Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenoit Maggi2016-12-16 13:04:06 +0000
committerGerrit Code Review @ Eclipse.org2017-01-03 15:26:36 +0000
commitaf4d73d59c3a8593ce43950e67b404fbccf13669 (patch)
tree8a9ec70f84bd681b2f42d73ad355e45a6642f298 /plugins/views/modelexplorer
parentf9943b0e1c05b80168047b396578186da74c203d (diff)
downloadorg.eclipse.papyrus-af4d73d59c3a8593ce43950e67b404fbccf13669.tar.gz
org.eclipse.papyrus-af4d73d59c3a8593ce43950e67b404fbccf13669.tar.xz
org.eclipse.papyrus-af4d73d59c3a8593ce43950e67b404fbccf13669.zip
Bug 509346 - [Facet] Order of loaded facet should be saved
- store the facet in an Array - reload the facet order - remove very old commented code Change-Id: I199d824a3cccc8ebee26a139b5ee22648ca47815 Signed-off-by: Benoit Maggi <benoit.maggi@cea.fr>
Diffstat (limited to 'plugins/views/modelexplorer')
-rw-r--r--plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/LoadBrowserCustomization.java129
1 files changed, 5 insertions, 124 deletions
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/LoadBrowserCustomization.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/LoadBrowserCustomization.java
index 21409f56a11..8cf0fbd2a1f 100644
--- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/LoadBrowserCustomization.java
+++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/LoadBrowserCustomization.java
@@ -9,7 +9,7 @@
* Contributors:
* Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
* Christian W. Damus - bug 485220
- *
+ * Benoit Maggi - Bug 509346
*****************************************************************************/
package org.eclipse.papyrus.views.modelexplorer.handler;
@@ -23,13 +23,6 @@ import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;
-//import org.eclipse.papyrus.emf.facet.infra.browser.Messages;
-//import org.eclipse.papyrus.emf.facet.infra.browser.custom.MetamodelView;
-//import org.eclipse.papyrus.emf.facet.infra.browser.custom.TypeView;
-//import org.eclipse.papyrus.emf.facet.infra.browser.uicore.CustomizationManager;
-//import org.eclipse.papyrus.emf.facet.infra.facet.Facet;
-//import org.eclipse.papyrus.emf.facet.infra.facet.FacetSet;
-//import org.eclipse.papyrus.emf.facet.infra.facet.core.FacetSetCatalog;
import org.eclipse.jface.window.Window;
import org.eclipse.papyrus.emf.facet.custom.core.ICustomizationCatalogManagerFactory;
import org.eclipse.papyrus.emf.facet.custom.core.ICustomizationManager;
@@ -38,8 +31,6 @@ import org.eclipse.papyrus.emf.facet.custom.ui.internal.exported.dialog.ILoadCus
import org.eclipse.papyrus.emf.facet.custom.ui.internal.exported.dialog.ILoadCustomizationsDialogFactory;
import org.eclipse.papyrus.emf.facet.util.ui.internal.exported.dialog.IDialogCallback;
import org.eclipse.papyrus.emf.facet.util.ui.internal.exported.dialog.IDialogCallbackWithPreCommit;
-import org.eclipse.papyrus.infra.core.resource.ModelSet;
-import org.eclipse.papyrus.infra.core.resource.ModelUtils;
import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager;
import org.eclipse.papyrus.infra.core.services.ServiceException;
import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
@@ -47,7 +38,6 @@ import org.eclipse.papyrus.infra.core.utils.ServiceUtils;
import org.eclipse.papyrus.infra.services.semantic.service.SemanticService;
import org.eclipse.papyrus.views.modelexplorer.Activator;
import org.eclipse.papyrus.views.modelexplorer.ModelExplorerPageBookView;
-import org.eclipse.papyrus.views.modelexplorer.dialog.PapyrusLoadBrowserCustomizationDialog;
import org.eclipse.swt.widgets.Dialog;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IViewPart;
@@ -71,7 +61,7 @@ public class LoadBrowserCustomization extends AbstractHandler {
if (part instanceof ModelExplorerPageBookView) {
IViewPart page = ((ModelExplorerPageBookView) part).getActiveView();
if (page instanceof CommonNavigator) {
- return ((CommonNavigator) page);
+ return (CommonNavigator) page;
}
}
return null;
@@ -82,26 +72,19 @@ public class LoadBrowserCustomization extends AbstractHandler {
*/
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
-
if (Activator.getDefault().getCustomizationManager() != null) {
ICustomizationManager customizationManager = Activator.getDefault().getCustomizationManager();
final List<Customization> registeredCustomizations = ICustomizationCatalogManagerFactory.DEFAULT.getOrCreateCustomizationCatalogManager(customizationManager.getResourceSet()).getRegisteredCustomizations();
- PapyrusLoadBrowserCustomizationDialog loadCustomizationsDialog;
-
-
Shell shell = HandlerUtil.getActiveShell(event);
IDialogCallbackWithPreCommit<List<Customization>, Boolean, Dialog> dialogCallBack = new IDialogCallbackWithPreCommit<List<Customization>, Boolean, Dialog>() {
@Override
public void committed(List<Customization> result, Boolean precommitResult) {
- // TODO Auto-generated method stub
-
}
@Override
public Dialog openPrecommitDialog(List<Customization> result, IDialogCallback<Boolean> precommitCallback) {
- // TODO Auto-generated method stub
return null;
}
};
@@ -110,14 +93,11 @@ public class LoadBrowserCustomization extends AbstractHandler {
if (Window.OK == dialog.open()) {
customizationManager.getManagedCustomizations().clear();
customizationManager.getManagedCustomizations().addAll(dialog.getSelectedCustomizations());
-
-
// Save the current state of the customizations
org.eclipse.papyrus.infra.ui.internal.emf.Activator.getDefault().saveCustomizationManagerState();
}
- // // load customizations defined as default through the customization
- // // extension
+ // load customizations defined as default through the customization extension
if (getCommonNavigator() != null) {
getCommonNavigator().getCommonViewer().refresh();
}
@@ -126,87 +106,9 @@ public class LoadBrowserCustomization extends AbstractHandler {
return null;
}
- /**
- *
- * @return the RessourceSet
- */
- private ModelSet getModelSet() {
- return ModelUtils.getModelSet();
- }
-
- // /**
- // * load the facets
- // *
- // * @param customizations
- // * list of customization
- // * @param customizationManager
- // * the Customization Manager
- // */
- // protected void loadFacetsForCustomizations(final List<MetamodelView> customizations, final CustomizationManager customizationManager) {
- // final Set<Facet> referencedFacets = new HashSet<Facet>();
- // final Collection<FacetSet> facetSets = FacetSetCatalog.getSingleton().getAllFacetSets();
- //
- // for(MetamodelView customization : customizations) {
- // String metamodelURI = customization.getMetamodelURI();
- // // find customized FacetSet
- // FacetSet customizedFacetSet = null;
- // if(metamodelURI != null) {
- // for(FacetSet facetSet : facetSets) {
- // if(metamodelURI.equals(facetSet.getNsURI())) {
- // customizedFacetSet = facetSet;
- // break;
- // }
- // }
- // }
- // if(customizedFacetSet == null) {
- // continue;
- // }
- //
- // // find customized Facets
- // EList<TypeView> types = customization.getTypes();
- // for(TypeView typeView : types) {
- // String metaclassName = typeView.getMetaclassName();
- // Facet facet = findFacetWithFullyQualifiedName(metaclassName, customizedFacetSet);
- // if(facet != null) {
- // referencedFacets.add(facet);
- // } else {
- // Activator.log.warn(NLS.bind(Messages.BrowserActionBarContributor_missingRequiredFacet, new Object[]{ metaclassName, customizedFacetSet.getName(), customization.getName() }));
- // }
- // }
- //
- // for(Facet referencedFacet : referencedFacets) {
- // customizationManager.loadFacet(referencedFacet);
- // }
- // }
-
- //
- // for modified facets
- // customizationManager.getInstancesForMetaclasses().buildDerivationTree();
- // customizationManager.getAppearanceConfiguration().touch();
- // customizationManager.refreshDelayed(true);
- // }
-
- // /**
- // * fin a facet from
- // *
- // * @param metaclassName
- // * @param customizedFacetSet
- // * @return
- // */
- // private Facet findFacetWithFullyQualifiedName(final String metaclassName, final FacetSet customizedFacetSet) {
- // EList<Facet> facets = customizedFacetSet.getFacets();
- // for(Facet facet : facets) {
- // String facetName = getMetaclassQualifiedName(facet);
- // if(metaclassName.equals(facetName)) {
- // return facet;
- // }
- // }
- // return null;
- // }
-
/** @return the qualified name of the given metaclass */
public static String getMetaclassQualifiedName(final EClassifier eClass) {
- final ArrayList<String> qualifiedNameParts = new ArrayList<String>();
+ final ArrayList<String> qualifiedNameParts = new ArrayList<>();
final StringBuilder builder = new StringBuilder();
EPackage ePackage = eClass.getEPackage();
@@ -224,32 +126,11 @@ public class LoadBrowserCustomization extends AbstractHandler {
return builder.toString();
}
- // /**
- // * Get the metmodel URI
- // * **/
- // @Unused
- // private String getMetamodelURI() {
- //
- // try {
- // EList<EObject> contents = UmlUtils.getUmlResource(getModelSet()).getContents();
- // if(contents.size() > 0) {
- // EObject eObject = contents.get(0);
- // EClass eClass = eObject.eClass();
- // if(eClass != null) {
- // return eClass.getEPackage().getNsURI();
- // }
- // }
- // } catch (Exception e) {
- // Activator.log.error(e);
- // }
- // return ""; //$NON-NLS-1$
- // }
-
/**
* Get the metmodel URI
**/
protected List<EPackage> getMetamodels(ServicesRegistry serviceRegistry) {
- List<EPackage> ePackages = new ArrayList<EPackage>();
+ List<EPackage> ePackages = new ArrayList<>();
/*
* we look for the current editors, because their are represented in the model explorer

Back to the top