Search in sources :

Example 1 with FormatPainterToolEntry

use of com.archimatetool.editor.diagram.tools.FormatPainterToolEntry in project archi by archimatetool.

the class CanvasEditorPalette method createControlsGroup.

/**
 * Create a Group of Controls
 */
private PaletteContainer createControlsGroup() {
    PaletteContainer group = new PaletteToolbar(Messages.CanvasEditorPalette_0);
    add(group);
    // The selection tool
    ToolEntry tool = new PanningSelectionToolEntry();
    tool.setToolClass(PanningSelectionExtendedTool.class);
    group.add(tool);
    // Use selection tool as default entry
    setDefaultEntry(tool);
    PaletteStack stack = createMarqueeSelectionStack();
    group.add(stack);
    // Format Painter
    formatPainterEntry = new FormatPainterToolEntry();
    group.add(formatPainterEntry);
    return group;
}
Also used : PaletteToolbar(org.eclipse.gef.palette.PaletteToolbar) FormatPainterToolEntry(com.archimatetool.editor.diagram.tools.FormatPainterToolEntry) PanningSelectionToolEntry(org.eclipse.gef.palette.PanningSelectionToolEntry) ToolEntry(org.eclipse.gef.palette.ToolEntry) FormatPainterToolEntry(com.archimatetool.editor.diagram.tools.FormatPainterToolEntry) ConnectionCreationToolEntry(org.eclipse.gef.palette.ConnectionCreationToolEntry) PanningSelectionToolEntry(org.eclipse.gef.palette.PanningSelectionToolEntry) PaletteContainer(org.eclipse.gef.palette.PaletteContainer) PaletteStack(org.eclipse.gef.palette.PaletteStack)

Example 2 with FormatPainterToolEntry

use of com.archimatetool.editor.diagram.tools.FormatPainterToolEntry in project archi by archimatetool.

the class ArchimateDiagramEditorPalette method createControlsGroup.

/**
 * Create a Group of Controls
 */
private void createControlsGroup() {
    PaletteContainer group = new PaletteToolbar(Messages.ArchimateDiagramEditorPalette_0);
    // The selection tool
    ToolEntry tool = new PanningSelectionToolEntry();
    tool.setToolClass(PanningSelectionExtendedTool.class);
    group.add(tool);
    // Use selection tool as default entry
    setDefaultEntry(tool);
    PaletteStack stack = createMarqueeSelectionStack();
    group.add(stack);
    // Format Painter
    formatPainterEntry = new FormatPainterToolEntry();
    group.add(formatPainterEntry);
    add(group);
    // Relations group will be inserted before this
    // $NON-NLS-1$
    add(new PaletteSeparator("relations"));
}
Also used : PaletteToolbar(org.eclipse.gef.palette.PaletteToolbar) PaletteSeparator(org.eclipse.gef.palette.PaletteSeparator) FormatPainterToolEntry(com.archimatetool.editor.diagram.tools.FormatPainterToolEntry) PanningSelectionToolEntry(org.eclipse.gef.palette.PanningSelectionToolEntry) ToolEntry(org.eclipse.gef.palette.ToolEntry) FormatPainterToolEntry(com.archimatetool.editor.diagram.tools.FormatPainterToolEntry) ConnectionCreationToolEntry(org.eclipse.gef.palette.ConnectionCreationToolEntry) PanningSelectionToolEntry(org.eclipse.gef.palette.PanningSelectionToolEntry) PaletteContainer(org.eclipse.gef.palette.PaletteContainer) PaletteStack(org.eclipse.gef.palette.PaletteStack)

Example 3 with FormatPainterToolEntry

use of com.archimatetool.editor.diagram.tools.FormatPainterToolEntry in project archi by archimatetool.

the class SketchEditorPalette method createControlsGroup.

/**
 * Create a Group of Controls
 */
private PaletteContainer createControlsGroup() {
    PaletteContainer group = new PaletteToolbar(Messages.SketchEditorPalette_0);
    add(group);
    // The selection tool
    ToolEntry tool = new PanningSelectionToolEntry();
    tool.setToolClass(PanningSelectionExtendedTool.class);
    group.add(tool);
    // Use selection tool as default entry
    setDefaultEntry(tool);
    PaletteStack stack = createMarqueeSelectionStack();
    group.add(stack);
    // Format Painter
    formatPainterEntry = new FormatPainterToolEntry();
    group.add(formatPainterEntry);
    return group;
}
Also used : PaletteToolbar(org.eclipse.gef.palette.PaletteToolbar) FormatPainterToolEntry(com.archimatetool.editor.diagram.tools.FormatPainterToolEntry) PanningSelectionToolEntry(org.eclipse.gef.palette.PanningSelectionToolEntry) ToolEntry(org.eclipse.gef.palette.ToolEntry) FormatPainterToolEntry(com.archimatetool.editor.diagram.tools.FormatPainterToolEntry) ConnectionCreationToolEntry(org.eclipse.gef.palette.ConnectionCreationToolEntry) PanningSelectionToolEntry(org.eclipse.gef.palette.PanningSelectionToolEntry) PaletteContainer(org.eclipse.gef.palette.PaletteContainer) PaletteStack(org.eclipse.gef.palette.PaletteStack)

Example 4 with FormatPainterToolEntry

use of com.archimatetool.editor.diagram.tools.FormatPainterToolEntry 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

FormatPainterToolEntry (com.archimatetool.editor.diagram.tools.FormatPainterToolEntry)4 ToolEntry (org.eclipse.gef.palette.ToolEntry)4 ConnectionCreationToolEntry (org.eclipse.gef.palette.ConnectionCreationToolEntry)3 PaletteContainer (org.eclipse.gef.palette.PaletteContainer)3 PaletteStack (org.eclipse.gef.palette.PaletteStack)3 PaletteToolbar (org.eclipse.gef.palette.PaletteToolbar)3 PanningSelectionToolEntry (org.eclipse.gef.palette.PanningSelectionToolEntry)3 Point (org.eclipse.draw2d.geometry.Point)1 TemplateTransferDragSourceListener (org.eclipse.gef.dnd.TemplateTransferDragSourceListener)1 PaletteListener (org.eclipse.gef.palette.PaletteListener)1 PaletteSeparator (org.eclipse.gef.palette.PaletteSeparator)1 CreationFactory (org.eclipse.gef.requests.CreationFactory)1 PaletteViewer (org.eclipse.gef.ui.palette.PaletteViewer)1 PaletteViewerPreferences (org.eclipse.gef.ui.palette.PaletteViewerPreferences)1 MouseAdapter (org.eclipse.swt.events.MouseAdapter)1 MouseEvent (org.eclipse.swt.events.MouseEvent)1 MouseTrackAdapter (org.eclipse.swt.events.MouseTrackAdapter)1