Search in sources :

Example 1 with PaletteViewer

use of org.eclipse.gef.ui.palette.PaletteViewer in project tdi-studio-se by Talend.

the class TalendSliderPaletteEditPart method registerVisuals.

/**
     * @see org.eclipse.gef.editparts.AbstractGraphicalEditPart#registerVisuals()
     */
@Override
protected void registerVisuals() {
    super.registerVisuals();
    controller = new PaletteAnimator(((PaletteViewer) getViewer()).getPaletteViewerPreferences());
    getViewer().getEditPartRegistry().put(PaletteAnimator.class, controller);
    ToolbarLayout layout = new PaletteToolbarLayout();
    getFigure().setLayoutManager(layout);
    getFigure().addLayoutListener(controller);
}
Also used : ToolbarLayout(org.eclipse.draw2d.ToolbarLayout) PaletteToolbarLayout(org.eclipse.gef.ui.palette.editparts.PaletteToolbarLayout) PaletteViewer(org.eclipse.gef.ui.palette.PaletteViewer) PaletteAnimator(org.eclipse.gef.ui.palette.editparts.PaletteAnimator) PaletteToolbarLayout(org.eclipse.gef.ui.palette.editparts.PaletteToolbarLayout)

Example 2 with PaletteViewer

use of org.eclipse.gef.ui.palette.PaletteViewer in project tdi-studio-se by Talend.

the class AbstractTalendEditor method selectPaletteEntry.

public void selectPaletteEntry(String componentName) {
    PaletteViewer paletteViewer = getPaletteViewerProvider().getEditDomain().getPaletteViewer();
    if (paletteViewer == null) {
        return;
    }
    PaletteRoot root = getPaletteRoot();
    RootEditPart part = paletteViewer.getRootEditPart();
    if (part != null) {
        collapsePalette(part.getChildren());
    }
    if (root != null) {
        selectPaletteEntry(componentName, paletteViewer, root.getChildren());
    }
}
Also used : PaletteRoot(org.eclipse.gef.palette.PaletteRoot) TalendPaletteViewer(org.talend.designer.core.ui.editor.palette.TalendPaletteViewer) PaletteViewer(org.eclipse.gef.ui.palette.PaletteViewer) RootEditPart(org.eclipse.gef.RootEditPart) ScalableFreeformRootEditPart(org.eclipse.gef.editparts.ScalableFreeformRootEditPart)

Example 3 with PaletteViewer

use of org.eclipse.gef.ui.palette.PaletteViewer in project cubrid-manager by CUBRID.

the class ReplicationEditor method createPaletteViewerProvider.

/**
	 * @see org.eclipse.gef.ui.parts.GraphicalEditorWithFlyoutPalette#createPaletteViewerProvider()
	 * @return the palette provider
	 */
protected PaletteViewerProvider createPaletteViewerProvider() {
    return new PaletteViewerProvider(getEditDomain()) {

        protected void configurePaletteViewer(PaletteViewer viewer) {
            super.configurePaletteViewer(viewer);
            viewer.addDragSourceListener(new TemplateTransferDragSourceListener(viewer));
        }
    };
}
Also used : PaletteViewer(org.eclipse.gef.ui.palette.PaletteViewer) PaletteViewerProvider(org.eclipse.gef.ui.palette.PaletteViewerProvider) TemplateTransferDragSourceListener(org.eclipse.gef.dnd.TemplateTransferDragSourceListener)

Example 4 with PaletteViewer

use of org.eclipse.gef.ui.palette.PaletteViewer in project yamcs-studio by yamcs.

the class OPIEditor method createPaletteViewerProvider.

@Override
protected PaletteViewerProvider createPaletteViewerProvider() {
    return new PaletteViewerProvider(getEditDomain()) {

        @Override
        protected void configurePaletteViewer(PaletteViewer viewer) {
            super.configurePaletteViewer(viewer);
            // create a drag source listener for this palette viewer
            // together with an appropriate transfer drop target listener, this will enable
            // model element creation by dragging a CombinatedTemplateCreationEntries
            // from the palette into the editor
            // @see ShapesEditor#createTransferDropTargetListener()
            viewer.addDragSourceListener(new TemplateTransferDragSourceListener(viewer));
        }
    };
}
Also used : PaletteViewer(org.eclipse.gef.ui.palette.PaletteViewer) PaletteViewerProvider(org.eclipse.gef.ui.palette.PaletteViewerProvider) TemplateTransferDragSourceListener(org.eclipse.gef.dnd.TemplateTransferDragSourceListener)

Example 5 with PaletteViewer

use of org.eclipse.gef.ui.palette.PaletteViewer in project archi by archimatetool.

the class AbstractDiagramEditor method configurePaletteViewer.

/**
 * Configure the Palette Viewer
 */
protected void configurePaletteViewer(final PaletteViewer viewer) {
    PaletteViewerPreferences prefs = viewer.getPaletteViewerPreferences();
    // First time use so set to icons layout
    if (!InternalGEFPlugin.getDefault().getPreferenceStore().getBoolean("com.archimatetool.paletteSet")) {
        // $NON-NLS-1$
        // $NON-NLS-1$
        InternalGEFPlugin.getDefault().getPreferenceStore().setValue("com.archimatetool.paletteSet", true);
        prefs.setLayoutSetting(PaletteViewerPreferences.LAYOUT_ICONS);
        prefs.setCurrentUseLargeIcons(false);
    }
    // Register as drag source to drag onto the canvas
    viewer.addDragSourceListener(new TemplateTransferDragSourceListener(viewer));
    /*
         * Tool Changed
         */
    viewer.addPaletteListener(new PaletteListener() {

        @Override
        public void activeToolChanged(PaletteViewer palette, ToolEntry toolEntry) {
            CreationFactory factory = (CreationFactory) toolEntry.getToolProperty(CreationTool.PROPERTY_CREATION_FACTORY);
            if (factory != null) {
                ComponentSelectionManager.INSTANCE.fireSelectionEvent(toolEntry, factory.getObjectType());
            }
        }
    });
    /*
         * Mouse Hover
         */
    viewer.getControl().addMouseTrackListener(new MouseTrackAdapter() {

        @Override
        public void mouseHover(MouseEvent e) {
            ToolEntry toolEntry = findToolEntryAt(viewer, new Point(e.x, e.y));
            if (toolEntry != null) {
                CreationFactory factory = (CreationFactory) toolEntry.getToolProperty(CreationTool.PROPERTY_CREATION_FACTORY);
                if (factory != null) {
                    ComponentSelectionManager.INSTANCE.fireSelectionEvent(toolEntry, factory.getObjectType());
                }
            }
        }
    });
    viewer.getControl().addMouseListener(new MouseAdapter() {

        /*
             * If Shift key is pressed set Tool Entry to unload or not
             */
        @Override
        public void mouseDown(MouseEvent e) {
            ToolEntry toolEntry = findToolEntryAt(viewer, new Point(e.x, e.y));
            if (toolEntry != null) {
                boolean shiftKey = (e.stateMask & SWT.SHIFT) != 0;
                toolEntry.setToolProperty(AbstractTool.PROPERTY_UNLOAD_WHEN_FINISHED, !shiftKey);
            }
        }

        /*
             * Double-click on Format Painter
             */
        @Override
        public void mouseDoubleClick(MouseEvent e) {
            ToolEntry toolEntry = findToolEntryAt(viewer, new Point(e.x, e.y));
            if (toolEntry instanceof FormatPainterToolEntry) {
                FormatPainterInfo.INSTANCE.reset();
            }
        }
    });
}
Also used : PaletteViewer(org.eclipse.gef.ui.palette.PaletteViewer) MouseEvent(org.eclipse.swt.events.MouseEvent) FormatPainterToolEntry(com.archimatetool.editor.diagram.tools.FormatPainterToolEntry) CreationFactory(org.eclipse.gef.requests.CreationFactory) MouseTrackAdapter(org.eclipse.swt.events.MouseTrackAdapter) MouseAdapter(org.eclipse.swt.events.MouseAdapter) PaletteViewerPreferences(org.eclipse.gef.ui.palette.PaletteViewerPreferences) PaletteListener(org.eclipse.gef.palette.PaletteListener) TemplateTransferDragSourceListener(org.eclipse.gef.dnd.TemplateTransferDragSourceListener) Point(org.eclipse.draw2d.geometry.Point) ToolEntry(org.eclipse.gef.palette.ToolEntry) FormatPainterToolEntry(com.archimatetool.editor.diagram.tools.FormatPainterToolEntry)

Aggregations

PaletteViewer (org.eclipse.gef.ui.palette.PaletteViewer)6 TemplateTransferDragSourceListener (org.eclipse.gef.dnd.TemplateTransferDragSourceListener)4 PaletteViewerProvider (org.eclipse.gef.ui.palette.PaletteViewerProvider)3 FormatPainterToolEntry (com.archimatetool.editor.diagram.tools.FormatPainterToolEntry)1 ToolbarLayout (org.eclipse.draw2d.ToolbarLayout)1 Point (org.eclipse.draw2d.geometry.Point)1 RootEditPart (org.eclipse.gef.RootEditPart)1 ScalableFreeformRootEditPart (org.eclipse.gef.editparts.ScalableFreeformRootEditPart)1 PaletteListener (org.eclipse.gef.palette.PaletteListener)1 PaletteRoot (org.eclipse.gef.palette.PaletteRoot)1 ToolEntry (org.eclipse.gef.palette.ToolEntry)1 CreationFactory (org.eclipse.gef.requests.CreationFactory)1 PaletteViewerPreferences (org.eclipse.gef.ui.palette.PaletteViewerPreferences)1 PaletteAnimator (org.eclipse.gef.ui.palette.editparts.PaletteAnimator)1 PaletteToolbarLayout (org.eclipse.gef.ui.palette.editparts.PaletteToolbarLayout)1 MouseAdapter (org.eclipse.swt.events.MouseAdapter)1 MouseEvent (org.eclipse.swt.events.MouseEvent)1 MouseTrackAdapter (org.eclipse.swt.events.MouseTrackAdapter)1 TalendPaletteViewer (org.talend.designer.core.ui.editor.palette.TalendPaletteViewer)1