Search in sources :

Example 6 with CreationFactory

use of org.eclipse.gef.requests.CreationFactory in project dbeaver by serge-rider.

the class NodeDropTargetListener method createTargetRequest.

@Override
protected Request createTargetRequest() {
    CreateRequest request = new CreateRequest();
    request.setFactory(new CreationFactory() {

        @Override
        public Object getNewObject() {
            Collection<DBPNamedObject> objects = DatabaseObjectTransfer.getInstance().getObject();
            if (objects == null) {
                return null;
            }
            return DiagramObjectCollector.generateEntityList(((DiagramPart) getViewer().getRootEditPart().getContents()).getDiagram(), objects);
        }

        @Override
        public Object getObjectType() {
            return RequestConstants.REQ_CREATE;
        }
    });
    request.setLocation(getDropLocation());
    return request;
}
Also used : CreateRequest(org.eclipse.gef.requests.CreateRequest) CreationFactory(org.eclipse.gef.requests.CreationFactory) Collection(java.util.Collection) DBPNamedObject(org.jkiss.dbeaver.model.DBPNamedObject) DiagramPart(org.jkiss.dbeaver.ext.erd.part.DiagramPart)

Example 7 with CreationFactory

use of org.eclipse.gef.requests.CreationFactory in project tdi-studio-se by Talend.

the class ComponentChooseDialog method createTargetRequest.

@Override
protected Request createTargetRequest() {
    fromPalette = false;
    CreateRequest request = new CreateRequest();
    CreationFactory factory = getFactory(LocalSelectionTransfer.getTransfer().getSelection());
    if (factory != null) {
        fromPalette = true;
        request.setFactory(factory);
        return request;
    }
    return super.createTargetRequest();
}
Also used : CreateRequest(org.eclipse.gef.requests.CreateRequest) CreationFactory(org.eclipse.gef.requests.CreationFactory)

Aggregations

CreationFactory (org.eclipse.gef.requests.CreationFactory)7 ArrayList (java.util.ArrayList)2 List (java.util.List)2 Point (org.eclipse.draw2d.geometry.Point)2 CreateRequest (org.eclipse.gef.requests.CreateRequest)2 Canvas (org.eclipse.swt.widgets.Canvas)2 Event (org.eclipse.swt.widgets.Event)2 DBPNamedObject (org.jkiss.dbeaver.model.DBPNamedObject)2 Node (org.talend.designer.core.ui.editor.nodes.Node)2 Collection (java.util.Collection)1 PaletteEntry (org.eclipse.gef.palette.PaletteEntry)1 ImageDescriptor (org.eclipse.jface.resource.ImageDescriptor)1 ERDNote (org.jkiss.dbeaver.ext.erd.model.ERDNote)1 DiagramPart (org.jkiss.dbeaver.ext.erd.part.DiagramPart)1 IComponent (org.talend.core.model.components.IComponent)1 IMetadataTable (org.talend.core.model.metadata.IMetadataTable)1 TalendCreationToolEntry (org.talend.core.ui.component.TalendCreationToolEntry)1 DummyComponent (org.talend.designer.core.model.components.DummyComponent)1 TalendCreateConnectionTool (org.talend.designer.core.ui.action.TalendCreateConnectionTool)1 PaletteComponentFactory (org.talend.designer.core.ui.editor.PaletteComponentFactory)1