Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaged Elaasar2018-03-16 20:06:14 -0400
committerptessier2018-04-19 16:55:57 -0400
commit371756cd59fe03ac08e079a6a98b2b332da6ff92 (patch)
treec50ab6ebf82acaeaf37f372acba864a49a876a04 /plugins/infra/ui
parent9795d6a6d23ed40a5fe31b89c6868e9c407a5edb (diff)
downloadorg.eclipse.papyrus-371756cd59fe03ac08e079a6a98b2b332da6ff92.tar.gz
org.eclipse.papyrus-371756cd59fe03ac08e079a6a98b2b332da6ff92.tar.xz
org.eclipse.papyrus-371756cd59fe03ac08e079a6a98b2b332da6ff92.zip
Bug 527664 - [AFViewpoints] Architecture Model Editor remove
CreationCommandClass property value Converted the Creation/ConversionCommandClass properties in the architecture editor to be of type string instead of Class. They can now reference class names from the workspace (on their project's class path). Also added validation rules for that. Finally, I added a Browse... button in the property sheet to help put values for them. remove some reexport increase version to take in account API tool Change-Id: I6792449fbee70b089f83780c4935242fff72d50b Signed-off-by: Maged Elaasar <melaasar@gmail.com>
Diffstat (limited to 'plugins/infra/ui')
-rw-r--r--plugins/infra/ui/org.eclipse.papyrus.infra.ui.architecture/META-INF/MANIFEST.MF21
-rw-r--r--plugins/infra/ui/org.eclipse.papyrus.infra.ui.architecture/pom.xml2
-rw-r--r--plugins/infra/ui/org.eclipse.papyrus.infra.ui.architecture/src/org/eclipse/papyrus/infra/ui/architecture/editor/ArchitectureEditor.java4
-rw-r--r--plugins/infra/ui/org.eclipse.papyrus.infra.ui.architecture/src/org/eclipse/papyrus/infra/ui/architecture/editor/CustomAdapterFactoryContentProvider.java154
-rw-r--r--plugins/infra/ui/org.eclipse.papyrus.infra.ui/META-INF/MANIFEST.MF3
5 files changed, 171 insertions, 13 deletions
diff --git a/plugins/infra/ui/org.eclipse.papyrus.infra.ui.architecture/META-INF/MANIFEST.MF b/plugins/infra/ui/org.eclipse.papyrus.infra.ui.architecture/META-INF/MANIFEST.MF
index 75850bc24c6..4d552874ae8 100644
--- a/plugins/infra/ui/org.eclipse.papyrus.infra.ui.architecture/META-INF/MANIFEST.MF
+++ b/plugins/infra/ui/org.eclipse.papyrus.infra.ui.architecture/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.papyrus.infra.ui.architecture;singleton:=true
-Bundle-Version: 1.0.100.qualifier
+Bundle-Version: 2.0.0.qualifier
Bundle-ClassPath: .
Bundle-Activator: org.eclipse.papyrus.infra.ui.architecture.ArchitectureUIPlugin$Implementation
Bundle-Vendor: %providerName
@@ -10,17 +10,20 @@ Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Export-Package: org.eclipse.papyrus.infra.ui.architecture,
org.eclipse.papyrus.infra.ui.architecture.widgets
-Require-Bundle: org.eclipse.core.runtime,
- org.eclipse.core.resources;visibility:=reexport,
- org.eclipse.emf.ecore.xmi;visibility:=reexport,
- org.eclipse.emf.edit.ui;visibility:=reexport,
- org.eclipse.ui.ide;visibility:=reexport,
- org.eclipse.papyrus.infra.types.edit;visibility:=reexport;bundle-version="[3.0.0,4.0.0)",
+Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.0.0,4.0.0)",
+ org.eclipse.core.resources;bundle-version="[3.0.0,4.0.0)",
+ org.eclipse.emf.ecore.xmi;bundle-version="[2.0.0,3.0.0)",
+ org.eclipse.emf.edit.ui;bundle-version="[2.0.0,3.0.0)",
+ org.eclipse.ui.ide;bundle-version="[3.0.0,4.0.0)",
+ org.eclipse.papyrus.infra.types.edit;bundle-version="[3.0.0,4.0.0)",
org.eclipse.papyrus.infra.architecture;bundle-version="[1.0.0,2.0.0)",
- org.eclipse.papyrus.infra.core.architecture.edit;visibility:=reexport;bundle-version="[1.0.0,2.0.0)",
+ org.eclipse.papyrus.infra.core.architecture.edit;bundle-version="[1.0.0,3.0.0)",
org.eclipse.papyrus.infra.architecture.representation.edit;bundle-version="[1.0.0,2.0.0)",
org.eclipse.papyrus.infra.emf;bundle-version="[3.0.0,4.0.0)",
org.eclipse.papyrus.infra.ui;bundle-version="[2.0.0,3.0.0)",
org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="[3.0.0,4.0.0)",
- org.eclipse.papyrus.infra.nattable.common;bundle-version="[5.0.0,6.0.0)"
+ org.eclipse.papyrus.infra.nattable.common;bundle-version="[5.0.0,6.0.0)",
+ org.eclipse.jdt.core;bundle-version="[3.0.0,4.0.0)",
+ org.eclipse.jdt.ui;bundle-version="[3.0.0,4.0.0)",
+ org.eclipse.papyrus.infra.viewpoints.policy;bundle-version="[3.0.0,4.0.0)"
Bundle-ActivationPolicy: lazy
diff --git a/plugins/infra/ui/org.eclipse.papyrus.infra.ui.architecture/pom.xml b/plugins/infra/ui/org.eclipse.papyrus.infra.ui.architecture/pom.xml
index 32eacb4deec..41a3a0ce2ea 100644
--- a/plugins/infra/ui/org.eclipse.papyrus.infra.ui.architecture/pom.xml
+++ b/plugins/infra/ui/org.eclipse.papyrus.infra.ui.architecture/pom.xml
@@ -8,6 +8,6 @@
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.papyrus.infra.ui.architecture</artifactId>
- <version>1.0.100-SNAPSHOT</version>
+ <version>2.0.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/plugins/infra/ui/org.eclipse.papyrus.infra.ui.architecture/src/org/eclipse/papyrus/infra/ui/architecture/editor/ArchitectureEditor.java b/plugins/infra/ui/org.eclipse.papyrus.infra.ui.architecture/src/org/eclipse/papyrus/infra/ui/architecture/editor/ArchitectureEditor.java
index 48bbd71b8b7..5619788896a 100644
--- a/plugins/infra/ui/org.eclipse.papyrus.infra.ui.architecture/src/org/eclipse/papyrus/infra/ui/architecture/editor/ArchitectureEditor.java
+++ b/plugins/infra/ui/org.eclipse.papyrus.infra.ui.architecture/src/org/eclipse/papyrus/infra/ui/architecture/editor/ArchitectureEditor.java
@@ -95,8 +95,8 @@ import org.eclipse.jface.viewers.TableLayout;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.papyrus.infra.core.architecture.provider.ArchitectureItemProviderAdapterFactory;
import org.eclipse.papyrus.infra.architecture.representation.provider.RepresentationItemProviderAdapterFactory;
+import org.eclipse.papyrus.infra.core.architecture.provider.ArchitectureItemProviderAdapterFactory;
import org.eclipse.papyrus.infra.types.provider.ElementTypesConfigurationsItemProviderAdapterFactory;
import org.eclipse.papyrus.infra.ui.architecture.ArchitectureUIPlugin;
import org.eclipse.swt.SWT;
@@ -1210,7 +1210,7 @@ public class ArchitectureEditor
getActionBarContributor().shareGlobalActions(this, actionBars);
}
};
- propertySheetPage.setPropertySourceProvider(new AdapterFactoryContentProvider(adapterFactory));
+ propertySheetPage.setPropertySourceProvider(new CustomAdapterFactoryContentProvider(adapterFactory));
propertySheetPages.add(propertySheetPage);
return propertySheetPage;
diff --git a/plugins/infra/ui/org.eclipse.papyrus.infra.ui.architecture/src/org/eclipse/papyrus/infra/ui/architecture/editor/CustomAdapterFactoryContentProvider.java b/plugins/infra/ui/org.eclipse.papyrus.infra.ui.architecture/src/org/eclipse/papyrus/infra/ui/architecture/editor/CustomAdapterFactoryContentProvider.java
new file mode 100644
index 00000000000..380d9268f5d
--- /dev/null
+++ b/plugins/infra/ui/org.eclipse.papyrus.infra.ui.architecture/src/org/eclipse/papyrus/infra/ui/architecture/editor/CustomAdapterFactoryContentProvider.java
@@ -0,0 +1,154 @@
+/*****************************************************************************
+ * Copyright (c) 2018 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.infra.ui.architecture.editor;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;
+import org.eclipse.emf.edit.ui.provider.PropertyDescriptor;
+import org.eclipse.emf.edit.ui.provider.PropertySource;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.search.IJavaSearchScope;
+import org.eclipse.jdt.core.search.SearchEngine;
+import org.eclipse.jdt.ui.IJavaElementSearchConstants;
+import org.eclipse.jdt.ui.JavaUI;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.jface.viewers.DialogCellEditor;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.infra.gmfdiag.common.Activator;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.dialogs.SelectionDialog;
+import org.eclipse.ui.views.properties.IPropertyDescriptor;
+import org.eclipse.ui.views.properties.IPropertySource;
+
+/**
+ * @author melaasar
+ *
+ */
+public class CustomAdapterFactoryContentProvider extends AdapterFactoryContentProvider {
+
+ /**
+ * @param adapterFactory
+ */
+ public CustomAdapterFactoryContentProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * @see org.eclipse.ui.views.properties.IPropertySourceProvider#getPropertySource(java.lang.Object)
+ *
+ * @param object
+ * @return
+ */
+ @Override
+ protected IPropertySource createPropertySource(Object object,
+ IItemPropertySource itemPropertySource) {
+ return new CustomPropertySource(object, itemPropertySource);
+ }
+
+ /**
+ * A custom property source
+ */
+ private class CustomPropertySource extends PropertySource {
+ /**
+ * Constructor.
+ *
+ * @param object
+ * @param itemPropertySource
+ */
+ public CustomPropertySource(Object object, IItemPropertySource itemPropertySource) {
+ super(object, itemPropertySource);
+ }
+
+ /*
+ * @see
+ * PropertySource#createPropertyDescriptor(org.eclipse.emf.edit .provider.IItemPropertyDescriptor)
+ */
+ protected IPropertyDescriptor createPropertyDescriptor(IItemPropertyDescriptor itemPropertyDescriptor) {
+ return new CustomPropertyDescriptor(object, itemPropertyDescriptor);
+ }
+ }
+
+ private class CustomPropertyDescriptor extends PropertyDescriptor {
+
+ /**
+ * @param object
+ * @param itemPropertyDescriptor
+ */
+ public CustomPropertyDescriptor(Object object, IItemPropertyDescriptor itemPropertyDescriptor) {
+ super(object, itemPropertyDescriptor);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ui.views.properties.IPropertyDescriptor#createPr opertyEditor(org.eclipse.swt.widgets.Composite)
+ */
+ public CellEditor createPropertyEditor(Composite composite) {
+ final EObject eObject = (EObject) object;
+ final EStructuralFeature feature = (EStructuralFeature) itemPropertyDescriptor.getFeature(eObject);
+ if (feature.getName().endsWith("Class") || feature.getName().endsWith("class")) {
+ CellEditor cellEditor = new DialogCellEditor(composite) {
+ @Override
+ protected Object openDialogBox(Control cellEditorWindow) {
+ return selectTypeDialog(cellEditorWindow, eObject, feature);
+ }
+ };
+ return cellEditor;
+ }
+ return super.createPropertyEditor(composite);
+ }
+ }
+
+ public String selectTypeDialog(Control cellEditorWindow, EObject eObject, EStructuralFeature feature) {
+ URI uri = eObject.eResource().getURI();
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ IFile file = workspace.getRoot().getFile(new Path(uri.toPlatformString(false)));
+ IProject project = file.getProject();
+ IJavaProject[] javaProject = new IJavaProject[] {JavaCore.create(project)};
+ IJavaSearchScope searchScope = SearchEngine.createJavaSearchScope(javaProject);
+
+ int scope = IJavaElementSearchConstants.CONSIDER_CLASSES;
+ String filter = (String) eObject.eGet(feature);
+ if (filter == null || filter.length() == 0)
+ filter = "**"; //$NON-NLS-1$
+
+ try {
+ SelectionDialog dialog = JavaUI.createTypeDialog(cellEditorWindow.getShell(), PlatformUI.getWorkbench().getProgressService(), searchScope, scope, false, filter);
+ dialog.setTitle("Select Class");
+ if (dialog.open() == Window.OK) {
+ IType type = (IType) dialog.getResult()[0];
+ return type.getFullyQualifiedName('$');
+ }
+ } catch (JavaModelException e) {
+ Activator.log.error(e);
+ }
+ return null;
+ }
+}
diff --git a/plugins/infra/ui/org.eclipse.papyrus.infra.ui/META-INF/MANIFEST.MF b/plugins/infra/ui/org.eclipse.papyrus.infra.ui/META-INF/MANIFEST.MF
index 98931c2c119..cb7dc37fa01 100644
--- a/plugins/infra/ui/org.eclipse.papyrus.infra.ui/META-INF/MANIFEST.MF
+++ b/plugins/infra/ui/org.eclipse.papyrus.infra.ui/META-INF/MANIFEST.MF
@@ -34,7 +34,8 @@ Require-Bundle: org.eclipse.papyrus.infra.core;bundle-version="[3.0.0,4.0.0)";vi
org.eclipse.ui.views;bundle-version="[3.8.0,4.0.0)";visibility:=reexport,
org.eclipse.papyrus.infra.emf;bundle-version="[3.0.0,4.0.0)",
org.eclipse.papyrus.infra.widgets.toolbox;bundle-version="[2.0.0,3.0.0)",
- org.eclipse.papyrus.infra.tools;bundle-version="[3.0.0,4.0.0)"
+ org.eclipse.papyrus.infra.tools;bundle-version="[3.0.0,4.0.0)",
+ org.eclipse.papyrus.infra.core.architecture;bundle-version="[2.0.0,3.0.0)"
Bundle-Vendor: %providerName
Bundle-Version: 2.0.0.qualifier
Eclipse-BuddyPolicy: dependent

Back to the top