Ok. Simple steps.
Create a new workspace.
Set editor preferences to show line numbers.
Create a new plugin project named Test. Keep all defaults, but do not use a
template.
In the test package, create a new visual class SWT->Composite named C.
Display palette and java bean views.
Drop a CLabel in upper left (use default field name).
Drop a Scale somewhere below it (use default field name).
Add a selection event handler to the Scale (via popup menu from visuals
display).
delete line 21: cLabel.setText("CLabel");
now, between lines 28 and 29:
28: });
29: setSize(new Point(300, 200));
create a new line 29: cLabel.setText("CLabel " + scale.getSelection());
Save source file (using control-S).
Pause and unpause VE (using toolbar). Get NPE.
entire C.java:
package test;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.custom.CLabel;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Scale;
public class C extends Composite {
private CLabel cLabel = null;
private Scale scale = null;
public C(Composite parent, int style) {
super(parent, style);
initialize();
}
private void initialize() {
cLabel = new CLabel(this, SWT.NONE);
cLabel.setBounds(new org.eclipse.swt.graphics.Rectangle(29,30,38,19));
scale = new Scale(this, SWT.NONE);
scale.setBounds(new org.eclipse.swt.graphics.Rectangle(75,106,170,42));
scale.addSelectionListener(new org.eclipse.swt.events.SelectionAdapter() {
public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
System.out.println("widgetSelected()"); // TODO Auto-generated Event
stub widgetSelected()
}
});
cLabel.setText("CLabel " + scale.getSelection());
setSize(new Point(300, 200));
}
}
.log file contains:
!SESSION 2005-08-01
13:50:19.816 -----------------------------------------------
eclipse.buildId=I20050627-1435
java.version=1.5.0_04
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US
Framework arguments: -showlocation
Command-line arguments: -os win32 -ws win32 -arch x86 -showlocation
!ENTRY org.eclipse.ve.java.core 4 0 2005-08-01 13:55:10.201
!MESSAGE Exception thrown.
!STACK 0
java.lang.NullPointerException
at
org.eclipse.ve.internal.swt.CompositeGraphicalEditPart.setupControl(CompositeGraphicalEditPart.java:96)
at
org.eclipse.ve.internal.swt.CompositeGraphicalEditPart.createChild(CompositeGraphicalEditPart.java:84)
at
org.eclipse.gef.editparts.AbstractEditPart.refreshChildren(AbstractEditPart.java:733)
at
org.eclipse.gef.editparts.AbstractEditPart.refresh(AbstractEditPart.java:684)
at
org.eclipse.gef.editparts.AbstractGraphicalEditPart.refresh(AbstractGraphicalEditPart.java:554)
at
org.eclipse.gef.editparts.AbstractEditPart.addNotify(AbstractEditPart.java:232)
at
org.eclipse.gef.editparts.AbstractGraphicalEditPart.addNotify(AbstractGraphicalEditPart.java:212)
at
org.eclipse.gef.editparts.AbstractEditPart.addChild(AbstractEditPart.java:195)
at
org.eclipse.gef.editparts.AbstractEditPart.refreshChildren(AbstractEditPart.java:734)
at
org.eclipse.gef.editparts.AbstractEditPart.refresh(AbstractEditPart.java:684)
at
org.eclipse.gef.editparts.AbstractGraphicalEditPart.refresh(AbstractGraphicalEditPart.java:554)
at
org.eclipse.ve.internal.java.codegen.editorpart.JavaVisualEditorPart.setRootModel(JavaVisualEditorPart.java:506)
at
org.eclipse.ve.internal.java.codegen.editorpart.JavaVisualEditorPart.initializeViewers(JavaVisualEditorPart.java:987)
at
org.eclipse.ve.internal.java.codegen.editorpart.JavaVisualEditorPart$12.run(JavaVisualEditorPart.java:1977)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
at
org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:123)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3057)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2716)
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(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
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)
!ENTRY org.eclipse.ui 4 4 2005-08-01 13:55:10.217
!MESSAGE Unhandled event loop exception
!ENTRY org.eclipse.ui 4 0 2005-08-01 13:55:10.217
!MESSAGE Failed to execute runnable (java.lang.NullPointerException)
!STACK 0
org.eclipse.swt.SWTException: Failed to execute runnable
(java.lang.NullPointerException)
at org.eclipse.swt.SWT.error(SWT.java:2942)
at org.eclipse.swt.SWT.error(SWT.java:2865)
at
org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:126)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3057)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2716)
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(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
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)
Caused by: java.lang.NullPointerException
at
org.eclipse.ve.internal.swt.CompositeGraphicalEditPart.setupControl(CompositeGraphicalEditPart.java:96)
at
org.eclipse.ve.internal.swt.CompositeGraphicalEditPart.createChild(CompositeGraphicalEditPart.java:84)
at
org.eclipse.gef.editparts.AbstractEditPart.refreshChildren(AbstractEditPart.java:733)
at
org.eclipse.gef.editparts.AbstractEditPart.refresh(AbstractEditPart.java:684)
at
org.eclipse.gef.editparts.AbstractGraphicalEditPart.refresh(AbstractGraphicalEditPart.java:554)
at
org.eclipse.gef.editparts.AbstractEditPart.addNotify(AbstractEditPart.java:232)
at
org.eclipse.gef.editparts.AbstractGraphicalEditPart.addNotify(AbstractGraphicalEditPart.java:212)
at
org.eclipse.gef.editparts.AbstractEditPart.addChild(AbstractEditPart.java:195)
at
org.eclipse.gef.editparts.AbstractEditPart.refreshChildren(AbstractEditPart.java:734)
at
org.eclipse.gef.editparts.AbstractEditPart.refresh(AbstractEditPart.java:684)
at
org.eclipse.gef.editparts.AbstractGraphicalEditPart.refresh(AbstractGraphicalEditPart.java:554)
at
org.eclipse.ve.internal.java.codegen.editorpart.JavaVisualEditorPart.setRootModel(JavaVisualEditorPart.java:506)
at
org.eclipse.ve.internal.java.codegen.editorpart.JavaVisualEditorPart.initializeViewers(JavaVisualEditorPart.java:987)
at
org.eclipse.ve.internal.java.codegen.editorpart.JavaVisualEditorPart$12.run(JavaVisualEditorPart.java:1977)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
at
org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:123)
... 18 more
"Joe Winchester" <winchest@xxxxxxxxxx> wrote in message
news:dcl5u7$lhg$1@xxxxxxxxxxxxxxxxxxx
Hi Joel,
From your description I have tried to re-create the error you got but
don't have enough information for me to encounter it. Could you please
post an idiot proof description of how to get the error, e.g.
1 - Open file foo.java
2 - select the lines 30 to 40. Cut and paste these so they are at line
20.
3 - Close the editor.
4 - Clean the project
5 - Re-open and see the VE crash.
Also post the full source code of the file(s) in error. Don't include
that much narrative of why you are doing what you are doing with moving
the code around. To create a bug report all we need is a set of
re-creatable steps from a standing start where we can make it crash and
then see what's wrong. If it crashes it's a bug.
By the way - there are two bits of parsing that go on with the VE when you
edit source code. One occurs each time you change the source and is a
snippit reload that tries to do intelligent delta on what has changed into
the model. If this can't do its job (which sometimes legitimately occurs
if the sippit analyzer realizes the changes made are too big to delta in)
then a full reload occurs. You can trigger this at any time by pushing
the pause button at the top and then unpausing. Each time the VE closes a
file and re-opens it we used to always re-parse from scratch the source,
however now we have a cache that holds information that helps performance.
This cache is what is cleared by doing a Project>Clean.
Best regards,
Joe Winchester