1.2.3GA: Funny code generation after copy & paste

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.3GA: Funny code generation after copy & paste

Postby cebarne2 » Tue Feb 10, 2004 7:00 am

I used the preview window to copy and paste a set of five controls.

Here is the original controls' source:

Code: Select all
         {
            final List lstPaths = new List(grpInclude, SWT.BORDER);
            final GridData gridData = new GridData(GridData.FILL_BOTH);
            gridData.verticalSpan = 4;
            lstPaths.setLayoutData(gridData);
         }
         {
            final Button cmdAddPath = new Button(grpInclude, SWT.NONE);
            cmdAddPath.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
            cmdAddPath.setText("Add");
         }
         {
            final Button cmdRemovePath = new Button(grpInclude, SWT.NONE);
            cmdRemovePath.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
            cmdRemovePath.setText("Remove");
         }
         {
            final Button cmdUpPath = new Button(grpInclude, SWT.NONE);
            cmdUpPath.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
            cmdUpPath.setText("Up");
         }
         {
            final Button cmdDownPath = new Button(grpInclude, SWT.NONE);
            cmdDownPath.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_BEGINNING));
            cmdDownPath.setText("Down");
         }


Here is the pasted cotrols' source:

Code: Select all
         {
            final List lstDefined = new List(grpDefined, SWT.BORDER);
            final GridData gridData = new GridData(GridData.FILL_BOTH);
            gridData.verticalSpan = 4;
            lstDefined.setLayoutData(gridData);
            {
               ;
            }
         }
         {
            final Button cmdAddDefined = new Button(grpDefined, SWT.NONE);
            cmdAddDefined.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
            cmdAddDefined.setText("Add");
            {
               ;
            }
         }
         {
            final Button cmdRemoveDefined = new Button(grpDefined, SWT.NONE);
            cmdRemoveDefined.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
            cmdRemoveDefined.setText("Remove");
            {
               ;
            }
         }
         {
            final Button cmdUpDefined = new Button(grpDefined, SWT.NONE);
            cmdUpDefined.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
            cmdUpDefined.setText("Up");
            {
               ;
            }
         }
         {
            final Button cmdDownDefined = new Button(grpDefined, SWT.NONE);
            cmdDownDefined.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_BEGINNING));
            cmdDownDefined.setText("Down");
            {
               ;
            }
         }


Notice the stray {;} for each control.

I am using 1.2.3 GA.

Thanks,
Chad
cebarne2
 
Posts: 67
Joined: Tue Sep 23, 2003 10:11 am
Location: Cedar Rapids, IA

Postby admin » Wed Feb 11, 2004 12:14 am

Hm...
This is second bug that I can not reproduce. :-(
Empty blocks most probably were create for GridData, but we have special check for this in paste. When I do copy and paste for your code, it does not creates empty blocks...
Can you try latest beta version?
admin
Moderator
 
Posts: 166
Joined: Thu Jul 24, 2003 12:25 am

Postby cebarne2 » Wed Feb 11, 2004 6:00 am

I will try that. I'm knee-deep in development right now, so I will post IF the issue occurs again.

When the issue occurs, I was copying from one group control to another group control. This may make a difference.

Just FYI: To install new versions of the plug-in, I use the designer-delete.bat file. Please advise if this isn't the best way.

Thank you for your support.[/i]
cebarne2
 
Posts: 67
Joined: Tue Sep 23, 2003 10:11 am
Location: Cedar Rapids, IA

Postby cebarne2 » Fri Feb 13, 2004 7:23 am

Still happening with the 02/11/04 1.2.3 beta version.

How to reproduce:

1) Copy the first three controls from the preview window (chkName, lblDescription, and lblRequired)
2) Paste them after the last control in the preview
3) I get the empty {;} blocks in the source.

Here is my new source that has the problem:

Code: Select all
public class WidgetTests extends Composite {

   private List argumentField;
   public WidgetTests(Composite parent, int style) {
      super(parent, style);
      final GridLayout gridLayout = new GridLayout();
      gridLayout.numColumns = 3;
      setLayout(gridLayout);
      {
         final Button chkName = new Button(this, SWT.CHECK);
         chkName.setText("-e");
      }
      {
         final Label lblDescription = new Label(this, SWT.NONE);
         final GridData gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
         gridData.horizontalSpan = 2;
         lblDescription.setLayoutData(gridData);
         lblDescription.setText("Natural language description of the option.");
      }
      {
         final Label lblRequired = new Label(this, SWT.RIGHT);
         lblRequired.setText("*");
         lblRequired.setForeground(ResourceManager.getColor(SWT.COLOR_RED));
         lblRequired.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
      }
      {
         final Text txtArgument = new Text(this, SWT.BORDER);
         txtArgument.setEnabled(false);
         final GridData gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
         gridData.horizontalSpan = 2;
         txtArgument.setLayoutData(gridData);
      }
      {
         final Button cmdBrowse = new Button(this, SWT.NONE);
         cmdBrowse.setEnabled(false);
         final GridData gridData = new GridData(GridData.HORIZONTAL_ALIGN_END);
         gridData.horizontalSpan = 3;
         cmdBrowse.setLayoutData(gridData);
         cmdBrowse.setText("...");
      }
      {
         final Button button = new Button(this, SWT.CHECK);
         button.setText("-e");
      }
      {
         final Label label = new Label(this, SWT.NONE);
         final GridData gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
         gridData.horizontalSpan = 2;
         label.setLayoutData(gridData);
         label.setText("Natural language description of the option.");
      }
      {
         final Label label = new Label(this, SWT.RIGHT);
         final GridData gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_BEGINNING);
         gridData.verticalSpan = 4;
         label.setLayoutData(gridData);
         label.setForeground(ResourceManager.getColor(SWT.COLOR_RED));
         label.setText("*");
      }
      {
         argumentField = new List(this, SWT.BORDER);
         final GridData gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL);
         gridData.verticalSpan = 4;
         argumentField.setLayoutData(gridData);
      }
      {
         final Button cmdAdd = new Button(this, SWT.NONE);
         cmdAdd.addSelectionListener(new SelectionAdapter() {
            public void widgetSelected(SelectionEvent e) {
            }
         });
         cmdAdd.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
         cmdAdd.setText("+");
      }
      {
         final Button cmdRemove = new Button(this, SWT.NONE);
         cmdRemove.addSelectionListener(new SelectionAdapter() {
            public void widgetSelected(SelectionEvent e) {
            }
         });
         cmdRemove.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
         cmdRemove.setText("-");
      }
      {
         final Button cmdUp = new Button(this, SWT.NONE);
         cmdUp.addSelectionListener(new SelectionAdapter() {
            public void widgetSelected(SelectionEvent e) {
            }
         });
         cmdUp.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
         cmdUp.setText("^");
      }
      {
         final Button cmdDown = new Button(this, SWT.NONE);
         cmdDown.addSelectionListener(new SelectionAdapter() {
            public void widgetSelected(SelectionEvent e) {
            }
         });
         cmdDown.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
         cmdDown.setText("v");
      }

   }
   public void dispose() {
      super.dispose();
   }
   protected void checkSubclass() {
   }
}


This is the result in the new source:

Code: Select all
.
.
.      {
         final Button button = new Button(this, SWT.CHECK);
         button.setText("-e");
      }
      {
         final Label label = new Label(this, SWT.NONE);
         final GridData gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
         gridData.horizontalSpan = 2;
         label.setLayoutData(gridData);
         label.setText("Natural language description of the option.");
         {
            ;
         }
      }
      {
         final Label label = new Label(this, SWT.RIGHT);
         label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
         label.setForeground(ResourceManager.getColor(SWT.COLOR_RED));
         label.setText("*");
         {
            ;
         }
      }
.
.
.
cebarne2
 
Posts: 67
Joined: Tue Sep 23, 2003 10:11 am
Location: Cedar Rapids, IA

Postby Eric Clayberg » Fri Feb 13, 2004 4:57 pm

cebarne2 wrote:Still happening with the 02/11/04 1.2.3 beta version.

How to reproduce:

1) Copy the first three controls from the preview window (chkName, lblDescription, and lblRequired)
2) Paste them after the last control in the preview
3) I get the empty {;} blocks in the source.


Thank you for the example. I think we have it fixed in our current code base (or at least I can't reproduce the problem). We will be putting out our first v1.2.4 beta shortly.
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


Return to SWT Designer

Who is online

Users browsing this forum: No registered users and 1 guest