@Override public Hashtable<String, Object> getChoiceOfValues() { List<EObject> values = new ArrayList<EObject>(); // search for all Properties and DataStores // Properties are contained in the nearest enclosing Process or Event; // DataStores are contained in the DocumentRoot EObject container = ModelUtil.getContainer(object); Object p = owner.getProperty(UI_SHOW_ITEMS_IN_SCOPE); if (p instanceof Boolean && (Boolean) p) { values.addAll( ModelUtil.collectAncestorObjects( container, "properties", new Class[] {Activity.class})); // $NON-NLS-1$ values.addAll( ModelUtil.collectAncestorObjects( container, "properties", new Class[] {Process.class})); // $NON-NLS-1$ values.addAll( ModelUtil.collectAncestorObjects( container, "properties", new Class[] {Event.class})); // $NON-NLS-1$ values.addAll( ModelUtil.collectAncestorObjects( container, "dataStore", new Class[] {DocumentRoot.class})); // $NON-NLS-1$ values.addAll( ModelUtil.collectAncestorObjects( container, "flowElements", new Class[] {FlowElementsContainer.class}, new Class[] {ItemAwareElement.class})); // $NON-NLS-1$ } else { if (container instanceof Activity) { Activity activity = (Activity) container; if (object instanceof DataInputAssociation) { values.addAll(ModelUtil.getItemAwareElements(activity.getDataInputAssociations())); } else { values.addAll(ModelUtil.getItemAwareElements(activity.getDataOutputAssociations())); } } else if (container instanceof ThrowEvent) { ThrowEvent event = (ThrowEvent) container; values.addAll(ModelUtil.getItemAwareElements(event.getDataInputAssociation())); } else if (container instanceof CatchEvent) { CatchEvent event = (CatchEvent) container; values.addAll(ModelUtil.getItemAwareElements(event.getDataOutputAssociation())); } } super.setChoiceOfValues(values); return super.getChoiceOfValues(); }
@Override protected void hook( Activity activity, ContainerShape container, IAddContext context, int width, int height) { super.hook(activity, container, context, width, height); Graphiti.getPeService().setPropertyValue(container, TRIGGERED_BY_EVENT, "false"); IPeService peService = Graphiti.getPeService(); IGaService gaService = Graphiti.getGaService(); Shape textShape = peService.createShape(container, false); Text text = gaService.createDefaultText(textShape, activity.getName()); gaService.setLocationAndSize(text, 5, 5, width - 10, 15); text.setStyle(StyleUtil.getStyleForText(getDiagram())); text.setHorizontalAlignment(Orientation.ALIGNMENT_CENTER); text.setVerticalAlignment(Orientation.ALIGNMENT_CENTER); text.getFont().setBold(true); link(textShape, activity); }