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: <mba...@us...> - 2006-12-30 09:43:56
|
Revision: 1747
http://svn.sourceforge.net/rubyeclipse/?rev=1747&view=rev
Author: mbarchfe
Date: 2006-12-30 01:43:55 -0800 (Sat, 30 Dec 2006)
Log Message:
-----------
next step for ruby debug integration
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/DebuggerPreferencePage.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/preferences/PreferencesMessages.properties
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/DebuggerPreferencePage.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/DebuggerPreferencePage.java 2006-12-30 09:43:16 UTC (rev 1746)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/DebuggerPreferencePage.java 2006-12-30 09:43:55 UTC (rev 1747)
@@ -18,7 +18,6 @@
import org.eclipse.ui.IWorkbenchPreferencePage;
import org.rubypeople.rdt.internal.launching.RdtLaunchingPlugin;
import org.rubypeople.rdt.internal.ui.text.PreferencesAdapter;
-import org.rubypeople.rdt.ui.PreferenceConstants;
public class DebuggerPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {
@@ -28,10 +27,10 @@
setPreferenceStore(new PreferencesAdapter(launchingPreferences));
setDescription(PreferencesMessages.DebuggerPreferencePage_description_label);
}
-
public void createFieldEditors() {
- addField(new BooleanFieldEditor(PreferenceConstants.DEBUGGER_USE_RUBY_DEBUG, PreferencesMessages.DebuggerPreferencePage_useRubyDebug_label, getFieldEditorParent()));
+ addField(new BooleanFieldEditor(org.rubypeople.rdt.internal.launching.PreferenceConstants.USE_RUBY_DEBUG, PreferencesMessages.DebuggerPreferencePage_useRubyDebug_label, getFieldEditorParent()));
+ addField(new BooleanFieldEditor(org.rubypeople.rdt.internal.launching.PreferenceConstants.VERBOSE_DEBUGGER, PreferencesMessages.DebuggerPreferencePage_verboseDebugger_label, getFieldEditorParent()));
}
protected Control createContents(Composite parent) {
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 2006-12-30 09:43:16 UTC (rev 1746)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/PreferencesMessages.java 2006-12-30 09:43:55 UTC (rev 1747)
@@ -56,6 +56,7 @@
public static String RiPreferencePage_ripath_label;
public static String RiPreferencePage_rdocpath_label;
public static String DebuggerPreferencePage_useRubyDebug_label;
+ public static String DebuggerPreferencePage_verboseDebugger_label;
public static String DebuggerPreferencePage_useRubyDebug_comment;
public static String TodoTaskConfigurationBlock_tasks_default;
public static String TodoTaskConfigurationBlock_markers_tasks_high_priority;
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/PreferencesMessages.properties
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/PreferencesMessages.properties 2006-12-30 09:43:16 UTC (rev 1746)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/PreferencesMessages.properties 2006-12-30 09:43:55 UTC (rev 1747)
@@ -170,6 +170,7 @@
DebuggerPreferencePage_description_label=Debugger preferences
DebuggerPreferencePage_useRubyDebug_label=Use ruby-debug library
+DebuggerPreferencePage_verboseDebugger_label=Debugger verbose mode
DebuggerPreferencePage_useRubyDebug_comment=ruby-debug requires a ruby version >= 1.8.4. At the time being a patched ruby-debug version must be used. It is packaged with RDT and can be found at {0}plugins/org.rubypeople.rdt.launching. It can be installed with the command 'gem install'. Please be aware that the package contains native code and therefore a c-compiler for your platform must be available.
PropertyAndPreferencePage_useprojectsettings_label=Enable pr&oject specific settings
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mba...@us...> - 2006-12-30 09:43:18
|
Revision: 1746
http://svn.sourceforge.net/rubyeclipse/?rev=1746&view=rev
Author: mbarchfe
Date: 2006-12-30 01:43:16 -0800 (Sat, 30 Dec 2006)
Log Message:
-----------
next step for ruby debug integration
Modified Paths:
--------------
trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/CodeReloadJob.java
trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/actions/InspectAction.java
Modified: trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/CodeReloadJob.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/CodeReloadJob.java 2006-12-30 09:42:59 UTC (rev 1745)
+++ trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/CodeReloadJob.java 2006-12-30 09:43:16 UTC (rev 1746)
@@ -38,7 +38,7 @@
if (!loadResult.isOk()) {
DebugUIPlugin.getStandardDisplay().syncExec(new Runnable() {
public void run() {
- MessageDialog.openInformation(DebugUIPlugin.getStandardDisplay().getActiveShell(), "Error during load: " + loadResult.getExceptionType(), loadResult.getExceptionMessage());
+ MessageDialog.openInformation(DebugUIPlugin.getStandardDisplay().getActiveShell(), "Error loading " + filename +": " + loadResult.getExceptionType(), loadResult.getExceptionMessage());
}
});
}
Modified: trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/actions/InspectAction.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/actions/InspectAction.java 2006-12-30 09:42:59 UTC (rev 1745)
+++ trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/actions/InspectAction.java 2006-12-30 09:43:16 UTC (rev 1746)
@@ -8,9 +8,14 @@
* compliance with the License. For further information see org.rubypeople.rdt/rdt.license.
*/
-
package org.rubypeople.rdt.internal.debug.ui.actions;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.IJobChangeEvent;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.core.runtime.jobs.JobChangeAdapter;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.debug.ui.IDebugView;
@@ -23,64 +28,89 @@
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IViewActionDelegate;
import org.eclipse.ui.IViewPart;
+import org.rubypeople.rdt.internal.debug.core.RdtDebugCorePlugin;
import org.rubypeople.rdt.internal.debug.core.model.RubyExpression;
import org.rubypeople.rdt.internal.debug.core.model.RubyProcessingException;
import org.rubypeople.rdt.internal.debug.core.model.RubyStackFrame;
import org.rubypeople.rdt.internal.debug.core.model.RubyVariable;
public class InspectAction extends AbstractInspectAction implements IViewActionDelegate, IEditorActionDelegate {
+ private RubyVariable inspectResult;
- protected RubyStackFrame getRubyStackFrame() {
- IViewPart part = page.findView(IDebugUIConstants.ID_DEBUG_VIEW);
- if (part == null) {
- return null;
- }
- IDebugView launchView = (IDebugView) part;
- StructuredSelection selected = (StructuredSelection) launchView.getViewer().getSelection();
- if (selected.isEmpty()) {
- return null;
- }
- if (!(selected.getFirstElement() instanceof RubyStackFrame)) {
- return null;
- }
- return (RubyStackFrame) selected.getFirstElement();
+ protected RubyStackFrame getRubyStackFrame() {
+ IViewPart part = page.findView(IDebugUIConstants.ID_DEBUG_VIEW);
+ if (part == null) {
+ return null;
+ }
+ IDebugView launchView = (IDebugView) part;
+ StructuredSelection selected = (StructuredSelection) launchView.getViewer().getSelection();
+ if (selected.isEmpty()) {
+ return null;
+ }
+ if (!(selected.getFirstElement() instanceof RubyStackFrame)) {
+ return null;
+ }
+ return (RubyStackFrame) selected.getFirstElement();
- }
+ }
- public void run(IAction action) {
- final RubyStackFrame stackFrame = this.getRubyStackFrame();
- if (stackFrame == null) {
- MessageDialog.openInformation(
- page.getActivePart().getSite().getShell(),
- "No suitable stack frame",
- "Could not inspect because there is no context (a ruby stack frame) for inspection selected.");
- return;
- }
- if (!(selection instanceof ITextSelection)) {
- return;
- }
- Display.getCurrent().asyncExec(new Runnable() {
- public void run() {
- String selectedText = ((ITextSelection) selection).getText().replace('\n', ';');
- selectedText = selectedText.replace('\r', ' ');
- try {
- RubyVariable rubyVariable = stackFrame.getRubyDebuggerProxy().readInspectExpression(stackFrame, selectedText);
- showExpressionView();
- DebugPlugin.getDefault().getExpressionManager().addExpression(new RubyExpression(selectedText, rubyVariable));
- } catch (RubyProcessingException e) {
- MessageDialog.openInformation(page.getActivePart().getSite().getShell(), e.getRubyExceptionType(), "Could not inspect '" + selectedText + "': " + e.getMessage());
- }
- }
- });
- }
+ public void run(IAction action) {
+ final RubyStackFrame stackFrame = this.getRubyStackFrame();
+ if (stackFrame == null) {
+ MessageDialog.openInformation(page.getActivePart().getSite().getShell(), "No suitable stack frame", "Could not inspect because there is no context (a ruby stack frame) for inspection selected.");
+ return;
+ }
+ if (!(selection instanceof ITextSelection)) {
+ return;
+ }
+ final String selectedText = ((ITextSelection) selection).getText().replace('\n', ';').replace('\r', ' ');
+ String jobName = "Inspect " + (selectedText.length() < 20 ? selectedText : selectedText.substring(0, 19) + "...");
+ Job job = new Job(jobName) {
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ monitor.beginTask("inspecting", IProgressMonitor.UNKNOWN);
+ IStatus result = null;
+ try {
+ inspectResult = stackFrame.getRubyDebuggerProxy().readInspectExpression(stackFrame, selectedText);
+ result = Status.OK_STATUS;
+ } catch (RubyProcessingException e) {
+ String message = e.getRubyExceptionType() + " inspecting '" + selectedText + "':\n" + e.getMessage();
+ result = new Status(IStatus.ERROR, RdtDebugCorePlugin.PLUGIN_ID, IStatus.ERROR, message, e);
+ }
+ return result;
+ }
- public void setActiveEditor(IAction action, IEditorPart targetEditor) {
- if (targetEditor == null || targetEditor.getEditorSite() == null) {
- this.page = null;
- } else {
- this.page = targetEditor.getEditorSite().getPage();
+ };
+ job.addJobChangeListener(new JobChangeAdapter() {
+ public void done(final IJobChangeEvent event) {
+ Display.getDefault().syncExec(new Runnable() {
+ public void run() {
+ if (event.getResult().isOK()) {
+ showExpressionView();
+ DebugPlugin.getDefault().getExpressionManager().addExpression(new RubyExpression(selectedText, inspectResult));
+ }
+ // if (event.getResult().getSeverity() == IStatus.ERROR)
+ // {
+ // String message = event.getResult().getMessage();
+ // MessageDialog.openInformation(Display.getCurrent().getActiveShell(),
+ // "Error", "Could not inspect '" + selectedText + "': "
+ // + message);
+ // }
+ }
+ });
+ }
+ });
+ job.setPriority(Job.SHORT);
+ job.schedule();
+ }
- }
- }
+ public void setActiveEditor(IAction action, IEditorPart targetEditor) {
+ if (targetEditor == null || targetEditor.getEditorSite() == null) {
+ this.page = null;
+ } else {
+ this.page = targetEditor.getEditorSite().getPage();
+ }
+ }
+
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mba...@us...> - 2006-12-30 09:43:00
|
Revision: 1745
http://svn.sourceforge.net/rubyeclipse/?rev=1745&view=rev
Author: mbarchfe
Date: 2006-12-30 01:42:59 -0800 (Sat, 30 Dec 2006)
Log Message:
-----------
next step for ruby debug integration
Modified Paths:
--------------
trunk/org.rubypeople.rdt.debug.core.tests/src/org/rubypeople/rdt/debug/core/tests/FTC_AbstractDebuggerCommunicationTest.java
trunk/org.rubypeople.rdt.debug.core.tests/src/org/rubypeople/rdt/debug/core/tests/FTC_ClassicDebuggerCommunicationTest.java
trunk/org.rubypeople.rdt.debug.core.tests/src/org/rubypeople/rdt/debug/core/tests/FTC_RubyDebugCommunicationTest.java
Added Paths:
-----------
trunk/org.rubypeople.rdt.debug.core.tests/src/org/rubypeople/rdt/debug/core/tests/WasteReader.java
Modified: trunk/org.rubypeople.rdt.debug.core.tests/src/org/rubypeople/rdt/debug/core/tests/FTC_AbstractDebuggerCommunicationTest.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.core.tests/src/org/rubypeople/rdt/debug/core/tests/FTC_AbstractDebuggerCommunicationTest.java 2006-12-30 09:42:35 UTC (rev 1744)
+++ trunk/org.rubypeople.rdt.debug.core.tests/src/org/rubypeople/rdt/debug/core/tests/FTC_AbstractDebuggerCommunicationTest.java 2006-12-30 09:42:59 UTC (rev 1745)
@@ -19,7 +19,9 @@
import org.rubypeople.rdt.internal.debug.core.model.RubyThread;
import org.rubypeople.rdt.internal.debug.core.model.RubyVariable;
import org.rubypeople.rdt.internal.debug.core.model.ThreadInfo;
+import org.rubypeople.rdt.internal.debug.core.parsing.BreakpointAddedReader;
import org.rubypeople.rdt.internal.debug.core.parsing.ErrorReader;
+import org.rubypeople.rdt.internal.debug.core.parsing.EvalReader;
import org.rubypeople.rdt.internal.debug.core.parsing.FramesReader;
import org.rubypeople.rdt.internal.debug.core.parsing.LoadResultReader;
import org.rubypeople.rdt.internal.debug.core.parsing.MultiReaderStrategy;
@@ -104,6 +106,10 @@
return new VariableReader(multiReaderStrategy);
}
+ protected EvalReader getEvalExceptionReader() throws Exception {
+ return new EvalReader(multiReaderStrategy);
+ }
+
protected FramesReader getFramesReader() throws Exception {
return new FramesReader(multiReaderStrategy);
}
@@ -115,6 +121,14 @@
protected LoadResultReader getLoadResultReader() throws Exception {
return new LoadResultReader(multiReaderStrategy);
}
+
+ protected EvalReader getEvalReader() throws Exception {
+ return new EvalReader(multiReaderStrategy);
+ }
+
+ protected BreakpointAddedReader getBreakpointAddedReader() throws Exception {
+ return new BreakpointAddedReader(multiReaderStrategy);
+ }
protected String getOSIndependent(String path) {
return path.replace('\\', '/');
@@ -211,7 +225,7 @@
System.out.println("..done");
}
- private void writeFile(String name, String[] content) throws Exception {
+ protected void writeFile(String name, String[] content) throws Exception {
PrintWriter writer = new PrintWriter(new FileOutputStream(getTmpDir()
+ name));
for (int i = 0; i < content.length; i++) {
@@ -220,10 +234,10 @@
writer.close();
}
- private void createSocket(String[] lines) throws Exception {
+ protected void createSocket(String[] lines) throws Exception {
writeFile("test.rb", lines);
startRubyProcess();
- Thread.sleep(500);
+ Thread.sleep(1000);
try {
socket = new Socket("localhost", 1098);
} catch (ConnectException cex) {
@@ -237,7 +251,7 @@
public void run() {
try {
while (true) {
- new ErrorReader(multiReaderStrategy).read();
+ new WasteReader(multiReaderStrategy).read();
}
} catch (Exception e) {
e.printStackTrace();
@@ -245,7 +259,7 @@
};
};
new Thread(runnable).start();
-
+ Thread.sleep(500);
out = new PrintWriter(socket.getOutputStream(), true);
readSuspensionInFirstLine() ;
}
@@ -255,7 +269,7 @@
}
- private void sendRuby(String debuggerCommand) {
+ protected void sendRuby(String debuggerCommand) {
try {
process.exitValue();
throw new RuntimeException(
@@ -293,7 +307,9 @@
// Breakpoint in line 1 does not work yet.
createSocket(new String[] { "puts 'a'", "puts 'a'", "puts 'a'" });
sendRuby("b test.rb:2");
+ assertEquals(1, getBreakpointAddedReader().readBreakpointNo()) ;
sendRuby("b test.rb:3");
+ assertEquals(2, getBreakpointAddedReader().readBreakpointNo()) ;
sendRuby("cont");
System.out.println("Waiting for breakpoint..");
SuspensionPoint hit = getSuspensionReader().readSuspension();
@@ -301,7 +317,10 @@
assertTrue(hit.isBreakpoint());
assertEquals(2, hit.getLine());
assertEquals("test.rb", hit.getFile());
- sendRuby("b remove test.rb:3");
+ sendRuby("delete -1");
+ sendRuby("delete 100");
+ sendRuby("delete 1");
+ sendRuby("delete 2");
sendRuby("cont");
hit = getSuspensionReader().readSuspension();
assertNull(hit);
@@ -369,6 +388,7 @@
public void testBreakpointNeverReached() throws Exception {
createSocket(new String[] { "puts 'a'", "puts 'b'", "puts 'c'" });
sendRuby("b test.rb:10");
+ getBreakpointAddedReader().readBreakpointNo();
sendRuby("cont");
System.out.println("Waiting for breakpoint..");
SuspensionPoint hit = getSuspensionReader().readSuspension();
@@ -378,6 +398,7 @@
public void testStepOver() throws Exception {
createSocket(new String[] { "puts 'a'", "puts 'b'", "puts 'c'" });
sendRuby("b test.rb:2");
+ getBreakpointAddedReader().readBreakpointNo();
sendRuby("cont");
getSuspensionReader().readSuspension();
sendRuby("next");
@@ -397,6 +418,7 @@
writeFile("test2.rb", new String[] { "class Test2", "def print",
"puts 'XX'", "end", "end" });
sendRuby("b test.rb:3");
+ getBreakpointAddedReader().readBreakpointNo();
sendRuby("cont");
getSuspensionReader().readSuspension();
sendRuby("next");
@@ -457,6 +479,7 @@
writeFile("test2.rb", new String[] { "class Test2", "def print",
"puts 'XX'", "puts 'XX'", "end", "end" });
sendRuby("b test2.rb:4");
+ getBreakpointAddedReader().readBreakpointNo();
runTo("test.rb", 2);
sendRuby("next");
SuspensionPoint info = getSuspensionReader().readSuspension();
@@ -481,12 +504,13 @@
sendRuby("cont");
}
- private void runToLine(int lineNumber) throws Exception {
+ protected void runToLine(int lineNumber) throws Exception {
runTo("test.rb", lineNumber);
}
private void runTo(String filename, int lineNumber) throws Exception {
sendRuby("b " + filename + ":" + lineNumber);
+ getBreakpointAddedReader().readBreakpointNo() ;
sendRuby("cont");
SuspensionPoint suspension = getSuspensionReader().readSuspension();
if (suspension == null) {
@@ -713,7 +737,7 @@
writeFile("test2.rb", new String[] { "class Test2", "def initialize",
"@y=5", "end", "def to_s", "'test'", "end", "end" });
runTo("test2.rb", 6);
- sendRuby("v i 2 customObject");
+ sendRuby("frame 2 ; v i customObject");
RubyVariable[] variables = getVariableReader().readVariables(
createStackFrame());
assertEquals(1, variables.length);
@@ -778,7 +802,7 @@
assertEquals(1, variables.length);
assertEquals("hash", variables[0].getName());
assertTrue("hash has children", variables[0].getValue().hasVariables());
- sendRuby("v i 1 " + variables[0].getObjectId());
+ sendRuby("frame 1 ; v i " + variables[0].getObjectId());
RubyVariable[] elements = getVariableReader().readVariables(
variables[0]);
assertEquals(1, elements.length);
@@ -787,7 +811,7 @@
assertEquals("KeyAndValue", elements[0].getValue()
.getReferenceTypeName());
// get the value
- sendRuby("v i 1 " + elements[0].getObjectId());
+ sendRuby("frame 1 ; v i " + elements[0].getObjectId());
RubyVariable[] values = getVariableReader().readVariables(variables[0]);
assertEquals(1, values.length);
assertEquals("@a", values[0].getName());
@@ -866,6 +890,7 @@
assertEquals("There is one variable returned.", 1, variables.length);
assertEquals("Result is 10", "10", variables[0].getValue()
.getValueString());
+ sendRuby("cont");
}
public void testInspectTemporaryArray() throws Exception {
@@ -889,7 +914,7 @@
RubyVariable[] elements = getVariableReader().readVariables(
variables[0]);
assertEquals("The array contains 3 elements", 3, elements.length);
-
+ sendRuby("cont");
}
public void testInspectNil() throws Exception {
@@ -898,9 +923,9 @@
sendRuby("v inspect nil");
RubyVariable[] variables = getVariableReader().readVariables(
createStackFrame());
- assertEquals("There is one variable returned which contains the array.", 1, variables.length);
+ assertEquals("There is one variable returned which is nil.", 1, variables.length);
assertEquals("nil", variables[0].getValue().getValueString()) ;
-
+ sendRuby("cont");
}
public void testSendCommandWithSpecialCharacters() throws Exception {
@@ -910,22 +935,38 @@
RubyVariable[] variables = getVariableReader().readVariables(
createStackFrame());
assertEquals(1, variables.length) ;
+ sendRuby("cont");
// just do not fail
}
public void testInspectError() throws Exception {
- createSocket(new String[] { "puts 'test'" });
- runToLine(1);
+ createSocket(new String[] { "puts 'test'", "puts 'test'" });
+ runToLine(2);
sendRuby("v inspect a*2");
try {
getVariableReader().readVariables(createStackFrame());
} catch (RubyProcessingException e) {
assertNotNull(e.getMessage());
+ sendRuby("cont");
return;
}
fail("RubyProcessingException not thrown.");
}
-
+
+ public void testEvalError() throws Exception {
+ createSocket(new String[] { "puts 'test'", "puts 'test'" });
+ runToLine(2);
+ sendRuby("eval unknown_") ;
+ try {
+ getEvalReader().readEvalResult() ;
+ } catch (RubyProcessingException e) {
+ assertNotNull(e.getMessage());
+ sendRuby("cont");
+ return;
+ }
+ fail("RubyProcessingException not thrown.");
+ }
+
public void testStaticVariableInstanceNested() throws Exception {
createSocket(new String[] { "class TestStatic", "def initialize(no)",
"@no = no", "end", "@@staticVar=TestStatic.new(2)", "end",
@@ -981,6 +1022,7 @@
"puts 'Test2.print'", "end", "end" });
runTo("test2.rb", 3);
sendRuby("b test.rb:4");
+ getBreakpointAddedReader().readBreakpointNo();
sendRuby("w");
RubyThread thread = new RubyThread(null, 0);
getFramesReader().readFrames(thread);
@@ -1014,62 +1056,13 @@
assertEquals(2, thread.getStackFramesSize());
}
- public void testThreads() throws Exception {
- createSocket(new String[] { "Thread.new {", "puts 'a'", "}",
- "Thread.pass", "puts 'b'" });
- sendRuby("b test.rb:2");
- sendRuby("b test.rb:5");
- sendRuby("cont");
- SuspensionPoint point1 = getSuspensionReader().readSuspension();
- sendRuby("th l");
- ThreadInfo[] threadInfos = getThreadInfoReader().readThreads();
- assertEquals(2, threadInfos.length);
- sendRuby("cont");
- SuspensionPoint point2 = getSuspensionReader().readSuspension();
- sendRuby("th l");
- threadInfos = getThreadInfoReader().readThreads();
- assertEquals(1, threadInfos.length);
- assertNotSame(point1.getThreadId(), point2.getThreadId());
- }
-
- public void testThreadIdsAndResume() throws Exception {
- createSocket(new String[] { "threads=[]", "threads << Thread.new {",
- "puts 'a'", "}", "threads << Thread.new{", "puts 'b'", "}",
- "puts 'c'", "threads.each{|t| t.join()}" });
- sendRuby("b test.rb:3");
- sendRuby("b test.rb:6");
- sendRuby("b test.rb:8");
- sendRuby("cont");
- getSuspensionReader().readSuspension();
- getSuspensionReader().readSuspension();
- getSuspensionReader().readSuspension();
-
- sendRuby("th l");
- ThreadInfo[] threads = getThreadInfoReader().readThreads();
- assertEquals(3, threads.length);
- int threadId1 = threads[0].getId();
- int threadId2 = threads[1].getId();
- int threadId3 = threads[2].getId();
- sendRuby("th " + threadId2 + " ; cont");
-
- sendRuby("th l");
- threads = getThreadInfoReader().readThreads();
- assertEquals(2, threads.length);
- assertEquals(threadId1, threads[0].getId());
- assertEquals(threadId3, threads[1].getId());
- sendRuby("th " + threadId3 + " ; cont");
-
- sendRuby("th l");
- threads = getThreadInfoReader().readThreads();
- assertEquals(1, threads.length);
- assertEquals(threadId1, threads[0].getId());
- }
-
public void testThreadFramesAndVariables() throws Exception {
createSocket(new String[] { "Thread.new {", "a=5", "x=6", "puts 'x'",
"}", "b=10", "b=11" });
sendRuby("b test.rb:3");
+ getBreakpointAddedReader().readBreakpointNo();
sendRuby("b test.rb:7");
+ getBreakpointAddedReader().readBreakpointNo();
sendRuby("th resume 1");
getSuspensionReader().readSuspension();
getSuspensionReader().readSuspension();
@@ -1109,103 +1102,4 @@
}
- public void testReloadAndInspect() throws Exception {
- String[] lines = new String[] { "class Test", "def calc(a)", "a = a*2",
- "return a", "end", "end", "test=Test.new()" };
- createSocket(lines);
- runToLine(7);
- // test variable value in stack 1 (top stack frame)
- lines[2] = "a=a*4";
- writeFile("test.rb", lines);
- sendRuby("load " + getTmpDir() + "test.rb");
- LoadResultReader.LoadResult loadResult = this.getLoadResultReader()
- .readLoadResult();
- assertTrue("No Exception from load", loadResult.isOk());
- sendRuby("v inspect Test.new.calc(2)");
- RubyVariable[] variables = getVariableReader().readVariables(
- createStackFrame());
- assertEquals("There is one variable returned.", 1, variables.length);
- assertEquals("Result is 8", "8", variables[0].getValue()
- .getValueString());
- }
-
- public void testReloadAndStep() throws Exception {
- String[] lines = new String[] { "puts 'a'", "puts 'b'", "puts 'c'" };
- createSocket(lines);
- runToLine(2);
- lines = new String[] { "puts 'd'", "puts 'e'", "puts 'f'" };
- writeFile("test.rb", lines);
- sendRuby("load " + getTmpDir() + "test.rb");
- this.getLoadResultReader().readLoadResult();
- sendRuby("next");
- SuspensionPoint info = getSuspensionReader().readSuspension();
- assertEquals(3, info.getLine());
- }
-
- public void testReloadWithException() throws Exception {
- createSocket(new String[] { "puts 'a'" });
- runToLine(1);
- // test variable value in stack 1 (top stack frame)
- String[] lines = new String[] { "classs A;end" };
- writeFile("test.rb", lines);
-
- sendRuby("load " + getTmpDir() + "test.rb");
- LoadResultReader.LoadResult loadResult = this.getLoadResultReader()
- .readLoadResult();
- assertFalse("Exception from load", loadResult.isOk());
- assertEquals(loadResult.getExceptionType(), "SyntaxError");
- }
-
- public void testReloadInRequire() throws Exception {
- // Deadlock
- String[] lines = new String[] { "def endless", "sleep 0.1", "end" };
- writeFile("content file.rb", lines);
- createSocket(new String[] { "require 'content file'", "while true",
- "endless()", "end" });
- sendRuby("cont");
- // test variable value in stack 1 (top stack frame)
- lines[1] = "exit 0";
- writeFile("content file.rb", lines);
- sendRuby("load " + getTmpDir() + "content file.rb");
- LoadResultReader.LoadResult loadResult = this.getLoadResultReader()
- .readLoadResult();
- assertTrue("No Exception from load", loadResult.isOk());
- }
-
- public void testReloadInStackFrame() throws Exception {
- String[] lines = new String[] { "class Test", "def calc(a)", "a = a*2",
- "return a", "end", "end", "result = Test.new.calc(2)",
- "result = Test.new.calc(2)", "puts result" };
- createSocket(lines);
- runToLine(3);
- // a has not yet been calculated ...
- sendRuby("v local");
- RubyVariable[] localVariables = getVariableReader().readVariables(
- createStackFrame());
- assertEquals("2", localVariables[0].getValue().getValueString());
- // now change the code ...
- lines[2] = "a=a*4";
- writeFile("test.rb", lines);
- sendRuby("load " + getTmpDir() + "test.rb");
- LoadResultReader.LoadResult loadResult = this.getLoadResultReader()
- .readLoadResult();
- assertTrue("No Exception from load", loadResult.isOk());
- runToLine(4);
- // now a is calculated and the result is 4. That means that ruby does
- // not change the code which
- // currently being executed in a stack frame, Java would have reset the
- // instruction pointer and the
- // result would be 8
- sendRuby("v local");
- localVariables = getVariableReader().readVariables(createStackFrame());
- assertEquals("4", localVariables[0].getValue().getValueString());
-
- // Now check that the new code is executed with the next call to calc
- runToLine(3);
- runToLine(4);
- sendRuby("v local");
- localVariables = getVariableReader().readVariables(createStackFrame());
- assertEquals("8", localVariables[0].getValue().getValueString());
- }
-
}
Modified: trunk/org.rubypeople.rdt.debug.core.tests/src/org/rubypeople/rdt/debug/core/tests/FTC_ClassicDebuggerCommunicationTest.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.core.tests/src/org/rubypeople/rdt/debug/core/tests/FTC_ClassicDebuggerCommunicationTest.java 2006-12-30 09:42:35 UTC (rev 1744)
+++ trunk/org.rubypeople.rdt.debug.core.tests/src/org/rubypeople/rdt/debug/core/tests/FTC_ClassicDebuggerCommunicationTest.java 2006-12-30 09:42:59 UTC (rev 1745)
@@ -3,6 +3,10 @@
import java.io.File;
import org.rubypeople.rdt.core.RubyCore;
+import org.rubypeople.rdt.internal.debug.core.SuspensionPoint;
+import org.rubypeople.rdt.internal.debug.core.model.RubyVariable;
+import org.rubypeople.rdt.internal.debug.core.model.ThreadInfo;
+import org.rubypeople.rdt.internal.debug.core.parsing.LoadResultReader;
import org.rubypeople.rdt.internal.launching.RdtLaunchingPlugin;
public class FTC_ClassicDebuggerCommunicationTest extends
@@ -11,7 +15,7 @@
junit.framework.TestSuite suite = new junit.framework.TestSuite();
//suite.addTest(new FTC_DebuggerCommunicationTest("testBreakpointOnFirstLine"));
- //suite.addTest(new FTC_DebuggerCommunicationTest("testBreakpointAddAndRemove"));
+ suite.addTest(new FTC_ClassicDebuggerCommunicationTest("testBreakpointAddAndRemove"));
// suite.addTest(new FTC_ClassicDebuggerCommunicationTest("testVariableLocal"));
// suite.addTest(new FTC_ClassicDebuggerCommunicationTest("testVariableArray"));
// suite.addTest(new FTC_ClassicDebuggerCommunicationTest("testVariableArrayEmpty"));
@@ -25,7 +29,7 @@
// suite.addTest(new FTC_ClassicDebuggerCommunicationTest("testThreads"));
- suite.addTest(new FTC_ClassicDebuggerCommunicationTest("testVariablesInFrames"));
+// suite.addTest(new FTC_ClassicDebuggerCommunicationTest("testVariablesInFrames"));
//suite.addTest(new TC_DebuggerCommunicationTest("testConstants"));
@@ -99,4 +103,154 @@
}
}
+ public void testThreads() throws Exception {
+ createSocket(new String[] { "Thread.new {", "puts 'a'", "}",
+ "Thread.pass", "puts 'b'" });
+ sendRuby("b test.rb:2");
+ sendRuby("b test.rb:5");
+ sendRuby("cont");
+ SuspensionPoint point1 = getSuspensionReader().readSuspension();
+ sendRuby("th l");
+ ThreadInfo[] threadInfos = getThreadInfoReader().readThreads();
+ assertEquals(2, threadInfos.length);
+ sendRuby("cont");
+ SuspensionPoint point2 = getSuspensionReader().readSuspension();
+ sendRuby("th l");
+ threadInfos = getThreadInfoReader().readThreads();
+ assertEquals(1, threadInfos.length);
+ assertNotSame(point1.getThreadId(), point2.getThreadId());
+ }
+
+ public void testThreadIdsAndResume() throws Exception {
+ createSocket(new String[] { "threads=[]", "threads << Thread.new {",
+ "puts 'a'", "}", "threads << Thread.new{", "puts 'b'", "}",
+ "puts 'c'", "threads.each{|t| t.join()}" });
+ sendRuby("b test.rb:3");
+ sendRuby("b test.rb:6");
+ sendRuby("b test.rb:8");
+ sendRuby("cont");
+ getSuspensionReader().readSuspension();
+ getSuspensionReader().readSuspension();
+ getSuspensionReader().readSuspension();
+
+ sendRuby("th l");
+ ThreadInfo[] threads = getThreadInfoReader().readThreads();
+ assertEquals(3, threads.length);
+ int threadId1 = threads[0].getId();
+ int threadId2 = threads[1].getId();
+ int threadId3 = threads[2].getId();
+ sendRuby("th " + threadId2 + " ; cont");
+
+ sendRuby("th l");
+ threads = getThreadInfoReader().readThreads();
+ assertEquals(2, threads.length);
+ assertEquals(threadId1, threads[0].getId());
+ assertEquals(threadId3, threads[1].getId());
+ sendRuby("th " + threadId3 + " ; cont");
+
+ sendRuby("th l");
+ threads = getThreadInfoReader().readThreads();
+ assertEquals(1, threads.length);
+ assertEquals(threadId1, threads[0].getId());
+ }
+
+ public void testReloadAndInspect() throws Exception {
+ String[] lines = new String[] { "class Test", "def calc(a)", "a = a*2",
+ "return a", "end", "end", "test=Test.new()" };
+ createSocket(lines);
+ runToLine(7);
+ // test variable value in stack 1 (top stack frame)
+ lines[2] = "a=a*4";
+ writeFile("test.rb", lines);
+ sendRuby("load " + getTmpDir() + "test.rb");
+ LoadResultReader.LoadResult loadResult = this.getLoadResultReader()
+ .readLoadResult();
+ assertTrue("No Exception from load", loadResult.isOk());
+ sendRuby("v inspect Test.new.calc(2)");
+ RubyVariable[] variables = getVariableReader().readVariables(
+ createStackFrame());
+ assertEquals("There is one variable returned.", 1, variables.length);
+ assertEquals("Result is 8", "8", variables[0].getValue()
+ .getValueString());
+ }
+
+ public void testReloadAndStep() throws Exception {
+ String[] lines = new String[] { "puts 'a'", "puts 'b'", "puts 'c'" };
+ createSocket(lines);
+ runToLine(2);
+ lines = new String[] { "puts 'd'", "puts 'e'", "puts 'f'" };
+ writeFile("test.rb", lines);
+ sendRuby("load " + getTmpDir() + "test.rb");
+ this.getLoadResultReader().readLoadResult();
+ sendRuby("next");
+ SuspensionPoint info = getSuspensionReader().readSuspension();
+ assertEquals(3, info.getLine());
+ }
+
+ public void testReloadWithException() throws Exception {
+ createSocket(new String[] { "puts 'a'" });
+ runToLine(1);
+ // test variable value in stack 1 (top stack frame)
+ String[] lines = new String[] { "classs A;end" };
+ writeFile("test.rb", lines);
+
+ sendRuby("load " + getTmpDir() + "test.rb");
+ LoadResultReader.LoadResult loadResult = this.getLoadResultReader()
+ .readLoadResult();
+ assertFalse("Exception from load", loadResult.isOk());
+ assertEquals(loadResult.getExceptionType(), "SyntaxError");
+ }
+
+ public void testReloadInRequire() throws Exception {
+ // Deadlock
+ String[] lines = new String[] { "def endless", "sleep 0.1", "end" };
+ writeFile("content file.rb", lines);
+ createSocket(new String[] { "require 'content file'", "while true",
+ "endless()", "end" });
+ sendRuby("cont");
+ // test variable value in stack 1 (top stack frame)
+ lines[1] = "exit 0";
+ writeFile("content file.rb", lines);
+ sendRuby("load " + getTmpDir() + "content file.rb");
+ LoadResultReader.LoadResult loadResult = this.getLoadResultReader()
+ .readLoadResult();
+ assertTrue("No Exception from load", loadResult.isOk());
+ }
+
+ public void testReloadInStackFrame() throws Exception {
+ String[] lines = new String[] { "class Test", "def calc(a)", "a = a*2",
+ "return a", "end", "end", "result = Test.new.calc(2)",
+ "result = Test.new.calc(2)", "puts result" };
+ createSocket(lines);
+ runToLine(3);
+ // a has not yet been calculated ...
+ sendRuby("v local");
+ RubyVariable[] localVariables = getVariableReader().readVariables(
+ createStackFrame());
+ assertEquals("2", localVariables[0].getValue().getValueString());
+ // now change the code ...
+ lines[2] = "a=a*4";
+ writeFile("test.rb", lines);
+ sendRuby("load " + getTmpDir() + "test.rb");
+ LoadResultReader.LoadResult loadResult = this.getLoadResultReader()
+ .readLoadResult();
+ assertTrue("No Exception from load", loadResult.isOk());
+ runToLine(4);
+ // now a is calculated and the result is 4. That means that ruby does
+ // not change the code which
+ // currently being executed in a stack frame, Java would have reset the
+ // instruction pointer and the
+ // result would be 8
+ sendRuby("v local");
+ localVariables = getVariableReader().readVariables(createStackFrame());
+ assertEquals("4", localVariables[0].getValue().getValueString());
+
+ // Now check that the new code is executed with the next call to calc
+ runToLine(3);
+ runToLine(4);
+ sendRuby("v local");
+ localVariables = getVariableReader().readVariables(createStackFrame());
+ assertEquals("8", localVariables[0].getValue().getValueString());
+ }
+
}
Modified: trunk/org.rubypeople.rdt.debug.core.tests/src/org/rubypeople/rdt/debug/core/tests/FTC_RubyDebugCommunicationTest.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.core.tests/src/org/rubypeople/rdt/debug/core/tests/FTC_RubyDebugCommunicationTest.java 2006-12-30 09:42:35 UTC (rev 1744)
+++ trunk/org.rubypeople.rdt.debug.core.tests/src/org/rubypeople/rdt/debug/core/tests/FTC_RubyDebugCommunicationTest.java 2006-12-30 09:42:59 UTC (rev 1745)
@@ -1,22 +1,38 @@
package org.rubypeople.rdt.debug.core.tests;
+import org.rubypeople.rdt.core.RubyCore;
import org.rubypeople.rdt.internal.debug.core.SuspensionPoint;
+import org.rubypeople.rdt.internal.debug.core.parsing.EvalReader;
+import org.rubypeople.rdt.internal.launching.DebuggerRunner;
+import org.rubypeople.rdt.internal.launching.RdtLaunchingPlugin;
-public class FTC_RubyDebugCommunicationTest extends
- FTC_ClassicDebuggerCommunicationTest {
-
+public class FTC_RubyDebugCommunicationTest extends FTC_ClassicDebuggerCommunicationTest {
+
public static junit.framework.TestSuite suite() {
junit.framework.TestSuite suite = new junit.framework.TestSuite();
+
+ suite.addTest(new FTC_RubyDebugCommunicationTest("testCommandList"));
+
+ // breakpoint on first line is not yet implemented for ruby-debug
+ //suite.addTest(new FTC_RubyDebugCommunicationTest("testBreakpointOnFirstLine"));
+ suite.addTest(new FTC_RubyDebugCommunicationTest("testBreakpointAddAndRemove"));
+ suite.addTest(new FTC_RubyDebugCommunicationTest("testBreakpointNeverReached"));
+ suite.addTest(new FTC_RubyDebugCommunicationTest("testException"));
+ suite.addTest(new FTC_RubyDebugCommunicationTest("testIgnoreException"));
+ suite.addTest(new FTC_RubyDebugCommunicationTest("testExceptionsIgnoredByDefault"));
+ suite.addTest(new FTC_RubyDebugCommunicationTest("testExceptionHierarchy"));
- suite.addTest(new FTC_RubyDebugCommunicationTest("testCommandList"));
suite.addTest(new FTC_RubyDebugCommunicationTest("testInspect"));
suite.addTest(new FTC_RubyDebugCommunicationTest("testInspectTemporaryArray"));
suite.addTest(new FTC_RubyDebugCommunicationTest("testInspectNil"));
-
+ suite.addTest(new FTC_RubyDebugCommunicationTest("testInspectError"));
+ suite.addTest(new FTC_RubyDebugCommunicationTest("testEvalError"));
+
suite.addTest(new FTC_RubyDebugCommunicationTest("testFrames"));
-
+ suite.addTest(new FTC_RubyDebugCommunicationTest("testFramesWhenThreadSpawned"));
+
suite.addTest(new FTC_RubyDebugCommunicationTest("testStepOver"));
suite.addTest(new FTC_RubyDebugCommunicationTest("testStepOverFrames"));
suite.addTest(new FTC_RubyDebugCommunicationTest("testStepOverFramesValue2"));
@@ -24,33 +40,39 @@
suite.addTest(new FTC_RubyDebugCommunicationTest("testStepReturn"));
suite.addTest(new FTC_RubyDebugCommunicationTest("testHitBreakpointWhileSteppingOver"));
suite.addTest(new FTC_RubyDebugCommunicationTest("testStepInto"));
-
+
suite.addTest(new FTC_RubyDebugCommunicationTest("testVariableString"));
suite.addTest(new FTC_RubyDebugCommunicationTest("testVariableLocal"));
suite.addTest(new FTC_RubyDebugCommunicationTest("testVariableInstance"));
- //suite.addTest(new FTC_RubyDebugCommunicationTest("testVariableInstanceNested"));
-
+ // is instance nested still needed?
+ // suite.addTest(new FTC_RubyDebugCommunicationTest("testVariableInstanceNested"));
suite.addTest(new FTC_RubyDebugCommunicationTest("testVariableNil"));
suite.addTest(new FTC_RubyDebugCommunicationTest("testVariableWithXmlContent"));
suite.addTest(new FTC_RubyDebugCommunicationTest("testVariableInObject"));
suite.addTest(new FTC_RubyDebugCommunicationTest("testVariableArray"));
suite.addTest(new FTC_RubyDebugCommunicationTest("testVariableArrayEmpty"));
-
suite.addTest(new FTC_RubyDebugCommunicationTest("testVariableHashWithStringKeys"));
suite.addTest(new FTC_RubyDebugCommunicationTest("testVariableHashWithObjectKeys"));
-
+
+ suite.addTest(new FTC_RubyDebugCommunicationTest("testStaticVariables"));
+ suite.addTest(new FTC_RubyDebugCommunicationTest("testSingletonStaticVariables"));
+ suite.addTest(new FTC_RubyDebugCommunicationTest("testConstants"));
+ suite.addTest(new FTC_RubyDebugCommunicationTest("testConstantDefinedInBothClassAndSuperclass"));
+
return suite;
}
-
+
public FTC_RubyDebugCommunicationTest(String arg0) {
super(arg0);
}
-
+
@Override
public void startRubyProcess() throws Exception {
// TODO Auto-generated method stub
- String cmd = "rdebug -s -p 1098 --cport 1099 -d -w -f xml -I " + getTmpDir().replace('\\', '/') + " " + getRubyTestFilename() ;
- //"FTC_DebuggerCommunicationTest.RUBY_INTERPRETER + " -I" + createIncludeDir() + " -I" + getTmpDir().replace('\\', '/') + " -reclipseDebugVerbose.rb " + ;
+ String cmd = "rdebug -s -p 1098 --cport 1099 -d -w -f xml -I " + getTmpDir().replace('\\', '/') + " " + getRubyTestFilename();
+ // "FTC_DebuggerCommunicationTest.RUBY_INTERPRETER + " -I" +
+ // createIncludeDir() + " -I" + getTmpDir().replace('\\', '/') + "
+ // -reclipseDebugVerbose.rb " + ;
System.out.println("Starting: " + cmd);
process = Runtime.getRuntime().exec(cmd);
rubyStderrRedirectorThread = new OutputRedirectorThread(process.getErrorStream());
@@ -60,11 +82,27 @@
}
+ protected String getDirectoryOfRubyDebuggerFile() {
+ String result = null;
+ if (RubyCore.getPlugin() != null) {
+ result = DebuggerRunner.getDirectoryOfRubyDebuggerFile();
+ } else {
+ result = RdtLaunchingPlugin.class.getResource(".").getPath() + "/../../../../../../ruby";
+ }
+ return result;
+ }
+
@Override
protected void readSuspensionInFirstLine() throws Exception {
- System.out.println("Waiting for suspension in first line") ;
+
+ System.out.println("Waiting for suspension in first line");
SuspensionPoint hit = getSuspensionReader().readSuspension();
- assertEquals(1, hit.getLine()) ;
+ assertEquals(1, hit.getLine());
+
+ String expression = "eval require '" + getDirectoryOfRubyDebuggerFile() + "/rdebugExtension.rb'";
+ sendRuby(expression);
+ String evalResult = getEvalReader().readEvalResult();
+ assertEquals("true", evalResult);
}
-
+
}
Added: trunk/org.rubypeople.rdt.debug.core.tests/src/org/rubypeople/rdt/debug/core/tests/WasteReader.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.core.tests/src/org/rubypeople/rdt/debug/core/tests/WasteReader.java (rev 0)
+++ trunk/org.rubypeople.rdt.debug.core.tests/src/org/rubypeople/rdt/debug/core/tests/WasteReader.java 2006-12-30 09:42:59 UTC (rev 1745)
@@ -0,0 +1,53 @@
+package org.rubypeople.rdt.debug.core.tests;
+
+import junit.framework.Assert;
+
+import org.rubypeople.rdt.internal.debug.core.RdtDebugCorePlugin;
+import org.rubypeople.rdt.internal.debug.core.parsing.AbstractReadStrategy;
+import org.rubypeople.rdt.internal.debug.core.parsing.XmlStreamReader;
+import org.rubypeople.rdt.internal.debug.core.parsing.XmlStreamReaderException;
+import org.xmlpull.v1.XmlPullParser;
+
+public class WasteReader extends XmlStreamReader {
+
+ private String name;
+ public WasteReader(XmlPullParser xpp) {
+ super(xpp);
+ }
+
+ public WasteReader(AbstractReadStrategy readStrategy) {
+ super(readStrategy);
+ }
+
+ @Override
+ protected boolean processStartElement(XmlPullParser xpp)
+ throws XmlStreamReaderException {
+ name = xpp.getName() ;
+ if (name.equals("exception") ) {
+ String exceptionType = xpp.getAttributeValue("", "type") ;
+ String exceptionMessage = xpp.getAttributeValue("", "message") ;
+ // Unfortunately JUnit does not stop the test because this assertion is thrown in another thread
+ Assert.fail("Exception " + exceptionType + " occurred: " + exceptionMessage) ;
+ }
+ return checkNAme();
+ }
+
+ private boolean checkNAme() {
+ return name.equals("error") || name.equals("message") || name.equals("frame") ;
+ }
+
+ @Override
+ public void processContent(String text) {
+ if (name.equals("error")) {
+ throw new RuntimeException("Error in test: " + text) ;
+ }
+ }
+ @Override
+ protected boolean processEndElement(XmlPullParser xpp) {
+ name = xpp.getName() ;
+ return checkNAme();
+ }
+
+
+
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mba...@us...> - 2006-12-30 09:42:37
|
Revision: 1744
http://svn.sourceforge.net/rubyeclipse/?rev=1744&view=rev
Author: mbarchfe
Date: 2006-12-30 01:42:35 -0800 (Sat, 30 Dec 2006)
Log Message:
-----------
next step for ruby debug integration
Modified Paths:
--------------
trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/ClassicDebuggerCommandFactory.java
trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/ICommandFactory.java
trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/RubyDebugCommandFactory.java
trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/RubyDebuggerProxy.java
trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/RubyLineBreakpoint.java
trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/model/RubyDebugTarget.java
trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/model/RubyProcessingException.java
trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/parsing/AbstractReadStrategy.java
trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/parsing/MultiReaderStrategy.java
trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/parsing/SingleReaderStrategy.java
trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/parsing/VariableReader.java
trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/parsing/XmlStreamReader.java
Added Paths:
-----------
trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/parsing/BreakpointAddedReader.java
trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/parsing/EvalReader.java
Modified: trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/ClassicDebuggerCommandFactory.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/ClassicDebuggerCommandFactory.java 2006-12-29 22:33:18 UTC (rev 1743)
+++ trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/ClassicDebuggerCommandFactory.java 2006-12-30 09:42:35 UTC (rev 1744)
@@ -48,16 +48,18 @@
return "th " + thread.getId() + ";cont";
}
- public String createSetBreakpoint(String mode, String file, int line) {
+ public String createAddBreakpoint(String file, int line) {
StringBuffer setBreakPointCommand = new StringBuffer();
- setBreakPointCommand.append("b ");
- setBreakPointCommand.append(mode);
- setBreakPointCommand.append(" ");
+ setBreakPointCommand.append("b ") ;
setBreakPointCommand.append(file);
setBreakPointCommand.append(":");
setBreakPointCommand.append(line);
return setBreakPointCommand.toString();
}
+
+ public String createRemoveBreakpoint(int index) {
+ return "delete " + index ;
+ }
public String createCatchOff() {
return "catch off";
Modified: trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/ICommandFactory.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/ICommandFactory.java 2006-12-29 22:33:18 UTC (rev 1743)
+++ trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/ICommandFactory.java 2006-12-30 09:42:35 UTC (rev 1744)
@@ -26,7 +26,9 @@
public String createResume(RubyThread thread);
- public String createSetBreakpoint(String mode, String file, int line);
+ public String createAddBreakpoint(String file, int line);
+
+ public String createRemoveBreakpoint(int index);
public String createCatchOff();
Modified: trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/RubyDebugCommandFactory.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/RubyDebugCommandFactory.java 2006-12-29 22:33:18 UTC (rev 1743)
+++ trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/RubyDebugCommandFactory.java 2006-12-30 09:42:35 UTC (rev 1744)
@@ -48,16 +48,18 @@
return "cont";
}
- public String createSetBreakpoint(String mode, String file, int line) {
+ public String createAddBreakpoint(String file, int line) {
StringBuffer setBreakPointCommand = new StringBuffer();
- setBreakPointCommand.append("b ");
- setBreakPointCommand.append(mode);
- setBreakPointCommand.append(" ");
+ setBreakPointCommand.append("b ") ;
setBreakPointCommand.append(file);
setBreakPointCommand.append(":");
setBreakPointCommand.append(line);
return setBreakPointCommand.toString();
}
+
+ public String createRemoveBreakpoint(int index) {
+ return "delete " + index ;
+ }
public String createCatchOff() {
return "catch off";
Modified: trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/RubyDebuggerProxy.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/RubyDebuggerProxy.java 2006-12-29 22:33:18 UTC (rev 1743)
+++ trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/RubyDebuggerProxy.java 2006-12-30 09:42:35 UTC (rev 1744)
@@ -15,13 +15,16 @@
import org.rubypeople.rdt.internal.debug.core.model.RubyThread;
import org.rubypeople.rdt.internal.debug.core.model.RubyVariable;
import org.rubypeople.rdt.internal.debug.core.model.ThreadInfo;
+import org.rubypeople.rdt.internal.debug.core.parsing.BreakpointAddedReader;
import org.rubypeople.rdt.internal.debug.core.parsing.ErrorReader;
+import org.rubypeople.rdt.internal.debug.core.parsing.EvalReader;
import org.rubypeople.rdt.internal.debug.core.parsing.FramesReader;
import org.rubypeople.rdt.internal.debug.core.parsing.LoadResultReader;
import org.rubypeople.rdt.internal.debug.core.parsing.MultiReaderStrategy;
import org.rubypeople.rdt.internal.debug.core.parsing.SuspensionReader;
import org.rubypeople.rdt.internal.debug.core.parsing.ThreadInfoReader;
import org.rubypeople.rdt.internal.debug.core.parsing.VariableReader;
+import org.rubypeople.rdt.internal.debug.core.parsing.XmlStreamReaderException;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import org.xmlpull.v1.XmlPullParserFactory;
@@ -35,12 +38,14 @@
private RubyLoop rubyLoop;
private XmlPullParser xpp;
protected MultiReaderStrategy multiReaderStrategy;
- private ICommandFactory commandFactory ;
+ private ICommandFactory commandFactory;
+ private final boolean isRubyDebug;
public RubyDebuggerProxy(IRubyDebugTarget debugTarget, boolean isRubyDebug) {
this.debugTarget = debugTarget;
+ this.isRubyDebug = isRubyDebug;
debugTarget.setRubyDebuggerProxy(this);
- commandFactory = isRubyDebug ? new RubyDebugCommandFactory() : new ClassicDebuggerCommandFactory() ;
+ commandFactory = isRubyDebug ? new RubyDebugCommandFactory() : new ClassicDebuggerCommandFactory();
}
public boolean checkConnection() {
@@ -53,11 +58,31 @@
}
}
- public void start() {
+ public String registerRdebugExtension(String pathToRdebugExtension) throws IOException, RubyProcessingException {
+ // should be called before start
+ if (!isRubyDebug) {
+ return "false";
+ }
try {
+ // TODO: do not let the debugger stop on the first line
+ new SuspensionReader(getMultiReaderStrategy()).readSuspension();
+ } catch (Exception e) {
+ RdtDebugCorePlugin.log(e);
+ }
+ String expression = "eval require '" + pathToRdebugExtension + "'";
+ println(expression);
+ EvalReader reader = new EvalReader(getMultiReaderStrategy());
+ return reader.readEvalResult(); // throws
+ // RubyProcessingException
+ }
+
+ public void start() throws RubyProcessingException {
+ try {
this.setBreakPoints();
this.startRubyLoop();
- } catch (IOException e) {}
+ } catch (Exception e) {
+ RdtDebugCorePlugin.log(e);
+ }
}
public void stop() {
@@ -90,7 +115,9 @@
if (socket == null) {
socket = acquireSocket();
- if (socket == null) { throw new DebuggerNotFoundException(); }
+ if (socket == null) {
+ throw new DebuggerNotFoundException();
+ }
}
return socket;
}
@@ -144,8 +171,12 @@
if (breakpoint.isEnabled()) {
if (breakpoint instanceof RubyExceptionBreakpoint) {
this.println(commandFactory.createCatchOn(breakpoint));
- } else {
- this.printBreakpoint("", breakpoint.getMarker().getResource().getName(), breakpoint.getMarker().getAttribute(IMarker.LINE_NUMBER, -1));
+ } else if (breakpoint instanceof RubyLineBreakpoint) {
+ RubyLineBreakpoint rubyLineBreakpoint = (RubyLineBreakpoint) breakpoint;
+ String command = commandFactory.createAddBreakpoint(rubyLineBreakpoint.getFileName(), rubyLineBreakpoint.getLineNumber());
+ this.println(command);
+ int index = readBreakpointIndex();
+ rubyLineBreakpoint.setIndex(index);
}
}
} catch (IOException e) {
@@ -158,9 +189,17 @@
public void removeBreakpoint(IBreakpoint breakpoint) {
try {
if (breakpoint instanceof RubyExceptionBreakpoint) {
+ // so far we allow only one catch exception
+ // catch off must be set in the case that the enablement has
+ // changed to disabled
this.println(commandFactory.createCatchOff());
- } else {
- this.printBreakpoint("remove", breakpoint.getMarker().getResource().getName(), breakpoint.getMarker().getAttribute(IMarker.LINE_NUMBER, -1));
+ } else if (breakpoint instanceof RubyLineBreakpoint) {
+ RubyLineBreakpoint rubyLineBreakpoint = (RubyLineBreakpoint) breakpoint;
+ if (rubyLineBreakpoint.getIndex() != -1) {
+ String command = commandFactory.createRemoveBreakpoint(rubyLineBreakpoint.getIndex());
+ this.println(command);
+ rubyLineBreakpoint.setIndex(-1);
+ }
}
} catch (IOException e) {
RdtDebugCorePlugin.log(e);
@@ -169,29 +208,18 @@
}
public void updateBreakpoint(IBreakpoint breakpoint, IMarkerDelta markerDelta) {
- // line might have changed or enablement/disablement
- try {
- if (breakpoint instanceof RubyExceptionBreakpoint) {
- // so far we allow only one catch exception
- // catch off must be set in the case that the enablement has changed to disabled
- this.println(commandFactory.createCatchOff());
- } else {
- // remove is called even if it has not been added at program start
- // (happens if enablement changed from disabled at program start to
- // enabled)
- this.printBreakpoint("remove", breakpoint.getMarker().getResource().getName(), markerDelta.getAttribute(IMarker.LINE_NUMBER, -1));
+ int currentline = markerDelta.getAttribute(IMarker.LINE_NUMBER, -1);
+ try {
+ if (currentline == ((RubyLineBreakpoint) breakpoint).getLineNumber()) {
+ return;
}
+ this.removeBreakpoint(breakpoint);
this.addBreakpoint(breakpoint);
- } catch (IOException e) {
+ } catch (CoreException e) {
RdtDebugCorePlugin.log(e);
}
}
- protected void printBreakpoint(String mode, String file, int line) throws IOException {
- String command = commandFactory.createSetBreakpoint(mode, file, line);
- this.println(command);
- }
-
public void startRubyLoop() {
rubyLoop = new RubyLoop();
rubyLoop.start();
@@ -202,7 +230,7 @@
new ErrorReader(getMultiReaderStrategy()).read();
}
} catch (Exception e) {
- RdtDebugCorePlugin.log(e) ;
+ RdtDebugCorePlugin.log(e);
}
};
};
@@ -231,9 +259,18 @@
return debugTarget;
}
+ public int readBreakpointIndex() {
+ try {
+ return new BreakpointAddedReader(getMultiReaderStrategy()).readBreakpointNo();
+ } catch (Exception ioex) {
+ ioex.printStackTrace();
+ throw new RuntimeException(ioex.getMessage());
+ }
+ }
+
public RubyVariable[] readVariables(RubyStackFrame frame) {
try {
- this.println(commandFactory.createReadLocalVariables(frame)) ;
+ this.println(commandFactory.createReadLocalVariables(frame));
return new VariableReader(getMultiReaderStrategy()).readVariables(frame);
} catch (Exception ioex) {
ioex.printStackTrace();
@@ -243,7 +280,7 @@
public RubyVariable[] readInstanceVariables(RubyVariable variable) {
try {
- this.println(commandFactory.createReadInstanceVariable(variable)) ;
+ this.println(commandFactory.createReadInstanceVariable(variable));
return new VariableReader(getMultiReaderStrategy()).readVariables(variable);
} catch (Exception ioex) {
ioex.printStackTrace();
@@ -293,7 +330,7 @@
public RubyStackFrame[] readFrames(RubyThread thread) {
try {
- this.println(commandFactory.createReadFrames(thread)) ;
+ this.println(commandFactory.createReadFrames(thread));
return new FramesReader(getMultiReaderStrategy()).readFrames(thread);
} catch (IOException e) {
RdtDebugCorePlugin.log(e);
Modified: trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/RubyLineBreakpoint.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/RubyLineBreakpoint.java 2006-12-29 22:33:18 UTC (rev 1743)
+++ trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/RubyLineBreakpoint.java 2006-12-30 09:42:35 UTC (rev 1744)
@@ -12,14 +12,17 @@
public class RubyLineBreakpoint extends LineBreakpoint {
protected static final String RUBY_BREAKPOINT_MARKER = "org.rubypeople.rdt.debug.core.RubyBreakpointMarker"; //$NON-NLS-1$
+ private int index = -1 ; // index of breakpoint on ruby debugger side
+
public RubyLineBreakpoint(final IResource resource, final int lineNumber) throws CoreException {
IWorkspaceRunnable wr = new IWorkspaceRunnable() {
public void run(IProgressMonitor monitor) throws CoreException {
setMarker(resource.createMarker(RUBY_BREAKPOINT_MARKER));
getMarker().setAttribute(IMarker.LINE_NUMBER, lineNumber + 1);
getMarker().setAttribute(REGISTERED, false);
+ // setEnabled must be set before calling setRegistered
+ setEnabled(true);
setRegistered(true);
- setEnabled(true);
}
};
try {
@@ -29,6 +32,10 @@
}
}
+
+ public String getFileName() throws CoreException {
+ return ensureMarker().getResource().getName();
+ }
public int getLineNumber() throws CoreException {
return ensureMarker().getAttribute(IMarker.LINE_NUMBER, -1);
@@ -53,4 +60,12 @@
return "org.rubypeople.rdt.debug";
}
+ public int getIndex() {
+ return index;
+ }
+
+ public void setIndex(int index) {
+ this.index = index;
+ }
+
}
Modified: trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/model/RubyDebugTarget.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/model/RubyDebugTarget.java 2006-12-29 22:33:18 UTC (rev 1743)
+++ trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/model/RubyDebugTarget.java 2006-12-30 09:42:35 UTC (rev 1744)
@@ -46,6 +46,7 @@
this.launch = launch;
this.process = process;
this.threads = new RubyThread[0] ;
+ this.isTerminated = false ;
IBreakpointManager manager= DebugPlugin.getDefault().getBreakpointManager();
manager.addBreakpointListener(this);
}
Modified: trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/model/RubyProcessingException.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/model/RubyProcessingException.java 2006-12-29 22:33:18 UTC (rev 1743)
+++ trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/model/RubyProcessingException.java 2006-12-30 09:42:35 UTC (rev 1744)
@@ -5,6 +5,11 @@
public class RubyProcessingException extends Exception {
private static final long serialVersionUID = -1651883905005341856L;
private String rubyExceptionType ;
+
+ public RubyProcessingException(String message) {
+ super(message) ;
+ }
+
public RubyProcessingException(String type, String message) {
super(message) ;
this.rubyExceptionType = type ;
Modified: trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/parsing/AbstractReadStrategy.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/parsing/AbstractReadStrategy.java 2006-12-29 22:33:18 UTC (rev 1743)
+++ trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/parsing/AbstractReadStrategy.java 2006-12-30 09:42:35 UTC (rev 1744)
@@ -12,12 +12,8 @@
this.xpp = xpp ;
}
-
public abstract void readElement(XmlStreamReader streamReader) throws XmlPullParserException, IOException, XmlStreamReaderException ;
-
-
-
-
+ public abstract void readElement(XmlStreamReader streamReader, long maxWaitTime) throws XmlPullParserException, IOException, XmlStreamReaderException ;
}
Added: trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/parsing/BreakpointAddedReader.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/parsing/BreakpointAddedReader.java (rev 0)
+++ trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/parsing/BreakpointAddedReader.java 2006-12-30 09:42:35 UTC (rev 1744)
@@ -0,0 +1,48 @@
+package org.rubypeople.rdt.internal.debug.core.parsing;
+
+import org.rubypeople.rdt.internal.debug.core.RdtDebugCorePlugin;
+import org.rubypeople.rdt.internal.debug.core.model.RubyProcessingException;
+import org.xmlpull.v1.XmlPullParser;
+
+public class BreakpointAddedReader extends XmlStreamReader {
+
+ private String no;
+
+ public BreakpointAddedReader(XmlPullParser xpp) {
+ super(xpp);
+ }
+
+ public BreakpointAddedReader(AbstractReadStrategy readStrategy) {
+ super(readStrategy);
+ }
+
+ @Override
+ protected boolean processStartElement(XmlPullParser xpp) throws XmlStreamReaderException {
+ boolean result = false;
+ if (xpp.getName().equals("breakpointAdded")) {
+ no = xpp.getAttributeValue("", "no");
+ result = true;
+ }
+ return result;
+ }
+
+ public int readBreakpointNo() throws NumberFormatException {
+
+ try {
+ this.read();
+ } catch (Exception ex) {
+ RdtDebugCorePlugin.log(ex);
+ return -1;
+ }
+ return Integer.parseInt(no) ;
+ }
+
+ @Override
+ public void processContent(String text) {}
+
+ @Override
+ protected boolean processEndElement(XmlPullParser xpp) {
+ return xpp.getName().equals("breakpointAdded") ;
+ }
+
+}
Added: trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/parsing/EvalReader.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/parsing/EvalReader.java (rev 0)
+++ trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/parsing/EvalReader.java 2006-12-30 09:42:35 UTC (rev 1744)
@@ -0,0 +1,59 @@
+package org.rubypeople.rdt.internal.debug.core.parsing;
+
+import org.rubypeople.rdt.internal.debug.core.RdtDebugCorePlugin;
+import org.rubypeople.rdt.internal.debug.core.model.RubyProcessingException;
+import org.xmlpull.v1.XmlPullParser;
+
+public class EvalReader extends XmlStreamReader {
+
+ private String exceptionType;
+ private String exceptionMessage;
+ private String name;
+ private String value;
+
+ public EvalReader(XmlPullParser xpp) {
+ super(xpp);
+ }
+
+ public EvalReader(AbstractReadStrategy readStrategy) {
+ super(readStrategy);
+ }
+
+ @Override
+ protected boolean processStartElement(XmlPullParser xpp) throws XmlStreamReaderException {
+ boolean result = false;
+ if (xpp.getName().equals("processingException")) {
+ exceptionType = xpp.getAttributeValue("", "type");
+ exceptionMessage = xpp.getAttributeValue("", "message");
+ result = true;
+ } else if (xpp.getName().equals("eval")) {
+ name = xpp.getAttributeValue("", "name");
+ value = xpp.getAttributeValue("", "value");
+ result = true;
+ }
+ return result;
+ }
+
+ public String readEvalResult() throws RubyProcessingException {
+
+ try {
+ this.read();
+ } catch (Exception ex) {
+ RdtDebugCorePlugin.log(ex);
+ return null;
+ }
+ if (exceptionType != null) {
+ throw new RubyProcessingException(exceptionType, exceptionMessage);
+ }
+ return value;
+ }
+
+ @Override
+ public void processContent(String text) {}
+
+ @Override
+ protected boolean processEndElement(XmlPullParser xpp) {
+ return xpp.getName().equals("processingException") || xpp.getName().equals("eval");
+ }
+
+}
Modified: trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/parsing/MultiReaderStrategy.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/parsing/MultiReaderStrategy.java 2006-12-29 22:33:18 UTC (rev 1743)
+++ trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/parsing/MultiReaderStrategy.java 2006-12-30 09:42:35 UTC (rev 1744)
@@ -82,13 +82,7 @@
int missed = 0 ;
RdtDebugCorePlugin.debug("Searching reader for start tag " + xpp.getName());
do {
- for (Iterator iter = streamReaders.iterator(); iter.hasNext();) {
- XmlStreamReader streamReader = (XmlStreamReader) iter.next();
- if (streamReader.processStartElement(xpp)) {
- currentReader = streamReader;
- break;
- }
- }
+ findReaderForTag();
if (currentReader == null) {
missed += 1 ;
RdtDebugCorePlugin.debug("Missed Start Tag : " + xpp.getName());
@@ -100,9 +94,19 @@
} while (currentReader == null && missed < 10);
}
- protected void releaseAllReader() {
+ private synchronized void findReaderForTag() throws XmlStreamReaderException {
for (Iterator iter = streamReaders.iterator(); iter.hasNext();) {
XmlStreamReader streamReader = (XmlStreamReader) iter.next();
+ if (streamReader.processStartElement(xpp)) {
+ currentReader = streamReader;
+ break;
+ }
+ }
+ }
+
+ protected synchronized void releaseAllReader() {
+ for (Iterator iter = streamReaders.iterator(); iter.hasNext();) {
+ XmlStreamReader streamReader = (XmlStreamReader) iter.next();
((Thread) threads.get(streamReader)).interrupt();
iter.remove() ;
}
@@ -121,10 +125,15 @@
}
public void readElement(XmlStreamReader streamReader) {
+ readElement(streamReader, Long.MAX_VALUE) ;
+ }
+
+ public void readElement(XmlStreamReader streamReader, long maxWaitTime) {
this.addReader(streamReader);
try {
RdtDebugCorePlugin.debug("Thread is waiting for input: " + Thread.currentThread());
- Thread.sleep(Long.MAX_VALUE);
+ Thread.sleep(maxWaitTime);
+ streamReader.setWaitTimeExpired(true) ;
} catch (InterruptedException e) {
RdtDebugCorePlugin.debug("Thread has finished processing : " + Thread.currentThread());
}
Modified: trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/parsing/SingleReaderStrategy.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/parsing/SingleReaderStrategy.java 2006-12-29 22:33:18 UTC (rev 1743)
+++ trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/parsing/SingleReaderStrategy.java 2006-12-30 09:42:35 UTC (rev 1744)
@@ -35,4 +35,9 @@
} while (true);
}
+ @Override
+ public void readElement(XmlStreamReader streamReader, long maxWaitTime) throws XmlPullParserException, IOException, XmlStreamReaderException {
+ readElement(streamReader) ;
+ }
+
}
Modified: trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/parsing/VariableReader.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/parsing/VariableReader.java 2006-12-29 22:33:18 UTC (rev 1743)
+++ trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/parsing/VariableReader.java 2006-12-30 09:42:35 UTC (rev 1744)
@@ -38,13 +38,16 @@
this.parent = parent ;
this.variables = new ArrayList() ;
try {
- this.read();
+ // TODO: timeout should be configurable
+ this.read(10000);
} catch (Exception ex) {
RdtDebugCorePlugin.log(ex) ;
return new RubyVariable[0] ;
}
if (exceptionMessage != null) {
throw new RubyProcessingException(exceptionType, exceptionMessage) ;
+ } else if (isWaitTimeExpired()) {
+ throw new RubyProcessingException("Timeout: Could not read result.") ;
}
RubyVariable[] variablesArray = new RubyVariable[variables.size()];
variables.toArray(variablesArray);
Modified: trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/parsing/XmlStreamReader.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/parsing/XmlStreamReader.java 2006-12-29 22:33:18 UTC (rev 1743)
+++ trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/parsing/XmlStreamReader.java 2006-12-30 09:42:35 UTC (rev 1744)
@@ -8,6 +8,7 @@
public abstract class XmlStreamReader {
private AbstractReadStrategy readStrategy ;
+ private boolean isWaitTimeExpired ;
public XmlStreamReader(XmlPullParser xpp) {
this(new SingleReaderStrategy(xpp)) ;
@@ -15,11 +16,16 @@
public XmlStreamReader(AbstractReadStrategy readStrategy) {
this.readStrategy = readStrategy ;
+ this.isWaitTimeExpired = false ;
}
public void read() throws XmlPullParserException, IOException, XmlStreamReaderException{
this.readStrategy.readElement(this) ;
}
+
+ public void read(long maxWaitTime) throws XmlPullParserException, IOException, XmlStreamReaderException{
+ this.readStrategy.readElement(this, maxWaitTime) ;
+ }
protected abstract boolean processStartElement(XmlPullParser xpp) throws XmlStreamReaderException ;
protected boolean processEndElement(XmlPullParser xpp) {
@@ -32,4 +38,12 @@
public void processContent(String text) {
}
+ public boolean isWaitTimeExpired() {
+ return isWaitTimeExpired;
+ }
+
+ protected void setWaitTimeExpired(boolean isWaitTimeExpired) {
+ this.isWaitTimeExpired = isWaitTimeExpired;
+ }
+
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2006-12-29 22:33:27
|
Revision: 1743
http://svn.sourceforge.net/rubyeclipse/?rev=1743&view=rev
Author: cawilliams
Date: 2006-12-29 14:33:18 -0800 (Fri, 29 Dec 2006)
Log Message:
-----------
make the duplicate code detection create markers, not spit out dupes to console. Still some ugliness to work out (like the offets are wrong, and that it should become a compiler that's only run on clean builds).
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/AbstractRdtCompiler.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/CleanRdtCompiler.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/IFileProvider.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/ProjectFileFinder.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/RubySourceFileCollectingVisitor.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/pmd/CPD.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/pmd/RubyTokenizer.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/pmd/TokenEntry.java
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/AbstractRdtCompiler.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/AbstractRdtCompiler.java 2006-12-29 15:06:29 UTC (rev 1742)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/AbstractRdtCompiler.java 2006-12-29 22:33:18 UTC (rev 1743)
@@ -7,7 +7,10 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.rubypeople.rdt.core.RubyCore;
import org.rubypeople.rdt.internal.core.pmd.CPD;
import org.rubypeople.rdt.internal.core.pmd.Match;
import org.rubypeople.rdt.internal.core.pmd.PMD;
@@ -32,7 +35,7 @@
protected abstract void removeMarkers(IMarkerManager markerManager);
protected abstract void flushIndexEntries(SymbolIndex symbolIndex);
- protected abstract List getFilesToCompile();
+ protected abstract List<IFile> getFilesToCompile();
protected abstract void analyzeFiles() throws CoreException;
protected static List compilers(MarkerManager markerManager) {
@@ -42,8 +45,8 @@
public void compile(IProgressMonitor monitor) throws CoreException {
analyzeFiles();
- List list = getFilesToCompile();
- int fileCount = list.size();
+ List<IFile> files = getFilesToCompile();
+ int fileCount = files.size();
monitor.beginTask("Building "+project.getName() + "...", fileCount * (compilers.size() + 3));
monitor.subTask("Removing Markers...");
@@ -52,37 +55,33 @@
monitor.subTask("Removing Search Indices...");
flushIndexEntries(symbolIndex);
monitor.worked(fileCount);
- // FIXME Create warning markers for these duplicate code matches
+
// TODO Refactor out this stuff into a compiler, only visit files we've collected
monitor.subTask("Finding duplicate code...");
try {
- Iterator<Match> matches = CPD.findMatches(project);
- StringBuffer buffer = new StringBuffer();
+ Iterator<Match> matches = CPD.findMatches(files);
while (matches.hasNext()) {
Match match = matches.next();
- renderOn(buffer, match);
+ addMarker(match);
}
- System.out.println(buffer.toString());
} catch (IOException e) {
e.printStackTrace();
}
monitor.worked(fileCount);
- compileFiles(list, monitor);
+ compileFiles(files, monitor);
monitor.done();
}
- private void renderOn(StringBuffer rpt, Match match) {
- rpt.append("Found a ").append(match.getLineCount()).append(" line (").append(match.getTokenCount()).append(" tokens) duplication in the following files: ").append(PMD.EOL);
-
- TokenEntry mark;
+ private void addMarker(Match match) {
+ StringBuffer message = new StringBuffer("Found a ");
+ message.append(match.getLineCount()).append(" line (").append(match.getTokenCount()).append(" tokens) duplication");
for (Iterator occurrences = match.iterator(); occurrences.hasNext();) {
- mark = (TokenEntry) occurrences.next();
- rpt.append("Starting at line ").append(mark.getBeginLine()).append(" of ").append(mark.getTokenSrcID()).append(PMD.EOL);
+ TokenEntry mark = (TokenEntry) occurrences.next();
+ // FIXME Make TokenEntry hold an IFile pointer to source file?
+ IFile file = RubyCore.getWorkspace().getRoot().getFileForLocation(Path.fromOSString(mark.getTokenSrcID()));
+ markerManager.addWarning(file, message.toString(), mark.getBeginLine(), mark.getStartOffset(), mark.getStartOffset() + match.getSourceCodeSlice().length());
}
- rpt.append(PMD.EOL); // add a line to separate the source from the desc above
- String source = match.getSourceCodeSlice();
- rpt.append(source).append(PMD.EOL);
}
private void compileFiles(List list, IProgressMonitor monitor) throws CoreException {
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/CleanRdtCompiler.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/CleanRdtCompiler.java 2006-12-29 15:06:29 UTC (rev 1742)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/CleanRdtCompiler.java 2006-12-29 22:33:18 UTC (rev 1743)
@@ -2,13 +2,14 @@
import java.util.List;
+import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.rubypeople.rdt.internal.core.symbols.SymbolIndex;
public class CleanRdtCompiler extends AbstractRdtCompiler {
- private List projectFiles;
+ private List<IFile> projectFiles;
public CleanRdtCompiler(IProject project, SymbolIndex symbolIndex) {
this(project, symbolIndex, new MarkerManager());
@@ -32,11 +33,11 @@
markerManager.removeProblemsAndTasksFor(project);
}
- protected List getFilesToClear() {
+ protected List<IFile> getFilesToClear() {
return projectFiles;
}
- protected List getFilesToCompile() {
+ protected List<IFile> getFilesToCompile() {
return projectFiles;
}
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/IFileProvider.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/IFileProvider.java 2006-12-29 15:06:29 UTC (rev 1742)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/IFileProvider.java 2006-12-29 22:33:18 UTC (rev 1743)
@@ -13,8 +13,9 @@
import java.util.List;
+import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
interface IFileProvider {
- public List findFiles() throws CoreException;
+ public List<IFile> findFiles() throws CoreException;
}
\ No newline at end of file
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/ProjectFileFinder.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/ProjectFileFinder.java 2006-12-29 15:06:29 UTC (rev 1742)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/ProjectFileFinder.java 2006-12-29 22:33:18 UTC (rev 1743)
@@ -15,6 +15,7 @@
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
@@ -26,13 +27,13 @@
this.project = project;
}
- public List findFiles() throws CoreException {
- List files = new ArrayList();
+ public List<IFile> findFiles() throws CoreException {
+ List<IFile> files = new ArrayList<IFile>();
addAllSourceFiles(files);
return files;
}
- protected void addAllSourceFiles(final List sourceFiles) throws CoreException {
+ protected void addAllSourceFiles(final List<IFile> sourceFiles) throws CoreException {
project.accept(new RubySourceFileCollectingVisitor(sourceFiles), IResource.NONE);
}
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/RubySourceFileCollectingVisitor.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/RubySourceFileCollectingVisitor.java 2006-12-29 15:06:29 UTC (rev 1742)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/RubySourceFileCollectingVisitor.java 2006-12-29 22:33:18 UTC (rev 1743)
@@ -27,10 +27,10 @@
public final class RubySourceFileCollectingVisitor implements IResourceProxyVisitor {
private static final String RUBY_SOURCE_CONTENT_TYPE_ID = "org.rubypeople.rdt.core.rubySource";
- private final List files;
+ private final List<IFile> files;
private HashSet<String> visitedLinks;
- public RubySourceFileCollectingVisitor(List files) {
+ public RubySourceFileCollectingVisitor(List<IFile> files) {
this.files = files;
this.visitedLinks = new HashSet<String>();
}
@@ -41,7 +41,7 @@
case IResource.FILE:
if (org.rubypeople.rdt.internal.core.util.Util.isRubyLikeFileName(proxy.getName())) {
if (resource == null) resource = proxy.requestResource();
- files.add(resource);
+ files.add((IFile)resource);
return false;
}
// Check for Ruby Source content type
@@ -52,7 +52,7 @@
IContentType type = contentDescription.getContentType();
if (type != null)
if (type.getId().equals(RUBY_SOURCE_CONTENT_TYPE_ID))
- files.add(resource);
+ files.add(file);
}
return false;
case IResource.FOLDER:
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/pmd/CPD.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/pmd/CPD.java 2006-12-29 15:06:29 UTC (rev 1742)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/pmd/CPD.java 2006-12-29 22:33:18 UTC (rev 1743)
@@ -1,7 +1,6 @@
package org.rubypeople.rdt.internal.core.pmd;
import java.io.File;
-import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.HashMap;
import java.util.HashSet;
@@ -10,34 +9,26 @@
import java.util.Map;
import java.util.Set;
-import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IFile;
public class CPD {
private Map<String, SourceCode> source = new HashMap<String, SourceCode>();
private int minimumTileSize;
- private Language language;
- private boolean skipDuplicates;
+ private Language language = new RubyLanguage();
private MatchAlgorithm matchAlgorithm;
private Tokens tokens = new Tokens();
private CPDListener listener = new CPDNullListener();
private Set<String> current = new HashSet<String>();
- private CPD(int minimumTileSize, Language language) {
+ private CPD(int minimumTileSize) {
this.minimumTileSize = minimumTileSize;
- this.language = language;
}
- public static Iterator<Match> findMatches(IProject project) throws IOException {
- boolean skipDuplicateFiles = true;
- int minimumTokens = 5;
- Language language = new RubyLanguage();
-
- CPD cpd = new CPD(minimumTokens, language);
- if (skipDuplicateFiles) {
- cpd.skipDuplicates();
- }
- cpd.addRecursively(project.getLocation().toOSString());
+ public static Iterator<Match> findMatches(List<IFile> files) throws IOException {
+ int minimumTokens = 5; // TODO Make this configurable in a preference page
+ CPD cpd = new CPD(minimumTokens);
+ cpd.add(files);
cpd.go();
return cpd.getMatches();
}
@@ -47,53 +38,33 @@
matchAlgorithm = new MatchAlgorithm(source, tokens, minimumTileSize, listener);
matchAlgorithm.findMatches();
}
-
- private void skipDuplicates() {
- this.skipDuplicates = true;
- }
-
+
private Iterator<Match> getMatches() {
return matchAlgorithm.matches();
}
- private void addRecursively(String dir) throws IOException {
- addDirectory(dir, true);
+ private void add(List<IFile> files) throws IOException {
+ for (IFile file : files) {
+ add(files.size(), file);
+ }
}
- private void addDirectory(String dir, boolean recurse) throws IOException {
- if (!(new File(dir)).exists()) {
- throw new FileNotFoundException("Couldn't find directory " + dir);
+ private void add(int fileCount, IFile file) throws IOException {
+ File realFile = file.getLocation().toFile();
+ // TODO refactor this thing into a separate class
+ String signature = realFile.getName() + '_' + realFile.length();
+ if (current.contains(signature)) { // skip duplicates
+ return;
}
- FileFinder finder = new FileFinder();
- // TODO - could use SourceFileSelector here
- add(finder.findFilesFrom(dir, language.getFileFilter(), recurse));
- }
-
- private void add(List files) throws IOException {
- for (Iterator i = files.iterator(); i.hasNext();) {
- add(files.size(), (File) i.next());
- }
- }
-
- private void add(int fileCount, File file) throws IOException {
-
- if (skipDuplicates) {
- // TODO refactor this thing into a separate class
- String signature = file.getName() + '_' + file.length();
- if (current.contains(signature)) {
- System.out.println("Skipping " + file.getAbsolutePath() + " since it appears to be a duplicate file and --skip-duplicate-files is set");
- return;
- }
- current.add(signature);
- }
-
- if (!file.getCanonicalPath().equals(file.getAbsolutePath())) {
- System.out.println("Skipping " + file + " since it appears to be a symlink");
+ current.add(signature);
+
+ if (!realFile.getCanonicalPath().equals(realFile.getAbsolutePath())) { // skip symlinks
return;
}
- listener.addedFile(fileCount, file);
- SourceCode sourceCode = new SourceCode(new SourceCode.FileCodeLoader(file));
+ listener.addedFile(fileCount, realFile);
+// FIXME We need to compensate all our token offsets by the end-of-line characters!
+ SourceCode sourceCode = new SourceCode(new SourceCode.FileCodeLoader(realFile));
language.getTokenizer().tokenize(sourceCode, tokens);
source.put(sourceCode.getFileName(), sourceCode);
}
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/pmd/RubyTokenizer.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/pmd/RubyTokenizer.java 2006-12-29 15:06:29 UTC (rev 1742)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/pmd/RubyTokenizer.java 2006-12-29 22:33:18 UTC (rev 1743)
@@ -11,11 +11,14 @@
public void tokenize(SourceCode tokens, Tokens tokenEntries) {
List code = tokens.getCode();
+ int curLineOffset = 0;
for (int i = 0; i < code.size(); i++) {
String currentLine = (String) code.get(i);
int loc = 0;
+ int startOffset = 0;
while (loc < currentLine.length()) {
StringBuffer token = new StringBuffer();
+ startOffset = curLineOffset + loc;
loc = getTokenFromLine(currentLine, token, loc);
if (token.length() > 0 && !isIgnorableString(token.toString())) {
if (downcaseString) {
@@ -23,9 +26,10 @@
}
tokenEntries.add(new TokenEntry(token.toString(),
tokens.getFileName(),
- i + 1));
+ i + 1, startOffset, startOffset + token.length()));
}
}
+ curLineOffset += currentLine.length();
}
tokenEntries.add(TokenEntry.getEOF());
}
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/pmd/TokenEntry.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/pmd/TokenEntry.java 2006-12-29 15:06:29 UTC (rev 1742)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/pmd/TokenEntry.java 2006-12-29 22:33:18 UTC (rev 1743)
@@ -15,6 +15,8 @@
private int index;
private int identifier;
private int hashCode;
+ private int startOffset;
+ private int endOffset;
private final static Map Tokens = new HashMap();
private static int TokenCount = 0;
@@ -24,7 +26,7 @@
this.tokenSrcID = "EOFMarker";
}
- public TokenEntry(String image, String tokenSrcID, int beginLine) {
+ public TokenEntry(String image, String tokenSrcID, int beginLine, int startOffset, int endOffset) {
Integer i = (Integer) Tokens.get(image);
if (i == null) {
i = new Integer(Tokens.size() + 1);
@@ -33,6 +35,8 @@
this.identifier = i.intValue();
this.tokenSrcID = tokenSrcID;
this.beginLine = beginLine;
+ this.startOffset = startOffset;
+ this.endOffset = endOffset;
this.index = TokenCount++;
}
@@ -46,6 +50,14 @@
TokenCount = 0;
}
+ public int getStartOffset() {
+ return startOffset;
+ }
+
+ public int getEndOffset() {
+ return endOffset;
+ }
+
public String getTokenSrcID() {
return tokenSrcID;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2006-12-29 15:06:31
|
Revision: 1742
http://svn.sourceforge.net/rubyeclipse/?rev=1742&view=rev
Author: cawilliams
Date: 2006-12-29 07:06:29 -0800 (Fri, 29 Dec 2006)
Log Message:
-----------
add more messages into build process so it's easier to tell where we are at any given time (which can help me, because I think the build is hanging or very slow with the code duplication checking I added on very large projects - like the ruby lib).
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/AbstractRdtCompiler.java
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/AbstractRdtCompiler.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/AbstractRdtCompiler.java 2006-12-28 12:32:18 UTC (rev 1741)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/AbstractRdtCompiler.java 2006-12-29 15:06:29 UTC (rev 1742)
@@ -44,15 +44,17 @@
analyzeFiles();
List list = getFilesToCompile();
int fileCount = list.size();
- monitor.beginTask("Building "+project.getName() + "...", fileCount * (compilers.size() + 2));
+ monitor.beginTask("Building "+project.getName() + "...", fileCount * (compilers.size() + 3));
monitor.subTask("Removing Markers...");
removeMarkers(markerManager);
monitor.worked(fileCount);
+ monitor.subTask("Removing Search Indices...");
flushIndexEntries(symbolIndex);
monitor.worked(fileCount);
// FIXME Create warning markers for these duplicate code matches
// TODO Refactor out this stuff into a compiler, only visit files we've collected
+ monitor.subTask("Finding duplicate code...");
try {
Iterator<Match> matches = CPD.findMatches(project);
StringBuffer buffer = new StringBuffer();
@@ -64,7 +66,8 @@
} catch (IOException e) {
e.printStackTrace();
}
-
+ monitor.worked(fileCount);
+
compileFiles(list, monitor);
monitor.done();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mba...@us...> - 2006-12-28 12:32:23
|
Revision: 1741
http://svn.sourceforge.net/rubyeclipse/?rev=1741&view=rev
Author: mbarchfe
Date: 2006-12-28 04:32:18 -0800 (Thu, 28 Dec 2006)
Log Message:
-----------
added ant jars since they are not available on the server's classpath
Modified Paths:
--------------
trunk/org.rubypeople.rdt.doc.user/build.xml
trunk/org.rubypeople.rdt.doc.user/buildDocbook.xml
Added Paths:
-----------
trunk/org.rubypeople.rdt.doc.user/lib/ant-launcher.jar
trunk/org.rubypeople.rdt.doc.user/lib/ant-trax.jar
trunk/org.rubypeople.rdt.doc.user/lib/ant.jar
Modified: trunk/org.rubypeople.rdt.doc.user/build.xml
===================================================================
--- trunk/org.rubypeople.rdt.doc.user/build.xml 2006-12-28 09:13:00 UTC (rev 1740)
+++ trunk/org.rubypeople.rdt.doc.user/build.xml 2006-12-28 12:32:18 UTC (rev 1741)
@@ -49,8 +49,7 @@
the html documents are created relative to the working directory. Using base.dir these files can be created
in a subdirectory but base.dir may not be an absolute path, because then the references in toc.xml would
be absolute, too -->
- <echo>${java.class.path}</echo>
- <java classpath="${java.class.path}" classname="org.apache.tools.ant.Main" dir="${basedir}" fork="true" >
+ <java classpath="${basedir}/lib/ant.jar:${basedir}/lib/ant-launcher.jar:${basedir}/lib/ant-trax.jar" classname="org.apache.tools.ant.Main" dir="${basedir}" fork="true" >
<arg value="-DfeatureVersion=${featureVersion}"/>
<arg value="-f"/>
<arg value="buildDocbook.xml"/>
Modified: trunk/org.rubypeople.rdt.doc.user/buildDocbook.xml
===================================================================
--- trunk/org.rubypeople.rdt.doc.user/buildDocbook.xml 2006-12-28 09:13:00 UTC (rev 1740)
+++ trunk/org.rubypeople.rdt.doc.user/buildDocbook.xml 2006-12-28 12:32:18 UTC (rev 1741)
@@ -53,7 +53,8 @@
basedir="${basedir}"
destdir="${basedir}"
extension=".done"
- style="customizationLayerCopy.xsl">
+ style="customizationLayerCopy.xsl"
+ processor="trax">
<param name="base.dir" expression="html/"/>
<param name="manifest.in.base.dir" expression="0"/>
<param name="eclipse.plugin.id" expression="org.rubypeople.rdt.doc.user"/>
Added: trunk/org.rubypeople.rdt.doc.user/lib/ant-launcher.jar
===================================================================
(Binary files differ)
Property changes on: trunk/org.rubypeople.rdt.doc.user/lib/ant-launcher.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/org.rubypeople.rdt.doc.user/lib/ant-trax.jar
===================================================================
(Binary files differ)
Property changes on: trunk/org.rubypeople.rdt.doc.user/lib/ant-trax.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/org.rubypeople.rdt.doc.user/lib/ant.jar
===================================================================
(Binary files differ)
Property changes on: trunk/org.rubypeople.rdt.doc.user/lib/ant.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mba...@us...> - 2006-12-28 09:13:03
|
Revision: 1740
http://svn.sourceforge.net/rubyeclipse/?rev=1740&view=rev
Author: mbarchfe
Date: 2006-12-28 01:13:00 -0800 (Thu, 28 Dec 2006)
Log Message:
-----------
replaced Launcher with Main for starting sub-ant task for html generation
Modified Paths:
--------------
trunk/org.rubypeople.rdt.doc.user/build.xml
Modified: trunk/org.rubypeople.rdt.doc.user/build.xml
===================================================================
--- trunk/org.rubypeople.rdt.doc.user/build.xml 2006-12-28 08:39:32 UTC (rev 1739)
+++ trunk/org.rubypeople.rdt.doc.user/build.xml 2006-12-28 09:13:00 UTC (rev 1740)
@@ -49,7 +49,8 @@
the html documents are created relative to the working directory. Using base.dir these files can be created
in a subdirectory but base.dir may not be an absolute path, because then the references in toc.xml would
be absolute, too -->
- <java classpath="${java.class.path}" classname="org.apache.tools.ant.launch.Launcher" dir="${basedir}" fork="true" >
+ <echo>${java.class.path}</echo>
+ <java classpath="${java.class.path}" classname="org.apache.tools.ant.Main" dir="${basedir}" fork="true" >
<arg value="-DfeatureVersion=${featureVersion}"/>
<arg value="-f"/>
<arg value="buildDocbook.xml"/>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mba...@us...> - 2006-12-28 08:39:34
|
Revision: 1739
http://svn.sourceforge.net/rubyeclipse/?rev=1739&view=rev
Author: mbarchfe
Date: 2006-12-28 00:39:32 -0800 (Thu, 28 Dec 2006)
Log Message:
-----------
change working directory (user.dir) to basedir because documents (write.chunk) are written relative to it
Modified Paths:
--------------
trunk/org.rubypeople.rdt.doc.user/build.xml
trunk/org.rubypeople.rdt.doc.user/buildDocbook.xml
Modified: trunk/org.rubypeople.rdt.doc.user/build.xml
===================================================================
--- trunk/org.rubypeople.rdt.doc.user/build.xml 2006-12-27 14:11:54 UTC (rev 1738)
+++ trunk/org.rubypeople.rdt.doc.user/build.xml 2006-12-28 08:39:32 UTC (rev 1739)
@@ -45,7 +45,16 @@
</target>
<target name="build.jars" depends="init" description="Build all the jars for the plug-in: org.rubypeople.rdt.doc.user.">
- <ant antfile="buildDocbook.xml" target="html"/>
+ <!-- start up a new VM with basedir as Working Directory (user.dir). Unfortunately this is necessary, because
+ the html documents are created relative to the working directory. Using base.dir these files can be created
+ in a subdirectory but base.dir may not be an absolute path, because then the references in toc.xml would
+ be absolute, too -->
+ <java classpath="${java.class.path}" classname="org.apache.tools.ant.launch.Launcher" dir="${basedir}" fork="true" >
+ <arg value="-DfeatureVersion=${featureVersion}"/>
+ <arg value="-f"/>
+ <arg value="buildDocbook.xml"/>
+ <arg value="html"/>
+ </java>
</target>
<target name="build.sources" depends="init">
Modified: trunk/org.rubypeople.rdt.doc.user/buildDocbook.xml
===================================================================
--- trunk/org.rubypeople.rdt.doc.user/buildDocbook.xml 2006-12-27 14:11:54 UTC (rev 1738)
+++ trunk/org.rubypeople.rdt.doc.user/buildDocbook.xml 2006-12-28 08:39:32 UTC (rev 1739)
@@ -32,6 +32,7 @@
<fileset dir="html" includes="*.html"/>
</delete>
<delete file="customizationLayerCopy.xsl"/>
+ <delete file="plugin.xml"/>
</target>
<target name="replaceVarInCustomizationLayer">
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mba...@us...> - 2006-12-27 14:11:55
|
Revision: 1738
http://svn.sourceforge.net/rubyeclipse/?rev=1738&view=rev
Author: mbarchfe
Date: 2006-12-27 06:11:54 -0800 (Wed, 27 Dec 2006)
Log Message:
-----------
ahem, it is necessary since it contains the custom attribute
Added Paths:
-----------
trunk/org.rubypeople.rdt.doc.user/build.properties
Added: trunk/org.rubypeople.rdt.doc.user/build.properties
===================================================================
--- trunk/org.rubypeople.rdt.doc.user/build.properties (rev 0)
+++ trunk/org.rubypeople.rdt.doc.user/build.properties 2006-12-27 14:11:54 UTC (rev 1738)
@@ -0,0 +1 @@
+custom = true
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mba...@us...> - 2006-12-27 13:48:13
|
Revision: 1737
http://svn.sourceforge.net/rubyeclipse/?rev=1737&view=rev
Author: mbarchfe
Date: 2006-12-27 05:48:12 -0800 (Wed, 27 Dec 2006)
Log Message:
-----------
update include file list for bin and source builds
Modified Paths:
--------------
trunk/org.rubypeople.rdt.doc.user/build.xml
Modified: trunk/org.rubypeople.rdt.doc.user/build.xml
===================================================================
--- trunk/org.rubypeople.rdt.doc.user/build.xml 2006-12-27 13:47:44 UTC (rev 1736)
+++ trunk/org.rubypeople.rdt.doc.user/build.xml 2006-12-27 13:48:12 UTC (rev 1737)
@@ -54,7 +54,7 @@
<target name="gather.bin.parts" depends="init" if="destination.temp.folder">
<mkdir dir="${destination.temp.folder}/org.rubypeople.rdt.doc.user_${featureVersion}"/>
<copy todir="${destination.temp.folder}/org.rubypeople.rdt.doc.user_${featureVersion}" failonerror="true">
- <fileset dir="${basedir}" includes="plugin.xml,toc.xml,html/,images/,META-INF/" excludes="build.xml" />
+ <fileset dir="${basedir}" includes="plugin.xml,toc.xml,plugin.properties,html/,images/,META-INF/" excludes="build.xml" />
</copy>
</target>
@@ -63,7 +63,7 @@
<target name="gather.sources" depends="init" if="destination.temp.folder">
<copy todir="${destination.temp.folder}/org.rubypeople.rdt.doc.user_${featureVersion}" failonerror="false">
- <fileset dir="${basedir}" includes="docbook.xml,plugin.xml,META-INF/"/>
+ <fileset dir="${basedir}" includes="docbook.xml,buildDocbook.xml,customizationLayer.xsl"/>
</copy>
</target>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mba...@us...> - 2006-12-27 13:47:47
|
Revision: 1736
http://svn.sourceforge.net/rubyeclipse/?rev=1736&view=rev
Author: mbarchfe
Date: 2006-12-27 05:47:44 -0800 (Wed, 27 Dec 2006)
Log Message:
-----------
. in basedir does not evaluate to the directory where the build file is located (buildDocbook.xml) but to the directory where the build was started
Modified Paths:
--------------
trunk/org.rubypeople.rdt.doc.user/buildDocbook.xml
Modified: trunk/org.rubypeople.rdt.doc.user/buildDocbook.xml
===================================================================
--- trunk/org.rubypeople.rdt.doc.user/buildDocbook.xml 2006-12-27 13:46:25 UTC (rev 1735)
+++ trunk/org.rubypeople.rdt.doc.user/buildDocbook.xml 2006-12-27 13:47:44 UTC (rev 1736)
@@ -49,8 +49,8 @@
-->
<style classpath="lib/saxon_6.6.5.jar"
includes="docbook.xml"
- basedir="."
- destdir="."
+ basedir="${basedir}"
+ destdir="${basedir}"
extension=".done"
style="customizationLayerCopy.xsl">
<param name="base.dir" expression="html/"/>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mba...@us...> - 2006-12-27 13:46:27
|
Revision: 1735
http://svn.sourceforge.net/rubyeclipse/?rev=1735&view=rev
Author: mbarchfe
Date: 2006-12-27 05:46:25 -0800 (Wed, 27 Dec 2006)
Log Message:
-----------
unnecessary in custom build
Removed Paths:
-------------
trunk/org.rubypeople.rdt.doc.user/build.properties
Deleted: trunk/org.rubypeople.rdt.doc.user/build.properties
===================================================================
--- trunk/org.rubypeople.rdt.doc.user/build.properties 2006-12-27 12:15:37 UTC (rev 1734)
+++ trunk/org.rubypeople.rdt.doc.user/build.properties 2006-12-27 13:46:25 UTC (rev 1735)
@@ -1,9 +0,0 @@
-bin.includes = plugin.xml,\
- toc.xml,\
- html/,\
- images/,\
- META-INF/
-bin.excludes = build.xml
-src.includes = docbook.xml,\
- plugin.xml
-custom = true
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mba...@us...> - 2006-12-27 12:15:41
|
Revision: 1734
http://svn.sourceforge.net/rubyeclipse/?rev=1734&view=rev
Author: mbarchfe
Date: 2006-12-27 04:15:37 -0800 (Wed, 27 Dec 2006)
Log Message:
-----------
modified eclipse.xsl writes MANIFEST.MF and plugin.xml. plugin.xml therefore does not need to be checked in anymore, but MANIFEST.MF must be checked in since the build process needs it before it is generated.
Modified Paths:
--------------
trunk/org.rubypeople.rdt.doc.user/buildDocbook.xml
Added Paths:
-----------
trunk/org.rubypeople.rdt.doc.user/docbook/modified_eclipse.xsl
trunk/org.rubypeople.rdt.doc.user/plugin.properties
Removed Paths:
-------------
trunk/org.rubypeople.rdt.doc.user/plugin.xml
Property Changed:
----------------
trunk/org.rubypeople.rdt.doc.user/
Property changes on: trunk/org.rubypeople.rdt.doc.user
___________________________________________________________________
Name: svn:ignore
- bin
org.rubypeople.rdt.doc.user_*.zip
build.xml
plugin.xml
html
docbook.done
toc.xml
customizationLayerCopy.xsl
+ bin
org.rubypeople.rdt.doc.user_*.zip
build.xml
plugin.xml
html
docbook.done
toc.xml
customizationLayerCopy.xsl
Modified: trunk/org.rubypeople.rdt.doc.user/buildDocbook.xml
===================================================================
--- trunk/org.rubypeople.rdt.doc.user/buildDocbook.xml 2006-12-22 21:38:51 UTC (rev 1733)
+++ trunk/org.rubypeople.rdt.doc.user/buildDocbook.xml 2006-12-27 12:15:37 UTC (rev 1734)
@@ -16,6 +16,7 @@
<move file="docbook/docbook-xsl-${docbook.xsl.version}" tofile="${docbook.xsl.dir}" />
<mkdir dir="${docbook.dtd.dir}"/>
<unzip src="docbook/docbook-xml-4.2.zip" dest="${docbook.dtd.dir}"/>
+ <copy file="docbook/modified_eclipse.xsl" tofile="${docbook.xsl.dir}/eclipse/eclipse.xsl"/>
</target>
<target name="init" depends="docbook.unpack">
@@ -55,8 +56,8 @@
<param name="base.dir" expression="html/"/>
<param name="manifest.in.base.dir" expression="0"/>
<param name="eclipse.plugin.id" expression="org.rubypeople.rdt.doc.user"/>
- <param name="eclipse.plugin.name" expression="Ruby Development Documentation"/>
- <param name="eclipse.plugin.provider" expression="RubyPeople, Inc."/>
+ <param name="eclipse.plugin.name" expression="%Plugin.name"/>
+ <param name="eclipse.plugin.provider" expression="%providerName"/>
<xmlcatalog id="docbook.catalog">
<dtd publicId="-//OASIS//DTD DocBook V3.1//EN" location="${docbook.dtd.dir}/docbookx.dtd"/>
</xmlcatalog>
Added: trunk/org.rubypeople.rdt.doc.user/docbook/modified_eclipse.xsl
===================================================================
--- trunk/org.rubypeople.rdt.doc.user/docbook/modified_eclipse.xsl (rev 0)
+++ trunk/org.rubypeople.rdt.doc.user/docbook/modified_eclipse.xsl 2006-12-27 12:15:37 UTC (rev 1734)
@@ -0,0 +1,190 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ version="1.0">
+
+<xsl:import href="../html/chunk.xsl"/>
+
+<!-- ********************************************************************
+ $Id: eclipse.xsl,v 1.3 2005/04/10 18:09:50 bobstayton Exp $
+ ********************************************************************
+
+ This file is part of the XSL DocBook Stylesheet distribution.
+ See ../README or http://nwalsh.com/docbook/xsl/ for copyright
+ and other information.
+
+ ******************************************************************** -->
+
+<xsl:template match="/">
+ <xsl:choose>
+ <xsl:when test="$rootid != ''">
+ <xsl:choose>
+ <xsl:when test="count(key('id',$rootid)) = 0">
+ <xsl:message terminate="yes">
+ <xsl:text>ID '</xsl:text>
+ <xsl:value-of select="$rootid"/>
+ <xsl:text>' not found in document.</xsl:text>
+ </xsl:message>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:if test="$collect.xref.targets = 'yes' or
+ $collect.xref.targets = 'only'">
+ <xsl:apply-templates select="key('id', $rootid)"
+ mode="collect.targets"/>
+ </xsl:if>
+ <xsl:if test="$collect.xref.targets != 'only'">
+ <xsl:message>Formatting from <xsl:value-of
+ select="$rootid"/></xsl:message>
+ <xsl:apply-templates select="key('id',$rootid)"
+ mode="process.root"/>
+ <xsl:call-template name="etoc"/>
+ <xsl:call-template name="plugin.xml"/>
+ <xsl:call-template name="manifest.mf"/>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:if test="$collect.xref.targets = 'yes' or
+ $collect.xref.targets = 'only'">
+ <xsl:apply-templates select="/" mode="collect.targets"/>
+ </xsl:if>
+ <xsl:if test="$collect.xref.targets != 'only'">
+ <xsl:apply-templates select="/" mode="process.root"/>
+ <xsl:call-template name="etoc"/>
+ <xsl:call-template name="plugin.xml"/>
+ <xsl:call-template name="manifest.mf"/>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+
+
+</xsl:template>
+
+<xsl:template name="etoc">
+ <xsl:call-template name="write.chunk">
+ <xsl:with-param name="filename">
+ <xsl:if test="$manifest.in.base.dir != 0">
+ <xsl:value-of select="$base.dir"/>
+ </xsl:if>
+ <xsl:value-of select="'toc.xml'"/>
+ </xsl:with-param>
+ <xsl:with-param name="method" select="'xml'"/>
+ <xsl:with-param name="encoding" select="'utf-8'"/>
+ <xsl:with-param name="indent" select="'yes'"/>
+ <xsl:with-param name="content">
+ <xsl:choose>
+
+ <xsl:when test="$rootid != ''">
+ <xsl:variable name="title">
+ <xsl:if test="$eclipse.autolabel=1">
+ <xsl:variable name="label.markup">
+ <xsl:apply-templates select="key('id',$rootid)" mode="label.markup"/>
+ </xsl:variable>
+ <xsl:if test="normalize-space($label.markup)">
+ <xsl:value-of select="concat($label.markup,$autotoc.label.separator)"/>
+ </xsl:if>
+ </xsl:if>
+ <xsl:apply-templates select="key('id',$rootid)" mode="title.markup"/>
+ </xsl:variable>
+ <xsl:variable name="href">
+ <xsl:call-template name="href.target.with.base.dir">
+ <xsl:with-param name="object" select="key('id',$rootid)"/>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <toc label="{$title}" topic="{$href}">
+ <xsl:apply-templates select="key('id',$rootid)/*" mode="etoc"/>
+ </toc>
+ </xsl:when>
+
+ <xsl:otherwise>
+ <xsl:variable name="title">
+ <xsl:if test="$eclipse.autolabel=1">
+ <xsl:variable name="label.markup">
+ <xsl:apply-templates select="/*" mode="label.markup"/>
+ </xsl:variable>
+ <xsl:if test="normalize-space($label.markup)">
+ <xsl:value-of select="concat($label.markup,$autotoc.label.separator)"/>
+ </xsl:if>
+ </xsl:if>
+ <xsl:apply-templates select="/*" mode="title.markup"/>
+ </xsl:variable>
+ <xsl:variable name="href">
+ <xsl:call-template name="href.target.with.base.dir">
+ <xsl:with-param name="object" select="/"/>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <toc label="{$title}" topic="{$href}">
+ <xsl:apply-templates select="/*/*" mode="etoc"/>
+ </toc>
+ </xsl:otherwise>
+
+ </xsl:choose>
+ </xsl:with-param>
+ </xsl:call-template>
+</xsl:template>
+
+<xsl:template match="book|part|reference|preface|chapter|bibliography|appendix|article|glossary|section|sect1|sect2|sect3|sect4|sect5|refentry|colophon|bibliodiv|index" mode="etoc">
+ <xsl:variable name="title">
+ <xsl:if test="$eclipse.autolabel=1">
+ <xsl:variable name="label.markup">
+ <xsl:apply-templates select="." mode="label.markup"/>
+ </xsl:variable>
+ <xsl:if test="normalize-space($label.markup)">
+ <xsl:value-of select="concat($label.markup,$autotoc.label.separator)"/>
+ </xsl:if>
+ </xsl:if>
+ <xsl:apply-templates select="." mode="title.markup"/>
+ </xsl:variable>
+
+ <xsl:variable name="href">
+ <xsl:call-template name="href.target.with.base.dir"/>
+ </xsl:variable>
+
+ <topic label="{$title}" href="{$href}">
+ <xsl:apply-templates select="part|reference|preface|chapter|bibliography|appendix|article|glossary|section|sect1|sect2|sect3|sect4|sect5|refentry|colophon|bibliodiv|index" mode="etoc"/>
+ </topic>
+
+</xsl:template>
+
+<xsl:template match="text()" mode="etoc"/>
+
+<xsl:template name="plugin.xml">
+ <xsl:call-template name="write.chunk">
+ <xsl:with-param name="filename">
+ <xsl:if test="$manifest.in.base.dir != 0">
+ <xsl:value-of select="$base.dir"/>
+ </xsl:if>
+ <xsl:value-of select="'plugin.xml'"/>
+ </xsl:with-param>
+ <xsl:with-param name="method" select="'xml'"/>
+ <xsl:with-param name="encoding" select="'utf-8'"/>
+ <xsl:with-param name="indent" select="'yes'"/>
+ <xsl:with-param name="content"><plugin>
+ <extension point="org.eclipse.help.toc">
+ <toc file="toc.xml" primary="true"/>
+ </extension>
+</plugin>
+ </xsl:with-param>
+ </xsl:call-template>
+</xsl:template>
+
+<xsl:template name="manifest.mf">
+ <xsl:call-template name="write.chunk">
+ <xsl:with-param name="filename">
+ <xsl:value-of select="'META-INF/MANIFEST.MF'"/>
+ </xsl:with-param>
+ <xsl:with-param name="method" select="'text'"/>
+ <xsl:with-param name="content">Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: <xsl:value-of select="$eclipse.plugin.name"/>
+Bundle-SymbolicName: <xsl:value-of select="$eclipse.plugin.id"/>;singleton:=true
+Bundle-Version: 0.0.0
+Bundle-Vendor: <xsl:value-of select="$eclipse.plugin.provider"/>
+Bundle-Localization: plugin
+Eclipse-LazyStart: true
+</xsl:with-param>
+ </xsl:call-template>
+</xsl:template>
+</xsl:stylesheet>
Added: trunk/org.rubypeople.rdt.doc.user/plugin.properties
===================================================================
--- trunk/org.rubypeople.rdt.doc.user/plugin.properties (rev 0)
+++ trunk/org.rubypeople.rdt.doc.user/plugin.properties 2006-12-27 12:15:37 UTC (rev 1734)
@@ -0,0 +1,7 @@
+#########################################
+# (c) Copyright RubyPeople, Inc. 2006
+# All Rights Reserved.
+#########################################
+
+Plugin.name=Ruby Development Tools User Documentation
+providerName=RubyPeople, Inc.
\ No newline at end of file
Deleted: trunk/org.rubypeople.rdt.doc.user/plugin.xml
===================================================================
--- trunk/org.rubypeople.rdt.doc.user/plugin.xml 2006-12-22 21:38:51 UTC (rev 1733)
+++ trunk/org.rubypeople.rdt.doc.user/plugin.xml 2006-12-27 12:15:37 UTC (rev 1734)
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<plugin>
-
-<!-- ============================================================================= -->
-<!-- Define primary TOC -->
-<!-- ============================================================================= -->
-
- <extension point="org.eclipse.help.toc">
- <toc file="toc.xml" primary="true" />
- </extension>
-
-</plugin>
\ 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...> - 2006-12-22 21:38:52
|
Revision: 1733
http://svn.sourceforge.net/rubyeclipse/?rev=1733&view=rev
Author: cawilliams
Date: 2006-12-22 13:38:51 -0800 (Fri, 22 Dec 2006)
Log Message:
-----------
Modified Paths:
--------------
trunk/org.rubypeople.rdt.astviewer/.classpath
trunk/org.rubypeople.rdt.astviewer/META-INF/MANIFEST.MF
Modified: trunk/org.rubypeople.rdt.astviewer/.classpath
===================================================================
--- trunk/org.rubypeople.rdt.astviewer/.classpath 2006-12-22 19:25:24 UTC (rev 1732)
+++ trunk/org.rubypeople.rdt.astviewer/.classpath 2006-12-22 21:38:51 UTC (rev 1733)
@@ -3,6 +3,5 @@
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="lib" path="/org.jruby/lib/jruby.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Modified: trunk/org.rubypeople.rdt.astviewer/META-INF/MANIFEST.MF
===================================================================
--- trunk/org.rubypeople.rdt.astviewer/META-INF/MANIFEST.MF 2006-12-22 19:25:24 UTC (rev 1732)
+++ trunk/org.rubypeople.rdt.astviewer/META-INF/MANIFEST.MF 2006-12-22 21:38:51 UTC (rev 1733)
@@ -14,7 +14,8 @@
org.rubypeople.rdt.core,
org.eclipse.ui.editors,
org.eclipse.ui.workbench.texteditor,
- org.eclipse.ui.console
+ org.eclipse.ui.console,
+ org.jruby
Eclipse-LazyStart: true
Export-Package: org.rubypeople.rdt.astviewer,
org.rubypeople.rdt.astviewer.views
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2006-12-22 19:25:27
|
Revision: 1732
http://svn.sourceforge.net/rubyeclipse/?rev=1732&view=rev
Author: cawilliams
Date: 2006-12-22 11:25:24 -0800 (Fri, 22 Dec 2006)
Log Message:
-----------
a quick hack to integrate code duplication checking from PMD into our build process. Eventually this will create warnings not spit out the offenders to the command line
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/AbstractRdtCompiler.java
Added Paths:
-----------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/pmd/
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/pmd/CPD.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/pmd/CPDListener.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/pmd/CPDNullListener.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/pmd/FileFinder.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/pmd/Language.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/pmd/Match.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/pmd/MatchAlgorithm.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/pmd/MatchCollector.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/pmd/PMD.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/pmd/RubyLanguage.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/pmd/RubyTokenizer.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/pmd/SourceCode.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/pmd/TokenEntry.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/pmd/Tokenizer.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/pmd/Tokens.java
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/AbstractRdtCompiler.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/AbstractRdtCompiler.java 2006-12-22 19:05:29 UTC (rev 1731)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/AbstractRdtCompiler.java 2006-12-22 19:25:24 UTC (rev 1732)
@@ -1,5 +1,6 @@
package org.rubypeople.rdt.internal.core.builder;
+import java.io.IOException;
import java.util.Iterator;
import java.util.List;
@@ -7,6 +8,10 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.rubypeople.rdt.internal.core.pmd.CPD;
+import org.rubypeople.rdt.internal.core.pmd.Match;
+import org.rubypeople.rdt.internal.core.pmd.PMD;
+import org.rubypeople.rdt.internal.core.pmd.TokenEntry;
import org.rubypeople.rdt.internal.core.symbols.SymbolIndex;
import org.rubypeople.rdt.internal.core.util.ListUtil;
@@ -46,10 +51,36 @@
monitor.worked(fileCount);
flushIndexEntries(symbolIndex);
monitor.worked(fileCount);
+ // FIXME Create warning markers for these duplicate code matches
+ // TODO Refactor out this stuff into a compiler, only visit files we've collected
+ try {
+ Iterator<Match> matches = CPD.findMatches(project);
+ StringBuffer buffer = new StringBuffer();
+ while (matches.hasNext()) {
+ Match match = matches.next();
+ renderOn(buffer, match);
+ }
+ System.out.println(buffer.toString());
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
compileFiles(list, monitor);
monitor.done();
}
+
+ private void renderOn(StringBuffer rpt, Match match) {
+ rpt.append("Found a ").append(match.getLineCount()).append(" line (").append(match.getTokenCount()).append(" tokens) duplication in the following files: ").append(PMD.EOL);
+
+ TokenEntry mark;
+ for (Iterator occurrences = match.iterator(); occurrences.hasNext();) {
+ mark = (TokenEntry) occurrences.next();
+ rpt.append("Starting at line ").append(mark.getBeginLine()).append(" of ").append(mark.getTokenSrcID()).append(PMD.EOL);
+ }
+ rpt.append(PMD.EOL); // add a line to separate the source from the desc above
+ String source = match.getSourceCodeSlice();
+ rpt.append(source).append(PMD.EOL);
+ }
private void compileFiles(List list, IProgressMonitor monitor) throws CoreException {
for (Iterator iter = list.iterator(); iter.hasNext();) {
Added: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/pmd/CPD.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/pmd/CPD.java (rev 0)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/pmd/CPD.java 2006-12-22 19:25:24 UTC (rev 1732)
@@ -0,0 +1,101 @@
+package org.rubypeople.rdt.internal.core.pmd;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.core.resources.IProject;
+
+public class CPD {
+
+ private Map<String, SourceCode> source = new HashMap<String, SourceCode>();
+ private int minimumTileSize;
+ private Language language;
+ private boolean skipDuplicates;
+ private MatchAlgorithm matchAlgorithm;
+ private Tokens tokens = new Tokens();
+ private CPDListener listener = new CPDNullListener();
+ private Set<String> current = new HashSet<String>();
+
+ private CPD(int minimumTileSize, Language language) {
+ this.minimumTileSize = minimumTileSize;
+ this.language = language;
+ }
+
+ public static Iterator<Match> findMatches(IProject project) throws IOException {
+ boolean skipDuplicateFiles = true;
+ int minimumTokens = 5;
+ Language language = new RubyLanguage();
+
+ CPD cpd = new CPD(minimumTokens, language);
+ if (skipDuplicateFiles) {
+ cpd.skipDuplicates();
+ }
+ cpd.addRecursively(project.getLocation().toOSString());
+ cpd.go();
+ return cpd.getMatches();
+ }
+
+ private void go() {
+ TokenEntry.clearImages();
+ matchAlgorithm = new MatchAlgorithm(source, tokens, minimumTileSize, listener);
+ matchAlgorithm.findMatches();
+ }
+
+ private void skipDuplicates() {
+ this.skipDuplicates = true;
+ }
+
+ private Iterator<Match> getMatches() {
+ return matchAlgorithm.matches();
+ }
+
+ private void addRecursively(String dir) throws IOException {
+ addDirectory(dir, true);
+ }
+
+ private void addDirectory(String dir, boolean recurse) throws IOException {
+ if (!(new File(dir)).exists()) {
+ throw new FileNotFoundException("Couldn't find directory " + dir);
+ }
+ FileFinder finder = new FileFinder();
+ // TODO - could use SourceFileSelector here
+ add(finder.findFilesFrom(dir, language.getFileFilter(), recurse));
+ }
+
+ private void add(List files) throws IOException {
+ for (Iterator i = files.iterator(); i.hasNext();) {
+ add(files.size(), (File) i.next());
+ }
+ }
+
+ private void add(int fileCount, File file) throws IOException {
+
+ if (skipDuplicates) {
+ // TODO refactor this thing into a separate class
+ String signature = file.getName() + '_' + file.length();
+ if (current.contains(signature)) {
+ System.out.println("Skipping " + file.getAbsolutePath() + " since it appears to be a duplicate file and --skip-duplicate-files is set");
+ return;
+ }
+ current.add(signature);
+ }
+
+ if (!file.getCanonicalPath().equals(file.getAbsolutePath())) {
+ System.out.println("Skipping " + file + " since it appears to be a symlink");
+ return;
+ }
+
+ listener.addedFile(fileCount, file);
+ SourceCode sourceCode = new SourceCode(new SourceCode.FileCodeLoader(file));
+ language.getTokenizer().tokenize(sourceCode, tokens);
+ source.put(sourceCode.getFileName(), sourceCode);
+ }
+
+}
Added: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/pmd/CPDListener.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/pmd/CPDListener.java (rev 0)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/pmd/CPDListener.java 2006-12-22 19:25:24 UTC (rev 1732)
@@ -0,0 +1,19 @@
+/**
+ * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
+ */
+package org.rubypeople.rdt.internal.core.pmd;
+
+import java.io.File;
+
+public interface CPDListener {
+
+ public static final int INIT = 0;
+ public static final int HASH = 1;
+ public static final int MATCH = 2;
+ public static final int GROUPING = 3;
+ public static final int DONE = 4;
+
+ void addedFile(int fileCount, File file);
+
+ void phaseUpdate(int phase);
+}
Added: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/pmd/CPDNullListener.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/pmd/CPDNullListener.java (rev 0)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/pmd/CPDNullListener.java 2006-12-22 19:25:24 UTC (rev 1732)
@@ -0,0 +1,14 @@
+/**
+ * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
+ */
+package org.rubypeople.rdt.internal.core.pmd;
+
+import java.io.File;
+
+public class CPDNullListener implements CPDListener {
+ public void addedFile(int fileCount, File file) {
+ }
+
+ public void phaseUpdate(int phase) {
+ }
+}
Added: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/pmd/FileFinder.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/pmd/FileFinder.java (rev 0)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/pmd/FileFinder.java 2006-12-22 19:25:24 UTC (rev 1732)
@@ -0,0 +1,42 @@
+/**
+ * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
+ */
+package org.rubypeople.rdt.internal.core.pmd;
+
+import java.io.File;
+import java.io.FilenameFilter;
+import java.util.ArrayList;
+import java.util.List;
+
+public class FileFinder {
+
+ private FilenameFilter filter;
+ private static final String FILE_SEP = System.getProperty("file.separator");
+
+ public List findFilesFrom(String dir, FilenameFilter filter, boolean recurse) {
+ this.filter = filter;
+ List files = new ArrayList();
+ scanDirectory(new File(dir), files, recurse);
+ return files;
+ }
+
+ /**
+ * Implements a tail recursive file scanner
+ */
+ private void scanDirectory(File dir, List list, boolean recurse) {
+ String[] candidates = dir.list(filter);
+ if (candidates == null) {
+ return;
+ }
+ for (int i = 0; i < candidates.length; i++) {
+ File tmp = new File(dir + FILE_SEP + candidates[i]);
+ if (tmp.isDirectory()) {
+ if (recurse) {
+ scanDirectory(tmp, list, true);
+ }
+ } else {
+ list.add(new File(dir + FILE_SEP + candidates[i]));
+ }
+ }
+ }
+}
Added: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/pmd/Language.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/pmd/Language.java (rev 0)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/pmd/Language.java 2006-12-22 19:25:24 UTC (rev 1732)
@@ -0,0 +1,11 @@
+package org.rubypeople.rdt.internal.core.pmd;
+
+import java.io.FilenameFilter;
+
+public interface Language {
+ String fileSeparator = System.getProperty("file.separator");
+
+ public Tokenizer getTokenizer();
+
+ public FilenameFilter getFileFilter();
+}
Added: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/pmd/Match.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/pmd/Match.java (rev 0)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/pmd/Match.java 2006-12-22 19:25:24 UTC (rev 1732)
@@ -0,0 +1,172 @@
+/**
+ * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
+ */
+package org.rubypeople.rdt.internal.core.pmd;
+
+
+import java.util.Comparator;
+import java.util.Iterator;
+import java.util.Set;
+import java.util.TreeSet;
+
+public class Match implements Comparable {
+
+ private int tokenCount;
+ private int lineCount;
+ private Set<TokenEntry> markSet = new TreeSet<TokenEntry>();
+ private TokenEntry[] marks = new TokenEntry[2];
+ private String code;
+ private MatchCode mc;
+ private String label;
+
+ public static final Comparator MatchesComparator = new Comparator() {
+ public int compare(Object a, Object b) {
+ Match ma = (Match)a;
+ Match mb = (Match)b;
+ return mb.getMarkCount() - ma.getMarkCount();
+ }
+ };
+
+ public static final Comparator LinesComparator = new Comparator() {
+ public int compare(Object a, Object b) {
+ Match ma = (Match)a;
+ Match mb = (Match)b;
+
+ return mb.getLineCount() - ma.getLineCount();
+ }
+ };
+
+ public static final Comparator LabelComparator = new Comparator() {
+ public int compare(Object a, Object b) {
+ Match ma = (Match)a;
+ Match mb = (Match)b;
+ if (ma.getLabel() == null) return 1;
+ if (mb.getLabel() == null) return -1;
+ return mb.getLabel().compareTo(ma.getLabel());
+ }
+ };
+
+ public static final Comparator LengthComparator = new Comparator() {
+ public int compare(Object o1, Object o2) {
+ Match m1 = (Match) o1;
+ Match m2 = (Match) o2;
+ return m2.getLineCount() - m1.getLineCount();
+ }
+ };
+
+ public static class MatchCode {
+
+ private int first;
+ private int second;
+
+ public MatchCode() {
+ }
+
+ public MatchCode(TokenEntry m1, TokenEntry m2) {
+ first = m1.getIndex();
+ second = m2.getIndex();
+ }
+
+ public int hashCode() {
+ return first + 37 * second;
+ }
+
+ public boolean equals(Object other) {
+ MatchCode mc = (MatchCode) other;
+ return mc.first == first && mc.second == second;
+ }
+
+ public void setFirst(int first) {
+ this.first = first;
+ }
+
+ public void setSecond(int second) {
+ this.second = second;
+ }
+
+ }
+
+ public Match(int tokenCount, TokenEntry first, TokenEntry second) {
+ markSet.add(first);
+ markSet.add(second);
+ marks[0] = first;
+ marks[1] = second;
+ this.tokenCount = tokenCount;
+ }
+
+ public int getMarkCount() {
+ return markSet.size();
+ }
+
+ public void setLineCount(int lineCount) {
+ this.lineCount = lineCount;
+ }
+
+ public int getLineCount() {
+ return this.lineCount;
+ }
+
+ public int getTokenCount() {
+ return this.tokenCount;
+ }
+
+ public String getSourceCodeSlice() {
+ return this.code;
+ }
+
+ public void setSourceCodeSlice(String code) {
+ this.code = code;
+ }
+
+ public Iterator<TokenEntry> iterator() {
+ return markSet.iterator();
+ }
+
+ public int compareTo(Object o) {
+ Match other = (Match) o;
+ int diff = other.getTokenCount() - getTokenCount();
+ if (diff != 0) {
+ return diff;
+ }
+ return other.getFirstMark().getIndex() - getFirstMark().getIndex();
+ }
+
+ public TokenEntry getFirstMark() {
+ return marks[0];
+ }
+
+ public TokenEntry getSecondMark() {
+ return marks[1];
+ }
+
+ public String toString() {
+ return "Match: " + PMD.EOL + "tokenCount = " + tokenCount + PMD.EOL + "marks = " + markSet.size();
+ }
+
+ public Set<TokenEntry> getMarkSet() {
+ return markSet;
+ }
+
+ public MatchCode getMatchCode() {
+ if (mc == null) {
+ mc = new MatchCode(marks[0], marks[1]);
+ }
+ return mc;
+ }
+
+ public int getEndIndex() {
+ return marks[1].getIndex() + getTokenCount() - 1;
+ }
+
+ public void setMarkSet(Set<TokenEntry> markSet) {
+ this.markSet = markSet;
+ }
+
+ public void setLabel(String aLabel) {
+ label = aLabel;
+ }
+
+ public String getLabel() {
+ return label;
+ }
+}
\ No newline at end of file
Added: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/pmd/MatchAlgorithm.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/pmd/MatchAlgorithm.java (rev 0)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/pmd/MatchAlgorithm.java 2006-12-22 19:25:24 UTC (rev 1732)
@@ -0,0 +1,126 @@
+/**
+ * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
+ */
+package org.rubypeople.rdt.internal.core.pmd;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+public class MatchAlgorithm {
+
+ private final static int MOD = 37;
+ private int lastHash;
+ private int lastMod = 1;
+
+ private List<Match> matches;
+ private Map source;
+ private Tokens tokens;
+ private List code;
+ private CPDListener cpdListener;
+ private int min;
+
+ public MatchAlgorithm(Map sourceCode, Tokens tokens, int min) {
+ this(sourceCode, tokens, min, new CPDNullListener());
+ }
+
+ public MatchAlgorithm(Map sourceCode, Tokens tokens, int min, CPDListener listener) {
+ this.source = sourceCode;
+ this.tokens = tokens;
+ this.code = tokens.getTokens();
+ this.min = min;
+ this.cpdListener = listener;
+ for (int i = 0; i < min; i++) {
+ lastMod *= MOD;
+ }
+ }
+
+ public void setListener(CPDListener listener) {
+ this.cpdListener = listener;
+ }
+
+ public Iterator<Match> matches() {
+ return matches.iterator();
+ }
+
+ public TokenEntry tokenAt(int offset, TokenEntry m) {
+ return (TokenEntry) code.get(offset + m.getIndex());
+ }
+
+ public int getMinimumTileSize() {
+ return this.min;
+ }
+
+ public void findMatches() {
+ cpdListener.phaseUpdate(CPDListener.HASH);
+ Map markGroups = hash();
+
+ cpdListener.phaseUpdate(CPDListener.MATCH);
+ MatchCollector matchCollector = new MatchCollector(this);
+ for (Iterator i = markGroups.values().iterator(); i.hasNext();) {
+ Object o = i.next();
+ if (o instanceof List) {
+ Collections.reverse((List) o);
+ matchCollector.collect((List) o);
+ }
+ i.remove();
+ }
+ cpdListener.phaseUpdate(CPDListener.GROUPING);
+ matches = matchCollector.getMatches();
+ matchCollector = null;
+ for (Iterator<Match> i = matches.iterator(); i.hasNext();) {
+ Match match = (Match) i.next();
+ for (Iterator<TokenEntry> occurrences = match.iterator(); occurrences.hasNext();) {
+ TokenEntry mark = (TokenEntry) occurrences.next();
+ match.setLineCount(tokens.getLineCount(mark, match));
+ if (!occurrences.hasNext()) {
+ int start = mark.getBeginLine();
+ int end = start + match.getLineCount() - 1;
+ SourceCode sourceCode = (SourceCode) source.get(mark.getTokenSrcID());
+ match.setSourceCodeSlice(sourceCode.getSlice(start, end));
+ }
+ }
+ }
+ cpdListener.phaseUpdate(CPDListener.DONE);
+ }
+
+ private Map hash() {
+ Map markGroups = new HashMap(tokens.size());
+ for (int i = code.size() - 1; i >= 0; i--) {
+ TokenEntry token = (TokenEntry) code.get(i);
+ if (token != TokenEntry.EOF) {
+ int last = tokenAt(min, token).getIdentifier();
+ lastHash = MOD * lastHash + token.getIdentifier() - lastMod * last;
+ token.setHashCode(lastHash);
+ Object o = markGroups.get(token);
+
+ // Note that this insertion method is worthwhile since the vast majority
+ // markGroup keys will have only one value.
+ if (o == null) {
+ markGroups.put(token, token);
+ } else if (o instanceof TokenEntry) {
+ List l = new ArrayList();
+ l.add(o);
+ l.add(token);
+ markGroups.put(token, l);
+ } else {
+ List l = (List) o;
+ l.add(token);
+ }
+ } else {
+ lastHash = 0;
+ for (int end = Math.max(0, i - min + 1); i > end; i--) {
+ token = (TokenEntry) code.get(i - 1);
+ lastHash = MOD * lastHash + token.getIdentifier();
+ if (token == TokenEntry.EOF) {
+ break;
+ }
+ }
+ }
+ }
+ return markGroups;
+ }
+}
Added: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/pmd/MatchCollector.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/pmd/MatchCollector.java (rev 0)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/pmd/MatchCollector.java 2006-12-22 19:25:24 UTC (rev 1732)
@@ -0,0 +1,165 @@
+/**
+ * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
+ */
+package org.rubypeople.rdt.internal.core.pmd;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+public class MatchCollector {
+
+ private MatchAlgorithm ma;
+ private Map<Match.MatchCode, Match> startMap = new HashMap<Match.MatchCode, Match>();
+ private Map fileMap = new HashMap();
+
+ public MatchCollector(MatchAlgorithm ma) {
+ this.ma = ma;
+ }
+
+ public void collect(List marks) {
+ //first get a pairwise collection of all maximal matches
+ for (int i = 0; i < marks.size() - 1; i++) {
+ TokenEntry mark1 = (TokenEntry) marks.get(i);
+ for (int j = i + 1; j < marks.size(); j++) {
+ TokenEntry mark2 = (TokenEntry) marks.get(j);
+ int diff = mark1.getIndex() - mark2.getIndex();
+ if (-diff < ma.getMinimumTileSize()) {
+ continue;
+ }
+ if (hasPreviousDupe(mark1, mark2)) {
+ continue;
+ }
+
+ // "match too small" check
+ int dupes = countDuplicateTokens(mark1, mark2);
+ if (dupes < ma.getMinimumTileSize()) {
+ continue;
+ }
+ // is it still too close together
+ if (diff + dupes >= 1) {
+ continue;
+ }
+ determineMatch(mark1, mark2, dupes);
+ }
+ }
+ }
+
+ public List<Match> getMatches() {
+ List<Match> matchList = new ArrayList<Match>(startMap.values());
+ Collections.sort(matchList);
+ Set<Match.MatchCode> matchSet = new HashSet<Match.MatchCode>();
+ Match.MatchCode matchCode = new Match.MatchCode();
+ for (int i = matchList.size(); i > 1; i--) {
+ Match match1 = (Match) matchList.get(i - 1);
+ TokenEntry mark1 = (TokenEntry) match1.getMarkSet().iterator().next();
+ matchSet.clear();
+ matchSet.add(match1.getMatchCode());
+ for (int j = i - 1; j > 0; j--) {
+ Match match2 = (Match) matchList.get(j - 1);
+ if (match1.getTokenCount() != match2.getTokenCount()) {
+ break;
+ }
+ TokenEntry mark2 = null;
+ for (Iterator iter = match2.getMarkSet().iterator(); iter.hasNext();) {
+ mark2 = (TokenEntry) iter.next();
+ if (mark2 != mark1) {
+ break;
+ }
+ }
+ int dupes = countDuplicateTokens(mark1, mark2);
+ if (dupes < match1.getTokenCount()) {
+ break;
+ }
+ matchSet.add(match2.getMatchCode());
+ match1.getMarkSet().addAll(match2.getMarkSet());
+ matchList.remove(i - 2);
+ i--;
+ }
+ if (matchSet.size() == 1) {
+ continue;
+ }
+ //prune the mark set
+ Set pruned = match1.getMarkSet();
+ boolean done = false;
+ ArrayList a1 = new ArrayList(match1.getMarkSet());
+ Collections.sort(a1);
+ for (int outer = 0; outer < a1.size() - 1 && !done; outer++) {
+ TokenEntry cmark1 = (TokenEntry) a1.get(outer);
+ for (int inner = outer + 1; inner < a1.size() && !done; inner++) {
+ TokenEntry cmark2 = (TokenEntry) a1.get(inner);
+ matchCode.setFirst(cmark1.getIndex());
+ matchCode.setSecond(cmark2.getIndex());
+ if (!matchSet.contains(matchCode)) {
+ if (pruned.size() > 2) {
+ pruned.remove(cmark2);
+ }
+ if (pruned.size() == 2) {
+ done = true;
+ }
+ }
+ }
+ }
+ }
+ return matchList;
+ }
+
+ /**
+ * A greedy algorithm for determining non-overlapping matches
+ */
+ private void determineMatch(TokenEntry mark1, TokenEntry mark2, int dupes) {
+ Match match = new Match(dupes, mark1, mark2);
+ String fileKey = mark1.getTokenSrcID() + mark2.getTokenSrcID();
+ List pairMatches = (ArrayList) fileMap.get(fileKey);
+ if (pairMatches == null) {
+ pairMatches = new ArrayList();
+ fileMap.put(fileKey, pairMatches);
+ }
+ boolean add = true;
+ for (int i = 0; i < pairMatches.size(); i++) {
+ Match other = (Match) pairMatches.get(i);
+ if (other.getFirstMark().getIndex() + other.getTokenCount() - mark1.getIndex()
+ > 0) {
+ boolean ordered = other.getSecondMark().getIndex() - mark2.getIndex() < 0;
+ if ((ordered && (other.getEndIndex() - mark2.getIndex() > 0))
+ || (!ordered && (match.getEndIndex() - other.getSecondMark().getIndex()) > 0)) {
+ if (other.getTokenCount() >= match.getTokenCount()) {
+ add = false;
+ break;
+ } else {
+ pairMatches.remove(i);
+ startMap.remove(other.getMatchCode());
+ }
+ }
+ }
+ }
+ if (add) {
+ pairMatches.add(match);
+ startMap.put(match.getMatchCode(), match);
+ }
+ }
+
+ private boolean hasPreviousDupe(TokenEntry mark1, TokenEntry mark2) {
+ if (mark1.getIndex() == 0) {
+ return false;
+ }
+ return !matchEnded(ma.tokenAt(-1, mark1), ma.tokenAt(-1, mark2));
+ }
+
+ private int countDuplicateTokens(TokenEntry mark1, TokenEntry mark2) {
+ int index = 0;
+ while (!matchEnded(ma.tokenAt(index, mark1), ma.tokenAt(index, mark2))) {
+ index++;
+ }
+ return index;
+ }
+
+ private boolean matchEnded(TokenEntry token1, TokenEntry token2) {
+ return token1.getIdentifier() != token2.getIdentifier() || token1 == TokenEntry.EOF || token2 == TokenEntry.EOF;
+ }
+}
\ No newline at end of file
Added: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/pmd/PMD.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/pmd/PMD.java (rev 0)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/pmd/PMD.java 2006-12-22 19:25:24 UTC (rev 1732)
@@ -0,0 +1,5 @@
+package org.rubypeople.rdt.internal.core.pmd;
+
+public interface PMD {
+ public static final String EOL = System.getProperty("line.separator", "\n");
+}
Added: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/pmd/RubyLanguage.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/pmd/RubyLanguage.java (rev 0)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/pmd/RubyLanguage.java 2006-12-22 19:25:24 UTC (rev 1732)
@@ -0,0 +1,23 @@
+package org.rubypeople.rdt.internal.core.pmd;
+
+import java.io.File;
+import java.io.FilenameFilter;
+
+public class RubyLanguage implements Language {
+
+ public static class RubyFileOrDirectoryFilter implements FilenameFilter {
+ public boolean accept(File dir, String filename) {
+ return filename.endsWith("rb") || filename.endsWith("cgi") ||
+ filename.endsWith("class") ||
+ (new File(dir.getAbsolutePath() + fileSeparator + filename).isDirectory());
+ }
+ }
+
+ public Tokenizer getTokenizer() {
+ return new RubyTokenizer();
+ }
+
+ public FilenameFilter getFileFilter() {
+ return new RubyFileOrDirectoryFilter();
+ }
+}
\ No newline at end of file
Added: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/pmd/RubyTokenizer.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/pmd/RubyTokenizer.java (rev 0)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/pmd/RubyTokenizer.java 2006-12-22 19:25:24 UTC (rev 1732)
@@ -0,0 +1,139 @@
+/**
+ * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
+ * @authors: Zev Blut zb...@ub...
+ */
+package org.rubypeople.rdt.internal.core.pmd;
+
+import java.util.List;
+
+public class RubyTokenizer implements Tokenizer {
+ private boolean downcaseString = true;
+
+ public void tokenize(SourceCode tokens, Tokens tokenEntries) {
+ List code = tokens.getCode();
+ for (int i = 0; i < code.size(); i++) {
+ String currentLine = (String) code.get(i);
+ int loc = 0;
+ while (loc < currentLine.length()) {
+ StringBuffer token = new StringBuffer();
+ loc = getTokenFromLine(currentLine, token, loc);
+ if (token.length() > 0 && !isIgnorableString(token.toString())) {
+ if (downcaseString) {
+ token = new StringBuffer(token.toString().toLowerCase());
+ }
+ tokenEntries.add(new TokenEntry(token.toString(),
+ tokens.getFileName(),
+ i + 1));
+ }
+ }
+ }
+ tokenEntries.add(TokenEntry.getEOF());
+ }
+
+ private int getTokenFromLine(String line, StringBuffer token, int loc) {
+ for (int j = loc; j < line.length(); j++) {
+ char tok = line.charAt(j);
+ if (!Character.isWhitespace(tok) && !ignoreCharacter(tok)) {
+ if (isComment(tok)) {
+ if (token.length() > 0) {
+ return j;
+ } else {
+ return getCommentToken(line, token, loc);
+ }
+ } else if (isString(tok)) {
+ if (token.length() > 0) {
+ //if (loc == lin
+ return j; // we need to now parse the string as a seperate token.
+ } else {
+ // we are at the start of a string
+ return parseString(line, token, j, tok);
+ }
+ } else {
+ token.append(tok);
+ }
+ } else {
+ if (token.length() > 0) {
+ return j;
+ }
+ }
+ loc = j;
+ }
+ return loc + 1;
+ }
+
+ private int parseString(String line, StringBuffer token, int loc, char stringType) {
+ boolean escaped = false;
+ boolean done = false;
+ //System.out.println("Parsing String:" + stringType);
+ //System.out.println("Starting loc:" + loc);
+ // problem of strings that span multiple lines :-(
+ char tok = ' '; // this will be replaced.
+ while ((loc < line.length()) && !done) {
+ tok = line.charAt(loc);
+ if (escaped && tok == stringType) {
+ // System.out.println("Found an escaped string");
+ escaped = false;
+ } else if (tok == stringType && (token.length() > 0)) {
+ // we are done
+ // System.out.println("Found an end string");
+ done = true;
+ } else if (tok == '\\') {
+ // System.out.println("Found an escaped char");
+ escaped = true;
+ } else {
+ // System.out.println("Adding char:" + tok + ";loc:" + loc);
+ escaped = false;
+ }
+ //System.out.println("Adding char to String:" + token.toString());
+ token.append(tok);
+ loc++;
+ }
+ return loc + 1;
+ }
+
+ private boolean ignoreCharacter(char tok) {
+ boolean result = false;
+ switch (tok) {
+ case '{':
+ case '}':
+ case '(':
+ case ')':
+ case ';':
+ case ',':
+ result = true;
+ break;
+ default :
+ result = false;
+ }
+ return result;
+ }
+
+ private boolean isString(char tok) {
+ boolean result = false;
+ switch (tok) {
+ case '\'':
+ case '"':
+ result = true;
+ break;
+ default:
+ result = false;
+ }
+ return result;
+ }
+
+ private boolean isComment(char tok) {
+ return tok == '#';
+ }
+
+ private int getCommentToken(String line, StringBuffer token, int loc) {
+ while (loc < line.length()) {
+ token.append(line.charAt(loc));
+ loc++;
+ }
+ return loc;
+ }
+
+ private boolean isIgnorableString(String token) {
+ return "do".equals(token) || "end".equals(token);
+ }
+}
Added: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/pmd/SourceCode.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/pmd/SourceCode.java (rev 0)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/pmd/SourceCode.java 2006-12-22 19:25:24 UTC (rev 1732)
@@ -0,0 +1,135 @@
+/**
+ * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
+ */
+package org.rubypeople.rdt.internal.core.pmd;
+
+import java.io.File;
+import java.io.FileReader;
+import java.io.LineNumberReader;
+import java.io.Reader;
+import java.io.StringReader;
+import java.lang.ref.SoftReference;
+import java.util.ArrayList;
+import java.util.List;
+
+public class SourceCode {
+
+ public static abstract class CodeLoader {
+ private SoftReference code;
+
+ public List getCode() {
+ List c = null;
+ if (code != null) {
+ c = (List) code.get();
+ }
+ if (c != null) {
+ return c;
+ }
+ this.code = new SoftReference(load());
+ return (List) code.get();
+ }
+
+ public abstract String getFileName();
+
+ protected abstract Reader getReader() throws Exception;
+
+ protected List load() {
+ LineNumberReader lnr = null;
+ try {
+ lnr = new LineNumberReader(getReader());
+ List lines = new ArrayList();
+ String currentLine;
+ while ((currentLine = lnr.readLine()) != null) {
+ lines.add(currentLine);
+ }
+ return lines;
+ } catch (Exception e) {
+ throw new RuntimeException("Problem while reading " + getFileName() + ":" + e.getMessage());
+ } finally {
+ try {
+ if (lnr != null)
+ lnr.close();
+ } catch (Exception e) {
+ throw new RuntimeException("Problem while reading " + getFileName() + ":" + e.getMessage());
+ }
+ }
+ }
+ }
+
+ public static class FileCodeLoader extends CodeLoader {
+ private File file;
+
+ public FileCodeLoader(File file) {
+ this.file = file;
+ }
+
+ public Reader getReader() throws Exception {
+ return new FileReader(file);
+ }
+
+ public String getFileName() {
+ return this.file.getAbsolutePath();
+ }
+ }
+
+ public static class StringCodeLoader extends CodeLoader {
+ public static final String DEFAULT_NAME = "CODE_LOADED_FROM_STRING";
+
+ private String source_code;
+
+ private String name;
+
+ public StringCodeLoader(String code) {
+ this(code, DEFAULT_NAME);
+ }
+
+ public StringCodeLoader(String code, String name) {
+ this.source_code = code;
+ this.name = name;
+ }
+
+ public Reader getReader() {
+ return new StringReader(source_code);
+ }
+
+ public String getFileName() {
+ return name;
+ }
+ }
+
+ private CodeLoader cl;
+
+ public SourceCode(CodeLoader cl) {
+ this.cl = cl;
+ }
+
+ public List getCode() {
+ return cl.getCode();
+ }
+
+ public StringBuffer getCodeBuffer() {
+ StringBuffer sb = new StringBuffer();
+ List lines = cl.getCode();
+ for (int i = 0; i < lines.size(); i++) {
+ sb.append((String) lines.get(i));
+ sb.append(PMD.EOL);
+ }
+ return sb;
+ }
+
+ public String getSlice(int startLine, int endLine) {
+ StringBuffer sb = new StringBuffer();
+ List lines = cl.getCode();
+ for (int i = startLine - 1; i < endLine && i < lines.size(); i++) {
+ if (sb.length() != 0) {
+ sb.append(PMD.EOL);
+ }
+ sb.append((String) lines.get(i));
+ }
+ return sb.toString();
+ }
+
+ public String getFileName() {
+ return cl.getFileName();
+ }
+}
\ No newline at end of file
Added: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/pmd/TokenEntry.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/pmd/TokenEntry.java (rev 0)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/pmd/TokenEntry.java 2006-12-22 19:25:24 UTC (rev 1732)
@@ -0,0 +1,85 @@
+/**
+ * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
+ */
+package org.rubypeople.rdt.internal.core.pmd;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class TokenEntry implements Comparable {
+
+ public static final TokenEntry EOF = new TokenEntry();
+
+ private String tokenSrcID;
+ private int beginLine;
+ private int index;
+ private int identifier;
+ private int hashCode;
+
+ private final static Map Tokens = new HashMap();
+ private static int TokenCount = 0;
+
+ private TokenEntry() {
+ this.identifier = 0;
+ this.tokenSrcID = "EOFMarker";
+ }
+
+ public TokenEntry(String image, String tokenSrcID, int beginLine) {
+ Integer i = (Integer) Tokens.get(image);
+ if (i == null) {
+ i = new Integer(Tokens.size() + 1);
+ Tokens.put(image, i);
+ }
+ this.identifier = i.intValue();
+ this.tokenSrcID = tokenSrcID;
+ this.beginLine = beginLine;
+ this.index = TokenCount++;
+ }
+
+ public static TokenEntry getEOF() {
+ TokenCount++;
+ return EOF;
+ }
+
+ public static void clearImages() {
+ Tokens.clear();
+ TokenCount = 0;
+ }
+
+ public String getTokenSrcID() {
+ return tokenSrcID;
+ }
+
+ public int getBeginLine() {
+ return beginLine;
+ }
+
+ public int getIdentifier() {
+ return this.identifier;
+ }
+
+ public int getIndex() {
+ return this.index;
+ }
+
+ public int hashCode() {
+ return hashCode;
+ }
+
+ public void setHashCode(int hashCode) {
+ this.hashCode = hashCode;
+ }
+
+ public boolean equals(Object o) {
+ if (!(o instanceof TokenEntry)) {
+ return false;
+ }
+ TokenEntry other = (TokenEntry) o;
+ return other.hashCode == hashCode;
+ }
+
+ public int compareTo(Object o) {
+ TokenEntry other = (TokenEntry) o;
+ return getIndex() - other.getIndex();
+ }
+}
\ No newline at end of file
Added: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/pmd/Tokenizer.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/pmd/Tokenizer.java (rev 0)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/pmd/Tokenizer.java 2006-12-22 19:25:24 UTC (rev 1732)
@@ -0,0 +1,7 @@
+package org.rubypeople.rdt.internal.core.pmd;
+
+import java.io.IOException;
+
+public interface Tokenizer {
+ void tokenize(SourceCode tokens, Tokens tokenEntries) throws IOException;
+}
Added: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/pmd/Tokens.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/pmd/Tokens.java (rev 0)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/pmd/Tokens.java 2006-12-22 19:25:24 UTC (rev 1732)
@@ -0,0 +1,42 @@
+/**
+ * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
+ */
+package org.rubypeople.rdt.internal.core.pmd;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+public class Tokens {
+
+ private List tokens = new ArrayList();
+
+ public void add(TokenEntry tokenEntry) {
+ this.tokens.add(tokenEntry);
+ }
+
+ public Iterator iterator() {
+ return tokens.iterator();
+ }
+
+ private TokenEntry get(int index) {
+ return (TokenEntry) tokens.get(index);
+ }
+
+ public int size() {
+ return tokens.size();
+ }
+
+ public int getLineCount(TokenEntry mark, Match match) {
+ TokenEntry endTok = get(mark.getIndex() + match.getTokenCount() - 1);
+ if (endTok == TokenEntry.EOF) {
+ endTok = get(mark.getIndex() + match.getTokenCount() - 2);
+ }
+ return endTok.getBeginLine() - mark.getBeginLine() + 1;
+ }
+
+ public List getTokens() {
+ return tokens;
+ }
+
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2006-12-22 19:05:30
|
Revision: 1731
http://svn.sourceforge.net/rubyeclipse/?rev=1731&view=rev
Author: cawilliams
Date: 2006-12-22 11:05:29 -0800 (Fri, 22 Dec 2006)
Log Message:
-----------
add a raw source image for our (potential) new logo
Added Paths:
-----------
trunk/org.rubypeople.rdt/rdt_logo.xcf
Added: trunk/org.rubypeople.rdt/rdt_logo.xcf
===================================================================
(Binary files differ)
Property changes on: trunk/org.rubypeople.rdt/rdt_logo.xcf
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2006-12-22 18:33:42
|
Revision: 1730
http://svn.sourceforge.net/rubyeclipse/?rev=1730&view=rev
Author: cawilliams
Date: 2006-12-22 10:33:41 -0800 (Fri, 22 Dec 2006)
Log Message:
-----------
apply part of murphee's patch - adding an extension point for hyperlinkProviders (they provide IHyperlinks)
Added Paths:
-----------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/hyperlinks/RubyHyperLinkDetector.java
Added: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/hyperlinks/RubyHyperLinkDetector.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/hyperlinks/RubyHyperLinkDetector.java (rev 0)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/hyperlinks/RubyHyperLinkDetector.java 2006-12-22 18:33:41 UTC (rev 1730)
@@ -0,0 +1,131 @@
+package org.rubypeople.rdt.internal.ui.text.hyperlinks;
+
+import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.jface.text.ITextViewer;
+import org.eclipse.jface.text.hyperlink.IHyperlink;
+import org.eclipse.jface.text.hyperlink.IHyperlinkDetector;
+import org.eclipse.ui.IEditorInput;
+import org.jruby.ast.Node;
+import org.rubypeople.rdt.core.IRubyScript;
+import org.rubypeople.rdt.core.RubyModelException;
+import org.rubypeople.rdt.internal.codeassist.SelectionEngine;
+import org.rubypeople.rdt.internal.core.parser.RubyParser;
+import org.rubypeople.rdt.internal.ui.RubyPlugin;
+import org.rubypeople.rdt.ui.IWorkingCopyManager;
+import org.rubypeople.rdt.ui.text.hyperlinks.IHyperlinkProvider;
+
+public class RubyHyperLinkDetector implements IHyperlinkDetector {
+
+ public static final String RDT_UI_NAMESPACE = "org.rubypeople.rdt.ui";
+ public static final String RDT_UI_HYPERLINKPROVIDER = "hyperlinkProvider";
+
+
+ private List fExtensions;
+ private final IEditorInput fEditorInput;
+
+
+ public RubyHyperLinkDetector(IEditorInput editorInput) {
+ this.fEditorInput = editorInput;
+ }
+
+ private List initExtensions() {
+ if(fExtensions == null){
+ fExtensions = new ArrayList();
+ IExtensionRegistry reg = Platform.getExtensionRegistry();
+ IExtensionPoint[] points = reg.getExtensionPoints(RDT_UI_NAMESPACE);
+ // TODO: Look for textProvider!
+ IExtensionPoint point = null;
+
+ if(points != null){
+ for (int i = 0; i < points.length; i++) {
+ IExtensionPoint currentPoint = points[i];
+ String uniqueIdentifier = currentPoint.getUniqueIdentifier();
+ if(uniqueIdentifier.endsWith(RDT_UI_HYPERLINKPROVIDER)){
+ point = currentPoint;
+ break;
+ }
+ }
+
+ if(point != null){
+ IExtension[] exts = point.getExtensions();
+
+ IHyperlinkProvider prov = null;
+
+ for (int i = 0; i < exts.length; i++) {
+ IConfigurationElement[] elem = exts[i].getConfigurationElements();
+ String attrs[] = elem[0].getAttributeNames();
+ try {
+ Object tempProv = elem[0].createExecutableExtension("class");
+ if (tempProv instanceof IHyperlinkProvider) {
+ prov = (IHyperlinkProvider) tempProv;
+ fExtensions.add(prov);
+ }
+// }
+ } catch (Exception e) {
+ RubyPlugin.log(e);
+ }
+
+ }
+ }
+ }
+
+ }
+ return fExtensions;
+
+ }
+
+
+
+ public IHyperlink[] detectHyperlinks(ITextViewer textViewer,
+ IRegion region, boolean canShowMultipleHyperlinks) {
+ String symbol = "";
+ IRegion newRegion = region;
+// newRegion = RubyWordFinder.findWord(textViewer.getDocument(), region.getOffset());
+// try {
+// symbol = textViewer.getDocument().get(newRegion.getOffset(), newRegion.getLength());
+// } catch (BadLocationException e) {
+// // TODO Auto-generated catch block
+// e.printStackTrace();
+// }
+// System.out.println("Symbol:" + symbol);
+// return new IHyperlink[]{new RubyHyperLinkDetector(fEditorInput, newRegion, symbol)};
+
+ List extensions = initExtensions();
+// final String symbol = textViewer.getDocument().get(hoverRegion.getOffset(), hoverRegion.getLength());
+ // first ask the extensions
+ if(extensions.size() > 0){
+ SelectionEngine engine = new SelectionEngine();
+ IWorkingCopyManager manager = RubyPlugin.getDefault().getWorkingCopyManager();
+ IRubyScript script = manager.getWorkingCopy(fEditorInput);
+ RubyParser parser = new RubyParser();
+ try {
+ Node root = parser.parse((IFile) script.getResource(),new StringReader(script.getSource()));
+ // IRubyElement[] elements = engine.select(script, newRegion.getOffset(), newRegion.getOffset() + newRegion.getLength());
+ for(int i=0; i< extensions.size(); i++){
+ IHyperlinkProvider currentProvider = (IHyperlinkProvider) extensions.get(i);
+ IHyperlink link = currentProvider.getHyperlink(fEditorInput, textViewer, root, newRegion, true);
+ // TODO: either do that or query all HyperlinkProviders and return a list of hyperlinks?
+ if(link != null){
+ return new IHyperlink[]{link};
+ }
+ }
+ } catch (RubyModelException e) {
+ RubyPlugin.log(e);
+ }
+ }
+
+ return null;
+
+ }
+
+}
\ 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...> - 2006-12-22 18:32:34
|
Revision: 1729
http://svn.sourceforge.net/rubyeclipse/?rev=1729&view=rev
Author: cawilliams
Date: 2006-12-22 10:32:30 -0800 (Fri, 22 Dec 2006)
Log Message:
-----------
apply part of murphee's patch - adding an extension point for hyperlinkProviders (they provide IHyperlinks)
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui/plugin.properties
trunk/org.rubypeople.rdt.ui/plugin.xml
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/ruby/hover/RiDocHoverProvider.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/ruby/hover/RubyCodeTextHover.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/extensions/ITextHoverProvider.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/text/RubySourceViewerConfiguration.java
Added Paths:
-----------
trunk/org.rubypeople.rdt.ui/schema/hyperlinkProvider.exsd
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/hyperlinks/
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/hyperlinks/RubyElementsHyperlinkProvider.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/text/hyperlinks/IHyperlinkProvider.java
Modified: trunk/org.rubypeople.rdt.ui/plugin.properties
===================================================================
--- trunk/org.rubypeople.rdt.ui/plugin.properties 2006-12-22 18:31:03 UTC (rev 1728)
+++ trunk/org.rubypeople.rdt.ui/plugin.properties 2006-12-22 18:32:30 UTC (rev 1729)
@@ -6,6 +6,8 @@
Plugin.name=Ruby Development Tools UI
providerName=RubyPeople, Inc.
+hyperlinkProvider=Hyperlink provider
+
# Browsing
Browsing.perspectiveName= Ruby Browsing
Browsing.viewCategoryName= Ruby Browsing
Modified: trunk/org.rubypeople.rdt.ui/plugin.xml
===================================================================
--- trunk/org.rubypeople.rdt.ui/plugin.xml 2006-12-22 18:31:03 UTC (rev 1728)
+++ trunk/org.rubypeople.rdt.ui/plugin.xml 2006-12-22 18:32:30 UTC (rev 1729)
@@ -3,6 +3,7 @@
<plugin>
<extension-point id="textHoverProvider" name="%textHoverProvider" schema="schema/textHoverProvider.exsd"/>
+ <extension-point id="hyperlinkProvider" name="%hyperlinkProvider" schema="schema/hyperlinkProvider.exsd"/>
<extension-point id="foldingStructureProviders" name="%foldingStructureProviders" schema="schema/foldingStructureProviders.exsd"/>
<extension-point id="editorPopupExtender" name="%editorPopupExtender" schema="schema/org.rubypeople.rdt.ui.editorPopupExtender.exsd"/>
<extension-point id="rubyTemplateProvider" name="Ruby template provider" schema="schema/rubyTemplateProvider.exsd"/>
Added: trunk/org.rubypeople.rdt.ui/schema/hyperlinkProvider.exsd
===================================================================
--- trunk/org.rubypeople.rdt.ui/schema/hyperlinkProvider.exsd (rev 0)
+++ trunk/org.rubypeople.rdt.ui/schema/hyperlinkProvider.exsd 2006-12-22 18:32:30 UTC (rev 1729)
@@ -0,0 +1,102 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.rubypeople.rdt.ui">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.rubypeople.rdt.ui" id="hyperlinkProvider" name="HyperLink Provider"/>
+ </appInfo>
+ <documentation>
+ Provides the detector and behavior for Code Browsing Hyperlinks.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <complexType>
+ <sequence>
+ <element ref="hyperlinkProvider"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="hyperlinkProvider">
+ <complexType>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+ The class that implements org.rubypeople.rdt.ui.extensions.IHyperlinkProvider.
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn="org.rubypeople.rdt.ui.extensions.IHyperlinkProvider"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </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>
\ No newline at end of file
Added: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/hyperlinks/RubyElementsHyperlinkProvider.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/hyperlinks/RubyElementsHyperlinkProvider.java (rev 0)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/hyperlinks/RubyElementsHyperlinkProvider.java 2006-12-22 18:32:30 UTC (rev 1729)
@@ -0,0 +1,125 @@
+package org.rubypeople.rdt.internal.ui.text.hyperlinks;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.jface.text.ITextViewer;
+import org.eclipse.jface.text.hyperlink.IHyperlink;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IFileEditorInput;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.ide.IDE;
+import org.jruby.ast.Node;
+import org.rubypeople.rdt.core.IMember;
+import org.rubypeople.rdt.core.IRubyElement;
+import org.rubypeople.rdt.core.IRubyScript;
+import org.rubypeople.rdt.core.ISourceRange;
+import org.rubypeople.rdt.core.RubyModelException;
+import org.rubypeople.rdt.internal.codeassist.SelectionEngine;
+import org.rubypeople.rdt.internal.ui.RubyPlugin;
+import org.rubypeople.rdt.internal.ui.text.RubyWordFinder;
+import org.rubypeople.rdt.ui.IWorkingCopyManager;
+import org.rubypeople.rdt.ui.text.hyperlinks.IHyperlinkProvider;
+
+public class RubyElementsHyperlinkProvider implements IHyperlinkProvider {
+
+ public RubyElementsHyperlinkProvider (){}
+
+ class RubyElementsHyperlink implements IHyperlink {
+ private IRegion fRegion;
+ private final IEditorInput fEditorInput;
+ private final IRubyElement[] fElements;
+
+ public RubyElementsHyperlink(IEditorInput editorInput, IRegion region, String symbol, IRubyElement[] elements) {
+ this.fEditorInput = editorInput;
+// fRegion = new Region(region.getOffset(), 5);
+ fRegion = region;
+ this.fElements = elements;
+ }
+
+ public IRegion getHyperlinkRegion() {
+ return fRegion;
+ }
+
+ public String getHyperlinkText() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public String getTypeLabel() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+
+ public void open() {
+ try {
+ // FIXME Check for first element which is an instanceof of IMember, don't just try to access the first element!
+ if(fElements != null && fElements.length > 0){
+ ISourceRange sourceRange = ((IMember) fElements[0]).getSourceRange();
+ IFile file = null;
+ if (fEditorInput instanceof IFileEditorInput) {
+ IFileEditorInput fileInput = (IFileEditorInput) fEditorInput;
+ file = fileInput.getFile();
+ }
+ openFileAndLocation(sourceRange, file);
+ }
+ } catch (PartInitException e) {
+ RubyPlugin.log(e);
+ } catch (RubyModelException e) {
+ RubyPlugin.log(e);
+ } catch (CoreException e) {
+ RubyPlugin.log(e);
+ }
+ }
+
+ private void openFileAndLocation(ISourceRange sourceRange, IFile file)
+ throws PartInitException, CoreException {
+ if (file == null) {
+ return;
+ }
+ if (sourceRange == null) {
+ return;
+ }
+ IEditorPart editorPart = IDE.openEditor(PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow().getActivePage(), file, true);
+
+ IMarker mark = file.createMarker(IMarker.TEXT);
+ mark.setAttribute(IMarker.CHAR_START, sourceRange.getOffset());
+ mark.setAttribute(IMarker.CHAR_END, sourceRange.getOffset()
+ + sourceRange.getLength());
+ IDE.gotoMarker(editorPart, mark);
+ mark.delete();
+ IDE.gotoMarker(editorPart, mark);
+ }
+
+ }
+
+
+ public IHyperlink getHyperlink(IEditorInput input, ITextViewer textViewer, Node node,
+ IRegion region, boolean canShowMultipleHyperlinks) {
+ IRegion newRegion = RubyWordFinder.findWord(textViewer.getDocument(), region.getOffset());
+ try {
+ String symbol = textViewer.getDocument().get(newRegion.getOffset(), newRegion.getLength());
+ // Let's see if this is a RubyElement
+ SelectionEngine engine = new SelectionEngine();
+ IWorkingCopyManager manager = RubyPlugin.getDefault().getWorkingCopyManager();
+ IRubyScript script = manager.getWorkingCopy(input);
+ IRubyElement[] elements = engine.select(script, newRegion.getOffset(), newRegion.getOffset() + newRegion.getLength());
+ if(elements == null){
+ return null;
+ }
+ if(elements.length > 0){
+ // TODO: check if it's a RubyElement, if not, return null
+ return new RubyElementsHyperlink(input, newRegion, symbol, elements);
+ }
+ return null;
+ } catch (Exception e) {
+ RubyPlugin.log(e);
+ }
+ return null;
+ }
+}
\ No newline at end of file
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/ruby/hover/RiDocHoverProvider.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/ruby/hover/RiDocHoverProvider.java 2006-12-22 18:31:03 UTC (rev 1728)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/ruby/hover/RiDocHoverProvider.java 2006-12-22 18:32:30 UTC (rev 1729)
@@ -12,6 +12,7 @@
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.ITextViewer;
+import org.eclipse.ui.IEditorInput;
import org.rubypeople.rdt.internal.launching.RubyRuntime;
import org.rubypeople.rdt.internal.ui.RubyPlugin;
import org.rubypeople.rdt.launching.IInterpreter;
@@ -20,7 +21,7 @@
public class RiDocHoverProvider implements ITextHoverProvider {
- public String getHoverInfo(ITextViewer textViewer, IRegion hoverRegion){
+ public String getHoverInfo(IEditorInput input, ITextViewer textViewer, IRegion hoverRegion){
IPath riPath = new Path( RubyPlugin.getDefault().getPreferenceStore().getString( PreferenceConstants.RI_PATH ) );
List args = new ArrayList();
args.add(0, riPath.toString());
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/ruby/hover/RubyCodeTextHover.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/ruby/hover/RubyCodeTextHover.java 2006-12-22 18:31:03 UTC (rev 1728)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/ruby/hover/RubyCodeTextHover.java 2006-12-22 18:32:30 UTC (rev 1729)
@@ -11,6 +11,7 @@
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.ITextViewer;
+import org.eclipse.ui.texteditor.ITextEditor;
import org.rubypeople.rdt.internal.ui.RubyPlugin;
import org.rubypeople.rdt.ui.extensions.ITextHoverProvider;
@@ -38,7 +39,7 @@
if(extensions.size() > 0){
for(int i=0; i< extensions.size(); i++){
ITextHoverProvider currentProvider = (ITextHoverProvider) extensions.get(i);
- String hoverText = currentProvider.getHoverInfo(textViewer, hoverRegion);
+ String hoverText = currentProvider.getHoverInfo(getEditor().getEditorInput(), textViewer, hoverRegion);
if(hoverText != null){
return hoverText;
}
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/extensions/ITextHoverProvider.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/extensions/ITextHoverProvider.java 2006-12-22 18:31:03 UTC (rev 1728)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/extensions/ITextHoverProvider.java 2006-12-22 18:32:30 UTC (rev 1729)
@@ -2,6 +2,8 @@
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.ITextViewer;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
/**
@@ -13,9 +15,10 @@
public interface ITextHoverProvider {
/**
*
+ * @param input
* @param textViewer the ITextViewer that shows this hover
* @param hoverRegion the region that was preselected by the Ruby Hover system
* @return the hover text OR null if no text was found
*/
- public String getHoverInfo(ITextViewer textViewer, IRegion hoverRegion);
+ public String getHoverInfo(IEditorInput input, ITextViewer textViewer, IRegion hoverRegion);
}
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/text/RubySourceViewerConfiguration.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/text/RubySourceViewerConfiguration.java 2006-12-22 18:31:03 UTC (rev 1728)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/text/RubySourceViewerConfiguration.java 2006-12-22 18:32:30 UTC (rev 1729)
@@ -55,6 +55,7 @@
import org.rubypeople.rdt.internal.ui.text.RubyReconciler;
import org.rubypeople.rdt.internal.ui.text.comment.CommentFormattingStrategy;
import org.rubypeople.rdt.internal.ui.text.comment.RubyCommentAutoIndentStrategy;
+import org.rubypeople.rdt.internal.ui.text.hyperlinks.RubyHyperLinkDetector;
import org.rubypeople.rdt.internal.ui.text.ruby.AbstractRubyScanner;
import org.rubypeople.rdt.internal.ui.text.ruby.RubyCodeScanner;
import org.rubypeople.rdt.internal.ui.text.ruby.RubyCompletionProcessor;
@@ -62,7 +63,6 @@
import org.rubypeople.rdt.internal.ui.text.ruby.RubyReconcilingStrategy;
import org.rubypeople.rdt.internal.ui.text.ruby.SingleTokenRubyCodeScanner;
import org.rubypeople.rdt.internal.ui.text.ruby.hover.RubyCodeTextHover;
-import org.rubypeople.rdt.ui.text.hyperlinks.RubyHyperLinkDetector;
public class RubySourceViewerConfiguration extends
TextSourceViewerConfiguration {
@@ -540,6 +540,7 @@
String contentType) {
if (fRubyTextHover == null) {
fRubyTextHover = new RubyCodeTextHover();
+ fRubyTextHover.setEditor(getEditor());
}
return fRubyTextHover;
}
Added: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/text/hyperlinks/IHyperlinkProvider.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/text/hyperlinks/IHyperlinkProvider.java (rev 0)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/text/hyperlinks/IHyperlinkProvider.java 2006-12-22 18:32:30 UTC (rev 1729)
@@ -0,0 +1,11 @@
+package org.rubypeople.rdt.ui.text.hyperlinks;
+
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.jface.text.ITextViewer;
+import org.eclipse.jface.text.hyperlink.IHyperlink;
+import org.eclipse.ui.IEditorInput;
+import org.jruby.ast.Node;
+
+public interface IHyperlinkProvider {
+ public IHyperlink getHyperlink(IEditorInput input,ITextViewer textViewer, Node node, IRegion region, boolean canShowMultipleHyperlinks);
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2006-12-22 18:31:06
|
Revision: 1728
http://svn.sourceforge.net/rubyeclipse/?rev=1728&view=rev
Author: cawilliams
Date: 2006-12-22 10:31:03 -0800 (Fri, 22 Dec 2006)
Log Message:
-----------
apply part of murphee's patch - adding an extension point for hyperlinkProviders (they provide IHyperlinks)
Removed Paths:
-------------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/text/hyperlinks/RubyHyperLinkDetector.java
Deleted: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/text/hyperlinks/RubyHyperLinkDetector.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/text/hyperlinks/RubyHyperLinkDetector.java 2006-12-21 21:43:43 UTC (rev 1727)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/text/hyperlinks/RubyHyperLinkDetector.java 2006-12-22 18:31:03 UTC (rev 1728)
@@ -1,111 +0,0 @@
-package org.rubypeople.rdt.ui.text.hyperlinks;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.jface.text.hyperlink.IHyperlink;
-import org.eclipse.jface.text.hyperlink.IHyperlinkDetector;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.ide.IDE;
-import org.rubypeople.rdt.core.IMember;
-import org.rubypeople.rdt.core.IRubyElement;
-import org.rubypeople.rdt.core.IRubyScript;
-import org.rubypeople.rdt.core.ISourceRange;
-import org.rubypeople.rdt.core.RubyModelException;
-import org.rubypeople.rdt.internal.codeassist.SelectionEngine;
-import org.rubypeople.rdt.internal.ui.RubyPlugin;
-import org.rubypeople.rdt.internal.ui.text.RubyWordFinder;
-import org.rubypeople.rdt.ui.IWorkingCopyManager;
-
-public class RubyHyperLinkDetector implements IHyperlinkDetector {
-
- private final IEditorInput fEditorInput;
-
- public class RubyHyperlink implements IHyperlink {
-
- private IRegion fRegion;
- private final IEditorInput fEditorInput;
-
- public RubyHyperlink(IEditorInput editorInput, IRegion region) {
- this.fEditorInput = editorInput;
- fRegion = region;
- }
-
- public IRegion getHyperlinkRegion() {
- return fRegion;
- }
-
- public String getHyperlinkText() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public String getTypeLabel() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public void open() {
- try {
- SelectionEngine engine = new SelectionEngine();
- IWorkingCopyManager manager = RubyPlugin.getDefault().getWorkingCopyManager();
- IRubyScript script = manager.getWorkingCopy(fEditorInput);
- IRubyElement[] elements = engine.select(script, fRegion.getOffset(), fRegion.getOffset() + fRegion.getLength());
- // FIXME Check for first element which is an instanceof of IMember, don't just try to access the first element!
- ISourceRange sourceRange = ((IMember) elements[0]).getSourceRange();
- IFile file = null;
- if (fEditorInput instanceof IFileEditorInput) {
- IFileEditorInput fileInput = (IFileEditorInput) fEditorInput;
- file = fileInput.getFile();
- }
- openFileAndLocation(sourceRange, file);
- } catch (PartInitException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (RubyModelException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (CoreException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- private void openFileAndLocation(ISourceRange sourceRange, IFile file)
- throws PartInitException, CoreException {
- if (file == null) return;
- if (sourceRange == null) return;
- IEditorPart editorPart = IDE.openEditor(PlatformUI.getWorkbench()
- .getActiveWorkbenchWindow().getActivePage(), file, true);
-
- IMarker mark = file.createMarker(IMarker.TEXT);
- mark.setAttribute(IMarker.CHAR_START, sourceRange.getOffset());
- mark.setAttribute(IMarker.CHAR_END, sourceRange.getOffset()
- + sourceRange.getLength());
- IDE.gotoMarker(editorPart, mark);
- mark.delete();
- IDE.gotoMarker(editorPart, mark);
- }
-
- }
-
- public RubyHyperLinkDetector(IEditorInput editorInput) {
- this.fEditorInput = editorInput;
-
- }
-
- public IHyperlink[] detectHyperlinks(ITextViewer textViewer,
- IRegion region, boolean canShowMultipleHyperlinks) {
- IRegion newRegion = region;
- newRegion = RubyWordFinder.findWord(textViewer.getDocument(), region
- .getOffset());
- return new IHyperlink[] { new RubyHyperlink(fEditorInput, newRegion) };
- }
-
-}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2006-12-21 21:43:45
|
Revision: 1727
http://svn.sourceforge.net/rubyeclipse/?rev=1727&view=rev
Author: cawilliams
Date: 2006-12-21 13:43:43 -0800 (Thu, 21 Dec 2006)
Log Message:
-----------
have our translatable string bundle stuff use NLS class (much easier to use in our code)
Modified Paths:
--------------
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/DebuggerRunner.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RdtLaunchingMessages.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RdtLaunchingMessages.properties
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RdtLaunchingPlugin.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RubyApplicationLaunchConfigurationDelegate.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RubyInterpreter.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/rdocexport/RDocUtility.java
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/DebuggerRunner.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/DebuggerRunner.java 2006-12-21 21:43:13 UTC (rev 1726)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/DebuggerRunner.java 2006-12-21 21:43:43 UTC (rev 1727)
@@ -33,8 +33,7 @@
IStatus.ERROR,
RdtLaunchingPlugin.PLUGIN_ID,
IStatus.ERROR,
- RdtLaunchingMessages
- .getString("RdtLaunchingPlugin.processTerminatedBecauseNoDebuggerConnection"),
+ RdtLaunchingMessages.RdtLaunchingPlugin_processTerminatedBecauseNoDebuggerConnection,
null));
debugTarget.terminate();
}
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RdtLaunchingMessages.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RdtLaunchingMessages.java 2006-12-21 21:43:13 UTC (rev 1726)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RdtLaunchingMessages.java 2006-12-21 21:43:43 UTC (rev 1727)
@@ -1,21 +1,20 @@
package org.rubypeople.rdt.internal.launching;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
+import org.eclipse.osgi.util.NLS;
public class RdtLaunchingMessages {
- private static final String BUNDLE_NAME = "org.rubypeople.rdt.internal.launching.RdtLaunchingMessages"; //$NON-NLS-1$
+ private static final String BUNDLE_NAME = RdtLaunchingMessages.class.getName();
- private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME);
-
+ public static String RdtLaunchingPlugin_processTerminatedBecauseNoDebuggerConnection;
+ public static String RdtLaunchingPlugin_internalErrorOccurred;
+ public static String RdtLaunchingPlugin_noInterpreterSelected;
+ public static String RdtLaunchingPlugin_interpreterNotFound;
+ public static String RdtLaunchingPlugin_noInterpreterSelectedTitle;
+
private RdtLaunchingMessages() {}
- public static String getString(String key) {
- try {
- return RESOURCE_BUNDLE.getString(key);
- } catch (MissingResourceException e) {
- return '!' + key + '!';
- }
+ static {
+ NLS.initializeMessages(BUNDLE_NAME, RdtLaunchingMessages.class);
}
}
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RdtLaunchingMessages.properties
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RdtLaunchingMessages.properties 2006-12-21 21:43:13 UTC (rev 1726)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RdtLaunchingMessages.properties 2006-12-21 21:43:43 UTC (rev 1727)
@@ -7,8 +7,8 @@
# RdtLaunchingPlugin
#########################################
-RdtLaunchingPlugin.internalErrorOccurred=Internal error occurred
-RdtLaunchingPlugin.processTerminatedBecauseNoDebuggerConnection=Ruby process terminated because no connection to the debugger could me made
-RdtLaunchingPlugin.interpreterNotFound=Please check the location of the following interpreter: {0}
-RdtLaunchingPlugin.noInterpreterSelectedTitle=No interpreter selected
-RdtLaunchingPlugin.noInterpreterSelected=There is currently no ruby interpreter defined. Use preferences to define and select the active interpreter.
\ No newline at end of file
+RdtLaunchingPlugin_internalErrorOccurred=Internal error occurred
+RdtLaunchingPlugin_processTerminatedBecauseNoDebuggerConnection=Ruby process terminated because no connection to the debugger could me made
+RdtLaunchingPlugin_interpreterNotFound=Please check the location of the following interpreter: {0}
+RdtLaunchingPlugin_noInterpreterSelectedTitle=No interpreter selected
+RdtLaunchingPlugin_noInterpreterSelected=There is currently no ruby interpreter defined. Use preferences to define and select the active interpreter.
\ No newline at end of file
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RdtLaunchingPlugin.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RdtLaunchingPlugin.java 2006-12-21 21:43:13 UTC (rev 1726)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RdtLaunchingPlugin.java 2006-12-21 21:43:43 UTC (rev 1727)
@@ -41,7 +41,7 @@
}
public static void log(Throwable e) {
- log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.ERROR, RdtLaunchingMessages.getString("RdtLaunchingPlugin.internalErrorOccurred"), e)); //$NON-NLS-1$
+ log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.ERROR, RdtLaunchingMessages.RdtLaunchingPlugin_internalErrorOccurred, e));
}
public static void debug(String message) {
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RubyApplicationLaunchConfigurationDelegate.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RubyApplicationLaunchConfigurationDelegate.java 2006-12-21 21:43:13 UTC (rev 1726)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RubyApplicationLaunchConfigurationDelegate.java 2006-12-21 21:43:43 UTC (rev 1727)
@@ -21,7 +21,7 @@
*/
public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException {
if (RubyRuntime.getDefault().getSelectedInterpreter() == null) {
- throw new CoreException(new Status(IStatus.ERROR, RdtLaunchingPlugin.PLUGIN_ID, IStatus.OK, RdtLaunchingMessages.getString("RdtLaunchingPlugin.noInterpreterSelected"), null));
+ throw new CoreException(new Status(IStatus.ERROR, RdtLaunchingPlugin.PLUGIN_ID, IStatus.OK, RdtLaunchingMessages.RdtLaunchingPlugin_noInterpreterSelected, null));
}
if (mode.equals("debug")) {
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RubyInterpreter.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RubyInterpreter.java 2006-12-21 21:43:13 UTC (rev 1726)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RubyInterpreter.java 2006-12-21 21:43:43 UTC (rev 1727)
@@ -62,7 +62,7 @@
if( new File(installLocation.toOSString()).isFile() ){
return installLocation.toOSString();
}
- String errorMessage = MessageFormat.format(RdtLaunchingMessages.getString("RdtLaunchingPlugin.interpreterNotFound"), new Object[] {this.getName()}) ;
+ String errorMessage = MessageFormat.format(RdtLaunchingMessages.RdtLaunchingPlugin_interpreterNotFound, new Object[] {this.getName()}) ;
throw new IllegalCommandException(errorMessage) ;
}
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/rdocexport/RDocUtility.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/rdocexport/RDocUtility.java 2006-12-21 21:43:13 UTC (rev 1726)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/rdocexport/RDocUtility.java 2006-12-21 21:43:43 UTC (rev 1727)
@@ -85,10 +85,9 @@
public final void invoke() {
log("Generating RDoc for " + resource.getName());
- RdtLaunchingMessages.getString("RdtLaunchingPlugin.noInterpreterSelected");
IInterpreter interpreter = RubyRuntime.getDefault().getSelectedInterpreter();
if (interpreter == null) {
- MessageDialog.openInformation(RubyPlugin.getActiveWorkbenchShell(), RdtLaunchingMessages.getString("RdtLaunchingPlugin.noInterpreterSelectedTitle"), RdtLaunchingMessages.getString("RdtLaunchingPlugin.noInterpreterSelected"));
+ MessageDialog.openInformation(RubyPlugin.getActiveWorkbenchShell(), RdtLaunchingMessages.RdtLaunchingPlugin_noInterpreterSelectedTitle, RdtLaunchingMessages.RdtLaunchingPlugin_noInterpreterSelected);
return ;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2006-12-21 21:43:14
|
Revision: 1726
http://svn.sourceforge.net/rubyeclipse/?rev=1726&view=rev
Author: cawilliams
Date: 2006-12-21 13:43:13 -0800 (Thu, 21 Dec 2006)
Log Message:
-----------
oops a mispelling referring to contentTypeViewerId ("rubypeoplee.rdt...")
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui/plugin.xml
Modified: trunk/org.rubypeople.rdt.ui/plugin.xml
===================================================================
--- trunk/org.rubypeople.rdt.ui/plugin.xml 2006-12-21 20:37:33 UTC (rev 1725)
+++ trunk/org.rubypeople.rdt.ui/plugin.xml 2006-12-21 21:43:13 UTC (rev 1726)
@@ -926,7 +926,7 @@
</viewer>
<contentTypeBinding
contentTypeId="org.rubypeople.rdt.core.rubySource"
- contentViewerId="org.rubypeoplee.rdt.internal.ui.compare.RubyTextViewerCreator">
+ contentViewerId="org.rubypeople.rdt.internal.ui.compare.RubyTextViewerCreator">
</contentTypeBinding>
</extension>
<extension
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2006-12-21 20:37:34
|
Revision: 1725
http://svn.sourceforge.net/rubyeclipse/?rev=1725&view=rev
Author: cawilliams
Date: 2006-12-21 12:37:33 -0800 (Thu, 21 Dec 2006)
Log Message:
-----------
don't try to replace the plugin version (we were inadvertantly messing up the xml declaration line). We need to look into changing the rewriting of plugin.xml (we shouldn't do it at all as part of our build process)
Modified Paths:
--------------
trunk/org.rubypeople.rdt.doc.user/buildDocbook.xml
Modified: trunk/org.rubypeople.rdt.doc.user/buildDocbook.xml
===================================================================
--- trunk/org.rubypeople.rdt.doc.user/buildDocbook.xml 2006-12-21 20:36:23 UTC (rev 1724)
+++ trunk/org.rubypeople.rdt.doc.user/buildDocbook.xml 2006-12-21 20:37:33 UTC (rev 1725)
@@ -40,12 +40,6 @@
</replace>
</target>
- <target name="replaceVersionInPluginXml">
- <replace file="plugin.xml">
- <replacefilter token="1.0" value="${featureVersion}"/>
- </replace>
- </target>
-
<target name="html" depends="init,clean.docbook.generated,replaceVarInCustomizationLayer">
<!-- docbook recommends to use the saxon comiler. With jdk1.4 we could also use xalan (which ships with jdk1.4)
but with the jdk1.5 built-in XSLTC we get errors related to chunks.
@@ -63,11 +57,10 @@
<param name="eclipse.plugin.id" expression="org.rubypeople.rdt.doc.user"/>
<param name="eclipse.plugin.name" expression="Ruby Development Documentation"/>
<param name="eclipse.plugin.provider" expression="RubyPeople, Inc."/>
- <xmlcatalog id="docbook.catalog">
+ <xmlcatalog id="docbook.catalog">
<dtd publicId="-//OASIS//DTD DocBook V3.1//EN" location="${docbook.dtd.dir}/docbookx.dtd"/>
</xmlcatalog>
</style>
- <antcall target="replaceVersionInPluginXml"/>
</target>
<target name="clean">
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2006-12-21 20:36:24
|
Revision: 1724
http://svn.sourceforge.net/rubyeclipse/?rev=1724&view=rev
Author: cawilliams
Date: 2006-12-21 12:36:23 -0800 (Thu, 21 Dec 2006)
Log Message:
-----------
Modified Paths:
--------------
trunk/org.rubypeople.rdt.doc.user/META-INF/MANIFEST.MF
Modified: trunk/org.rubypeople.rdt.doc.user/META-INF/MANIFEST.MF
===================================================================
--- trunk/org.rubypeople.rdt.doc.user/META-INF/MANIFEST.MF 2006-12-21 20:36:17 UTC (rev 1723)
+++ trunk/org.rubypeople.rdt.doc.user/META-INF/MANIFEST.MF 2006-12-21 20:36:23 UTC (rev 1724)
@@ -3,5 +3,6 @@
Bundle-Name: %Plugin.name
Bundle-SymbolicName: org.rubypeople.rdt.doc.user;singleton:=true
Bundle-Version: 0.0.0
-Bundle-Vendor: RubyPeople, Inc.
+Bundle-Vendor: %providerName
Bundle-Localization: plugin
+Eclipse-LazyStart: true
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2006-12-21 20:36:18
|
Revision: 1723
http://svn.sourceforge.net/rubyeclipse/?rev=1723&view=rev
Author: cawilliams
Date: 2006-12-21 12:36:17 -0800 (Thu, 21 Dec 2006)
Log Message:
-----------
include the manifest in the jar/zips
Modified Paths:
--------------
trunk/org.rubypeople.rdt.doc.user/build.xml
Modified: trunk/org.rubypeople.rdt.doc.user/build.xml
===================================================================
--- trunk/org.rubypeople.rdt.doc.user/build.xml 2006-12-21 19:32:55 UTC (rev 1722)
+++ trunk/org.rubypeople.rdt.doc.user/build.xml 2006-12-21 20:36:17 UTC (rev 1723)
@@ -54,7 +54,7 @@
<target name="gather.bin.parts" depends="init" if="destination.temp.folder">
<mkdir dir="${destination.temp.folder}/org.rubypeople.rdt.doc.user_${featureVersion}"/>
<copy todir="${destination.temp.folder}/org.rubypeople.rdt.doc.user_${featureVersion}" failonerror="true">
- <fileset dir="${basedir}" includes="plugin.xml,toc.xml,html/,images/" excludes="build.xml" />
+ <fileset dir="${basedir}" includes="plugin.xml,toc.xml,html/,images/,META-INF/" excludes="build.xml" />
</copy>
</target>
@@ -63,7 +63,7 @@
<target name="gather.sources" depends="init" if="destination.temp.folder">
<copy todir="${destination.temp.folder}/org.rubypeople.rdt.doc.user_${featureVersion}" failonerror="false">
- <fileset dir="${basedir}" includes="docbook.xml,plugin.xml" />
+ <fileset dir="${basedir}" includes="docbook.xml,plugin.xml,META-INF/"/>
</copy>
</target>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|