|
From: <caw...@us...> - 2007-01-05 15:49:11
|
Revision: 1753
http://svn.sourceforge.net/rubyeclipse/?rev=1753&view=rev
Author: cawilliams
Date: 2007-01-05 07:49:09 -0800 (Fri, 05 Jan 2007)
Log Message:
-----------
massive overhaul under the hood to add SourceFolderRoot into RubyElement hierarchy, and to include some actual loadpath support. This is to pave the way for referencing external libraries like the core/std ruby lib
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core/META-INF/MANIFEST.MF
trunk/org.rubypeople.rdt.core/plugin.xml
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/IRubyElement.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/IRubyModelMarker.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/IRubyModelStatusConstants.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/IRubyProject.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/ISourceFolder.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/IType.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/RubyConventions.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/RubyCore.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/CompletionEngine.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/CreateSourceFolderOperation.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/DeltaProcessingState.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/DeltaProcessor.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/LoadpathEntry.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/ModelUpdater.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/Openable.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/RubyModelManager.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/RubyProjectElementInfo.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/RubyScriptProblemFinder.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyType.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/SourceFolderInfo.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/RubyBuilder.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/util/CharOperation.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/util/Util.java
trunk/org.rubypeople.rdt.core.tests/src/RubyParserCmd.java
trunk/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/internal/core/TC_RubyProject.java
trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/launcher/RubyEnvironmentTab.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/InterpreterRunnerConfiguration.java
trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/testunit/wizards/RubyNewTestCaseWizardPage.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/corext/util/RubyModelUtil.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/RubyProjectLibraryPage.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/RubyProjectPropertyPage.java
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
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/NewClassCreationWizard.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/NewElementWizard.java
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.properties
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/RubyElementLabels.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/StandardRubyElementContentProvider.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/wizards/NewClassWizardPage.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/wizards/NewContainerWizardPage.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/wizards/NewTypeWizardPage.java
Added Paths:
-----------
trunk/org.rubypeople.rdt.core/schema/
trunk/org.rubypeople.rdt.core/schema/loadpathContainerInitializer.exsd
trunk/org.rubypeople.rdt.core/schema/loadpathVariableInitializer.exsd
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/ILoadpathContainer.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/ISourceFolderRoot.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/LoadpathContainerInitializer.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/LoadpathVariableInitializer.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/compiler/
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/compiler/util/
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/compiler/util/ObjectVector.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/compiler/util/Util.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/ExternalPackageFragmentRoot.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/SetLoadpathOperation.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/SourceFolderRoot.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/SourceFolderRootInfo.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/XMLWriter.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/util/HashtableOfArrayToObject.java
trunk/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/core/tests/
trunk/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/core/tests/AbstractRubyModelTest.java
trunk/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/core/tests/ModifyingResourceTest.java
trunk/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/core/tests/util/
trunk/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/core/tests/util/Util.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/dialogfields/StringButtonStatusDialogField.java
Modified: trunk/org.rubypeople.rdt.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/org.rubypeople.rdt.core/META-INF/MANIFEST.MF 2007-01-05 13:44:00 UTC (rev 1752)
+++ trunk/org.rubypeople.rdt.core/META-INF/MANIFEST.MF 2007-01-05 15:49:09 UTC (rev 1753)
@@ -25,5 +25,6 @@
org.eclipse.core.resources,
org.eclipse.team.core,
org.eclipse.jface.text,
- org.jruby
+ org.jruby,
+ org.eclipse.core.filesystem
Eclipse-LazyStart: true
Modified: trunk/org.rubypeople.rdt.core/plugin.xml
===================================================================
--- trunk/org.rubypeople.rdt.core/plugin.xml 2007-01-05 13:44:00 UTC (rev 1752)
+++ trunk/org.rubypeople.rdt.core/plugin.xml 2007-01-05 15:49:09 UTC (rev 1753)
@@ -1,6 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.0"?>
<plugin>
+ <extension-point id="loadpathVariableInitializer" name="%loadpathVariableInitializersName" schema="schema/loadpathVariableInitializer.exsd"/>
+ <extension-point id="loadpathContainerInitializer" name="%loadpathContainerInitializersName" schema="schema/loadpathContainerInitializer.exsd"/>
<extension
id="rubynature"
Added: trunk/org.rubypeople.rdt.core/schema/loadpathContainerInitializer.exsd
===================================================================
--- trunk/org.rubypeople.rdt.core/schema/loadpathContainerInitializer.exsd (rev 0)
+++ trunk/org.rubypeople.rdt.core/schema/loadpathContainerInitializer.exsd 2007-01-05 15:49:09 UTC (rev 1753)
@@ -0,0 +1,124 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.jdt.core">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.eclipse.jdt.core" id="loadpathContainerInitializer" name="loadpath Container Initializers"/>
+ </appInfo>
+ <documentation>
+ This extension point allows clients to contribute custom loadpath container initializers,
+ which are used to lazily bind loadpath containers to instances of org.rubypeople.rdt.core.ILoadpathContainer.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <complexType>
+ <sequence>
+ <element ref="loadpathContainerInitializer" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+ a fully qualified identifier of the target extension point
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+ an optional identifier of the extension instance
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+ an optional name of the extension instance
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="loadpathContainerInitializer">
+ <complexType>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+ a unique name identifying all containers for which this initializer will be activated.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+ the load that implements this container initializer.
+ This load must implement a public subload of <code>org.rubypeople.rdt.core.LoadpathContainerInitializer</code> with a public 0-argument constructor.
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="ruby" basedOn="org.rubypeople.rdt.core.LoadpathContainerInitializer"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ 0.9.0
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ Example of a declaration of a <code>loadpathContainerInitializer</code> for a loadpath container named "JDK": <pre>
+<extension point="org.eclipse.jdt.core.loadpathContainerInitializer">
+ <loadpathContainerInitializer
+ id="JDK"
+ class="com.example.MyInitializer"/>
+</extension>
+</pre>
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiInfo"/>
+ </appInfo>
+ <documentation>
+
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="copyright"/>
+ </appInfo>
+ <documentation>
+ Copyright (c) 2000, 2004 IBM Corporation and others.<br>
+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 <a
+href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>
+ </documentation>
+ </annotation>
+
+</schema>
Added: trunk/org.rubypeople.rdt.core/schema/loadpathVariableInitializer.exsd
===================================================================
--- trunk/org.rubypeople.rdt.core/schema/loadpathVariableInitializer.exsd (rev 0)
+++ trunk/org.rubypeople.rdt.core/schema/loadpathVariableInitializer.exsd 2007-01-05 15:49:09 UTC (rev 1753)
@@ -0,0 +1,113 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.rubypeople.rdt.core">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.rubypeople.rdt.core" id="loadpathVariableInitializer" name="loadpathVariableInitializer"/>
+ </appInfo>
+ <documentation>
+ This extension point allows clients to contribute custom loadpath variable initializers,
+ which are used to lazily bind loadpath variables.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <complexType>
+ <sequence minOccurs="0" maxOccurs="unbounded">
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+ a fully qualified identifier of the target extension point
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+ an optional identifier of the extension instance
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+ an optional name of the extension instance
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="loadpathVariableInitializer">
+ <complexType>
+ <attribute name="variable" type="string" use="required">
+ <annotation>
+ <documentation>
+ a unique name identifying the variable for which this initializer will be activated.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+ The class that implements this variable initializer.
+This class must implement a public subclass of &lt;code&gt;org.rubypeople.rdt.core.LoadpathVariableInitializer&lt;/code&gt; with a public 0-argument constructor.
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="ruby" basedOn="org.rubypeople.rdt.core.LoadpathVariableInitializer"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ 0.9.0
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiInfo"/>
+ </appInfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="copyright"/>
+ </appInfo>
+ <documentation>
+
+ </documentation>
+ </annotation>
+
+</schema>
Added: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/ILoadpathContainer.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/ILoadpathContainer.java (rev 0)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/ILoadpathContainer.java 2007-01-05 15:49:09 UTC (rev 1753)
@@ -0,0 +1,9 @@
+package org.rubypeople.rdt.core;
+
+public interface ILoadpathContainer {
+
+ ILoadpathEntry[] getLoadpathEntries();
+
+ String getDescription();
+
+}
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/IRubyElement.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/IRubyElement.java 2007-01-05 13:44:00 UTC (rev 1752)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/IRubyElement.java 2007-01-05 15:49:09 UTC (rev 1753)
@@ -37,24 +37,25 @@
* A Ruby element with this type can be safely cast to <code>IRubyProject</code>.
*/
public static final int RUBY_PROJECT = 1;
+ public static final int SOURCE_FOLDER_ROOT = 2;
/**
* Constant representing a source folder
* A Ruby element with this type can be safely cast to <code>ISourceFolder</code>.
*/
- public static final int SOURCE_FOLDER = 2;
- public static final int SCRIPT = 3;
- public static final int TYPE = 4;
- public static final int METHOD = 5;
- public static final int GLOBAL = 6;
- public static final int IMPORT_DECLARATION = 7;
- public static final int CONSTANT = 8;
- public static final int CLASS_VAR = 9;
- public static final int INSTANCE_VAR = 10;
- public static final int LOCAL_VARIABLE = 11;
- public static final int BLOCK = 12;
- public static final int DYNAMIC_VAR = 13;
- public static final int FIELD = 14;
- public static final int IMPORT_CONTAINER = 15;
+ public static final int SOURCE_FOLDER = 3;
+ public static final int SCRIPT = 4;
+ public static final int TYPE = 5;
+ public static final int METHOD = 6;
+ public static final int GLOBAL = 7;
+ public static final int IMPORT_DECLARATION = 8;
+ public static final int CONSTANT = 9;
+ public static final int CLASS_VAR = 10;
+ public static final int INSTANCE_VAR = 11;
+ public static final int LOCAL_VARIABLE = 12;
+ public static final int BLOCK = 13;
+ public static final int DYNAMIC_VAR = 14;
+ public static final int FIELD = 15;
+ public static final int IMPORT_CONTAINER = 16;
/**
* Returns the first ancestor of this Ruby element that has the given type.
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/IRubyModelMarker.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/IRubyModelMarker.java 2007-01-05 13:44:00 UTC (rev 1752)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/IRubyModelMarker.java 2007-01-05 15:49:09 UTC (rev 1753)
@@ -20,43 +20,81 @@
public interface IRubyModelMarker {
/**
- * Ruby model problem marker type (value <code>"org.rubypeople.rdt.core.problem"</code>).
- * This can be used to recognize those markers in the workspace that flag problems
- * detected by the Ruby tooling during compilation.
+ * Ruby model problem marker type (value
+ * <code>"org.rubypeople.rdt.core.problem"</code>). This can be used to
+ * recognize those markers in the workspace that flag problems detected by
+ * the Ruby tooling during compilation.
*/
- public static final String RUBY_MODEL_PROBLEM_MARKER = RubyCore.PLUGIN_ID + ".problem"; //$NON-NLS-1$
+ public static final String RUBY_MODEL_PROBLEM_MARKER = RubyCore.PLUGIN_ID
+ + ".problem"; //$NON-NLS-1$
/**
- * Ruby model transient problem marker type (value <code>"org.rubypeople.rdt.core.transient_problem"</code>).
- * This can be used to recognize those markers in the workspace that flag transient
- * problems detected by the Ruby tooling (such as a problem
- * detected by the outliner, or a problem detected during a code completion)
+ * Ruby model transient problem marker type (value
+ * <code>"org.rubypeople.rdt.core.transient_problem"</code>). This can be
+ * used to recognize those markers in the workspace that flag transient
+ * problems detected by the Ruby tooling (such as a problem detected by the
+ * outliner, or a problem detected during a code completion)
*/
- public static final String TRANSIENT_PROBLEM = RubyCore.PLUGIN_ID + ".transient_problem"; //$NON-NLS-1$
+ public static final String TRANSIENT_PROBLEM = RubyCore.PLUGIN_ID
+ + ".transient_problem"; //$NON-NLS-1$
/**
- * Ruby model task marker type (value <code>"org.rubypeople.rdt.core.task"</code>).
- * This can be used to recognize task markers in the workspace that correspond to tasks
- * specified in Ruby source comments and detected during compilation (for example, 'TO-DO: ...').
- * Tasks are identified by a task tag, which can be customized through <code>RubyCore</code>
- * option <code>"org.rubypeople.rdt.core.compiler.taskTag"</code>.
+ * Ruby model task marker type (value
+ * <code>"org.rubypeople.rdt.core.task"</code>). This can be used to
+ * recognize task markers in the workspace that correspond to tasks
+ * specified in Ruby source comments and detected during compilation (for
+ * example, 'TO-DO: ...'). Tasks are identified by a task tag, which can be
+ * customized through <code>RubyCore</code> option
+ * <code>"org.rubypeople.rdt.core.compiler.taskTag"</code>.
+ *
* @since 2.1
*/
public static final String TASK_MARKER = RubyCore.PLUGIN_ID + ".task"; //$NON-NLS-1$
-
- /**
- * Id marker attribute (value <code>"arguments"</code>).
- * Arguments are concatenated into one String, prefixed with an argument count (followed with colon
- * separator) and separated with '#' characters. For example:
- * { "foo", "bar" } is encoded as "2:foo#bar",
- * { } is encoded as "0: "
- * @since 2.0
+
+ /**
+ * Id marker attribute (value <code>"arguments"</code>). Arguments are
+ * concatenated into one String, prefixed with an argument count (followed
+ * with colon separator) and separated with '#' characters. For example: {
+ * "foo", "bar" } is encoded as "2:foo#bar", { } is encoded as "0: "
+ *
+ * @since 0.9.0
*/
- public static final String ARGUMENTS = "arguments"; //$NON-NLS-1$
-
- /**
+ public static final String ARGUMENTS = "arguments"; //$NON-NLS-1$
+
+ /**
* Id marker attribute (value <code>"id"</code>).
*/
- public static final String ID = "id"; //$NON-NLS-1$
+ public static final String ID = "id"; //$NON-NLS-1$
+ // FIXME Rename to LOADPATH_FILE_FORMAT
+ /**
+ * Classpath file format marker attribute (value
+ * <code>"classpathFileFormat"</code>). Used only on buildpath problem
+ * markers. The value of this attribute is either "true" or "false".
+ *
+ * @since 0.9.0
+ */
+ String CLASSPATH_FILE_FORMAT = "classpathFileFormat"; //$NON-NLS-1$
+
+ /**
+ * Cycle detected marker attribute (value <code>"cycleDetected"</code>).
+ * Used only on buildpath problem markers. The value of this attribute is
+ * either "true" or "false".
+ */
+ String CYCLE_DETECTED = "cycleDetected"; //$NON-NLS-1$
+
+ /**
+ * Build path problem marker type (value
+ * <code>"org.rubypeople.rdt.core.buildpath_problem"</code>). This can be
+ * used to recognize those markers in the workspace that flag problems
+ * detected by the Ruby tooling during classpath setting.
+ */
+ String BUILDPATH_PROBLEM_MARKER = RubyCore.PLUGIN_ID + ".buildpath_problem"; //$NON-NLS-1$
+
+ /**
+ * ID category marker attribute (value <code>"categoryId"</code>)
+ * @since 0.9.0
+ */
+ String CATEGORY_ID = "categoryId"; //$NON-NLS-1$
+
}
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/IRubyModelStatusConstants.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/IRubyModelStatusConstants.java 2007-01-05 13:44:00 UTC (rev 1752)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/IRubyModelStatusConstants.java 2007-01-05 15:49:09 UTC (rev 1753)
@@ -258,7 +258,7 @@
* be read/written successfully.
* @since 2.1
*/
- public static final int INVALID_CLASSPATH_FILE_FORMAT = 1000;
+ public static final int INVALID_LOADPATH_FILE_FORMAT = 1000;
/**
* Status indicating that a project is involved in a build path cycle.
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/IRubyProject.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/IRubyProject.java 2007-01-05 13:44:00 UTC (rev 1752)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/IRubyProject.java 2007-01-05 15:49:09 UTC (rev 1753)
@@ -24,13 +24,12 @@
*/
package org.rubypeople.rdt.core;
-import java.util.List;
import java.util.Map;
-import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
/**
@@ -41,14 +40,8 @@
public abstract IProject getProject();
- public abstract List getLoadPathEntries();
-
- public abstract List getReferencedProjects();
-
public String[] getRequiredProjectNames() throws RubyModelException;
- public abstract void save() throws CoreException;
-
/**
* Returns the first type found following this project's classpath with the
* given fully qualified name or <code>null</code> if none is found. The
@@ -109,18 +102,33 @@
public abstract IRubyScript[] getRubyScripts() throws RubyModelException;
public abstract Object[] getNonRubyResources() throws RubyModelException;
-
- public abstract boolean isOnLoadpath(IRubyScript element);
- public IRubyScript getRubyScript(IFile file);
+ public abstract ISourceFolder[] getSourceFolders() throws RubyModelException;
- public abstract ISourceFolder getSourceFolder(String[] names);
+ public abstract ISourceFolderRoot getSourceFolderRoot(IResource resource);
- public abstract ISourceFolder getSourceFolder(IResource resource);
+ public abstract ILoadpathEntry[] getRawLoadpath() throws RubyModelException;
- public abstract ISourceFolder[] getSourceFolders() throws RubyModelException;
+ public abstract ISourceFolderRoot[] getSourceFolderRoots() throws RubyModelException;
- public abstract ISourceFolder createSourceFolder(String packName,
- boolean force, IProgressMonitor monitor) throws RubyModelException;
+ public abstract boolean isOnLoadpath(IRubyElement element);
+
+ ILoadpathEntry[] getResolvedLoadpath(boolean ignoreUnresolvedEntry) throws RubyModelException;
+ public void setRawLoadpath(ILoadpathEntry[] newEntries,
+ IPath newOutputLocation,
+ IProgressMonitor monitor,
+ boolean canChangeResource,
+ ILoadpathEntry[] oldResolvedPath,
+ boolean needValidation,
+ boolean needSave)
+ throws RubyModelException;
+
+ void setRawLoadpath(ILoadpathEntry[] entries, boolean canModifyResources, IProgressMonitor monitor) throws RubyModelException;
+
+ void setRawLoadpath(ILoadpathEntry[] entries, IProgressMonitor monitor)
+ throws RubyModelException;
+
+ void setRawLoadpath(ILoadpathEntry[] entries, IPath outputLocation, IProgressMonitor monitor)
+ throws RubyModelException;
}
\ No newline at end of file
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/ISourceFolder.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/ISourceFolder.java 2007-01-05 13:44:00 UTC (rev 1752)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/ISourceFolder.java 2007-01-05 15:49:09 UTC (rev 1753)
@@ -5,6 +5,14 @@
public interface ISourceFolder extends IRubyElement, IParent, IOpenable {
+ /**
+ * <p>
+ * The name of package fragment for the default package (value: the empty
+ * string, <code>""</code>).
+ * </p>
+ */
+ public static final String DEFAULT_PACKAGE_NAME = ""; //$NON-NLS-1$
+
/**
* Returns whether this fragment contains at least one Ruby resource.
* @return true if this fragment contains at least one Ruby resource, false otherwise
@@ -114,5 +122,6 @@
*/
Object[] getNonRubyResources() throws RubyModelException;
IRubyScript getRubyScript(String name);
+ boolean isDefaultPackage();
}
Added: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/ISourceFolderRoot.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/ISourceFolderRoot.java (rev 0)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/ISourceFolderRoot.java 2007-01-05 15:49:09 UTC (rev 1753)
@@ -0,0 +1,113 @@
+package org.rubypeople.rdt.core;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+
+public interface ISourceFolderRoot extends IParent, IRubyElement, IOpenable {
+ /**
+ * Returns whether this package fragment root is external
+ * to the workbench (that is, a local file), and has no
+ * underlying resource.
+ * <p>
+ * This is a handle-only method.
+ * </p>
+ *
+ * @return true if this package fragment root is external
+ * to the workbench (that is, a local file), and has no
+ * underlying resource, false otherwise
+ */
+ boolean isExternal();
+
+ /**
+ * Returns the package fragment with the given package name.
+ * An empty string indicates the default package.
+ * This is a handle-only operation. The package fragment
+ * may or may not exist.
+ *
+ * @param packageName the given package name
+ * @return the package fragment with the given package name
+ */
+ ISourceFolder getSourceFolder(String names[]);
+
+ /**
+ * Creates and returns a package fragment in this root with the
+ * given dot-separated package name. An empty string specifies the default package.
+ * This has the side effect of creating all package
+ * fragments that are a prefix of the new package fragment which
+ * do not exist yet. If the package fragment already exists, this
+ * has no effect.
+ *
+ * For a description of the <code>force</code> flag, see <code>IFolder.create</code>.
+ *
+ * @param name the given dot-separated package name
+ * @param force a flag controlling how to deal with resources that
+ * are not in sync with the local file system
+ * @param monitor the given progress monitor
+ * @exception JavaModelException if the element could not be created. Reasons include:
+ * <ul>
+ * <li> This Java element does not exist (ELEMENT_DOES_NOT_EXIST)</li>
+ * <li> A <code>CoreException</code> occurred while creating an underlying resource
+ * <li> This package fragment root is read only (READ_ONLY)
+ * <li> The name is not a valid package name (INVALID_NAME)
+ * </ul>
+ * @return a package fragment in this root with the given dot-separated package name
+ * @see org.eclipse.core.resources.IFolder#create(boolean, boolean, IProgressMonitor)
+ */
+ ISourceFolder createSourceFolder(
+ String name,
+ boolean force,
+ IProgressMonitor monitor)
+ throws RubyModelException;
+
+ /**
+ * Deletes the resource of this package fragment root as specified by
+ * <code>IResource.delete(int, IProgressMonitor)</code> but excluding nested
+ * source folders.
+ * <p>
+ * If <code>NO_RESOURCE_MODIFICATION</code> is specified in
+ * <code>updateModelFlags</code> or if this package fragment root is external,
+ * this operation doesn't delete the resource. <code>updateResourceFlags</code>
+ * is then ignored.
+ * </p><p>
+ * If <code>ORIGINATING_PROJECT_CLASSPATH</code> is specified in
+ * <code>updateModelFlags</code>, update the raw classpath of this package
+ * fragment root's project by removing the corresponding classpath entry.
+ * </p><p>
+ * If <code>OTHER_REFERRING_PROJECTS_CLASSPATH</code> is specified in
+ * <code>updateModelFlags</code>, update the raw classpaths of all other Java
+ * projects referring to this root's resource by removing the corresponding classpath
+ * entries.
+ * </p><p>
+ * If no flags is specified in <code>updateModelFlags</code> (using
+ * <code>IResource.NONE</code>), the default behavior applies: the
+ * resource is deleted (if this package fragment root is not external) and no
+ * classpaths are updated.
+ * </p>
+ *
+ * @param updateResourceFlags bit-wise or of update resource flag constants
+ * (<code>IResource.FORCE</code> and <code>IResource.KEEP_HISTORY</code>)
+ * @param updateModelFlags bit-wise or of update resource flag constants
+ * (<code>ORIGINATING_PROJECT_CLASSPATH</code>,
+ * <code>OTHER_REFERRING_PROJECTS_CLASSPATH</code> and
+ * <code>NO_RESOURCE_MODIFICATION</code>)
+ * @param monitor a progress monitor
+ *
+ * @exception JavaModelException if this root could not be deleted. Reasons
+ * include:
+ * <ul>
+ * <li> This root does not exist (ELEMENT_DOES_NOT_EXIST)</li>
+ * <li> A <code>CoreException</code> occurred while deleting the resource
+ * or updating a classpath
+ * </li>
+ * </ul>
+ * @see org.eclipse.core.resources.IResource#delete(boolean, IProgressMonitor)
+ * @since 2.1
+ */
+ void delete(int updateResourceFlags, int updateModelFlags, IProgressMonitor monitor) throws RubyModelException;
+
+ boolean isArchive();
+
+ Object[] getNonRubyResources() throws RubyModelException;
+
+ ISourceFolder getSourceFolder(String packName);
+
+}
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/IType.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/IType.java 2007-01-05 13:44:00 UTC (rev 1752)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/IType.java 2007-01-05 15:49:09 UTC (rev 1753)
@@ -172,4 +172,6 @@
public IMethod createMethod(String contents, IRubyElement sibling, boolean force,
IProgressMonitor progress) throws RubyModelException;
+ public ISourceFolder getSourceFolder();
+
}
\ No newline at end of file
Added: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/LoadpathContainerInitializer.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/LoadpathContainerInitializer.java (rev 0)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/LoadpathContainerInitializer.java 2007-01-05 15:49:09 UTC (rev 1753)
@@ -0,0 +1,196 @@
+/*******************************************************************************
+ * 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
+ * IBM Corporation - added support for requesting updates of a particular
+ * container for generic container operations.
+ * - canUpdateClasspathContainer(IPath, IJavaProject)
+ * - requestClasspathContainerUpdate(IPath, IJavaProject, IClasspathContainer)
+ * IBM Corporation - allow initializers to provide a readable description
+ * of a container reference, ahead of actual resolution.
+ * - getDescription(IPath, IJavaProject)
+ *******************************************************************************/
+package org.rubypeople.rdt.core;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+
+/**
+ * Abstract base implementation of all classpath container initializer.
+ * Classpath variable containers are used in conjunction with the
+ * "org.eclipse.jdt.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
+ * constructor and a concrete implementation of <code>initialize</code>.
+ * <p>
+ * Multiple classpath containers can be registered, each of them declares
+ * the container ID they can handle, so as to narrow the set of containers they
+ * can resolve, in other words, a container initializer is guaranteed to only be
+ * activated to resolve containers which match the ID they registered onto.
+ * <p>
+ * In case multiple container initializers collide on the same container ID, the first
+ * registered one will be invoked.
+ *
+ * @see IClasspathEntry
+ * @see IClasspathContainer
+ * @since 2.0
+ */
+public abstract class LoadpathContainerInitializer {
+
+ /**
+ * Creates a new classpath container initializer.
+ */
+ public LoadpathContainerInitializer() {
+ // a classpath container initializer must have a public 0-argument constructor
+ }
+
+ /**
+ * Binds a classpath container to a <code>IClasspathContainer</code> for a given project,
+ * or silently fails if unable to do so.
+ * <p>
+ * A container is identified by a container path, which must be formed of two segments.
+ * The first segment is used as a unique identifier (which this initializer did register onto), and
+ * the second segment can be used as an additional hint when performing the resolution.
+ * <p>
+ * The initializer is invoked if a container path needs to be resolved for a given project, and no
+ * value for it was recorded so far. The implementation of the initializer would typically set the
+ * corresponding container using <code>JavaCore#setClasspathContainer</code>.
+ * <p>
+ * A container initialization can be indirectly performed while attempting to resolve a project
+ * classpath using <code>IJavaProject#getResolvedClasspath(</code>; or directly when using
+ * <code>JavaCore#getClasspathContainer</code>. During the initialization process, any attempt
+ * to further obtain the same container will simply return <code>null</code> so as to avoid an
+ * infinite regression of initializations.
+ * <p>
+ * A container initialization may also occur indirectly when setting a project classpath, as the operation
+ * needs to resolve the classpath for validation purpose. While the operation is in progress, a referenced
+ * container initializer may be invoked. If the initializer further tries to access the referring project classpath,
+ * it will not see the new assigned classpath until the operation has completed. Note that once the Java
+ * change notification occurs (at the end of the operation), the model has been updated, and the project
+ * classpath can be queried normally.
+ * <p>
+ * This method is called by the Java model to give the party that defined
+ * this particular kind of classpath container the chance to install
+ * classpath container objects that will be used to convert classpath
+ * container entries into simpler classpath entries. The method is typically
+ * called exactly once for a given Java project and classpath container
+ * entry. This method must not be called by other clients.
+ * <p>
+ * There are a wide variety of conditions under which this method may be
+ * invoked. To ensure that the implementation does not interfere with
+ * correct functioning of the Java model, the implementation should use
+ * only the following Java model APIs:
+ * <ul>
+ * <li>{@link JavaCore#setClasspathContainer(IPath, IJavaProject[], IClasspathContainer[], org.eclipse.core.runtime.IProgressMonitor)}</li>
+ * <li>{@link JavaCore#getClasspathContainer(IPath, IJavaProject)}</li>
+ * <li>{@link JavaCore#create(org.eclipse.core.resources.IWorkspaceRoot)}</li>
+ * <li>{@link JavaCore#create(org.eclipse.core.resources.IProject)}</li>
+ * <li>{@link IJavaModel#getJavaProjects()}</li>
+ * <li>Java element operations marked as "handle-only"</li>
+ * </ul>
+ * The effects of using other Java model APIs are unspecified.
+ * </p>
+ *
+ * @param containerPath a two-segment path (ID/hint) identifying the container that needs
+ * to be resolved
+ * @param project the Java project in which context the container is to be resolved.
+ * This allows generic containers to be bound with project specific values.
+ * @throws CoreException if an exception occurs during the initialization
+ *
+ * @see JavaCore#getClasspathContainer(IPath, IJavaProject)
+ * @see JavaCore#setClasspathContainer(IPath, IJavaProject[], IClasspathContainer[], org.eclipse.core.runtime.IProgressMonitor)
+ * @see IClasspathContainer
+ */
+ public abstract void initialize(IPath containerPath, IRubyProject project) throws CoreException;
+
+ /**
+ * Returns <code>true</code> if this container initializer can be requested to perform updates
+ * on its own container values. If so, then an update request will be performed using
+ * <code>ClasspathContainerInitializer#requestClasspathContainerUpdate</code>/
+ * <p>
+ * @param containerPath the path of the container which requires to be updated
+ * @param project the project for which the container is to be updated
+ * @return returns <code>true</code> if the container can be updated
+ * @since 2.1
+ */
+ public boolean canUpdateClasspathContainer(IPath containerPath, IRubyProject project) {
+
+ // By default, classpath container initializers do not accept updating containers
+ return false;
+ }
+
+ /**
+ * Request a registered container definition to be updated according to a container suggestion. The container suggestion
+ * only acts as a place-holder to pass along the information to update the matching container definition(s) held by the
+ * container initializer. In particular, it is not expected to store the container suggestion as is, but rather adjust
+ * the actual container definition based on suggested changes.
+ * <p>
+ * IMPORTANT: In reaction to receiving an update request, a container initializer will update the corresponding
+ * container definition (after reconciling changes) at its earliest convenience, using
+ * <code>JavaCore#setClasspathContainer(IPath, IJavaProject[], IClasspathContainer[], IProgressMonitor)</code>.
+ * Until it does so, the update will not be reflected in the Java Model.
+ * <p>
+ * In order to anticipate whether the container initializer allows to update its containers, the predicate
+ * <code>JavaCore#canUpdateClasspathContainer</code> should be used.
+ * <p>
+ * @param containerPath the path of the container which requires to be updated
+ * @param project the project for which the container is to be updated
+ * @param containerSuggestion a suggestion to update the corresponding container definition
+ * @throws CoreException when <code>JavaCore#setClasspathContainer</code> would throw any.
+ * @see JavaCore#setClasspathContainer(IPath, IJavaProject[], IClasspathContainer[], org.eclipse.core.runtime.IProgressMonitor)
+ * @see ClasspathContainerInitializer#canUpdateClasspathContainer(IPath, IJavaProject)
+ * @since 2.1
+ */
+ public void requestClasspathContainerUpdate(IPath containerPath, IRubyProject project, ILoadpathContainer containerSuggestion) throws CoreException {
+
+ // By default, classpath container initializers do not accept updating containers
+ }
+
+ /**
+ * Returns a readable description for a container path. A readable description for a container path can be
+ * used for improving the display of references to container, without actually needing to resolve them.
+ * A good implementation should answer a description consistent with the description of the associated
+ * target container (see <code>IClasspathContainer.getDescription()</code>).
+ *
+ * @param containerPath the path of the container which requires a readable description
+ * @param project the project from which the container is referenced
+ * @return a string description of the container
+ * @since 2.1
+ */
+ public String getDescription(IPath containerPath, IRubyProject project) {
+
+ // By default, a container path is the only available description
+ return containerPath.makeRelative().toString();
+ }
+
+ /**
+ * Returns an object which identifies a container for comparison purpose. This allows
+ * to eliminate redundant containers when accumulating classpath entries (e.g.
+ * runtime classpath computation). When requesting a container comparison ID, one
+ * should ensure using its corresponding container initializer. Indeed, a random container
+ * initializer cannot be held responsible for determining comparison IDs for arbitrary
+ * containers.
+ * <p>
+ * @param containerPath the path of the container which is being checked
+ * @param project the project for which the container is to being checked
+ * @return returns an Object identifying the container for comparison
+ * @since 3.0
+ */
+ public Object getComparisonID(IPath containerPath, IRubyProject project) {
+
+ // By default, containers are identical if they have the same containerPath first segment,
+ // but this may be refined by other container initializer implementations.
+ if (containerPath == null) {
+ return null;
+ } else {
+ return containerPath.segment(0);
+ }
+ }
+}
+
Added: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/LoadpathVariableInitializer.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/LoadpathVariableInitializer.java (rev 0)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/LoadpathVariableInitializer.java 2007-01-05 15:49:09 UTC (rev 1753)
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * 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.core;
+
+/**
+ * Abstract base implementation of all classpath variable initializers.
+ * Classpath variable initializers are used in conjunction with the
+ * "org.eclipse.jdt.core.classpathVariableInitializer" extension point.
+ * <p>
+ * Clients should subclass this class to implement a specific classpath
+ * variable initializer. The subclass must have a public 0-argument
+ * constructor and a concrete implementation of <code>initialize</code>.
+ *
+ * @see ILoadpathEntry
+ * @since 2.0
+ */
+public abstract class LoadpathVariableInitializer {
+
+ /**
+ * Creates a new classpath variable initializer.
+ */
+ public LoadpathVariableInitializer() {
+ // a classpath variable initializer must have a public 0-argument constructor
+ }
+
+ /**
+ * Binds a value to the workspace classpath variable with the given name,
+ * or fails silently if this cannot be done.
+ * <p>
+ * A variable initializer is automatically activated whenever a variable value
+ * is needed and none has been recorded so far. The implementation of
+ * the initializer can set the corresponding variable using
+ * <code>JavaCore#setLoadpathVariable</code>.
+ *
+ * @param variable the name of the workspace classpath variable
+ * that requires a binding
+ *
+ * @see JavaCore#getLoadpathVariable(String)
+ * @see JavaCore#setLoadpathVariable(String, org.eclipse.core.runtime.IPath, org.eclipse.core.runtime.IProgressMonitor)
+ * @see JavaCore#setLoadpathVariables(String[], org.eclipse.core.runtime.IPath[], org.eclipse.core.runtime.IProgressMonitor)
+ */
+ public abstract void initialize(String variable);
+}
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-05 13:44:00 UTC (rev 1752)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/RubyConventions.java 2007-01-05 15:49:09 UTC (rev 1753)
@@ -7,6 +7,7 @@
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
+import org.jruby.javasupport.JavaMethod;
import org.rubypeople.rdt.internal.core.RubyModelStatus;
import org.rubypeople.rdt.internal.core.util.Messages;
import org.rubypeople.rdt.internal.core.util.Util;
@@ -102,4 +103,9 @@
}
return true;
}
+
+ public static IStatus validateSourceFolderName(String packName) {
+ // TODO Actually do some validation
+ return RubyModelStatus.VERIFIED_OK;
+ }
}
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-05 13:44:00 UTC (rev 1752)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/RubyCore.java 2007-01-05 15:49:09 UTC (rev 1753)
@@ -13,6 +13,7 @@
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.HashMap;
import java.util.Hashtable;
import java.util.List;
@@ -25,7 +26,12 @@
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.Assert;
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;
import org.eclipse.core.runtime.Path;
@@ -37,12 +43,11 @@
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.rubypeople.rdt.internal.core.BatchOperation;
-import org.rubypeople.rdt.internal.core.DefaultWorkingCopyOwner;
+import org.rubypeople.rdt.internal.core.LoadpathEntry;
import org.rubypeople.rdt.internal.core.RubyCorePreferenceInitializer;
import org.rubypeople.rdt.internal.core.RubyModel;
import org.rubypeople.rdt.internal.core.RubyModelManager;
import org.rubypeople.rdt.internal.core.RubyProject;
-import org.rubypeople.rdt.internal.core.RubyScript;
import org.rubypeople.rdt.internal.core.SymbolIndexResourceChangeListener;
import org.rubypeople.rdt.internal.core.builder.IndexUpdater;
import org.rubypeople.rdt.internal.core.builder.MassIndexUpdaterJob;
@@ -274,8 +279,35 @@
* @since 0.9.0
*/
public static final String CODEASSIST_CAMEL_CASE_MATCH = PLUGIN_ID + ".codeComplete.camelCaseMatch"; //$NON-NLS-1$
+
+ // FIXME Rename to CORE_INCOMPLETE_LOADPATH
+ /**
+ * Possible configurable option ID.
+ * @see #getDefaultOptions()
+ * @since 0.9.0
+ */
+ public static final String CORE_INCOMPLETE_CLASSPATH = PLUGIN_ID + ".incompleteClasspath"; //$NON-NLS-1$
+
+ // FIXME Rename to CORE_INCOMPATIBLE_RUBY_VERSION
+ /**
+ * Possible configurable option ID.
+ * @see #getDefaultOptions()
+ * @since 3.0
+ */
+ public static final String CORE_INCOMPATIBLE_JDK_LEVEL = PLUGIN_ID + ".incompatibleJDKLevel"; //$NON-NLS-1$
+ // FIXME Rename to CORE_CIRCULAR_LOADPATH
+ /**
+ * Possible configurable option ID.
+ * @see #getDefaultOptions()
+ * @since 2.1
+ */
+ public static final String CORE_CIRCULAR_CLASSPATH = PLUGIN_ID + ".circularClasspath"; //$NON-NLS-1$
+ private static final boolean VERBOSE = false;
+
+
+
private SymbolIndex symbolIndex;
private ISymbolFinder symbolFinder;
@@ -433,21 +465,10 @@
return false;
}
- public static IRubyScript create(IFile aFile) {
- return create(aFile, null);
+ public static IRubyScript create(IFile file) {
+ return RubyModelManager.create(file, null/*unknown ruby project*/);
}
- public static IRubyScript create(IFile file, IRubyProject project) {
- if (project == null) {
- project = create(file.getProject());
- }
- if(isRubyLikeFileName(file.getName())) {
- return new RubyScript((RubyProject) project, file, file.getName(),
- DefaultWorkingCopyOwner.PRIMARY);
- }
- return null;
- }
-
public static IRubyProject create(IProject project) {
if (project == null) { return null; }
RubyModel rubyModel = RubyModelManager.getRubyModelManager().getRubyModel();
@@ -681,4 +702,401 @@
public static boolean isRubyLikeFileName(String name) {
return Util.isRubyLikeFileName(name);
}
+
+ /**
+ * Creates and returns a new classpath entry of kind <code>CPE_SOURCE</code>
+ * for all files in the project's source folder identified by the given
+ * absolute workspace-relative path.
+ * <p>
+ * The convenience method is fully equivalent to:
+ * <pre>
+ * newSourceEntry(path, new IPath[] {}, new IPath[] {}, null);
+ * </pre>
+ * </p>
+ *
+ * @param path the absolute workspace-relative path of a source folder
+ * @return a new source classpath entry
+ * @see #newSourceEntry(IPath, IPath[], IPath[])
+ */
+ public static ILoadpathEntry newSourceEntry(IPath path) {
+
+ return newSourceEntry(path, LoadpathEntry.INCLUDE_ALL, LoadpathEntry.EXCLUDE_NONE);
+ }
+
+ /**
+ * Creates and returns a new classpath entry of kind <code>CPE_SOURCE</code>
+ * for the project's source folder identified by the given absolute
+ * workspace-relative path but excluding all source files with paths
+ * matching any of the given patterns, and associated with a specific output location
+ * (that is, ".class" files are not going to the project default output location).
+ * <p>
+ * The convenience method is fully equivalent to:
+ * <pre>
+ * newSourceEntry(path, new IPath[] {}, exclusionPatterns);
+ * </pre>
+ * </p>
+ *
+ * @param path the absolute workspace-relative path of a source folder
+ * @param inclusionPatterns the possibly empty list of inclusion patterns
+ * represented as relative paths
+ * @param exclusionPatterns the possibly empty list of exclusion patterns
+ * represented as relative paths
+ * @return a new source classpath entry
+ * @since 3.0
+ */
+ public static ILoadpathEntry newSourceEntry(IPath path, IPath[] inclusionPatterns, IPath[] exclusionPatterns) {
+ if (path == null) Assert.isTrue(false, "Source path cannot be null"); //$NON-NLS-1$
+ if (!path.isAbsolute()) Assert.isTrue(false, "Path for ILoadpathEntry must be absolute"); //$NON-NLS-1$
+ if (exclusionPatterns == null) Assert.isTrue(false, "Exclusion pattern set cannot be null"); //$NON-NLS-1$
+ if (inclusionPatterns == null) Assert.isTrue(false, "Inclusion pattern set cannot be null"); //$NON-NLS-1$
+
+ return new LoadpathEntry(
+ ILoadpathEntry.CPE_SOURCE,
+ path,
+ inclusionPatterns,
+ exclusionPatterns,
+ false);
+ }
+
+ public static ILoadpathEntry newLibraryEntry(IPath path, boolean isExported) {
+
+ if (path == null) Assert.isTrue(false, "Library path cannot be null"); //$NON-NLS-1$
+ if (!path.isAbsolute()) Assert.isTrue(false, "Path for ILoadpathEntry must be absolute"); //$NON-NLS-1$
+
+ return new LoadpathEntry(
+ ILoadpathEntry.CPE_LIBRARY,
+ RubyProject.canonicalizedPath(path),
+ LoadpathEntry.INCLUDE_ALL, // inclusion patterns
+ LoadpathEntry.EXCLUDE_NONE, // exclusion patterns
+ isExported);
+
+ }
+
+ public static ILoadpathEntry newProjectEntry(IPath path, boolean isExported) {
+ if (!path.isAbsolute()) Assert.isTrue(false, "Path for ILoadpathEntry must be absolute"); //$NON-NLS-1$
+
+ return new LoadpathEntry(
+ ILoadpathEntry.CPE_PROJECT,
+ path,
+ LoadpathEntry.INCLUDE_ALL, // inclusion patterns
+ LoadpathEntry.EXCLUDE_NONE, // exclusion patterns
+ isExported);
+ }
+
+ public static ILoadpathEntry newVariableEntry(IPath variablePath, boolean isExported) {
+ if (variablePath == null) Assert.isTrue(false, "Variable path cannot be null"); //$NON-NLS-1$
+ if (variablePath.segmentCount() < 1) {
+ Assert.isTrue(
+ false,
+ "Illegal loadpath variable path: \'" + variablePath.makeRelative().toString() + "\', must have at least one segment"); //$NON-NLS-1$//$NON-NLS-2$
+ }
+
+ return new LoadpathEntry(
+ ILoadpathEntry.CPE_VARIABLE,
+ variablePath,
+ LoadpathEntry.INCLUDE_ALL, // inclusion patterns
+ LoadpathEntry.EXCLUDE_NONE, // exclusion patterns
+ isExported);
+ }
+
+ public static ILoadpathEntry newContainerEntry(IPath containerPath,
+ boolean isExported) {
+ if (containerPath == null) {
+ Assert.isTrue(false, "Container path cannot be null"); //$NON-NLS-1$
+ } else if (containerPath.segmentCount() < 1) {
+ Assert.isTrue(
+ false,
+ "Illegal loadpath container path: \'" + containerPath.makeRelative().toString() + "\', must have at least one segment (containerID+hints)"); //$NON-NLS-1$//$NON-NLS-2$
+ }
+ return new LoadpathEntry(
+ ILoadpathEntry.CPE_CONTAINER,
+ containerPath,
+ LoadpathEntry.INCLUDE_ALL, // inclusion patterns
+ LoadpathEntry.EXCLUDE_NONE, // exclusion patterns
+ isExported);
+ }
+
+ public static ILoadpathEntry getResolvedLoadpathEntry(
+ ILoadpathEntry entry) {
+ if (entry.getEntryKind() != ILoadpathEntry.CPE_VARIABLE)
+ return entry;
+
+ IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
+ IPath resolvedPath = RubyCore.getResolvedVariablePath(entry.getPath());
+ if (resolvedPath == null)
+ return null;
+
+ Object target = RubyModel.getTarget(workspaceRoot, resolvedPath, false);
+ if (target == null)
+ return null;
+
+ // inside the workspace
+ if (target instanceof IResource) {
+ IResource resolvedResource = (IResource) target;
+ if (resolvedResource != null) {
+ switch (resolvedResource.getType()) {
+
+ case IResource.PROJECT :
+ // internal project
+ return RubyCore.newProjectEntry(
+ resolvedPath,
+ entry.isExported());
+ case IResource.FOLDER :
+ // internal binary folder
+ return RubyCore.newLibraryEntry(
+ resolvedPath,
+ entry.isExported());
+ }
+ }
+ }
+ // outside the workspace
+ if (target instanceof File) {
+ File externalFile = RubyModel.getFile(target);
+ if (externalFile != null) {
+ return RubyCore.newLibraryEntry(resolvedPath, entry.isExported());
+ } else { // external binary folder
+ if (resolvedPath.isAbsolute()){
+ return RubyCore.newLibraryEntry(resolvedPath, entry.isExported());
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Resolve a variable path (helper method).
+ *
+ * @param variablePath the given variable path
+ * @return the resolved variable path or <code>null</code> if none
+ */
+ public static IPath getResolvedVariablePath(IPath variablePath) {
+
+ if (variablePath == null)
+ return null;
+ int count = variablePath.segmentCount();
+ if (count == 0)
+ return null;
+
+ // lookup variable
+ String variableName = variablePath.segment(0);
+ IPath resolvedPath = RubyCore.getLoadpathVariable(variableName);
+ if (res...
[truncated message content] |