From 371756cd59fe03ac08e079a6a98b2b332da6ff92 Mon Sep 17 00:00:00 2001 From: Maged Elaasar Date: Fri, 16 Mar 2018 17:06:14 -0700 Subject: Bug 527664 - [AFViewpoints] Architecture Model Editor remove CreationCommandClass property value Converted the Creation/ConversionCommandClass properties in the architecture editor to be of type string instead of Class. They can now reference class names from the workspace (on their project's class path). Also added validation rules for that. Finally, I added a Browse... button in the property sheet to help put values for them. remove some reexport increase version to take in account API tool Change-Id: I6792449fbee70b089f83780c4935242fff72d50b Signed-off-by: Maged Elaasar --- .../META-INF/MANIFEST.MF | 6 ++-- .../common/helper/GMFDiagramViewTypeHelper.java | 40 +++++++++++++++++----- .../service/palette/PapyrusPaletteService.java | 1 - 3 files changed, 35 insertions(+), 12 deletions(-) (limited to 'plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common') diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/META-INF/MANIFEST.MF b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/META-INF/MANIFEST.MF index 99bcffbb8c1..7dfd8dac3e0 100755 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/META-INF/MANIFEST.MF +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/META-INF/MANIFEST.MF @@ -68,11 +68,13 @@ Require-Bundle: org.eclipse.emf.ecore.edit;bundle-version="[2.9.0,3.0.0)", org.eclipse.papyrus.infra.core;bundle-version="[3.0.0,4.0.0)", org.eclipse.papyrus.infra.internationalization.utils;bundle-version="[1.0.0,2.0.0)", org.eclipse.papyrus.infra.gmfdiag.tooling.runtime;bundle-version="[3.0.0,4.0.0)", - org.eclipse.papyrus.infra.gmfdiag.representation;bundle-version="[1.0.0,2.0.0)";visibility:=reexport, + org.eclipse.papyrus.infra.gmfdiag.representation;bundle-version="[1.0.0,3.0.0)";visibility:=reexport, org.eclipse.papyrus.infra.gmfdiag.style;bundle-version="[1.0.0,2.0.0)";visibility:=reexport, org.eclipse.papyrus.infra.gmfdiag.paletteconfiguration;bundle-version="[3.0.0,4.0.0)", org.eclipse.papyrus.infra.filters;bundle-version="1.2.0", - org.eclipse.papyrus.infra.viewpoints.policy;bundle-version="[2.100.0,3.0.0)"; visibility:=reexport + org.eclipse.papyrus.infra.viewpoints.policy;bundle-version="[2.100.0,4.0.0)", + org.eclipse.papyrus.infra.architecture.representation;bundle-version="[1.0.0,3.0.0)", + org.eclipse.papyrus.infra.architecture;bundle-version="[1.0.0,2.0.0)" Bundle-Vendor: %providerName Bundle-ActivationPolicy: lazy Bundle-ClassPath: . diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/helper/GMFDiagramViewTypeHelper.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/helper/GMFDiagramViewTypeHelper.java index 3b34937389d..21abab70070 100755 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/helper/GMFDiagramViewTypeHelper.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/helper/GMFDiagramViewTypeHelper.java @@ -13,6 +13,8 @@ *****************************************************************************/ package org.eclipse.papyrus.infra.gmfdiag.common.helper; +import org.eclipse.core.runtime.Platform; +import org.eclipse.emf.common.util.URI; import org.eclipse.emf.ecore.EObject; import org.eclipse.gmf.runtime.notation.Diagram; import org.eclipse.papyrus.infra.gmfdiag.common.AbstractPapyrusGmfCreateDiagramCommandHandler; @@ -22,6 +24,7 @@ import org.eclipse.papyrus.infra.gmfdiag.representation.PapyrusDiagram; import org.eclipse.papyrus.infra.viewpoints.policy.AbstractViewTypeHelper; import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker; import org.eclipse.papyrus.infra.viewpoints.policy.ViewPrototype; +import org.osgi.framework.Bundle; /** * Represents the dynamic contribution of a policy to menus @@ -49,16 +52,35 @@ public class GMFDiagramViewTypeHelper extends AbstractViewTypeHelper creationCommandClass = diagramKind.getCreationCommandClass(); - command = (AbstractPapyrusGmfCreateDiagramCommandHandler) creationCommandClass.newInstance(); - } catch (Exception e) { - Activator.log.error(e); - return null; + String commandClassName = diagramKind.getCreationCommandClass(); + if (commandClassName != null) { + Class creationCommandClass = null; + + URI uri = diagramKind.eResource().getURI(); + if (uri.isPlatformPlugin()) { + String bundleName = uri.segment(1); + Bundle bundle = Platform.getBundle(bundleName); + try { + creationCommandClass = bundle.loadClass(diagramKind.getCreationCommandClass()); + } catch (ClassNotFoundException e) { + Activator.log.error(e); + } + } + + if (creationCommandClass != null) { + AbstractPapyrusGmfCreateDiagramCommandHandler command; + try { + command = (AbstractPapyrusGmfCreateDiagramCommandHandler) creationCommandClass.newInstance(); + } catch (Exception e) { + Activator.log.error(e); + return null; + } + + String language = diagramKind.getLanguage().getId(); + return new DiagramPrototype(diagramKind, language, command); + } } - return new DiagramPrototype(diagramKind, language, command); + return null; } /** 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 5444bbf2403..f42a5607efe 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 @@ -46,7 +46,6 @@ import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.emf.edit.domain.IEditingDomainProvider; import org.eclipse.emf.transaction.TransactionalEditingDomain; import org.eclipse.gef.palette.PaletteContainer; -import org.eclipse.gef.palette.PaletteDrawer; import org.eclipse.gef.palette.PaletteEntry; import org.eclipse.gef.palette.PaletteRoot; import org.eclipse.gef.palette.PaletteSeparator; -- cgit v1.2.3