Search in sources :

Example 11 with PaletteEntry

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

the class TalendEntryEditPart method getChildLevel.

protected int getChildLevel() {
    PaletteEntry entry = (PaletteEntry) getModel();
    int i = 0;
    while ((entry = entry.getParent()) != null) {
        ++i;
    }
    return i;
}
Also used : PaletteEntry(org.eclipse.gef.palette.PaletteEntry)

Example 12 with PaletteEntry

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

the class CanvasEditorPalette method createElementsGroup.

private PaletteContainer createElementsGroup() {
    PaletteContainer group = new PaletteGroup(Messages.CanvasEditorPalette_1);
    add(group);
    PaletteEntry entry = new CombinedTemplateCreationEntry(Messages.CanvasEditorPalette_2, null, new CanvasModelFactory(ICanvasPackage.eINSTANCE.getCanvasModelBlock()), ICanvasImages.ImageFactory.getImageDescriptor(ICanvasImages.ICON_CANVAS_BLOCK), ICanvasImages.ImageFactory.getImageDescriptor(ICanvasImages.ICON_CANVAS_BLOCK));
    group.add(entry);
    entry = new CombinedTemplateCreationEntry(Messages.CanvasEditorPalette_3, null, new CanvasModelFactory(ICanvasPackage.eINSTANCE.getCanvasModelImage()), IArchiImages.ImageFactory.getImageDescriptor(IArchiImages.ICON_LANDSCAPE), IArchiImages.ImageFactory.getImageDescriptor(IArchiImages.ICON_LANDSCAPE));
    group.add(entry);
    entry = createConnectionCreationToolEntry(ICanvasPackage.eINSTANCE.getCanvasModelConnection(), IDiagramModelConnection.LINE_SOLID, Messages.CanvasEditorPalette_4, null, IArchiImages.ImageFactory.getImageDescriptor(IArchiImages.ICON_CONNECTION_PLAIN));
    group.add(entry);
    entry = createConnectionCreationToolEntry(ICanvasPackage.eINSTANCE.getCanvasModelConnection(), IDiagramModelConnection.ARROW_FILL_TARGET, Messages.CanvasEditorPalette_5, null, IArchiImages.ImageFactory.getImageDescriptor(IArchiImages.ICON_CONNECTION_ARROW));
    group.add(entry);
    entry = createConnectionCreationToolEntry(ICanvasPackage.eINSTANCE.getCanvasModelConnection(), IDiagramModelConnection.ARROW_FILL_TARGET | IDiagramModelConnection.LINE_DASHED, Messages.CanvasEditorPalette_6, null, IArchiImages.ImageFactory.getImageDescriptor(IArchiImages.ICON_CONNECTION_DASHED_ARROW));
    group.add(entry);
    entry = createConnectionCreationToolEntry(ICanvasPackage.eINSTANCE.getCanvasModelConnection(), IDiagramModelConnection.ARROW_FILL_TARGET | IDiagramModelConnection.LINE_DOTTED, Messages.CanvasEditorPalette_7, null, IArchiImages.ImageFactory.getImageDescriptor(IArchiImages.ICON_CONNECTION_DOTTED_ARROW));
    group.add(entry);
    return group;
}
Also used : PaletteEntry(org.eclipse.gef.palette.PaletteEntry) PaletteGroup(org.eclipse.gef.palette.PaletteGroup) CombinedTemplateCreationEntry(org.eclipse.gef.palette.CombinedTemplateCreationEntry) PaletteContainer(org.eclipse.gef.palette.PaletteContainer)

Example 13 with PaletteEntry

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

the class SketchEditorPalette method createElementsGroup.

private PaletteContainer createElementsGroup() {
    PaletteContainer group = new PaletteGroup(Messages.SketchEditorPalette_1);
    add(group);
    // Actor
    PaletteEntry groupEntry = createCombinedTemplateCreationEntry(IArchimatePackage.eINSTANCE.getSketchModelActor(), Messages.SketchEditorPalette_2, Messages.SketchEditorPalette_3);
    group.add(groupEntry);
    // Group
    groupEntry = createCombinedTemplateCreationEntry(IArchimatePackage.eINSTANCE.getDiagramModelGroup(), Messages.SketchEditorPalette_4, Messages.SketchEditorPalette_5);
    group.add(groupEntry);
    return group;
}
Also used : PaletteEntry(org.eclipse.gef.palette.PaletteEntry) PaletteGroup(org.eclipse.gef.palette.PaletteGroup) PaletteContainer(org.eclipse.gef.palette.PaletteContainer)

Example 14 with PaletteEntry

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

the class ArchimateDiagramEditorPalette method setViewpoint.

/**
 * Update the Palette depending on the Viewpoint
 * @param viewpoint
 */
public void setViewpoint(IViewpoint viewpoint) {
    fViewpoint = viewpoint;
    // Remove 'em all
    for (PaletteEntry entry : fEntries) {
        remove(entry);
    }
    // Re-Create Archimate Relations Group
    createArchimateRelationsGroup();
    // Re-Create Archimate Groups
    createArchimateElementGroups();
}
Also used : PaletteEntry(org.eclipse.gef.palette.PaletteEntry)

Example 15 with PaletteEntry

use of org.eclipse.gef.palette.PaletteEntry in project liferay-ide by liferay.

the class SnippetsUtil method importSnippetsFromFile.

@SuppressWarnings("rawtypes")
public static void importSnippetsFromFile(File snippetFile) throws FileNotFoundException {
    if ((snippetFile == null) || !snippetFile.exists() || !snippetFile.isFile()) {
        return;
    }
    // InputStream stream = Files.newInputStream(snippetFile.toPath());
    SnippetDefinitions definitions = ModelFactoryForUser.getInstance().load(snippetFile.getAbsolutePath());
    List importCategories = definitions.getCategories();
    SnippetManager manager = SnippetManager.getInstance();
    List currentCategories = manager.getDefinitions().getCategories();
    Display.getDefault().asyncExec(new Runnable() {

        public void run() {
            for (int i = 0; i < importCategories.size(); i++) {
                boolean found = false;
                for (int j = 0; j < currentCategories.size(); j++) {
                    if (((PaletteEntry) currentCategories.get(j)).getId().compareToIgnoreCase(((PaletteEntry) importCategories.get(i)).getId()) == 0) {
                        found = true;
                        break;
                    }
                }
                if (!found) {
                    SnippetManager manager = SnippetManager.getInstance();
                    manager.getPaletteRoot().add((PaletteEntry) importCategories.get(i));
                }
            }
        }
    });
// IViewPart view = findSnippetsView();
// if (view != null) {
// SnippetsView snippetsView = (SnippetsView) view;
// snippetsView.getViewer().getContents().refresh();
// }
}
Also used : List(java.util.List) SnippetManager(org.eclipse.wst.common.snippets.internal.model.SnippetManager) PaletteEntry(org.eclipse.gef.palette.PaletteEntry) SnippetDefinitions(org.eclipse.wst.common.snippets.internal.SnippetDefinitions)

Aggregations

PaletteEntry (org.eclipse.gef.palette.PaletteEntry)15 List (java.util.List)4 CombinedTemplateCreationEntry (org.eclipse.gef.palette.CombinedTemplateCreationEntry)4 PaletteContainer (org.eclipse.gef.palette.PaletteContainer)4 ArrayList (java.util.ArrayList)3 Iterator (java.util.Iterator)3 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)3 AbstractHandler (org.eclipse.core.commands.AbstractHandler)2 Command (org.eclipse.core.commands.Command)2 ExecutionEvent (org.eclipse.core.commands.ExecutionEvent)2 ExecutionException (org.eclipse.core.commands.ExecutionException)2 IEvaluationContext (org.eclipse.core.expressions.IEvaluationContext)2 IConfigurationElement (org.eclipse.core.runtime.IConfigurationElement)2 PaletteGroup (org.eclipse.gef.palette.PaletteGroup)2 PaletteRoot (org.eclipse.gef.palette.PaletteRoot)2 PaletteEditPart (org.eclipse.gef.ui.palette.editparts.PaletteEditPart)2 MouseAdapter (org.eclipse.swt.events.MouseAdapter)2 MouseEvent (org.eclipse.swt.events.MouseEvent)2 ICommandService (org.eclipse.ui.commands.ICommandService)2 IHandlerService (org.eclipse.ui.handlers.IHandlerService)2