Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus')
-rw-r--r--extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/Activator.java54
-rw-r--r--extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/DisplayReverse.java181
-rw-r--r--extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/DndReverseCodeHandler.java254
-rw-r--r--extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/JavaCodeReverse.java287
-rw-r--r--extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/Messages.java32
-rw-r--r--extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/ReverseCodeHandler.java342
-rw-r--r--extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/TreeSelectionList.java153
-rw-r--r--extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/dialog/DndReverseCodeDialog.java93
-rw-r--r--extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/dialog/InputListDialog.java332
-rw-r--r--extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/dialog/ReverseCodeDialog.java340
-rwxr-xr-xextraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/dnd/DropReverseCommand.java106
-rwxr-xr-xextraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/dnd/DropReverseStrategy.java60
-rw-r--r--extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/dnd/Messages.java19
-rw-r--r--extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/dnd/messages.properties2
-rw-r--r--extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/handlers/CreateAssociationFromPropertyHandler.java286
-rw-r--r--extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/messages.properties9
-rw-r--r--extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/preference/CreationPathListEditor.java94
-rw-r--r--extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/preference/PreferenceConstants.java29
-rw-r--r--extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/preference/PreferenceInitializer.java43
-rw-r--r--extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/preference/PreferencePage.java62
-rw-r--r--extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/preference/ReversePreference.java50
-rw-r--r--extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/preference/SearchPathListEditor.java86
22 files changed, 0 insertions, 2914 deletions
diff --git a/extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/Activator.java b/extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/Activator.java
deleted file mode 100644
index 2ac94758559..00000000000
--- a/extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/Activator.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package org.eclipse.papyrus.java.reverse.ui;
-
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class Activator extends AbstractUIPlugin {
-
- // The plug-in ID
- public static final String PLUGIN_ID = "org.eclipse.papyrus.java.reverse.ui";
-
- // The shared instance
- private static Activator plugin;
-
- /**
- * The constructor
- */
- public Activator() {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- @Override
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static Activator getDefault() {
- return plugin;
- }
-
-}
diff --git a/extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/DisplayReverse.java b/extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/DisplayReverse.java
deleted file mode 100644
index caac0a8c995..00000000000
--- a/extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/DisplayReverse.java
+++ /dev/null
@@ -1,181 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2014 Jonathan Geoffroy.
- *
- *
- * 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:
- * Jonathan Geoffroy geoffroy.jonathan@gmail.com initial implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.java.reverse.ui;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.emf.common.util.TreeIterator;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
-import org.eclipse.gmf.runtime.diagram.core.services.ViewService;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.IPackageFragment;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.uml2.uml.Model;
-import org.eclipse.uml2.uml.NamedElement;
-
-/**
- * Command which allow to display java elements into papyrus diagram.
- * The java element must exists into papyrus model (for example by using reverse plugin)
- *
- * @author Jonathan Geoffroy
- *
- */
-public class DisplayReverse {
-
- private static final String MODEL_TYPE = "2005", PACKAGE_TYPE = "2007", CU_TYPE = "2008"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-
- /**
- * items to display into papyrus diagram
- */
- private List<IJavaElement> items;
-
- /**
- * Contains all uml resources.
- * Used to improve research into umlModel.
- */
- private Map<String, NamedElement> umlModelNames;
-
- /**
- * Graphical container for the reverse result
- */
- private Diagram diagram;
-
- /**
- * model to display into diagram. Null if user doesn't want to display any model
- */
- private Model model;
-
- /**
- * Constructor.
- *
- * @param items
- * items to display into papyrus diagram
- * @param diagram
- * container where to display items
- * @param umlModel
- * resource representing the papyrus uml model
- * @param model
- * model to display into diagram. Null if user doesn't want to display any model
- */
- public DisplayReverse(List<IJavaElement> items, Diagram diagram, Resource umlModel, Model model) {
- super();
- this.items = items;
- this.diagram = diagram;
- this.model = model;
-
- // Change uml model collection to improve search
- umlModelNames = new HashMap<String, NamedElement>();
- TreeIterator<EObject> tree = umlModel.getAllContents();
- while (tree.hasNext()) {
- for (EObject o : tree.next().eContents()) {
- /*
- * Only add reversable elements.
- * The non Named element cannot been added into model (comments ...)
- */
- if (o instanceof NamedElement) {
- // Add it into items to display
- NamedElement e = (NamedElement) o;
- umlModelNames.put(e.getName(), e);
- }
- }
- }
-
-
- }
-
- /**
- * Execute the display command.
- * Should call this method when you want display the selection into papyrus diagram.
- *
- * @throws JavaModelException
- */
- public void execute() throws JavaModelException {
- // Display the model
- if (model != null) {
- display(model.getName(), MODEL_TYPE);
- }
-
- // Cross selection to display each selected item
- for (IJavaElement item : items) {
- scanJavaElement(item);
- }
- }
-
- /**
- * Scan a Compilation Unit item
- * Just display it
- *
- * @param item
- * a selection compilation unit
- */
- private void scanCU(ICompilationUnit item) {
- String itemName = item.getElementName().substring(0, item.getElementName().length() - 5); // remove ".java" to the compilation unit name
- display(itemName, CU_TYPE);
- }
-
- /**
- * Scan a package.
- * Display it and cross its childs to display all sub-packages (and recursively)
- *
- * @param item
- * the package to scan
- * @throws JavaModelException
- */
- private void scanPackage(IPackageFragment item) throws JavaModelException {
- String itemName = item.getElementName();
- display(itemName, PACKAGE_TYPE);
- }
-
- /**
- * scan and display a JavaElement by delegates to scan{typeOfJavaElement}
- *
- * @param item
- * the item to display
- * @throws JavaModelException
- */
- private void scanJavaElement(IJavaElement item) throws JavaModelException {
- try {
- switch (item.getElementType()) {
- case IJavaElement.PACKAGE_FRAGMENT:
- scanPackage((IPackageFragment) item);
- break;
- case IJavaElement.COMPILATION_UNIT:
- scanCU((ICompilationUnit) item);
- break;
- }
- } catch (NullPointerException e) {
- System.err.println(item.getElementName() + "is NOT in selected uml model"); //$NON-NLS-1$
- }
- }
-
- /**
- * Display an element into papyrus diagram
- *
- * @param itemName
- * the name of element to display
- */
- private void display(String itemName, String type) {
- EObject item = this.umlModelNames.get(itemName);
- if (!diagram.getChildren().contains(item)) {
- ViewService.createNode(diagram, item, type, new PreferencesHint("org.eclipse.papyrus.uml.diagram.clazz")); //$NON-NLS-1$
- }
- }
-}
diff --git a/extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/DndReverseCodeHandler.java b/extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/DndReverseCodeHandler.java
deleted file mode 100644
index 1f735dca23c..00000000000
--- a/extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/DndReverseCodeHandler.java
+++ /dev/null
@@ -1,254 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2014 Jonathan Geoffroy.
- *
- *
- * 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:
- * Jonathan Geoffroy geoffroy.jonathan@gmail.com initial implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.java.reverse.ui;
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.TreeSet;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.common.util.TreeIterator;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.Shape;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.TreeSelection;
-import org.eclipse.papyrus.infra.core.Activator;
-import org.eclipse.papyrus.infra.core.services.ServiceException;
-import org.eclipse.papyrus.java.reverse.ui.dialog.DndReverseCodeDialog;
-import org.eclipse.papyrus.java.reverse.ui.dialog.ReverseCodeDialog;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.uml2.uml.Model;
-import org.eclipse.uml2.uml.NamedElement;
-
-/**
- * Handler to display reverse result into current papyrus diagram
- * This Handler is activated when user drag'n'drop java resource into papyrus diagram.<br>
- * It display just non displayed java resource.
- * Moreover, it use DndReverseCodeDialog to know if it have to display model, packages and CompilationUnit or not.
- *
- * @author Jonathan Geoffroy
- *
- */
-public class DndReverseCodeHandler extends ReverseCodeHandler {
-
- /**
- * true if and only if user want to display reversed compilation unit
- */
- private boolean displayCU;
-
- /**
- * true if and only if user want to display reversed packages
- */
- private boolean displayPackages;
-
- /**
- * true if and only if user want to display reversed model
- */
- private boolean displayModel;
-
- @Override
- /**
- * Find all resource to display (selection - resources which are already in the diagram), run the reverse command, before running the display command<br/>
- * @see org.eclipse.papyrus.java.reverse.ui.ReverseCodeHandler#doExecute(org.eclipse.papyrus.java.reverse.ui.dialog.ReverseCodeDialog)
- *
- * @param dialog The dialog previuosly used to get data from user. This dialog has already been called by execute().
- */
- protected void doExecute(ReverseCodeDialog dialog) {
- // Get user preferences on dialog
- DndReverseCodeDialog dndDialog = (DndReverseCodeDialog) dialog;
- displayModel = dndDialog.displayModel();
- displayPackages = dndDialog.displayPackages();
- displayCU = dndDialog.displayCU();
-
- // get current selection
- ISelection selection = getCurrentSelection();
- TreeSelection treeSelection = (TreeSelection) selection;
-
- // Run the reverse
- super.doExecute(dialog);
-
- // Try to insert result into current diagram
- try {
- // Find active papyrus diagram
- Diagram diagram = null;
- IEditorPart activeEditor = getNestedActiveIEditorPart();
- if (activeEditor != null) {
- diagram = activeEditor.getAdapter(Diagram.class);
- }
-
- // Remove items already in diagram from selection
- List<IJavaElement> listSelection;
- listSelection = selectionMinusAlreadyInDiagram(treeSelection, diagram);
-
- // Find model to display
- Model model = null;
- if (displayModel) {
- String modelName = dndDialog.getValue();
- model = getModelToDisplay(diagram, modelName);
- }
-
- // Run the reverse displayer
- DisplayReverse displayReverse = new DisplayReverse(listSelection, diagram, getUmlResource(), model);
- displayReverse.execute();
- } catch (JavaModelException e) {
- // Can't get a Papyrus ServiceRegistry.
- Shell shell = getShell();
- Status errorStatus = new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.DndReverseCodeHandler_CantDisplayResult_Title);
- ErrorDialog.openError(shell, "", Messages.DndReverseCodeHandler_CantDisplayResult_Message, errorStatus);
-
- } catch (ServiceException e) {
- // Can't get a Papyrus ServiceRegistry.
- Shell shell = getShell();
- Status errorStatus = new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.DndReverseCodeHandler_CantFindService_Title );
- ErrorDialog.openError(shell, "", Messages.DndReverseCodeHandler_CantFindService_Message+ " - " + e.getMessage(), errorStatus);
- }
-
- }
-
- @Override
- protected ReverseCodeDialog getDialog(Shell shell, String modelUid) {
- return new DndReverseCodeDialog(shell, modelUid, getSelectedProjectName(), null);
- }
-
- /**
- *
- * @param selection
- * java resources selected
- * @param diagram
- * opened papyrus diagram
- * @return selection - resources already in diagram
- * @throws JavaModelException
- */
- private List<IJavaElement> selectionMinusAlreadyInDiagram(TreeSelection selection, Diagram diagram) throws JavaModelException {
- // Add all diagram elements to Set
- TreeSet<String> alreadyExists = new TreeSet<String>();
- @SuppressWarnings("unchecked")
- List<View> diagramList = diagram.getChildren();
- Iterator<View> diagramIt = diagramList.iterator();
- Shape item;
- NamedElement e;
- while (diagramIt.hasNext()) {
- item = (Shape) diagramIt.next();
- e = (NamedElement) (item.getElement());
- alreadyExists.add(e.getName());
- }
-
- // remove all elements of Set from selection
- TreeSelectionList selectionList = new TreeSelectionList(selection, displayPackages, displayCU);
- ListIterator<IJavaElement> selectionIterator = selectionList.listIterator();
- String selectionItemName;
- while (selectionIterator.hasNext()) {
- selectionItemName = getName(selectionIterator.next());
- if (selectionItemName != null && alreadyExists.contains(selectionItemName)) {
- selectionIterator.remove();
- }
- }
-
- return selectionList;
- }
-
- /**
- * Find the name of <code>item</code> For java compilation unit, remove ".java" extension
- *
- * @param item
- * @return the name of item.
- */
- private String getName(IJavaElement item) {
- String name = item.getElementName();
- if (item instanceof ICompilationUnit) {
- return name.substring(0, name.length() - 5);
- }
- return name;
- }
-
- /**
- * find a model named <code>modelName</code>
- *
- * @param modelName
- * the name of the model the find
- * @return the model which named <code>modelName</code>, or null if it doesn't exists into the current papyrus uml resource
- * @throws ServiceException
- */
- public Model getModel(String modelName) throws ServiceException {
- TreeIterator<EObject> tree = getUmlResource().getAllContents();
- while (tree.hasNext()) {
- for (EObject o : tree.next().eContents()) {
- if (o instanceof Model) {
- // Add it into items to display
- Model model = (Model) o;
-
- // Search for model
- if (model.getName().equals(modelName)) {
- System.out.println("model = " + model);
- return model;
- }
- }
- }
- }
- System.out.println("model = null");
- return null;
- }
-
- /**
- * find the model named <code>modelName</code>, and get it only if it has to be displayed
- *
- * @param diagram
- * active papyrus diagram
- * @param modelName
- * the name of the model to find
- * @return model corresponding to the modelName if it has to be displayed, i.e. if it doesn't already displayed into the diagram, or null
- * otherwise
- * @throws ServiceException
- */
- private Model getModelToDisplay(Diagram diagram, String modelName) throws ServiceException {
- Model model = getModel(modelName);
- if (model != null && !isInDiagram(diagram, model)) {
- System.out.println("display model " + model);
- return model;
- }
- System.out.println("don't display model");
- return null;
- }
-
- /**
- *
- * @param diagram
- * @param model
- * @return true if model is in diagram
- */
- private boolean isInDiagram(Diagram diagram, Model model) {
- @SuppressWarnings("unchecked")
- EList<View> diagramList = diagram.getChildren();
- Iterator<View> diagramIt = diagramList.iterator();
- Shape item;
- while (diagramIt.hasNext()) {
- item = (Shape) diagramIt.next();
- if (item.getElement() == model) {
- return true;
- }
- }
- return false;
- }
-
-}
diff --git a/extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/JavaCodeReverse.java b/extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/JavaCodeReverse.java
deleted file mode 100644
index a9190952dcc..00000000000
--- a/extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/JavaCodeReverse.java
+++ /dev/null
@@ -1,287 +0,0 @@
-/**
- *
- */
-package org.eclipse.papyrus.java.reverse.ui;
-
-import japa.parser.JavaParser;
-import japa.parser.ParseException;
-import japa.parser.ast.CompilationUnit;
-
-import java.io.StringReader;
-import java.util.Iterator;
-import java.util.List;
-
-import javagen.umlparser.CompilationUnitAnalyser;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.IPackageFragment;
-import org.eclipse.jdt.core.IPackageFragmentRoot;
-import org.eclipse.jdt.core.ITypeRoot;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.TreeSelection;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.uml2.uml.Package;
-
-/**
- * @author dumoulin
- *
- */
-public class JavaCodeReverse {
-
- CompilationUnitAnalyser javaAnalyser;
-
- /**
- * Constructor.
- *
- * @param model
- */
- public JavaCodeReverse(Resource model) {
- javaAnalyser = new CompilationUnitAnalyser(model);
- }
-
- /**
- * Constructor.
- *
- * @param model
- */
- public JavaCodeReverse(Package rootPackage, String generatedPackageName, List<String> searchPaths) {
- javaAnalyser = new CompilationUnitAnalyser(rootPackage, generatedPackageName, searchPaths);
- }
-
-
- /**
- * @throws CoreException
- * @throws ParseException
- *
- */
- public void reverseResource(IResource resource) throws ParseException, CoreException {
- System.out.println("reverseResource(" + resource.getName() + ")");
-
- if (resource instanceof IFile) {
- reverseFile((IFile) resource);
- } else if (resource instanceof IFolder) {
- reverseFolder((IFolder) resource);
- } else if (resource instanceof IProject) {
- reverseProject((IProject) resource);
- }
-
- }
-
- /**
- * Walk throw each file in folder
- *
- * @param resource
- * @param model
- * @throws CoreException
- * @throws ParseException
- */
- private void reverseFolder(IFolder folder) throws CoreException, ParseException {
-
- for (IResource resource : folder.members()) {
- reverseResource(resource);
- }
-
- }
-
- /**
- * Walk throw each file in folder
- *
- * @param resource
- * @param model
- * @throws CoreException
- * @throws ParseException
- */
- private void reverseProject(IProject folder) throws CoreException, ParseException {
-
- for (IResource resource : folder.members()) {
- reverseResource(resource);
- }
-
- }
-
- /**
- * Reverse a file
- *
- * @param resource
- * @throws CoreException
- * @throws ParseException
- */
- private void reverseFile(IFile file) throws ParseException, CoreException {
- System.out.println("try to reverseFile(" + file.getName() + ")");
- if (!"java".equals(file.getFileExtension())) {
- return;
- }
-
- System.out.println("reverseFile(" + file.getName() + ")");
-
- CompilationUnit cu = JavaParser.parse(file.getContents());
- javaAnalyser.processCompilationUnit(cu);
- }
-
- /**
- * @throws CoreException
- * @throws ParseException
- *
- */
- public void reverseJavaElement(IJavaElement element) throws ParseException, CoreException
- {
- System.out.println("reverseJavaElement(" + element.getElementName() + ")");
-
- if (element instanceof ITypeRoot)
- {
- reverseCompilationUnit((ITypeRoot) element);
- }
- else if (element instanceof IPackageFragment)
- {
- reversePackageFragment((IPackageFragment) element);
- }
- else if (element instanceof IPackageFragmentRoot)
- {
- reversePackageFragmentRoot((IPackageFragmentRoot) element);
- }
- else
- {
- System.err.println("Can't reverse Java Element " + element);
- }
-
- }
-
- /**
- *
- * @param element
- * @throws ParseException
- * @throws CoreException
- */
- private void reversePackageFragmentRoot(IPackageFragmentRoot element) throws ParseException, CoreException {
-
- System.out.println("reversePackageFragmentRoot(" + element.getElementName() + ")");
-
- IJavaElement[] children = element.getChildren();
- for (IJavaElement child : children) {
- reverseJavaElement(child);
- }
-
- }
-
- /**
- *
- * @param element
- * @throws ParseException
- * @throws CoreException
- */
- private void reversePackageFragment(IPackageFragment element) throws ParseException, CoreException {
-
- System.out.println("reversePackageFragment(" + element.getElementName() + ")");
-
- IJavaElement[] children = element.getChildren();
- for (IJavaElement child : children) {
- reverseJavaElement(child);
- }
- }
-
- /**
- * Reverse a file
- *
- * @param resource
- * @throws CoreException
- * @throws ParseException
- */
- private void reverseCompilationUnit(ITypeRoot unit) throws ParseException, CoreException {
- System.out.println("try to reverseUnit(" + unit.getElementName() + ")");
- System.out.println("file type=(" + unit.getElementType() + ")");
-
- String source = unit.getSource();
- if (source == null)
- {
- System.err.println("No source attached to unit '" + unit.getElementName() + "'");
- return;
- }
-
-
- CompilationUnit cu = JavaParser.parse(new StringReader(source));
- javaAnalyser.processCompilationUnit(cu);
- }
-
- /**
- * Real Implementation of the command.
- *
- * @param generationPackageName
- * @param searchPaths
- */
- public void executeCodeReverse(Resource umlResource, String generationPackageName, List<String> searchPaths) {
- System.out.println("executeCodeReverse()");
-
- // Get current selection
- IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
- ISelection selection = page.getSelection();
-
- TreeSelection treeSelection = (TreeSelection) selection;
- // String filename = treeSelection.
- @SuppressWarnings("rawtypes")
- Iterator iter = treeSelection.iterator();
- while (iter.hasNext()) {
- Object obj = iter.next();
- // Translate java ICompilationUnit to Iresource
- if (obj instanceof ICompilationUnit) {
- ICompilationUnit u = (ICompilationUnit) obj;
- try {
- obj = u.getCorrespondingResource();
- } catch (JavaModelException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- if (obj instanceof IPackageFragment)
- {
- IPackageFragment u = (IPackageFragment) obj;
- try {
- IResource res = u.getCorrespondingResource();
- if (res != null) {
- obj = res;
- }
- } catch (JavaModelException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- // This happen when selection is an element from a jar
- if (obj instanceof IJavaElement)
- {
- IJavaElement u = (IJavaElement) obj;
- try {
-
- reverseJavaElement(u);
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- // This is a regular java file
- if (obj instanceof IResource)
- {
- try {
- reverseResource((IResource) obj);
- } catch (ParseException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (CoreException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- }
-
- System.out.println("reverse done");
-
- }
-
-}
diff --git a/extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/Messages.java b/extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/Messages.java
deleted file mode 100644
index 1ccc7715fcd..00000000000
--- a/extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/Messages.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package org.eclipse.papyrus.java.reverse.ui;
-
-import org.eclipse.osgi.util.NLS;
-
-public class Messages extends NLS {
-
- private static final String BUNDLE_NAME = "org.eclipse.papyrus.java.reverse.ui.messages"; //$NON-NLS-1$
-
- public static String ReverseCodeHandler_NoModelError_Message;
-
- public static String ReverseCodeHandler_NoModelError_Title;
-
- public static String ReverseCodeHandler_NoPapyrusEditor_Title;
-
- public static String ReverseCodeHandler_NoPapyrusEditor_Message;
-
- public static String DndReverseCodeHandler_CantDisplayResult_Title;
-
- public static String DndReverseCodeHandler_CantDisplayResult_Message;
-
- public static String DndReverseCodeHandler_CantFindService_Title;
-
- public static String DndReverseCodeHandler_CantFindService_Message;
-
- static {
- // initialize resource bundle
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-
- private Messages() {
- }
-}
diff --git a/extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/ReverseCodeHandler.java b/extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/ReverseCodeHandler.java
deleted file mode 100644
index 718f4f9ddc6..00000000000
--- a/extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/ReverseCodeHandler.java
+++ /dev/null
@@ -1,342 +0,0 @@
-/**
- *
- */
-package org.eclipse.papyrus.java.reverse.ui;
-
-import java.util.Arrays;
-import java.util.List;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.IHandler;
-import org.eclipse.core.expressions.IEvaluationContext;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.TreeSelection;
-import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.infra.core.Activator;
-import org.eclipse.papyrus.infra.core.sasheditor.editor.ISashWindowsContainer;
-import org.eclipse.papyrus.infra.core.services.ServiceException;
-import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
-import org.eclipse.papyrus.infra.core.services.spi.IContextualServiceRegistryTracker;
-import org.eclipse.papyrus.infra.core.utils.ServiceUtils;
-import org.eclipse.papyrus.infra.ui.util.ServiceUtilsForHandlers;
-import org.eclipse.papyrus.java.reverse.ui.dialog.ReverseCodeDialog;
-import org.eclipse.papyrus.uml.tools.model.UmlModel;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.ISources;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.handlers.HandlerUtil;
-import org.eclipse.uml2.uml.Package;
-
-
-/**
- * @author cedric dumoulin
- *
- */
-public class ReverseCodeHandler extends AbstractHandler implements IHandler {
-
- private static String DefaultGenerationModeleName = "generated";
-
- /**
- * Event provided to the execute method. The event is stored when the execute() method start.
- * Other method can then use this event.
- */
- protected ExecutionEvent event;
- protected ServicesRegistry registry;
-
- /**
- * Method called when button is pressed.
- */
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
-
- // Store the event in order to be able to use it from utility methods.
- this.event = event;
-
- // Try to find uml resource
- final Resource umlResource;
- try {
- // Lookup ServiceRegistry
- registry = lookupServiceRegistry(event);
-
- System.err.println("ServiceRegistry = " + registry);
- umlResource = getUmlResource();
- } catch (NullPointerException e) {
- // No uml resource available. User must open a model. We open an error dialog with an explicit message to advice user.
- Shell shell = getShell();
- Status errorStatus = new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.ReverseCodeHandler_NoModelError_Title);
- ErrorDialog.openError(shell, "", Messages.ReverseCodeHandler_NoModelError_Message, errorStatus);
-
- // Stop the reverse execution.
- return null;
- } catch (ServiceException e) {
- // Can't get a Papyrus ServiceRegistry.
- Shell shell = getShell();
- Status errorStatus = new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.ReverseCodeHandler_NoPapyrusEditor_Title);
- ErrorDialog.openError(shell, "", Messages.ReverseCodeHandler_NoPapyrusEditor_Message, errorStatus);
-
- // Stop the handler execution.
- return null;
- }
- ;
-
- String modelUid = getModelUid(umlResource);
-
- // Get reverse parameters from a dialog
- Shell shell = getShell();
- // ReverseCodeDialog dialog = new ReverseCodeDialog(shell, DefaultGenerationPackageName, Arrays.asList("generated") );
- final ReverseCodeDialog dialog = getDialog(shell, modelUid);
-
- int res = dialog.open();
- // System.out.println("dialog result =" + res);
- if (res == Window.CANCEL) {
- return null;
- }
-
- // Execute the reverse with provided parameters
- TransactionalEditingDomain editingDomain;
- try {
- editingDomain = getEditingDomain();
- } catch (ServiceException e) {
- // Can't get editing domain
- e.printStackTrace();
- throw new ExecutionException(e.getMessage());
- }
-
- RecordingCommand command = new RecordingCommand(editingDomain, "Reverse Java Code") {
-
- @Override
- protected void doExecute() {
- ReverseCodeHandler.this.doExecute(dialog);
- }
-
- };
-
- editingDomain.getCommandStack().execute(command);
-
-
- return null;
- }
-
- /**
- * Get the active shell from the event, or from the active page if event is null.
- *
- * @param event
- * @return
- */
- protected Shell getShell() {
-
- if(event != null ) {
- return HandlerUtil.getActiveShell(event);
- }
- else {
- return PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart().getSite().getShell();
-
- }
- }
-
- /**
- * @param event
- * @return
- */
- protected ServicesRegistry lookupServiceRegistry(ExecutionEvent event) throws ServiceException {
-
- ServicesRegistry registry;
-
- try {
- // This utility accept null event.
- registry = ServiceUtilsForHandlers.getInstance().getServiceRegistry(event);
- } catch (ServiceException e1) {
- registry = getContextualServiceRegistry();
- }
- return registry;
- }
-
- /**
- * Find the modelUid name contains into umlResource taken in parameter
- *
- * @param umlResource
- * @return the modelUid name
- */
- private String getModelUid(Resource umlResource) {
- // Try to compute a uid identifying the model. Used to store user settings.
- String modelUid = umlResource.getURI().toPlatformString(true);
- if (modelUid == null) {
- // Can't compute relatif model uid. Use absolute one
-// System.err.println("Can't compute relatif model uid. Use absolute one");
- modelUid = umlResource.getURI().path();
- }
- return modelUid;
- }
-
- /**
- * Command ran in a RecordingCommand, after the dialog
- * Run the @link{JavaCodeReverse.executeCodeReverse}
- * Shall be override to change command behavior
- */
- protected void doExecute(ReverseCodeDialog dialog) {
- // Create searchpaths. Add the rootmodelname as prefix.
- final List<String> searchPaths = Arrays.asList(dialog.getSearchPath());
- Resource umlResource;
- try {
- umlResource = getUmlResource();
- } catch (ServiceException e) {
- // Should never happen, as we have already used this method and check its result (with an error message).
- return;
- }
- String packageName = getPackageName(dialog);
- JavaCodeReverse reverse = new JavaCodeReverse(getRootPackage(umlResource), packageName, searchPaths);
- reverse.executeCodeReverse(umlResource, packageName, searchPaths);
- }
-
- /**
- * The dialog used for user.
- *
- * @param shell
- * @param modelUid
- * @return the dialog to show to user
- */
- protected ReverseCodeDialog getDialog(Shell shell, String modelUid) {
- return new ReverseCodeDialog(shell, modelUid, getSelectedProjectName(), null);
- }
-
- /**
- *
- * @return the name of the selected project into explorer
- */
- protected String getSelectedProjectName() {
-
- // Lookup selection
- ISelection selection = getCurrentSelection();
-
- // Lookup the java compilation unit.
- TreeSelection treeSelection = (TreeSelection)selection;
- IJavaElement selectionElement = (IJavaElement)treeSelection.getFirstElement();
- String name = selectionElement.getAncestor(IJavaProject.JAVA_PROJECT).getElementName();
- return name;
- }
-
- /**
- * Get the current selection.
- * First, try with ISources.ACTIVE_CURRENT_SELECTION_NAME.
- * Then try with PlatformUI.getWorkbench() ...
- * @return
- */
- protected ISelection getCurrentSelection() {
- ISelection selection=null;
-
- if (event != null) {
- // Try to get selection from context
- Object context = event.getApplicationContext();
- if ( context instanceof IEvaluationContext) {
- IEvaluationContext evaluationContext = (IEvaluationContext) context;
- selection = (ISelection)evaluationContext.getVariable(ISources.ACTIVE_CURRENT_SELECTION_NAME);
- }
- }
- if( selection == null) {
- // Try to get selection from ActivePage
- IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
- selection = page.getSelection();
- }
- return selection;
- }
-
- /**
- * Find the name of the model provided by the dialog
- *
- * @param dialog
- * opened dialog to user
- * @return the name of the model. If the user has changed this name, return the name provided by the user; return the default model name
- * otherwise.
- */
- protected String getPackageName(ReverseCodeDialog dialog) {
- String generationPackageName = dialog.getValue();
- if (generationPackageName == null || generationPackageName.length() == 0) {
- generationPackageName = DefaultGenerationModeleName;
- }
- return generationPackageName;
- }
-
- /**
- * Get the uml resource used by the model.
- *
- * @return the Uml Resource
- * @throws ServiceException
- */
- protected Resource getUmlResource() throws ServiceException {
-
- UmlModel umlModel = (UmlModel)ServiceUtils.getInstance().getModelSet(registry).getModel(UmlModel.MODEL_ID);
- Resource umlResource = umlModel.getResource();
- return umlResource;
- }
-
- /**
- * Get the name of the root model.
- *
- * @return
- */
- protected Package getRootPackage(Resource umlResource) {
- Package rootPackage = (Package) umlResource.getContents().get(0);
- return rootPackage;
- }
-
- /**
- * Gets the {@link IEditorPart} of the currently nested active editor.
- *
- * @param from
- * @return
- * @throws ServiceException
- * If an error occurs while getting the requested service.
- */
- public IEditorPart getNestedActiveIEditorPart() throws ServiceException {
- return ServiceUtils.getInstance().getService(ISashWindowsContainer.class, registry).getActiveEditor();
- }
-
- /**
- * Get the current MultiDiagramEditor.
- *
- * @return
- */
-// protected IMultiDiagramEditor getMultiDiagramEditor() {
-// return EditorUtils.getMultiDiagramEditor();
-// }
-
- /**
- * Get the main editing doamin.
- *
- * @return
- * @throws ServiceException
- */
- protected TransactionalEditingDomain getEditingDomain() throws ServiceException {
- return ServiceUtils.getInstance().getTransactionalEditingDomain(registry);
- }
-
- /**
- * Obtains the service registry determined automatically from the context of which
- * Papyrus editor or view is active (implying the model that the user is currently editing).
- *
- * @return the contextual service registry, or {@code null} if none can be determined
- * @throws ServiceException
- * @since 2.0
- */
- protected ServicesRegistry getContextualServiceRegistry() throws ServiceException {
- IContextualServiceRegistryTracker tracker = Activator.getDefault().getContextualServiceRegistryTracker();
- if( tracker !=null) {
- return tracker.getServiceRegistry();
- }
- throw new ServiceException("Can't get ServiceRegistry from Tracker");
- }
-
-
-}
diff --git a/extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/TreeSelectionList.java b/extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/TreeSelectionList.java
deleted file mode 100644
index 370a9c0319e..00000000000
--- a/extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/TreeSelectionList.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2014 Jonathan Geoffroy.
- *
- *
- * 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:
- * Jonathan Geoffroy geoffroy.jonathan@gmail.com initial implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.java.reverse.ui;
-
-import java.util.Iterator;
-import java.util.LinkedList;
-
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.IPackageFragment;
-import org.eclipse.jdt.core.IPackageFragmentRoot;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jface.viewers.TreeSelection;
-
-/**
- * Transform a TreeSelection collection, provided by java resource selection, into a java List (java.util.List). <br>
- * Add each element of TreeSelection which have to be displayed. i.e. include packages if <code>includePackages</code> == true; include compilation
- * unit if <code>inclupdeCU</code> == true<br/>
- * Note the each element of TreeSelection is a IJavaElement.
- *
- * @author Jonathan Geoffroy
- *
- */
-public class TreeSelectionList extends LinkedList<IJavaElement> {
-
- /**
- *
- */
- private static final long serialVersionUID = -5749380826507346600L;
-
- /**
- * True if and only if this list includes packages
- */
- private boolean includePackages;
-
- /**
- * True if and only if this list includes packages
- */
- private boolean includeCU;
-
- /**
- *
- * Constructor.
- *
- * @param treeSelection
- * java resources selection
- * @param includePackages
- * True if and only if this list includes packages from <code>treeSelection</code>
- * @param includeCU
- * True if and only if this list includes compilation units from <code>treeSelection</code>
- * @throws JavaModelException
- */
- public TreeSelectionList(TreeSelection treeSelection, boolean includePackages, boolean includeCU) throws JavaModelException {
- super();
- this.includePackages = includePackages;
- this.includeCU = includeCU;
-
- // Add each treeSelection item into the list
- addAll(treeSelection);
- }
-
- /**
- *
- * @param selection
- * @throws JavaModelException
- */
- private void addAll(TreeSelection selection) throws JavaModelException {
- Iterator<IJavaElement> selectionIterator = selection.iterator();
- while (selectionIterator.hasNext()) {
- IJavaElement item = selectionIterator.next();
- scanJavaElement(item);
- }
- }
-
- /**
- * Scan a Compilation Unit item
- * Just add it if it's necessary
- *
- * @param item
- * a selection compilation unit
- */
- private void scanCU(ICompilationUnit item) {
- if (includeCU) {
- add(item);
- }
- }
-
- /**
- * Scan a package.
- * add it if it's necessary and cross its childs to display all sub-packages (and recursively)
- *
- * @param item
- * the package to scan
- * @throws JavaModelException
- */
- private void scanPackage(IPackageFragment item) throws JavaModelException {
- if (includePackages) {
- add(item);
- }
-
- // Recursive search in tree
- for (IJavaElement child : item.getChildren()) {
- scanJavaElement(child);
- }
- }
-
- /**
- * Scan a source folder.
- * add its childs (and recursively) by calling scanJavaElement on each child
- *
- * @param item
- * the folder to scan
- * @throws JavaModelException
- */
- private void scanFolder(IPackageFragmentRoot item) throws JavaModelException {
- // Recursive search in tree
- for (IJavaElement child : item.getChildren()) {
- scanJavaElement(child);
- }
- }
-
- /**
- * scan and add a JavaElement by delegates to scan{typeOfJavaElement}
- *
- * @param item
- * the item to display
- * @throws JavaModelException
- */
- private void scanJavaElement(IJavaElement item) throws JavaModelException {
- switch (item.getElementType()) {
- case IJavaElement.PACKAGE_FRAGMENT_ROOT:
- scanFolder((IPackageFragmentRoot) item);
- break;
- case IJavaElement.PACKAGE_FRAGMENT:
- scanPackage((IPackageFragment) item);
- break;
- case IJavaElement.COMPILATION_UNIT:
- scanCU((ICompilationUnit) item);
- break;
- }
- }
-}
diff --git a/extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/dialog/DndReverseCodeDialog.java b/extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/dialog/DndReverseCodeDialog.java
deleted file mode 100644
index 05180af829d..00000000000
--- a/extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/dialog/DndReverseCodeDialog.java
+++ /dev/null
@@ -1,93 +0,0 @@
-package org.eclipse.papyrus.java.reverse.ui.dialog;
-
-import java.util.List;
-
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.papyrus.java.reverse.ui.Activator;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Shell;
-
-
-public class DndReverseCodeDialog extends ReverseCodeDialog {
-
- private static final String DISPLAY_MODEL_UID = ":DISPLAY_MODEL"; //$NON-NLS-1$
- private static final String DISPLAY_PACKAGES_UID = ":DISPLAY_PACKAGES"; //$NON-NLS-1$
- private static final String DISPLAY_CU_UID = ":DISPLAY_CU"; //$NON-NLS-1$
- private Button displayModelCheckbox;
- private Button displayPackagesCheckbox;
- private Button displayCUCheckbox;
-
- private boolean displayModel;
- private boolean displayPackages;
- private boolean displayCU;
-
- public DndReverseCodeDialog(Shell parentShell, String modelUid, String initialValue, List<String> searchPathsInitialValues) {
- super(parentShell, modelUid, initialValue, searchPathsInitialValues);
-
- }
-
- @Override
- protected Control createDialogArea(Composite parent) {
- IDialogSettings settings = Activator.getDefault().getDialogSettings();
- Composite composite = (Composite) super.createDialogArea(parent);
-
- // Create button to display or not the model
- displayModelCheckbox = new Button(composite, SWT.CHECK);
- displayModelCheckbox.setText("Display reversed Model into diagram");
- displayModelCheckbox.setSelection(settings.getBoolean(MODEL_UID + DISPLAY_MODEL_UID));
-
- // Create button to display or not package
- displayPackagesCheckbox = new Button(composite, SWT.CHECK);
- displayPackagesCheckbox.setText("Display reversed UML::packages into diagram");
- displayPackagesCheckbox.setSelection(settings.getBoolean(MODEL_UID + DISPLAY_PACKAGES_UID));
-
- // Create button to display or not CompilationUnit
- displayCUCheckbox = new Button(composite, SWT.CHECK);
- displayCUCheckbox.setText("Display UML::classes, UML::interfaces, UML::enumerations into diagram");
- displayCUCheckbox.setSelection(settings.getBoolean(MODEL_UID + DISPLAY_CU_UID));
-
- return composite;
- }
-
- @Override
- protected void okPressed() {
- // add selection into fields to prevent dialog disposing
- displayModel = displayModelCheckbox.getSelection();
- displayPackages = displayPackagesCheckbox.getSelection();
- displayCU = displayCUCheckbox.getSelection();
-
- // save selection into settings
- IDialogSettings settings = Activator.getDefault().getDialogSettings();
- settings.put(MODEL_UID + DISPLAY_MODEL_UID, displayModel);
- settings.put(MODEL_UID + DISPLAY_PACKAGES_UID, displayPackages);
- settings.put(MODEL_UID + DISPLAY_CU_UID, displayCU);
- super.okPressed();
- }
-
- /**
- *
- * @return true if displayModelCheckbox is checked
- */
- public boolean displayModel() {
- return displayModel;
- }
-
- /**
- *
- * @return true if displayPackagesCheckbox is checked
- */
- public boolean displayPackages() {
- return displayPackages;
- }
-
- /**
- *
- * @return true if displayCUCheckbox is checked
- */
- public boolean displayCU() {
- return displayCU;
- }
-}
diff --git a/extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/dialog/InputListDialog.java b/extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/dialog/InputListDialog.java
deleted file mode 100644
index f8c4fd0a58e..00000000000
--- a/extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/dialog/InputListDialog.java
+++ /dev/null
@@ -1,332 +0,0 @@
-/**
- *
- */
-package org.eclipse.papyrus.java.reverse.ui.dialog;
-
-import java.util.List;
-
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-
-/**
- * @author dumoulin
- *
- */
-public class InputListDialog {
-
- /** Message to be show */
- private String message;
-
- /** Message to be show */
- private String tooltips;
-
- /** List of fields to show */
- private List<String> fieldList;
-
- /**
- * Input text widget.
- */
- private Text addToListText;
-
- private org.eclipse.swt.widgets.List listWidget;
-
- /**
- * Constructor.
- *
- * @param msg
- * @param list
- */
- public InputListDialog(String msg, List<String> list) {
- this.message = msg;
- this.fieldList = list;
- }
-
-
-
- /**
- * @param tooltips
- * the tooltips to set
- */
- public void setTooltips(String tooltips) {
- this.tooltips = tooltips;
- }
-
-
- /**
- * Return the selected list.
- *
- * @return
- */
- public String[] getList() {
- return listWidget.getItems();
- }
-
- /**
- *
- * @param parent
- * @return
- */
- public Control createDialogArea(Composite parent) {
- // create composite
- Composite composite = parent;
- // create message
- if (message != null) {
- Label label = new Label(composite, SWT.WRAP);
- label.setText(message);
- GridData data = new GridData(GridData.GRAB_HORIZONTAL
- /* | GridData.GRAB_VERTICAL */| GridData.HORIZONTAL_ALIGN_FILL
- | GridData.VERTICAL_ALIGN_CENTER);
- // data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
- label.setLayoutData(data);
- label.setFont(parent.getFont());
- setToolTip(label, tooltips);
- ;
- }
-
- // button
- createButtonBar(composite);
-
- // list
- listWidget = new org.eclipse.swt.widgets.List(composite, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.RESIZE);
-
- GridData listData = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_VERTICAL | GridData.VERTICAL_ALIGN_FILL);
-
- listData.heightHint = 100;
- listWidget.setLayoutData(listData);
- setToolTip(listWidget, tooltips);
- if (fieldList != null) {
- for (String item : fieldList) {
- listWidget.add(item);
- }
- }
-
- // applyDialogFont(composite);
- return composite;
- }
-
-
- /**
- * Set the tooltips if not null.
- *
- * @param parent
- * @param tooltips
- */
- private void setToolTip(Control parent, String tooltips) {
- if (tooltips != null) {
- parent.setToolTipText(tooltips);
- }
- }
-
- /**
- * Returns the style bits that should be used for the input text field.
- * Defaults to a single line entry. Subclasses may override.
- *
- * @return the integer style bits that should be used when creating the
- * input text
- *
- * @since 3.4
- */
- protected int getInputTextStyle() {
- return SWT.SINGLE | SWT.BORDER;
- }
-
- /**
- * Creates and returns the contents of this dialog's button bar.
- * <p>
- * The <code>Dialog</code> implementation of this framework method lays out a button bar and calls the <code>createButtonsForButtonBar</code> framework method to populate it. Subclasses may override.
- * </p>
- * <p>
- * The returned control's layout data must be an instance of <code>GridData</code>.
- * </p>
- *
- * @param parent
- * the parent composite to contain the button bar
- * @return the button bar control
- */
- protected Control createButtonBar(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- // create a layout with spacing and margins appropriate for the font
- // size.
- GridLayout layout = new GridLayout();
- layout.numColumns = 0; // this is incremented by createButton
- layout.makeColumnsEqualWidth = false;
- // layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
- // layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
- // layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
- // layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
- composite.setLayout(layout);
- GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL
- | GridData.VERTICAL_ALIGN_CENTER);
- composite.setLayoutData(data);
- composite.setFont(parent.getFont());
-
- // Add the buttons to the button bar.
- createButtonsForButtonBar(composite);
- return composite;
- }
-
- /**
- * Adds buttons to this dialog's button bar.
- * <p>
- * The <code>Dialog</code> implementation of this framework method adds standard ok and cancel buttons using the <code>createButton</code> framework method. These standard buttons will be accessible from <code>getCancelButton</code>, and
- * <code>getOKButton</code>. Subclasses may override.
- * </p>
- *
- * @param parent
- * the button bar composite
- */
- protected void createButtonsForButtonBar(Composite parent) {
- // create OK and Cancel buttons by default
- // Create input text
- // input text
- ((GridLayout) parent.getLayout()).numColumns++;
- addToListText = new Text(parent, getInputTextStyle());
- setButtonLayoutData(addToListText);
- addToListText.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING
- | GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL));
-
- // Create a Button
- ((GridLayout) parent.getLayout()).numColumns++;
- Button button = new Button(parent, SWT.PUSH);
- button.setText("add");
- button.setFont(JFaceResources.getDialogFont());
- button.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent event) {
- addPressed();
- }
- });
- setButtonLayoutData(button);
-
- // remove
- ((GridLayout) parent.getLayout()).numColumns++;
- button = new Button(parent, SWT.PUSH);
- button.setText("-");
- button.setFont(JFaceResources.getDialogFont());
- button.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent event) {
- removedPressed();
- }
- });
- setButtonLayoutData(button);
-
- // up
- ((GridLayout) parent.getLayout()).numColumns++;
- button = new Button(parent, SWT.PUSH);
- button.setText("^");
- button.setFont(JFaceResources.getDialogFont());
- button.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent event) {
- upPressed();
- }
- });
- setButtonLayoutData(button);
-
- // down
- ((GridLayout) parent.getLayout()).numColumns++;
- button = new Button(parent, SWT.PUSH);
- button.setText("v");
- button.setFont(JFaceResources.getDialogFont());
- button.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent event) {
- downPressed();
- }
- });
- setButtonLayoutData(button);
-
-
- }
-
- /**
- * Called when add button is pressed.
- */
- protected void addPressed() {
- System.out.println("add pressed " + addToListText.getText());
- String msg = addToListText.getText();
- if (msg.length() == 0) {
- return;
- }
-
- msg.trim();
- listWidget.add(msg);
- // listWidget.pack(true);
- }
-
- protected void upPressed() {
- System.out.println("up pressed");
- int selectionIndex = listWidget.getSelectionIndex();
-
- if (selectionIndex > 0) {
- swapItems(selectionIndex - 1, selectionIndex);
- listWidget.setSelection(selectionIndex - 1);
- }
- }
-
- /**
- * Swap items in the list
- *
- * @param down
- * @param up
- */
- private void swapItems(int down, int up) {
- String tmp = listWidget.getItem(down);
- listWidget.setItem(down, listWidget.getItem(up));
- listWidget.setItem(up, tmp);
- }
-
- protected void downPressed() {
- System.out.println("down pressed");
- int selectionIndex = listWidget.getSelectionIndex();
-
- if (selectionIndex < listWidget.getItemCount() - 1) {
- swapItems(selectionIndex, selectionIndex + 1);
- listWidget.setSelection(selectionIndex + 1);
- }
- }
-
-
- protected void removedPressed() {
- System.out.println("removed pressed");
- int selectionIndex = listWidget.getSelectionIndex();
-
- String old = listWidget.getItem(selectionIndex);
- listWidget.remove(selectionIndex);
- addToListText.setText(old);
- }
-
-
- /**
- * Set the layout data of the button to a GridData with appropriate heights
- * and widths.
- *
- * @param button
- */
- protected void setButtonLayoutData(Control button) {
- GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- // int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
- Point minSize = button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
- // data.widthHint = Math.max(widthHint, minSize.x);
- data.widthHint = minSize.x;
- button.setLayoutData(data);
- }
-
-
-
-}
diff --git a/extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/dialog/ReverseCodeDialog.java b/extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/dialog/ReverseCodeDialog.java
deleted file mode 100644
index 43289f2953b..00000000000
--- a/extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/dialog/ReverseCodeDialog.java
+++ /dev/null
@@ -1,340 +0,0 @@
-/**
- *
- */
-package org.eclipse.papyrus.java.reverse.ui.dialog;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.LinkedList;
-import java.util.List;
-
-import javagen.umlparser.CreationPackageCatalog;
-
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.dialogs.InputDialog;
-import org.eclipse.papyrus.java.reverse.ui.Activator;
-import org.eclipse.papyrus.java.reverse.ui.preference.ReversePreference;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.RowLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * @author dumoulin
- *
- */
-public class ReverseCodeDialog extends InputDialog {
-
- /** Internal dialog to show list of searchpaths */
- private InputListDialog listDialog;
-
- /** Internal dialog to show list of creation paths */
- private InputListDialog creationPathsDialog;
-
- /** Returned searchpaths */
- private String[] searchPath;
- /** creationPaths read by the list. One line pattern by element */
- private String[] creationPaths;
- /** splitted creationPaths. pattern lines are splitted in small path */
- private List<String> splittedCreationPaths;
-
- private String SEARCHPATHS_UID = ":searchpaths";
- private String CREATIONPATHS_UID = ":creationpaths";
- private static final String STEREOTYPERADIO_UID = ":stereotypeRadioButton";
- private static final String PROJECTNAME_UID = ":projectName";
-
- protected String MODEL_UID = "nomodeluid";
-
- /**
- * then name of the selected project
- */
- private String projectName;
-
- private static String textMsg = "Default creation package.";
- @SuppressWarnings("unused")
- private static String creationPackageTooltips = "The default creation package is used when no matching creation package are found.";
-
-
- private static String dialogTitle = "Reverse Code";
-
- private static String listMsg = "search paths - list of model packages used to search for already existing classes (ex: p1/p2)";
- private static String listTooltips = "search paths - list of model packages used to search for already existing classes (ex: p1/p2)";
-
- private static String creationPathMsg = "creation paths \n"
- + "pattern: includePath ; excludePath ; destination (use ';' as separator)\n";
-
- private static String creationPathTooltips = "creation paths - list of path describing the models inside which reversed classes will be generated.\n"
- + "pattern: includeJavaPackage ; excludeJavaPackage ; destinationPath (use ';' as separator)\n"
- + "includeJavaPackage: the java package that should be mapped. Can contain a '*'.\n"
- + "excludeJavaPackage: the java package that should be excluded. Can contain a '*'.\n"
- + "destinationPath: the uml model inside which matching java packages will be created. Can contain a '*'.\n"
- + "if destinationPath contains a '*', it will be replaced by the partname found at the place of '*'\n"
- + "in the includeJavaPackage\n"
- + "\n"
- + "ex: eclipse.org.* ; eclipse.org.papyrus ; *";
-
-
- /**
- * @param parentShell
- * @param dialogTitle
- * @param dialogMessage
- * @param projectName
- * @param validator
- */
- public ReverseCodeDialog(Shell parentShell, String modelUid, String projectName, List<String> searchPathsInitialValues) {
- super(parentShell, dialogTitle, textMsg, getInitialValue(modelUid, projectName), null);
- // TODO Auto-generated constructor stub
- IDialogSettings settings = Activator.getDefault().getDialogSettings();
-
- MODEL_UID = modelUid;
- this.projectName = projectName;
-
- // Look for generationPackageName if none is provided.
- // if(initialValue == null)
- // {
- // String generationPackageName = settings.get("generationPackageName");
- // getText().setText(generationPackageName);
- //
- // }
-
- // Find default values for search path and creation path
- ReversePreference preference = new ReversePreference();
-
- if (searchPathsInitialValues == null) {
- String[] savedSearchPath = settings.getArray( getRootSettingKey() + SEARCHPATHS_UID);
- if(savedSearchPath != null)
- searchPathsInitialValues = Arrays.asList(savedSearchPath);
- else
- {
- searchPathsInitialValues = getDefaultSearchPath(preference);
- }
- }
-
- // Look for saved creationPaths if none is provided.
- if (creationPaths == null) {
- String[] savedSearchPath = settings.getArray( getRootSettingKey() + CREATIONPATHS_UID);
- if(savedSearchPath != null)
- creationPaths = savedSearchPath;
- else
- creationPaths = getDefaultCreationPath(preference);
- }
-
- // Look for saved creationPaths if none is provided.
- if(creationPaths == null ) {
- String[] savedSearchPath = settings.getArray( getRootSettingKey() + CREATIONPATHS_UID);
- if(savedSearchPath != null)
- creationPaths = savedSearchPath;
- else
- creationPaths = CreationPackageCatalog.getDefaultPackageCreationPatterns(" ; ");
- }
-
- listDialog = new InputListDialog(listMsg, searchPathsInitialValues);
- listDialog.setTooltips(listTooltips);
- creationPathsDialog = new InputListDialog(creationPathMsg, Arrays.asList(creationPaths));
- creationPathsDialog.setTooltips(creationPathTooltips);
- }
-
- /**
- *
- * @return the root of the setting key
- */
- private String getRootSettingKey() {
- return MODEL_UID + projectName;
- }
-
- /**
- *
- * @param preference
- * the eclipse preferences
- * @return default values of SearchPath from eclipse preferences
- */
- private List<String> getDefaultSearchPath(ReversePreference preference) {
- String[] defaultSearchPath = preference.getSearchPath();
- LinkedList<String> listSearchPath = new LinkedList<String>();
- for(String path : defaultSearchPath) {
- listSearchPath.add(path);
- }
- return listSearchPath;
- }
-
- /**
- *
- * @param preference
- * the eclipse preferences
- * @return default values of CreationPath from eclipse preferences
- */
- private String[] getDefaultCreationPath(ReversePreference preference) {
- String[] defaultCreationPath = preference.getCreationPath();
- return defaultCreationPath;
- }
-
- /**
- *
- * @param modelUid
- * @param projectName
- * the name of the reversed project
- * @return initialValue contained into setting, or <code>projectName</code> if it doesn't exists
- */
- private static String getInitialValue(String modelUid, String projectName) {
- IDialogSettings settings = Activator.getDefault().getDialogSettings();
-
- // Look for generationPackageName
- String generationPackageName = settings.get(modelUid + projectName + PROJECTNAME_UID);
- if(generationPackageName != null) {
- return generationPackageName;
-
- }
- return projectName;
- }
-
- /**
- * Allows resizing.
- */
- @Override
- protected boolean isResizable() {
- // TODO Auto-generated method stub
- return true;
- }
-
- /**
- * Get the returned searchpaths.
- *
- * @return
- */
- public String[] getSearchPath() {
- return searchPath;
- }
-
- /**
- * Get the returned creationPaths, one pattern for each entry, separated by ';'.
- *
- * @return
- */
- public List<String> getCreationPaths() {
-
- return splittedCreationPaths;
- }
-
-
- /**
- * Create additional list of searchpaths.
- */
- @Override
- protected Control createDialogArea(Composite parent) {
- // create composite
- Composite composite = (Composite) super.createDialogArea(parent);
-
- listDialog.createDialogArea(composite);
- creationPathsDialog.createDialogArea(composite);
- return composite;
- }
-
- /**
- * Save the searchpath after the button is pressed.
- */
- @Override
- protected void okPressed() {
- // Save the list before the control is disposed
- searchPath = listDialog.getList();
- creationPaths = creationPathsDialog.getList();
- String defaultCreationPath = getValue();
- if(defaultCreationPath == null || defaultCreationPath.length() == 0)
- defaultCreationPath = CreationPackageCatalog.getDefaultCreationPath();
-
-
- // Check inputs
- try {
- // Check paths
- splittedCreationPaths = computeCreationPaths(creationPaths);
- CreationPackageCatalog.validateCreationPath(splittedCreationPaths);
- // add default searchPaths
- searchPath = addDefaultSearchPaths(Arrays.asList(searchPath), splittedCreationPaths).toArray(new String[0]);
-
- } catch (Exception e) {
- // TODO Auto-generated catch block
- showError(e.getMessage());
- return;
- }
-
-
- // save values
- IDialogSettings settings = Activator.getDefault().getDialogSettings();
- settings.put(getRootSettingKey() + SEARCHPATHS_UID, searchPath);
- settings.put(getRootSettingKey() + CREATIONPATHS_UID, creationPaths);
- settings.put(getRootSettingKey() + PROJECTNAME_UID, getValue());
-
-
- super.okPressed();
- }
-
-
- /**
- * Add the defaultSearchPath extracted from the splittedCreationPath to the searchPath.
- *
- * @param splittedCreationPaths2
- */
- private List<String> addDefaultSearchPaths(List<String> searchPath, List<String> splittedCreationPaths) {
-
-
- List<String> result = new ArrayList<String>(searchPath.size() + splittedCreationPaths.size());
- result.addAll(searchPath);
-
- List<String> additionalPaths = CreationPackageCatalog.extractCreationPaths(splittedCreationPaths.toArray(new String[0]));
- for (String toAdd : additionalPaths) {
- if (!result.contains(toAdd)) {
- result.add(toAdd);
- }
- }
-
- return result;
- }
-
- /**
- * Show an error message
- *
- * @param message
- */
- private void showError(String message) {
- System.err.println("Error: " + message);
-
- }
-
-
- /**
- * Compute and check the creationsPaths
- *
- * @param creationPaths
- * An array with one creationPattern by element
- * @return An array with one path by elements
- * @throws Exception
- */
- private List<String> computeCreationPaths(String[] creationPaths) throws Exception {
-
- List<String> result = new ArrayList<String>();
-
- // Iterate line by line
- // For each line, separate the 3 patterns
- // If a pattern is empty, put a null
- for (String line : creationPaths) {
- String[] eles = line.split(";");
- if (eles.length != 3) {
- throw new Exception("A line must contains 3 pattern separated by ';' :" + line);
- }
- for (String ele : eles)
- {
- ele = ele.trim();
- if (ele.length() == 0) {
- ele = null;
- }
- // add ele
- result.add(ele);
- }
- }
- return result;
- }
-
-
-}
diff --git a/extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/dnd/DropReverseCommand.java b/extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/dnd/DropReverseCommand.java
deleted file mode 100755
index b78f05e39c6..00000000000
--- a/extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/dnd/DropReverseCommand.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2014 Jonathan Geoffroy.
- *
- *
- * 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:
- * Jonathan Geoffroy geoffroy.jonathan@gmail.com - initial implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.java.reverse.ui.dnd;
-
-import java.util.List;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.papyrus.java.reverse.ui.DndReverseCodeHandler;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * Command called when user drop Java Elements into diagram model (on Papyrus editor).
- * Check for selected elements, and run reverse handler if all selected files are reversible.
- *
- * This command implements a Singleton Pattern. You should use ReverseCommand.getInstance() to receive a Singleton of this Command.
- *
- * @author Jonathan Geoffroy
- *
- */
-public class DropReverseCommand extends Command {
-
- /**
- * Singleton implementation of ReverseCommand
- * Always return this instance of Reverse Command when ask for instance
- *
- * @see {getInstance()}
- */
- private static DropReverseCommand instance;
-
- /**
- * Constructor. Initialize the request for this ReverseCommand
- */
- private DropReverseCommand() {
- super();
- }
-
- @Override
- public boolean canExecute() {
- // Find the type of each selected file (CompilationUnit, packages ...)
- List<?> selected; // The selected files from JDT
-
- IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
- ISelection selection = page.getSelection();
- if (!(selection instanceof IStructuredSelection)) {
- return false;
- }
- IStructuredSelection structuredSelection = (IStructuredSelection) selection;
- selected = structuredSelection.toList();
-
- // For each selected object, check if it's reversible.
- for (Object s : selected) {
- // We can only reverse Java Elements. Moreover, reversing projects is not available yet
- if (!(s instanceof IJavaElement) || s instanceof IProject) {
- return false;
- }
- }
- return true;
- }
-
- @Override
- public void execute() {
- DndReverseCodeHandler reverse = new DndReverseCodeHandler();
- try {
-
- reverse.execute(null);
- } catch (ExecutionException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * return a singleton of this command
- * Change the request if it differ from the previous calling
- * @param targetEditPart
- *
- *
- * @return a singleton of this command
- */
- public static DropReverseCommand getInstance(Request request, EditPart targetEditPart) {
- if (instance == null) {
- instance = new DropReverseCommand();
- }
-
- return instance;
- }
-}
diff --git a/extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/dnd/DropReverseStrategy.java b/extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/dnd/DropReverseStrategy.java
deleted file mode 100755
index 4cc990969c8..00000000000
--- a/extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/dnd/DropReverseStrategy.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2014 Jonathan Geoffroy.
- *
- *
- * 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:
- * Jonathan Geoffroy geoffroy.jonathan@gmail.com - initial implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.java.reverse.ui.dnd;
-
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.papyrus.infra.gmfdiag.dnd.strategy.DropStrategy;
-import org.eclipse.swt.graphics.Image;
-
-
-public class DropReverseStrategy implements DropStrategy {
- public DropReverseStrategy() {
- }
-
- @Override
- public String getLabel() {
- return Messages.DropReverseStrategy_LABEL;
- }
-
- @Override
- public String getDescription() {
- return Messages.DropReverseStrategy_DESCRIPTION;
- }
-
- @Override
- public Image getImage() {
- // No image to display
- return null;
- }
-
- @Override
- public String getID() {
- return "org.eclipse.papyrus.java.reverse.ui.dnd.reversedropstrategy"; //$NON-NLS-1$
- }
-
- @Override
- public Command getCommand(final Request request, final EditPart targetEditPart) {
- return DropReverseCommand.getInstance(request, targetEditPart);
-
- }
-
- @Override
- public int getPriority() {
- return 0;
- }
-
-}
diff --git a/extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/dnd/Messages.java b/extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/dnd/Messages.java
deleted file mode 100644
index 3253c5eb40a..00000000000
--- a/extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/dnd/Messages.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package org.eclipse.papyrus.java.reverse.ui.dnd;
-
-import org.eclipse.osgi.util.NLS;
-
-public class Messages extends NLS {
-
- private static final String BUNDLE_NAME = "org.eclipse.papyrus.java.reverse.ui.dnd.messages"; //$NON-NLS-1$
-
- public static String DropReverseStrategy_DESCRIPTION;
-
- public static String DropReverseStrategy_LABEL;
- static {
- // initialize resource bundle
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-
- private Messages() {
- }
-}
diff --git a/extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/dnd/messages.properties b/extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/dnd/messages.properties
deleted file mode 100644
index 753937a59b2..00000000000
--- a/extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/dnd/messages.properties
+++ /dev/null
@@ -1,2 +0,0 @@
-DropReverseStrategy_DESCRIPTION=Reverse all dropped classes into model
-DropReverseStrategy_LABEL=Reverse
diff --git a/extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/handlers/CreateAssociationFromPropertyHandler.java b/extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/handlers/CreateAssociationFromPropertyHandler.java
deleted file mode 100644
index f9388cdfd3b..00000000000
--- a/extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/handlers/CreateAssociationFromPropertyHandler.java
+++ /dev/null
@@ -1,286 +0,0 @@
-/**
- *
- */
-package org.eclipse.papyrus.java.reverse.ui.handlers;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.IHandler;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.TreeSelection;
-import org.eclipse.papyrus.infra.core.services.ServiceException;
-import org.eclipse.papyrus.infra.ui.util.ServiceUtilsForActionHandlers;
-import org.eclipse.papyrus.java.reverse.utils.TypeOperationsEnhanced;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.handlers.HandlerUtil;
-import org.eclipse.uml2.uml.AggregationKind;
-import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.Property;
-import org.eclipse.uml2.uml.Type;
-
-
-/**
- * An handler getting the selected element and reporting them in console.
- *
- * @author Cedric dumoulin
- *
- */
-public class CreateAssociationFromPropertyHandler extends AbstractHandler implements IHandler {
-
-
- /**
- * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- * @param event
- * @return
- * @throws ExecutionException
- *
- */
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
-
- List<Object> objects = lookupSelectedElements();
- List<Property> selectedProperties = getAllSelectionOfType(event, Property.class);
- if (objects == null) {
-
- showErrorDialog(event, "No object selected", "Can't create association. Please select a Property First.");
- return null;
- }
-
- // Try creation
- try {
- doExecute(selectedProperties);
- } catch (ServiceException e) {
- showErrorDialog(event, "Can't get TransactionalEditingDomain", e.getMessage());
- e.printStackTrace();
- } catch (Exception e) {
- showErrorDialog(event, "Can't Create Association", e.getMessage());
- e.printStackTrace();
- }
-
- return null;
- }
-
- /**
- * Get all selected element of the specified type.
- *
- * @param expectedType
- * @return
- * @throws ExecutionException
- */
- private <T> List<T> getAllSelectionOfType(ExecutionEvent event, Class<T> expectedType) throws ExecutionException {
-
- ISelection selection = HandlerUtil.getCurrentSelectionChecked(event);
- // IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
- // ISelection selection = page.getSelection();
- System.out.println("check " + selection);
- if (selection instanceof IStructuredSelection)
- {
- IStructuredSelection structuredSelection = (IStructuredSelection) selection;
- return getAllElementOfType(structuredSelection.toList(), expectedType);
- }
- else if (selection instanceof TreeSelection) {
- TreeSelection treeSelection = (TreeSelection) selection;
- return getAllElementOfType(treeSelection.toList(), expectedType);
-
- }
- return null;
- }
-
- /**
- * Filter the list, and only retain objects that can be adapted to the specified type
- *
- * @param objects
- * @param class1
- * @return
- */
- private <T> List<T> getAllElementOfType(List<Object> list, Class<T> expectedClassType) {
-
- List<T> res = new ArrayList<T>();
-
- for (Object cur : list) {
-
- T adapted = adapt(cur, expectedClassType);
- if (adapted != null) {
- res.add(adapted);
- }
- }
- return res;
- }
-
- /**
- * Adapt the specified object to the requested type, if possible.
- * Return null if the object can't be adapted.
- *
- * @param object
- * @param expectedClassType
- * @return The adapted object, or null.
- */
- private <T> T adapt(Object object, Class<T> expectedClassType) {
-
- if (object instanceof IAdaptable) {
- @SuppressWarnings("unchecked")
- T ele = (T) ((IAdaptable) object).getAdapter(expectedClassType);
- if (ele != null) {
- return ele;
- }
- // Try as EObject if the expectedClasType is sub-type of EObject.
- if (EObject.class.isAssignableFrom(expectedClassType)) {
- // to EObject
- EObject eobject = (EObject) ((IAdaptable) object).getAdapter(EObject.class);
-
- if (eobject != null && expectedClassType.isInstance(eobject)) {
- return (T) eobject;
- }
- }
- }
-
- // Try global mechanism
- {
- @SuppressWarnings("unchecked")
- T ele = (T) Platform.getAdapterManager().getAdapter(object, expectedClassType);
- if (ele != null) {
- return ele;
- }
- // Try as EObject if the expectedClasType is sub-type of EObject.
- if (EObject.class.isAssignableFrom(expectedClassType)) {
- // to EObject
- EObject eobject = (EObject) Platform.getAdapterManager().getAdapter(object, EObject.class);
-
- if (eobject != null && expectedClassType.isInstance(eobject)) {
-
- return (T) eobject;
- }
- }
- }
- // Can't be adapted
- return null;
-
- }
-
- /**
- *
- * @param event
- * @param errorMessage
- * @throws ExecutionException
- */
- private void showErrorDialog(ExecutionEvent event, String title, String errorMessage) throws ExecutionException {
- IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
- MessageDialog.openError(
- window.getShell(),
- title,
- errorMessage);
- }
-
-
- /**
- * Get the name used in the {@link RecordingCommand}. This name will be visible in
- * undo/redo.
- *
- * @return The command name to show.
- */
- public String getCommandName() {
- return "Create Association";
- }
-
- /**
- * Do the execution of the command.
- *
- * @param objects
- * List of object to generate Java code from.
- * @throws ServiceException
- */
- protected void doExecute(final List<?> objects) throws ServiceException {
-
- // Execute the reverse with provided paramters
- TransactionalEditingDomain editingDomain = getEditingDomain();
- RecordingCommand command = new RecordingCommand(editingDomain, getCommandName()) {
-
- @Override
- protected void doExecute() {
- System.out.println(" Selections:");
-
- for (Object obj : objects) {
-
- System.out.println("found '" + obj + "'.");
- createAssociationFromProperty((Property) obj);
- }
- }
-
- };
-
- editingDomain.getCommandStack().execute(command);
-
-
- }
-
-
- /**
- * Create an association from the specified Property. The association is created
- * in the property's nearest package.
- *
- * @param p
- * The property to use to create an association.
- */
- protected void createAssociationFromProperty(Property p) {
-
- Element owner = p.getOwner();
-
- if (owner instanceof Type) {
-
- Type classOwner = (Type) owner;
-
- // Compute other end name
- String name = classOwner.getName();
- String newname = name.substring(0, 1).toLowerCase() + name.substring(1);
- // Create
- TypeOperationsEnhanced.createAssociationFromProperty(p, true, AggregationKind.COMPOSITE_LITERAL,
- false, AggregationKind.NONE_LITERAL, newname, 0, 1);
- }
- }
-
- /**
- * Lookup selected objects in UI.
- *
- * @return
- */
- private List<Object> lookupSelectedElements() {
- IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
- ISelection selection = page.getSelection();
- System.out.println("check " + selection);
- if (selection instanceof IStructuredSelection)
- {
- IStructuredSelection structuredSelection = (IStructuredSelection) selection;
- return structuredSelection.toList();
- }
- else if (selection instanceof TreeSelection) {
- TreeSelection treeSelection = (TreeSelection) selection;
- return treeSelection.toList();
-
- }
- return null;
- }
-
- /**
- * Get the main editing doamin.
- *
- * @return
- * @throws ServiceException
- */
- protected TransactionalEditingDomain getEditingDomain() throws ServiceException {
- return ServiceUtilsForActionHandlers.getInstance().getTransactionalEditingDomain();
- }
-
-}
diff --git a/extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/messages.properties b/extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/messages.properties
deleted file mode 100644
index 92a5ca789b8..00000000000
--- a/extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/messages.properties
+++ /dev/null
@@ -1,9 +0,0 @@
-ReverseCodeHandler_NoModelError_Message=No model selected for Reverse. Please open a model where you want to add the reverse result.
-ReverseCodeHandler_NoModelError_Title=No model selected
-ReverseCodeHandler_NoPapyrusEditor_Title=No Papyrus Editor selected
-ReverseCodeHandler_NoPapyrusEditor_Message=No Papyrus Editor selected for Reverse. Please open and select a Papyrus Editor, then select java classes to reverse.
-
-DndReverseCodeHandler_CantDisplayResult_Title=Can't display reversed element in diagram
-DndReverseCodeHandler_CantDisplayResult_Message=Can't display reversed element in diagram
-DndReverseCodeHandler_CantFindService_Title=Can't display reversed element in diagram
-DndReverseCodeHandler_CantFindService_Message=Can't display reversed element in diagram
diff --git a/extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/preference/CreationPathListEditor.java b/extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/preference/CreationPathListEditor.java
deleted file mode 100644
index 11f0ccbbd7e..00000000000
--- a/extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/preference/CreationPathListEditor.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2014 Jonathan Geoffroy
- *
- *
- * 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:
- * Jonathan Geoffroy geoffroy.jonathan@gmail.com initial implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.java.reverse.ui.preference;
-
-import org.eclipse.jface.dialogs.IInputValidator;
-import org.eclipse.jface.dialogs.InputDialog;
-import org.eclipse.jface.preference.ListEditor;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * A ListEditor implementation. When user push "add" button, open a dialog box which can validate/invalidate the input value for Creation Path. <br>
- * Used to add a Creation Path value into Eclipse preferences
- *
- * @author Jonathan Geoffroy
- *
- */
-public class CreationPathListEditor extends ListEditor {
-
- public static final String SPLIT_STRING = ":";
-
- /**
- * Constructor.
- *
- * @param name
- * @param labelText
- * @param parent
- */
- public CreationPathListEditor(String name, String labelText, Composite parent) {
- super(name, labelText, parent);
- }
-
- @Override
- protected String createList(String[] items) {
- StringBuffer str = new StringBuffer();
- for(String item : items) {
- str.append(item + SPLIT_STRING);
- }
- return str.toString();
- }
-
- @Override
- protected String getNewInputObject() {
- InputDialog dialog = new InputDialog(getShell(), "Add creation path", "Add creation path", "", new CreationPathValidator());
- dialog.open();
-
- // If user clicked on "cancel" button, return null to NOT add empty value
- if(dialog.getReturnCode() == InputDialog.CANCEL) {
- return null;
- }
- return dialog.getValue();
- }
-
- @Override
- protected String[] parseString(String stringList) {
- return stringList.split(SPLIT_STRING);
- }
-
- /**
- * Validator for creation path value
- *
- * @author Jonathan Geoffroy
- *
- */
- private class CreationPathValidator implements IInputValidator {
-
- @Override
- /**
- * Validate the input value if it contains 3 parts, separated by ';' character
- * @see org.eclipse.jface.dialogs.IInputValidator#isValid(java.lang.String)
- *
- * @param newText
- * @return
- */
- public String isValid(String newText) {
- String[] splittedText = newText.split(";");
- if(! (splittedText.length == 3 || (splittedText.length == 2 && newText.charAt(newText.length() - 1) == ';'))) {
- return "pattern: includePath ; excludePath ; destination (use ';' as separator)";
- }
- return null;
- }
-
- }
-}
diff --git a/extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/preference/PreferenceConstants.java b/extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/preference/PreferenceConstants.java
deleted file mode 100644
index 7340837ae0b..00000000000
--- a/extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/preference/PreferenceConstants.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2014 Jonathan Geoffroy
- *
- *
- * 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:
- * Jonathan Geoffroy geoffroy.jonathan@gmail.com initial implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.java.reverse.ui.preference;
-
-/**
- * Provide constant identifiers for reverse eclipse preferences.
- *
- * @author Jonathan Geoffroy
- *
- */
-public class PreferenceConstants {
-
- public static final String P_PREFERENCE_ID = "org.eclipse.papyrus.java.reverse.ui.preference.PreferencePage";
-
- public static final String P_SEARCH_PATH = P_PREFERENCE_ID + "searchPath";
-
- public static final String P_CREATION_PATH = P_PREFERENCE_ID + "creationPath";
-}
diff --git a/extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/preference/PreferenceInitializer.java b/extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/preference/PreferenceInitializer.java
deleted file mode 100644
index 7237ad2aa5e..00000000000
--- a/extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/preference/PreferenceInitializer.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2014 Jonathan Geoffroy
- *
- *
- * 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:
- * Jonathan Geoffroy geoffroy.jonathan@gmail.com initial implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.java.reverse.ui.preference;
-
-import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.papyrus.java.reverse.ui.Activator;
-
-/**
- * Initialize reverse eclipse preference by default values.
- *
- * @author Jonathan Geoffroy
- *
- */
-public class PreferenceInitializer extends AbstractPreferenceInitializer {
-
- public PreferenceInitializer() {
- // TODO Auto-generated constructor stub
- }
-
- @Override
- public void initializeDefaultPreferences() {
- IPreferenceStore store = Activator.getDefault().getPreferenceStore();
-
- store.setDefault(PreferenceConstants.P_SEARCH_PATH, "java;*;osgi.*;datatype");
- store.setDefault(PreferenceConstants.P_CREATION_PATH, "java.* ; ; java"
- + CreationPathListEditor.SPLIT_STRING + "org.eclipse.papyrus.* ; ; *"
- + CreationPathListEditor.SPLIT_STRING + "org.eclipse.* ; org.eclipse.papyrus.* ; *"
- + CreationPathListEditor.SPLIT_STRING + " org.osgi.* ; ; osgi.*"
- + CreationPathListEditor.SPLIT_STRING + " datatype.* ; ; datatype");
- }
-}
diff --git a/extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/preference/PreferencePage.java b/extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/preference/PreferencePage.java
deleted file mode 100644
index dacb89581ef..00000000000
--- a/extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/preference/PreferencePage.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2014 Jonathan Geoffroy
- *
- *
- * 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:
- * Jonathan Geoffroy geoffroy.jonathan@gmail.com initial implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.java.reverse.ui.preference;
-
-import org.eclipse.jface.preference.FieldEditorPreferencePage;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.papyrus.java.reverse.ui.Activator;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPreferencePage;
-
-/**
- * Define a new section into eclipse preferences. Create a page for reverse eclipse preferences.
- *
- * @author Jonathan Geoffroy
- *
- */
-public class PreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {
-
- public PreferencePage() {
- super(GRID);
- }
-
- public PreferencePage(int style) {
- super(style);
- }
-
- public PreferencePage(String title, int style) {
- super(title, style);
- }
-
- public PreferencePage(String title, ImageDescriptor image, int style) {
- super(title, image, style);
- }
-
- @Override
- public void init(IWorkbench workbench) {
- setPreferenceStore(Activator.getDefault().getPreferenceStore());
- setDescription("Edit your preferences to reverse java project into papyrus model");
- }
-
- @Override
- protected void createFieldEditors() {
- // Search path field
- addField(new SearchPathListEditor(PreferenceConstants.P_SEARCH_PATH, "Default search path", getFieldEditorParent()));
-
- // Creation path field
- addField(new CreationPathListEditor(PreferenceConstants.P_CREATION_PATH, "Default creation path", getFieldEditorParent()));
-
- }
-
-}
diff --git a/extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/preference/ReversePreference.java b/extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/preference/ReversePreference.java
deleted file mode 100644
index 32faf62cd5e..00000000000
--- a/extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/preference/ReversePreference.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2014 Jonathan Geoffroy
- *
- *
- * 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:
- * Jonathan Geoffroy geoffroy.jonathan@gmail.com initial implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.java.reverse.ui.preference;
-
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.papyrus.java.reverse.ui.Activator;
-
-/**
- * Provide reverse eclipse preferences values
- *
- * @author Jonathan Geoffroy
- *
- */
-public class ReversePreference {
-
- /**
- * allow to gather default value
- */
- private IPreferenceStore store = Activator.getDefault().getPreferenceStore();
-
- /**
- *
- * @return an array containing each search path values
- */
- public String[] getSearchPath() {
- String searchPath = store.getString(PreferenceConstants.P_SEARCH_PATH);
- return searchPath.split(";");
- }
-
- /**
- *
- * @return an array containing each creation path values
- */
- public String[] getCreationPath() {
- String creationPath = store.getString(PreferenceConstants.P_CREATION_PATH);
- return creationPath.split(CreationPathListEditor.SPLIT_STRING);
- }
-}
diff --git a/extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/preference/SearchPathListEditor.java b/extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/preference/SearchPathListEditor.java
deleted file mode 100644
index a6791398d43..00000000000
--- a/extraplugins/qompass/codegen/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/preference/SearchPathListEditor.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2014 Jonathan Geoffroy
- *
- *
- * 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:
- * Jonathan Geoffroy geoffroy.jonathan@gmail.com initial implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.java.reverse.ui.preference;
-
-import java.util.LinkedList;
-import java.util.List;
-
-import org.eclipse.jdt.internal.ui.preferences.TypeFilterInputDialog;
-import org.eclipse.jface.dialogs.InputDialog;
-import org.eclipse.jface.preference.ListEditor;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * A ListEditor implementation. When user push "add" button, open a dialog box which can validate/invalidate the input value for Search Path. <br>
- * Used to add a Search Path value into Eclipse preferences
- *
- * @author Jonathan Geoffroy
- *
- */
-public class SearchPathListEditor extends ListEditor {
-
- /**
- * Constructor.
- *
- * @param name
- * @param labelText
- * @param parent
- */
- public SearchPathListEditor(String name, String labelText, Composite parent) {
- super(name, labelText, parent);
- }
-
- @SuppressWarnings("restriction")
- @Override
- /**
- * Functionality for New button.
- * Shows a browser dialog to select a file and returns that file.
- */
- protected String getNewInputObject() {
- //Dialog p = new JDialog();
- List<String> l = new LinkedList<String>();
-
-
- TypeFilterInputDialog dialog = new TypeFilterInputDialog(getShell(), l);
- dialog.open();
- // If user clicked on "cancel" button, return null to NOT add empty value
- if(dialog.getReturnCode() == InputDialog.CANCEL) {
- return null;
- }
- Object pack = dialog.getResult();
-
- return pack.toString();
- }
-
- @Override
- protected String createList(String[] items) {
- StringBuffer str = new StringBuffer();
- for(String item : items) {
- str.append(item + ";");
- }
- return str.toString();
- }
-
- /*
- * (non-Javadoc)
- * initialize list of items
- *
- * @see org.eclipse.jface.preference.ListEditor#parseString(java.lang.String)
- */
- @Override
- protected String[] parseString(String stringList) {
- return stringList.split(";");
- }
-
-}

Back to the top