1.2.3 beta: Copy/Paste controls

SWT Designer allows you to create the views, editors, perspectives, pref pages, composites, etc. that comprise Eclipse SWT & RCP applications and plug-ins.

Moderators: Konstantin.Scheglov, gnebling, Alexander.Mitin, jwren, Eric Clayberg

1.2.3 beta: Copy/Paste controls

Postby cebarne2 » Mon Jan 26, 2004 6:59 am

Using a recent beta of 1.2.3.

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
Last edited by cebarne2 on Mon Jan 26, 2004 8:59 am, edited 1 time in total.
cebarne2
 
Posts: 67
Joined: Tue Sep 23, 2003 10:11 am
Location: Cedar Rapids, IA

Postby cebarne2 » Mon Jan 26, 2004 7:15 am

I keep getting exceptions similar to the following since I did the paste. Restarting Eclipse clears things up.

Code: Select all
!ENTRY org.eclipse.ui 4 4 Jan 26, 2004 09:13:41.693
!MESSAGE Unhandled exception caught in event loop.
!ENTRY org.eclipse.ui 4 0 Jan 26, 2004 09:13:41.703
!MESSAGE java.lang.NullPointerException
!STACK 0
java.lang.NullPointerException
   at org.eclipse.gef.ui.palette.PaletteViewer.setActiveTool(SourceFile:264)
   at org.eclipse.gef.internal.ui.palette.editparts.ToolEntryEditPart$2.actionPerformed(SourceFile:165)
   at org.eclipse.draw2d.Clickable.fireActionPerformed(Clickable.java:195)
   at org.eclipse.draw2d.Clickable$1.actionPerformed(Clickable.java:167)
   at org.eclipse.draw2d.ButtonModel.fireActionPerformed(ButtonModel.java:131)
   at org.eclipse.draw2d.ToggleModel.fireActionPerformed(ToggleModel.java:28)
   at org.eclipse.draw2d.ButtonModel$DefaultFiringBehavior.released(ButtonModel.java:484)
   at org.eclipse.draw2d.ButtonModel.fireReleased(ButtonModel.java:169)
   at org.eclipse.draw2d.ButtonModel.setPressed(ButtonModel.java:444)
   at org.eclipse.gef.internal.ui.palette.editparts.ToolEntryEditPart$ToggleButtonTracker.handleButtonUp(SourceFile:94)
   at org.eclipse.gef.tools.AbstractTool.mouseUp(AbstractTool.java:1006)
   at org.eclipse.gef.tools.SelectionTool.mouseUp(SelectionTool.java:504)
   at org.eclipse.gef.EditDomain.mouseUp(EditDomain.java:232)
   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)


(I do understand that this is beta software. So I am only bringing these issues to your attention -if not already there- I DO NOT demand an immediate solution. Thanks)
cebarne2
 
Posts: 67
Joined: Tue Sep 23, 2003 10:11 am
Location: Cedar Rapids, IA

Re: 1.2.3 beta: Copy/Paste controls

Postby Eric Clayberg » Tue Jan 27, 2004 1:27 pm

cebarne2 wrote: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)

This has been fixed in the v1.2.3 GA release.
Last edited by Eric Clayberg on Sun Feb 01, 2004 9:24 am, edited 2 times in total.
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA

Postby cebarne2 » Sun Feb 01, 2004 8:39 am

Didn't see a reply. :?:
cebarne2
 
Posts: 67
Joined: Tue Sep 23, 2003 10:11 am
Location: Cedar Rapids, IA

Postby Eric Clayberg » Sun Feb 01, 2004 9:25 am

Give the v1.2.3 GA release a try. It should correct the problem.
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA

Postby cebarne2 » Tue Feb 10, 2004 6:52 am

Thanks. My browser must have done something funky with this thread...
cebarne2
 
Posts: 67
Joined: Tue Sep 23, 2003 10:11 am
Location: Cedar Rapids, IA


Return to SWT Designer

Who is online

Users browsing this forum: No registered users and 1 guest