|
From: <mir...@us...> - 2007-03-21 13:44:07
|
Revision: 2202
http://svn.sourceforge.net/rubyeclipse/?rev=2202&view=rev
Author: mirkostocker
Date: 2007-03-21 06:44:04 -0700 (Wed, 21 Mar 2007)
Log Message:
-----------
fix the new test case wizard and validate the classname
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/CreateMethodOperation.java
trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/testunit/wizards/RubyNewTestCaseWizardPage.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/wizards/NewClassWizardPage.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/wizards/NewTypeWizardPage.java
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/CreateMethodOperation.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/CreateMethodOperation.java 2007-03-19 13:08:24 UTC (rev 2201)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/CreateMethodOperation.java 2007-03-21 13:44:04 UTC (rev 2202)
@@ -7,6 +7,7 @@
import org.jruby.ast.DefsNode;
import org.jruby.ast.NewlineNode;
import org.jruby.ast.Node;
+import org.jruby.ast.RootNode;
import org.rubypeople.rdt.core.IRubyElement;
import org.rubypeople.rdt.core.IRubyModelStatus;
import org.rubypeople.rdt.core.IRubyModelStatusConstants;
@@ -224,8 +225,7 @@
private Node generateElementAST(IDocument document, IRubyScript cu) {
RubyParser parser = new RubyParser();
Node root = parser.parse(this.source);
- NewlineNode newline = (NewlineNode) root;
- this.createdNode = newline.getNextNode(); // Grab node from our parsed source!
+ this.createdNode = ((NewlineNode) ((RootNode) root).getBodyNode()).getNextNode(); // Grab node from our parsed source!
return this.createdNode;
}
Modified: trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/testunit/wizards/RubyNewTestCaseWizardPage.java
===================================================================
--- trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/testunit/wizards/RubyNewTestCaseWizardPage.java 2007-03-19 13:08:24 UTC (rev 2201)
+++ trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/testunit/wizards/RubyNewTestCaseWizardPage.java 2007-03-21 13:44:04 UTC (rev 2202)
@@ -22,7 +22,6 @@
import org.eclipse.swt.widgets.Text;
import org.rubypeople.rdt.core.IRubyElement;
import org.rubypeople.rdt.core.IRubyProject;
-import org.rubypeople.rdt.core.IRubyScript;
import org.rubypeople.rdt.core.ISourceFolderRoot;
import org.rubypeople.rdt.core.IType;
import org.rubypeople.rdt.core.RubyConventions;
@@ -281,6 +280,7 @@
fClassUnderTestStatus= classUnderTestChanged();
handleFieldChanged(CLASS_UNDER_TEST);
}
+
/**
* Hook method that gets called when the class under test has changed. The method class under test
@@ -359,19 +359,19 @@
// TODO Uncomment to set up type page
// initTypePage(element);
// put default class to test
- if (element != null) {
- IType classToTest= null;
+// if (element != null) {
+// IType classToTest= null;
// evaluate the enclosing type
- IType typeInCompUnit= (IType) element.getAncestor(IRubyElement.TYPE);
- if (typeInCompUnit != null) {
- if (typeInCompUnit.getRubyScript() != null) {
- classToTest= typeInCompUnit;
- }
- } else {
- IRubyScript cu= (IRubyScript) element.getAncestor(IRubyElement.SCRIPT);
- if (cu != null)
- classToTest= cu.findPrimaryType();
- }
+// IType typeInCompUnit= (IType) element.getAncestor(IRubyElement.TYPE);
+// if (typeInCompUnit != null) {
+// if (typeInCompUnit.getRubyScript() != null) {
+// classToTest= typeInCompUnit;
+// }
+// } else {
+// IRubyScript cu= (IRubyScript) element.getAncestor(IRubyElement.SCRIPT);
+// if (cu != null)
+// classToTest= cu.findPrimaryType();
+// }
// TODO uncomment to set class under test
// if (classToTest != null) {
// try {
@@ -382,7 +382,7 @@
// TestunitPlugin.log(e);
// }
// }
- }
+// }
restoreWidgetValues();
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/wizards/NewClassWizardPage.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/wizards/NewClassWizardPage.java 2007-03-19 13:08:24 UTC (rev 2201)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/wizards/NewClassWizardPage.java 2007-03-21 13:44:04 UTC (rev 2202)
@@ -12,7 +12,6 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.viewers.IStructuredSelection;
@@ -91,31 +90,7 @@
setMethodStubSelection(createConstructors, true);
}
- // ------ validation --------
- private void doStatusUpdate() {
- // status of all used components
- IStatus[] status= new IStatus[] {
- fContainerStatus,
- fTypeNameStatus,
- fSuperClassStatus,
- fSuperInterfacesStatus
- };
-
- // the mode severe status will be displayed and the OK button enabled/disabled.
- updateStatus(status);
- }
-
- /*
- * @see NewContainerWizardPage#handleFieldChanged
- */
- protected void handleFieldChanged(String fieldName) {
- super.handleFieldChanged(fieldName);
-
- doStatusUpdate();
- }
-
-
// ------ UI --------
/*
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/wizards/NewTypeWizardPage.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/wizards/NewTypeWizardPage.java 2007-03-19 13:08:24 UTC (rev 2201)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/wizards/NewTypeWizardPage.java 2007-03-21 13:44:04 UTC (rev 2202)
@@ -794,6 +794,31 @@
return status;
}
+
+ // ------ validation --------
+ protected void doStatusUpdate() {
+ // status of all used components
+ IStatus[] status= new IStatus[] {
+ fContainerStatus,
+ fTypeNameStatus,
+ fSuperClassStatus,
+ fSuperInterfacesStatus
+ };
+
+ // the mode severe status will be displayed and the OK button enabled/disabled.
+ updateStatus(status);
+ }
+
+
+ /*
+ * @see NewContainerWizardPage#handleFieldChanged
+ */
+ protected void handleFieldChanged(String fieldName) {
+ super.handleFieldChanged(fieldName);
+
+ doStatusUpdate();
+ }
+
/**
* Initializes all fields provided by the page with a given selection.
*
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|