Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Cicognani2015-07-07 12:44:46 +0000
committerThomas Cicognani2015-08-14 09:42:30 +0000
commita9b82e41a1a8f9bbbe24ecb3cc3590b05d80bf60 (patch)
tree60d5d85582812edf395d87c341475ff25a67c2a0
parenta56815391bc372080aa060b9d9a8d217fb2cbcf4 (diff)
downloadorg.eclipse.modisco-a9b82e41a1a8f9bbbe24ecb3cc3590b05d80bf60.tar.gz
org.eclipse.modisco-a9b82e41a1a8f9bbbe24ecb3cc3590b05d80bf60.tar.xz
org.eclipse.modisco-a9b82e41a1a8f9bbbe24ecb3cc3590b05d80bf60.zip
Bug 470962 - Add shortcuts to activate customs.
New shortcuts with the new EMF Facet API. Change-Id: I6182c67a62ae8a56305b8f29ffb3340286941c4f Signed-off-by: Thomas Cicognani <tcicognani@sodifrance.fr>
-rw-r--r--org.eclipse.modisco.archi.tech.targetplatform/org.eclipse.modisco.archi.tech.targetplatform.target6
-rw-r--r--org.eclipse.modisco.infra.browser.ecore.core/custom/hideDerivedReferences.custom25
-rw-r--r--org.eclipse.modisco.infra.browser.ecore.core/custom/hideEmptyReferences.custom35
-rw-r--r--org.eclipse.modisco.infra.browser.ecore.core/custom/linksCount.custom15
-rw-r--r--org.eclipse.modisco.infra.browser.ecore.core/plugin.xml6
-rw-r--r--org.eclipse.modisco.infra.browser.ecore.core/src/org/eclipse/modisco/infra/browser/ecore/core/internal/hidederviedreferences/IsVisibleQuery.java61
-rw-r--r--org.eclipse.modisco.infra.browser.ecore.core/src/org/eclipse/modisco/infra/browser/ecore/core/internal/hideemptyreferences/IsEmptyQuery.java70
-rw-r--r--org.eclipse.modisco.infra.browser.ecore.core/src/org/eclipse/modisco/infra/browser/ecore/core/internal/linkscount/LinksCountQuery.java66
-rw-r--r--org.eclipse.modisco.infra.browser.ecore.ui/META-INF/MANIFEST.MF5
-rw-r--r--org.eclipse.modisco.infra.browser.ecore.ui/OSGI-INF/l10n/bundle.properties3
-rw-r--r--org.eclipse.modisco.infra.browser.ecore.ui/custom/nbInstancesEClassByResource.custom15
-rw-r--r--org.eclipse.modisco.infra.browser.ecore.ui/plugin.xml25
-rw-r--r--org.eclipse.modisco.infra.browser.ecore.ui/src/org/eclipse/modisco/infra/browser/ecore/ui/internal/Messages.java8
-rw-r--r--org.eclipse.modisco.infra.browser.ecore.ui/src/org/eclipse/modisco/infra/browser/ecore/ui/internal/handler/LoadCustomShortcutsMenu.java24
-rw-r--r--org.eclipse.modisco.infra.browser.ecore.ui/src/org/eclipse/modisco/infra/browser/ecore/ui/internal/handler/LoadFacetSetShortcutsMenu.java24
-rw-r--r--org.eclipse.modisco.infra.browser.ecore.ui/src/org/eclipse/modisco/infra/browser/ecore/ui/internal/messages.properties8
-rw-r--r--org.eclipse.modisco.infra.browser.ecore.ui/src/org/eclipse/modisco/infra/browser/ecore/ui/internal/widget/EcoreExplorerShortcutUtils.java147
-rw-r--r--org.eclipse.modisco.infra.browser.ecore.ui/src/org/eclipse/modisco/infra/browser/ecore/ui/internal/widget/EcoreExplorerWidgetComposite.java33
-rw-r--r--org.eclipse.modisco.infra.browser.editor.ui/META-INF/MANIFEST.MF3
-rw-r--r--org.eclipse.modisco.infra.browser.editor.ui/OSGI-INF/l10n/bundle.properties14
-rw-r--r--org.eclipse.modisco.infra.browser.editor.ui/plugin.xml142
-rw-r--r--org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/Messages.java4
-rw-r--r--org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/editor/TreeEditor.java23
-rw-r--r--org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/editor/TreeEditorShortcutUtils.java124
-rw-r--r--org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/handlers/AbstractFacetSetActivatorHandler.java90
-rw-r--r--org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/handlers/AbstractFacetSetActivatorToggleState.java122
-rw-r--r--org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/handlers/EContainerHandler.java24
-rw-r--r--org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/handlers/EContainerToggleState.java21
-rw-r--r--org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/handlers/HideDerivedReferencesHandler.java25
-rw-r--r--org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/handlers/HideDerivedReferencesToggleState.java22
-rw-r--r--org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/handlers/HideEmptyReferencesHandler.java25
-rw-r--r--org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/handlers/HideEmptyReferencesToggleState.java22
-rw-r--r--org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/handlers/HierarchicalEClassCustomHandler.java25
-rw-r--r--org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/handlers/HierarchicalEClassCustomToggleState.java22
-rw-r--r--org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/handlers/HierarchicalEClassFacetHandler.java25
-rw-r--r--org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/handlers/HierarchicalEClassFacetToggleState.java22
-rw-r--r--org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/handlers/LinksCountHandler.java25
-rw-r--r--org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/handlers/LinksCountState.java22
-rw-r--r--org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/handlers/LoadCustomShortcutsMenu.java24
-rw-r--r--org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/handlers/LoadFacetSetShortcutsMenu.java25
-rw-r--r--org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/messages.properties4
41 files changed, 509 insertions, 922 deletions
diff --git a/org.eclipse.modisco.archi.tech.targetplatform/org.eclipse.modisco.archi.tech.targetplatform.target b/org.eclipse.modisco.archi.tech.targetplatform/org.eclipse.modisco.archi.tech.targetplatform.target
index 68a53adcc..dfa892a59 100644
--- a/org.eclipse.modisco.archi.tech.targetplatform/org.eclipse.modisco.archi.tech.targetplatform.target
+++ b/org.eclipse.modisco.archi.tech.targetplatform/org.eclipse.modisco.archi.tech.targetplatform.target
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?pde version="3.6"?>
-<target name="org.eclipse.modisco.archi.tech.targetplatform" sequenceNumber="10">
+<target name="org.eclipse.modisco.archi.tech.targetplatform" sequenceNumber="11">
<locations>
<location includeAllPlatforms="false" includeMode="planner" includeSource="true" type="InstallableUnit">
<unit id="org.eclipse.m2m.atl.feature.group" version="3.1.0.v201006150240"/>
@@ -26,8 +26,8 @@
<repository location="http://download.eclipse.org/technology/epp/packages/helios/"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
-<unit id="org.eclipse.emf.facet.sdk.feature.feature.group" version="1.1.0.201507100802"/>
-<unit id="org.eclipse.emf.facet.util.tests.feature.feature.group" version="1.1.0.201507100802"/>
+<unit id="org.eclipse.emf.facet.sdk.feature.feature.group" version="1.1.0.201508071644"/>
+<unit id="org.eclipse.emf.facet.util.tests.feature.feature.group" version="1.1.0.201508071644"/>
<repository location="http://download.eclipse.org/facet/updates/integration/"/>
</location>
<location includeAllPlatforms="false" includeMode="planner" includeSource="true" type="InstallableUnit">
diff --git a/org.eclipse.modisco.infra.browser.ecore.core/custom/hideDerivedReferences.custom b/org.eclipse.modisco.infra.browser.ecore.core/custom/hideDerivedReferences.custom
deleted file mode 100644
index d8c4b38a4..000000000
--- a/org.eclipse.modisco.infra.browser.ecore.core/custom/hideDerivedReferences.custom
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="ASCII"?>
-<custom:Customization
- xmi:version="2.0"
- xmlns:xmi="http://www.omg.org/XMI"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:custom="http://www.eclipse.org/emf/facet/custom/0.2.incubation/custom"
- xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
- xmlns:efacet="http://www.eclipse.org/emf/facet/efacet/0.2.incubation/efacet"
- xmlns:javaQuery="http://www.eclipse.org/emf/facet/query/java/0.2.incubation/javaquery"
- name="org.eclipse.modisco.infra.browser.ecore.core.hideDerivedReferences"
- nsURI="http://www.eclipse.org/MoDisco/infra/browser/ecore/0.13.0.incubation/hideDerviedReferences/"
- nsPrefix="hideDerviedReferences">
- <eClassifiers xsi:type="custom:EClassCustomization" name="EReference null">
- <extendedMetaclass href="http://www.eclipse.org/emf/2002/Ecore#//EObject"/>
- <facetOperations name="isVisible">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
- <eParameters name="eStructuralFeature">
- <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/emf/2002/Ecore#//ETypedElement"/>
- </eParameters>
- <query xsi:type="javaQuery:JavaQuery" implementationClassName="org.eclipse.modisco.infra.browser.ecore.core.internal.hidederviedreferences.IsVisibleQuery"/>
- <override xsi:type="efacet:FacetOperation" href="../../../plugin/org.eclipse.emf.facet.custom.ui/resources/customproperties.efacet#//CustomizedEObject/isVisible"/>
- </facetOperations>
- <extendedFacets href="../../../plugin/org.eclipse.emf.facet.custom.ui/resources/customproperties.efacet#//CustomizedEObject"/>
- </eClassifiers>
-</custom:Customization>
diff --git a/org.eclipse.modisco.infra.browser.ecore.core/custom/hideEmptyReferences.custom b/org.eclipse.modisco.infra.browser.ecore.core/custom/hideEmptyReferences.custom
deleted file mode 100644
index 96c5a2c59..000000000
--- a/org.eclipse.modisco.infra.browser.ecore.core/custom/hideEmptyReferences.custom
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="ASCII"?><!--
-Copyright (c) 2015 Soft-Maint.
-
-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:
- Thomas Cicognani (Soft-Maint) - Bug 442041 - A customization hiding empty references
--->
-<custom:Customization
- xmi:version="2.0"
- xmlns:xmi="http://www.omg.org/XMI"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:custom="http://www.eclipse.org/emf/facet/custom/0.2.incubation/custom"
- xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
- xmlns:efacet="http://www.eclipse.org/emf/facet/efacet/0.2.incubation/efacet"
- xmlns:javaQuery="http://www.eclipse.org/emf/facet/query/java/0.2.incubation/javaquery"
- name="org.eclipse.modisco.infra.browser.ecore.core.hideEmptyReferences"
- nsURI="http://www.eclipse.org/MoDisco/infra/browser/ecore/0.13.0.incubation/hideEmptyReferences/"
- nsPrefix="hideEmptyReferences">
- <eClassifiers xsi:type="custom:EClassCustomization" name="EReference null">
- <extendedMetaclass href="http://www.eclipse.org/emf/2002/Ecore#//EObject"/>
- <facetOperations name="isVisible">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
- <eParameters name="eStructuralFeature">
- <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/emf/2002/Ecore#//ETypedElement"/>
- </eParameters>
- <query xsi:type="javaQuery:JavaQuery" implementationClassName="org.eclipse.modisco.infra.browser.ecore.core.internal.hideemptyreferences.IsEmptyQuery"/>
- <override xsi:type="efacet:FacetOperation" href="../../../plugin/org.eclipse.emf.facet.custom.ui/resources/customproperties.efacet#//CustomizedEObject/isVisible"/>
- </facetOperations>
- <extendedFacets href="../../../plugin/org.eclipse.emf.facet.custom.ui/resources/customproperties.efacet#//CustomizedEObject"/>
- </eClassifiers>
-</custom:Customization>
diff --git a/org.eclipse.modisco.infra.browser.ecore.core/custom/linksCount.custom b/org.eclipse.modisco.infra.browser.ecore.core/custom/linksCount.custom
deleted file mode 100644
index 0e4decd75..000000000
--- a/org.eclipse.modisco.infra.browser.ecore.core/custom/linksCount.custom
+++ /dev/null
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="ASCII"?>
-<custom:Customization xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:custom="http://www.eclipse.org/emf/facet/custom/0.2.incubation/custom" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:efacet="http://www.eclipse.org/emf/facet/efacet/0.2.incubation/efacet" xmlns:javaQuery="http://www.eclipse.org/emf/facet/query/java/0.2.incubation/javaquery" name="org.eclipse.modisco.infra.browser.ecore.core.linksCount" nsURI="http://www.eclipse.org/MoDisco/infra/browser/ecore/0.13.0.incubation/linksCount" nsPrefix="linksCount">
- <eClassifiers xsi:type="custom:EClassCustomization" name="EObject null">
- <extendedMetaclass href="http://www.eclipse.org/emf/2002/Ecore#//EObject"/>
- <facetOperations name="label" lowerBound="1">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- <eParameters name="eStructuralFeature">
- <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/emf/2002/Ecore#//ETypedElement"/>
- </eParameters>
- <query xsi:type="javaQuery:JavaQuery" implementationClassName="org.eclipse.modisco.infra.browser.ecore.core.internal.linkscount.LinksCountQuery"/>
- <override xsi:type="efacet:FacetOperation" href="../../../plugin/org.eclipse.emf.facet.custom.ui/resources/customproperties.efacet#//CustomizedEObject/label"/>
- </facetOperations>
- <extendedFacets href="../../../plugin/org.eclipse.emf.facet.custom.ui/resources/customproperties.efacet#//CustomizedEObject"/>
- </eClassifiers>
-</custom:Customization>
diff --git a/org.eclipse.modisco.infra.browser.ecore.core/plugin.xml b/org.eclipse.modisco.infra.browser.ecore.core/plugin.xml
index ef1a14771..56ef0152a 100644
--- a/org.eclipse.modisco.infra.browser.ecore.core/plugin.xml
+++ b/org.eclipse.modisco.infra.browser.ecore.core/plugin.xml
@@ -11,14 +11,12 @@ Contributors:
Gregoire Dupe (Mia-Software) - Bug 358914 - [Move to EMF Facet][Browser] Switch to EMF Facet
Thomas Cicognani (Soft-Maint) - Bug 442041 - A customization hiding empty references
Thomas Cicognani (Soft-Maint) - Bug 471447 - [New Browser] Add a customization counting instances by EClass
- Thomas Cicognani (Soft-Maint) - Bug 471597 - [New Browser] Add a customization to display subclasses from an EClass
+ Thomas Cicognani (Soft-Maint) - Bug 471597 - [New Browser] Add a customization to display subclasses from an EClass
+ Thomas Cicognani (Mia-Software) - Bug 470962 - Add shortcuts to activate customs
-->
<plugin>
<extension point="org.eclipse.emf.facet.util.emf.core.modeldeclaration">
- <modeldeclaration file="custom/hideDerivedReferences.custom"/>
<modeldeclaration file="custom/ePackageContainsEClass.custom"/>
- <modeldeclaration file="custom/linksCount.custom"/>
- <modeldeclaration file="custom/hideEmptyReferences.custom"/>
<modeldeclaration file="custom/hierarchicalEClass.custom"/>
<modeldeclaration file="facet/hierarchicalEClass.efacet" />
</extension>
diff --git a/org.eclipse.modisco.infra.browser.ecore.core/src/org/eclipse/modisco/infra/browser/ecore/core/internal/hidederviedreferences/IsVisibleQuery.java b/org.eclipse.modisco.infra.browser.ecore.core/src/org/eclipse/modisco/infra/browser/ecore/core/internal/hidederviedreferences/IsVisibleQuery.java
deleted file mode 100644
index f14477d6b..000000000
--- a/org.eclipse.modisco.infra.browser.ecore.core/src/org/eclipse/modisco/infra/browser/ecore/core/internal/hidederviedreferences/IsVisibleQuery.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/**
- * Copyright (c) 2014, 2015 Mia-Software, and Soft-Maint.
- * 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:
- * Gregoire Dupe (Mia-Software) - Bug 358914 - [Move to EMF Facet][Browser] Switch to EMF Facet
- * Thomas Cicognani (Soft-Maint) - Bug 470903 - The custom HideDerivedReferences doesn't use the super method
- * Thomas Cicognani (Soft-Maint) - Bug 470988 - Imports cleaning in IsVisibleQuery class
- */
-package org.eclipse.modisco.infra.browser.ecore.core.internal.hidederviedreferences;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.facet.efacet.core.IFacetManager;
-import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException;
-import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement;
-import org.eclipse.emf.facet.query.java.core.IJavaQuery3;
-import org.eclipse.emf.facet.query.java.core.IParameterValueList2;
-
-public class IsVisibleQuery implements IJavaQuery3<EObject, Boolean> {
- public Boolean evaluate(final EObject source,
- final IParameterValueList2 parameterValues,
- final IFacetManager facetManager, final DerivedTypedElement feature)
- throws DerivedTypedElementException {
- boolean result = false;
- if (parameterValues.size() == 0) {
- throw new DerivedTypedElementException(
- "parameterValues must not be empty"); //$NON-NLS-1$
- }
-
- final Object paramValue = parameterValues.get(0).getValue();
- if (paramValue instanceof EStructuralFeature) {
- final EStructuralFeature eStructFeature = (EStructuralFeature) paramValue;
- result = !eStructFeature.isDerived();
- } else if (paramValue == null) {
- result = true;
- } else {
- final String message = String
- .format("Unexpected parameter type (%s instead of EStructuralFeature)", //$NON-NLS-1$
- paramValue.getClass().getName());
- throw new DerivedTypedElementException(message);
- }
-
- try {
- /*
- * The object is visible if this custom says it is AND if the
- * previous/super customs say it is
- */
- result = result
- && facetManager.getSuperValueOf(feature, source,
- parameterValues, Boolean.class).booleanValue();
- } catch (Exception e) {
- throw new DerivedTypedElementException(e);
- }
-
- return Boolean.valueOf(result);
- }
-}
diff --git a/org.eclipse.modisco.infra.browser.ecore.core/src/org/eclipse/modisco/infra/browser/ecore/core/internal/hideemptyreferences/IsEmptyQuery.java b/org.eclipse.modisco.infra.browser.ecore.core/src/org/eclipse/modisco/infra/browser/ecore/core/internal/hideemptyreferences/IsEmptyQuery.java
deleted file mode 100644
index 9aef8c120..000000000
--- a/org.eclipse.modisco.infra.browser.ecore.core/src/org/eclipse/modisco/infra/browser/ecore/core/internal/hideemptyreferences/IsEmptyQuery.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/**
- * Copyright (c) 2015 Soft-Maint.
- * 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:
- * Thomas Cicognani (Soft-Maint) - Bug 442041 - A customization hiding empty references
- * Grégoire Dupé (Mia-Software) - Bug 442041 - A customization hiding empty references
- */
-package org.eclipse.modisco.infra.browser.ecore.core.internal.hideemptyreferences;
-
-import java.util.Collection;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EReference;
-import org.eclipse.emf.ecore.ETypedElement;
-import org.eclipse.emf.facet.efacet.core.IFacetManager;
-import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException;
-import org.eclipse.emf.facet.efacet.core.exception.FacetManagerException;
-import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement;
-import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue;
-import org.eclipse.emf.facet.query.java.core.IJavaQuery3;
-import org.eclipse.emf.facet.query.java.core.IParameterValueList2;
-
-public class IsEmptyQuery implements IJavaQuery3<EObject, Boolean> {
- public Boolean evaluate(final EObject source,
- final IParameterValueList2 parameterValues,
- final IFacetManager facetManager, final DerivedTypedElement feature)
- throws DerivedTypedElementException {
- try {
- boolean isVisible = true;
- if (parameterValues != null) {
- final ParameterValue eTypedElement = parameterValues
- .getParameterValueByName("eStructuralFeature"); //$NON-NLS-1$
- final ETypedElement sfParam = (ETypedElement) eTypedElement
- .getValue();
- if (sfParam instanceof EReference) {
- final int size = getSizeForReference(source, facetManager,
- sfParam);
- isVisible = (size > 0);
- }
- }
- if (isVisible) {
- final Boolean superValueOf = facetManager.getSuperValueOf(
- feature, source, parameterValues, Boolean.class);
- isVisible = superValueOf.booleanValue();
- }
- return Boolean.valueOf(isVisible);
- } catch (Exception e) {
- throw new DerivedTypedElementException(e);
- }
- }
-
- private static int getSizeForReference(final EObject source,
- final IFacetManager facetManager, final ETypedElement sfParam)
- throws FacetManagerException {
- int size = 0;
- final Object object = facetManager.getOrInvoke(source, sfParam,
- Object.class);
- if (object instanceof Collection) {
- final Collection<?> collection = (Collection<?>) object;
- size = collection.size();
- } else if (object != null) {
- size = 1;
- }
- return size;
- }
-}
diff --git a/org.eclipse.modisco.infra.browser.ecore.core/src/org/eclipse/modisco/infra/browser/ecore/core/internal/linkscount/LinksCountQuery.java b/org.eclipse.modisco.infra.browser.ecore.core/src/org/eclipse/modisco/infra/browser/ecore/core/internal/linkscount/LinksCountQuery.java
deleted file mode 100644
index 66a3ded1c..000000000
--- a/org.eclipse.modisco.infra.browser.ecore.core/src/org/eclipse/modisco/infra/browser/ecore/core/internal/linkscount/LinksCountQuery.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/**
- * Copyright (c) 2014, 2015 Soft-Maint.
- * 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:
- * Thomas Cicognani (Soft-Maint) - Bug 442017 - A customization counting elements by reference
- * Thomas Cicognani (Soft-Maint) - Bug 471000 - Reactivate the customization which counts elements by reference
- */
-package org.eclipse.modisco.infra.browser.ecore.core.internal.linkscount;
-
-import java.util.Collection;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EReference;
-import org.eclipse.emf.ecore.ETypedElement;
-import org.eclipse.emf.facet.efacet.core.IFacetManager;
-import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException;
-import org.eclipse.emf.facet.efacet.core.exception.FacetManagerException;
-import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement;
-import org.eclipse.emf.facet.query.java.core.IJavaQuery3;
-import org.eclipse.emf.facet.query.java.core.IParameterValueList2;
-
-public class LinksCountQuery implements IJavaQuery3<EObject, String> {
- public String evaluate(final EObject source,
- final IParameterValueList2 parameterValues,
- final IFacetManager facetManager, final DerivedTypedElement feature)
- throws DerivedTypedElementException {
- try {
- String size = ""; //$NON-NLS-1$
- if (parameterValues != null) {
- final ETypedElement sfParam = (ETypedElement) parameterValues
- .getParameterValueByName("eStructuralFeature").getValue(); //$NON-NLS-1$
- if (sfParam instanceof EReference) {
- size = getSizeForReference(source, facetManager, sfParam);
- }
- }
- return facetManager.getSuperValueOf(feature, source,
- parameterValues, String.class) + size;
- } catch (Exception e) {
- throw new DerivedTypedElementException(e);
- }
- }
-
- private static String getSizeForReference(final EObject source,
- final IFacetManager facetManager, final ETypedElement sfParam)
- throws FacetManagerException {
- String size = ""; //$NON-NLS-1$
- final Object object = facetManager.getOrInvoke(source, sfParam,
- Object.class);
- if (object instanceof Collection) {
- final Collection<?> collection = (Collection<?>) object;
- final int listSize = collection.size();
- if (listSize > 0) {
- size = String.format(" (%d)", //$NON-NLS-1$
- Integer.valueOf(listSize));
- }
- } else if (object != null) {
- size = " (1)"; //$NON-NLS-1$
- }
- return size;
- }
-}
-
diff --git a/org.eclipse.modisco.infra.browser.ecore.ui/META-INF/MANIFEST.MF b/org.eclipse.modisco.infra.browser.ecore.ui/META-INF/MANIFEST.MF
index ffe1acaf8..7a153fe40 100644
--- a/org.eclipse.modisco.infra.browser.ecore.ui/META-INF/MANIFEST.MF
+++ b/org.eclipse.modisco.infra.browser.ecore.ui/META-INF/MANIFEST.MF
@@ -10,7 +10,10 @@ Require-Bundle: org.eclipse.ui;bundle-version="3.6.0",
org.eclipse.emf.edit.ui;bundle-version="2.6.0",
org.eclipse.emf.facet.query.java.core;bundle-version="1.0.0",
org.eclipse.emf.facet.util.ui;bundle-version="1.0.0",
- org.eclipse.modisco.util.emf.core;bundle-version="1.0.0"
+ org.eclipse.modisco.util.emf.core;bundle-version="1.0.0",
+ org.eclipse.emf.facet.efacet.ui;bundle-version="1.1.0",
+ org.eclipse.core.expressions;bundle-version="3.4.200",
+ org.eclipse.emf.facet.util.swt;bundle-version="1.0.1"
Bundle-Vendor: %Bundle-Vendor
Bundle-ActivationPolicy: lazy
Bundle-Version: 1.0.0.qualifier
diff --git a/org.eclipse.modisco.infra.browser.ecore.ui/OSGI-INF/l10n/bundle.properties b/org.eclipse.modisco.infra.browser.ecore.ui/OSGI-INF/l10n/bundle.properties
index 0c21ac30b..5b1d9ab06 100644
--- a/org.eclipse.modisco.infra.browser.ecore.ui/OSGI-INF/l10n/bundle.properties
+++ b/org.eclipse.modisco.infra.browser.ecore.ui/OSGI-INF/l10n/bundle.properties
@@ -6,6 +6,7 @@
#
# Contributors:
# Grégoire Dupé (Mia-Software) - Bug 471020 - Ecore Explorer View
+# Thomas Cicognani (Mia-Software) - Bug 470962 - Add shortcuts to activate customs
Bundle-Vendor = Eclipse Modeling Project
Bundle-Name = MoDisco Ecore Explorer (Incubation)
-EcoreExplorer = Ecore Explorer \ No newline at end of file
+EcoreExplorer = Ecore Explorer
diff --git a/org.eclipse.modisco.infra.browser.ecore.ui/custom/nbInstancesEClassByResource.custom b/org.eclipse.modisco.infra.browser.ecore.ui/custom/nbInstancesEClassByResource.custom
index 8ee6e0ee6..9400e5469 100644
--- a/org.eclipse.modisco.infra.browser.ecore.ui/custom/nbInstancesEClassByResource.custom
+++ b/org.eclipse.modisco.infra.browser.ecore.ui/custom/nbInstancesEClassByResource.custom
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="ASCII"?><!--
-Copyright (c) 2015 Soft-Maint.
+Copyright (c) 2015 Soft-Maint, and Mia-Software.
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Public License v1.0
@@ -8,8 +8,19 @@ http://www.eclipse.org/legal/epl-v10.html
Contributors:
Thomas Cicognani (Soft-Maint) - Bug 472041 - [New Browser] Add a customization counting instances by EClass in the same Resource
+ Thomas Cicognani (Mia-Software) - Bug 470962 - Add shortcuts to activate customs
-->
-<custom:Customization xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:custom="http://www.eclipse.org/emf/facet/custom/0.2.incubation/custom" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:efacet="http://www.eclipse.org/emf/facet/efacet/0.2.incubation/efacet" xmlns:javaQuery="http://www.eclipse.org/emf/facet/query/java/0.2.incubation/javaquery" name="org.eclipse.modisco.infra.browser.ecore.ui.nbInstancesEClassByResource" nsURI="http://www.eclipse.org/MoDisco/infra/browser/ecore/0.13.0.incubation/nbInstancesEClassByResource" nsPrefix="nbInstancesEClassByResource">
+<custom:Customization
+ xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:custom="http://www.eclipse.org/emf/facet/custom/0.2.incubation/custom"
+ xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
+ xmlns:efacet="http://www.eclipse.org/emf/facet/efacet/0.2.incubation/efacet"
+ xmlns:javaQuery="http://www.eclipse.org/emf/facet/query/java/0.2.incubation/javaquery"
+ name="org.eclipse.modisco.infra.browser.ecore.ui.nbInstancesEClassByResource"
+ nsURI="http://www.eclipse.org/MoDisco/infra/browser/ecore/0.13.0.incubation/nbInstancesEClassByResource"
+ nsPrefix="nbInstancesEClassByResource">
<eClassifiers xsi:type="custom:EClassCustomization" name="EObject null">
<extendedMetaclass href="http://www.eclipse.org/emf/2002/Ecore#//EObject"/>
<facetOperations name="label" lowerBound="1">
diff --git a/org.eclipse.modisco.infra.browser.ecore.ui/plugin.xml b/org.eclipse.modisco.infra.browser.ecore.ui/plugin.xml
index fa7058dad..4cffa83de 100644
--- a/org.eclipse.modisco.infra.browser.ecore.ui/plugin.xml
+++ b/org.eclipse.modisco.infra.browser.ecore.ui/plugin.xml
@@ -12,6 +12,7 @@ Contributors:
Thomas Cicognani (Soft-Maint) - Bug 471020 - Ecore Explorer View
Thomas Cicognani (Soft-Maint) - Bug 471447 - [New Browser] Add a customization counting instances by EClass
Thomas Cicognani (Soft-Maint) - Bug 472041 - [New Browser] Add a customization counting instances by EClass in the same Resource
+ Thomas Cicognani (Mia-Software) - Bug 470962 - Add shortcuts to activate customs
-->
<plugin>
<extension point="org.eclipse.ui.views">
@@ -28,17 +29,33 @@ Contributors:
locationURI="toolbar:org.eclipse.modisco.infra.browser.ecore.ui.view1">
<command
commandId="org.eclipse.emf.facet.ui.loadCustomization"
- id="org.eclipse.modisco.util.emffacet.ui.menu.loadCustomization"
+ id="org.eclipse.modisco.infra.browser.ecore.ui.menu.loadCustomization"
label="Load/Unload customizations"
- style="push">
+ style="pulldown">
</command>
<command
commandId="org.eclipse.emf.facet.efacet.ui.loadFacet"
- id="org.eclipse.modisco.util.emffacet.menu.ui.loadFacet"
+ id="org.eclipse.modisco.infra.browser.ecore.ui.menu.loadFacet"
label="Load/Unload facets"
- style="push">
+ style="pulldown">
</command>
</menuContribution>
+ <menuContribution
+ allPopups="false"
+ locationURI="menu:org.eclipse.modisco.infra.browser.ecore.ui.menu.loadCustomization">
+ <dynamic
+ class="org.eclipse.modisco.infra.browser.ecore.ui.internal.handler.LoadCustomShortcutsMenu"
+ id="org.eclipse.modisco.infra.browser.ecore.ui.menu.loadCustomization.dynamic">
+ </dynamic>
+ </menuContribution>
+ <menuContribution
+ allPopups="false"
+ locationURI="menu:org.eclipse.modisco.infra.browser.ecore.ui.menu.loadFacet">
+ <dynamic
+ class="org.eclipse.modisco.infra.browser.ecore.ui.internal.handler.LoadFacetSetShortcutsMenu"
+ id="org.eclipse.modisco.infra.browser.ecore.ui.menu.loadFacet.dynamic">
+ </dynamic>
+ </menuContribution>
</extension>
<extension
point="org.eclipse.emf.facet.util.emf.core.modeldeclaration">
diff --git a/org.eclipse.modisco.infra.browser.ecore.ui/src/org/eclipse/modisco/infra/browser/ecore/ui/internal/Messages.java b/org.eclipse.modisco.infra.browser.ecore.ui/src/org/eclipse/modisco/infra/browser/ecore/ui/internal/Messages.java
index ab11b18fa..df654a74f 100644
--- a/org.eclipse.modisco.infra.browser.ecore.ui/src/org/eclipse/modisco/infra/browser/ecore/ui/internal/Messages.java
+++ b/org.eclipse.modisco.infra.browser.ecore.ui/src/org/eclipse/modisco/infra/browser/ecore/ui/internal/Messages.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2015 Soft-Maint
+ * Copyright (c) 2015 Soft-Maint, and Mia-Software.
* 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
@@ -7,6 +7,7 @@
*
* Contributors:
* Thomas Cicognani (Soft-Maint) - Bug 471020 - Ecore Explorer View
+ * Thomas Cicognani (Mia-Software) - Bug 470962 - Add shortcuts to activate customs
*/
package org.eclipse.modisco.infra.browser.ecore.ui.internal;
@@ -17,6 +18,11 @@ public class Messages extends NLS {
public static String EcoreInstancesExplorerComposite_Instances;
public static String EcoreMetaExplorerComposite_Metas;
+ public static String EcoreExplorerShortcutUtils_NbInstancesEClassByResource;
+ public static String EcoreExplorerShortcutUtils_NbInstancesEClassByResourceSet;
+ public static String EcoreExplorerShortcutUtils_EClassFromEPackage;
+ public static String EcoreExplorerShortcutUtils_EClassSubclasses;
+ public static String EcoreExplorerShortcutUtils_EClassHierarchy;
static {
// initialize resource bundle
diff --git a/org.eclipse.modisco.infra.browser.ecore.ui/src/org/eclipse/modisco/infra/browser/ecore/ui/internal/handler/LoadCustomShortcutsMenu.java b/org.eclipse.modisco.infra.browser.ecore.ui/src/org/eclipse/modisco/infra/browser/ecore/ui/internal/handler/LoadCustomShortcutsMenu.java
new file mode 100644
index 000000000..1aa927fe9
--- /dev/null
+++ b/org.eclipse.modisco.infra.browser.ecore.ui/src/org/eclipse/modisco/infra/browser/ecore/ui/internal/handler/LoadCustomShortcutsMenu.java
@@ -0,0 +1,24 @@
+/**
+ * Copyright (c) 2015 Mia-Software.
+ * 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:
+ * Thomas Cicognani (Mia-Software) - Bug 470962 - Add shortcuts to activate customs
+ */
+package org.eclipse.modisco.infra.browser.ecore.ui.internal.handler;
+
+import org.eclipse.emf.facet.custom.ui.LoadCustomShortcutsMenuUtils;
+import org.eclipse.jface.action.IContributionItem;
+import org.eclipse.ui.actions.CompoundContributionItem;
+
+public class LoadCustomShortcutsMenu extends CompoundContributionItem {
+
+ @Override
+ protected IContributionItem[] getContributionItems() {
+ return LoadCustomShortcutsMenuUtils.getCustomItemsFromCurrentPart();
+ }
+
+}
diff --git a/org.eclipse.modisco.infra.browser.ecore.ui/src/org/eclipse/modisco/infra/browser/ecore/ui/internal/handler/LoadFacetSetShortcutsMenu.java b/org.eclipse.modisco.infra.browser.ecore.ui/src/org/eclipse/modisco/infra/browser/ecore/ui/internal/handler/LoadFacetSetShortcutsMenu.java
new file mode 100644
index 000000000..d0e1bc6bd
--- /dev/null
+++ b/org.eclipse.modisco.infra.browser.ecore.ui/src/org/eclipse/modisco/infra/browser/ecore/ui/internal/handler/LoadFacetSetShortcutsMenu.java
@@ -0,0 +1,24 @@
+/**
+ * Copyright (c) 2015 Mia-Software.
+ * 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:
+ * Thomas Cicognani (Mia-Software) - Bug 470962 - Add shortcuts to activate customs
+ */
+package org.eclipse.modisco.infra.browser.ecore.ui.internal.handler;
+
+import org.eclipse.emf.facet.efacet.ui.LoadFacetSetShortcutsMenuUtils;
+import org.eclipse.jface.action.IContributionItem;
+import org.eclipse.ui.actions.CompoundContributionItem;
+
+public class LoadFacetSetShortcutsMenu extends CompoundContributionItem {
+
+ @Override
+ protected IContributionItem[] getContributionItems() {
+ return LoadFacetSetShortcutsMenuUtils.getFacetSetItemsFromCurrentPart();
+ }
+
+}
diff --git a/org.eclipse.modisco.infra.browser.ecore.ui/src/org/eclipse/modisco/infra/browser/ecore/ui/internal/messages.properties b/org.eclipse.modisco.infra.browser.ecore.ui/src/org/eclipse/modisco/infra/browser/ecore/ui/internal/messages.properties
index 0ef6ae990..1b505be53 100644
--- a/org.eclipse.modisco.infra.browser.ecore.ui/src/org/eclipse/modisco/infra/browser/ecore/ui/internal/messages.properties
+++ b/org.eclipse.modisco.infra.browser.ecore.ui/src/org/eclipse/modisco/infra/browser/ecore/ui/internal/messages.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2015 Soft-Maint.
+# Copyright (c) 2015 Soft-Maint, and Mia-Software.
# 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
@@ -7,6 +7,12 @@
#
# Contributors:
# Thomas Cicognani (Soft-Maint) - Bug 471020 - Ecore Explorer View
+# Thomas Cicognani (Mia-Software) - Bug 470962 - Add shortcuts to activate customs
###############################################################################
EcoreInstancesExplorerComposite_Instances=Instances
EcoreMetaExplorerComposite_Metas=Metas
+EcoreExplorerShortcutUtils_NbInstancesEClassByResource = Show The Number Of Instances From An EClass, In The Same Resource
+EcoreExplorerShortcutUtils_NbInstancesEClassByResourceSet = Show The Number Of Instances From An EClass, In The Same ResourceSet
+EcoreExplorerShortcutUtils_EClassFromEPackage=Show Contained EClass From EPackage
+EcoreExplorerShortcutUtils_EClassSubclasses=Show EClass Subclasses
+EcoreExplorerShortcutUtils_EClassHierarchy=Show EClass Hierarchy
diff --git a/org.eclipse.modisco.infra.browser.ecore.ui/src/org/eclipse/modisco/infra/browser/ecore/ui/internal/widget/EcoreExplorerShortcutUtils.java b/org.eclipse.modisco.infra.browser.ecore.ui/src/org/eclipse/modisco/infra/browser/ecore/ui/internal/widget/EcoreExplorerShortcutUtils.java
new file mode 100644
index 000000000..f6ce7366a
--- /dev/null
+++ b/org.eclipse.modisco.infra.browser.ecore.ui/src/org/eclipse/modisco/infra/browser/ecore/ui/internal/widget/EcoreExplorerShortcutUtils.java
@@ -0,0 +1,147 @@
+/**
+ * Copyright (c) 2015 Mia-Software.
+ * 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:
+ * Thomas Cicognani (Mia-Software) - Bug 470962 - Add shortcuts to activate customs
+ */
+package org.eclipse.modisco.infra.browser.ecore.ui.internal.widget;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.emf.common.util.EList;
+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.facet.custom.metamodel.v0_2_0.custom.Customization;
+import org.eclipse.emf.facet.custom.ui.ICustomizationManagerProvider2.ICustomShortcut;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet;
+import org.eclipse.emf.facet.efacet.ui.IFacetManagerProvider2.IFacetSetShortcut;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.modisco.infra.browser.ecore.ui.internal.Activator;
+import org.eclipse.modisco.infra.browser.ecore.ui.internal.Messages;
+import org.osgi.framework.Bundle;
+
+public final class EcoreExplorerShortcutUtils {
+
+ private EcoreExplorerShortcutUtils() {
+ // DO NOTHING
+ }
+
+ public static List<ICustomShortcut> getCustomShortcuts(
+ final ResourceSet resourceSet) {
+ final List<ICustomShortcut> shortcuts = new ArrayList<ICustomShortcut>();
+ final Bundle bundle = Activator.getDefault().getBundle();
+ final String bundleName = bundle.getSymbolicName();
+
+ final String uriStr = String
+ .format("platform:/plugin/%s/custom/nbInstancesEClassByResource.custom", //$NON-NLS-1$
+ bundleName);
+ shortcuts
+ .add(createCustomShortcut(
+ resourceSet,
+ uriStr,
+ Messages.EcoreExplorerShortcutUtils_NbInstancesEClassByResource));
+
+ final String uriStr2 = String
+ .format("platform:/plugin/%s/custom/nbInstancesEClassByResourceSet.custom", //$NON-NLS-1$
+ bundleName);
+ shortcuts
+ .add(createCustomShortcut(
+ resourceSet,
+ uriStr2,
+ Messages.EcoreExplorerShortcutUtils_NbInstancesEClassByResourceSet));
+
+ shortcuts
+ .add(createCustomShortcut(
+ resourceSet,
+ "platform:/plugin/org.eclipse.modisco.infra.browser.ecore.core/custom/ePackageContainsEClass.custom", //$NON-NLS-1$
+ Messages.EcoreExplorerShortcutUtils_EClassFromEPackage));
+
+ shortcuts
+ .add(createCustomShortcut(
+ resourceSet,
+ "platform:/plugin/org.eclipse.modisco.infra.browser.ecore.core/custom/hierarchicalEClass.custom", //$NON-NLS-1$
+ Messages.EcoreExplorerShortcutUtils_EClassHierarchy));
+
+ return shortcuts;
+ }
+
+ public static List<IFacetSetShortcut> getFacetSetShortcuts(
+ final ResourceSet resourceSet) {
+ final List<IFacetSetShortcut> shortcuts = new ArrayList<IFacetSetShortcut>();
+
+ shortcuts
+ .add(createFacetSetShortcut(
+ resourceSet,
+ "platform:/plugin/org.eclipse.modisco.infra.browser.ecore.core/facet/hierarchicalEClass.efacet", //$NON-NLS-1$
+ Messages.EcoreExplorerShortcutUtils_EClassSubclasses));
+
+ return shortcuts;
+ }
+
+ private static ICustomShortcut createCustomShortcut(
+ final ResourceSet resourceSet, final String uriStr,
+ final String label) {
+ return createCustomShortcut(resourceSet, uriStr, label, null);
+ }
+
+ private static ICustomShortcut createCustomShortcut(
+ final ResourceSet resourceSet, final String uriStr,
+ final String label, final ImageDescriptor icon) {
+ final Customization custom = (Customization) getObjectFromURI(uriStr,
+ resourceSet);
+ return new ICustomShortcut() {
+ public String getLabel() {
+ return label;
+ }
+
+ public Customization getCustom() {
+ return custom;
+ }
+
+ public ImageDescriptor getIcon() {
+ return icon;
+ }
+ };
+ }
+
+ private static IFacetSetShortcut createFacetSetShortcut(
+ final ResourceSet resourceSet, final String uriStr,
+ final String label) {
+ return createFacetSetShortcut(resourceSet, uriStr, label, null);
+ }
+
+ private static IFacetSetShortcut createFacetSetShortcut(
+ final ResourceSet resourceSet, final String uriStr,
+ final String label, final ImageDescriptor icon) {
+ final FacetSet facetSet = (FacetSet) getObjectFromURI(uriStr,
+ resourceSet);
+ return new IFacetSetShortcut() {
+ public String getLabel() {
+ return label;
+ }
+
+ public FacetSet getFacetSet() {
+ return facetSet;
+ }
+
+ public ImageDescriptor getIcon() {
+ return icon;
+ }
+ };
+ }
+
+ private static EObject getObjectFromURI(final String uriStr,
+ final ResourceSet resourceSet) {
+ final URI uri = URI.createURI(uriStr);
+ final Resource resource = resourceSet.getResource(uri, true);
+ final EList<EObject> contents = resource.getContents();
+ return contents.get(0);
+ }
+}
diff --git a/org.eclipse.modisco.infra.browser.ecore.ui/src/org/eclipse/modisco/infra/browser/ecore/ui/internal/widget/EcoreExplorerWidgetComposite.java b/org.eclipse.modisco.infra.browser.ecore.ui/src/org/eclipse/modisco/infra/browser/ecore/ui/internal/widget/EcoreExplorerWidgetComposite.java
index e99ad99b5..8998e583a 100644
--- a/org.eclipse.modisco.infra.browser.ecore.ui/src/org/eclipse/modisco/infra/browser/ecore/ui/internal/widget/EcoreExplorerWidgetComposite.java
+++ b/org.eclipse.modisco.infra.browser.ecore.ui/src/org/eclipse/modisco/infra/browser/ecore/ui/internal/widget/EcoreExplorerWidgetComposite.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2015 Soft-Maint
+ * Copyright (c) 2015 Soft-Maint, and Mia-Software.
* 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
@@ -7,11 +7,13 @@
*
* Contributors:
* Thomas Cicognani (Soft-Maint) - Bug 471020 - Ecore Explorer View
+ * Thomas Cicognani (Mia-Software) - Bug 470962 - Add shortcuts to activate customs
*/
package org.eclipse.modisco.infra.browser.ecore.ui.internal.widget;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -19,10 +21,11 @@ import java.util.Set;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.facet.custom.core.ICustomizationManager;
-import org.eclipse.emf.facet.custom.core.ICustomizationManagerProvider;
+import org.eclipse.emf.facet.custom.ui.ICustomizationManagerProvider2;
import org.eclipse.emf.facet.efacet.core.IFacetManager;
-import org.eclipse.emf.facet.efacet.core.IFacetManagerProvider;
+import org.eclipse.emf.facet.efacet.ui.IFacetManagerProvider2;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
@@ -39,8 +42,8 @@ import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
public class EcoreExplorerWidgetComposite extends Composite implements
- ISelectionProvider, ICustomizationManagerProvider,
- IFacetManagerProvider {
+ ISelectionProvider, ICustomizationManagerProvider2,
+ IFacetManagerProvider2 {
interface IEClassSelectionListener {
void onEClassSelected(Set<EClass> eClasses);
@@ -51,6 +54,8 @@ public class EcoreExplorerWidgetComposite extends Composite implements
private final EcoreMetaExplorerComposite metaComposite;
private final EcoreInstancesExplorerComposite instComposite;
private final List<IEClassSelectionListener> listeners = new ArrayList<IEClassSelectionListener>();
+ private final List<ICustomShortcut> customShortcuts;
+ private final List<IFacetSetShortcut> facetSetShortcuts;
public EcoreExplorerWidgetComposite(final Composite parent,
final MenuManager menuManager) {
@@ -88,6 +93,14 @@ public class EcoreExplorerWidgetComposite extends Composite implements
updateSashOrientation();
}
});
+
+ final ResourceSet customRS = getCustomizationManager().getResourceSet();
+ this.customShortcuts = EcoreExplorerShortcutUtils
+ .getCustomShortcuts(customRS);
+
+ final ResourceSet facetSetRS = getFacetManager().getResourceSet();
+ this.facetSetShortcuts = EcoreExplorerShortcutUtils
+ .getFacetSetShortcuts(facetSetRS);
}
protected ISelection getMetaSelection() {
@@ -138,6 +151,14 @@ public class EcoreExplorerWidgetComposite extends Composite implements
public IFacetManager getFacetManager() {
return this.metaComposite.getFacetManager();
}
+
+ public List<IFacetSetShortcut> getFacetSetShortcuts() {
+ return Collections.unmodifiableList(this.facetSetShortcuts);
+ }
+
+ public List<ICustomShortcut> getCustomShortcuts() {
+ return Collections.unmodifiableList(this.customShortcuts);
+ }
public void addSelectionChangedListener(
final ISelectionChangedListener listener) {
@@ -174,5 +195,5 @@ public class EcoreExplorerWidgetComposite extends Composite implements
this.instComposite.changeInput(eObjects);
}
-
+
}
diff --git a/org.eclipse.modisco.infra.browser.editor.ui/META-INF/MANIFEST.MF b/org.eclipse.modisco.infra.browser.editor.ui/META-INF/MANIFEST.MF
index 0e1440fe0..e19658aab 100644
--- a/org.eclipse.modisco.infra.browser.editor.ui/META-INF/MANIFEST.MF
+++ b/org.eclipse.modisco.infra.browser.editor.ui/META-INF/MANIFEST.MF
@@ -15,7 +15,8 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.emf.facet.util.emf.ui;bundle-version="0.3.0",
org.eclipse.emf.facet.util.core;bundle-version="0.3.0",
org.eclipse.emf.ecore.edit;bundle-version="2.6.0",
- org.eclipse.emf.facet.util.ui;bundle-version="0.5.0"
+ org.eclipse.emf.facet.util.ui;bundle-version="0.5.0",
+ org.eclipse.emf.facet.efacet.ui
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-ActivationPolicy: lazy
Export-Package: org.eclipse.modisco.infra.browser.editor.ui,
diff --git a/org.eclipse.modisco.infra.browser.editor.ui/OSGI-INF/l10n/bundle.properties b/org.eclipse.modisco.infra.browser.editor.ui/OSGI-INF/l10n/bundle.properties
index 347cfeb95..86e64ccbd 100644
--- a/org.eclipse.modisco.infra.browser.editor.ui/OSGI-INF/l10n/bundle.properties
+++ b/org.eclipse.modisco.infra.browser.editor.ui/OSGI-INF/l10n/bundle.properties
@@ -1,4 +1,4 @@
-# Copyright (c) 2014, 2015 Soft-Maint.
+# Copyright (c) 2014, 2015 Mia-Software, and Soft-Maint.
# 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
@@ -11,7 +11,9 @@
# Thomas Cicognani (Soft-Maint) - Bug 442714 - New toolbar action to show/hide eContainer link
# Grégoire Dupé (Mia-Software) - Bug 469263 - [Unit Test Failure] org.eclipse.modisco.tests.BundleTest.name
# Thomas Cicognani (Soft-Maint) - Bug 470962 - Add shortcuts to activate customs
-# Thomas Cicognani (Soft-Maint) - Bug 471597 - [New Browser] Add a customization to display subclasses from an EClass
+# Thomas Cicognani (Soft-Maint) - Bug 471597 - [New Browser] Add a customization to display subclasses from an EClass
+# Thomas Cicognani (Soft-Maint) - Bug 472041 - [New Browser] Add a customization counting instances by EClass in the same Resource
+# Thomas Cicognani (Mia-Software) - Bug 470962 - Add shortcuts to activate customs
#Properties file for org.eclipse.emf.facet.widgets.tree.ui.workbench
Bundle-Vendor = Eclipse Modeling Project
Bundle-Name = MoDisco Tree Widgets (Incubation)
@@ -22,7 +24,7 @@ LoadUnloadCustoms = Load/Unload customizations
ShowLinksLabel = Show number of links
ShowEContainerLabel = Show eContainer link
CopyLabel = Copy
-HideEmptyReferences = Hide empty references
-HideDerivedReferences = Hide derived references
-showEClassSubclasses = Show EClass subclasses
-showEClassSubclassesFromEClass = Show EClass subclasses from an EClass
+HideEmptyReferences = Hide Empty References
+HideDerivedReferences = Hide Derived References
+showEClassSubclasses = Show EClass Subclasses
+showEClassSubclassesFromEClass = Show EClass Subclasses From An EClass
diff --git a/org.eclipse.modisco.infra.browser.editor.ui/plugin.xml b/org.eclipse.modisco.infra.browser.editor.ui/plugin.xml
index fbe3708d9..d1565d69e 100644
--- a/org.eclipse.modisco.infra.browser.editor.ui/plugin.xml
+++ b/org.eclipse.modisco.infra.browser.editor.ui/plugin.xml
@@ -15,7 +15,8 @@
Thomas Cicognani (Soft-Maint) - Bug 442714 - New toolbar action to show/hide eContainer link
Thomas Cicognani (Soft-Maint) - Bug 442800 - API to open new MoDisco Browser
Thomas Cicognani (Soft-Maint) - Bug 470962 - Add shortcuts to activate customs
- Thomas Cicognani (Soft-Maint) - Bug 471597 - [New Browser] Add a customization to display subclasses from an EClass
+ Thomas Cicognani (Soft-Maint) - Bug 471597 - [New Browser] Add a customization to display subclasses from an EClass
+ Thomas Cicognani (Soft-Maint) - Bug 472041 - [New Browser] Add a customization counting instances by EClass in the same Resource
-->
<plugin>
<extension point="org.eclipse.ui.editors">
@@ -93,84 +94,9 @@
</with>
</visibleWhen>
</command>
- <command
- commandId="org.eclipse.modisco.infra.browser.editor.ui.command.linkscount"
- label="%ShowLinksLabel"
- style="toggle">
- <visibleWhen
- checkEnabled="true">
- <with
- variable="activeEditor">
- <instanceof
- value="org.eclipse.modisco.infra.browser.editor.ui.internal.editor.TreeEditor">
- </instanceof>
- </with>
- </visibleWhen>
- </command>
- <command
- commandId="org.eclipse.modisco.infra.browser.editor.ui.command.hideemptyreferences"
- label="%HideEmptyReferences"
- style="toggle">
- <visibleWhen
- checkEnabled="true">
- <with
- variable="activeEditor">
- <instanceof
- value="org.eclipse.modisco.infra.browser.editor.ui.internal.editor.TreeEditor">
- </instanceof>
- </with>
- </visibleWhen>
- </command>
- <command
- commandId="org.eclipse.modisco.infra.browser.editor.ui.command.hidederivedreferences"
- label="%HideDerivedReferences"
- style="toggle">
- <visibleWhen
- checkEnabled="true">
- <with
- variable="activeEditor">
- <instanceof
- value="org.eclipse.modisco.infra.browser.editor.ui.internal.editor.TreeEditor">
- </instanceof>
- </with>
- </visibleWhen>
- </command>
</toolbar>
</menuContribution>
<menuContribution
- allPopups="false"
- locationURI="menu:org.eclipse.modisco.util.emffacet.menu.ui.loadFacet">
- <command
- commandId="org.eclipse.modisco.infra.browser.editor.ui.command.hierarchicaleclassfacet"
- label="%showEClassSubclasses"
- style="toggle">
- </command>
- </menuContribution>
- <menuContribution
- allPopups="false"
- locationURI="menu:org.eclipse.modisco.util.emffacet.ui.menu.loadCustomization">
- <command
- commandId="org.eclipse.modisco.infra.browser.editor.ui.command.linkscount"
- label="%ShowLinksLabel"
- style="toggle">
- </command>
- <command
- commandId="org.eclipse.modisco.infra.browser.editor.ui.command.hideemptyreferences"
- label="%HideEmptyReferences"
- style="toggle">
- </command>
- <command
- commandId="org.eclipse.modisco.infra.browser.editor.ui.command.hidederivedreferences"
- label="%HideDerivedReferences"
- style="toggle">
- </command>
- <command
- commandId="org.eclipse.modisco.infra.browser.editor.ui.command.hierarchicaleclasscustom"
- label="%showEClassSubclassesFromEClass"
- style="toggle">
- </command>
- </menuContribution>
- <menuContribution
allPopups="true"
locationURI="popup:org.eclipse.ui.popup.any">
<command
@@ -188,54 +114,22 @@
</visibleWhen>
</command>
</menuContribution>
- </extension>
- <extension
- point="org.eclipse.ui.commands">
- <command
- defaultHandler="org.eclipse.modisco.infra.browser.editor.ui.internal.handlers.LinksCountHandler"
- id="org.eclipse.modisco.infra.browser.editor.ui.command.linkscount"
- name="%ShowLinksLabel">
- <state
- class="org.eclipse.modisco.infra.browser.editor.ui.internal.handlers.LinksCountState"
- id="org.eclipse.ui.commands.toggleState">
- </state>
- </command>
- <command
- defaultHandler="org.eclipse.modisco.infra.browser.editor.ui.internal.handlers.HideEmptyReferencesHandler"
- id="org.eclipse.modisco.infra.browser.editor.ui.command.hideemptyreferences"
- name="%HideEmptyReferences">
- <state
- class="org.eclipse.modisco.infra.browser.editor.ui.internal.handlers.HideEmptyReferencesToggleState"
- id="org.eclipse.ui.commands.toggleState">
- </state>
- </command>
- <command
- defaultHandler="org.eclipse.modisco.infra.browser.editor.ui.internal.handlers.HideDerivedReferencesHandler"
- id="org.eclipse.modisco.infra.browser.editor.ui.command.hidederivedreferences"
- name="%HideDerivedReferences">
- <state
- class="org.eclipse.modisco.infra.browser.editor.ui.internal.handlers.HideDerivedReferencesToggleState"
- id="org.eclipse.ui.commands.toggleState">
- </state>
- </command>
- <command
- defaultHandler="org.eclipse.modisco.infra.browser.editor.ui.internal.handlers.HierarchicalEClassFacetHandler"
- id="org.eclipse.modisco.infra.browser.editor.ui.command.hierarchicaleclassfacet"
- name="%showEClassSubclasses">
- <state
- class="org.eclipse.modisco.infra.browser.editor.ui.internal.handlers.HierarchicalEClassFacetToggleState"
- id="org.eclipse.ui.commands.toggleState">
- </state>
- </command>
- <command
- defaultHandler="org.eclipse.modisco.infra.browser.editor.ui.internal.handlers.HierarchicalEClassCustomHandler"
- id="org.eclipse.modisco.infra.browser.editor.ui.command.hierarchicaleclasscustom"
- name="%showEClassSubclassesFromEClass">
- <state
- class="org.eclipse.modisco.infra.browser.editor.ui.internal.handlers.HierarchicalEClassCustomToggleState"
- id="org.eclipse.ui.commands.toggleState">
- </state>
- </command>
+ <menuContribution
+ allPopups="false"
+ locationURI="menu:org.eclipse.modisco.util.emffacet.ui.menu.loadCustomization">
+ <dynamic
+ class="org.eclipse.modisco.infra.browser.editor.ui.internal.handlers.LoadCustomShortcutsMenu"
+ id="org.eclipse.modisco.util.emffacet.ui.menu.loadCustomization.dynamic">
+ </dynamic>
+ </menuContribution>
+ <menuContribution
+ allPopups="false"
+ locationURI="menu:org.eclipse.modisco.util.emffacet.menu.ui.loadFacet">
+ <dynamic
+ class="org.eclipse.modisco.infra.browser.editor.ui.internal.handlers.LoadFacetSetShortcutsMenu"
+ id="org.eclipse.modisco.util.emffacet.menu.ui.loadFacet.dynamic">
+ </dynamic>
+ </menuContribution>
</extension>
<extension
point="org.eclipse.ui.handlers">
diff --git a/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/Messages.java b/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/Messages.java
index 296e04f1e..57a9e7180 100644
--- a/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/Messages.java
+++ b/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/Messages.java
@@ -8,6 +8,7 @@
* Contributors:
* Gregoire Dupe (Mia-Software) - Bug 358914 - [Move to EMF Facet][Browser] Switch to EMF Facet
* Thomas Cicognani (Soft-Maint) - Bug 442800 - API to open new MoDisco Browser
+ * Thomas Cicognani (Mia-Software) - Bug 470962 - Add shortcuts to activate customs
*/
package org.eclipse.modisco.infra.browser.editor.ui.internal;
@@ -17,6 +18,9 @@ public class Messages extends NLS {
private static final String BUNDLE_NAME = Messages.class.getPackage().getName() + ".messages"; //$NON-NLS-1$
public static String ResourceBrowserOpener_MoDiscoDefaultTreeBrowser;
+ public static String TreeEditorShortcutUtils_CustomHideDerivedReferences;
+ public static String TreeEditorShortcutUtils_CustomHideEmptyReferences;
+ public static String TreeEditorShortcutUtils_CustomShowLinksCount;
static {
// initialize resource bundle
diff --git a/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/editor/TreeEditor.java b/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/editor/TreeEditor.java
index e90b7ce23..00a9f85f3 100644
--- a/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/editor/TreeEditor.java
+++ b/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/editor/TreeEditor.java
@@ -9,7 +9,8 @@
* Gregoire Dupe (Mia-Software) - Bug 358914 - [Move to EMF Facet][Browser] Switch to EMF Facet
* Thomas Cicognani (Soft-Maint) - Bug 442718 - Implement copy action in the new MoDisco Browser
* Thomas Cicognani (Soft-Maint) - Bug 442800 - API to open new MoDisco Browser
- * Grégoire Dupé (Mia-Software) - Bug 442800 - API to open new MoDisco Browser
+ * Grégoire Dupé (Mia-Software) - Bug 442800 - API to open new MoDisco Browser
+ * Thomas Cicognani (Mia-Software) - Bug 470962 - Add shortcuts to activate customs
*/
package org.eclipse.modisco.infra.browser.editor.ui.internal.editor;
@@ -33,13 +34,13 @@ import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.emf.edit.domain.IEditingDomainProvider;
import org.eclipse.emf.facet.custom.core.ICustomizationManager;
import org.eclipse.emf.facet.custom.core.ICustomizationManagerFactory;
-import org.eclipse.emf.facet.custom.core.ICustomizationManagerProvider;
+import org.eclipse.emf.facet.custom.ui.ICustomizationManagerProvider2;
import org.eclipse.emf.facet.custom.ui.ICustomizedContentProviderFactory;
import org.eclipse.emf.facet.custom.ui.IResolvingCustomizedLabelProviderFactory;
import org.eclipse.emf.facet.efacet.core.IFacetManager;
import org.eclipse.emf.facet.efacet.core.IFacetManagerFactory;
import org.eclipse.emf.facet.efacet.core.IFacetManagerListener;
-import org.eclipse.emf.facet.efacet.core.IFacetManagerProvider;
+import org.eclipse.emf.facet.efacet.ui.IFacetManagerProvider2;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.viewers.IContentProvider;
import org.eclipse.jface.viewers.ILabelProvider;
@@ -58,7 +59,7 @@ import org.eclipse.ui.part.EditorPart;
import org.eclipse.ui.part.FileEditorInput;
public class TreeEditor extends EditorPart implements IEditingDomainProvider,
- IFacetManagerProvider, ICustomizationManagerProvider, ITreeEditor {
+ IFacetManagerProvider2, ICustomizationManagerProvider2, ITreeEditor {
private static final String EDITOR_ID = Activator.getDefault().getBundle()
.getSymbolicName() + ".TreeEditor"; //$NON-NLS-1$
@@ -69,6 +70,8 @@ public class TreeEditor extends EditorPart implements IEditingDomainProvider,
private ICustomizationManager customManager;
private TreeViewer tree;
private IFacetManagerListener facetMgrListener;
+ private List<IFacetSetShortcut> facetSetShortcuts;
+ private List<ICustomShortcut> customShortcuts;
@Override
public void doSave(final IProgressMonitor monitor) {
@@ -119,6 +122,9 @@ public class TreeEditor extends EditorPart implements IEditingDomainProvider,
final CommandStack commandStack = new BasicCommandStack();
this.editingDomain = new AdapterFactoryEditingDomain(adapterFactory,
commandStack, this.resourceSet);
+
+ this.facetSetShortcuts = TreeEditorShortcutUtils.getFacetSetShortcuts(this.resourceSet);
+ this.customShortcuts = TreeEditorShortcutUtils.getCustomShortcuts(this.resourceSet);
}
@@ -214,10 +220,18 @@ public class TreeEditor extends EditorPart implements IEditingDomainProvider,
return this.customManager;
}
+ public List<ICustomShortcut> getCustomShortcuts() {
+ return this.customShortcuts;
+ }
+
public IFacetManager getFacetManager() {
return this.facetManager;
}
+ public List<IFacetSetShortcut> getFacetSetShortcuts() {
+ return this.facetSetShortcuts;
+ }
+
@Override
public void dispose() {
this.facetManager.removeListener(this.facetMgrListener);
@@ -227,4 +241,5 @@ public class TreeEditor extends EditorPart implements IEditingDomainProvider,
public ILabelProvider getViewerLabelProvider() {
return (ILabelProvider) this.tree.getLabelProvider();
}
+
}
diff --git a/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/editor/TreeEditorShortcutUtils.java b/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/editor/TreeEditorShortcutUtils.java
new file mode 100644
index 000000000..f7974398d
--- /dev/null
+++ b/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/editor/TreeEditorShortcutUtils.java
@@ -0,0 +1,124 @@
+/**
+ * Copyright (c) 2015 Mia-Software.
+ * 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:
+ * Thomas Cicognani (Mia-Software) - Bug 470962 - Add shortcuts to activate customs
+ */
+package org.eclipse.modisco.infra.browser.editor.ui.internal.editor;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.emf.common.util.EList;
+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.facet.custom.metamodel.v0_2_0.custom.Customization;
+import org.eclipse.emf.facet.custom.ui.ICustomizationManagerProvider2.ICustomShortcut;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet;
+import org.eclipse.emf.facet.efacet.ui.IFacetManagerProvider2.IFacetSetShortcut;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.modisco.infra.browser.editor.ui.internal.Messages;
+
+public final class TreeEditorShortcutUtils {
+
+ private TreeEditorShortcutUtils() {
+ // DO NOTHING
+ }
+
+ public static List<ICustomShortcut> getCustomShortcuts(
+ final ResourceSet resourceSet) {
+ final List<ICustomShortcut> shortcuts = new ArrayList<ICustomShortcut>();
+
+ shortcuts
+ .add(createCustomShortcut(
+ resourceSet,
+ "platform:/plugin/org.eclipse.emf.facet.ecore.ui/custom/hideDerivedReferences.custom", //$NON-NLS-1$
+ Messages.TreeEditorShortcutUtils_CustomHideDerivedReferences));
+
+ shortcuts
+ .add(createCustomShortcut(
+ resourceSet,
+ "platform:/plugin/org.eclipse.emf.facet.ecore.ui/custom/hideEmptyReferences.custom", //$NON-NLS-1$
+ Messages.TreeEditorShortcutUtils_CustomHideEmptyReferences));
+
+ shortcuts
+ .add(createCustomShortcut(
+ resourceSet,
+ "platform:/plugin/org.eclipse.emf.facet.ecore.ui/custom/linksCount.custom", //$NON-NLS-1$
+ Messages.TreeEditorShortcutUtils_CustomShowLinksCount));
+
+ return shortcuts;
+ }
+
+ public static List<IFacetSetShortcut> getFacetSetShortcuts(
+ final ResourceSet resourceSet) {
+ return Collections.emptyList();
+ }
+
+ private static ICustomShortcut createCustomShortcut(
+ final ResourceSet resourceSet, final String uriStr,
+ final String label) {
+ return createCustomShortcut(resourceSet, uriStr, label, null);
+ }
+
+ private static ICustomShortcut createCustomShortcut(
+ final ResourceSet resourceSet, final String uriStr,
+ final String label, final ImageDescriptor icon) {
+ final Customization custom = (Customization) getObjectFromURI(uriStr,
+ resourceSet);
+ return new ICustomShortcut() {
+ public String getLabel() {
+ return label;
+ }
+
+ public Customization getCustom() {
+ return custom;
+ }
+
+ public ImageDescriptor getIcon() {
+ return icon;
+ }
+ };
+ }
+
+ private static IFacetSetShortcut createFacetSetShortcut(
+ final ResourceSet resourceSet, final String uriStr,
+ final String label) {
+ return createFacetSetShortcut(resourceSet, uriStr, label, null);
+ }
+
+ private static IFacetSetShortcut createFacetSetShortcut(
+ final ResourceSet resourceSet, final String uriStr,
+ final String label, final ImageDescriptor icon) {
+ final FacetSet facetSet = (FacetSet) getObjectFromURI(uriStr,
+ resourceSet);
+ return new IFacetSetShortcut() {
+ public String getLabel() {
+ return label;
+ }
+
+ public FacetSet getFacetSet() {
+ return facetSet;
+ }
+
+ public ImageDescriptor getIcon() {
+ return icon;
+ }
+ };
+ }
+
+ private static EObject getObjectFromURI(final String uriStr,
+ final ResourceSet resourceSet) {
+ final URI uri = URI.createURI(uriStr);
+ final Resource resource = resourceSet.getResource(uri, true);
+ final EList<EObject> contents = resource.getContents();
+ return contents.get(0);
+ }
+}
diff --git a/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/handlers/AbstractFacetSetActivatorHandler.java b/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/handlers/AbstractFacetSetActivatorHandler.java
deleted file mode 100644
index adc365bb0..000000000
--- a/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/handlers/AbstractFacetSetActivatorHandler.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/**
- * Copyright (c) 2014 Soft-Maint.
- * 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:
- * Thomas Cicognani (Soft-Maint) - Bug 442257 - New toolbar actions to (des)activate customizations
- * Thomas Cicognani (Soft-Maint) - Bug 442714 - New toolbar action to show/hide eContainer link
- */
-package org.eclipse.modisco.infra.browser.editor.ui.internal.handlers;
-
-import java.util.List;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.emf.facet.custom.core.ICustomizationManager;
-import org.eclipse.emf.facet.custom.core.ICustomizationManagerProvider;
-import org.eclipse.emf.facet.efacet.core.IFacetManager;
-import org.eclipse.emf.facet.efacet.core.IFacetSetCatalogManager;
-import org.eclipse.emf.facet.efacet.core.IFacetSetCatalogManagerFactory;
-import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-/**
- * Abstract Handler to manage menu toolbar shortcuts. These shortcuts allow
- * users to (des)activate facet sets (customizations are facet sets). If you
- * want to create a menu shortcut, your Handler must extends this class
- */
-public abstract class AbstractFacetSetActivatorHandler extends AbstractHandler {
-
- /**
- * Execute the Handler
- *
- * @param event
- * The execution event that contains the application context
- * @param facetSetID
- * ID of the facet set linked to this Handler
- * @return the result of the execution. Reserved for future use, can be
- * null.
- * @throws ExecutionException
- */
- protected static Object execute(final ExecutionEvent event,
- final String facetSetID) throws ExecutionException {
- final boolean toggle = HandlerUtil.toggleCommandState(event
- .getCommand());
- final IWorkbenchPart activePart = HandlerUtil.getActivePart(event);
- if (activePart != null) {
- final ICustomizationManagerProvider customMgrProvider = (ICustomizationManagerProvider) activePart
- .getAdapter(ICustomizationManagerProvider.class);
- if (customMgrProvider != null) {
- execute(facetSetID, toggle, customMgrProvider);
- }
- }
- return null;
- }
-
- private static void execute(final String facetSetID, final boolean toggle,
- final ICustomizationManagerProvider customMgrProvider) {
- final ICustomizationManager manager = customMgrProvider
- .getCustomizationManager();
-
- final IFacetSetCatalogManager catalog = IFacetSetCatalogManagerFactory.DEFAULT
- .getOrCreateFacetSetCatalogManager(manager.getResourceSet());
-
- FacetSet facetSetToActive = null;
- for (FacetSet facetSet : catalog.getRegisteredFacetSets()) {
- if (facetSetID.equals(facetSet.getName())) {
- facetSetToActive = facetSet;
- break;
- }
- }
- if (facetSetToActive != null) {
- final IFacetManager facetManager = manager.getFacetManager();
- final List<FacetSet> managedFacetSets = facetManager
- .getManagedFacetSets();
- if (toggle) {
- managedFacetSets.remove(facetSetToActive);
- } else {
- if (!managedFacetSets.contains(facetSetToActive)) {
- managedFacetSets.add(0, facetSetToActive);
- }
- }
- }
- }
-
-}
diff --git a/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/handlers/AbstractFacetSetActivatorToggleState.java b/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/handlers/AbstractFacetSetActivatorToggleState.java
deleted file mode 100644
index a370820b9..000000000
--- a/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/handlers/AbstractFacetSetActivatorToggleState.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/**
- * Copyright (c) 2014 Soft-Maint.
- * 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:
- * Thomas Cicognani (Soft-Maint) - Bug 442257 - New toolbar actions to (des)activate customizations
- * Thomas Cicognani (Soft-Maint) - Bug 442714 - New toolbar action to show/hide eContainer link
- */
-package org.eclipse.modisco.infra.browser.editor.ui.internal.handlers;
-
-import java.util.List;
-
-import org.eclipse.emf.facet.efacet.core.IFacetManager;
-import org.eclipse.emf.facet.efacet.core.IFacetManagerListener;
-import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet;
-import org.eclipse.jface.commands.ToggleState;
-import org.eclipse.modisco.infra.browser.editor.ui.internal.editor.TreeEditor;
-import org.eclipse.ui.IPartListener;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * Abstract ToggleState to manage menu toolbar shortcuts. These shortcuts allow
- * users to (des)activate facet sets (customizations are facet sets). If you
- * want to create a menu shortcut, your ToggleState must extends this class
- */
-public abstract class AbstractFacetSetActivatorToggleState extends ToggleState {
-
- private final IPartListener partListener;
- private final IFacetManagerListener facetMgrListener;
-
- private IFacetManager facetManager;
- private final String facetSetID;
-
- protected AbstractFacetSetActivatorToggleState(final String facetSetID) {
- /*
- * No persistence and initialized to FALSE (unchecked button)
- */
- super();
- setShouldPersist(false);
- setValue(Boolean.FALSE);
- this.facetSetID = facetSetID;
- this.partListener = new IPartListener() {
- public void partOpened(final IWorkbenchPart part) {
- // DO NOTHING
- }
-
- public void partDeactivated(final IWorkbenchPart part) {
- // DO NOTHING
- }
-
- public void partClosed(final IWorkbenchPart part) {
- // DO NOTHING
- }
-
- public void partBroughtToTop(final IWorkbenchPart part) {
- // DO NOTHING
- }
-
- public void partActivated(final IWorkbenchPart part) {
- AbstractFacetSetActivatorToggleState.this.partActivated(part);
- }
- };
-
- this.facetMgrListener = new IFacetManagerListener() {
- public void facetManagerChanged() {
- changeToggleState();
- }
- };
- }
-
- protected void partActivated(final IWorkbenchPart part) {
- if (part instanceof TreeEditor) {
- final TreeEditor treeEditor = (TreeEditor) part;
- this.facetManager = treeEditor.getFacetManager();
- this.facetManager.removeListener(this.facetMgrListener);
- this.facetManager.addListener(this.facetMgrListener);
- changeToggleState();
- }
- }
-
- /**
- * Check if the facet set linked to this ToogleState is activated. If so,
- * the ToggleState is checked
- */
- protected void changeToggleState() {
- final List<FacetSet> facetSets = this.facetManager
- .getManagedFacetSets();
- for (FacetSet facetSet : facetSets) {
- if (this.facetSetID.equals(facetSet.getName())) {
- setValue(Boolean.TRUE);
- break;
- } else if (!this.getValue().equals(Boolean.FALSE)) {
- setValue(Boolean.FALSE);
- }
- }
- }
-
- @Override
- public Object getValue() {
- /*
- * Add a listener which changes all ToggleStates when user changes the
- * activated editor
- */
- final IWorkbenchWindow window = PlatformUI.getWorkbench()
- .getActiveWorkbenchWindow();
- if (window != null) {
- final IWorkbenchPage activePage = window.getActivePage();
- if (activePage != null) {
- activePage.removePartListener(this.partListener);
- activePage.addPartListener(this.partListener);
- }
- }
- return super.getValue();
- }
-
-}
diff --git a/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/handlers/EContainerHandler.java b/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/handlers/EContainerHandler.java
deleted file mode 100644
index bc43f0e84..000000000
--- a/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/handlers/EContainerHandler.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/**
- * Copyright (c) 2014 Soft-Maint.
- * 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:
- * Thomas Cicognani (Soft-Maint) - Bug 442714 - New toolbar action to show/hide eContainer link
- */
-package org.eclipse.modisco.infra.browser.editor.ui.internal.handlers;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-
-public class EContainerHandler extends AbstractFacetSetActivatorHandler {
-
- private static final String FACET_SET_ID = "org.eclipse.emf.facet.ecore.econtainer"; //$NON-NLS-1$
-
- public Object execute(final ExecutionEvent event) throws ExecutionException {
- return execute(event, FACET_SET_ID);
- }
-
-}
diff --git a/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/handlers/EContainerToggleState.java b/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/handlers/EContainerToggleState.java
deleted file mode 100644
index 065a3efc7..000000000
--- a/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/handlers/EContainerToggleState.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/**
- * Copyright (c) 2014 Soft-Maint.
- * 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:
- * Thomas Cicognani (Soft-Maint) - Bug 442714 - New toolbar action to show/hide eContainer link
- */
-package org.eclipse.modisco.infra.browser.editor.ui.internal.handlers;
-
-public class EContainerToggleState extends AbstractFacetSetActivatorToggleState {
-
- private static final String FACET_SET_ID = "org.eclipse.emf.facet.ecore.econtainer"; //$NON-NLS-1$
-
- public EContainerToggleState() {
- super(FACET_SET_ID);
- }
-
-}
diff --git a/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/handlers/HideDerivedReferencesHandler.java b/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/handlers/HideDerivedReferencesHandler.java
deleted file mode 100644
index b8cee442d..000000000
--- a/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/handlers/HideDerivedReferencesHandler.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/**
- * Copyright (c) 2015 Soft-Maint.
- * 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:
- * Thomas Cicognani (Soft-Maint) - Bug 470962 - Add shortcuts to activate customs
- */
-package org.eclipse.modisco.infra.browser.editor.ui.internal.handlers;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-
-public class HideDerivedReferencesHandler extends
- AbstractFacetSetActivatorHandler {
-
- private static final String CUSTOM_ID = "org.eclipse.modisco.infra.browser.ecore.core.hideDerivedReferences"; //$NON-NLS-1$
-
- public Object execute(final ExecutionEvent event) throws ExecutionException {
- return execute(event, CUSTOM_ID);
- }
-
-}
diff --git a/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/handlers/HideDerivedReferencesToggleState.java b/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/handlers/HideDerivedReferencesToggleState.java
deleted file mode 100644
index b62402526..000000000
--- a/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/handlers/HideDerivedReferencesToggleState.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/**
- * Copyright (c) 2015 Soft-Maint.
- * 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:
- * Thomas Cicognani (Soft-Maint) - Bug 470962 - Add shortcuts to activate customs
- */
-package org.eclipse.modisco.infra.browser.editor.ui.internal.handlers;
-
-public class HideDerivedReferencesToggleState extends
- AbstractFacetSetActivatorToggleState {
-
- private static final String CUSTOM_ID = "org.eclipse.modisco.infra.browser.ecore.core.hideDerivedReferences"; //$NON-NLS-1$
-
- public HideDerivedReferencesToggleState() {
- super(CUSTOM_ID);
- }
-
-}
diff --git a/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/handlers/HideEmptyReferencesHandler.java b/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/handlers/HideEmptyReferencesHandler.java
deleted file mode 100644
index b026ddfc5..000000000
--- a/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/handlers/HideEmptyReferencesHandler.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/**
- * Copyright (c) 2015 Soft-Maint.
- * 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:
- * Thomas Cicognani (Soft-Maint) - Bug 470962 - Add shortcuts to activate customs
- */
-package org.eclipse.modisco.infra.browser.editor.ui.internal.handlers;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-
-public class HideEmptyReferencesHandler extends
- AbstractFacetSetActivatorHandler {
-
- private static final String CUSTOM_ID = "org.eclipse.modisco.infra.browser.ecore.core.hideEmptyReferences"; //$NON-NLS-1$
-
- public Object execute(final ExecutionEvent event) throws ExecutionException {
- return execute(event, CUSTOM_ID);
- }
-
-}
diff --git a/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/handlers/HideEmptyReferencesToggleState.java b/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/handlers/HideEmptyReferencesToggleState.java
deleted file mode 100644
index e8bfcadba..000000000
--- a/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/handlers/HideEmptyReferencesToggleState.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/**
- * Copyright (c) 2015 Soft-Maint.
- * 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:
- * Thomas Cicognani (Soft-Maint) - Bug 470962 - Add shortcuts to activate customs
- */
-package org.eclipse.modisco.infra.browser.editor.ui.internal.handlers;
-
-public class HideEmptyReferencesToggleState extends
- AbstractFacetSetActivatorToggleState {
-
- private static final String CUSTOM_ID = "org.eclipse.modisco.infra.browser.ecore.core.hideEmptyReferences"; //$NON-NLS-1$
-
- public HideEmptyReferencesToggleState() {
- super(CUSTOM_ID);
- }
-
-}
diff --git a/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/handlers/HierarchicalEClassCustomHandler.java b/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/handlers/HierarchicalEClassCustomHandler.java
deleted file mode 100644
index 7119388ef..000000000
--- a/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/handlers/HierarchicalEClassCustomHandler.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/**
- * Copyright (c) 2015 Soft-Maint.
- * 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:
- * Thomas Cicognani (Soft-Maint) - Bug 471597 - [New Browser] Add a customization to display subclasses from an EClass
- */
-package org.eclipse.modisco.infra.browser.editor.ui.internal.handlers;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-
-public class HierarchicalEClassCustomHandler extends
- AbstractFacetSetActivatorHandler {
-
- private static final String CUSTOM_ID = "org.eclipse.modisco.infra.browser.ecore.core.hierarchicalEClass.custom"; //$NON-NLS-1$
-
- public Object execute(final ExecutionEvent event) throws ExecutionException {
- return execute(event, CUSTOM_ID);
- }
-
-}
diff --git a/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/handlers/HierarchicalEClassCustomToggleState.java b/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/handlers/HierarchicalEClassCustomToggleState.java
deleted file mode 100644
index 820d6d44e..000000000
--- a/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/handlers/HierarchicalEClassCustomToggleState.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/**
- * Copyright (c) 2015 Soft-Maint.
- * 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:
- * Thomas Cicognani (Soft-Maint) - Bug 471597 - [New Browser] Add a customization to display subclasses from an EClass
- */
-package org.eclipse.modisco.infra.browser.editor.ui.internal.handlers;
-
-public class HierarchicalEClassCustomToggleState extends
- AbstractFacetSetActivatorToggleState {
-
- private static final String CUSTOM_ID = "org.eclipse.modisco.infra.browser.ecore.core.hierarchicalEClass.custom"; //$NON-NLS-1$
-
- public HierarchicalEClassCustomToggleState() {
- super(CUSTOM_ID);
- }
-
-}
diff --git a/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/handlers/HierarchicalEClassFacetHandler.java b/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/handlers/HierarchicalEClassFacetHandler.java
deleted file mode 100644
index ed45828c9..000000000
--- a/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/handlers/HierarchicalEClassFacetHandler.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/**
- * Copyright (c) 2015 Soft-Maint.
- * 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:
- * Thomas Cicognani (Soft-Maint) - Bug 471597 - [New Browser] Add a customization to display subclasses from an EClass
- */
-package org.eclipse.modisco.infra.browser.editor.ui.internal.handlers;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-
-public class HierarchicalEClassFacetHandler extends
- AbstractFacetSetActivatorHandler {
-
- private static final String FACET_ID = "org.eclipse.modisco.infra.browser.ecore.core.hierarchicalEClass.facet"; //$NON-NLS-1$
-
- public Object execute(final ExecutionEvent event) throws ExecutionException {
- return execute(event, FACET_ID);
- }
-
-}
diff --git a/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/handlers/HierarchicalEClassFacetToggleState.java b/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/handlers/HierarchicalEClassFacetToggleState.java
deleted file mode 100644
index cf501e774..000000000
--- a/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/handlers/HierarchicalEClassFacetToggleState.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/**
- * Copyright (c) 2015 Soft-Maint.
- * 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:
- * Thomas Cicognani (Soft-Maint) - Bug 471597 - [New Browser] Add a customization to display subclasses from an EClass
- */
-package org.eclipse.modisco.infra.browser.editor.ui.internal.handlers;
-
-public class HierarchicalEClassFacetToggleState extends
- AbstractFacetSetActivatorToggleState {
-
- private static final String CUSTOM_ID = "org.eclipse.modisco.infra.browser.ecore.core.hierarchicalEClass.facet"; //$NON-NLS-1$
-
- public HierarchicalEClassFacetToggleState() {
- super(CUSTOM_ID);
- }
-
-}
diff --git a/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/handlers/LinksCountHandler.java b/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/handlers/LinksCountHandler.java
deleted file mode 100644
index 7b3ab34a1..000000000
--- a/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/handlers/LinksCountHandler.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/**
- * Copyright (c) 2014 Soft-Maint.
- * 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:
- * Thomas Cicognani (Soft-Maint) - Bug 442257 - New toolbar actions to (des)activate customizations
- * Thomas Cicognani (Soft-Maint) - Bug 442714 - New toolbar action to show/hide eContainer link
- */
-package org.eclipse.modisco.infra.browser.editor.ui.internal.handlers;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-
-public class LinksCountHandler extends AbstractFacetSetActivatorHandler {
-
- private static final String CUSTOM_ID = "org.eclipse.modisco.infra.browser.ecore.core.linksCount"; //$NON-NLS-1$
-
- public Object execute(final ExecutionEvent event) throws ExecutionException {
- return execute(event, CUSTOM_ID);
- }
-
-}
diff --git a/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/handlers/LinksCountState.java b/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/handlers/LinksCountState.java
deleted file mode 100644
index dd3c54293..000000000
--- a/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/handlers/LinksCountState.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/**
- * Copyright (c) 2014 Soft-Maint.
- * 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:
- * Thomas Cicognani (Soft-Maint) - Bug 442257 - New toolbar actions to (des)activate customizations
- * Thomas Cicognani (Soft-Maint) - Bug 442714 - New toolbar action to show/hide eContainer link
- */
-package org.eclipse.modisco.infra.browser.editor.ui.internal.handlers;
-
-public class LinksCountState extends AbstractFacetSetActivatorToggleState {
-
- private static final String CUSTOM_ID = "org.eclipse.modisco.infra.browser.ecore.core.linksCount"; //$NON-NLS-1$
-
- public LinksCountState() {
- super(CUSTOM_ID);
- }
-
-}
diff --git a/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/handlers/LoadCustomShortcutsMenu.java b/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/handlers/LoadCustomShortcutsMenu.java
new file mode 100644
index 000000000..24f5430b7
--- /dev/null
+++ b/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/handlers/LoadCustomShortcutsMenu.java
@@ -0,0 +1,24 @@
+/**
+ * Copyright (c) 2015 Mia-Software.
+ * 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:
+ * Thomas Cicognani (Mia-Software) - Bug 470962 - Add shortcuts to activate customs
+ */
+package org.eclipse.modisco.infra.browser.editor.ui.internal.handlers;
+
+import org.eclipse.emf.facet.custom.ui.LoadCustomShortcutsMenuUtils;
+import org.eclipse.jface.action.IContributionItem;
+import org.eclipse.ui.actions.CompoundContributionItem;
+
+public class LoadCustomShortcutsMenu extends CompoundContributionItem {
+
+ @Override
+ protected IContributionItem[] getContributionItems() {
+ return LoadCustomShortcutsMenuUtils.getCustomItemsFromCurrentEditor();
+ }
+
+}
diff --git a/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/handlers/LoadFacetSetShortcutsMenu.java b/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/handlers/LoadFacetSetShortcutsMenu.java
new file mode 100644
index 000000000..4ac1e9b48
--- /dev/null
+++ b/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/handlers/LoadFacetSetShortcutsMenu.java
@@ -0,0 +1,25 @@
+/**
+ * Copyright (c) 2015 Mia-Software.
+ * 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:
+ * Thomas Cicognani (Mia-Software) - Bug 470962 - Add shortcuts to activate customs
+ */
+package org.eclipse.modisco.infra.browser.editor.ui.internal.handlers;
+
+import org.eclipse.emf.facet.efacet.ui.LoadFacetSetShortcutsMenuUtils;
+import org.eclipse.jface.action.IContributionItem;
+import org.eclipse.ui.actions.CompoundContributionItem;
+
+public class LoadFacetSetShortcutsMenu extends CompoundContributionItem {
+
+ @Override
+ protected IContributionItem[] getContributionItems() {
+ return LoadFacetSetShortcutsMenuUtils
+ .getFacetSetItemsFromCurrentEditor();
+ }
+
+}
diff --git a/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/messages.properties b/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/messages.properties
index 9c89214ec..0b64a2345 100644
--- a/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/messages.properties
+++ b/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/messages.properties
@@ -7,5 +7,9 @@
# Contributors:
# Gregoire Dupe (Mia-Software) - Bug 358914 - [Move to EMF Facet][Browser] Switch to EMF Facet
# Thomas Cicognani (Soft-Maint) - Bug 442800 - API to open new MoDisco Browser
+# Thomas Cicognani (Mia-Software) - Bug 470962 - Add shortcuts to activate customs
#
ResourceBrowserOpener_MoDiscoDefaultTreeBrowser=MoDisco Model Browser V2
+TreeEditorShortcutUtils_CustomHideDerivedReferences=Hide Derived References
+TreeEditorShortcutUtils_CustomHideEmptyReferences=Hide Empty References
+TreeEditorShortcutUtils_CustomShowLinksCount=Show Links Count

Back to the top