Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilipe Mulet2001-07-09 14:12:43 +0000
committerPhilipe Mulet2001-07-09 14:12:43 +0000
commit1252ec76ddf159ce9f8102ab9609c61aaf077dfe (patch)
tree56505f35bb18d836f3b25cc120e45bfb946270ed
parente0b8aee1afb079d50df6c15f0614bc13b3513ab2 (diff)
downloadeclipse.jdt.core-1252ec76ddf159ce9f8102ab9609c61aaf077dfe.tar.gz
eclipse.jdt.core-1252ec76ddf159ce9f8102ab9609c61aaf077dfe.tar.xz
eclipse.jdt.core-1252ec76ddf159ce9f8102ab9609c61aaf077dfe.zip
*** empty log message ***
-rw-r--r--org.eclipse.jdt.core/.classpath3
-rw-r--r--org.eclipse.jdt.core/ant/org/eclipse/jdt/core/ant/Jdtcom.java22
-rw-r--r--org.eclipse.jdt.core/ant/org/eclipse/jdt/internal/core/ant/Util.java92
3 files changed, 106 insertions, 11 deletions
diff --git a/org.eclipse.jdt.core/.classpath b/org.eclipse.jdt.core/.classpath
index 50bca17e60..e1df1e34e8 100644
--- a/org.eclipse.jdt.core/.classpath
+++ b/org.eclipse.jdt.core/.classpath
@@ -14,5 +14,8 @@
<classpathentry kind="src" path="Eclipse Java Evaluation"/>
<classpathentry kind="src" path="Eclipse Java Model"/>
<classpathentry kind="src" path="Eclipse Java Formatter"/>
+ <classpathentry kind="lib" path="/org.eclipse.ant.core/ant.jar"/>
+ <classpathentry kind="lib"
+ path="/org.eclipse.ant.core/antsupport.jar" sourcepath="/org.eclipse.ant.core/antsupportsrc.zip"/>
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/org.eclipse.jdt.core/ant/org/eclipse/jdt/core/ant/Jdtcom.java b/org.eclipse.jdt.core/ant/org/eclipse/jdt/core/ant/Jdtcom.java
index 5486242bc8..276adb167a 100644
--- a/org.eclipse.jdt.core/ant/org/eclipse/jdt/core/ant/Jdtcom.java
+++ b/org.eclipse.jdt.core/ant/org/eclipse/jdt/core/ant/Jdtcom.java
@@ -7,7 +7,7 @@ import org.apache.tools.ant.*;
import org.apache.tools.ant.taskdefs.*;
import org.apache.tools.ant.types.*;
import org.eclipse.jdt.internal.compiler.batch.Main;
-import org.eclipse.jdt.internal.core.ant.AntPrintWriter;
+import org.eclipse.jdt.internal.core.ant.*;
public class Jdtcom extends MatchingTask {
private Path src;
@@ -22,9 +22,9 @@ public class Jdtcom extends MatchingTask {
public void execute() throws BuildException {
if(src == null)
- throw new BuildException("no");
+ throw new BuildException(Util.bind("jdtcom.source"/*nonNLS*/));
if(dest == null)
- throw new BuildException("no");
+ throw new BuildException(Util.bind("jdtcom.destination"/*nonNLS*/));
arguments.append(" -d "/*nonNLS*/);
arguments.append(dest.getAbsolutePath());
@@ -35,7 +35,7 @@ public class Jdtcom extends MatchingTask {
for(int i = 0 ; i < classpathList.length ; i++){
File pathElement = project.resolveFile(classpathList[i]);
if(!pathElement.exists())
- throw new BuildException("no");
+ throw new BuildException(Util.bind("jdtcom.classpath"/*nonNLS*/,pathElement.getAbsolutePath()));
if(i != 0)
arguments.append(";"/*nonNLS*/);
arguments.append(pathElement);
@@ -46,9 +46,9 @@ public class Jdtcom extends MatchingTask {
for(int i = 0 ; i < srcList.length ; i++){
File file = project.resolveFile(srcList[i]);
if(!file.exists())
- throw new BuildException("no");
+ throw new BuildException(Util.bind("jdtcom.sourcepath"/*nonNLS*/,file.getAbsolutePath()));
if(!file.isDirectory())
- throw new BuildException("no");
+ throw new BuildException(Util.bind("jdtcom.sourcedir"/*nonNLS*/,file.getAbsolutePath()));
DirectoryScanner ds = getDirectoryScanner(file);
String[] files = ds.getIncludedFiles();
for(int j = 0; j < files.length ; j++){
@@ -105,7 +105,7 @@ public class Jdtcom extends MatchingTask {
public void setTarget(String target){
if (!target.equals("1.1"/*nonNLS*/) && !target.equals("1.2"/*nonNLS*/))
- throw new BuildException("no");
+ throw new BuildException(Util.bind("jdtcom.target"/*nonNLS*/));
arguments.append(" -target "/*nonNLS*/);
arguments.append(target);
}
@@ -114,7 +114,7 @@ public class Jdtcom extends MatchingTask {
try {
new PrintWriter(new FileOutputStream(log.getAbsolutePath(), false));
} catch(IOException e){
- throw new BuildException("no");
+ throw new BuildException(Util.bind("jdtcom.log"/*nonNLS*/,log.getAbsolutePath()));
}
arguments.append(" -log "/*nonNLS*/);
arguments.append(log.getAbsolutePath());
@@ -122,7 +122,7 @@ public class Jdtcom extends MatchingTask {
public void setRepeat(int repeat){
if(repeat < 0)
- throw new BuildException("no");
+ throw new BuildException(Util.bind("jdtcom.repeat"/*nonNLS*/));
arguments.append(" -repeat "/*nonNLS*/);
arguments.append(String.valueOf(repeat));
}
@@ -143,7 +143,7 @@ public class Jdtcom extends MatchingTask {
!token.equals("unusedArguments"/*nonNLS*/) &&
!token.equals("syntheticAccess"/*nonNLS*/) &&
!token.equals("nls"/*nonNLS*/))
- throw new BuildException("no");
+ throw new BuildException(Util.bind("jdtcom.warning"/*nonNLS*/));
}
arguments.append(" -warn:"/*nonNLS*/+warning);
}
@@ -161,7 +161,7 @@ public class Jdtcom extends MatchingTask {
while (tokenizer.hasMoreTokens()) {
String token = tokenizer.nextToken();
if (!token.equals("vars"/*nonNLS*/) && !token.equals("lines"/*nonNLS*/) && !token.equals("source"/*nonNLS*/))
- throw new BuildException("no");
+ throw new BuildException(Util.bind("jdtcom.debug"/*nonNLS*/));
}
arguments.append(" -g:"/*nonNLS*/+debug);
}
diff --git a/org.eclipse.jdt.core/ant/org/eclipse/jdt/internal/core/ant/Util.java b/org.eclipse.jdt.core/ant/org/eclipse/jdt/internal/core/ant/Util.java
new file mode 100644
index 0000000000..5d8a2a7e54
--- /dev/null
+++ b/org.eclipse.jdt.core/ant/org/eclipse/jdt/internal/core/ant/Util.java
@@ -0,0 +1,92 @@
+package org.eclipse.jdt.internal.core.ant;
+
+import java.util.*;
+
+public class Util {
+
+
+ /* Bundle containing messages */
+ protected static ResourceBundle bundle;
+ private final static String bundleName = "org.eclipse.jdt.internal.core.Messages"/*nonNLS*/;
+
+
+ static {
+ relocalize();
+ }
+
+/**
+ * Lookup the message with the given ID in this catalog
+ */
+public static String bind(String id) {
+ return bind(id, (String[])null);
+}
+
+/**
+ * Lookup the message with the given ID in this catalog and bind its
+ * substitution locations with the given string values.
+ */
+public static String bind(String id, String[] bindings) {
+ if (id == null)
+ return "No message available"/*nonNLS*/;
+ String message = null;
+ try {
+ message = bundle.getString(id);
+ } catch (MissingResourceException e) {
+ // If we got an exception looking for the message, fail gracefully by just returning
+ // the id we were looking for. In most cases this is semi-informative so is not too bad.
+ return "Missing message: "/*nonNLS*/ + id + " in: "/*nonNLS*/ + bundleName;
+ }
+ if (bindings == null)
+ return message;
+ int length = message.length();
+ int start = -1;
+ int end = length;
+ StringBuffer output = new StringBuffer(80);
+ while (true) {
+ if ((end = message.indexOf('{', start)) > -1) {
+ output.append(message.substring(start + 1, end));
+ if ((start = message.indexOf('}', end)) > -1) {
+ int index = -1;
+ try {
+ index = Integer.parseInt(message.substring(end + 1, start));
+ output.append(bindings[index]);
+ } catch (NumberFormatException nfe) {
+ output.append(message.substring(end + 1, start + 1));
+ } catch (ArrayIndexOutOfBoundsException e) {
+ output.append("{missing "/*nonNLS*/ + Integer.toString(index) + "}"/*nonNLS*/);
+ }
+ } else {
+ output.append(message.substring(end, length));
+ break;
+ }
+ } else {
+ output.append(message.substring(start + 1, length));
+ break;
+ }
+ }
+ return output.toString();
+}
+
+/**
+ * Lookup the message with the given ID in this catalog and bind its
+ * substitution locations with the given string.
+ */
+public static String bind(String id, String binding) {
+ return bind(id, new String[] {binding});
+}
+
+/**
+ * Lookup the message with the given ID in this catalog and bind its
+ * substitution locations with the given strings.
+ */
+public static String bind(String id, String binding1, String binding2) {
+ return bind(id, new String[] {binding1, binding2});
+}
+
+/**
+ * Creates a NLS catalog for the given locale.
+ */
+public static void relocalize() {
+ bundle = ResourceBundle.getBundle(bundleName, Locale.getDefault());
+}
+}

Back to the top