Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian W. Damus2015-11-24 21:26:11 +0000
committerGerrit Code Review @ Eclipse.org2015-11-26 19:57:19 +0000
commit50c6b2c7f4b90cdfd1272d9d049decdcfa8c33c5 (patch)
treeb7482ee723eca18081d06c408ebc2a031a91cdef /plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties
parent50d72f8ec11d7157ce700a1e7744d6bbc8b35b99 (diff)
downloadorg.eclipse.papyrus-50c6b2c7f4b90cdfd1272d9d049decdcfa8c33c5.tar.gz
org.eclipse.papyrus-50c6b2c7f4b90cdfd1272d9d049decdcfa8c33c5.tar.xz
org.eclipse.papyrus-50c6b2c7f4b90cdfd1272d9d049decdcfa8c33c5.zip
Bug 482927: [Properties] Customization context models should have UI labels
https://bugs.eclipse.org/bugs/show_bug.cgi?id=482927 Add an optional 'label' attribute to the Context class and a derived 'userLabel' that is the 'label' if present, otherwise the 'name'. Use the new derived user label wherever appropriate in the UI: in progress monitors, informational dialogs, and especially the preference pages. In the "Property view" preference page, sort contexts by user label. Update existing context models to provide user-friendly labels.
Diffstat (limited to 'plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties')
-rw-r--r--plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/preferences/Preferences.java18
-rw-r--r--plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/runtime/ConfigurationConflict.java5
2 files changed, 20 insertions, 3 deletions
diff --git a/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/preferences/Preferences.java b/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/preferences/Preferences.java
index df45283b98f..8ee8990fe2e 100644
--- a/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/preferences/Preferences.java
+++ b/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/preferences/Preferences.java
@@ -9,10 +9,13 @@
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
* Christian W. Damus - bug 482930
+ * Christian W. Damus - bug 482927
*****************************************************************************/
package org.eclipse.papyrus.views.properties.preferences;
import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -67,6 +70,7 @@ public class Preferences extends PreferencePage implements IWorkbenchPreferenceP
// Only customizable Property view contexts should appear here
List<Context> contexts = new java.util.ArrayList<Context>(configurationManager.getCustomizableContexts());
contexts.addAll(configurationManager.getMissingContexts());
+ Collections.sort(contexts, contextOrdering());
for (Context context : contexts) {
boolean applied = configurationManager.isApplied(context);
@@ -97,6 +101,18 @@ public class Preferences extends PreferencePage implements IWorkbenchPreferenceP
return null;
}
+ protected Comparator<? super Context> contextOrdering() {
+ return Comparator.comparingInt(this::getCategory).thenComparing(
+ Comparator.comparing(Context::getUserLabel));
+ }
+
+ protected int getCategory(Context context) {
+ ConfigurationManager mgr = ConfigurationManager.getInstance();
+ return mgr.isCustomizable(context)
+ ? mgr.isPlugin(context) ? 0 : 1
+ : 1000;
+ }
+
@Override
public boolean performOk() {
return contextState.saveContext() && super.performOk();
@@ -130,7 +146,7 @@ public class Preferences extends PreferencePage implements IWorkbenchPreferenceP
qualifier = Messages.Preferences_Custom;
}
- return String.format("%s (%s)", context.getName(), qualifier); //$NON-NLS-1$
+ return String.format("%s (%s)", context.getUserLabel(), qualifier); //$NON-NLS-1$
}
private final ContextState contextState = new ContextState();
diff --git a/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/runtime/ConfigurationConflict.java b/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/runtime/ConfigurationConflict.java
index 0f16f17b0e2..2e692ec6ae1 100644
--- a/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/runtime/ConfigurationConflict.java
+++ b/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/runtime/ConfigurationConflict.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
+ * Copyright (c) 2011, 2015 CEA LIST, Christian W. Damus, and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,6 +8,7 @@
*
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ * Christian W. Damus - bug 482927
*****************************************************************************/
package org.eclipse.papyrus.views.properties.runtime;
@@ -60,7 +61,7 @@ public class ConfigurationConflict {
public String toString() {
String result = sectionID + " : "; //$NON-NLS-1$
for (Context context : conflictingContexts) {
- result += context.getName() + ", "; //$NON-NLS-1$
+ result += context.getUserLabel() + ", "; //$NON-NLS-1$
}
return result.substring(0, result.length() - 2);
}

Back to the top