Java Code Examples for org.eclipse.swt.widgets.Button#setEnabled()

The following examples show how to use org.eclipse.swt.widgets.Button#setEnabled() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MappingDialog.java    From hop with Apache License 2.0 6 votes vote down vote up
/**
 * Enables or disables the mapping button. We can only enable it if the target transforms allows a mapping to be made
 * against it.
 *
 * @param button         The button to disable or enable
 * @param input          input or output. If it's true, we keep the button enabled all the time.
 * @param sourceTransformName The mapping output transform
 * @param targetTransformname The target transform to verify
 * @throws HopException
 */
private void enableMappingButton( final Button button, boolean input, String sourceTransformName, String targetTransformname ) throws HopException {
  if ( input ) {
    return; // nothing to do
  }

  boolean enabled = false;

  if ( mappingPipelineMeta != null ) {
    TransformMeta mappingInputTransform = mappingPipelineMeta.findMappingInputTransform( sourceTransformName );
    if ( mappingInputTransform != null ) {
      TransformMeta mappingOutputTransform = pipelineMeta.findMappingOutputTransform( targetTransformname );
      IRowMeta requiredFields = mappingOutputTransform.getITransform().getRequiredFields( pipelineMeta );
      if ( requiredFields != null && requiredFields.size() > 0 ) {
        enabled = true;
      }
    }
  }

  button.setEnabled( enabled );
}
 
Example 2
Source File: DQSystemInfoPage.java    From olca-app with Mozilla Public License 2.0 6 votes vote down vote up
private void createAddScoreButton(Composite parent) {
	Button button = toolkit.createButton(parent, M.AddScore, SWT.NONE);
	if (getModel().indicators.size() == 0) {
		button.setEnabled(false);
		return;
	}
	Controls.onSelect(button, (e) -> {
		int newScore = getModel().getScoreCount() + 1;
		for (DQIndicator indicator : getModel().indicators) {
			DQScore score = new DQScore();
			score.position = newScore;
			score.label = "Score " + newScore;
			score.description = indicator.name + " - score " + newScore;
			indicator.scores.add(score);
		}
		getEditor().setDirty(true);
		redraw();
	});
}
 
Example 3
Source File: KontaktDetailDialog.java    From elexis-3-core with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void create(){
	super.create();
	getShell().setText(Messages.KontaktDetailDialog_showDetails); //$NON-NLS-1$
	if (k != null) {
		setTitle(k.getLabel());
	} else {
		setTitle(Messages.KontaktDetailDialog_newContact); //$NON-NLS-1$
	}
	setMessage(Messages.KontaktDetailDialog_enterData); //$NON-NLS-1$
	
	if (locked) {
		Button btnOk = getButton(IDialogConstants.OK_ID);
		if (btnOk != null) {
			btnOk.setEnabled(false);
		}
	}
}
 
Example 4
Source File: ViewerListFieldEditor.java    From texlipse with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Creates a new editor button for the field editor.
 * @param parent parent component
 * @return the "edit"-button
 */
protected Button createEditButton(Composite parent) {
    
    Button button = new Button(parent, SWT.PUSH);
    button.setText(TexlipsePlugin.getResourceString("openEdit"));
    button.setFont(parent.getFont());
    GridData data = new GridData(GridData.FILL_HORIZONTAL);
    data.heightHint = convertVerticalDLUsToPixels(button, IDialogConstants.BUTTON_HEIGHT);
    int widthHint = convertHorizontalDLUsToPixels(button, IDialogConstants.BUTTON_WIDTH);
    data.widthHint = Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
    button.setLayoutData(data);
    button.setEnabled(false);
    button.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent event) {
            openEditorDialog();
        }});
    
    return button;
}
 
Example 5
Source File: AbstractEditor.java    From gama with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void setActive(final Boolean active) {
	if (titleLabel != null) {
		titleLabel.setForeground(active ? IGamaColors.BLACK.color() : GamaColors.system(SWT.COLOR_GRAY));
	}
	if (!active) {
		for (final Button t : items) {
			if (t == null) {
				continue;
			}
			t.setEnabled(false);
		}
	} else {
		checkButtons();
	}

	this.getEditor().setEnabled(active);
}
 
Example 6
Source File: NewCategoryDialog.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected Control createButtonBar(Composite parent) {
    Control control = super.createButtonBar(parent);
    Button okButton = getButton(IDialogConstants.OK_ID);
    if (okButton != null) {
        okButton.setEnabled(category.getId() != null && !category.getId().isEmpty());
    }
    return control;
}
 
Example 7
Source File: AbstractSuperTypeSelectionDialog.java    From sarl with Apache License 2.0 5 votes vote down vote up
@Override
protected void updateButtonsEnableState(IStatus status) {
	super.updateButtonsEnableState(status);
	final Button addButton = getButton(ADD_ID);
	if (addButton != null && !addButton.isDisposed()) {
		addButton.setEnabled(!status.matches(IStatus.ERROR));
	}
}
 
Example 8
Source File: MappingDialog.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
private void setTabFlags( Button wMainPath, Label wlInputStep, Text wInputStep, Button wbInputStep,
                          Label wlOutputStep, Text wOutputStep, Button wbOutputStep, Label wlDescription,
                          Text wDescription ) {
  boolean mainPath = wMainPath.getSelection();
  wlInputStep.setEnabled( !mainPath );
  wInputStep.setEnabled( !mainPath );
  wbInputStep.setEnabled( !mainPath );
  wlOutputStep.setEnabled( !mainPath );
  wOutputStep.setEnabled( !mainPath );
  wbOutputStep.setEnabled( !mainPath );
  wlDescription.setEnabled( !mainPath );
  wDescription.setEnabled( !mainPath );
}
 
Example 9
Source File: HierarchyWizardPageFinal.java    From arx with Apache License 2.0 5 votes vote down vote up
@Override
public void setVisible(boolean value){
    
    if (value) {
        this.composite.setRedraw(false);
        
        // Reset
        list.removeAll();
        this.view.setHierarchy(Hierarchy.create());
        
        if (groups != null) {
            for (int count : groups){
                list.add(String.valueOf(count));
            }
        }
        if (hierarchy != null) {
            view.setHierarchy(hierarchy);
        }
        
        this.composite.layout(true);
        this.composite.setRedraw(true);

        // Deactivate buttons
        Button load = this.wizard.getLoadButton();
        if (load != null) load.setEnabled(false);
        Button save = this.wizard.getSaveButton();
        if (save != null) save.setEnabled(false);
    }
    super.setVisible(value);
}
 
Example 10
Source File: LoginDialog.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
protected void handleComplete ( final Collection<LoginHandler> result )
{
    if ( this.creator == null )
    {
        logger.error ( "Creating is null but we got a result. This should also never happen!" ); //$NON-NLS-1$
        return;
    }

    this.creator.dispose ();
    this.creator = null;

    if ( result == null )
    {
        final Button button = getButton ( OK );
        button.setEnabled ( true );

        this.contextSelector.getControl ().setEnabled ( true );
        this.userText.setEnabled ( true );
        this.passwordText.setEnabled ( true );
    }
    else
    {
        saveTo ();
        Activator.getDefault ().setLoginSession ( this.user, this.password, this.loginContext, result );
        super.okPressed ();
    }
}
 
Example 11
Source File: LoadDialog.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
private void enableLocalButtons() {
    Object[] checked = fFolderViewer.getCheckedElements();
    boolean enabled = (checked != null) && (checked.length > 0);
    Button okButton = getButton(IDialogConstants.OK_ID);
    if (okButton != null) {
        okButton.setEnabled(enabled);
    }
}
 
Example 12
Source File: PullUpMemberPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
protected void createStubCheckbox(final Composite parent) {
	fCreateStubsButton= new Button(parent, SWT.CHECK);
	fCreateStubsButton.setText(getCreateStubsButtonLabel());
	final GridData data= new GridData();
	data.horizontalSpan= 2;
	fCreateStubsButton.setLayoutData(data);
	fCreateStubsButton.setEnabled(false);
	fCreateStubsButton.setSelection(fProcessor.getCreateMethodStubs());
}
 
Example 13
Source File: HorizontalSpinner.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Create plus button
 *
 * @param buttonStyle button style
 */
private void createPlusButton(final int buttonStyle) {
	rightButton = new Button(this, buttonStyle | SWT.RIGHT);
	rightButton.setFont(getFont());
	rightButton.setBackground(getBackground());
	rightButton.setCursor(getCursor());
	rightButton.setEnabled(getEnabled());
	rightButton.setFont(getFont());
	rightButton.setForeground(getForeground());
	rightButton.setLayoutData(new GridData(GridData.FILL, GridData.FILL, false, false));
}
 
Example 14
Source File: WebSearchPreferencePage.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
private Composite createTableCmdArea(Composite parent) {
	Composite urlCmdArea = new Composite(parent, SWT.NONE);
	GridLayout urlCmdArea_layout = new GridLayout(1, true);
	urlCmdArea.setLayout(urlCmdArea_layout);
	urlCmdArea.setLayoutData(new GridData(GridData.FILL_VERTICAL));

	addItemBtn = new Button(urlCmdArea, SWT.NONE);
	addItemBtn.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	addItemBtn.setText(Messages.getString("Websearch.WebSearcPreferencePage.Add"));

	editItemBtn = new Button(urlCmdArea, SWT.NONE);
	editItemBtn.setText(Messages.getString("Websearch.WebSearcPreferencePage.edit"));
	editItemBtn.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	editItemBtn.setEnabled(false);

	deleteItemBtn = new Button(urlCmdArea, SWT.NONE);
	deleteItemBtn.setText(Messages.getString("Websearch.WebSearcPreferencePage.delete"));
	deleteItemBtn.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	deleteItemBtn.setEnabled(false);

	upItemBtn = new Button(urlCmdArea, SWT.NONE);
	upItemBtn.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	upItemBtn.setText(Messages.getString("Websearch.WebSearcPreferencePage.upitem"));
	upItemBtn.setEnabled(false);

	downItemBtn = new Button(urlCmdArea, SWT.NONE);
	downItemBtn.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	downItemBtn.setText(Messages.getString("Websearch.WebSearcPreferencePage.downitem"));
	downItemBtn.setEnabled(false);

	importItemsBtn = new Button(urlCmdArea, SWT.NONE);
	importItemsBtn.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	importItemsBtn.setText(Messages.getString("Websearch.WebSearcPreferencePage.import"));

	exportItemsBtn = new Button(urlCmdArea, SWT.NONE);
	exportItemsBtn.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	exportItemsBtn.setText(Messages.getString("Websearch.WebSearcPreferencePage.export"));

	return urlCmdArea;
}
 
Example 15
Source File: CheckboxCellContentProvider.java    From ice with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * If the enabled/disabled checked/unchecked checkbox <code>Image</code>s
 * have not already been created and added to the JFace
 * <code>ImageRegistry</code>, this method generates and registers them.
 * This produces platform-specific images at run-time.
 * 
 * @param display
 *            The <code>Display</code> shared with the underlying
 *            <code>ColumnViewer</code>.
 * @param background
 *            The background of the <code>ColumnViewer</code>'s cells.
 */
private static void registerImages(final Display display, Color background) {

	if (display != null && IMAGES_REGISTERED.compareAndSet(false, true)) {

		// Get the ImageRegistry for JFace images. We will load up images
		// for each combination of checkbox enabled/disabled and
		// checked/unchecked.
		ImageRegistry jfaceImages = JFaceResources.getImageRegistry();

		// Create a temporary shell and checkbox Button to generate
		// platform-specific images of checkboxes.
		Shell shell = new Shell(display, SWT.NO_TRIM);
		Button checkbox = new Button(shell, SWT.CHECK);

		// Set the widget's background to the viewer's cell background.
		checkbox.setBackground(background);

		// Reduce the size of the shell to a square (checkboxes are supposed
		// to be square!!!).
		Point size = checkbox.computeSize(SWT.DEFAULT, SWT.DEFAULT);
		// int width = Math.min(size.x, size.y);
		checkbox.setSize(size);
		// checkbox.setLocation(width - size.x, width - size.y);
		// shell.setSize(width, width);
		shell.setSize(size);

		// Open the shell to enable widget drawing.
		shell.open();

		// Create the enabled/unchecked image.
		jfaceImages.put(ENABLED_UNCHECKED, createImage(checkbox));
		// Create the enabled/checked image.
		checkbox.setSelection(true);
		jfaceImages.put(ENABLED_CHECKED, createImage(checkbox));
		// Create the disabled/checked image.
		checkbox.setEnabled(false);
		jfaceImages.put(DISABLED_CHECKED, createImage(checkbox));
		// Create the disabled/unchecked image.
		checkbox.setSelection(false);
		jfaceImages.put(DISABLED_UNCHECKED, createImage(checkbox));

		// Release any remaining resources.
		// gc.dispose();
		shell.close();
	}

	return;
}
 
Example 16
Source File: UserControlDialog.java    From gama with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected Control createDialogArea(final Composite parent) {
	final Composite composite = (Composite) super.createDialogArea(parent);
	final GridLayout layout = (GridLayout) composite.getLayout();
	layout.numColumns = 3;
	// Label text = new Label(composite, SWT.None);
	// text.setBackground(SwtGui.COLOR_OK);
	// text.setForeground(SwtGui.getDisplay().getSystemColor(SWT.COLOR_WHITE));
	// text.setText(title);
	// GridData data = new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1);
	// text.setLayoutData(data);
	// Label sep = new Label(composite, SWT.SEPARATOR | SWT.HORIZONTAL);
	// data = new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1);
	// data.heightHint = 20;
	// sep.setLayoutData(data);
	for (final IStatement c : userCommands) {
		if (c instanceof UserCommandStatement) {
			final List<UserInputStatement> inputs = ((UserCommandStatement) c).getInputs();
			final int nbLines = inputs.size() > 1 ? inputs.size() : 1;
			final int nbCol = inputs.size() > 0 ? 1 : 3;
			final Button b = new Button(composite, SWT.PUSH);
			b.setText(c.getName());
			b.setEnabled(((UserCommandStatement) c).isEnabled(scope));
			final GridData gd = new GridData(SWT.LEFT, SWT.TOP, true, true, nbCol, nbLines);
			b.setLayoutData(gd);
			b.addSelectionListener(new SelectionAdapter() {

				@Override
				public void widgetSelected(final SelectionEvent e) {
					scope.execute(c);
					GAMA.getExperiment().refreshAllOutputs();
				}

			});
			for (final UserInputStatement i : inputs) {

				scope.addVarWithValue(i.getTempVarName(), i.value(scope));
				EditorFactory.create(scope, composite, i, newValue -> {
					i.setValue(scope, newValue);
					scope.execute(i);
				}, false, false);
			}

			final Label sep = new Label(composite, SWT.SEPARATOR | SWT.HORIZONTAL);
			final GridData data = new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1);
			sep.setLayoutData(data);
		}
	}
	composite.layout();
	composite.pack();

	return composite;
}
 
Example 17
Source File: LinkGroupsPage.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public Control createContents( Composite parent )
{
	Composite contents = new Composite( parent, SWT.NONE );
	GridLayout layout = new GridLayout( );
	layout.verticalSpacing = 0;
	layout.marginWidth = 10;
	layout.marginTop = 10;
	layout.numColumns = 2;
	contents.setLayout( layout );
	GridData data = new GridData( GridData.FILL_BOTH );
	contents.setLayoutData( data );

	createCubeArea( contents );

	filterButton = new Button( contents, SWT.PUSH );
	filterButton.setText( Messages.getString( "DatasetPage.Button.Filter" ) ); //$NON-NLS-1$
	GridData gd = new GridData( );
	gd.widthHint = Math.max( 60, filterButton.computeSize( SWT.DEFAULT,
			SWT.DEFAULT ).x );
	gd.grabExcessVerticalSpace = true;
	gd.verticalAlignment = GridData.VERTICAL_ALIGN_BEGINNING;
	filterButton.setLayoutData( gd );
	filterButton.setEnabled( false );
	filterButton.addSelectionListener( new SelectionAdapter( ) {

		public void widgetSelected( SelectionEvent e )
		{
			EditPart editPart = (EditPart) viewer.getSelectedEditParts( )
					.get( 0 );
			CommandStack stack = SessionHandleAdapter.getInstance( )
					.getCommandStack( );
			stack.startTrans( "" ); //$NON-NLS-1$

			FilterHandleProvider provider = (FilterHandleProvider) ElementAdapterManager.getAdapter( builder,
					FilterHandleProvider.class );
			if ( provider == null )
				provider = new FilterHandleProvider( );

			FilterListDialog dialog = new FilterListDialog( provider );
			if ( editPart instanceof DatasetNodeEditPart )
				dialog.setInput( (ReportElementHandle) ( editPart.getParent( ).getModel( ) ) );
			else if ( editPart instanceof HierarchyNodeEditPart )
				dialog.setInput( (ReportElementHandle) ( editPart.getModel( ) ) );
			if ( dialog.open( ) == Window.OK )
			{
				stack.commit( );
			}
			else
				stack.rollback( );
		}

	} );
	return contents;
}
 
Example 18
Source File: DartProjectPage.java    From dartboard with Eclipse Public License 2.0 4 votes vote down vote up
private void createAdditionalControls(Composite parent) {
	Group dartGroup = new Group(parent, SWT.NONE);
	dartGroup.setFont(parent.getFont());
	dartGroup.setText(Messages.NewProject_Group_Label);
	dartGroup.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
	dartGroup.setLayout(new GridLayout(2, false));

	Label labelSdkLocation = new Label(dartGroup, SWT.NONE);
	labelSdkLocation.setText(Messages.Preference_SDKLocation_Dart);
	GridDataFactory.swtDefaults().applyTo(labelSdkLocation);

	Label sdkLocation = new Label(dartGroup, SWT.NONE);
	GridDataFactory.fillDefaults().grab(true, false).applyTo(sdkLocation);
	sdkLocation.setText(preferences.getString(GlobalConstants.P_SDK_LOCATION_DART));

	// ------------------------------------------
	Group stagehandGroup = new Group(parent, SWT.NONE);
	stagehandGroup.setFont(parent.getFont());
	stagehandGroup.setText(Messages.NewProject_Stagehand_Title);
	stagehandGroup.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
	stagehandGroup.setLayout(new GridLayout(1, false));

	useStagehandButton = new Button(stagehandGroup, SWT.CHECK);
	GridDataFactory.fillDefaults().grab(true, false).applyTo(useStagehandButton);
	useStagehandButton.setEnabled(false);

	stagehandTemplates = new Combo(stagehandGroup, SWT.READ_ONLY);
	stagehandTemplates.setEnabled(useStagehandButton.getSelection());
	GridDataFactory.fillDefaults().grab(true, false).applyTo(stagehandTemplates);

	useStagehandButton.setText(Messages.NewProject_Stagehand_UseStagehandButtonText);
	useStagehandButton.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			// Enable/Disable the stagehand templates list if the button is
			// checked/unchecked
			stagehandTemplates.setEnabled(useStagehandButton.getSelection());
			if (stagehandTemplates.getSelectionIndex() == -1) {
				stagehandTemplates.select(0);
			}
		}
	});

	ProgressIndicator indicator = new ProgressIndicator(stagehandGroup);
	GridDataFactory.fillDefaults().grab(true, false).applyTo(indicator);
	indicator.beginAnimatedTask();

	Job.create(Messages.NewProject_Stagehand_FetchStagehand, monitor -> {
		templates = StagehandService.getStagehandTemplates();

		Display.getDefault().asyncExec(() -> {
			if (!indicator.isDisposed()) {
				indicator.done();
			}
			if (!stagehandTemplates.isDisposed()) {
				templates.forEach(str -> stagehandTemplates.add(str.getDisplayName()));
				useStagehandButton.setEnabled(true);
			}
		});
	}).schedule();
}
 
Example 19
Source File: NewDriverWizardPage.java    From RDFS with Apache License 2.0 4 votes vote down vote up
private Text createBrowseClassControl(final Composite composite,
    final String string, String browseButtonLabel,
    final String baseClassName, final String dialogTitle) {
  Label label = new Label(composite, SWT.NONE);
  GridData data = new GridData(GridData.FILL_HORIZONTAL);
  label.setText(string);
  label.setLayoutData(data);

  final Text text = new Text(composite, SWT.SINGLE | SWT.BORDER);
  GridData data2 = new GridData(GridData.FILL_HORIZONTAL);
  data2.horizontalSpan = 2;
  text.setLayoutData(data2);

  Button browse = new Button(composite, SWT.NONE);
  browse.setText(browseButtonLabel);
  GridData data3 = new GridData(GridData.FILL_HORIZONTAL);
  browse.setLayoutData(data3);
  browse.addListener(SWT.Selection, new Listener() {
    public void handleEvent(Event event) {
      IType baseType;
      try {
        baseType = getPackageFragmentRoot().getJavaProject().findType(
            baseClassName);

        // edit this to limit the scope
        SelectionDialog dialog = JavaUI.createTypeDialog(
            composite.getShell(), new ProgressMonitorDialog(composite
                .getShell()), SearchEngine.createHierarchyScope(baseType),
            IJavaElementSearchConstants.CONSIDER_CLASSES, false);

        dialog.setMessage("&Choose a type:");
        dialog.setBlockOnOpen(true);
        dialog.setTitle(dialogTitle);
        dialog.open();

        if ((dialog.getReturnCode() == Window.OK)
            && (dialog.getResult().length > 0)) {
          IType type = (IType) dialog.getResult()[0];
          text.setText(type.getFullyQualifiedName());
        }
      } catch (JavaModelException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
    }
  });

  if (!showContainerSelector) {
    label.setEnabled(false);
    text.setEnabled(false);
    browse.setEnabled(false);
  }

  return text;
}
 
Example 20
Source File: ConfigurationSettingsWizardPage.java    From saros with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Setups gateway SWT controls by populating a gateway combobox and configuring an information
 * Label and the enabling checkbox.
 *
 * @param combo {@link Combo} selector to populate with discovered gateways
 * @param info {@link Label} displaying status information of the discovery
 * @param checkbox {@link Button} checkbox to enable/disable UPnP support
 */
private void populateGatewaySelectionControls(
    List<GatewayDevice> gateways, final Combo combo, final Label info, final Button checkbox) {

  combo.setEnabled(false);
  checkbox.setEnabled(false);
  combo.removeAll();

  // if no devices are found, return now - nothing to populate
  if (gateways == null || gateways.isEmpty()) {
    info.setText(Messages.UPnPUIUtils_no_gateway);
    info.getParent().pack();
    return;
  }

  this.gateways = new ArrayList<GatewayDevice>();

  // insert found gateways into combobox
  for (GatewayDevice gw : gateways) {
    try {
      String name = gw.getFriendlyName();
      if (!gw.isConnected()) name += Messages.UPnPUIUtils_disconnected;

      combo.add(name);
      this.gateways.add(gw);

    } catch (Exception e) {
      log.debug("Error updating UPnP selector:" + e.getMessage()); // $NON-NLS-1$
      // ignore faulty gateway
    }
  }

  // if valid gateway found, show info and enable
  if (combo.getItemCount() > 0) {
    checkbox.setEnabled(true);
    combo.setEnabled(true);
    combo.select(0);
    combo.pack();
    info.setVisible(false);
  } else {
    info.setText(Messages.UPnPUIUtils_no_valid_gateway);
  }
  info.getParent().pack();
}