Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrancois Le Fevre - CEA2015-03-24 15:41:04 +0000
committerFrancois Le Fevre2015-03-27 14:02:46 +0000
commit1cb507726fa5fe03b35ead9de52c299d24846c90 (patch)
treeeb3fec334207f8bd977d17dcce94906a3e02edfb
parentf2568b5ba276b425ee7aa597a1f09c7c4460a258 (diff)
downloadorg.eclipse.papyrus-1cb507726fa5fe03b35ead9de52c299d24846c90.tar.gz
org.eclipse.papyrus-1cb507726fa5fe03b35ead9de52c299d24846c90.tar.xz
org.eclipse.papyrus-1cb507726fa5fe03b35ead9de52c299d24846c90.zip
Bug 462641 - [General]: implement different naming strategy for quick
format button - refactoring for strategy of command - adding all default methods - name the action buttons Change-Id: If1b69baa9b75116903e7dbb8036fa406668aa914 Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=462641 Signed-off-by: Francois Le Fevre - CEA <francois.le-fevre@cea.fr>
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.modelexplorer/plugin.xml45
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.modelexplorer/src/org/eclipse/papyrus/infra/nattable/modelexplorer/actions/NattableNameNormalizationCommand.java17
-rw-r--r--plugins/infra/org.eclipse.papyrus.infra.ui/plugin.xml67
-rw-r--r--plugins/infra/org.eclipse.papyrus.infra.ui/src/main/java/org/eclipse/papyrus/infra/ui/menu/NameNormalization.java24
-rw-r--r--plugins/infra/org.eclipse.papyrus.infra.ui/src/main/java/org/eclipse/papyrus/infra/ui/menu/NameNormalizationCommand.java87
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/plugin.xml45
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/src/org/eclipse/papyrus/uml/diagram/menu/actions/DiagramNameNormalizationCommand.java18
-rw-r--r--plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer/plugin.xml45
-rw-r--r--plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer/src/org/eclipse/papyrus/uml/modelexplorer/actions/UmlNameNormalizationCommand.java15
9 files changed, 314 insertions, 49 deletions
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.modelexplorer/plugin.xml b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.modelexplorer/plugin.xml
index 9fb5aa5135b..0746ee37722 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.modelexplorer/plugin.xml
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.modelexplorer/plugin.xml
@@ -61,6 +61,51 @@
</and>
</activeWhen>
</handler>
+ <handler
+ class="org.eclipse.papyrus.infra.nattable.modelexplorer.handlers.NattableQuickFormatHandler"
+ commandId="org.eclipse.papyrus.infra.ui.menu.commands.QuickFormattingSwitchSpace2UnderscoreCommand">
+ <activeWhen>
+ <and>
+ <with
+ variable="selection">
+ <test
+ property="org.eclipse.papyrus.infra.nattable.modelexplorer.menu.quickformatpropertytester.isNameChangeable"
+ value="true">
+ </test>
+ </with>
+ </and>
+ </activeWhen>
+ </handler>
+ <handler
+ class="org.eclipse.papyrus.infra.nattable.modelexplorer.handlers.NattableQuickFormatHandler"
+ commandId="org.eclipse.papyrus.infra.ui.menu.commands.QuickFormattingCapitalizeFirstLetterCommand">
+ <activeWhen>
+ <and>
+ <with
+ variable="selection">
+ <test
+ property="org.eclipse.papyrus.infra.nattable.modelexplorer.menu.quickformatpropertytester.isNameChangeable"
+ value="true">
+ </test>
+ </with>
+ </and>
+ </activeWhen>
+ </handler>
+ <handler
+ class="org.eclipse.papyrus.infra.nattable.modelexplorer.handlers.NattableQuickFormatHandler"
+ commandId="org.eclipse.papyrus.infra.ui.menu.commands.QuickFormattingRemoveSpaceCommand">
+ <activeWhen>
+ <and>
+ <with
+ variable="selection">
+ <test
+ property="org.eclipse.papyrus.infra.nattable.modelexplorer.menu.quickformatpropertytester.isNameChangeable"
+ value="true">
+ </test>
+ </with>
+ </and>
+ </activeWhen>
+ </handler>
</extension>
<extension
point="org.eclipse.core.expressions.propertyTesters">
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.modelexplorer/src/org/eclipse/papyrus/infra/nattable/modelexplorer/actions/NattableNameNormalizationCommand.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.modelexplorer/src/org/eclipse/papyrus/infra/nattable/modelexplorer/actions/NattableNameNormalizationCommand.java
index a9d4c05a4e1..8560ed8be8f 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.modelexplorer/src/org/eclipse/papyrus/infra/nattable/modelexplorer/actions/NattableNameNormalizationCommand.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.modelexplorer/src/org/eclipse/papyrus/infra/nattable/modelexplorer/actions/NattableNameNormalizationCommand.java
@@ -14,7 +14,6 @@
package org.eclipse.papyrus.infra.nattable.modelexplorer.actions;
import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.papyrus.infra.nattable.model.nattable.nattableconfiguration.TableNamedElement;
import org.eclipse.papyrus.infra.ui.menu.NameNormalizationCommand;
@@ -39,20 +38,8 @@ public class NattableNameNormalizationCommand extends NameNormalizationCommand{
protected void doExecute() {
if(source instanceof TableNamedElement){
String name = ((TableNamedElement)source).getName();
-
- switch (parameter) {
- case UPPERCASE_ACTION:
- ((TableNamedElement)source).setName(name.toUpperCase());
- break;
- case LOWERCASE_ACTION:
- ((TableNamedElement)source).setName(name.toLowerCase());
- break;
-
- default:
- ((TableNamedElement)source).setName(name.toUpperCase());
- break;
- }
-
+ String newName = normalizeName(name,parameter);
+ ((TableNamedElement)source).setName(newName);
}
}
diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/plugin.xml b/plugins/infra/org.eclipse.papyrus.infra.ui/plugin.xml
index 9bb05a45e56..6eb3e1f4e3a 100644
--- a/plugins/infra/org.eclipse.papyrus.infra.ui/plugin.xml
+++ b/plugins/infra/org.eclipse.papyrus.infra.ui/plugin.xml
@@ -34,11 +34,11 @@
allPopups="false"
locationURI="menu:org.eclipse.papyrus.ui.menu">
<menu
- label="&amp;Quick Formatting..."
+ label="&amp;Name Edition..."
tooltip="Quick formatting for labels">
<command
commandId="org.eclipse.papyrus.infra.ui.menu.commands.QuickFormattingUpperCaseCommand"
- label="&amp;Uppercase Quick Formatting"
+ label="&amp;To apply uppercase"
style="push">
<parameter
name="org.eclipse.papyrus.infra.ui.menu.quickformatcommandParameter"
@@ -47,13 +47,40 @@
</command>
<command
commandId="org.eclipse.papyrus.infra.ui.menu.commands.QuickFormattingLowerCaseCommand"
- label="&amp;Lowercase Quick Formatting"
+ label="&amp;To apply lowercase"
style="push">
<parameter
name="org.eclipse.papyrus.infra.ui.menu.quickformatcommandParameter"
value="lowercase">
</parameter>
</command>
+ <command
+ commandId="org.eclipse.papyrus.infra.ui.menu.commands.QuickFormattingSwitchSpace2UnderscoreCommand"
+ label="&amp;To switch space and underscore"
+ style="push">
+ <parameter
+ name="org.eclipse.papyrus.infra.ui.menu.quickformatcommandParameter"
+ value="switchSpace2Underscore">
+ </parameter>
+ </command>
+ <command
+ commandId="org.eclipse.papyrus.infra.ui.menu.commands.QuickFormattingCapitalizeFirstLetterCommand"
+ label="&amp;To apply camelcase"
+ style="push">
+ <parameter
+ name="org.eclipse.papyrus.infra.ui.menu.quickformatcommandParameter"
+ value="capitalizeFirstLetter">
+ </parameter>
+ </command>
+ <command
+ commandId="org.eclipse.papyrus.infra.ui.menu.commands.QuickFormattingRemoveSpaceCommand"
+ label="&amp;To remove or add space"
+ style="push">
+ <parameter
+ name="org.eclipse.papyrus.infra.ui.menu.quickformatcommandParameter"
+ value="removeSpace">
+ </parameter>
+ </command>
<visibleWhen
checkEnabled="true">
</visibleWhen>
@@ -86,6 +113,40 @@
optional="false">
</commandParameter>
</command>
+
+ <command
+ categoryId="org.eclipse.papyrus.infra.ui.quickformat"
+ description="The command to quickly format by switching space and underscore in the selected labels"
+ id="org.eclipse.papyrus.infra.ui.menu.commands.QuickFormattingSwitchSpace2UnderscoreCommand"
+ name="Switch Space to Underscore Quick Format Command">
+ <commandParameter
+ id="org.eclipse.papyrus.infra.ui.menu.quickformatcommandParameter"
+ name="name"
+ optional="false">
+ </commandParameter>
+ </command>
+ <command
+ categoryId="org.eclipse.papyrus.infra.ui.quickformat"
+ description="The command to quickly format by capitalizing the first letter in the selected labels"
+ id="org.eclipse.papyrus.infra.ui.menu.commands.QuickFormattingCapitalizeFirstLetterCommand"
+ name="Capitalize First Letter Quick Format Command">
+ <commandParameter
+ id="org.eclipse.papyrus.infra.ui.menu.quickformatcommandParameter"
+ name="name"
+ optional="false">
+ </commandParameter>
+ </command>
+ <command
+ categoryId="org.eclipse.papyrus.infra.ui.quickformat"
+ description="The command to quickly format by removing space in the selected labels"
+ id="org.eclipse.papyrus.infra.ui.menu.commands.QuickFormattingRemoveSpaceCommand"
+ name="Remove Space Quick Format Command">
+ <commandParameter
+ id="org.eclipse.papyrus.infra.ui.menu.quickformatcommandParameter"
+ name="name"
+ optional="false">
+ </commandParameter>
+ </command>
<category
description="quickformat routines"
id="org.eclipse.papyrus.infra.ui.quickformat"
diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/main/java/org/eclipse/papyrus/infra/ui/menu/NameNormalization.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/main/java/org/eclipse/papyrus/infra/ui/menu/NameNormalization.java
new file mode 100644
index 00000000000..44d3711682d
--- /dev/null
+++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/main/java/org/eclipse/papyrus/infra/ui/menu/NameNormalization.java
@@ -0,0 +1,24 @@
+/*****************************************************************************
+ * Copyright (c) 2015 CEA LIST and others.
+ *
+ * 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:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.ui.menu;
+
+/**
+ * @author flefevre
+ *
+ */
+public interface NameNormalization {
+
+ public String normalizeName(String name, String parameter);
+
+}
diff --git a/plugins/infra/org.eclipse.papyrus.infra.ui/src/main/java/org/eclipse/papyrus/infra/ui/menu/NameNormalizationCommand.java b/plugins/infra/org.eclipse.papyrus.infra.ui/src/main/java/org/eclipse/papyrus/infra/ui/menu/NameNormalizationCommand.java
index b372e14df6f..563cb346a83 100644
--- a/plugins/infra/org.eclipse.papyrus.infra.ui/src/main/java/org/eclipse/papyrus/infra/ui/menu/NameNormalizationCommand.java
+++ b/plugins/infra/org.eclipse.papyrus.infra.ui/src/main/java/org/eclipse/papyrus/infra/ui/menu/NameNormalizationCommand.java
@@ -21,16 +21,24 @@ import org.eclipse.emf.transaction.TransactionalEditingDomain;
* this command is used to create a link "satisfyBy" between requirement and namedElement
*
*/
-public abstract class NameNormalizationCommand extends RecordingCommand{
+public abstract class NameNormalizationCommand extends RecordingCommand implements NameNormalization{
protected EObject source;
protected String parameter;
+ private final String BLANK= new String("");//$NON-NLS-1$
+ private final String SPACE= new String(" ");//$NON-NLS-1$
+ private final String MULTISPACE= new String(" +");//$NON-NLS-1$
+ private final String UNDERSCORE= new String("_");//$NON-NLS-1$
+ private final String MULTIUNDERSCORE= new String("_+");//$NON-NLS-1$
+
public static final String NAME_ACTION="name quick formatting action";//$NON-NLS-1$
public static final String DEFAULT_ACTION="default";//$NON-NLS-1$
public static final String UPPERCASE_ACTION="uppercase";//$NON-NLS-1$
public static final String LOWERCASE_ACTION="lowercase";//$NON-NLS-1$
-
+ public static final String SWITCHSPACE2UNDERSCORE_ACTION="switchSpace2Underscore";//$NON-NLS-1$
+ public static final String CAPITALIZEFIRSTLETTER_ACTION="capitalizeFirstLetter";//$NON-NLS-1$
+ public static final String REMOVESPACE_ACTION="removeSpace";//$NON-NLS-1$
public NameNormalizationCommand(TransactionalEditingDomain domain, EObject source, String normalization){
super(domain,NAME_ACTION+": "+normalization);
@@ -38,4 +46,79 @@ public abstract class NameNormalizationCommand extends RecordingCommand{
this.parameter=normalization;
}
+ public String normalizeName(String name, String parameter){
+ String newName = new String(name);
+ switch (parameter) {
+ case UPPERCASE_ACTION:
+ newName = getUpperCaseName(name);
+ break;
+ case LOWERCASE_ACTION:
+ newName = getLowerCaseName(name);
+ break;
+ case SWITCHSPACE2UNDERSCORE_ACTION:
+ newName = switchSpace2UnderscoreName(name);
+ break;
+ case REMOVESPACE_ACTION:
+ newName = removeSpaceName(name);
+ break;
+ case CAPITALIZEFIRSTLETTER_ACTION:
+ newName = capitalizeName(name);
+ break;
+
+ default:
+ newName = new String(name);
+ break;
+ }
+ return newName;
+ }
+
+ private String capitalizeName(String name) {
+ String[] ns = name.split(" ");
+ StringBuffer finalName=new StringBuffer();
+ for(String n : ns){
+ finalName.append(n.substring(0, 1).toUpperCase()+n.substring(1,n.length())+" ");
+ }
+ return finalName.toString().trim();
+ }
+
+ private String removeSpaceName(String name) {
+ StringBuffer finalName=new StringBuffer();
+ int spacePos = name.indexOf(SPACE);
+ if(spacePos>0){
+ finalName.append(name.replace(SPACE, BLANK));
+ }
+ else{
+ finalName.append(name.replaceAll("(.)([A-Z])", "$1 $2"));//$NON-NLS-1$
+ }
+
+ return finalName.toString().trim();
+ }
+
+ private String getUpperCaseName(String name){
+ return name.toUpperCase().trim();
+ }
+
+ private String getLowerCaseName(String name){
+ return name.toLowerCase().trim();
+ }
+
+ private String switchSpace2UnderscoreName(String name){
+ StringBuffer finalName=new StringBuffer();
+ int underscorePos = name.indexOf(UNDERSCORE);
+ int spacePos = name.indexOf(SPACE);
+ if(underscorePos>0 && spacePos>0 && underscorePos<spacePos){
+ finalName.append(name.replace(UNDERSCORE, BLANK));
+ }
+ else if(underscorePos>0 && spacePos>0 && underscorePos>spacePos){
+ finalName.append(name.replace(SPACE, UNDERSCORE));
+ }
+ else if(underscorePos<0 && spacePos>0 ){
+ finalName.append(name.replace(SPACE, UNDERSCORE));
+ }
+ else if(underscorePos>0 && spacePos<0){
+ finalName.append(name.replace(UNDERSCORE, SPACE));
+ }
+
+ return finalName.toString().trim().replaceAll(MULTISPACE, SPACE).replaceAll(MULTIUNDERSCORE, UNDERSCORE);
+ }
} \ No newline at end of file
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/plugin.xml
index 5ed34acaea0..11596399c3b 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/plugin.xml
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/plugin.xml
@@ -3740,6 +3740,51 @@
</and>
</activeWhen>
</handler>
+ <handler
+ class="org.eclipse.papyrus.uml.diagram.menu.actions.handlers.DiagramQuickFormatHandler"
+ commandId="org.eclipse.papyrus.infra.ui.menu.commands.QuickFormattingSwitchSpace2UnderscoreCommand">
+ <activeWhen>
+ <and>
+ <with
+ variable="selection">
+ <test
+ property="org.eclipse.papyrus.uml.diagram.menu.quickformatpropertytester.isNameChangeable"
+ value="true">
+ </test>
+ </with>
+ </and>
+ </activeWhen>
+ </handler>
+ <handler
+ class="org.eclipse.papyrus.uml.diagram.menu.actions.handlers.DiagramQuickFormatHandler"
+ commandId="org.eclipse.papyrus.infra.ui.menu.commands.QuickFormattingCapitalizeFirstLetterCommand">
+ <activeWhen>
+ <and>
+ <with
+ variable="selection">
+ <test
+ property="org.eclipse.papyrus.uml.diagram.menu.quickformatpropertytester.isNameChangeable"
+ value="true">
+ </test>
+ </with>
+ </and>
+ </activeWhen>
+ </handler>
+ <handler
+ class="org.eclipse.papyrus.uml.diagram.menu.actions.handlers.DiagramQuickFormatHandler"
+ commandId="org.eclipse.papyrus.infra.ui.menu.commands.QuickFormattingRemoveSpaceCommand">
+ <activeWhen>
+ <and>
+ <with
+ variable="selection">
+ <test
+ property="org.eclipse.papyrus.uml.diagram.menu.quickformatpropertytester.isNameChangeable"
+ value="true">
+ </test>
+ </with>
+ </and>
+ </activeWhen>
+ </handler>
</extension>
<extension
id="PapyrusFillColorCommand"
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/src/org/eclipse/papyrus/uml/diagram/menu/actions/DiagramNameNormalizationCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/src/org/eclipse/papyrus/uml/diagram/menu/actions/DiagramNameNormalizationCommand.java
index 734a163448b..c5584c529ee 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/src/org/eclipse/papyrus/uml/diagram/menu/actions/DiagramNameNormalizationCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/src/org/eclipse/papyrus/uml/diagram/menu/actions/DiagramNameNormalizationCommand.java
@@ -37,23 +37,9 @@ public class DiagramNameNormalizationCommand extends NameNormalizationCommand{
protected void doExecute() {
if(source instanceof Diagram){
String name = ((Diagram)source).getName();
-
- switch (parameter) {
- case UPPERCASE_ACTION:
- ((Diagram)source).setName(name.toUpperCase());
- break;
- case LOWERCASE_ACTION:
- ((Diagram)source).setName(name.toLowerCase());
- break;
-
- default:
- ((Diagram)source).setName(name.toUpperCase());
- break;
- }
+ String newName = normalizeName(name,parameter);
+ ((Diagram)source).setName(newName);
}
-
-
-
}
} \ No newline at end of file
diff --git a/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer/plugin.xml b/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer/plugin.xml
index 13a9a9344e8..ee16d30cd43 100644
--- a/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer/plugin.xml
+++ b/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer/plugin.xml
@@ -2392,6 +2392,51 @@
</and>
</activeWhen>
</handler>
+ <handler
+ class="org.eclipse.papyrus.uml.modelexplorer.handler.UmlQuickFormatHandler"
+ commandId="org.eclipse.papyrus.infra.ui.menu.commands.QuickFormattingSwitchSpace2UnderscoreCommand">
+ <activeWhen>
+ <and>
+ <with
+ variable="selection">
+ <test
+ property="org.eclipse.papyrus.uml.modelexplorer.menu.quickformatpropertytester.isNameChangeable"
+ value="true">
+ </test>
+ </with>
+ </and>
+ </activeWhen>
+ </handler>
+ <handler
+ class="org.eclipse.papyrus.uml.modelexplorer.handler.UmlQuickFormatHandler"
+ commandId="org.eclipse.papyrus.infra.ui.menu.commands.QuickFormattingCapitalizeFirstLetterCommand">
+ <activeWhen>
+ <and>
+ <with
+ variable="selection">
+ <test
+ property="org.eclipse.papyrus.uml.modelexplorer.menu.quickformatpropertytester.isNameChangeable"
+ value="true">
+ </test>
+ </with>
+ </and>
+ </activeWhen>
+ </handler>
+ <handler
+ class="org.eclipse.papyrus.uml.modelexplorer.handler.UmlQuickFormatHandler"
+ commandId="org.eclipse.papyrus.infra.ui.menu.commands.QuickFormattingRemoveSpaceCommand">
+ <activeWhen>
+ <and>
+ <with
+ variable="selection">
+ <test
+ property="org.eclipse.papyrus.uml.modelexplorer.menu.quickformatpropertytester.isNameChangeable"
+ value="true">
+ </test>
+ </with>
+ </and>
+ </activeWhen>
+ </handler>
</extension>
<extension
point="org.eclipse.core.expressions.propertyTesters">
diff --git a/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer/src/org/eclipse/papyrus/uml/modelexplorer/actions/UmlNameNormalizationCommand.java b/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer/src/org/eclipse/papyrus/uml/modelexplorer/actions/UmlNameNormalizationCommand.java
index 74b91feae36..737f9ad8d9a 100644
--- a/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer/src/org/eclipse/papyrus/uml/modelexplorer/actions/UmlNameNormalizationCommand.java
+++ b/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer/src/org/eclipse/papyrus/uml/modelexplorer/actions/UmlNameNormalizationCommand.java
@@ -32,19 +32,8 @@ public class UmlNameNormalizationCommand extends NameNormalizationCommand{
protected void doExecute() {
if(source instanceof NamedElement){
String name = ((NamedElement)source).getName();
- switch (parameter) {
- case UPPERCASE_ACTION:
- ((NamedElement)source).setName(name.toUpperCase());
- break;
- case LOWERCASE_ACTION:
- ((NamedElement)source).setName(name.toLowerCase());
- break;
-
- default:
- ((NamedElement)source).setName(name.toUpperCase());
- break;
- }
-
+ String newName = normalizeName(name,parameter);
+ ((NamedElement)source).setName(newName);
}
}

Back to the top