Author: scabanovich
Date: 2009-10-09 07:48:22 -0400 (Fri, 09 Oct 2009)
New Revision: 18004
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/action/impl/SpecialWizardSupport.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/key/WizardKeys.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-5000
More sophisticated way to get window title (like that for menu items) is implemented.
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/action/impl/SpecialWizardSupport.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/action/impl/SpecialWizardSupport.java 2009-10-09
10:58:22 UTC (rev 18003)
+++
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/action/impl/SpecialWizardSupport.java 2009-10-09
11:48:22 UTC (rev 18004)
@@ -86,6 +86,8 @@
public String getTitle() {
String title = WizardKeys.getHeader(getHelpKey());
if(title != null) return title;
+ title = WizardKeys.getHeader(action, getEntityData()[0].getModelEntity()); // no
step id
+ if(title != null) return title;
String n = (action == null) ? "" : "" + action.getDisplayName();
//$NON-NLS-1$ //$NON-NLS-2$
if(n.endsWith("...")) n = n.substring(0, n.length() - 3); //$NON-NLS-1$
return n;
@@ -98,6 +100,9 @@
String key1 = key.substring(0, key.length() - 2);
t = WizardKeys.getTitle(key1);
}
+ if(t == null) {
+ t = WizardKeys.getTitle(action, getEntityData()[0].getModelEntity()); // no step
id
+ }
return t;
}
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/key/WizardKeys.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/key/WizardKeys.java 2009-10-09
10:58:22 UTC (rev 18003)
+++
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/key/WizardKeys.java 2009-10-09
11:48:22 UTC (rev 18004)
@@ -147,21 +147,52 @@
* @return
*/
public static String getMenuItemDisplayName(XActionItem item, XModelEntity entity) {
+ String s = getDisplayValue(item, entity, ".", ".menu");
//$NON-NLS-1$ //$NON-NLS-2$
+ if(s != null) return s;
+ return item.getDisplayName();
+ }
+
+ public static String getHeader(XActionItem item, XModelEntity entity) {
+ String s = getDisplayValue(item, entity, "_", ".WindowTitle");
//$NON-NLS-1$ //$NON-NLS-2$
+ if(s != null) return s;
+ return item.getDisplayName();
+ }
+
+ public static String getTitle(XActionItem item, XModelEntity entity) {
+ String s = getDisplayValue(item, entity, "_", ".Title");
//$NON-NLS-1$ //$NON-NLS-2$
+ if(s != null) return s;
+ return item.getDisplayName();
+ }
+
+ /**
+ * Display value for action item generated for meta declaration of action item.
+ * Several keys are checked in resources, the first found key is used.
+ * 1) Entity specific: %Entity name% %separator% %Item name% %prefix%
+ * 2) Module specific: %Module name% %separator% %Item name% %prefix%
+ * 3) Global: %Item name% %prefix%
+ * If no key is found, null is returned.
+ *
+ * @param item
+ * @param entity
+ * @return
+ */
+ public static String getDisplayValue(XActionItem item, XModelEntity entity, String
separator, String suffix) {
if(entity != null) {
- String key = entity.getName() + "." + item.getName() + ".menu";
//$NON-NLS-1$ //$NON-NLS-2$
+ String key = entity.getName() + separator + item.getName() + suffix;
String s = keys.getProperty(key);
if(s != null) return s;
- key = entity.getModule() + "." + item.getName() + ".menu";
//$NON-NLS-1$ //$NON-NLS-2$
+ key = entity.getModule() + "." + item.getName() + suffix; //$NON-NLS-1$
s = keys.getProperty(key);
if(s != null) return s;
}
- String key = item.getName() + ".menu"; //$NON-NLS-1$
+ String key = item.getName() + suffix;
String s = keys.getProperty(key);
if(s != null) return s;
- return item.getDisplayName();
+ return null;
}
+
public static String getVisualListValue(XAttribute attr, String value) {
if(attr == null || value == null || value.length() == 0) return value;
String keyPart = toKey(value);