Eclipse 2.1.2
Java 1.4_x
1) I select multiple controls (inside a group control)
2) Select Copy (right-click)
3) Select Paste (right-click)
4) Place the controls
The copied controls appear, but some properties were not preserved:
-layoutData.hAlign (reset to left)
-layoutData.hSpan (reset to 1)
Also, I can no longer select controls with the mouse in the preview area. I have to select them from the tree. After selecting a control from the tree, then I can go back and select them like normal from the preview window.
Here's the exceptions I get after pasting the controls and trying to click on one:
- Code: Select all
!ENTRY org.eclipse.ui 4 4 Jan 26, 2004 08:51:41.237
!MESSAGE Unhandled exception caught in event loop.
!ENTRY org.eclipse.ui 4 0 Jan 26, 2004 08:51:41.237
!MESSAGE java.lang.NullPointerException
!STACK 0
java.lang.NullPointerException
at org.eclipse.gef.ui.palette.PaletteViewer.setActiveTool(SourceFile:264)
at com.swtdesigner.gef.DesignerEditor.c(SourceFile:761)
at com.swtdesigner.gef.actions.PasteAction.run(SourceFile:38)
at com.swtdesigner.gef.common.selection.c.run(SourceFile:322)
at org.eclipse.jface.action.Action.runWithEvent(Action.java:842)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:456)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetEvent(ActionContributionItem.java:403)
at org.eclipse.jface.action.ActionContributionItem.access$0(ActionContributionItem.java:397)
at org.eclipse.jface.action.ActionContributionItem$ActionListener.handleEvent(ActionContributionItem.java:72)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:81)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:840)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2022)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1729)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1402)
at org.eclipse.ui.internal.Workbench.run(Workbench.java:1385)
at org.eclipse.core.internal.boot.InternalBootLoader.run(InternalBootLoader.java:858)
at org.eclipse.core.boot.BootLoader.run(BootLoader.java:461)
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.basicRun(Main.java:291)
at org.eclipse.core.launcher.Main.run(Main.java:747)
at org.eclipse.core.launcher.Main.main(Main.java:583)
!ENTRY org.eclipse.ui 4 4 Jan 26, 2004 08:51:43.140
!MESSAGE Unhandled exception caught in event loop.
!ENTRY org.eclipse.ui 4 0 Jan 26, 2004 08:51:43.140
!MESSAGE java.lang.NullPointerException
!STACK 0
java.lang.NullPointerException
at org.eclipse.gef.ui.palette.PaletteViewer.setActiveTool(SourceFile:264)
at org.eclipse.gef.EditDomain.loadDefaultTool(EditDomain.java:161)
at org.eclipse.gef.tools.AbstractTool.handleFinished(AbstractTool.java:668)
at org.eclipse.gef.tools.CreationTool.handleButtonUp(CreationTool.java:126)
at org.eclipse.gef.tools.AbstractTool.mouseUp(AbstractTool.java:1006)
at org.eclipse.gef.EditDomain.mouseUp(EditDomain.java:232)
at com.swtdesigner.gef.DesignerEditDomain.mouseUp(SourceFile:110)
at org.eclipse.gef.ui.parts.DomainEventDispatcher.dispatchMouseReleased(DomainEventDispatcher.java:346)
at org.eclipse.draw2d.LightweightSystem$EventHandler.mouseUp(LightweightSystem.java:511)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:132)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:81)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:840)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2022)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1729)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1402)
at org.eclipse.ui.internal.Workbench.run(Workbench.java:1385)
at org.eclipse.core.internal.boot.InternalBootLoader.run(InternalBootLoader.java:858)
at org.eclipse.core.boot.BootLoader.run(BootLoader.java:461)
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.basicRun(Main.java:291)
at org.eclipse.core.launcher.Main.run(Main.java:747)
at org.eclipse.core.launcher.Main.main(Main.java:583)
Here's the sample code if you desire:
- Code: Select all
protected Control createContents(Composite parent) {
Composite thisComposite = new Composite(parent, SWT.NONE);
thisComposite.setLayout(new GridLayout());
{
final Group grpConfig = new Group(thisComposite, SWT.NONE);
grpConfig.setText("Configuration Files");
grpConfig.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL));
final GridLayout gridLayout = new GridLayout();
gridLayout.numColumns = 3;
grpConfig.setLayout(gridLayout);
{
final Label lblLocalConfig = new Label(grpConfig, SWT.RIGHT);
lblLocalConfig.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
lblLocalConfig.setText("Local Configuration:");
}
{
final Text txtLocConfig = new Text(grpConfig, SWT.BORDER);
txtLocConfig.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
}
{
final Button cmdOpenLocConfig = new Button(grpConfig, SWT.NONE);
cmdOpenLocConfig.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
cmdOpenLocConfig.setText("...");
}
{
final Label label = new Label(grpConfig, SWT.RIGHT);
label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
label.setText("Last Modified:");
}
{
final Label label = new Label(grpConfig, SWT.NONE);
final GridData gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
gridData.horizontalSpan = 2;
label.setLayoutData(gridData);
label.setText("N/A");
}
{
final Label lblProjConfig = new Label(grpConfig, SWT.RIGHT);
lblProjConfig.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
lblProjConfig.setText("Project Configuration:");
}
{
final Text txtProjConfig = new Text(grpConfig, SWT.BORDER);
txtProjConfig.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
}
{
final Button cmdOpenPrjConfig = new Button(grpConfig, SWT.NONE);
cmdOpenPrjConfig.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
cmdOpenPrjConfig.setText("...");
}
{
final Label lblProjLastModified_RO = new Label(grpConfig, SWT.RIGHT);
final GridData gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
lblProjLastModified_RO.setLayoutData(gridData);
lblProjLastModified_RO.setText("Last Modified:");
}
{
final Label lblProjLastModified = new Label(grpConfig, SWT.NONE);
final GridData gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
gridData.horizontalSpan = 2;
lblProjLastModified.setLayoutData(gridData);
lblProjLastModified.setText("N/A");
}
}
return thisComposite;
}
Try selecting the last two labels and copy/paste them to the next row.
Thanks,
Chad