Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcletavernie2012-10-16 07:23:27 +0000
committercletavernie2012-10-16 07:23:27 +0000
commitafa45fbd5b9ff4da72d32f81110dada43c3b52ae (patch)
tree8ef6592e42d2f860b646636268e6e4f1cf33120c /extraplugins/diagramtemplate
parentdc972a9e160f2a53abae74dcf57ee133547bd407 (diff)
downloadorg.eclipse.papyrus-afa45fbd5b9ff4da72d32f81110dada43c3b52ae.tar.gz
org.eclipse.papyrus-afa45fbd5b9ff4da72d32f81110dada43c3b52ae.tar.xz
org.eclipse.papyrus-afa45fbd5b9ff4da72d32f81110dada43c3b52ae.zip
391945: [Refactoring] Part 2: Refactoring on Kepler (0.10)
https://bugs.eclipse.org/bugs/show_bug.cgi?id=391945 Missing files from the previous commit
Diffstat (limited to 'extraplugins/diagramtemplate')
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/META-INF/MANIFEST.MF4
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/DiagramTemplateEditor.java2
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/DiagramDefinitionLabelProvider.java6
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/DiagramKindContentProvider.java6
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/launcher/DiagramTemplateLauncher.java51
5 files changed, 40 insertions, 29 deletions
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/META-INF/MANIFEST.MF b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/META-INF/MANIFEST.MF
index b74294f7fb5..8aff7a08274 100644
--- a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/META-INF/MANIFEST.MF
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/META-INF/MANIFEST.MF
@@ -19,7 +19,9 @@ Require-Bundle: org.eclipse.core.runtime,
org.eclipse.papyrus.infra.core;bundle-version="0.10.0",
org.eclipse.papyrus.uml.diagram.wizards;bundle-version="0.10.0",
org.eclipse.gmf.runtime.diagram.ui;bundle-version="1.6.0",
- org.eclipse.papyrus.infra.core.sasheditor;bundle-version="0.10.0"
+ org.eclipse.papyrus.infra.core.sasheditor;bundle-version="0.10.0",
+ org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="0.10.0",
+ org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="0.10.0"
Bundle-Vendor: %providerName
Bundle-Version: 0.10.0.qualifier
Bundle-ManifestVersion: 2
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/DiagramTemplateEditor.java b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/DiagramTemplateEditor.java
index f614896bdf0..05cf38cdecf 100644
--- a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/DiagramTemplateEditor.java
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/DiagramTemplateEditor.java
@@ -74,6 +74,7 @@ import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.TreeViewerColumn;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.papyrus.commands.CreationCommandDescriptor;
import org.eclipse.papyrus.diagramtemplate.AbstractSelection;
import org.eclipse.papyrus.diagramtemplate.DiagramDefinition;
import org.eclipse.papyrus.diagramtemplate.DiagramTemplateFactory;
@@ -94,7 +95,6 @@ import org.eclipse.papyrus.diagramtemplate.editor.provider.WhatContentProvider;
import org.eclipse.papyrus.diagramtemplate.launcher.DiagramTemplateLauncher;
import org.eclipse.papyrus.diagramtemplate.provider.DiagramTemplateItemProviderAdapterFactory;
import org.eclipse.papyrus.diagramtemplate.utils.Messages;
-import org.eclipse.papyrus.infra.core.extension.commands.CreationCommandDescriptor;
import org.eclipse.papyrus.uml.diagram.wizards.category.DiagramCategoryDescriptor;
import org.eclipse.papyrus.uml.diagram.wizards.category.DiagramCategoryRegistry;
import org.eclipse.papyrus.uml.diagram.wizards.kind.DiagramKindLabelProvider;
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/DiagramDefinitionLabelProvider.java b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/DiagramDefinitionLabelProvider.java
index 0ac88627b5a..5ab37a1c22b 100644
--- a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/DiagramDefinitionLabelProvider.java
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/DiagramDefinitionLabelProvider.java
@@ -15,10 +15,10 @@ package org.eclipse.papyrus.diagramtemplate.editor.provider;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.papyrus.commands.CreationCommandDescriptor;
+import org.eclipse.papyrus.commands.CreationCommandRegistry;
+import org.eclipse.papyrus.commands.ICreationCommandRegistry;
import org.eclipse.papyrus.diagramtemplate.DiagramDefinition;
-import org.eclipse.papyrus.infra.core.extension.commands.CreationCommandDescriptor;
-import org.eclipse.papyrus.infra.core.extension.commands.CreationCommandRegistry;
-import org.eclipse.papyrus.infra.core.extension.commands.ICreationCommandRegistry;
import org.eclipse.swt.graphics.Image;
/**
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/DiagramKindContentProvider.java b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/DiagramKindContentProvider.java
index 51d37dd12a8..e3fd02c03b7 100644
--- a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/DiagramKindContentProvider.java
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/DiagramKindContentProvider.java
@@ -18,9 +18,9 @@ import java.util.List;
import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.papyrus.infra.core.extension.commands.CreationCommandDescriptor;
-import org.eclipse.papyrus.infra.core.extension.commands.CreationCommandRegistry;
-import org.eclipse.papyrus.infra.core.extension.commands.ICreationCommandRegistry;
+import org.eclipse.papyrus.commands.CreationCommandDescriptor;
+import org.eclipse.papyrus.commands.CreationCommandRegistry;
+import org.eclipse.papyrus.commands.ICreationCommandRegistry;
/**
*
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/launcher/DiagramTemplateLauncher.java b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/launcher/DiagramTemplateLauncher.java
index 4a6f04cd9b2..b0a993c8c83 100644
--- a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/launcher/DiagramTemplateLauncher.java
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/launcher/DiagramTemplateLauncher.java
@@ -43,6 +43,7 @@ import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.papyrus.commands.CreationCommandDescriptor;
import org.eclipse.papyrus.diagramtemplate.AbstractSelection;
import org.eclipse.papyrus.diagramtemplate.DiagramDefinition;
import org.eclipse.papyrus.diagramtemplate.Selection;
@@ -53,12 +54,16 @@ import org.eclipse.papyrus.diagramtemplate.editor.provider.DiagramKindContentPro
import org.eclipse.papyrus.diagramtemplate.utils.Messages;
import org.eclipse.papyrus.editor.PapyrusMultiDiagramEditor;
import org.eclipse.papyrus.infra.core.editor.BackboneException;
-import org.eclipse.papyrus.infra.core.extension.commands.CreationCommandDescriptor;
+import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor;
+import org.eclipse.papyrus.infra.core.resource.ModelMultiException;
+import org.eclipse.papyrus.infra.core.resource.ModelSet;
+import org.eclipse.papyrus.infra.core.resource.sasheditor.DiModelUtils;
import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageMngr;
import org.eclipse.papyrus.infra.core.services.ServiceException;
import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
import org.eclipse.papyrus.infra.core.utils.DiResourceSet;
import org.eclipse.papyrus.infra.core.utils.EditorUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationUtils;
import org.eclipse.papyrus.uml.diagram.wizards.category.DiagramCategoryDescriptor;
import org.eclipse.papyrus.uml.diagram.wizards.category.DiagramCategoryRegistry;
import org.eclipse.ui.IEditorPart;
@@ -89,7 +94,7 @@ public class DiagramTemplateLauncher {
*/
public enum CreationReportKind {
SUCCESS, FAIL
- };
+ }
/**
* The creation report information
@@ -182,11 +187,11 @@ public class DiagramTemplateLauncher {
//Guess which of the View is the new one
EditPartViewer viewer = actualEditPart.getViewer();
- Map map = viewer.getEditPartRegistry();
+ Map<?, ?> map = viewer.getEditPartRegistry();
//We must have a copy since map may change during the loop
- Map mapCopy = new HashMap<Object, Object>(map);
- Iterator it = mapCopy.keySet().iterator();
+ Map<?, ?> mapCopy = new HashMap<Object, Object>(map);
+ Iterator<?> it = mapCopy.keySet().iterator();
boolean found = false;
while(it.hasNext() && !found) {
Object view = it.next();
@@ -249,7 +254,7 @@ public class DiagramTemplateLauncher {
* @param editPartToShowIn
* the editPart to show elements in
*/
- protected void addElementsFor(List selectionList, EObject root, DiagramEditor activeEditor, EditPart editPartToShowIn) {
+ protected void addElementsFor(List<?> selectionList, EObject root, DiagramEditor activeEditor, EditPart editPartToShowIn) {
// Go through the SelectionRef
for(Object object : selectionList) {
if(object instanceof SelectionRef) {
@@ -444,7 +449,7 @@ public class DiagramTemplateLauncher {
* @param diResourceSet
* The Papyrus resource to create the diagrams in
*/
- protected void createDiagramFor(List selectionList, DiagramDefinition diagramDefinition, DiResourceSet diResourceSet) {
+ protected void createDiagramFor(List<?> selectionList, DiagramDefinition diagramDefinition, ModelSet modelSet) {
//Go through the selection and try to find elements in the target model that match
for(Object object : selectionList) {
@@ -501,10 +506,10 @@ public class DiagramTemplateLauncher {
// System.err.println("FoundForAll Sub: " + diagramDefinition.getName());
// It matches: create a diagram
try {
- creationCommandDescriptor.getCommand().createDiagram(diResourceSet, eObject, name);
+ creationCommandDescriptor.getCommand().createDiagram(modelSet, eObject, name);
//Identify the new diagram
- TreeIterator<EObject> it = diResourceSet.getNotationResource().getAllContents();
+ TreeIterator<EObject> it = NotationUtils.getNotationResource(modelSet).getAllContents();
while(it.hasNext()) {
EObject diagram = it.next();
if(diagram instanceof Diagram) {
@@ -528,10 +533,10 @@ public class DiagramTemplateLauncher {
// It matches: create a diagram
try {
- creationCommandDescriptor.getCommand().createDiagram(diResourceSet, eObject, name);
+ creationCommandDescriptor.getCommand().createDiagram(modelSet, eObject, name);
//Identify the new diagram
- TreeIterator<EObject> it = diResourceSet.getNotationResource().getAllContents();
+ TreeIterator<EObject> it = NotationUtils.getNotationResource(modelSet).getAllContents();
while(it.hasNext()) {
EObject diagram = it.next();
if(diagram instanceof Diagram) {
@@ -563,10 +568,10 @@ public class DiagramTemplateLauncher {
}
try {
- creationCommandDescriptor.getCommand().createDiagram(diResourceSet, selection.getElement(), name);
+ creationCommandDescriptor.getCommand().createDiagram(modelSet, selection.getElement(), name);
//Identify the new diagram
- TreeIterator<EObject> it = diResourceSet.getNotationResource().getAllContents();
+ TreeIterator<EObject> it = NotationUtils.getNotationResource(modelSet).getAllContents();
while(it.hasNext()) {
EObject diagram = it.next();
if(diagram instanceof Diagram) {
@@ -628,7 +633,7 @@ public class DiagramTemplateLauncher {
creationReport = new HashMap<EObject, CreationReportKind>();
if(template != null) {
- DiResourceSet diResourceSet = new DiResourceSet();
+ ModelSet modelSet = new DiResourceSet();
if(template.getTargetRoot().eResource() != null) {
String targetModelLocation = template.getTargetRoot().eResource().getURI().toPlatformString(false);
@@ -638,10 +643,14 @@ public class DiagramTemplateLauncher {
if(file.exists()) {
- diResourceSet.loadResources(file);
+ try {
+ modelSet.loadModels(file);
+ } catch (ModelMultiException ex) {
+ ex.printStackTrace(System.out);
+ }
//Identify already available diagrams
- TreeIterator<EObject> it = diResourceSet.getNotationResource().getAllContents();
+ TreeIterator<EObject> it = NotationUtils.getNotationResource(modelSet).getAllContents();
while(it.hasNext()) {
EObject diagram = it.next();
if(diagram instanceof Diagram) {
@@ -652,16 +661,16 @@ public class DiagramTemplateLauncher {
// Create diagrams
if(!template.getDiagramDefinitions().isEmpty()) {
for(DiagramDefinition diagramDefinition : template.getDiagramDefinitions()) {
- createDiagramFor(diagramDefinition.getSelection(), diagramDefinition, diResourceSet);
+ createDiagramFor(diagramDefinition.getSelection(), diagramDefinition, modelSet);
}
} else {
// Create empty diagrams
- EditorUtils.getTransactionalIPageMngr(diResourceSet.getDiResource(), diResourceSet.getTransactionalEditingDomain());
+ EditorUtils.getTransactionalIPageMngr(DiModelUtils.getDiResource(modelSet), modelSet.getTransactionalEditingDomain());
}
// Save the resource
try {
- diResourceSet.save(new NullProgressMonitor());
+ modelSet.save(new NullProgressMonitor());
} catch (IOException e) {
e.printStackTrace();
// return false;
@@ -675,8 +684,8 @@ public class DiagramTemplateLauncher {
try {
IEditorPart editor = IDE.openEditor(page, file, true);
- if(editor instanceof PapyrusMultiDiagramEditor) {
- ServicesRegistry services = ((PapyrusMultiDiagramEditor)editor).getServicesRegistry();
+ if(editor instanceof IMultiDiagramEditor) {
+ ServicesRegistry services = ((IMultiDiagramEditor)editor).getServicesRegistry();
IPageMngr pageMngr = services.getService(IPageMngr.class);
pageMngr.closeAllOpenedPages();

Back to the top