@Override protected CreationFactory getFactory(Object template) { if (template instanceof Element) { //how this happened??? return new TitaniumUIElementFactory( (Class<? extends Element>) template.getClass(), diagram); } else if (template instanceof Class){ if (Element.class.isAssignableFrom((Class<?>) template)){ return new TitaniumUIElementFactory( (Class<? extends Element>) template, diagram); } } throw new IllegalArgumentException("Can't create factory for " + template); }
/** * This function is called to return a factory for our create request. A factory is returned depending on the state of the tool. * * (non-Javadoc) * * @see org.eclipse.gef.tools.CreationTool#getFactory() */ protected CreationFactory getFactory() { ModelCreationFactory factory; switch (state) { case ENDPOINT: factory = new ModelCreationFactory(getURNspec(), EndPoint.class); break; case STARTPOINT: factory = new ModelCreationFactory(getURNspec(), StartPoint.class); break; case NOSELECT: factory = new ModelCreationFactory(getURNspec(), StartPoint.class); break; case CONNECTION: factory = new ModelCreationFactory(getURNspec(), EmptyPoint.class); break; default: factory = new ModelCreationFactory(getURNspec(), StartPoint.class); } return factory; }
/** * Create a transfer drop target listener. When using a * CombinedTemplateCreationEntry tool in the palette, this will enable model * element creation by dragging from the palette. * * @see #createPaletteViewerProvider() */ public TransferDropTargetListener createTransferDropTargetListener() { return new TemplateTransferDropTargetListener(getGraphicalViewer()) { @Override protected CreationFactory getFactory(Object template) { return new SimpleFactory((Class) template); } }; }
private TransferDropTargetListener createTransferDropTargetListener() { return new TemplateTransferDropTargetListener(getGraphicalViewer()) { protected CreationFactory getFactory(Object template) { return new SimpleFactory((Class<?>) template); } }; }
/** * @see org.eclipse.gef.tools.AbstractTool#applyProperty(java.lang.Object, * java.lang.Object) */ protected void applyProperty(Object key, Object value) { if (PROPERTY_CREATION_FACTORY.equals(key)) { if (value instanceof CreationFactory) setFactory((CreationFactory) value); return; } super.applyProperty(key, value); }
protected void applyProperty(Object key, Object value) { if (CreationTool.PROPERTY_CREATION_FACTORY.equals(key)) { if (value instanceof CreationFactory) setFactory((CreationFactory) value); return; } super.applyProperty(key, value); }
@Override public void setFactory(CreationFactory factory) { if(factory instanceof InstallOptionsTemplateCreationFactory) { super.setFactory(factory); } }
public PaletteEntryCreationTool( CreationFactory factory, PaletteEntryExtension paletteEntry ) { super( factory, null ); this.factory = factory; setFactory( factory ); this.paletteEntry = paletteEntry; }
protected CreationFactory getFactory( Object template ) { if ( handleValidateDrag( template ) ) { if ( template instanceof String ) { return new ReportElementFactory( template ); } return new ReportElementFactory( getSingleTransferData( template ), template ); } return null; }
/** * Constructor * * @param factory * @param preHandle */ public ReportCreationTool( CreationFactory factory, AbstractToolHandleExtends preHandle ) { super( factory ); this.preHandle = preHandle; }
public CreationFactory getFactory(Object template) { setEnablementDeterminedByCommand(true); if (template instanceof CreationFactory) return (CreationFactory) template; else return new ModelCreationFactory(urn, (Class) template); }
/** * Create a transfer drop target listener. When using a * CombinedTemplateCreationEntry tool in the palette, this will enable model * element creation by dragging from the palette. * * @see #createPaletteViewerProvider() */ private TransferDropTargetListener createTransferDropTargetListener() { return new TemplateTransferDropTargetListener(getGraphicalViewer()) { protected CreationFactory getFactory(Object template) { return new SimpleFactory((Class) template); } }; }
/** * @param factory */ public ConnectionCreationToolWithAdditionalInformation(CreationFactory factory) { super(factory); }
/** * @param factory */ public LifeLineCreationToolWithAdditionalInformation(CreationFactory factory) { super(factory); }
public JDCreationTool(CreationFactory aFactory) { super(aFactory); }
@Override protected CreationFactory getFactory(Object template) { return new JDPaletteCreationFactory(template); }
public CreationConstraintToolEntry(String label, String shortDesc, CreationFactory factory, ImageDescriptor iconSmall, ImageDescriptor iconLarge, int typeValue) { super(label, shortDesc, factory, iconSmall, iconLarge); this.typeValue = typeValue; }
public QuickToolsCombinedTemplateCreationEntry(String label, String shortDesc, Object template, CreationFactory factory, ImageDescriptor iconSmall, ImageDescriptor iconLarge) { super(label, shortDesc,template, factory, iconSmall, iconLarge); }
protected CreationFactory getFactory(Object template) { return new ElementFactory(template); }
/** * */ public URNElementCreationTool(CreationFactory factory) { super(factory); setUnloadWhenFinished(false); }
public BaseCreationTool(CreationFactory factory) { super(factory); }
public BaseConnectionCreationToolEntry(String label, String shortDesc, CreationFactory factory, ImageDescriptor iconSmall, ImageDescriptor iconLarge) { super(label, shortDesc, factory, iconSmall, iconLarge); }
public Tool createTool() { return new BaseConnectionCreationTool((CreationFactory)getToolProperty(CreationTool.PROPERTY_CREATION_FACTORY)); }
public BaseConnectionCreationTool(CreationFactory factory) { super(factory); }
public URNElementCreationEntry(String label, String shortDesc, Object template, CreationFactory factory, ImageDescriptor iconSmall, ImageDescriptor iconLarge) { super(label, shortDesc, template, /* factory */null, iconSmall, iconLarge); myFactory = factory; }
public void setFactory(CreationFactory factory) { this.myFactory = factory; }
/** * Constructor for CreationToolEntry. * * @param label * the label * @param shortDesc * the description * @param factory * the CreationFactory * @param iconSmall * the small icon * @param iconLarge * the large icon */ public CreationToolEntry(String label, String shortDesc, CreationFactory factory, ImageDescriptor iconSmall, ImageDescriptor iconLarge) { super(label, shortDesc, iconSmall, iconLarge, CreationTool.class); this.factory = factory; setToolProperty(CreationTool.PROPERTY_CREATION_FACTORY, factory); }
/** * Constructor for ConnectionCreationToolEntry. * * @param label * the label * @param shortDesc * the description * @param factory * the CreationFactory * @param iconSmall * the small icon * @param iconLarge * the large icon */ public ConnectionCreationToolEntry(String label, String shortDesc, CreationFactory factory, ImageDescriptor iconSmall, ImageDescriptor iconLarge) { super(label, shortDesc, factory, iconSmall, iconLarge); setToolClass(ConnectionCreationTool.class); setUserModificationPermission(PERMISSION_NO_MODIFICATION); }
/** * Constructs an entry with the given creation factory and template. The * creation factory is used by the creation tool when the entry is selected. * The template is used with the * {@link org.eclipse.gef.dnd.TemplateTransferDragSourceListener}. * * @since 3.2 * @param label * the label * @param shortDesc * the descriptoin * @param template * the template object * @param factory * the CreationFactory * @param iconSmall * the small icon * @param iconLarge * the large icon */ public CombinedTemplateCreationEntry(String label, String shortDesc, Object template, CreationFactory factory, ImageDescriptor iconSmall, ImageDescriptor iconLarge) { super(label, shortDesc, factory, iconSmall, iconLarge); setTemplate(template); }
/** * Returns the appropriate Factory object to be used for the specified * template. This Factory is used on the CreateRequest that is sent to the * target EditPart. * * @param template * the template Object * @return a Factory */ protected CreationFactory getFactory(Object template) { if (template instanceof CreationFactory) { return ((CreationFactory) template); } else if (template instanceof Class) { return new SimpleFactory((Class) template); } else return null; }
/** * Constructor. * * @param label * @param shortDesc * @param template * @param factory * @param iconSmall * @param iconLarge */ public ReportCombinedTemplateCreationEntry( String label, String shortDesc, Object template, CreationFactory factory, ImageDescriptor iconSmall, ImageDescriptor iconLarge, AbstractToolHandleExtends preHandle ) { super( label, shortDesc, template, factory, iconSmall, iconLarge ); this.preHandle = preHandle; }
/** * Sets the creation factory. * * @param creationFactory * the new creation factory */ public void setCreationFactory(CreationFactory creationFactory) { this.creationFactory = creationFactory; }
/** * Constructs an entry with the given creation factory. The creation factory * is also used as the template object. * * @param label * the label * @param shortDesc * the description * @param factory * the creation factory and template * @param iconSmall * the small icon * @param iconLarge * the large icon * @since 3.2 */ public CombinedTemplateCreationEntry(String label, String shortDesc, CreationFactory factory, ImageDescriptor iconSmall, ImageDescriptor iconLarge) { this(label, shortDesc, factory, factory, iconSmall, iconLarge); }
/** * Constructs a new ConnectionDragCreationTool with the given factory. * * @param factory * the creation factory */ public ConnectionDragCreationTool(CreationFactory factory) { setFactory(factory); }
/** * Constructs a new CreationTool with the given factory. * * @param aFactory * the creation factory */ public CreationTool(CreationFactory aFactory) { this(); setFactory(aFactory); }
/** * Returns the creation factory used to create the new EditParts. * * @return the creation factory */ protected CreationFactory getFactory() { return factory; }
/** * Sets the creation factory used to create the new edit parts. * * @param factory * the factory */ public void setFactory(CreationFactory factory) { this.factory = factory; }