/* * (non-Javadoc) * @see org.eclipse.sapphire.ui.SapphireActionHandlerFactory#create() */ @Override public List<SapphireActionHandler> create() { List<SapphireActionHandler> listOfHandlers = new ArrayList<SapphireActionHandler>(); for (int i = 0; i < this.modelProperties.length; i++) { String modelProperty = this.modelProperties[i]; if (modelProperty != null && "Portlets".equalsIgnoreCase(modelProperty) && isPartInLiferayProject()) { SapphireActionHandler handler = new CreateLiferayPortletActionHandler(); handler.init(this.getAction(), null); handler.addImage(IPortlet.TYPE.image()); handler.setLabel(getActionLabel("Portlets")); listOfHandlers.add(handler); } else { listOfHandlers.add(new Handler(modelProperty)); } } // System.out.println( "QuickActionsHandlerFactory.created" + listOfHandlers.size() + " handlers // " ); return listOfHandlers; }
@Override public void init(SapphireAction action, ISapphireActionHandlerDef def) { super.init(action, def); final IModelElement rootModel = action.getPart().getModelElement(); final ModelProperty modelProperty = rootModel.getModelElementType().getProperty(this.strModelProperty); String labelText = modelProperty.getLabel(false, CapitalizationType.FIRST_WORD_ONLY, true); String actionLabel = getActionLabel(labelText); setLabel(actionLabel); ModelElementType propModelElementType = modelProperty.getType(); addImage(propModelElementType.image()); }
@Override public void init(SapphireAction action, ActionHandlerDef def) { super.init(action, def); SapphireDiagramEditorPagePart part = (SapphireDiagramEditorPagePart) getPart(); part.attach( new Listener() { @Override public void handle(final Event e) { if (e instanceof SelectionChangedEvent) { broadcast(new EnablementChangedEvent()); refreshConnectionPartsListener(); } } }); refreshConnectionPartsListener(); }
@Override public boolean check(SapphireActionHandler handler) { return !(handler.getId().contains("Sapphire.Create.Java")); // $NON-NLS-1$ }