Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » Introduce Indirection does nothing on a .class file
Introduce Indirection does nothing on a .class file [message #522786] Tue, 23 March 2010 18:21 Go to next message
Eclipse UserFriend
I want to replace all calls to org.eclipse.jface.dialogs.DialogPage.setButtonLayoutData() with calls to a new method that I've written in my own class. I open DialogPage.class (It's listed in my plug-in's plug-in dependencies) and right click on the method name, hit Refactor-> Introduce Indirection... and nothing happens.

Any way to get this to work? Or another way to do what I want to do? Thanks.
Re: Introduce Indirection does nothing on a .class file [message #522802 is a reply to message #522786] Tue, 23 March 2010 14:08 Go to previous messageGo to next message
Eclipse UserFriend
Gary Miguel wrote:
> I want to replace all calls to
> org.eclipse.jface.dialogs.DialogPage.setButtonLayoutData() with calls to
> a new method that I've written in my own class. I open DialogPage.class
> (It's listed in my plug-in's plug-in dependencies) and right click on
> the method name, hit Refactor-> Introduce Indirection... and nothing
> happens.
>
> Any way to get this to work? Or another way to do what I want to do?
> Thanks.

A refactor is a change to source code. A .class file is a compiled binary file,
although when you open it, Eclipse will try to locate the source that it was
compiled from and show you the source.

Are you saying that you want to edit the JFace implementation, that is,
DialogPage.java? That doesn't sound like a good idea to me unless you're
planning on contributing the change back to Eclipse, but if you really want to
you can; to do that, import the plugin's source code into your project as a
source project.

If you're saying that you want to actually modify the .class file itself, rather
than modifying the source and then recompiling, I don't believe that Eclipse
will do that for you. You may be able to do it with a bytecode modification
program, such as BCEL, ASM, AspectWorkz, etc.
Re: Introduce Indirection does nothing on a .class file [message #522809 is a reply to message #522802] Tue, 23 March 2010 19:50 Go to previous messageGo to next message
Eclipse UserFriend
Walter Harley wrote on Tue, 23 March 2010 14:08


Are you saying that you want to edit the JFace implementation, that is,
DialogPage.java?


No, I am saying I want to edit MY code that calls the JFace code.
Walter Harley wrote on Tue, 23 March 2010 14:08

If you're saying that you want to actually modify the .class file itself,.

No, that's not what I'm saying. I'm saying I want to change MY code that references this class file.

For example, if this code appears in my class, which is a subclass of DialogPage:
this.setButtonLayoutData(button)

I want to replace it with:
NewUtilityClass.setButtonLayoutData(button)
Re: Introduce Indirection does nothing on a .class file [message #522824 is a reply to message #522809] Wed, 24 March 2010 00:07 Go to previous messageGo to next message
Eclipse UserFriend
Gary Miguel wrote:
> Walter Harley wrote on Tue, 23 March 2010 14:08
>> Are you saying that you want to edit the JFace implementation, that
>> is, DialogPage.java?
>
>
> No, I am saying I want to edit MY code that calls the JFace code.
> Walter Harley wrote on Tue, 23 March 2010 14:08
>> If you're saying that you want to actually modify the .class file
>> itself,.
>
> No, that's not what I'm saying. I'm saying I want to change MY code that
> references this class file.
>
> For example, if this code appears in my class, which is a subclass of
> DialogPage:
> this.setButtonLayoutData(button)
> I want to replace it with:
> NewUtilityClass.setButtonLayoutData(button)

Oh, I understand - my apologies for misreading your request.

Is it only happening for calls to binary methods (methods in .class files)?
Re: Introduce Indirection does nothing on a .class file [message #522993 is a reply to message #522824] Wed, 24 March 2010 13:07 Go to previous messageGo to next message
Eclipse UserFriend
It works fine if I select "Introduce Indirection" on a method in one of my java source files.
Re: Introduce Indirection does nothing on a .class file [message #523017 is a reply to message #522993] Wed, 24 March 2010 10:02 Go to previous messageGo to next message
Eclipse UserFriend
Gary Miguel wrote:
> It works fine if I select "Introduce Indirection" on a method in one of
> my java source files.

Can you enter a bug in Bugzilla, against JDT/UI? I don't know if this is an
intentional limitation but it doesn't sound like anything you're doing wrong.
Re: Introduce Indirection does nothing on a .class file [message #523021 is a reply to message #522786] Wed, 24 March 2010 14:57 Go to previous messageGo to next message
Eclipse UserFriend
On 2010-03-23 23:21, Gary Miguel wrote:
> I want to replace all calls to
> org.eclipse.jface.dialogs.DialogPage.setButtonLayoutData() with calls to
> a new method that I've written in my own class. I open DialogPage.class
> (It's listed in my plug-in's plug-in dependencies) and right click on
> the method name, hit Refactor-> Introduce Indirection... and nothing
> happens.
>
> Any way to get this to work? Or another way to do what I want to do?
> Thanks.

Sounds like a bug. Try to select an invocation of the method or select
the declaration in the Outline view, and then start the refactoring.

HTH,
Markus
Re: Introduce Indirection does nothing on a .class file [message #523048 is a reply to message #523021] Wed, 24 March 2010 17:11 Go to previous messageGo to next message
Eclipse UserFriend
Hi Markus,
Should file a new bug in bugzilla? There are some similar bugs, but I think they might be different issues.
Re: Introduce Indirection does nothing on a .class file [message #523059 is a reply to message #523048] Wed, 24 March 2010 18:12 Go to previous messageGo to next message
Eclipse UserFriend
Gary Miguel wrote:
> Hi Markus,
> Should file a new bug in bugzilla? There are some similar bugs, but I
> think they might be different issues.

If you think yours is different, file a new bug report, and mention the other
bug numbers in your report (and explain why you think it's different).

If the underlying cause is the same, the developer will resolve your report as a
dup, but it's better to start with multiple bug reports - it gets very confusing
when one bug report is describing multiple bugs.
Re: Introduce Indirection does nothing on a .class file [message #523066 is a reply to message #522786] Wed, 24 March 2010 18:55 Go to previous message
Eclipse UserFriend
Bug 307002 filed. Thanks for all the help.
Previous Topic:Change one file but must do clean on project
Next Topic:Locating another project
Goto Forum:
  


Current Time: Fri Mar 21 10:06:05 EDT 2025

Powered by FUDForum. Page generated in 0.31458 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top