Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src')
-rw-r--r--plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/Activator.java82
-rw-r--r--plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/generator/ElementTypeRegistryGenerator.xtend61
-rw-r--r--plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/handlers/GenerateElementTypesRegistry.java105
-rw-r--r--plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/handlers/MigrateElementTypesConfigurations.java252
-rw-r--r--plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/providers/ElementTypesConfigurationsEventContentProvider.java161
-rw-r--r--plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/providers/ElementTypesConfigurationsEventLabelProvider.java135
-rw-r--r--plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/providers/ElementTypesContentProvider.java85
-rw-r--r--plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/providers/ElementTypesDetailsContentProvider.java153
-rw-r--r--plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/providers/ElementTypesDetailsLabelProvider.java39
-rw-r--r--plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/providers/ElementTypesLabelProvider.java45
-rw-r--r--plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/utils/AdvicesComparator.java35
-rw-r--r--plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/utils/EClassComparator.java25
-rw-r--r--plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/utils/ElementTypeConfigurationComparator.java25
-rw-r--r--plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/utils/ElementTypeRegistryUtils.java45
-rw-r--r--plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/utils/ElementTypesConfigurationsEventPrinter.java138
-rw-r--r--plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/utils/GenerateElementTypesConfigurationsUtils.java112
-rw-r--r--plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/utils/IElementTypeComparator.java25
-rw-r--r--plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/utils/NotifierNullEditHelper.java30
-rw-r--r--plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/view/ElementTypesConfigurationsListenerView.java227
-rw-r--r--plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/view/RegistredElementTypesView.java127
20 files changed, 0 insertions, 1907 deletions
diff --git a/plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/Activator.java b/plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/Activator.java
deleted file mode 100644
index 8e6a1609ed6..00000000000
--- a/plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/Activator.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.elementtypesconfigurations.developer;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.papyrus.infra.core.log.LogHelper;
-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.elementtypesconfigurations.developer"; //$NON-NLS-1$
-
- // The shared instance
- private static Activator plugin;
-
- /** Logging helper */
- public static LogHelper log;
-
- /**
- * The constructor
- */
- public Activator() {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- log = new LogHelper(this);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext context) throws Exception {
- log = null;
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static Activator getDefault() {
- return plugin;
- }
-
- /**
- * Returns an image descriptor for the image file at the given
- * plug-in relative path
- *
- * @param path
- * the path
- * @return the image descriptor
- */
- public static ImageDescriptor getImageDescriptor(String path) {
- return imageDescriptorFromPlugin(PLUGIN_ID, path);
- }
-}
diff --git a/plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/generator/ElementTypeRegistryGenerator.xtend b/plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/generator/ElementTypeRegistryGenerator.xtend
deleted file mode 100644
index 1314649fec7..00000000000
--- a/plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/generator/ElementTypeRegistryGenerator.xtend
+++ /dev/null
@@ -1,61 +0,0 @@
-package org.eclipse.papyrus.elementtypesconfigurations.developer.generator
-
-import org.eclipse.emf.ecore.resource.Resource
-import org.eclipse.emf.common.util.TreeIterator
-import org.eclipse.emf.ecore.EObject
-import org.eclipse.papyrus.infra.elementtypesconfigurations.ElementTypeConfiguration
-
-class ElementTypeRegistryGenerator {
-
- static def Iterable<EObject> allContentsIterable(Resource resource) {
- var TreeIterator<EObject> _allContents = resource.getAllContents();
- return IteratorExtensions.<EObject>toIterable(_allContents);
- }
-
- static def String camelToUnderScore(String in) {
- var String regex = "([a-z])([A-Z])";
- var String replacement = "$1_$2";
- return in.replaceAll(regex, replacement);
- }
-
- static def String safeName(String in) {
- var result = camelToUnderScore(in)
- result = result.replaceAll("[^A-Za-z0-9]", "_")
- result = result.replaceAll("_{2,}", "_")
- result = result.toUpperCase;
- result = result.replaceAll("UML_","");
- return result;
- }
-
-
-
-
- static def generateRegistry(Resource it,String outputType) '''
- /*****************************************************************************
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
- import org.eclipse.gmf.runtime.emf.type.core.AbstractElementTypeEnumerator;
- import org.eclipse.gmf.runtime.emf.type.core.IHintedType;
-
- public class «outputType» extends AbstractElementTypeEnumerator {
-
- /** Constant for UML nature */
- public static final String UML_NATURE = "UML_Nature";
-
- «FOR elementTypeConfiguration : allContentsIterable(it).filter(typeof(ElementTypeConfiguration))»
- public static final IHintedType «safeName(elementTypeConfiguration.name).toUpperCase» = (IHintedType)getElementType("«elementTypeConfiguration.identifier»"); //$NON-NLS-1$
-
- «ENDFOR»
-
- }
- '''
-}
diff --git a/plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/handlers/GenerateElementTypesRegistry.java b/plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/handlers/GenerateElementTypesRegistry.java
deleted file mode 100644
index 65d08fde319..00000000000
--- a/plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/handlers/GenerateElementTypesRegistry.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.elementtypesconfigurations.developer.handlers;
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.papyrus.elementtypesconfigurations.developer.generator.ElementTypeRegistryGenerator;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.dialogs.ContainerSelectionDialog;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-/**
- * Our sample handler extends AbstractHandler, an IHandler base class.
- *
- * @see org.eclipse.core.commands.IHandler
- * @see org.eclipse.core.commands.AbstractHandler
- */
-public class GenerateElementTypesRegistry extends AbstractHandler {
-
-
- public GenerateElementTypesRegistry() {
- }
-
- public Object execute(ExecutionEvent event) throws ExecutionException {
- ResourceSet resourceSet = new ResourceSetImpl();
- ISelection currentSelection = HandlerUtil.getCurrentSelection(event);
- if (!(currentSelection instanceof IStructuredSelection) || currentSelection.isEmpty()) {
- return null;
- }
-
- final IStructuredSelection selection = (IStructuredSelection) currentSelection;
- Object selectedElement = selection.getFirstElement();
-
- if (selectedElement instanceof IFile) {
-
- String selectedFilePath = ((IFile) selectedElement).getFullPath().toString();
- String outputType = ((IFile) selectedElement).getFullPath().removeFileExtension().lastSegment();
- String outputFileName = outputType + ".java";
-
- ContainerSelectionDialog dialog = new ContainerSelectionDialog(Display.getCurrent().getActiveShell(), null, true, "Select a folder:");
- dialog.setTitle("Select output folder");
- dialog.open();
- if (dialog.getResult() != null && dialog.getResult().length > 0 && dialog.getResult()[0] instanceof IPath) {
-
- IWorkspace workspace = ResourcesPlugin.getWorkspace();
- IWorkspaceRoot root = workspace.getRoot();
- IResource container = root.findMember((IPath) dialog.getResult()[0]);
-
- if (container instanceof IFolder) {
-
- Resource inputResource = resourceSet.getResource(URI.createURI(selectedFilePath), true);
- CharSequence registryText = ElementTypeRegistryGenerator.generateRegistry(inputResource, outputType);
-
-
- IFile outputFile = ((IFolder) container).getFile(outputFileName);
- if (!outputFile.exists()) {
-
- InputStream source = new ByteArrayInputStream(registryText.toString().getBytes());
- try {
- outputFile.create(source, IResource.NONE, null);
- } catch (CoreException e) {
- e.printStackTrace();
- }
- } else {
- MessageDialog.openWarning(Display.getCurrent().getActiveShell(), "Registry already exists", "No file generated: the registry file already exists.");
- }
- } else {
- MessageDialog.openWarning(Display.getCurrent().getActiveShell(), "Container selection", "Selection must be a folder");
- }
- }
-
-
- }
- return null;
- }
-}
diff --git a/plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/handlers/MigrateElementTypesConfigurations.java b/plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/handlers/MigrateElementTypesConfigurations.java
deleted file mode 100644
index 2bb3b935828..00000000000
--- a/plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/handlers/MigrateElementTypesConfigurations.java
+++ /dev/null
@@ -1,252 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.elementtypesconfigurations.developer.handlers;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.URI;
-import java.util.Iterator;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.Result;
-import javax.xml.transform.Source;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerConfigurationException;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.TransformerFactoryConfigurationError;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.filesystem.EFS;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.handlers.HandlerUtil;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.xml.sax.SAXException;
-
-public class MigrateElementTypesConfigurations extends AbstractHandler {
-
-
- public Object execute(ExecutionEvent event) throws ExecutionException {
-
- final String FILE_EXTENSION = "elementtypesconfigurations";
-
- final String ELEMENTTYPECONFIGURATION_NAMESPACE_ATTRIBUTE = "xmlns:elementtypesconfigurations";
- final String ELEMENTTYPECONFIGURATION_NAMESPACE_OLD = "http://www.eclipse.org/papyrus/infra/elementtypesconfigurations/1.0";
- final String ELEMENTTYPECONFIGURATION_NAMESPACE_NEW = "http://www.eclipse.org/papyrus/infra/elementtypesconfigurations/1.1";
-
- final String APPLYSTEREOTYPEADVICECONFIGURATION_NAMESPACE_ATTRIBUTE = "xmlns:applystereotypeadviceconfiguration";
- final String APPLYSTEREOTYPEADVICECONFIGURATION_NAMESPACE_NEW = "http://www.eclipse.org/papyrus/infra/elementtypesconfigurations/uml/applystereotypeadvice/1.1";
-
- final String INVARIANTSTEREOTYPERULECONFIGURATION_NAMESPACE_ATTRIBUTE = "xmlns:invariantstereotyperuleconfiguration";
- final String INVARIANTSTEREOTYPERULECONFIGURATION_NAMESPACE_NEW = "http://www.eclipse.org/papyrus/infra/elementtypesconfigurations/invariantstereotyperule/1.1";
-
- final String SETTYPEADVICECONFIGURATION_NAMESPACE_ATTRIBUTE = "xmlns:settypeadviceconfiguration";
- final String SETTYPEADVICECONFIGURATION_NAMESPACE_NEW = "http://www.eclipse.org/papyrus/infra/elementtypesconfigurations/uml/settypeadvice/1.1";
-
- final String STEREOTYPEAPPLICATIONMATCHERCONFIGURATION_NAMESPACE_ATTRIBUTE = "xmlns:stereotypeapplicationmatcherconfiguration";
- final String STEREOTYPEAPPLICATIONMATCHERCONFIGURATION_NAMESPACE_NEW = "http://www.eclipse.org/payrus/elementtypesconfigurations/uml/stereotypematcherconfiguration/1.1";
-
- final String INVARIANTCONTAINERRULECONFIGURATION_NAMESPACE_ATTRIBUTE = "xmlns:invariantcontainerruleconfiguration";
- final String INVARIANTCONTAINERRULECONFIGURATION_NAMESPACE_NEW = "http://www.eclipse.org/papyrus/infra/elementtypesconfigurations/invarianttypeconfiguration/containerruleconfiguration/1.1";
-
- final String RUNTIMEVALUESEDITIONADVICECONFIGURATION_NAMESPACE_ATTRIBUTE = "xmlns:runtimevalueseditionadviceconfiguration";
- final String RUNTIMEVALUESEDITIONADVICECONFIGURATION_NAMESPACE_NEW = "http://www.eclipse.org/papyrus/infra/elementtypesconfigurations/emf/runtimevalueseditionadviceconfiguration/1.1";
-
- final String SETVALUESADVICECONFIGURATION_NAMESPACE_ATTRIBUTE = "xmlns:setvaluesadviceconfiguration";
- final String SETVALUESADVICECONFIGURATION_NAMESPACE_NEW = "http://www.eclipse.org/papyrus/infra/elementtypesconfigurations/emf/setvaluesadviceconfiguration/1.1";
-
- final String INVARIANTTYPECONFIGURATION_NAMESPACE_ATTRIBUTE = "xmlns:invarianttypeconfiguration";
- final String INVARIANTTYPECONFIGURATION_NAMESPACE_NEW = "http://www.eclipse.org/papyrus/infra/elementtypesconfigurations/invarianttype/1.1";
-
-
-
- final String TYPE_ATTRIBUTE = "xsi:type";
- final String EDITHELPERADVICECONFIGURATION_TAG = "editHelperAdviceConfiguration";
- final String MATCHERCONFIGURATION_TAG = "matcherConfiguration";
- final String NAME_ATTRIBUTE = "name";
- final String IDENTIFIER_ATTRIBUTE = "identifier";
- final String EDITHELPERADVICECLASSNAME_ATTRIBUTE = "editHelperAdviceClassName";
- final String ADVICEBINDINGSCONFIGURATIONS_TAG = "adviceBindingsConfigurations";
- final String MATCHER_TYPE = "elementtypesconfigurations:MatcherConfiguration";
- final String ADVICEBINDINGCONFIGURATION_TYPE = "elementtypesconfigurations:AdviceBindingConfiguration";
- final String EDITHELPERADVICECONFIGURATION_TYPE = "elementtypesconfigurations:EditHelperAdviceConfiguration";
- final String MATCHERCLASSNAME_ATTRIBUTE = "matcherClassName";
-
-
- ISelection currentSelection = HandlerUtil.getCurrentSelection(event);
- if (!(currentSelection instanceof IStructuredSelection) || currentSelection.isEmpty()) {
- return null;
- }
-
- final IStructuredSelection selection = (IStructuredSelection) currentSelection;
-
- Iterator<?> it = selection.iterator();
-
- while (it.hasNext()) {
- Object selectedElement = (Object) it.next();
-
- if (selectedElement instanceof IFile) {
- if (FILE_EXTENSION.equals(((IFile) selectedElement).getFileExtension())) {
- IFile selectedFile = ((IFile) selectedElement);
- URI uri = selectedFile.getLocationURI();
-
- if (selectedFile.isLinked()) {
- uri = selectedFile.getRawLocationURI();
- }
-
- try {
- File file = EFS.getStore(uri).toLocalFile(0, new NullProgressMonitor());
- DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
- DocumentBuilder builder = factory.newDocumentBuilder();
- Document doc = builder.parse(file);
- Element root = doc.getDocumentElement();
-
- if (root.getAttribute(ELEMENTTYPECONFIGURATION_NAMESPACE_ATTRIBUTE).equals(ELEMENTTYPECONFIGURATION_NAMESPACE_OLD)) {
-
- // Update namespaces
- root.setAttribute(ELEMENTTYPECONFIGURATION_NAMESPACE_ATTRIBUTE, ELEMENTTYPECONFIGURATION_NAMESPACE_NEW);
-
- if (!root.getAttribute(APPLYSTEREOTYPEADVICECONFIGURATION_NAMESPACE_ATTRIBUTE).isEmpty()) {
- root.setAttribute(APPLYSTEREOTYPEADVICECONFIGURATION_NAMESPACE_ATTRIBUTE, APPLYSTEREOTYPEADVICECONFIGURATION_NAMESPACE_NEW);
- }
-
- if (!root.getAttribute(INVARIANTSTEREOTYPERULECONFIGURATION_NAMESPACE_ATTRIBUTE).isEmpty()) {
- root.setAttribute(INVARIANTSTEREOTYPERULECONFIGURATION_NAMESPACE_ATTRIBUTE, INVARIANTSTEREOTYPERULECONFIGURATION_NAMESPACE_NEW);
- }
-
- if (!root.getAttribute(SETTYPEADVICECONFIGURATION_NAMESPACE_ATTRIBUTE).isEmpty()) {
- root.setAttribute(SETTYPEADVICECONFIGURATION_NAMESPACE_ATTRIBUTE, SETTYPEADVICECONFIGURATION_NAMESPACE_NEW);
- }
-
- if (!root.getAttribute(STEREOTYPEAPPLICATIONMATCHERCONFIGURATION_NAMESPACE_ATTRIBUTE).isEmpty()) {
- root.setAttribute(STEREOTYPEAPPLICATIONMATCHERCONFIGURATION_NAMESPACE_ATTRIBUTE, STEREOTYPEAPPLICATIONMATCHERCONFIGURATION_NAMESPACE_NEW);
- }
-
- if (!root.getAttribute(INVARIANTCONTAINERRULECONFIGURATION_NAMESPACE_ATTRIBUTE).isEmpty()) {
- root.setAttribute(INVARIANTCONTAINERRULECONFIGURATION_NAMESPACE_ATTRIBUTE, INVARIANTCONTAINERRULECONFIGURATION_NAMESPACE_NEW);
- }
-
- if (!root.getAttribute(RUNTIMEVALUESEDITIONADVICECONFIGURATION_NAMESPACE_ATTRIBUTE).isEmpty()) {
- root.setAttribute(RUNTIMEVALUESEDITIONADVICECONFIGURATION_NAMESPACE_ATTRIBUTE, RUNTIMEVALUESEDITIONADVICECONFIGURATION_NAMESPACE_NEW);
- }
-
- if (!root.getAttribute(SETVALUESADVICECONFIGURATION_NAMESPACE_ATTRIBUTE).isEmpty()) {
- root.setAttribute(SETVALUESADVICECONFIGURATION_NAMESPACE_ATTRIBUTE, SETVALUESADVICECONFIGURATION_NAMESPACE_NEW);
- }
-
- if (!root.getAttribute(INVARIANTTYPECONFIGURATION_NAMESPACE_ATTRIBUTE).isEmpty()) {
- root.setAttribute(INVARIANTTYPECONFIGURATION_NAMESPACE_ATTRIBUTE, INVARIANTTYPECONFIGURATION_NAMESPACE_NEW);
- }
-
- NodeList editHelperAdviceConfigurations = root.getElementsByTagName(EDITHELPERADVICECONFIGURATION_TAG);
-
- for (int i = 0; i < editHelperAdviceConfigurations.getLength(); i++) {
- Element editHelperAdvice = (Element) editHelperAdviceConfigurations.item(i);
-
- Node type = editHelperAdvice.getAttributes().getNamedItem(TYPE_ATTRIBUTE);
-
- if (type == null) {
- editHelperAdvice.setAttribute(TYPE_ATTRIBUTE, EDITHELPERADVICECONFIGURATION_TYPE);
- } else if (!type.getNodeValue().equals(EDITHELPERADVICECONFIGURATION_TYPE)) {
- editHelperAdvice.removeAttribute(EDITHELPERADVICECLASSNAME_ATTRIBUTE);
- }
-
- editHelperAdvice.removeAttribute(NAME_ATTRIBUTE);
- editHelperAdvice.removeAttribute(IDENTIFIER_ATTRIBUTE);
- }
-
- NodeList adviceBindingsConfigurations = root.getElementsByTagName(ADVICEBINDINGSCONFIGURATIONS_TAG);
-
- for (int i = 0; i < adviceBindingsConfigurations.getLength(); i++) {
- Element adviceBinding = (Element) adviceBindingsConfigurations.item(i);
-
- Node type = adviceBinding.getAttributes().getNamedItem(TYPE_ATTRIBUTE);
-
- if (type == null) {
- adviceBinding.setAttribute(TYPE_ATTRIBUTE, ADVICEBINDINGCONFIGURATION_TYPE);
- } else if (!type.getNodeValue().equals(ADVICEBINDINGCONFIGURATION_TYPE)) {
- adviceBinding.removeAttribute(EDITHELPERADVICECLASSNAME_ATTRIBUTE);
- }
-
- adviceBinding.removeAttribute(NAME_ATTRIBUTE);
- }
-
- NodeList matcherConfigurations = root.getElementsByTagName(MATCHERCONFIGURATION_TAG);
-
- for (int i = 0; i < matcherConfigurations.getLength(); i++) {
- Element matcher = (Element) matcherConfigurations.item(i);
-
- Node type = matcher.getAttributes().getNamedItem(TYPE_ATTRIBUTE);
-
- if (type == null) {
- matcher.setAttribute(TYPE_ATTRIBUTE, MATCHER_TYPE);
- } else {
- matcher.removeAttribute(MATCHERCLASSNAME_ATTRIBUTE);
- }
- }
-
- Transformer transformer = TransformerFactory.newInstance().newTransformer();
- Result output = new StreamResult(file);
- Source input = new DOMSource(doc);
-
- transformer.transform(input, output);
- }
-
- } catch (ParserConfigurationException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (SAXException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (CoreException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (TransformerConfigurationException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (TransformerFactoryConfigurationError e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (TransformerException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- }
- }
-
- }
- return null;
- }
-
-
-
-
-
-}
diff --git a/plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/providers/ElementTypesConfigurationsEventContentProvider.java b/plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/providers/ElementTypesConfigurationsEventContentProvider.java
deleted file mode 100644
index 54b2d0c9a4e..00000000000
--- a/plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/providers/ElementTypesConfigurationsEventContentProvider.java
+++ /dev/null
@@ -1,161 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2016 CEA LIST and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.elementtypesconfigurations.developer.providers;
-
-import java.util.AbstractMap;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.papyrus.infra.elementtypesconfigurations.notification.ElementTypesConfigurationsEventsChain;
-import org.eclipse.papyrus.infra.elementtypesconfigurations.notification.events.AbstractElementTypesConfigurationsEvent;
-
-
-public class ElementTypesConfigurationsEventContentProvider implements ITreeContentProvider {
-
- /**
- * @see org.eclipse.jface.viewers.IContentProvider#dispose()
- *
- */
- @Override
- public void dispose() {
- // TODO Auto-generated method stub
-
- }
-
- /**
- * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
- *
- * @param viewer
- * @param oldInput
- * @param newInput
- */
- @Override
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- // TODO Auto-generated method stub
-
- }
-
- /**
- * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
- *
- * @param inputElement
- * @return
- */
- @Override
- public Object[] getElements(Object inputElement) {
- List<ElementTypesConfigurationsEventsChain> result = new ArrayList<ElementTypesConfigurationsEventsChain>();
- if (inputElement instanceof List<?>) {
- List<?> inputSet = (List<?>) inputElement;
- for (Object element : inputSet) {
- if (element instanceof ElementTypesConfigurationsEventsChain) {
- result.add((ElementTypesConfigurationsEventsChain) element);
- }
- }
- }
-
- Collections.sort(result, new Comparator<ElementTypesConfigurationsEventsChain>() {
-
- @Override
- public int compare(ElementTypesConfigurationsEventsChain o1, ElementTypesConfigurationsEventsChain o2) {
- if (o1.getTimestamp() > o2.getTimestamp()) {
- return -1;
- }
- return 1;
- }
- });
-
-
- return result.toArray();
- }
-
- /**
- * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)
- *
- * @param parentElement
- * @return
- */
- @Override
- public Object[] getChildren(Object parentElement) {
-
-
- List<Object> result = new ArrayList<Object>();
- if (parentElement instanceof ElementTypesConfigurationsEventsChain) {
- ElementTypesConfigurationsEventsChain elementTypesConfigurationsEventsChain = (ElementTypesConfigurationsEventsChain) parentElement;
-
- List<AbstractElementTypesConfigurationsEvent> adviceRequestConfigurationEvents = elementTypesConfigurationsEventsChain.getAdviceRequestConfigurationEvents();
- if (!adviceRequestConfigurationEvents.isEmpty()) {
- result.add(new AbstractMap.SimpleEntry<String, Object>("AdviceRequestConfigurationEvents", adviceRequestConfigurationEvents));
- }
- AbstractElementTypesConfigurationsEvent editHelperRequestConfigurationEvent = elementTypesConfigurationsEventsChain.getEditHelperRequestConfigurationEvent();
- if (editHelperRequestConfigurationEvent != null) {
- result.add(editHelperRequestConfigurationEvent);
- }
- List<AbstractElementTypesConfigurationsEvent> adviceApprovalEvents = elementTypesConfigurationsEventsChain.getAdviceApprovalEvents();
- if (!adviceApprovalEvents.isEmpty()) {
- result.add(new AbstractMap.SimpleEntry<String, Object>("AdviceApprovalEvents", adviceApprovalEvents));
- }
- AbstractElementTypesConfigurationsEvent editHelperApprovalEvent = elementTypesConfigurationsEventsChain.getEditHelperApprovalEvent();
- if (editHelperApprovalEvent != null) {
- result.add(editHelperApprovalEvent);
- }
- List<AbstractElementTypesConfigurationsEvent> beforeAdvicesCommandsEvents = elementTypesConfigurationsEventsChain.getBeforeAdvicesCommandsEvents();
- if (!beforeAdvicesCommandsEvents.isEmpty()) {
- result.add(new AbstractMap.SimpleEntry<String, Object>("BeforeAdvicesCommandsEvents", beforeAdvicesCommandsEvents));
- }
- AbstractElementTypesConfigurationsEvent editHelperCommandEvent = elementTypesConfigurationsEventsChain.getEditHelperCommandEvent();
- if (editHelperCommandEvent != null) {
- result.add(editHelperCommandEvent);
- }
- List<AbstractElementTypesConfigurationsEvent> afterAdvicesCommandsEvents = elementTypesConfigurationsEventsChain.getAfterAdvicesCommandsEvents();
- if (!afterAdvicesCommandsEvents.isEmpty()) {
- result.add(new AbstractMap.SimpleEntry<String, Object>("AfterAdvicesCommandsEvents", afterAdvicesCommandsEvents));
- }
- } else if (parentElement instanceof Map.Entry) {
- Object value = ((Map.Entry<?, ?>) parentElement).getValue();
- if (value instanceof Collection) {
- result.addAll((Collection<?>) value);
- }
- }
- return result.toArray();
- }
-
- /**
- * @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object)
- *
- * @param element
- * @return
- */
- @Override
- public Object getParent(Object element) {
- return null;
- }
-
- /**
- * @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object)
- *
- * @param element
- * @return
- */
- @Override
- public boolean hasChildren(Object element) {
- return getChildren(element).length == 0 ? false : true;
- }
-
-}
diff --git a/plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/providers/ElementTypesConfigurationsEventLabelProvider.java b/plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/providers/ElementTypesConfigurationsEventLabelProvider.java
deleted file mode 100644
index ad1fe1cf275..00000000000
--- a/plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/providers/ElementTypesConfigurationsEventLabelProvider.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2016 CEA LIST and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.elementtypesconfigurations.developer.providers;
-
-import java.text.SimpleDateFormat;
-import java.util.Calendar;
-import java.util.Collection;
-import java.util.Map;
-
-import org.eclipse.jface.viewers.IColorProvider;
-import org.eclipse.papyrus.infra.elementtypesconfigurations.notification.ElementTypesConfigurationsEventsChain;
-import org.eclipse.papyrus.infra.elementtypesconfigurations.notification.events.ElementTypesConfigurationsEventType;
-import org.eclipse.papyrus.infra.elementtypesconfigurations.notification.events.IElementTypesConfigurationsEvent;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.RGB;
-import org.eclipse.swt.widgets.Display;
-
-
-public class ElementTypesConfigurationsEventLabelProvider extends org.eclipse.jface.viewers.LabelProvider implements IColorProvider {
-
- @Override
- public Image getImage(Object element) {
-
- return null;
- }
-
- @Override
- public String getText(Object element) {
- String result = "";
- Calendar calendar = Calendar.getInstance();
- SimpleDateFormat formater = new SimpleDateFormat("yyyy-MM-dd - hh:mm:ss:SSS");
- if (element instanceof IElementTypesConfigurationsEvent) {
- calendar.setTimeInMillis(((IElementTypesConfigurationsEvent) element).getTimestamp());
- result += "[" + formater.format(calendar.getTime()) + "] " + ((IElementTypesConfigurationsEvent) element).getEventName();
- } else if (element instanceof ElementTypesConfigurationsEventsChain) {
- calendar.setTimeInMillis(((ElementTypesConfigurationsEventsChain) element).getTimestamp());
- result += "[" + formater.format(calendar.getTime()) + "] " + ((ElementTypesConfigurationsEventsChain) element).getName();
- } else if (element instanceof Map.Entry) {
- result += ((Map.Entry<?, ?>) element).getKey().toString();
- } else {
- result += element.toString();
- }
- return result;
- }
-
- Color yellow = new Color(Display.getCurrent(), new RGB(255, 200, 0));
- Color green = new Color(Display.getCurrent(), new RGB(0, 128, 0));
- Color red = new Color(Display.getCurrent(), new RGB(255, 0, 0));
- Color black = new Color(Display.getCurrent(), new RGB(0, 0, 0));
- Color blue = new Color(Display.getCurrent(), new RGB(0, 0, 255));
-
-
- /**
- * @see org.eclipse.jface.viewers.IColorProvider#getForeground(java.lang.Object)
- *
- * @param element
- * @return
- */
- @Override
- public Color getForeground(Object element) {
- if (element instanceof IElementTypesConfigurationsEvent) {
- if (((IElementTypesConfigurationsEvent) element).getEventType().equals(ElementTypesConfigurationsEventType.Disapproved)) {
- return red;
- } else if (((IElementTypesConfigurationsEvent) element).getEventType().equals(ElementTypesConfigurationsEventType.Unexecutable)) {
- return red;
- } else if (((IElementTypesConfigurationsEvent) element).getEventType().equals(ElementTypesConfigurationsEventType.Executable)) {
- return green;
- } else if (((IElementTypesConfigurationsEvent) element).getEventType().equals(ElementTypesConfigurationsEventType.Approved)) {
- return green;
- } else if (((IElementTypesConfigurationsEvent) element).getEventType().equals(ElementTypesConfigurationsEventType.Identity)) {
- return yellow;
- } else if (((IElementTypesConfigurationsEvent) element).getEventType().equals(ElementTypesConfigurationsEventType.RequestConfiguration)) {
- return blue;
- }
- } else if (element instanceof Map.Entry) {
- Object value = ((Map.Entry<?, ?>) element).getValue();
- if (value instanceof Collection) {
- return checkWorst((Collection<?>) value, true);
- }
- } else if (element instanceof ElementTypesConfigurationsEventsChain) {
- return checkWorst(((ElementTypesConfigurationsEventsChain) element).getAllEvents(), false);
- }
- return black;
- }
-
- /**
- * @param value
- */
- private Color checkWorst(Collection<?> value, boolean considerRequestConfiguration) {
- Color result = green;
- for (Object object : value) {
- if (((IElementTypesConfigurationsEvent) object).getEventType().equals(ElementTypesConfigurationsEventType.Disapproved)) {
- return red;
- } else if (((IElementTypesConfigurationsEvent) object).getEventType().equals(ElementTypesConfigurationsEventType.Unexecutable)) {
- return red;
- } else if (((IElementTypesConfigurationsEvent) object).getEventType().equals(ElementTypesConfigurationsEventType.Identity)) {
- if (result == green) {
- result = yellow;
- }
- } else if (((IElementTypesConfigurationsEvent) object).getEventType().equals(ElementTypesConfigurationsEventType.RequestConfiguration)) {
- if (considerRequestConfiguration) {
- if (result != yellow && result != red) {
- result = blue;
- }
- }
- }
- }
- return result;
- }
-
- /**
- * @see org.eclipse.jface.viewers.IColorProvider#getBackground(java.lang.Object)
- *
- * @param element
- * @return
- */
- @Override
- public Color getBackground(Object element) {
- // TODO Auto-generated method stub
- return null;
- }
-
-}
diff --git a/plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/providers/ElementTypesContentProvider.java b/plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/providers/ElementTypesContentProvider.java
deleted file mode 100644
index 9714f998a45..00000000000
--- a/plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/providers/ElementTypesContentProvider.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.elementtypesconfigurations.developer.providers;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.MetamodelType;
-import org.eclipse.gmf.runtime.emf.type.core.SpecializationType;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.papyrus.elementtypesconfigurations.developer.utils.IElementTypeComparator;
-
-public class ElementTypesContentProvider implements ITreeContentProvider {
-
- private Map<IElementType, List<SpecializationType>> elementTypesHierarchy = new HashMap<IElementType, List<SpecializationType>>();
-
- @Override
- public void dispose() {
- }
-
- @Override
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- if (newInput instanceof Object[]) {
- elementTypesHierarchy.clear();
- for (Object elementType : ((Object[]) newInput)) {
- if (elementType instanceof MetamodelType) {
- if (!elementTypesHierarchy.containsKey(elementType)) {
- elementTypesHierarchy.put((MetamodelType) elementType, new ArrayList<SpecializationType>());
- }
- } else if (elementType instanceof SpecializationType) {
- for (IElementType superType : ((SpecializationType) elementType).getSpecializedTypes()) {
- if (!elementTypesHierarchy.containsKey(superType)) {
- elementTypesHierarchy.put(superType, new ArrayList<SpecializationType>());
- }
- elementTypesHierarchy.get(superType).add((SpecializationType) elementType);
- }
- }
- }
- }
- }
-
- @Override
- public Object[] getElements(Object inputElement) {
- inputChanged(null, null, inputElement);
- ArrayList<IElementType> result = new ArrayList<IElementType>();
- for (IElementType iElementType : elementTypesHierarchy.keySet()) {
- if (iElementType instanceof MetamodelType) {
- result.add(iElementType);
- }
- }
- Collections.sort(result, new IElementTypeComparator());
-
- return result.toArray();
- }
-
- @Override
- public Object[] getChildren(Object parentElement) {
- return elementTypesHierarchy.containsKey(parentElement) ? elementTypesHierarchy.get(parentElement).toArray() : Collections.emptyList().toArray();
- }
-
- @Override
- public Object getParent(Object element) {
- return null;
- }
-
- @Override
- public boolean hasChildren(Object element) {
- return getChildren(element).length == 0 ? false : true;
- }
-}
diff --git a/plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/providers/ElementTypesDetailsContentProvider.java b/plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/providers/ElementTypesDetailsContentProvider.java
deleted file mode 100644
index 10a3a094a65..00000000000
--- a/plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/providers/ElementTypesDetailsContentProvider.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.elementtypesconfigurations.developer.providers;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.emf.ecore.EReference;
-import org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil;
-import org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.IHintedType;
-import org.eclipse.gmf.runtime.emf.type.core.SpecializationType;
-import org.eclipse.gmf.runtime.emf.type.core.edithelper.IEditHelperAdvice;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.papyrus.elementtypesconfigurations.developer.utils.AdvicesComparator;
-
-public class ElementTypesDetailsContentProvider implements ITreeContentProvider {
-
- /**
- * @see org.eclipse.jface.viewers.IContentProvider#dispose()
- *
- */
- @Override
- public void dispose() {
- // TODO Auto-generated method stub
-
- }
-
- /**
- * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
- *
- * @param viewer
- * @param oldInput
- * @param newInput
- */
- @Override
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- // TODO Auto-generated method stub
-
- }
-
- /**
- * @see org.eclipse.jface.viewers.ITreeContentProvider#getElements(java.lang.Object)
- *
- * @param inputElement
- * @return
- */
- @Override
- public Object[] getElements(Object inputElement) {
- ArrayList<Object> result = new ArrayList<Object>();
- if (inputElement instanceof IElementType) {
- if (inputElement instanceof IHintedType) {
- result.add("Semantic Hint: " + ((IHintedType) inputElement).getSemanticHint());
- } else {
- result.add("Not Hinted");
- }
- if (inputElement instanceof SpecializationType) {
- for (String id : ((SpecializationType) inputElement).getSpecializedTypeIds()) {
- result.add("SpecializedType Id: " + id);
- }
-
-
- if (((SpecializationType) inputElement).getEditHelperAdvice() != null) {
- result.add("EditHelperAdvice: " + ((SpecializationType) inputElement).getEditHelperAdvice().getClass().getName());
- } else {
- result.add("EditHelperAdvice: None");
- }
-
- if (((SpecializationType) inputElement).getEContainerDescriptor() != null) {
- String eReferences = "";
- for (EReference eReference : ((SpecializationType) inputElement).getEContainerDescriptor().getContainmentFeatures()) {
- eReferences += EMFCoreUtil.getQualifiedName(eReference, true) + " ";
- }
- result.add("EContainerDescriptor: " + eReferences);
- } else {
- result.add("EContainerDescriptor: None");
- }
- }
-
- if (((IElementType) inputElement).getEditHelper() != null) {
- result.add("EditHelper: " + ((IElementType) inputElement).getEditHelper().getClass().getName());
- } else {
- result.add("EditHelper: None");
- }
-
- if (((IElementType) inputElement).getEClass() != null) {
- result.add("Eclass: " + EMFCoreUtil.getQualifiedName(((IElementType) inputElement).getEClass(), true));
- } else {
- result.add("Eclass: None");
- }
-
- result.add("Display Name: " + ((IElementType) inputElement).getDisplayName());
- IEditHelperAdvice[] advices = ElementTypeRegistry.getInstance().getEditHelperAdvice(((IElementType) inputElement));
- result.add(Arrays.asList(advices));
- }
- return result.toArray();
- }
-
- /**
- * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)
- *
- * @param parentElement
- * @return
- */
- @Override
- public Object[] getChildren(Object parentElement) {
- if (parentElement instanceof List<?>) {
- Collections.sort((List<IEditHelperAdvice>) parentElement, new AdvicesComparator());
- return ((List<?>) parentElement).toArray();
- }
-
- return Collections.emptyList().toArray();
- }
-
- /**
- * @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object)
- *
- * @param element
- * @return
- */
- @Override
- public Object getParent(Object element) {
- // TODO Auto-generated method stub
- return null;
- }
-
- /**
- * @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object)
- *
- * @param element
- * @return
- */
- @Override
- public boolean hasChildren(Object element) {
- return getChildren(element).length == 0 ? false : true;
- }
-
-
-}
diff --git a/plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/providers/ElementTypesDetailsLabelProvider.java b/plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/providers/ElementTypesDetailsLabelProvider.java
deleted file mode 100644
index 2736e4dddc8..00000000000
--- a/plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/providers/ElementTypesDetailsLabelProvider.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.elementtypesconfigurations.developer.providers;
-
-import java.util.List;
-
-import org.eclipse.gmf.runtime.emf.type.core.edithelper.IEditHelperAdvice;
-import org.eclipse.swt.graphics.Image;
-
-public class ElementTypesDetailsLabelProvider extends org.eclipse.jface.viewers.LabelProvider {
-
- @Override
- public Image getImage(Object element) {
- return null;
- }
-
- @Override
- public String getText(Object element) {
- String result = "";
- if (element instanceof String) {
- result += element;
- } else if (element instanceof List<?>) {
- result += "Advices: ";
- } else if (element instanceof IEditHelperAdvice) {
- result += element;
- }
- return result;
- }
-}
diff --git a/plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/providers/ElementTypesLabelProvider.java b/plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/providers/ElementTypesLabelProvider.java
deleted file mode 100644
index fa89e5858e3..00000000000
--- a/plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/providers/ElementTypesLabelProvider.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.elementtypesconfigurations.developer.providers;
-
-import java.io.IOException;
-
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-
-public class ElementTypesLabelProvider extends org.eclipse.jface.viewers.LabelProvider {
-
- @Override
- public Image getImage(Object element) {
- if (element instanceof IElementType) {
- if (((IElementType) element).getIconURL() != null) {
- try {
- return new Image(Display.getCurrent(), ((IElementType) element).getIconURL().openStream());
- } catch (IOException ex) {
- ex.printStackTrace();
- }
- }
- }
- return null;
- }
-
- @Override
- public String getText(Object element) {
- String result = "";
- if (element instanceof IElementType) {
- result += ((IElementType) element).getId();
- }
- return result;
- }
-}
diff --git a/plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/utils/AdvicesComparator.java b/plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/utils/AdvicesComparator.java
deleted file mode 100644
index 9df1c0773d7..00000000000
--- a/plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/utils/AdvicesComparator.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2015 CEA LIST and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.elementtypesconfigurations.developer.utils;
-
-import java.util.Comparator;
-
-import org.eclipse.gmf.runtime.emf.type.core.edithelper.IEditHelperAdvice;
-
-
-public class AdvicesComparator implements Comparator<IEditHelperAdvice> {
-
- /**
- * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
- *
- * @param arg0
- * @param arg1
- * @return
- */
- @Override
- public int compare(IEditHelperAdvice o1, IEditHelperAdvice o2) {
- return o1.toString().compareTo(o2.toString());
- }
-
-}
diff --git a/plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/utils/EClassComparator.java b/plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/utils/EClassComparator.java
deleted file mode 100644
index 60b1249bfee..00000000000
--- a/plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/utils/EClassComparator.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.elementtypesconfigurations.developer.utils;
-
-import java.util.Comparator;
-
-import org.eclipse.emf.ecore.EClass;
-
-public class EClassComparator implements Comparator<EClass> {
-
- @Override
- public int compare(EClass o1, EClass o2) {
- return o1.getName().compareTo(o2.getName());
- }
-} \ No newline at end of file
diff --git a/plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/utils/ElementTypeConfigurationComparator.java b/plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/utils/ElementTypeConfigurationComparator.java
deleted file mode 100644
index 73bb842866b..00000000000
--- a/plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/utils/ElementTypeConfigurationComparator.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.elementtypesconfigurations.developer.utils;
-
-import java.util.Comparator;
-
-import org.eclipse.papyrus.infra.elementtypesconfigurations.ElementTypeConfiguration;
-
-public class ElementTypeConfigurationComparator implements Comparator<ElementTypeConfiguration> {
-
- @Override
- public int compare(ElementTypeConfiguration o1, ElementTypeConfiguration o2) {
- return o1.getName().compareTo(o2.getName());
- }
-} \ No newline at end of file
diff --git a/plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/utils/ElementTypeRegistryUtils.java b/plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/utils/ElementTypeRegistryUtils.java
deleted file mode 100644
index 16ed6ae5147..00000000000
--- a/plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/utils/ElementTypeRegistryUtils.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.elementtypesconfigurations.developer.utils;
-
-import java.lang.reflect.Field;
-
-import org.eclipse.gmf.runtime.emf.type.core.MetamodelType;
-import org.eclipse.papyrus.infra.elementtypesconfigurations.Activator;
-
-
-public class ElementTypeRegistryUtils {
-
-
- static public synchronized Field getNullElementTypeEditHelper() {
-
- Field declaredField = null;
- try {
- declaredField = MetamodelType.class.getDeclaredField("editHelper");
- } catch (SecurityException e1) {
- Activator.log.error(e1);
- return null;
- } catch (NoSuchFieldException e1) {
- Activator.log.error(e1);
- return null;
- }
- if (declaredField == null) {
- Activator.log.error("impossible to find editHelper", null);
- return null;
- }
- declaredField.setAccessible(true);
-
- return declaredField;
- }
-
-}
diff --git a/plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/utils/ElementTypesConfigurationsEventPrinter.java b/plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/utils/ElementTypesConfigurationsEventPrinter.java
deleted file mode 100644
index 334f7317b5d..00000000000
--- a/plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/utils/ElementTypesConfigurationsEventPrinter.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2016 CEA LIST and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.elementtypesconfigurations.developer.utils;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.gmf.runtime.emf.type.core.edithelper.IEditHelperAdvice;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest;
-import org.eclipse.papyrus.infra.elementtypesconfigurations.notification.events.AdviceApprovedEvent;
-import org.eclipse.papyrus.infra.elementtypesconfigurations.notification.events.AdviceDisapprovedEvent;
-import org.eclipse.papyrus.infra.elementtypesconfigurations.notification.events.AdviceRequestConfigurationEvent;
-import org.eclipse.papyrus.infra.elementtypesconfigurations.notification.events.EditHelperApprovedEvent;
-import org.eclipse.papyrus.infra.elementtypesconfigurations.notification.events.EditHelperDisapprovedEvent;
-import org.eclipse.papyrus.infra.elementtypesconfigurations.notification.events.EditHelperRequestConfigurationEvent;
-import org.eclipse.papyrus.infra.elementtypesconfigurations.notification.events.ExecutableAdviceEvent;
-import org.eclipse.papyrus.infra.elementtypesconfigurations.notification.events.ExecutableEditHelperEvent;
-import org.eclipse.papyrus.infra.elementtypesconfigurations.notification.events.IAdviceEvent;
-import org.eclipse.papyrus.infra.elementtypesconfigurations.notification.events.IElementTypesConfigurationsEvent;
-import org.eclipse.papyrus.infra.elementtypesconfigurations.notification.events.IdentityAdviceEvent;
-import org.eclipse.papyrus.infra.elementtypesconfigurations.notification.events.IdentityEditHelperEvent;
-import org.eclipse.papyrus.infra.elementtypesconfigurations.notification.events.UnexecutableAdviceEvent;
-import org.eclipse.papyrus.infra.elementtypesconfigurations.notification.events.UnexecutableEditHelperEvent;
-
-public class ElementTypesConfigurationsEventPrinter {
- public static Map<String, String> getEventDetails(IElementTypesConfigurationsEvent event) {
- Map<String, String> result = new HashMap<>();
-
- if (event instanceof AdviceApprovedEvent) {
- result.put("Approved Advice", ((AdviceApprovedEvent) event).getAdvice().getClass().getName());
- } else if (event instanceof AdviceDisapprovedEvent) {
- result.put("Disapprover Advice", ((AdviceDisapprovedEvent) event).getAdvice().getClass().getName());
- } else if (event instanceof EditHelperApprovedEvent) {
- result.put("Approver edithelper", ((EditHelperApprovedEvent) event).getEditHelper().getClass().getName());
- } else if (event instanceof EditHelperDisapprovedEvent) {
- result.put("Disapprover edithelper", ((EditHelperDisapprovedEvent) event).getEditHelper().getClass().getName());
- } else if (event instanceof ExecutableAdviceEvent) {
- result.put("Advice", ((ExecutableAdviceEvent) event).getAdvice().getClass().getName());
- result.put("Phase ", ((ExecutableAdviceEvent) event).getAdvicePhase().name());
- result.put("Executable command", ((ExecutableAdviceEvent) event).getCommand().getClass().getName());
- } else if (event instanceof ExecutableEditHelperEvent) {
- result.put("Executable command from edithelper", ((ExecutableEditHelperEvent) event).getEditHelper().getClass().getName());
- result.put("Executable command", ((ExecutableEditHelperEvent) event).getCommand().getClass().getName());
- } else if (event instanceof IdentityAdviceEvent) {
- result.put("Identity Advice", ((IdentityAdviceEvent) event).getAdvice().getClass().getName());
- result.put("Phase ", ((IdentityAdviceEvent) event).getAdvicePhase().name());
- } else if (event instanceof IdentityEditHelperEvent) {
- result.put("Identity EditHelper", ((IdentityEditHelperEvent) event).getEditHelper().getClass().getName());
- } else if (event instanceof UnexecutableAdviceEvent) {
- result.put("Unexecutable Advice", ((UnexecutableAdviceEvent) event).getAdvice().getClass().getName());
- result.put("Phase ", ((UnexecutableAdviceEvent) event).getAdvicePhase().name());
- result.put("Unexecutable command", ((UnexecutableAdviceEvent) event).getCommand().getClass().getName());
- } else if (event instanceof UnexecutableEditHelperEvent) {
- result.put("Unexecutable command from edithelper", ((UnexecutableEditHelperEvent) event).getEditHelper().getClass().getName());
- result.put("Unexecutable command", ((UnexecutableEditHelperEvent) event).getCommand().getClass().getName());
- } else if (event instanceof AdviceRequestConfigurationEvent) {
- result.put("RequestConfiguration Advice", ((AdviceRequestConfigurationEvent) event).getAdvice().getClass().getName());
- } else if (event instanceof EditHelperRequestConfigurationEvent) {
- result.put("RequestConfiguration EditHelper", ((EditHelperRequestConfigurationEvent) event).getEditHelper().getClass().getName());
- }
-
- if (event instanceof IAdviceEvent) {
- String adviceNames = "";
- for (IEditHelperAdvice editHelperAdvice : ((IAdviceEvent) event).getAdvices()) {
- adviceNames += " -" + editHelperAdvice.getClass().getName() + "\n";
- }
- result.put("Among the following advices ", adviceNames);
- }
-
- return result;
- }
-
- public static String printHtmlEvent(Map<String, String> details) {
-
-
- String html = "<table border=\"1\">";
- for (String key : details.keySet()) {
- html += "<tr>";
- html += "<td><b>" + key + "<b></td>";
- html += "<td>" + details.get(key) + "</td>";
- html += "</tr>";
- }
- html += "</table>";
-
- html = html.replaceAll("\\n", "<br>");
-
- return html;
- }
-
- /**
- * @param req
- * @return
- */
- public static String printHtmRequest(IEditCommandRequest req) {
- String result = "<ul>";
- result += "<li><b>Request</b>: " + req + "</li>";
- result += "<li><b>Label</b>: " + req.getLabel() + "</li>";
- result += "<li><b>Kind</b>: " + req.getClass().getName() + "</li>";
- result += "<li><b>ElementsToEdit</b>: " + req.getElementsToEdit() + "</li>";
- result += "<li><b>Parameters</b>:</li>";
-
- if (!req.getParameters().keySet().isEmpty()) {
- result += "<ul>";
-
- for (Object key : req.getParameters().keySet()) {
- result += "<li><b>" + key + "</b> <-> " + req.getParameters().get(key) + "</li>";
- }
- result += "</ul>";
- }
- result += "<li><b>EditHelperContext</b>: " + req.getEditHelperContext() + "</li>";
-
- if (req instanceof CreateElementRequest) {
- result += "<li><b>ElementType</b>: " + ((CreateElementRequest) req).getElementType() + "</li>";
- result += "<li><b>Container</b>: " + ((CreateElementRequest) req).getContainer() + "</li>";
- result += "<li><b>ContainmentFeature</b>: " + ((CreateElementRequest) req).getContainmentFeature() + "</li>";
- if (req instanceof CreateRelationshipRequest) {
- result += "<li><b>Source</b>: " + ((CreateRelationshipRequest) req).getSource() + "</li>";
- result += "<li><b>Target</b>: " + ((CreateRelationshipRequest) req).getTarget() + "</li>";
- }
- }
- result += "</ul>";
-
- return result;
- }
-}
diff --git a/plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/utils/GenerateElementTypesConfigurationsUtils.java b/plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/utils/GenerateElementTypesConfigurationsUtils.java
deleted file mode 100644
index 09519bf8b28..00000000000
--- a/plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/utils/GenerateElementTypesConfigurationsUtils.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.elementtypesconfigurations.developer.utils;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EClassifier;
-import org.eclipse.emf.ecore.ENamedElement;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.ecore.EReference;
-import org.eclipse.uml2.uml.UMLPackage;
-
-public class GenerateElementTypesConfigurationsUtils {
-
-
-
- static public Collection<EReference> findAmbiguousContainments(EReference eReference, Collection<EReference> possibleContainmentsEReference) {
- HashSet<EReference> result = new HashSet<EReference>();
-
- for (EReference ownerContainment : eReference.getEContainingClass().getEAllContainments()) {
- for (EReference possibleContainement : possibleContainmentsEReference) {
- if (eReference != possibleContainement) {
- if (ownerContainment.equals(possibleContainement)) {
- result.add(possibleContainement);
- }
- }
- }
- }
-
- return result;
- }
-
- static public Collection<EReference> findPossibleContainmentsEReference(EClass ownedEClass, Collection<EClass> ownerTypes) {
- HashSet<EReference> result = new HashSet<EReference>();
- for (EClass candidateOwner : ownerTypes) {
- for (EReference eReference : candidateOwner.getEAllContainments()) {
- if (isKindOf(ownedEClass, eReference.getEReferenceType())) {
- result.add(eReference);
- }
- }
- }
- return result;
- }
-
- static public boolean isKindOf(EClass a, EClassifier b) {
- if (a.getEAllSuperTypes().contains(b)) {
- return true;
- } else {
- return a.equals(b);
- }
- }
-
- static public Collection<EClass> getAllEClass(EPackage ePackage) {
- List<EClass> eClasses = new ArrayList<EClass>();
- for (EClassifier eClassifier : ePackage.getEClassifiers()) {
- if (eClassifier instanceof EClass) {
- eClasses.add((EClass) eClassifier);
- }
- }
-
- Collections.sort(eClasses, new EClassComparator());
-
- return eClasses;
- }
-
- static public String getIdentifier(EClass eClass) {
- return "org.eclipse.papyrus.uml." + eClass.getName();
- }
-
- static public String getAsName(EReference containmentEReference, EClass container) {
- return "_As_" + ((ENamedElement) container.eContainer()).getName().toUpperCase() + "::" + container.getName() + "::" + containmentEReference.getName();
- }
-
- static public boolean isSpecializedASpecialization(EClass eClass, EReference containmentEReference) {
- Collection<EReference> possibleContainmentsEReference = findPossibleContainmentsEReference(eClass, getAllEClass(UMLPackage.eINSTANCE));
- if (!findAmbiguousContainments(containmentEReference, possibleContainmentsEReference).isEmpty()) {
- // The SpecialiazedType is SpecializationType
- return true;
- } else {
- // The SpecialiazedType is MetamodelType
- return false;
-
- }
- }
-
- static public String findSpecializedTypesIDs(EClass eClass, EReference containmentEReference) {
- if (isSpecializedASpecialization(eClass, containmentEReference)) {
- // The SpecialiazedType is SpecializationType
- return GenerateElementTypesConfigurationsUtils.getIdentifier(eClass) + GenerateElementTypesConfigurationsUtils.getAsName(containmentEReference, eClass);
- } else {
- // The SpecialiazedType is MetamodelType
- return getIdentifier(eClass);
- }
-
-
- }
-}
diff --git a/plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/utils/IElementTypeComparator.java b/plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/utils/IElementTypeComparator.java
deleted file mode 100644
index f015527581a..00000000000
--- a/plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/utils/IElementTypeComparator.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.elementtypesconfigurations.developer.utils;
-
-import java.util.Comparator;
-
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-
-public class IElementTypeComparator implements Comparator<IElementType> {
-
- @Override
- public int compare(IElementType o1, IElementType o2) {
- return o1.getId().compareTo(o2.getId());
- }
-} \ No newline at end of file
diff --git a/plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/utils/NotifierNullEditHelper.java b/plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/utils/NotifierNullEditHelper.java
deleted file mode 100644
index 9c1ed6085ec..00000000000
--- a/plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/utils/NotifierNullEditHelper.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2016 CEA LIST and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.elementtypesconfigurations.developer.utils;
-
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest;
-import org.eclipse.papyrus.infra.elementtypesconfigurations.notification.AbstractNotifierEditHelper;
-
-/**
- * Edit helper for the NullElementType that considers before and after
- * advice, only.
- */
-public class NotifierNullEditHelper
- extends AbstractNotifierEditHelper {
-
- protected ICommand getInsteadCommand(IEditCommandRequest req) {
- return null;
- }
-} \ No newline at end of file
diff --git a/plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/view/ElementTypesConfigurationsListenerView.java b/plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/view/ElementTypesConfigurationsListenerView.java
deleted file mode 100644
index 0953772c4b6..00000000000
--- a/plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/view/ElementTypesConfigurationsListenerView.java
+++ /dev/null
@@ -1,227 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.elementtypesconfigurations.developer.view;
-
-
-import java.lang.reflect.Field;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.gmf.runtime.emf.type.core.IClientContext;
-import org.eclipse.gmf.runtime.emf.type.core.NullElementType;
-import org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.papyrus.elementtypesconfigurations.developer.Activator;
-import org.eclipse.papyrus.elementtypesconfigurations.developer.providers.ElementTypesConfigurationsEventContentProvider;
-import org.eclipse.papyrus.elementtypesconfigurations.developer.providers.ElementTypesConfigurationsEventLabelProvider;
-import org.eclipse.papyrus.elementtypesconfigurations.developer.utils.ElementTypeRegistryUtils;
-import org.eclipse.papyrus.elementtypesconfigurations.developer.utils.ElementTypesConfigurationsEventPrinter;
-import org.eclipse.papyrus.elementtypesconfigurations.developer.utils.NotifierNullEditHelper;
-import org.eclipse.papyrus.infra.elementtypesconfigurations.notification.ElementTypesConfigurationsEventsChain;
-import org.eclipse.papyrus.infra.elementtypesconfigurations.notification.ElementTypesConfigurationsListenersRegistry;
-import org.eclipse.papyrus.infra.elementtypesconfigurations.notification.IElementTypesConfigurationsEventsChainListener;
-import org.eclipse.papyrus.infra.elementtypesconfigurations.notification.events.IElementTypesConfigurationsEvent;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.browser.Browser;
-import org.eclipse.swt.custom.SashForm;
-import org.eclipse.swt.events.MouseAdapter;
-import org.eclipse.swt.events.MouseEvent;
-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.Display;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.dialogs.FilteredTree;
-import org.eclipse.ui.dialogs.PatternFilter;
-import org.eclipse.ui.part.ViewPart;
-
-public class ElementTypesConfigurationsListenerView extends ViewPart {
-
- IClientContext context = null;
- FilteredTree tree = null;
- SashForm sash = null;
- Browser browser = null;
- IElementTypesConfigurationsEventsChainListener listener = null;
- Text limitText = null;
-
- List<ElementTypesConfigurationsEventsChain> eventsChains = new ArrayList<ElementTypesConfigurationsEventsChain>();
-
- final private int MAX_SIZE = 1000;
-
-
- @Override
- public void createPartControl(Composite parent) {
- parent.setLayout(new GridLayout(3, true));
- Button startButton = new Button(parent, SWT.NONE);
- startButton.setText("Start");
- startButton.addMouseListener(new MouseAdapter() {
-
-
-
- @Override
- public void mouseUp(MouseEvent e) {
- if (!Platform.inDebugMode()) {
- MessageDialog.openInformation(Display.getCurrent().getActiveShell(), "Debug mode", "You must activate debug mode to be able to use this view. ");
- }
-
- // Dirty work to force the NullElementType edithelper if in debug mode
- if (Platform.inDebugMode()) {
-
- Field nullElementTypeEditHelperField = ElementTypeRegistryUtils.getNullElementTypeEditHelper();
-
- if (nullElementTypeEditHelperField != null) {
- // Register fake
-
- try {
- nullElementTypeEditHelperField.set(NullElementType.getInstance(), new NotifierNullEditHelper());
- } catch (IllegalArgumentException e1) {
- // TODO Auto-generated catch block
- e1.printStackTrace();
- } catch (IllegalAccessException e1) {
- // TODO Auto-generated catch block
- e1.printStackTrace();
- }
- } else {
- Activator.log.warn("Failed to override NullElementType's EditHelper");
- }
-
- MessageDialog.openInformation(Display.getCurrent().getActiveShell(), "Debug mode", "Be careful, as the platform is in debug mode, the NullElementType's EditHelper has been overriden");
- }
-
- if (listener == null) {
- listener = new IElementTypesConfigurationsEventsChainListener() {
-
- @Override
- public void notifyChain(ElementTypesConfigurationsEventsChain chain) {
- int limit;
- String text = limitText.getText();
- try {
- limit = Integer.parseInt(text);
- } catch (NumberFormatException e) {
- limit = MAX_SIZE;
- }
- if (eventsChains.size() >= limit) {
- eventsChains.remove(0);
- }
- eventsChains.add(chain);
- Display.getCurrent().asyncExec(new Runnable() {
- @Override
- public void run() {
- tree.getViewer().refresh();
- }
- });
-
- }
- };
- ElementTypesConfigurationsListenersRegistry.getInstance().addEventChainListener(listener);
- }
- }
-
- });
- startButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
-
- Button stopButton = new Button(parent, SWT.NONE);
- stopButton.setText("Stop");
- stopButton.addMouseListener(new MouseAdapter() {
-
- @Override
- public void mouseUp(MouseEvent e) {
- ElementTypesConfigurationsListenersRegistry.getInstance().removeEventChainListener(listener);
- listener = null;
- }
-
- });
- stopButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
-
- Button clearButton = new Button(parent, SWT.NONE);
- clearButton.setText("Clear");
- clearButton.addMouseListener(new MouseAdapter() {
-
- @Override
- public void mouseUp(MouseEvent e) {
- eventsChains.clear();
- tree.getViewer().refresh();
- browser.setText("");
- }
-
- });
- clearButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
-
- Label label = new Label(parent, SWT.NONE);
- label.setText("Limit: ");
-
- limitText = new Text(parent, SWT.BORDER);
- limitText.setText(MAX_SIZE + "");
- limitText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1));
-
- sash = new SashForm(parent, SWT.HORIZONTAL | SWT.BORDER);
-
- sash.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1));
-
- tree = new FilteredTree(sash, SWT.BORDER, new PatternFilter(), true);
- tree.getViewer().setLabelProvider(new ElementTypesConfigurationsEventLabelProvider());
- tree.getViewer().setContentProvider(new ElementTypesConfigurationsEventContentProvider());
- tree.getViewer().addSelectionChangedListener(new ISelectionChangedListener() {
-
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- if (event.getSelection() instanceof IStructuredSelection) {
- Object first = ((IStructuredSelection) event.getSelection()).getFirstElement();
- String result = "";
- if (first instanceof IElementTypesConfigurationsEvent) {
-
- Map<String, String> details = ElementTypesConfigurationsEventPrinter.getEventDetails(((IElementTypesConfigurationsEvent) first));
- result = ElementTypesConfigurationsEventPrinter.printHtmlEvent(details);
- } else if (first instanceof ElementTypesConfigurationsEventsChain) {
- IEditCommandRequest req = ((ElementTypesConfigurationsEventsChain) first).getRequest();
- result = ElementTypesConfigurationsEventPrinter.printHtmRequest(req);
- }
- browser.setText(result);
- }
-
- }
- });
- tree.getViewer().setInput(eventsChains);
-
- browser = new Browser(sash, SWT.NONE);
-
-
- sash.setWeights(new int[] { 1, 3 });
- }
-
-
-
- @Override
- public void setFocus() {
-
- }
-
- /**
- * @see org.eclipse.ui.part.WorkbenchPart#dispose()
- *
- */
- @Override
- public void dispose() {
- ElementTypesConfigurationsListenersRegistry.getInstance().removeEventChainListener(listener);
- super.dispose();
- }
-
-
-}
diff --git a/plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/view/RegistredElementTypesView.java b/plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/view/RegistredElementTypesView.java
deleted file mode 100644
index b41803577ec..00000000000
--- a/plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/view/RegistredElementTypesView.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.elementtypesconfigurations.developer.view;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.gmf.runtime.emf.type.core.ClientContextManager;
-import org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry;
-import org.eclipse.gmf.runtime.emf.type.core.IClientContext;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.papyrus.elementtypesconfigurations.developer.providers.ElementTypesContentProvider;
-import org.eclipse.papyrus.elementtypesconfigurations.developer.providers.ElementTypesDetailsContentProvider;
-import org.eclipse.papyrus.elementtypesconfigurations.developer.providers.ElementTypesDetailsLabelProvider;
-import org.eclipse.papyrus.elementtypesconfigurations.developer.providers.ElementTypesLabelProvider;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.SashForm;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.dialogs.FilteredTree;
-import org.eclipse.ui.dialogs.PatternFilter;
-import org.eclipse.ui.part.ViewPart;
-
-public class RegistredElementTypesView extends ViewPart {
-
- FilteredTree detailsFilteredTree = null;
- SashForm sash = null;
- FilteredTree elementTypesFilteredTree = null;
- Combo combo = null;
-
-
- @Override
- public void createPartControl(Composite parent) {
- parent.setLayout(new GridLayout(1, true));
-
- combo = new Combo(parent, SWT.NONE);
- final List<String> itemsList = new ArrayList<>();
- List<IClientContext> contexts = new ArrayList<IClientContext>(ClientContextManager.getInstance().getClientContexts());
-
- int index = -1;
- int i = 0;
- for (IClientContext context : contexts) {
- itemsList.add(context.getId());
- if (context.getId().equals(ClientContextManager.getDefaultClientContext().getId())) {
- index = i;
- }
- i++;
- }
- String[] items = new String[itemsList.size()];
- items = itemsList.toArray(items);
- combo.setItems(items);
- if (index != -1) {
- combo.select(index);
- }
- combo.addSelectionListener(new SelectionListener() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- int index = combo.getSelectionIndex();
-
- String clientContexId = itemsList.get(index);
-
- if (clientContexId != null) {
- IClientContext clientContex = ClientContextManager.getInstance().getClientContext(clientContexId);
- if (clientContex != null) {
- IElementType[] elementTypes = ElementTypeRegistry.getInstance().getElementTypes(clientContex);
- elementTypesFilteredTree.getViewer().setInput(elementTypes);
- }
- }
-
- }
-
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {
-
-
- }
- });
-
- sash = new SashForm(parent, SWT.HORIZONTAL);
- sash.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
-
- elementTypesFilteredTree = new FilteredTree(sash, SWT.BORDER, new PatternFilter(), true);
- elementTypesFilteredTree.getViewer().setLabelProvider(new ElementTypesLabelProvider());
- elementTypesFilteredTree.getViewer().setContentProvider(new ElementTypesContentProvider());
- detailsFilteredTree = new FilteredTree(sash, SWT.BORDER, new PatternFilter(), true);
- detailsFilteredTree.getViewer().setLabelProvider(new ElementTypesDetailsLabelProvider());
- detailsFilteredTree.getViewer().setContentProvider(new ElementTypesDetailsContentProvider());
-
- if (index != -1) {
- combo.select(index);
- }
-
- elementTypesFilteredTree.getViewer().addSelectionChangedListener(new ISelectionChangedListener() {
-
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- if (event.getSelection() instanceof IStructuredSelection) {
- detailsFilteredTree.getViewer().setInput(((IStructuredSelection) event.getSelection()).getFirstElement());
- }
-
- }
- });
- }
-
- @Override
- public void setFocus() {
-
- }
-}

Back to the top