Author: sflanigan
Date: 2009-06-22 03:22:50 -0400 (Mon, 22 Jun 2009)
New Revision: 16108
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/ant/model/AntEntityRecognizer.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/ant/model/handlers/CreateAntFileSupport.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/ant/parser/AntParser.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/java/generation/JavaBeanGenerator.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/java/generation/JavaPropertyGenerator.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/java/model/handler/CreateJavaFileHandler.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/action/SignificanceMessageFactory.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/action/XAction.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/action/XActionInvoker.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/action/impl/CompoundAdoptManager.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/action/impl/DefaultWizardDataValidator.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-3557 Externalize English strings
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/ant/model/AntEntityRecognizer.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/ant/model/AntEntityRecognizer.java 2009-06-22
07:16:29 UTC (rev 16107)
+++
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/ant/model/AntEntityRecognizer.java 2009-06-22
07:22:50 UTC (rev 16108)
@@ -28,7 +28,7 @@
public String getEntityName(String ext, String body) {
if(body == null) return null;
- IContentType cd =
Platform.getContentTypeManager().getContentType("org.eclipse.ant.core.antBuildFile");
+ IContentType cd =
Platform.getContentTypeManager().getContentType("org.eclipse.ant.core.antBuildFile");
//$NON-NLS-1$
AntBuildfileContentDescriber d = new AntBuildfileContentDescriber();
int i = -1;
try {
@@ -39,7 +39,7 @@
} catch (IOException e) {
ModelPlugin.getPluginLog().logError(e);
}
- return i == 2 ? "FileANT" : null;
+ return i == 2 ? "FileANT" : null; //$NON-NLS-1$
// AntParser p = new AntParser(body);
// return (p.getTargets() != null) ? "FileANT" : null;
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/ant/model/handlers/CreateAntFileSupport.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/ant/model/handlers/CreateAntFileSupport.java 2009-06-22
07:16:29 UTC (rev 16107)
+++
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/ant/model/handlers/CreateAntFileSupport.java 2009-06-22
07:22:50 UTC (rev 16108)
@@ -16,11 +16,11 @@
protected String modifyBody(String body) {
if(body == null || body.length() == 0) {
- body = "<?xml version=\"1.0\"
encoding=\"UTF-8\"?>\n" +
- "<project basedir=\".\"
default=\"build\">\n" +
- " <target name=\"build\">\n\n" +
- " </target>\n" +
- "</project>\n";
+ body = "<?xml version=\"1.0\"
encoding=\"UTF-8\"?>\n" + //$NON-NLS-1$
+ "<project basedir=\".\"
default=\"build\">\n" + //$NON-NLS-1$
+ " <target name=\"build\">\n\n" +
//$NON-NLS-1$
+ " </target>\n" + //$NON-NLS-1$
+ "</project>\n"; //$NON-NLS-1$
}
return body;
}
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/ant/parser/AntParser.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/ant/parser/AntParser.java 2009-06-22
07:16:29 UTC (rev 16107)
+++
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/ant/parser/AntParser.java 2009-06-22
07:22:50 UTC (rev 16108)
@@ -25,13 +25,13 @@
private String[] targets = null;
public AntParser(String body) {
- if(body == null || body.indexOf("<project") < 0) return;
+ if(body == null || body.indexOf("<project") < 0) return;
//$NON-NLS-1$
Element element = XMLUtil.getElement(new StringReader(body));
if(element == null) return;
- if(!"project".equals(element.getNodeName())) return;
- if(element.hasAttribute("xmlns")) return;
- if(element.hasAttribute("xsi:schemaLocation")) return;
- NodeList es = element.getElementsByTagName("target");
+ if(!"project".equals(element.getNodeName())) return; //$NON-NLS-1$
+ if(element.hasAttribute("xmlns")) return; //$NON-NLS-1$
+ if(element.hasAttribute("xsi:schemaLocation")) return; //$NON-NLS-1$
+ NodeList es = element.getElementsByTagName("target"); //$NON-NLS-1$
for (int i = 0; i < es.getLength(); i++)
if(!((Element)es.item(i)).hasAttribute(XModelObjectConstants.ATTR_NAME))
return;
targets = new String[es.getLength()];
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/java/generation/JavaBeanGenerator.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/java/generation/JavaBeanGenerator.java 2009-06-22
07:16:29 UTC (rev 16107)
+++
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/java/generation/JavaBeanGenerator.java 2009-06-22
07:22:50 UTC (rev 16108)
@@ -42,15 +42,15 @@
import org.jboss.tools.common.model.util.EclipseResourceUtil;
public class JavaBeanGenerator {
- public static String PARAM_PACKAGENAME = "packageName";
- public static String PARAM_SHORTNAME = "shortName";
- public static String PARAM_ACCESS = "access";
- public static String PARAM_EXTENDS = "extends";
- public static String PARAM_IMPLEMENTS = "implements";
- public static String PARAM_INTERFACE = "interface";
+ public static String PARAM_PACKAGENAME = "packageName"; //$NON-NLS-1$
+ public static String PARAM_SHORTNAME = "shortName"; //$NON-NLS-1$
+ public static String PARAM_ACCESS = "access"; //$NON-NLS-1$
+ public static String PARAM_EXTENDS = "extends"; //$NON-NLS-1$
+ public static String PARAM_IMPLEMENTS = "implements"; //$NON-NLS-1$
+ public static String PARAM_INTERFACE = "interface"; //$NON-NLS-1$
- public static String ATT_CLASS_NAME = "class name";
- public static String ATT_ACCESS_MODIFIER = "access modifier";
+ public static String ATT_CLASS_NAME = "class name"; //$NON-NLS-1$
+ public static String ATT_ACCESS_MODIFIER = "access modifier"; //$NON-NLS-1$
protected XModelObject context;
protected Properties input;
@@ -75,20 +75,20 @@
if(srcpath == null) return;
String qclsname = input.getProperty(ATT_CLASS_NAME);
- String filepath = srcpath + XModelObjectConstants.SEPARATOR +
qclsname.replace('.', '/') + ".java";
+ String filepath = srcpath + XModelObjectConstants.SEPARATOR +
qclsname.replace('.', '/') + ".java"; //$NON-NLS-1$
if(new File(filepath).exists()) return;
int lastDot = qclsname.lastIndexOf('.');
Properties p = new Properties();
p.setProperty(PARAM_SHORTNAME, qclsname.substring(lastDot + 1));
- p.setProperty(PARAM_PACKAGENAME, (lastDot < 0) ? "" :
qclsname.substring(0, lastDot));
+ p.setProperty(PARAM_PACKAGENAME, (lastDot < 0) ? "" :
qclsname.substring(0, lastDot)); //$NON-NLS-1$
// String pkgname = (lastDot < 0) ? "" : qclsname.substring(0, lastDot);
String access = input.getProperty(ATT_ACCESS_MODIFIER);
- if(access == null || "default".equals(access)) access = "";
+ if(access == null || "default".equals(access)) access = "";
//$NON-NLS-1$ //$NON-NLS-2$
p.setProperty(PARAM_ACCESS, access);
- p.setProperty(PARAM_EXTENDS, input.getProperty("extends"));
- p.setProperty(PARAM_IMPLEMENTS,
input.getProperty("implements").replace(';', ','));
- p.setProperty(PARAM_INTERFACE,
input.getProperty("interface").replace(';', ','));
+ p.setProperty(PARAM_EXTENDS, input.getProperty("extends")); //$NON-NLS-1$
+ p.setProperty(PARAM_IMPLEMENTS,
input.getProperty("implements").replace(';', ','));
//$NON-NLS-1$
+ p.setProperty(PARAM_INTERFACE,
input.getProperty("interface").replace(';', ','));
//$NON-NLS-1$
doGenerateJava(javaproject, filepath, p);
}
@@ -118,8 +118,8 @@
String shortname = p.getProperty(PARAM_SHORTNAME);
- String lineDelimiter = System.getProperty("line.separator", "\n");
- ICompilationUnit parentCU = pack.createCompilationUnit(shortname + ".java",
"", false, null);
+ String lineDelimiter = System.getProperty("line.separator", "\n");
//$NON-NLS-1$ //$NON-NLS-2$
+ ICompilationUnit parentCU = pack.createCompilationUnit(shortname + ".java",
"", false, null); //$NON-NLS-1$ //$NON-NLS-2$
ICompilationUnit createdWorkingCopy = (ICompilationUnit)
parentCU.getWorkingCopy(null);
/// imports= new ImportsStructure(createdWorkingCopy, prefOrder, threshold, false);
@@ -164,9 +164,9 @@
}
StringBuffer sb = new StringBuffer();
if(!p.isDefaultPackage()) {
- sb.append("package ");
+ sb.append("package "); //$NON-NLS-1$
sb.append(p.getElementName());
- sb.append(';'); //$NON-NLS-1$
+ sb.append(';');
}
for (int i = 0; i < 2; i++) sb.append(lineDelimiter);
if(comments != null) {
@@ -201,37 +201,37 @@
StringBuffer sb = new StringBuffer();
// String pkgname = p.getProperty(PARAM_PACKAGENAME);
String access = p.getProperty(PARAM_ACCESS);
- if(access == null) access = ""; else if(access.length() > 0) access +=
" ";
+ if(access == null) access = ""; else if(access.length() > 0) access +=
" "; //$NON-NLS-1$ //$NON-NLS-2$
boolean isInterface =
XModelObjectConstants.TRUE.equals(p.getProperty(PARAM_INTERFACE));
- String kind = isInterface ? "interface " : "class ";
+ String kind = isInterface ? "interface " : "class "; //$NON-NLS-1$
//$NON-NLS-2$
String shortname = p.getProperty(PARAM_SHORTNAME);
String _extends = p.getProperty(PARAM_EXTENDS);
- if(_extends == null) _extends = ""; else if(_extends.length() > 0)
_extends = "extends " + _extends + " ";
+ if(_extends == null) _extends = ""; else if(_extends.length() > 0)
_extends = "extends " + _extends + " "; //$NON-NLS-1$ //$NON-NLS-2$
//$NON-NLS-3$
String _implements = formatImplements(p.getProperty(PARAM_IMPLEMENTS));
if(_implements == null) {
- _implements = "";
+ _implements = ""; //$NON-NLS-1$
} else if(_implements.length() > 0) {
if(isInterface) {
- _implements = "extends " + _implements + " ";
+ _implements = "extends " + _implements + " "; //$NON-NLS-1$
//$NON-NLS-2$
} else {
- _implements = "implements " + _implements + " ";
+ _implements = "implements " + _implements + " "; //$NON-NLS-1$
//$NON-NLS-2$
}
}
- String header = access + kind + shortname + " " + _extends + _implements +
"{" + lineDelimiter;
+ String header = access + kind + shortname + " " + _extends + _implements +
"{" + lineDelimiter; //$NON-NLS-1$ //$NON-NLS-2$
sb.append(header);
if(!isInterface) {
- sb.append("public " + shortname + "() {" + lineDelimiter +
"}" + lineDelimiter); // constructor
+ sb.append("public " + shortname + "() {" + lineDelimiter +
"}" + lineDelimiter); // constructor //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
- sb.append("}" + lineDelimiter);
+ sb.append("}" + lineDelimiter); //$NON-NLS-1$
return sb.toString();
}
private String formatImplements(String s) {
StringBuffer sb = new StringBuffer();
- StringTokenizer st = new StringTokenizer(s, ",;");
+ StringTokenizer st = new StringTokenizer(s, ",;"); //$NON-NLS-1$
while(st.hasMoreTokens()) {
sb.append(st.nextToken());
- if(st.hasMoreTokens()) sb.append(", ");
+ if(st.hasMoreTokens()) sb.append(", "); //$NON-NLS-1$
}
return sb.toString();
}
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/java/generation/JavaPropertyGenerator.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/java/generation/JavaPropertyGenerator.java 2009-06-22
07:16:29 UTC (rev 16107)
+++
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/java/generation/JavaPropertyGenerator.java 2009-06-22
07:22:50 UTC (rev 16108)
@@ -25,8 +25,8 @@
}
public void generate(String name, String javatype, String access, boolean field, boolean
getter, boolean setter) throws CoreException {
- if("default".equals(access)) access = ""; else access += "
";
- String fa = (getter && setter) ? "private " : access;
+ if("default".equals(access)) access = ""; else access += "
"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ String fa = (getter && setter) ? "private " : access; //$NON-NLS-1$
ICompilationUnit parentCU = owner.getCompilationUnit();
String lineDelimiter = getLineDelimiterUsed(parentCU);
ICompilationUnit createdWorkingCopy = (ICompilationUnit)
parentCU.getWorkingCopy(null);
@@ -39,7 +39,7 @@
if(field && !isInterface &&
(createdType.getField(name) == null || !createdType.getField(name).exists())
) {
- String fieldContents = "\t" + fa + javatype + " " + name +
";" + lineDelimiter;
+ String fieldContents = "\t" + fa + javatype + " " + name +
";" + lineDelimiter; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
createdType.createField(fieldContents, null, true, null);
synchronized(cu) {
cu.reconcile(ICompilationUnit.NO_AST, true, null, null);
@@ -56,15 +56,15 @@
}
public static void createGetter(ICompilationUnit cu, IType type, String access, String
javatype, String name, String lineDelimiter) throws CoreException {
- String methodName = getAccessorName("get", name);
+ String methodName = getAccessorName("get", name); //$NON-NLS-1$
if(findGetter(type, methodName) != null) return;
- String methodHeader = access + javatype + " " + methodName + "()";
+ String methodHeader = access + javatype + " " + methodName + "()";
//$NON-NLS-1$ //$NON-NLS-2$
String stub = null;
if(!type.isInterface()) {
- methodHeader += " {" + lineDelimiter;
- stub = methodHeader + "}" + lineDelimiter;
+ methodHeader += " {" + lineDelimiter; //$NON-NLS-1$
+ stub = methodHeader + "}" + lineDelimiter; //$NON-NLS-1$
} else {
- methodHeader += ";" + lineDelimiter;
+ methodHeader += ";" + lineDelimiter; //$NON-NLS-1$
stub = methodHeader;
}
IMethod m = type.createMethod(stub, null, true, null);
@@ -88,19 +88,19 @@
}
public static void createSetter(ICompilationUnit cu, IType type, String access, String
javatype, String name, String lineDelimiter) throws CoreException {
- String methodName = getAccessorName("set", name);
- String methodHeader = access + "void " + methodName + "(" +
javatype + " " + name + ")";
+ String methodName = getAccessorName("set", name); //$NON-NLS-1$
+ String methodHeader = access + "void " + methodName + "(" +
javatype + " " + name + ")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
//$NON-NLS-4$
String stub = null;
if(!type.isInterface()) {
- methodHeader += " {" + lineDelimiter;
- stub = methodHeader + "}" + lineDelimiter;
+ methodHeader += " {" + lineDelimiter; //$NON-NLS-1$
+ stub = methodHeader + "}" + lineDelimiter; //$NON-NLS-1$
} else {
- methodHeader += ";" + lineDelimiter;
+ methodHeader += ";" + lineDelimiter; //$NON-NLS-1$
stub = methodHeader;
}
IMethod m = type.createMethod(stub, null, true, null);
String methodComment = CodeGeneration.getSetterComment(cu, type.getElementName(),
m.getElementName(), name, javatype, name, name, lineDelimiter);
- String methodContent = (type.isInterface()) ? null :
CodeGeneration.getSetterMethodBodyContent(cu, cu.getElementName(), m.getElementName(),
"this." + name, name, lineDelimiter);
+ String methodContent = (type.isInterface()) ? null :
CodeGeneration.getSetterMethodBodyContent(cu, cu.getElementName(), m.getElementName(),
"this." + name, name, lineDelimiter); //$NON-NLS-1$
editMethod(cu, m, methodHeader, methodComment, methodContent, lineDelimiter);
}
@@ -116,10 +116,10 @@
}
sb.append(methodHeader);
if(methodContent != null) {
- sb.append(methodContent).append("}").append(lineDelimiter);
+ sb.append(methodContent).append("}").append(lineDelimiter); //$NON-NLS-1$
}
String formattedContent =
JavaBeanGenerator.codeFormat2(CodeFormatter.K_CLASS_BODY_DECLARATIONS, sb.toString(), 1,
lineDelimiter, cu.getJavaProject());
- if(formattedContent != null && formattedContent.startsWith("\t")) {
+ if(formattedContent != null && formattedContent.startsWith("\t")) {
//$NON-NLS-1$
formattedContent = formattedContent.substring(1);
}
buf.replace(range.getOffset(), range.getLength(), formattedContent);
@@ -132,7 +132,7 @@
public static String getLineDelimiterUsed(ICompilationUnit cu) {
if (cu == null || !cu.exists()) {
- return System.getProperty("line.separator", "\n");
+ return System.getProperty("line.separator", "\n"); //$NON-NLS-1$
//$NON-NLS-2$
}
IBuffer buf = null;
try {
@@ -141,7 +141,7 @@
ModelPlugin.getPluginLog().logError(e);
}
if (buf == null) {
- return System.getProperty("line.separator", "\n");
+ return System.getProperty("line.separator", "\n"); //$NON-NLS-1$
//$NON-NLS-2$
}
int length = buf.getLength();
for (int i = 0; i < length; i++) {
@@ -149,15 +149,15 @@
if (ch == SWT.CR) {
if (i + 1 < length) {
if (buf.getChar(i + 1) == SWT.LF) {
- return "\r\n";
+ return "\r\n"; //$NON-NLS-1$
}
}
- return "\r";
+ return "\r"; //$NON-NLS-1$
} else if (ch == SWT.LF) {
- return "\n";
+ return "\n"; //$NON-NLS-1$
}
}
- return System.getProperty("line.separator", "\n");
+ return System.getProperty("line.separator", "\n"); //$NON-NLS-1$
//$NON-NLS-2$
}
}
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/java/model/handler/CreateJavaFileHandler.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/java/model/handler/CreateJavaFileHandler.java 2009-06-22
07:16:29 UTC (rev 16107)
+++
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/java/model/handler/CreateJavaFileHandler.java 2009-06-22
07:22:50 UTC (rev 16108)
@@ -27,7 +27,7 @@
}
public void executeHandler(XModelObject object, Properties p) throws XModelException {
- SpecialWizard wizard =
SpecialWizardFactory.createSpecialWizard("org.jboss.tools.common.model.ui.wizard.newfile.NewClassCreationWizard");
+ SpecialWizard wizard =
SpecialWizardFactory.createSpecialWizard("org.jboss.tools.common.model.ui.wizard.newfile.NewClassCreationWizard");
//$NON-NLS-1$
wizard.setObject(object);
wizard.execute();
}
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/action/SignificanceMessageFactory.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/action/SignificanceMessageFactory.java 2009-06-22
07:16:29 UTC (rev 16107)
+++
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/action/SignificanceMessageFactory.java 2009-06-22
07:22:50 UTC (rev 16108)
@@ -20,7 +20,7 @@
public class SignificanceMessageFactory {
- static public final String MESSAGE_CLASS_NAME_PARAMETER =
"significanceMessageClass";
+ static public final String MESSAGE_CLASS_NAME_PARAMETER =
"significanceMessageClass"; //$NON-NLS-1$
static private SignificanceMessage defaultFactory = new SignificanceMessageImpl();
static private SignificanceMessage defaultReplaceFactory = new
ReplaceSignificanceMessageImpl();
@@ -37,7 +37,7 @@
public String getMessage(XAction action, XModelObject object, XModelObject[] objects)
{
String ms = action.getProperty(MESSAGE_CLASS_NAME_PARAMETER);
if(ms == null || ms.length() == 0) return defaultFactory.getMessage(action, object,
objects);
- if("%Replace%".equals(ms)) {
+ if("%Replace%".equals(ms)) { //$NON-NLS-1$
return defaultReplaceFactory.getMessage(action, object, objects);
}
SignificanceMessage specificMessage = (SignificanceMessage)map.get(ms);
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/action/XAction.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/action/XAction.java 2009-06-22
07:16:29 UTC (rev 16107)
+++
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/action/XAction.java 2009-06-22
07:22:50 UTC (rev 16108)
@@ -14,16 +14,16 @@
import org.jboss.tools.common.model.event.*;
public interface XAction extends XActionItem, XActionHandler {
- public String HIDE_NEVER = "never";
- public String HIDE_DISABLED = "disabled";
- public String HIDE_ALWAYS = "always";
+ public String HIDE_NEVER = "never"; //$NON-NLS-1$
+ public String HIDE_DISABLED = "disabled"; //$NON-NLS-1$
+ public String HIDE_ALWAYS = "always"; //$NON-NLS-1$
// standart actions paths
- public static final String CUT = "CopyActions.Cut";
- public static final String COPY = "CopyActions.Copy";
- public static final String DELETE = "DeleteActions.Delete";
- public static final String PASTE = "CopyActions.Paste";
+ public static final String CUT = "CopyActions.Cut"; //$NON-NLS-1$
+ public static final String COPY = "CopyActions.Copy"; //$NON-NLS-1$
+ public static final String DELETE = "DeleteActions.Delete"; //$NON-NLS-1$
+ public static final String PASTE = "CopyActions.Paste"; //$NON-NLS-1$
public String getWizardClassName();
public XEntityData[] getEntityData(XModelObject object);
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/action/XActionInvoker.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/action/XActionInvoker.java 2009-06-22
07:16:29 UTC (rev 16107)
+++
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/action/XActionInvoker.java 2009-06-22
07:22:50 UTC (rev 16108)
@@ -19,23 +19,23 @@
import org.jboss.tools.common.model.plugin.ModelPlugin;
public class XActionInvoker {
- static SpecialWizard sw =
SpecialWizardFactory.createSpecialWizard("org.jboss.tools.common.model.ui.action.XModelObjectActionInvoker");
+ static SpecialWizard sw =
SpecialWizardFactory.createSpecialWizard("org.jboss.tools.common.model.ui.action.XModelObjectActionInvoker");
//$NON-NLS-1$
public static void invoke(String invokerEntity, String actionPath, XModelObject
object, Properties runningProperties) {
if(object == null) {
- ModelPlugin.getPluginLog().logError("Cannot invoke action " + actionPath
+ " on null object.");
+ ModelPlugin.getPluginLog().logError("Cannot invoke action " + actionPath
+ " on null object."); //$NON-NLS-1$ //$NON-NLS-2$
return;
}
XModelEntity entity = object.getModel().getMetaData().getEntity(invokerEntity);
if(entity == null) {
- ModelPlugin.getPluginLog().logError("Entity " + invokerEntity + "
is not found.");
+ ModelPlugin.getPluginLog().logError("Entity " + invokerEntity + "
is not found."); //$NON-NLS-1$ //$NON-NLS-2$
}
invoke(entity, actionPath, object, runningProperties);
}
public static void invoke(String actionPath, XModelObject object, Properties
runningProperties) {
if(object == null) {
- ModelPlugin.getPluginLog().logError("Cannot invoke action " + actionPath
+ " on null object.");
+ ModelPlugin.getPluginLog().logError("Cannot invoke action " + actionPath
+ " on null object."); //$NON-NLS-1$ //$NON-NLS-2$
} else {
invoke(object.getModelEntity(), actionPath, object, runningProperties);
}
@@ -43,11 +43,11 @@
public static void invoke(XModelEntity invoker, String actionPath, XModelObject
object, Properties runningProperties) {
if(sw == null) {
- ModelPlugin.getPluginLog().logError("XActionInvoker could not be
loaded");
+ ModelPlugin.getPluginLog().logError("XActionInvoker could not be
loaded"); //$NON-NLS-1$
} else {
XAction a = getAction(invoker, actionPath);
if(a == null) {
- ModelPlugin.getPluginLog().logError("Cannot find action " +
actionPath + " in entity " + invoker.getName());
+ ModelPlugin.getPluginLog().logError("Cannot find action " +
actionPath + " in entity " + invoker.getName()); //$NON-NLS-1$ //$NON-NLS-2$
} else {
sw.setObject(new Object[]{a, object, runningProperties});
sw.execute();
@@ -61,11 +61,11 @@
public static void invoke(XModelEntity invoker, String actionPath, XModelObject
object, XModelObject[] targets, Properties runningProperties) {
if(sw == null) {
- ModelPlugin.getPluginLog().logError("XActionInvoker could not be
loaded");
+ ModelPlugin.getPluginLog().logError("XActionInvoker could not be
loaded"); //$NON-NLS-1$
} else {
XAction a = getAction(invoker, actionPath);
if(a == null) {
- ModelPlugin.getPluginLog().logError("Cannot find action " +
actionPath + " in entity " + invoker.getName());
+ ModelPlugin.getPluginLog().logError("Cannot find action " +
actionPath + " in entity " + invoker.getName()); //$NON-NLS-1$ //$NON-NLS-2$
} else {
sw.setObject(new Object[]{a, object, runningProperties, targets});
sw.execute();
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/action/impl/CompoundAdoptManager.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/action/impl/CompoundAdoptManager.java 2009-06-22
07:16:29 UTC (rev 16107)
+++
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/action/impl/CompoundAdoptManager.java 2009-06-22
07:22:50 UTC (rev 16108)
@@ -22,25 +22,25 @@
protected synchronized final XAdoptManager[] loadManagers(String extensionPoint) {
IExtensionPoint p = Platform.getExtensionRegistry().getExtensionPoint(extensionPoint);
if(p == null) {
- ModelPlugin.getDefault().getLog().log(new Status(Status.ERROR, ModelPlugin.PLUGIN_ID,
Status.OK, "Model warning: Cannot load extension point " + extensionPoint +
".", null));
+ ModelPlugin.getDefault().getLog().log(new Status(Status.ERROR, ModelPlugin.PLUGIN_ID,
Status.OK, "Model warning: Cannot load extension point " + extensionPoint +
".", null)); //$NON-NLS-1$ //$NON-NLS-2$
return new XAdoptManager[0];
}
IConfigurationElement[] es = p.getConfigurationElements();
XAdoptManager[] array = new XAdoptManager[es.length];
int length = 0;
for (int i = 0; i < es.length; i++) {
- String cls = es[i].getAttribute("class");
+ String cls = es[i].getAttribute("class"); //$NON-NLS-1$
if(cls == null || cls.length() == 0) continue;
try {
- XAdoptManager m = (XAdoptManager)es[i].createExecutableExtension("class");
+ XAdoptManager m = (XAdoptManager)es[i].createExecutableExtension("class");
//$NON-NLS-1$
if(m != null) {
array[length] = m;
length++;
}
} catch (CoreException e) {
- ModelPlugin.getDefault().getLog().log(new Status(Status.ERROR, ModelPlugin.PLUGIN_ID,
Status.OK, "Model warning: Cannot load class " + cls + ".", e));
+ ModelPlugin.getDefault().getLog().log(new Status(Status.ERROR, ModelPlugin.PLUGIN_ID,
Status.OK, "Model warning: Cannot load class " + cls + ".", e));
//$NON-NLS-1$ //$NON-NLS-2$
} catch (ClassCastException e2) {
- ModelPlugin.getDefault().getLog().log(new Status(Status.ERROR, ModelPlugin.PLUGIN_ID,
Status.OK, "Model warning: Cannot load class " + cls + ".", e2));
+ ModelPlugin.getDefault().getLog().log(new Status(Status.ERROR, ModelPlugin.PLUGIN_ID,
Status.OK, "Model warning: Cannot load class " + cls + ".", e2));
//$NON-NLS-1$ //$NON-NLS-2$
}
}
if(length < array.length) {
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/action/impl/DefaultWizardDataValidator.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/action/impl/DefaultWizardDataValidator.java 2009-06-22
07:16:29 UTC (rev 16107)
+++
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/action/impl/DefaultWizardDataValidator.java 2009-06-22
07:22:50 UTC (rev 16108)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.common.meta.action.impl;
+import java.text.MessageFormat;
import java.util.*;
import org.jboss.tools.common.meta.XChild;
@@ -42,7 +43,7 @@
XEntityData[] ds = support.getEntityData();
if(ds.length <= step) return;
if(support.action != null) {
- if(XModelObjectConstants.TRUE.equals(support.action.getProperty("validator.add"))
&& step == 0) {
+ if(XModelObjectConstants.TRUE.equals(support.action.getProperty("validator.add"))
&& step == 0) { //$NON-NLS-1$
String entity = support.action.getProperty(XMetaDataConstants.ENTITY);
if(entity == null) entity = ds[step].getModelEntity().getName();
if(!checkChild(support.getTarget(), entity, data)) return;
@@ -52,11 +53,17 @@
XChild c = support.getTarget().getModelEntity().getChild(entity);
int max = c == null ? 0 : c.getMaxCount();
if(c != null && max <= childCount) {
- message = DefaultCreateHandler.title(parent, true) + " can contain only "
+ max +
- ((max == 1) ? " child " : " children ") +
- "with entity " + entity + ".";
+ String parentTitle = DefaultCreateHandler.title(parent, true);
+ // TODO (i18n) this assumes Germanic-type plurals
+ message = ((max == 1) ?
+ MessageFormat.format(
+ "{0} can contain only {1} child with entity {2}.",
+ parentTitle, max, entity)
+ : MessageFormat.format(
+ "{0} can contain only {1} children with entity {2}.",
+ parentTitle, max, entity));
}
- } else
if(XModelObjectConstants.TRUE.equals(support.action.getProperty("validator.edit")))
{
+ } else
if(XModelObjectConstants.TRUE.equals(support.action.getProperty("validator.edit")))
{ //$NON-NLS-1$
String entity = support.action.getProperty(XMetaDataConstants.ENTITY);
if(entity == null) entity = ds[step].getModelEntity().getName();
if(!checkChild(support.getTarget().getParent(), entity, data)) return;
@@ -67,20 +74,20 @@
for (int i = 0; i < as.length; i++) {
String n = as[i].getAttribute().getName();
String value = data.getProperty(n);
- if(value == null) value = "";
+ if(value == null) value = ""; //$NON-NLS-1$
if(!support.isFieldEditorEnabled(step, n, data)) continue;
message = DefaultCreateHandler.validateAttribute(as[i], value);
if(message != null) return;
}
if(message != null || support.action == null) return;
- if(XModelObjectConstants.TRUE.equals(support.action.getProperty("validator.addfile"))
&& step == 0) {
+ if(XModelObjectConstants.TRUE.equals(support.action.getProperty("validator.addfile"))
&& step == 0) { //$NON-NLS-1$
validateAddFile(ds, data);
}
- String resourceAttr = support.action.getProperty("validator.resource");
+ String resourceAttr = support.action.getProperty("validator.resource");
//$NON-NLS-1$
if(resourceAttr != null) {
String value = data.getProperty(resourceAttr);
if(value != null && (!new java.io.File(value).exists())) {
- message = "Resource " + value + " does not exist.";
+ message = MessageFormat.format("Resource {0} does not exist.", value);
}
}
}