Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaged Elaasar2018-03-16 20:06:14 -0400
committerptessier2018-04-19 16:55:57 -0400
commit371756cd59fe03ac08e079a6a98b2b332da6ff92 (patch)
treec50ab6ebf82acaeaf37f372acba864a49a876a04 /plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src
parent9795d6a6d23ed40a5fe31b89c6868e9c407a5edb (diff)
downloadorg.eclipse.papyrus-371756cd59fe03ac08e079a6a98b2b332da6ff92.tar.gz
org.eclipse.papyrus-371756cd59fe03ac08e079a6a98b2b332da6ff92.tar.xz
org.eclipse.papyrus-371756cd59fe03ac08e079a6a98b2b332da6ff92.zip
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 <melaasar@gmail.com>
Diffstat (limited to 'plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src')
-rwxr-xr-xplugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/helper/GMFDiagramViewTypeHelper.java40
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/service/palette/PapyrusPaletteService.java1
2 files changed, 31 insertions, 10 deletions
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<PapyrusDiag
*/
@Override
protected ViewPrototype doGetPrototypeFor(PapyrusDiagram diagramKind) {
- String language = diagramKind.getLanguage().getId();
- AbstractPapyrusGmfCreateDiagramCommandHandler command;
- try {
- Class<?> 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;

Back to the top