diff options
Diffstat (limited to 'plugins')
7 files changed, 142 insertions, 51 deletions
diff --git a/plugins/infra/ui/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/MultiDiagramPropertySheetPage.java b/plugins/infra/ui/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/MultiDiagramPropertySheetPage.java index e98dc0341e6..e98dc0341e6 100644..100755 --- a/plugins/infra/ui/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/MultiDiagramPropertySheetPage.java +++ b/plugins/infra/ui/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/editor/MultiDiagramPropertySheetPage.java diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/META-INF/MANIFEST.MF b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/META-INF/MANIFEST.MF index 49f24e2765f..12268bce6a0 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/META-INF/MANIFEST.MF +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/META-INF/MANIFEST.MF @@ -92,7 +92,7 @@ Require-Bundle: org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors;bundle org.eclipse.papyrus.infra.gmfdiag.style;bundle-version="[2.0.0,3.0.0)", org.eclipse.papyrus.infra.gmfdiag.representation;bundle-version="[2.0.0,3.0.0)" Bundle-Vendor: %providerName -Bundle-Version: 3.3.100.qualifier +Bundle-Version: 3.3.200.qualifier Eclipse-BuddyPolicy: dependent Bundle-Activator: org.eclipse.papyrus.uml.diagram.common.Activator Bundle-ManifestVersion: 2 diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/plugin.xml index 2aeb3448a6a..f651f3010f8 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/plugin.xml +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/plugin.xml @@ -64,10 +64,10 @@ point="org.eclipse.ui.views.properties.tabbed.propertySections"> <propertySections contributorId="TreeOutlinePage"> <propertySection - afterSection="" - class="org.eclipse.papyrus.uml.diagram.common.sheet.UMLPropertySection" - id="AdvancedProperty" - tab="advanced"> + class="org.eclipse.papyrus.uml.diagram.common.sheet.UMLPropertySection" + filter="org.eclipse.papyrus.uml.diagram.common.internal.sheet.UMLPropertySectionFilter" + id="AdvancedProperty" + tab="advanced"> <input type="java.lang.Object"/> </propertySection> </propertySections> diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/pom.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/pom.xml index cf66c4b3836..e5dc27f122b 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/pom.xml +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/pom.xml @@ -8,6 +8,6 @@ <version>0.0.1-SNAPSHOT</version> </parent> <artifactId>org.eclipse.papyrus.uml.diagram.common</artifactId> - <version>3.3.100-SNAPSHOT</version> + <version>3.3.200-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> </project>
\ No newline at end of file diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/internal/sheet/UMLPropertySectionFilter.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/internal/sheet/UMLPropertySectionFilter.java new file mode 100755 index 00000000000..b7e194ca044 --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/internal/sheet/UMLPropertySectionFilter.java @@ -0,0 +1,49 @@ +/***************************************************************************** + * Copyright (c) 2019 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Vincent LORENZO (CEA LIST) - vincent.lorenzo@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.common.internal.sheet; + +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.jface.viewers.IFilter; +import org.eclipse.uml2.uml.Element; + +/** + * + * This class allow to restraint the the display of the property section to UML Element and GMF Diagram. + * This filter has been added to contribute to the Advanced Property View only for UML and Diagram elements (see bug 546737) + * + * @since 3.3.200 + */ +public class UMLPropertySectionFilter implements IFilter { + + /** + * + * @see org.eclipse.jface.viewers.IFilter#select(java.lang.Object) + * + * @param selected + * @return + */ + @Override + public boolean select(Object selected) { + final Object input = UMLPropertySectionInputUtils.transformSelection(selected); + if (input instanceof Diagram) { + return true; + } + if (input instanceof Element) { + return true; + } + return false; + } + +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/internal/sheet/UMLPropertySectionInputUtils.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/internal/sheet/UMLPropertySectionInputUtils.java new file mode 100755 index 00000000000..20b7e86cc39 --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/internal/sheet/UMLPropertySectionInputUtils.java @@ -0,0 +1,83 @@ +/***************************************************************************** + * Copyright (c) 2019 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Vincent LORENZO (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.common.internal.sheet; + +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.gef.EditPart; +import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.emf.utils.EMFHelper; +import org.eclipse.ui.views.properties.IPropertySource; + +/** + * This class provides a method to convert a selected element into a valid input for the PropertySheet + * + * @since 3.3.200 + * + */ +public class UMLPropertySectionInputUtils { + + + /** + * Modify/unwrap selection. + * + * @param selected + * a selected element + * @return + * a valid object to use for the property sheet + */ + public static final Object transformSelection(final Object selected) { + if (selected == null) { + return null; + } + if (selected instanceof IAdaptable) { + IAdaptable adaptable = (IAdaptable) selected; + + Object adapter = adaptable.getAdapter(IPropertySource.class); + if (adapter != null) { + // This is a terminal transformation + return adapter; + } + adapter = adaptable.getAdapter(EObject.class); + if (adapter != null) { + // This is a terminal transformation + return adapter; + } + adapter = adaptable.getAdapter(View.class); + if (adapter instanceof View) { + // This is an intermediate transformation + return transformSelection(adapter); + } + } + if (selected instanceof EditPart) { + // This is an intermediate transformation + Object model = ((EditPart) selected).getModel(); + return transformSelection(model); + } + if (selected instanceof View) { + // This is a terminal transformation + return ViewUtil.resolveSemanticElement((View) selected); + } + + EObject elem = EMFHelper.getEObject(selected); + if (elem != null) { + return elem; + } + + return selected; + } + +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/sheet/UMLPropertySection.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/sheet/UMLPropertySection.java index de30e40a4c0..2d5c15c6178 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/sheet/UMLPropertySection.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/sheet/UMLPropertySection.java @@ -11,7 +11,7 @@ * Atos Origin - Initial API and implementation * Christian W. Damus (CEA) - bug 386118 * Christian W. Damus - bug 512387 - * + * Vincent LORENZO (CEA ) - bug 546737 *****************************************************************************/ package org.eclipse.papyrus.uml.diagram.common.sheet; @@ -21,18 +21,14 @@ import java.util.Iterator; import org.eclipse.core.runtime.IAdaptable; import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain; import org.eclipse.emf.edit.provider.IItemPropertySource; import org.eclipse.emf.transaction.TransactionalEditingDomain; import org.eclipse.emf.transaction.util.TransactionUtil; -import org.eclipse.gef.EditPart; -import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil; import org.eclipse.gmf.runtime.diagram.ui.properties.sections.AdvancedPropertySection; -import org.eclipse.gmf.runtime.notation.View; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.papyrus.infra.emf.utils.EMFHelper; +import org.eclipse.papyrus.uml.diagram.common.internal.sheet.UMLPropertySectionInputUtils; import org.eclipse.ui.IWorkbenchPart; import org.eclipse.ui.views.properties.IPropertySource; import org.eclipse.ui.views.properties.IPropertySourceProvider; @@ -63,7 +59,7 @@ public class UMLPropertySection extends AdvancedPropertySection implements IProp /* * (non-Javadoc) * - * @seeorg.eclipse.gmf.runtime.diagram.ui.properties.sections. + * @see org.eclipse.gmf.runtime.diagram.ui.properties.sections. * AdvancedPropertySection# getPropertySourceProvider() */ @Override @@ -76,44 +72,7 @@ public class UMLPropertySection extends AdvancedPropertySection implements IProp * */ protected Object transformSelection(Object selected) { - if (selected == null) { - return null; - } - if (selected instanceof IAdaptable) { - IAdaptable adaptable = (IAdaptable) selected; - - Object adapter = adaptable.getAdapter(IPropertySource.class); - if (adapter != null) { - // This is a terminal transformation - return adapter; - } - adapter = adaptable.getAdapter(EObject.class); - if (adapter != null) { - // This is a terminal transformation - return adapter; - } - adapter = adaptable.getAdapter(View.class); - if (adapter instanceof View) { - // This is an intermediate transformation - return transformSelection(adapter); - } - } - if (selected instanceof EditPart) { - // This is an intermediate transformation - Object model = ((EditPart) selected).getModel(); - return transformSelection(model); - } - if (selected instanceof View) { - // This is a terminal transformation - return ViewUtil.resolveSemanticElement((View) selected); - } - - EObject elem = EMFHelper.getEObject(selected); - if (elem != null) { - return elem; - } - - return selected; + return UMLPropertySectionInputUtils.transformSelection(selected); } @Override |