Bug 6496 - Rename Refactoring should consider non Java files [refactoring]
Summary: Rename Refactoring should consider non Java files [refactoring]
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 2000
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: investigate
: 299 27035 (view as bug list)
Depends on:
Blocks:
 
Reported: 2001-12-03 04:31 EST by Dirk Baeumer CLA
Modified: 2003-02-20 17:12 EST (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dirk Baeumer CLA 2001-12-03 04:31:40 EST
Rename refactorings currently only consider Java files. As a result renaming a 
Java class that is referenced in a plugin.xml file too, doesn't update the 
plugin.xml file. There are two alternatives to solve this problem:

1.) do a textual find/replace on certain files too (for example files with the 
extension .xml). But this can lead to a wrong refactoring too, since it doesn't 
know anything about the structure of the xml file and might change occurences 
which aren't releated to the changed Java element.
2.) open the refactoring framework for other plugins so that PDE could supply 
its own plugin.xml refactoring.

Short term should be (1), long term solution should be (2).
Comment 1 rolarenfan CLA 2001-12-12 10:25:18 EST
Dirk mentioned two possibilities when he opened this bug based on my report; I 
vote for the second one: "open the refactoring framework for other plugins so 
that PDE could supply its own plugin.xml refactoring", assuming that means "make 
the refactor-gizmo work on xml files the way it does on java files: i.e., in 
Java it knows where/how to look for imports, method-calls, etc. -- SO, in XML, 
it should know to look for tags or whatever they are called"
Comment 2 rolarenfan CLA 2001-12-21 14:33:37 EST
Seems to be a dupe of 299?
Comment 3 rolarenfan CLA 2002-01-04 11:05:21 EST
Here are two kinds of failures that show that refactoring should and could 
consider the plugin.xml file: 

In a project Foo, created by using the Plugin wizards (my tests were in a plugin 
that added an action to the main menu): 

a) rename the (wizard-generated) package in which the plugin's classes are 
found; there is one reference to that package for the FooPlugin.java class and 
one for the EditActionDelegate; see b and c for the effects of failing to change 
those references (if both are unchanged, go to # b).

b) rename the EditorActionDelegate class; if the plugin.xml isn't made 
consistent, the action (if the plugin is an action) will appear in the runtime 
workspace, but will crash on invocation, with the stack trace below, and the 
message (in the console): "Plug-in <id of plugin> was unable to load class 
<package>.<wrong name of class>." 

java.lang.ClassNotFoundException: <package>.<wrong name of class>
	at 
org.eclipse.core.internal.boot.DelegatingURLClassLoader.loadClass(DelegatingURLC
lassLoader.java(Compiled Code))
	at java.lang.ClassLoader.loadClass(ClassLoader.java(Compiled Code))
	at 
org.eclipse.core.internal.plugins.PluginDescriptor.createExecutableExtension(Plu
ginDescriptor.java:148)
	at 
org.eclipse.core.internal.plugins.PluginDescriptor.createExecutableExtension(Plu
ginDescriptor.java:185)
	at 
org.eclipse.core.internal.plugins.ConfigurationElement.createExecutableExtension
(ConfigurationElement.java:97)
	at 
org.eclipse.ui.internal.WorkbenchPlugin$1.run(WorkbenchPlugin.java:103)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:98)
	at 
org.eclipse.ui.internal.WorkbenchPlugin.createExtension(WorkbenchPlugin.java:100
)
	at 
org.eclipse.ui.internal.PluginAction.createDelegate(PluginAction.java:70)
	at 
org.eclipse.ui.internal.EditorPluginAction.createDelegate(EditorPluginAction.jav
a:37)
	at org.eclipse.ui.internal.PluginAction.run(PluginAction.java:114)
	at 
org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionCont
ributionItem.java:407)
	at 
org.eclipse.jface.action.ActionContributionItem.handleWidgetEvent(ActionContribu
tionItem.java:361)
	at 
org.eclipse.jface.action.ActionContributionItem.access$0(ActionContributionItem.
java:352)
	at 
org.eclipse.jface.action.ActionContributionItem$ActionListener.handleEvent(Actio
nContributionItem.java:47)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java(Compiled 
Code))
	at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:634)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1282)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1092)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:673)
	at org.eclipse.ui.internal.Workbench.run(Workbench.java:656)
	at 
org.eclipse.core.internal.boot.InternalBootLoader.run(InternalBootLoader.java:81
5)
	at org.eclipse.core.boot.BootLoader.run(BootLoader.java:285)
	at java.lang.reflect.Method.invoke(Native Method)
	at org.eclipse.core.launcher.Main.basicRun(Main.java:151)
	at org.eclipse.core.launcher.Main.run(Main.java:433)
	at org.eclipse.core.launcher.UIMain.main(UIMain.java:52)
===========================================================================

c) given that the problem described in # b is not present, then rename the 
(wizard-generated) plugin class; if the plugin.xml isn't made consistent, the 
action (if the plugin is an action) will appear in the runtime workspace, but 
will crash on invocation, with the stack trace below, and the message (in the 
console): "Plugin <id of plugin> activation failed while loading class 
<package>.<editor action delegate class>"

java.lang.ClassNotFoundException: <package>.<plugin class>
	at 
org.eclipse.core.internal.boot.DelegatingURLClassLoader.loadClass(DelegatingURLC
lassLoader.java(Compiled Code))
	at java.lang.ClassLoader.loadClass(ClassLoader.java(Compiled Code))
	at 
org.eclipse.core.internal.plugins.PluginDescriptor.internalDoPluginActivation(Pl
uginDescriptor.java:615)
	at 
org.eclipse.core.internal.plugins.PluginDescriptor.doPluginActivation(PluginDesc
riptor.java:204)
	at 
org.eclipse.core.internal.plugins.PluginClassLoader.activatePlugin(PluginClassLo
ader.java:52)
	at 
org.eclipse.core.internal.plugins.PluginClassLoader.findClassParentsSelf(PluginC
lassLoader.java(Compiled Code))
	at 
org.eclipse.core.internal.boot.DelegatingURLClassLoader.loadClass(DelegatingURLC
lassLoader.java(Compiled Code))
	at 
org.eclipse.core.internal.boot.DelegatingURLClassLoader.loadClass(DelegatingURLC
lassLoader.java(Compiled Code))
	at java.lang.ClassLoader.loadClass(ClassLoader.java(Compiled Code))
	at 
org.eclipse.core.internal.plugins.PluginDescriptor.createExecutableExtension(Plu
ginDescriptor.java:148)
	at 
org.eclipse.core.internal.plugins.PluginDescriptor.createExecutableExtension(Plu
ginDescriptor.java:185)
	at 
org.eclipse.core.internal.plugins.ConfigurationElement.createExecutableExtension
(ConfigurationElement.java:97)
	at 
org.eclipse.ui.internal.WorkbenchPlugin$1.run(WorkbenchPlugin.java:103)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:98)
	at 
org.eclipse.ui.internal.WorkbenchPlugin.createExtension(WorkbenchPlugin.java:100
)
	at 
org.eclipse.ui.internal.PluginAction.createDelegate(PluginAction.java:70)
	at 
org.eclipse.ui.internal.EditorPluginAction.createDelegate(EditorPluginAction.jav
a:37)
	at org.eclipse.ui.internal.PluginAction.run(PluginAction.java:114)
	at 
org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionCont
ributionItem.java:407)
	at 
org.eclipse.jface.action.ActionContributionItem.handleWidgetEvent(ActionContribu
tionItem.java:361)
	at 
org.eclipse.jface.action.ActionContributionItem.access$0(ActionContributionItem.
java:352)
	at 
org.eclipse.jface.action.ActionContributionItem$ActionListener.handleEvent(Actio
nContributionItem.java:47)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java(Compiled 
Code))
	at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:634)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1282)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1092)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:673)
	at org.eclipse.ui.internal.Workbench.run(Workbench.java:656)
	at 
org.eclipse.core.internal.boot.InternalBootLoader.run(InternalBootLoader.java:81
5)
	at org.eclipse.core.boot.BootLoader.run(BootLoader.java:285)
	at java.lang.reflect.Method.invoke(Native Method)
	at org.eclipse.core.launcher.Main.basicRun(Main.java:151)
	at org.eclipse.core.launcher.Main.run(Main.java:433)
	at org.eclipse.core.launcher.UIMain.main(UIMain.java:52)
============================================================================
Comment 4 Dirk Baeumer CLA 2002-01-10 04:52:57 EST
*** Bug 299 has been marked as a duplicate of this bug. ***
Comment 5 Dirk Baeumer CLA 2002-01-10 04:56:47 EST
We would like to have this feature, but is is not a priority for 2.0.

Postpone > 2.0
Comment 6 Johan Walles CLA 2002-01-10 05:14:56 EST
How is "Later" a resolution?  What Mozilla does with bugs they don't want to
solve immediately is that they assign the bug to "nobody@mozilla.org" and add
the keyword "helpwanted".  IMO, it would be great if you guys could do the same.

Some advantages of that is that:
* Unresolved bugs aren't marked as "resolved"...
* Easy to for people who want to help to find out where help is needed.

Comment 7 Dirk Baeumer CLA 2002-01-15 04:18:34 EST
Good suggestion. 

We already started to flag PRs with 'helpwanted' but we don't assign these bugs 
to nobody@oti.com. We are looking into changing our procedure accordingly.

 
Comment 8 Erich Gamma CLA 2002-01-15 08:37:03 EST
I agree with Dirk, currently nobody is me...
Comment 9 rolarenfan CLA 2002-01-30 11:16:26 EST
If this might increase its priority ("increase" in the sense of "sooner") 
here's another case: 

create, compile, etc. a plugin Foo; all is well 

create, compile, make dependent upon Foo another plugin Bar; all is well

now rename the *project* Foo to Food.  Ooops -- Bar barfs, and one needs to go 
both to Bar's manifest editor to reset the dependency from Foo (still oddly a 
possibility) to Food by hand, and also go to Bar's Project properties and 
reset the project reference from Foo (still oddly a possibility) to Food by 
hand.


Comment 10 Erich Gamma CLA 2002-01-31 05:59:36 EST
I got burned by this as well and I would really like to have this feature. 

As has been suggested in this bug there is 1) a quick and dirty way (text 
search) or 2) supporting refactoring in other file types. 

We should do 2) but 2) is work and we can't commit to it for 2.0.
Comment 11 Dirk Baeumer CLA 2002-07-25 14:18:43 EDT
Not clear yet if refactoring will become public in 2.x or 3.x
Comment 12 Dirk Baeumer CLA 2002-11-25 05:08:13 EST
*** Bug 27035 has been marked as a duplicate of this bug. ***
Comment 13 Dirk Baeumer CLA 2002-11-25 05:08:47 EST
We should also consider working sets and lauch configs when introducing 
refactoring participants.
Comment 14 Erich Gamma CLA 2003-02-20 17:12:57 EST
option to search in non-Java file is now available.