You can subscribe to this list here.
| 2005 |
Jan
|
Feb
|
Mar
(41) |
Apr
(9) |
May
|
Jun
|
Jul
(39) |
Aug
(38) |
Sep
(135) |
Oct
(220) |
Nov
(75) |
Dec
(74) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2006 |
Jan
(44) |
Feb
(160) |
Mar
(49) |
Apr
(69) |
May
(40) |
Jun
(52) |
Jul
(47) |
Aug
(51) |
Sep
(19) |
Oct
(22) |
Nov
(36) |
Dec
(76) |
| 2007 |
Jan
(154) |
Feb
(165) |
Mar
(186) |
Apr
(143) |
May
(175) |
Jun
(133) |
Jul
(203) |
Aug
(177) |
Sep
(136) |
Oct
|
Nov
|
Dec
|
|
From: <caw...@us...> - 2007-01-24 14:50:51
|
Revision: 1872
http://svn.sourceforge.net/rubyeclipse/?rev=1872&view=rev
Author: cawilliams
Date: 2007-01-24 06:50:49 -0800 (Wed, 24 Jan 2007)
Log Message:
-----------
formatting changes, also change StepInto - previosuly it set frames to null and immediately tried to access the first element - so it should have always had a null pointer exception. Now it checks for null and non-empty frames and if that is true steps into top frame.
Modified Paths:
--------------
trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/model/RubyThread.java
Modified: trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/model/RubyThread.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/model/RubyThread.java 2007-01-24 14:48:40 UTC (rev 1871)
+++ trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/model/RubyThread.java 2007-01-24 14:50:49 UTC (rev 1872)
@@ -14,18 +14,13 @@
// see RubyDebugTarget for the reason why PlatformObject is being extended
public class RubyThread extends PlatformObject implements IThread {
+
private RubyStackFrame[] frames;
-
private IDebugTarget target;
-
private boolean isSuspended = false;
-
private boolean isTerminated = false;
-
private boolean isStepping = false;
-
private String name;
-
private int id;
public RubyThread(IDebugTarget target, int id) {
@@ -180,8 +175,9 @@
public void stepInto() throws DebugException {
isStepping = true;
this.updateName();
- this.frames = null;
- frames[0].stepInto();
+ if (frames != null && frames.length > 0) {
+ frames[0].stepInto();
+ }
}
public void stepOver() throws DebugException {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-01-24 14:48:42
|
Revision: 1871
http://svn.sourceforge.net/rubyeclipse/?rev=1871&view=rev
Author: cawilliams
Date: 2007-01-24 06:48:40 -0800 (Wed, 24 Jan 2007)
Log Message:
-----------
move copyright relates stuff into copyright section so license just contains CPL. Also add more description of the feature.
Modified Paths:
--------------
trunk/org.rubypeople.rdt-feature/feature.xml
Modified: trunk/org.rubypeople.rdt-feature/feature.xml
===================================================================
--- trunk/org.rubypeople.rdt-feature/feature.xml 2007-01-24 14:39:46 UTC (rev 1870)
+++ trunk/org.rubypeople.rdt-feature/feature.xml 2007-01-24 14:48:40 UTC (rev 1871)
@@ -8,26 +8,27 @@
<description>
Ruby Development Tools for Eclipse.
+
+RDT is a set of plugins for Eclipse which makes the platform a Ruby-aware IDE. RDT provides a ruby debugger, code outline, syntax highlighting, ri/rdoc integration, code completion, code folding, variable occurence marking and much more.
</description>
- <license>
+ <copyright>
The Ruby Development Tools (RDT) plugin for eclipse is subject
-to the Common Public License (CPL) v 1.0. All files of the RDT except
-for the external plug-ins and libraries named below are copyright of RubyPeople.
-RubyPeople is not a legal entity, but consists of the following people
-who have contributed to the RDT. Currently these are (in alphabetical order):
-
-Markus Barchfeld, David Corbin, Zach Dennis, Adam Williams and
+to the Common Public License (CPL) v 1.0. All files of the RDT
+except
+for the external plug-ins and libraries named below are copyright
+of RubyPeople.
+RubyPeople is not a legal entity, but consists of the following
+people
+who have contributed to the RDT. Currently these are (in alphabetical
+order):
+Markus Barchfeld, David Corbin, Zach Dennis, Adam Williams and
Chris Williams. See www.rubypeople.org for more information.
-
-The RDT feature contains the following plug-ins and libraries from external providers:
-
+The RDT feature contains the following plug-ins and libraries
+from external providers:
RegExp plug-in, http://e-p-i-c.sourceforge.net
-
JRuby, http://jruby.sourceforge.net
-
kxml2, http://kxml.sourceforge.net
-
The file org.rubypeople.rdt.launching/ruby/eclipseDebug.rb
is based on the debug.rb file, which is part of the ruby 1.6.8
release. Because of the nature of developing this plugin, many
@@ -36,7 +37,10 @@
jdt. We did not add the IBM copyright with every code fragment
of this kind. We think that this is in accordance with the CPL
and is not an intended removal of copyright.
-Common Public License Version 1.0
+ </copyright>
+
+ <license>
+ Common Public License Version 1.0
THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS
COMMON PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR
DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-01-24 14:39:49
|
Revision: 1870
http://svn.sourceforge.net/rubyeclipse/?rev=1870&view=rev
Author: cawilliams
Date: 2007-01-24 06:39:46 -0800 (Wed, 24 Jan 2007)
Log Message:
-----------
more moving to NLS based localization
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/RubyConventions.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/ReconcileWorkingCopyOperation.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyModel.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyModelStatus.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/util/Util.java
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/RubyConventions.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/RubyConventions.java 2007-01-24 14:11:53 UTC (rev 1869)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/RubyConventions.java 2007-01-24 14:39:46 UTC (rev 1870)
@@ -9,7 +9,6 @@
import org.eclipse.core.runtime.Status;
import org.rubypeople.rdt.internal.core.RubyModelStatus;
import org.rubypeople.rdt.internal.core.util.Messages;
-import org.rubypeople.rdt.internal.core.util.Util;
/**
* @author Chris
@@ -37,13 +36,13 @@
* indicating what is wrong with the name
*/
public static IStatus validateRubyScriptName(String name) {
- if (name == null) { return new Status(IStatus.ERROR, RubyCore.PLUGIN_ID, -1, Util.bind("convention.unit.nullName"), null); //$NON-NLS-1$
+ if (name == null) { return new Status(IStatus.ERROR, RubyCore.PLUGIN_ID, -1, Messages.bind(Messages.convention_unit_nullName), null);
}
- if (!org.rubypeople.rdt.internal.core.util.Util.isRubyLikeFileName(name)) { return new Status(IStatus.ERROR, RubyCore.PLUGIN_ID, -1, Util.bind("convention.unit.notJavaName"), null); //$NON-NLS-1$
+ if (!org.rubypeople.rdt.internal.core.util.Util.isRubyLikeFileName(name)) { return new Status(IStatus.ERROR, RubyCore.PLUGIN_ID, -1, Messages.bind(Messages.convention_unit_notJavaName), null);
}
int index;
index = name.lastIndexOf('.');
- if (index == -1) { return new Status(IStatus.ERROR, RubyCore.PLUGIN_ID, -1, Util.bind("convention.unit.notJavaName"), null); //$NON-NLS-1$
+ if (index == -1) { return new Status(IStatus.ERROR, RubyCore.PLUGIN_ID, -1, Messages.bind(Messages.convention_unit_notJavaName), null);
}
IStatus status = ResourcesPlugin.getWorkspace().validateName(name, IResource.FILE);
if (!status.isOK()) { return status; }
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/ReconcileWorkingCopyOperation.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/ReconcileWorkingCopyOperation.java 2007-01-24 14:11:53 UTC (rev 1869)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/ReconcileWorkingCopyOperation.java 2007-01-24 14:39:46 UTC (rev 1870)
@@ -17,6 +17,7 @@
import org.rubypeople.rdt.core.IRubyModelStatusConstants;
import org.rubypeople.rdt.core.RubyModelException;
import org.rubypeople.rdt.core.WorkingCopyOwner;
+import org.rubypeople.rdt.internal.core.util.Messages;
/**
* Reconcile a working copy and signal the changes through a delta.
@@ -44,8 +45,7 @@
protected void executeOperation() throws RubyModelException {
if (this.progressMonitor != null) {
if (this.progressMonitor.isCanceled()) throw new OperationCanceledException();
- this.progressMonitor.beginTask(org.rubypeople.rdt.internal.core.util.Util
- .bind("element.reconciling"), 2); //$NON-NLS-1$
+ this.progressMonitor.beginTask(Messages.bind(Messages.element_reconciling), 2);
}
RubyScript workingCopy = getWorkingCopy();
boolean wasConsistent = workingCopy.isConsistent();
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyModel.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyModel.java 2007-01-24 14:11:53 UTC (rev 1869)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyModel.java 2007-01-24 14:39:46 UTC (rev 1870)
@@ -24,6 +24,7 @@
import org.rubypeople.rdt.core.IRubyModel;
import org.rubypeople.rdt.core.IRubyProject;
import org.rubypeople.rdt.core.RubyModelException;
+import org.rubypeople.rdt.internal.core.util.Messages;
/**
* @author Chris
@@ -173,7 +174,7 @@
case IResource.PROJECT:
return new RubyProject((IProject) resource, this);
default:
- throw new IllegalArgumentException(org.rubypeople.rdt.internal.core.util.Util.bind("element.invalidResourceForProject")); //$NON-NLS-1$
+ throw new IllegalArgumentException(Messages.bind(Messages.element_invalidResourceForProject));
}
}
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyModelStatus.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyModelStatus.java 2007-01-24 14:11:53 UTC (rev 1869)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyModelStatus.java 2007-01-24 14:39:46 UTC (rev 1870)
@@ -20,7 +20,7 @@
import org.rubypeople.rdt.core.IRubyModelStatusConstants;
import org.rubypeople.rdt.core.IRubyProject;
import org.rubypeople.rdt.core.RubyCore;
-import org.rubypeople.rdt.internal.core.util.Util;
+import org.rubypeople.rdt.internal.core.util.Messages;
/**
* @see IRubyModelStatus
@@ -52,7 +52,7 @@
/**
* Singleton OK object
*/
- public static final IRubyModelStatus VERIFIED_OK = new RubyModelStatus(OK, OK, Util.bind("status.OK")); //$NON-NLS-1$
+ public static final IRubyModelStatus VERIFIED_OK = new RubyModelStatus(OK, OK, Messages.bind(Messages.status_OK));
/**
* Constructs an Ruby model status with no corresponding elements.
@@ -172,40 +172,40 @@
if (exception == null) {
switch (getCode()) {
case CORE_EXCEPTION :
- return Util.bind("status.coreException"); //$NON-NLS-1$
+ return Messages.bind(Messages.status_coreException);
case BUILDER_INITIALIZATION_ERROR:
- return Util.bind("build.initializationError"); //$NON-NLS-1$
+ return Messages.bind(Messages.build_initializationError);
case BUILDER_SERIALIZATION_ERROR:
- return Util.bind("build.serializationError"); //$NON-NLS-1$
+ return Messages.bind(Messages.build_serializationError);
case DEVICE_PATH:
- return Util.bind("status.cannotUseDeviceOnPath", getPath().toString()); //$NON-NLS-1$
+ return Messages.bind(Messages.status_cannotUseDeviceOnPath, getPath().toString());
case DOM_EXCEPTION:
- return Util.bind("status.JDOMError"); //$NON-NLS-1$
+ return Messages.bind(Messages.status_JDOMError);
case ELEMENT_DOES_NOT_EXIST:
- return Util.bind("element.doesNotExist",((RubyElement)elements[0]).toStringWithAncestors()); //$NON-NLS-1$
+ return Messages.bind(Messages.element_doesNotExist,((RubyElement)elements[0]).toStringWithAncestors());
case ELEMENT_NOT_ON_CLASSPATH:
- return Util.bind("element.notOnClasspath",((RubyElement)elements[0]).toStringWithAncestors()); //$NON-NLS-1$
+ return Messages.bind(Messages.element_notOnClasspath,((RubyElement)elements[0]).toStringWithAncestors());
case EVALUATION_ERROR:
- return Util.bind("status.evaluationError", string); //$NON-NLS-1$
+ return Messages.bind(Messages.status_evaluationError, string);
case INDEX_OUT_OF_BOUNDS:
- return Util.bind("status.indexOutOfBounds"); //$NON-NLS-1$
+ return Messages.bind(Messages.status_indexOutOfBounds);
case INVALID_CONTENTS:
- return Util.bind("status.invalidContents"); //$NON-NLS-1$
+ return Messages.bind(Messages.status_invalidContents);
case INVALID_DESTINATION:
- return Util.bind("status.invalidDestination", ((RubyElement)elements[0]).toStringWithAncestors()); //$NON-NLS-1$
+ return Messages.bind(Messages.status_invalidDestination, ((RubyElement)elements[0]).toStringWithAncestors());
case INVALID_ELEMENT_TYPES:
- StringBuffer buff= new StringBuffer(Util.bind("operation.notSupported")); //$NON-NLS-1$
+ StringBuffer buff= new StringBuffer(Messages.bind(Messages.operation_notSupported));
for (int i= 0; i < elements.length; i++) {
if (i > 0) {
buff.append(", "); //$NON-NLS-1$
@@ -215,81 +215,81 @@
return buff.toString();
case INVALID_NAME:
- return Util.bind("status.invalidName", string); //$NON-NLS-1$
+ return Messages.bind(Messages.status_invalidName, string);
case INVALID_PACKAGE:
- return Util.bind("status.invalidPackage", string); //$NON-NLS-1$
+ return Messages.bind(Messages.status_invalidPackage, string);
case INVALID_PATH:
if (string != null) {
return string;
}
- return Util.bind("status.invalidPath", getPath() == null ? "null" : getPath().toString()); //$NON-NLS-1$ //$NON-NLS-2$
+ return Messages.bind(Messages.status_invalidPath, getPath() == null ? "null" : getPath().toString()); //$NON-NLS-1$
case INVALID_PROJECT:
- return Util.bind("status.invalidProject", string); //$NON-NLS-1$
+ return Messages.bind(Messages.status_invalidProject, string);
case INVALID_RESOURCE:
- return Util.bind("status.invalidResource", string); //$NON-NLS-1$
+ return Messages.bind(Messages.status_invalidResource, string);
case INVALID_RESOURCE_TYPE:
- return Util.bind("status.invalidResourceType", string); //$NON-NLS-1$
+ return Messages.bind(Messages.status_invalidResourceType, string);
case INVALID_SIBLING:
if (string != null) {
- return Util.bind("status.invalidSibling", string); //$NON-NLS-1$
+ return Messages.bind(Messages.status_invalidSibling, string);
}
- return Util.bind("status.invalidSibling", ((RubyElement)elements[0]).toStringWithAncestors()); //$NON-NLS-1$
+ return Messages.bind(Messages.status_invalidSibling, ((RubyElement)elements[0]).toStringWithAncestors());
case IO_EXCEPTION:
- return Util.bind("status.IOException"); //$NON-NLS-1$
+ return Messages.bind(Messages.status_IOException);
case NAME_COLLISION:
if (string != null) {
return string;
}
- return Util.bind("status.nameCollision", ""); //$NON-NLS-1$ //$NON-NLS-2$
+ return Messages.bind(Messages.status_nameCollision, ""); //$NON-NLS-1$
case NO_ELEMENTS_TO_PROCESS:
- return Util.bind("operation.needElements"); //$NON-NLS-1$
+ return Messages.bind(Messages.operation_needElements);
case NULL_NAME:
- return Util.bind("operation.needName"); //$NON-NLS-1$
+ return Messages.bind(Messages.operation_needName);
case NULL_PATH:
- return Util.bind("operation.needPath"); //$NON-NLS-1$
+ return Messages.bind(Messages.operation_needPath);
case NULL_STRING:
- return Util.bind("operation.needString"); //$NON-NLS-1$
+ return Messages.bind(Messages.operation_needString);
case PATH_OUTSIDE_PROJECT:
- return Util.bind("operation.pathOutsideProject", string, ((RubyElement)elements[0]).toStringWithAncestors()); //$NON-NLS-1$
+ return Messages.bind(Messages.operation_pathOutsideProject, string, ((RubyElement)elements[0]).toStringWithAncestors());
case READ_ONLY:
IRubyElement element = elements[0];
String name = element.getElementName();
- return Util.bind("status.readOnly", name); //$NON-NLS-1$
+ return Messages.bind(Messages.status_readOnly, name);
case RELATIVE_PATH:
- return Util.bind("operation.needAbsolutePath", getPath().toString()); //$NON-NLS-1$
+ return Messages.bind(Messages.operation_needAbsolutePath, getPath().toString());
case TARGET_EXCEPTION:
- return Util.bind("status.targetException"); //$NON-NLS-1$
+ return Messages.bind(Messages.status_targetException);
case UPDATE_CONFLICT:
- return Util.bind("status.updateConflict"); //$NON-NLS-1$
+ return Messages.bind(Messages.status_updateConflict);
case NO_LOCAL_CONTENTS :
- return Util.bind("status.noLocalContents", getPath().toString()); //$NON-NLS-1$
+ return Messages.bind(Messages.status_noLocalContents, getPath().toString());
case CP_VARIABLE_PATH_UNBOUND:
IRubyProject javaProject = (IRubyProject)elements[0];
- return Util.bind("classpath.unboundVariablePath", path.makeRelative().toString(), javaProject.getElementName()); //$NON-NLS-1$
+ return Messages.bind(Messages.classpath_unboundVariablePath, path.makeRelative().toString(), javaProject.getElementName());
case CLASSPATH_CYCLE:
javaProject = (IRubyProject)elements[0];
- return Util.bind("classpath.cycle", javaProject.getElementName()); //$NON-NLS-1$
+ return Messages.bind(Messages.classpath_cycle, javaProject.getElementName());
case DISABLED_CP_EXCLUSION_PATTERNS:
javaProject = (IRubyProject)elements[0];
@@ -298,7 +298,7 @@
if (path.segment(0).toString().equals(projectName)) {
newPath = path.removeFirstSegments(1);
}
- return Util.bind("classpath.disabledInclusionExclusionPatterns", newPath.makeRelative().toString(), projectName); //$NON-NLS-1$
+ return Messages.bind(Messages.classpath_disabledInclusionExclusionPatterns, newPath.makeRelative().toString(), projectName);
case DISABLED_CP_MULTIPLE_OUTPUT_LOCATIONS:
javaProject = (IRubyProject)elements[0];
@@ -307,7 +307,7 @@
if (path.segment(0).toString().equals(projectName)) {
newPath = path.removeFirstSegments(1);
}
- return Util.bind("classpath.disabledMultipleOutputLocations", newPath.makeRelative().toString(), projectName); //$NON-NLS-1$
+ return Messages.bind(Messages.classpath_disabledMultipleOutputLocations, newPath.makeRelative().toString(), projectName);
}
if (string != null) {
return string;
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/util/Util.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/util/Util.java 2007-01-24 14:11:53 UTC (rev 1869)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/util/Util.java 2007-01-24 14:39:46 UTC (rev 1870)
@@ -11,9 +11,6 @@
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.net.URI;
-import java.util.Locale;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
import org.eclipse.core.filesystem.EFS;
import org.eclipse.core.filesystem.IFileStore;
@@ -42,20 +39,10 @@
*/
public class Util {
- /* Bundle containing messages */
- protected static ResourceBundle bundle;
private static boolean ENABLE_RUBY_LIKE_EXTENSIONS = true;
private static char[][] RUBY_LIKE_EXTENSIONS;
private static char[][] RUBY_LIKE_FILENAMES;
- private final static String bundleName = "org.rubypeople.rdt.internal.core.util.messages"; //$NON-NLS-1$
- private final static char[] DOUBLE_QUOTES = "''".toCharArray(); //$NON-NLS-1$
- private final static char[] SINGLE_QUOTE = "'".toCharArray(); //$NON-NLS-1$
-
- static {
- relocalize();
- }
-
private Util() {
// cannot be instantiated
}
@@ -107,123 +94,6 @@
}
}
- /**
- * Creates a NLS catalog for the given locale.
- */
- public static void relocalize() {
- try {
- bundle = ResourceBundle.getBundle(bundleName, Locale.getDefault());
- } catch (MissingResourceException e) {
- System.out
- .println("Missing resource : " + bundleName.replace('.', '/') + ".properties for locale " + Locale.getDefault()); //$NON-NLS-1$//$NON-NLS-2$
- throw e;
- }
- }
-
- /**
- * 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[] arguments) {
- if (id == null) return "No message available"; //$NON-NLS-1$
- 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: " + id + " in: " + bundleName; //$NON-NLS-2$ //$NON-NLS-1$
- }
- // for compatibility with MessageFormat which eliminates double quotes
- // in original message
- char[] messageWithNoDoubleQuotes = CharOperation.replace(message.toCharArray(),
- DOUBLE_QUOTES, SINGLE_QUOTE);
-
- if (arguments == null) return new String(messageWithNoDoubleQuotes);
-
- int length = messageWithNoDoubleQuotes.length;
- int start = 0;
- int end = length;
- StringBuffer output = null;
- while (true) {
- if ((end = CharOperation.indexOf('{', messageWithNoDoubleQuotes, start)) > -1) {
- if (output == null) output = new StringBuffer(length + arguments.length * 20);
- output.append(messageWithNoDoubleQuotes, start, end - start);
- if ((start = CharOperation.indexOf('}', messageWithNoDoubleQuotes, end + 1)) > -1) {
- int index = -1;
- String argId = new String(messageWithNoDoubleQuotes, end + 1, start - end - 1);
- try {
- index = Integer.parseInt(argId);
- if (arguments[index] == null) {
- output.append('{').append(argId).append('}'); // leave
- // parameter
- // in
- // since
- // no
- // better
- // arg
- // '{0}'
- } else {
- output.append(arguments[index]);
- }
- } catch (NumberFormatException nfe) { // could be nested
- // message ID
- // {compiler.name}
- boolean done = false;
- if (!id.equals(argId)) {
- String argMessage = null;
- try {
- argMessage = bundle.getString(argId);
- output.append(argMessage);
- done = true;
- } catch (MissingResourceException e) {
- // unable to bind argument, ignore (will leave
- // argument in)
- }
- }
- if (!done) output.append(messageWithNoDoubleQuotes, end + 1, start - end);
- } catch (ArrayIndexOutOfBoundsException e) {
- output.append("{missing " + Integer.toString(index) + "}"); //$NON-NLS-2$ //$NON-NLS-1$
- }
- start++;
- } else {
- output.append(messageWithNoDoubleQuotes, end, length);
- break;
- }
- } else {
- if (output == null) return new String(messageWithNoDoubleQuotes);
- output.append(messageWithNoDoubleQuotes, start, length - start);
- 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});
- }
-
/*
* Returns whether the given resource path matches one of the
* inclusion/exclusion patterns. NOTE: should not be asked directly using
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-01-24 14:11:54
|
Revision: 1869
http://svn.sourceforge.net/rubyeclipse/?rev=1869&view=rev
Author: cawilliams
Date: 2007-01-24 06:11:53 -0800 (Wed, 24 Jan 2007)
Log Message:
-----------
trying to fix debugging - implementation Is tole from JDT forcibly terminated the debug Target and process too early. Modified to not do that (but the debugger is throwing erros for me - presumably from our previous incompatibility problems with particular ruby versions)
Modified Paths:
--------------
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMDebugger.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/AbstractVMRunner.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/IRubyLaunchConfigurationConstants.java
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMDebugger.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMDebugger.java 2007-01-23 21:46:17 UTC (rev 1868)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMDebugger.java 2007-01-24 14:11:53 UTC (rev 1869)
@@ -134,19 +134,18 @@
launch.addDebugTarget(debugTarget);
} catch (IOException e) {
abort(LaunchingMessages.StandardVMDebugger_Couldn__t_connect_to_VM_4, e, IRubyLaunchConfigurationConstants.ERR_CONNECTION_FAILED);
+ debugTarget.terminate();
} catch (RubyProcessingException e) {
abort(LaunchingMessages.StandardVMDebugger_Couldn__t_connect_to_VM_5, e, IRubyLaunchConfigurationConstants.ERR_CONNECTION_FAILED);
- } finally {
- // FIXME Should this always terminate, or just on exceptions?
debugTarget.terminate();
}
} else {
LaunchingPlugin.log(new Status(IStatus.ERROR, LaunchingPlugin.PLUGIN_ID, IStatus.ERROR, LaunchingMessages.RdtLaunchingPlugin_processTerminatedBecauseNoDebuggerConnection, null));
debugTarget.terminate();
}
- if (p != null) {
- p.destroy();
- }
+// if (p != null) {
+// p.destroy();
+// }
}
/**
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/AbstractVMRunner.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/AbstractVMRunner.java 2007-01-23 21:46:17 UTC (rev 1868)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/AbstractVMRunner.java 2007-01-24 14:11:53 UTC (rev 1869)
@@ -30,7 +30,7 @@
* Clients implementing VM runners should subclass this class.
* </p>
* @see IVMRunner
- * @since 2.0
+ * @since 0.9.0
*/
public abstract class AbstractVMRunner implements IVMRunner {
@@ -64,12 +64,12 @@
}
/**
- * @since 3.0
+ * @since 0.9.0
* @see DebugPlugin#exec(String[], File, String[])
*/
protected Process exec(String[] cmdLine, File workingDirectory, String[] envp) throws CoreException {
LaunchingPlugin.debug("Starting: " + getCmdLineAsString(cmdLine)) ;
- return DebugPlugin.exec(new String[] { "/bin/sleep" ,"120" }, workingDirectory, envp);
+ return DebugPlugin.exec(cmdLine, workingDirectory, envp);
}
/**
@@ -106,7 +106,7 @@
* @param attributes values for the attribute map
* @return the new process
* @throws CoreException problems occurred creating the process
- * @since 3.0
+ * @since 0.9.0
*/
protected IProcess newProcess(ILaunch launch, Process p, String label, Map attributes) throws CoreException {
IProcess process= DebugPlugin.newProcess(launch, p, label, attributes);
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/IRubyLaunchConfigurationConstants.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/IRubyLaunchConfigurationConstants.java 2007-01-23 21:46:17 UTC (rev 1868)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/IRubyLaunchConfigurationConstants.java 2007-01-24 14:11:53 UTC (rev 1869)
@@ -78,13 +78,13 @@
* <code>ATTR_VM_INSTALL_TYPE_SPECIFIC_ATTRS_MAP</code>. The value is a String,
* indicating the String to use to invoke the Ruby VM.
*/
- public static final String ATTR_RUBY_COMMAND = LaunchingPlugin.PLUGIN_ID + ".RUBY_COMMAND"; //$NON-NLS-1$
+ public static final String ATTR_RUBY_COMMAND = LaunchingPlugin.getUniqueIdentifier() + ".RUBY_COMMAND"; //$NON-NLS-1$
/**
* Launch configuration attribute key. The value is a name of
* a Ruby project associated with a Ruby launch configuration.
*/
- public static final String ATTR_PROJECT_NAME = LaunchingPlugin.PLUGIN_ID + ".PROJECT_NAME"; //$NON-NLS-1$
+ public static final String ATTR_PROJECT_NAME = LaunchingPlugin.getUniqueIdentifier() + ".PROJECT_NAME"; //$NON-NLS-1$
/**
@@ -109,7 +109,7 @@
*
* @deprecated use <code>ATTR_RUBY_CONTAINER_PATH</code>
*/
- public static final String ATTR_VM_INSTALL_NAME = LaunchingPlugin.PLUGIN_ID + ".VM_INSTALL_NAME"; //$NON-NLS-1$
+ public static final String ATTR_VM_INSTALL_NAME = LaunchingPlugin.getUniqueIdentifier() + ".VM_INSTALL_NAME"; //$NON-NLS-1$
/**
* Launch configuration attribute key. The value is an identifier of
@@ -120,21 +120,21 @@
*
* @deprecated use <code>ATTR_RUBY_CONTAINER_PATH</code>
*/
- public static final String ATTR_VM_INSTALL_TYPE = LaunchingPlugin.PLUGIN_ID + ".VM_INSTALL_TYPE_ID"; //$NON-NLS-1$
+ public static final String ATTR_VM_INSTALL_TYPE = LaunchingPlugin.getUniqueIdentifier() + ".VM_INSTALL_TYPE_ID"; //$NON-NLS-1$
/**
* Launch configuration attribute key. The value is a string specifying
* program arguments for a Ruby launch configuration, as they should appear
* on the command line.
*/
- public static final String ATTR_PROGRAM_ARGUMENTS = LaunchingPlugin.PLUGIN_ID + ".PROGRAM_ARGUMENTS"; //$NON-NLS-1$
+ public static final String ATTR_PROGRAM_ARGUMENTS = LaunchingPlugin.getUniqueIdentifier() + ".PROGRAM_ARGUMENTS"; //$NON-NLS-1$
/**
* Launch configuration attribute key. The value is a string specifying
* VM arguments for a Ruby launch configuration, as they should appear
* on the command line.
*/
- public static final String ATTR_VM_ARGUMENTS = LaunchingPlugin.PLUGIN_ID + ".VM_ARGUMENTS"; //$NON-NLS-1$
+ public static final String ATTR_VM_ARGUMENTS = LaunchingPlugin.getUniqueIdentifier() + ".VM_ARGUMENTS"; //$NON-NLS-1$
/**
* Launch configuration attribute key. The value is a string specifying a
@@ -146,7 +146,7 @@
* launch configuration, the working directory is inherited from the current
* process.
*/
- public static final String ATTR_WORKING_DIRECTORY = LaunchingPlugin.PLUGIN_ID + ".WORKING_DIRECTORY"; //$NON-NLS-1$
+ public static final String ATTR_WORKING_DIRECTORY = LaunchingPlugin.getUniqueIdentifier() + ".WORKING_DIRECTORY"; //$NON-NLS-1$
/**
* Launch configuration attribute key. The value is a Map of attributes specific
@@ -155,13 +155,13 @@
* when launching a VM. The attributes in the map are implementation dependent
* and are limited to String keys and values.
*/
- public static final String ATTR_VM_INSTALL_TYPE_SPECIFIC_ATTRS_MAP = LaunchingPlugin.PLUGIN_ID + "VM_INSTALL_TYPE_SPECIFIC_ATTRS_MAP"; //$NON-NLS-1$
+ public static final String ATTR_VM_INSTALL_TYPE_SPECIFIC_ATTRS_MAP = LaunchingPlugin.getUniqueIdentifier() + "VM_INSTALL_TYPE_SPECIFIC_ATTRS_MAP"; //$NON-NLS-1$
/**
* Launch configuration attribute key. The value is a fully qualified name
* of a file to launch.
*/
- public static final String ATTR_FILE_NAME = LaunchingPlugin.PLUGIN_ID + ".FILE_NAME"; //$NON-NLS-1$
+ public static final String ATTR_FILE_NAME = LaunchingPlugin.getUniqueIdentifier() + ".FILE_NAME"; //$NON-NLS-1$
/**
* Launch configuration attribute key. The value is an identifier of a
@@ -169,7 +169,7 @@
* for a launch configuration. When unspecified, the default loadpath
* provider is used - <code>StandardLoadpathProvider</code>.
*/
- public static final String ATTR_LOADPATH_PROVIDER = LaunchingPlugin.PLUGIN_ID + ".LOADPATH_PROVIDER"; //$NON-NLS-1$
+ public static final String ATTR_LOADPATH_PROVIDER = LaunchingPlugin.getUniqueIdentifier() + ".LOADPATH_PROVIDER"; //$NON-NLS-1$
/**
* Launch configuration attribute key. The value is a boolean specifying
@@ -179,7 +179,7 @@
* unspecified, a loadpath is computed by the loadpath provider associated
* with a launch configuration.
*/
- public static final String ATTR_DEFAULT_LOADPATH = LaunchingPlugin.PLUGIN_ID + ".DEFAULT_LOADPATH"; //$NON-NLS-1$
+ public static final String ATTR_DEFAULT_LOADPATH = LaunchingPlugin.getUniqueIdentifier() + ".DEFAULT_LOADPATH"; //$NON-NLS-1$
/**
* Launch configuration attribute key. The attribute value is an ordered list of strings
@@ -187,6 +187,6 @@
* loadpath is generated by the loadpath provider associated with a launch
* configuration (via the <code>ATTR_LOADPATH_PROVIDER</code> attribute).
*/
- public static final String ATTR_LOADPATH = LaunchingPlugin.PLUGIN_ID + ".LOADPATH"; //$NON-NLS-1$
+ public static final String ATTR_LOADPATH = LaunchingPlugin.getUniqueIdentifier() + ".LOADPATH"; //$NON-NLS-1$
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mba...@us...> - 2007-01-23 21:46:19
|
Revision: 1868
http://svn.sourceforge.net/rubyeclipse/?rev=1868&view=rev
Author: mbarchfe
Date: 2007-01-23 13:46:17 -0800 (Tue, 23 Jan 2007)
Log Message:
-----------
fix for using a debug launch configuration on linux
Modified Paths:
--------------
trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/launcher/LoadPathEntryLabelProvider.java
trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/launcher/RubyArgumentsTab.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/AbstractVMRunner.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/IRubyLaunchConfigurationConstants.java
Modified: trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/launcher/LoadPathEntryLabelProvider.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/launcher/LoadPathEntryLabelProvider.java 2007-01-23 21:10:19 UTC (rev 1867)
+++ trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/launcher/LoadPathEntryLabelProvider.java 2007-01-23 21:46:17 UTC (rev 1868)
@@ -22,6 +22,10 @@
public String getText(Object element) {
if (element != null && element.getClass() == LoadpathEntry.class) {
IProject project = ((LoadpathEntry) element).getProject();
+ // TODO: quick fix
+ if (project == null) {
+ return "Project is null" ;
+ }
if (project.isAccessible()) {
return project.getLocation().toOSString() ;
}
Modified: trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/launcher/RubyArgumentsTab.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/launcher/RubyArgumentsTab.java 2007-01-23 21:10:19 UTC (rev 1867)
+++ trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/launcher/RubyArgumentsTab.java 2007-01-23 21:46:17 UTC (rev 1868)
@@ -84,7 +84,7 @@
if (useDefaultWorkingDirectoryButton.getSelection() != useDefault)
useDefaultWorkingDirectoryButton.setSelection(useDefault);
if (useDefault) {
- workingDirectorySelector.setSelectionText((String)null);
+ workingDirectorySelector.setSelectionText((String)"");
}
workingDirectorySelector.setEnabled(!useDefault);
}
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/AbstractVMRunner.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/AbstractVMRunner.java 2007-01-23 21:10:19 UTC (rev 1867)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/AbstractVMRunner.java 2007-01-23 21:46:17 UTC (rev 1868)
@@ -22,6 +22,7 @@
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.model.IProcess;
import org.rubypeople.rdt.internal.launching.LaunchingMessages;
+import org.rubypeople.rdt.internal.launching.LaunchingPlugin;
/**
* Abstract implementation of a VM runner.
@@ -67,7 +68,8 @@
* @see DebugPlugin#exec(String[], File, String[])
*/
protected Process exec(String[] cmdLine, File workingDirectory, String[] envp) throws CoreException {
- return DebugPlugin.exec(cmdLine, workingDirectory, envp);
+ LaunchingPlugin.debug("Starting: " + getCmdLineAsString(cmdLine)) ;
+ return DebugPlugin.exec(new String[] { "/bin/sleep" ,"120" }, workingDirectory, envp);
}
/**
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/IRubyLaunchConfigurationConstants.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/IRubyLaunchConfigurationConstants.java 2007-01-23 21:10:19 UTC (rev 1867)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/IRubyLaunchConfigurationConstants.java 2007-01-23 21:46:17 UTC (rev 1868)
@@ -78,13 +78,13 @@
* <code>ATTR_VM_INSTALL_TYPE_SPECIFIC_ATTRS_MAP</code>. The value is a String,
* indicating the String to use to invoke the Ruby VM.
*/
- public static final String ATTR_RUBY_COMMAND = LaunchingPlugin.getUniqueIdentifier() + ".RUBY_COMMAND"; //$NON-NLS-1$
+ public static final String ATTR_RUBY_COMMAND = LaunchingPlugin.PLUGIN_ID + ".RUBY_COMMAND"; //$NON-NLS-1$
/**
* Launch configuration attribute key. The value is a name of
* a Ruby project associated with a Ruby launch configuration.
*/
- public static final String ATTR_PROJECT_NAME = LaunchingPlugin.getUniqueIdentifier() + ".PROJECT_ATTR"; //$NON-NLS-1$
+ public static final String ATTR_PROJECT_NAME = LaunchingPlugin.PLUGIN_ID + ".PROJECT_NAME"; //$NON-NLS-1$
/**
@@ -109,7 +109,7 @@
*
* @deprecated use <code>ATTR_RUBY_CONTAINER_PATH</code>
*/
- public static final String ATTR_VM_INSTALL_NAME = LaunchingPlugin.getUniqueIdentifier() + ".VM_INSTALL_NAME"; //$NON-NLS-1$
+ public static final String ATTR_VM_INSTALL_NAME = LaunchingPlugin.PLUGIN_ID + ".VM_INSTALL_NAME"; //$NON-NLS-1$
/**
* Launch configuration attribute key. The value is an identifier of
@@ -120,21 +120,21 @@
*
* @deprecated use <code>ATTR_RUBY_CONTAINER_PATH</code>
*/
- public static final String ATTR_VM_INSTALL_TYPE = LaunchingPlugin.getUniqueIdentifier() + ".VM_INSTALL_TYPE_ID"; //$NON-NLS-1$
+ public static final String ATTR_VM_INSTALL_TYPE = LaunchingPlugin.PLUGIN_ID + ".VM_INSTALL_TYPE_ID"; //$NON-NLS-1$
/**
* Launch configuration attribute key. The value is a string specifying
* program arguments for a Ruby launch configuration, as they should appear
* on the command line.
*/
- public static final String ATTR_PROGRAM_ARGUMENTS = LaunchingPlugin.getUniqueIdentifier() + ".PROGRAM_ARGUMENTS"; //$NON-NLS-1$
+ public static final String ATTR_PROGRAM_ARGUMENTS = LaunchingPlugin.PLUGIN_ID + ".PROGRAM_ARGUMENTS"; //$NON-NLS-1$
/**
* Launch configuration attribute key. The value is a string specifying
* VM arguments for a Ruby launch configuration, as they should appear
* on the command line.
*/
- public static final String ATTR_VM_ARGUMENTS = LaunchingPlugin.getUniqueIdentifier() + ".VM_ARGUMENTS"; //$NON-NLS-1$
+ public static final String ATTR_VM_ARGUMENTS = LaunchingPlugin.PLUGIN_ID + ".VM_ARGUMENTS"; //$NON-NLS-1$
/**
* Launch configuration attribute key. The value is a string specifying a
@@ -146,7 +146,7 @@
* launch configuration, the working directory is inherited from the current
* process.
*/
- public static final String ATTR_WORKING_DIRECTORY = LaunchingPlugin.getUniqueIdentifier() + ".WORKING_DIRECTORY"; //$NON-NLS-1$
+ public static final String ATTR_WORKING_DIRECTORY = LaunchingPlugin.PLUGIN_ID + ".WORKING_DIRECTORY"; //$NON-NLS-1$
/**
* Launch configuration attribute key. The value is a Map of attributes specific
@@ -155,13 +155,13 @@
* when launching a VM. The attributes in the map are implementation dependent
* and are limited to String keys and values.
*/
- public static final String ATTR_VM_INSTALL_TYPE_SPECIFIC_ATTRS_MAP = LaunchingPlugin.getUniqueIdentifier() + "VM_INSTALL_TYPE_SPECIFIC_ATTRS_MAP"; //$NON-NLS-1$
+ public static final String ATTR_VM_INSTALL_TYPE_SPECIFIC_ATTRS_MAP = LaunchingPlugin.PLUGIN_ID + "VM_INSTALL_TYPE_SPECIFIC_ATTRS_MAP"; //$NON-NLS-1$
/**
* Launch configuration attribute key. The value is a fully qualified name
* of a file to launch.
*/
- public static final String ATTR_FILE_NAME = LaunchingPlugin.getUniqueIdentifier() + ".FILE_NAME"; //$NON-NLS-1$
+ public static final String ATTR_FILE_NAME = LaunchingPlugin.PLUGIN_ID + ".FILE_NAME"; //$NON-NLS-1$
/**
* Launch configuration attribute key. The value is an identifier of a
@@ -169,7 +169,7 @@
* for a launch configuration. When unspecified, the default loadpath
* provider is used - <code>StandardLoadpathProvider</code>.
*/
- public static final String ATTR_LOADPATH_PROVIDER = LaunchingPlugin.getUniqueIdentifier() + ".LOADPATH_PROVIDER"; //$NON-NLS-1$
+ public static final String ATTR_LOADPATH_PROVIDER = LaunchingPlugin.PLUGIN_ID + ".LOADPATH_PROVIDER"; //$NON-NLS-1$
/**
* Launch configuration attribute key. The value is a boolean specifying
@@ -179,7 +179,7 @@
* unspecified, a loadpath is computed by the loadpath provider associated
* with a launch configuration.
*/
- public static final String ATTR_DEFAULT_LOADPATH = LaunchingPlugin.getUniqueIdentifier() + ".DEFAULT_LOADPATH"; //$NON-NLS-1$
+ public static final String ATTR_DEFAULT_LOADPATH = LaunchingPlugin.PLUGIN_ID + ".DEFAULT_LOADPATH"; //$NON-NLS-1$
/**
* Launch configuration attribute key. The attribute value is an ordered list of strings
@@ -187,6 +187,6 @@
* loadpath is generated by the loadpath provider associated with a launch
* configuration (via the <code>ATTR_LOADPATH_PROVIDER</code> attribute).
*/
- public static final String ATTR_LOADPATH = LaunchingPlugin.getUniqueIdentifier() + ".LOADPATH"; //$NON-NLS-1$
+ public static final String ATTR_LOADPATH = LaunchingPlugin.PLUGIN_ID + ".LOADPATH"; //$NON-NLS-1$
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-01-23 21:10:25
|
Revision: 1867
http://svn.sourceforge.net/rubyeclipse/?rev=1867&view=rev
Author: cawilliams
Date: 2007-01-23 13:10:19 -0800 (Tue, 23 Jan 2007)
Log Message:
-----------
ha! fixed the issue where you had to swap default VMs to get the loadpath variables to be resolved.
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyModelManager.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyProject.java
Added Paths:
-----------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/compiler/util/HashtableOfObjectToInt.java
Added: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/compiler/util/HashtableOfObjectToInt.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/compiler/util/HashtableOfObjectToInt.java (rev 0)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/compiler/util/HashtableOfObjectToInt.java 2007-01-23 21:10:19 UTC (rev 1867)
@@ -0,0 +1,155 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 IBM Corporation 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.rubypeople.rdt.internal.compiler.util;
+
+/**
+ * Hashtable of {Object --> int }
+ */
+public final class HashtableOfObjectToInt implements Cloneable {
+
+ // to avoid using Enumerations, walk the individual tables skipping nulls
+ public Object[] keyTable;
+ public int[] valueTable;
+
+ public int elementSize; // number of elements in the table
+ int threshold;
+
+ public HashtableOfObjectToInt() {
+ this(13);
+ }
+
+ public HashtableOfObjectToInt(int size) {
+
+ this.elementSize = 0;
+ this.threshold = size; // size represents the expected number of elements
+ int extraRoom = (int) (size * 1.75f);
+ if (this.threshold == extraRoom)
+ extraRoom++;
+ this.keyTable = new Object[extraRoom];
+ this.valueTable = new int[extraRoom];
+ }
+
+ public Object clone() throws CloneNotSupportedException {
+ HashtableOfObjectToInt result = (HashtableOfObjectToInt) super.clone();
+ result.elementSize = this.elementSize;
+ result.threshold = this.threshold;
+
+ int length = this.keyTable.length;
+ result.keyTable = new Object[length];
+ System.arraycopy(this.keyTable, 0, result.keyTable, 0, length);
+
+ length = this.valueTable.length;
+ result.valueTable = new int[length];
+ System.arraycopy(this.valueTable, 0, result.valueTable, 0, length);
+ return result;
+ }
+
+ public boolean containsKey(Object key) {
+ int length = this.keyTable.length,
+ index = (key.hashCode()& 0x7FFFFFFF) % length;
+ Object currentKey;
+ while ((currentKey = this.keyTable[index]) != null) {
+ if (currentKey.equals(key))
+ return true;
+ if (++index == length) {
+ index = 0;
+ }
+ }
+ return false;
+ }
+
+ public int get(Object key) {
+ int length = this.keyTable.length,
+ index = (key.hashCode()& 0x7FFFFFFF) % length;
+ Object currentKey;
+ while ((currentKey = this.keyTable[index]) != null) {
+ if (currentKey.equals(key))
+ return this.valueTable[index];
+ if (++index == length) {
+ index = 0;
+ }
+ }
+ return -1;
+ }
+
+ public void keysToArray(Object[] array) {
+ int index = 0;
+ for (int i=0, length=this.keyTable.length; i<length; i++) {
+ if (this.keyTable[i] != null)
+ array[index++] = this.keyTable[i];
+ }
+ }
+
+ public int put(Object key, int value) {
+ int length = this.keyTable.length,
+ index = (key.hashCode()& 0x7FFFFFFF) % length;
+ Object currentKey;
+ while ((currentKey = this.keyTable[index]) != null) {
+ if (currentKey.equals(key))
+ return this.valueTable[index] = value;
+ if (++index == length) {
+ index = 0;
+ }
+ }
+ this.keyTable[index] = key;
+ this.valueTable[index] = value;
+
+ // assumes the threshold is never equal to the size of the table
+ if (++elementSize > threshold)
+ rehash();
+ return value;
+ }
+
+ public int removeKey(Object key) {
+ int length = this.keyTable.length,
+ index = (key.hashCode()& 0x7FFFFFFF) % length;
+ Object currentKey;
+ while ((currentKey = this.keyTable[index]) != null) {
+ if (currentKey.equals(key)) {
+ int value = this.valueTable[index];
+ elementSize--;
+ this.keyTable[index] = null;
+ rehash();
+ return value;
+ }
+ if (++index == length) {
+ index = 0;
+ }
+ }
+ return -1;
+ }
+
+ private void rehash() {
+
+ HashtableOfObjectToInt newHashtable = new HashtableOfObjectToInt(elementSize * 2); // double the number of expected elements
+ Object currentKey;
+ for (int i = this.keyTable.length; --i >= 0;)
+ if ((currentKey = this.keyTable[i]) != null)
+ newHashtable.put(currentKey, this.valueTable[i]);
+
+ this.keyTable = newHashtable.keyTable;
+ this.valueTable = newHashtable.valueTable;
+ this.threshold = newHashtable.threshold;
+ }
+
+ public int size() {
+ return elementSize;
+ }
+
+ public String toString() {
+ String s = ""; //$NON-NLS-1$
+ Object key;
+ for (int i = 0, length = this.keyTable.length; i < length; i++)
+ if ((key = this.keyTable[i]) != null)
+ s += key + " -> " + this.valueTable[i] + "\n"; //$NON-NLS-2$ //$NON-NLS-1$
+ return s;
+ }
+}
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyModelManager.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyModelManager.java 2007-01-23 20:32:46 UTC (rev 1866)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyModelManager.java 2007-01-23 21:10:19 UTC (rev 1867)
@@ -4,19 +4,29 @@
*/
package org.rubypeople.rdt.internal.core;
+import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
+import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.File;
+import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
+import java.io.StringReader;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
+import java.util.Map.Entry;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
@@ -24,11 +34,15 @@
import org.eclipse.core.resources.IResourceChangeEvent;
import org.eclipse.core.resources.ISaveContext;
import org.eclipse.core.resources.ISaveParticipant;
+import org.eclipse.core.resources.ISavedState;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
@@ -36,10 +50,13 @@
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.PerformanceStats;
import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Plugin;
import org.eclipse.core.runtime.Preferences;
+import org.eclipse.core.runtime.QualifiedName;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.content.IContentTypeManager.ContentTypeChangeEvent;
import org.eclipse.core.runtime.content.IContentTypeManager.IContentTypeChangeListener;
+import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.core.runtime.preferences.DefaultScope;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.IPreferencesService;
@@ -60,11 +77,17 @@
import org.rubypeople.rdt.core.RubyModelException;
import org.rubypeople.rdt.core.WorkingCopyOwner;
import org.rubypeople.rdt.core.parser.IProblem;
+import org.rubypeople.rdt.internal.compiler.util.HashtableOfObjectToInt;
import org.rubypeople.rdt.internal.core.buffer.BufferManager;
import org.rubypeople.rdt.internal.core.builder.RubyBuilder;
import org.rubypeople.rdt.internal.core.util.Messages;
import org.rubypeople.rdt.internal.core.util.Util;
import org.rubypeople.rdt.internal.core.util.WeakHashSet;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
/**
* @author cawilliams
@@ -89,12 +112,12 @@
/**
* Name of the extension point for contributing classpath variable initializers
*/
- public static final String CPVARIABLE_INITIALIZER_EXTPOINT_ID = "classpathVariableInitializer" ; //$NON-NLS-1$
+ public static final String CPVARIABLE_INITIALIZER_EXTPOINT_ID = "loadpathVariableInitializer" ; //$NON-NLS-1$
/**
* Name of the extension point for contributing classpath container initializers
*/
- public static final String CPCONTAINER_INITIALIZER_EXTPOINT_ID = "classpathContainerInitializer" ; //$NON-NLS-1$
+ public static final String CPCONTAINER_INITIALIZER_EXTPOINT_ID = "loadpathContainerInitializer" ; //$NON-NLS-1$
/**
@@ -180,6 +203,7 @@
public static final boolean VERBOSE = false;
public final static String CP_VARIABLE_PREFERENCES_PREFIX = RubyCore.PLUGIN_ID+".loadpathVariable."; //$NON-NLS-1$
+ public final static String CP_CONTAINER_PREFERENCES_PREFIX = RubyCore.PLUGIN_ID+".loadpathContainer."; //$NON-NLS-1$
/**
* Special value used for recognizing ongoing initialization and breaking initialization cycles
@@ -194,6 +218,7 @@
};
public final static String CP_ENTRY_IGNORE = "##<cp entry ignore>##"; //$NON-NLS-1$
public final static IPath CP_ENTRY_IGNORE_PATH = new Path(CP_ENTRY_IGNORE);
+ private static final int VARIABLES_AND_CONTAINERS_FILE_VERSION = 1;
public static boolean PERF_VARIABLE_INITIALIZER = false;
public static boolean PERF_CONTAINER_INITIALIZER = false;
@@ -733,6 +758,9 @@
public void startup() throws CoreException {
try {
configurePluginDebugOptions();
+
+// initialize Ruby model cache
+ this.cache = new RubyModelCache();
// request state folder creation (workaround 19885)
RubyCore.getPlugin().getStateLocation();
@@ -742,7 +770,6 @@
// Listen to preference changes
Preferences.IPropertyChangeListener propertyListener = new Preferences.IPropertyChangeListener() {
-
public void propertyChange(Preferences.PropertyChangeEvent event) {
RubyModelManager.this.optionsCache = null;
}
@@ -752,23 +779,347 @@
// Listen to content-type changes
Platform.getContentTypeManager().addContentTypeChangeListener(this);
- final IWorkspace workspace = ResourcesPlugin.getWorkspace();
- workspace.addResourceChangeListener(this.deltaState,
- /*
- * update spec in
- * JavaCore#addPreProcessingResourceChangedListener(...) if adding
- * more event types
- */
- IResourceChangeEvent.PRE_BUILD | IResourceChangeEvent.POST_BUILD
- | IResourceChangeEvent.POST_CHANGE | IResourceChangeEvent.PRE_DELETE
- | IResourceChangeEvent.PRE_CLOSE);
+// retrieve variable values
+ long start = -1;
+ if (VERBOSE)
+ start = System.currentTimeMillis();
+ loadVariablesAndContainers();
+// if (VERBOSE)
+// traceVariableAndContainers("Loaded", start); //$NON-NLS-1$
+ final IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ workspace.addResourceChangeListener(
+ this.deltaState,
+ /* update spec in JavaCore#addPreProcessingResourceChangedListener(...) if adding more event types */
+ IResourceChangeEvent.PRE_BUILD
+ | IResourceChangeEvent.POST_BUILD
+ | IResourceChangeEvent.POST_CHANGE
+ | IResourceChangeEvent.PRE_DELETE
+ | IResourceChangeEvent.PRE_CLOSE);
+
+// startIndexing();
+
+ // process deltas since last activated in indexer thread so that indexes are up-to-date.
+ // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=38658
+ Job processSavedState = new Job(Messages.savedState_jobName) {
+ protected IStatus run(IProgressMonitor monitor) {
+ try {
+ // add save participant and process delta atomically
+ // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=59937
+ workspace.run(
+ new IWorkspaceRunnable() {
+ public void run(IProgressMonitor progress) throws CoreException {
+ ISavedState savedState = workspace.addSaveParticipant(RubyCore.getRubyCore(), RubyModelManager.this);
+ if (savedState != null) {
+ // the event type coming from the saved state is always POST_AUTO_BUILD
+ // force it to be POST_CHANGE so that the delta processor can handle it
+ RubyModelManager.this.deltaState.getDeltaProcessor().overridenEventType = IResourceChangeEvent.POST_CHANGE;
+ savedState.processResourceChangeEvents(RubyModelManager.this.deltaState);
+ }
+ }
+ },
+ monitor);
+ } catch (CoreException e) {
+ return e.getStatus();
+ }
+ return Status.OK_STATUS;
+ }
+ };
+ processSavedState.setSystem(true);
+ processSavedState.setPriority(Job.SHORT); // process asap
+ processSavedState.schedule();
} catch (RuntimeException e) {
shutdown();
throw e;
}
}
+
+ public void loadVariablesAndContainers() throws CoreException {
+ // backward compatibility, consider persistent property
+ QualifiedName qName = new QualifiedName(RubyCore.PLUGIN_ID, "variables"); //$NON-NLS-1$
+ String xmlString = ResourcesPlugin.getWorkspace().getRoot().getPersistentProperty(qName);
+
+ try {
+ if (xmlString != null){
+ StringReader reader = new StringReader(xmlString);
+ Element cpElement;
+ try {
+ DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
+ cpElement = parser.parse(new InputSource(reader)).getDocumentElement();
+ } catch(SAXException e) {
+ return;
+ } catch(ParserConfigurationException e){
+ return;
+ } finally {
+ reader.close();
+ }
+ if (cpElement == null) return;
+ if (!cpElement.getNodeName().equalsIgnoreCase("variables")) { //$NON-NLS-1$
+ return;
+ }
+
+ NodeList list= cpElement.getChildNodes();
+ int length= list.getLength();
+ for (int i= 0; i < length; ++i) {
+ Node node= list.item(i);
+ short type= node.getNodeType();
+ if (type == Node.ELEMENT_NODE) {
+ Element element= (Element) node;
+ if (element.getNodeName().equalsIgnoreCase("variable")) { //$NON-NLS-1$
+ variablePut(
+ element.getAttribute("name"), //$NON-NLS-1$
+ new Path(element.getAttribute("path"))); //$NON-NLS-1$
+ }
+ }
+ }
+ }
+ } catch(IOException e){
+ // problem loading xml file: nothing we can do
+ } finally {
+ if (xmlString != null){
+ ResourcesPlugin.getWorkspace().getRoot().setPersistentProperty(qName, null); // flush old one
+ }
+ }
+ // backward compatibility, load variables and containers from preferences into cache
+ loadVariablesAndContainers(getDefaultPreferences());
+ loadVariablesAndContainers(getInstancePreferences());
+
+ // load variables and containers from saved file into cache
+ File file = getVariableAndContainersFile();
+ DataInputStream in = null;
+ try {
+ in = new DataInputStream(new BufferedInputStream(new FileInputStream(file)));
+ switch (in.readInt()) {
+ case 2 :
+ new VariablesAndContainersLoadHelper(in).load();
+ break;
+ case 1 : // backward compatibility, load old format
+ // variables
+ int size = in.readInt();
+ while (size-- > 0) {
+ String varName = in.readUTF();
+ String pathString = in.readUTF();
+ if (CP_ENTRY_IGNORE.equals(pathString))
+ continue;
+ IPath varPath = Path.fromPortableString(pathString);
+ this.variables.put(varName, varPath);
+ this.previousSessionVariables.put(varName, varPath);
+ }
+
+ // containers
+ IRubyModel model = getRubyModel();
+ int projectSize = in.readInt();
+ while (projectSize-- > 0) {
+ String projectName = in.readUTF();
+ IRubyProject project = model.getRubyProject(projectName);
+ int containerSize = in.readInt();
+ while (containerSize-- > 0) {
+ IPath containerPath = Path.fromPortableString(in.readUTF());
+ int length = in.readInt();
+ byte[] containerString = new byte[length];
+ in.readFully(containerString);
+ recreatePersistedContainer(project, containerPath, new String(containerString), true/*add to container values*/);
+ }
+ }
+ break;
+ }
+ } catch (IOException e) {
+ if (file.exists())
+ Util.log(e, "Unable to read variable and containers file"); //$NON-NLS-1$
+ } catch (RuntimeException e) {
+ if (file.exists())
+ Util.log(e, "Unable to read variable and containers file (file is corrupt)"); //$NON-NLS-1$
+ } finally {
+ if (in != null) {
+ try {
+ in.close();
+ } catch (IOException e) {
+ // nothing we can do: ignore
+ }
+ }
+ }
+
+ // override persisted values for variables which have a registered initializer
+ String[] registeredVariables = getRegisteredVariableNames();
+ for (int i = 0; i < registeredVariables.length; i++) {
+ String varName = registeredVariables[i];
+ this.variables.put(varName, null); // reset variable, but leave its entry in the Map, so it will be part of variable names.
+ }
+ // override persisted values for containers which have a registered initializer
+ containersReset(getRegisteredContainerIDs());
+ }
+
+ public static void recreatePersistedContainer(String propertyName, String containerString, boolean addToContainerValues) {
+ int containerPrefixLength = CP_CONTAINER_PREFERENCES_PREFIX.length();
+ int index = propertyName.indexOf('|', containerPrefixLength);
+ if (containerString != null) containerString = containerString.trim();
+ if (index > 0) {
+ String projectName = propertyName.substring(containerPrefixLength, index).trim();
+ IRubyProject project = getRubyModelManager().getRubyModel().getRubyProject(projectName);
+ IPath containerPath = new Path(propertyName.substring(index+1).trim());
+ recreatePersistedContainer(project, containerPath, containerString, addToContainerValues);
+ }
+ }
+
+ private static void recreatePersistedContainer(final IRubyProject project, final IPath containerPath, String containerString, boolean addToContainerValues) {
+ if (!project.getProject().isAccessible()) return; // avoid leaking deleted project's persisted container
+ if (containerString == null) {
+ getRubyModelManager().containerPut(project, containerPath, null);
+ } else {
+ final ILoadpathEntry[] containerEntries = ((RubyProject) project).decodeLoadpath(containerString, false, false);
+ if (containerEntries != null && containerEntries != RubyProject.INVALID_LOADPATH) {
+ ILoadpathContainer container = new ILoadpathContainer() {
+ public ILoadpathEntry[] getLoadpathEntries() {
+ return containerEntries;
+ }
+ public String getDescription() {
+ return "Persisted container ["+containerPath+" for project ["+ project.getElementName()+"]"; //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
+ }
+ public int getKind() {
+ return 0;
+ }
+ public IPath getPath() {
+ return containerPath;
+ }
+ public String toString() {
+ return getDescription();
+ }
+
+ };
+ if (addToContainerValues) {
+ getRubyModelManager().containerPut(project, containerPath, container);
+ }
+ Map projectContainers = (Map)getRubyModelManager().previousSessionContainers.get(project);
+ if (projectContainers == null){
+ projectContainers = new HashMap(1);
+ getRubyModelManager().previousSessionContainers.put(project, projectContainers);
+ }
+ projectContainers.put(containerPath, container);
+ }
+ }
+ }
+
+ private File getVariableAndContainersFile() {
+ return RubyCore.getPlugin().getStateLocation().append("variablesAndContainers.dat").toFile(); //$NON-NLS-1$
+ }
+
+ private synchronized void containersReset(String[] containerIDs) {
+ for (int i = 0; i < containerIDs.length; i++) {
+ String containerID = containerIDs[i];
+ Iterator projectIterator = this.containers.keySet().iterator();
+ while (projectIterator.hasNext()){
+ IRubyProject project = (IRubyProject)projectIterator.next();
+ Map projectContainers = (Map)this.containers.get(project);
+ if (projectContainers != null){
+ Iterator containerIterator = projectContainers.keySet().iterator();
+ while (containerIterator.hasNext()){
+ IPath containerPath = (IPath)containerIterator.next();
+ if (containerPath.segment(0).equals(containerID)) { // registered container
+ projectContainers.put(containerPath, null); // reset container value, but leave entry in Map
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Returns the name of the variables for which an CP variable initializer is registered through an extension point
+ */
+ public static String[] getRegisteredVariableNames(){
+
+ Plugin jdtCorePlugin = RubyCore.getPlugin();
+ if (jdtCorePlugin == null) return null;
+
+ ArrayList variableList = new ArrayList(5);
+ IExtensionPoint extension = Platform.getExtensionRegistry().getExtensionPoint(RubyCore.PLUGIN_ID, RubyModelManager.CPVARIABLE_INITIALIZER_EXTPOINT_ID);
+ if (extension != null) {
+ IExtension[] extensions = extension.getExtensions();
+ for(int i = 0; i < extensions.length; i++){
+ IConfigurationElement [] configElements = extensions[i].getConfigurationElements();
+ for(int j = 0; j < configElements.length; j++){
+ String varAttribute = configElements[j].getAttribute("variable"); //$NON-NLS-1$
+ if (varAttribute != null) variableList.add(varAttribute);
+ }
+ }
+ }
+ String[] variableNames = new String[variableList.size()];
+ variableList.toArray(variableNames);
+ return variableNames;
+ }
+
+ private void loadVariablesAndContainers(IEclipsePreferences preferences) {
+ try {
+ // only get variable from preferences not set to their default
+ String[] propertyNames = preferences.keys();
+ int variablePrefixLength = CP_VARIABLE_PREFERENCES_PREFIX.length();
+ for (int i = 0; i < propertyNames.length; i++){
+ String propertyName = propertyNames[i];
+ if (propertyName.startsWith(CP_VARIABLE_PREFERENCES_PREFIX)){
+ String varName = propertyName.substring(variablePrefixLength);
+ String propertyValue = preferences.get(propertyName, null);
+ if (propertyValue != null) {
+ String pathString = propertyValue.trim();
+
+ if (CP_ENTRY_IGNORE.equals(pathString)) {
+ // cleanup old preferences
+ preferences.remove(propertyName);
+ continue;
+ }
+
+ // add variable to table
+ IPath varPath = new Path(pathString);
+ this.variables.put(varName, varPath);
+ this.previousSessionVariables.put(varName, varPath);
+ }
+ } else if (propertyName.startsWith(CP_CONTAINER_PREFERENCES_PREFIX)){
+ String propertyValue = preferences.get(propertyName, null);
+ if (propertyValue != null) {
+ // cleanup old preferences
+ preferences.remove(propertyName);
+
+ // recreate container
+ recreatePersistedContainer(propertyName, propertyValue, true/*add to container values*/);
+ }
+ }
+ }
+ } catch (BackingStoreException e1) {
+ // TODO (frederic) see if it's necessary to report this failure...
+ }
+ }
+
+ /**
+ * Get default eclipse preference for JavaCore plugin.
+ */
+ public IEclipsePreferences getDefaultPreferences() {
+ return preferencesLookup[PREF_DEFAULT];
+ }
+
+ /**
+ * Returns the name of the container IDs for which an LP container initializer is registered through an extension point
+ */
+ public static String[] getRegisteredContainerIDs(){
+ Plugin jdtCorePlugin = RubyCore.getPlugin();
+ if (jdtCorePlugin == null) return null;
+
+ ArrayList containerIDList = new ArrayList(5);
+ IExtensionPoint extension = Platform.getExtensionRegistry().getExtensionPoint(RubyCore.PLUGIN_ID, RubyModelManager.CPCONTAINER_INITIALIZER_EXTPOINT_ID);
+ if (extension != null) {
+ IExtension[] extensions = extension.getExtensions();
+ for(int i = 0; i < extensions.length; i++){
+ IConfigurationElement [] configElements = extensions[i].getConfigurationElements();
+ for(int j = 0; j < configElements.length; j++){
+ String idAttribute = configElements[j].getAttribute("id"); //$NON-NLS-1$
+ if (idAttribute != null) containerIDList.add(idAttribute);
+ }
+ }
+ }
+ String[] containerIDs = new String[containerIDList.size()];
+ containerIDList.toArray(containerIDs);
+ return containerIDs;
+ }
+
public void shutdown() {
RubyCore javaCore = RubyCore.getRubyCore();
javaCore.savePluginPreferences();
@@ -796,7 +1147,7 @@
long start = -1;
// if (VERBOSE)
// start = System.currentTimeMillis();
-// saveVariablesAndContainers();
+ saveVariablesAndContainers();
// if (VERBOSE)
// traceVariableAndContainers("Saved", start); //$NON-NLS-1$
@@ -853,6 +1204,27 @@
this.deltaState.saveExternalLibTimeStamps();
}
+ private void saveVariablesAndContainers() throws CoreException {
+ File file = getVariableAndContainersFile();
+ DataOutputStream out = null;
+ try {
+ out = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(file)));
+ out.writeInt(VARIABLES_AND_CONTAINERS_FILE_VERSION);
+ new VariablesAndContainersSaveHelper(out).save();
+ } catch (IOException e) {
+ IStatus status = new Status(IStatus.ERROR, RubyCore.PLUGIN_ID, IStatus.ERROR, "Problems while saving variables and containers", e); //$NON-NLS-1$
+ throw new CoreException(status);
+ } finally {
+ if (out != null) {
+ try {
+ out.close();
+ } catch (IOException e) {
+ // nothing we can do: ignore
+ }
+ }
+ }
+ }
+
private void saveState(PerProjectInfo info, ISaveContext context) throws CoreException {
// passed this point, save actions are non trivial
@@ -1854,5 +2226,393 @@
variablePut(variableName, newPath);
return true;
}
+
+ private final class VariablesAndContainersLoadHelper {
+ private static final int ARRAY_INCREMENT = 200;
+
+ private ILoadpathEntry[] allLoadpathEntries;
+ private int allLoadpathEntryCount;
+
+ private final Map allPaths; // String -> IPath
+
+ private String[] allStrings;
+ private int allStringsCount;
+
+ private final DataInputStream in;
+
+ VariablesAndContainersLoadHelper(DataInputStream in) {
+ super();
+ this.allLoadpathEntries = null;
+ this.allLoadpathEntryCount = 0;
+ this.allPaths = new HashMap();
+ this.allStrings = null;
+ this.allStringsCount = 0;
+ this.in = in;
+ }
+
+ void load() throws IOException {
+ loadProjects(RubyModelManager.this.getRubyModel());
+ loadVariables();
+ }
+
+ private boolean loadBoolean() throws IOException {
+ return this.in.readBoolean();
+ }
+
+ private ILoadpathEntry[] loadLoadpathEntries() throws IOException {
+ int count = loadInt();
+ ILoadpathEntry[] entries = new ILoadpathEntry[count];
+
+ for (int i = 0; i < count; ++i)
+ entries[i] = loadLoadpathEntry();
+
+ return entries;
+ }
+
+ private ILoadpathEntry loadLoadpathEntry() throws IOException {
+ int id = loadInt();
+
+ if (id < 0 || id > this.allLoadpathEntryCount)
+ throw new IOException("Unexpected loadpathentry id"); //$NON-NLS-1$
+
+ if (id < this.allLoadpathEntryCount)
+ return this.allLoadpathEntries[id];
+
+ int entryKind = loadInt();
+ IPath path = loadPath();
+ IPath[] inclusionPatterns = loadPaths();
+ IPath[] exclusionPatterns = loadPaths();
+ boolean isExported = loadBoolean();
+
+ ILoadpathEntry entry = new LoadpathEntry(entryKind,
+ path, inclusionPatterns, exclusionPatterns, isExported);
+
+ ILoadpathEntry[] array = this.allLoadpathEntries;
+
+ if (array == null || id == array.length) {
+ array = new ILoadpathEntry[id + ARRAY_INCREMENT];
+
+ if (id != 0)
+ System.arraycopy(this.allLoadpathEntries, 0, array, 0, id);
+
+ this.allLoadpathEntries = array;
+ }
+
+ array[id] = entry;
+ this.allLoadpathEntryCount = id + 1;
+
+ return entry;
+ }
+
+ private void loadContainers(IRubyProject project) throws IOException {
+ boolean projectIsAccessible = project.getProject().isAccessible();
+ int count = loadInt();
+ for (int i = 0; i < count; ++i) {
+ IPath path = loadPath();
+ ILoadpathEntry[] entries = loadLoadpathEntries();
+
+ if (!projectIsAccessible)
+ // avoid leaking deleted project's persisted container,
+ // but still read the container as it is is part of the file format
+ continue;
+
+ ILoadpathContainer container = new PersistedLoadpathContainer(project, path, entries);
+
+ RubyModelManager.this.containerPut(project, path, container);
+
+ Map oldContainers = (Map) RubyModelManager.this.previousSessionContainers.get(project);
+
+ if (oldContainers == null) {
+ oldContainers = new HashMap();
+ RubyModelManager.this.previousSessionContainers.put(project, oldContainers);
+ }
+
+ oldContainers.put(path, container);
+ }
+ }
+
+ private int loadInt() throws IOException {
+ return this.in.readInt();
+ }
+
+ private IPath loadPath() throws IOException {
+ if (loadBoolean())
+ return null;
+
+ String portableString = loadString();
+ IPath path = (IPath) this.allPaths.get(portableString);
+
+ if (path == null) {
+ path = Path.fromPortableString(portableString);
+ this.allPaths.put(portableString, path);
+ }
+
+ return path;
+ }
+
+ private IPath[] loadPaths() throws IOException {
+ int count = loadInt();
+ IPath[] pathArray = new IPath[count];
+
+ for (int i = 0; i < count; ++i)
+ pathArray[i] = loadPath();
+
+ return pathArray;
+ }
+
+ private void loadProjects(IRubyModel model) throws IOException {
+ int count = loadInt();
+
+ for (int i = 0; i < count; ++i) {
+ String projectName = loadString();
+
+ loadContainers(model.getRubyProject(projectName));
+ }
+ }
+
+ private String loadString() throws IOException {
+ int id = loadInt();
+
+ if (id < 0 || id > this.allStringsCount)
+ throw new IOException("Unexpected string id"); //$NON-NLS-1$
+
+ if (id < this.allStringsCount)
+ return this.allStrings[id];
+
+ String string = this.in.readUTF();
+ String[] array = this.allStrings;
+
+ if (array == null || id == array.length) {
+ array = new String[id + ARRAY_INCREMENT];
+
+ if (id != 0)
+ System.arraycopy(this.allStrings, 0, array, 0, id);
+
+ this.allStrings = array;
+ }
+
+ array[id] = string;
+ this.allStringsCount = id + 1;
+
+ return string;
+ }
+
+ private void loadVariables() throws IOException {
+ int size = loadInt();
+ Map loadedVars = new HashMap(size);
+
+ for (int i = 0; i < size; ++i) {
+ String varName = loadString();
+ IPath varPath = loadPath();
+
+ if (varPath != null)
+ loadedVars.put(varName, varPath);
+ }
+
+ RubyModelManager.this.previousSessionVariables.putAll(loadedVars);
+ RubyModelManager.this.variables.putAll(loadedVars);
+ }
+ }
+
+ private static final class PersistedLoadpathContainer implements ILoadpathContainer {
+
+ private final IPath containerPath;
+ private final ILoadpathEntry[] entries;
+ private final IRubyProject project;
+
+ PersistedLoadpathContainer(IRubyProject project, IPath containerPath, ILoadpathEntry[] entries) {
+ super();
+ this.containerPath = containerPath;
+ this.entries = entries;
+ this.project = project;
+ }
+
+ public ILoadpathEntry[] getLoadpathEntries() {
+ return entries;
+ }
+
+ public String getDescription() {
+ return "Persisted container [" + containerPath //$NON-NLS-1$
+ + " for project [" + project.getElementName() //$NON-NLS-1$
+ + "]]"; //$NON-NLS-1$
+ }
+
+ public int getKind() {
+ return 0;
+ }
+
+ public IPath getPath() {
+ return containerPath;
+ }
+
+ public String toString() {
+ return getDescription();
+ }
+ }
+
+ private final class VariablesAndContainersSaveHelper {
+
+ private final HashtableOfObjectToInt loadpathEntryIds; // ILoadpathEntry -> int
+ private final DataOutputStream out;
+ private final HashtableOfObjectToInt stringIds; // Strings -> int
+
+ VariablesAndContainersSaveHelper(DataOutputStream out) {
+ super();
+ this.loadpathEntryIds = new HashtableOfObjectToInt();
+ this.out = out;
+ this.stringIds = new HashtableOfObjectToInt();
+ }
+
+ void save() throws IOException, RubyModelException {
+ saveProjects(RubyModelManager.this.getRubyModel().getRubyProjects());
+
+ // remove variables that should not be saved
+ HashMap varsToSave = null;
+ Iterator iterator = RubyModelManager.this.variables.entrySet().iterator();
+ IEclipsePreferences defaultPreferences = getDefaultPreferences();
+ while (iterator.hasNext()) {
+ Map.Entry entry = (Map.Entry) iterator.next();
+ String varName = (String) entry.getKey();
+ if (defaultPreferences.get(CP_VARIABLE_PREFERENCES_PREFIX + varName, null) != null // don't save classpath variables from the default preferences as there is no delta if they are removed
+ || CP_ENTRY_IGNORE_PATH.equals(entry.getValue())) {
+
+ if (varsToSave == null)
+ varsToSave = new HashMap(RubyModelManager.this.variables);
+ varsToSave.remove(varName);
+ }
+
+ }
+
+ saveVariables(varsToSave != null ? varsToSave : RubyModelManager.this.variables);
+ }
+
+ private void saveLoadpathEntries(ILoadpathEntry[] entries)
+ throws IOException {
+ int count = entries == null ? 0 : entries.length;
+
+ saveInt(count);
+ for (int i = 0; i < count; ++i)
+ saveLoadpathEntry(entries[i]);
+ }
+
+ private void saveLoadpathEntry(ILoadpathEntry entry)
+ throws IOException {
+ if (saveNewId(entry, this.loadpathEntryIds)) {
+ saveInt(entry.getEntryKind());
+ savePath(entry.getPath());
+ savePaths(entry.getInclusionPatterns());
+ savePaths(entry.getExclusionPatterns());
+ this.out.writeBoolean(entry.isExported());
+ }
+ }
+
+ private void saveContainers(IRubyProject project, Map containerMap)
+ throws IOException {
+ saveInt(containerMap.size());
+
+ for (Iterator i = containerMap.entrySet().iterator(); i.hasNext();) {
+ Entry entry = (Entry) i.next();
+ IPath path = (IPath) entry.getKey();
+ ILoadpathContainer container = (ILoadpathContainer) entry.getValue();
+ ILoadpathEntry[] cpEntries = null;
+
+ if (container == null) {
+ // container has not been initialized yet, use previous
+ // session value
+ // (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=73969)
+ container = RubyModelManager.this.getPreviousSessionContainer(path, project);
+ }
+
+ if (container != null)
+ cpEntries = container.getLoadpathEntries();
+
+ savePath(path);
+ saveLoadpathEntries(cpEntries);
+ }
+ }
+
+ private void saveInt(int value) throws IOException {
+ this.out.writeInt(value);
+ }
+
+ private boolean saveNewId(Object key, HashtableOfObjectToInt map) throws IOException {
+ int id = map.get(key);
+
+ if (id == -1) {
+ int newId = map.size();
+
+ map.put(key, newId);
+
+ saveInt(newId);
+
+ return true;
+ } else {
+ saveInt(id);
+
+ return false;
+ }
+ }
+
+ private void savePath(IPath path) throws IOException {
+ if (path == null) {
+ this.out.writeBoolean(true);
+ } else {
+ this.out.writeBoolean(false);
+ saveString(path.toPortableString());
+ }
+ }
+
+ private void savePaths(IPath[] paths) throws IOException {
+ int count = paths == null ? 0 : paths.length;
+
+ saveInt(count);
+ for (int i = 0; i < count; ++i)
+ savePath(paths[i]);
+ }
+
+ private void saveProjects(IRubyProject[] projects) throws IOException,
+ RubyModelException {
+ int count = projects.length;
+
+ saveInt(count);
+
+ for (int i = 0; i < count; ++i) {
+ IRubyProject project = projects[i];
+
+ saveString(project.getElementName());
+
+ Map containerMap = (Map) RubyModelManager.this.containers.get(project);
+
+ if (containerMap == null) {
+ containerMap = Collections.EMPTY_MAP;
+ } else {
+ // clone while iterating
+ // (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=59638)
+ containerMap = new HashMap(containerMap);
+ }
+
+ saveContainers(project, containerMap);
+ }
+ }
+
+ private void saveString(String string) throws IOException {
+ if (saveNewId(string, this.stringIds))
+ this.out.writeUTF(string);
+ }
+
+ private void saveVariables(Map map) throws IOException {
+ saveInt(map.size());
+
+ for (Iterator i = map.entrySet().iterator(); i.hasNext();) {
+ Entry entry = (Entry) i.next();
+ String varName = (String) entry.getKey();
+ IPath varPath = (IPath) entry.getValue();
+
+ saveString(varName);
+ savePath(varPath);
+ }
+ }
+ }
+
}
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyProject.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyProject.java 2007-01-23 20:32:46 UTC (rev 1866)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyProject.java 2007-01-23 21:10:19 UTC (rev 1867)
@@ -82,7 +82,7 @@
*/
private static final ILoadpathEntry[] RESOLUTION_IN_PROGRESS = new ILoadpathEntry[0];
static final String LOADPATH_FILENAME = ".loadpath";
- private static final ILoadpathEntry[] INVALID_LOADPATH = new ILoadpathEntry[0];
+ static final ILoadpathEntry[] INVALID_LOADPATH = new ILoadpathEntry[0];
/**
* Whether the underlying file system is case sensitive.
@@ -2309,4 +2309,11 @@
this.createLoadpathProblemMarker(status);
}
}
+
+ /**
+ * Reads and decode an XML loadpath string
+ */
+ public ILoadpathEntry[] decodeLoadpath(String xmlClasspath, boolean createMarker, boolean logProblems) {
+ return decodeLoadpath(xmlClasspath, createMarker, logProblems, null/*not interested in unknown elements*/);
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-01-23 20:32:47
|
Revision: 1866
http://svn.sourceforge.net/rubyeclipse/?rev=1866&view=rev
Author: cawilliams
Date: 2007-01-23 12:32:46 -0800 (Tue, 23 Jan 2007)
Log Message:
-----------
fix broken building
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core.tests/src/RubyParserCmd.java
Modified: trunk/org.rubypeople.rdt.core.tests/src/RubyParserCmd.java
===================================================================
--- trunk/org.rubypeople.rdt.core.tests/src/RubyParserCmd.java 2007-01-23 20:31:32 UTC (rev 1865)
+++ trunk/org.rubypeople.rdt.core.tests/src/RubyParserCmd.java 2007-01-23 20:32:46 UTC (rev 1866)
@@ -18,6 +18,8 @@
import org.rubypeople.rdt.internal.core.RubyScript;
import org.rubypeople.rdt.internal.core.RubyScriptElementInfo;
import org.rubypeople.rdt.internal.core.RubyScriptStructureBuilder;
+import org.rubypeople.rdt.internal.core.SourceFolder;
+import org.rubypeople.rdt.internal.core.SourceFolderRoot;
import org.rubypeople.rdt.internal.core.parser.RdtWarnings;
import org.rubypeople.rdt.internal.core.parser.RubyParser;
@@ -104,7 +106,7 @@
try {
Node node = parser.parse(new ShamFile(file), new FileReader(file));
RubyScriptElementInfo unitInfo = new RubyScriptElementInfo() ;
- RubyScript script = new RubyScript(new RubyProject(), file, DefaultWorkingCopyOwner.PRIMARY ) ;
+ RubyScript script = new RubyScript(null, file, DefaultWorkingCopyOwner.PRIMARY ) ;
RubyScriptStructureBuilder visitor = new RubyScriptStructureBuilder(script, unitInfo, elements);
if (node != null) {
node.accept(visitor);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-01-23 20:31:35
|
Revision: 1865
http://svn.sourceforge.net/rubyeclipse/?rev=1865&view=rev
Author: cawilliams
Date: 2007-01-23 12:31:32 -0800 (Tue, 23 Jan 2007)
Log Message:
-----------
mwa ha ha ha ha! I got it!
You can now do a go to declaration on a ruby project and have it open a standard library module/class in an editor!
(Granted you need to create the ruby project using our new wizard, and must swap your default interpreter to get the variable resolution set up - I've gotta fix that)
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/ExternalSourceFolder.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/ExternalSourceFolderRoot.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyProject.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyScript.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/SourceFolder.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/util/ASTUtil.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/rubyeditor/EditorUtility.java
Added Paths:
-----------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/ExternalRubyScript.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/ExternalSourceFolderInfo.java
Added: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/ExternalRubyScript.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/ExternalRubyScript.java (rev 0)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/ExternalRubyScript.java 2007-01-23 20:31:32 UTC (rev 1865)
@@ -0,0 +1,111 @@
+package org.rubypeople.rdt.internal.core;
+
+import java.io.CharArrayReader;
+import java.io.File;
+import java.io.IOException;
+import java.util.Map;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.jruby.ast.Node;
+import org.jruby.lexer.yacc.SyntaxException;
+import org.rubypeople.rdt.core.IBuffer;
+import org.rubypeople.rdt.core.RubyCore;
+import org.rubypeople.rdt.core.RubyModelException;
+import org.rubypeople.rdt.core.WorkingCopyOwner;
+import org.rubypeople.rdt.internal.compiler.util.Util;
+import org.rubypeople.rdt.internal.core.buffer.BufferManager;
+import org.rubypeople.rdt.internal.core.parser.RubyParser;
+
+public class ExternalRubyScript extends RubyScript {
+
+ public ExternalRubyScript(ExternalSourceFolder parent, String name, WorkingCopyOwner owner) {
+ super(parent, name, owner);
+ }
+
+ @Override
+ protected boolean buildStructure(OpenableElementInfo info, IProgressMonitor pm, Map newElements, IResource underlyingResource) throws RubyModelException {
+ RubyScriptElementInfo unitInfo = (RubyScriptElementInfo) info;
+ // get buffer contents
+ IBuffer buffer = getBufferManager().getBuffer(this);
+ if (buffer == null) {
+ buffer = openBuffer(pm, unitInfo); // open buffer independently
+ // from the info, since we are
+ // building the info
+ }
+ final char[] contents = buffer == null ? null : buffer.getCharacters();
+ try {
+ RubyParser parser = new RubyParser();
+ Node node = parser.parse(null, new CharArrayReader(contents));
+ RubyScriptStructureBuilder visitor = new RubyScriptStructureBuilder(this, unitInfo, newElements);
+ if (node != null) node.accept(visitor);
+ unitInfo.setIsStructureKnown(true);
+ } catch (SyntaxException e) {
+ unitInfo.setIsStructureKnown(false);
+ unitInfo.setSyntaxException(e) ;
+ } catch (Exception e) {
+ RubyCore.log(e);
+ }
+ return unitInfo.isStructureKnown();
+ }
+
+ @Override
+ public boolean exists() {
+ return ((Openable)getOpenable()).exists();
+ }
+
+ /**
+ * Opens and returns buffer on the source code associated with this class file.
+ * Maps the source code to the children elements of this class file.
+ * If no source code is associated with this class file,
+ * <code>null</code> is returned.
+ *
+ * @see Openable
+ */
+ protected IBuffer openBuffer(IProgressMonitor pm, Object info) throws RubyModelException {
+ char[] contents = findSource();
+ if (contents != null) {
+ // create buffer
+ IBuffer buffer = getBufferManager().createBuffer(this);
+ if (buffer == null) return null;
+ BufferManager bufManager = getBufferManager();
+ bufManager.addBuffer(buffer);
+
+ // set the buffer source
+ if (buffer.getCharacters() == null){
+ buffer.setContents(contents);
+ }
+
+ // listen to buffer changes
+ buffer.addBufferChangedListener(this);
+
+ return buffer;
+ }
+ return null;
+ }
+
+ public File getFile() {
+ ExternalSourceFolder parent = (ExternalSourceFolder) getParent();
+ IPath parentPath = parent.getPath();
+ return parentPath.append(name).toFile();
+ }
+
+ private char[] findSource() {
+ File file = getFile();
+ byte[] bytes;
+ try {
+ bytes = Util.getFileByteContent(file);
+ } catch (IOException e) {
+ RubyCore.log(e);
+ return new char[0];
+ }
+ return new String(bytes).toCharArray();
+ }
+
+ @Override
+ public IResource getResource() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+}
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/ExternalSourceFolder.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/ExternalSourceFolder.java 2007-01-23 18:31:25 UTC (rev 1864)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/ExternalSourceFolder.java 2007-01-23 20:31:32 UTC (rev 1865)
@@ -1,9 +1,13 @@
package org.rubypeople.rdt.internal.core;
+import java.io.File;
+import java.util.ArrayList;
import java.util.HashMap;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.rubypeople.rdt.core.IRubyElement;
import org.rubypeople.rdt.core.RubyModelException;
+import org.rubypeople.rdt.internal.core.util.Util;
public class ExternalSourceFolder extends SourceFolder {
@@ -20,10 +24,29 @@
if (!openableParent.isOpen()) {
openableParent.generateInfos(openableParent.createElementInfo(), newElements, pm);
}
- // XXX We need to modify ExtenralSourceFolerRoot's computeChildren method. None of the source folders' children are getting set!
}
public boolean isReadOnly() {
return true;
}
+
+ protected boolean computeChildren(OpenableElementInfo info) {
+ ArrayList<IRubyElement> vChildren = new ArrayList<IRubyElement>();
+ File file = getPath().toFile();
+ File[] members = file.listFiles();
+ for (int i = 0, max = members.length; i < max; i++) {
+ File child = members[i];
+ if (!child.isDirectory()) {
+ IRubyElement childElement;
+ if (Util.isValidRubyScriptName(child.getName())) {
+ childElement = new ExternalRubyScript(this, child.getName(), DefaultWorkingCopyOwner.PRIMARY);
+ vChildren.add(childElement);
+ }
+ }
+ }
+ IRubyElement[] children= new IRubyElement[vChildren.size()];
+ vChildren.toArray(children);
+ info.setChildren(children);
+ return true;
+ }
}
Added: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/ExternalSourceFolderInfo.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/ExternalSourceFolderInfo.java (rev 0)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/ExternalSourceFolderInfo.java 2007-01-23 20:31:32 UTC (rev 1865)
@@ -0,0 +1,5 @@
+package org.rubypeople.rdt.internal.core;
+
+public class ExternalSourceFolderInfo extends SourceFolderInfo {
+
+}
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/ExternalSourceFolderRoot.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/ExternalSourceFolderRoot.java 2007-01-23 18:31:25 UTC (rev 1864)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/ExternalSourceFolderRoot.java 2007-01-23 20:31:32 UTC (rev 1865)
@@ -40,6 +40,15 @@
IRubyElement[] children = new IRubyElement[vChildren.size()];
vChildren.toArray(children);
info.setChildren(children);
+
+ // Now go through every SourceFolder and set it's children!
+ for (int i = 0; i < children.length; i++) {
+ ExternalSourceFolder packFrag = (ExternalSourceFolder) children[i];
+ ExternalSourceFolderInfo fragInfo = new ExternalSourceFolderInfo();
+ packFrag.computeChildren(fragInfo);
+ newElements.put(packFrag, fragInfo);
+ }
+
}
} catch (RubyModelException e) {
// problem resolving children; structure remains unknown
@@ -148,6 +157,7 @@
if (this.resource == null) {
this.resource = RubyModel.getTarget(ResourcesPlugin.getWorkspace().getRoot(), this.folderPath, false);
}
+ // FIXME We need to turn this File into an IResource somehow!
if (this.resource instanceof IResource) {
return super.getResource();
}
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyProject.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyProject.java 2007-01-23 18:31:25 UTC (rev 1864)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyProject.java 2007-01-23 20:31:32 UTC (rev 1865)
@@ -51,6 +51,7 @@
import org.rubypeople.rdt.core.IRubyModelStatus;
import org.rubypeople.rdt.core.IRubyModelStatusConstants;
import org.rubypeople.rdt.core.IRubyProject;
+import org.rubypeople.rdt.core.IRubyScript;
import org.rubypeople.rdt.core.ISourceFolder;
import org.rubypeople.rdt.core.ISourceFolderRoot;
import org.rubypeople.rdt.core.IType;
@@ -423,6 +424,10 @@
ISourceFolder folder = (ISourceFolder) child;
IType type = getType(folder, className);
if (type != null) return type;
+ } else if(child.isType(IRubyElement.SCRIPT)) {
+ IRubyScript script = (IRubyScript) child;
+ IType type = getType(script, className);
+ if (type != null) return type;
} else if(child.isType(IRubyElement.TYPE)) {
IType type = (IType) child;
if (type.getElementName().equals(className)) return type;
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyScript.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyScript.java 2007-01-23 18:31:25 UTC (rev 1864)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyScript.java 2007-01-23 20:31:32 UTC (rev 1865)
@@ -71,7 +71,7 @@
/**
* @param name
*/
- public RubyScript(RubyElement parent, String name, WorkingCopyOwner owner) {
+ public RubyScript(SourceFolder parent, String name, WorkingCopyOwner owner) {
super(parent);
this.name = name;
this.owner = owner;
@@ -235,7 +235,7 @@
*/
public IRubyElement getPrimaryElement(boolean checkOwner) {
if (checkOwner && isPrimary()) return this;
- return new RubyScript((RubyElement) getParent(), getElementName(), DefaultWorkingCopyOwner.PRIMARY);
+ return new RubyScript((SourceFolder) getParent(), getElementName(), DefaultWorkingCopyOwner.PRIMARY);
}
/*
@@ -323,7 +323,7 @@
if (buffer.getCharacters() == null) {
if (isWorkingCopy) {
IRubyScript original;
- if (!isPrimary() && (original = new RubyScript((RubyElement) getParent(), getElementName(), DefaultWorkingCopyOwner.PRIMARY)).isOpen()) {
+ if (!isPrimary() && (original = new RubyScript((SourceFolder) getParent(), getElementName(), DefaultWorkingCopyOwner.PRIMARY)).isOpen()) {
buffer.setContents(original.getSource());
} else {
IFile file = (IFile) getResource();
@@ -397,7 +397,7 @@
RubyModelManager manager = RubyModelManager.getRubyModelManager();
- RubyScript workingCopy = new RubyScript((RubyElement) getParent(), getElementName(), DefaultWorkingCopyOwner.PRIMARY);
+ RubyScript workingCopy = new RubyScript((SourceFolder) getParent(), getElementName(), DefaultWorkingCopyOwner.PRIMARY);
RubyModelManager.PerWorkingCopyInfo perWorkingCopyInfo = manager.getPerWorkingCopyInfo(workingCopy, false/*
* don't
* create
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/SourceFolder.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/SourceFolder.java 2007-01-23 18:31:25 UTC (rev 1864)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/SourceFolder.java 2007-01-23 20:31:32 UTC (rev 1865)
@@ -13,7 +13,6 @@
import org.eclipse.core.runtime.Path;
import org.rubypeople.rdt.core.IParent;
import org.rubypeople.rdt.core.IRubyElement;
-import org.rubypeople.rdt.core.IRubyProject;
import org.rubypeople.rdt.core.IRubyScript;
import org.rubypeople.rdt.core.ISourceFolder;
import org.rubypeople.rdt.core.RubyModelException;
@@ -152,7 +151,8 @@
}
public IPath getPath() {
- IRubyProject root = this.getRubyProject();
+ SourceFolderRoot root = this.getSourceFolderRoot();
+
IPath path = root.getPath();
for (int i = 0, length = this.names.length; i < length; i++) {
String name = this.names[i];
@@ -180,17 +180,15 @@
SourceFolderRoot root = this.getSourceFolderRoot();
if (root.isArchive()) {
return root.getResource();
- } else {
- int length = this.names.length;
- if (length == 0) {
- return root.getResource();
- } else {
- IPath path = new Path(this.names[0]);
- for (int i = 1; i < length; i++)
- path = path.append(this.names[i]);
- return ((IContainer)root.getResource()).getFolder(path);
- }
}
+ int length = this.names.length;
+ if (length == 0) {
+ return root.getResource();
+ }
+ IPath path = new Path(this.names[0]);
+ for (int i = 1; i < length; i++)
+ path = path.append(this.names[i]);
+ return ((IContainer) root.getResource()).getFolder(path);
}
public IResource getUnderlyingResource() throws RubyModelException {
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/util/ASTUtil.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/util/ASTUtil.java 2007-01-23 18:31:25 UTC (rev 1864)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/util/ASTUtil.java 2007-01-23 20:31:32 UTC (rev 1865)
@@ -22,6 +22,8 @@
import org.jruby.parser.StaticScope;
public abstract class ASTUtil {
+ private static final boolean VERBOSE = false;
+
/**
* @param argsNode
* @param bodyNode
@@ -108,11 +110,15 @@
return stringRepresentation((DStrNode) node);
if (node instanceof StrNode)
return ((StrNode) node).getValue();
- System.err.println("Reached node type we don't know how to represent: "
+ log("Reached node type we don't know how to represent: "
+ node.getClass().getName());
return node.toString();
}
+ private static void log(String string) {
+ if (VERBOSE) System.out.println(string);
+ }
+
private static String stringRepresentation(DStrNode node) {
List children = node.childNodes();
StringBuffer buffer = new StringBuffer();
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/rubyeditor/EditorUtility.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/rubyeditor/EditorUtility.java 2007-01-23 18:31:25 UTC (rev 1864)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/rubyeditor/EditorUtility.java 2007-01-23 20:31:32 UTC (rev 1865)
@@ -34,6 +34,7 @@
import org.rubypeople.rdt.core.ISourceReference;
import org.rubypeople.rdt.core.RubyCore;
import org.rubypeople.rdt.core.RubyModelException;
+import org.rubypeople.rdt.internal.core.ExternalRubyScript;
import org.rubypeople.rdt.internal.corext.util.RubyModelUtil;
import org.rubypeople.rdt.internal.ui.RubyPlugin;
import org.rubypeople.rdt.ui.PreferenceConstants;
@@ -141,7 +142,8 @@
if (resource instanceof IFile)
return new FileEditorInput((IFile) resource);
}
-
+ if (element instanceof ExternalRubyScript)
+ return new ExternalRubyFileEditorInput(((ExternalRubyScript) element).getFile());
element= element.getParent();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-01-23 18:31:31
|
Revision: 1864
http://svn.sourceforge.net/rubyeclipse/?rev=1864&view=rev
Author: cawilliams
Date: 2007-01-23 10:31:25 -0800 (Tue, 23 Jan 2007)
Log Message:
-----------
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/ExternalSourceFolder.java
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/ExternalSourceFolder.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/ExternalSourceFolder.java 2007-01-23 18:30:51 UTC (rev 1863)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/ExternalSourceFolder.java 2007-01-23 18:31:25 UTC (rev 1864)
@@ -20,6 +20,7 @@
if (!openableParent.isOpen()) {
openableParent.generateInfos(openableParent.createElementInfo(), newElements, pm);
}
+ // XXX We need to modify ExtenralSourceFolerRoot's computeChildren method. None of the source folders' children are getting set!
}
public boolean isReadOnly() {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-01-23 18:30:53
|
Revision: 1863
http://svn.sourceforge.net/rubyeclipse/?rev=1863&view=rev
Author: cawilliams
Date: 2007-01-23 10:30:51 -0800 (Tue, 23 Jan 2007)
Log Message:
-----------
getting ever closer to having external libraries hooked up properly...
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/RubyCore.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/ExternalSourceFolderRoot.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyElement.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyModel.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyProject.java
Added Paths:
-----------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/ExternalSourceFolder.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/ExternalSourceFolderRootInfo.java
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/RubyCore.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/RubyCore.java 2007-01-23 17:17:26 UTC (rev 1862)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/RubyCore.java 2007-01-23 18:30:51 UTC (rev 1863)
@@ -852,7 +852,7 @@
}
// outside the workspace
if (target instanceof File) {
- File externalFile = RubyModel.getFile(target);
+ File externalFile = RubyModel.getFolder(target);
if (externalFile != null) {
return RubyCore.newLibraryEntry(resolvedPath, entry.isExported());
} else { // external binary folder
Added: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/ExternalSourceFolder.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/ExternalSourceFolder.java (rev 0)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/ExternalSourceFolder.java 2007-01-23 18:30:51 UTC (rev 1863)
@@ -0,0 +1,28 @@
+package org.rubypeople.rdt.internal.core;
+
+import java.util.HashMap;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.rubypeople.rdt.core.RubyModelException;
+
+public class ExternalSourceFolder extends SourceFolder {
+
+ public ExternalSourceFolder(SourceFolderRoot parent, String[] names) {
+ super(parent, names);
+ }
+
+ /*
+ * @see RubyElement#generateInfos
+ */
+ protected void generateInfos(Object info, HashMap newElements, IProgressMonitor pm) throws RubyModelException {
+ // Open my folder: this creates all the pkg infos
+ Openable openableParent = (Openable)this.parent;
+ if (!openableParent.isOpen()) {
+ openableParent.generateInfos(openableParent.createElementInfo(), newElements, pm);
+ }
+ }
+
+ public boolean isReadOnly() {
+ return true;
+ }
+}
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/ExternalSourceFolderRoot.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/ExternalSourceFolderRoot.java 2007-01-23 17:17:26 UTC (rev 1862)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/ExternalSourceFolderRoot.java 2007-01-23 18:30:51 UTC (rev 1863)
@@ -1,31 +1,95 @@
package org.rubypeople.rdt.internal.core;
+import java.io.File;
import java.util.ArrayList;
import java.util.Map;
-import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.rubypeople.rdt.core.IRubyElement;
+import org.rubypeople.rdt.core.IRubyModelStatusConstants;
+import org.rubypeople.rdt.core.ISourceFolder;
import org.rubypeople.rdt.core.ISourceFolderRoot;
-import org.rubypeople.rdt.core.RubyCore;
import org.rubypeople.rdt.core.RubyModelException;
import org.rubypeople.rdt.internal.core.util.CharOperation;
+import org.rubypeople.rdt.internal.core.util.Util;
-public class ExternalSourceFolderRoot extends SourceFolderRoot implements
- ISourceFolderRoot {
-
+public class ExternalSourceFolderRoot extends SourceFolderRoot implements ISourceFolderRoot {
+
public final static ArrayList EMPTY_LIST = new ArrayList();
protected final IPath folderPath;
-
- protected ExternalSourceFolderRoot(IPath resource,
- RubyProject project) {
+
+ protected ExternalSourceFolderRoot(IPath resource, RubyProject project) {
super(null, project);
this.folderPath = resource;
}
+
+ @Override
+ protected boolean computeChildren(OpenableElementInfo info, Map newElements) throws RubyModelException {
+ try {
+ // the underlying resource may be a folder or a project (in the case
+ // that the project folder
+ // is actually the source folder root)
+ Object target = RubyModel.getTarget(ResourcesPlugin.getWorkspace().getRoot(), this.folderPath, false);
+ if (target instanceof File) {
+ ArrayList vChildren = new ArrayList(5);
+ computeFolderChildren((File) target, CharOperation.NO_STRINGS, vChildren);
+ IRubyElement[] children = new IRubyElement[vChildren.size()];
+ vChildren.toArray(children);
+ info.setChildren(children);
+ }
+ } catch (RubyModelException e) {
+ // problem resolving children; structure remains unknown
+ info.setChildren(new IRubyElement[] {});
+ throw e;
+ }
+ return true;
+ }
+
+ protected void computeFolderChildren(File folder, String[] pkgName, ArrayList vChildren) throws RubyModelException {
+ ISourceFolder pkg = getSourceFolder(pkgName);
+ vChildren.add(pkg);
+
+ try {
+ RubyProject rubyProject = (RubyProject) getRubyProject();
+ RubyModelManager manager = RubyModelManager.getRubyModelManager();
+ File[] members = folder.listFiles();
+
+ for (int i = 0, max = members.length; i < max; i++) {
+ File member = members[i];
+ String memberName = member.getName();
+ if (member.isDirectory()) {
+ String[] newNames = Util.arrayConcat(pkgName, manager.intern(memberName));
+ computeFolderChildren(member, newNames, vChildren);
+ ISourceFolder child = getSourceFolder(newNames);
+ vChildren.add(child);
+ } else if (member.isFile()) {
+ // do nothing
+ }
+ }
+ } catch (IllegalArgumentException e) {
+ throw new RubyModelException(e, IRubyModelStatusConstants.ELEMENT_DOES_NOT_EXIST); // could
+ // be
+ // thrown
+ // by
+ // ElementTree
+ // when
+ // path
+ // is
+ // not
+ // found
+ } catch (CoreException e) {
+ throw new RubyModelException(e);
+ }
+ }
+ public SourceFolder getSourceFolder(String[] pkgName) {
+ return new ExternalSourceFolder(this, pkgName);
+ }
+
@Override
public IPath getPath() {
return folderPath;
@@ -35,51 +99,76 @@
public boolean isExternal() {
return true;
}
-
+
public int hashCode() {
return this.folderPath.hashCode();
}
-
+
@Override
public boolean isReadOnly() {
return true;
}
-
+
/**
- * Returns true if this handle represents the same folder
- * as the given handle.
- *
+ * Returns true if this handle represents the same folder as the given
+ * handle.
+ *
* @see Object#equals
*/
public boolean equals(Object o) {
if (this == o)
return true;
if (o instanceof ExternalSourceFolderRoot) {
- ExternalSourceFolderRoot other= (ExternalSourceFolderRoot) o;
+ ExternalSourceFolderRoot other = (ExternalSourceFolderRoot) o;
return this.folderPath.equals(other.folderPath);
}
return false;
}
-
- @Override
- protected boolean computeChildren(OpenableElementInfo info, Map newElements) throws RubyModelException {
- try {
- // the underlying resource may be a folder or a project (in the case that the project folder
- // is actually the source folder root)
- IWorkspaceRoot workspaceRoot = RubyCore.getWorkspace().getRoot();
- IContainer rootFolder = workspaceRoot.getContainerForLocation(folderPath.makeAbsolute());
- if (rootFolder.getType() == IResource.FOLDER || rootFolder.getType() == IResource.PROJECT) {
- ArrayList vChildren = new ArrayList(5);
- computeFolderChildren(rootFolder, CharOperation.NO_STRINGS, vChildren);
- IRubyElement[] children = new IRubyElement[vChildren.size()];
- vChildren.toArray(children);
- info.setChildren(children);
- }
- } catch (RubyModelException e) {
- //problem resolving children; structure remains unknown
- info.setChildren(new IRubyElement[]{});
- throw e;
+
+ /**
+ * @see IRubyElement
+ */
+ public IResource getUnderlyingResource() throws RubyModelException {
+ if (isExternal()) {
+ if (!exists())
+ throw newNotPresentException();
+ return null;
}
- return true;
+ return super.getUnderlyingResource();
}
+
+ /**
+ * Returns a new element info for this element.
+ */
+ protected Object createElementInfo() {
+ return new ExternalSourceFolderRootInfo();
+ }
+
+ public IResource getResource() {
+ if (this.resource == null) {
+ this.resource = RubyModel.getTarget(ResourcesPlugin.getWorkspace().getRoot(), this.folderPath, false);
+ }
+ if (this.resource instanceof IResource) {
+ return super.getResource();
+ }
+ return null;
+ }
+
+ protected boolean resourceExists() {
+ if (this.isExternal()) {
+ return RubyModel.getTarget(ResourcesPlugin.getWorkspace().getRoot(), this.getPath(), // don't
+ // make
+ // the
+ // path
+ // relative
+ // as
+ // this
+ // is
+ // an
+ // external
+ // archive
+ true) != null;
+ }
+ return super.resourceExists();
+ }
}
Added: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/ExternalSourceFolderRootInfo.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/ExternalSourceFolderRootInfo.java (rev 0)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/ExternalSourceFolderRootInfo.java 2007-01-23 18:30:51 UTC (rev 1863)
@@ -0,0 +1,11 @@
+package org.rubypeople.rdt.internal.core;
+
+public class ExternalSourceFolderRootInfo extends SourceFolderRootInfo {
+ /**
+ * Returns an array of non-ruby resources contained in the receiver.
+ */
+ public Object[] getNonRubyResources() {
+ fNonRubyResources = NO_NON_RUBY_RESOURCES;
+ return fNonRubyResources;
+ }
+}
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyElement.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyElement.java 2007-01-23 17:17:26 UTC (rev 1862)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyElement.java 2007-01-23 18:30:51 UTC (rev 1863)
@@ -26,7 +26,6 @@
import java.util.ArrayList;
import java.util.HashMap;
-import java.util.List;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyModel.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyModel.java 2007-01-23 17:17:26 UTC (rev 1862)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyModel.java 2007-01-23 18:30:51 UTC (rev 1863)
@@ -43,7 +43,7 @@
* been confirmed as file (ie. which returns true to {@link java.io.File#isFile()}.
* Note this cache is kept for the whole session.
*/
- public static HashSet existingExternalConfirmedFiles = new HashSet();
+ public static HashSet existingExternalConfirmedFolders = new HashSet();
protected RubyModel() {
super(null);
@@ -54,7 +54,7 @@
*/
public static void flushExternalFileCache() {
existingExternalFiles = new HashSet();
- existingExternalConfirmedFiles = new HashSet();
+ existingExternalConfirmedFolders = new HashSet();
}
/**
@@ -231,23 +231,23 @@
}
/**
- * Helper method - returns whether an object is afile (ie. which returns true to {@link java.io.File#isFile()}.
+ * Helper method - returns whether an object is a file (ie. which returns true to {@link java.io.File#isFile()}.
*/
-public static boolean isFile(Object target) {
- return getFile(target) != null;
+public static boolean isFolder(Object target) {
+ return getFolder(target) != null;
}
/**
* Helper method - returns the file item (ie. which returns true to {@link java.io.File#isFile()},
* or null if unbound
*/
-public static synchronized File getFile(Object target) {
- if (existingExternalConfirmedFiles.contains(target))
+public static synchronized File getFolder(Object target) {
+ if (existingExternalConfirmedFolders.contains(target))
return (File) target;
if (target instanceof File) {
File f = (File) target;
- if (f.isFile()) {
- existingExternalConfirmedFiles.add(f);
+ if (f.isDirectory()) {
+ existingExternalConfirmedFolders.add(f);
return f;
}
}
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyProject.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyProject.java 2007-01-23 17:17:26 UTC (rev 1862)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyProject.java 2007-01-23 18:30:51 UTC (rev 1863)
@@ -16,7 +16,6 @@
import java.util.HashSet;
import java.util.Hashtable;
import java.util.Iterator;
-import java.util.List;
import java.util.Map;
import javax.xml.parsers.DocumentBuilder;
@@ -46,6 +45,7 @@
import org.osgi.service.prefs.BackingStoreException;
import org.rubypeople.rdt.core.ILoadpathContainer;
import org.rubypeople.rdt.core.ILoadpathEntry;
+import org.rubypeople.rdt.core.IParent;
import org.rubypeople.rdt.core.IRubyElement;
import org.rubypeople.rdt.core.IRubyModelMarker;
import org.rubypeople.rdt.core.IRubyModelStatus;
@@ -406,15 +406,8 @@
ISourceFolderRoot[] roots = getAllSourceFolderRoots(reverseMap);
for (int i = 0; i < roots.length; i++) {
SourceFolderRoot root = (SourceFolderRoot) roots[i];
- List<IRubyElement> childen = root.getChildrenOfType(IRubyElement.TYPE);
- for (IRubyElement element : childen) {
- if (element.isType(IRubyElement.TYPE)) {
- IType aType = (IType) element;
- if (aType.getElementName().equals(className)) {
- return aType;
- }
- }
- }
+ IType type = getType(root, className);
+ if (type != null) return type;
}
} catch (RubyModelException e) {
e.printStackTrace();
@@ -422,6 +415,22 @@
return null;
}
+ private IType getType(IParent parent, String className) throws RubyModelException {
+ IRubyElement[] children = parent.getChildren();
+ for (int j = 0; j < children.length; j++) {
+ IRubyElement child = children[j];
+ if (child.isType(IRubyElement.SOURCE_FOLDER)) {
+ ISourceFolder folder = (ISourceFolder) child;
+ IType type = getType(folder, className);
+ if (type != null) return type;
+ } else if(child.isType(IRubyElement.TYPE)) {
+ IType type = (IType) child;
+ if (type.getElementName().equals(className)) return type;
+ }
+ }
+ return null;
+ }
+
/**
* @param project
* @return
@@ -591,7 +600,7 @@
root = getSourceFolderRoot((IResource) target);
} else {
// external target
- if (RubyModel.isFile(target)) {
+ if (RubyModel.isFolder(target)) {
root = new ExternalSourceFolderRoot(entryPath, this);
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-01-23 17:17:42
|
Revision: 1861
http://svn.sourceforge.net/rubyeclipse/?rev=1861&view=rev
Author: cawilliams
Date: 2007-01-23 09:17:20 -0800 (Tue, 23 Jan 2007)
Log Message:
-----------
more hooking up the launching stuff for loadpaths to core
Modified Paths:
--------------
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/LaunchingPlugin.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RubyVMContainer.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/RubyRuntime.java
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/LaunchingPlugin.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/LaunchingPlugin.java 2007-01-23 16:29:38 UTC (rev 1860)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/LaunchingPlugin.java 2007-01-23 17:17:20 UTC (rev 1861)
@@ -131,13 +131,14 @@
@Override
public void start(BundleContext context) throws Exception {
super.start(context);
-
+ getPluginPreferences().addPropertyChangeListener(this);
RubyRuntime.addVMInstallChangedListener(this);
}
@Override
public void stop(BundleContext context) throws Exception {
try {
+ getPluginPreferences().removePropertyChangeListener(this);
RubyRuntime.removeVMInstallChangedListener(this);
RubyRuntime.saveVMConfiguration();
savePluginPreferences();
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RubyVMContainer.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RubyVMContainer.java 2007-01-23 16:29:38 UTC (rev 1860)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RubyVMContainer.java 2007-01-23 17:17:20 UTC (rev 1861)
@@ -78,6 +78,9 @@
*/
private static ILoadpathEntry[] computeLoadpathEntries(IVMInstall vm) {
IPath[] libs = vm.getLibraryLocations();
+ if (libs == null) {
+ libs = RubyRuntime.getLibraryLocations(vm);
+ }
List entries = new ArrayList(libs.length);
for (int i = 0; i < libs.length; i++) {
entries.add(RubyCore.newLibraryEntry(libs[i], false));
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/RubyRuntime.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/RubyRuntime.java 2007-01-23 16:29:38 UTC (rev 1860)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/RubyRuntime.java 2007-01-23 17:17:20 UTC (rev 1861)
@@ -76,7 +76,7 @@
* </ol>
* @since 0.9.0
*/
- public static final String RUBY_CONTAINER = LaunchingPlugin.getUniqueIdentifier() + "RUBY_CONTAINER"; //$NON-NLS-1$
+ public static final String RUBY_CONTAINER = LaunchingPlugin.getUniqueIdentifier() + ".RUBY_CONTAINER"; //$NON-NLS-1$
/**
* Preference key for the String of XML that defines all installed VMs.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-01-23 17:17:42
|
Revision: 1862
http://svn.sourceforge.net/rubyeclipse/?rev=1862&view=rev
Author: cawilliams
Date: 2007-01-23 09:17:26 -0800 (Tue, 23 Jan 2007)
Log Message:
-----------
add missing messages
Modified Paths:
--------------
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/LaunchingMessages.properties
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/LaunchingMessages.properties
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/LaunchingMessages.properties 2007-01-23 17:17:20 UTC (rev 1861)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/LaunchingMessages.properties 2007-01-23 17:17:26 UTC (rev 1862)
@@ -95,4 +95,7 @@
StandardVMDebugger_Finding_free_socket____2=Finding free socket...
StandardVMDebugger_Constructing_command_line____3=Constructing command line...
StandardVMDebugger_Starting_virtual_machine____4=Starting virtual machine...
-StandardVMDebugger_Establishing_debug_connection____5=Establishing debug connection...
\ No newline at end of file
+StandardVMDebugger_Establishing_debug_connection____5=Establishing debug connection...
+
+LaunchingPlugin_0=Updating build paths
+LaunchingPlugin_1=Update Installed Ruby VMs
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-01-23 16:29:40
|
Revision: 1860
http://svn.sourceforge.net/rubyeclipse/?rev=1860&view=rev
Author: cawilliams
Date: 2007-01-23 08:29:38 -0800 (Tue, 23 Jan 2007)
Log Message:
-----------
more hooking up the launching stuff for loadpaths to core
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/LoadpathContainerInitializer.java
trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/preferences/RubyInterpreterPreferencePage.java
trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/rubyvms/RubyVMsUpdater.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/LaunchingMessages.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/LaunchingPlugin.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RubyVMRuntimeLoadpathEntryResolver.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/RubyRuntime.java
trunk/org.rubypeople.rdt.launching.tests/src/org/rubypeople/rdt/internal/launching/TC_RubyRuntime.java
trunk/org.rubypeople.rdt.launching.tests/src/org/rubypeople/rdt/internal/launching/TC_RunnerLaunching.java
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/LoadpathContainerInitializer.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/LoadpathContainerInitializer.java 2007-01-23 15:40:11 UTC (rev 1859)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/LoadpathContainerInitializer.java 2007-01-23 16:29:38 UTC (rev 1860)
@@ -22,8 +22,8 @@
/**
* Abstract base implementation of all classpath container initializer.
- * Classpath variable containers are used in conjunction with the
- * "org.eclipse.jdt.core.classpathContainerInitializer" extension point.
+ * Loadpath variable containers are used in conjunction with the
+ * "org.rubypeople.rdt.core.classpathContainerInitializer" extension point.
* <p>
* Clients should subclass this class to implement a specific classpath
* container initializer. The subclass must have a public 0-argument
Modified: trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/preferences/RubyInterpreterPreferencePage.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/preferences/RubyInterpreterPreferencePage.java 2007-01-23 15:40:11 UTC (rev 1859)
+++ trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/preferences/RubyInterpreterPreferencePage.java 2007-01-23 16:29:38 UTC (rev 1860)
@@ -218,7 +218,8 @@
}
protected void removeInterpreter() {
- fVMList.remove(getSelectedInterpreter());
+ fVMs.remove(getSelectedInterpreter());
+ fVMList.refresh();
}
protected void enableButtons() {
@@ -271,7 +272,7 @@
IVMInstall defaultVM = getCheckedRubyVM();
IVMInstall[] vms = getRubyVMs();
RubyVMsUpdater updater = new RubyVMsUpdater();
- if (!updater.updateJRESettings(vms, defaultVM)) {
+ if (!updater.updateRubyVMSettings(vms, defaultVM)) {
canceled[0] = true;
}
}
Modified: trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/rubyvms/RubyVMsUpdater.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/rubyvms/RubyVMsUpdater.java 2007-01-23 15:40:11 UTC (rev 1859)
+++ trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/rubyvms/RubyVMsUpdater.java 2007-01-23 16:29:38 UTC (rev 1860)
@@ -54,22 +54,22 @@
/**
* Updates VM settings and returns whether the update was successful.
*
- * @param jres new installed JREs
- * @param defaultJRE new default VM
+ * @param rubyVMs new installed JREs
+ * @param defaultRubyVM new default VM
* @return whether the update was successful
*/
- public boolean updateJRESettings(IVMInstall[] jres, IVMInstall defaultJRE) {
+ public boolean updateRubyVMSettings(IVMInstall[] rubyVMs, IVMInstall defaultRubyVM) {
// Create a VM definition container
VMDefinitionsContainer vmContainer = new VMDefinitionsContainer();
// Set the default VM Id on the container
- String defaultVMId = RubyRuntime.getCompositeIdFromVM(defaultJRE);
+ String defaultVMId = RubyRuntime.getCompositeIdFromVM(defaultRubyVM);
vmContainer.setDefaultVMInstallCompositeID(defaultVMId);
// Set the VMs on the container
- for (int i = 0; i < jres.length; i++) {
- vmContainer.addVM(jres[i]);
+ for (int i = 0; i < rubyVMs.length; i++) {
+ vmContainer.addVM(rubyVMs[i]);
}
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/LaunchingMessages.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/LaunchingMessages.java 2007-01-23 15:40:11 UTC (rev 1859)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/LaunchingMessages.java 2007-01-23 16:29:38 UTC (rev 1860)
@@ -80,6 +80,8 @@
public static String StandardVMDebugger_Establishing_debug_connection____5;
public static String StandardVMDebugger_Couldn__t_connect_to_VM_4;
public static String StandardVMDebugger_Couldn__t_connect_to_VM_5;
+ public static String LaunchingPlugin_0;
+ public static String LaunchingPlugin_1;
private LaunchingMessages() {}
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/LaunchingPlugin.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/LaunchingPlugin.java 2007-01-23 15:40:11 UTC (rev 1859)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/LaunchingPlugin.java 2007-01-23 16:29:38 UTC (rev 1860)
@@ -1,5 +1,6 @@
package org.rubypeople.rdt.internal.launching;
+import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
@@ -25,17 +26,30 @@
import javax.xml.transform.stream.StreamResult;
import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.IWorkspaceRunnable;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Plugin;
import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.Preferences.IPropertyChangeListener;
+import org.eclipse.core.runtime.jobs.Job;
import org.osgi.framework.BundleContext;
+import org.rubypeople.rdt.core.ILoadpathEntry;
+import org.rubypeople.rdt.core.IRubyProject;
import org.rubypeople.rdt.core.RubyCore;
import org.rubypeople.rdt.launching.IRuntimeLoadpathEntry2;
+import org.rubypeople.rdt.launching.IVMInstall;
+import org.rubypeople.rdt.launching.IVMInstallChangedListener;
+import org.rubypeople.rdt.launching.PropertyChangeEvent;
+import org.rubypeople.rdt.launching.RubyRuntime;
+import org.rubypeople.rdt.launching.VMStandin;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@@ -44,7 +58,7 @@
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
-public class LaunchingPlugin extends Plugin {
+public class LaunchingPlugin extends Plugin implements IVMInstallChangedListener, IPropertyChangeListener {
public static final String PLUGIN_ID = "org.rubypeople.rdt.launching"; //$NON-NLS-1$
@@ -65,6 +79,16 @@
*/
private static Map fgLibraryInfoMap = null;
+ /**
+ * Whether changes in VM preferences are being batched. When being batched
+ * the plug-in can ignore processing and changes.
+ */
+ private boolean fBatchingChanges = false;
+
+ private boolean fIgnoreVMDefPropertyChangeEvents = false;
+ private String fOldVMPrefString = EMPTY_STRING;
+ private static final String EMPTY_STRING = ""; //$NON-NLS-1$
+
public static String osDependentPath(String aPath) {
if (Platform.getOS().equals(Platform.OS_WIN32)) {
if (aPath.startsWith(File.separator)) {
@@ -103,17 +127,172 @@
System.out.println(message);
}
}
+
@Override
- public void stop(BundleContext arg0) throws Exception {
- super.stop(arg0);
- savePluginPreferences() ;
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+
+ RubyRuntime.addVMInstallChangedListener(this);
}
+
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ try {
+ RubyRuntime.removeVMInstallChangedListener(this);
+ RubyRuntime.saveVMConfiguration();
+ savePluginPreferences();
+ fgXMLParser = null;
+ } finally {
+ super.stop(context);
+ }
+ }
public static String getUniqueIdentifier() {
return PLUGIN_ID;
}
+
+ /**
+ * Save preferences whenever the connect timeout changes.
+ * Process changes to the list of installed JREs.
+ *
+ * @see org.eclipse.core.runtime.Preferences.IPropertyChangeListener#propertyChange(PropertyChangeEvent)
+ */
+ public void propertyChange(org.eclipse.core.runtime.Preferences.PropertyChangeEvent event) {
+ String property = event.getProperty();
+// if (property.equals(RubyRuntime.PREF_CONNECT_TIMEOUT)) {
+// savePluginPreferences();
+// } else
+ if (property.equals(RubyRuntime.PREF_VM_XML)) {
+ if (!isIgnoreVMDefPropertyChangeEvents()) {
+ processVMPrefsChanged((String)event.getOldValue(), (String)event.getNewValue());
+ }
+ }
+ }
+ public void setIgnoreVMDefPropertyChangeEvents(boolean ignore) {
+ fIgnoreVMDefPropertyChangeEvents = ignore;
+ }
+
+ public boolean isIgnoreVMDefPropertyChangeEvents() {
+ return fIgnoreVMDefPropertyChangeEvents;
+ }
+
/**
+ * Check for differences between the old & new sets of installed JREs.
+ * Differences may include additions, deletions and changes. Take
+ * appropriate action for each type of difference.
+ *
+ * When importing preferences, TWO propertyChange events are fired. The first
+ * has an old value but an empty new value. The second has a new value, but an empty
+ * old value. Normal user changes to the preferences result in a single propertyChange
+ * event, with both old and new values populated. This method handles both types
+ * of notification.
+ */
+ protected void processVMPrefsChanged(String oldValue, String newValue) {
+
+ // batch changes
+ fBatchingChanges = true;
+ VMChanges vmChanges = null;
+ try {
+
+ String oldPrefString;
+ String newPrefString;
+
+ // If empty new value, save the old value and wait for 2nd propertyChange notification
+ if (newValue == null || newValue.equals(EMPTY_STRING)) {
+ fOldVMPrefString = oldValue;
+ return;
+ }
+ // An empty old value signals the second notification in the import preferences
+ // sequence. Now that we have both old & new prefs, we can parse and compare them.
+ else if (oldValue == null || oldValue.equals(EMPTY_STRING)) {
+ oldPrefString = fOldVMPrefString;
+ newPrefString = newValue;
+ }
+ // If both old & new values are present, this is a normal user change
+ else {
+ oldPrefString = oldValue;
+ newPrefString = newValue;
+ }
+
+ vmChanges = new VMChanges();
+ RubyRuntime.addVMInstallChangedListener(vmChanges);
+
+ // Generate the previous VMs
+ VMDefinitionsContainer oldResults = getVMDefinitions(oldPrefString);
+
+ // Generate the current
+ VMDefinitionsContainer newResults = getVMDefinitions(newPrefString);
+
+ // Determine the deteled VMs
+ List deleted = oldResults.getVMList();
+ List current = newResults.getValidVMList();
+ deleted.removeAll(current);
+
+ // Dispose deleted VMs. The 'disposeVMInstall' method fires notification of the
+ // deletion.
+ Iterator deletedIterator = deleted.iterator();
+ while (deletedIterator.hasNext()) {
+ VMStandin deletedVMStandin = (VMStandin) deletedIterator.next();
+ deletedVMStandin.getVMInstallType().disposeVMInstall(deletedVMStandin.getId());
+ }
+
+ // Fire change notification for added and changed VMs. The 'convertToRealVM'
+ // fires the appropriate notification.
+ Iterator iter = current.iterator();
+ while (iter.hasNext()) {
+ VMStandin standin = (VMStandin)iter.next();
+ standin.convertToRealVM();
+ }
+
+ // set the new default VM install. This will fire a 'defaultVMChanged',
+ // if it in fact changed
+ String newDefaultId = newResults.getDefaultVMInstallCompositeID();
+ if (newDefaultId != null) {
+ IVMInstall newDefaultVM = RubyRuntime.getVMFromCompositeId(newDefaultId);
+ if (newDefaultVM != null) {
+ try {
+ RubyRuntime.setDefaultVMInstall(newDefaultVM, null, false);
+ } catch (CoreException ce) {
+ log(ce);
+ }
+ }
+ }
+
+ } finally {
+ // stop batch changes
+ fBatchingChanges = false;
+ if (vmChanges != null) {
+ RubyRuntime.removeVMInstallChangedListener(vmChanges);
+ try {
+ vmChanges.process();
+ } catch (CoreException e) {
+ log(e);
+ }
+ }
+ }
+ }
+
+ /**
+ * Parse the given xml into a VM definitions container, returning an empty
+ * container if an exception occurs.
+ *
+ * @param xml
+ * @return VMDefinitionsContainer
+ */
+ private VMDefinitionsContainer getVMDefinitions(String xml) {
+ if (xml.length() > 0) {
+ try {
+ ByteArrayInputStream stream = new ByteArrayInputStream(xml.getBytes("UTF8")); //$NON-NLS-1$
+ return VMDefinitionsContainer.parseXMLIntoContainer(stream);
+ } catch (IOException e) {
+ LaunchingPlugin.log(e);
+ }
+ }
+ return new VMDefinitionsContainer();
+ }
+
+ /**
* Returns a Document that can be used to build a DOM tree
* @return the Document
* @throws ParserConfigurationException if an exception occurs creating the document builder
@@ -427,5 +606,216 @@
for (int i= 0; i < configs.length; i++) {
fClasspathEntryExtensions.put(configs[i].getAttribute("id"), configs[i]); //$NON-NLS-1$
}
+ }
+
+ public void defaultVMInstallChanged(IVMInstall previous, IVMInstall current) {
+ if (!fBatchingChanges) {
+ try {
+ VMChanges changes = new VMChanges();
+ changes.defaultVMInstallChanged(previous, current);
+ changes.process();
+ } catch (CoreException e) {
+ log(e);
+ }
+ }
+ }
+
+ public void vmAdded(IVMInstall newVm) {
+ }
+
+ public void vmChanged(PropertyChangeEvent event) {
+ if (!fBatchingChanges) {
+ try {
+ VMChanges changes = new VMChanges();
+ changes.vmChanged(event);
+ changes.process();
+ } catch (CoreException e) {
+ log(e);
+ }
+ }
+ }
+
+ public void vmRemoved(IVMInstall vm) {
+ if (!fBatchingChanges) {
+ try {
+ VMChanges changes = new VMChanges();
+ changes.vmRemoved(vm);
+ changes.process();
+ } catch (CoreException e) {
+ log(e);
+ }
+ }
}
+
+ /**
+ * Stores VM changes resulting from a JRE preference change.
+ */
+ class VMChanges implements IVMInstallChangedListener {
+
+ // true if the default VM changes
+ private boolean fDefaultChanged = false;
+
+ // old container ids to new
+ private HashMap fRenamedContainerIds = new HashMap();
+
+ /**
+ * Returns the JRE container id that the given VM would map to, or
+ * <code>null</code> if none.
+ *
+ * @param vm
+ * @return container id or <code>null</code>
+ */
+ private IPath getContainerId(IVMInstall vm) {
+ if (vm != null) {
+ String name = vm.getName();
+ if (name != null) {
+ IPath path = new Path(RubyRuntime.RUBY_CONTAINER);
+ path = path.append(new Path(vm.getVMInstallType().getId()));
+ path = path.append(new Path(name));
+ return path;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * @see org.rubypeople.rdt.launching.IVMInstallChangedListener#defaultVMInstallChanged(org.rubypeople.rdt.launching.IVMInstall, org.rubypeople.rdt.launching.IVMInstall)
+ */
+ public void defaultVMInstallChanged(IVMInstall previous, IVMInstall current) {
+ fDefaultChanged = true;
+ }
+
+ /**
+ * @see org.rubypeople.rdt.launching.IVMInstallChangedListener#vmAdded(org.rubypeople.rdt.launching.IVMInstall)
+ */
+ public void vmAdded(IVMInstall vm) {
+ }
+
+ /**
+ * @see org.rubypeople.rdt.launching.IVMInstallChangedListener#vmChanged(org.rubypeople.rdt.launching.PropertyChangeEvent)
+ */
+ public void vmChanged(org.rubypeople.rdt.launching.PropertyChangeEvent event) {
+ String property = event.getProperty();
+ IVMInstall vm = (IVMInstall)event.getSource();
+ if (property.equals(IVMInstallChangedListener.PROPERTY_NAME)) {
+ IPath newId = getContainerId(vm);
+ IPath oldId = new Path(RubyRuntime.RUBY_CONTAINER);
+ oldId = oldId.append(vm.getVMInstallType().getId());
+ String oldName = (String)event.getOldValue();
+ // bug 33746 - if there is no old name, then this is not a re-name.
+ if (oldName != null) {
+ oldId = oldId.append(oldName);
+ fRenamedContainerIds.put(oldId, newId);
+ }
+ }
+ }
+
+ /**
+ * @see org.rubypeople.rdt.launching.IVMInstallChangedListener#vmRemoved(org.rubypeople.rdt.launching.IVMInstall)
+ */
+ public void vmRemoved(IVMInstall vm) {
+ }
+
+ /**
+ * Re-bind loadpath variables and containers affected by the JRE
+ * changes.
+ */
+ public void process() throws CoreException {
+ RubyVMUpdateJob job = new RubyVMUpdateJob(this);
+ job.schedule();
+ }
+
+ protected void doit(IProgressMonitor monitor) throws CoreException {
+ IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
+ public void run(IProgressMonitor monitor1) throws CoreException {
+ IRubyProject[] projects = RubyCore.create(ResourcesPlugin.getWorkspace().getRoot()).getRubyProjects();
+ monitor1.beginTask(LaunchingMessages.LaunchingPlugin_0, projects.length + 1);
+ rebind(monitor1, projects);
+ monitor1.done();
+ }
+ };
+ RubyCore.run(runnable, null, monitor);
+ }
+
+ /**
+ * Re-bind loadpath variables and containers affected by the Ruby VM
+ * changes.
+ * @param monitor
+ */
+ private void rebind(IProgressMonitor monitor, IRubyProject[] projects) throws CoreException {
+
+ if (fDefaultChanged) {
+ // re-bind RUBYLIB if the default VM changed
+ RubyLoadpathVariablesInitializer initializer = new RubyLoadpathVariablesInitializer();
+ initializer.initialize(RubyRuntime.RUBYLIB_VARIABLE);
+ }
+ monitor.worked(1);
+
+ // re-bind all container entries
+ for (int i = 0; i < projects.length; i++) {
+ IRubyProject project = projects[i];
+ ILoadpathEntry[] entries = project.getRawLoadpath();
+ boolean replace = false;
+ for (int j = 0; j < entries.length; j++) {
+ ILoadpathEntry entry = entries[j];
+ switch (entry.getEntryKind()) {
+ case ILoadpathEntry.CPE_CONTAINER:
+ IPath reference = entry.getPath();
+ IPath newBinding = null;
+ String firstSegment = reference.segment(0);
+ if (RubyRuntime.RUBY_CONTAINER.equals(firstSegment)) {
+ if (reference.segmentCount() > 1) {
+ IPath renamed = (IPath)fRenamedContainerIds.get(reference);
+ if (renamed != null) {
+ // The JRE was re-named. This changes the identifier of
+ // the container entry.
+ newBinding = renamed;
+ }
+ }
+ RubyContainerInitializer initializer = new RubyContainerInitializer();
+ if (newBinding == null){
+ // rebind old path
+ initializer.initialize(reference, project);
+ } else {
+ // replace old cp entry with a new one
+ ILoadpathEntry newEntry = RubyCore.newContainerEntry(newBinding, entry.isExported());
+ entries[j] = newEntry;
+ replace = true;
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ if (replace) {
+ project.setRawLoadpath(entries, null);
+ }
+ monitor.worked(1);
+ }
+ }
+ }
+
+ class RubyVMUpdateJob extends Job {
+ private VMChanges fChanges;
+
+ public RubyVMUpdateJob(VMChanges changes) {
+ super(LaunchingMessages.LaunchingPlugin_1);
+ fChanges = changes;
+ setSystem(true);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ protected IStatus run(IProgressMonitor monitor) {
+ try {
+ fChanges.doit(monitor);
+ } catch (CoreException e) {
+ return e.getStatus();
+ }
+ return Status.OK_STATUS;
+ }
+
+ }
}
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RubyVMRuntimeLoadpathEntryResolver.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RubyVMRuntimeLoadpathEntryResolver.java 2007-01-23 15:40:11 UTC (rev 1859)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RubyVMRuntimeLoadpathEntryResolver.java 2007-01-23 16:29:38 UTC (rev 1860)
@@ -30,7 +30,7 @@
import org.rubypeople.rdt.launching.RubyRuntime;
/**
- * Resolves for JRELIB_VARIABLE and JRE_CONTAINER
+ * Resolves for RUBYLIB_VARIABLE and RUBY_CONTAINER
*/
public class RubyVMRuntimeLoadpathEntryResolver implements IRuntimeLoadpathEntryResolver2 {
@@ -38,38 +38,38 @@
* @see IRuntimeLoadpathEntryResolver#resolveRuntimeLoadpathEntry(IRuntimeLoadpathEntry, ILaunchConfiguration)
*/
public IRuntimeLoadpathEntry[] resolveRuntimeLoadpathEntry(IRuntimeLoadpathEntry entry, ILaunchConfiguration configuration) throws CoreException {
- IVMInstall jre = null;
+ IVMInstall rubyVM = null;
if (entry.getType() == IRuntimeLoadpathEntry.CONTAINER && entry.getPath().segmentCount() > 1) {
// a specific VM
- jre = RubyContainerInitializer.resolveInterpreter(entry.getPath());
+ rubyVM = RubyContainerInitializer.resolveInterpreter(entry.getPath());
} else {
// default VM for config
- jre = RubyRuntime.computeVMInstall(configuration);
+ rubyVM = RubyRuntime.computeVMInstall(configuration);
}
- if (jre == null) {
- // cannot resolve JRE
+ if (rubyVM == null) {
+ // cannot resolve Ruby VM
return new IRuntimeLoadpathEntry[0];
}
- return resolveLibraryLocations(jre, entry.getLoadpathProperty());
+ return resolveLibraryLocations(rubyVM, entry.getLoadpathProperty());
}
/**
* @see IRuntimeLoadpathEntryResolver#resolveRuntimeLoadpathEntry(IRuntimeLoadpathEntry, IRubyProject)
*/
public IRuntimeLoadpathEntry[] resolveRuntimeLoadpathEntry(IRuntimeLoadpathEntry entry, IRubyProject project) throws CoreException {
- IVMInstall jre = null;
+ IVMInstall rubyVM = null;
if (entry.getType() == IRuntimeLoadpathEntry.CONTAINER && entry.getPath().segmentCount() > 1) {
// a specific VM
- jre = RubyContainerInitializer.resolveInterpreter(entry.getPath());
+ rubyVM = RubyContainerInitializer.resolveInterpreter(entry.getPath());
} else {
// default VM for project
- jre = RubyRuntime.getVMInstall(project);
+ rubyVM = RubyRuntime.getVMInstall(project);
}
- if (jre == null) {
- // cannot resolve JRE
+ if (rubyVM == null) {
+ // cannot resolve RubyVM
return new IRuntimeLoadpathEntry[0];
}
- return resolveLibraryLocations(jre, entry.getLoadpathProperty());
+ return resolveLibraryLocations(rubyVM, entry.getLoadpathProperty());
}
/**
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/RubyRuntime.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/RubyRuntime.java 2007-01-23 15:40:11 UTC (rev 1859)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/RubyRuntime.java 2007-01-23 16:29:38 UTC (rev 1860)
@@ -25,6 +25,7 @@
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.core.runtime.Path;
@@ -218,29 +219,7 @@
initializeVMs();
return fgDefaultVMId;
}
-
- public static void setSelectedInterpreter(IVMInstall vm) throws CoreException {
- setDefaultVMInstall(vm, true);
- }
-
- public static void setDefaultVMInstall(IVMInstall vm, boolean savePreference) throws CoreException {
- IVMInstall previous = null;
- if (fgDefaultVMId != null) {
- previous = getVMFromCompositeId(fgDefaultVMId);
- }
- fgDefaultVMId= getCompositeIdFromVM(vm);
- if (savePreference) {
- saveVMConfiguration();
- }
- IVMInstall current = null;
- if (fgDefaultVMId != null) {
- current = getVMFromCompositeId(fgDefaultVMId);
- }
- if (previous != current) {
- notifyDefaultVMChanged(previous, current);
- }
- }
-
+
/**
* Saves the VM configuration information to the preferences. This includes
* the following information:
@@ -1593,5 +1572,35 @@
public static IRuntimeLoadpathEntry[] resolveRuntimeLoadpath(
IRuntimeLoadpathEntry[] entries, ILaunchConfiguration configuration) throws CoreException {
return getLoadpathProvider(configuration).resolveLoadpath(entries, configuration);
+ }
+
+ /**
+ * Sets a VM as the system-wide default VM, and notifies registered VM install
+ * change listeners of the change.
+ *
+ * @param vm The vm to make the default. May be <code>null</code> to clear
+ * the default.
+ * @param monitor progress monitor or <code>null</code>
+ * @param savePreference If <code>true</code>, update workbench preferences to reflect
+ * the new default VM.
+ * @throws CoreException
+ * @since 0.9.0
+ */
+ public static void setDefaultVMInstall(IVMInstall vm, IProgressMonitor monitor, boolean savePreference) throws CoreException {
+ IVMInstall previous = null;
+ if (fgDefaultVMId != null) {
+ previous = getVMFromCompositeId(fgDefaultVMId);
+ }
+ fgDefaultVMId = getCompositeIdFromVM(vm);
+ if (savePreference) {
+ saveVMConfiguration();
+ }
+ IVMInstall current = null;
+ if (fgDefaultVMId != null) {
+ current = getVMFromCompositeId(fgDefaultVMId);
+ }
+ if (previous != current) {
+ notifyDefaultVMChanged(previous, current);
+ }
}
}
Modified: trunk/org.rubypeople.rdt.launching.tests/src/org/rubypeople/rdt/internal/launching/TC_RubyRuntime.java
===================================================================
--- trunk/org.rubypeople.rdt.launching.tests/src/org/rubypeople/rdt/internal/launching/TC_RubyRuntime.java 2007-01-23 15:40:11 UTC (rev 1859)
+++ trunk/org.rubypeople.rdt.launching.tests/src/org/rubypeople/rdt/internal/launching/TC_RubyRuntime.java 2007-01-23 16:29:38 UTC (rev 1860)
@@ -78,7 +78,7 @@
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<vmSettings defaultVM=\"\" defaultVMConnector=\"\">\r\n<vmType id=\"org.rubypeople.rdt.launching.StandardVMType\">\r\n<vm id=\"InterpreterOne\" name=\"InterpreterOne\" path=\"C:\\RubyInstallRootOne\"/>\r\n<vm id=\"InterpreterTwo\" name=\"InterpreterTwo\" path=\"C:\\RubyInstallRootTwo\"/>\r\n</vmType>\r\n</vmSettings>\r\n",
getVMsXML());
- RubyRuntime.setSelectedInterpreter(standin2);
+ RubyRuntime.setDefaultVMInstall(standin2, null,true);
assertEquals(
"XML should indicate both interpreters with the first one being selected.",
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<vmSettings defaultVM=\"" + RubyRuntime.getCompositeIdFromVM(standin2) + "\" defaultVMConnector=\"\">\r\n<vmType id=\"org.rubypeople.rdt.launching.StandardVMType\">\r\n<vm id=\"InterpreterOne\" name=\"InterpreterOne\" path=\"C:\\RubyInstallRootOne\"/>\r\n<vm id=\"InterpreterTwo\" name=\"InterpreterTwo\" path=\"C:\\RubyInstallRootTwo\"/>\r\n</vmType>\r\n</vmSettings>\r\n",
Modified: trunk/org.rubypeople.rdt.launching.tests/src/org/rubypeople/rdt/internal/launching/TC_RunnerLaunching.java
===================================================================
--- trunk/org.rubypeople.rdt.launching.tests/src/org/rubypeople/rdt/internal/launching/TC_RunnerLaunching.java 2007-01-23 15:40:11 UTC (rev 1859)
+++ trunk/org.rubypeople.rdt.launching.tests/src/org/rubypeople/rdt/internal/launching/TC_RunnerLaunching.java 2007-01-23 16:29:38 UTC (rev 1860)
@@ -53,7 +53,7 @@
standin.setName("fake");
standin.setInstallLocation(new File("C:\ruby"));
IVMInstall real = standin.convertToRealVM();
- RubyRuntime.setDefaultVMInstall(real, true);
+ RubyRuntime.setDefaultVMInstall(real, null, true);
}
protected ILaunchManager getLaunchManager() {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-01-23 15:52:31
|
Revision: 1859
http://svn.sourceforge.net/rubyeclipse/?rev=1859&view=rev
Author: cawilliams
Date: 2007-01-23 07:40:11 -0800 (Tue, 23 Jan 2007)
Log Message:
-----------
still wokring towards getting RubyProject to actually resolve the RUBY_CONTAINER loadpath entry
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyProject.java
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyProject.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyProject.java 2007-01-23 15:16:10 UTC (rev 1858)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyProject.java 2007-01-23 15:40:11 UTC (rev 1859)
@@ -46,7 +46,6 @@
import org.osgi.service.prefs.BackingStoreException;
import org.rubypeople.rdt.core.ILoadpathContainer;
import org.rubypeople.rdt.core.ILoadpathEntry;
-import org.rubypeople.rdt.core.IParent;
import org.rubypeople.rdt.core.IRubyElement;
import org.rubypeople.rdt.core.IRubyModelMarker;
import org.rubypeople.rdt.core.IRubyModelStatus;
@@ -388,7 +387,7 @@
public boolean hasChildren() {
return true;
}
-
+
/*
* (non-Javadoc)
*
@@ -402,26 +401,17 @@
} else {
className = fullyQualifiedName.substring(index + 2);
}
-
- // XXX Use the imports to search the path properly, then do an
- // exhaustive search if that fails
- IType child = searchChildren(this, className);
- if (child != null)
- return child;
try {
- ILoadpathEntry[] loadpaths = getResolvedLoadpath(true);
- for (int i = 0; i < loadpaths.length; i++) {
- ILoadpathEntry entry = loadpaths[i];
- if (entry.getEntryKind() == ILoadpathEntry.CPE_LIBRARY) {
- IPath path = entry.getPath();
- SourceFolderRoot root = new ExternalSourceFolderRoot(path, this);
- List<IRubyElement> childen = root.getChildrenOfType(IRubyElement.TYPE);
- for (IRubyElement element : childen) {
- if (element.isType(IRubyElement.TYPE)) {
- IType aType = (IType) element;
- if (aType.getElementName().equals(className)) {
- return aType;
- }
+ Map reverseMap = new HashMap(3);
+ ISourceFolderRoot[] roots = getAllSourceFolderRoots(reverseMap);
+ for (int i = 0; i < roots.length; i++) {
+ SourceFolderRoot root = (SourceFolderRoot) roots[i];
+ List<IRubyElement> childen = root.getChildrenOfType(IRubyElement.TYPE);
+ for (IRubyElement element : childen) {
+ if (element.isType(IRubyElement.TYPE)) {
+ IType aType = (IType) element;
+ if (aType.getElementName().equals(className)) {
+ return aType;
}
}
}
@@ -433,37 +423,12 @@
}
/**
- * @param element
- * @param className
- */
- private IType searchChildren(IRubyElement element, String className) {
- if (element.isType(IRubyElement.TYPE)) {
- if (element.getElementName().equals(className))
- return (IType) element;
- }
- if (!(element instanceof IParent))
- return null;
- try {
- IRubyElement[] children = ((IParent) element).getChildren();
- for (int i = 0; i < children.length; i++) {
- IRubyElement child = children[i];
- IType type = searchChildren(child, className);
- if (type != null)
- return type;
- }
- } catch (RubyModelException e) {
- RubyCore.log(e);
- }
- return null;
- }
-
- /**
- * @param project2
+ * @param project
* @return
*/
- public static boolean hasRubyNature(IProject project2) {
+ public static boolean hasRubyNature(IProject project) {
try {
- return project2.hasNature(RubyCore.NATURE_ID);
+ return project.hasNature(RubyCore.NATURE_ID);
} catch (CoreException e) {
// project does not exist or is not open
}
@@ -914,17 +879,6 @@
return classpath;
classpath = this.readLoadpathFile(createMarkers, logProblems);
}
- // extract out the output location
- IPath outputLocation = null;
- if (classpath != null && classpath.length > 0) {
- ILoadpathEntry entry = classpath[classpath.length - 1];
- // if (entry.getContentKind() == ClasspathEntry.K_OUTPUT) {
- // outputLocation = entry.getPath();
- // ILoadpathEntry[] copy = new ILoadpathEntry[classpath.length - 1];
- // System.arraycopy(classpath, 0, copy, 0, copy.length);
- // classpath = copy;
- // }
- }
if (classpath == null) {
return defaultLoadpath();
}
@@ -936,7 +890,7 @@
*/
if (!createMarkers) {
perProjectInfo.rawLoadpath = classpath;
- perProjectInfo.outputLocation = outputLocation;
+ perProjectInfo.outputLocation = null;
}
return classpath;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-01-23 15:16:12
|
Revision: 1858
http://svn.sourceforge.net/rubyeclipse/?rev=1858&view=rev
Author: cawilliams
Date: 2007-01-23 07:16:10 -0800 (Tue, 23 Jan 2007)
Log Message:
-----------
set up loadpaths on project creation using wizard (sets up RUBY_CONTAINER), start trying to hook that down into core (RubyProject) so we can start searching loadpaths in VM libraries
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyProject.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/RubyRuntime.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/PreferencesMessages.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/NewProjectCreationWizard.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/NewWizardMessages.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/PreferenceConstants.java
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyProject.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyProject.java 2007-01-23 14:25:31 UTC (rev 1857)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyProject.java 2007-01-23 15:16:10 UTC (rev 1858)
@@ -1668,7 +1668,7 @@
public ILoadpathEntry[] getResolvedLoadpath(boolean ignoreUnresolvedEntry) throws RubyModelException {
return getResolvedLoadpath(ignoreUnresolvedEntry, false, // don't
- // generateMarkerOnError
+ // generateMarkerOnError
true // returnResolutionInProgress
);
}
@@ -1676,9 +1676,9 @@
public ISourceFolderRoot[] computeSourceFolderRoots(ILoadpathEntry resolvedEntry) {
try {
return computeSourceFolderRoots(new ILoadpathEntry[] { resolvedEntry }, false, // don't
- // retrieve
- // exported
- // roots
+ // retrieve
+ // exported
+ // roots
null /* no reverse map */
);
} catch (RubyModelException e) {
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/RubyRuntime.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/RubyRuntime.java 2007-01-23 14:25:31 UTC (rev 1857)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/RubyRuntime.java 2007-01-23 15:16:10 UTC (rev 1858)
@@ -96,6 +96,7 @@
* Classpath variable name used for the default RubyVM's library
* (value <code>"RUBY_LIB"</code>).
*/
+// FIXME We need to define more library variables! RUBY_CORE, RUBY_STD_LIB, RUBY_SITE_LIB
public static final String RUBYLIB_VARIABLE= "RUBY_LIB"; //$NON-NLS-1$
/**
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/PreferencesMessages.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/PreferencesMessages.java 2007-01-23 14:25:31 UTC (rev 1857)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/PreferencesMessages.java 2007-01-23 15:16:10 UTC (rev 1858)
@@ -160,6 +160,9 @@
public static String ProjectSelectionDialog_filter;
public static String FoldingConfigurationBlock_enable;
public static String FoldingConfigurationBlock_combo_caption;
+ public static String NewJavaProjectPreferencePage_error_decode;
+ public static String NewJavaProjectPreferencePage_jre_variable_description;
+ public static String NewJavaProjectPreferencePage_jre_container_description;
static {
NLS.initializeMessages(BUNDLE_NAME, PreferencesMessages.class);
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/NewProjectCreationWizard.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/NewProjectCreationWizard.java 2007-01-23 14:25:31 UTC (rev 1857)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/NewProjectCreationWizard.java 2007-01-23 15:16:10 UTC (rev 1858)
@@ -5,11 +5,14 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IProjectDescription;
import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExecutableExtension;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.jface.operation.IRunnableWithProgress;
@@ -18,10 +21,14 @@
import org.eclipse.ui.dialogs.WizardNewProjectCreationPage;
import org.eclipse.ui.wizards.newresource.BasicNewProjectResourceWizard;
import org.eclipse.ui.wizards.newresource.BasicNewResourceWizard;
+import org.rubypeople.rdt.core.ILoadpathEntry;
+import org.rubypeople.rdt.core.IRubyProject;
import org.rubypeople.rdt.core.RubyCore;
+import org.rubypeople.rdt.core.RubyModelException;
import org.rubypeople.rdt.internal.ui.RubyPlugin;
import org.rubypeople.rdt.internal.ui.RubyPluginImages;
import org.rubypeople.rdt.internal.ui.RubyUIMessages;
+import org.rubypeople.rdt.ui.PreferenceConstants;
public class NewProjectCreationWizard extends BasicNewResourceWizard implements INewWizard, IExecutableExtension {
protected WizardNewProjectCreationPage projectPage;
@@ -77,6 +84,8 @@
remainingWorkUnits--;
}
RubyCore.addRubyNature(newProject, new SubProgressMonitor(monitor, remainingWorkUnits));
+ IRubyProject rubyProject = RubyCore.create(newProject);
+ configureRubyProject(rubyProject, new SubProgressMonitor(monitor, 6));
} catch (CoreException e) {
throw new InvocationTargetException(e);
} finally {
@@ -86,6 +95,120 @@
};
}
+ protected void configureRubyProject(IRubyProject rubyProject, IProgressMonitor monitor) {
+ if (monitor == null) {
+ monitor= new NullProgressMonitor();
+ }
+ ILoadpathEntry[] loadpathEntries = getDefaultLoadpath(rubyProject);
+
+ monitor.setTaskName(NewWizardMessages.BuildPathsBlock_operationdesc_java);
+ monitor.beginTask("", loadpathEntries.length * 4 + 4); //$NON-NLS-1$
+ try {
+ IProject project = rubyProject.getProject();
+ IPath projPath= project.getFullPath();
+
+ monitor.worked(1);
+
+ IWorkspaceRoot fWorkspaceRoot= RubyPlugin.getWorkspace().getRoot();
+
+ monitor.worked(1);
+
+ if (monitor.isCanceled()) {
+ throw new OperationCanceledException();
+ }
+
+// int nEntries= loadpathEntries.length;
+// for (int i = 0 ; i < loadpathEntries.length; i++) {
+// ILoadpathEntry entry = loadpathEntries[i];
+// IResource res= entry.getResource();
+// //1 tick
+// if (res instanceof IFolder && entry.getLinkTarget() == null && !res.exists()) {
+// CoreUtility.createFolder((IFolder)res, true, true, new SubProgressMonitor(monitor, 1));
+// } else {
+// monitor.worked(1);
+// }
+//
+// //3 ticks
+// if (entry.getEntryKind() == ILoadpathEntry.CPE_SOURCE) {
+// monitor.worked(1);
+//
+// IPath path= entry.getPath();
+// if (projPath.equals(path)) {
+// monitor.worked(2);
+// continue;
+// }
+//
+// if (projPath.isPrefixOf(path)) {
+// path= path.removeFirstSegments(projPath.segmentCount());
+// }
+// IFolder folder= project.getFolder(path);
+// IPath orginalPath= entry.getOrginalPath();
+// if (orginalPath == null) {
+// if (!folder.exists()) {
+// //New source folder needs to be created
+// if (entry.getLinkTarget() == null) {
+// CoreUtility.createFolder(folder, true, true, new SubProgressMonitor(monitor, 2));
+// } else {
+// folder.createLink(entry.getLinkTarget(), IResource.ALLOW_MISSING_LOCAL, new SubProgressMonitor(monitor, 2));
+// }
+// }
+// } else {
+// if (projPath.isPrefixOf(orginalPath)) {
+// orginalPath= orginalPath.removeFirstSegments(projPath.segmentCount());
+// }
+// IFolder orginalFolder= project.getFolder(orginalPath);
+// if (entry.getLinkTarget() == null) {
+// if (!folder.exists()) {
+// //Source folder was edited, move to new location
+// IPath parentPath= entry.getPath().removeLastSegments(1);
+// if (projPath.isPrefixOf(parentPath)) {
+// parentPath= parentPath.removeFirstSegments(projPath.segmentCount());
+// }
+// if (parentPath.segmentCount() > 0) {
+// IFolder parentFolder= project.getFolder(parentPath);
+// if (!parentFolder.exists()) {
+// CoreUtility.createFolder(parentFolder, true, true, new SubProgressMonitor(monitor, 1));
+// } else {
+// monitor.worked(1);
+// }
+// } else {
+// monitor.worked(1);
+// }
+// orginalFolder.move(entry.getPath(), true, true, new SubProgressMonitor(monitor, 1));
+// }
+// } else {
+// if (!folder.exists() || !entry.getLinkTarget().equals(entry.getOrginalLinkTarget())) {
+// orginalFolder.delete(true, new SubProgressMonitor(monitor, 1));
+// folder.createLink(entry.getLinkTarget(), IResource.ALLOW_MISSING_LOCAL, new SubProgressMonitor(monitor, 1));
+// }
+// }
+// }
+// } else {
+// monitor.worked(3);
+// }
+// if (monitor.isCanceled()) {
+// throw new OperationCanceledException();
+// }
+// }
+
+ rubyProject.setRawLoadpath(loadpathEntries, new SubProgressMonitor(monitor, 2));
+ } catch (RubyModelException e) {
+ RubyPlugin.log(e);
+ } finally {
+ monitor.done();
+ }
+ }
+
+ private ILoadpathEntry[] getDefaultLoadpath(IRubyProject rubyProject) {
+ ILoadpathEntry[] dflts= PreferenceConstants.getDefaultRubyVMLibrary();
+ ILoadpathEntry[] loadpathEntries= new ILoadpathEntry[dflts.length + 1];
+ for (int i = 0; i < dflts.length; i ++) {
+ loadpathEntries[i] = dflts[i];
+ }
+ loadpathEntries[dflts.length] = RubyCore.newSourceEntry(rubyProject.getProject().getFullPath());
+ return loadpathEntries;
+ }
+
public void addPages() {
super.addPages();
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/NewWizardMessages.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/NewWizardMessages.java 2007-01-23 14:25:31 UTC (rev 1857)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/NewWizardMessages.java 2007-01-23 15:16:10 UTC (rev 1858)
@@ -69,6 +69,7 @@
public static String NewClassWizardPage_methods_main;
public static String NewClassWizardPage_methods_constructors;
public static String NewClassWizardPage_methods_label;
+ public static String BuildPathsBlock_operationdesc_java;
static {
NLS.initializeMessages(BUNDLE_NAME, NewWizardMessages.class);
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/PreferenceConstants.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/PreferenceConstants.java 2007-01-23 14:25:31 UTC (rev 1857)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/PreferenceConstants.java 2007-01-23 15:16:10 UTC (rev 1858)
@@ -1,265 +1,320 @@
package org.rubypeople.rdt.ui;
import java.io.File;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.net.URLEncoder;
+import java.util.ArrayList;
+import java.util.NoSuchElementException;
+import java.util.StringTokenizer;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.PreferenceConverter;
import org.eclipse.swt.graphics.RGB;
+import org.rubypeople.rdt.core.ILoadpathEntry;
+import org.rubypeople.rdt.core.RubyCore;
import org.rubypeople.rdt.internal.ui.RubyPlugin;
+import org.rubypeople.rdt.internal.ui.preferences.PreferencesMessages;
import org.rubypeople.rdt.internal.ui.preferences.formatter.ProfileManager;
import org.rubypeople.rdt.launching.IVMInstall;
import org.rubypeople.rdt.launching.RubyRuntime;
public class PreferenceConstants {
- private PreferenceConstants() {
- }
+ private PreferenceConstants() {}
+
+ private static String fgDefaultEncoding= System.getProperty("file.encoding"); //$NON-NLS-1$
- public static final String RI_PATH = "riDirectoryPath";
- public static final String RDOC_PATH = "rdocDirectoryPath";
- public static final String DEBUGGER_USE_RUBY_DEBUG = "useRubyDebug";
+ public static final String RI_PATH = "riDirectoryPath";
+ public static final String RDOC_PATH = "rdocDirectoryPath";
+ public static final String DEBUGGER_USE_RUBY_DEBUG = "useRubyDebug";
- public static final String TEMPLATES_USE_CODEFORMATTER = "templatesUseCodeFormatter"; //$NON-NLS-1$
+ public static final String TEMPLATES_USE_CODEFORMATTER = "templatesUseCodeFormatter"; //$NON-NLS-1$
- private final static String DEFAULT_RDOC_CMD = "rdoc"; //$NON-NLS-1$
- private final static String DEFAULT_RI_CMD = "ri"; //$NON-NLS-1$
+ private final static String DEFAULT_RDOC_CMD = "rdoc"; //$NON-NLS-1$
+ private final static String DEFAULT_RI_CMD = "ri"; //$NON-NLS-1$
+
+ private static final String LOADPATH_RUBYVMLIBRARY_INDEX= PreferenceConstants.NEWPROJECT_JRELIBRARY_INDEX;
+ private static final String LOADPATH_RUBYVMLIBRARY_LIST= PreferenceConstants.NEWPROJECT_JRELIBRARY_LIST;
+
/**
- * A named preference that controls parameter names rendering of methods in the UI.
+ * A named preference that holds a list of possible JRE libraries used by the New Java Project wizard. A library
+ * consists of a description and an arbitrary number of <code>IClasspathEntry</code>s, that will represent the
+ * JRE on the new project's class path.
* <p>
- * Value is of type <code>Boolean</code>: if <code>true</code> return names
- * are rendered
+ * Value is of type <code>String</code>: a semicolon separated list of encoded JRE libraries.
+ * <code>NEWPROJECT_JRELIBRARY_INDEX</code> defines the currently used library. Clients
+ * should use the method <code>encodeJRELibrary</code> to encode a JRE library into a string
+ * and the methods <code>decodeJRELibraryDescription(String)</code> and <code>
+ * decodeJRELibraryClasspathEntries(String)</code> to decode the description and the array
+ * of class path entries from an encoded string.
* </p>
+ *
+ * @see #NEWPROJECT_JRELIBRARY_INDEX
+ * @see #encodeJRELibrary(String, IClasspathEntry[])
+ * @see #decodeJRELibraryDescription(String)
+ * @see #decodeJRELibraryClasspathEntries(String)
+ */
+ public static final String NEWPROJECT_JRELIBRARY_LIST= "org.rubypeople.rdt.ui.wizards.rubyvm.list"; //$NON-NLS-1$
+
+ /**
+ * A named preferences that specifies the current active JRE library.
+ * <p>
+ * Value is of type <code>Integer</code>: an index into the list of possible JRE libraries.
+ * </p>
+ *
+ * @see #NEWPROJECT_JRELIBRARY_LIST
+ */
+ public static final String NEWPROJECT_JRELIBRARY_INDEX= "org.rubypeople.rdt.ui.wizards.rubyvm.index"; //$NON-NLS-1$
+
+
+ /**
+ * A named preference that controls parameter names rendering of methods in
+ * the UI.
+ * <p>
+ * Value is of type <code>Boolean</code>: if <code>true</code> return
+ * names are rendered
+ * </p>
+ *
* @since 0.8.0
*/
- public static final String APPEARANCE_METHOD_PARAMETER_NAMES= "org.rubypeople.rdt.ui.methodparameternames";//$NON-NLS-1$
+ public static final String APPEARANCE_METHOD_PARAMETER_NAMES = "org.rubypeople.rdt.ui.methodparameternames";//$NON-NLS-1$
- /**
- * A named preference that controls whether folding is enabled in the Ruby
- * editor.
- * <p>
- * Value is of type <code>Boolean</code>.
- * </p>
- *
- * @since 3.0
- */
- public static final String EDITOR_FOLDING_ENABLED = "editor_folding_enabled"; //$NON-NLS-1$
+ /**
+ * A named preference that controls whether folding is enabled in the Ruby
+ * editor.
+ * <p>
+ * Value is of type <code>Boolean</code>.
+ * </p>
+ *
+ * @since 3.0
+ */
+ public static final String EDITOR_FOLDING_ENABLED = "editor_folding_enabled"; //$NON-NLS-1$
- /**
- * A named preference that stores the configured folding provider.
- * <p>
- * Value is of type <code>String</code>.
- * </p>
- *
- * @since 3.0
- */
- public static final String EDITOR_FOLDING_PROVIDER = "editor_folding_provider"; //$NON-NLS-1$
+ /**
+ * A named preference that stores the configured folding provider.
+ * <p>
+ * Value is of type <code>String</code>.
+ * </p>
+ *
+ * @since 3.0
+ */
+ public static final String EDITOR_FOLDING_PROVIDER = "editor_folding_provider"; //$NON-NLS-1$
- /**
- * A named preference that stores the value for Rdoc folding for the default
- * folding provider.
- * <p>
- * Value is of type <code>Boolean</code>.
- * </p>
- *
- * @since 3.0
- */
- public static final String EDITOR_FOLDING_RDOC = "editor_folding_default_rdoc"; //$NON-NLS-1$
+ /**
+ * A named preference that stores the value for Rdoc folding for the default
+ * folding provider.
+ * <p>
+ * Value is of type <code>Boolean</code>.
+ * </p>
+ *
+ * @since 3.0
+ */
+ public static final String EDITOR_FOLDING_RDOC = "editor_folding_default_rdoc"; //$NON-NLS-1$
- /**
- * A named preference that controls if temporary problems are evaluated and
- * shown in the UI.
- * <p>
- * Value is of type <code>Boolean</code>.
- * </p>
- */
- public final static String EDITOR_EVALUTE_TEMPORARY_PROBLEMS = "handleTemporaryProblems"; //$NON-NLS-1$
+ /**
+ * A named preference that controls if temporary problems are evaluated and
+ * shown in the UI.
+ * <p>
+ * Value is of type <code>Boolean</code>.
+ * </p>
+ */
+ public final static String EDITOR_EVALUTE_TEMPORARY_PROBLEMS = "handleTemporaryProblems"; //$NON-NLS-1$
- /**
- * A named preference that stores the value for inner type folding for the
- * default folding provider.
- * <p>
- * Value is of type <code>Boolean</code>.
- * </p>
- *
- * @since 3.0
- */
- public static final String EDITOR_FOLDING_INNERTYPES = "editor_folding_default_innertypes"; //$NON-NLS-1$
+ /**
+ * A named preference that stores the value for inner type folding for the
+ * default folding provider.
+ * <p>
+ * Value is of type <code>Boolean</code>.
+ * </p>
+ *
+ * @since 3.0
+ */
+ public static final String EDITOR_FOLDING_INNERTYPES = "editor_folding_default_innertypes"; //$NON-NLS-1$
- /**
- * A named preference that stores the value for method folding for the
- * default folding provider.
- * <p>
- * Value is of type <code>Boolean</code>.
- * </p>
- *
- * @since 3.0
- */
- public static final String EDITOR_FOLDING_METHODS = "editor_folding_default_methods"; //$NON-NLS-1$
+ /**
+ * A named preference that stores the value for method folding for the
+ * default folding provider.
+ * <p>
+ * Value is of type <code>Boolean</code>.
+ * </p>
+ *
+ * @since 3.0
+ */
+ public static final String EDITOR_FOLDING_METHODS = "editor_folding_default_methods"; //$NON-NLS-1$
- /**
- * Preference key suffix for background text style preference keys.
- *
- * @since 2.1
- */
- public static final String EDITOR_BG_SUFFIX = "_background"; //$NON-NLS-1$
-
- /**
- * Preference key suffix for bold text style preference keys.
- *
- * @since 2.1
- */
- public static final String EDITOR_BOLD_SUFFIX = "_bold"; //$NON-NLS-1$
+ /**
+ * Preference key suffix for background text style preference keys.
+ *
+ * @since 2.1
+ */
+ public static final String EDITOR_BG_SUFFIX = "_background"; //$NON-NLS-1$
- /**
- * Preference key suffix for italic text style preference keys.
- *
- * @since 3.0
- */
- public static final String EDITOR_ITALIC_SUFFIX = "_italic"; //$NON-NLS-1$
+ /**
+ * Preference key suffix for bold text style preference keys.
+ *
+ * @since 2.1
+ */
+ public static final String EDITOR_BOLD_SUFFIX = "_bold"; //$NON-NLS-1$
- /**
- * A named preference that controls if correction indicators are shown in
- * the UI.
- * <p>
- * Value is of type <code>Boolean</code>.
- * </p>
- */
- public final static String EDITOR_CORRECTION_INDICATION = "RubyEditor.ShowTemporaryProblem"; //$NON-NLS-1$
- /**
- * A named preference that defines whether the hint to make hover sticky
- * should be shown.
- *
- * @see RubyUI
- * @since 0.8.0
- */
- public static final String EDITOR_SHOW_TEXT_HOVER_AFFORDANCE = "PreferenceConstants.EDITOR_SHOW_TEXT_HOVER_AFFORDANCE"; //$NON-NLS-1$
+ /**
+ * Preference key suffix for italic text style preference keys.
+ *
+ * @since 3.0
+ */
+ public static final String EDITOR_ITALIC_SUFFIX = "_italic"; //$NON-NLS-1$
- /**
- * A named preference that controls if segmented view (show selected element
- * only) is turned on or off.
- * <p>
- * Value is of type <code>Boolean</code>.
- * </p>
- */
- public static final String EDITOR_SHOW_SEGMENTS = "org.rubypeople.rdt.ui.editor.showSegments"; //$NON-NLS-1$
- /**
- * A named preference that controls whether the outline view selection
- * should stay in sync with with the element at the current cursor position.
- * <p>
- * Value is of type <code>Boolean</code>.
- * </p>
- *
- * @since 0.8.0
- */
- public final static String EDITOR_SYNC_OUTLINE_ON_CURSOR_MOVE = "RubyEditor.SyncOutlineOnCursorMove"; //$NON-NLS-1$
+ /**
+ * A named preference that controls if correction indicators are shown in
+ * the UI.
+ * <p>
+ * Value is of type <code>Boolean</code>.
+ * </p>
+ */
+ public final static String EDITOR_CORRECTION_INDICATION = "RubyEditor.ShowTemporaryProblem"; //$NON-NLS-1$
+ /**
+ * A named preference that defines whether the hint to make hover sticky
+ * should be shown.
+ *
+ * @see RubyUI
+ * @since 0.8.0
+ */
+ public static final String EDITOR_SHOW_TEXT_HOVER_AFFORDANCE = "PreferenceConstants.EDITOR_SHOW_TEXT_HOVER_AFFORDANCE"; //$NON-NLS-1$
- /**
- * A named preference that defines how member elements are ordered by the
- * Ruby views using the <code>RubyElementSorter</code>.
- * <p>
- * Value is of type <code>String</code>: A comma separated list of the
- * following entries. Each entry must be in the list, no duplication. List
- * order defines the sort order.
- * <ul>
- * <li><b>T</b>: Types</li>
- * <li><b>C</b>: Constructors</li>
- * <li><b>M</b>: Methods</li>
- * <li><b>F</b>: Fields</li>
- * <li><b>SM</b>: Static Methods</li>
- * <li><b>SF</b>: Static Fields</li>
- * </ul>
- * </p>
- *
- * @since 0.8.0
- */
- public static final String APPEARANCE_MEMBER_SORT_ORDER = "outlinesortoption"; //$NON-NLS-1$
+ /**
+ * A named preference that controls if segmented view (show selected element
+ * only) is turned on or off.
+ * <p>
+ * Value is of type <code>Boolean</code>.
+ * </p>
+ */
+ public static final String EDITOR_SHOW_SEGMENTS = "org.rubypeople.rdt.ui.editor.showSegments"; //$NON-NLS-1$
+ /**
+ * A named preference that controls whether the outline view selection
+ * should stay in sync with with the element at the current cursor position.
+ * <p>
+ * Value is of type <code>Boolean</code>.
+ * </p>
+ *
+ * @since 0.8.0
+ */
+ public final static String EDITOR_SYNC_OUTLINE_ON_CURSOR_MOVE = "RubyEditor.SyncOutlineOnCursorMove"; //$NON-NLS-1$
- /**
- * A named preference that defines how member elements are ordered by
- * visibility in the Ruby views using the <code>RubyElementSorter</code>.
- * <p>
- * Value is of type <code>String</code>: A comma separated list of the
- * following entries. Each entry must be in the list, no duplication. List
- * order defines the sort order.
- * <ul>
- * <li><b>B</b>: Public</li>
- * <li><b>V</b>: Private</li>
- * <li><b>R</b>: Protected</li>
- * </ul>
- * </p>
- *
- * @since 0.8.0
- */
- public static final String APPEARANCE_VISIBILITY_SORT_ORDER = "org.eclipse.jdt.ui.visibility.order"; //$NON-NLS-1$
+ /**
+ * A named preference that defines how member elements are ordered by the
+ * Ruby views using the <code>RubyElementSorter</code>.
+ * <p>
+ * Value is of type <code>String</code>: A comma separated list of the
+ * following entries. Each entry must be in the list, no duplication. List
+ * order defines the sort order.
+ * <ul>
+ * <li><b>T</b>: Types</li>
+ * <li><b>C</b>: Constructors</li>
+ * <li><b>M</b>: Methods</li>
+ * <li><b>F</b>: Fields</li>
+ * <li><b>SM</b>: Static Methods</li>
+ * <li><b>SF</b>: Static Fields</li>
+ * </ul>
+ * </p>
+ *
+ * @since 0.8.0
+ */
+ public static final String APPEARANCE_MEMBER_SORT_ORDER = "outlinesortoption"; //$NON-NLS-1$
- /**
- * A named preferences that controls if Ruby elements are also sorted by
- * visibility.
- * <p>
- * Value is of type <code>Boolean</code>.
- * </p>
- *
- * @since 0.8.0
- */
- public static final String APPEARANCE_ENABLE_VISIBILITY_SORT_ORDER = "org.rubypeople.rdt.ui.enable.visibility.order"; //$NON-NLS-1$
+ /**
+ * A named preference that defines how member elements are ordered by
+ * visibility in the Ruby views using the <code>RubyElementSorter</code>.
+ * <p>
+ * Value is of type <code>String</code>: A comma separated list of the
+ * following entries. Each entry must be in the list, no duplication. List
+ * order defines the sort order.
+ * <ul>
+ * <li><b>B</b>: Public</li>
+ * <li><b>V</b>: Private</li>
+ * <li><b>R</b>: Protected</li>
+ * </ul>
+ * </p>
+ *
+ * @since 0.8.0
+ */
+ public static final String APPEARANCE_VISIBILITY_SORT_ORDER = "org.eclipse.jdt.ui.visibility.order"; //$NON-NLS-1$
- /**
- * A named preference that controls if package name compression is turned on
- * or off.
- * <p>
- * Value is of type <code>Boolean</code>.
- * </p>
- *
- * @see #APPEARANCE_PKG_NAME_PATTERN_FOR_PKG_VIEW
- */
- public static final String APPEARANCE_COMPRESS_PACKAGE_NAMES = "org.rubypeople.rdt.ui.compresspackagenames";//$NON-NLS-1$
+ /**
+ * A named preferences that controls if Ruby elements are also sorted by
+ * visibility.
+ * <p>
+ * Value is of type <code>Boolean</code>.
+ * </p>
+ *
+ * @since 0.8.0
+ */
+ public static final String APPEARANCE_ENABLE_VISIBILITY_SORT_ORDER = "org.rubypeople.rdt.ui.enable.visibility.order"; //$NON-NLS-1$
- /**
- * A named preference that defines the pattern used for package name
- * compression.
- * <p>
- * Value is of type <code>String</code>. For example for the given
- * package name 'org.eclipse.jdt' pattern '.' will compress it to '..jdt',
- * '1~' to 'o~.e~.jdt'.
- * </p>
- */
- public static final String APPEARANCE_PKG_NAME_PATTERN_FOR_PKG_VIEW = "PackagesView.pkgNamePatternForPackagesView";//$NON-NLS-1$
- /**
- * The symbolic font name for the Ruby editor text font
- * (value <code>"org.rubypeople.rdt.ui.editors.textfont"</code>).
- *
- * @since 0.8.0
- */
- public final static String EDITOR_TEXT_FONT= "org.rubypeople.rdt.ui.editors.textfont"; //$NON-NLS-1$
- /**
- * A named preference that controls which profile is used by the code formatter.
- * <p>
- * Value is of type <code>String</code>.
- * </p>
- *
- * @since 0.8.0
- */
- public static final String FORMATTER_PROFILE = "formatter_profile"; //$NON-NLS-1$
+ /**
+ * A named preference that controls if package name compression is turned on
+ * or off.
+ * <p>
+ * Value is of type <code>Boolean</code>.
+ * </p>
+ *
+ * @see #APPEARANCE_PKG_NAME_PATTERN_FOR_PKG_VIEW
+ */
+ public static final String APPEARANCE_COMPRESS_PACKAGE_NAMES = "org.rubypeople.rdt.ui.compresspackagenames";//$NON-NLS-1$
/**
- * A named preference that controls the layout of the Ruby Browsing views vertically. Boolean value.
+ * A named preference that defines the pattern used for package name
+ * compression.
* <p>
- * Value is of type <code>Boolean</code>. If <code>true<code> the views are stacked vertical.
+ * Value is of type <code>String</code>. For example for the given
+ * package name 'org.eclipse.jdt' pattern '.' will compress it to '..jdt',
+ * '1~' to 'o~.e~.jdt'.
+ * </p>
+ */
+ public static final String APPEARANCE_PKG_NAME_PATTERN_FOR_PKG_VIEW = "PackagesView.pkgNamePatternForPackagesView";//$NON-NLS-1$
+ /**
+ * The symbolic font name for the Ruby editor text font (value
+ * <code>"org.rubypeople.rdt.ui.editors.textfont"</code>).
+ *
+ * @since 0.8.0
+ */
+ public final static String EDITOR_TEXT_FONT = "org.rubypeople.rdt.ui.editors.textfont"; //$NON-NLS-1$
+ /**
+ * A named preference that controls which profile is used by the code
+ * formatter.
+ * <p>
+ * Value is of type <code>String</code>.
+ * </p>
+ *
+ * @since 0.8.0
+ */
+ public static final String FORMATTER_PROFILE = "formatter_profile"; //$NON-NLS-1$
+
+ /**
+ * A named preference that controls the layout of the Ruby Browsing views
+ * vertically. Boolean value.
+ * <p>
+ * Value is of type <code>Boolean</code>. If
+ * <code>true<code> the views are stacked vertical.
* If <code>false</code> they are stacked horizontal.
* </p>
*/
- public static final String BROWSING_STACK_VERTICALLY= "org.rubypeople.rdt.ui.browsing.stackVertically"; //$NON-NLS-1$
-
+ public static final String BROWSING_STACK_VERTICALLY = "org.rubypeople.rdt.ui.browsing.stackVertically"; //$NON-NLS-1$
+
/**
* A named preference that controls whether the projects view's selection is
* linked to the active editor.
* <p>
* Value is of type <code>Boolean</code>.
* </p>
+ *
* @since 0.8.0
*/
- public static final String LINK_BROWSING_PROJECTS_TO_EDITOR= "org.rubypeople.rdt.ui.browsing.projectstoeditor"; //$NON-NLS-1$
+ public static final String LINK_BROWSING_PROJECTS_TO_EDITOR = "org.rubypeople.rdt.ui.browsing.projectstoeditor"; //$NON-NLS-1$
/**
* A named preference that controls whether the types view's selection is
@@ -267,70 +322,75 @@
* <p>
* Value is of type <code>Boolean</code>.
* </p>
+ *
* @since 0.8.0
*/
- public static final String LINK_BROWSING_TYPES_TO_EDITOR= "org.rubypeople.rdt.ui.browsing.typestoeditor"; //$NON-NLS-1$
+ public static final String LINK_BROWSING_TYPES_TO_EDITOR = "org.rubypeople.rdt.ui.browsing.typestoeditor"; //$NON-NLS-1$
-
/**
* A named preference that controls whether the members view's selection is
* linked to the active editor.
* <p>
* Value is of type <code>Boolean</code>.
* </p>
+ *
* @since 0.8.0
*/
- public static final String LINK_BROWSING_MEMBERS_TO_EDITOR= "org.rubypeople.rdt.ui.browsing.memberstoeditor"; //$NON-NLS-1$
+ public static final String LINK_BROWSING_MEMBERS_TO_EDITOR = "org.rubypeople.rdt.ui.browsing.memberstoeditor"; //$NON-NLS-1$
/**
* Preference key suffix for strikethrough text style preference keys.
*
* @since 0.9.0
*/
- public static final String EDITOR_STRIKETHROUGH_SUFFIX= "_strikethrough"; //$NON-NLS-1$
-
+ public static final String EDITOR_STRIKETHROUGH_SUFFIX = "_strikethrough"; //$NON-NLS-1$
+
/**
* Preference key suffix for underline text style preference keys.
*
* @since 0.9.0
*/
- public static final String EDITOR_UNDERLINE_SUFFIX= "_underline"; //$NON-NLS-1$
+ public static final String EDITOR_UNDERLINE_SUFFIX = "_underline"; //$NON-NLS-1$
/**
- * A named preference that controls whether bracket matching highlighting is turned on or off.
+ * A named preference that controls whether bracket matching highlighting is
+ * turned on or off.
* <p>
* Value is of type <code>Boolean</code>.
* </p>
*/
- public final static String EDITOR_MATCHING_BRACKETS= "matchingBrackets"; //$NON-NLS-1$
+ public final static String EDITOR_MATCHING_BRACKETS = "matchingBrackets"; //$NON-NLS-1$
/**
- * A named preference that holds the color used to highlight matching brackets.
+ * A named preference that holds the color used to highlight matching
+ * brackets.
* <p>
- * Value is of type <code>String</code>. A RGB color value encoded as a string
- * using class <code>PreferenceConverter</code>
+ * Value is of type <code>String</code>. A RGB color value encoded as a
+ * string using class <code>PreferenceConverter</code>
* </p>
*
* @see org.eclipse.jface.resource.StringConverter
* @see org.eclipse.jface.preference.PreferenceConverter
*/
- public final static String EDITOR_MATCHING_BRACKETS_COLOR= "matchingBracketsColor"; //$NON-NLS-1$
-
+ public final static String EDITOR_MATCHING_BRACKETS_COLOR = "matchingBracketsColor"; //$NON-NLS-1$
+
/**
- * A named preference that controls if the Ruby code assist gets auto activated.
+ * A named preference that controls if the Ruby code assist gets auto
+ * activated.
* <p>
* Value is of type <code>Boolean</code>.
* </p>
*/
- public final static String CODEASSIST_AUTOACTIVATION= "content_assist_autoactivation"; //$NON-NLS-1$
+ public final static String CODEASSIST_AUTOACTIVATION = "content_assist_autoactivation"; //$NON-NLS-1$
/**
- * A name preference that holds the auto activation delay time in milliseconds.
+ * A name preference that holds the auto activation delay time in
+ * milliseconds.
* <p>
* Value is of type <code>Integer</code>.
* </p>
*/
- public final static String CODEASSIST_AUTOACTIVATION_DELAY= "content_assist_autoactivation_delay"; //$NON-NLS-1$
+ public final static String CODEASSIST_AUTOACTIVATION_DELAY = "content_assist_autoactivation_delay"; //$NON-NLS-1$
/**
* A named preference that controls if the Java code assist inserts a
@@ -338,28 +398,30 @@
* <p>
* Value is of type <code>Boolean</code>.
* </p>
+ *
* @since 2.1
*/
- public final static String CODEASSIST_AUTOINSERT= "content_assist_autoinsert"; //$NON-NLS-1$
-
+ public final static String CODEASSIST_AUTOINSERT = "content_assist_autoinsert"; //$NON-NLS-1$
+
/**
* A named preference that controls if the Java code assist only inserts
* completions. If set to false the proposals can also _replace_ code.
* <p>
* Value is of type <code>Boolean</code>.
* </p>
+ *
* @since 2.1
*/
- public final static String CODEASSIST_INSERT_COMPLETION= "content_assist_insert_completion"; //$NON-NLS-1$
+ public final static String CODEASSIST_INSERT_COMPLETION = "content_assist_insert_completion"; //$NON-NLS-1$
/**
- * A named preference that controls if argument names are filled in when a method is selected from as list
- * of code assist proposal.
+ * A named preference that controls if argument names are filled in when a
+ * method is selected from as list of code assist proposal.
* <p>
* Value is of type <code>Boolean</code>.
* </p>
*/
- public final static String CODEASSIST_FILL_ARGUMENT_NAMES= "content_assist_fill_method_arguments"; //$NON-NLS-1$
+ public final static String CODEASSIST_FILL_ARGUMENT_NAMES = "content_assist_fill_method_arguments"; //$NON-NLS-1$
/**
* A named preference that controls if method arguments are guessed when a
@@ -367,85 +429,90 @@
* <p>
* Value is of type <code>Boolean</code>.
* </p>
+ *
* @since 2.1
*/
- public final static String CODEASSIST_GUESS_METHOD_ARGUMENTS= "content_assist_guess_method_arguments"; //$NON-NLS-1$
+ public final static String CODEASSIST_GUESS_METHOD_ARGUMENTS = "content_assist_guess_method_arguments"; //$NON-NLS-1$
/**
- * A named preference that holds the background color used in the code assist selection dialog.
+ * A named preference that holds the background color used in the code
+ * assist selection dialog.
* <p>
- * Value is of type <code>String</code>. A RGB color value encoded as a string
- * using class <code>PreferenceConverter</code>
+ * Value is of type <code>String</code>. A RGB color value encoded as a
+ * string using class <code>PreferenceConverter</code>
* </p>
*
* @see org.eclipse.jface.resource.StringConverter
* @see org.eclipse.jface.preference.PreferenceConverter
*/
- public final static String CODEASSIST_PROPOSALS_BACKGROUND= "content_assist_proposals_background"; //$NON-NLS-1$
+ public final static String CODEASSIST_PROPOSALS_BACKGROUND = "content_assist_proposals_background"; //$NON-NLS-1$
/**
- * A named preference that holds the foreground color used in the code assist selection dialog.
+ * A named preference that holds the foreground color used in the code
+ * assist selection dialog.
* <p>
- * Value is of type <code>String</code>. A RGB color value encoded as a string
- * using class <code>PreferenceConverter</code>
+ * Value is of type <code>String</code>. A RGB color value encoded as a
+ * string using class <code>PreferenceConverter</code>
* </p>
*
* @see org.eclipse.jface.resource.StringConverter
* @see org.eclipse.jface.preference.PreferenceConverter
*/
- public final static String CODEASSIST_PROPOSALS_FOREGROUND= "content_assist_proposals_foreground"; //$NON-NLS-1$
-
+ public final static String CODEASSIST_PROPOSALS_FOREGROUND = "content_assist_proposals_foreground"; //$NON-NLS-1$
+
/**
- * A named preference that holds the background color used for parameter hints.
+ * A named preference that holds the background color used for parameter
+ * hints.
* <p>
- * Value is of type <code>String</code>. A RGB color value encoded as a string
- * using class <code>PreferenceConverter</code>
+ * Value is of type <code>String</code>. A RGB color value encoded as a
+ * string using class <code>PreferenceConverter</code>
* </p>
*
* @see org.eclipse.jface.resource.StringConverter
* @see org.eclipse.jface.preference.PreferenceConverter
*/
- public final static String CODEASSIST_PARAMETERS_BACKGROUND= "content_assist_parameters_background"; //$NON-NLS-1$
+ public final static String CODEASSIST_PARAMETERS_BACKGROUND = "content_assist_parameters_background"; //$NON-NLS-1$
/**
- * A named preference that holds the foreground color used in the code assist selection dialog.
+ * A named preference that holds the foreground color used in the code
+ * assist selection dialog.
* <p>
- * Value is of type <code>String</code>. A RGB color value encoded as a string
- * using class <code>PreferenceConverter</code>
+ * Value is of type <code>String</code>. A RGB color value encoded as a
+ * string using class <code>PreferenceConverter</code>
* </p>
*
* @see org.eclipse.jface.resource.StringConverter
* @see org.eclipse.jface.preference.PreferenceConverter
*/
- public final static String CODEASSIST_PARAMETERS_FOREGROUND= "content_assist_parameters_foreground"; //$NON-NLS-1$
+ public final static String CODEASSIST_PARAMETERS_FOREGROUND = "content_assist_parameters_foreground"; //$NON-NLS-1$
/**
* A named preference that holds the background color used in the code
* assist selection dialog to mark replaced code.
* <p>
- * Value is of type <code>String</code>. A RGB color value encoded as a string
- * using class <code>PreferenceConverter</code>
+ * Value is of type <code>String</code>. A RGB color value encoded as a
+ * string using class <code>PreferenceConverter</code>
* </p>
- *
+ *
* @see org.eclipse.jface.resource.StringConverter
* @see org.eclipse.jface.preference.PreferenceConverter
* @since 2.1
*/
- public final static String CODEASSIST_REPLACEMENT_BACKGROUND= "content_assist_completion_replacement_background"; //$NON-NLS-1$
+ public final static String CODEASSIST_REPLACEMENT_BACKGROUND = "content_assist_completion_replacement_background"; //$NON-NLS-1$
/**
* A named preference that holds the foreground color used in the code
* assist selection dialog to mark replaced code.
* <p>
- * Value is of type <code>String</code>. A RGB color value encoded as a string
- * using class <code>PreferenceConverter</code>
+ * Value is of type <code>String</code>. A RGB color value encoded as a
+ * string using class <code>PreferenceConverter</code>
* </p>
- *
+ *
* @see org.eclipse.jface.resource.StringConverter
* @see org.eclipse.jface.preference.PreferenceConverter
* @since 2.1
*/
- public final static String CODEASSIST_REPLACEMENT_FOREGROUND= "content_assist_completion_replacement_foreground"; //$NON-NLS-1$
+ public final static String CODEASSIST_REPLACEMENT_FOREGROUND = "content_assist_completion_replacement_foreground"; //$NON-NLS-1$
/**
* A named preference that controls if content assist inserts the common
@@ -456,27 +523,29 @@
*
* @since 3.0
*/
- public final static String CODEASSIST_PREFIX_COMPLETION= "content_assist_prefix_completion"; //$NON-NLS-1$
-
+ public final static String CODEASSIST_PREFIX_COMPLETION = "content_assist_prefix_completion"; //$NON-NLS-1$
+
/**
- * A named preference that controls whether the 'close strings' feature
- * is enabled.
+ * A named preference that controls whether the 'close strings' feature is
+ * enabled.
* <p>
* Value is of type <code>Boolean</code>.
* </p>
+ *
* @since 2.1
*/
- public final static String EDITOR_CLOSE_STRINGS= "closeStrings"; //$NON-NLS-1$
-
+ public final static String EDITOR_CLOSE_STRINGS = "closeStrings"; //$NON-NLS-1$
+
/**
* A named preference that controls whether the 'close brackets' feature is
* enabled.
* <p>
* Value is of type <code>Boolean</code>.
* </p>
+ *
* @since 2.1
*/
- public final static String EDITOR_CLOSE_BRACKETS= "closeBrackets"; //$NON-NLS-1$
+ public final static String EDITOR_CLOSE_BRACKETS = "closeBrackets"; //$NON-NLS-1$
/**
* A named preference that controls whether the 'close braces' feature is
@@ -484,31 +553,33 @@
* <p>
* Value is of type <code>Boolean</code>.
* </p>
+ *
* @since 2.1
*/
- public final static String EDITOR_CLOSE_BRACES= "closeBraces"; //$NON-NLS-1$
-
-
+ public final static String EDITOR_CLOSE_BRACES = "closeBraces"; //$NON-NLS-1$
+
/**
- * A named preference that controls whether occurrences are marked in the editor.
+ * A named preference that controls whether occurrences are marked in the
+ * editor.
* <p>
* Value is of type <code>Boolean</code>.
* </p>
- *
+ *
* @since 0.9.0
- */
- public static final String EDITOR_MARK_OCCURRENCES= "markOccurrences"; //$NON-NLS-1$
+ */
+ public static final String EDITOR_MARK_OCCURRENCES = "markOccurrences"; //$NON-NLS-1$
/**
- * A named preference that controls whether occurrences are sticky in the editor.
+ * A named preference that controls whether occurrences are sticky in the
+ * editor.
* <p>
* Value is of type <code>Boolean</code>.
* </p>
- *
+ *
* @since 0.9.0
- */
- public static final String EDITOR_STICKY_OCCURRENCES= "stickyOccurrences"; //$NON-NLS-1$
-
+ */
+ public static final String EDITOR_STICKY_OCCURRENCES = "stickyOccurrences"; //$NON-NLS-1$
+
/**
* A named preference that controls whether type occurrences are marked.
* Only valid if {@link #EDITOR_MARK_OCCURRENCES} is <code>true</code>.
@@ -518,7 +589,7 @@
*
* @since 0.9.0
*/
- public static final String EDITOR_MARK_TYPE_OCCURRENCES= "markTypeOccurrences"; //$NON-NLS-1$
+ public static final String EDITOR_MARK_TYPE_OCCURRENCES = "markTypeOccurrences"; //$NON-NLS-1$
/**
* A named preference that controls whether method occurrences are marked.
@@ -529,38 +600,41 @@
*
* @since 0.9.0
*/
- public static final String EDITOR_MARK_METHOD_OCCURRENCES= "markMethodOccurrences"; //$NON-NLS-1$
+ public static final String EDITOR_MARK_METHOD_OCCURRENCES = "markMethodOccurrences"; //$NON-NLS-1$
/**
- * A named preference that controls whether non-constant field occurrences are marked.
- * Only valid if {@link #EDITOR_MARK_OCCURRENCES} is <code>true</code>.
+ * A named preference that controls whether non-constant field occurrences
+ * are marked. Only valid if {@link #EDITOR_MARK_OCCURRENCES} is
+ * <code>true</code>.
* <p>
* Value is of type <code>Boolean</code>.
* </p>
*
* @since 0.9.0
*/
- public static final String EDITOR_MARK_FIELD_OCCURRENCES= "markFieldOccurrences"; //$NON-NLS-1$
+ public static final String EDITOR_MARK_FIELD_OCCURRENCES = "markFieldOccurrences"; //$NON-NLS-1$
/**
- * A named preference that controls whether constant (static final) occurrences are marked.
- * Only valid if {@link #EDITOR_MARK_OCCURRENCES} is <code>true</code>.
+ * A named preference that controls whether constant (static final)
+ * occurrences are marked. Only valid if {@link #EDITOR_MARK_OCCURRENCES} is
+ * <code>true</code>.
* <p>
* Value is of type <code>Boolean</code>.
* </p>
*
* @since 0.9.0
*/
- public static final String EDITOR_MARK_CONSTANT_OCCURRENCES= "markConstantOccurrences"; //$NON-NLS-1$
-
+ public static final String EDITOR_MARK_CONSTANT_OCCURRENCES = "markConstantOccurrences"; //$NON-NLS-1$
+
/**
- * A named preference that controls whether local variable occurrences are marked.
- * Only valid if {@link #EDITOR_MARK_OCCURRENCES} is <code>true</code>.
+ * A named preference that controls whether local variable occurrences are
+ * marked. Only valid if {@link #EDITOR_MARK_OCCURRENCES} is
+ * <code>true</code>.
* <p>
* Value is of type <code>Boolean</code>.
* </p>
*
* @since 0.9.0
*/
- public static final String EDITOR_MARK_LOCAL_VARIABLE_OCCURRENCES= "markLocalVariableOccurrences"; //$NON-NLS-1$
+ public static final String EDITOR_MARK_LOCAL_VARIABLE_OCCURRENCES = "markLocalVariableOccurrences"; //$NON-NLS-1$
/**
* A named preference that controls whether method exit points are marked.
@@ -571,56 +645,111 @@
*
* @since 0.9.0
*/
- public static final String EDITOR_MARK_METHOD_EXIT_POINTS= "markMethodExitPoints"; //$NON-NLS-1$
+ public static final String EDITOR_MARK_METHOD_EXIT_POINTS = "markMethodExitPoints"; //$NON-NLS-1$
+
- public static void initializeDefaultValues(IPreferenceStore store) {
- store.setDefault(PreferenceConstants.EDITOR_SHOW_SEGMENTS, false);
-
- // FIXME We can't enabling using code formatter yet, because it breaks on formatting templates (when inserting via content assist)
- // FIXME Uncomment when we have an AST based formatter which spits out TextEdits (rather than one huge replace)
- //store.setDefault(PreferenceConstants.TEMPLATES_USE_CODEFORMATTER, true);
-
- store.setDefault(PreferenceConstants.FORMATTER_PROFILE, ProfileManager.DEFAULT_PROFILE);
-
- store.setDefault(PreferenceConstants.LINK_BROWSING_PROJECTS_TO_EDITOR, true);
+ private static String getDefaultRubyVMLibraries() {
+ StringBuffer buf= new StringBuffer();
+ ILoadpathEntry cntentry= getRubyVMContainerEntry();
+ buf.append(encodeRubyVMLibrary(PreferencesMessages.NewJavaProjectPreferencePage_jre_container_description, new ILoadpathEntry[] { cntentry} ));
+ buf.append(';');
+ ILoadpathEntry varentry= getRubyVMVariableEntry();
+ buf.append(encodeRubyVMLibrary(PreferencesMessages.NewJavaProjectPreferencePage_jre_variable_description, new ILoadpathEntry[] { varentry }));
+ buf.append(';');
+ return buf.toString();
+ }
+
+ private static ILoadpathEntry getRubyVMVariableEntry() {
+ // FIXME We need to define more library variables! RUBY_CORE, RUBY_STD_LIB, RUBY_SITE_LIB
+ return RubyCore.newVariableEntry(new Path("RUBY_LIB")); //$NON-NLS-1$
+ }
+
+ public static String encodeRubyVMLibrary(String desc, ILoadpathEntry[] cpentries) {
+ StringBuffer buf= new StringBuffer();
+ for (int i= 0; i < cpentries.length; i++) {
+ ILoadpathEntry entry= cpentries[i];
+ buf.append(encode(desc));
+ buf.append(' ');
+ buf.append(entry.getEntryKind());
+ buf.append(' ');
+ buf.append(encodePath(entry.getPath()));
+ buf.append(' ');
+ buf.append(entry.isExported());
+ buf.append(' ');
+ }
+ return buf.toString();
+ }
+
+ private static String encodePath(IPath path) {
+ if (path == null) {
+ return "#"; //$NON-NLS-1$
+ } else if (path.isEmpty()) {
+ return "&"; //$NON-NLS-1$
+ } else {
+ return encode(path.toPortableString());
+ }
+ }
+
+ private static String encode(String str) {
+ try {
+ return URLEncoder.encode(str, fgDefaultEncoding);
+ } catch (UnsupportedEncodingException e) {
+ RubyPlugin.log(e);
+ }
+ return ""; //$NON-NLS-1$
+ }
+
+ public static void initializeDefaultValues(IPreferenceStore store) {
+ store.setDefault(LOADPATH_RUBYVMLIBRARY_LIST, getDefaultRubyVMLibraries());
+ store.setDefault(LOADPATH_RUBYVMLIBRARY_INDEX, 0);
+
+ store.setDefault(PreferenceConstants.EDITOR_SHOW_SEGMENTS, false);
+
+ // FIXME We can't enabling using code formatter yet, because it breaks
+ // on formatting templates (when inserting via content assist)
+ // FIXME Uncomment when we have an AST based formatter which spits out
+ // TextEdits (rather than one huge replace)
+ // store.setDefault(PreferenceConstants.TEMPLATES_USE_CODEFORMATTER,
+ // true);
+
+ store.setDefault(PreferenceConstants.FORMATTER_PROFILE, ProfileManager.DEFAULT_PROFILE);
+
+ store.setDefault(PreferenceConstants.LINK_BROWSING_PROJECTS_TO_EDITOR, true);
store.setDefault(PreferenceConstants.LINK_BROWSING_TYPES_TO_EDITOR, true);
store.setDefault(PreferenceConstants.LINK_BROWSING_MEMBERS_TO_EDITOR, true);
- // MembersOrderPreferencePage
- store.setDefault(PreferenceConstants.APPEARANCE_MEMBER_SORT_ORDER, "T,SF,SM,F,C,M"); //$NON-NLS-1$
- store.setDefault(PreferenceConstants.APPEARANCE_VISIBILITY_SORT_ORDER, "B,V,R"); //$NON-NLS-1$
- store.setDefault(PreferenceConstants.APPEARANCE_ENABLE_VISIBILITY_SORT_ORDER, false);
+ // MembersOrderPreferencePage
+ store.setDefault(PreferenceConstants.APPEARANCE_MEMBER_SORT_ORDER, "T,SF,SM,F,C,M"); //$NON-NLS-1$
+ store.setDefault(PreferenceConstants.APPEARANCE_VISIBILITY_SORT_ORDER, "B,V,R"); //$NON-NLS-1$
+ store.setDefault(PreferenceConstants.APPEARANCE_ENABLE_VISIBILITY_SORT_ORDER, false);
- // AppearancePreferencePage
- store.setDefault(PreferenceConstants.APPEARANCE_COMPRESS_PACKAGE_NAMES, false);
- store.setDefault(PreferenceConstants.APPEARANCE_PKG_NAME_PATTERN_FOR_PKG_VIEW, ""); //$NON-NLS-1$
- store.setDefault(PreferenceConstants.BROWSING_STACK_VERTICALLY, false);
+ // AppearancePreferencePage
+ store.setDefault(PreferenceConstants.APPEARANCE_COMPRESS_PACKAGE_NAMES, false);
+ store.setDefault(PreferenceConstants.APPEARANCE_PKG_NAME_PATTERN_FOR_PKG_VIEW, ""); //$NON-NLS-1$
+ store.setDefault(PreferenceConstants.BROWSING_STACK_VERTICALLY, false);
- store.setDefault(PreferenceConstants.EDITOR_CORRECTION_INDICATION, true);
- store.setDefault(PreferenceConstants.EDITOR_EVALUTE_TEMPORARY_PROBLEMS, true);
+ store.setDefault(PreferenceConstants.EDITOR_CORRECTION_INDICATION, true);
+ store.setDefault(PreferenceConstants.EDITOR_EVALUTE_TEMPORARY_PROBLEMS, true);
- // folding
- store.setDefault(PreferenceConstants.EDITOR_FOLDING_ENABLED, true);
- store.setDefault(PreferenceConstants.EDITOR_FOLDING_PROVIDER,
- "org.rubypeople.rdt.ui.text.defaultFoldingProvider"); //$NON-NLS-1$
- store.setDefault(PreferenceConstants.EDITOR_FOLDING_RDOC, false);
- store.setDefault(PreferenceConstants.EDITOR_FOLDING_INNERTYPES, true);
- store.setDefault(PreferenceConstants.EDITOR_FOLDING_METHODS, false);
+ // folding
+ store.setDefault(PreferenceConstants.EDITOR_FOLDING_ENABLED, true);
+ store.setDefault(PreferenceConstants.EDITOR_FOLDING_PROVIDER, "org.rubypeople.rdt.ui.text.defaultFoldingProvider"); //$NON-NLS-1$
+ store.setDefault(PreferenceConstants.EDITOR_FOLDING_RDOC, false);
+ store.setDefault(PreferenceConstants.EDITOR_FOLDING_INNERTYPES, true);
+ store.setDefault(PreferenceConstants.EDITOR_FOLDING_METHODS, false);
- store.setDefault(PreferenceConstants.EDITOR_SHOW_TEXT_HOVER_AFFORDANCE, true);
+ store.setDefault(PreferenceConstants.EDITOR_SHOW_TEXT_HOVER_AFFORDANCE, true);
- store.setDefault(PreferenceConstants.RDOC_PATH, PreferenceConstants
- .getDefaultPath(PreferenceConstants.DEFAULT_RDOC_CMD));
- store.setDefault(PreferenceConstants.RI_PATH, PreferenceConstants
- .getDefaultPath(PreferenceConstants.DEFAULT_RI_CMD));
-
- store.setDefault(PreferenceConstants.DEBUGGER_USE_RUBY_DEBUG, false) ;
+ store.setDefault(PreferenceConstants.RDOC_PATH, PreferenceConstants.getDefaultPath(PreferenceConstants.DEFAULT_RDOC_CMD));
+ store.setDefault(PreferenceConstants.RI_PATH, PreferenceConstants.getDefaultPath(PreferenceConstants.DEFAULT_RI_CMD));
- store.setDefault(PreferenceConstants.EDITOR_SYNC_OUTLINE_ON_CURSOR_MOVE, true);
-
+ store.setDefault(PreferenceConstants.DEBUGGER_USE_RUBY_DEBUG, false);
+
+ store.setDefault(PreferenceConstants.EDITOR_SYNC_OUTLINE_ON_CURSOR_MOVE, true);
+
// RubyEditorPreferencePage
store.setDefault(PreferenceConstants.EDITOR_MATCHING_BRACKETS, true);
- PreferenceConverter.setDefault(store, PreferenceConstants.EDITOR_MATCHING_BRACKETS_COLOR, new RGB(192, 192,192));
+ PreferenceConverter.setDefault(store, PreferenceConstants.EDITOR_MATCHING_BRACKETS_COLOR, new RGB(192, 192, 192));
store.setDefault(PreferenceConstants.CODEASSIST_AUTOACTIVATION, true);
store.setDefault(PreferenceConstants.CODEASSIST_AUTOACTIVATION_DELAY, 200);
@@ -640,7 +769,7 @@
store.setDefault(PreferenceConstants.EDITOR_CLOSE_STRINGS, true);
store.setDefault(PreferenceConstants.EDITOR_CLOSE_BRACKETS, true);
store.setDefault(PreferenceConstants.EDITOR_CLOSE_BRACES, true);
-
+
// mark occurrences
store.setDefault(PreferenceConstants.EDITOR_MARK_OCCURRENCES, true);
store.setDefault(PreferenceConstants.EDITOR_STICKY_OCCURRENCES, true);
@@ -650,22 +779,105 @@
store.setDefault(PreferenceConstants.EDITOR_MARK_FIELD_OCCURRENCES, true);
store.setDefault(PreferenceConstants.EDITOR_MARK_LOCAL_VARIABLE_OCCURRENCES, true);
store.setDefault(PreferenceConstants.EDITOR_MARK_METHOD_EXIT_POINTS, true);
- }
+ }
- private static String getDefaultPath(String programName) {
- IVMInstall interpreter = RubyRuntime.getDefault().getDefaultVMInstall();
- if (interpreter == null) { return programName; }
- File path = interpreter.getInstallLocation();
- return path.getParent() + File.separator + programName;
- }
+ private static String getDefaultPath(String programName) {
+ IVMInstall interpreter = RubyRuntime.getDefault().getDefaultVMInstall();
+ if (interpreter == null) {
+ return programName;
+ }
+ File path = interpreter.getInstallLocation();
+ return path.getParent() + File.separator + programName;
+ }
- /**
- * Returns the RDT-UI preference store.
- *
- * @return the RDT-UI preference store
- */
- public static IPreferenceStore getPreferenceStore() {
- return RubyPlugin.getDefault().getPreferenceStore();
- }
+ /**
+ * Returns the RDT-UI preference store.
+ *
+ * @return the RDT-UI preference store
+ */
+ public static IPreferenceStore getPreferenceStore() {
+ return RubyPlugin.getDefault().getPreferenceStore();
+ }
+ public static ILoadpathEntry[] getDefaultRubyVMLibrary() {
+ IPreferenceStore store = RubyPlugin.getDefault().getPreferenceStore();
+
+ String str = store.getString(LOADPATH_RUBYVMLIBRARY_LIST);
+ int index = store.getInt(LOADPATH_RUBYVMLIBRARY_INDEX);
+
+ StringTokenizer tok = new StringTokenizer(str, ";"); //$NON-NLS-1$
+ while (tok.hasMoreTokens() && index > 0) {
+ tok.nextToken();
+ index--;
+ }
+
+ if (tok.hasMoreTokens()) {
+ ILoadpathEntry[] res = decodeRubyVMLibraryLoadpathEntries(tok.nextToken());
+ if (res.length > 0) {
+ return res;
+ }
+ }
+ return new ILoadpathEntry[] { getRubyVMContainerEntry() };
+ }
+
+ private static ILoadpathEntry getRubyVMContainerEntry() {
+ return RubyCore.newContainerEntry(new Path("org.rubypeople.rdt.launching.RUBY_CONTAINER")); //$NON-NLS-1$
+ }
+
+ public static ILoadpathEntry[] decodeRubyVMLibraryLoadpathEntries(String encoded) {
+ StringTokenizer tok= new StringTokenizer(encoded, " "); //$NON-NLS-1$
+ ArrayList res= new ArrayList();
+ while (tok.hasMoreTokens()) {
+ try {
+ tok.nextToken(); // desc: ignore
+ int kind= Integer.parseInt(tok.nextToken());
+ IPath path= decodePath(tok.nextToken());
+ boolean isExported= Boolean.valueOf(tok.nextToken()).booleanValue();
+ switch (kind) {
+ case ILoadpathEntry.CPE_SOURCE:
+ res.add(RubyCore.newSourceEntry(path));
+ break;
+ case ILoadpathEntry.CPE_LIBRARY:
+ res.add(RubyCore.newLibraryEntry(path, isExported));
+ break;
+ case ILoadpathEntry.CPE_VARIABLE:
+ res.add(RubyCore.newVariableEntry(path, isExported));
+ break;
+ case ILoadpathEntry.CPE_PROJECT:
+ res.add(RubyCore.newProjectEntry(path, isExported));
+ break;
+ case ILoadpathEntry.CPE_CONTAINER:
+ res.add(RubyCore.newContainerEntry(path, isExported));
+ break;
+ }
+ } catch (NumberFormatException e) {
+ String message= PreferencesMessages.NewJavaProjectPreferencePage_error_decode;
+ RubyPlugin.log(new Status(IStatus.ERROR, RubyUI.ID_PLUGIN, IStatus.ERROR, message, e));
+ } catch (NoSuchElementException e) {
+ String message= PreferencesMessages.NewJavaProjectPreferencePage_error_decode;
+ RubyPlugin.log(new Status(IStatus.ERROR, RubyUI.ID_PLUGIN, IStatus.ERROR, message, e));
+ }
+ }
+ return (ILoadpathEntry[]) res.toArray(new ILoadpathEntry[res.size()]);
+ }
+
+ private static IPath decodePath(String str) {
+ if ("#".equals(str)) { //$NON-NLS-1$
+ return null;
+ } else if ("&".equals(str)) { //$NON-NLS-1$
+ return Path.EMPTY;
+ } else {
+ return Path.fromPortableString(decode(str));
+ }
+ }
+
+ private static String decode(String str) {
+ try {
+ return URLDecoder.decode(str, fgDefaultEncoding);
+ } catch (UnsupportedEncodingException e) {
+ RubyPlugin.log(e);
+ }
+ return ""; //$NON-NLS-1$
+ }
+
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-01-23 14:25:33
|
Revision: 1857
http://svn.sourceforge.net/rubyeclipse/?rev=1857&view=rev
Author: cawilliams
Date: 2007-01-23 06:25:31 -0800 (Tue, 23 Jan 2007)
Log Message:
-----------
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/CompletionEngine.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/ExternalSourceFolderRoot.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyProject.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/SourceFolder.java
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/CompletionEngine.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/CompletionEngine.java 2007-01-23 13:50:42 UTC (rev 1856)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/CompletionEngine.java 2007-01-23 14:25:31 UTC (rev 1857)
@@ -91,7 +91,7 @@
// If the prefix looks like a constant don't bother searching for
// methods
- if (!(this.prefix != null && Character.isUpperCase(this.prefix
+ if (!(this.prefix != null && this.prefix.length() > 0 && Character.isUpperCase(this.prefix
.charAt(0)))) {
List<ITypeGuess> guesses = inferrer
.infer(source.toString(), offset);
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/ExternalSourceFolderRoot.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/ExternalSourceFolderRoot.java 2007-01-23 13:50:42 UTC (rev 1856)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/ExternalSourceFolderRoot.java 2007-01-23 14:25:31 UTC (rev 1857)
@@ -1,10 +1,22 @@
package org.rubypeople.rdt.internal.core;
+import java.util.ArrayList;
+import java.util.Map;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.runtime.IPath;
+import org.rubypeople.rdt.core.IRubyElement;
import org.rubypeople.rdt.core.ISourceFolderRoot;
+import org.rubypeople.rdt.core.RubyCore;
+import org.rubypeople.rdt.core.RubyModelException;
+import org.rubypeople.rdt.internal.core.util.CharOperation;
public class ExternalSourceFolderRoot extends SourceFolderRoot implements
ISourceFolderRoot {
+
+ public final static ArrayList EMPTY_LIST = new ArrayList();
protected final IPath folderPath;
@@ -48,4 +60,26 @@
}
return false;
}
+
+ @Override
+ protected boolean computeChildren(OpenableElementInfo info, Map newElements) throws RubyModelException {
+ try {
+ // the underlying resource may be a folder or a project (in the case that the project folder
+ // is actually the source folder root)
+ IWorkspaceRoot workspaceRoot = RubyCore.getWorkspace().getRoot();
+ IContainer rootFolder = workspaceRoot.getContainerForLocation(folderPath.makeAbsolute());
+ if (rootFolder.getType() == IResource.FOLDER || rootFolder.getType() == IResource.PROJECT) {
+ ArrayList vChildren = new ArrayList(5);
+ computeFolderChildren(rootFolder, CharOperation.NO_STRINGS, vChildren);
+ IRubyElement[] children = new IRubyElement[vChildren.size()];
+ vChildren.toArray(children);
+ info.setChildren(children);
+ }
+ } catch (RubyModelException e) {
+ //problem resolving children; structure remains unknown
+ info.setChildren(new IRubyElement[]{});
+ throw e;
+ }
+ return true;
+ }
}
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyProject.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyProject.java 2007-01-23 13:50:42 UTC (rev 1856)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyProject.java 2007-01-23 14:25:31 UTC (rev 1857)
@@ -69,14 +69,14 @@
public class RubyProject extends Openable implements IProjectNature, IRubyElement, IRubyProject {
- protected IProject project;
- protected boolean scratched;
-
- /**
- * Name of file containing custom project preferences
- */
- private static final String PREF_FILENAME = ".rprefs"; //$NON-NLS-1$
-
+ protected IProject project;
+ protected boolean scratched;
+
+ /**
+ * Name of file containing custom project preferences
+ */
+ private static final String PREF_FILENAME = ".rprefs"; //$NON-NLS-1$
+
/*
* Value of project's resolved loadpath while it is being resolved
*/
@@ -90,316 +90,338 @@
protected static final boolean IS_CASE_SENSITIVE = !new File("Temp").equals(new File("temp")); //$NON-NLS-1$ //$NON-NLS-2$
/**
- * An empty array of strings indicating that a project doesn't have any prerequesite projects.
+ * An empty array of strings indicating that a project doesn't have any
+ * prerequesite projects.
*/
protected static final String[] NO_PREREQUISITES = new String[0];
- /*
- * Value of project's resolved loadpath while it is being resolved
- */
+ /*
+ * Value of project's resolved loadpath while it is being resolved
+ */
- public RubyProject() {
- super(null);
- }
+ public RubyProject() {
+ super(null);
+ }
- /**
- * @param aProject
- */
- public RubyProject(IProject aProject, RubyElement parent) {
- super(parent);
- setProject(aProject);
- }
+ /**
+ * @param aProject
+ */
+ public RubyProject(IProject aProject, RubyElement parent) {
+ super(parent);
+ setProject(aProject);
+ }
- /**
- * Configure the project with Ruby nature.
- */
- public void configure() throws CoreException {
- // register Ruby builder
- addToBuildSpec(RubyCore.BUILDER_ID);
- }
+ /**
+ * Configure the project with Ruby nature.
+ */
+ public void configure() throws CoreException {
+ // register Ruby builder
+ addToBuildSpec(RubyCore.BUILDER_ID);
+ }
- public boolean upgrade() throws CoreException {
- return addToBuildSpec(RubyCore.BUILDER_ID);
- }
-
- /**
- * Adds a builder to the build spec for the given project.
- */
- protected boolean addToBuildSpec(String builderID) throws CoreException {
+ public boolean upgrade() throws CoreException {
+ return addToBuildSpec(RubyCore.BUILDER_ID);
+ }
- IProjectDescription description = this.project.getDescription();
- int commandIndex = getRubyCommandIndex(description.getBuildSpec());
+ /**
+ * Adds a builder to the build spec for the given project.
+ */
+ protected boolean addToBuildSpec(String builderID) throws CoreException {
- if (commandIndex == -1) {
+ IProjectDescription description = this.project.getDescription();
+ int commandIndex = getRubyCommandIndex(description.getBuildSpec());
- // Add a Ruby command to the build spec
- ICommand command = description.newCommand();
- command.setBuilderName(builderID);
- setRubyCommand(description, command);
- return true;
- }
- return false;
- }
+ if (commandIndex == -1) {
- /**
- * Find the specific Ruby command amongst the given build spec and return
- * its index or -1 if not found.
- */
- private int getRubyCommandIndex(ICommand[] buildSpec) {
+ // Add a Ruby command to the build spec
+ ICommand command = description.newCommand();
+ command.setBuilderName(builderID);
+ setRubyCommand(description, command);
+ return true;
+ }
+ return false;
+ }
- for (int i = 0; i < buildSpec.length; ++i) {
- if (buildSpec[i].getBuilderName().equals(RubyCore.BUILDER_ID)) { return i; }
- }
- return -1;
- }
+ /**
+ * Find the specific Ruby command amongst the given build spec and return
+ * its index or -1 if not found.
+ */
+ private int getRubyCommandIndex(ICommand[] buildSpec) {
- /**
- * Update the Ruby command in the build spec (replace existing one if
- * present, add one first if none).
- */
- private void setRubyCommand(IProjectDescription description, ICommand newCommand)
- throws CoreException {
+ for (int i = 0; i < buildSpec.length; ++i) {
+ if (buildSpec[i].getBuilderName().equals(RubyCore.BUILDER_ID)) {
+ return i;
+ }
+ }
+ return -1;
+ }
- ICommand[] oldBuildSpec = description.getBuildSpec();
- int oldRubyCommandIndex = getRubyCommandIndex(oldBuildSpec);
- ICommand[] newCommands;
+ /**
+ * Update the Ruby command in the build spec (replace existing one if
+ * present, add one first if none).
+ */
+ private void setRubyCommand(IProjectDescription description, ICommand newCommand) throws CoreException {
- if (oldRubyCommandIndex == -1) {
- // Add a Ruby build spec before other builders (1FWJK7I)
- newCommands = new ICommand[oldBuildSpec.length + 1];
- System.arraycopy(oldBuildSpec, 0, newCommands, 1, oldBuildSpec.length);
- newCommands[0] = newCommand;
- } else {
- oldBuildSpec[oldRubyCommandIndex] = newCommand;
- newCommands = oldBuildSpec;
- }
+ ICommand[] oldBuildSpec = description.getBuildSpec();
+ int oldRubyCommandIndex = getRubyCommandIndex(oldBuildSpec);
+ ICommand[] newCommands;
- // Commit the spec change into the project
- description.setBuildSpec(newCommands);
- this.project.setDescription(description, null);
- }
+ if (oldRubyCommandIndex == -1) {
+ // Add a Ruby build spec before other builders (1FWJK7I)
+ newCommands = new ICommand[oldBuildSpec.length + 1];
+ System.arraycopy(oldBuildSpec, 0, newCommands, 1, oldBuildSpec.length);
+ newCommands[0] = newCommand;
+ } else {
+ oldBuildSpec[oldRubyCommandIndex] = newCommand;
+ newCommands = oldBuildSpec;
+ }
- /**
- * /** Removes the Java nature from the project.
- */
- public void deconfigure() throws CoreException {
+ // Commit the spec change into the project
+ description.setBuildSpec(newCommands);
+ this.project.setDescription(description, null);
+ }
- // deregister Ruby builder
- removeFromBuildSpec(RubyCore.BUILDER_ID);
- }
+ /**
+ * /** Removes the Java nature from the project.
+ */
+ public void deconfigure() throws CoreException {
- /**
- * Removes the given builder from the build spec for the given project.
- */
- protected void removeFromBuildSpec(String builderID) throws CoreException {
+ // deregister Ruby builder
+ removeFromBuildSpec(RubyCore.BUILDER_ID);
+ }
- IProjectDescription description = this.project.getDescription();
- ICommand[] commands = description.getBuildSpec();
- for (int i = 0; i < commands.length; ++i) {
- if (commands[i].getBuilderName().equals(builderID)) {
- ICommand[] newCommands = new ICommand[commands.length - 1];
- System.arraycopy(commands, 0, newCommands, 0, i);
- System.arraycopy(commands, i + 1, newCommands, i, commands.length - i - 1);
- description.setBuildSpec(newCommands);
- this.project.setDescription(description, null);
- return;
- }
- }
- }
+ /**
+ * Removes the given builder from the build spec for the given project.
+ */
+ protected void removeFromBuildSpec(String builderID) throws CoreException {
- /**
- * Returns true if this handle represents the same Ruby project as the given
- * handle. Two handles represent the same project if they are identical or
- * if they represent a project with the same underlying resource and
- * occurrence counts.
- *
- * @see RubyElement#equals(Object)
- */
- public boolean equals(Object o) {
+ IProjectDescription description = this.project.getDescription();
+ ICommand[] commands = description.getBuildSpec();
+ for (int i = 0; i < commands.length; ++i) {
+ if (commands[i].getBuilderName().equals(builderID)) {
+ ICommand[] newCommands = new ICommand[commands.length - 1];
+ System.arraycopy(commands, 0, newCommands, 0, i);
+ System.arraycopy(commands, i + 1, newCommands, i, commands.length - i - 1);
+ description.setBuildSpec(newCommands);
+ this.project.setDescription(description, null);
+ return;
+ }
+ }
+ }
- if (this == o) return true;
+ /**
+ * Returns true if this handle represents the same Ruby project as the given
+ * handle. Two handles represent the same project if they are identical or
+ * if they represent a project with the same underlying resource and
+ * occurrence counts.
+ *
+ * @see RubyElement#equals(Object)
+ */
+ public boolean equals(Object o) {
- if (!(o instanceof RubyProject)) return false;
+ if (this == o)
+ return true;
- RubyProject other = (RubyProject) o;
- return this.project.equals(other.getProject());
- }
-
- public int hashCode() {
- if ( this.project == null )
- {
- return super.hashCode() * 10 + 1;
- }
- return this.project.hashCode() * 10 + 2;
- }
+ if (!(o instanceof RubyProject))
+ return false;
- public boolean exists() {
- return hasRubyNature(this.project);
- }
+ RubyProject other = (RubyProject) o;
+ return this.project.equals(other.getProject());
+ }
- public RubyModelManager.PerProjectInfo getPerProjectInfo() throws RubyModelException {
- return RubyModelManager.getRubyModelManager().getPerProjectInfoCheckExistence(this.project);
- }
+ public int hashCode() {
+ if (this.project == null) {
+ return super.hashCode() * 10 + 1;
+ }
+ return this.project.hashCode() * 10 + 2;
+ }
- private IPath getPluginWorkingLocation() {
- return this.project.getWorkingLocation(RubyCore.PLUGIN_ID);
- }
-
- public IProject getProject() {
- return project;
- }
+ public boolean exists() {
+ return hasRubyNature(this.project);
+ }
- /**
- * @see IRubyElement
- */
- public IPath getPath() {
- return this.project.getFullPath();
- }
+ public RubyModelManager.PerProjectInfo getPerProjectInfo() throws RubyModelException {
+ return RubyModelManager.getRubyModelManager().getPerProjectInfoCheckExistence(this.project);
+ }
- protected IProject getProject(String name) {
- return RubyCore.getWorkspace().getRoot().getProject(name);
- }
+ private IPath getPluginWorkingLocation() {
+ return this.project.getWorkingLocation(RubyCore.PLUGIN_ID);
+ }
- public void setProject(IProject aProject) {
- project = aProject;
- }
+ public IProject getProject() {
+ return project;
+ }
- public IResource getResource() {
- return this.project;
- }
+ /**
+ * @see IRubyElement
+ */
+ public IPath getPath() {
+ return this.project.getFullPath();
+ }
- public String[] getRequiredProjectNames() throws RubyModelException {
- return this.projectPrerequisites(getResolvedLoadpath(true/*ignoreUnresolvedEntry*/, false/*don't generateMarkerOnError*/, false/*don't returnResolutionInProgress*/));
- }
-
+ protected IProject getProject(String name) {
+ return RubyCore.getWorkspace().getRoot().getProject(name);
+ }
+
+ public void setProject(IProject aProject) {
+ project = aProject;
+ }
+
+ public IResource getResource() {
+ return this.project;
+ }
+
+ public String[] getRequiredProjectNames() throws RubyModelException {
+ return this.projectPrerequisites(getResolvedLoadpath(true/* ignoreUnresolvedEntry */, false/*
+ * don't
+ * generateMarkerOnError
+ */, false/*
+ * don't
+ * returnResolutionInProgress
+ */));
+ }
+
public String[] projectPrerequisites(ILoadpathEntry[] entries) throws RubyModelException {
-
- ArrayList prerequisites = new ArrayList();
- // need resolution
- entries = getResolvedLoadpath(entries, null, true, false, null/*no reverse map*/);
- for (int i = 0, length = entries.length; i < length; i++) {
- ILoadpathEntry entry = entries[i];
- if (entry.getEntryKind() == ILoadpathEntry.CPE_PROJECT) {
- prerequisites.add(entry.getPath().lastSegment());
+
+ ArrayList prerequisites = new ArrayList();
+ // need resolution
+ entries = getResolvedLoadpath(entries, null, true, false, null/*
+ * no
+ * reverse
+ * map
+ */);
+ for (int i = 0, length = entries.length; i < length; i++) {
+ ILoadpathEntry entry = entries[i];
+ if (entry.getEntryKind() == ILoadpathEntry.CPE_PROJECT) {
+ prerequisites.add(entry.getPath().lastSegment());
+ }
}
+ int size = prerequisites.size();
+ if (size == 0) {
+ return NO_PREREQUISITES;
+ } else {
+ String[] result = new String[size];
+ prerequisites.toArray(result);
+ return result;
+ }
}
- int size = prerequisites.size();
- if (size == 0) {
- return NO_PREREQUISITES;
- } else {
- String[] result = new String[size];
- prerequisites.toArray(result);
- return result;
+
+ /**
+ * @see IRubyElement
+ */
+ public IResource getUnderlyingResource() throws RubyModelException {
+ if (!exists())
+ throw newNotPresentException();
+ return this.project;
}
-}
- /**
- * @see IRubyElement
- */
- public IResource getUnderlyingResource() throws RubyModelException {
- if (!exists()) throw newNotPresentException();
- return this.project;
- }
+ /**
+ * Returns the project custom preference pool. Project preferences may
+ * include custom encoding.
+ *
+ * @return IEclipsePreferences
+ */
+ public IEclipsePreferences getEclipsePreferences() {
+ if (!RubyProject.hasRubyNature(this.project))
+ return null;
+ // Get cached preferences if exist
+ RubyModelManager.PerProjectInfo perProjectInfo = RubyModelManager.getRubyModelManager().getPerProjectInfo(this.project, true);
+ if (perProjectInfo.preferences != null)
+ return perProjectInfo.preferences;
+ // Init project preferences
+ IScopeContext context = new ProjectScope(getProject());
+ final IEclipsePreferences eclipsePreferences = context.getNode(RubyCore.PLUGIN_ID);
+ updatePreferences(eclipsePreferences);
+ perProjectInfo.preferences = eclipsePreferences;
- /**
- * Returns the project custom preference pool.
- * Project preferences may include custom encoding.
- * @return IEclipsePreferences
- */
- public IEclipsePreferences getEclipsePreferences(){
- if (!RubyProject.hasRubyNature(this.project)) return null;
- // Get cached preferences if exist
- RubyModelManager.PerProjectInfo perProjectInfo = RubyModelManager.getRubyModelManager().getPerProjectInfo(this.project, true);
- if (perProjectInfo.preferences != null) return perProjectInfo.preferences;
- // Init project preferences
- IScopeContext context = new ProjectScope(getProject());
- final IEclipsePreferences eclipsePreferences = context.getNode(RubyCore.PLUGIN_ID);
- updatePreferences(eclipsePreferences);
- perProjectInfo.preferences = eclipsePreferences;
+ // Listen to node removal from parent in order to reset cache (see bug
+ // 68993)
+ IEclipsePreferences.INodeChangeListener nodeListener = new IEclipsePreferences.INodeChangeListener() {
+ public void added(IEclipsePreferences.NodeChangeEvent event) {
+ // do nothing
+ }
- // Listen to node removal from parent in order to reset cache (see bug 68993)
- IEclipsePreferences.INodeChangeListener nodeListener = new IEclipsePreferences.INodeChangeListener() {
- public void added(IEclipsePreferences.NodeChangeEvent event) {
- // do nothing
- }
- public void removed(IEclipsePreferences.NodeChangeEvent event) {
- if (event.getChild() == eclipsePreferences) {
- RubyModelManager.getRubyModelManager().resetProjectPreferences(RubyProject.this);
- }
- }
- };
- ((IEclipsePreferences) eclipsePreferences.parent()).addNodeChangeListener(nodeListener);
+ public void removed(IEclipsePreferences.NodeChangeEvent event) {
+ if (event.getChild() == eclipsePreferences) {
+ RubyModelManager.getRubyModelManager().resetProjectPreferences(RubyProject.this);
+ }
+ }
+ };
+ ((IEclipsePreferences) eclipsePreferences.parent()).addNodeChangeListener(nodeListener);
- // Listen to preference changes
- IEclipsePreferences.IPreferenceChangeListener preferenceListener = new IEclipsePreferences.IPreferenceChangeListener() {
- public void preferenceChange(IEclipsePreferences.PreferenceChangeEvent event) {
- RubyModelManager.getRubyModelManager().resetProjectOptions(RubyProject.this);
- }
- };
- eclipsePreferences.addPreferenceChangeListener(preferenceListener);
- return eclipsePreferences;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.rubypeople.rdt.core.IRubyElement#getElementName()
- */
- public String getElementName() {
- if ( project == null )
- {
- return super.getElementName();
- }
- return project.getName();
- }
+ // Listen to preference changes
+ IEclipsePreferences.IPreferenceChangeListener preferenceListener = new IEclipsePreferences.IPreferenceChangeListener() {
+ public void preferenceChange(IEclipsePreferences.PreferenceChangeEvent event) {
+ RubyModelManager.getRubyModelManager().resetProjectOptions(RubyProject.this);
+ }
+ };
+ eclipsePreferences.addPreferenceChangeListener(preferenceListener);
+ return eclipsePreferences;
+ }
- /*
- * (non-Javadoc)
- *
- * @see org.rubypeople.rdt.internal.core.parser.RubyElement#getElementType()
- */
- public int getElementType() {
- return IRubyElement.RUBY_PROJECT;
- }
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.rubypeople.rdt.core.IRubyElement#getElementName()
+ */
+ public String getElementName() {
+ if (project == null) {
+ return super.getElementName();
+ }
+ return project.getName();
+ }
- /*
- * (non-Javadoc)
- *
- * @see org.rubypeople.rdt.core.IRubyElement#hasChildren()
- */
- public boolean hasChildren() {
- return true;
- }
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.rubypeople.rdt.internal.core.parser.RubyElement#getElementType()
+ */
+ public int getElementType() {
+ return IRubyElement.RUBY_PROJECT;
+ }
- /*
- * (non-Javadoc)
- *
- * @see org.rubypeople.rdt.core.IRubyProject#findType(java.lang.String)
- */
- public IType findType(String fullyQualifiedName) {
- int index = fullyQualifiedName.lastIndexOf("::");
- String className = null;
- if (index == -1) {
- className = fullyQualifiedName;
- } else {
- className = fullyQualifiedName.substring(index + 2);
- }
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.rubypeople.rdt.core.IRubyElement#hasChildren()
+ */
+ public boolean hasChildren() {
+ return true;
+ }
- // XXX Use the imports to search the path properly, then do an exhaustive search if that fails
- IType child = searchChildren(this, className);
- if (child != null) return child;
- try {
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.rubypeople.rdt.core.IRubyProject#findType(java.lang.String)
+ */
+ public IType findType(String fullyQualifiedName) {
+ int index = fullyQualifiedName.lastIndexOf("::");
+ String className = null;
+ if (index == -1) {
+ className = fullyQualifiedName;
+ } else {
+ className = fullyQualifiedName.substring(index + 2);
+ }
+
+ // XXX Use the imports to search the path properly, then do an
+ // exhaustive search if that fails
+ IType child = searchChildren(this, className);
+ if (child != null)
+ return child;
+ try {
ILoadpathEntry[] loadpaths = getResolvedLoadpath(true);
for (int i = 0; i < loadpaths.length; i++) {
ILoadpathEntry entry = loadpaths[i];
- IPath path = entry.getPath();
- SourceFolderRoot root = new ExternalSourceFolderRoot(path, this);
- List<IRubyElement> childen = root.getChildrenOfType(IRubyElement.TYPE);
- for (IRubyElement element : childen) {
- if (element.isType(IRubyElement.TYPE)) {
- IType aType = (IType) element;
- if (aType.getElementName().equals(className)) {
- return aType;
+ if (entry.getEntryKind() == ILoadpathEntry.CPE_LIBRARY) {
+ IPath path = entry.getPath();
+ SourceFolderRoot root = new ExternalSourceFolderRoot(path, this);
+ List<IRubyElement> childen = root.getChildrenOfType(IRubyElement.TYPE);
+ for (IRubyElement element : childen) {
+ if (element.isType(IRubyElement.TYPE)) {
+ IType aType = (IType) element;
+ if (aType.getElementName().equals(className)) {
+ return aType;
+ }
}
}
}
@@ -408,240 +430,270 @@
e.printStackTrace();
}
return null;
- }
+ }
- /**
- * @param element
- * @param className
- */
- private IType searchChildren(IRubyElement element, String className) {
- if (element.isType(IRubyElement.TYPE)) {
- if (element.getElementName().equals(className)) return (IType) element;
- }
- if (!(element instanceof IParent)) return null;
- try {
- IRubyElement[] children = ((IParent) element).getChildren();
- for (int i = 0; i < children.length; i++) {
- IRubyElement child = children[i];
- IType type = searchChildren(child, className);
- if (type != null) return type;
- }
- } catch (RubyModelException e) {
- RubyCore.log(e);
- }
- return null;
- }
+ /**
+ * @param element
+ * @param className
+ */
+ private IType searchChildren(IRubyElement element, String className) {
+ if (element.isType(IRubyElement.TYPE)) {
+ if (element.getElementName().equals(className))
+ return (IType) element;
+ }
+ if (!(element instanceof IParent))
+ return null;
+ try {
+ IRubyElement[] children = ((IParent) element).getChildren();
+ for (int i = 0; i < children.length; i++) {
+ IRubyElement child = children[i];
+ IType type = searchChildren(child, className);
+ if (type != null)
+ return type;
+ }
+ } catch (RubyModelException e) {
+ RubyCore.log(e);
+ }
+ return null;
+ }
- /**
- * @param project2
- * @return
- */
- public static boolean hasRubyNature(IProject project2) {
- try {
- return project2.hasNature(RubyCore.NATURE_ID);
- } catch (CoreException e) {
- // project does not exist or is not open
- }
- return false;
- }
+ /**
+ * @param project2
+ * @return
+ */
+ public static boolean hasRubyNature(IProject project2) {
+ try {
+ return project2.hasNature(RubyCore.NATURE_ID);
+ } catch (CoreException e) {
+ // project does not exist or is not open
+ }
+ return false;
+ }
/**
* @see Openable
*/
protected boolean buildStructure(OpenableElementInfo info, IProgressMonitor pm, Map newElements, IResource underlyingResource) throws RubyModelException {
-
+
// check whether the ruby project can be opened
if (!hasRubyNature((IProject) underlyingResource)) {
throw newNotPresentException();
}
-
- // cannot refresh cp markers on opening (emulate cp check on startup) since can create deadlocks (see bug 37274)
- ILoadpathEntry[] resolvedClasspath = getResolvedLoadpath(true/*ignoreUnresolvedEntry*/, false/*don't generateMarkerOnError*/, false/*don't returnResolutionInProgress*/);
+ // cannot refresh cp markers on opening (emulate cp check on startup)
+ // since can create deadlocks (see bug 37274)
+ ILoadpathEntry[] resolvedClasspath = getResolvedLoadpath(true/* ignoreUnresolvedEntry */, false/*
+ * don't
+ * generateMarkerOnError
+ */, false/*
+ * don't
+ * returnResolutionInProgress
+ */);
+
// compute the src folder roots
- info.setChildren(computeSourceFolderRoots(resolvedClasspath, false, null /*no reverse map*/));
-
- // remember the timestamps of external libraries the first time they are looked up
- getPerProjectInfo().rememberExternalLibTimestamps();
+ info.setChildren(computeSourceFolderRoots(resolvedClasspath, false, null /*
+ * no
+ * reverse
+ * map
+ */));
+ // remember the timestamps of external libraries the first time they are
+ // looked up
+ getPerProjectInfo().rememberExternalLibTimestamps();
+
return true;
}
-
+
/**
- * Returns (local/all) the package fragment roots identified by the given project's classpath.
- * Note: this follows project classpath references to find required project contributions,
- * eliminating duplicates silently.
+ * Returns (local/all) the package fragment roots identified by the given
+ * project's classpath. Note: this follows project classpath references to
+ * find required project contributions, eliminating duplicates silently.
* Only works with resolved entries
- * @param resolvedClasspath ILoadpathEntry[]
- * @param retrieveExportedRoots boolean
+ *
+ * @param resolvedClasspath
+ * ILoadpathEntry[]
+ * @param retrieveExportedRoots
+ * boolean
* @return IPackageFragmentRoot[]
* @throws RubyModelException
*/
- public ISourceFolderRoot[] computeSourceFolderRoots(
- ILoadpathEntry[] resolvedClasspath,
- boolean retrieveExportedRoots,
- Map rootToResolvedEntries) throws RubyModelException {
+ public ISourceFolderRoot[] computeSourceFolderRoots(ILoadpathEntry[] resolvedClasspath, boolean retrieveExportedRoots, Map rootToResolvedEntries) throws RubyModelException {
ObjectVector accumulatedRoots = new ObjectVector();
- computeSourceFolderRoots(
- resolvedClasspath,
- accumulatedRoots,
- new HashSet(5), // rootIDs
- null, // inside original project
- true, // check existency
- retrieveExportedRoots,
- rootToResolvedEntries);
+ computeSourceFolderRoots(resolvedClasspath, accumulatedRoots, new HashSet(5), // rootIDs
+ null, // inside original project
+ true, // check existency
+ retrieveExportedRoots, rootToResolvedEntries);
ISourceFolderRoot[] rootArray = new ISourceFolderRoot[accumulatedRoots.size()];
accumulatedRoots.copyInto(rootArray);
return rootArray;
}
-
+
/**
- * Returns (local/all) the package fragment roots identified by the given project's classpath.
- * Note: this follows project classpath references to find required project contributions,
- * eliminating duplicates silently.
+ * Returns (local/all) the package fragment roots identified by the given
+ * project's classpath. Note: this follows project classpath references to
+ * find required project contributions, eliminating duplicates silently.
* Only works with resolved entries
- * @param resolvedClasspath IClasspathEntry[]
- * @param accumulatedRoots ObjectVector
- * @param rootIDs HashSet
- * @param referringEntry project entry referring to this CP or null if initial project
- * @param checkExistency boolean
- * @param retrieveExportedRoots boolean
+ *
+ * @param resolvedClasspath
+ * IClasspathEntry[]
+ * @param accumulatedRoots
+ * ObjectVector
+ * @param rootIDs
+ * HashSet
+ * @param referringEntry
+ * project entry referring to this CP or null if initial project
+ * @param checkExistency
+ * boolean
+ * @param retrieveExportedRoots
+ * boolean
* @throws RubyModelException
*/
- public void computeSourceFolderRoots(
- ILoadpathEntry[] resolvedClasspath,
- ObjectVector accumulatedRoots,
- HashSet rootIDs,
- ILoadpathEntry referringEntry,
- boolean checkExistency,
- boolean retrieveExportedRoots,
- Map rootToResolvedEntries) throws RubyModelException {
+ public void computeSourceFolderRoots(ILoadpathEntry[] resolvedClasspath, ObjectVector accumulatedRoots, HashSet rootIDs, ILoadpathEntry referringEntry, boolean checkExistency, boolean retrieveExportedRoots, Map rootToResolvedEntries) throws RubyModelException {
- if (referringEntry == null){
+ if (referringEntry == null) {
rootIDs.add(rootID());
- }
- for (int i = 0, length = resolvedClasspath.length; i < length; i++){
- computeSourceFolderRoots(
- resolvedClasspath[i],
- accumulatedRoots,
- rootIDs,
- referringEntry,
- checkExistency,
- retrieveExportedRoots,
- rootToResolvedEntries);
}
+ for (int i = 0, length = resolvedClasspath.length; i < length; i++) {
+ computeSourceFolderRoots(resolvedClasspath[i], accumulatedRoots, rootIDs, referringEntry, checkExistency, retrieveExportedRoots, rootToResolvedEntries);
+ }
}
-
+
/**
- * Returns the package fragment roots identified by the given entry. In case it refers to
- * a project, it will follow its classpath so as to find exported roots as well.
- * Only works with resolved entry
- * @param resolvedEntry IClasspathEntry
- * @param accumulatedRoots ObjectVector
- * @param rootIDs HashSet
- * @param referringEntry the CP entry (project) referring to this entry, or null if initial project
- * @param checkExistency boolean
- * @param retrieveExportedRoots boolean
+ * Returns the package fragment roots identified by the given entry. In case
+ * it refers to a project, it will follow its classpath so as to find
+ * exported roots as well. Only works with resolved entry
+ *
+ * @param resolvedEntry
+ * IClasspathEntry
+ * @param accumulatedRoots
+ * ObjectVector
+ * @param rootIDs
+ * HashSet
+ * @param referringEntry
+ * the CP entry (project) referring to this entry, or null if
+ * initial project
+ * @param checkExistency
+ * boolean
+ * @param retrieveExportedRoots
+ * boolean
* @throws JavaModelException
*/
- public void computeSourceFolderRoots(
- ILoadpathEntry resolvedEntry,
- ObjectVector accumulatedRoots,
- HashSet rootIDs,
- ILoadpathEntry referringEntry,
- boolean checkExistency,
- boolean retrieveExportedRoots,
- Map rootToResolvedEntries) throws RubyModelException {
-
- String rootID = ((LoadpathEntry)resolvedEntry).rootID();
- if (rootIDs.contains(rootID)) return;
+ public void computeSourceFolderRoots(ILoadpathEntry resolvedEntry, ObjectVector accumulatedRoots, HashSet rootIDs, ILoadpathEntry referringEntry, boolean checkExistency, boolean retrieveExportedRoots, Map rootToResolvedEntries) throws RubyModelException {
+ String rootID = ((LoadpathEntry) resolvedEntry).rootID();
+ if (rootIDs.contains(rootID))
+ return;
+
IPath projectPath = this.project.getFullPath();
IPath entryPath = resolvedEntry.getPath();
IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
ISourceFolderRoot root = null;
-
- switch(resolvedEntry.getEntryKind()){
-
- // source folder
- case ILoadpathEntry.CPE_SOURCE :
- if (projectPath.isPrefixOf(entryPath)){
- if (checkExistency) {
- Object target = RubyModel.getTarget(workspaceRoot, entryPath, checkExistency);
- if (target == null) return;
-
- if (target instanceof IFolder || target instanceof IProject){
- root = getSourceFolderRoot((IResource)target);
- }
- } else {
- root = getFolderSourceFolderRoot(entryPath);
- }
- }
- break;
+ switch (resolvedEntry.getEntryKind()) {
- // internal/external JAR or folder
- case ILoadpathEntry.CPE_LIBRARY :
-
- if (referringEntry != null && !resolvedEntry.isExported()) return;
-
+ // source folder
+ case ILoadpathEntry.CPE_SOURCE:
+
+ if (projectPath.isPrefixOf(entryPath)) {
if (checkExistency) {
Object target = RubyModel.getTarget(workspaceRoot, entryPath, checkExistency);
- if (target == null) return;
-
- if (target instanceof IResource){
- // internal target
+ if (target == null)
+ return;
+
+ if (target instanceof IFolder || target instanceof IProject) {
root = getSourceFolderRoot((IResource) target);
- } else {
- // external target
- if (RubyModel.isFile(target)) {
- root = new ExternalSourceFolderRoot(entryPath, this);
- }
}
} else {
- root = getSourceFolderRoot(entryPath);
+ root = getFolderSourceFolderRoot(entryPath);
}
- break;
+ }
+ break;
- // recurse into required project
- case ILoadpathEntry.CPE_PROJECT :
+ // internal/external JAR or folder
+ case ILoadpathEntry.CPE_LIBRARY:
- if (!retrieveExportedRoots) return;
- if (referringEntry != null && !resolvedEntry.isExported()) return;
+ if (referringEntry != null && !resolvedEntry.isExported())
+ return;
- IResource member = workspaceRoot.findMember(entryPath);
- if (member != null && member.getType() == IResource.PROJECT){// double check if bound to project (23977)
- IProject requiredProjectRsc = (IProject) member;
- if (RubyProject.hasRubyNature(requiredProjectRsc)){ // special builder binary output
- rootIDs.add(rootID);
- RubyProject requiredProject = (RubyProject)RubyCore.create(requiredProjectRsc);
- requiredProject.computeSourceFolderRoots(
- requiredProject.getResolvedLoadpath(true/*ignoreUnresolvedEntry*/, false/*don't generateMarkerOnError*/, false/*don't returnResolutionInProgress*/),
- accumulatedRoots,
- rootIDs,
- rootToResolvedEntries == null ? resolvedEntry : ((LoadpathEntry)resolvedEntry).combineWith((LoadpathEntry) referringEntry), // only combine if need to build the reverse map
- checkExistency,
- retrieveExportedRoots,
- rootToResolvedEntries);
+ if (checkExistency) {
+ Object target = RubyModel.getTarget(workspaceRoot, entryPath, checkExistency);
+ if (target == null)
+ return;
+
+ if (target instanceof IResource) {
+ // internal target
+ root = getSourceFolderRoot((IResource) target);
+ } else {
+ // external target
+ if (RubyModel.isFile(target)) {
+ root = new ExternalSourceFolderRoot(entryPath, this);
}
+ }
+ } else {
+ root = getSourceFolderRoot(entryPath);
+ }
+ break;
+
+ // recurse into required project
+ case ILoadpathEntry.CPE_PROJECT:
+
+ if (!retrieveExportedRoots)
+ return;
+ if (referringEntry != null && !resolvedEntry.isExported())
+ return;
+
+ IResource member = workspaceRoot.findMember(entryPath);
+ if (member != null && member.getType() == IResource.PROJECT) {// double
+ // check
+ // if
+ // bound
+ // to
+ // project
+ // (23977)
+ IProject requiredProjectRsc = (IProject) member;
+ if (RubyProject.hasRubyNature(requiredProjectRsc)) { // special
+ // builder
+ // binary
+ // output
+ rootIDs.add(rootID);
+ RubyProject requiredProject = (RubyProject) RubyCore.create(requiredProjectRsc);
+ requiredProject.computeSourceFolderRoots(requiredProject.getResolvedLoadpath(true/* ignoreUnresolvedEntry */, false/*
+ * don't
+ * generateMarkerOnError
+ */, false/*
+ * don't
+ * returnResolutionInProgress
+ */), accumulatedRoots, rootIDs, rootToResolvedEntries == null ? resolvedEntry : ((LoadpathEntry) resolvedEntry).combineWith((LoadpathEntry) referringEntry), // only
+ // combine
+ // if
+ // need
+ // to
+ // build
+ // the
+ // reverse
+ // map
+ checkExistency, retrieveExportedRoots, rootToResolvedEntries);
+ }
break;
}
}
if (root != null) {
accumulatedRoots.add(root);
rootIDs.add(rootID);
- if (rootToResolvedEntries != null) rootToResolvedEntries.put(root, ((LoadpathEntry)resolvedEntry).combineWith((LoadpathEntry) referringEntry));
+ if (rootToResolvedEntries != null)
+ rootToResolvedEntries.put(root, ((LoadpathEntry) resolvedEntry).combineWith((LoadpathEntry) referringEntry));
}
}
-
+
/**
- * @param path IPath
- * @return A handle to the package fragment root identified by the given path.
- * This method is handle-only and the element may or may not exist. Returns
- * <code>null</code> if unable to generate a handle from the path (for example,
- * an absolute path that has less than 1 segment. The path may be relative or
- * absolute.
+ * @param path
+ * IPath
+ * @return A handle to the package fragment root identified by the given
+ * path. This method is handle-only and the element may or may not
+ * exist. Returns <code>null</code> if unable to generate a handle
+ * from the path (for example, an absolute path that has less than 1
+ * segment. The path may be relative or absolute.
*/
public ISourceFolderRoot getSourceFolderRoot(IPath path) {
if (!path.isAbsolute()) {
@@ -649,181 +701,186 @@
}
int segmentCount = path.segmentCount();
switch (segmentCount) {
- case 0:
- return null;
- case 1:
- if (path.equals(getPath())) { // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=75814
- // default root
- return getSourceFolderRoot(this.project);
- }
- default:
- if (segmentCount == 1) {
- // lib being another project
- return getSourceFolderRoot(this.project.getWorkspace().getRoot().getProject(path.lastSegment()));
- } else {
- // lib being a folder
- return getSourceFolderRoot(this.project.getWorkspace().getRoot().getFolder(path));
- }
+ case 0:
+ return null;
+ case 1:
+ if (path.equals(getPath())) { // see
+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=75814
+ // default root
+ return getSourceFolderRoot(this.project);
+ }
+ default:
+ if (segmentCount == 1) {
+ // lib being another project
+ return getSourceFolderRoot(this.project.getWorkspace().getRoot().getProject(path.lastSegment()));
+ } else {
+ // lib being a folder
+ return getSourceFolderRoot(this.project.getWorkspace().getRoot().getFolder(path));
+ }
}
}
-
- public boolean contains(IResource resource) {
+
+ public boolean contains(IResource resource) {
// XXX Check the paths to see if this is true or not!
return true;
}
- /**
- * Answers an ID which is used to distinguish project/entries during package
- * fragment root computations
- *
- * @return String
- */
- public String rootID() {
- return "[PRJ]" + this.project.getFullPath(); //$NON-NLS-1$
- }
+ /**
+ * Answers an ID which is used to distinguish project/entries during package
+ * fragment root computations
+ *
+ * @return String
+ */
+ public String rootID() {
+ return "[PRJ]" + this.project.getFullPath(); //$NON-NLS-1$
+ }
- /**
- * Returns a new element info for this element.
- */
- protected Object createElementInfo() {
- return new RubyProjectElementInfo();
- }
-
- /**
- * @see org.rubypeople.rdt.core.IRubyProject#getOption(String, boolean)
- */
- public String getOption(String optionName, boolean inheritRubyCoreOptions) {
-
- String propertyName = optionName;
- if (RubyModelManager.getRubyModelManager().optionNames.contains(propertyName)){
- IEclipsePreferences projectPreferences = getEclipsePreferences();
- String javaCoreDefault = inheritRubyCoreOptions ? RubyCore.getOption(propertyName) : null;
- if (projectPreferences == null) return javaCoreDefault;
- String value = projectPreferences.get(propertyName, javaCoreDefault);
- return value == null ? null : value.trim();
- }
- return null;
- }
-
- /**
- * @see org.rubypeople.rdt.core.IRubyProject#getOptions(boolean)
- */
- public Map getOptions(boolean inheritRubyCoreOptions) {
+ /**
+ * Returns a new element info for this element.
+ */
+ protected Object createElementInfo() {
+ return new RubyProjectElementInfo();
+ }
- // initialize to the defaults from RubyCore options pool
- Map options = inheritRubyCoreOptions ? RubyCore.getOptions() : new Hashtable(5);
+ /**
+ * @see org.rubypeople.rdt.core.IRubyProject#getOption(String, boolean)
+ */
+ public String getOption(String optionName, boolean inheritRubyCoreOptions) {
- // Get project specific options
- RubyModelManager.PerProjectInfo perProjectInfo = null;
- Hashtable projectOptions = null;
- HashSet optionNames = RubyModelManager.getRubyModelManager().optionNames;
- try {
- perProjectInfo = getPerProjectInfo();
- projectOptions = perProjectInfo.options;
- if (projectOptions == null) {
- // get eclipse preferences
- IEclipsePreferences projectPreferences= getEclipsePreferences();
- if (projectPreferences == null) return options; // cannot do better (non-Ruby project)
- // create project options
- String[] propertyNames = projectPreferences.keys();
- projectOptions = new Hashtable(propertyNames.length);
- for (int i = 0; i < propertyNames.length; i++){
- String propertyName = propertyNames[i];
- String value = projectPreferences.get(propertyName, null);
- if (value != null && optionNames.contains(propertyName)){
- projectOptions.put(propertyName, value.trim());
- }
- }
- // cache project options
- perProjectInfo.options = projectOptions;
- }
- } catch (RubyModelException jme) {
- projectOptions = new Hashtable();
- } catch (BackingStoreException e) {
- projectOptions = new Hashtable();
- }
+ String propertyName = optionName;
+ if (RubyModelManager.getRubyModelManager().optionNames.contains(propertyName)) {
+ IEclipsePreferences projectPreferences = getEclipsePreferences();
+ String javaCoreDefault = inheritRubyCoreOptions ? RubyCore.getOption(propertyName) : null;
+ if (projectPreferences == null)
+ return javaCoreDefault;
+ String value = projectPreferences.get(propertyName, javaCoreDefault);
+ return value == null ? null : value.trim();
+ }
+ return null;
+ }
- // Inherit from RubyCore options if specified
- if (inheritRubyCoreOptions) {
- Iterator propertyNames = projectOptions.keySet().iterator();
- while (propertyNames.hasNext()) {
- String propertyName = (String) propertyNames.next();
- String propertyValue = (String) projectOptions.get(propertyName);
- if (propertyValue != null && optionNames.contains(propertyName)){
- options.put(propertyName, propertyValue.trim());
- }
- }
- return options;
- }
- return projectOptions;
- }
-
- /*
- * Update eclipse preferences from old preferences.
- */
- private void updatePreferences(IEclipsePreferences preferences) {
-
- Preferences oldPreferences = loadPreferences();
- if (oldPreferences != null) {
- String[] propertyNames = oldPreferences.propertyNames();
- for (int i = 0; i < propertyNames.length; i++){
- String propertyName = propertyNames[i];
- String propertyValue = oldPreferences.getString(propertyName);
- if (!"".equals(propertyValue)) { //$NON-NLS-1$
- preferences.put(propertyName, propertyValue);
- }
- }
- try {
- // save immediately old preferences
- preferences.flush();
- } catch (BackingStoreException e) {
- // fails silently
- }
- }
- }
-
- /**
- * load preferences from a shareable format (VCM-wise)
- */
- private Preferences loadPreferences() {
-
- Preferences preferences = new Preferences();
- IPath projectMetaLocation = getPluginWorkingLocation();
- if (projectMetaLocation != null) {
- File prefFile = projectMetaLocation.append(PREF_FILENAME).toFile();
- if (prefFile.exists()) { // load preferences from file
- InputStream in = null;
- try {
- in = new BufferedInputStream(new FileInputStream(prefFile));
- preferences.load(in);
- } catch (IOException e) { // problems loading preference store - quietly ignore
- } finally {
- if (in != null) {
- try {
- in.close();
- } catch (IOException e) { // ignore problems with close
- }
- }
- }
- // one shot read, delete old preferences
- prefFile.delete();
- return preferences;
- }
- }
- return null;
- }
+ /**
+ * @see org.rubypeople.rdt.core.IRubyProject#getOptions(boolean)
+ */
+ public Map getOptions(boolean inheritRubyCoreOptions) {
- /*
- * Resets this project's caches
- */
- public void resetCaches() {
- RubyProjectElementInfo info = (RubyProjectElementInfo) RubyModelManager.getRubyModelManager().peekAtInfo(this);
- if (info != null){
- info.resetCaches();
- }
- }
+ // initialize to the defaults from RubyCore options pool
+ Map options = inheritRubyCoreOptions ? RubyCore.getOptions() : new Hashtable(5);
+ // Get project specific options
+ RubyModelManager.PerProjectInfo perProjectInfo = null;
+ Hashtable projectOptions = null;
+ HashSet optionNames = RubyModelManager.getRubyModelManager().optionNames;
+ try {
+ perProjectInfo = getPerProjectInfo();
+ projectOptions = perProjectInfo.options;
+ if (projectOptions == null) {
+ // get eclipse preferences
+ IEclipsePreferences projectPreferences = getEclipsePreferences();
+ if (projectPreferences == null)
+ return options; // cannot do better (non-Ruby project)
+ // create project options
+ String[] propertyNames = projectPreferences.keys();
+ projectOptions = new Hashtable(propertyNames.length);
+ for (int i = 0; i < propertyNames.length; i++) {
+ String propertyName = propertyNames[i];
+ String value = projectPreferences.get(propertyName, null);
+ if (value != null && optionNames.contains(propertyName)) {
+ projectOptions.put(propertyName, value.trim());
+ }
+ }
+ // cache project options
+ perProjectInfo.options = projectOptions;
+ }
+ } catch (RubyModelException jme) {
+ projectOptions = new Hashtable();
+ } catch (BackingStoreException e) {
+ projectOptions = new Hashtable();
+ }
+
+ // Inherit from RubyCore options if specified
+ if (inheritRubyCoreOptions) {
+ Iterator propertyNames = projectOptions.keySet().iterator();
+ while (propertyNames.hasNext()) {
+ String propertyName = (String) propertyNames.next();
+ String propertyValue = (String) projectOptions.get(propertyName);
+ if (propertyValue != null && optionNames.contains(propertyName)) {
+ options.put(propertyName, propertyValue.trim());
+ }
+ }
+ return options;
+ }
+ return projectOptions;
+ }
+
+ /*
+ * Update eclipse preferences from old preferences.
+ */
+ private void updatePreferences(IEclipsePreferences preferences) {
+
+ Preferences oldPreferences = loadPreferences();
+ if (oldPreferences != null) {
+ String[] propertyNames = oldPreferences.propertyNames();
+ for (int i = 0; i < propertyNames.length; i++) {
+ String propertyName = propertyNames[i];
+ String propertyValue = oldPreferences.getString(propertyName);
+ if (!"".equals(propertyValue)) { //$NON-NLS-1$
+ preferences.put(propertyName, propertyValue);
+ }
+ }
+ try {
+ // save immediately old preferences
+ preferences.flush();
+ } catch (BackingStoreException e) {
+ // fails silently
+ }
+ }
+ }
+
/**
+ * load preferences from a shareable format (VCM-wise)
+ */
+ private Preferences loadPreferences() {
+
+ Preferences preferences = new Preferences();
+ IPath projectMetaLocation = getPluginWorkingLocation();
+ if (projectMetaLocation != null) {
+ File prefFile = projectMetaLocation.append(PREF_FILENAME).toFile();
+ if (prefFile.exists()) { // load preferences from file
+ InputStream in = null;
+ try {
+ in = new BufferedInputStream(new FileInputStream(prefFile));
+ preferences.load(in);
+ } catch (IOException e) { // problems loading preference store
+ // - quietly ignore
+ } finally {
+ if (in != null) {
+ try {
+ in.close();
+ } catch (IOException e) { // ignore problems with
+ // close
+ }
+ }
+ }
+ // one shot read, delete old preferences
+ prefFile.delete();
+ return preferences;
+ }
+ }
+ return null;
+ }
+
+ /*
+ * Resets this project's caches
+ */
+ public void resetCaches() {
+ RubyProjectElementInfo info = (RubyProjectElementInfo) RubyModelManager.getRubyModelManager().peekAtInfo(this);
+ if (info != null) {
+ info.resetCaches();
+ }
+ }
+
+ /**
* Returns an array of non-ruby resources contained in the receiver.
*/
public Object[] getNonRubyResources() throws RubyModelException {
@@ -835,16 +892,11 @@
int length;
ISourceFolder[] roots;
- System.arraycopy(
- children = getChildren(),
- 0,
- roots = new ISourceFolder[length = children.length],
- 0,
- length);
-
+ System.arraycopy(children = getChildren(), 0, roots = new ISourceFolder[length = children.length], 0, length);
+
return roots;
}
-
+
/*
* Internal variant allowing to parameterize problem creation/logging
*/
@@ -853,89 +905,88 @@
RubyModelManager.PerProjectInfo perProjectInfo = null;
ILoadpathEntry[] classpath;
if (createMarkers) {
- this.flushLoadpathProblemMarkers(false/*cycle*/, true/*format*/);
+ this.flushLoadpathProblemMarkers(false/* cycle */, true/* format */);
classpath = this.readLoadpathFile(createMarkers, logProblems);
} else {
perProjectInfo = getPerProjectInfo();
classpath = perProjectInfo.rawLoadpath;
- if (classpath != null) return classpath;
+ if (classpath != null)
+ return classpath;
classpath = this.readLoadpathFile(createMarkers, logProblems);
}
// extract out the output location
IPath outputLocation = null;
if (classpath != null && classpath.length > 0) {
ILoadpathEntry entry = classpath[classpath.length - 1];
-// if (entry.getContentKind() == ClasspathEntry.K_OUTPUT) {
-// outputLocation = entry.getPath();
-// ILoadpathEntry[] copy = new ILoadpathEntry[classpath.length - 1];
-// System.arraycopy(classpath, 0, copy, 0, copy.length);
-// classpath = copy;
-// }
+ // if (entry.getContentKind() == ClasspathEntry.K_OUTPUT) {
+ // outputLocation = entry.getPath();
+ // ILoadpathEntry[] copy = new ILoadpathEntry[classpath.length - 1];
+ // System.arraycopy(classpath, 0, copy, 0, copy.length);
+ // classpath = copy;
+ // }
}
if (classpath == null) {
return defaultLoadpath();
}
- /* Disable validate: classpath can contain CP variables and container that need to be resolved
- if (classpath != INVALID_CLASSPATH
- && !JavaConventions.validateClasspath(this, classpath, outputLocation).isOK()) {
- classpath = INVALID_CLASSPATH;
- }
- */
+ /*
+ * Disable validate: classpath can contain CP variables and container
+ * that need to be resolved if (classpath != INVALID_CLASSPATH &&
+ * !JavaConventions.validateClasspath(this, classpath,
+ * outputLocation).isOK()) { classpath = INVALID_CLASSPATH; }
+ */
if (!createMarkers) {
perProjectInfo.rawLoadpath = classpath;
perProjectInfo.outputLocation = outputLocation;
}
return classpath;
}
-
+
/**
- * Returns a default load path.
- * This is the root of the project
+ * Returns a default load path. This is the root of the project
*/
protected ILoadpathEntry[] defaultLoadpath() {
- return new ILoadpathEntry[] {
- RubyCore.newSourceEntry(this.project.getFullPath())};
+ return new ILoadpathEntry[] { RubyCore.newSourceEntry(this.project.getFullPath()) };
}
-
+
/**
- * Reads the .classpath file from disk and returns the list of entries it contains (including output location entry)
- * Returns null if .classfile is not present.
- * Returns INVALID_CLASSPATH if it has a format problem.
+ * Reads the .classpath file from disk and returns the list of entries it
+ * contains (including output location entry) Returns null if .classfile is
+ * not present. Returns INVALID_CLASSPATH if it has a format problem.
*/
protected ILoadpathEntry[] readLoadpathFile(boolean createMarker, boolean logProblems) {
- return readLoadpathFile(createMarker, logProblems, null/*not interested in unknown elements*/);
+ return readLoadpathFile(createMarker, logProblems, null/*
+ * not
+ * interested in
+ * unknown
+ * elements
+ */);
}
-
+
protected ILoadpathEntry[] readLoadpathFile(boolean createMarker, boolean logProblems, Map unknownElements) {
try {
String xmlClasspath = getSharedProperty(LOADPATH_FILENAME);
if (xmlClasspath == null) {
if (createMarker && this.project.isAccessible()) {
- this.createLoadpathProblemMarker(new RubyModelStatus(
- IRubyModelStatusConstants.INVALID_LOADPATH_FILE_FORMAT,
- Messages.bind(Messages.classpath_cannotReadClasspathFile, this.getElementName())));
+ this.createLoadpathProblemMarker(new RubyModelStatus(IRubyModelStatusConstants.INVALID_LOADPATH_FILE_FORMAT, Messages.bind(Messages.classpath_cannotReadClasspathFile, this.getElementName())));
}
return null;
}
return decodeLoadpath(xmlClasspath, createMarker, logProblems, unknownElements);
- } catch(CoreException e) {
+ } catch (CoreException e) {
// file does not exist (or not accessible)
if (createMarker && this.project.isAccessible()) {
- this.createLoadpathProblemMarker(new RubyModelStatus(
- IRubyModelStatusConstants.INVALID_LOADPATH_FILE_FORMAT,
- Messages.bind(Messages.classpath_cannotReadClasspathFile, this.getElementName())));
+ this.createLoadpathProblemMarker(new RubyModelStatus(IRubyModelStatusConstants.INVALID_LOADPATH_FILE_FORMAT, Messages.bind(Messages.classpath_cannotReadClasspathFile, this.getElementName())));
}
if (logProblems) {
- Util.log(e,
- "Exception while retrieving "+ this.getPath() //$NON-NLS-1$
- +"/.classpath, will revert to default classpath"); //$NON-NLS-1$
+ Util.log(e, "Exception while retrieving " + this.getPath() //$NON-NLS-1$
+ + "/.classpath, will revert to default classpath"); //$NON-NLS-1$
}
}
return null;
}
-
+
/**
* Reads and decode an XML classpath string
*/
@@ -944,80 +995,79 @@
ArrayList paths = new ArrayList();
ILoadpathEntry defaultOutput = null;
try {
- if (xmlClasspath == null) return null;
+ if (xmlClasspath == null)
+ return null;
StringReader reader = new StringReader(xmlClasspath);
Element cpElement;
-
+
...
[truncated message content] |
|
From: <caw...@us...> - 2007-01-23 13:50:50
|
Revision: 1856
http://svn.sourceforge.net/rubyeclipse/?rev=1856&view=rev
Author: cawilliams
Date: 2007-01-23 05:50:42 -0800 (Tue, 23 Jan 2007)
Log Message:
-----------
show VM type in installed interpreters table, Add more text to dialog for finding ruby home (to let Unix users know what they should set it to).
Modified Paths:
--------------
trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/RdtDebugUiMessages.java
trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/RdtDebugUiMessages.properties
trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/preferences/RubyInterpreterLabelProvider.java
trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/preferences/RubyInterpreterPreferencePage.java
trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/rubyvms/RubyVMMessages.java
trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/rubyvms/RubyVMMessages.properties
Modified: trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/RdtDebugUiMessages.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/RdtDebugUiMessages.java 2007-01-23 01:02:24 UTC (rev 1855)
+++ trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/RdtDebugUiMessages.java 2007-01-23 13:50:42 UTC (rev 1856)
@@ -69,6 +69,7 @@
public static String RubyInterpreterPreferencePage_rubyInterpreterTable_interpreterName;
public static String RubyInterpreterPreferencePage_rubyInterpreterTable_interpreterPath;
public static String RdtDebugUiPlugin_couldNotOpenFile;
+ public static String RubyInterpreterPreferencePage_rubyInterpreterTable_interpreterType;
static {
// load message values from bundle file
Modified: trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/RdtDebugUiMessages.properties
===================================================================
--- trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/RdtDebugUiMessages.properties 2007-01-23 01:02:24 UTC (rev 1855)
+++ trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/RdtDebugUiMessages.properties 2007-01-23 13:50:42 UTC (rev 1856)
@@ -65,6 +65,7 @@
RubyInterpreterPreferencePage_removeButton_label=Remove
RubyInterpreterPreferencePage_rubyInterpreterTable_interpreterName=Name
RubyInterpreterPreferencePage_rubyInterpreterTable_interpreterPath=Location
+RubyInterpreterPreferencePage_rubyInterpreterTable_interpreterType=Type
RubyInterpreterPreferencePage_EditInterpreterDialog_addInterpreter_title=Add Interpreter
RubyInterpreterPreferencePage_EditInterpreterDialog_editInterpreter_title=Edit Interpreter
Modified: trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/preferences/RubyInterpreterLabelProvider.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/preferences/RubyInterpreterLabelProvider.java 2007-01-23 01:02:24 UTC (rev 1855)
+++ trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/preferences/RubyInterpreterLabelProvider.java 2007-01-23 13:50:42 UTC (rev 1856)
@@ -6,6 +6,7 @@
import org.eclipse.jface.viewers.ITableLabelProvider;
import org.eclipse.swt.graphics.Image;
import org.rubypeople.rdt.launching.IVMInstall;
+import org.rubypeople.rdt.launching.IVMInstallType;
public class RubyInterpreterLabelProvider implements ITableLabelProvider {
@@ -25,6 +26,9 @@
case 1 :
File installLocation = interpreter.getInstallLocation();
return installLocation != null ? installLocation.getAbsolutePath() : "In user path";
+ case 2 :
+ IVMInstallType installType = interpreter.getVMInstallType();
+ return installType != null ? installType.getName() : "Unknown";
default :
return "Unknown Column Index";
}
Modified: trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/preferences/RubyInterpreterPreferencePage.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/preferences/RubyInterpreterPreferencePage.java 2007-01-23 01:02:24 UTC (rev 1855)
+++ trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/preferences/RubyInterpreterPreferencePage.java 2007-01-23 13:50:42 UTC (rev 1856)
@@ -15,12 +15,14 @@
import org.eclipse.jface.window.Window;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.BusyIndicator;
+import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
@@ -37,17 +39,21 @@
import org.rubypeople.rdt.launching.VMStandin;
public class RubyInterpreterPreferencePage extends PreferencePage implements IWorkbenchPreferencePage, IAddVMDialogRequestor {
-
+
/**
* VMs being displayed
*/
- private List<IVMInstall> fVMs = new ArrayList<IVMInstall>();
-
+ private List<IVMInstall> fVMs = new ArrayList<IVMInstall>();
+
protected CheckboxTableViewer fVMList;
protected Button addButton, editButton, removeButton;
public RubyInterpreterPreferencePage() {
super();
+ // only used when page is shown programatically
+ setTitle(RubyVMMessages.JREsPreferencePage_1);
+
+ setDescription(RubyVMMessages.JREsPreferencePage_2);
}
public void init(IWorkbench workbench) {}
@@ -56,12 +62,22 @@
noDefaultAndApplyButton();
Composite composite = createPageRoot(parent);
+
+ Label tableLabel = new Label(composite, SWT.NONE);
+ tableLabel.setText(RubyVMMessages.InstalledJREsBlock_15);
+ GridData data = new GridData();
+ data.horizontalSpan = 2;
+ tableLabel.setLayoutData(data);
+ Font font = parent.getFont();
+ composite.setFont(font);
+ tableLabel.setFont(font);
+
Table table = createInstalledInterpretersTable(composite);
createInstalledInterpretersTableViewer(table);
- createButtonGroup(composite);
+ createButtonGroup(composite);
fillWithWorkspaceRubyVMs();
-
+
IVMInstall selectedInterpreter = RubyRuntime.getDefaultVMInstall();
if (selectedInterpreter != null)
fVMList.setChecked(selectedInterpreter, true);
@@ -70,9 +86,9 @@
return composite;
}
-
+
private void fillWithWorkspaceRubyVMs() {
-// fill with Ruby VMs
+ // fill with Ruby VMs
List<VMStandin> standins = new ArrayList<VMStandin>();
IVMInstallType[] types = RubyRuntime.getVMInstallTypes();
for (int i = 0; i < types.length; i++) {
@@ -83,13 +99,14 @@
standins.add(new VMStandin(install));
}
}
- setJREs((IVMInstall[])standins.toArray(new IVMInstall[standins.size()]));
+ setJREs((IVMInstall[]) standins.toArray(new IVMInstall[standins.size()]));
}
/**
* Sets the JREs to be displayed in this block
*
- * @param vms JREs to be displayed
+ * @param vms
+ * JREs to be displayed
*/
protected void setJREs(IVMInstall[] vms) {
fVMs.clear();
@@ -153,7 +170,7 @@
updateSelectedInterpreter(event.getElement());
}
});
-
+
fVMList.addDoubleClickListener(new IDoubleClickListener() {
public void doubleClick(DoubleClickEvent e) {
editInterpreter();
@@ -175,7 +192,11 @@
column = new TableColumn(table, SWT.NULL);
column.setText(RdtDebugUiMessages.RubyInterpreterPreferencePage_rubyInterpreterTable_interpreterPath);
- column.setWidth(350);
+ column.setWidth(250);
+
+ column = new TableColumn(table, SWT.NULL);
+ column.setText(RdtDebugUiMessages.RubyInterpreterPreferencePage_rubyInterpreterTable_interpreterType);
+ column.setWidth(125);
return table;
}
@@ -190,7 +211,7 @@
protected void addInterpreter() {
AddVMDialog dialog = new AddVMDialog(this, getShell(), RubyRuntime.getVMInstallTypes(), null);
- dialog.setTitle(RubyVMMessages.InstalledJREsBlock_7);
+ dialog.setTitle(RubyVMMessages.InstalledJREsBlock_7);
if (dialog.open() != Window.OK) {
return;
}
@@ -220,31 +241,31 @@
}
protected void editInterpreter() {
- IStructuredSelection selection= (IStructuredSelection)fVMList.getSelection();
- IVMInstall vm= (IVMInstall)selection.getFirstElement();
+ IStructuredSelection selection = (IStructuredSelection) fVMList.getSelection();
+ IVMInstall vm = (IVMInstall) selection.getFirstElement();
if (vm == null) {
return;
}
-// if (isContributed(vm)) {
-// VMDetailsDialog dialog= new VMDetailsDialog(getShell(), vm);
-// dialog.open();
-// } else {
- AddVMDialog dialog= new AddVMDialog(this, getShell(), RubyRuntime.getVMInstallTypes(), vm);
- dialog.setTitle(RubyVMMessages.InstalledJREsBlock_8);
- if (dialog.open() != Window.OK) {
- return;
- }
- fVMList.refresh(vm);
-// }
+ // if (isContributed(vm)) {
+ // VMDetailsDialog dialog= new VMDetailsDialog(getShell(), vm);
+ // dialog.open();
+ // } else {
+ AddVMDialog dialog = new AddVMDialog(this, getShell(), RubyRuntime.getVMInstallTypes(), vm);
+ dialog.setTitle(RubyVMMessages.InstalledJREsBlock_8);
+ if (dialog.open() != Window.OK) {
+ return;
+ }
+ fVMList.refresh(vm);
+ // }
}
-
+
protected IVMInstall getSelectedInterpreter() {
IStructuredSelection selection = (IStructuredSelection) fVMList.getSelection();
return (IVMInstall) selection.getFirstElement();
}
-
- public boolean performOk() {
- final boolean[] canceled = new boolean[] {false};
+
+ public boolean performOk() {
+ final boolean[] canceled = new boolean[] { false };
BusyIndicator.showWhile(null, new Runnable() {
public void run() {
IVMInstall defaultVM = getCheckedRubyVM();
@@ -255,14 +276,14 @@
}
}
});
-
- if(canceled[0]) {
+
+ if (canceled[0]) {
return false;
}
-
- return super.performOk();
+
+ return super.performOk();
}
-
+
/**
* Returns the checked RubyVM or <code>null</code> if none.
*
@@ -273,21 +294,21 @@
if (objects.length == 0) {
return null;
}
- return (IVMInstall)objects[0];
+ return (IVMInstall) objects[0];
}
-
+
/**
* Returns the RubyVMs currently being displayed in this block
*
* @return RubyVMs currently being displayed in this block
*/
public IVMInstall[] getRubyVMs() {
- return (IVMInstall[])fVMs.toArray(new IVMInstall[fVMs.size()]);
+ return (IVMInstall[]) fVMs.toArray(new IVMInstall[fVMs.size()]);
}
public boolean isDuplicateName(String name) {
- for (int i= 0; i < fVMs.size(); i++) {
- IVMInstall vm = (IVMInstall)fVMs.get(i);
+ for (int i = 0; i < fVMs.size(); i++) {
+ IVMInstall vm = (IVMInstall) fVMs.get(i);
if (vm.getName().equals(name)) {
return true;
}
Modified: trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/rubyvms/RubyVMMessages.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/rubyvms/RubyVMMessages.java 2007-01-23 01:02:24 UTC (rev 1855)
+++ trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/rubyvms/RubyVMMessages.java 2007-01-23 13:50:42 UTC (rev 1856)
@@ -28,6 +28,9 @@
public static String VMLibraryBlock_Libraries_cannot_be_empty__1;
public static String VMLibraryBlock_10;
public static String LibraryStandin_0;
+ public static String InstalledJREsBlock_15;
+ public static String JREsPreferencePage_2;
+ public static String JREsPreferencePage_1;
static {
// load message values from bundle file
Modified: trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/rubyvms/RubyVMMessages.properties
===================================================================
--- trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/rubyvms/RubyVMMessages.properties 2007-01-23 01:02:24 UTC (rev 1855)
+++ trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/rubyvms/RubyVMMessages.properties 2007-01-23 13:50:42 UTC (rev 1856)
@@ -1,4 +1,4 @@
-addVMDialog_pickJRERootDialog_message=Select the root directory of the Ruby installation:
+addVMDialog_pickJRERootDialog_message=Select the root directory of the Ruby installation:\n(For *nix systems, this may be /usr or /usr/local. If the ruby executable is in /usr/local/bin/ruby, use /usr/local).
addVMDialog_enterLocation=Enter the location of the Ruby VM.
addVMDialog_locationNotExists=The location does not exist.
@@ -15,6 +15,7 @@
InstalledJREsBlock_7=Add RubyVM
InstalledJREsBlock_8=Edit RubyVM
+InstalledJREsBlock_15=Installed &RubyVMs:
JREsUpdater_0=Save VM Definitions
@@ -23,5 +24,8 @@
VMLibraryBlock_6=Re&move
VMLibraryBlock_7=Add E&xternal Folders...
VMLibraryBlock_9=&Restore Default
+VMLibraryBlock_Libraries_cannot_be_empty__1=Libraries cannot be empty.
-LibraryStandin_0=System library does not exist: {0}
\ No newline at end of file
+LibraryStandin_0=System library does not exist: {0}
+
+JREsPreferencePage_2=Add, remove or edit Ruby VM definitions.\nBy default, the checked RubyVM is added to the build path of newly created Ruby projects.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-01-23 01:02:25
|
Revision: 1855
http://svn.sourceforge.net/rubyeclipse/?rev=1855&view=rev
Author: cawilliams
Date: 2007-01-22 17:02:24 -0800 (Mon, 22 Jan 2007)
Log Message:
-----------
add translation strings for open editor action
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui/plugin.properties
Modified: trunk/org.rubypeople.rdt.ui/plugin.properties
===================================================================
--- trunk/org.rubypeople.rdt.ui/plugin.properties 2007-01-23 01:01:55 UTC (rev 1854)
+++ trunk/org.rubypeople.rdt.ui/plugin.properties 2007-01-23 01:02:24 UTC (rev 1855)
@@ -123,6 +123,9 @@
ActionDefinition.foldingCollapseComments.name= Collapse Comments
ActionDefinition.foldingCollapseComments.description= Collapse all comments
+ActionDefinition.openEditor.name= Open Declaration
+ActionDefinition.openEditor.description= Open an editor on the selected element
+
scope.rubyEditor.name=Ruby Editor
scope.rubyEditor.description=Ruby Editor
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-01-23 01:01:56
|
Revision: 1854
http://svn.sourceforge.net/rubyeclipse/?rev=1854&view=rev
Author: cawilliams
Date: 2007-01-22 17:01:55 -0800 (Mon, 22 Jan 2007)
Log Message:
-----------
start moving towards searching loadpaths for stuff, not using that hack of linking core stubs inside a project
Added Paths:
-----------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/ExternalSourceFolderRoot.java
Added: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/ExternalSourceFolderRoot.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/ExternalSourceFolderRoot.java (rev 0)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/ExternalSourceFolderRoot.java 2007-01-23 01:01:55 UTC (rev 1854)
@@ -0,0 +1,51 @@
+package org.rubypeople.rdt.internal.core;
+
+import org.eclipse.core.runtime.IPath;
+import org.rubypeople.rdt.core.ISourceFolderRoot;
+
+public class ExternalSourceFolderRoot extends SourceFolderRoot implements
+ ISourceFolderRoot {
+
+ protected final IPath folderPath;
+
+ protected ExternalSourceFolderRoot(IPath resource,
+ RubyProject project) {
+ super(null, project);
+ this.folderPath = resource;
+ }
+
+ @Override
+ public IPath getPath() {
+ return folderPath;
+ }
+
+ @Override
+ public boolean isExternal() {
+ return true;
+ }
+
+ public int hashCode() {
+ return this.folderPath.hashCode();
+ }
+
+ @Override
+ public boolean isReadOnly() {
+ return true;
+ }
+
+ /**
+ * Returns true if this handle represents the same folder
+ * as the given handle.
+ *
+ * @see Object#equals
+ */
+ public boolean equals(Object o) {
+ if (this == o)
+ return true;
+ if (o instanceof ExternalSourceFolderRoot) {
+ ExternalSourceFolderRoot other= (ExternalSourceFolderRoot) o;
+ return this.folderPath.equals(other.folderPath);
+ }
+ return false;
+ }
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-01-23 01:00:34
|
Revision: 1853
http://svn.sourceforge.net/rubyeclipse/?rev=1853&view=rev
Author: cawilliams
Date: 2007-01-22 17:00:32 -0800 (Mon, 22 Jan 2007)
Log Message:
-----------
start moving towards searching loadpaths for stuff, not using that hack of linking core stubs inside a project
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/RubyElementRequestor.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyElement.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyProject.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/DefaultTypeInferrer.java
Removed Paths:
-------------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/ExternalPackageFragmentRoot.java
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/RubyElementRequestor.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/RubyElementRequestor.java 2007-01-22 23:58:42 UTC (rev 1852)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/RubyElementRequestor.java 2007-01-23 01:00:32 UTC (rev 1853)
@@ -1,16 +1,7 @@
package org.rubypeople.rdt.internal.codeassist;
-import java.io.File;
-
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourceAttributes;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
import org.rubypeople.rdt.core.IRubyProject;
import org.rubypeople.rdt.core.IType;
-import org.rubypeople.rdt.core.RubyCore;
import org.rubypeople.rdt.core.RubyModelException;
public class RubyElementRequestor {
@@ -19,43 +10,10 @@
public RubyElementRequestor(IRubyProject[] projects) {
this.projects = projects;
- // Get path of folder containing ruby core stubs
- String rootDirName = RubyCore.getOSDirectory(RubyCore.getPlugin());
- String dirName = rootDirName
- + "ruby/lib";
+ }
- File rubyfolder = new File(dirName);
- IPath projectPath = new Path(rubyfolder.getAbsolutePath());
- // XXX This is still a big hack. We're adding the ruby core library on demand. We need to add it when the project is created (and/ore interpreter is installed)
- IFolder folder = projects[0].getProject().getFolder("ruby_core");
- if (!folder.exists()) {
- try {
- folder.createLink(projectPath, IResource.ALLOW_MISSING_LOCAL, null);
- } catch (CoreException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- // Hide ruby_core resource folder
- try {
- ResourceAttributes ra = folder.getResourceAttributes();
- if ( ra != null ) {
-
- //TODO: Doesn't hide & make readonly for some reason?
- ra.setHidden(true);
- ra.setReadOnly(true);
-
- folder.setResourceAttributes(ra);
-
- // Mark ruby_core as derived to keep out of source control
- folder.setDerived(true);
- }
- } catch (CoreException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
+ public RubyElementRequestor(IRubyProject rubyProject) {
+ this(new IRubyProject[] {rubyProject});
}
public IType findType(String typeName) {
Deleted: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/ExternalPackageFragmentRoot.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/ExternalPackageFragmentRoot.java 2007-01-22 23:58:42 UTC (rev 1852)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/ExternalPackageFragmentRoot.java 2007-01-23 01:00:32 UTC (rev 1853)
@@ -1,18 +0,0 @@
-package org.rubypeople.rdt.internal.core;
-
-import org.eclipse.core.runtime.IPath;
-import org.rubypeople.rdt.core.ISourceFolderRoot;
-
-public class ExternalPackageFragmentRoot extends SourceFolderRoot implements
- ISourceFolderRoot {
-
- protected ExternalPackageFragmentRoot(IPath resource,
- RubyProject project) {
- super(null, project);
- }
-
- @Override
- public boolean isExternal() {
- return true;
- }
-}
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyElement.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyElement.java 2007-01-22 23:58:42 UTC (rev 1852)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyElement.java 2007-01-23 01:00:32 UTC (rev 1853)
@@ -26,6 +26,7 @@
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.List;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
@@ -211,10 +212,10 @@
*
* @param type - one of the type constants defined by RubyElement
*/
- public ArrayList getChildrenOfType(int type) throws RubyModelException {
+ public ArrayList<IRubyElement> getChildrenOfType(int type) throws RubyModelException {
IRubyElement[] children = getChildren();
int size = children.length;
- ArrayList list = new ArrayList(size);
+ ArrayList<IRubyElement> list = new ArrayList<IRubyElement>(size);
for (int i = 0; i < size; ++i) {
RubyElement elt = (RubyElement)children[i];
if (elt.getElementType() == type) {
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyProject.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyProject.java 2007-01-22 23:58:42 UTC (rev 1852)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyProject.java 2007-01-23 01:00:32 UTC (rev 1853)
@@ -70,7 +70,6 @@
public class RubyProject extends Openable implements IProjectNature, IRubyElement, IRubyProject {
protected IProject project;
- protected List loadPathEntries;
protected boolean scratched;
/**
@@ -379,17 +378,36 @@
*/
public IType findType(String fullyQualifiedName) {
int index = fullyQualifiedName.lastIndexOf("::");
- String className = null, packageName = null;
+ String className = null;
if (index == -1) {
- packageName = "";
className = fullyQualifiedName;
} else {
- packageName = fullyQualifiedName.substring(0, index);
className = fullyQualifiedName.substring(index + 2);
}
- // FIXME Handle the namespaces properly. we ignore them so far!
- return searchChildren(this, className);
+ // XXX Use the imports to search the path properly, then do an exhaustive search if that fails
+ IType child = searchChildren(this, className);
+ if (child != null) return child;
+ try {
+ ILoadpathEntry[] loadpaths = getResolvedLoadpath(true);
+ for (int i = 0; i < loadpaths.length; i++) {
+ ILoadpathEntry entry = loadpaths[i];
+ IPath path = entry.getPath();
+ SourceFolderRoot root = new ExternalSourceFolderRoot(path, this);
+ List<IRubyElement> childen = root.getChildrenOfType(IRubyElement.TYPE);
+ for (IRubyElement element : childen) {
+ if (element.isType(IRubyElement.TYPE)) {
+ IType aType = (IType) element;
+ if (aType.getElementName().equals(className)) {
+ return aType;
+ }
+ }
+ }
+ }
+ } catch (RubyModelException e) {
+ e.printStackTrace();
+ }
+ return null;
}
/**
@@ -578,7 +596,7 @@
} else {
// external target
if (RubyModel.isFile(target)) {
- root = new ExternalPackageFragmentRoot(entryPath, this);
+ root = new ExternalSourceFolderRoot(entryPath, this);
}
}
} else {
@@ -2045,7 +2063,7 @@
}
private ISourceFolderRoot getPackageFragmentRoot0(IPath path) {
- return new ExternalPackageFragmentRoot(path, this);
+ return new ExternalSourceFolderRoot(path, this);
}
/*
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/DefaultTypeInferrer.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/DefaultTypeInferrer.java 2007-01-22 23:58:42 UTC (rev 1852)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/DefaultTypeInferrer.java 2007-01-23 01:00:32 UTC (rev 1853)
@@ -26,284 +26,321 @@
import org.rubypeople.rdt.internal.ti.util.OffsetNodeLocator;
public class DefaultTypeInferrer implements ITypeInferrer {
-
+
private RootNode rootNode;
/**
* Infers type inside the source at given offset.
+ *
* @return List of ITypeGuess objects.
*/
public List<ITypeGuess> infer(String source, int offset) {
RubyParser parser = new RubyParser();
rootNode = (RootNode) parser.parse(source);
Node node = OffsetNodeLocator.Instance().getNodeAtOffset(rootNode.getBodyNode(), offset);
-
- if ( node == null )
- {
+
+ if (node == null) {
return null;
}
-
-// System.out.println("offset: " + offset + ": " + node.getClass().getName());
+ // System.out.println("offset: " + offset + ": " +
+ // node.getClass().getName());
+
return infer(node);
}
-
+
/**
* Infers the type of the specified node.
- * @param node Node to infer type of.
+ *
+ * @param node
+ * Node to infer type of.
* @return List of ITypeGuess objects.
*/
- private List<ITypeGuess> infer(Node node)
- {
+ private List<ITypeGuess> infer(Node node) {
List<ITypeGuess> guesses = new LinkedList<ITypeGuess>();
tryConstantNode(node, guesses);
tryAsgnNode(node, guesses);
-
- //todo: refactor these 3 by common features into 1 (or 1+3) method(s)
+
+ // todo: refactor these 3 by common features into 1 (or 1+3) method(s)
tryLocalVarNode(node, guesses);
tryInstVarNode(node, guesses);
tryGlobalVarNode(node, guesses);
-
+
tryWellKnownMethodCalls(node, guesses);
-
+
return guesses;
}
-
+
/**
* Infers type if node is a constant node; i.e. 5, 'foo', [1,2,3]
- * @param node Node to infer type of.
- * @param guesses List of ITypeGuess objects to insert guesses into.
+ *
+ * @param node
+ * Node to infer type of.
+ * @param guesses
+ * List of ITypeGuess objects to insert guesses into.
*/
- private void tryConstantNode(Node node, List<ITypeGuess>guesses)
- {
+ private void tryConstantNode(Node node, List<ITypeGuess> guesses) {
// Try seeing if the rvalue is a constant (5, "foo", [1,2,3], etc.)
- String concreteGuess = ConstNodeTypeNames.get(node.getClass().getSimpleName());
- if ( concreteGuess != null )
- {
- guesses.add( new BasicTypeGuess( concreteGuess, 100 ) );
+ String concreteGuess = ConstNodeTypeNames.get(node.getClass().getSimpleName());
+ if (concreteGuess != null) {
+ guesses.add(new BasicTypeGuess(concreteGuess, 100));
}
}
-
+
/**
- * Infers type if node is an assignment node; i.e. x = 5, @y = 'foo', $z = [1,2,3]
- * @param node Node to infer type of.
- * @param guesses List of ITypeGuess objects to insert guesses into.
+ * Infers type if node is an assignment node; i.e. x = 5,
+ *
+ * @y = 'foo', $z = [1,2,3]
+ * @param node
+ * Node to infer type of.
+ * @param guesses
+ * List of ITypeGuess objects to insert guesses into.
*/
- private void tryAsgnNode(Node node, List<ITypeGuess>guesses)
- {
+ private void tryAsgnNode(Node node, List<ITypeGuess> guesses) {
Node valueNode = null;
-
- if ( node instanceof LocalAsgnNode )
- {
- valueNode = ((LocalAsgnNode)node).getValueNode();
+
+ if (node instanceof LocalAsgnNode) {
+ valueNode = ((LocalAsgnNode) node).getValueNode();
}
- if ( node instanceof InstAsgnNode)
- {
- valueNode = ((InstAsgnNode)node).getValueNode();
+ if (node instanceof InstAsgnNode) {
+ valueNode = ((InstAsgnNode) node).getValueNode();
}
- if ( node instanceof GlobalAsgnNode)
- {
- valueNode = ((GlobalAsgnNode)node).getValueNode();
+ if (node instanceof GlobalAsgnNode) {
+ valueNode = ((GlobalAsgnNode) node).getValueNode();
}
- if ( valueNode != null )
- {
+ if (valueNode != null) {
guesses.addAll(infer(valueNode));
}
}
-
- private void tryInstVarNode(Node node, List<ITypeGuess> guesses)
- {
- if ( node instanceof InstVarNode )
- {
- final InstVarNode instVarNode = (InstVarNode)node;
+
+ private void tryInstVarNode(Node node, List<ITypeGuess> guesses) {
+ if (node instanceof InstVarNode) {
+ final InstVarNode instVarNode = (InstVarNode) node;
int nodeStart = node.getPosition().getStartOffset();
-
- //todo: see if there is attr_reader/attr_writer, maybe?
- //todo: find calls to the reader/writers
- //todo: for STI on InstVar, find references within this ClassNode to this InstVar... record 'em
-
- // Find first assignment to this var name that occurs before the reference
- //todo: This will find assignments in other local scopes that precede this reference but have the same variable name.
- // To mitigate, ensure that the closest spanning ScopeNode for both this LocalVarNode and the AsgnNode are the name ScopeNode.
- // Or scopingNode. Still not sure whether IterNodes count or not... silly block-local-var ambiguity ;)
- Node initialAssignmentNode = FirstPrecursorNodeLocator.Instance().findFirstPrecursor( rootNode, nodeStart, new INodeAcceptor(){
+
+ // todo: see if there is attr_reader/attr_writer, maybe?
+ // todo: find calls to the reader/writers
+ // todo: for STI on InstVar, find references within this ClassNode
+ // to this InstVar... record 'em
+
+ // Find first assignment to this var name that occurs before the
+ // reference
+ // todo: This will find assignments in other local scopes that
+ // precede this reference but have the same variable name.
+ // To mitigate, ensure that the closest spanning ScopeNode for both
+ // this LocalVarNode and the AsgnNode are the name ScopeNode.
+ // Or scopingNode. Still not sure whether IterNodes count or not...
+ // silly block-local-var ambiguity ;)
+ Node initialAssignmentNode = FirstPrecursorNodeLocator.Instance().findFirstPrecursor(rootNode, nodeStart, new INodeAcceptor() {
public boolean doesAccept(Node node) {
String name = null;
- if ( node instanceof LocalAsgnNode ) name = ((LocalAsgnNode)node).getName();
- if ( node instanceof InstAsgnNode ) name = ((InstAsgnNode)node).getName();
- if ( node instanceof GlobalAsgnNode ) name = ((GlobalAsgnNode)node).getName();
- return ( name != null && name.equals(instVarNode.getName())); /** refactor to common INodeAcceptor for instVarName,localVarName,globalVarName*/
+ if (node instanceof LocalAsgnNode)
+ name = ((LocalAsgnNode) node).getName();
+ if (node instanceof InstAsgnNode)
+ name = ((InstAsgnNode) node).getName();
+ if (node instanceof GlobalAsgnNode)
+ name = ((GlobalAsgnNode) node).getName();
+ return (name != null && name.equals(instVarNode.getName()));
+ /**
+ * refactor to common INodeAcceptor for
+ * instVarName,localVarName,globalVarName
+ */
}
});
- if ( initialAssignmentNode != null )
- {
+ if (initialAssignmentNode != null) {
tryAsgnNode(initialAssignmentNode, guesses);
}
}
}
-
- private void tryGlobalVarNode(Node node, List<ITypeGuess> guesses)
- {
- if ( node instanceof GlobalVarNode )
- {
- final GlobalVarNode globalVarNode = (GlobalVarNode)node;
+
+ private void tryGlobalVarNode(Node node, List<ITypeGuess> guesses) {
+ if (node instanceof GlobalVarNode) {
+ final GlobalVarNode globalVarNode = (GlobalVarNode) node;
int nodeStart = node.getPosition().getStartOffset();
-
- //todo: for STI on GlobalVar, find references within this ClassNode to this GlobalVar... record 'em
- //todo: p.s. globals are low-priority.
-
- // Find first assignment to this var name that occurs before the reference
- //todo: This will find assignments in other local scopes that precede this reference but have the same variable name.
- // To mitigate, ensure that the closest spanning ScopeNode for both this LocalVarNode and the AsgnNode are the name ScopeNode.
- // Or scopingNode. Still not sure whether IterNodes count or not... silly block-local-var ambiguity ;)
- Node initialAssignmentNode = FirstPrecursorNodeLocator.Instance().findFirstPrecursor( rootNode, nodeStart, new INodeAcceptor(){
+
+ // todo: for STI on GlobalVar, find references within this ClassNode
+ // to this GlobalVar... record 'em
+ // todo: p.s. globals are low-priority.
+
+ // Find first assignment to this var name that occurs before the
+ // reference
+ // todo: This will find assignments in other local scopes that
+ // precede this reference but have the same variable name.
+ // To mitigate, ensure that the closest spanning ScopeNode for both
+ // this LocalVarNode and the AsgnNode are the name ScopeNode.
+ // Or scopingNode. Still not sure whether IterNodes count or not...
+ // silly block-local-var ambiguity ;)
+ Node initialAssignmentNode = FirstPrecursorNodeLocator.Instance().findFirstPrecursor(rootNode, nodeStart, new INodeAcceptor() {
public boolean doesAccept(Node node) {
String name = null;
- if ( node instanceof LocalAsgnNode ) name = ((LocalAsgnNode)node).getName();
- if ( node instanceof InstAsgnNode ) name = ((InstAsgnNode)node).getName();
- if ( node instanceof GlobalAsgnNode ) name = ((GlobalAsgnNode)node).getName();
- return ( name != null && name.equals(globalVarNode.getName())); /** refactor to common INodeAcceptor for instVarName,localVarName,globalVarName*/
+ if (node instanceof LocalAsgnNode)
+ name = ((LocalAsgnNode) node).getName();
+ if (node instanceof InstAsgnNode)
+ name = ((InstAsgnNode) node).getName();
+ if (node instanceof GlobalAsgnNode)
+ name = ((GlobalAsgnNode) node).getName();
+ return (name != null && name.equals(globalVarNode.getName()));
+ /**
+ * refactor to common INodeAcceptor for
+ * instVarName,localVarName,globalVarName
+ */
}
});
- if ( initialAssignmentNode != null )
- {
+ if (initialAssignmentNode != null) {
tryAsgnNode(initialAssignmentNode, guesses);
}
}
}
-
- private void tryLocalVarNode(Node node, List<ITypeGuess> guesses)
- {
- //System.out.println(node.getClass().getName());
- if ( node instanceof LocalVarNode )
- {
- LocalVarNode localVarNode = (LocalVarNode)node;
+
+ private void tryLocalVarNode(Node node, List<ITypeGuess> guesses) {
+ // System.out.println(node.getClass().getName());
+ if (node instanceof LocalVarNode) {
+ LocalVarNode localVarNode = (LocalVarNode) node;
int nodeStart = node.getPosition().getStartOffset();
final String localVarName = TypeInferenceHelper.Instance().getVarName(localVarNode);
- // See if it has been assigned to, earlier [todo: in this local scope].
- // Find first assignment to this var name that occurs before the reference
- //todo: This will find assignments in other local scopes that precede this reference but have the same variable name.
- // To mitigate, ensure that the closest spanning ScopeNode for both this LocalVarNode and the AsgnNode are the name ScopeNode.
- // Or scopingNode. Still not sure whether IterNodes count or not... silly block-local-var ambiguity ;)
- Node initialAssignmentNode = FirstPrecursorNodeLocator.Instance().findFirstPrecursor( rootNode, nodeStart, new INodeAcceptor(){
+ // See if it has been assigned to, earlier [todo: in this local
+ // scope].
+ // Find first assignment to this var name that occurs before the
+ // reference
+ // todo: This will find assignments in other local scopes that
+ // precede this reference but have the same variable name.
+ // To mitigate, ensure that the closest spanning ScopeNode for both
+ // this LocalVarNode and the AsgnNode are the name ScopeNode.
+ // Or scopingNode. Still not sure whether IterNodes count or not...
+ // silly block-local-var ambiguity ;)
+ Node initialAssignmentNode = FirstPrecursorNodeLocator.Instance().findFirstPrecursor(rootNode, nodeStart, new INodeAcceptor() {
public boolean doesAccept(Node node) {
String name = null;
- if ( node instanceof LocalAsgnNode ) name = ((LocalAsgnNode)node).getName();
- if ( node instanceof InstAsgnNode ) name = ((InstAsgnNode)node).getName();
- if ( node instanceof GlobalAsgnNode ) name = ((GlobalAsgnNode)node).getName();
- return ( name != null && name.equals(localVarName));
+ if (node instanceof LocalAsgnNode)
+ name = ((LocalAsgnNode) node).getName();
+ if (node instanceof InstAsgnNode)
+ name = ((InstAsgnNode) node).getName();
+ if (node instanceof GlobalAsgnNode)
+ name = ((GlobalAsgnNode) node).getName();
+ return (name != null && name.equals(localVarName));
}
});
- if ( initialAssignmentNode != null )
- {
+ if (initialAssignmentNode != null) {
tryAsgnNode(initialAssignmentNode, guesses);
}
// See if it is a param into this scope
- ArgsNode argsNode = (ArgsNode)FirstPrecursorNodeLocator.Instance().findFirstPrecursor(rootNode, nodeStart, new INodeAcceptor(){
+ ArgsNode argsNode = (ArgsNode) FirstPrecursorNodeLocator.Instance().findFirstPrecursor(rootNode, nodeStart, new INodeAcceptor() {
public boolean doesAccept(Node node) {
- return ( (node instanceof ArgsNode) && (doesArgsNodeContainsVariable((ArgsNode)node, localVarName)));
+ return ((node instanceof ArgsNode) && (doesArgsNodeContainsVariable((ArgsNode) node, localVarName)));
}
});
// If so, find its enclosing method
- if ( argsNode != null )
- {
- int argNumber = getArgumentIndex(argsNode,localVarName);
- //System.out.println("Variable " + localVarName + " is the " + argNumber + "th argument to the enclosing method ");
-
+ if (argsNode != null) {
+ int argNumber = getArgumentIndex(argsNode, localVarName);
+ // System.out.println("Variable " + localVarName + " is the " +
+ // argNumber + "th argument to the enclosing method ");
+
// Find enclosing method
- Node defNode = FirstPrecursorNodeLocator.Instance().findFirstPrecursor(rootNode, nodeStart, new INodeAcceptor(){
+ Node defNode = FirstPrecursorNodeLocator.Instance().findFirstPrecursor(rootNode, nodeStart, new INodeAcceptor() {
public boolean doesAccept(Node node) {
- //System.out.println("Looking for enclosing method, checking: " + node.getClass().getName() + "[" + node.getPosition().getStartOffset() + ".." + node.getPosition().getEndOffset() + "]" );
+ // System.out.println("Looking for enclosing method,
+ // checking: " + node.getClass().getName() + "[" +
+ // node.getPosition().getStartOffset() + ".." +
+ // node.getPosition().getEndOffset() + "]" );
ArgsNode argsNode = null;
- if ( node instanceof DefnNode ) argsNode = ((DefnNode)node).getArgsNode();
- if ( node instanceof DefsNode ) argsNode = ((DefsNode)node).getArgsNode();
- return ( (argsNode != null) && (doesArgsNodeContainsVariable(argsNode, localVarName)));
+ if (node instanceof DefnNode)
+ argsNode = ((DefnNode) node).getArgsNode();
+ if (node instanceof DefsNode)
+ argsNode = ((DefsNode) node).getArgsNode();
+ return ((argsNode != null) && (doesArgsNodeContainsVariable(argsNode, localVarName)));
}
});
- if ( defNode != null )
- {
+ if (defNode != null) {
String methodName = null;
- if ( defNode instanceof DefnNode ) methodName = ((DefnNode)defNode).getName();
- if ( defNode instanceof DefsNode ) methodName = ((DefsNode)defNode).getName();
+ if (defNode instanceof DefnNode)
+ methodName = ((DefnNode) defNode).getName();
+ if (defNode instanceof DefsNode)
+ methodName = ((DefsNode) defNode).getName();
- //System.out.println("Variable " + localVarName + " is the " + argNumber + "th argument to method " + methodName );
-
+ // System.out.println("Variable " + localVarName + " is the
+ // " + argNumber + "th argument to method " + methodName );
+
// Find all invocations of the surrounding method.
- //todo: from easiest to hardest:
- // It may be a global function, where simply a CallNode where method name must be matched.
- // It may be a DefsNode static class method, where a CallNode whose receiverNode is a ConstNode whose name is the surrounding class
- // It may be an DefnNode method defined in a class, where a CallNode whose receiverNode must be type-matched to the surrounding class
-
+ // todo: from easiest to hardest:
+ // It may be a global function, where simply a CallNode
+ // where method name must be matched.
+ // It may be a DefsNode static class method, where a
+ // CallNode whose receiverNode is a ConstNode whose name is
+ // the surrounding class
+ // It may be an DefnNode method defined in a class, where a
+ // CallNode whose receiverNode must be type-matched to the
+ // surrounding class
+
}
}
}
}
-
- private void tryWellKnownMethodCalls(Node node, List<ITypeGuess> guesses)
- {
- if ( node instanceof CallNode )
- {
- CallNode callNode = (CallNode)node;
-
+
+ private void tryWellKnownMethodCalls(Node node, List<ITypeGuess> guesses) {
+ if (node instanceof CallNode) {
+ CallNode callNode = (CallNode) node;
+
String method = callNode.getName();
- if ( method.equals("new") && callNode.getReceiverNode() instanceof ConstNode)
- {
- guesses.add( new BasicTypeGuess( ((ConstNode)callNode.getReceiverNode()).getName() , 100 ) );
- }
- else
- {
-//todo: this NEEDS to be done with a multimap and various confidences for each. i.e. X.slice, X is 50/50 Array or String
+ if (method.equals("new") && callNode.getReceiverNode() instanceof ConstNode) {
+ guesses.add(new BasicTypeGuess(((ConstNode) callNode.getReceiverNode()).getName(), 100));
+ } else {
+ // todo: this NEEDS to be done with a multimap and various
+ // confidences for each. i.e. X.slice, X is 50/50 Array or
+ // String
String methodReturnTypeGuess = TypicalMethodReturnNames.get(method);
- if ( methodReturnTypeGuess != null )
- {
- guesses.add( new BasicTypeGuess( methodReturnTypeGuess, 100 ) );
+ if (methodReturnTypeGuess != null) {
+ guesses.add(new BasicTypeGuess(methodReturnTypeGuess, 100));
}
}
}
}
-
/**
* Determine whether an ArgsNode contains a particular named argument
- * @param argsNode ArgsNode to search
- * @param argName Name of argument to find
+ *
+ * @param argsNode
+ * ArgsNode to search
+ * @param argName
+ * Name of argument to find
* @return
*/
- private boolean doesArgsNodeContainsVariable(ArgsNode argsNode, String argName)
- {
+ private boolean doesArgsNodeContainsVariable(ArgsNode argsNode, String argName) {
return getArgumentIndex(argsNode, argName) >= 0;
}
-
+
/**
- * Finds the index of an argument in an ArgsNode by name, -1 if it is not contained.
- * @param argsNode ArgsNode to search
- * @param argName Name of argument to find
+ * Finds the index of an argument in an ArgsNode by name, -1 if it is not
+ * contained.
+ *
+ * @param argsNode
+ * ArgsNode to search
+ * @param argName
+ * Name of argument to find
* @return Index of argName in argsNode or -1 if it is not there.
*/
- private int getArgumentIndex(ArgsNode argsNode, String argName)
- {
+ private int getArgumentIndex(ArgsNode argsNode, String argName) {
int argNumber = 0;
- for ( Iterator iter = argsNode.getArgs().iterator(); iter.hasNext();) {
- if (((ArgumentNode)iter.next()).getName().equals(argName)) { break; }
+ for (Iterator iter = argsNode.getArgs().iterator(); iter.hasNext();) {
+ if (((ArgumentNode) iter.next()).getName().equals(argName)) {
+ break;
+ }
argNumber++;
}
- if ( argNumber == argsNode.getArgsCount() )
- {
+ if (argNumber == argsNode.getArgsCount()) {
return -1;
}
return argNumber;
}
-
-
+
public static void main(String[] args) {
ITypeInferrer dti = new DefaultTypeInferrer();
- List<ITypeGuess> guesses = dti.infer("'string'",3);
-
+ List<ITypeGuess> guesses = dti.infer("'string'", 3);
+
for (ITypeGuess guess : guesses) {
- System.out.println("Type guess: " + guess.getType() + ", " + guess.getConfidence() + "%" );
+ System.out.println("Type guess: " + guess.getType() + ", " + guess.getConfidence() + "%");
}
-
+
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-01-22 23:58:43
|
Revision: 1852
http://svn.sourceforge.net/rubyeclipse/?rev=1852&view=rev
Author: cawilliams
Date: 2007-01-22 15:58:42 -0800 (Mon, 22 Jan 2007)
Log Message:
-----------
pipes ('|') are a word boundary
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/RubyWordFinder.java
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/RubyWordFinder.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/RubyWordFinder.java 2007-01-22 21:41:36 UTC (rev 1851)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/RubyWordFinder.java 2007-01-22 23:58:42 UTC (rev 1852)
@@ -21,7 +21,7 @@
* are what break up the tokens for double-clicking and for hovers.
*/
private static final char[] BOUNDARIES = { ' ', '\n', '\t', '\r', '.', '(', ')', '{', '}', '[',
- ']', '=', '*', '+', '-', '"', '\'', '#', ','};
+ ']', '=', '*', '+', '-', '"', '\'', '#', ',', '|'};
public static IRegion findWord(IDocument document, int offset) {
int start = -1;
int end = -1;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-01-22 21:41:37
|
Revision: 1851
http://svn.sourceforge.net/rubyeclipse/?rev=1851&view=rev
Author: cawilliams
Date: 2007-01-22 13:41:36 -0800 (Mon, 22 Jan 2007)
Log Message:
-----------
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/RubyUIMessages.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/RubyUIMessages.properties
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/RubyUIMessages.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/RubyUIMessages.java 2007-01-22 21:18:52 UTC (rev 1850)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/RubyUIMessages.java 2007-01-22 21:41:36 UTC (rev 1851)
@@ -28,8 +28,6 @@
public static String TypeSelectionDialog_errorTitle;
public static String TypeSelectionDialog_dialogMessage;
public static String RubyElementLabels_default_package;
-
-
public static String RdtUiPlugin_internalErrorOccurred;
public static String RubyProjectLibraryPage_project;
public static String RubyProjectLibraryPage_elementNotIProject;
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/RubyUIMessages.properties
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/RubyUIMessages.properties 2007-01-22 21:18:52 UTC (rev 1850)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/RubyUIMessages.properties 2007-01-22 21:41:36 UTC (rev 1851)
@@ -23,10 +23,12 @@
RubyBasePreferencePage_label=General Properties
RubyProjectPropertyPage_rubyProjectClosed=The project selected is a Ruby project, but is closed.
-RubyProjectPropertyPage_performOkExceptionDialogTitle=Unable to save
+RubyProjectPropertyPage_performOkException=Unable to save
RubyProjectPropertyPage_performOkExceptionDialogMessage=ERROR: Unable to save project properties.
FoldingConfigurationBlock_info_no_preferences= The selected folding provider did not provide a preference control
+FoldingConfigurationBlock_error_not_exist= The selected folding provider does not exist
+
#########################################
# Various Dialogs
#########################################
@@ -82,6 +84,8 @@
#########
# misc
#########
+OptionalMessageDialog_dontShowAgain= Do not show this message again
+
RubyAnnotationHover_multipleMarkersAtThisLine=Multiple markers at this line
HTMLTextPresenter_ellipsis=...
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-01-22 21:18:54
|
Revision: 1850
http://svn.sourceforge.net/rubyeclipse/?rev=1850&view=rev
Author: cawilliams
Date: 2007-01-22 13:18:52 -0800 (Mon, 22 Jan 2007)
Log Message:
-----------
try to move us towards using only subclasses of NLS for translations - so we get accurate information on what strings are missing and what are unused.
Modified Paths:
--------------
trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/ui/CompareResultsAction.java
trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/ui/CopyTraceAction.java
trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/ui/CounterPanel.java
trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/ui/FailureTab.java
trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/ui/FailureTrace.java
trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/ui/OpenEditorAtLineAction.java
trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/ui/OpenSymbolAction.java
trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/ui/RerunAction.java
trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/ui/ScrollLockAction.java
trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/ui/TestHierarchyTab.java
trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/ui/TestUnitMessages.java
trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/ui/TestUnitMessages.properties
trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/ui/TestUnitView.java
trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/testunit/launcher/RubyClassSelector.java
trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/testunit/launcher/TestUnitLaunchShortcut.java
trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/testunit/launcher/TestUnitMainTab.java
Modified: trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/ui/CompareResultsAction.java
===================================================================
--- trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/ui/CompareResultsAction.java 2007-01-22 21:00:44 UTC (rev 1849)
+++ trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/ui/CompareResultsAction.java 2007-01-22 21:18:52 UTC (rev 1850)
@@ -19,9 +19,9 @@
public CompareResultsAction(FailureTrace view) {
- super(TestUnitMessages.getString("CompareResultsAction.label")); //$NON-NLS-1$
- setDescription(TestUnitMessages.getString("CompareResultsAction.description")); //$NON-NLS-1$
- setToolTipText(TestUnitMessages.getString("CompareResultsAction.tooltip")); //$NON-NLS-1$
+ super(TestUnitMessages.CompareResultsAction_label);
+ setDescription(TestUnitMessages.CompareResultsAction_description);
+ setToolTipText(TestUnitMessages.CompareResultsAction_tooltip);
setDisabledImageDescriptor(TestunitPlugin.getImageDescriptor("dlcl16/compare.gif")); //$NON-NLS-1$
setHoverImageDescriptor(TestunitPlugin.getImageDescriptor("elcl16/compare.gif")); //$NON-NLS-1$
Modified: trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/ui/CopyTraceAction.java
===================================================================
--- trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/ui/CopyTraceAction.java 2007-01-22 21:00:44 UTC (rev 1849)
+++ trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/ui/CopyTraceAction.java 2007-01-22 21:18:52 UTC (rev 1850)
@@ -38,7 +38,7 @@
* Constructor for CopyTraceAction.
*/
public CopyTraceAction(FailureTrace view, Clipboard clipboard) {
- super(TestUnitMessages.getString("CopyTrace.action.label")); //$NON-NLS-1$
+ super(TestUnitMessages.CopyTrace_action_label);
Assert.isNotNull(clipboard);
// TODO Show help!
//WorkbenchHelp.setHelp(this, ITestUnitHelpContextIds.COPYTRACE_ACTION);
@@ -62,7 +62,7 @@
} catch (SWTError e){
if (e.code != DND.ERROR_CANNOT_SET_CLIPBOARD)
throw e;
- if (MessageDialog.openQuestion(fView.getComposite().getShell(), TestUnitMessages.getString("CopyTraceAction.problem"), TestUnitMessages.getString("CopyTraceAction.clipboard_busy"))) //$NON-NLS-1$ //$NON-NLS-2$
+ if (MessageDialog.openQuestion(fView.getComposite().getShell(), TestUnitMessages.CopyTraceAction_problem, TestUnitMessages.CopyTraceAction_clipboard_busy))
run();
}
}
Modified: trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/ui/CounterPanel.java
===================================================================
--- trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/ui/CounterPanel.java 2007-01-22 21:00:44 UTC (rev 1849)
+++ trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/ui/CounterPanel.java 2007-01-22 21:18:52 UTC (rev 1850)
@@ -42,9 +42,9 @@
gridLayout.marginWidth= 0;
setLayout(gridLayout);
- fNumberOfRuns= createLabel(TestUnitMessages.getString("CounterPanel.label.runs"), null, " 0/0 "); //$NON-NLS-1$ //$NON-NLS-2$
- fNumberOfErrors= createLabel(TestUnitMessages.getString("CounterPanel.label.errors"), fErrorIcon, " 0 "); //$NON-NLS-1$ //$NON-NLS-2$
- fNumberOfFailures= createLabel(TestUnitMessages.getString("CounterPanel.label.failures"), fFailureIcon, " 0 "); //$NON-NLS-1$ //$NON-NLS-2$
+ fNumberOfRuns= createLabel(TestUnitMessages.CounterPanel_label_runs, null, " 0/0 "); //$NON-NLS-1$
+ fNumberOfErrors= createLabel(TestUnitMessages.CounterPanel_label_errors, fErrorIcon, " 0 "); //$NON-NLS-1$
+ fNumberOfFailures= createLabel(TestUnitMessages.CounterPanel_label_failures, fFailureIcon, " 0 "); //$NON-NLS-1$
addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposeEvent e) {
@@ -95,7 +95,7 @@
}
public void setRunValue(int value) {
- String runString= TestUnitMessages.getFormattedString("CounterPanel.runcount", new String[] { Integer.toString(value), Integer.toString(fTotal) }); //$NON-NLS-1$
+ String runString= TestUnitMessages.getFormattedString(TestUnitMessages.CounterPanel_runcount, new String[] { Integer.toString(value), Integer.toString(fTotal) });
fNumberOfRuns.setText(runString);
fNumberOfRuns.redraw();
Modified: trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/ui/FailureTab.java
===================================================================
--- trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/ui/FailureTab.java 2007-01-22 21:00:44 UTC (rev 1849)
+++ trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/ui/FailureTab.java 2007-01-22 21:18:52 UTC (rev 1850)
@@ -82,7 +82,7 @@
fTable.setLayoutData(gridData);
failureTab.setControl(composite);
- failureTab.setToolTipText(TestUnitMessages.getString("FailureRunView.tab.tooltip")); //$NON-NLS-1$
+ failureTab.setToolTipText(TestUnitMessages.FailureRunView_tab_tooltip);
initMenu();
addListeners();
@@ -103,7 +103,7 @@
}
public String getName() {
- return TestUnitMessages.getString("FailureRunView.tab.title"); //$NON-NLS-1$
+ return TestUnitMessages.FailureRunView_tab_title;
}
public String getSelectedTestId() {
@@ -207,7 +207,7 @@
}
private void updateTableItem(TestRunInfo testInfo, TableItem tableItem) {
- String label = TestUnitMessages.getFormattedString("FailureRunView.labelfmt", new String[] { testInfo.getTestMethodName(), testInfo.getClassName()}); //$NON-NLS-1$
+ String label = TestUnitMessages.getFormattedString(TestUnitMessages.FailureRunView_labelfmt, new String[] { testInfo.getTestMethodName(), testInfo.getClassName()});
tableItem.setText(label);
if (testInfo.getStatus() == ITestRunListener.STATUS_FAILURE)
tableItem.setImage(fFailureIcon);
Modified: trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/ui/FailureTrace.java
===================================================================
--- trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/ui/FailureTrace.java 2007-01-22 21:00:44 UTC (rev 1849)
+++ trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/ui/FailureTrace.java 2007-01-22 21:18:52 UTC (rev 1850)
@@ -251,7 +251,7 @@
private final StackTraceLine trace;
public OpenEditorAction(StackTraceLine trace) {
- super(TestUnitMessages.getString("OpenEditor.action.label"));
+ super(TestUnitMessages.OpenEditor_action_label);
this.trace = trace;
}
Modified: trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/ui/OpenEditorAtLineAction.java
===================================================================
--- trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/ui/OpenEditorAtLineAction.java 2007-01-22 21:00:44 UTC (rev 1849)
+++ trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/ui/OpenEditorAtLineAction.java 2007-01-22 21:18:52 UTC (rev 1850)
@@ -46,7 +46,7 @@
* Constructor for OpenEditorAtLineAction.
*/
public OpenEditorAtLineAction(TestUnitView testRunner, String fileName, int line) {
- super(TestUnitMessages.getString("OpenEditorAction.action.label"));
+ super(TestUnitMessages.OpenEditorAction_action_label);
// TODO Uncomment and fix!
// WorkbenchHelp.setHelp(this,
// IJUnitHelpContextIds.OPENEDITORATLINE_ACTION);
Modified: trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/ui/OpenSymbolAction.java
===================================================================
--- trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/ui/OpenSymbolAction.java 2007-01-22 21:00:44 UTC (rev 1849)
+++ trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/ui/OpenSymbolAction.java 2007-01-22 21:18:52 UTC (rev 1850)
@@ -36,7 +36,7 @@
}
public OpenSymbolAction(Symbol symbol, ISymbolFinder finder, Shell shell, String title) {
- super(TestUnitMessages.getString("OpenEditor.action.label"));
+ super(TestUnitMessages.OpenEditor_action_label);
this.shell = shell;
this.symbol = symbol;
this.finder = finder;
Modified: trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/ui/RerunAction.java
===================================================================
--- trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/ui/RerunAction.java 2007-01-22 21:00:44 UTC (rev 1849)
+++ trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/ui/RerunAction.java 2007-01-22 21:18:52 UTC (rev 1850)
@@ -29,9 +29,9 @@
public RerunAction(TestUnitView runner, String testId, String className, String testName, String launchMode) {
super();
if (launchMode.equals(ILaunchManager.RUN_MODE))
- setText(TestUnitMessages.getString("RerunAction.label.run")); //$NON-NLS-1$
+ setText(TestUnitMessages.RerunAction_label_run);
else if (launchMode.equals(ILaunchManager.DEBUG_MODE))
- setText(TestUnitMessages.getString("RerunAction.label.debug")); //$NON-NLS-1$
+ setText(TestUnitMessages.RerunAction_label_debug);
// TODO Re-enable help text
//WorkbenchHelp.setHelp(this, ITestUnitHelpContextIds.RERUN_ACTION);
fTestRunner= runner;
Modified: trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/ui/ScrollLockAction.java
===================================================================
--- trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/ui/ScrollLockAction.java 2007-01-22 21:00:44 UTC (rev 1849)
+++ trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/ui/ScrollLockAction.java 2007-01-22 21:18:52 UTC (rev 1850)
@@ -20,9 +20,9 @@
private TestUnitView fRunnerViewPart;
public ScrollLockAction(TestUnitView viewer) {
- super(TestUnitMessages.getString("ScrollLockAction.action.label")); //$NON-NLS-1$
+ super(TestUnitMessages.ScrollLockAction_action_label);
fRunnerViewPart = viewer;
- setToolTipText(TestUnitMessages.getString("ScrollLockAction.action.tooltip")); //$NON-NLS-1$
+ setToolTipText(TestUnitMessages.ScrollLockAction_action_tooltip);
setDisabledImageDescriptor(TestunitPlugin.getImageDescriptor("dlcl16/lock.gif")); //$NON-NLS-1$
setHoverImageDescriptor(TestunitPlugin.getImageDescriptor("elcl16/lock.gif")); //$NON-NLS-1$
setImageDescriptor(TestunitPlugin.getImageDescriptor("elcl16/lock.gif")); //$NON-NLS-1$
Modified: trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/ui/TestHierarchyTab.java
===================================================================
--- trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/ui/TestHierarchyTab.java 2007-01-22 21:00:44 UTC (rev 1849)
+++ trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/ui/TestHierarchyTab.java 2007-01-22 21:18:52 UTC (rev 1850)
@@ -103,8 +103,8 @@
private class ExpandAllAction extends Action {
public ExpandAllAction() {
- setText(TestUnitMessages.getString("ExpandAllAction.text")); //$NON-NLS-1$
- setToolTipText(TestUnitMessages.getString("ExpandAllAction.tooltip")); //$NON-NLS-1$
+ setText(TestUnitMessages.ExpandAllAction_text);
+ setToolTipText(TestUnitMessages.ExpandAllAction_tooltip);
}
public void run() {
@@ -131,7 +131,7 @@
testTreePanel.setLayoutData(gridData);
hierarchyTab.setControl(testTreePanel);
- hierarchyTab.setToolTipText(TestUnitMessages.getString("HierarchyRunView.tab.tooltip")); //$NON-NLS-1$
+ hierarchyTab.setToolTipText(TestUnitMessages.HierarchyRunView_tab_tooltip);
fTree = new Tree(testTreePanel, SWT.V_SCROLL | SWT.SINGLE);
gridData = new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL);
@@ -189,7 +189,7 @@
}
public String getName() {
- return TestUnitMessages.getString("HierarchyRunView.tab.title"); //$NON-NLS-1$
+ return TestUnitMessages.HierarchyRunView_tab_title;
}
public void setSelectedTest(String testId) {
Modified: trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/ui/TestUnitMessages.java
===================================================================
--- trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/ui/TestUnitMessages.java 2007-01-22 21:00:44 UTC (rev 1849)
+++ trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/ui/TestUnitMessages.java 2007-01-22 21:18:52 UTC (rev 1850)
@@ -1,39 +1,86 @@
package org.rubypeople.rdt.internal.testunit.ui;
import java.text.MessageFormat;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
+import org.eclipse.osgi.util.NLS;
+
public class TestUnitMessages {
private static final String BUNDLE_NAME= "org.rubypeople.rdt.internal.testunit.ui.TestUnitMessages"; //$NON-NLS-1$
+
+ private TestUnitMessages() {}
+
+ public static String LaunchConfigurationTab_RubyEntryPoint_allTestCases;
+ public static String LaunchConfigurationTab_RubyEntryPoint_classSelectorMessage;
+ public static String LaunchConfigurationTab_RubyEntryPoint_classLabel;
+ public static String CompareResultsAction_label;
+ public static String CompareResultsAction_description;
+ public static String CompareResultsAction_tooltip;
+ public static String CopyTrace_action_label;
+ public static String CopyTraceAction_problem;
+ public static String CopyTraceAction_clipboard_busy;
+ public static String CounterPanel_label_runs;
+ public static String CounterPanel_label_errors;
+ public static String CounterPanel_label_failures;
+ public static String FailureRunView_tab_tooltip;
+ public static String FailureRunView_tab_title;
+ public static String OpenEditor_action_label;
+ public static String OpenEditorAction_action_label;
+ public static String RerunAction_label_debug;
+ public static String RerunAction_label_run;
+ public static String TestRunnerViewPart_label_failure;
+ public static String TestRunnerViewPart_error_cannotrerun;
+ public static String TestRunnerViewPart_cannotrerun_title;
+ public static String TestRunnerViewPart_cannotrerurn_message;
+ public static String TestRunnerViewPart_message_launching;
+ public static String TestRunnerViewPart_message_stopped;
+ public static String TestRunnerViewPart_message_terminated;
+ public static String TestRunnerViewPart_jobName;
+ public static String TestRunnerViewPart_terminate_title;
+ public static String TestRunnerViewPart_terminate_message;
+ public static String TestRunnerViewPart_rerunaction_label;
+ public static String TestRunnerViewPart_rerunaction_tooltip;
+ public static String LaunchTestAction_message_selectConfiguration;
+ public static String LaunchTestAction_message_selectDebugConfiguration;
+ public static String LaunchTestAction_message_selectRunConfiguration;
+ public static String Dialog_launchWithoutSelectedInterpreter_title;
+ public static String Dialog_launchWithoutSelectedInterpreter;
+ public static String LaunchConfigurationTab_RubyEntryPoint_allTestMethods;
+ public static String LaunchConfigurationTab_RubyEntryPoint_methodLabel;
+ public static String JUnitMainTab_tab_label;
+ public static String ExpandAllAction_text;
+ public static String ExpandAllAction_tooltip;
+ public static String HierarchyRunView_tab_tooltip;
+ public static String HierarchyRunView_tab_title;
+ public static String ScrollLockAction_action_label;
+ public static String ScrollLockAction_action_tooltip;
+ public static String RubyClassSelector_Title;
+ public static String CounterPanel_runcount;
+ public static String FailureRunView_labelfmt;
+ public static String TestRunnerViewPart_message_error;
+ public static String TestRunnerViewPart_message_failure;
+ public static String TestRunnerViewPart_message_success;
+ public static String TestRunnerViewPart_message_finish;
+ public static String TestRunnerViewPart_message_started;
+ public static String TestRunnerViewPart_configName;
- private static final ResourceBundle RESOURCE_BUNDLE= ResourceBundle.getBundle(BUNDLE_NAME);
-
- private TestUnitMessages() {
+ static {
+ NLS.initializeMessages(BUNDLE_NAME, TestUnitMessages.class);
}
-
+
/**
* Gets a string from the resource bundle and formats it with the argument
*
* @param key the string used to get the bundle value, must not be null
*/
public static String getFormattedString(String key, Object arg) {
- return MessageFormat.format(getString(key), new Object[] { arg });
+ return MessageFormat.format(key, new Object[] { arg });
}
/**
* Gets a string from the resource bundle and formats it with arguments
*/
public static String getFormattedString(String key, Object[] args) {
- return MessageFormat.format(getString(key), args);
+ return MessageFormat.format(key, args);
}
-
- public static String getString(String key) {
- try {
- return RESOURCE_BUNDLE.getString(key);
- } catch (MissingResourceException e) {
- return '!' + key + '!';
- }
- }
}
Modified: trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/ui/TestUnitMessages.properties
===================================================================
--- trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/ui/TestUnitMessages.properties 2007-01-22 21:00:44 UTC (rev 1849)
+++ trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/ui/TestUnitMessages.properties 2007-01-22 21:18:52 UTC (rev 1850)
@@ -1,162 +1,162 @@
-OpenEditor.action.label=Open
+OpenEditor_action_label=Open
-CopyTrace.action.label=Copy Trace
-CopyTraceAction.problem=Problem Copying to Clipboard
-CopyTraceAction.clipboard_busy=There was a problem when accessing the system clipboard. Retry?
+CopyTrace_action_label=Copy Trace
+CopyTraceAction_problem=Problem Copying to Clipboard
+CopyTraceAction_clipboard_busy=There was a problem when accessing the system clipboard. Retry?
-CopyFailureList.action.label=Copy Failure List
-CopyFailureList.problem=Problem Copying Failure List to Clipboard
-CopyFailureList.clipboard_busy=There was a problem when accessing the system clipboard. Retry?
+CopyFailureList_action_label=Copy Failure List
+CopyFailureList_problem=Problem Copying Failure List to Clipboard
+CopyFailureList_clipboard_busy=There was a problem when accessing the system clipboard. Retry?
-CounterPanel.label.runs=Runs:
-CounterPanel.label.errors=Errors:
-CounterPanel.label.failures=Failures:
-CounterPanel.runcount= {0}/{1}
+CounterPanel_label_runs=Runs:
+CounterPanel_label_errors=Errors:
+CounterPanel_label_failures=Failures:
+CounterPanel_runcount= {0}/{1}
-FailureRunView.tab.tooltip=Failures and Errors
-FailureRunView.tab.title=Failures
-FailureRunView.labelfmt= {0} - {1}
+FailureRunView_tab_tooltip=Failures and Errors
+FailureRunView_tab_title=Failures
+FailureRunView_labelfmt= {0} - {1}
-HierarchyRunView.tab.tooltip=Test Hierarchy
-HierarchyRunView.tab.title=Hierarchy
+HierarchyRunView_tab_tooltip=Test Hierarchy
+HierarchyRunView_tab_title=Hierarchy
-JUnitPlugin.error.cannotshow=Could not show JUnit Result View
-JUnitPlugin.searching=Searching
+JUnitPlugin_error_cannotshow=Could not show JUnit Result View
+JUnitPlugin_searching=Searching
-JUnitPreferencePage.description=JUnit settings:
-JUnitPreferencePage.addfilterbutton.label=Add &Filter
-JUnitPreferencePage.addfilterbutton.tooltip=Type the Name of a New Stack Filter
-JUnitPreferencePage.addtypebutton.label=Add &Class...
-JUnitPreferencePage.addtypebutton.tooltip=Choose a Java Type and Add It to Stack Filters
-JUnitPreferencePage.addpackagebutton.label=Add &Packages...
-JUnitPreferencePage.addpackagebutton.tooltip=Choose Package(s) to Add to Stack Filters
-JUnitPreferencePage.removefilterbutton.label=&Remove
-JUnitPreferencePage.removefilterbutton.tooltip=Remove All Selected Stack Filters
-JUnitPreferencePage.enableallbutton.label=&Enable All
-JUnitPreferencePage.enableallbutton.tooltip=Enables All Stack Filters
-JUnitPreferencePage.disableallbutton.label=Disa&ble All
-JUnitPreferencePage.disableallbutton.tooltip=Disables All Stack Filters
-JUnitPreferencePage.filter.label=&Stack trace filter patterns (changes only apply to new test runs):
-JUnitPreferencePage.adddialog.title=Add Stack Filter Pattern
-JUnitPreferencePage.addialog.prompt=Enter Filter Pattern:
-JUnitPreferencePage.showcheck.label=Show the JUnit results &view only when an error or failure occurs
-JUnitPreferencePage.invalidstepfilterreturnescape=Invalid stack filter. Press Enter to continue editing or Escape to cancel.
-JUnitPreferencePage.addtypedialog.title=Add Class to Stack Filters
-JUnitPreferencePage.addtypedialog.message=&Select a class to filter in the failure stack trace.
-JUnitPreferencePage.addtypedialog.error.message=Could not open type selection dialog for stack filters.
-JUnitPreferencePage.addpackagedialog.title=Add Packages to Stack Filters
-JUnitPreferencePage.addpackagedialog.message=&Select a package to filter in the failure stack trace.
-JUnitPreferencePage.addpackagedialog.error.message=Could not open package selection dialog for stack filters.
+JUnitPreferencePage_description=JUnit settings:
+JUnitPreferencePage_addfilterbutton_label=Add &Filter
+JUnitPreferencePage_addfilterbutton_tooltip=Type the Name of a New Stack Filter
+JUnitPreferencePage_addtypebutton_label=Add &Class...
+JUnitPreferencePage_addtypebutton_tooltip=Choose a Java Type and Add It to Stack Filters
+JUnitPreferencePage_addpackagebutton_label=Add &Packages...
+JUnitPreferencePage_addpackagebutton_tooltip=Choose Package(s) to Add to Stack Filters
+JUnitPreferencePage_removefilterbutton_label=&Remove
+JUnitPreferencePage_removefilterbutton_tooltip=Remove All Selected Stack Filters
+JUnitPreferencePage_enableallbutton_label=&Enable All
+JUnitPreferencePage_enableallbutton_tooltip=Enables All Stack Filters
+JUnitPreferencePage_disableallbutton_label=Disa&ble All
+JUnitPreferencePage_disableallbutton_tooltip=Disables All Stack Filters
+JUnitPreferencePage_filter_label=&Stack trace filter patterns (changes only apply to new test runs):
+JUnitPreferencePage_adddialog_title=Add Stack Filter Pattern
+JUnitPreferencePage_addialog_prompt=Enter Filter Pattern:
+JUnitPreferencePage_showcheck_label=Show the JUnit results &view only when an error or failure occurs
+JUnitPreferencePage_invalidstepfilterreturnescape=Invalid stack filter. Press Enter to continue editing or Escape to cancel.
+JUnitPreferencePage_addtypedialog_title=Add Class to Stack Filters
+JUnitPreferencePage_addtypedialog_message=&Select a class to filter in the failure stack trace.
+JUnitPreferencePage_addtypedialog_error_message=Could not open type selection dialog for stack filters.
+JUnitPreferencePage_addpackagedialog_title=Add Packages to Stack Filters
+JUnitPreferencePage_addpackagedialog_message=&Select a package to filter in the failure stack trace.
+JUnitPreferencePage_addpackagedialog_error_message=Could not open package selection dialog for stack filters.
-OpenEditorAction.action.label=&Go to File
-OpenEditorAction.error.cannotopen.title=Cannot Open Editor
-OpenEditorAction.error.cannotopen.message=Test class not found in selected project
-OpenEditorAction.error.dialog.title=Error
-OpenEditorAction.error.dialog.message=Cannot open editor
-OpenEditorAction.message.cannotopen=Cannot open editor
+OpenEditorAction_action_label=&Go to File
+OpenEditorAction_error_cannotopen_title=Cannot Open Editor
+OpenEditorAction_error_cannotopen_message=Test class not found in selected project
+OpenEditorAction_error_dialog_title=Error
+OpenEditorAction_error_dialog_message=Cannot open editor
+OpenEditorAction_message_cannotopen=Cannot open editor
-OpenTestAction.error.title=Go To Test
-OpenTestAction.error.methodNoFound=Method ''{0}'' not found. Opening the test class.
+OpenTestAction_error_title=Go To Test
+OpenTestAction_error_methodNoFound=Method ''{0}'' not found. Opening the test class.
-TestRunnerViewPart.jobName=Update JUnit
-TestRunnerViewPart.stopaction.text=Stop JUnit Test
-TestRunnerViewPart.stopaction.tooltip=Stop JUnit Test Run
-TestRunnerViewPart.rerunaction.label=Rerun Last Test
-TestRunnerViewPart.rerunaction.tooltip=Rerun Last Test
-TestRunnerViewPart.error.cannotrerun=Could not rerun test
-TestRunnerViewPart.message.terminated=Terminated
-TestRunnerViewPart.message.launching=Launching...
-TestRunnerViewPart.cannotrerun.title=Rerun Test
-TestRunnerViewPart.cannotrerurn.message=To rerun tests they must be launched under the debugger\nand \'Keep Test::Unit running\' must be set in the launch configuration.
-TestRunnerViewPart.message.cannotshow=Could not show JUnit Result View
-TestRunnerViewPart.label.failure=Failure Trace
-TestRunnerViewPart.message.finish= Finished after {0} seconds
-TestRunnerViewPart.message.stopped= Stopped
-TestRunnerViewPart.message.started= {0} - {1}
-TestRunnerViewPart.message.failure= {0}({1}) had a failure
-TestRunnerViewPart.message.error= {0}({1}) had an error
-TestRunnerViewPart.message.success= {0}({1}) was successful
-TestRunnerViewPart.title= JUnit ({0})
-TestRunnerViewPart.title_no_type=JUnit
-TestRunnerViewPart.configName=Rerun {0}
-TestRunnerViewPart.toggle.vertical.label=&Vertical View Orientation
-TestRunnerViewPart.toggle.horizontal.label=&Horizontal View Orientation
-TestRunnerViewPart.toggle.automatic.label=&Automatic View Orientation
-TestRunnerViewPart.terminate.title=Run Last Test
-TestRunnerViewPart.terminate.message=Terminate currently running tests?
+TestRunnerViewPart_jobName=Update JUnit
+TestRunnerViewPart_stopaction_text=Stop JUnit Test
+TestRunnerViewPart_stopaction_tooltip=Stop JUnit Test Run
+TestRunnerViewPart_rerunaction_label=Rerun Last Test
+TestRunnerViewPart_rerunaction_tooltip=Rerun Last Test
+TestRunnerViewPart_error_cannotrerun=Could not rerun test
+TestRunnerViewPart_message_terminated=Terminated
+TestRunnerViewPart_message_launching=Launching...
+TestRunnerViewPart_cannotrerun_title=Rerun Test
+TestRunnerViewPart_cannotrerurn_message=To rerun tests they must be launched under the debugger\nand \'Keep Test::Unit running\' must be set in the launch configuration.
+TestRunnerViewPart_message_cannotshow=Could not show JUnit Result View
+TestRunnerViewPart_label_failure=Failure Trace
+TestRunnerViewPart_message_finish= Finished after {0} seconds
+TestRunnerViewPart_message_stopped= Stopped
+TestRunnerViewPart_message_started= {0} - {1}
+TestRunnerViewPart_message_failure= {0}({1}) had a failure
+TestRunnerViewPart_message_error= {0}({1}) had an error
+TestRunnerViewPart_message_success= {0}({1}) was successful
+TestRunnerViewPart_title= JUnit ({0})
+TestRunnerViewPart_title_no_type=JUnit
+TestRunnerViewPart_configName=Rerun {0}
+TestRunnerViewPart_toggle_vertical_label=&Vertical View Orientation
+TestRunnerViewPart_toggle_horizontal_label=&Horizontal View Orientation
+TestRunnerViewPart_toggle_automatic_label=&Automatic View Orientation
+TestRunnerViewPart_terminate_title=Run Last Test
+TestRunnerViewPart_terminate_message=Terminate currently running tests?
-JUnitBaseLaunchConfiguration.error.invalidproject=Invalid project specified
-JUnitBaseLaunchConfiguration.error.novmrunner=Internal error: JRE {0} does not specify a VM Runner
-JUnitBaseLaunchConfiguration.error.notests=No tests found
+JUnitBaseLaunchConfiguration_error_invalidproject=Invalid project specified
+JUnitBaseLaunchConfiguration_error_novmrunner=Internal error: JRE {0} does not specify a VM Runner
+JUnitBaseLaunchConfiguration_error_notests=No tests found
-JUnitMainTab.label.oneTest=&Run a single test
-JUnitMainTab.label.project=&Project:
-JUnitMainTab.label.browse=&Browse...
-JUnitMainTab.label.test=T&est class:
-JUnitMainTab.label.search=&Search...
-JUnitMainTab.label.containerTest=Run &all tests in the selected project, package or source folder:
-JUnitMainTab.label.keeprunning=&Keep Test::Unit running after a test run when debugging
-JUnitMainTab.testdialog.title=Test Selection
-JUnitMainTab.testdialog.message=Choose a test case or test suite:
-JUnitMainTab.projectdialog.title=Project Selection
-JUnitMainTab.projectdialog.message=Choose a project to constrain the search for main types:
-JUnitMainTab.tab.label=Test
-JUnitMainTab.label.defaultpackage=(default package)
-JUnitMainTab.label.method=Test method:
-JUnitMainTab.folderdialog.title=Folder Selection
-JUnitMainTab.folderdialog.message=Choose a Project, Source Folder or Package:
-JUnitMainTab.error.projectnotdefined=Project not specified
-JUnitMainTab.error.projectnotexists=Project does not exist
-JUnitMainTab.error.notJavaProject=Specified project is not a Java project
-JUnitMainTab.error.testnotdefined=Test not specified
-JUnitMainTab.error.testnotexists=Test class does not exist
-JUnitMainTab.error.invalidTest=Specified class is not a valid test class
-JUnitMainTab.error.noContainer=No project, source folder or package is specified
+JUnitMainTab_label_oneTest=&Run a single test
+JUnitMainTab_label_project=&Project:
+JUnitMainTab_label_browse=&Browse...
+JUnitMainTab_label_test=T&est class:
+JUnitMainTab_label_search=&Search...
+JUnitMainTab_label_containerTest=Run &all tests in the selected project, package or source folder:
+JUnitMainTab_label_keeprunning=&Keep Test::Unit running after a test run when debugging
+JUnitMainTab_testdialog_title=Test Selection
+JUnitMainTab_testdialog_message=Choose a test case or test suite:
+JUnitMainTab_projectdialog_title=Project Selection
+JUnitMainTab_projectdialog_message=Choose a project to constrain the search for main types:
+JUnitMainTab_tab_label=Test
+JUnitMainTab_label_defaultpackage=(default package)
+JUnitMainTab_label_method=Test method:
+JUnitMainTab_folderdialog_title=Folder Selection
+JUnitMainTab_folderdialog_message=Choose a Project, Source Folder or Package:
+JUnitMainTab_error_projectnotdefined=Project not specified
+JUnitMainTab_error_projectnotexists=Project does not exist
+JUnitMainTab_error_notJavaProject=Specified project is not a Java project
+JUnitMainTab_error_testnotdefined=Test not specified
+JUnitMainTab_error_testnotexists=Test class does not exist
+JUnitMainTab_error_invalidTest=Specified class is not a valid test class
+JUnitMainTab_error_noContainer=No project, source folder or package is specified
-TestSearchEngine.message.searching=Searching suites
-LaunchTestAction.dialog.title=Test::Unit Launch
-LaunchTestAction.message.notests=No Test::Unit tests found.
-LaunchTestAction.dialog.title2=Test Selection
-LaunchTestAction.message.selectTestToRun=Select Test to debug
-LaunchTestAction.message.selectTestToDebug=Select Test to run
-LaunchTestAction.message.launchFailed=JUnit Launch Failed
-LaunchTestAction.message.selectConfiguration=Select a Test Configuration
-LaunchTestAction.message.selectDebugConfiguration=Select JUnit configuration to debug
-LaunchTestAction.message.selectRunConfiguration=Select JUnit configuration to run
+TestSearchEngine_message_searching=Searching suites
+LaunchTestAction_dialog_title=Test::Unit Launch
+LaunchTestAction_message_notests=No Test::Unit tests found.
+LaunchTestAction_dialog_title2=Test Selection
+LaunchTestAction_message_selectTestToRun=Select Test to debug
+LaunchTestAction_message_selectTestToDebug=Select Test to run
+LaunchTestAction_message_launchFailed=JUnit Launch Failed
+LaunchTestAction_message_selectConfiguration=Select a Test Configuration
+LaunchTestAction_message_selectDebugConfiguration=Select JUnit configuration to debug
+LaunchTestAction_message_selectRunConfiguration=Select JUnit configuration to run
-Resources.outOfSyncResources= Some resources are out of sync
-Resources.outOfSync= Resource ''{0}'' is out of sync with file system.
-Resources.modifiedResources= There are modified resources
-Resources.fileModified= File ''{0}'' has been modified since the beginning of the operation
+Resources_outOfSyncResources= Some resources are out of sync
+Resources_outOfSync= Resource ''{0}'' is out of sync with file system.
+Resources_modifiedResources= There are modified resources
+Resources_fileModified= File ''{0}'' has been modified since the beginning of the operation
-CompareResultsAction.label=Compare Result
-CompareResultsAction.description=Compare the actual and expected test result
-CompareResultsAction.tooltip=Compare Actual With Expected Test Result
+CompareResultsAction_label=Compare Result
+CompareResultsAction_description=Compare the actual and expected test result
+CompareResultsAction_tooltip=Compare Actual With Expected Test Result
-CompareResultDialog.title=Result Comparison
-CompareResultDialog.labelOK=OK
-CompareResultDialog.expectedLabel=Expected
-CompareResultDialog.actualLabel=Actual
+CompareResultDialog_title=Result Comparison
+CompareResultDialog_labelOK=OK
+CompareResultDialog_expectedLabel=Expected
+CompareResultDialog_actualLabel=Actual
-RerunAction.label.run=&Run
-RerunAction.label.debug=&Debug
+RerunAction_label_run=&Run
+RerunAction_label_debug=&Debug
-ScrollLockAction.action.label=Scroll Lock
-ScrollLockAction.action.description=Scroll lock
-ScrollLockAction.action.tooltip=Scroll Lock
+ScrollLockAction_action_label=Scroll Lock
+ScrollLockAction_action_description=Scroll lock
+ScrollLockAction_action_tooltip=Scroll Lock
-ExpandAllAction.text=Expand All
-ExpandAllAction.tooltip=Expand All Nodes
+ExpandAllAction_text=Expand All
+ExpandAllAction_tooltip=Expand All Nodes
-LaunchConfigurationTab.RubyEntryPoint.allTestCases=Run all TestCases
-LaunchConfigurationTab.RubyEntryPoint.classLabel=Test Class:
-LaunchConfigurationTab.RubyEntryPoint.classSelectorMessage=Choose the test class:
-LaunchConfigurationTab.RubyEntryPoint.allTestMethods=Run all tests
-LaunchConfigurationTab.RubyEntryPoint.methodLabel=Test Method:
-RubyClassSelector.Title=Class Selection
+LaunchConfigurationTab_RubyEntryPoint_allTestCases=Run all TestCases
+LaunchConfigurationTab_RubyEntryPoint_classLabel=Test Class:
+LaunchConfigurationTab_RubyEntryPoint_classSelectorMessage=Choose the test class:
+LaunchConfigurationTab_RubyEntryPoint_allTestMethods=Run all tests
+LaunchConfigurationTab_RubyEntryPoint_methodLabel=Test Method:
+RubyClassSelector_Title=Class Selection
#########################################
# Information Dialog
#########################################
-Dialog.launchWithoutSelectedInterpreter=Before launching a ruby application, please specifiy an interpreter using the ruby interpreter preferences page.
-Dialog.launchWithoutSelectedInterpreter.title=No interpreter found
\ No newline at end of file
+Dialog_launchWithoutSelectedInterpreter=Before launching a ruby application, please specifiy an interpreter using the ruby interpreter preferences page.
+Dialog_launchWithoutSelectedInterpreter_title=No interpreter found
\ No newline at end of file
Modified: trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/ui/TestUnitView.java
===================================================================
--- trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/ui/TestUnitView.java 2007-01-22 21:00:44 UTC (rev 1849)
+++ trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/ui/TestUnitView.java 2007-01-22 21:18:52 UTC (rev 1850)
@@ -234,7 +234,7 @@
ViewForm bottom = new ViewForm(fSashForm, SWT.NONE);
CLabel label = new CLabel(bottom, SWT.NONE);
- label.setText(TestUnitMessages.getString("TestRunnerViewPart.label.failure")); //$NON-NLS-1$
+ label.setText(TestUnitMessages.TestRunnerViewPart_label_failure);
label.setImage(fStackViewIcon);
bottom.setTopLeft(label);
@@ -394,7 +394,7 @@
try {
String name = className;
if (testName != null) name += "." + testName; //$NON-NLS-1$
- String configName = TestUnitMessages.getFormattedString("TestRunnerViewPart.configName", name); //$NON-NLS-1$
+ String configName = TestUnitMessages.getFormattedString(TestUnitMessages.TestRunnerViewPart_configName, name);
ILaunchConfigurationWorkingCopy tmp = launchConfiguration.copy(configName);
// fix for bug: 64838 junit view run single test does not
// use
@@ -407,12 +407,12 @@
tmp.launch(launchMode, null);
return;
} catch (CoreException e) {
- ErrorDialog.openError(getSite().getShell(), TestUnitMessages.getString("TestRunnerViewPart.error.cannotrerun"), e.getMessage(), e.getStatus() //$NON-NLS-1$
+ ErrorDialog.openError(getSite().getShell(), TestUnitMessages.TestRunnerViewPart_error_cannotrerun, e.getMessage(), e.getStatus() //$NON-NLS-1$
);
}
}
- MessageDialog.openInformation(getSite().getShell(), TestUnitMessages.getString("TestRunnerViewPart.cannotrerun.title"), //$NON-NLS-1$
- TestUnitMessages.getString("TestRunnerViewPart.cannotrerurn.message") //$NON-NLS-1$
+ MessageDialog.openInformation(getSite().getShell(), TestUnitMessages.TestRunnerViewPart_cannotrerun_title,
+ TestUnitMessages.TestRunnerViewPart_cannotrerurn_message
);
}
}
@@ -446,7 +446,7 @@
}
protected void aboutToLaunch() {
- String msg = TestUnitMessages.getString("TestRunnerViewPart.message.launching"); //$NON-NLS-1$
+ String msg = TestUnitMessages.TestRunnerViewPart_message_launching;
showInformation(msg);
setInfoMessage(msg);
//fViewImage= fOriginalViewImage;
@@ -669,13 +669,13 @@
*/
public void testReran(String testId, String className, String testName, int status, String trace) {
if (status == ITestRunListener.STATUS_ERROR) {
- String msg = TestUnitMessages.getFormattedString("TestRunnerViewPart.message.error", new String[] { testName, className}); //$NON-NLS-1$
+ String msg = TestUnitMessages.getFormattedString(TestUnitMessages.TestRunnerViewPart_message_error, new String[] { testName, className});
postError(msg);
} else if (status == ITestRunListener.STATUS_FAILURE) {
- String msg = TestUnitMessages.getFormattedString("TestRunnerViewPart.message.failure", new String[] { testName, className}); //$NON-NLS-1$
+ String msg = TestUnitMessages.getFormattedString(TestUnitMessages.TestRunnerViewPart_message_failure, new String[] { testName, className});
postError(msg);
} else {
- String msg = TestUnitMessages.getFormattedString("TestRunnerViewPart.message.success", new String[] { testName, className}); //$NON-NLS-1$
+ String msg = TestUnitMessages.getFormattedString(TestUnitMessages.TestRunnerViewPart_message_success, new String[] { testName, className});
setInfoMessage(msg);
}
TestRunInfo info = getTestInfo(testId);
@@ -781,7 +781,7 @@
}
String className = testInfo.getClassName();
String method = testInfo.getTestMethodName();
- String status = TestUnitMessages.getFormattedString("TestRunnerViewPart.message.started", new String[] { className, method}); //$NON-NLS-1$
+ String status = TestUnitMessages.getFormattedString(TestUnitMessages.TestRunnerViewPart_message_started, new String[] { className, method});
setInfoMessage(status);
}
@@ -802,7 +802,7 @@
* @see ITestRunListener#testRunStopped
*/
public void testRunStopped(final long elapsedTime) {
- String msg = TestUnitMessages.getString("TestRunnerViewPart.message.stopped"); //$NON-NLS-1$
+ String msg = TestUnitMessages.TestRunnerViewPart_message_stopped;
setInfoMessage(msg);
handleStopped();
}
@@ -826,7 +826,7 @@
public void testRunEnded(long elapsedTime) {
fExecutedTests--;
String[] keys = { elapsedTimeAsString(elapsedTime)};
- String msg = TestUnitMessages.getFormattedString("TestRunnerViewPart.message.finish", keys); //$NON-NLS-1$
+ String msg = TestUnitMessages.getFormattedString(TestUnitMessages.TestRunnerViewPart_message_finish, keys);
if (hasErrorsOrFailures())
postError(msg);
else
@@ -874,7 +874,7 @@
* @see ITestRunListener#testRunTerminated
*/
public void testRunTerminated() {
- String msg = TestUnitMessages.getString("TestRunnerViewPart.message.terminated"); //$NON-NLS-1$
+ String msg = TestUnitMessages.TestRunnerViewPart_message_terminated;
showMessage(msg);
handleStopped();
}
@@ -891,7 +891,7 @@
//fShowOnErrorOnly = JUnitPreferencePage.getShowOnErrorOnly();
fExecutedTests++;
stopUpdateJob();
- fUpdateJob = new UpdateUIJob(TestUnitMessages.getString("TestRunnerViewPart.jobName")); //$NON-NLS-1$
+ fUpdateJob = new UpdateUIJob(TestUnitMessages.TestRunnerViewPart_jobName);
fUpdateJob.schedule(REFRESH_INTERVAL);
}
@@ -928,7 +928,7 @@
public void rerunTestRun() {
if (lastLaunchIsKeptAlive()) {
// prompt for terminating the existing run
- if (MessageDialog.openQuestion(getSite().getShell(), TestUnitMessages.getString("TestRunnerViewPart.terminate.title"), TestUnitMessages.getString("TestRunnerViewPart.terminate.message"))) { //$NON-NLS-1$ //$NON-NLS-2$
+ if (MessageDialog.openQuestion(getSite().getShell(), TestUnitMessages.TestRunnerViewPart_terminate_title, TestUnitMessages.TestRunnerViewPart_terminate_message)) {
if (fTestRunnerClient != null) fTestRunnerClient.stopTest();
}
}
@@ -972,8 +972,8 @@
private class RerunLastAction extends Action {
public RerunLastAction() {
- setText(TestUnitMessages.getString("TestRunnerViewPart.rerunaction.label")); //$NON-NLS-1$
- setToolTipText(TestUnitMessages.getString("TestRunnerViewPart.rerunaction.tooltip")); //$NON-NLS-1$
+ setText(TestUnitMessages.TestRunnerViewPart_rerunaction_label);
+ setToolTipText(TestUnitMessages.TestRunnerViewPart_rerunaction_tooltip);
setDisabledImageDescriptor(TestunitPlugin.getImageDescriptor("dlcl16/relaunch.gif")); //$NON-NLS-1$
setHoverImageDescriptor(TestunitPlugin.getImageDescriptor("elcl16/relaunch.gif")); //$NON-NLS-1$
setImageDescriptor(TestunitPlugin.getImageDescriptor("elcl16/relaunch.gif")); //$NON-NLS-1$
Modified: trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/testunit/launcher/RubyClassSelector.java
===================================================================
--- trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/testunit/launcher/RubyClassSelector.java 2007-01-22 21:00:44 UTC (rev 1849)
+++ trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/testunit/launcher/RubyClassSelector.java 2007-01-22 21:18:52 UTC (rev 1850)
@@ -98,7 +98,7 @@
}
});
- browseDialogTitle = TestUnitMessages.getString("RubyClassSelector.Title");
+ browseDialogTitle = TestUnitMessages.RubyClassSelector_Title;
}
Modified: trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/testunit/launcher/TestUnitLaunchShortcut.java
===================================================================
--- trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/testunit/launcher/TestUnitLaunchShortcut.java 2007-01-22 21:00:44 UTC (rev 1849)
+++ trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/testunit/launcher/TestUnitLaunchShortcut.java 2007-01-22 21:18:52 UTC (rev 1850)
@@ -91,11 +91,11 @@
IDebugModelPresentation labelProvider = DebugUITools.newDebugModelPresentation();
ElementListSelectionDialog dialog = new ElementListSelectionDialog(getShell(), labelProvider);
dialog.setElements(configList.toArray());
- dialog.setTitle(TestUnitMessages.getString("LaunchTestAction.message.selectConfiguration")); //$NON-NLS-1$
+ dialog.setTitle(TestUnitMessages.LaunchTestAction_message_selectConfiguration);
if (mode.equals(ILaunchManager.DEBUG_MODE)) {
- dialog.setMessage(TestUnitMessages.getString("LaunchTestAction.message.selectDebugConfiguration")); //$NON-NLS-1$
+ dialog.setMessage(TestUnitMessages.LaunchTestAction_message_selectDebugConfiguration);
} else {
- dialog.setMessage(TestUnitMessages.getString("LaunchTestAction.message.selectRunConfiguration")); //$NON-NLS-1$
+ dialog.setMessage(TestUnitMessages.LaunchTestAction_message_selectRunConfiguration);
}
dialog.setMultipleSelection(false);
int result = dialog.open();
@@ -167,7 +167,7 @@
}
protected void showNoInterpreterDialog() {
- MessageDialog.openInformation(TestunitPlugin.getActiveWorkbenchShell(), TestUnitMessages.getString("Dialog.launchWithoutSelectedInterpreter.title"), TestUnitMessages.getString("Dialog.launchWithoutSelectedInterpreter"));
+ MessageDialog.openInformation(TestunitPlugin.getActiveWorkbenchShell(), TestUnitMessages.Dialog_launchWithoutSelectedInterpreter_title, TestUnitMessages.Dialog_launchWithoutSelectedInterpreter);
}
protected static String getDefaultWorkingDirectory(IProject project) {
Modified: trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/testunit/launcher/TestUnitMainTab.java
===================================================================
--- trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/testunit/launcher/TestUnitMainTab.java 2007-01-22 21:00:44 UTC (rev 1849)
+++ trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/testunit/launcher/TestUnitMainTab.java 2007-01-22 21:18:52 UTC (rev 1850)
@@ -83,9 +83,9 @@
public void createControl(Composite parent) {
Composite composite = createPageRoot(parent);
- new Label(composite, SWT.NONE).setText(RdtDebugUiMessages.getString("LaunchConfigurationTab.RubyEntryPoint.projectLabel"));
+ new Label(composite, SWT.NONE).setText(RdtDebugUiMessages.LaunchConfigurationTab_RubyEntryPoint_projectLabel);
projectSelector = new RubyProjectSelector(composite);
- projectSelector.setBrowseDialogMessage(RdtDebugUiMessages.getString("LaunchConfigurationTab.RubyEntryPoint.projectSelectorMessage"));
+ projectSelector.setBrowseDialogMessage(RdtDebugUiMessages.LaunchConfigurationTab_RubyEntryPoint_projectSelectorMessage);
projectSelector.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
projectSelector.addModifyListener(new ModifyListener() {
@@ -100,9 +100,9 @@
}
});
- new Label(composite, SWT.NONE).setText(RdtDebugUiMessages.getString("LaunchConfigurationTab.RubyEntryPoint.fileLabel"));
+ new Label(composite, SWT.NONE).setText(RdtDebugUiMessages.LaunchConfigurationTab_RubyEntryPoint_fileLabel);
fileSelector = new RubyFileSelector(composite, projectSelector);
- fileSelector.setBrowseDialogMessage(RdtDebugUiMessages.getString("LaunchConfigurationTab.RubyEntryPoint.fileSelectorMessage"));
+ fileSelector.setBrowseDialogMessage(RdtDebugUiMessages.LaunchConfigurationTab_RubyEntryPoint_fileSelectorMessage);
fileSelector.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
fileSelector.addModifyListener(new ModifyListener() {
@@ -117,7 +117,7 @@
});
allClassesCheckBox = new Button(composite, SWT.CHECK);
- allClassesCheckBox.setText(TestUnitMessages.getString("LaunchConfigurationTab.RubyEntryPoint.allTestCases"));
+ allClassesCheckBox.setText(TestUnitMessages.LaunchConfigurationTab_RubyEntryPoint_allTestCases);
allClassesCheckBox.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
@@ -129,10 +129,10 @@
});
classLabel = new Label(composite, SWT.NONE);
- classLabel.setText(TestUnitMessages.getString("LaunchConfigurationTab.RubyEntryPoint.classLabel"));
+ classLabel.setText(TestUnitMessages.LaunchConfigurationTab_RubyEntryPoint_classLabel);
classSelector = new RubyClassSelector(composite, fileSelector, projectSelector);
- classSelector.setBrowseDialogMessage(TestUnitMessages.getString("LaunchConfigurationTab.RubyEntryPoint.classSelectorMessage"));
+ classSelector.setBrowseDialogMessage(TestUnitMessages.LaunchConfigurationTab_RubyEntryPoint_classSelectorMessage);
classSelector.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
classSelector.addModifyListener(new ModifyListener() {
@@ -142,7 +142,7 @@
});
allMethodsCheckBox = new Button(composite, SWT.CHECK);
- allMethodsCheckBox.setText(TestUnitMessages.getString("LaunchConfigurationTab.RubyEntryPoint.allTestMethods"));
+ allMethodsCheckBox.setText(TestUnitMessages.LaunchConfigurationTab_RubyEntryPoint_allTestMethods);
allMethodsCheckBox.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
@@ -154,7 +154,7 @@
});
testLabel = new Label(composite, SWT.NONE);
- testLabel.setText(TestUnitMessages.getString("LaunchConfigurationTab.RubyEntryPoint.methodLabel"));
+ testLabel.setText(TestUnitMessages.LaunchConfigurationTab_RubyEntryPoint_methodLabel);
testMethodEditBox = new Text(composite, SWT.BORDER | SWT.BORDER);
testMethodEditBox.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
@@ -274,7 +274,7 @@
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#getName()
*/
public String getName() {
- return TestUnitMessages.getString("JUnitMainTab.tab.label"); //$NON-NLS-1$
+ return TestUnitMessages.JUnitMainTab_tab_label;
}
}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-01-22 21:00:45
|
Revision: 1849
http://svn.sourceforge.net/rubyeclipse/?rev=1849&view=rev
Author: cawilliams
Date: 2007-01-22 13:00:44 -0800 (Mon, 22 Jan 2007)
Log Message:
-----------
try to move us towards using only subclasses of NLS for translations - so we get accurate information on what strings are missing and what are unused.
Modified Paths:
--------------
trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/RdtDebugUiMessages.java
trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/RdtDebugUiMessages.properties
trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/RdtDebugUiPlugin.java
trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/RubyExecutionArgumentsPage.java
trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/RubySourceLocator.java
trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/actions/ModifyCatchpointAction.java
trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/launcher/RubyApplicationShortcut.java
trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/launcher/RubyArgumentsTab.java
trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/launcher/RubyEntryPointTab.java
trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/launcher/RubyEnvironmentTab.java
trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/preferences/EditEvaluationExpressionDialog.java
trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/preferences/EvaluationExpressionsPreferencePage.java
trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/preferences/RubyInterpreterPreferencePage.java
trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/rubyvms/RubyVMMessages.java
trunk/org.rubypeople.rdt.debug.ui.tests/src/org/rubypeople/rdt/internal/debug/ui/launcher/TC_RubyArgumentsTab.java
trunk/org.rubypeople.rdt.debug.ui.tests/src/org/rubypeople/rdt/internal/debug/ui/launcher/TC_RubyEntryPointTab.java
trunk/org.rubypeople.rdt.debug.ui.tests/src/org/rubypeople/rdt/internal/debug/ui/launcher/TC_RubyEnvironmentTab.java
Modified: trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/RdtDebugUiMessages.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/RdtDebugUiMessages.java 2007-01-22 20:57:20 UTC (rev 1848)
+++ trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/RdtDebugUiMessages.java 2007-01-22 21:00:44 UTC (rev 1849)
@@ -4,13 +4,83 @@
import java.util.MissingResourceException;
import java.util.ResourceBundle;
+import org.eclipse.osgi.util.NLS;
+
public class RdtDebugUiMessages {
private static final String BUNDLE_NAME = RdtDebugUiMessages.class.getName();
- private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME);
private RdtDebugUiMessages() {}
+ public static String LaunchConfigurationTab_RubyArguments_working_dir_error_message;
+ public static String LaunchConfigurationTab_RubyEntryPoint_invalidProjectSelectionMessage;
+ public static String LaunchConfigurationTab_RubyEntryPoint_invalidFileSelectionMessage;
+ public static String LaunchConfigurationTab_RubyEnvironment_interpreter_not_selected_error_message;
+ public static String RdtDebugUiPlugin_internalErrorOccurred;
+ public static String LaunchConfigurationTab_RubyArguments_interpreter_args_box_title;
+ public static String LaunchConfigurationTab_RubyArguments_program_args_box_title;
+ public static String ModifyCatchpointDialog_title;
+ public static String ModifyCatchpointDialog_message;
+ public static String Dialog_launchErrorTitle;
+ public static String Dialog_launchErrorMessage;
+ public static String LaunchConfigurationShortcut_Ruby_multipleConfigurationsError;
+ public static String Dialog_launchWithoutSelectedInterpreter_title;
+ public static String Dialog_launchWithoutSelectedInterpreter;
+ public static String LaunchConfigurationTab_RubyArguments_working_dir;
+ public static String LaunchConfigurationTab_RubyArguments_working_dir_browser_message;
+ public static String LaunchConfigurationTab_RubyArguments_working_dir_use_default_message;
+ public static String LaunchConfigurationTab_RubyArguments_name;
+ public static String LaunchConfigurationTab_RubyEntryPoint_projectLabel;
+ public static String LaunchConfigurationTab_RubyEntryPoint_projectSelectorMessage;
+ public static String LaunchConfigurationTab_RubyEntryPoint_fileLabel;
+ public static String LaunchConfigurationTab_RubyEntryPoint_fileSelectorMessage;
+ public static String LaunchConfigurationTab_RubyEntryPoint_name;
+ public static String LaunchConfigurationTab_RubyEnvironment_loadPathTab_label;
+ public static String LaunchConfigurationTab_RubyEnvironment_loadPathDefaultButton_label;
+ public static String LaunchConfigurationTab_RubyEnvironment_interpreterAddButton_label;
+ public static String LaunchConfigurationTab_RubyEnvironment_interpreterTab_label;
+ public static String LaunchConfigurationTab_RubyEnvironment_name;
+ public static String EditEvaluationExpression_name_label;
+ public static String EditEvaluationExpression_description_label;
+ public static String EditEvaluationExpression_expression_label;
+ public static String EvaluationExpressionsPreferencePage_description;
+ public static String EvaluationExpressionsPreferencePage_column_name;
+ public static String EvaluationExpressionsPreferencePage_column_description;
+ public static String EvaluationExpressionsPreferencePage_new;
+ public static String EvaluationExpressionsPreferencePage_edit;
+ public static String EvaluationExpressionsPreferencePage_remove;
+ public static String EvaluationExpressionsPreferencePage_import;
+ public static String EvaluationExpressionsPreferencePage_export;
+ public static String EditEvaluationExpressionDialog_add;
+ public static String EditEvaluationExpressionDialog_edit;
+ public static String EvaluationExpressionsPreferencePage_import_title;
+ public static String EvaluationExpressionsPreferencePage_importexport_extension;
+ public static String EvaluationExpressionsPreferencePage_export_title;
+ public static String EvaluationExpressionsPreferencePage_export_filename;
+ public static String EvaluationExpressionsPreferencePage_export_error_title;
+ public static String EvaluationExpressionsPreferencePage_export_error_hidden;
+ public static String EvaluationExpressionsPreferencePage_export_error_canNotWrite;
+ public static String EvaluationExpressionsPreferencePage_export_exists_title;
+ public static String EvaluationExpressionsPreferencePage_export_exists_message;
+ public static String EvaluationExpressionsPreferencePage_title;
+ public static String RubyInterpreterPreferencePage_addButton_label;
+ public static String RubyInterpreterPreferencePage_editButton_label;
+ public static String RubyInterpreterPreferencePage_removeButton_label;
+ public static String RubyInterpreterPreferencePage_rubyInterpreterTable_interpreterName;
+ public static String RubyInterpreterPreferencePage_rubyInterpreterTable_interpreterPath;
+ public static String RdtDebugUiPlugin_couldNotOpenFile;
+
+ static {
+ // load message values from bundle file
+ NLS.initializeMessages(BUNDLE_NAME, RdtDebugUiMessages.class);
+ }
+
+ public static String getFormattedString(String key, Object arg) {
+ return MessageFormat.format(key, new Object[] { arg });
+ }
+
+ private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME);
+
public static String getString(String key) {
try {
return RESOURCE_BUNDLE.getString(key);
@@ -18,12 +88,4 @@
return '!' + key + '!';
}
}
-
- public static String getFormattedString(String key, Object arg) {
- return MessageFormat.format(getString(key), new Object[] { arg });
- }
-
- public static String getFormattedString(String key, Object[] args) {
- return MessageFormat.format(getString(key), args);
- }
}
\ No newline at end of file
Modified: trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/RdtDebugUiMessages.properties
===================================================================
--- trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/RdtDebugUiMessages.properties 2007-01-22 20:57:20 UTC (rev 1848)
+++ trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/RdtDebugUiMessages.properties 2007-01-22 21:00:44 UTC (rev 1849)
@@ -1,118 +1,115 @@
#########################################
-# (c) Copyright RubyPeople, Inc. 2002.
+# (c) Copyright RubyPeople, Inc. 2002, 2007.
# All Rights Reserved.
#########################################
#########################################
# RdtDebugUiPlugin
#########################################
+RdtDebugUiPlugin_internalErrorOccurred=Internal error occurred
+RdtDebugUiPlugin_couldNotOpenFile=Could not find file: {0}.
-RdtDebugUiPlugin.internalErrorOccurred=Internal error occurred
-RdtDebugUiPlugin.couldNotOpenFile=Could not find file: {0}.
-
#########################################
# RubyApplicationWizardPage
#########################################
-RubyApplicationWizardPage.name=RubyApplicationWizardPage.name
-RubyApplicationWizardPage.description=Configure and Launch a Ruby application
-RubyApplicationWizardPage.title=Ruby Application Launch Wizard
+RubyApplicationWizardPage_name=Ruby Application Wizard
+RubyApplicationWizardPage_description=Configure and Launch a Ruby application
+RubyApplicationWizardPage_title=Ruby Application Launch Wizard
#########################################
# LaunchConfigurationTab
#########################################
-LaunchConfigurationTab.RubyArguments.name=Arguments
-LaunchConfigurationTab.RubyArguments.working_dir=Working Directory:
-LaunchConfigurationTab.RubyArguments.working_dir_browser_message=Select a working directory for the launch configuration
-LaunchConfigurationTab.RubyArguments.working_dir_use_default_message=Use default working directory
-LaunchConfigurationTab.RubyArguments.working_dir_error_message=Invalid working directory
-LaunchConfigurationTab.RubyArguments.interpreter_args_box_title=Interpreter Arguments:
-LaunchConfigurationTab.RubyArguments.program_args_box_title=Program Arguments:
+LaunchConfigurationTab_RubyArguments_name=Arguments
+LaunchConfigurationTab_RubyArguments_working_dir=Working Directory:
+LaunchConfigurationTab_RubyArguments_working_dir_browser_message=Select a working directory for the launch configuration
+LaunchConfigurationTab_RubyArguments_working_dir_use_default_message=Use default working directory
+LaunchConfigurationTab_RubyArguments_working_dir_error_message=Invalid working directory
+LaunchConfigurationTab_RubyArguments_interpreter_args_box_title=Interpreter Arguments:
+LaunchConfigurationTab_RubyArguments_program_args_box_title=Program Arguments:
-LaunchConfigurationTab.RubyEntryPoint.name=File
-LaunchConfigurationTab.RubyEntryPoint.projectLabel=Project:
-LaunchConfigurationTab.RubyEntryPoint.projectSelectorMessage=Choose the project containing the application entry point:
-LaunchConfigurationTab.RubyEntryPoint.invalidProjectSelectionMessage=Invalid project selection.
-LaunchConfigurationTab.RubyEntryPoint.fileLabel=File:
-LaunchConfigurationTab.RubyEntryPoint.fileSelectorMessage=Choose the Ruby file that represents the application entry point:
-LaunchConfigurationTab.RubyEntryPoint.invalidFileSelectionMessage=Invalid Ruby file.
+LaunchConfigurationTab_RubyEntryPoint_name=File
+LaunchConfigurationTab_RubyEntryPoint_projectLabel=Project:
+LaunchConfigurationTab_RubyEntryPoint_projectSelectorMessage=Choose the project containing the application entry point:
+LaunchConfigurationTab_RubyEntryPoint_invalidProjectSelectionMessage=Invalid project selection.
+LaunchConfigurationTab_RubyEntryPoint_fileLabel=File:
+LaunchConfigurationTab_RubyEntryPoint_fileSelectorMessage=Choose the Ruby file that represents the application entry point:
+LaunchConfigurationTab_RubyEntryPoint_invalidFileSelectionMessage=Invalid Ruby file.
-LaunchConfigurationTab.RubyEnvironment.name=Environment
-LaunchConfigurationTab.RubyEnvironment.loadPathTab.label=Load&path
-LaunchConfigurationTab.RubyEnvironment.loadPathDefaultButton.label=&Use default loadpath
-LaunchConfigurationTab.RubyEnvironment.interpreterAddButton.label=N&ew...
-LaunchConfigurationTab.RubyEnvironment.interpreterTab.label=&Interpreter
-LaunchConfigurationTab.RubyEnvironment.editInterpreterDialog.title=Add Interpreter
-LaunchConfigurationTab.RubyEnvironment.interpreter_not_selected_error_message=No interpreter has been selected
+LaunchConfigurationTab_RubyEnvironment_name=Environment
+LaunchConfigurationTab_RubyEnvironment_loadPathTab_label=Load&path
+LaunchConfigurationTab_RubyEnvironment_loadPathDefaultButton_label=&Use default loadpath
+LaunchConfigurationTab_RubyEnvironment_interpreterAddButton_label=N&ew...
+LaunchConfigurationTab_RubyEnvironment_interpreterTab_label=&Interpreter
+LaunchConfigurationTab_RubyEnvironment_editInterpreterDialog_title=Add Interpreter
+LaunchConfigurationTab_RubyEnvironment_interpreter_not_selected_error_message=No interpreter has been selected
-LaunchConfigurationShortcut.Ruby.multipleConfigurationsError=The file you are trying to launch has multiple configurations associated with it.\nPlease launch using 'Run...' and choose a configuration.
+LaunchConfigurationShortcut_Ruby_multipleConfigurationsError=The file you are trying to launch has multiple configurations associated with it.\nPlease launch using 'Run...' and choose a configuration.
#########################################
# Ruby Interpreter configuration
#########################################
-EditInterpreterDialog.rubyInterpreter.path.label=Location:
-EditInterpreterDialog.rubyInterpreter.path.browse.button.label=Browse...
-EditInterpreterDialog.rubyInterpreter.path.error=Please select a ruby interpreter
-EditInterpreterDialog.rubyInterpreter.name=Interpreter Name:
-EditInterpreterDialog.rubyInterpreter.name.error=Name cannot be empty
-EditInterpreterDialog.rubyInterpreter.path.browse.message=Choose location
+EditInterpreterDialog_rubyInterpreter_path_label=Location:
+EditInterpreterDialog_rubyInterpreter_path_browse_button_label=Browse...
+EditInterpreterDialog_rubyInterpreter_path_error=Please select a ruby interpreter
+EditInterpreterDialog_rubyInterpreter_name=Interpreter Name:
+EditInterpreterDialog_rubyInterpreter_name_error=Name cannot be empty
+EditInterpreterDialog_rubyInterpreter_path_browse_message=Choose location
-RubyInterpreterPreferencePage.addButton.label=Add
-RubyInterpreterPreferencePage.editButton.label=Edit
-RubyInterpreterPreferencePage.removeButton.label=Remove
-RubyInterpreterPreferencePage.rubyInterpreterTable.interpreterName=Name
-RubyInterpreterPreferencePage.rubyInterpreterTable.interpreterPath=Location
+RubyInterpreterPreferencePage_addButton_label=Add
+RubyInterpreterPreferencePage_editButton_label=Edit
+RubyInterpreterPreferencePage_removeButton_label=Remove
+RubyInterpreterPreferencePage_rubyInterpreterTable_interpreterName=Name
+RubyInterpreterPreferencePage_rubyInterpreterTable_interpreterPath=Location
-RubyInterpreterPreferencePage.EditInterpreterDialog.addInterpreter.title=Add Interpreter
-RubyInterpreterPreferencePage.EditInterpreterDialog.editInterpreter.title=Edit Interpreter
+RubyInterpreterPreferencePage_EditInterpreterDialog_addInterpreter_title=Add Interpreter
+RubyInterpreterPreferencePage_EditInterpreterDialog_editInterpreter_title=Edit Interpreter
#########################################
# Information Dialog
#########################################
-Dialog.launchWithoutSelectedInterpreter=Before launching a ruby application, please specifiy an interpreter using the ruby interpreter preferences page.
-Dialog.launchWithoutSelectedInterpreter.title=No interpreter found
-Dialog.launchErrorTitle=Launch Error
-Dialog.launchErrorMessage=An error occurred while trying to launch a ruby application.
+Dialog_launchWithoutSelectedInterpreter=Before launching a ruby application, please specifiy an interpreter using the ruby interpreter preferences page.
+Dialog_launchWithoutSelectedInterpreter_title=No interpreter found
+Dialog_launchErrorTitle=Launch Error
+Dialog_launchErrorMessage=An error occurred while trying to launch a ruby application.
#########################################
# Evaluation Expressions Preference Page
#########################################
-EvaluationExpressionsPreferencePage.title=Expressions for quick inspect
-EvaluationExpressionsPreferencePage.description=Create, Edit and Remove Ruby expressions for quick inspect:
-EvaluationExpressionsPreferencePage.column.name=Name
-EvaluationExpressionsPreferencePage.column.description=Description
-EvaluationExpressionsPreferencePage.new=New
-EvaluationExpressionsPreferencePage.edit=Edit
-EvaluationExpressionsPreferencePage.remove=Remove
-EvaluationExpressionsPreferencePage.import=Import
-EvaluationExpressionsPreferencePage.export=Export
-EditEvaluationExpressionDialog.add=Add Evaluation Expression
-EditEvaluationExpressionDialog.edit=Edit Evaluation Expression
-EditEvaluationExpression.name.label=Name
-EditEvaluationExpression.description.label=Description
-EditEvaluationExpression.expression.label=Expression
+EvaluationExpressionsPreferencePage_title=Expressions for quick inspect
+EvaluationExpressionsPreferencePage_description=Create, Edit and Remove Ruby expressions for quick inspect:
+EvaluationExpressionsPreferencePage_column_name=Name
+EvaluationExpressionsPreferencePage_column_description=Description
+EvaluationExpressionsPreferencePage_new=New
+EvaluationExpressionsPreferencePage_edit=Edit
+EvaluationExpressionsPreferencePage_remove=Remove
+EvaluationExpressionsPreferencePage_import=Import
+EvaluationExpressionsPreferencePage_export=Export
+EditEvaluationExpressionDialog_add=Add Evaluation Expression
+EditEvaluationExpressionDialog_edit=Edit Evaluation Expression
+EditEvaluationExpression_name_label=Name
+EditEvaluationExpression_description_label=Description
+EditEvaluationExpression_expression_label=Expression
-EvaluationExpressionsPreferencePage.importexport.extension=*.xml
+EvaluationExpressionsPreferencePage_importexport_extension=*.xml
-EvaluationExpressionsPreferencePage.import.title=Importing Expressions
+EvaluationExpressionsPreferencePage_import_title=Importing Expressions
+EvaluationExpressionsPreferencePage_export_title=Exporting {0} Expressions
+EvaluationExpressionsPreferencePage_export_filename=expressions.xml
-EvaluationExpressionsPreferencePage.export.title=Exporting {0} Expressions
-EvaluationExpressionsPreferencePage.export.filename=expressions.xml
+EvaluationExpressionsPreferencePage_export_exists_title= Exporting Expressions
+EvaluationExpressionsPreferencePage_export_exists_message= {0} already exists.\nDo you want to replace it?
+EvaluationExpressionsPreferencePage_export_error_title= Exporting Expressions
+EvaluationExpressionsPreferencePage_export_error_hidden= Export failed.\n{0} is a hidden file.
+EvaluationExpressionsPreferencePage_export_error_canNotWrite= Export failed.\n{0} cannot be modified.
+EvaluationExpressionsPreferencePage_export_error_fileNotFound= Export failed:\n{0}
-EvaluationExpressionsPreferencePage.export.exists.title= Exporting Expressions
-EvaluationExpressionsPreferencePage.export.exists.message= {0} already exists.\nDo you want to replace it?
-
-EvaluationExpressionsPreferencePage.export.error.title= Exporting Expressions
-EvaluationExpressionsPreferencePage.export.error.hidden= Export failed.\n{0} is a hidden file.
-EvaluationExpressionsPreferencePage.export.error.canNotWrite= Export failed.\n{0} cannot be modified.
-EvaluationExpressionsPreferencePage.export.error.fileNotFound= Export failed:\n{0}
-
-ModifyCatchpointDialog.title=Define Catchpoint
-ModifyCatchpointDialog.message=Enter the name of a ruby exception. The debugger halts when an exception of this type or a subclass is raised.
+ModifyCatchpointDialog_title=Define Catchpoint
+ModifyCatchpointDialog_message=Enter the name of a ruby exception. The debugger halts when an exception of this type or a subclass is raised.
Modified: trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/RdtDebugUiPlugin.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/RdtDebugUiPlugin.java 2007-01-22 20:57:20 UTC (rev 1848)
+++ trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/RdtDebugUiPlugin.java 2007-01-22 21:00:44 UTC (rev 1849)
@@ -51,7 +51,7 @@
}
public static void log(Throwable e) {
- log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.ERROR, RdtDebugUiMessages.getString("RdtDebugUiPlugin.internalErrorOccurred"), e)); //$NON-NLS-1$
+ log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.ERROR, RdtDebugUiMessages.RdtDebugUiPlugin_internalErrorOccurred, e));
}
public void start(BundleContext context) throws Exception {
Modified: trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/RubyExecutionArgumentsPage.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/RubyExecutionArgumentsPage.java 2007-01-22 20:57:20 UTC (rev 1848)
+++ trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/RubyExecutionArgumentsPage.java 2007-01-22 21:00:44 UTC (rev 1849)
@@ -27,7 +27,7 @@
GridLayout layout = new GridLayout();
layout.numColumns = 2;
composite.setLayout(layout);
- new Label(composite, SWT.NONE).setText(RdtDebugUiMessages.getString("LaunchConfigurationTab.RubyArguments.interpreter_args_box_title"));
+ new Label(composite, SWT.NONE).setText(RdtDebugUiMessages.LaunchConfigurationTab_RubyArguments_interpreter_args_box_title);
new Label(composite, SWT.NONE).setText(" ");
interpreterArgumentsText = new Text(composite, SWT.BORDER);
GridData interpreterArgumentsData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
@@ -35,7 +35,7 @@
interpreterArgumentsText.setLayoutData(interpreterArgumentsData);
interpreterArgumentsText.setText(getArgument("interpreter"));
- new Label(composite, SWT.NONE).setText(RdtDebugUiMessages.getString("LaunchConfigurationTab.RubyArguments.program_args_box_title"));
+ new Label(composite, SWT.NONE).setText(RdtDebugUiMessages.LaunchConfigurationTab_RubyArguments_program_args_box_title);
programArgumentsText = new Text(composite, SWT.BORDER);
GridData programArgumentsData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
programArgumentsData.horizontalSpan = 2;
Modified: trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/RubySourceLocator.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/RubySourceLocator.java 2007-01-22 20:57:20 UTC (rev 1848)
+++ trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/RubySourceLocator.java 2007-01-22 21:00:44 UTC (rev 1849)
@@ -94,7 +94,7 @@
return new ExternalRubyFileEditorInput(filesystemFile);
}
- RdtDebugCorePlugin.log(IStatus.INFO, RdtDebugUiMessages.getFormattedString("RdtDebugUiPlugin.couldNotOpenFile", sourceElement.getFilename())); //$NON-NLS-1$
+ RdtDebugCorePlugin.log(IStatus.INFO, RdtDebugUiMessages.getFormattedString(RdtDebugUiMessages.RdtDebugUiPlugin_couldNotOpenFile, sourceElement.getFilename()));
return null;
}
Modified: trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/actions/ModifyCatchpointAction.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/actions/ModifyCatchpointAction.java 2007-01-22 20:57:20 UTC (rev 1848)
+++ trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/actions/ModifyCatchpointAction.java 2007-01-22 21:00:44 UTC (rev 1849)
@@ -45,8 +45,8 @@
*/
public void run(IAction action) {
final ModifyCatchpointDialog dialog = new ModifyCatchpointDialog(RdtDebugUiPlugin.getActiveWorkbenchWindow().getShell()) ;
- dialog.setTitle(RdtDebugUiMessages.getString("ModifyCatchpointDialog.title")); //$NON-NLS-1$
- dialog.setMessage(RdtDebugUiMessages.getString("ModifyCatchpointDialog.message")); //$NON-NLS-1$
+ dialog.setTitle(RdtDebugUiMessages.ModifyCatchpointDialog_title);
+ dialog.setMessage(RdtDebugUiMessages.ModifyCatchpointDialog_message);
int result = dialog.open();
if (result == Window.CANCEL) {
Modified: trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/launcher/RubyApplicationShortcut.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/launcher/RubyApplicationShortcut.java 2007-01-22 20:57:20 UTC (rev 1848)
+++ trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/launcher/RubyApplicationShortcut.java 2007-01-22 21:00:44 UTC (rev 1849)
@@ -59,8 +59,8 @@
} catch (CoreException e) {
log(e);
IStatus status= e.getStatus();
- String title = RdtDebugUiMessages.getString("Dialog.launchErrorTitle") ;
- String message = RdtDebugUiMessages.getString("Dialog.launchErrorMessage") ;
+ String title = RdtDebugUiMessages.Dialog_launchErrorTitle;
+ String message = RdtDebugUiMessages.Dialog_launchErrorMessage;
if (status != null) {
ErrorDialog.openError(RdtDebugUiPlugin.getActiveWorkbenchWindow().getShell(), title, message, status);
}
@@ -113,7 +113,7 @@
case 1:
return (ILaunchConfiguration) candidateConfigs.get(0);
default:
- Status status = new Status(Status.WARNING, RdtDebugUiPlugin.PLUGIN_ID, 0, RdtDebugUiMessages.getString("LaunchConfigurationShortcut.Ruby.multipleConfigurationsError"), null);
+ Status status = new Status(Status.WARNING, RdtDebugUiPlugin.PLUGIN_ID, 0, RdtDebugUiMessages.LaunchConfigurationShortcut_Ruby_multipleConfigurationsError, null);
throw new CoreException(status);
}
}
@@ -157,7 +157,7 @@
}
protected void showNoInterpreterDialog() {
- MessageDialog.openInformation(RubyPlugin.getActiveWorkbenchShell(), RdtDebugUiMessages.getString("Dialog.launchWithoutSelectedInterpreter.title"), RdtDebugUiMessages.getString("Dialog.launchWithoutSelectedInterpreter"));
+ MessageDialog.openInformation(RubyPlugin.getActiveWorkbenchShell(), RdtDebugUiMessages.Dialog_launchWithoutSelectedInterpreter_title, RdtDebugUiMessages.Dialog_launchWithoutSelectedInterpreter);
}
protected static String getDefaultWorkingDirectory(IProject project) {
Modified: trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/launcher/RubyArgumentsTab.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/launcher/RubyArgumentsTab.java 2007-01-22 20:57:20 UTC (rev 1848)
+++ trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/launcher/RubyArgumentsTab.java 2007-01-22 21:00:44 UTC (rev 1849)
@@ -36,9 +36,9 @@
public void createControl(Composite parent) {
Composite composite = createPageRoot(parent);
- new Label(composite, SWT.NONE).setText(RdtDebugUiMessages.getString("LaunchConfigurationTab.RubyArguments.working_dir"));
+ new Label(composite, SWT.NONE).setText(RdtDebugUiMessages.LaunchConfigurationTab_RubyArguments_working_dir);
workingDirectorySelector = new DirectorySelector(composite);
- workingDirectorySelector.setBrowseDialogMessage(RdtDebugUiMessages.getString("LaunchConfigurationTab.RubyArguments.working_dir_browser_message"));
+ workingDirectorySelector.setBrowseDialogMessage(RdtDebugUiMessages.LaunchConfigurationTab_RubyArguments_working_dir_browser_message);
workingDirectorySelector.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
workingDirectorySelector.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
@@ -56,12 +56,12 @@
setUseDefaultWorkingDirectory(((Button) e.getSource()).getSelection());
}
});
- new Label(defaultWorkingDirectoryComposite, SWT.NONE).setText(RdtDebugUiMessages.getString("LaunchConfigurationTab.RubyArguments.working_dir_use_default_message"));
+ new Label(defaultWorkingDirectoryComposite, SWT.NONE).setText(RdtDebugUiMessages.LaunchConfigurationTab_RubyArguments_working_dir_use_default_message);
defaultWorkingDirectoryComposite.pack();
Label verticalSpacer = new Label(composite, SWT.NONE);
- new Label(composite, SWT.NONE).setText(RdtDebugUiMessages.getString("LaunchConfigurationTab.RubyArguments.interpreter_args_box_title"));
+ new Label(composite, SWT.NONE).setText(RdtDebugUiMessages.LaunchConfigurationTab_RubyArguments_interpreter_args_box_title);
interpreterArgsText = new Text(composite, SWT.MULTI | SWT.V_SCROLL | SWT.BORDER);
interpreterArgsText.setLayoutData(new GridData(GridData.FILL_BOTH));
interpreterArgsText.addModifyListener(new ModifyListener() {
@@ -70,7 +70,7 @@
}
});
- new Label(composite, SWT.NONE).setText(RdtDebugUiMessages.getString("LaunchConfigurationTab.RubyArguments.program_args_box_title"));
+ new Label(composite, SWT.NONE).setText(RdtDebugUiMessages.LaunchConfigurationTab_RubyArguments_program_args_box_title);
programArgsText = new Text(composite, SWT.MULTI | SWT.V_SCROLL | SWT.BORDER);
programArgsText.setLayoutData(new GridData(GridData.FILL_BOTH));
programArgsText.addModifyListener(new ModifyListener() {
@@ -133,14 +133,14 @@
}
public String getName() {
- return RdtDebugUiMessages.getString("LaunchConfigurationTab.RubyArguments.name");
+ return RdtDebugUiMessages.LaunchConfigurationTab_RubyArguments_name;
}
public boolean isValid(ILaunchConfiguration launchConfig) {
try {
String workingDirectory = launchConfig.getAttribute(RubyLaunchConfigurationAttribute.WORKING_DIRECTORY, "");
if (workingDirectory.length() == 0) {
- setErrorMessage(RdtDebugUiMessages.getString("LaunchConfigurationTab.RubyArguments.working_dir_error_message"));
+ setErrorMessage(RdtDebugUiMessages.LaunchConfigurationTab_RubyArguments_working_dir_error_message);
return false;
}
} catch (CoreException e) {
Modified: trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/launcher/RubyEntryPointTab.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/launcher/RubyEntryPointTab.java 2007-01-22 20:57:20 UTC (rev 1848)
+++ trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/launcher/RubyEntryPointTab.java 2007-01-22 21:00:44 UTC (rev 1849)
@@ -37,9 +37,9 @@
public void createControl(Composite parent) {
Composite composite = createPageRoot(parent);
- new Label(composite, SWT.NONE).setText(RdtDebugUiMessages.getString("LaunchConfigurationTab.RubyEntryPoint.projectLabel"));
+ new Label(composite, SWT.NONE).setText(RdtDebugUiMessages.LaunchConfigurationTab_RubyEntryPoint_projectLabel);
projectSelector = new RubyProjectSelector(composite);
- projectSelector.setBrowseDialogMessage(RdtDebugUiMessages.getString("LaunchConfigurationTab.RubyEntryPoint.projectSelectorMessage"));
+ projectSelector.setBrowseDialogMessage(RdtDebugUiMessages.LaunchConfigurationTab_RubyEntryPoint_projectSelectorMessage);
projectSelector.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
projectSelector.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent evt) {
@@ -47,9 +47,9 @@
}
});
- new Label(composite, SWT.NONE).setText(RdtDebugUiMessages.getString("LaunchConfigurationTab.RubyEntryPoint.fileLabel"));
+ new Label(composite, SWT.NONE).setText(RdtDebugUiMessages.LaunchConfigurationTab_RubyEntryPoint_fileLabel);
fileSelector = new RubyFileSelector(composite, projectSelector);
- fileSelector.setBrowseDialogMessage(RdtDebugUiMessages.getString("LaunchConfigurationTab.RubyEntryPoint.fileSelectorMessage"));
+ fileSelector.setBrowseDialogMessage(RdtDebugUiMessages.LaunchConfigurationTab_RubyEntryPoint_fileSelectorMessage);
fileSelector.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
fileSelector.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent evt) {
@@ -104,7 +104,7 @@
}
public String getName() {
- return RdtDebugUiMessages.getString("LaunchConfigurationTab.RubyEntryPoint.name");
+ return RdtDebugUiMessages.LaunchConfigurationTab_RubyEntryPoint_name;
}
public boolean isValid(ILaunchConfiguration launchConfig) {
@@ -112,13 +112,13 @@
String projectName = launchConfig.getAttribute(RubyLaunchConfigurationAttribute.PROJECT_NAME, "");
if (projectName.length() == 0) {
- setErrorMessage(RdtDebugUiMessages.getString("LaunchConfigurationTab.RubyEntryPoint.invalidProjectSelectionMessage"));
+ setErrorMessage(RdtDebugUiMessages.LaunchConfigurationTab_RubyEntryPoint_invalidProjectSelectionMessage);
return false;
}
String fileName = launchConfig.getAttribute(RubyLaunchConfigurationAttribute.FILE_NAME, "");
if (fileName.length() == 0) {
- setErrorMessage(RdtDebugUiMessages.getString("LaunchConfigurationTab.RubyEntryPoint.invalidFileSelectionMessage"));
+ setErrorMessage(RdtDebugUiMessages.LaunchConfigurationTab_RubyEntryPoint_invalidFileSelectionMessage);
return false;
}
} catch (CoreException e) {
Modified: trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/launcher/RubyEnvironmentTab.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/launcher/RubyEnvironmentTab.java 2007-01-22 20:57:20 UTC (rev 1848)
+++ trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/launcher/RubyEnvironmentTab.java 2007-01-22 21:00:44 UTC (rev 1849)
@@ -80,15 +80,13 @@
TabItem loadPathTab = new TabItem(tabFolder, SWT.NONE, 0);
loadPathTab
- .setText(RdtDebugUiMessages
- .getString("LaunchConfigurationTab.RubyEnvironment.loadPathTab.label"));
+ .setText(RdtDebugUiMessages.LaunchConfigurationTab_RubyEnvironment_loadPathTab_label);
loadPathTab.setControl(loadPathComposite);
loadPathTab.setData(loadPathListViewer);
loadPathDefaultButton = new Button(loadPathComposite, SWT.CHECK);
loadPathDefaultButton
- .setText(RdtDebugUiMessages
- .getString("LaunchConfigurationTab.RubyEnvironment.loadPathDefaultButton.label"));
+ .setText(RdtDebugUiMessages.LaunchConfigurationTab_RubyEnvironment_loadPathDefaultButton_label);
loadPathDefaultButton.setLayoutData(new GridData(
GridData.HORIZONTAL_ALIGN_BEGINNING));
loadPathDefaultButton
@@ -135,14 +133,12 @@
Button interpreterAddButton = new Button(interpreterComposite, SWT.PUSH);
interpreterAddButton
- .setText(RdtDebugUiMessages
- .getString("LaunchConfigurationTab.RubyEnvironment.interpreterAddButton.label"));
+ .setText(RdtDebugUiMessages.LaunchConfigurationTab_RubyEnvironment_interpreterAddButton_label);
interpreterAddButton.addSelectionListener(new AddInterpreterSelectionAdapter(interpreterCombo, getShell()));
TabItem interpreterTab = new TabItem(tabFolder, SWT.NONE);
interpreterTab
- .setText(RdtDebugUiMessages
- .getString("LaunchConfigurationTab.RubyEnvironment.interpreterTab.label"));
+ .setText(RdtDebugUiMessages.LaunchConfigurationTab_RubyEnvironment_interpreterTab_label);
interpreterTab.setControl(interpreterComposite);
}
@@ -199,8 +195,7 @@
}
public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
- IVMInstall defaultInterpreter = RubyRuntime.getDefault()
- .getDefaultVMInstall();
+ IVMInstall defaultInterpreter = RubyRuntime.getDefaultVMInstall();
if (defaultInterpreter != null) {
configuration.setAttribute(
RubyLaunchConfigurationAttribute.SELECTED_INTERPRETER,
@@ -324,8 +319,7 @@
}
public String getName() {
- return RdtDebugUiMessages
- .getString("LaunchConfigurationTab.RubyEnvironment.name");
+ return RdtDebugUiMessages.LaunchConfigurationTab_RubyEnvironment_name;
}
public boolean isValid(ILaunchConfiguration launchConfig) {
@@ -333,8 +327,7 @@
String selectedInterpreter = launchConfig.getAttribute(
RubyLaunchConfigurationAttribute.SELECTED_INTERPRETER, "");
if (selectedInterpreter.length() == 0) {
- setErrorMessage(RdtDebugUiMessages
- .getString("LaunchConfigurationTab.RubyEnvironment.interpreter_not_selected_error_message"));
+ setErrorMessage(RdtDebugUiMessages.LaunchConfigurationTab_RubyEnvironment_interpreter_not_selected_error_message);
return false;
}
} catch (CoreException e) {
Modified: trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/preferences/EditEvaluationExpressionDialog.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/preferences/EditEvaluationExpressionDialog.java 2007-01-22 20:57:20 UTC (rev 1848)
+++ trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/preferences/EditEvaluationExpressionDialog.java 2007-01-22 21:00:44 UTC (rev 1849)
@@ -50,17 +50,17 @@
composite.setLayout(layout);
composite.setLayoutData(new GridData(GridData.FILL_BOTH)) ;
- new Label(composite, SWT.NONE).setText(RdtDebugUiMessages.getString("EditEvaluationExpression.name.label")); //$NON-NLS-1$
+ new Label(composite, SWT.NONE).setText(RdtDebugUiMessages.EditEvaluationExpression_name_label);
txtName = new Text(composite, SWT.SINGLE | SWT.BORDER);
txtName.setLayoutData(new GridData(GridData.FILL_BOTH));
txtName.setText(evaluationExpression.getName());
- new Label(composite, SWT.NONE).setText(RdtDebugUiMessages.getString("EditEvaluationExpression.description.label")); //$NON-NLS-1$
+ new Label(composite, SWT.NONE).setText(RdtDebugUiMessages.EditEvaluationExpression_description_label);
txtDescription = new Text(composite, SWT.SINGLE | SWT.BORDER);
txtDescription.setLayoutData(new GridData(GridData.FILL_BOTH)) ;
txtDescription.setText(evaluationExpression.getDescription()) ;
- new Label(composite, SWT.NONE).setText(RdtDebugUiMessages.getString("EditEvaluationExpression.expression.label")); //$NON-NLS-1$
+ new Label(composite, SWT.NONE).setText(RdtDebugUiMessages.EditEvaluationExpression_expression_label);
txtExpression = new Text(composite, SWT.SINGLE | SWT.BORDER);
txtExpression.setLayoutData(new GridData(GridData.FILL_BOTH)) ;
txtExpression.setText(evaluationExpression.getExpression()) ;
Modified: trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/preferences/EvaluationExpressionsPreferencePage.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/preferences/EvaluationExpressionsPreferencePage.java 2007-01-22 20:57:20 UTC (rev 1848)
+++ trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/preferences/EvaluationExpressionsPreferencePage.java 2007-01-22 21:00:44 UTC (rev 1849)
@@ -219,7 +219,7 @@
public EvaluationExpressionsPreferencePage() {
super();
fModel = new EditableExpressionModel();
- setDescription(RdtDebugUiMessages.getString("EvaluationExpressionsPreferencePage.description"));
+ setDescription(RdtDebugUiMessages.EvaluationExpressionsPreferencePage_description);
}
/*
@@ -262,10 +262,10 @@
table.setLayout(tableLayout);
TableColumn column1 = new TableColumn(table, SWT.NONE);
- column1.setText(RdtDebugUiMessages.getString("EvaluationExpressionsPreferencePage.column.name")); //$NON-NLS-1$
+ column1.setText(RdtDebugUiMessages.EvaluationExpressionsPreferencePage_column_name);
TableColumn column2 = new TableColumn(table, SWT.NONE);
- column2.setText(RdtDebugUiMessages.getString("EvaluationExpressionsPreferencePage.column.description")); //$NON-NLS-1$
+ column2.setText(RdtDebugUiMessages.EvaluationExpressionsPreferencePage_column_description);
fTableViewer = new TableViewer(table);
fTableViewer.setLabelProvider(new EvaluationExpressionLabelProvider());
@@ -293,7 +293,7 @@
buttons.setLayout(layout);
fAddButton = new Button(buttons, SWT.PUSH);
- fAddButton.setText(RdtDebugUiMessages.getString("EvaluationExpressionsPreferencePage.new")); //$NON-NLS-1$
+ fAddButton.setText(RdtDebugUiMessages.EvaluationExpressionsPreferencePage_new);
fAddButton.setLayoutData(getButtonGridData(fAddButton));
fAddButton.addListener(SWT.Selection, new Listener() {
@@ -303,7 +303,7 @@
});
fEditButton = new Button(buttons, SWT.PUSH);
- fEditButton.setText(RdtDebugUiMessages.getString("EvaluationExpressionsPreferencePage.edit")); //$NON-NLS-1$
+ fEditButton.setText(RdtDebugUiMessages.EvaluationExpressionsPreferencePage_edit);
fEditButton.setLayoutData(getButtonGridData(fEditButton));
fEditButton.addListener(SWT.Selection, new Listener() {
@@ -313,7 +313,7 @@
});
fRemoveButton = new Button(buttons, SWT.PUSH);
- fRemoveButton.setText(RdtDebugUiMessages.getString("EvaluationExpressionsPreferencePage.remove")); //$NON-NLS-1$
+ fRemoveButton.setText(RdtDebugUiMessages.EvaluationExpressionsPreferencePage_remove);
fRemoveButton.setLayoutData(getButtonGridData(fRemoveButton));
fRemoveButton.addListener(SWT.Selection, new Listener() {
@@ -325,7 +325,7 @@
createSeparator(buttons);
fImportButton = new Button(buttons, SWT.PUSH);
- fImportButton.setText(RdtDebugUiMessages.getString("EvaluationExpressionsPreferencePage.import")); //$NON-NLS-1$
+ fImportButton.setText(RdtDebugUiMessages.EvaluationExpressionsPreferencePage_import);
fImportButton.setLayoutData(getButtonGridData(fImportButton));
fImportButton.addListener(SWT.Selection, new Listener() {
@@ -335,7 +335,7 @@
});
fExportButton = new Button(buttons, SWT.PUSH);
- fExportButton.setText(RdtDebugUiMessages.getString("EvaluationExpressionsPreferencePage.export")); //$NON-NLS-1$
+ fExportButton.setText(RdtDebugUiMessages.EvaluationExpressionsPreferencePage_export);
fExportButton.setLayoutData(getButtonGridData(fExportButton));
fExportButton.addListener(SWT.Selection, new Listener() {
@@ -439,7 +439,7 @@
private void add() {
EvaluationExpression evalExpression = new EvaluationExpression("", "", "");
- String title = RdtDebugUiMessages.getString("EditEvaluationExpressionDialog.add");
+ String title = RdtDebugUiMessages.EditEvaluationExpressionDialog_add;
Dialog dialog = new EditEvaluationExpressionDialog(getShell(), title, evalExpression);
if (dialog.open() == Window.OK) {
fModel.addExpression(evalExpression);
@@ -459,7 +459,7 @@
}
private void edit(EvaluationExpression evalExpression) {
- String title = RdtDebugUiMessages.getString("EditEvaluationExpressionDialog.edit");
+ String title = RdtDebugUiMessages.EditEvaluationExpressionDialog_edit;
Dialog dialog = new EditEvaluationExpressionDialog(getShell(), title, evalExpression);
if (dialog.open() == Window.OK) {
fTableViewer.refresh();
@@ -468,8 +468,8 @@
private void importFile() {
FileDialog dialog = new FileDialog(getShell());
- dialog.setText(RdtDebugUiMessages.getString("EvaluationExpressionsPreferencePage.import.title")); //$NON-NLS-1$
- dialog.setFilterExtensions(new String[] { RdtDebugUiMessages.getString("EvaluationExpressionsPreferencePage.importexport.extension")}); //$NON-NLS-1$
+ dialog.setText(RdtDebugUiMessages.EvaluationExpressionsPreferencePage_import_title);
+ dialog.setFilterExtensions(new String[] { RdtDebugUiMessages.EvaluationExpressionsPreferencePage_importexport_extension});
String path = dialog.open();
if (path == null) return;
@@ -502,9 +502,9 @@
private void export(EvaluationExpression[] expressions) {
FileDialog dialog = new FileDialog(getShell(), SWT.SAVE);
- dialog.setText(RdtDebugUiMessages.getFormattedString("EvaluationExpressionsPreferencePage.export.title", new Integer(expressions.length))); //$NON-NLS-1$
- dialog.setFilterExtensions(new String[] { RdtDebugUiMessages.getString("EvaluationExpressionsPreferencePage.importexport.extension")}); //$NON-NLS-1$
- dialog.setFileName(RdtDebugUiMessages.getString("EvaluationExpressionsPreferencePage.export.filename")); //$NON-NLS-1$
+ dialog.setText(RdtDebugUiMessages.getFormattedString(RdtDebugUiMessages.EvaluationExpressionsPreferencePage_export_title, new Integer(expressions.length)));
+ dialog.setFilterExtensions(new String[] { RdtDebugUiMessages.EvaluationExpressionsPreferencePage_importexport_extension});
+ dialog.setFileName(RdtDebugUiMessages.EvaluationExpressionsPreferencePage_export_filename);
String path = dialog.open();
if (path == null) return;
@@ -512,15 +512,15 @@
File file = new File(path);
if (file.isHidden()) {
- String title = RdtDebugUiMessages.getString("EvaluationExpressionsPreferencePage.export.error.title"); //$NON-NLS-1$
- String message = RdtDebugUiMessages.getFormattedString("EvaluationExpressionsPreferencePage.export.error.hidden", file.getAbsolutePath()); //$NON-NLS-1$
+ String title = RdtDebugUiMessages.EvaluationExpressionsPreferencePage_export_error_title;
+ String message = RdtDebugUiMessages.getFormattedString(RdtDebugUiMessages.EvaluationExpressionsPreferencePage_export_error_hidden, file.getAbsolutePath());
MessageDialog.openError(getShell(), title, message);
return;
}
if (file.exists() && !file.canWrite()) {
- String title = RdtDebugUiMessages.getString("EvaluationExpressionsPreferencePage.export.error.title"); //$NON-NLS-1$
- String message = RdtDebugUiMessages.getFormattedString("EvaluationExpressionsPreferencePage.export.error.canNotWrite", file.getAbsolutePath()); //$NON-NLS-1$
+ String title = RdtDebugUiMessages.EvaluationExpressionsPreferencePage_export_error_title;
+ String message = RdtDebugUiMessages.getFormattedString(RdtDebugUiMessages.EvaluationExpressionsPreferencePage_export_error_canNotWrite, file.getAbsolutePath());
MessageDialog.openError(getShell(), title, message);
return;
}
@@ -536,8 +536,8 @@
}
private boolean confirmOverwrite(File file) {
- return MessageDialog.openQuestion(getShell(), RdtDebugUiMessages.getString("EvaluationExpressionsPreferencePage.export.exists.title"), //$NON-NLS-1$
- RdtDebugUiMessages.getFormattedString("EvaluationExpressionsPreferencePage.export.exists.message", file.getAbsolutePath())); //$NON-NLS-1$
+ return MessageDialog.openQuestion(getShell(), RdtDebugUiMessages.EvaluationExpressionsPreferencePage_export_exists_title,
+ RdtDebugUiMessages.getFormattedString(RdtDebugUiMessages.EvaluationExpressionsPreferencePage_export_exists_message, file.getAbsolutePath()));
}
private void remove() {
@@ -552,7 +552,7 @@
public void setVisible(boolean visible) {
super.setVisible(visible);
- if (visible) setTitle(RdtDebugUiMessages.getString("EvaluationExpressionsPreferencePage.title")); //$NON-NLS-1$
+ if (visible) setTitle(RdtDebugUiMessages.EvaluationExpressionsPreferencePage_title);
}
/*
Modified: trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/preferences/RubyInterpreterPreferencePage.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/preferences/RubyInterpreterPreferencePage.java 2007-01-22 20:57:20 UTC (rev 1848)
+++ trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/preferences/RubyInterpreterPreferencePage.java 2007-01-22 21:00:44 UTC (rev 1849)
@@ -110,7 +110,7 @@
addButton = new Button(buttons, SWT.PUSH);
addButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- addButton.setText(RdtDebugUiMessages.getString("RubyInterpreterPreferencePage.addButton.label")); //$NON-NLS-1$
+ addButton.setText(RdtDebugUiMessages.RubyInterpreterPreferencePage_addButton_label);
addButton.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event evt) {
addInterpreter();
@@ -119,7 +119,7 @@
editButton = new Button(buttons, SWT.PUSH);
editButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- editButton.setText(RdtDebugUiMessages.getString("RubyInterpreterPreferencePage.editButton.label")); //$NON-NLS-1$
+ editButton.setText(RdtDebugUiMessages.RubyInterpreterPreferencePage_editButton_label);
editButton.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event evt) {
editInterpreter();
@@ -128,7 +128,7 @@
removeButton = new Button(buttons, SWT.PUSH);
removeButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- removeButton.setText(RdtDebugUiMessages.getString("RubyInterpreterPreferencePage.removeButton.label")); //$NON-NLS-1$
+ removeButton.setText(RdtDebugUiMessages.RubyInterpreterPreferencePage_removeButton_label);
removeButton.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event evt) {
removeInterpreter();
@@ -170,11 +170,11 @@
table.setLinesVisible(false);
TableColumn column = new TableColumn(table, SWT.NULL);
- column.setText(RdtDebugUiMessages.getString("RubyInterpreterPreferencePage.rubyInterpreterTable.interpreterName")); //$NON-NLS-1$
+ column.setText(RdtDebugUiMessages.RubyInterpreterPreferencePage_rubyInterpreterTable_interpreterName);
column.setWidth(125);
column = new TableColumn(table, SWT.NULL);
- column.setText(RdtDebugUiMessages.getString("RubyInterpreterPreferencePage.rubyInterpreterTable.interpreterPath")); //$NON-NLS-1$
+ column.setText(RdtDebugUiMessages.RubyInterpreterPreferencePage_rubyInterpreterTable_interpreterPath);
column.setWidth(350);
return table;
Modified: trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/rubyvms/RubyVMMessages.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/rubyvms/RubyVMMessages.java 2007-01-22 20:57:20 UTC (rev 1848)
+++ trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/rubyvms/RubyVMMessages.java 2007-01-22 21:00:44 UTC (rev 1849)
@@ -20,7 +20,6 @@
public static String InstalledJREsBlock_8;
public static String JREsUpdater_0;
public static String addVMDialog_pickJRERootDialog_message;
-
public static String VMLibraryBlock_7;
public static String VMLibraryBlock_6;
public static String VMLibraryBlock_4;
Modified: trunk/org.rubypeople.rdt.debug.ui.tests/src/org/rubypeople/rdt/internal/debug/ui/launcher/TC_RubyArgumentsTab.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.ui.tests/src/org/rubypeople/rdt/internal/debug/ui/launcher/TC_RubyArgumentsTab.java 2007-01-22 20:57:20 UTC (rev 1848)
+++ trunk/org.rubypeople.rdt.debug.ui.tests/src/org/rubypeople/rdt/internal/debug/ui/launcher/TC_RubyArgumentsTab.java 2007-01-22 21:00:44 UTC (rev 1849)
@@ -21,7 +21,7 @@
String errorMessage = tab.getErrorMessage();
assertNull("There should be no error message.", errorMessage);
assertTrue("The tab is not valid when the configuration is completely empty.", !tab.isValid(configuration));
- errorMessage = RdtDebugUiMessages.getString("LaunchConfigurationTab.RubyArguments.working_dir_error_message");
+ errorMessage = RdtDebugUiMessages.LaunchConfigurationTab_RubyArguments_working_dir_error_message;
assertEquals("The tab should set the error message for invalid working directory.", errorMessage, tab.getErrorMessage());
configuration.setAttribute(RubyLaunchConfigurationAttribute.WORKING_DIRECTORY, "aValidDirectory");
Modified: trunk/org.rubypeople.rdt.debug.ui.tests/src/org/rubypeople/rdt/internal/debug/ui/launcher/TC_RubyEntryPointTab.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.ui.tests/src/org/rubypeople/rdt/internal/debug/ui/launcher/TC_RubyEntryPointTab.java 2007-01-22 20:57:20 UTC (rev 1848)
+++ trunk/org.rubypeople.rdt.debug.ui.tests/src/org/rubypeople/rdt/internal/debug/ui/launcher/TC_RubyEntryPointTab.java 2007-01-22 21:00:44 UTC (rev 1849)
@@ -21,12 +21,12 @@
String errorMessage = tab.getErrorMessage();
assertNull("There should be no error message.", errorMessage);
assertTrue("The tab is not valid when the configuration is completely empty.", !tab.isValid(configuration));
- errorMessage = RdtDebugUiMessages.getString("LaunchConfigurationTab.RubyEntryPoint.invalidProjectSelectionMessage");
+ errorMessage = RdtDebugUiMessages.LaunchConfigurationTab_RubyEntryPoint_invalidProjectSelectionMessage;
assertEquals("The tab should set the error message for no project.", errorMessage, tab.getErrorMessage());
configuration.setAttribute(RubyLaunchConfigurationAttribute.PROJECT_NAME, "myProjectName");
assertTrue("The tab is not valid when the configuration has only a projectname.", !tab.isValid(configuration));
- errorMessage = RdtDebugUiMessages.getString("LaunchConfigurationTab.RubyEntryPoint.invalidFileSelectionMessage");
+ errorMessage = RdtDebugUiMessages.LaunchConfigurationTab_RubyEntryPoint_invalidFileSelectionMessage;
assertEquals("The tab should set the error message for no file.", errorMessage, tab.getErrorMessage());
configuration.setAttribute(RubyLaunchConfigurationAttribute.FILE_NAME, "myFileName");
Modified: trunk/org.rubypeople.rdt.debug.ui.tests/src/org/rubypeople/rdt/internal/debug/ui/launcher/TC_RubyEnvironmentTab.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.ui.tests/src/org/rubypeople/rdt/internal/debug/ui/launcher/TC_RubyEnvironmentTab.java 2007-01-22 20:57:20 UTC (rev 1848)
+++ trunk/org.rubypeople.rdt.debug.ui.tests/src/org/rubypeople/rdt/internal/debug/ui/launcher/TC_RubyEnvironmentTab.java 2007-01-22 21:00:44 UTC (rev 1849)
@@ -21,7 +21,7 @@
String errorMessage = tab.getErrorMessage();
assertNull("There should be no error message.", errorMessage);
assertTrue("The tab is not valid when the configuration is completely empty.", !tab.isValid(configuration));
- errorMessage = RdtDebugUiMessages.getString("LaunchConfigurationTab.RubyEnvironment.interpreter_not_selected_error_message");
+ errorMessage = RdtDebugUiMessages.LaunchConfigurationTab_RubyEnvironment_interpreter_not_selected_error_message;
assertEquals("The tab should set the error message for no interpreter selected.", errorMessage, tab.getErrorMessage());
configuration.setAttribute(RubyLaunchConfigurationAttribute.SELECTED_INTERPRETER, "anInterpreter");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-01-22 20:57:22
|
Revision: 1848
http://svn.sourceforge.net/rubyeclipse/?rev=1848&view=rev
Author: cawilliams
Date: 2007-01-22 12:57:20 -0800 (Mon, 22 Jan 2007)
Log Message:
-----------
try to move us towards using only subclasses of NLS for translations - so we get accurate information on what strings are missing and what are unused.
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/folding/DefaultRubyFoldingPreferenceBlock.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/folding/EmptyRubyFoldingPreferenceBlock.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/folding/FoldingMessages.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/folding/FoldingMessages.properties
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/folding/DefaultRubyFoldingPreferenceBlock.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/folding/DefaultRubyFoldingPreferenceBlock.java 2007-01-22 20:56:38 UTC (rev 1847)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/folding/DefaultRubyFoldingPreferenceBlock.java 2007-01-22 20:57:20 UTC (rev 1848)
@@ -84,11 +84,11 @@
inner.setLayout(layout);
Label label= new Label(inner, SWT.LEFT);
- label.setText(FoldingMessages.getString("DefaultRubyFoldingPreferenceBlock.title")); //$NON-NLS-1$
+ label.setText(FoldingMessages.DefaultRubyFoldingPreferenceBlock_title);
- addCheckBox(inner, FoldingMessages.getString("DefaultRubyFoldingPreferenceBlock.comments"), PreferenceConstants.EDITOR_FOLDING_RDOC, 0); //$NON-NLS-1$
- addCheckBox(inner, FoldingMessages.getString("DefaultRubyFoldingPreferenceBlock.innerTypes"), PreferenceConstants.EDITOR_FOLDING_INNERTYPES, 0); //$NON-NLS-1$
- addCheckBox(inner, FoldingMessages.getString("DefaultRubyFoldingPreferenceBlock.methods"), PreferenceConstants.EDITOR_FOLDING_METHODS, 0); //$NON-NLS-1$
+ addCheckBox(inner, FoldingMessages.DefaultRubyFoldingPreferenceBlock_comments, PreferenceConstants.EDITOR_FOLDING_RDOC, 0); //$NON-NLS-1$
+ addCheckBox(inner, FoldingMessages.DefaultRubyFoldingPreferenceBlock_innerTypes, PreferenceConstants.EDITOR_FOLDING_INNERTYPES, 0); //$NON-NLS-1$
+ addCheckBox(inner, FoldingMessages.DefaultRubyFoldingPreferenceBlock_methods, PreferenceConstants.EDITOR_FOLDING_METHODS, 0); //$NON-NLS-1$
return inner;
}
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/folding/EmptyRubyFoldingPreferenceBlock.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/folding/EmptyRubyFoldingPreferenceBlock.java 2007-01-22 20:56:38 UTC (rev 1847)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/folding/EmptyRubyFoldingPreferenceBlock.java 2007-01-22 20:57:20 UTC (rev 1848)
@@ -40,7 +40,7 @@
label.setLayoutData(gd);
label= new Label(inner, SWT.CENTER);
- label.setText(FoldingMessages.getString("EmptyRubyFoldingPreferenceBlock.emptyCaption")); //$NON-NLS-1$
+ label.setText(FoldingMessages.EmptyRubyFoldingPreferenceBlock_emptyCaption);
gd= new GridData(GridData.CENTER);
label.setLayoutData(gd);
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/folding/FoldingMessages.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/folding/FoldingMessages.java 2007-01-22 20:56:38 UTC (rev 1847)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/folding/FoldingMessages.java 2007-01-22 20:57:20 UTC (rev 1848)
@@ -10,26 +10,24 @@
*******************************************************************************/
package org.rubypeople.rdt.internal.ui.text.folding;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
+import org.eclipse.osgi.util.NLS;
/**
- * @since 3.0
+ * @since 0.8.0
*/
-class FoldingMessages {
+class FoldingMessages extends NLS {
private static final String BUNDLE_NAME= FoldingMessages.class.getName();
-
- private static final ResourceBundle RESOURCE_BUNDLE= ResourceBundle.getBundle(BUNDLE_NAME);
-
private FoldingMessages() {
}
+
+ public static String DefaultRubyFoldingPreferenceBlock_title;
+ public static String DefaultRubyFoldingPreferenceBlock_comments;
+ public static String DefaultRubyFoldingPreferenceBlock_innerTypes;
+ public static String DefaultRubyFoldingPreferenceBlock_methods;
+ public static String EmptyRubyFoldingPreferenceBlock_emptyCaption;
- public static String getString(String key) {
- try {
- return RESOURCE_BUNDLE.getString(key);
- } catch (MissingResourceException e) {
- return '!' + key + '!';
- }
+ static {
+ NLS.initializeMessages(BUNDLE_NAME, FoldingMessages.class);
}
}
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/folding/FoldingMessages.properties
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/folding/FoldingMessages.properties 2007-01-22 20:56:38 UTC (rev 1847)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/folding/FoldingMessages.properties 2007-01-22 20:57:20 UTC (rev 1848)
@@ -10,10 +10,9 @@
###############################################################################
-DefaultRubyFoldingPreferenceBlock.title= Initially fold these region types:
-DefaultRubyFoldingPreferenceBlock.comments= &Comments
-DefaultRubyFoldingPreferenceBlock.innerTypes= Inner &types
-DefaultRubyFoldingPreferenceBlock.methods= &Methods
-DefaultRubyFoldingPreferenceBlock.imports= &Imports
+DefaultRubyFoldingPreferenceBlock_title= Initially fold these region types:
+DefaultRubyFoldingPreferenceBlock_comments= &Comments
+DefaultRubyFoldingPreferenceBlock_innerTypes= Inner &types
+DefaultRubyFoldingPreferenceBlock_methods= &Methods
-EmptyRubyFoldingPreferenceBlock.emptyCaption=
+EmptyRubyFoldingPreferenceBlock_emptyCaption=
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|