Example usage for org.eclipse.jface.fieldassist AutoCompleteField AutoCompleteField

List of usage examples for org.eclipse.jface.fieldassist AutoCompleteField AutoCompleteField

Introduction

In this page you can find the example usage for org.eclipse.jface.fieldassist AutoCompleteField AutoCompleteField.

Prototype

public AutoCompleteField(Control control, IControlContentAdapter controlContentAdapter, String... proposals) 

Source Link

Document

Construct an AutoComplete field on the specified control, whose completions are characterized by the specified array of Strings.

Usage

From source file:org.eclipse.wst.server.ui.internal.wizard.page.NewManualServerComposite.java

License:Open Source License

/**
 * Returns this page's initial visual components.
 *///  w  w w .  j  a v a2s .co m
protected void createControl() {
    // top level group
    GridLayout layout = new GridLayout();
    layout.numColumns = 3;
    layout.horizontalSpacing = SWTUtil.convertHorizontalDLUsToPixels(this, 4);
    layout.verticalSpacing = SWTUtil.convertVerticalDLUsToPixels(this, 4);
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    setLayout(layout);

    this.setFont(getParent().getFont());
    IWorkbenchHelpSystem whs = PlatformUI.getWorkbench().getHelpSystem();
    whs.setHelp(this, ContextIds.NEW_SERVER_WIZARD);

    List<ServerCreationWizardPageExtension> pageExtensionLst = ServerUIPlugin
            .getServerCreationWizardPageExtensions();
    // Add the page modifier top section UI. 
    for (ServerCreationWizardPageExtension curPageExtension : pageExtensionLst) {
        curPageExtension.createControl(ServerCreationWizardPageExtension.UI_POSITION.TOP, this);
        curPageExtension.setUIControlListener(this);
    }

    serverTypeComposite = new ServerTypeComposite(this, moduleType, serverTypeId,
            new ServerTypeComposite.ServerTypeSelectionListener() {
                public void serverTypeSelected(IServerType type2) {
                    handleTypeSelection(type2);
                    //WizardUtil.defaultSelect(parent, CreateServerWizardPage.this);
                }
            });
    serverTypeComposite.setIncludeIncompatibleVersions(includeIncompatible);
    GridData data = new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL);
    data.horizontalSpan = 3;
    serverTypeComposite.setLayoutData(data);
    whs.setHelp(serverTypeComposite, ContextIds.NEW_SERVER_TYPE);

    // Add the page modifier middle section UI. 
    for (ServerCreationWizardPageExtension curPageExtension : pageExtensionLst) {
        curPageExtension.createControl(ServerCreationWizardPageExtension.UI_POSITION.MIDDLE, this);
    }

    hostnameListener = new IHostnameSelectionListener() {
        public void hostnameSelected(String selectedHostname) {
            setHost(selectedHostname);
        }
    };
    hostnameLabel = new Label(this, SWT.NONE);
    hostnameLabel.setText(Messages.hostname);
    hostname = new Text(this, SWT.SINGLE | SWT.BORDER | SWT.CANCEL);
    hostname.setText(HostnameComposite.LOCALHOST);
    hostnameDecoration = new ControlDecoration(hostname, SWT.TOP | SWT.LEAD);

    GridData data2 = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    hostname.setLayoutData(data2);
    new Label(this, SWT.NONE);

    hostname.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            setHostnameChangeTimer(hostname.getText());
        }
    });

    FieldDecorationRegistry registry = FieldDecorationRegistry.getDefault();
    FieldDecoration fd = registry.getFieldDecoration(FieldDecorationRegistry.DEC_CONTENT_PROPOSAL);
    hostnameDecoration.setImage(fd.getImage());
    hostnameDecoration.setDescriptionText(fd.getDescription());

    hostname.addFocusListener(new FocusListener() {
        public void focusGained(FocusEvent e) {
            hostnameDecoration.show();
        }

        public void focusLost(FocusEvent e) {
            hostnameDecoration.hide();
        }
    });

    List<String> hosts = ServerUIPlugin.getPreferences().getHostnames();
    String[] hosts2 = hosts.toArray(new String[hosts.size()]);
    new AutoCompleteField(hostname, new TextContentAdapter(), hosts2);

    Label serverNameLabel = new Label(this, SWT.NONE);
    serverNameLabel.setText(Messages.serverName);

    serverName = new Text(this, SWT.SINGLE | SWT.BORDER | SWT.CANCEL);
    data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    if ((serverName.getStyle() & SWT.CANCEL) != 0)
        data.horizontalSpan = 2;
    serverName.setLayoutData(data);

    if (server != null)
        serverName.setText(server.getName());

    serverName.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            if (updatingServerName)
                return;

            String name = serverName.getText();

            IServerType selectedServerType = serverTypeComposite.getSelectedServerType();
            if (!validate(selectedServerType)) {
                // Do not set the server name if it is invalid
                return;
            }

            if (server != null) {
                server.setName(name);
                IRuntime runtime2 = server.getRuntime();
                if (runtime2 != null && runtime2 instanceof IRuntimeWorkingCopy) {
                    IRuntimeWorkingCopy rwc = (IRuntimeWorkingCopy) runtime2;
                    rwc.setName(name);
                }
            }

            if (serverNameModified)
                return;

            serverNameModified = true;
            if (serverNameToolBar != null)
                serverNameToolBar.getControl().setVisible(true);
        }
    });

    if ((serverName.getStyle() & SWT.CANCEL) == 0) {
        serverNameToolBar = new ToolBarManager(SWT.FLAT | SWT.HORIZONTAL);
        serverNameToolBar.createControl(this);

        IAction resetDefaultAction = new Action("", IAction.AS_PUSH_BUTTON) {//$NON-NLS-1$
            public void run() {
                ((ServerWorkingCopy) server).setDefaults(null);
                serverName.setText(server.getName());
                serverNameModified = false;
                if (serverNameToolBar != null)
                    serverNameToolBar.getControl().setVisible(false);
            }
        };

        resetDefaultAction.setToolTipText(Messages.serverNameDefault);
        resetDefaultAction
                .setImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_ETOOL_RESET_DEFAULT));
        resetDefaultAction.setDisabledImageDescriptor(
                ImageResource.getImageDescriptor(ImageResource.IMG_DTOOL_RESET_DEFAULT));

        serverNameToolBar.add(resetDefaultAction);
        serverNameToolBar.update(false);
        serverNameToolBar.getControl().setVisible(false);
    }

    runtimeLabel = new Label(this, SWT.NONE);
    runtimeLabel.setText(Messages.wizNewServerRuntime);

    runtimeCombo = new Combo(this, SWT.READ_ONLY);
    runtimeCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    runtimeCombo.addSelectionListener(new SelectionListener() {
        public void widgetSelected(SelectionEvent e) {
            try {
                setRuntime(runtimes[runtimeCombo.getSelectionIndex()]);
            } catch (Exception ex) {
                // ignore
            }
        }

        public void widgetDefaultSelected(SelectionEvent e) {
            widgetSelected(e);
        }
    });

    addRuntime = new Link(this, SWT.NONE);
    addRuntime.setText("<a>" + Messages.addRuntime + "</a>");
    addRuntime.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
    addRuntime.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            IServerType serverType = serverTypeComposite.getSelectedServerType();
            showRuntimeWizard(serverType);
        }
    });

    configureRuntimes = new Link(this, SWT.NONE);
    configureRuntimes.setText("<a>" + Messages.configureRuntimes + "</a>");
    data = new GridData(GridData.HORIZONTAL_ALIGN_END);
    data.horizontalSpan = 3;
    configureRuntimes.setLayoutData(data);
    configureRuntimes.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            if (showPreferencePage()) {
                runtime = null;
                IServerType serverType = serverTypeComposite.getSelectedServerType();
                updateRuntimeCombo(serverType);
            }
        }
    });

    // Add the page modifier bottom section UI. 
    for (ServerCreationWizardPageExtension curPageExtension : pageExtensionLst) {
        curPageExtension.createControl(ServerCreationWizardPageExtension.UI_POSITION.BOTTOM, this);
    }

    Dialog.applyDialogFont(this);
}

From source file:org.jboss.tools.openshift.express.internal.ui.wizard.application.ApplicationConfigurationWizardPage.java

License:Open Source License

private void createExistingAppNameContentAssist() {
    ControlDecoration dec = new ControlDecoration(existingAppNameText, SWT.TOP | SWT.LEFT);
    FieldDecoration contentProposalFieldIndicator = FieldDecorationRegistry.getDefault()
            .getFieldDecoration(FieldDecorationRegistry.DEC_CONTENT_PROPOSAL);
    dec.setImage(contentProposalFieldIndicator.getImage());
    dec.setDescriptionText("Auto-completion is enabled when you start typing an application name.");
    dec.setShowOnlyOnFocus(true);//from  w  ww .jav  a  2 s.c om

    AutoCompleteField adapter = new AutoCompleteField(existingAppNameText, new TextContentAdapter(),
            new String[] {});
    adapter.setProposals(pageModel.getApplicationNames());
}

From source file:org.jboss.tools.openshift.express.internal.ui.wizard.application.ApplicationTemplateWizardPage.java

License:Open Source License

private AutoCompleteField createExistingAppNameContentAssist(Text existingAppNameText) {
    final AutoCompleteField autoCompleteField = new AutoCompleteField(existingAppNameText,
            new TextContentAdapter(), new String[] {});

    pageModel.addPropertyChangeListener(ApplicationTemplateWizardPageModel.PROPERTY_EXISTING_APPLICATIONS,
            onExistingApplicationsChanged(autoCompleteField));

    ControlDecoration dec = new ControlDecoration(existingAppNameText, SWT.TOP | SWT.RIGHT);
    FieldDecoration contentProposalFieldIndicator = FieldDecorationRegistry.getDefault()
            .getFieldDecoration(FieldDecorationRegistry.DEC_CONTENT_PROPOSAL);
    dec.setImage(contentProposalFieldIndicator.getImage());
    dec.setDescriptionText("Auto-completion is enabled when you start typing an application name.");
    dec.setShowOnlyOnFocus(true);//w w w. j  av  a  2s.  c om

    return autoCompleteField;
}

From source file:org.jboss.tools.openshift.express.internal.ui.wizard.application.ProjectAndServerAdapterSettingsWizardPage.java

License:Open Source License

private Composite createProjectGroup(Composite parent, DataBindingContext dbc) {
    Composite projectGroup = new Composite(parent, SWT.NONE);
    // projectGroup.setText("Project");
    GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).align(SWT.FILL, SWT.CENTER).grab(true, false)
            .applyTo(projectGroup);// www  . j a va 2  s  . c o  m
    GridLayoutFactory.fillDefaults().numColumns(3).margins(6, 6).applyTo(projectGroup);

    // new project checkbox
    Button newProjectRadioBtn = new Button(projectGroup, SWT.CHECK);
    newProjectRadioBtn.setText("Create a new project");
    newProjectRadioBtn.setToolTipText(
            "The OpenShift application code will be pulled into the newly created project or merged into the selected one.");
    newProjectRadioBtn.setFocus();
    GridDataFactory.fillDefaults().span(3, 1).align(SWT.FILL, SWT.CENTER).grab(false, false)
            .applyTo(newProjectRadioBtn);
    final IObservableValue newProjectObservable = BeanProperties
            .value(ProjectAndServerAdapterSettingsWizardPageModel.PROPERTY_IS_NEW_PROJECT).observe(pageModel);
    final ISWTObservableValue newProjectRadioBtnSelection = WidgetProperties.selection()
            .observe(newProjectRadioBtn);
    dbc.bindValue(newProjectRadioBtnSelection, newProjectObservable);

    // existing project
    Label existingProjectLabel = new Label(projectGroup, SWT.NONE);
    existingProjectLabel.setText("Use existing project:");
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).span(1, 1).grab(false, false).indent(10, 0)
            .applyTo(existingProjectLabel);

    existingProjectNameText = new Text(projectGroup, SWT.BORDER);
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).span(1, 1).grab(true, false)
            .applyTo(existingProjectNameText);
    final IObservableValue projectNameModelObservable = BeanProperties
            .value(ProjectAndServerAdapterSettingsWizardPageModel.PROPERTY_PROJECT_NAME).observe(pageModel);
    final ISWTObservableValue existingProjectNameTextObservable = WidgetProperties.text(SWT.Modify)
            .observe(existingProjectNameText);
    ValueBindingBuilder.bind(existingProjectNameTextObservable).to(projectNameModelObservable).in(dbc);
    // disable the project name text when the model state is set to 'new project'
    ValueBindingBuilder.bind(WidgetProperties.enabled().observe(existingProjectNameText))
            .notUpdating(newProjectObservable).converting(new InvertingBooleanConverter()).in(dbc);
    // move focus to the project name text control when choosing the 'Use an existing project' option.
    newProjectRadioBtn.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            existingProjectNameText.setFocus();
            existingProjectNameText.selectAll();
        }
    });
    // let's provide content assist on the existing project name
    ControlDecoration dec = new ControlDecoration(existingProjectNameText, SWT.TOP | SWT.LEFT);
    FieldDecoration contentProposalFieldIndicator = FieldDecorationRegistry.getDefault()
            .getFieldDecoration(FieldDecorationRegistry.DEC_CONTENT_PROPOSAL);
    dec.setImage(contentProposalFieldIndicator.getImage());
    dec.setDescriptionText("Auto-completion is enabled when you start typing a project name.");
    dec.setShowOnlyOnFocus(true);

    AutoCompleteField adapter = new AutoCompleteField(existingProjectNameText, new TextContentAdapter(),
            new String[] {});

    adapter.setProposals(getOpenProjectsInWorkspace());

    Button browseProjectsButton = new Button(projectGroup, SWT.NONE);
    browseProjectsButton.setText("Browse...");
    GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).hint(100, SWT.DEFAULT).span(1, 1)
            .grab(false, false).applyTo(browseProjectsButton);
    browseProjectsButton.addSelectionListener(onBrowseProjects());
    ValueBindingBuilder.bind(WidgetProperties.enabled().observe(browseProjectsButton))
            .notUpdating(newProjectObservable).converting(new InvertingBooleanConverter()).in(dbc);

    final IObservableValue applicationNameModelObservable = BeanProperties
            .value(GitCloningSettingsWizardPageModel.PROPERTY_APPLICATION_NAME).observe(pageModel);
    final UseExistingOpenProjectValidator existingProjectValidator = new UseExistingOpenProjectValidator(
            applicationNameModelObservable, newProjectObservable, projectNameModelObservable);
    dbc.addValidationStatusProvider(existingProjectValidator);
    ControlDecorationSupport.create(existingProjectValidator, SWT.LEFT | SWT.TOP);

    return projectGroup;
}

From source file:org.jboss.tools.openshift.internal.common.ui.SelectProjectComponentBuilder.java

License:Open Source License

public void build(Composite container, DataBindingContext dbc) {
    Label existingProjectLabel = new Label(container, SWT.NONE);
    existingProjectLabel.setText("Eclipse Project: ");
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).applyTo(existingProjectLabel);

    final Text existingProjectNameText = new Text(container, SWT.BORDER);
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).span(hSpan, 1).align(SWT.FILL, SWT.CENTER)
            .grab(true, false).applyTo(existingProjectNameText);

    projectNameTextObservable = WidgetProperties.text(SWT.Modify).observe(existingProjectNameText);

    Binding eclipseProjectBinding = ValueBindingBuilder.bind(projectNameTextObservable)
            .validatingAfterConvert(new IValidator() {
                @Override//from w  w  w .  ja v a 2s .  c  o m
                public IStatus validate(Object value) {
                    if (value instanceof String) {
                        return ValidationStatus.ok();
                    } else if (value == null) {
                        if (required) {
                            return ValidationStatus.error("Select an existing project");
                        } else if (!StringUtils.isEmpty(existingProjectNameText.getText())) {
                            return ValidationStatus.error(
                                    NLS.bind("Project {0} does not exist", existingProjectNameText.getText()));
                        }
                    }
                    return ValidationStatus.ok();
                }
            }).converting(new Converter(String.class, IProject.class) {
                @Override
                public Object convert(Object fromObject) {
                    String name = (String) fromObject;
                    return ProjectUtils.getProject(name);
                }
            }).to(eclipseProjectObservable).converting(new Converter(IProject.class, String.class) {

                @Override
                public Object convert(Object fromObject) {
                    return fromObject == null ? "" : ((IProject) fromObject).getName();
                }
            }).in(dbc);
    ControlDecorationSupport.create(eclipseProjectBinding, SWT.LEFT | SWT.TOP, null,
            new RequiredControlDecorationUpdater(true));

    // project name content assist
    ControlDecoration dec = new ControlDecoration(existingProjectNameText, SWT.TOP | SWT.RIGHT);

    FieldDecoration contentProposalFieldIndicator = FieldDecorationRegistry.getDefault()
            .getFieldDecoration(FieldDecorationRegistry.DEC_CONTENT_PROPOSAL);
    dec.setImage(contentProposalFieldIndicator.getImage());
    dec.setDescriptionText("Auto-completion is enabled when you start typing a project name.");
    dec.setShowOnlyOnFocus(true);

    new AutoCompleteField(existingProjectNameText, new TextContentAdapter(),
            ProjectUtils.getAllAccessibleProjectNames());

    // browse projects
    Button browseProjectsButton = new Button(container, SWT.NONE);
    browseProjectsButton.setText("Browse...");
    GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).grab(false, false).applyTo(browseProjectsButton);
    UIUtils.setDefaultButtonWidth(browseProjectsButton);
    browseProjectsButton.addSelectionListener(selectionListener);
}

From source file:org.mule.tooling.properties.utils.UIUtils.java

public static AutoCompleteField initializeAutoCompleteField(Text text, Collection<?> keySet) {
    return new AutoCompleteField(text, new TextContentAdapter(), keySet.toArray(new String[0]));
}

From source file:org.obeonetwork.dsl.uml2.design.internal.dialogs.ImportMetaclassDialog.java

License:Open Source License

@SuppressWarnings("unused")
@Override/*from w w w  .  j a v a 2  s.co  m*/
protected Control createExtendedContentArea(final Composite parent) {

    final Composite subClassButtonComposite = new Composite(parent, SWT.BORDER);
    final GridLayout layout = new GridLayout(2, false);
    layout.numColumns = 2;

    final GridData gridData = new GridData();
    gridData.horizontalAlignment = SWT.FILL;
    gridData.grabExcessHorizontalSpace = true;

    subClassButtonComposite.setLayoutData(gridData);

    subClassButtonComposite.setLayout(layout);

    final GridData gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = 2;

    concreteButton = new Button(subClassButtonComposite, SWT.CHECK);
    concreteButton.setText("Only concrete Metaclass"); //$NON-NLS-1$
    concreteButton.addSelectionListener(new SelectionListener() {
        public void widgetDefaultSelected(final SelectionEvent e) {
            // Nothing
        }

        public void widgetSelected(final SelectionEvent e) {
            if (concrete != ((Button) e.widget).getSelection()) {
                concrete = ((Button) e.widget).getSelection();
                applyFilter();
            }
        }
    });

    concreteButton.setLayoutData(gd);

    subClassButton = new Button(subClassButtonComposite, SWT.CHECK);
    subClassButton.setText("Only sub classes of:"); //$NON-NLS-1$
    subClassButton.addSelectionListener(new SelectionListener() {
        public void widgetDefaultSelected(final SelectionEvent e) {
            // Nothing
        }

        public void widgetSelected(final SelectionEvent e) {
            if (subClass != ((Button) e.widget).getSelection()) {
                subClass = ((Button) e.widget).getSelection();
                combo.setEnabled(subClass);
                applyFilter();
            }
        }
    });

    combo = new Combo(subClassButtonComposite, SWT.DROP_DOWN);
    combo.setEnabled(subClass);
    combo.setItems(getMetaclassesNames());
    combo.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(final SelectionEvent e) {
            if (e != null) {
                final Object src = e.getSource();
                if (src instanceof Combo) {
                    final Combo comboEvent = (Combo) src;
                    superClassName = comboEvent.getText();
                }
            }
            applyFilter();
        }

    });
    combo.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            if (e != null) {
                final Object src = e.getSource();
                if (src instanceof Combo) {
                    final Combo myCombo = (Combo) src;
                    final String myText = myCombo.getText();
                    for (int i = 0; i < myCombo.getItemCount(); i++) {
                        final String item = myCombo.getItem(i);
                        if (myText != null && !myText.isEmpty() && item.equalsIgnoreCase(myText)) {
                            superClassName = myText;
                            break;
                        } else if (myText == null || myText.isEmpty()) {
                            superClassName = ""; //$NON-NLS-1$
                        }
                    }
                } else {
                    superClassName = ""; //$NON-NLS-1$
                }
            }
            applyFilter();
        }
    });

    new AutoCompleteField(combo, new ComboContentAdapter(), combo.getItems());
    combo.setLayoutData(gridData);

    return parent;
}

From source file:org.obeonetwork.dsl.uml2.profile.design.dialogs.ImportMetaclassDialog.java

License:Open Source License

@Override
protected Control createExtendedContentArea(final Composite parent) {

    Composite subClassButtonComposite = new Composite(parent, SWT.BORDER);
    GridLayout layout = new GridLayout(2, false);
    layout.numColumns = 2;/*from ww  w . j av a2  s  . c o  m*/

    GridData gridData = new GridData();
    gridData.horizontalAlignment = SWT.FILL;
    gridData.grabExcessHorizontalSpace = true;

    subClassButtonComposite.setLayoutData(gridData);

    subClassButtonComposite.setLayout(layout);

    final GridData gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = 2;

    concreteButton = new Button(subClassButtonComposite, SWT.CHECK);
    concreteButton.setText("Only concrete Metaclass"); //$NON-NLS-1$
    concreteButton.addSelectionListener(new SelectionListener() {
        public void widgetDefaultSelected(final SelectionEvent e) {
        }

        public void widgetSelected(final SelectionEvent e) {
            if (concrete != ((Button) e.widget).getSelection()) {
                concrete = ((Button) e.widget).getSelection();
                applyFilter();
            }
        }
    });

    concreteButton.setLayoutData(gd);

    subClassButton = new Button(subClassButtonComposite, SWT.CHECK);
    subClassButton.setText("Only sub classes of:"); //$NON-NLS-1$
    subClassButton.addSelectionListener(new SelectionListener() {
        public void widgetDefaultSelected(final SelectionEvent e) {
        }

        public void widgetSelected(final SelectionEvent e) {
            if (subClass != ((Button) e.widget).getSelection()) {
                subClass = ((Button) e.widget).getSelection();
                combo.setEnabled(subClass);
                applyFilter();
            }
        }
    });

    combo = new Combo(subClassButtonComposite, SWT.DROP_DOWN);
    combo.setEnabled(subClass);
    combo.setItems(getMetaclassesNames());
    combo.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(final SelectionEvent e) {
            if (e != null) {
                final Object src = e.getSource();
                if (src instanceof Combo) {
                    final Combo comboEvent = (Combo) src;
                    superClassName = comboEvent.getText();
                }
            }
            applyFilter();
        }

    });
    combo.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            if (e != null) {
                final Object src = e.getSource();
                if (src instanceof Combo) {
                    final Combo myCombo = (Combo) src;
                    String myText = myCombo.getText();
                    for (int i = 0; i < myCombo.getItemCount(); i++) {
                        String item = myCombo.getItem(i);
                        if (myText != null && !myText.isEmpty() && item.equalsIgnoreCase(myText)) {
                            superClassName = myText;
                            break;
                        } else if (myText.isEmpty()) {
                            superClassName = "";
                        }
                    }
                } else {
                    superClassName = "";
                }
            }
            applyFilter();
        }
    });

    new AutoCompleteField(combo, new ComboContentAdapter(), combo.getItems());
    combo.setLayoutData(gridData);

    return parent;
}