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-08-08 06:36:56
|
Revision: 1552 Author: mbarchfe Date: 2006-08-07 23:36:30 -0700 (Mon, 07 Aug 2006) ViewCVS: http://svn.sourceforge.net/rubyeclipse/?rev=1552&view=rev Log Message: ----------- designker patch: Restored Welcome page, moved cheatsheet actions from rdt.debug.ui to rdt Modified Paths: -------------- trunk/org.rubypeople.rdt/.classpath trunk/org.rubypeople.rdt/build.properties trunk/org.rubypeople.rdt/intro/css/rdt.properties trunk/org.rubypeople.rdt/intro/rdtNewsExtensionContent.xml trunk/org.rubypeople.rdt/intro/rdtOverviewExtensionContent.xml trunk/org.rubypeople.rdt/intro/rdtTutorialsExtensionContent.xml trunk/org.rubypeople.rdt/plugin.properties trunk/org.rubypeople.rdt/plugin.xml trunk/org.rubypeople.rdt.debug.ui/cheatsheets/WebServices.xml Added Paths: ----------- trunk/org.rubypeople.rdt/META-INF/ trunk/org.rubypeople.rdt/META-INF/MANIFEST.MF trunk/org.rubypeople.rdt/src/ trunk/org.rubypeople.rdt/src/org/ trunk/org.rubypeople.rdt/src/org/rubypeople/ trunk/org.rubypeople.rdt/src/org/rubypeople/rdt/ trunk/org.rubypeople.rdt/src/org/rubypeople/rdt/internal/ trunk/org.rubypeople.rdt/src/org/rubypeople/rdt/internal/cheatsheets/ trunk/org.rubypeople.rdt/src/org/rubypeople/rdt/internal/cheatsheets/RdtPlugin.java trunk/org.rubypeople.rdt/src/org/rubypeople/rdt/internal/cheatsheets/webservice/ trunk/org.rubypeople.rdt/src/org/rubypeople/rdt/internal/cheatsheets/webservice/CopyContentAction.java trunk/org.rubypeople.rdt/src/org/rubypeople/rdt/internal/cheatsheets/webservice/CreateWsdlFileAction.java trunk/org.rubypeople.rdt/src/org/rubypeople/rdt/internal/cheatsheets/webservice/OpenNewRubyProjectWizardAction.java trunk/org.rubypeople.rdt/src/org/rubypeople/rdt/internal/cheatsheets/webservice/OpenRunConfigurationAction.java Modified: trunk/org.rubypeople.rdt/.classpath =================================================================== --- trunk/org.rubypeople.rdt/.classpath 2006-07-31 20:22:07 UTC (rev 1551) +++ trunk/org.rubypeople.rdt/.classpath 2006-08-08 06:36:30 UTC (rev 1552) @@ -1,5 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> + <classpathentry kind="src" path="src"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="output" path="bin"/> Added: trunk/org.rubypeople.rdt/META-INF/MANIFEST.MF =================================================================== --- trunk/org.rubypeople.rdt/META-INF/MANIFEST.MF (rev 0) +++ trunk/org.rubypeople.rdt/META-INF/MANIFEST.MF 2006-08-08 06:36:30 UTC (rev 1552) @@ -0,0 +1,20 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: %pluginName +Bundle-SymbolicName: org.rubypeople.rdt;singleton:=true +Bundle-Version: 0.0.0 +Bundle-Localization: plugin +Require-Bundle: org.eclipse.core.resources, + org.eclipse.debug.ui, + org.rubypeople.rdt.ui, + org.rubypeople.rdt.core, + org.rubypeople.rdt.debug.core, + org.eclipse.ui.ide, + org.eclipse.ui.cheatsheets, + org.eclipse.core.runtime, + org.rubypeople.rdt.debug.ui, + org.eclipse.jface, + org.eclipse.ui.workbench +Eclipse-LazyStart: true +Bundle-Activator: org.rubypeople.rdt.internal.cheatsheets.RdtPlugin +Bundle-Vendor: %providerName Modified: trunk/org.rubypeople.rdt/build.properties =================================================================== --- trunk/org.rubypeople.rdt/build.properties 2006-07-31 20:22:07 UTC (rev 1551) +++ trunk/org.rubypeople.rdt/build.properties 2006-08-08 06:36:30 UTC (rev 1552) @@ -8,4 +8,6 @@ ruby.png,\ intro/,\ rdt.license,\ - Changelog.txt + Changelog.txt,\ + cheatsheets/,\ + META-INF/ Modified: trunk/org.rubypeople.rdt/intro/css/rdt.properties =================================================================== --- trunk/org.rubypeople.rdt/intro/css/rdt.properties 2006-07-31 20:22:07 UTC (rev 1551) +++ trunk/org.rubypeople.rdt/intro/css/rdt.properties 2006-08-08 06:36:30 UTC (rev 1552) @@ -1,8 +1,11 @@ # this is the configuration for swt based presentation of the # intro pages, like it is used for os=linux and ws=motif -overview.page-content.overview-links.rdt.link-icon = intro/css/graphics/rdt_overview.gif +overview.rdt.link-icon = intro/css/graphics/rdt_overview.gif +tutorials.rdt-introduction.link-icon = intro/css/graphics/rdt_tutorial.gif +tutorials.rdt-introduction.hover-icon = intro/css/graphics/rdt_tutorialhov.gif + tutorials.page-content.rdt.layout.ncolumns = 1 tutorials.page-content.rdt.rdt-introduction.link-icon = intro/css/graphics/rdt_tutorial.gif Modified: trunk/org.rubypeople.rdt/intro/rdtNewsExtensionContent.xml =================================================================== --- trunk/org.rubypeople.rdt/intro/rdtNewsExtensionContent.xml 2006-07-31 20:22:07 UTC (rev 1551) +++ trunk/org.rubypeople.rdt/intro/rdtNewsExtensionContent.xml 2006-08-08 06:36:30 UTC (rev 1552) @@ -1,9 +1,11 @@ <?xml version="1.0" encoding="UTF-8" ?> <introContent> - <!-- Extension to the SDK What's New Page. --> - <extensionContent alt-style="css/rdt.properties" path="news/page-content/noteworthy-links/generalAnchor"> - <link label="Ruby Development Tools" url="http://org.eclipse.ui.intro/showHelpTopic?id=/org.rubypeople.rdt.doc.user/html/ch04.html" id="rdt-noteworthy" style-id="noteworthy-link"> - <text>News about RDT for this release</text> - </link> - </extensionContent> + <!-- Extension to the SDK What's New Page. --> + <extensionContent id="org.eclipse.rdt.news" name="Ruby Development Tools" path="whatsnew/@"> + <group style-id="content-group" id="content-group"> + <link label="Ruby Development Tools" url="http://org.eclipse.ui.intro/showHelpTopic?id=/org.rubypeople.rdt.doc.user/html/ch03.html" id="rdt-noteworthy" style-id="content-link"> + <text>News about RDT for this release</text> + </link> + </group> + </extensionContent> </introContent> \ No newline at end of file Modified: trunk/org.rubypeople.rdt/intro/rdtOverviewExtensionContent.xml =================================================================== --- trunk/org.rubypeople.rdt/intro/rdtOverviewExtensionContent.xml 2006-07-31 20:22:07 UTC (rev 1551) +++ trunk/org.rubypeople.rdt/intro/rdtOverviewExtensionContent.xml 2006-08-08 06:36:30 UTC (rev 1552) @@ -1,9 +1,11 @@ -<?xml version="1.0" encoding="UTF-8" ?> +<?xml version="1.0" encoding="utf-8" ?> <introContent> - <!-- Extension to the SDK Overview Page. --> - <extensionContent alt-style="css/rdt.properties" style="css/rdtOverview.css" path="overview/page-content/overview-links/endAnchor"> - <link label="Ruby Development Tools" url="http://org.eclipse.ui.intro/showHelpTopic?id=/org.rubypeople.rdt.doc.user/html/index.html" id="rdt"> - <text>Overview of the Ruby Development Tools (RDT)</text> - </link> - </extensionContent> + <!-- Extension to the SDK Overview Page. --> + <extensionContent id="org.eclipse.rdt.overview" alt-style="css/rdt.properties" style="css/rdtOverview.css" name="Ruby Development" path="overview/@"> + <group style-id="content-group" id="content-group"> + <link label="Ruby Development" url="http://org.eclipse.ui.intro/showHelpTopic?id=/org.rubypeople.rdt.doc.user/html/index.html" id="ruby" style-id="content-link"> + <text>Get familiar with developing Ruby programs Using Eclipse</text> + </link> + </group> + </extensionContent> </introContent> \ No newline at end of file Modified: trunk/org.rubypeople.rdt/intro/rdtTutorialsExtensionContent.xml =================================================================== --- trunk/org.rubypeople.rdt/intro/rdtTutorialsExtensionContent.xml 2006-07-31 20:22:07 UTC (rev 1551) +++ trunk/org.rubypeople.rdt/intro/rdtTutorialsExtensionContent.xml 2006-08-08 06:36:30 UTC (rev 1552) @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> <introContent> <!-- Extension to the SDK Tutorials Page. --> - <extensionContent alt-style="css/rdt.properties" style="css/rdtTutorials.css" path="tutorials/page-content/endAnchor"> - <group label="Ruby Development Tools" id="rdt" style-id="tutorials-group"> - <link url="http://org.eclipse.ui.intro/showStandby?partId=org.eclipse.platform.cheatsheet&input=org.rubypeople.rdt.cheatsheets.webservices" label="Introduction to RDT" id="rdt-introduction" style-id="tutorials-link"> - <text>Learn how to create ruby projects and how to run and debug ruby programs using soap4r as example</text> + <extensionContent id="org.eclipse.rdt.tutorials" alt-style="css/rdt.properties" style="css/rdtTutorials.css" name="Ruby Development" path="tutorials/@"> + <group style-id="content-group" id="ruby-introduction-group"> + <link url="http://org.eclipse.ui.intro/showStandby?partId=org.eclipse.platform.cheatsheet&input=org.rubypeople.rdt.cheatsheets.webservices" label="Introduction to RDT" id="ruby-introduction" style-id="content-link"> + <text>Learn how to create ruby projects and how to run and debug ruby programs using soap4r as an example</text> </link> </group> </extensionContent> Modified: trunk/org.rubypeople.rdt/plugin.properties =================================================================== --- trunk/org.rubypeople.rdt/plugin.properties 2006-07-31 20:22:07 UTC (rev 1551) +++ trunk/org.rubypeople.rdt/plugin.properties 2006-08-08 06:36:30 UTC (rev 1552) @@ -1,2 +1,6 @@ pluginName=Ruby Development Tools -providerName=RubyPeople, Inc. \ No newline at end of file +providerName=RubyPeople, Inc. + +cheatsheet.category.rdt = Ruby Development +cheatsheet.webservices.name=RDT Introduction +cheatsheet.webservices.desc=Ruby Development Tools (RDT) Introduction Modified: trunk/org.rubypeople.rdt/plugin.xml =================================================================== --- trunk/org.rubypeople.rdt/plugin.xml 2006-07-31 20:22:07 UTC (rev 1551) +++ trunk/org.rubypeople.rdt/plugin.xml 2006-08-08 06:36:30 UTC (rev 1552) @@ -1,25 +1,35 @@ <?xml version="1.0" encoding="UTF-8"?> -<?eclipse version="3.0"?> -<plugin - id="org.rubypeople.rdt" - name="%pluginName" - version="0.0.0" - provider-name="%providerName"> - <requires> - <import plugin="org.eclipse.ui.intro"/> - </requires> +<?eclipse version="3.2"?> +<plugin> + <extension point="org.eclipse.ui.intro.configExtension"> <configExtension + content="intro/rdtOverviewExtensionContent.xml" + configId="org.eclipse.ui.intro.universalConfig"/> + <configExtension content="intro/rdtTutorialsExtensionContent.xml" - configId="org.eclipse.platform.introConfig"/> + configId="org.eclipse.ui.intro.universalConfig"/> <configExtension - content="intro/rdtOverviewExtensionContent.xml" - configId="org.eclipse.platform.introConfig"/> - <configExtension content="intro/rdtNewsExtensionContent.xml" - configId="org.eclipse.platform.introConfig"/> + configId="org.eclipse.ui.intro.universalConfig"/> </extension> + <extension + point="org.eclipse.ui.cheatsheets.cheatSheetContent"> + <category + id="org.rubypeople.rdt.cheatsheet.category" + name="%cheatsheet.category.rdt"/> + <cheatsheet + category="org.rubypeople.rdt.cheatsheet.category" + composite="false" + contentFile="$nl$/cheatsheets/WebServices.xml" + id="org.rubypeople.rdt.cheatsheets.webservices" + name="%cheatsheet.webservices.name"> + <description> + %cheatsheet.webservices.desc + </description> + </cheatsheet> + </extension> </plugin> Added: trunk/org.rubypeople.rdt/src/org/rubypeople/rdt/internal/cheatsheets/RdtPlugin.java =================================================================== --- trunk/org.rubypeople.rdt/src/org/rubypeople/rdt/internal/cheatsheets/RdtPlugin.java (rev 0) +++ trunk/org.rubypeople.rdt/src/org/rubypeople/rdt/internal/cheatsheets/RdtPlugin.java 2006-08-08 06:36:30 UTC (rev 1552) @@ -0,0 +1,20 @@ +package org.rubypeople.rdt.internal.cheatsheets; + +import org.eclipse.ui.plugin.AbstractUIPlugin; + + +public class RdtPlugin extends AbstractUIPlugin { + + public static final String PLUGIN_ID = "org.rubypeople.rdt"; //$NON-NLS-1$ + protected static RdtPlugin plugin; + + public RdtPlugin() { + super(); + plugin = this; + } + + public static RdtPlugin getDefault() { + return plugin; + } +} + Added: trunk/org.rubypeople.rdt/src/org/rubypeople/rdt/internal/cheatsheets/webservice/CopyContentAction.java =================================================================== --- trunk/org.rubypeople.rdt/src/org/rubypeople/rdt/internal/cheatsheets/webservice/CopyContentAction.java (rev 0) +++ trunk/org.rubypeople.rdt/src/org/rubypeople/rdt/internal/cheatsheets/webservice/CopyContentAction.java 2006-08-08 06:36:30 UTC (rev 1552) @@ -0,0 +1,43 @@ +package org.rubypeople.rdt.internal.cheatsheets.webservice; + +import java.io.File; +import java.io.FileInputStream; +import java.io.InputStream; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.runtime.Path; +import org.eclipse.jface.action.Action; +import org.eclipse.ui.cheatsheets.ICheatSheetAction; +import org.eclipse.ui.cheatsheets.ICheatSheetManager; +import org.rubypeople.rdt.core.RubyCore; +import org.rubypeople.rdt.internal.cheatsheets.RdtPlugin; +import org.rubypeople.rdt.internal.ui.RubyPlugin; + + +public class CopyContentAction extends Action implements ICheatSheetAction { + + /* (non-Javadoc) + * @see org.eclipse.ui.cheatsheets.ICheatSheetAction#run(java.lang.String[], org.eclipse.ui.cheatsheets.ICheatSheetManager) + */ + public void run(String[] params, ICheatSheetManager manager) { + File sourceFile = new File(RubyCore.getOSDirectory(RdtPlugin.getDefault()) + params[0]); + if (!sourceFile.exists()) { + this.notifyResult(false); + return; + } + + IFile dest = RubyPlugin.getWorkspace().getRoot().getFile(new Path(params[1])); + if (dest == null || !dest.exists()) { + this.notifyResult(false); + return; + } + try { + InputStream inputStream = new FileInputStream(sourceFile); + dest.setContents(inputStream, true, true, null); + this.notifyResult(true); + } catch (Exception e) { + this.notifyResult(false); + } + } + +} Added: trunk/org.rubypeople.rdt/src/org/rubypeople/rdt/internal/cheatsheets/webservice/CreateWsdlFileAction.java =================================================================== --- trunk/org.rubypeople.rdt/src/org/rubypeople/rdt/internal/cheatsheets/webservice/CreateWsdlFileAction.java (rev 0) +++ trunk/org.rubypeople.rdt/src/org/rubypeople/rdt/internal/cheatsheets/webservice/CreateWsdlFileAction.java 2006-08-08 06:36:30 UTC (rev 1552) @@ -0,0 +1,38 @@ +package org.rubypeople.rdt.internal.cheatsheets.webservice; + +import org.eclipse.core.resources.IProject; +import org.eclipse.jface.action.Action; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.wizard.WizardDialog; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.cheatsheets.ICheatSheetAction; +import org.eclipse.ui.cheatsheets.ICheatSheetManager; +import org.eclipse.ui.wizards.newresource.BasicNewFileResourceWizard; +import org.rubypeople.rdt.internal.ui.RubyPlugin; + + +public class CreateWsdlFileAction extends Action implements ICheatSheetAction { + + + public void run(String[] params, ICheatSheetManager manager) { + + BasicNewFileResourceWizard wizard = new BasicNewFileResourceWizard(); + + + String projectName = params.length > 0 ? params[0] : "Unbekannt" ; + IProject project = RubyPlugin.getWorkspace().getRoot().getProject(projectName) ; + + if (project == null) { + // show error dialog + return ; + } + + wizard.init(PlatformUI.getWorkbench(), new StructuredSelection(project)); + WizardDialog dialog = new WizardDialog(RubyPlugin.getActiveWorkbenchShell(), wizard); + dialog.create(); + dialog.getShell().setText(wizard.getWindowTitle()); + int result = dialog.open(); + notifyResult(result==WizardDialog.OK); + } + +} Added: trunk/org.rubypeople.rdt/src/org/rubypeople/rdt/internal/cheatsheets/webservice/OpenNewRubyProjectWizardAction.java =================================================================== --- trunk/org.rubypeople.rdt/src/org/rubypeople/rdt/internal/cheatsheets/webservice/OpenNewRubyProjectWizardAction.java (rev 0) +++ trunk/org.rubypeople.rdt/src/org/rubypeople/rdt/internal/cheatsheets/webservice/OpenNewRubyProjectWizardAction.java 2006-08-08 06:36:30 UTC (rev 1552) @@ -0,0 +1,45 @@ +package org.rubypeople.rdt.internal.cheatsheets.webservice; + +import org.eclipse.jface.action.Action; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.wizard.WizardDialog; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.cheatsheets.ICheatSheetAction; +import org.eclipse.ui.cheatsheets.ICheatSheetManager; +import org.rubypeople.rdt.internal.ui.RubyPlugin; +import org.rubypeople.rdt.internal.ui.wizards.NewProjectCreationWizard; + + +/** + * @author markus + * + */ +public class OpenNewRubyProjectWizardAction extends Action implements ICheatSheetAction { + public OpenNewRubyProjectWizardAction() { + super("OpenProject"); //$NON-NLS-1$ + } + + /** + * @see IActionDelegate#run(IAction) + */ + public void run() { + run(new String [] {}, null); + } + + /* (non-Javadoc) + * @see org.eclipse.ui.cheatsheets.ICheatSheetAction#run(java.lang.String[], org.eclipse.ui.cheatsheets.ICheatSheetManager) + */ + public void run(String[] params, ICheatSheetManager manager) { + NewProjectCreationWizard wizard = new NewProjectCreationWizard(); + if (params.length > 0) { + wizard.setDefaultProjectName(params[0]) ; + } + wizard.init(PlatformUI.getWorkbench(), new StructuredSelection()); + WizardDialog dialog = new WizardDialog(RubyPlugin.getActiveWorkbenchShell(), wizard); + dialog.create(); + //SWTUtil.setDialogSize(dialog, 500, 500); + dialog.getShell().setText(wizard.getWindowTitle()); + int result = dialog.open(); + notifyResult(result==WizardDialog.OK); + } +} Added: trunk/org.rubypeople.rdt/src/org/rubypeople/rdt/internal/cheatsheets/webservice/OpenRunConfigurationAction.java =================================================================== --- trunk/org.rubypeople.rdt/src/org/rubypeople/rdt/internal/cheatsheets/webservice/OpenRunConfigurationAction.java (rev 0) +++ trunk/org.rubypeople.rdt/src/org/rubypeople/rdt/internal/cheatsheets/webservice/OpenRunConfigurationAction.java 2006-08-08 06:36:30 UTC (rev 1552) @@ -0,0 +1,23 @@ +package org.rubypeople.rdt.internal.cheatsheets.webservice; + +import org.eclipse.debug.internal.ui.DebugUIPlugin; +import org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationsDialog; +import org.eclipse.debug.ui.IDebugUIConstants; +import org.eclipse.jface.action.Action; +import org.eclipse.ui.cheatsheets.ICheatSheetAction; +import org.eclipse.ui.cheatsheets.ICheatSheetManager; + + +public class OpenRunConfigurationAction extends Action implements ICheatSheetAction { + + /* (non-Javadoc) + * @see org.eclipse.ui.cheatsheets.ICheatSheetAction#run(java.lang.String[], org.eclipse.ui.cheatsheets.ICheatSheetManager) + */ + public void run(String[] params, ICheatSheetManager manager) { + LaunchConfigurationsDialog dialog = new LaunchConfigurationsDialog(DebugUIPlugin.getShell(), DebugUIPlugin.getDefault().getLaunchConfigurationManager().getDefaultLanuchGroup(IDebugUIConstants.ID_RUN_LAUNCH_GROUP)); + dialog.setOpenMode(LaunchConfigurationsDialog.LAUNCH_CONFIGURATION_DIALOG_OPEN_ON_LAST_LAUNCHED); + dialog.open(); + + } + +} Modified: trunk/org.rubypeople.rdt.debug.ui/cheatsheets/WebServices.xml =================================================================== --- trunk/org.rubypeople.rdt.debug.ui/cheatsheets/WebServices.xml 2006-07-31 20:22:07 UTC (rev 1551) +++ trunk/org.rubypeople.rdt.debug.ui/cheatsheets/WebServices.xml 2006-08-08 06:36:30 UTC (rev 1552) @@ -15,16 +15,18 @@ Click on the help button if you don't know how to do that. </description> </item> <item title="Switch to Ruby Perspective"> + <!-- Fix missing class <action pluginId="org.rubypeople.rdt.debug.ui" - class="org.rubypeople.rdt.internal.debug.ui.cheatsheets.webservice.OpenRubyPerspectiveAction"/> + class="org.rubypeople.rdt.internal.cheatsheets.webservice.OpenRubyPerspectiveAction"/> +--> <description> Use the "Click to Perform" button to open the ruby perspective. This can also be done manually by choosing "Window->Open Perspective->Other..." from the main menu and selecting "Ruby" from the dialog which opens. </description> </item> <item title="Create Ruby project on soap4r"> - <action pluginId="org.rubypeople.rdt.debug.ui" param1="soap4r" - class="org.rubypeople.rdt.internal.debug.ui.cheatsheets.webservice.OpenNewRubyProjectWizardAction"/> + <action pluginId="org.rubypeople.rdt" param1="soap4r" + class="org.rubypeople.rdt.internal.cheatsheets.webservice.OpenNewRubyProjectWizardAction"/> <description> In order to run wsdl2ruby.rb from the soap4r package, you create a ruby project called soap4r on top of the soap4r installation directory at first. After clicking the "Click to Perform" button below, the "New @@ -34,8 +36,8 @@ unzipped the soap4r tar ball. </description> </item> <item title="Create MyWebservice project"> - <action pluginId="org.rubypeople.rdt.debug.ui" param1="MyWebservice" - class="org.rubypeople.rdt.internal.debug.ui.cheatsheets.webservice.OpenNewRubyProjectWizardAction"/> + <action pluginId="org.rubypeople.rdt" param1="MyWebservice" + class="org.rubypeople.rdt.internal.cheatsheets.webservice.OpenNewRubyProjectWizardAction"/> <description> In this step you create a new project within your workspace, which will be used to hold the wsdl file and the generated code from this file. The project is called @@ -45,8 +47,8 @@ subdirectory into your workspace location. </description> </item> <item title="Add wsdl file to MyWebservice"> - <action pluginId="org.rubypeople.rdt.debug.ui" param1="MyWebservice" - class="org.rubypeople.rdt.internal.debug.ui.cheatsheets.webservice.CreateWsdlFileAction"/> + <action pluginId="org.rubypeople.rdt" param1="MyWebservice" + class="org.rubypeople.rdt.internal.cheatsheets.webservice.CreateWsdlFileAction"/> <description> Add a new file called sample.wsdl to the MyWebservice project. In the dialog which "Click to Perform" brings up you only have to enter the file name @@ -54,9 +56,9 @@ container of this new resource. </description> </item> <item title="Add content to sample.wsdl"> - <action pluginId="org.rubypeople.rdt.debug.ui" + <action pluginId="org.rubypeople.rdt" param1="/cheatsheets/Sample.wsdl" param2="/MyWebservice/sample.wsdl" - class="org.rubypeople.rdt.internal.debug.ui.cheatsheets.webservice.CopyContentAction"/> + class="org.rubypeople.rdt.internal.cheatsheets.webservice.CopyContentAction"/> <description> In the last step you have created the file "sample.wsdl". But why is it not there? It is, but is filtered out: In the Ruby Resources views menu deselect @@ -73,8 +75,8 @@ process. There you find the required command line options. </description> </item> <item title="Modify the run configuration for server generation"> - <action pluginId="org.rubypeople.rdt.debug.ui" - class="org.rubypeople.rdt.internal.debug.ui.cheatsheets.webservice.OpenRunConfigurationAction"/> + <action pluginId="org.rubypeople.rdt" + class="org.rubypeople.rdt.internal.cheatsheets.webservice.OpenRunConfigurationAction"/> <description> "Click to Perform" opens the run configuration dialog, which is also available as Run As->Run... from the main menu. The running of wsdl2ruby.rb in the last step has created a run-configuration named @@ -98,8 +100,8 @@ </description> </item> <item title="Create Run-Configuration for client generation"> - <action pluginId="org.rubypeople.rdt.debug.ui" - class="org.rubypeople.rdt.internal.debug.ui.cheatsheets.webservice.OpenRunConfigurationAction"/> + <action pluginId="org.rubypeople.rdt" + class="org.rubypeople.rdt.internal.cheatsheets.webservice.OpenRunConfigurationAction"/> <description> "Click to Perform" opens the run configuration dialog again. Perform "Duplicate" from the context menu of the wsdl-gen-server run configuration. A duplicate "wsdl-gen-server @@ -138,8 +140,8 @@ from the toolbar or ctrl+s.</description> </item> <item title="Run the client"> - <action pluginId="org.rubypeople.rdt.debug.ui" - class="org.rubypeople.rdt.internal.debug.ui.cheatsheets.webservice.OpenRunConfigurationAction"/> + <action pluginId="org.rubypeople.rdt" + class="org.rubypeople.rdt.internal.cheatsheets.webservice.OpenRunConfigurationAction"/> <description> Use the "Click to perform" button or select "Run->Run..." from the main menu to open the run configuration dialog. Select "Ruby Application" and click "New". This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <mir...@us...> - 2006-07-31 20:22:19
|
Revision: 1551 Author: mirkostocker Date: 2006-07-31 13:22:07 -0700 (Mon, 31 Jul 2006) ViewCVS: http://svn.sourceforge.net/rubyeclipse/?rev=1551&view=rev Log Message: ----------- added some preferences for the astviewer plugin and refactored some of the existing code Modified Paths: -------------- trunk/org.rubypeople.rdt.astviewer/plugin.xml trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/views/AstView.java trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/views/ViewContentProvider.java Added Paths: ----------- trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/preferences/ trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/preferences/AstViewerPreferencePage.java trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/preferences/PreferenceConstants.java trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/preferences/PreferenceInitializer.java Modified: trunk/org.rubypeople.rdt.astviewer/plugin.xml =================================================================== --- trunk/org.rubypeople.rdt.astviewer/plugin.xml 2006-07-27 22:46:52 UTC (rev 1550) +++ trunk/org.rubypeople.rdt.astviewer/plugin.xml 2006-07-31 20:22:07 UTC (rev 1551) @@ -28,5 +28,15 @@ </view> </perspectiveExtension> </extension> + <extension point="org.eclipse.ui.preferencePages"> + <page class="org.rubypeople.rdt.astviewer.preferences.AstViewerPreferencePage" + id="org.rubypeople.rdt.astviewer.preferences.AstViewerPreferencePage" + name="AST View"/> + </extension> + <extension point="org.eclipse.core.runtime.preferences"> + <initializer class="org.rubypeople.rdt.astviewer.preferences.PreferenceInitializer"/> + </extension> + <extension point="org.eclipse.ui.preferencePages"> + </extension> </plugin> Added: trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/preferences/AstViewerPreferencePage.java =================================================================== --- trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/preferences/AstViewerPreferencePage.java (rev 0) +++ trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/preferences/AstViewerPreferencePage.java 2006-07-31 20:22:07 UTC (rev 1551) @@ -0,0 +1,34 @@ +package org.rubypeople.rdt.astviewer.preferences; + +import org.eclipse.jface.preference.*; +import org.eclipse.ui.IWorkbenchPreferencePage; +import org.eclipse.ui.IWorkbench; +import org.rubypeople.rdt.astviewer.Activator; + +public class AstViewerPreferencePage + extends FieldEditorPreferencePage + implements IWorkbenchPreferencePage { + + public AstViewerPreferencePage() { + super(GRID); + setPreferenceStore(Activator.getDefault().getPreferenceStore()); + setDescription("Select the nodes you want to see in the tree:"); + } + + public void createFieldEditors() { + + addField( new BooleanFieldEditor( + PreferenceConstants.P_SHOW_NEWLINE, + "show &NewlineNodes", + getFieldEditorParent())); + + addField( new BooleanFieldEditor( + PreferenceConstants.P_SHOW_SCOPE, + "show &ScopeNodes", + getFieldEditorParent())); + } + + public void init(IWorkbench workbench) { + } + +} \ No newline at end of file Added: trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/preferences/PreferenceConstants.java =================================================================== --- trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/preferences/PreferenceConstants.java (rev 0) +++ trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/preferences/PreferenceConstants.java 2006-07-31 20:22:07 UTC (rev 1551) @@ -0,0 +1,11 @@ +package org.rubypeople.rdt.astviewer.preferences; + +/** + * Constant definitions for plug-in preferences + */ +public class PreferenceConstants { + + public static final String P_SHOW_NEWLINE = "showNewline"; + public static final String P_SHOW_SCOPE = "showScope"; + +} Added: trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/preferences/PreferenceInitializer.java =================================================================== --- trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/preferences/PreferenceInitializer.java (rev 0) +++ trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/preferences/PreferenceInitializer.java 2006-07-31 20:22:07 UTC (rev 1551) @@ -0,0 +1,18 @@ +package org.rubypeople.rdt.astviewer.preferences; + +import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; +import org.eclipse.jface.preference.IPreferenceStore; + +import org.rubypeople.rdt.astviewer.Activator; + +/** + * Class used to initialize default preference values. + */ +public class PreferenceInitializer extends AbstractPreferenceInitializer { + + public void initializeDefaultPreferences() { + IPreferenceStore store = Activator.getDefault().getPreferenceStore(); + store.setDefault(PreferenceConstants.P_SHOW_NEWLINE, true); + store.setDefault(PreferenceConstants.P_SHOW_SCOPE, true); + } +} Modified: trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/views/AstView.java =================================================================== --- trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/views/AstView.java 2006-07-27 22:46:52 UTC (rev 1550) +++ trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/views/AstView.java 2006-07-31 20:22:07 UTC (rev 1551) @@ -28,18 +28,12 @@ package org.rubypeople.rdt.astviewer.views; -import java.io.InputStream; -import java.net.URL; - -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Platform; import org.eclipse.jface.action.Action; import org.eclipse.jface.action.IMenuListener; import org.eclipse.jface.action.IMenuManager; import org.eclipse.jface.action.IToolBarManager; import org.eclipse.jface.action.MenuManager; import org.eclipse.jface.action.Separator; -import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.jface.text.Document; import org.eclipse.jface.text.source.SourceViewer; import org.eclipse.jface.viewers.DoubleClickEvent; @@ -49,7 +43,6 @@ import org.eclipse.jface.viewers.TreeViewer; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.SashForm; -import org.eclipse.swt.graphics.ImageData; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; @@ -61,6 +54,7 @@ import org.eclipse.ui.part.DrillDownAdapter; import org.eclipse.ui.part.ViewPart; import org.jruby.ast.Node; +import org.rubypeople.rdt.astviewer.Activator; import org.rubypeople.rdt.internal.ui.rubyeditor.RubyEditor; public class AstView extends ViewPart { @@ -72,9 +66,6 @@ private ViewContentProvider viewContentProvider; private SashForm sashForm; private SourceViewer detailsViewer; - - public static final String PLUGIN_ID = "org.rubypeople.rdt.astviewer"; - public static final String ICON_PATH = "icons/"; public void createPartControl(Composite parent) { sashForm = new SashForm(parent, SWT.NONE); @@ -186,13 +177,9 @@ refreshAction.setText("Refresh the AST View"); refreshAction.setToolTipText("Performs a complete refresh over the whole AST."); - refreshAction.setImageDescriptor(ImageDescriptor.createFromURL(getImageUrl("refresh.gif"))); + refreshAction.setImageDescriptor(Activator.getImageDescriptor("icons/refresh.gif")); } - private static URL getImageUrl(String relative) { - return Platform.find(Platform.getBundle(PLUGIN_ID), new Path(ICON_PATH + relative)); - } - private void setSelection(RubyEditor editor, Node n) { if (n == null) return; Modified: trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/views/ViewContentProvider.java =================================================================== --- trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/views/ViewContentProvider.java 2006-07-27 22:46:52 UTC (rev 1550) +++ trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/views/ViewContentProvider.java 2006-07-31 20:22:07 UTC (rev 1551) @@ -40,12 +40,15 @@ import org.eclipse.ui.IViewSite; import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.PlatformUI; +import org.jruby.ast.NewlineNode; import org.jruby.ast.Node; +import org.jruby.ast.ScopeNode; import org.jruby.common.NullWarnings; import org.jruby.lexer.yacc.LexerSource; import org.jruby.parser.DefaultRubyParser; import org.jruby.parser.RubyParserConfiguration; import org.jruby.parser.RubyParserPool; +import org.rubypeople.rdt.astviewer.Activator; import org.rubypeople.rdt.internal.ui.rubyeditor.RubyEditor; class ViewContentProvider implements IStructuredContentProvider, ITreeContentProvider { @@ -56,6 +59,10 @@ private RubyEditor editor; private DefaultRubyParser parser; + + private boolean showNewline; + + private boolean showScope; public ViewContentProvider(IViewSite viewSite) { this.viewSite = viewSite; @@ -124,13 +131,12 @@ if(n == null) return; + + if(!showNewline && n instanceof NewlineNode) + n = ((NewlineNode) n).getNextNode(); + else if(!showScope && n instanceof ScopeNode) + n = ((ScopeNode) n).getBodyNode(); - //we could just skip newline and scope nodes here. should make it configureable -// if(n instanceof NewlineNode) -// n = ((NewlineNode) n).getNextNode(); -// else if(n instanceof ScopeNode) -// n = ((ScopeNode) n).getBodyNode(); - if(n.childNodes().size() <= 0) { parent.addChild(new TreeObject(n)); } else { @@ -140,7 +146,7 @@ while(it.hasNext()) { buildTree(new_parent, (Node) it.next()); } - } + } } private IWorkbenchPage getActiveWorkbenchPage() { @@ -160,6 +166,8 @@ setEditor((RubyEditor) getActiveWorkbenchPage().getActiveEditor()); invisibleRoot = new TreeParent(null); + showNewline = Activator.getDefault().getPreferenceStore().getBoolean("showNewline"); + showScope = Activator.getDefault().getPreferenceStore().getBoolean("showScope"); buildTree(invisibleRoot, getRootNode()); return true; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <mir...@us...> - 2006-07-28 19:17:15
|
Revision: 1545 Author: mirkostocker Date: 2006-07-27 11:29:13 -0700 (Thu, 27 Jul 2006) ViewCVS: http://svn.sourceforge.net/rubyeclipse/?rev=1545&view=rev Log Message: ----------- Added a first version of the AST viewer plugin, I had some problems with automatically updating the view, so this currently needs to be done by hand (with the refresh icon). I also plan to make it configureable, so you could select the nodes you don't want to see (for example NewlineNode). Feel free to contact me if you have any suggestions for further functionality! Added Paths: ----------- trunk/org.rubypeople.rdt.astviewer/ trunk/org.rubypeople.rdt.astviewer/.classpath trunk/org.rubypeople.rdt.astviewer/.project trunk/org.rubypeople.rdt.astviewer/.settings/ trunk/org.rubypeople.rdt.astviewer/.settings/org.eclipse.jdt.core.prefs trunk/org.rubypeople.rdt.astviewer/.settings/org.eclipse.jdt.ui.prefs trunk/org.rubypeople.rdt.astviewer/META-INF/ trunk/org.rubypeople.rdt.astviewer/META-INF/MANIFEST.MF trunk/org.rubypeople.rdt.astviewer/bin/ trunk/org.rubypeople.rdt.astviewer/build.properties trunk/org.rubypeople.rdt.astviewer/icons/ trunk/org.rubypeople.rdt.astviewer/icons/ast_view.gif trunk/org.rubypeople.rdt.astviewer/icons/refresh.gif trunk/org.rubypeople.rdt.astviewer/plugin.xml trunk/org.rubypeople.rdt.astviewer/src/ trunk/org.rubypeople.rdt.astviewer/src/org/ trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/ trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/ trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/ trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/Activator.java trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/views/ trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/views/AstView.java trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/views/TreeObject.java trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/views/TreeParent.java trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/views/ViewContentProvider.java trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/views/ViewLabelProvider.java Added: trunk/org.rubypeople.rdt.astviewer/.classpath =================================================================== --- trunk/org.rubypeople.rdt.astviewer/.classpath (rev 0) +++ trunk/org.rubypeople.rdt.astviewer/.classpath 2006-07-27 18:29:13 UTC (rev 1545) @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <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 sourcepath="/org.jruby/src" kind="lib" path="/org.rubypeople.rdt.core/lib/jruby.jar"/> + <classpathentry kind="output" path="bin"/> +</classpath> Added: trunk/org.rubypeople.rdt.astviewer/.project =================================================================== --- trunk/org.rubypeople.rdt.astviewer/.project (rev 0) +++ trunk/org.rubypeople.rdt.astviewer/.project 2006-07-27 18:29:13 UTC (rev 1545) @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>org.rubypeople.rdt.astviewer</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.ManifestBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.SchemaBuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.pde.PluginNature</nature> + <nature>org.eclipse.jdt.core.javanature</nature> + </natures> +</projectDescription> Added: trunk/org.rubypeople.rdt.astviewer/.settings/org.eclipse.jdt.core.prefs =================================================================== --- trunk/org.rubypeople.rdt.astviewer/.settings/org.eclipse.jdt.core.prefs (rev 0) +++ trunk/org.rubypeople.rdt.astviewer/.settings/org.eclipse.jdt.core.prefs 2006-07-27 18:29:13 UTC (rev 1545) @@ -0,0 +1,12 @@ +#Thu Jul 27 01:45:30 CEST 2006 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 Added: trunk/org.rubypeople.rdt.astviewer/.settings/org.eclipse.jdt.ui.prefs =================================================================== --- trunk/org.rubypeople.rdt.astviewer/.settings/org.eclipse.jdt.ui.prefs (rev 0) +++ trunk/org.rubypeople.rdt.astviewer/.settings/org.eclipse.jdt.ui.prefs 2006-07-27 18:29:13 UTC (rev 1545) @@ -0,0 +1,3 @@ +#Thu Jul 27 01:45:30 CEST 2006 +eclipse.preferences.version=1 +internal.default.compliance=default Added: trunk/org.rubypeople.rdt.astviewer/META-INF/MANIFEST.MF =================================================================== --- trunk/org.rubypeople.rdt.astviewer/META-INF/MANIFEST.MF (rev 0) +++ trunk/org.rubypeople.rdt.astviewer/META-INF/MANIFEST.MF 2006-07-27 18:29:13 UTC (rev 1545) @@ -0,0 +1,19 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Astviewer Plug-in +Bundle-SymbolicName: org.rubypeople.rdt.astviewer; singleton:=true +Bundle-Version: 0.1.0 +Bundle-Activator: org.rubypeople.rdt.astviewer.Activator +Bundle-Localization: plugin +Require-Bundle: org.eclipse.ui, + org.eclipse.core.runtime, + org.rubypeople.rdt.ui, + org.eclipse.core.resources, + org.eclipse.ui.ide, + org.eclipse.jface.text, + org.rubypeople.rdt.core, + org.eclipse.ui.editors, + org.eclipse.ui.workbench.texteditor +Eclipse-LazyStart: true +Export-Package: org.rubypeople.rdt.astviewer, + org.rubypeople.rdt.astviewer.views Added: trunk/org.rubypeople.rdt.astviewer/build.properties =================================================================== --- trunk/org.rubypeople.rdt.astviewer/build.properties (rev 0) +++ trunk/org.rubypeople.rdt.astviewer/build.properties 2006-07-27 18:29:13 UTC (rev 1545) @@ -0,0 +1,11 @@ +source.. = src/ +output.. = bin/ +bin.includes = plugin.xml,\ + META-INF/,\ + .,\ + icons/ +src.includes = META-INF/,\ + src/,\ + plugin.xml,\ + icons/,\ + build.properties Added: trunk/org.rubypeople.rdt.astviewer/icons/ast_view.gif =================================================================== (Binary files differ) Property changes on: trunk/org.rubypeople.rdt.astviewer/icons/ast_view.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/org.rubypeople.rdt.astviewer/icons/refresh.gif =================================================================== (Binary files differ) Property changes on: trunk/org.rubypeople.rdt.astviewer/icons/refresh.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/org.rubypeople.rdt.astviewer/plugin.xml =================================================================== --- trunk/org.rubypeople.rdt.astviewer/plugin.xml (rev 0) +++ trunk/org.rubypeople.rdt.astviewer/plugin.xml 2006-07-27 18:29:13 UTC (rev 1545) @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?eclipse version="3.2"?> +<plugin> + + <extension + point="org.eclipse.ui.views"> + <category + name="Ruby" + id="org.rubypeople.rdt.astviewer"> + </category> + <view + name="AST View" + icon="icons/ast_view.gif" + category="org.rubypeople.rdt.astviewer" + class="org.rubypeople.rdt.astviewer.views.AstView" + id="org.rubypeople.rdt.astviewer.views.AstView"> + </view> + </extension> + <extension + point="org.eclipse.ui.perspectiveExtensions"> + <perspectiveExtension + targetID="org.eclipse.ui.resourcePerspective"> + <view + ratio="0.5" + relative="org.eclipse.ui.views.TaskList" + relationship="right" + id="org.rubypeople.rdt.astviewer.views.AstView"> + </view> + </perspectiveExtension> + </extension> + +</plugin> Added: trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/Activator.java =================================================================== --- trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/Activator.java (rev 0) +++ trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/Activator.java 2006-07-27 18:29:13 UTC (rev 1545) @@ -0,0 +1,89 @@ +/***** BEGIN LICENSE BLOCK ***** + * Version: CPL 1.0/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Common Public + * License Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.eclipse.org/legal/cpl-v10.html + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * Copyright (C) 2006 Mirko Stocker <me...@mi...> + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the CPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the CPL, the GPL or the LGPL. + ***** END LICENSE BLOCK *****/ + +package org.rubypeople.rdt.astviewer; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator extends AbstractUIPlugin { + + // The plug-in ID + public static final String PLUGIN_ID = "org.rubypeople.rdt.astviewer"; + + // The shared instance + private static Activator plugin; + + /** + * The constructor + */ + public Activator() { + plugin = this; + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext context) throws Exception { + super.start(context); + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + + /** + * Returns an image descriptor for the image file at the given + * plug-in relative path + * + * @param path the path + * @return the image descriptor + */ + public static ImageDescriptor getImageDescriptor(String path) { + return imageDescriptorFromPlugin(PLUGIN_ID, path); + } +} Added: trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/views/AstView.java =================================================================== --- trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/views/AstView.java (rev 0) +++ trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/views/AstView.java 2006-07-27 18:29:13 UTC (rev 1545) @@ -0,0 +1,263 @@ +/***** BEGIN LICENSE BLOCK ***** + * Version: CPL 1.0/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Common Public + * License Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.eclipse.org/legal/cpl-v10.html + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * Copyright (C) 2006 Mirko Stocker <me...@mi...> + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the CPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the CPL, the GPL or the LGPL. + ***** END LICENSE BLOCK *****/ + +package org.rubypeople.rdt.astviewer.views; + +import java.io.InputStream; +import java.net.URL; + +import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.Platform; +import org.eclipse.jface.action.Action; +import org.eclipse.jface.action.IMenuListener; +import org.eclipse.jface.action.IMenuManager; +import org.eclipse.jface.action.IToolBarManager; +import org.eclipse.jface.action.MenuManager; +import org.eclipse.jface.action.Separator; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.text.Document; +import org.eclipse.jface.text.source.SourceViewer; +import org.eclipse.jface.viewers.DoubleClickEvent; +import org.eclipse.jface.viewers.IDoubleClickListener; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.viewers.TreeViewer; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.SashForm; +import org.eclipse.swt.graphics.ImageData; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Menu; +import org.eclipse.swt.widgets.TreeItem; +import org.eclipse.ui.IActionBars; +import org.eclipse.ui.IWorkbenchActionConstants; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.part.DrillDownAdapter; +import org.eclipse.ui.part.ViewPart; +import org.jruby.ast.Node; +import org.rubypeople.rdt.internal.ui.rubyeditor.RubyEditor; + +public class AstView extends ViewPart { + private TreeViewer viewer; + private DrillDownAdapter drillDownAdapter; + private Action refreshAction; + private Action doubleClickAction; + private Action clickAction; + private ViewContentProvider viewContentProvider; + private SashForm sashForm; + private SourceViewer detailsViewer; + + public static final String PLUGIN_ID = "org.rubypeople.rdt.astviewer"; + public static final String ICON_PATH = "icons/"; + + public void createPartControl(Composite parent) { + sashForm = new SashForm(parent, SWT.NONE); + sashForm.setOrientation(SWT.VERTICAL); + + viewer = new TreeViewer(sashForm, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL); + drillDownAdapter = new DrillDownAdapter(viewer); + viewContentProvider = new ViewContentProvider(getViewSite()); + viewer.setContentProvider(viewContentProvider); + viewer.setLabelProvider(new ViewLabelProvider()); + + viewer.setInput(getViewSite()); + makeActions(); + hookContextMenu(); + hookClickAction(); + hookDoubleClickAction(); + contributeToActionBars(); + //setupListeners(); + viewer.setAutoExpandLevel(TreeViewer.ALL_LEVELS); + + detailsViewer= new SourceViewer(sashForm, null, SWT.V_SCROLL | SWT.H_SCROLL); + detailsViewer.setEditable(false); + detailsViewer.setDocument(new Document()); + Control control = detailsViewer.getControl(); + GridData gd = new GridData(GridData.FILL_BOTH); + control.setLayoutData(gd); + + sashForm.setWeights(new int[]{90, 10}); + } + +// Tried to automatically update the view, but could not figure out yet how to do it properly. +// private void setupListeners(){ +// +// final IPartListener partListener = new IPartListener(){ +// public void partActivated(IWorkbenchPart part) { +// partWasActivated(); +// } +// public void partBroughtToTop(IWorkbenchPart part) {} +// public void partClosed(IWorkbenchPart part) {} +// public void partDeactivated(IWorkbenchPart part) {} +// public void partOpened(IWorkbenchPart part) { +// partWasActivated(); +// } +// }; +// +// PlatformUI.getWorkbench().getActiveWorkbenchWindow().addPageListener(new IPageListener(){ +// +// public void pageActivated(final IWorkbenchPage page) { +// page.addPartListener(partListener); +// } +// +// public void pageClosed(IWorkbenchPage page) {} +// +// public void pageOpened(IWorkbenchPage page) { +// page.addPartListener(partListener); +// }}); +// } +// +// private void partWasActivated() { +// if(viewContentProvider.updateContent()) { +// viewer.setInput(getViewSite()); +// viewer.setAutoExpandLevel(TreeViewer.ALL_LEVELS); +// } +// } + + private void hookContextMenu() { + MenuManager menuMgr = new MenuManager("#PopupMenu"); + menuMgr.setRemoveAllWhenShown(true); + menuMgr.addMenuListener(new IMenuListener() { + public void menuAboutToShow(IMenuManager manager) { + AstView.this.fillContextMenu(manager); + } + }); + Menu menu = menuMgr.createContextMenu(viewer.getControl()); + viewer.getControl().setMenu(menu); + getSite().registerContextMenu(menuMgr, viewer); + } + + private void contributeToActionBars() { + IActionBars bars = getViewSite().getActionBars(); + fillLocalPullDown(bars.getMenuManager()); + fillLocalToolBar(bars.getToolBarManager()); + } + + private void fillLocalPullDown(IMenuManager manager) { + manager.add(refreshAction); + } + + private void fillContextMenu(IMenuManager manager) { + manager.add(refreshAction); + drillDownAdapter.addNavigationActions(manager); + // Other plug-ins can contribute there actions here + manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); + } + + private void fillLocalToolBar(IToolBarManager manager) { + manager.add(refreshAction); + drillDownAdapter.addNavigationActions(manager); + } + + private void makeActions() { + refreshAction = new Action() { + public void run() { + viewContentProvider.forceUpdateContent(); + viewer.setInput(getViewSite()); + viewer.setAutoExpandLevel(TreeViewer.ALL_LEVELS); + } + }; + + refreshAction.setText("Refresh the AST View"); + refreshAction.setToolTipText("Performs a complete refresh over the whole AST."); + refreshAction.setImageDescriptor(ImageDescriptor.createFromURL(getImageUrl("refresh.gif"))); + } + + private static URL getImageUrl(String relative) { + return Platform.find(Platform.getBundle(PLUGIN_ID), new Path(ICON_PATH + relative)); + } + + private void setSelection(RubyEditor editor, Node n) { + if (n == null) + return; + editor.selectAndReveal(n.getPosition().getStartOffset(), n.getPosition().getEndOffset() - n.getPosition().getStartOffset() + 1); + } + + private String formatedPosition(Node n) { + if(n == null) + return ""; + + StringBuilder posString = new StringBuilder(); + posString.append("Lines ["); + posString.append(n.getPosition().getStartLine()); + posString.append(":"); + posString.append(n.getPosition().getEndLine()); + posString.append("], Offset ["); + posString.append(n.getPosition().getStartOffset()); + posString.append(":"); + posString.append(n.getPosition().getEndOffset()); + posString.append("]"); + return posString.toString(); + } + + private void hookClickAction() { + + clickAction = new Action(){ + public void run() { + detailsViewer.getDocument().set(formatedPosition(getSelectedNode())); + } + }; + + viewer.addSelectionChangedListener(new ISelectionChangedListener() { + public void selectionChanged(SelectionChangedEvent event) { + clickAction.run(); + } + }); + } + + private Node getSelectedNode() { + TreeItem[] selection = viewer.getTree().getSelection(); + if(selection.length <= 0) + return null; + return ((TreeObject) selection[0].getData()).getNode(); + } + + private RubyEditor getEditor() { + return (RubyEditor) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor(); + } + + private void hookDoubleClickAction() { + + doubleClickAction = new Action(){ + public void run() { + setSelection(getEditor(), getSelectedNode()); + } + }; + + viewer.addDoubleClickListener(new IDoubleClickListener() { + public void doubleClick(DoubleClickEvent event) { + doubleClickAction.run(); + } + }); + } + + public void setFocus() { + viewer.getControl().setFocus(); + } +} \ No newline at end of file Added: trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/views/TreeObject.java =================================================================== --- trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/views/TreeObject.java (rev 0) +++ trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/views/TreeObject.java 2006-07-27 18:29:13 UTC (rev 1545) @@ -0,0 +1,59 @@ +/***** BEGIN LICENSE BLOCK ***** + * Version: CPL 1.0/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Common Public + * License Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.eclipse.org/legal/cpl-v10.html + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * Copyright (C) 2006 Mirko Stocker <me...@mi...> + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the CPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the CPL, the GPL or the LGPL. + ***** END LICENSE BLOCK *****/ + +package org.rubypeople.rdt.astviewer.views; + +import org.eclipse.core.runtime.IAdaptable; +import org.jruby.ast.Node; + +class TreeObject implements IAdaptable { + private Node node; + private TreeParent parent; + + public Node getNode() { + return node; + } + public TreeObject(Node n) { + this.node = n; + } + public String getName() { + return node.getClass().toString(); + } + public void setParent(TreeParent parent) { + this.parent = parent; + } + public TreeParent getParent() { + return parent; + } + public String toString() { + return getName(); + } + public Object getAdapter(Class key) { + return null; + } +} \ No newline at end of file Added: trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/views/TreeParent.java =================================================================== --- trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/views/TreeParent.java (rev 0) +++ trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/views/TreeParent.java 2006-07-27 18:29:13 UTC (rev 1545) @@ -0,0 +1,55 @@ +/***** BEGIN LICENSE BLOCK ***** + * Version: CPL 1.0/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Common Public + * License Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.eclipse.org/legal/cpl-v10.html + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * Copyright (C) 2006 Mirko Stocker <me...@mi...> + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the CPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the CPL, the GPL or the LGPL. + ***** END LICENSE BLOCK *****/ + +package org.rubypeople.rdt.astviewer.views; + +import java.util.ArrayList; + +import org.jruby.ast.Node; + +class TreeParent extends TreeObject { + private ArrayList<TreeObject> children; + public TreeParent(Node n) { + super(n); + children = new ArrayList<TreeObject>(); + } + public void addChild(TreeObject child) { + children.add(child); + child.setParent(this); + } + public void removeChild(TreeObject child) { + children.remove(child); + child.setParent(null); + } + public TreeObject [] getChildren() { + return (TreeObject [])children.toArray(new TreeObject[children.size()]); + } + public boolean hasChildren() { + return children.size() > 0; + } +} \ No newline at end of file Added: trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/views/ViewContentProvider.java =================================================================== --- trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/views/ViewContentProvider.java (rev 0) +++ trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/views/ViewContentProvider.java 2006-07-27 18:29:13 UTC (rev 1545) @@ -0,0 +1,183 @@ +/***** BEGIN LICENSE BLOCK ***** + * Version: CPL 1.0/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Common Public + * License Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.eclipse.org/legal/cpl-v10.html + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * Copyright (C) 2006 Mirko Stocker <me...@mi...> + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the CPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the CPL, the GPL or the LGPL. + ***** END LICENSE BLOCK *****/ + +package org.rubypeople.rdt.astviewer.views; + +import java.io.InputStreamReader; +import java.util.Iterator; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.jface.viewers.IStructuredContentProvider; +import org.eclipse.jface.viewers.ITreeContentProvider; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.ui.IFileEditorInput; +import org.eclipse.ui.IViewSite; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.PlatformUI; +import org.jruby.ast.Node; +import org.jruby.common.NullWarnings; +import org.jruby.lexer.yacc.LexerSource; +import org.jruby.parser.DefaultRubyParser; +import org.jruby.parser.RubyParserConfiguration; +import org.jruby.parser.RubyParserPool; +import org.rubypeople.rdt.internal.ui.rubyeditor.RubyEditor; + +class ViewContentProvider implements IStructuredContentProvider, ITreeContentProvider { + private TreeParent invisibleRoot; + + private IViewSite viewSite; + + private RubyEditor editor; + + private DefaultRubyParser parser; + + public ViewContentProvider(IViewSite viewSite) { + this.viewSite = viewSite; + parser = RubyParserPool.getInstance().borrowParser(); + parser.setWarnings(new NullWarnings()); + parser.init(new RubyParserConfiguration()); + } + + public void inputChanged(Viewer v, Object oldInput, Object newInput) { + } + + public void dispose() { + RubyParserPool.getInstance().returnParser(parser); + } + + protected IFile getFile() + { + return ((IFileEditorInput) editor.getEditorInput()).getFile(); + } + + public Object[] getElements(Object parent) { + if (parent.equals(viewSite)) { + if (invisibleRoot == null) + initialize(); + return getChildren(invisibleRoot); + } + return getChildren(parent); + } + + public Object getParent(Object child) { + if (child instanceof TreeObject) { + return ((TreeObject) child).getParent(); + } + return null; + } + + public Object[] getChildren(Object parent) { + if (parent instanceof TreeParent) { + return ((TreeParent) parent).getChildren(); + } + return new Object[0]; + } + + public boolean hasChildren(Object parent) { + if (parent instanceof TreeParent) + return ((TreeParent) parent).hasChildren(); + return false; + } + + public Node getRootNode() { + LexerSource lexerSource; + try { + lexerSource = new LexerSource(getFile().getName(), new InputStreamReader(getFile().getContents())); + return parser.parse(lexerSource).getAST(); + } catch (CoreException e) { + e.printStackTrace(); + } + return null; + } + + private void initialize() { + updateContent(); + } + + private void buildTree(TreeParent parent, Node n) { + + if(n == null) + return; + + //we could just skip newline and scope nodes here. should make it configureable +// if(n instanceof NewlineNode) +// n = ((NewlineNode) n).getNextNode(); +// else if(n instanceof ScopeNode) +// n = ((ScopeNode) n).getBodyNode(); + + if(n.childNodes().size() <= 0) { + parent.addChild(new TreeObject(n)); + } else { + TreeParent new_parent = new TreeParent(n); + parent.addChild(new_parent); + Iterator it = n.childNodes().iterator(); + while(it.hasNext()) { + buildTree(new_parent, (Node) it.next()); + } + } + } + + private IWorkbenchPage getActiveWorkbenchPage() { + return PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); + } + + private boolean editorChanged() { + if(getActiveWorkbenchPage() == null) + return false; + return getEditor() != (RubyEditor) getActiveWorkbenchPage().getActiveEditor(); + } + + public boolean forceUpdateContent() { + if(getActiveWorkbenchPage() == null) + return false; + + setEditor((RubyEditor) getActiveWorkbenchPage().getActiveEditor()); + + invisibleRoot = new TreeParent(null); + buildTree(invisibleRoot, getRootNode()); + + return true; + } + + public boolean updateContent() { + + if(editorChanged()) + return forceUpdateContent(); + else + return false; + } + + private void setEditor(RubyEditor editor) { + this.editor = editor; + } + + private RubyEditor getEditor() { + return editor; + } +} Added: trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/views/ViewLabelProvider.java =================================================================== --- trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/views/ViewLabelProvider.java (rev 0) +++ trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/views/ViewLabelProvider.java 2006-07-27 18:29:13 UTC (rev 1545) @@ -0,0 +1,53 @@ +/***** BEGIN LICENSE BLOCK ***** + * Version: CPL 1.0/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Common Public + * License Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.eclipse.org/legal/cpl-v10.html + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * Copyright (C) 2006 Mirko Stocker <me...@mi...> + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the CPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the CPL, the GPL or the LGPL. + ***** END LICENSE BLOCK *****/ + +package org.rubypeople.rdt.astviewer.views; + +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.swt.graphics.Image; +import org.eclipse.ui.ISharedImages; +import org.eclipse.ui.PlatformUI; + +class ViewLabelProvider extends LabelProvider { + + public String getText(Object obj) { + String text = obj.toString().substring(obj.toString().lastIndexOf('.') + 1); + + if (text.endsWith("Node")) + text = text.substring(0, text.length() - "Node".length()); + + return text; + } + + public Image getImage(Object obj) { + String imageKey = ISharedImages.IMG_OBJ_ELEMENT; + if (obj instanceof TreeParent) + imageKey = ISharedImages.IMG_OBJ_FOLDER; + return PlatformUI.getWorkbench().getSharedImages().getImage(imageKey); + } +} \ 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: <jas...@us...> - 2006-07-27 22:46:57
|
Revision: 1550 Author: jasonpmorrison Date: 2006-07-27 15:46:52 -0700 (Thu, 27 Jul 2006) ViewCVS: http://svn.sourceforge.net/rubyeclipse/?rev=1550&view=rev Log Message: ----------- * getNameReflectively returns null if it fails. Modified Paths: -------------- branches/type_inferrence/trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/DefaultOccurrencesFinder.java Modified: branches/type_inferrence/trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/DefaultOccurrencesFinder.java =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/DefaultOccurrencesFinder.java 2006-07-27 22:40:25 UTC (rev 1549) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/DefaultOccurrencesFinder.java 2006-07-27 22:46:52 UTC (rev 1550) @@ -835,23 +835,24 @@ Method getNameMethod = node.getClass().getMethod("getName", new Class[]{}); Object name = getNameMethod.invoke( node, new Object[0] ); return (String)name; - } catch (SecurityException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (NoSuchMethodException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (IllegalArgumentException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (IllegalAccessException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (InvocationTargetException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + } catch (Exception e) { + return null; } - return null; +// } catch (SecurityException e) { +// // TODO Auto-generated catch block +// e.printStackTrace(); +// } catch (NoSuchMethodException e) { +// return null; +// } catch (IllegalArgumentException e) { +// // TODO Auto-generated catch block +// e.printStackTrace(); +// } catch (IllegalAccessException e) { +// // TODO Auto-generated catch block +// e.printStackTrace(); +// } catch (InvocationTargetException e) { +// // TODO Auto-generated catch block +// e.printStackTrace(); +// } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <jas...@us...> - 2006-07-27 22:40:34
|
Revision: 1549 Author: jasonpmorrison Date: 2006-07-27 15:40:25 -0700 (Thu, 27 Jul 2006) ViewCVS: http://svn.sourceforge.net/rubyeclipse/?rev=1549&view=rev Log Message: ----------- * Cleaning up Mark Occurrences * Ensure it doesn't return dupes * Cut down on getName() cast+calls with reflectivelyGetName() * Culled the prefs page Modified Paths: -------------- branches/type_inferrence/trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/MarkOccurrencesConfigurationBlock.java branches/type_inferrence/trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/rubyeditor/RubyAbstractEditor.java Modified: branches/type_inferrence/trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/MarkOccurrencesConfigurationBlock.java =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/MarkOccurrencesConfigurationBlock.java 2006-07-27 22:40:16 UTC (rev 1548) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/MarkOccurrencesConfigurationBlock.java 2006-07-27 22:40:25 UTC (rev 1549) @@ -108,25 +108,25 @@ Button slave= addCheckBox(composite, label, PreferenceConstants.EDITOR_MARK_TYPE_OCCURRENCES, 0); createDependency(master, PreferenceConstants.EDITOR_STICKY_OCCURRENCES, slave); - label= PreferencesMessages.MarkOccurrencesConfigurationBlock_markMethodOccurrences; - slave= addCheckBox(composite, label, PreferenceConstants.EDITOR_MARK_METHOD_OCCURRENCES, 0); - createDependency(master, PreferenceConstants.EDITOR_MARK_METHOD_OCCURRENCES, slave); +// label= PreferencesMessages.MarkOccurrencesConfigurationBlock_markMethodOccurrences; +// slave= addCheckBox(composite, label, PreferenceConstants.EDITOR_MARK_METHOD_OCCURRENCES, 0); +// createDependency(master, PreferenceConstants.EDITOR_MARK_METHOD_OCCURRENCES, slave); label= PreferencesMessages.MarkOccurrencesConfigurationBlock_markConstantOccurrences; slave= addCheckBox(composite, label, PreferenceConstants.EDITOR_MARK_CONSTANT_OCCURRENCES, 0); createDependency(master, PreferenceConstants.EDITOR_MARK_CONSTANT_OCCURRENCES, slave); - label= PreferencesMessages.MarkOccurrencesConfigurationBlock_markFieldOccurrences; - slave= addCheckBox(composite, label, PreferenceConstants.EDITOR_MARK_FIELD_OCCURRENCES, 0); - createDependency(master, PreferenceConstants.EDITOR_MARK_FIELD_OCCURRENCES, slave); +// label= PreferencesMessages.MarkOccurrencesConfigurationBlock_markFieldOccurrences; +// slave= addCheckBox(composite, label, PreferenceConstants.EDITOR_MARK_FIELD_OCCURRENCES, 0); +// createDependency(master, PreferenceConstants.EDITOR_MARK_FIELD_OCCURRENCES, slave); label= PreferencesMessages.MarkOccurrencesConfigurationBlock_markLocalVariableOccurrences; slave= addCheckBox(composite, label, PreferenceConstants.EDITOR_MARK_LOCAL_VARIABLE_OCCURRENCES, 0); createDependency(master, PreferenceConstants.EDITOR_MARK_LOCAL_VARIABLE_OCCURRENCES, slave); - label= PreferencesMessages.MarkOccurrencesConfigurationBlock_markMethodExitPoints; - slave= addCheckBox(composite, label, PreferenceConstants.EDITOR_MARK_METHOD_EXIT_POINTS, 0); - createDependency(master, PreferenceConstants.EDITOR_MARK_METHOD_EXIT_POINTS, slave); +// label= PreferencesMessages.MarkOccurrencesConfigurationBlock_markMethodExitPoints; +// slave= addCheckBox(composite, label, PreferenceConstants.EDITOR_MARK_METHOD_EXIT_POINTS, 0); +// createDependency(master, PreferenceConstants.EDITOR_MARK_METHOD_EXIT_POINTS, slave); addFiller(composite); Modified: branches/type_inferrence/trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/rubyeditor/RubyAbstractEditor.java =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/rubyeditor/RubyAbstractEditor.java 2006-07-27 22:40:16 UTC (rev 1548) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/rubyeditor/RubyAbstractEditor.java 2006-07-27 22:40:25 UTC (rev 1549) @@ -174,7 +174,7 @@ * Only valid if {@link #fMarkOccurrenceAnnotations} is <code>true</code>. * @since 3.0 */ - private boolean fMarkLocalVariableypeOccurrences; + private boolean fMarkLocalVariableOccurrences; /** * Tells whether to mark method exits in this editor. * Only valid if {@link #fMarkOccurrenceAnnotations} is <code>true</code>. @@ -280,13 +280,13 @@ RubyTextTools textTools= RubyPlugin.getDefault().getRubyTextTools(); setSourceViewerConfiguration(new RubySourceViewerConfiguration(textTools.getColorManager(), store, this, IRubyPartitions.RUBY_PARTITIONING)); fMarkOccurrenceAnnotations= store.getBoolean(PreferenceConstants.EDITOR_MARK_OCCURRENCES); - fStickyOccurrenceAnnotations= store.getBoolean(PreferenceConstants.EDITOR_STICKY_OCCURRENCES); - fMarkTypeOccurrences= store.getBoolean(PreferenceConstants.EDITOR_MARK_TYPE_OCCURRENCES); - fMarkMethodOccurrences= store.getBoolean(PreferenceConstants.EDITOR_MARK_METHOD_OCCURRENCES); - fMarkConstantOccurrences= store.getBoolean(PreferenceConstants.EDITOR_MARK_CONSTANT_OCCURRENCES); - fMarkFieldOccurrences= store.getBoolean(PreferenceConstants.EDITOR_MARK_FIELD_OCCURRENCES); - fMarkLocalVariableypeOccurrences= store.getBoolean(PreferenceConstants.EDITOR_MARK_LOCAL_VARIABLE_OCCURRENCES); - fMarkMethodExitPoints= store.getBoolean(PreferenceConstants.EDITOR_MARK_METHOD_EXIT_POINTS); + fStickyOccurrenceAnnotations= store.getBoolean(PreferenceConstants.EDITOR_STICKY_OCCURRENCES); + fMarkTypeOccurrences= store.getBoolean(PreferenceConstants.EDITOR_MARK_TYPE_OCCURRENCES); + fMarkMethodOccurrences= store.getBoolean(PreferenceConstants.EDITOR_MARK_METHOD_OCCURRENCES); + fMarkConstantOccurrences= store.getBoolean(PreferenceConstants.EDITOR_MARK_CONSTANT_OCCURRENCES); + fMarkFieldOccurrences= store.getBoolean(PreferenceConstants.EDITOR_MARK_FIELD_OCCURRENCES); + fMarkLocalVariableOccurrences= store.getBoolean(PreferenceConstants.EDITOR_MARK_LOCAL_VARIABLE_OCCURRENCES); + fMarkMethodExitPoints= store.getBoolean(PreferenceConstants.EDITOR_MARK_METHOD_EXIT_POINTS); } /* @@ -399,7 +399,7 @@ return; } if (PreferenceConstants.EDITOR_MARK_LOCAL_VARIABLE_OCCURRENCES.equals(property)) { - fMarkLocalVariableypeOccurrences= newBooleanValue; + fMarkLocalVariableOccurrences= newBooleanValue; return; } if (PreferenceConstants.EDITOR_MARK_METHOD_EXIT_POINTS.equals(property)) { @@ -1406,7 +1406,15 @@ String source = document.get(); // Search for occurrences - fOccurrencesFinder.initialize(source, selection.getOffset(), selection.getLength()); + fOccurrencesFinder.setFMarkConstantOccurrences(fMarkConstantOccurrences); + fOccurrencesFinder.setFMarkFieldOccurrences(fMarkFieldOccurrences); + fOccurrencesFinder.setFMarkLocalVariableOccurrences(fMarkLocalVariableOccurrences); + fOccurrencesFinder.setFMarkMethodExitPoints(fMarkMethodExitPoints); + fOccurrencesFinder.setFMarkMethodOccurrences(fMarkMethodOccurrences); + fOccurrencesFinder.setFMarkOccurrenceAnnotations(fMarkOccurrenceAnnotations); + fOccurrencesFinder.setFMarkTypeOccurrences(fMarkTypeOccurrences); + fOccurrencesFinder.setFStickyOccurrenceAnnotations(fStickyOccurrenceAnnotations); + fOccurrencesFinder.initialize(source, selection.getOffset(), selection.getLength()); List<Position> matches = fOccurrencesFinder.perform(); if (matches.isEmpty()) { @@ -1431,6 +1439,11 @@ fOccurrencesFinderJob.run(new NullProgressMonitor()); } } + + protected void setMarkOccurrencePreferences(IOccurrencesFinder occurrencesFinder) + { + + } protected void installOccurrencesFinder(boolean forceUpdate) { fMarkOccurrenceAnnotations= true; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
Revision: 1548 Author: jasonpmorrison Date: 2006-07-27 15:40:16 -0700 (Thu, 27 Jul 2006) ViewCVS: http://svn.sourceforge.net/rubyeclipse/?rev=1548&view=rev Log Message: ----------- * Cleaning up Mark Occurrences * Ensure it doesn't return dupes * Cut down on getName() cast+calls with reflectivelyGetName() * Culled the prefs page Modified Paths: -------------- branches/type_inferrence/trunk/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/internal/ti/MarkOccurrencesTest.java Modified: branches/type_inferrence/trunk/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/internal/ti/MarkOccurrencesTest.java =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/internal/ti/MarkOccurrencesTest.java 2006-07-27 22:39:56 UTC (rev 1547) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/internal/ti/MarkOccurrencesTest.java 2006-07-27 22:40:16 UTC (rev 1548) @@ -2,13 +2,8 @@ import java.util.List; -import org.jruby.ast.BlockArgNode; -import org.jruby.ast.Node; -import org.jruby.lexer.yacc.ISourcePosition; -import org.rubypeople.rdt.internal.core.parser.RubyParser; -import org.rubypeople.rdt.internal.ti.util.OffsetNodeLocator; +import junit.framework.TestCase; -import junit.framework.TestCase; import org.eclipse.jface.text.Position; /** @@ -21,20 +16,34 @@ private IOccurrencesFinder occurrencesFinder; public void setUp() { - occurrencesFinder = new DefaultOccurrencesFinder(); + occurrencesFinder = new DefaultOccurrencesFinder(); + occurrencesFinder.setFMarkConstantOccurrences(true); + occurrencesFinder.setFMarkFieldOccurrences(true); + occurrencesFinder.setFMarkLocalVariableOccurrences(true); + occurrencesFinder.setFMarkMethodExitPoints(true); + occurrencesFinder.setFMarkMethodOccurrences(true); + occurrencesFinder.setFMarkOccurrenceAnnotations(true); + occurrencesFinder.setFMarkTypeOccurrences(true); + occurrencesFinder.setFStickyOccurrenceAnnotations(true); } private void assertOccurrencesEqual(String source, int offset, String matchName, int[][] offsets ) { occurrencesFinder.initialize(source, offset, 0); - List <Position> occurrences = occurrencesFinder.perform(); + List<Position> occurrences = occurrencesFinder.perform(); assertEquals( offsets.length, occurrences.size() ); for ( int i = 0; i < offsets.length; i++ ) { - int start = occurrences.get(i).getOffset(); - int end = occurrences.get(i).getOffset() + occurrences.get(i).getLength(); - assertEquals( offsets[i][0], start ); - assertEquals( offsets[i][1], end ); + int start = occurrences.get(i).getOffset(); + int length = occurrences.get(i).getLength(); + int end = occurrences.get(i).getOffset() + length; + + Position testPosition = new Position( start, length ); + + assertTrue( occurrences.contains( testPosition ) ); + +// assertEquals( offsets[i][0], start ); +// assertEquals( offsets[i][1], end ); assertEquals( matchName, source.substring(start, end)); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <jas...@us...> - 2006-07-27 22:40:12
|
Revision: 1547 Author: jasonpmorrison Date: 2006-07-27 15:39:56 -0700 (Thu, 27 Jul 2006) ViewCVS: http://svn.sourceforge.net/rubyeclipse/?rev=1547&view=rev Log Message: ----------- * Cleaning up Mark Occurrences * Ensure it doesn't return dupes * Cut down on getName() cast+calls with reflectivelyGetName() * Culled the prefs page Modified Paths: -------------- branches/type_inferrence/trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/AbstractOccurencesFinder.java branches/type_inferrence/trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/DefaultOccurrencesFinder.java branches/type_inferrence/trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/IOccurrencesFinder.java Modified: branches/type_inferrence/trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/AbstractOccurencesFinder.java =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/AbstractOccurencesFinder.java 2006-07-27 22:00:32 UTC (rev 1546) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/AbstractOccurencesFinder.java 2006-07-27 22:39:56 UTC (rev 1547) @@ -8,11 +8,19 @@ import org.rubypeople.rdt.core.IRubyElement; public class AbstractOccurencesFinder implements IOccurrencesFinder { + + protected boolean fMarkOccurrenceAnnotations; + protected boolean fStickyOccurrenceAnnotations; + protected boolean fMarkTypeOccurrences; + protected boolean fMarkMethodOccurrences; + protected boolean fMarkConstantOccurrences; + protected boolean fMarkFieldOccurrences; + protected boolean fMarkLocalVariableOccurrences; + protected boolean fMarkMethodExitPoints; public void collectOccurrenceMatches(IRubyElement element, IDocument document, Collection resultingMatches) { // TODO Auto-generated method stub - } public String getElementName() { @@ -45,4 +53,36 @@ return null; } + public void setFMarkConstantOccurrences(boolean markConstantOccurrences) { + fMarkConstantOccurrences = markConstantOccurrences; + } + + public void setFMarkFieldOccurrences(boolean markFieldOccurrences) { + fMarkFieldOccurrences = markFieldOccurrences; + } + + public void setFMarkLocalVariableOccurrences(boolean markLocalVariableOccurrences) { + fMarkLocalVariableOccurrences = markLocalVariableOccurrences; + } + + public void setFMarkMethodExitPoints(boolean markMethodExitPoints) { + fMarkMethodExitPoints = markMethodExitPoints; + } + + public void setFMarkMethodOccurrences(boolean markMethodOccurrences) { + fMarkMethodOccurrences = markMethodOccurrences; + } + + public void setFMarkOccurrenceAnnotations(boolean markOccurrenceAnnotations) { + fMarkOccurrenceAnnotations = markOccurrenceAnnotations; + } + + public void setFMarkTypeOccurrences(boolean markTypeOccurrences) { + fMarkTypeOccurrences = markTypeOccurrences; + } + + public void setFStickyOccurrenceAnnotations(boolean stickyOccurrenceAnnotations) { + fStickyOccurrenceAnnotations = stickyOccurrenceAnnotations; + } + } Modified: branches/type_inferrence/trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/DefaultOccurrencesFinder.java =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/DefaultOccurrencesFinder.java 2006-07-27 22:00:32 UTC (rev 1546) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/DefaultOccurrencesFinder.java 2006-07-27 22:39:56 UTC (rev 1547) @@ -1,8 +1,13 @@ package org.rubypeople.rdt.internal.ti; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; import java.util.ArrayList; +import java.util.HashSet; +import java.util.Iterator; import java.util.LinkedList; import java.util.List; +import java.util.Set; import org.eclipse.jface.text.Position; import org.jruby.ast.ArgumentNode; @@ -85,27 +90,31 @@ // occurrences to return List<ISourcePosition> occurrences = new LinkedList<ISourcePosition>(); - if ( isLocalVarRef(orig) ) { + if ( fMarkLocalVariableOccurrences && isLocalVarRef(orig) ) { pushLocalVarRefs( root, orig, occurrences ); } - if ( isDVarRef(orig) ) { + if ( fMarkLocalVariableOccurrences && isDVarRef(orig) ) { pushDVarRefs( root, orig, occurrences ); } - if ( isInstanceVarRef(orig) ) { + //XXX: Add pref for instvars + if ( fMarkLocalVariableOccurrences && isInstanceVarRef(orig) ) { pushInstVarRefs( root, orig, occurrences ); } - if ( isClassVarRef(orig) ) { + //XXX: Add pref for classvars + if ( fMarkLocalVariableOccurrences && isClassVarRef(orig) ) { pushClassVarRefs( root, orig, occurrences ); } - if ( isGlobalVarRef(orig) ) { + //XXX: Add pref for global vars + if ( fMarkLocalVariableOccurrences && isGlobalVarRef(orig) ) { pushGlobalVarRefs( root, orig, occurrences ); } - if ( orig instanceof SymbolNode ) { + //XXX: Add pref for symbols + if ( fMarkConstantOccurrences && orig instanceof SymbolNode ) { pushSymbolRefs( root, orig, occurrences ); } @@ -113,11 +122,16 @@ // pushMethodRefs( root, orig, occurrences ); // } - if ( isConstRef(orig) ) + if ( fMarkConstantOccurrences && isConstRef(orig) ) { pushConstRefs( root, orig, occurrences ); } - + + if ( fMarkTypeOccurrences && isTypeRef(orig) ) + { + pushTypeRefs( root, orig, occurrences ); + } + // Convert ISourcePosition to IPosition List<Position> positions = new LinkedList<Position>(); for (ISourcePosition occurrence : occurrences) { @@ -125,6 +139,9 @@ positions.add(position); } + // Uniqueify positions + positions = new LinkedList<Position>( new HashSet<Position>(positions) ); + return positions; } @@ -190,14 +207,27 @@ } /** - * Determines whether a given node is a constant reference (class, module... others??) + * Determines whether a given node is a constant reference (constant) * @param node * @return */ private boolean isConstRef( Node node ) { - return ( ( node instanceof ConstNode ) || ( node instanceof ClassNode ) || ( node instanceof ModuleNode ) ); + return ( node instanceof ConstNode ); } + + /** + * Determines whether a given node is a type reference (class, module) + * @param node + * @return + */ + private boolean isTypeRef( Node node ) { + //TODO: Classes can be referred to as a ConstNode; i.e. "class Klass;end; k = Klass.new" the last reference is a ConstNode, not a ClassNode. Special way to handle this? + return ( ( node instanceof ClassNode ) || ( node instanceof ModuleNode ) || ( node instanceof ConstNode )); + } + + + // **************************************************************************** // * // * Worker methods - handles delegation of occurrence searches @@ -272,8 +302,12 @@ // Find all pertinent nodes List<Node> searchResults = ScopedNodeLocator.Instance().findNodesInScope(searchSpace, new INodeAcceptor() { public boolean doesAccept(Node node) { - String name = getDVarRefName(node); - return ( name != null && name.equals(origName)); + if ( isDVarRef(node)) + { + String name = getDVarRefName(node); + return ( name != null && name.equals(origName)); + } + return false; } }); @@ -512,6 +546,32 @@ } } + /** + * Collects all pertinent type ref occurrences + */ + private void pushTypeRefs( Node root, Node orig, List<ISourcePosition> occurrences) { + if ( !isTypeRef(orig) ) + { + return; + } + + final String matchName = getConstRefName(orig); + List <Node> searchResults = ScopedNodeLocator.Instance().findNodesInScope(root, new INodeAcceptor() { + public boolean doesAccept(Node node) { + if ( isTypeRef(node) ) + { + return getTypeRefName(node).equals(matchName); + } + return false; + } + }); + + for ( Node searchResult : searchResults ) { + occurrences.add(getPositionOfName(searchResult, root ) ); + } + } + + // **************************************************************************** // * // * Utility methods @@ -535,8 +595,7 @@ if ( isInstanceVarRef(node) ) { name = getInstVarRefName(node ); } if ( isGlobalVarRef(node) ) { name = getGlobalVarRefName(node); } if ( isClassVarRef(node) ) { name = getClassVarRefName(node); } -// if ( isConstRef(node) ) { name = getConstRefName(node); } - if ( node instanceof ConstNode ) { name = ((ConstNode)node).getName(); } + if ( isConstRef(node) ) { name = getConstRefName(node); } if ( node instanceof ClassNode ) { name = getClassNodeName( (ClassNode)node ); String classDeclString = source.substring(pos.getStartOffset(), pos.getEndOffset()); @@ -558,7 +617,7 @@ if ( name == null ) { - System.err.println("Couldn't get the name for: " + node.toString() + " in " + scope.toString() ); + throw new RuntimeException("Couldn't get the name for: " + node.toString() + " in " + scope.toString()); } return new SourcePosition(pos.getFile(), pos.getStartLine(), pos.getEndLine(), pos.getStartOffset(), pos.getStartOffset() + name.length() ); } @@ -602,7 +661,7 @@ return ((LocalAsgnNode)previousAssign).getName(); } - System.err.println("Unhandled scope for local var ref node found: " + scope.toString() ); + throw new RuntimeException("Unhandled scope for local var ref node found: " + scope.toString()); //TODO: if scope instanceof Block Body? what type is this.. } @@ -619,13 +678,14 @@ * @return */ private String getDVarRefName( Node node ) { - if ( node instanceof DVarNode ) { - return ((DVarNode)node).getName(); - } - if ( node instanceof DAsgnNode ) { - return ((DAsgnNode)node).getName(); - } - return null; +// if ( node instanceof DVarNode ) { +// return ((DVarNode)node).getName(); +// } +// if ( node instanceof DAsgnNode ) { +// return ((DAsgnNode)node).getName(); +// } +// return null; + return getNameReflectively( node ); } /** @@ -634,18 +694,19 @@ * @return */ private String getInstVarRefName( Node node ) { - if ( node instanceof InstAsgnNode ) { - return ((InstAsgnNode)node).getName(); - } - - if ( node instanceof InstVarNode ) { - return ((InstVarNode)node).getName(); - } - - if ( node instanceof DVarNode ) { - return ((DVarNode)node).getName(); - } - return null; +// if ( node instanceof InstAsgnNode ) { +// return ((InstAsgnNode)node).getName(); +// } +// +// if ( node instanceof InstVarNode ) { +// return ((InstVarNode)node).getName(); +// } +// +// if ( node instanceof DVarNode ) { +// return ((DVarNode)node).getName(); +// } +// return null; + return getNameReflectively( node ); } /** @@ -654,16 +715,17 @@ * @return */ private String getClassVarRefName( Node node ) { - if ( node instanceof ClassVarNode ) { - return ((ClassVarNode)node).getName(); - } - if ( node instanceof ClassVarDeclNode ) { - return ((ClassVarDeclNode)node).getName(); - } - if ( node instanceof ClassVarAsgnNode ) { - return ((ClassVarAsgnNode)node).getName(); - } - return null; +// if ( node instanceof ClassVarNode ) { +// return ((ClassVarNode)node).getName(); +// } +// if ( node instanceof ClassVarDeclNode ) { +// return ((ClassVarDeclNode)node).getName(); +// } +// if ( node instanceof ClassVarAsgnNode ) { +// return ((ClassVarAsgnNode)node).getName(); +// } +// return null; + return getNameReflectively( node ); } /** @@ -672,14 +734,15 @@ * @return */ private String getGlobalVarRefName( Node node ) { - if ( node instanceof GlobalVarNode ) - { - return ((GlobalVarNode)node).getName(); - } - if ( node instanceof GlobalAsgnNode ) { - return ((GlobalAsgnNode)node).getName(); - } - return null; +// if ( node instanceof GlobalVarNode ) +// { +// return ((GlobalVarNode)node).getName(); +// } +// if ( node instanceof GlobalAsgnNode ) { +// return ((GlobalAsgnNode)node).getName(); +// } +// return null; + return getNameReflectively( node ); } /** @@ -688,19 +751,20 @@ * @return */ private String getMethodRefName( Node node ) { - if ( node instanceof DefnNode ) { - return ((DefnNode)node).getName(); - } - if ( node instanceof DefsNode ) { - return ((DefsNode)node).getName(); - } - if ( node instanceof CallNode ) { - return ((CallNode)node).getName(); - } if ( node instanceof VCallNode ) { return ((VCallNode)node).getMethodName(); } - return null; +// if ( node instanceof DefnNode ) { +// return ((DefnNode)node).getName(); +// } +// if ( node instanceof DefsNode ) { +// return ((DefsNode)node).getName(); +// } +// if ( node instanceof CallNode ) { +// return ((CallNode)node).getName(); +// } +// return null; + return getNameReflectively( node ); } /** @@ -713,8 +777,7 @@ Colon2Node c2node = (Colon2Node) classNode.getCPath(); return c2node.getName(); } - System.err.println("ClassNode.getCPath() returned other than Colon2Node: " + classNode.toString() ); - return null; + throw new RuntimeException("ClassNode.getCPath() returned other than Colon2Node: " + classNode.toString()); } /** @@ -727,27 +790,66 @@ Colon2Node c2node = (Colon2Node) moduleNode.getCPath(); return c2node.getName(); } - System.err.println("ModuleNode.getCPath() returned other than Colon2Node: " + moduleNode.toString() ); - return null; + throw new RuntimeException("ModuleNode.getCPath() returned other than Colon2Node: " + moduleNode.toString()); } /** - * Helper method to get the class name from a const ref node (Class/Module/Const) - * @param constRefNode + * Helper method to get the class name from a const ref node + * @param node * @return */ - private String getConstRefName( Node constRefNode ) { - if ( constRefNode instanceof ClassNode ) + private String getConstRefName( Node node ) { +// if ( constRefNode instanceof ConstNode ) +// { +// return ((ConstNode)node).getName(); +// } +// return null; + return getNameReflectively( node ); + } + + /** + * Helper method to get the class name from a const ref node (Class/Module) + * @param node + * @return + */ + private String getTypeRefName( Node node ) { + if ( node instanceof ClassNode ) { - return getClassNodeName( (ClassNode)constRefNode ); + return getClassNodeName((ClassNode)node); } - if ( constRefNode instanceof ModuleNode ) + if ( node instanceof ModuleNode ) { - return getModuleNodeName( (ModuleNode)constRefNode ); + return getModuleNodeName((ModuleNode)node); } - if ( constRefNode instanceof ConstNode ) - { - return ((ConstNode)constRefNode).getName(); + return getNameReflectively( node ); + } + + /** + * Gets the name of a node by reflectively invoking "getName()" on it; + * helper method just to cut many "instanceof/cast" pairs. + * @param node + * @return name or null + */ + private String getNameReflectively( Node node ) { + try { + Method getNameMethod = node.getClass().getMethod("getName", new Class[]{}); + Object name = getNameMethod.invoke( node, new Object[0] ); + return (String)name; + } catch (SecurityException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (NoSuchMethodException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IllegalArgumentException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IllegalAccessException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (InvocationTargetException e) { + // TODO Auto-generated catch block + e.printStackTrace(); } return null; } Modified: branches/type_inferrence/trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/IOccurrencesFinder.java =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/IOccurrencesFinder.java 2006-07-27 22:00:32 UTC (rev 1546) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/IOccurrencesFinder.java 2006-07-27 22:39:56 UTC (rev 1547) @@ -14,6 +14,7 @@ import java.util.List; import org.eclipse.jface.text.IDocument; +import org.eclipse.jface.text.Position; import org.jruby.ast.Node; import org.rubypeople.rdt.core.IRubyElement; @@ -37,7 +38,7 @@ * * @return List of AST Nodes */ - public List perform(); + public List<Position> perform(); public String getJobLabel(); @@ -74,4 +75,15 @@ public void collectOccurrenceMatches(IRubyElement element, IDocument document, Collection resultingMatches); + + /* Preferences */ + public void setFMarkConstantOccurrences(boolean markConstantOccurrences); + public void setFMarkFieldOccurrences(boolean markFieldOccurrences); + public void setFMarkLocalVariableOccurrences(boolean markLocalVariableOccurrences); + public void setFMarkMethodExitPoints(boolean markMethodExitPoints); + public void setFMarkMethodOccurrences(boolean markMethodOccurrences); + public void setFMarkOccurrenceAnnotations(boolean markOccurrenceAnnotations); + public void setFMarkTypeOccurrences(boolean markTypeOccurrences); + public void setFStickyOccurrenceAnnotations(boolean stickyOccurrenceAnnotations); + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <caw...@us...> - 2006-07-27 22:00:59
|
Revision: 1546 Author: cawilliams Date: 2006-07-27 15:00:32 -0700 (Thu, 27 Jul 2006) ViewCVS: http://svn.sourceforge.net/rubyeclipse/?rev=1546&view=rev Log Message: ----------- add an update to our welcome page on Sourceforge - everybody keeps thinking the project is dead! Modified Paths: -------------- trunk/org.rubypeople.rdt.webpage/htdocs/welcome.php Modified: trunk/org.rubypeople.rdt.webpage/htdocs/welcome.php =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
Revision: 1544 Author: cawilliams Date: 2006-07-22 21:58:15 -0700 (Sat, 22 Jul 2006) ViewCVS: http://svn.sourceforge.net/rubyeclipse/?rev=1544&view=rev Log Message: ----------- make the solution slightly less hacky. Now we create a link to the ruby core stubs inside the project that's doing the code completion. We need to move this link creation into project creation/interpreter choosing. We also need to see if we can enforce that the ruby stubs are read-only. Eventually we need to solidify this link creation to be able to do the same for other external libraries and gems. (and create nice project proprty pages to edit this stuff, and nice little icons like the JDT books and jars) Modified Paths: -------------- branches/type_inferrence/trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/RubyElementRequestor.java Modified: branches/type_inferrence/trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/RubyElementRequestor.java =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/RubyElementRequestor.java 2006-07-22 19:20:42 UTC (rev 1543) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/RubyElementRequestor.java 2006-07-23 04:58:15 UTC (rev 1544) @@ -1,17 +1,9 @@ package org.rubypeople.rdt.internal.codeassist; import java.io.File; -import java.io.FilenameFilter; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import org.eclipse.core.internal.resources.ProjectDescription; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IProjectDescription; -import org.eclipse.core.resources.IWorkspaceRoot; -import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.resources.IFolder; +import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.Path; @@ -25,77 +17,40 @@ private IRubyProject[] projects; - private IRubyProject fDummyProject; - private List fScripts; - public RubyElementRequestor(IRubyProject[] projects) { -// Get path of folder containing ruby stubs + this.projects = projects; + // Get path of folder containing ruby core stubs String dirName = RubyCore.getOSDirectory(RubyCore.getPlugin()) + "ruby/lib"; - // Iterate through the stubs, and create a RubyScript for each one File rubyfolder = new File(dirName); IPath projectPath = new Path(rubyfolder.getAbsolutePath()); - fDummyProject = createRubyCoreProject(projectPath); - fScripts = new ArrayList(); - - File[] scripts = rubyfolder.listFiles(new FilenameFilter() { - - public boolean accept(File dir, String name) { - return name.endsWith(".rb"); + // XXX This is still a big hack. We're adding the ruby core library on demand. We need to add it when the project is created (and/ore interpreter is installed) + IFolder folder = projects[0].getProject().getFolder("ruby_core"); + if (!folder.exists()) { + try { + folder.createLink(projectPath, IResource.ALLOW_MISSING_LOCAL, null); + } catch (CoreException e) { + // TODO Auto-generated catch block + e.printStackTrace(); } - - }); - for (int i = 0; i < scripts.length; i++) { - IPath path = new Path(scripts[i].getAbsolutePath()); - path = path.removeFirstSegments(projectPath.segmentCount()); - IFile file = fDummyProject.getProject().getFile(path); - IRubyScript script = fDummyProject.getRubyScript(file); - fScripts.add(script); } - this.projects = new IRubyProject[projects.length + 1]; - this.projects[0] = fDummyProject; - for (int x = 0; x < projects.length; x++) { - this.projects[x+1] = projects[x]; - } - } - private IRubyProject createRubyCoreProject(IPath location) { - String name = "####internal"; //$NON-NLS-1$ - IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); -// while (true) { - IProject project = root.getProject(name); - if (!project.exists()) { - try { - IProjectDescription desc = ResourcesPlugin.getWorkspace().newProjectDescription(name); - desc.setLocation(location); - project.create(desc, null); - project.open(null); - } catch (CoreException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - return RubyCore.create(project); -// } } public IType findType(String typeName) { try { - for (Iterator iter = fScripts.iterator(); iter.hasNext();) { - IRubyScript script = (IRubyScript) iter.next(); - IType type = findTypeInScript(typeName, script); - if (type != null) return type; - } for (int x = 0; x < projects.length; x++) { IRubyProject project = projects[x]; - System.out.println("Checking project: " + project.getElementName()); + System.out.println("Checking project: " + + project.getElementName()); IRubyScript[] scripts = project.getRubyScripts(); System.out.println("Got " + scripts.length + " scripts"); for (int i = 0; i < scripts.length; i++) { IRubyScript script = scripts[i]; IType type = findTypeInScript(typeName, script); - if (type != null) return type; + if (type != null) + return type; } } } catch (RubyModelException e) { @@ -105,7 +60,8 @@ return null; } - private IType findTypeInScript(String typeName, IRubyScript script) throws RubyModelException { + private IType findTypeInScript(String typeName, IRubyScript script) + throws RubyModelException { System.out.println("Checking for that type inside script: " + script.getElementName()); IType[] types = script.getTypes(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <caw...@us...> - 2006-07-22 19:21:30
|
Revision: 1543 Author: cawilliams Date: 2006-07-22 12:20:42 -0700 (Sat, 22 Jul 2006) ViewCVS: http://svn.sourceforge.net/rubyeclipse/?rev=1543&view=rev Log Message: ----------- add our initial stubs in (eventually we want to generate these dynamically when a new interpreter is chosen) make our code completion create a ruby project dynamically with these stubs in it, and then query that when we resolve a Type name We now have working code completion (very, very hacky)! Modified Paths: -------------- branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/core_stubber.rb branches/type_inferrence/trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/RubyElementRequestor.java Added Paths: ----------- branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/ branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/argumenterror.rb branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/array.rb branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/bignum.rb branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/binding.rb branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/buffering.rb branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/class.rb branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/comparable.rb branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/config.rb branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/continuation.rb branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/data.rb branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/date.rb branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/datetime.rb branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/digest.rb branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/dir.rb branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/enumerable.rb branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/eoferror.rb branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/errno.rb branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/exception.rb branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/falseclass.rb branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/file.rb branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/filetest.rb branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/fileutils.rb branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/fixnum.rb branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/float.rb branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/floatdomainerror.rb branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/forwardable.rb branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/gc.rb branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/gem.rb branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/hash.rb branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/indexerror.rb branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/integer.rb branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/interrupt.rb branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/io.rb branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/ioerror.rb branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/kernel.rb branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/loaderror.rb branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/localjumperror.rb branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/marshal.rb branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/matchdata.rb branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/math.rb branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/method.rb branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/module.rb branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/nameerror.rb branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/nilclass.rb branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/nomemoryerror.rb branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/nomethoderror.rb branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/notimplementederror.rb branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/numeric.rb branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/object.rb branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/objectspace.rb branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/openssl.rb branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/parsedate.rb branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/precision.rb branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/proc.rb branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/process.rb branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/range.rb branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/rangeerror.rb branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/rational.rb branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/regexp.rb branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/regexperror.rb branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/runtimeerror.rb branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/scripterror.rb branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/securityerror.rb branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/signal.rb branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/signalexception.rb branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/singleforwardable.rb branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/standarderror.rb branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/string.rb branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/struct.rb branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/symbol.rb branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/syntaxerror.rb branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/systemcallerror.rb branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/systemexit.rb branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/systemstackerror.rb branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/thread.rb branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/threaderror.rb branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/threadgroup.rb branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/time.rb branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/trueclass.rb branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/typeerror.rb branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/unboundmethod.rb branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/zerodivisionerror.rb Modified: branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/core_stubber.rb =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/core_stubber.rb 2006-07-22 16:33:46 UTC (rev 1542) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/core_stubber.rb 2006-07-22 19:20:42 UTC (rev 1543) @@ -52,7 +52,7 @@ f << "\n" klass.methods(false).each do |method_name| method = eval("#{klass}").method(method_name) rescue nil - print_method(f, method, method_name.to_s, true) + print_method(f, method, method_name.to_s, true) end # TODO Fix it so we can get a hold of the module instance methods properly klass.instance_methods(false).each do |method_name| @@ -74,6 +74,8 @@ method = nil end end + print_method(f, method, method_name.to_s) end + f << "end\n" end end \ No newline at end of file Added: branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/argumenterror.rb =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/argumenterror.rb (rev 0) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/argumenterror.rb 2006-07-22 19:20:42 UTC (rev 1543) @@ -0,0 +1,3 @@ +class ArgumentError < StandardError + +end Added: branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/array.rb =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/array.rb (rev 0) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/array.rb 2006-07-22 19:20:42 UTC (rev 1543) @@ -0,0 +1,148 @@ +class Array < Object + include Enumerable + + def self.[](arg0, arg1, *rest) + end + def concat(arg0) + end + def delete_at(arg0) + end + def include?(arg0) + end + def &(arg0) + end + def reverse_each + end + def flatten + end + def collect! + end + def size + end + def uniq! + end + def first(arg0, arg1, *rest) + end + def collect + end + def fill(arg0, arg1, *rest) + end + def reject! + end + def reverse + end + def *(arg0) + end + def insert(arg0, arg1, *rest) + end + def pack(arg0) + end + def unshift(arg0, arg1, *rest) + end + def compact + end + def transpose + end + def +(arg0) + end + def replace(arg0) + end + def at(arg0) + end + def select(arg0, arg1, *rest) + end + def zip(arg0, arg1, *rest) + end + def pop + end + def uniq + end + def to_s + end + def -(arg0) + end + def eql?(arg0) + end + def index(arg0) + end + def delete_if + end + def map! + end + def indexes(arg0, arg1, *rest) + end + def hash + end + def [](arg0, arg1, *rest) + end + def []=(arg0, arg1, *rest) + end + def last(arg0, arg1, *rest) + end + def |(arg0) + end + def map + end + def assoc(arg0) + end + def <<(arg0) + end + def values_at(arg0, arg1, *rest) + end + def each_index + end + def sort! + end + def length + end + def slice!(arg0, arg1, *rest) + end + def fetch(arg0, arg1, *rest) + end + def reject + end + def delete(arg0) + end + def clear + end + def sort + end + def each + end + def flatten! + end + def join(arg0, arg1, *rest) + end + def shift + end + def empty? + end + def inspect + end + def rindex(arg0) + end + def frozen? + end + def to_ary + end + def <=>(arg0) + end + def indices(arg0, arg1, *rest) + end + def ==(arg0) + end + def reverse! + end + def nitems + end + def slice(arg0, arg1, *rest) + end + def push(arg0, arg1, *rest) + end + def to_a + end + def rassoc(arg0) + end + def compact! + end +end Added: branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/bignum.rb =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/bignum.rb (rev 0) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/bignum.rb 2006-07-22 19:20:42 UTC (rev 1543) @@ -0,0 +1,67 @@ +class Bignum < Integer + include Precision + include Comparable + + def div + end + def ** + end + def eql? + end + def size + end + def - + end + def <=> + end + def remainder + end + def [] + end + def == + end + def hash + end + def / + end + def quo + end + def | + end + def to_s + end + def coerce + end + def % + end + def << + end + def rpower + end + def modulo + end + def & + end + def ~ + end + def >> + end + def ^ + end + def to_f + end + def power! + end + def rdiv + end + def divmod + end + def * + end + def -@ + end + def + + end + def abs + end +end Added: branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/binding.rb =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/binding.rb (rev 0) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/binding.rb 2006-07-22 19:20:42 UTC (rev 1543) @@ -0,0 +1,5 @@ +class Binding < Object + + def clone + end +end Added: branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/buffering.rb =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/buffering.rb (rev 0) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/buffering.rb 2006-07-22 19:20:42 UTC (rev 1543) @@ -0,0 +1,46 @@ +module Buffering + include Enumerable + + def getc + end + def ungetc(arg0) + end + def close + end + def sync=(arg0) + end + def gets(arg0, arg1, *rest) + end + def printf(arg0, arg1, *rest) + end + def read(arg0, arg1, *rest) + end + def readchar + end + def <<(arg0) + end + def puts(arg0, arg1, *rest) + end + def each(arg0, arg1, *rest) + end + def each_byte + end + def readlines(arg0, arg1, *rest) + end + def eof + end + def write(arg0) + end + def each_line(arg0, arg1, *rest) + end + def flush + end + def sync + end + def readline(arg0, arg1, *rest) + end + def eof? + end + def print(arg0, arg1, *rest) + end +end Added: branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/class.rb =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/class.rb (rev 0) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/class.rb 2006-07-22 19:20:42 UTC (rev 1543) @@ -0,0 +1,9 @@ +class Class < Module + + def new(arg0, arg1, *rest) + end + def allocate + end + def superclass + end +end Added: branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/comparable.rb =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/comparable.rb (rev 0) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/comparable.rb 2006-07-22 19:20:42 UTC (rev 1543) @@ -0,0 +1,15 @@ +module Comparable + + def between?(arg0, arg1) + end + def ==(arg0) + end + def >=(arg0) + end + def <(arg0) + end + def <=(arg0) + end + def >(arg0) + end +end Added: branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/config.rb =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/config.rb (rev 0) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/config.rb 2006-07-22 19:20:42 UTC (rev 1543) @@ -0,0 +1,9 @@ +module Config + + def self.gem_original_datadir(arg0) + end + def self.datadir(arg0) + end + def self.expand(arg0, arg1, arg2, *rest) + end +end Added: branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/continuation.rb =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/continuation.rb (rev 0) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/continuation.rb 2006-07-22 19:20:42 UTC (rev 1543) @@ -0,0 +1,7 @@ +class Continuation < Object + + def [] + end + def call + end +end Added: branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/data.rb =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/data.rb (rev 0) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/data.rb 2006-07-22 19:20:42 UTC (rev 1543) @@ -0,0 +1,3 @@ +class Data < Object + +end Added: branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/date.rb =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/date.rb (rev 0) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/date.rb 2006-07-22 19:20:42 UTC (rev 1543) @@ -0,0 +1,15 @@ +class Date < Object + + def self.zone_to_diff(arg0) + end + def self._strptime(arg0, arg1, arg2, *rest) + end + def self._parse(arg0, arg1, arg2, *rest) + end + def asctime + end + def ctime + end + def strftime(arg0, arg1, *rest) + end +end Added: branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/datetime.rb =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/datetime.rb (rev 0) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/datetime.rb 2006-07-22 19:20:42 UTC (rev 1543) @@ -0,0 +1,7 @@ +class DateTime < Date + + def self._strptime(arg0, arg1, arg2, *rest) + end + def strftime(arg0, arg1, *rest) + end +end Added: branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/digest.rb =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/digest.rb (rev 0) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/digest.rb 2006-07-22 19:20:42 UTC (rev 1543) @@ -0,0 +1,3 @@ +module Digest + +end Added: branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/dir.rb =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/dir.rb (rev 0) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/dir.rb 2006-07-22 19:20:42 UTC (rev 1543) @@ -0,0 +1,48 @@ +class Dir < Object + include Enumerable + + def self.mkdir(arg0, arg1, *rest) + end + def self.chdir(arg0, arg1, *rest) + end + def self.[](arg0) + end + def self.chroot(arg0) + end + def self.unlink(arg0) + end + def self.open(arg0) + end + def self.glob(arg0, arg1, *rest) + end + def self.pwd + end + def self.foreach(arg0) + end + def self.delete(arg0) + end + def self.rmdir(arg0) + end + def self.getwd + end + def self.entries(arg0) + end + def close + end + def rewind + end + def pos= + end + def seek + end + def read + end + def each + end + def tell + end + def path + end + def pos + end +end Added: branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/enumerable.rb =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/enumerable.rb (rev 0) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/enumerable.rb 2006-07-22 19:20:42 UTC (rev 1543) @@ -0,0 +1,47 @@ +module Enumerable + + def select(arg0, arg1, *rest) + end + def each_with_index + end + def grep(arg0) + end + def map + end + def find_all + end + def sort_by + end + def collect + end + def detect(arg0, arg1, *rest) + end + def max + end + def to_a + end + def sort + end + def partition + end + def any? + end + def include?(arg0) + end + def reject + end + def zip(arg0, arg1, *rest) + end + def find(arg0, arg1, *rest) + end + def min + end + def member?(arg0) + end + def entries + end + def inject(arg0, arg1, *rest) + end + def all? + end +end Added: branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/eoferror.rb =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/eoferror.rb (rev 0) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/eoferror.rb 2006-07-22 19:20:42 UTC (rev 1543) @@ -0,0 +1,3 @@ +class EOFError < IOError + +end Added: branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/errno.rb =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/errno.rb (rev 0) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/errno.rb 2006-07-22 19:20:42 UTC (rev 1543) @@ -0,0 +1,3 @@ +module Errno + +end Added: branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/exception.rb =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/exception.rb (rev 0) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/exception.rb 2006-07-22 19:20:42 UTC (rev 1543) @@ -0,0 +1,19 @@ +class Exception < Object + + def self.exception(arg0, arg1, *rest) + end + def to_str + end + def backtrace + end + def inspect + end + def message + end + def to_s + end + def exception(arg0, arg1, *rest) + end + def set_backtrace(arg0) + end +end Added: branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/falseclass.rb =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/falseclass.rb (rev 0) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/falseclass.rb 2006-07-22 19:20:42 UTC (rev 1543) @@ -0,0 +1,11 @@ +class FalseClass < Object + + def | + end + def to_s + end + def & + end + def ^ + end +end Added: branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/file.rb =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/file.rb (rev 0) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/file.rb 2006-07-22 19:20:42 UTC (rev 1543) @@ -0,0 +1,123 @@ +class File < IO + include File::Constants + include Enumerable + + def self.writable?(arg0) + end + def self.size(arg0) + end + def self.blockdev?(arg0) + end + def self.mtime(arg0) + end + def self.rename(arg0, arg1) + end + def self.truncate(arg0, arg1) + end + def self.exist?(arg0) + end + def self.grpowned?(arg0) + end + def self.stat(arg0) + end + def self.link(arg0, arg1) + end + def self.executable_real?(arg0) + end + def self.setgid?(arg0) + end + def self.chmod(arg0, arg1, *rest) + end + def self.basename(arg0, arg1, *rest) + end + def self.fnmatch(arg0, arg1, *rest) + end + def self.readable_real?(arg0) + end + def self.socket?(arg0) + end + def self.atime(arg0) + end + def self.unlink(arg0, arg1, *rest) + end + def self.directory?(arg0) + end + def self.owned?(arg0) + end + def self.lchown(arg0, arg1, *rest) + end + def self.executable?(arg0) + end + def self.setuid?(arg0) + end + def self.utime(arg0, arg1, *rest) + end + def self.expand_path(arg0, arg1, *rest) + end + def self.fnmatch?(arg0, arg1, *rest) + end + def self.readable?(arg0) + end + def self.symlink?(arg0) + end + def self.ftype(arg0) + end + def self.readlink(arg0) + end + def self.size?(arg0) + end + def self.lchmod(arg0, arg1, *rest) + end + def self.delete(arg0, arg1, *rest) + end + def self.extname(arg0) + end + def self.writable_real?(arg0) + end + def self.chardev?(arg0) + end + def self.ctime(arg0) + end + def self.umask(arg0, arg1, *rest) + end + def self.split(arg0) + end + def self.join(arg0, arg1, *rest) + end + def self.exists?(arg0) + end + def self.pipe?(arg0) + end + def self.lstat(arg0) + end + def self.symlink(arg0, arg1) + end + def self.file?(arg0) + end + def self.zero?(arg0) + end + def self.sticky?(arg0) + end + def self.chown(arg0, arg1, *rest) + end + def self.dirname(arg0) + end + def mtime + end + def truncate + end + def chmod + end + def atime + end + def flock + end + def ctime + end + def path + end + def lstat + end + def chown + end +end Added: branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/filetest.rb =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/filetest.rb (rev 0) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/filetest.rb 2006-07-22 19:20:42 UTC (rev 1543) @@ -0,0 +1,49 @@ +module FileTest + + def self.writable?(arg0) + end + def self.size(arg0) + end + def self.blockdev?(arg0) + end + def self.exist?(arg0) + end + def self.grpowned?(arg0) + end + def self.executable_real?(arg0) + end + def self.setgid?(arg0) + end + def self.readable_real?(arg0) + end + def self.socket?(arg0) + end + def self.directory?(arg0) + end + def self.owned?(arg0) + end + def self.executable?(arg0) + end + def self.setuid?(arg0) + end + def self.readable?(arg0) + end + def self.symlink?(arg0) + end + def self.size?(arg0) + end + def self.writable_real?(arg0) + end + def self.chardev?(arg0) + end + def self.exists?(arg0) + end + def self.pipe?(arg0) + end + def self.file?(arg0) + end + def self.zero?(arg0) + end + def self.sticky?(arg0) + end +end Added: branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/fileutils.rb =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/fileutils.rb (rev 0) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/fileutils.rb 2006-07-22 19:20:42 UTC (rev 1543) @@ -0,0 +1,81 @@ +module FileUtils + + def mkdir(arg0, arg1, arg2, *rest) + end + def remove_file(arg0, arg1, arg2, *rest) + end + def chdir(arg0, arg1, arg2, *rest) + end + def uptodate?(arg0, arg1, arg2, arg3, *rest) + end + def link(arg0, arg1, arg2, arg3, *rest) + end + def cp_r(arg0, arg1, arg2, arg3, *rest) + end + def rm_r(arg0, arg1, arg2, *rest) + end + def cp(arg0, arg1, arg2, arg3, *rest) + end + def identical?(arg0, arg1) + end + def chmod(arg0, arg1, arg2, arg3, *rest) + end + def mkdir_p(arg0, arg1, arg2, *rest) + end + def ln(arg0, arg1, arg2, arg3, *rest) + end + def copy(arg0, arg1, arg2, arg3, *rest) + end + def mv(arg0, arg1, arg2, arg3, *rest) + end + def rmtree(arg0, arg1, arg2, *rest) + end + def touch(arg0, arg1, arg2, *rest) + end + def makedirs(arg0, arg1, arg2, *rest) + end + def copy_file(arg0, arg1, arg2, arg3, *rest) + end + def safe_unlink(arg0, arg1, arg2, *rest) + end + def ln_sf(arg0, arg1, arg2, arg3, *rest) + end + def copy_entry(arg0, arg1, arg2, arg3, *rest) + end + def rm(arg0, arg1, arg2, *rest) + end + def pwd + end + def rm_rf(arg0, arg1, arg2, *rest) + end + def install(arg0, arg1, arg2, arg3, *rest) + end + def cd(arg0, arg1, arg2, *rest) + end + def mkpath(arg0, arg1, arg2, *rest) + end + def rm_f(arg0, arg1, arg2, *rest) + end + def rmdir(arg0, arg1, arg2, *rest) + end + def ln_s(arg0, arg1, arg2, arg3, *rest) + end + def move(arg0, arg1, arg2, arg3, *rest) + end + def compare_file(arg0, arg1) + end + def getwd + end + def symlink(arg0, arg1, arg2, arg3, *rest) + end + def copy_stream(arg0, arg1) + end + def remove_dir(arg0, arg1, arg2, *rest) + end + def cmp(arg0, arg1) + end + def remove(arg0, arg1, arg2, *rest) + end + def compare_stream(arg0, arg1) + end +end Added: branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/fixnum.rb =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/fixnum.rb (rev 0) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/fixnum.rb 2006-07-22 19:20:42 UTC (rev 1543) @@ -0,0 +1,75 @@ +class Fixnum < Integer + include Precision + include Comparable + + def self.induced_from(arg0) + end + def div + end + def ** + end + def size + end + def - + end + def <=> + end + def == + end + def [] + end + def / + end + def quo + end + def | + end + def to_s + end + def % + end + def << + end + def rpower + end + def modulo + end + def >= + end + def < + end + def ~ + end + def & + end + def >> + end + def <= + end + def ^ + end + def to_f + end + def to_sym + end + def > + end + def rdiv + end + def power! + end + def divmod + end + def * + end + def id2name + end + def -@ + end + def + + end + def abs + end + def zero? + end +end Added: branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/float.rb =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/float.rb (rev 0) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/float.rb 2006-07-22 19:20:42 UTC (rev 1543) @@ -0,0 +1,69 @@ +class Float < Numeric + include Precision + include Comparable + + def self.induced_from(arg0) + end + def ** + end + def eql? + end + def truncate + end + def - + end + def <=> + end + def == + end + def hash + end + def to_int + end + def / + end + def round + end + def to_s + end + def coerce + end + def % + end + def finite? + end + def modulo + end + def >= + end + def < + end + def <= + end + def to_f + end + def ceil + end + def > + end + def infinite? + end + def divmod + end + def * + end + def to_i + end + def floor + end + def -@ + end + def + + end + def abs + end + def zero? + end + def nan? + end +end Added: branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/floatdomainerror.rb =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/floatdomainerror.rb (rev 0) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/floatdomainerror.rb 2006-07-22 19:20:42 UTC (rev 1543) @@ -0,0 +1,3 @@ +class FloatDomainError < RangeError + +end Added: branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/forwardable.rb =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/forwardable.rb (rev 0) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/forwardable.rb 2006-07-22 19:20:42 UTC (rev 1543) @@ -0,0 +1,15 @@ +module Forwardable + + def self.debug + end + def self.debug=(arg0) + end + def def_delegators(arg0, arg1, arg2, *rest) + end + def def_instance_delegator(arg0, arg1, arg2, arg3, *rest) + end + def def_delegator(arg0, arg1, arg2, arg3, *rest) + end + def def_instance_delegators(arg0, arg1, arg2, *rest) + end +end Added: branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/gc.rb =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/gc.rb (rev 0) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/gc.rb 2006-07-22 19:20:42 UTC (rev 1543) @@ -0,0 +1,11 @@ +module GC + + def self.disable + end + def self.start + end + def self.enable + end + def garbage_collect + end +end Added: branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/gem.rb =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/gem.rb (rev 0) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/gem.rb 2006-07-22 19:20:42 UTC (rev 1543) @@ -0,0 +1,45 @@ +module Gem + + def self.dir + end + def self.activate(arg0, arg1, arg2, arg3, *rest) + end + def self.latest_load_paths + end + def self.source_index + end + def self.use_paths(arg0, arg1, arg2, *rest) + end + def self.default_dir + end + def self.cache + end + def self.configuration + end + def self.ensure_ssl_available + end + def self.manage_gems + end + def self.user_home + end + def self.ruby + end + def self.all_load_paths + end + def self.datadir(arg0) + end + def self.clear_paths + end + def self.required_location(arg0, arg1, arg2, arg3, *rest) + end + def self.config_file + end + def self.configuration=(arg0) + end + def self.path + end + def self.ssl_available=(arg0) + end + def self.ssl_available? + end +end Added: branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/hash.rb =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/hash.rb (rev 0) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/hash.rb 2006-07-22 19:20:42 UTC (rev 1543) @@ -0,0 +1,96 @@ +class Hash < Object + include Enumerable + + def self.[](arg0, arg1, *rest) + end + def default_proc + end + def size + end + def values_at(arg0, arg1, *rest) + end + def select(arg0, arg1, *rest) + end + def inspect + end + def indices(arg0, arg1, *rest) + end + def has_key?(arg0) + end + def ==(arg0) + end + def [](arg0) + end + def each_pair + end + def []=(arg0, arg1) + end + def store(arg0, arg1) + end + def length + end + def empty? + end + def replace(arg0) + end + def to_s + end + def default(arg0, arg1, *rest) + end + def indexes(arg0, arg1, *rest) + end + def update(arg0) + end + def each + end + def each_key + end + def shift + end + def delete_if + end + def to_hash + end + def value?(arg0) + end + def to_a + end + def default=(arg0) + end + def sort + end + def delete(arg0) + end + def clear + end + def invert + end + def merge!(arg0) + end + def include?(arg0) + end + def key?(arg0) + end + def each_value + end + def reject + end + def reject! + end + def rehash + end + def fetch(arg0, arg1, *rest) + end + def index(arg0) + end + def keys + end + def merge(arg0) + end + def member?(arg0) + end + def has_value?(arg0) + end + def values + end +end Added: branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/indexerror.rb =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/indexerror.rb (rev 0) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/indexerror.rb 2006-07-22 19:20:42 UTC (rev 1543) @@ -0,0 +1,3 @@ +class IndexError < StandardError + +end Added: branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/integer.rb =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/integer.rb (rev 0) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/integer.rb 2006-07-22 19:20:42 UTC (rev 1543) @@ -0,0 +1,49 @@ +class Integer < Numeric + include Precision + include Comparable + + def self.induced_from(arg0) + end + def truncate + end + def gcd2 + end + def upto + end + def integer? + end + def times + end + def succ + end + def to_int + end + def denominator + end + def lcm + end + def round + end + def to_bn + end + def downto + end + def ceil + end + def gcd + end + def next + end + def numerator + end + def to_r + end + def to_i + end + def floor + end + def chr + end + def gcdlcm + end +end Added: branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/interrupt.rb =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/interrupt.rb (rev 0) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/interrupt.rb 2006-07-22 19:20:42 UTC (rev 1543) @@ -0,0 +1,3 @@ +class Interrupt < SignalException + +end Added: branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/io.rb =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/io.rb (rev 0) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/io.rb 2006-07-22 19:20:42 UTC (rev 1543) @@ -0,0 +1,121 @@ +class IO < Object + include File::Constants + include Enumerable + + def self.select(arg0, arg1, *rest) + end + def self.for_fd(arg0, arg1, *rest) + end + def self.new(arg0, arg1, *rest) + end + def self.read(arg0, arg1, *rest) + end + def self.pipe + end + def self.open(arg0, arg1, *rest) + end + def self.sysopen(arg0, arg1, *rest) + end + def self.readlines(arg0, arg1, *rest) + end + def self.foreach(arg0, arg1, *rest) + end + def self.popen(arg0, arg1, *rest) + end + def getc + end + def ungetc + end + def close + end + def fsync + end + def sync= + end + def gets + end + def rewind + end + def pos= + end + def sysseek + end + def inspect + end + def stat + end + def printf + end + def syswrite + end + def seek + end + def close_write + end + def tty? + end + def read + end + def readchar + end + def closed? + end + def pid + end + def puts + end + def to_io + end + def << + end + def binmode + end + def reopen + end + def each + end + def each_byte + end + def tell + end + def close_read + end + def lineno + end + def readlines + end + def write + end + def eof + end + def fcntl + end + def putc + end + def fileno + end + def each_line + end + def flush + end + def to_i + end + def sync + end + def lineno= + end + def readline + end + def pos + end + def eof? + end + def ioctl + end + def print + end + def sysread + end + def isatty + end +end Added: branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/ioerror.rb =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/ioerror.rb (rev 0) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/ioerror.rb 2006-07-22 19:20:42 UTC (rev 1543) @@ -0,0 +1,3 @@ +class IOError < StandardError + +end Added: branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/kernel.rb =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/kernel.rb (rev 0) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/kernel.rb 2006-07-22 19:20:42 UTC (rev 1543) @@ -0,0 +1,219 @@ +module Kernel + + def self.String(arg0) + end + def self.iterator? + end + def self.at_exit + end + def self.sub(arg0, arg1, *rest) + end + def self.callcc + end + def self.getc + end + def self.select(arg0, arg1, *rest) + end + def self.lambda + end + def self.fail(arg0, arg1, *rest) + end + def self.chop! + end + def self.scan(arg0) + end + def self.gets(arg0, arg1, *rest) + end + def self.sleep(arg0, arg1, *rest) + end + def self.load(arg0, arg1, *rest) + end + def self.global_variables + end + def self.chomp(arg0, arg1, *rest) + end + def self.printf(arg0, arg1, *rest) + end + def self.exit!(arg0, arg1, *rest) + end + def self.Float(arg0) + end + def self.abort(arg0, arg1, *rest) + end + def self.p(arg0, arg1, *rest) + end + def self.rand(arg0, arg1, *rest) + end + def self.fork + end + def self.proc + end + def self.raise(arg0, arg1, *rest) + end + def self.set_trace_func(arg0) + end + def self.gsub!(arg0, arg1, *rest) + end + def self.warn(arg0) + end + def self.puts(arg0, arg1, *rest) + end + def self.system(arg0, arg1, *rest) + end + def self.format(arg0, arg1, *rest) + end + def self.throw(arg0, arg1, *rest) + end + def self.chop + end + def self.open(arg0, arg1, *rest) + end + def self.Integer(arg0) + end + def self.exit(arg0, arg1, *rest) + end + def self.readlines(arg0, arg1, *rest) + end + def self.srand(arg0, arg1, *rest) + end + def self.autoload(arg0, arg1) + end + def self.binding + end + def self.untrace_var(arg0, arg1, *rest) + end + def self.sub!(arg0, arg1, *rest) + end + def self.putc(arg0) + end + def self.test(arg0, arg1, *rest) + end + def self.sprintf(arg0, arg1, *rest) + end + def self.Array(arg0) + end + def self.eval(arg0, arg1, *rest) + end + def self.block_given? + end + def self.catch(arg0) + end + def self.gsub(arg0, arg1, *rest) + end + def self.split(arg0, arg1, *rest) + end + def self.syscall(arg0, arg1, *rest) + end + def self.`(arg0) + end + def self.trap(arg0, arg1, *rest) + end + def self.method_missing(arg0, arg1, *rest) + end + def self.caller(arg0, arg1, *rest) + end + def self.chomp!(arg0, arg1, *rest) + end + def self.readline(arg0, arg1, *rest) + end + def self.require(arg0) + end + def self.autoload?(arg0) + end + def self.loop + end + def self.local_variables + end + def self.trace_var(arg0, arg1, *rest) + end + def self.print(arg0, arg1, *rest) + end + def self.exec(arg0, arg1, *rest) + end + def clone + end + def protected_methods(arg0, arg1, *rest) + end + def freeze + end + def instance_variable_set(arg0, arg1) + end + def is_a?(arg0) + end + def type + end + def methods(arg0, arg1, *rest) + end + def =~(arg0) + end + def send(arg0, arg1, *rest) + end + def instance_of?(arg0) + end + def __id__ + end + def instance_variables + end + def to_s + end + def eql?(arg0) + end + def dup + end + def hash + end + def private_methods(arg0, arg1, *rest) + end + def require_gem(arg0, arg1, arg2, *rest) + end + def require(arg0) + end + def nil? + end + def tainted? + end + def class + end + def singleton_methods(arg0, arg1, *rest) + end + def display(arg0, arg1, *rest) + end + def extend(arg0, arg1, *rest) + end + def instance_eval(arg0, arg1, *rest) + end + def untaint + end + def __send__(arg0, arg1, *rest) + end + def method(arg0) + end + def instance_variable_get(arg0) + end + def object_id + end + def kind_of?(arg0) + end + def inspect + end + def taint + end + def frozen? + end + def gem(arg0, arg1, arg2, *rest) + end + def ==(arg0) + end + def public_methods(arg0, arg1, *rest) + end + def id + end + def respond_to?(arg0, arg1, *rest) + end + def ===(arg0) + end + def equal?(arg0) + end + def to_a + end +end Added: branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/loaderror.rb =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/loaderror.rb (rev 0) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/loaderror.rb 2006-07-22 19:20:42 UTC (rev 1543) @@ -0,0 +1,3 @@ +class LoadError < ScriptError + +end Added: branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/localjumperror.rb =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/localjumperror.rb (rev 0) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/localjumperror.rb 2006-07-22 19:20:42 UTC (rev 1543) @@ -0,0 +1,7 @@ +class LocalJumpError < StandardError + + def reason + end + def exit_value + end +end Added: branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/marshal.rb =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/marshal.rb (rev 0) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/marshal.rb 2006-07-22 19:20:42 UTC (rev 1543) @@ -0,0 +1,9 @@ +module Marshal + + def self.load(arg0, arg1, *rest) + end + def self.dump(arg0, arg1, *rest) + end + def self.restore(arg0, arg1, *rest) + end +end Added: branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/matchdata.rb =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/matchdata.rb (rev 0) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/matchdata.rb 2006-07-22 19:20:42 UTC (rev 1543) @@ -0,0 +1,33 @@ +class MatchData < Object + + def size + end + def select + end + def values_at + end + def post_match + end + def begin + end + def inspect + end + def [] + end + def length + end + def pre_match + end + def offset + end + def to_s + end + def captures + end + def to_a + end + def string + end + def end + end +end Added: branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/math.rb =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/math.rb (rev 0) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/math.rb 2006-07-22 19:20:42 UTC (rev 1543) @@ -0,0 +1,47 @@ +module Math + + def self.atan2(arg0, arg1) + end + def self.asinh(arg0) + end + def self.cosh(arg0) + end + def self.ldexp(arg0, arg1) + end + def self.tan(arg0) + end + def self.log(arg0) + end + def self.acosh(arg0) + end + def self.erfc(arg0) + end + def self.atan(arg0) + end + def self.frexp(arg0) + end + def self.sin(arg0) + end + def self.exp(arg0) + end + def self.tanh(arg0) + end + def self.erf(arg0) + end + def self.asin(arg0) + end + def self.sqrt(arg0) + end + def self.cos(arg0) + end + def self.atanh(arg0) + end + def self.sinh(arg0) + end + def self.hypot(arg0, arg1) + end + def self.acos(arg0) + end + def self.log10(arg0) + end +end Added: branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/method.rb =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/method.rb (rev 0) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/method.rb 2006-07-22 19:20:42 UTC (rev 1543) @@ -0,0 +1,21 @@ +class Method < Object + + def arity + end + def inspect + end + def == + end + def [] + end + def call + end + def to_s + end + def unbind + end + def clone + end + def to_proc + end +end Added: branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/module.rb =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/module.rb (rev 0) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/module.rb 2006-07-22 19:20:42 UTC (rev 1543) @@ -0,0 +1,75 @@ +class Module < Object + + def self.constants + end + def self.nesting + end + def public_method_defined?(arg0) + end + def <=>(arg0) + end + def constants + end + def module_eval(arg0, arg1, *rest) + end + def freeze + end + def ==(arg0) + end + def instance_methods(arg0, arg1, *rest) + end + def ===(arg0) + end + def method_defined?(arg0) + end + def to_s + end + def included_modules + end + def private_instance_methods(arg0, arg1, *rest) + end + def private_class_method(arg0, arg1, *rest) + end + def instance_method(arg0) + end + def <(arg0) + end + def >=(arg0) + end + def class_variables + end + def protected_method_defined?(arg0) + end + def <=(arg0) + end + def ancestors + end + def const_set(arg0, arg1) + end + def autoload(arg0, arg1) + end + def >(arg0) + end + def include?(arg0) + end + def protected_instance_methods(arg0, arg1, *rest) + end + def public_class_method(arg0, arg1, *rest) + end + def const_missing(arg0) + end + def private_method_defined?(arg0) + end + def name + end + def const_get(arg0) + end + def const_defined?(arg0) + end + def class_eval(arg0, arg1, *rest) + end + def autoload?(arg0) + end + def public_instance_methods(arg0, arg1, *rest) + end +end Added: branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/nameerror.rb =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/nameerror.rb (rev 0) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/nameerror.rb 2006-07-22 19:20:42 UTC (rev 1543) @@ -0,0 +1,7 @@ +class NameError < StandardError + + def to_s + end + def name + end +end Added: branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/nilclass.rb =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/nilclass.rb (rev 0) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/nilclass.rb 2006-07-22 19:20:42 UTC (rev 1543) @@ -0,0 +1,21 @@ +class NilClass < Object + + def inspect + end + def | + end + def to_s + end + def & + end + def to_f + end + def ^ + end + def nil? + end + def to_a + end + def to_i + end +end Added: branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/nomemoryerror.rb =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/nomemoryerror.rb (rev 0) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/nomemoryerror.rb 2006-07-22 19:20:42 UTC (rev 1543) @@ -0,0 +1,3 @@ +class NoMemoryError < Exception + +end Added: branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/nomethoderror.rb =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/nomethoderror.rb (rev 0) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/nomethoderror.rb 2006-07-22 19:20:42 UTC (rev 1543) @@ -0,0 +1,5 @@ +class NoMethodError < NameError + + def args + end +end Added: branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/notimplementederror.rb =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/notimplementederror.rb (rev 0) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/notimplementederror.rb 2006-07-22 19:20:42 UTC (rev 1543) @@ -0,0 +1,3 @@ +class NotImplementedError < ScriptError + +end Added: branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/numeric.rb =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/numeric.rb (rev 0) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/numeric.rb 2006-07-22 19:20:42 UTC (rev 1543) @@ -0,0 +1,46 @@ +class Numeric < Object + include Comparable + + def eql?(arg0) + end + def div(arg0) + end + def truncate + end + def <=>(arg0) + end + def remainder(arg0) + end + def to_int + end + def integer? + end + def quo(arg0) + end + def round + end + def coerce(arg0) + end + def modulo(arg0) + end + def singleton_method_added(arg0) + end + def ceil + end + def nonzero? + end + def divmod(arg0) + end + def step(arg0, arg1, *rest) + end + def +@ + end + def floor + end + def -@ + end + def abs + end + def zero? + end +end Added: branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/object.rb =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/object.rb (rev 0) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/object.rb 2006-07-22 19:20:42 UTC (rev 1543) @@ -0,0 +1,4 @@ +class Object + include Kernel + +end Added: branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/objectspace.rb =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/objectspace.rb (rev 0) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/objectspace.rb 2006-07-22 19:20:42 UTC (rev 1543) @@ -0,0 +1,21 @@ +module ObjectSpace + + def self.undefine_finalizer(arg0) + end + def self.remove_finalizer(arg0) + end + def self.garbage_collect + end + def self.define_finalizer(arg0, arg1, *rest) + end + def self.add_finalizer(arg0) + end + def self.call_finalizer(arg0) + end + def self.each_object(arg0, arg1, *rest) + end + def self._id2ref(arg0) + end + def self.finalizers + end +end Added: branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/openssl.rb =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/openssl.rb (rev 0) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/openssl.rb 2006-07-22 19:20:42 UTC (rev 1543) @@ -0,0 +1,7 @@ +module OpenSSL + + def self.debug + end + def self.debug=(arg0) + end +end Added: branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/parsedate.rb =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/parsedate.rb (rev 0) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/parsedate.rb 2006-07-22 19:20:42 UTC (rev 1543) @@ -0,0 +1,5 @@ +module ParseDate + + def self.parsedate(arg0, arg1, arg2, *rest) + end +end Added: branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/precision.rb =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/precision.rb (rev 0) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/precision.rb 2006-07-22 19:20:42 UTC (rev 1543) @@ -0,0 +1,11 @@ +module Precision + + def self.included(arg0) + end + def prec_f + end + def prec_i + end + def prec(arg0) + end +end Added: branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/proc.rb =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/proc.rb (rev 0) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/proc.rb 2006-07-22 19:20:42 UTC (rev 1543) @@ -0,0 +1,23 @@ +class Proc < Object + + def self.new(arg0, arg1, *rest) + end + def arity + end + def [] + end + def == + end + def dup + end + def call + end + def to_s + end + def clone + end + def binding + end + def to_proc + end +end Added: branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/process.rb =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/process.rb (rev 0) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/process.rb 2006-07-22 19:20:42 UTC (rev 1543) @@ -0,0 +1,71 @@ +module Process + + def self.waitpid(arg0, arg1, *rest) + end + def self.initgroups(arg0, arg1) + end + def self.groups=(arg0) + end + def self.getpriority(arg0, arg1) + end + def self.exit!(arg0, arg1, *rest) + end + def self.detach(arg0) + end + def self.setpgrp + end + def self.gid + end + def self.times + end + def self.fork + end + def self.abort(arg0, arg1, *rest) + end + def self.wait2(arg0, arg1, *rest) + end + def self.pid + end + def self.egid + end + def self.setsid + end + def self.waitall + end + def self.getpgrp + end + def self.uid + end + def self.gid=(arg0) + end + def self.maxgroups + end + def self.exit(arg0, arg1, *rest) + end + def self.wait(arg0, arg1, *rest) + end + def self.euid + end + def self.egid=(arg0) + end + def self.setpgid(arg0, arg1) + end + def self.kill(arg0, arg1, *rest) + end + def self.waitpid2(arg0, arg1, *rest) + end + def self.ppid + end + def self.uid=(arg0) + end + def self.groups + end + def self.maxgroups=(arg0) + end + def self.setpriority(arg0, arg1, arg2) + end + def self.euid=(arg0) + end + def self.getpgid(arg0) + end +end Added: branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/range.rb =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/range.rb (rev 0) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/range.rb 2006-07-22 19:20:42 UTC (rev 1543) @@ -0,0 +1,34 @@ +class Range < Object + include Enumerable + + def eql? + end + def begin + end + def inspect + end + def == + end + def hash + end + def exclude_end? + end + def === + end + def last + end + def to_s + end + def each + end + def first + end + def include? + end + def step + end + def end + end + def member? + end +end Added: branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/rangeerror.rb =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/rangeerror.rb (rev 0) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/rangeerror.rb 2006-07-22 19:20:42 UTC (rev 1543) @@ -0,0 +1,3 @@ +class RangeError < StandardError + +end Added: branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/rational.rb =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/rational.rb (rev 0) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/rational.rb 2006-07-22 19:20:42 UTC (rev 1543) @@ -0,0 +1,46 @@ +class Rational < Numeric + include Comparable + + def self.new!(arg0, arg1, arg2, *rest) + end + def self.reduce(arg0, arg1, arg2, *rest) + end + def ** + end + def - + end + def <=> + end + def inspect + end + def == + end + def hash + end + def denominator + end + def / + end + def % + end + def coerce + end + def to_s + end + def to_f + end + def to_r + end + def numerator + end + def divmod + end + def * + end + def to_i + end + def + + end + def abs + end +end Added: branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/regexp.rb =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/regexp.rb (rev 0) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/regexp.rb 2006-07-22 19:20:42 UTC (rev 1543) @@ -0,0 +1,39 @@ +class Regexp < Object + + def self.last_match(arg0, arg1, *rest) + end + def self.compile(arg0, arg1, *rest) + end + def self.union(arg0, arg1, *rest) + end + def self.escape(arg0, arg1, *rest) + end + def self.quote(arg0, arg1, *rest) + end + def eql? + end + def kcode + end + def inspect + end + def casefold? + end + def hash + end + def == + end + def === + end + def options + end + def to_s + end + def ~ + end + def match + end + def =~ + end + def source + end +end Added: branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/regexperror.rb =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/regexperror.rb (rev 0) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/regexperror.rb 2006-07-22 19:20:42 UTC (rev 1543) @@ -0,0 +1,3 @@ +class RegexpError < StandardError + +end Added: branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/runtimeerror.rb =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/runtimeerror.rb (rev 0) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/runtimeerror.rb 2006-07-22 19:20:42 UTC (rev 1543) @@ -0,0 +1,3 @@ +class RuntimeError < StandardError + +end Added: branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/lib/scripterror.rb =================================================================== --- branches/type_... [truncated message content] |
|
From: <caw...@us...> - 2006-07-22 16:33:51
|
Revision: 1542 Author: cawilliams Date: 2006-07-22 09:33:46 -0700 (Sat, 22 Jul 2006) ViewCVS: http://svn.sourceforge.net/rubyeclipse/?rev=1542&view=rev Log Message: ----------- add entry to plugin.xml for the warnings preference page Modified Paths: -------------- branches/type_inferrence/trunk/org.rubypeople.rdt.ui/plugin.properties branches/type_inferrence/trunk/org.rubypeople.rdt.ui/plugin.xml Modified: branches/type_inferrence/trunk/org.rubypeople.rdt.ui/plugin.properties =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.ui/plugin.properties 2006-07-22 01:51:51 UTC (rev 1541) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.ui/plugin.properties 2006-07-22 16:33:46 UTC (rev 1542) @@ -30,9 +30,8 @@ viewCategoryName=Ruby appearancePrefName=Appearance -problemSeveritiesPageName=Errors/Warnings +problemSeveritiesPrefName=Errors/Warnings - preferenceKeywords.general=Ruby resources call type hierarchy refactoring search preferenceKeywords.appearance=Ruby appearance resources browsing preferenceKeywords.sortorder=Ruby member sort order appearance Modified: branches/type_inferrence/trunk/org.rubypeople.rdt.ui/plugin.xml =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.ui/plugin.xml 2006-07-22 01:51:51 UTC (rev 1541) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.ui/plugin.xml 2006-07-22 16:33:46 UTC (rev 1542) @@ -87,6 +87,13 @@ id="org.rubypeople.rdt.ui.preferences.MarkOccurrencesPreferencePage"> <keywordReference id="org.rubypeople.rdt.ui.markoccurrences"/> </page> + <page + name="%problemSeveritiesPrefName" + category="org.rubypeople.rdt.ui.preferences.PreferencePageRubyBase" + class="org.rubypeople.rdt.internal.ui.preferences.ProblemSeveritiesPreferencePage" + id="org.rubypeople.rdt.ui.preferences.ProblemSeveritiesPreferencePage"> + <keywordReference id="org.rubypeople.rdt.ui.severities"/> + </page> </extension> <!-- =========================================================================== --> <!-- Ruby Perspective --> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <caw...@us...> - 2006-07-22 01:51:59
|
Revision: 1541 Author: cawilliams Date: 2006-07-21 18:51:51 -0700 (Fri, 21 Jul 2006) ViewCVS: http://svn.sourceforge.net/rubyeclipse/?rev=1541&view=rev Log Message: ----------- Add in a new ruby script meant to query the ruby interpreter and generate stub ruby scripts (so we can later parse it into the RubyModel and use that for code completion, etc). Added Paths: ----------- branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/ branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/core_stubber.rb Added: branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/core_stubber.rb =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/core_stubber.rb (rev 0) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.core/ruby/core_stubber.rb 2006-07-22 01:51:51 UTC (rev 1541) @@ -0,0 +1,79 @@ +OUTPUT_PATH = "ruby/lib/" + +def file_name(klass) + file_name = OUTPUT_PATH + klass.to_s.downcase + file_name.gsub!("::", "/") + file_name << ".rb" + return file_name +end + +def dir_names(file_name) + last_slash = file_name.rindex("/") + return nil if last_slash.nil? + file_name[0...last_slash] +end + +def print_method(f, method, method_name, singleton = false) + f << " def " + f << "self." if singleton + f << method_name.to_s + if !method.nil? and method.arity != 0 + # TODO We need to handle methods that take blocks! + f << "(" + if method.arity < 0 + args = [] + (method.arity.abs + 1).times {|i| args << "arg#{i}" } + args << "*rest" + f << args.join(", ") + else + args = [] + method.arity.times {|i| args << "arg#{i}" } + f << args.join(", ") + end + f << ")" + end + f << "\n end\n" +end + +require 'FileUtils' +@klasses = Module.constants.select {|c| ["Class", "Module"].include?(eval("#{c}.class").to_s) } +@klasses = @klasses.collect {|k| eval("#{k}")} +@klasses = @klasses.uniq.sort_by {|klass| klass.to_s } +@klasses.each do |klass| + next if klass.to_s[0].chr == "f" # TODO Skip if first char is lowercase + file_name = file_name(klass) + dirs = dir_names(file_name) + FileUtils.mkdir_p(dirs) if !dirs.nil? and !File.exist?(file_name) + open(file_name, 'w') do |f| + f << "#{klass.class.to_s.downcase} #{klass}" + f << " < #{klass.superclass.to_s }" if klass.respond_to?(:superclass) and !klass.superclass.nil? + f << "\n" + klass.included_modules.each {|mod| f << " include #{mod.to_s}\n" unless mod.to_s == "Kernel" && klass.to_s != "Object"} + f << "\n" + klass.methods(false).each do |method_name| + method = eval("#{klass}").method(method_name) rescue nil + print_method(f, method, method_name.to_s, true) + end + # TODO Fix it so we can get a hold of the module instance methods properly + klass.instance_methods(false).each do |method_name| + begin + obj = if klass.class.to_s == "Module" then klass else klass.new end + method = obj.method(method_name.to_s) + rescue StandardError => e + puts e + # TODO If we can't create an instance of a class, generate dynamic subclass where we can, and then + # grab methods from there + begin + # If we're a module, we may need to force the function to be more visible to grab it + obj.module_eval do + module_function(method_name.to_s) + end + method = obj.method(method_name.to_s) + rescue StandardError => e + puts e + method = nil + end + end + end + end +end \ 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-07-22 01:49:42
|
Revision: 1540 Author: cawilliams Date: 2006-07-21 18:49:23 -0700 (Fri, 21 Jul 2006) ViewCVS: http://svn.sourceforge.net/rubyeclipse/?rev=1540&view=rev Log Message: ----------- add some hacks so we handle periods properly for code completion. (we hack off the period and do some offset adjustments) So now we properly find an inferred type in the same project and grab all the methods on it. (Now we just need to handle searching referenced projects and the ruby core) Modified Paths: -------------- branches/type_inferrence/trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyScript.java Added Paths: ----------- branches/type_inferrence/trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/RubyElementRequestor.java Added: branches/type_inferrence/trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/RubyElementRequestor.java =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/RubyElementRequestor.java (rev 0) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/RubyElementRequestor.java 2006-07-22 01:49:23 UTC (rev 1540) @@ -0,0 +1,43 @@ +package org.rubypeople.rdt.internal.codeassist; + +import org.rubypeople.rdt.core.IRubyProject; +import org.rubypeople.rdt.core.IRubyScript; +import org.rubypeople.rdt.core.IType; +import org.rubypeople.rdt.core.RubyModelException; + +public class RubyElementRequestor { + + private IRubyProject[] projects; + + public RubyElementRequestor(IRubyProject[] projects) { + this.projects = projects; + } + + public IType findType(String typeName) { + try { + for (int x = 0; x < projects.length; x++) { + IRubyProject project = projects[x]; + IRubyScript[] scripts = project.getRubyScripts(); + System.out.println("Got " + scripts.length + " scripts"); + for (int i = 0; i < scripts.length; i++) { + IRubyScript script = scripts[i]; + System.out.println("Checking for that type inside script: " + + script.getElementName()); + IType[] types = script.getTypes(); + for (int j = 0; j < types.length; j++) { + IType type = types[j]; + if (!type.getElementName().equals(typeName)) + continue; + return type; + + } + } + } + } catch (RubyModelException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return null; + } + +} Modified: branches/type_inferrence/trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyScript.java =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyScript.java 2006-07-21 00:57:04 UTC (rev 1539) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyScript.java 2006-07-22 01:49:23 UTC (rev 1540) @@ -59,6 +59,7 @@ import org.rubypeople.rdt.core.RubyCore; import org.rubypeople.rdt.core.RubyModelException; import org.rubypeople.rdt.core.WorkingCopyOwner; +import org.rubypeople.rdt.internal.codeassist.RubyElementRequestor; import org.rubypeople.rdt.internal.core.buffer.BufferManager; import org.rubypeople.rdt.internal.core.parser.RubyParser; import org.rubypeople.rdt.internal.core.util.Util; @@ -664,44 +665,38 @@ public void codeComplete(int offset, CompletionRequestor requestor) throws RubyModelException { if (offset < 0) offset = 0; ITypeInferrer inferrer = new DefaultTypeInferrer(); - List<ITypeGuess> guesses = inferrer.infer(new String(getContents()), offset); - // FIXME We're doing some ugly hacky searching for methods and types - // here + StringBuffer source = new StringBuffer(new String(getContents())); + int replaceStart = offset + 1; + char charAtOffset = (char) source.charAt(offset); + if (charAtOffset == '.') { + source.deleteCharAt(offset); + offset--; + } + charAtOffset = (char) source.charAt(offset); + System.out.println(charAtOffset); + List<ITypeGuess> guesses = inferrer.infer(source.toString(), offset); + // TODO Grab the project and all referred projects! + IRubyProject[] projects = new IRubyProject[1]; + projects[0] = getRubyProject(); + RubyElementRequestor completer = new RubyElementRequestor(projects); for (Iterator iter = guesses.iterator(); iter.hasNext();) { ITypeGuess guess = (ITypeGuess) iter.next(); System.out.println("Type Inferrer thinks this is a: " + guess.getType()); - - IRubyProject project = getRubyProject(); - IRubyScript[] scripts = project.getRubyScripts(); - System.out.println("Got " + scripts.length + " scripts"); - for (int i = 0; i < scripts.length; i++) { - IRubyScript script = scripts[i]; - System.out.println("Checking for that type inside script: " - + script.getElementName()); - IType[] types = script.getTypes(); - for (int j = 0; j < types.length; j++) { - - IType type = types[j]; - if (!type.getElementName().equals(guess.getType())) - continue; - System.out.println("Got type with that name: " - + type.getElementName()); - IMethod[] methods = type.getMethods(); - System.out.println("Got " + methods.length + " methods"); - for (int k = 0; k < methods.length; k++) { - String name = methods[k].getElementName(); - System.out.println("Got method name: " + name); - CompletionProposal proposal = new CompletionProposal( - CompletionProposal.METHOD_REF, name, guess - .getConfidence()); - proposal - .setReplaceRange(offset, offset + name.length()); - requestor.accept(proposal); - } - } + IType type = completer.findType(guess.getType()); + IMethod[] methods = type.getMethods(); + System.out.println("Got " + methods.length + " methods"); + for (int k = 0; k < methods.length; k++) { + String name = methods[k].getElementName(); + System.out.println("Got method name: " + name); + CompletionProposal proposal = new CompletionProposal( + CompletionProposal.METHOD_REF, name, guess + .getConfidence()); + // TODO Handle replacement start index correctly + proposal.setReplaceRange(replaceStart, replaceStart + name.length()); + requestor.accept(proposal); } } } -} \ 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-07-21 00:57:11
|
Revision: 1539 Author: cawilliams Date: 2006-07-20 17:57:04 -0700 (Thu, 20 Jul 2006) ViewCVS: http://svn.sourceforge.net/rubyeclipse/?rev=1539&view=rev Log Message: ----------- remove reference to jruby.jar inside rdt.core - just require the org.jruby plugin Modified Paths: -------------- branches/type_inferrence/trunk/org.rubypeople.rdt.core/.classpath branches/type_inferrence/trunk/org.rubypeople.rdt.core/META-INF/MANIFEST.MF Removed Paths: ------------- branches/type_inferrence/trunk/org.rubypeople.rdt.core/lib/jruby.jar Modified: branches/type_inferrence/trunk/org.rubypeople.rdt.core/.classpath =================================================================== (Binary files differ) Modified: branches/type_inferrence/trunk/org.rubypeople.rdt.core/META-INF/MANIFEST.MF =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.core/META-INF/MANIFEST.MF 2006-07-20 22:35:12 UTC (rev 1538) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.core/META-INF/MANIFEST.MF 2006-07-21 00:57:04 UTC (rev 1539) @@ -3,8 +3,7 @@ Bundle-Name: %Plugin.name Bundle-SymbolicName: org.rubypeople.rdt.core; singleton:=true Bundle-Version: 0.0.0 -Bundle-ClassPath: rdtcore.jar, - lib/jruby.jar +Bundle-ClassPath: rdtcore.jar Bundle-Activator: org.rubypeople.rdt.core.RubyCore Bundle-Vendor: %providerName Bundle-Localization: plugin Deleted: branches/type_inferrence/trunk/org.rubypeople.rdt.core/lib/jruby.jar =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <caw...@us...> - 2006-07-20 22:35:22
|
Revision: 1538 Author: cawilliams Date: 2006-07-20 15:35:12 -0700 (Thu, 20 Jul 2006) ViewCVS: http://svn.sourceforge.net/rubyeclipse/?rev=1538&view=rev Log Message: ----------- add annotations for marked occurrences Modified Paths: -------------- branches/type_inferrence/trunk/org.rubypeople.rdt.ui/plugin.properties branches/type_inferrence/trunk/org.rubypeople.rdt.ui/plugin.xml branches/type_inferrence/trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/rubyeditor/RubyAbstractEditor.java Added Paths: ----------- branches/type_inferrence/trunk/org.rubypeople.rdt.ui/icons/full/obj16/searchm_obj.gif Added: branches/type_inferrence/trunk/org.rubypeople.rdt.ui/icons/full/obj16/searchm_obj.gif =================================================================== (Binary files differ) Property changes on: branches/type_inferrence/trunk/org.rubypeople.rdt.ui/icons/full/obj16/searchm_obj.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Modified: branches/type_inferrence/trunk/org.rubypeople.rdt.ui/plugin.properties =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.ui/plugin.properties 2006-07-20 22:34:40 UTC (rev 1537) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.ui/plugin.properties 2006-07-20 22:35:12 UTC (rev 1538) @@ -134,6 +134,7 @@ RubyElementCreationActionSet.label= Ruby Element Creation RubyElementCreationActionSet.description= Ruby Element Creation Action Set +OccurrenceAnnotation.label= Occurrences #--- folding foldingStructureProvidersExtensionPoint= Folding Structure Providers Modified: branches/type_inferrence/trunk/org.rubypeople.rdt.ui/plugin.xml =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.ui/plugin.xml 2006-07-20 22:34:40 UTC (rev 1537) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.ui/plugin.xml 2006-07-20 22:35:12 UTC (rev 1538) @@ -718,6 +718,9 @@ name="org.rubypeople.rdt.ui.info" markerSeverity="0"> </type> + <type + name="org.rubypeople.rdt.ui.occurrences"> + </type> </extension> <extension point="org.eclipse.ui.editors.markerAnnotationSpecification"> @@ -733,6 +736,29 @@ symbolicIcon="info" annotationType="org.rubypeople.rdt.ui.info"> </specification> + <specification + annotationType="org.rubypeople.rdt.ui.occurrences " + label="%OccurrenceAnnotation.label" + icon="$nl$/icons/full/obj16/searchm_obj.gif" + textPreferenceKey="occurrenceIndication" + textPreferenceValue="false" + highlightPreferenceKey="occurrenceHighlighting" + highlightPreferenceValue="true" + contributesToHeader="false" + overviewRulerPreferenceKey="occurrenceIndicationInOverviewRuler" + overviewRulerPreferenceValue="true" + verticalRulerPreferenceKey="occurrenceIndicationInVerticalRuler" + verticalRulerPreferenceValue="false" + colorPreferenceKey="occurrenceIndicationColor" + colorPreferenceValue="212,212,212" + presentationLayer="4" + showInNextPrevDropdownToolbarActionKey="showOccurrenceInNextPrevDropdownToolbarAction" + showInNextPrevDropdownToolbarAction="true" + isGoToNextNavigationTargetKey="isOccurrenceGoToNextNavigationTarget" + isGoToNextNavigationTarget="false" + isGoToPreviousNavigationTargetKey="isOccurrenceGoToPreviousNavigationTarget" + isGoToPreviousNavigationTarget="false"> + </specification> </extension> <extension point="org.eclipse.ui.ide.resourceFilters"> Modified: branches/type_inferrence/trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/rubyeditor/RubyAbstractEditor.java =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/rubyeditor/RubyAbstractEditor.java 2006-07-20 22:34:40 UTC (rev 1537) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/rubyeditor/RubyAbstractEditor.java 2006-07-20 22:35:12 UTC (rev 1538) @@ -1360,7 +1360,7 @@ continue; } annotationMap.put( - new Annotation("org.eclipse.jdt.ui.occurrences", false, message), //$NON-NLS-1$ + new Annotation("org.rubypeople.rdt.ui.occurrences", false, message), //$NON-NLS-1$ position); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <caw...@us...> - 2006-07-20 22:34:43
|
Revision: 1537 Author: cawilliams Date: 2006-07-20 15:34:40 -0700 (Thu, 20 Jul 2006) ViewCVS: http://svn.sourceforge.net/rubyeclipse/?rev=1537&view=rev Log Message: ----------- remove hack which put type inferred twice as proposal. Now do a slightly more correct ugly hack that does a search for types matching the particular guess and adds all it's methods as proposals. There's still a big hurdle to cover: we want the completion to work after a user has placed a period - the parser throws a syntax error and the inferrer doesn't resolve to the right node for inferrence. Modified Paths: -------------- branches/type_inferrence/trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyScript.java Modified: branches/type_inferrence/trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyScript.java =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyScript.java 2006-07-20 22:34:35 UTC (rev 1536) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyScript.java 2006-07-20 22:34:40 UTC (rev 1537) @@ -47,6 +47,7 @@ import org.rubypeople.rdt.core.ICodeAssist; import org.rubypeople.rdt.core.IImportContainer; import org.rubypeople.rdt.core.IImportDeclaration; +import org.rubypeople.rdt.core.IMethod; import org.rubypeople.rdt.core.IOpenable; import org.rubypeople.rdt.core.IProblemRequestor; import org.rubypeople.rdt.core.IRubyElement; @@ -665,14 +666,42 @@ ITypeInferrer inferrer = new DefaultTypeInferrer(); List<ITypeGuess> guesses = inferrer.infer(new String(getContents()), offset); - // FIXME We're returning back the type as a completion all the time which makes no sense + // FIXME We're doing some ugly hacky searching for methods and types + // here for (Iterator iter = guesses.iterator(); iter.hasNext();) { ITypeGuess guess = (ITypeGuess) iter.next(); - CompletionProposal proposal = new CompletionProposal(CompletionProposal.METHOD_REF, guess.getType(), guess.getConfidence()); - proposal.setReplaceRange(offset, offset + guess.getType().length()); - requestor.accept(proposal); - requestor.accept(proposal); // FIXME Ugly hack to show proposal twice (so we don't try to auto-apply) - } - + System.out.println("Type Inferrer thinks this is a: " + + guess.getType()); + + IRubyProject project = getRubyProject(); + IRubyScript[] scripts = project.getRubyScripts(); + System.out.println("Got " + scripts.length + " scripts"); + for (int i = 0; i < scripts.length; i++) { + IRubyScript script = scripts[i]; + System.out.println("Checking for that type inside script: " + + script.getElementName()); + IType[] types = script.getTypes(); + for (int j = 0; j < types.length; j++) { + + IType type = types[j]; + if (!type.getElementName().equals(guess.getType())) + continue; + System.out.println("Got type with that name: " + + type.getElementName()); + IMethod[] methods = type.getMethods(); + System.out.println("Got " + methods.length + " methods"); + for (int k = 0; k < methods.length; k++) { + String name = methods[k].getElementName(); + System.out.println("Got method name: " + name); + CompletionProposal proposal = new CompletionProposal( + CompletionProposal.METHOD_REF, name, guess + .getConfidence()); + proposal + .setReplaceRange(offset, offset + name.length()); + requestor.accept(proposal); + } + } + } + } } } \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
Revision: 1536 Author: jasonpmorrison Date: 2006-07-20 15:34:35 -0700 (Thu, 20 Jul 2006) ViewCVS: http://svn.sourceforge.net/rubyeclipse/?rev=1536&view=rev Log Message: ----------- Initial support for mark occurrence on dynamic var refs (block args etc.) Modified Paths: -------------- branches/type_inferrence/trunk/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/internal/ti/MarkOccurrencesTest.java Modified: branches/type_inferrence/trunk/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/internal/ti/MarkOccurrencesTest.java =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/internal/ti/MarkOccurrencesTest.java 2006-07-20 22:34:27 UTC (rev 1535) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/internal/ti/MarkOccurrencesTest.java 2006-07-20 22:34:35 UTC (rev 1536) @@ -2,6 +2,7 @@ import java.util.List; +import org.jruby.ast.BlockArgNode; import org.jruby.ast.Node; import org.jruby.lexer.yacc.ISourcePosition; import org.rubypeople.rdt.internal.core.parser.RubyParser; @@ -165,11 +166,12 @@ assertOccurrencesEqual( source, 34, "Klass", offsets ); } -// public void testBlockArguments() { -// String source = "[1,2,3].each { |number| puts number }"; -// int[][] offsets = {{16,22},{29,35}}; -// assertOccurrencesEqual(source, 16, "number", offsets); -// } + public void testBlockArguments() { + String source = "[1,2,3].each { |number| puts number }"; + int[][] offsets = {{16,22},{29,35}}; + assertOccurrencesEqual(source, 16, "number", offsets); +// assertOccurrencesEqual(source, 29, "number", offsets); + } /** @@ -189,4 +191,16 @@ int[][] offsets = {{20,29},{60,69}}; assertOccurrencesEqual( source, 23, "@@cls_var", offsets ); } + +// Oddity with local/dvars: +// +// foo = Printer.new +// [person, place, thing].each do |noun| +// foo.print(noun) +// end +// noun = "hi" +// +// There are 3 refs to "noun". Clicking the first highlights 1&2, clicking 2 highlights 1&2 +// but clicking 3 highlights 2&3 - ????! + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <jas...@us...> - 2006-07-20 22:34:33
|
Revision: 1535 Author: jasonpmorrison Date: 2006-07-20 15:34:27 -0700 (Thu, 20 Jul 2006) ViewCVS: http://svn.sourceforge.net/rubyeclipse/?rev=1535&view=rev Log Message: ----------- Initial support for mark occurrence on dynamic var refs (block args etc.) Modified Paths: -------------- branches/type_inferrence/trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/DefaultOccurrencesFinder.java Modified: branches/type_inferrence/trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/DefaultOccurrencesFinder.java =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/DefaultOccurrencesFinder.java 2006-07-20 22:15:32 UTC (rev 1534) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/DefaultOccurrencesFinder.java 2006-07-20 22:34:27 UTC (rev 1535) @@ -14,6 +14,7 @@ import org.jruby.ast.ClassVarNode; import org.jruby.ast.Colon2Node; import org.jruby.ast.ConstNode; +import org.jruby.ast.DAsgnNode; import org.jruby.ast.DVarNode; import org.jruby.ast.DefnNode; import org.jruby.ast.DefsNode; @@ -88,6 +89,10 @@ pushLocalVarRefs( root, orig, occurrences ); } + if ( isDVarRef(orig) ) { + pushDVarRefs( root, orig, occurrences ); + } + if ( isInstanceVarRef(orig) ) { pushInstVarRefs( root, orig, occurrences ); } @@ -140,6 +145,15 @@ } /** + * Determines whether a given node is a dynamic variable reference + * @param node + * @return + */ + private boolean isDVarRef( Node node ) { + return ( ( node instanceof DVarNode ) || ( node instanceof DAsgnNode ) ); + } + + /** * Determines whether a given node is an instance variable reference * @param node * @return @@ -232,6 +246,44 @@ } /** + * Collects all corresponding dynamic variable occurrences + * @param root Root node to search + * @param orig Originating node + * @param occurrences + */ + private void pushDVarRefs( Node root, Node orig, List<ISourcePosition> occurrences ) { +// System.out.println("Finding occurrences for a local variable " + orig.toString()); + + // Find the search space + Node searchSpace = FirstPrecursorNodeLocator.Instance().findFirstPrecursor(root, orig.getPosition().getStartOffset(), new INodeAcceptor() { + public boolean doesAccept(Node node) { + return ( ( node instanceof DefnNode ) || ( node instanceof DefsNode ) /*TODO: Block Body? */ ); + } + }); + + // If no enclosing node found, search the entire space + if ( searchSpace == null ) { + searchSpace = root; + } + + // Get name of local variable reference + final String origName = getDVarRefName(orig); + + // Find all pertinent nodes + List<Node> searchResults = ScopedNodeLocator.Instance().findNodesInScope(searchSpace, new INodeAcceptor() { + public boolean doesAccept(Node node) { + String name = getDVarRefName(node); + return ( name != null && name.equals(origName)); + } + }); + + // Scrape position from pertinent nodes + for ( Node searchResult : searchResults ) { + occurrences.add(getPositionOfName(searchResult, searchSpace)); + } + } + + /** * Collects all instance variable occurrences * @param root * @param orig @@ -479,6 +531,7 @@ //todo: refactor the getting-of-name String name = null; if ( isLocalVarRef(node) ) { name = getLocalVarRefName(node, scope); } + if ( isDVarRef(node) ) { name = getDVarRefName(node); } if ( isInstanceVarRef(node) ) { name = getInstVarRefName(node ); } if ( isGlobalVarRef(node) ) { name = getGlobalVarRefName(node); } if ( isClassVarRef(node) ) { name = getClassVarRefName(node); } @@ -487,7 +540,7 @@ if ( node instanceof ClassNode ) { name = getClassNodeName( (ClassNode)node ); String classDeclString = source.substring(pos.getStartOffset(), pos.getEndOffset()); - int begin = classDeclString.indexOf(name); + int begin = pos.getStartOffset() + classDeclString.indexOf(name); return new SourcePosition( pos.getFile(), pos.getStartLine(), pos.getEndLine(), begin, begin + name.length() ); } if ( node instanceof ModuleNode ) { @@ -561,6 +614,21 @@ } /** + * Gets the name of a dynamic variable reference + * @param node Dynamic variable reference + * @return + */ + private String getDVarRefName( Node node ) { + if ( node instanceof DVarNode ) { + return ((DVarNode)node).getName(); + } + if ( node instanceof DAsgnNode ) { + return ((DAsgnNode)node).getName(); + } + return null; + } + + /** * Gets the name of an instance variable reference * @param node Instance variable reference * @return This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
Revision: 1534 Author: jasonpmorrison Date: 2006-07-20 15:15:32 -0700 (Thu, 20 Jul 2006) ViewCVS: http://svn.sourceforge.net/rubyeclipse/?rev=1534&view=rev Log Message: ----------- Mark occurrences for class variables Modified Paths: -------------- branches/type_inferrence/trunk/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/internal/ti/MarkOccurrencesTest.java Modified: branches/type_inferrence/trunk/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/internal/ti/MarkOccurrencesTest.java =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/internal/ti/MarkOccurrencesTest.java 2006-07-20 22:15:17 UTC (rev 1533) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/internal/ti/MarkOccurrencesTest.java 2006-07-20 22:15:32 UTC (rev 1534) @@ -171,4 +171,22 @@ // assertOccurrencesEqual(source, 16, "number", offsets); // } + + /** + * Match instance vars inside one ClassNode across DefnNode + */ + public void testClassVariableMatches() { + String source = "class Klass;def foo(param);@@cls_var = param;puts @@cls_var;end;def bar;y @@cls_var;end;end"; + int[][] offsets = {{27,36},{50,59},{74,83}}; + assertOccurrencesEqual( source, 29, "@@cls_var", offsets ); + } + + /** + * Match instance vars inside two DefnNodes, each in a separate ClassNode (for the same class) + */ + public void testClassVariableMatchInReopenedClass() { + String source = "class Klass;def foo;@@cls_var=5;end;end;class Klass;def bar;@@cls_var=6;end;end"; + int[][] offsets = {{20,29},{60,69}}; + assertOccurrencesEqual( source, 23, "@@cls_var", offsets ); + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <jas...@us...> - 2006-07-20 22:15:28
|
Revision: 1533 Author: jasonpmorrison Date: 2006-07-20 15:15:17 -0700 (Thu, 20 Jul 2006) ViewCVS: http://svn.sourceforge.net/rubyeclipse/?rev=1533&view=rev Log Message: ----------- Mark occurrences for class variables Modified Paths: -------------- branches/type_inferrence/trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/DefaultOccurrencesFinder.java Modified: branches/type_inferrence/trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/DefaultOccurrencesFinder.java =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/DefaultOccurrencesFinder.java 2006-07-20 05:33:35 UTC (rev 1532) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/DefaultOccurrencesFinder.java 2006-07-20 22:15:17 UTC (rev 1533) @@ -9,6 +9,9 @@ import org.jruby.ast.BlockNode; import org.jruby.ast.CallNode; import org.jruby.ast.ClassNode; +import org.jruby.ast.ClassVarAsgnNode; +import org.jruby.ast.ClassVarDeclNode; +import org.jruby.ast.ClassVarNode; import org.jruby.ast.Colon2Node; import org.jruby.ast.ConstNode; import org.jruby.ast.DVarNode; @@ -89,6 +92,10 @@ pushInstVarRefs( root, orig, occurrences ); } + if ( isClassVarRef(orig) ) { + pushClassVarRefs( root, orig, occurrences ); + } + if ( isGlobalVarRef(orig) ) { pushGlobalVarRefs( root, orig, occurrences ); } @@ -142,6 +149,15 @@ } /** + * Determines whether a given node is a class variable reference + * @param node + * @return + */ + private boolean isClassVarRef( Node node ) { + return ( ( node instanceof ClassVarNode ) || ( node instanceof ClassVarAsgnNode ) || ( node instanceof ClassVarDeclNode ) ); + } + + /** * Determines whether a given node is a global variable reference * @param node * @return @@ -284,6 +300,74 @@ } /** + * Collects all class variable occurrences + * @param root + * @param orig + * @param occurrences + */ + private void pushClassVarRefs( Node root, Node orig, List<ISourcePosition> occurrences ) { +// System.out.println("Finding occurrences for an instance variable " + orig.toString() ); + + Node searchSpace; + + // Find the name of the enclosing class + ClassNode enclosingClass = (ClassNode)FirstPrecursorNodeLocator.Instance().findFirstPrecursor(root, orig.getPosition().getStartOffset(), new INodeAcceptor() { + public boolean doesAccept(Node node) { + return ( node instanceof ClassNode ); + } + }); + + // If no enclosing class is identified, search root. + if ( enclosingClass == null ) { + searchSpace = root; + } + // Find the search space - all ClassNodes for that name within root scope + else { + final String className = getClassNodeName(enclosingClass); + List<Node> classNodes = ScopedNodeLocator.Instance().findNodesInScope(root, new INodeAcceptor() { + public boolean doesAccept(Node node) { + if ( node instanceof ClassNode ) + { + return getClassNodeName((ClassNode)node).equals(className); + } + return false; + } + }); + BlockNode blockNode = new BlockNode(new SourcePosition("",0)); + for ( Node classNode : classNodes ) + { + blockNode.add( classNode ); + } + searchSpace = blockNode; + } + + // Finalize searchSpace because Java's scoping rules are the awesome + //todo: not needed? + //final Node finalSearchSpace = searchSpace; + + // Get name of local variable reference + final String origName = getClassVarRefName(orig); + + // Find all pertinent nodes + List<Node> searchResults = ScopedNodeLocator.Instance().findNodesInScope(searchSpace, new INodeAcceptor() { + public boolean doesAccept(Node node) { + if ( isClassVarRef(node) ) + { + String name = getClassVarRefName(node); + return ( name != null && name.equals(origName)); + } + return false; + } + }); + + // Scrape position from pertinent nodes + for ( Node searchResult : searchResults ) { + occurrences.add(getPositionOfName(searchResult, searchSpace)); + } + + } + + /** * Collects all global variable occurrences * @param root * @param orig @@ -397,6 +481,7 @@ if ( isLocalVarRef(node) ) { name = getLocalVarRefName(node, scope); } if ( isInstanceVarRef(node) ) { name = getInstVarRefName(node ); } if ( isGlobalVarRef(node) ) { name = getGlobalVarRefName(node); } + if ( isClassVarRef(node) ) { name = getClassVarRefName(node); } // if ( isConstRef(node) ) { name = getConstRefName(node); } if ( node instanceof ConstNode ) { name = ((ConstNode)node).getName(); } if ( node instanceof ClassNode ) { @@ -477,7 +562,7 @@ /** * Gets the name of an instance variable reference - * @param node Instanve variable reference + * @param node Instance variable reference * @return */ private String getInstVarRefName( Node node ) { @@ -492,7 +577,24 @@ if ( node instanceof DVarNode ) { return ((DVarNode)node).getName(); } + return null; + } + /** + * Gets the name of a class variable reference + * @param node Class variable reference + * @return + */ + private String getClassVarRefName( Node node ) { + if ( node instanceof ClassVarNode ) { + return ((ClassVarNode)node).getName(); + } + if ( node instanceof ClassVarDeclNode ) { + return ((ClassVarDeclNode)node).getName(); + } + if ( node instanceof ClassVarAsgnNode ) { + return ((ClassVarAsgnNode)node).getName(); + } return null; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <jas...@us...> - 2006-07-20 05:33:41
|
Revision: 1532 Author: jasonpmorrison Date: 2006-07-19 22:33:35 -0700 (Wed, 19 Jul 2006) ViewCVS: http://svn.sourceforge.net/rubyeclipse/?rev=1532&view=rev Log Message: ----------- Null check Modified Paths: -------------- branches/type_inferrence/trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/DefaultOccurrencesFinder.java Modified: branches/type_inferrence/trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/DefaultOccurrencesFinder.java =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/DefaultOccurrencesFinder.java 2006-07-20 05:22:46 UTC (rev 1531) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/DefaultOccurrencesFinder.java 2006-07-20 05:33:35 UTC (rev 1532) @@ -60,6 +60,7 @@ this.root = null; } this.orig = OffsetNodeLocator.Instance().getNodeAtOffset(root, offset); + if ( orig == null ) { return null; } if ( orig.getPosition().getEndOffset() > offset + length ) { // Selection spans nodes; not handling that for now. @@ -75,6 +76,7 @@ public List<Position> perform() { // Mark no occurrences if root is null (AST couldn't be parsed correctly.) if ( root == null ) return new LinkedList<Position>(); + if ( orig == null ) return new LinkedList<Position>(); // occurrences to return List<ISourcePosition> occurrences = new LinkedList<ISourcePosition>(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <jas...@us...> - 2006-07-20 05:22:57
|
Revision: 1531 Author: jasonpmorrison Date: 2006-07-19 22:22:46 -0700 (Wed, 19 Jul 2006) ViewCVS: http://svn.sourceforge.net/rubyeclipse/?rev=1531&view=rev Log Message: ----------- Holy it's-a-good-idea-to-check-for-nulls, Batman Modified Paths: -------------- branches/type_inferrence/trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/util/OffsetNodeLocator.java branches/type_inferrence/trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/util/ScopedNodeLocator.java Modified: branches/type_inferrence/trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/util/OffsetNodeLocator.java =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/util/OffsetNodeLocator.java 2006-07-20 04:52:38 UTC (rev 1530) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/util/OffsetNodeLocator.java 2006-07-20 05:22:46 UTC (rev 1531) @@ -37,6 +37,8 @@ * @return Node most closely spanning the requested offset. */ public Node getNodeAtOffset(Node rootNode, int offset) { + if ( rootNode == null ) { return null; } + locatedNode = null; this.offset = offset; Modified: branches/type_inferrence/trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/util/ScopedNodeLocator.java =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/util/ScopedNodeLocator.java 2006-07-20 04:52:38 UTC (rev 1530) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/util/ScopedNodeLocator.java 2006-07-20 05:22:46 UTC (rev 1531) @@ -36,6 +36,9 @@ * @return List of located nodes. */ public List<Node> findNodesInScope(Node rootNode, INodeAcceptor acceptor ) { + if ( rootNode == null ) { return null; } + if ( acceptor == null ) { return null; } + locatedNodes = new LinkedList<Node>(); this.acceptor = acceptor; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <jas...@us...> - 2006-07-20 04:52:45
|
Revision: 1530 Author: jasonpmorrison Date: 2006-07-19 21:52:38 -0700 (Wed, 19 Jul 2006) ViewCVS: http://svn.sourceforge.net/rubyeclipse/?rev=1530&view=rev Log Message: ----------- ConstNode/Class Decl Node matching Modified Paths: -------------- branches/type_inferrence/trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/DefaultOccurrencesFinder.java Modified: branches/type_inferrence/trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/DefaultOccurrencesFinder.java =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/DefaultOccurrencesFinder.java 2006-07-20 04:52:30 UTC (rev 1529) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/DefaultOccurrencesFinder.java 2006-07-20 04:52:38 UTC (rev 1530) @@ -20,6 +20,7 @@ import org.jruby.ast.InstVarNode; import org.jruby.ast.LocalAsgnNode; import org.jruby.ast.LocalVarNode; +import org.jruby.ast.ModuleNode; import org.jruby.ast.Node; import org.jruby.ast.SymbolNode; import org.jruby.ast.VCallNode; @@ -45,8 +46,11 @@ // Originating node; corresponds to cursor selection private Node orig; + // Original source + private String source; + public String initialize(String source, int offset, int length) { - + this.source = source; try { this.root = (new RubyParser()).parse(source); } @@ -95,7 +99,7 @@ // pushMethodRefs( root, orig, occurrences ); // } - if ( orig instanceof ConstNode ) + if ( isConstRef(orig) ) { pushConstRefs( root, orig, occurrences ); } @@ -153,6 +157,15 @@ return ( ( node instanceof DefnNode ) || ( node instanceof DefsNode ) || ( node instanceof CallNode ) || ( node instanceof VCallNode ) ); } + /** + * Determines whether a given node is a constant reference (class, module... others??) + * @param node + * @return + */ + private boolean isConstRef( Node node ) { + return ( ( node instanceof ConstNode ) || ( node instanceof ClassNode ) || ( node instanceof ModuleNode ) ); + } + // **************************************************************************** // * // * Worker methods - handles delegation of occurrence searches @@ -337,20 +350,20 @@ // } /** - * Collects all pertinent ConstNode occurrences + * Collects all pertinent const occurrences */ private void pushConstRefs( Node root, Node orig, List<ISourcePosition> occurrences) { - if ( !( orig instanceof ConstNode) ) + if ( !isConstRef(orig) ) { return; } - final String matchName = ((ConstNode)orig).getName(); + final String matchName = getConstRefName(orig); List <Node> searchResults = ScopedNodeLocator.Instance().findNodesInScope(root, new INodeAcceptor() { public boolean doesAccept(Node node) { - if ( node instanceof ConstNode ) + if ( isConstRef(node) ) { - return ((ConstNode)node).getName().equals(matchName); + return getConstRefName(node).equals(matchName); } return false; } @@ -382,12 +395,25 @@ if ( isLocalVarRef(node) ) { name = getLocalVarRefName(node, scope); } if ( isInstanceVarRef(node) ) { name = getInstVarRefName(node ); } if ( isGlobalVarRef(node) ) { name = getGlobalVarRefName(node); } +// if ( isConstRef(node) ) { name = getConstRefName(node); } if ( node instanceof ConstNode ) { name = ((ConstNode)node).getName(); } + if ( node instanceof ClassNode ) { + name = getClassNodeName( (ClassNode)node ); + String classDeclString = source.substring(pos.getStartOffset(), pos.getEndOffset()); + int begin = classDeclString.indexOf(name); + return new SourcePosition( pos.getFile(), pos.getStartLine(), pos.getEndLine(), begin, begin + name.length() ); + } + if ( node instanceof ModuleNode ) { + name = getModuleNodeName( (ModuleNode)node ); + String moduleDeclString = source.substring(pos.getStartOffset(), pos.getEndOffset()); + int begin = moduleDeclString.indexOf(name); + return new SourcePosition( pos.getFile(), pos.getStartLine(), pos.getEndLine(), begin, begin + name.length() ); + } + if ( node instanceof SymbolNode ) { //XXX: This is a hack to get around improper offsets in my JRuby copy; ":foo" returns offset for ":fo", so compensate by adding one name = ((SymbolNode)node).getName(); return new SourcePosition(pos.getFile(), pos.getStartLine(), pos.getEndLine(), pos.getStartOffset(), pos.getStartOffset() + name.length() + 1 ); - } if ( name == null ) @@ -519,4 +545,40 @@ return null; } + /** + * Helper method to get the class name from a ModuleNode + * @param classNode + * @return + */ + private String getModuleNodeName( ModuleNode moduleNode ) { + if ( moduleNode.getCPath() instanceof Colon2Node ) { + Colon2Node c2node = (Colon2Node) moduleNode.getCPath(); + return c2node.getName(); + } + System.err.println("ModuleNode.getCPath() returned other than Colon2Node: " + moduleNode.toString() ); + return null; + } + + /** + * Helper method to get the class name from a const ref node (Class/Module/Const) + * @param constRefNode + * @return + */ + private String getConstRefName( Node constRefNode ) { + if ( constRefNode instanceof ClassNode ) + { + return getClassNodeName( (ClassNode)constRefNode ); + } + if ( constRefNode instanceof ModuleNode ) + { + return getModuleNodeName( (ModuleNode)constRefNode ); + } + if ( constRefNode instanceof ConstNode ) + { + return ((ConstNode)constRefNode).getName(); + } + return null; + } + + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
Revision: 1529 Author: jasonpmorrison Date: 2006-07-19 21:52:30 -0700 (Wed, 19 Jul 2006) ViewCVS: http://svn.sourceforge.net/rubyeclipse/?rev=1529&view=rev Log Message: ----------- ConstNode/Class Decl Node matching Modified Paths: -------------- branches/type_inferrence/trunk/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/internal/ti/MarkOccurrencesTest.java Modified: branches/type_inferrence/trunk/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/internal/ti/MarkOccurrencesTest.java =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/internal/ti/MarkOccurrencesTest.java 2006-07-20 04:16:55 UTC (rev 1528) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/internal/ti/MarkOccurrencesTest.java 2006-07-20 04:52:30 UTC (rev 1529) @@ -159,11 +159,11 @@ assertOccurrencesEqual( source, 4, "String", offsets ); } -// public void testConstNodeToClassDeclNode() { -// String source = "class Klass;def foo;5;end;end;k = Klass.new"; -// int[][] offsets = {{6,11},{34,39}}; -// assertOccurrencesEqual( source, 6, "Klass", offsets ); -// } + public void testConstNodeToClassDeclNode() { + String source = "class Klass;def foo;5;end;end;k = Klass.new"; + int[][] offsets = {{6,11},{34,39}}; + assertOccurrencesEqual( source, 34, "Klass", offsets ); + } // public void testBlockArguments() { // String source = "[1,2,3].each { |number| puts number }"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <jas...@us...> - 2006-07-20 04:17:01
|
Revision: 1528 Author: jasonpmorrison Date: 2006-07-19 21:16:55 -0700 (Wed, 19 Jul 2006) ViewCVS: http://svn.sourceforge.net/rubyeclipse/?rev=1528&view=rev Log Message: ----------- - Find and match ArgumentNode - Find and match Symbol Node (HACK: JRuby positioning issue with symbols) Modified Paths: -------------- branches/type_inferrence/trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/DefaultOccurrencesFinder.java Modified: branches/type_inferrence/trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/DefaultOccurrencesFinder.java =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/DefaultOccurrencesFinder.java 2006-07-20 04:16:47 UTC (rev 1527) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/DefaultOccurrencesFinder.java 2006-07-20 04:16:55 UTC (rev 1528) @@ -21,6 +21,7 @@ import org.jruby.ast.LocalAsgnNode; import org.jruby.ast.LocalVarNode; import org.jruby.ast.Node; +import org.jruby.ast.SymbolNode; import org.jruby.ast.VCallNode; import org.jruby.lexer.yacc.ISourcePosition; import org.jruby.lexer.yacc.SourcePosition; @@ -86,6 +87,10 @@ pushGlobalVarRefs( root, orig, occurrences ); } + if ( orig instanceof SymbolNode ) { + pushSymbolRefs( root, orig, occurrences ); + } + // if ( isMethodRefNode(orig)) { // pushMethodRefs( root, orig, occurrences ); // } @@ -286,6 +291,32 @@ } } + + /** + * Collects all symbol occurrences + * @param root + * @param orig + * @param occurrences + */ + private void pushSymbolRefs( Node root, Node orig, List<ISourcePosition> occurrences ) { + final Node searchSpace = root; + final String origName = ((SymbolNode)orig).getName(); + + // Find all pertinent nodes + List<Node> searchResults = ScopedNodeLocator.Instance().findNodesInScope(searchSpace, new INodeAcceptor() { + public boolean doesAccept(Node node) { + return ( node instanceof SymbolNode ) && ((SymbolNode)node).getName().equals(origName); + } + }); + + // Scrape position from pertinent nodes + for ( Node searchResult : searchResults ) { + occurrences.add(getPositionOfName(searchResult, searchSpace)); + } + } + + + //todo: complete // private void pushMethodRefs( Node root, Node orig, List<ISourcePosition> occurrences) { // @@ -348,10 +379,16 @@ //todo: refactor the getting-of-name String name = null; - if ( isLocalVarRef(node) ) { name = getLocalVarRefName(node, scope); } - if ( isInstanceVarRef(node) ) { name = getInstVarRefName(node ); } - if ( isGlobalVarRef(node) ) { name = getGlobalVarRefName(node); } - if ( node instanceof ConstNode ) { name = ((ConstNode)node).getName(); } + if ( isLocalVarRef(node) ) { name = getLocalVarRefName(node, scope); } + if ( isInstanceVarRef(node) ) { name = getInstVarRefName(node ); } + if ( isGlobalVarRef(node) ) { name = getGlobalVarRefName(node); } + if ( node instanceof ConstNode ) { name = ((ConstNode)node).getName(); } + if ( node instanceof SymbolNode ) { + //XXX: This is a hack to get around improper offsets in my JRuby copy; ":foo" returns offset for ":fo", so compensate by adding one + name = ((SymbolNode)node).getName(); + return new SourcePosition(pos.getFile(), pos.getStartLine(), pos.getEndLine(), pos.getStartOffset(), pos.getStartOffset() + name.length() + 1 ); + + } if ( name == null ) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |