ponder-lab / Constants-to-Enum-Eclipse-Plugin

A research prototype Eclipse plugin that refactors Java legacy code to make use of the new enum program construct that was introduced in Java 5.
Eclipse Public License 1.0
3 stars 2 forks source link

Refactoring should not use UI components for code changes #16

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Currently we reuse the NewEnumTypeWizard page as part of the refactoring.
The refactoring must not have any dependencies to UI components as this can
lead to problematic code pathes.

Eg. running the refactoring in another thread than the UI thread leads to
major refactoring failures.

Caused by: java.lang.NullPointerException
    at
org.eclipse.jface.resource.JFaceResources.getResources(JFaceResources.java:207)
    at org.eclipse.jface.resource.ImageRegistry.<init>(ImageRegistry.java:152)
    at org.eclipse.jface.resource.ImageRegistry.<init>(ImageRegistry.java:124)
    at
org.eclipse.jdt.internal.ui.JavaPluginImages.getImageRegistry(JavaPluginImages.j
ava:534)
    at org.eclipse.jdt.internal.ui.JavaPluginImages.get(JavaPluginImages.java:491)
    at
org.eclipse.jdt.ui.wizards.NewTypeWizardPage$InterfacesListLabelProvider.<init>(
NewTypeWizardPage.java:305)
    at
org.eclipse.jdt.ui.wizards.NewTypeWizardPage.<init>(NewTypeWizardPage.java:442)
    at
org.eclipse.jdt.ui.wizards.NewEnumWizardPage.<init>(NewEnumWizardPage.java:49)
    at
edu.ohio_state.khatchad.refactoring.ConvertConstantsToEnumRefactoring.insertNewE
numType(ConvertConstantsToEnumRefactoring.java:622)
    at
edu.ohio_state.khatchad.refactoring.ConvertConstantsToEnumRefactoring.checkFinal
Conditions(ConvertConstantsToEnumRefactoring.java:351)
    at
org.eclipse.ltk.core.refactoring.CheckConditionsOperation.run(CheckConditionsOpe
ration.java:85)
    at
org.eclipse.ltk.core.refactoring.CreateChangeOperation.run(CreateChangeOperation
.java:121)
    at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1800)
    at
org.eclipse.ltk.internal.ui.refactoring.WorkbenchRunnableAdapter.run(WorkbenchRu
nnableAdapter.java:87)
    at
org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.jav
a:121)
Root exception:

Original issue reported on code.google.com by b.muskalla@gmail.com on 28 Aug 2009 at 3:54

GoogleCodeExporter commented 9 years ago
just for the record: I was talking about
ConvertConstantsToEnumRefactoring#insertNewEnumType with reference to the 
NewEnumTypePage

Original comment by b.muskalla@gmail.com on 28 Aug 2009 at 3:55

GoogleCodeExporter commented 9 years ago
Right, this is obviously a code-reuse hack. Getting this issue fixed may 
involve some work; we may need to 
replicate code found in the new enum type page functionality.

Original comment by raffi.t.khatchadourian on 1 Sep 2009 at 12:32

GoogleCodeExporter commented 9 years ago
Hi Ben. If it's okay with you I'll start working on this so the tool will be 
ready for the demonstration next week.

Original comment by raffi.t.khatchadourian on 17 Sep 2010 at 5:58