Created a separated 'externaltools' plugin: initial check-in
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / externaltools / model / ToolUtil.java
index 3d083c9..01f505a 100644 (file)
@@ -5,22 +5,23 @@ Copyright (c) 2002 IBM Corp. and others. All rights reserved.
 This file is made available under the terms of the Common Public License v1.0
 which accompanies this distribution, and is available at
 http://www.eclipse.org/legal/cpl-v10.html
+�
 Contributors:
 **********************************************************************/
 
 import java.util.ArrayList;
 
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.MultiStatus;
+import net.sourceforge.phpdt.externaltools.internal.model.ExternalToolsModelMessages;
 import net.sourceforge.phpdt.externaltools.internal.model.ExternalToolsPlugin;
-import net.sourceforge.phpdt.externaltools.internal.model.ToolMessages;
 import net.sourceforge.phpdt.externaltools.internal.registry.ArgumentVariable;
 import net.sourceforge.phpdt.externaltools.internal.registry.ArgumentVariableRegistry;
 import net.sourceforge.phpdt.externaltools.internal.registry.PathLocationVariable;
 import net.sourceforge.phpdt.externaltools.internal.registry.PathLocationVariableRegistry;
 import net.sourceforge.phpdt.externaltools.variable.ExpandVariableContext;
 
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.MultiStatus;
+
 /**
  * General utility class dealing with external tools
  */
@@ -106,7 +107,7 @@ public final class ToolUtil {
 
                        // Invalid variable format
                        if (varDef.end == -1 || varDef.name == null || varDef.name.length() == 0) {
-                               String msg = ToolMessages.getString("ToolUtil.argumentVarFormatWrong"); //$NON-NLS-1$
+                               String msg = ExternalToolsModelMessages.getString("ToolUtil.argumentVarFormatWrong"); //$NON-NLS-1$
                                status.merge(ExternalToolsPlugin.newErrorStatus(msg, null));
                                return null;
                        }
@@ -121,7 +122,7 @@ public final class ToolUtil {
                        registry = ExternalToolsPlugin.getDefault().getArgumentVariableRegistry();
                        ArgumentVariable variable = registry.getArgumentVariable(varDef.name);
                        if (variable == null) {
-                               String msg = ToolMessages.format("ToolUtil.argumentVarMissing", new Object[] {varDef.name}); //$NON-NLS-1$
+                               String msg = ExternalToolsModelMessages.format("ToolUtil.argumentVarMissing", new Object[] {varDef.name}); //$NON-NLS-1$
                                status.merge(ExternalToolsPlugin.newErrorStatus(msg, null));
                                return null;
                        }
@@ -129,7 +130,7 @@ public final class ToolUtil {
                        // Expand the variable as text if possible
                        String text = variable.getExpander().getText(varDef.name, varDef.argument, context);
                        if (text == null) {
-                               String msg = ToolMessages.format("ToolUtil.argumentVarExpandFailed", new Object[] {varDef.name}); //$NON-NLS-1$
+                               String msg = ExternalToolsModelMessages.format("ToolUtil.argumentVarExpandFailed", new Object[] {varDef.name}); //$NON-NLS-1$
                                status.merge(ExternalToolsPlugin.newErrorStatus(msg, null));
                                return null;
                        }
@@ -183,14 +184,14 @@ public final class ToolUtil {
                
                // Disallow text before/after variable
                if (varDef.start != 0 || (varDef.end < dirLocation.length() && varDef.end != -1)) {
-                       String msg = ToolMessages.getString("ToolUtil.dirLocVarBetweenText"); //$NON-NLS-1$
+                       String msg = ExternalToolsModelMessages.getString("ToolUtil.dirLocVarBetweenText"); //$NON-NLS-1$
                        status.merge(ExternalToolsPlugin.newErrorStatus(msg, null));
                        return null;
                }
                
                // Invalid variable format
                if (varDef.name == null || varDef.name.length() == 0 || varDef.end == -1) {
-                       String msg = ToolMessages.getString("ToolUtil.dirLocVarFormatWrong"); //$NON-NLS-1$
+                       String msg = ExternalToolsModelMessages.getString("ToolUtil.dirLocVarFormatWrong"); //$NON-NLS-1$
                        status.merge(ExternalToolsPlugin.newErrorStatus(msg, null));
                        return null;
                }
@@ -200,7 +201,7 @@ public final class ToolUtil {
                registry = ExternalToolsPlugin.getDefault().getDirectoryLocationVariableRegistry();
                PathLocationVariable variable = registry.getPathLocationVariable(varDef.name);
                if (variable == null) {
-                       String msg = ToolMessages.format("ToolUtil.dirLocVarMissing", new Object[] {varDef.name}); //$NON-NLS-1$
+                       String msg = ExternalToolsModelMessages.format("ToolUtil.dirLocVarMissing", new Object[] {varDef.name}); //$NON-NLS-1$
                        status.merge(ExternalToolsPlugin.newErrorStatus(msg, null));
                        return null;
                }
@@ -208,7 +209,7 @@ public final class ToolUtil {
                // Expand the variable into a IPath if possible
                IPath path = variable.getExpander().getPath(varDef.name, varDef.argument, context);
                if (path == null) {
-                       String msg = ToolMessages.format("ToolUtil.dirLocVarExpandFailed", new Object[] {varDef.name}); //$NON-NLS-1$
+                       String msg = ExternalToolsModelMessages.format("ToolUtil.dirLocVarExpandFailed", new Object[] {varDef.name}); //$NON-NLS-1$
                        status.merge(ExternalToolsPlugin.newErrorStatus(msg, null));
                        return null;
                }
@@ -238,14 +239,14 @@ public final class ToolUtil {
                
                // Disallow text before/after variable
                if (varDef.start != 0 || (varDef.end < fileLocation.length() && varDef.end != -1)) {
-                       String msg = ToolMessages.getString("ToolUtil.fileLocVarBetweenText"); //$NON-NLS-1$
+                       String msg = ExternalToolsModelMessages.getString("ToolUtil.fileLocVarBetweenText"); //$NON-NLS-1$
                        status.merge(ExternalToolsPlugin.newErrorStatus(msg, null));
                        return null;
                }
                
                // Invalid variable format
                if (varDef.name == null || varDef.name.length() == 0 || varDef.end == -1) {
-                       String msg = ToolMessages.getString("ToolUtil.fileLocVarFormatWrong"); //$NON-NLS-1$
+                       String msg = ExternalToolsModelMessages.getString("ToolUtil.fileLocVarFormatWrong"); //$NON-NLS-1$
                        status.merge(ExternalToolsPlugin.newErrorStatus(msg, null));
                        return null;
                }
@@ -255,7 +256,7 @@ public final class ToolUtil {
                registry = ExternalToolsPlugin.getDefault().getFileLocationVariableRegistry();
                PathLocationVariable variable = registry.getPathLocationVariable(varDef.name);
                if (variable == null) {
-                       String msg = ToolMessages.format("ToolUtil.fileLocVarMissing", new Object[] {varDef.name}); //$NON-NLS-1$
+                       String msg = ExternalToolsModelMessages.format("ToolUtil.fileLocVarMissing", new Object[] {varDef.name}); //$NON-NLS-1$
                        status.merge(ExternalToolsPlugin.newErrorStatus(msg, null));
                        return null;
                }
@@ -263,7 +264,7 @@ public final class ToolUtil {
                // Expand the variable into a IPath if possible
                IPath path = variable.getExpander().getPath(varDef.name, varDef.argument, context);
                if (path == null) {
-                       String msg = ToolMessages.format("The variable {0} with argument {1} could not be expanded to a valid path.", new Object[] {varDef.name, varDef.argument});
+                       String msg = ExternalToolsModelMessages.format("The variable {0} with argument {1} could not be expanded to a valid path.", new Object[] {varDef.name, varDef.argument});
                        status.merge(ExternalToolsPlugin.newErrorStatus(msg, null));
                        return null;
                }