diff options
author | Sebastien Gabel | 2017-07-04 15:30:19 +0000 |
---|---|---|
committer | vincent lorenzo | 2017-11-16 13:51:25 +0000 |
commit | ef0e2809fe1b78585a2a43e9e1e457660390b26e (patch) | |
tree | 7858088a7f268cbe4936b2d7be3fc02ee001e23b | |
parent | 5ce3416449bbc91dc5f757b4f66e4afa562c4c25 (diff) | |
download | org.eclipse.papyrus-ef0e2809fe1b78585a2a43e9e1e457660390b26e.tar.gz org.eclipse.papyrus-ef0e2809fe1b78585a2a43e9e1e457660390b26e.tar.xz org.eclipse.papyrus-ef0e2809fe1b78585a2a43e9e1e457660390b26e.zip |
Bug 513803: [API] Add an empty implementation of an interface for
extended palette entries
Prevent Papyrus to destroy palettes entries that it doesn't control,
typically palette entries created by another GMF-based tools.
In the PapyrusPaletteService class, restore the original creation year
figuring inside the copyright.
Change-Id: I63648ffeb4b2e3a44b7a4ba60e358f76224e48dd
Signed-off-by: Sebastien Gabel <sebastien.gabel@ansys.com>
5 files changed, 90 insertions, 59 deletions
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/service/palette/PapyrusPaletteService.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/service/palette/PapyrusPaletteService.java index 310e30e8bab..5444bbf2403 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/service/palette/PapyrusPaletteService.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/service/palette/PapyrusPaletteService.java @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2017 CEA LIST. + * Copyright (c) 2009, 2017 CEA LIST, Esterel Technologies SAS and others. * * * All rights reserved. This program and the accompanying materials @@ -10,6 +10,7 @@ * Contributors: * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation * Micka�l ADAM (ALL4TEC) mickael.adam@all4tec.net - bug 512343. + * Sebastien Gabel (Esterel Technologies SAS) - bug 513803 * *****************************************************************************/ package org.eclipse.papyrus.infra.gmfdiag.common.service.palette; @@ -73,6 +74,7 @@ import org.eclipse.papyrus.infra.core.architecture.merged.MergedArchitectureDesc import org.eclipse.papyrus.infra.gmfdiag.common.Activator; import org.eclipse.papyrus.infra.gmfdiag.common.messages.Messages; import org.eclipse.papyrus.infra.gmfdiag.common.service.palette.XMLPaletteProviderConfiguration.EditorDescriptor; +import org.eclipse.papyrus.infra.gmfdiag.paletteconfiguration.provider.IExtendedPaletteEntry; import org.eclipse.papyrus.infra.gmfdiag.representation.PapyrusDiagram; import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker; import org.eclipse.ui.IEditorPart; @@ -1020,7 +1022,10 @@ public class PapyrusPaletteService extends PaletteService implements IPalettePro // remove existing entries that were not found in the new container for (Iterator iter = existingEntryIds.values().iterator(); iter.hasNext();) { PaletteEntry entry = (PaletteEntry) iter.next(); - existingContainer.remove(entry); + // only process palette entries that Papyrus is able to support + if (entry instanceof IExtendedPaletteEntry) { + existingContainer.remove(entry); + } } } diff --git a/plugins/infra/gmfdiag/paletteconfiguration/org.eclipse.papyrus.infra.gmfdiag.paletteconfiguration/src/org/eclipse/papyrus/infra/gmfdiag/paletteconfiguration/provider/ExtendedConnectionToolEntry.java b/plugins/infra/gmfdiag/paletteconfiguration/org.eclipse.papyrus.infra.gmfdiag.paletteconfiguration/src/org/eclipse/papyrus/infra/gmfdiag/paletteconfiguration/provider/ExtendedConnectionToolEntry.java index c474b997820..1a1de19a0b1 100644 --- a/plugins/infra/gmfdiag/paletteconfiguration/org.eclipse.papyrus.infra.gmfdiag.paletteconfiguration/src/org/eclipse/papyrus/infra/gmfdiag/paletteconfiguration/provider/ExtendedConnectionToolEntry.java +++ b/plugins/infra/gmfdiag/paletteconfiguration/org.eclipse.papyrus.infra.gmfdiag.paletteconfiguration/src/org/eclipse/papyrus/infra/gmfdiag/paletteconfiguration/provider/ExtendedConnectionToolEntry.java @@ -1,5 +1,5 @@ /*****************************************************************************
- * Copyright (c) 2010 - 2017 CEA LIST, ALL4TEC and others.
+ * Copyright (c) 2010, 2017 CEA LIST, ALL4TEC, Esterel Technologies SAS and others.
*
*
* All rights reserved. This program and the accompanying materials
@@ -10,6 +10,7 @@ * Contributors:
* Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
* Micka�l ADAM (ALL4TEC) mickael.adam@all4tec.net - Bug 512110
+ * Sebastien Gabel (Esterel Technologies SAS) - Bug 513803
*****************************************************************************/
package org.eclipse.papyrus.infra.gmfdiag.paletteconfiguration.provider;
@@ -28,7 +29,7 @@ import org.eclipse.papyrus.infra.types.ElementTypeConfiguration; * Extended connection Tool Entry
*/
@SuppressWarnings("restriction")
-public class ExtendedConnectionToolEntry extends PaletteToolEntry implements IElementTypesBasedTool, IClassBasedTool {
+public class ExtendedConnectionToolEntry extends PaletteToolEntry implements IElementTypesBasedTool, IClassBasedTool, IExtendedPaletteEntry {
/** list of element types created by this tool */
final private List<IElementType> elementTypes = new ArrayList<IElementType>();
diff --git a/plugins/infra/gmfdiag/paletteconfiguration/org.eclipse.papyrus.infra.gmfdiag.paletteconfiguration/src/org/eclipse/papyrus/infra/gmfdiag/paletteconfiguration/provider/ExtendedCreationToolEntry.java b/plugins/infra/gmfdiag/paletteconfiguration/org.eclipse.papyrus.infra.gmfdiag.paletteconfiguration/src/org/eclipse/papyrus/infra/gmfdiag/paletteconfiguration/provider/ExtendedCreationToolEntry.java index 712baeaac69..6fa9ec2c0d4 100644 --- a/plugins/infra/gmfdiag/paletteconfiguration/org.eclipse.papyrus.infra.gmfdiag.paletteconfiguration/src/org/eclipse/papyrus/infra/gmfdiag/paletteconfiguration/provider/ExtendedCreationToolEntry.java +++ b/plugins/infra/gmfdiag/paletteconfiguration/org.eclipse.papyrus.infra.gmfdiag.paletteconfiguration/src/org/eclipse/papyrus/infra/gmfdiag/paletteconfiguration/provider/ExtendedCreationToolEntry.java @@ -1,5 +1,5 @@ /*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
+ * Copyright (c) 2010, 2017 CEA LIST, Esterel Technologies SAS and others. *
*
* All rights reserved. This program and the accompanying materials
@@ -9,6 +9,7 @@ *
* Contributors:
* Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
+ * Sebastien Gabel (Esterel Technologies SAS) - bug 513803 *
*****************************************************************************/
package org.eclipse.papyrus.infra.gmfdiag.paletteconfiguration.provider;
@@ -29,7 +30,7 @@ import org.eclipse.papyrus.infra.types.ElementTypeConfiguration; * Extended version of the {@link CombinedTemplateCreationEntry}.
*/
@SuppressWarnings("restriction")
-public class ExtendedCreationToolEntry extends PaletteToolEntry implements IElementTypesBasedTool, IClassBasedTool {
+public class ExtendedCreationToolEntry extends PaletteToolEntry implements IElementTypesBasedTool, IClassBasedTool, IExtendedPaletteEntry {
/** list of element types created by this tool */
final private List<IElementType> elementTypes = new ArrayList<IElementType>();
diff --git a/plugins/infra/gmfdiag/paletteconfiguration/org.eclipse.papyrus.infra.gmfdiag.paletteconfiguration/src/org/eclipse/papyrus/infra/gmfdiag/paletteconfiguration/provider/ExtendedPaletteDrawer.java b/plugins/infra/gmfdiag/paletteconfiguration/org.eclipse.papyrus.infra.gmfdiag.paletteconfiguration/src/org/eclipse/papyrus/infra/gmfdiag/paletteconfiguration/provider/ExtendedPaletteDrawer.java index e2e3f03f7d8..f4128a66d4c 100644 --- a/plugins/infra/gmfdiag/paletteconfiguration/org.eclipse.papyrus.infra.gmfdiag.paletteconfiguration/src/org/eclipse/papyrus/infra/gmfdiag/paletteconfiguration/provider/ExtendedPaletteDrawer.java +++ b/plugins/infra/gmfdiag/paletteconfiguration/org.eclipse.papyrus.infra.gmfdiag.paletteconfiguration/src/org/eclipse/papyrus/infra/gmfdiag/paletteconfiguration/provider/ExtendedPaletteDrawer.java @@ -1,53 +1,54 @@ -/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.gmfdiag.paletteconfiguration.provider;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.papyrus.infra.gmfdiag.paletteconfiguration.Activator;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-
-
-/**
- * Specific implementation of the Palette Drawer for Papyrus. The one from GMF is not used, as it is internal.
- */
-public class ExtendedPaletteDrawer extends org.eclipse.gef.palette.PaletteDrawer {
-
- /**
- * Creates a new PaletteDrawerEx, with the default icon
- *
- * @param label
- * the label of the drawer
- * @param id
- * the unique identifier of this drawer.
- */
- public ExtendedPaletteDrawer(String label, String id) {
- this(label, AbstractUIPlugin.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "/icons/drawer.gif"), id);
- }
-
- /**
- * Creates a new PaletteDrawerEx.
- *
- * @param label
- * the label of the drawer
- * @param icon
- * the icon of the drawer
- * @param id
- * the unique identifier of this drawer.
- */
- public ExtendedPaletteDrawer(String label, ImageDescriptor icon, String id) {
- super(label, icon);
- setId(id);
- }
-
-}
+/***************************************************************************** + * Copyright (c) 2010, 2017 CEA LIST, Esterel Technologies SAS and others. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation + * Sebastien Gabel (Esterel Technologies SAS) - implements IExtendedPaletteEntry interface (bug 513803) + * + *****************************************************************************/ +package org.eclipse.papyrus.infra.gmfdiag.paletteconfiguration.provider; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.papyrus.infra.gmfdiag.paletteconfiguration.Activator; +import org.eclipse.ui.plugin.AbstractUIPlugin; + + +/** + * Specific implementation of the Palette Drawer for Papyrus. The one from GMF is not used, as it is internal. + */ +public class ExtendedPaletteDrawer extends org.eclipse.gef.palette.PaletteDrawer implements IExtendedPaletteEntry { + + /** + * Creates a new PaletteDrawerEx, with the default icon + * + * @param label + * the label of the drawer + * @param id + * the unique identifier of this drawer. + */ + public ExtendedPaletteDrawer(String label, String id) { + this(label, AbstractUIPlugin.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "/icons/drawer.gif"), id); + } + + /** + * Creates a new PaletteDrawerEx. + * + * @param label + * the label of the drawer + * @param icon + * the icon of the drawer + * @param id + * the unique identifier of this drawer. + */ + public ExtendedPaletteDrawer(String label, ImageDescriptor icon, String id) { + super(label, icon); + setId(id); + } + +} diff --git a/plugins/infra/gmfdiag/paletteconfiguration/org.eclipse.papyrus.infra.gmfdiag.paletteconfiguration/src/org/eclipse/papyrus/infra/gmfdiag/paletteconfiguration/provider/IExtendedPaletteEntry.java b/plugins/infra/gmfdiag/paletteconfiguration/org.eclipse.papyrus.infra.gmfdiag.paletteconfiguration/src/org/eclipse/papyrus/infra/gmfdiag/paletteconfiguration/provider/IExtendedPaletteEntry.java new file mode 100644 index 00000000000..2a49d59d1d6 --- /dev/null +++ b/plugins/infra/gmfdiag/paletteconfiguration/org.eclipse.papyrus.infra.gmfdiag.paletteconfiguration/src/org/eclipse/papyrus/infra/gmfdiag/paletteconfiguration/provider/IExtendedPaletteEntry.java @@ -0,0 +1,23 @@ +/***************************************************************************** + * Copyright (c) 2017 Esterel Technologies SAS. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sebastien Gabel (Esterel Technologies SAS) - Initial API and implementation (bug 513803) + * + *****************************************************************************/ +package org.eclipse.papyrus.infra.gmfdiag.paletteconfiguration.provider; + +/** + * This interface is intended to distinguish the palette entries that Papyrus can handle among coming from other tools. + * + * @see {@link PapyrusPaletteService} + * @since 4.0.0 + */ +public interface IExtendedPaletteEntry { + +} |