Bug? Expose Control

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

Bug? Expose Control

Postby meme » Wed Nov 09, 2005 10:13 am

Hi there,

I'm currently running in trouble. I've got a WizardPage with several Controls on the Page (Text, Combo, Radio).

But when I use the "expost control" from the context menu I receive always the same name of the first control I've got on the page. In the example below it's the getNewOwner(). If I try to expose another control
I'll receive an dialog with the error-message that the method getNewOwner exists (what's really true). But if I even change the method name I'll receive a method wich returns the control of the first control on the site (here: newOwner).

I'm using:
SWT-Designer:
Version: 4.2.0
Build id: 2005.11.04

and Eclipse 3.1.1:
Version: 3.1.1
Build id: M20050929-0840

Example-Code:
Code: Select all
package de.isi.client.objekte.wizards.pages;

import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;

public abstract class AbstractOwnerPage extends WizardPage {

   private Button newOwner;
   private Button chooseOwner;
   private Text ownerCity;
   private Text ownerZip;
   private Text ownerAddress2;
   private Text ownerAddress1;
   private Text ownerName;
   private Combo existingOwner;
   private boolean controlsInitialized = false;
   /**
    * Create the wizard
    */
   public AbstractOwnerPage() {
      super("wizardPage");
      setTitle("Wizard Page title");
      setDescription("Wizard Page description");
   }

   /**
    * Create contents of the wizard
    * @param parent
    */
   public void createControl(Composite parent) {
      Composite container = new Composite(parent, SWT.NULL);
      final GridLayout gridLayout = new GridLayout();
      gridLayout.numColumns = 3;
      container.setLayout(gridLayout);
      //
      setControl(container);

      chooseOwner = new Button(container, SWT.RADIO);
      chooseOwner.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 3, 1));
      chooseOwner.setText("Bestehenden Eigentümer auswählen:");

      existingOwner = new Combo(container, SWT.NONE);
      existingOwner.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 3, 1));

      newOwner = new Button(container, SWT.RADIO);
      newOwner.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 3, 1));
      newOwner.setText("Neuen Eigentümer anlegen:");

      final Label nameLabel = new Label(container, SWT.NONE);
      nameLabel.setText("Name:");

      ownerName = new Text(container, SWT.BORDER);
      ownerName.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1));

      final Label adresseLabel = new Label(container, SWT.NONE);
      adresseLabel.setText("Adresse");

      ownerAddress1 = new Text(container, SWT.BORDER);
      ownerAddress1.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1));
      new Label(container, SWT.NONE);

      ownerAddress2 = new Text(container, SWT.BORDER);
      ownerAddress2.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1));

      final Label plzortLabel = new Label(container, SWT.NONE);
      plzortLabel.setLayoutData(new GridData(57, SWT.DEFAULT));
      plzortLabel.setText("PLZ/Ort:");

      ownerZip = new Text(container, SWT.BORDER);
      final GridData gridData = new GridData(65, SWT.DEFAULT);
      ownerZip.setLayoutData(gridData);

      ownerCity = new Text(container, SWT.BORDER);
      ownerCity.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, true, false));
      controlsInitialized = true;
   }
   
   protected abstract void initializeContents();

   public boolean isControlsInitialized() {
      return controlsInitialized;
   }

   public void setControlsInitialized(boolean controlsInitialized) {
      this.controlsInitialized = controlsInitialized;
   }
   protected Button getNewOwner() {
      return newOwner;
   }


}
meme
 
Posts: 4
Joined: Tue Nov 08, 2005 1:34 am

Abstract-Class

Postby meme » Fri Nov 11, 2005 8:29 am

Hi,

I've found the problem. This problem occures only when I declare the Class "abstract". So if I expose the controls als protected and declare the "abstract-ness" afterwards it's no problem.

yours

marc
meme
 
Posts: 4
Joined: Tue Nov 08, 2005 1:34 am

Re: Abstract-Class

Postby Eric Clayberg » Mon Nov 14, 2005 9:41 am

meme wrote:I've found the problem. This problem occures only when I declare the Class "abstract". So if I expose the controls als protected and declare the "abstract-ness" afterwards it's no problem.

Yes. The problem was caused by the class being abstract.

This has been fixed in the latest v4.2.1 build.
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