| @namespace(uri="http://www.eclipse.org/gmf/2005/ToolDefinition", prefix="gmftool") |
| package tooldef; |
| |
| ///////////////// |
| // Root container |
| // |
| |
| class ToolRegistry { |
| @genmodel(documentation="Instead of placing common actions somewhere in menu hierarchy and referencing them in (2..n) cases, keep them in this central registry and use ItemRef everywhere (i.e. in 1..n cases)") |
| val MenuAction[*] sharedActions; |
| val Menu[*] allMenus; |
| val Palette[?] palette; |
| } |
| |
| ////////// |
| // Palette |
| // |
| |
| abstract class AbstractTool { |
| val Image smallIcon; |
| val Image largeIcon; |
| attr String title; |
| attr String description; |
| } |
| |
| abstract class ToolContainer extends AbstractTool { |
| // TODO opposite ref |
| ordered val AbstractTool[*] tools; |
| } |
| |
| class PaletteSeparator extends AbstractTool { |
| } |
| |
| class ToolGroup extends ToolContainer { |
| attr boolean collapsible; |
| attr boolean stack; |
| ref AbstractTool[?] active; |
| } |
| |
| class Palette extends ToolContainer { |
| ref AbstractTool[?] default; |
| } |
| |
| @genmodel(documentation="predefined, like zoom or marquee") |
| class StandardTool extends AbstractTool { |
| //attr String identifier; |
| attr StandardToolKind toolKind; |
| } |
| |
| enum StandardToolKind { |
| SELECT; |
| SELECT_PAN; |
| MARQUEE; |
| ZOOM_PAN; |
| ZOOM_IN; |
| ZOOM_OUT; |
| } |
| |
| class CreationTool extends AbstractTool { |
| } |
| |
| class GenericTool extends AbstractTool { |
| attr String[1] toolClass; |
| } |
| |
| ///////////////////// |
| // Menus and toolbars |
| // |
| |
| abstract interface ItemBase { |
| } |
| |
| abstract class Menu { |
| ordered val ItemBase[*] items; |
| } |
| |
| class Separator extends ItemBase { |
| attr String name; |
| } |
| |
| class PredefinedItem extends ItemBase { |
| attr String identifier; |
| } |
| |
| class PredefinedMenu extends Menu, PredefinedItem { |
| } |
| |
| abstract interface ContributionItem extends ItemBase { |
| val Image icon; |
| attr String title; |
| } |
| |
| class MenuAction extends ContributionItem { |
| attr ActionKind kind; |
| attr String hotKey; |
| } |
| |
| class ItemRef extends ItemBase { |
| // constraints: self.item not instanceof Separator? |
| ref ItemBase[1] item; |
| } |
| |
| class ContextMenu extends Menu { |
| // constraint: isUndefined(default) or super.items.contains(default) |
| // FIXME - what if default should be itemRef? int (=position) instead? |
| ref MenuAction[?] default; |
| } |
| |
| class PopupMenu extends Menu, ContributionItem { |
| id attr String iD; |
| } |
| |
| @genmodel(documentation="no default action and no id, just a collection of items") |
| class MainMenu extends Menu { |
| attr String title; |
| } |
| |
| class Toolbar extends Menu { |
| } |
| |
| /////////////// |
| // Action kinds |
| // |
| |
| enum ActionKind { |
| CREATE; |
| PROPCHANGE; // detailsLevel, isVisible, modifier |
| MODIFY; |
| PROCESS; // READ? |
| CUSTOM = 99; |
| } |
| |
| |
| //class OutlineView { |
| // attr boolean dontneedthat; |
| //} |
| |
| ///////// |
| // Images |
| // |
| |
| abstract interface Image { |
| } |
| |
| @genmodel(documentation="Delegate to EMF.Edit providers") |
| class DefaultImage extends Image { |
| } |
| |
| @genmodel(documentation="Image bundled as part of distribution") |
| class BundleImage extends Image { |
| @genmodel(documentation="Relative path to image") |
| attr String path; |
| @genmodel(documentation="Empty value means image path is relative to generated bundle") |
| attr String bundle; |
| } |
| |
| ///////////////////////////// |
| // Customizing Property Sheet |
| // |
| |
| abstract interface StyleSelector { |
| op boolean isOk(Object style); |
| } |
| |
| class GenericStyleSelector extends StyleSelector { |
| attr AppearanceStyle[+] values; |
| } |
| |
| enum AppearanceStyle { |
| Font; |
| Fill; |
| Line; |
| } |