@Override protected void fillPopupBarDescriptors() { super.fillPopupBarDescriptors(); AbstractPopupBarTool tool = null; ImageDescriptor imageDescriptor = null; Image image = null; tool = new XXXPopupBarTool(getHost(), null); imageDescriptor = Activator.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "/icons/tool.gif"); image = imageDescriptor.createImage(); addPopupBarDescriptor(null, image, tool, "ToolTip"); }
public XXXPopupBarTool(EditPart epHost, CreateRequest theRequest) { super(epHost, theRequest); } @Override protected Request createTargetRequest() { return new RequestForThisTool(); } @Override protected Command getCommand() { return new CommandForThisTool(); }
/** * @generated */ protected void createDefaultEditPolicies() { //Generated code before... removeEditPolicy(EditPolicyRoles.POPUPBAR_ROLE); installEditPolicy(EditPolicyRoles.POPUPBAR_ROLE, new YourPopupBarEditPolicy()); }
imageDescriptor = Activator.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "/icons/tool.gif");
imageDescriptor = AbstractUIPlugin.imageDescriptorFromPlugin(Activator.PI_APP, "open.gif");
public IntrospectPopupBarTool(EditPart epHost, CreateRequest theRequest) { super(epHost, theRequest); } @Override protected Request createTargetRequest() { ChangePropertyValueRequest req = new ChangePropertyValueRequest("XXXX", "XXX"); return req; } @Override protected Command getCommand() { return new XXXCommand((IGraphicalEditPart)getHost()); }
private IGraphicalEditPart host = null; /** * * @param host Element to introspect */ public IntrospectCommand(IGraphicalEditPart host){ this.host = host; } @Override public void execute() { super.execute(); Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); MessageBox m = new MessageBox(shell); m.setMessage("Hello World"); m.open(); }
List types = Collections.singletonList(ActivityElementTypes.Action_2001); CreateUnspecifiedTypeRequest gefRequest = new CreateUnspecifiedTypeRequest(types, PreferencesHint.USE_DEFAULTS); gefRequest.setLocation(...); gefRequest.setSize(...); EditPart containerEP = .... //find EP that should host the new element, DiagramEditPart for top-level elements. Command gefCommand = containerEP.getCommand(gefRequest); if (gefCommand.canExecute()) { //execute }