Refactoring & help offer

perlguy67 wrote on Fri Sep 16 14:59:17 MEST 2005:
Hi,

I have Eclipse running at work on WinXP and at home running on Fedora Core
4.

I am running the latest "testing" version of e-p-i-c on both.

Refactoring - extract subroutine - does not work on either system. I get
a java error complaining about an array out of bounds.

Since it looks like I am going to be doing a lot more here at work with
this tool, it would benefit me - and everyone else, if I helped out when
possible.

Where is a good place to start with trying to make the e-p-i-c code better?
 I can do some java, but am mostly a Perl person.

Any help would be great, I would love to make eclipse work MUCH better with
Perl!

Brent
matisse wrote on Fri Sep 16 18:39:23 MEST 2005:
I use EPIC with refactoring a lot and it worksd for me, so maybe we can
figure out what's up.

Which version of Eclipse and EPIC are you using?
Also, can you find our which version of Devel::Refactor is installed in
the EPIC directory - which will be something like:
  {eclipse folder}\plugins\org.epic.perleditor_2.2.0\perlutils\modules\Devel\Refactor.pm

look in that file and see which version you have.
perlguy67 wrote on Fri Sep 16 18:44:06 MEST 2005:
Thanks.

I am using Eclipse 3.1.0 and Epic 0.3.11

The Refactor.pm that came with Epic was 0.03, I tried replacing that with
0.05 (the latest ver), but the results were the same.

I am using the same versions for both Eclipse and Epic on my WinXP work
box, and my home Linux box.

Here is the error that I get when I try to refactor.  I get the popup to
enter the subroutine name, enter the name and click 'OK'.  Then I get this:

Error 2005-09-16 11:43:02.709 0
java.lang.ArrayIndexOutOfBoundsException: 0
	at org.epic.perleditor.popupmenus.refactor.ExtractSubroutineAction.run(ExtractSubroutineAction.java:102)
	at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:246)
	at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:538)
	at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:488)
	at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:400)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:843)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3080)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2713)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1699)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1663)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:367)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:143)
	at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:103)
	at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:226)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:376)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:163)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:324)
	at org.eclipse.core.launcher.Main.invokeFramework(Main.java:334)
	at org.eclipse.core.launcher.Main.basicRun(Main.java:278)
	at org.eclipse.core.launcher.Main.run(Main.java:973)
	at org.eclipse.core.launcher.Main.main(Main.java:948)

matisse wrote on Fri Sep 16 19:02:34 MEST 2005:
Try replacing Refactor.pm with version 0.02 and see what happens.

I have a suspicion here....
perlguy67 wrote on Fri Sep 16 20:07:58 MEST 2005:
Nope, same error message...

I replaced Refactor.pm in
C:\eclipse\plugins\org.epic.perleditor_0.2.1\perlutils\modules\Devel

Shut down, then restarted Eclipse.

Could the module be in any other location as well?  Or, could it be picking
it up from my computers Perl libraries?

Thanks again,

Brent
perlguy67 wrote on Fri Sep 16 20:29:32 MEST 2005:
Ok.

I replaced the Refactor.pm in my Perl installation as well.

Then, I re-ran eclipse with the -clean option.

This time it worked!

Now, I think I'll try to figure out WHY!  :o)

Thanks for your help! I am still open to suggestions, ideas!  I would love
to add more Perl things to Eclipse!

Brent
perlguy67 wrote on Fri Sep 16 20:56:05 MEST 2005:
A couple items...

I was able to make changes to Refactor.pm v0.05 to make it work. Basically,
I took v0.02 and saw that the new() method had changed greatly in what was
happening.

So, I made it so that the v0.05 would run the extract_subroutine() code
whenever new() was called. I also made sure that the right vars were passed
in.

This limits what Refactor.pm can do, but for now I am ok with that.

One thing I noticed, Eclipse picks up the Refactor.pm from my Perl distro,
NOT the e-p-i-c plugin directory.

Now. Does anyone have info on how to fiddle with the Java so that I can
add the other "hooks" from the newest Refactor module into Eclipse?

I've tried the CVS source but ended up with so many errors I stopped and
decided I need to figure out a bit more.

Any good guides out there?  Or, at least how to get started writing e-p-i-c
plugins using Eclipse???

Thanks!

Brent
matisse wrote on Sat Sep 17 05:04:44 MEST 2005:
I think I have a version of the EPIC java code that will work with Devel::Refactor
.5

Who should I send it to?
perlguy67 wrote on Sat Sep 17 05:37:58 MEST 2005:
I'd love to see it!

As far as who to send it to, I would send it to the people who are listed
on this project as the owners.

Brent

Note: The above is an archived snapshot of a forum thread. Use the original thread at sf.net to post comments.