diff options
author | Camille Letavernier | 2013-07-17 11:02:52 +0000 |
---|---|---|
committer | Camille Letavernier | 2013-07-17 11:02:52 +0000 |
commit | 760b53a67156cc8dec462b48d2f4cb1863c29161 (patch) | |
tree | d835ac2efa6de795320372b32735d7d248290824 /plugins | |
parent | ffc76d52eaa000c46a7638eea089f800b5513d83 (diff) | |
download | org.eclipse.papyrus-760b53a67156cc8dec462b48d2f4cb1863c29161.tar.gz org.eclipse.papyrus-760b53a67156cc8dec462b48d2f4cb1863c29161.tar.xz org.eclipse.papyrus-760b53a67156cc8dec462b48d2f4cb1863c29161.zip |
408491: Papyrus shall enable to easily switch between local and
registered profiles.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=408491
Initial contribution
Diffstat (limited to 'plugins')
6 files changed, 219 insertions, 0 deletions
diff --git a/plugins/infra/org.eclipse.papyrus.infra.modelrepair/META-INF/MANIFEST.MF b/plugins/infra/org.eclipse.papyrus.infra.modelrepair/META-INF/MANIFEST.MF new file mode 100644 index 00000000000..c193d860d28 --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.modelrepair/META-INF/MANIFEST.MF @@ -0,0 +1,14 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Model Repair (Incubation) +Bundle-SymbolicName: org.eclipse.papyrus.uml.modelrepair;singleton:=true +Bundle-Version: 0.10.1.qualifier +Bundle-Activator: org.eclipse.papyrus.uml.modelrepair.Activator +Bundle-Vendor: Eclipse Modeling Project +Require-Bundle: org.eclipse.ui, + org.eclipse.core.runtime, + org.eclipse.papyrus.infra.core;bundle-version="0.10.1", + org.eclipse.papyrus.uml.extensionpoints;bundle-version="0.10.1", + org.eclipse.emf.ecore;bundle-version="2.9.0" +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Bundle-ActivationPolicy: lazy diff --git a/plugins/infra/org.eclipse.papyrus.infra.modelrepair/build.properties b/plugins/infra/org.eclipse.papyrus.infra.modelrepair/build.properties new file mode 100644 index 00000000000..e3693a3b66e --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.modelrepair/build.properties @@ -0,0 +1,7 @@ +source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ about.html,\
+ plugin.xml
+src.includes = about.html
diff --git a/plugins/infra/org.eclipse.papyrus.infra.modelrepair/plugin.xml b/plugins/infra/org.eclipse.papyrus.infra.modelrepair/plugin.xml new file mode 100644 index 00000000000..2a9dd64012b --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.modelrepair/plugin.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ point="org.eclipse.ui.menus">
+ <menuContribution
+ allPopups="false"
+ locationURI="org.eclipse.papyrus.uml.modelrepair.menuContribution1">
+ </menuContribution>
+ </extension>
+ <extension
+ point="org.eclipse.ui.commands">
+ <command
+ defaultHandler="org.eclipse.papyrus.uml.modelrepair.handler.ModelRepairHandler"
+ id="org.eclipse.papyrus.uml.modelrepair.editlinks"
+ name="Edit model links">
+ </command>
+ </extension>
+
+</plugin>
diff --git a/plugins/infra/org.eclipse.papyrus.infra.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/Activator.java b/plugins/infra/org.eclipse.papyrus.infra.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/Activator.java new file mode 100644 index 00000000000..abc0ae0aaa2 --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/Activator.java @@ -0,0 +1,65 @@ +/*****************************************************************************
+ * Copyright (c) 2013 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:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.modelrepair;
+
+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.uml.modelrepair"; //$NON-NLS-1$
+
+ // 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/plugins/infra/org.eclipse.papyrus.infra.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/handler/ModelRepairHandler.java b/plugins/infra/org.eclipse.papyrus.infra.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/handler/ModelRepairHandler.java new file mode 100644 index 00000000000..3a1ff3924e5 --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/handler/ModelRepairHandler.java @@ -0,0 +1,15 @@ +package org.eclipse.papyrus.uml.modelrepair.handler;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+
+
+public class ModelRepairHandler extends AbstractHandler {
+
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
diff --git a/plugins/infra/org.eclipse.papyrus.infra.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/ui/ModelRepairDialog.java b/plugins/infra/org.eclipse.papyrus.infra.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/ui/ModelRepairDialog.java new file mode 100644 index 00000000000..fb6d25f962e --- /dev/null +++ b/plugins/infra/org.eclipse.papyrus.infra.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/ui/ModelRepairDialog.java @@ -0,0 +1,98 @@ +/*****************************************************************************
+ * Copyright (c) 2013 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:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.modelrepair.ui;
+
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.jface.dialogs.TrayDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+
+
+public class ModelRepairDialog extends TrayDialog {
+
+ private ResourceSet resourceSet;
+
+ public ModelRepairDialog(Shell shell, ResourceSet resourceSet) {
+ super(shell);
+
+ this.resourceSet = resourceSet;
+ }
+
+ @Override
+ protected Control createDialogArea(Composite parent) {
+ Composite contents = (Composite)super.createDialogArea(parent);
+
+ Composite self = new Composite(contents, SWT.BORDER);
+ self.setLayout(new GridLayout(4, true));
+
+ EcoreUtil.resolveAll(resourceSet);
+
+ Map<Resource, Set<URI>> allLinks = allLinks();
+
+ for(Resource resource : allLinks.keySet()) {
+ Label label = new Label(self, SWT.NONE);
+ String displayLabel = String.format("%s (%s)", resource.getURI().lastSegment(), allLinks.get(resource).size()); //$NON-NLS-1$
+
+ label.setText(displayLabel);
+ }
+
+ return contents;
+ }
+
+ protected Map<Resource, Set<URI>> allLinks() {
+ Map<Resource, Set<URI>> result = new HashMap<Resource, Set<URI>>();
+ for(Resource resource : resourceSet.getResources()) {
+
+ Set<URI> allReferencedURIs = new HashSet<URI>();
+ result.put(resource, allReferencedURIs);
+
+ Iterator<EObject> allContents = resource.getAllContents();
+
+ while(allContents.hasNext()) {
+ EObject nextElement = allContents.next();
+ List<EObject> allReferencedEObjects = nextElement.eCrossReferences();
+ for(EObject referencedEObject : allReferencedEObjects) {
+ allReferencedURIs.add(referencedEObject.eResource().getURI());
+ }
+ }
+ }
+
+ return result;
+ }
+
+ @Override
+ protected boolean isResizable() {
+ return true;
+ }
+
+ @Override
+ public boolean isHelpAvailable() {
+ return false;
+ }
+
+}
|