Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/infra')
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/Activator.java206
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/resources/PapyrusDiagram.custom2
2 files changed, 101 insertions, 107 deletions
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/Activator.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/Activator.java
index 726b40881f0..a466c36cd10 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/Activator.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/Activator.java
@@ -114,23 +114,24 @@ public class Activator extends AbstractUIPlugin {
* Saves the current Customization Manager settings to the preferences
*/
public void saveCustomizationManagerState() {
-// IDialogSettings dialogSettings = getBrowserCustomizationDialogSettings();
-//
-// List<MetamodelView> appliedCustomizations = getCustomizationManager().getRegisteredCustomizations();
-//
-// for(MetamodelView customization : CustomizationsCatalog.getInstance().getRegistryCustomizations()) {
-//
-// boolean isApplied = appliedCustomizations.contains(customization);
-// String settingKey = getSettingKey(customization);
-//
-// dialogSettings.put(settingKey, isApplied);
-// }
+ IDialogSettings dialogSettings = getBrowserCustomizationDialogSettings();
+ List<Customization> appliedCustomizations = getCustomizationManager().getManagedCustomizations();
+
+ final List<Customization> registeredCustomizations = ICustomizationCatalogManagerFactory.DEFAULT.getOrCreateCustomizationCatalogManager(getCustomizationManager().getResourceSet()).getRegisteredCustomizations();
+
+ for(Customization customization : registeredCustomizations) {
+
+ boolean isApplied = appliedCustomizations.contains(customization);
+ String settingKey = getSettingKey(customization);
+
+ dialogSettings.put(settingKey, isApplied);
+ }
}
private String getSettingKey(Customization customization) {
// do not exist anymore
- //return customization.getLocation();
- return "";
+ return customization.eResource().getURI().toString();
+ //return "";
}
protected IDialogSettings getBrowserCustomizationDialogSettings() {
@@ -146,10 +147,6 @@ public class Activator extends AbstractUIPlugin {
private void init(final ICustomizationManager customizationManager) {
// the appearance can be customized here:
- //customizationManager.setShowDerivedLinks(true);
- //to hide the blue arrow overlay
- //customizationManager.setDecorateExternalResources(false);
-
IDialogSettings settings = getBrowserCustomizationDialogSettings();
try {
@@ -158,29 +155,26 @@ public class Activator extends AbstractUIPlugin {
// extension
ICustomizationCatalogManager customCatalog = ICustomizationCatalogManagerFactory.DEFAULT.getOrCreateCustomizationCatalogManager(customizationManager.getResourceSet());
//no possibility to get default customization
- //List<MetamodelView> registryDefaultCustomizations = customCatalog.;
+
List<Customization> registryAllCustomizations = customCatalog.getRegisteredCustomizations();
+
+
+ for(Customization customization : registryAllCustomizations) {
+ String settingKey = getSettingKey(customization);
+
+ boolean isActive = false;
+ if(settings.get(settingKey) == null) { //Never customized
+ isActive = customization.isMustBeLoadedByDefault(); //Loaded by default
+ } else {
+ isActive = settings.getBoolean(settingKey);
+ }
+
+ if(isActive) {
+ customizationManager.getManagedCustomizations().add(customization);
+ }
+ }
+
- List<Customization> appliedCustomizations = new LinkedList<Customization>();
-//
-// for(Customization customization : registryAllCustomizations) {
-// String settingKey = getSettingKey(customization);
-//
-// boolean isActive = false;
-// if(settings.get(settingKey) == null) { //Never customized
-// isActive = registryDefaultCustomizations.contains(customization); //Loaded by default
-// } else {
-// isActive = settings.getBoolean(settingKey);
-// }
-//
-// if(isActive) {
-// customizationManager.registerCustomization(customization);
-// appliedCustomizations.add(customization);
-// }
-// }
-
-// customizationManager.loadCustomizations();
-// loadFacetsForCustomizations(appliedCustomizations, customizationManager);
} catch (Throwable e) {
Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Error initializing customizations", e)); //$NON-NLS-1$
@@ -201,13 +195,13 @@ public class Activator extends AbstractUIPlugin {
DialogSettings settings = (DialogSettings)getDialogSettings();
settings.removeSection(CUSTOMIZATION_MANAGER_SECTION);
-// List<MetamodelView> registryDefaultCustomizations = CustomizationsCatalog.getInstance().getRegistryDefaultCustomizations();
-//
-// manager.clearCustomizations();
-// for(MetamodelView customization : registryDefaultCustomizations) {
-// manager.registerCustomization(customization);
-// }
-// manager.loadCustomizations();
+ // List<MetamodelView> registryDefaultCustomizations = CustomizationsCatalog.getInstance().getRegistryDefaultCustomizations();
+ //
+ // manager.clearCustomizations();
+ // for(MetamodelView customization : registryDefaultCustomizations) {
+ // manager.registerCustomization(customization);
+ // }
+ // manager.loadCustomizations();
}
/**
@@ -218,67 +212,67 @@ public class Activator extends AbstractUIPlugin {
* @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(String.format("Missing required facet \"%s\" in FacetSet \"%s\" for customization \"%s\"", 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;
-// }
+ // 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(String.format("Missing required facet \"%s\" in FacetSet \"%s\" for customization \"%s\"", 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) {
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/resources/PapyrusDiagram.custom b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/resources/PapyrusDiagram.custom
index 9298e47f8af..550c6c7bf5f 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/resources/PapyrusDiagram.custom
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/resources/PapyrusDiagram.custom
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<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/papyrus/emf/facet/custom/0.2.incubation/custom" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:efacet="http://www.eclipse.org/papyrus/emf/facet/efacet/0.2.incubation/efacet" xmlns:javaQuery="http://www.eclipse.org/papyrus/emf/facet/query/java/0.2.incubation/javaquery" xmlns:query="http://www.eclipse.org/papyrus/emf/facet/efacet/0.2.incubation/efacet/query" name="PapyrusDiagram">
+<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/papyrus/emf/facet/custom/0.2.incubation/custom" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:efacet="http://www.eclipse.org/papyrus/emf/facet/efacet/0.2.incubation/efacet" xmlns:javaQuery="http://www.eclipse.org/papyrus/emf/facet/query/java/0.2.incubation/javaquery" xmlns:query="http://www.eclipse.org/papyrus/emf/facet/efacet/0.2.incubation/efacet/query" name="PapyrusDiagram" documentation="Display contained diagram and their icons">
<eClassifiers xsi:type="custom:EClassCustomization" name="Diagram" documentation="Representation of diagram in model explorer">
<extendedMetaclass href="http://www.eclipse.org/gmf/runtime/1.0.2/notation#//Diagram"/>
<facetOperations name="GetDiagramIcon" documentation="Return the path to the icon of the corresponding diagram">

Back to the top