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

The following examples show how to use org.eclipse.swt.widgets.Button#setToolTipText() . 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: ButtonFactoryUtil.java    From n4js with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Creates button with {@link org.eclipse.swt.SWT#PUSH} style. Provided parameters control other aspects of the
 * button.
 *
 * @param parent
 *            the parent used to create the button.
 * @param text
 *            the text used to set text of the button.
 * @param listener
 *            the listener added to the button.
 * @param enabled
 *            flag controls if created button is enabled.
 * @return created button.
 */
public static Button createPushButton(final Composite parent, final String text, final String tooltip,
		final SelectionListener listener, boolean enabled) {

	final Button button = new Button(parent, PUSH);
	button.setLayoutData(fillDefaults().align(FILL, CENTER).create());
	button.setText(text);
	button.setToolTipText(tooltip);
	if (null != listener) {
		button.addSelectionListener(listener);
		button.addDisposeListener(e -> {
			button.removeSelectionListener(listener);
		});
	}
	button.setEnabled(enabled);
	return button;
}
 
Example 2
Source File: ExcelDataSourcePageHelper.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * @param composite
 */
private void setupTypeLineCheckBox( Composite composite )
{
	typeLineCheckBox = new Button( composite, SWT.CHECK );
	typeLineCheckBox.setToolTipText( Messages.getString( "tooltip.typeline" ) ); //$NON-NLS-1$
	GridData data = new GridData( );
	data.horizontalSpan = 3;
	typeLineCheckBox.setLayoutData( data );
	typeLineCheckBox.setText( Messages.getString( "label.includeTypeLine" ) ); //$NON-NLS-1$
	if ( columnNameLineCheckBox.getSelection( ) )
		typeLineCheckBox.setEnabled( true );
	else
	{
		typeLineCheckBox.setSelection( false );
		typeLineCheckBox.setEnabled( false );
	}
}
 
Example 3
Source File: SWTButtonWidget.java    From atdl4j with MIT License 6 votes vote down vote up
public Widget createWidget(Composite parent, int style)
{

	// button
	button = new Button( parent, style | ( control instanceof RadioButtonT ? SWT.RADIO : SWT.CHECK ) );
	GridData gd = new GridData( GridData.GRAB_HORIZONTAL );
	gd.horizontalSpan = 2;
	button.setLayoutData( gd );

	if ( control.getLabel() != null )
		button.setText( control.getLabel() );
	if ( getTooltip() != null )
		button.setToolTipText( getTooltip() );

	Boolean tempInitValue = (Boolean) ControlHelper.getInitValue( control, getAtdl4jOptions() );
	if ( tempInitValue != null )
	{
		setValue( tempInitValue );
	}
	
	return parent;
}
 
Example 4
Source File: ConfigureGhidraScriptProjectWizardPage.java    From ghidra with Apache License 2.0 6 votes vote down vote up
@Override
public void createControl(Composite parent) {

	Composite container = new Composite(parent, SWT.NULL);
	container.setLayout(new GridLayout(1, false));

	userScriptsCheckboxButton = new Button(container, SWT.CHECK);
	userScriptsCheckboxButton.setText(
		"Link user home script directory (" + GhidraScriptUtils.userScriptsDir + ")");
	userScriptsCheckboxButton.setToolTipText("Automatically links Ghidra's default user home " +
		"script directory to the new project.  This is recommended.");
	userScriptsCheckboxButton.setSelection(true);

	systemScriptsCheckboxButton = new Button(container, SWT.CHECK);
	systemScriptsCheckboxButton.setText("Link Ghidra installation script directories");
	systemScriptsCheckboxButton.setToolTipText("Automatically links any script directories " +
		"found in the Ghidra installation to the new project, which serve as good examples.");
	systemScriptsCheckboxButton.setSelection(true);

	setErrorMessage(null);
	setPageComplete(true);
	setControl(container);
}
 
Example 5
Source File: SuperClassComponentProvider.java    From n4js with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Creates a new super class component using the given model and container.
 *
 * @param model
 *            The model to bind this to
 * @param container
 *            The parent WizardComponentContainer
 */
public SuperClassComponent(N4JSClassWizardModel model, WizardComponentContainer container) {
	super(container);
	this.model = model;

	Label superClassLabel = new Label(container.getComposite(), SWT.NONE);
	superClassLabel.setText("Super class:");

	text = new Text(container.getComposite(), SWT.BORDER);
	text.setLayoutData(fillTextDefaults());

	browseButton = new Button(container.getComposite(), SWT.NONE);
	browseButton.setToolTipText("Opens a dialog to choose the super class");
	browseButton.setText("Browse...");

	setupBindings();
	setupDialog();
}
 
Example 6
Source File: CommandPage.java    From EasyShell with Eclipse Public License 2.0 5 votes vote down vote up
private void createEditButton(Font font, GridData gridData, Composite groupComponent) {
    editButton = new Button(groupComponent, SWT.PUSH);
    editButton.setText(Activator.getResourceString("easyshell.command.page.button.text.edit"));
    editButton.setToolTipText(Activator.getResourceString("easyshell.command.page.button.tooltip.edit"));
    editButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent event) {
            editDialog();
        }
    });
    editButton.setLayoutData(gridData);
    editButton.setFont(font);
    setButtonLayoutData(editButton);
}
 
Example 7
Source File: Chart3DViewer.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * execute application
 * 
 * @param args
 */
public static void main( String[] args )
{
	Display display = Display.getDefault( );
	Shell shell = new Shell( display );
	shell.setSize( 600, 400 );
	shell.setLayout( new GridLayout( ) );

	Chart3DViewer c3dViewer = new Chart3DViewer( shell, SWT.NO_BACKGROUND );
	c3dViewer.setLayoutData( new GridData( GridData.FILL_BOTH ) );
	c3dViewer.addPaintListener( c3dViewer );

	Composite cBottom = new Composite( shell, SWT.NONE );
	cBottom.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
	cBottom.setLayout( new RowLayout( ) );

	Label la = new Label( cBottom, SWT.NONE );

	la.setText( "&Choose: " );//$NON-NLS-1$
	cbType = new Combo( cBottom, SWT.DROP_DOWN | SWT.READ_ONLY );
	cbType.add( "3D Bar Chart" ); //$NON-NLS-1$
	cbType.add( "3D Line Chart" );//$NON-NLS-1$
	cbType.add( "3D Area Chart" );//$NON-NLS-1$
	cbType.select( 0 );

	btn = new Button( cBottom, SWT.NONE );
	btn.setText( "&Update" );//$NON-NLS-1$
	btn.addSelectionListener( c3dViewer );
	btn.setToolTipText( "Update" );//$NON-NLS-1$
	
	shell.open( );
	while ( !shell.isDisposed( ) )
	{
		if ( !display.readAndDispatch( ) )
			display.sleep( );
	}
	display.dispose( );
}
 
Example 8
Source File: AbstractSection.java    From uima-uimaj with Apache License 2.0 5 votes vote down vote up
/**
 * New push button.
 *
 * @param parent the parent
 * @param label the label
 * @param tip the tip
 * @param enabled the enabled
 * @param style the style
 * @return the button
 */
public Button newPushButton(Composite parent, String label, String tip, boolean enabled, int style) {
  Button button = toolkit.createButton(parent, label, SWT.PUSH | style);
  GridData gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.FILL_HORIZONTAL);
  button.setLayoutData(gd);
  button.pack(false);
  button.setToolTipText(tip);
  button.setEnabled(enabled);
  button.addListener(SWT.Selection, this);
  Point buttonSize = button.getSize();
  gd.heightHint = buttonSize.y - 2;
  gd.widthHint = buttonSize.x - 2;
  return button;
}
 
Example 9
Source File: Snippet8.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
private Button createButton(Composite parent, String toolTipText,
		Listener selectionListener) {
	Button button = new Button(parent, SWT.PUSH);
	button.setToolTipText(toolTipText);
	button.setLayoutData(
			new GridData(SWT.FILL, SWT.FILL, false, false));
	button.addListener(SWT.Selection, selectionListener);
	return button;
}
 
Example 10
Source File: LineSeriesMarkerSheet.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
protected void createButtonGroup( Group grpTop )
{
	btnAdd = new Button( grpTop, SWT.NONE );
	{
		btnAdd.setText( Messages.getString( "LineSeriesMarkerSheet.Label.Add" ) ); //$NON-NLS-1$
		btnAdd.addSelectionListener( this );
	}

	newMarkerEditor = new MarkerEditorComposite( grpTop,
			createMarker( ),
			getContext( ),
			getDefaultMarker( ) );
	if ( markerTypeSet != null )
	{
		newMarkerEditor.setSupportedMarkerTypes( markerTypeSet );
	}
	if ( outlineText != null )
	{
		newMarkerEditor.setOutlineText( outlineText );
	}
	
	btnRemove = new Button( grpTop, SWT.NONE );
	{
		btnRemove.setText( Messages.getString( "LineSeriesMarkerSheet.Label.Remove" ) ); //$NON-NLS-1$
		btnRemove.addSelectionListener( this );
	}

	btnUp = new Button( grpTop, SWT.ARROW | SWT.UP );
	{
		btnUp.setToolTipText( Messages.getString( "PaletteEditorComposite.Lbl.Up" ) ); //$NON-NLS-1$
		btnUp.addSelectionListener( this );
	}

	btnDown = new Button( grpTop, SWT.ARROW | SWT.DOWN );
	{
		btnDown.setToolTipText( Messages.getString( "PaletteEditorComposite.Lbl.Down" ) ); //$NON-NLS-1$
		btnDown.addSelectionListener( this );
	}
}
 
Example 11
Source File: AppEngineDeployPreferencesPanel.java    From google-cloud-eclipse with Apache License 2.0 5 votes vote down vote up
protected Button createCheckBox(String text, String tooltip) {
  Button checkBox = new Button(this, SWT.CHECK);
  checkBox.setText(text);
  checkBox.setToolTipText(tooltip);

  GridData gridData = new GridData(SWT.BEGINNING, SWT.CENTER, false, false);
  gridData.horizontalSpan = 2;
  checkBox.setLayoutData(gridData);
  return checkBox;
}
 
Example 12
Source File: UtilsUI.java    From EasyShell with Eclipse Public License 2.0 5 votes vote down vote up
static public Button createButton(Composite parent, String imageId, String text, String tooltip) {
    Button button = new Button(parent, SWT.LEFT);
    button.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
    if (text!=null) {
        button.setText(text);
    }
    if (tooltip != null) {
        button.setToolTipText(tooltip);
    }
    button.setImage(Activator.getImage(imageId));
    return button;
}
 
Example 13
Source File: AbstractDataSection.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
protected Button createMoveDataButton(final Composite parent) {
    final Button moveData = getWidgetFactory().createButton(parent, Messages.moveData, SWT.FLAT);
    moveData.setLayoutData(GridDataFactory.fillDefaults().minSize(IDialogConstants.BUTTON_WIDTH, SWT.DEFAULT).create());
    moveData.setToolTipText(Messages.moveData_tooltip);
    moveData.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(final SelectionEvent e) {
            moveData((IStructuredSelection) dataTableViewer.getSelection());
        }
    });
    return moveData;
}
 
Example 14
Source File: ThrowEventSection.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
private Button createAddEventButton(final Composite buttonsComposite) {
    final Button addMessageEventButton = getWidgetFactory().createButton(buttonsComposite, Messages.addConnector, SWT.FLAT);
    addMessageEventButton.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).hint(85, SWT.DEFAULT).create());
    addMessageEventButton.addListener(SWT.Selection, new Listener() {
        @Override
        public void handleEvent(final Event event) {
            new WizardDialog(ThrowEventSection.this.getPart().getSite().getShell(),
                    createMessageEventWizard(ModelHelper.getMainProcess(getEObject()),null)).open();
            refresh();
        }
    });
    addMessageEventButton.setToolTipText(Messages.connectorAdd_tooltip);
    return addMessageEventButton;
}
 
Example 15
Source File: ExportImportablePartDialog.java    From uima-uimaj with Apache License 2.0 4 votes vote down vote up
@Override
protected Control createDialogArea(Composite parent) {

  Composite composite = (Composite) super.createDialogArea(parent);
  AbstractSection.spacer(composite);

  createWideLabel(composite, "Base file name (without path or following \".xml\":");

  baseFileNameUI = new Text(composite, SWT.BORDER);
  baseFileNameUI.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  baseFileNameUI.addModifyListener(m_dialogModifyListener);
  baseFileNameUI.addVerifyListener(new DialogVerifyListener());
  baseFileName = "";

  newErrorMessage(composite);

  createWideLabel(composite, "Where the generated part descriptor file will be stored:");
  genFilePathUI = new Text(composite, SWT.BORDER | SWT.H_SCROLL);
  genFilePathUI.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  genFilePathUI.setText(rootPath + ".xml");

  new Label(composite, SWT.NONE).setText("");
  importByNameUI = new Button(composite, SWT.RADIO);
  importByNameUI.setText("Import by Name");
  importByNameUI
          .setToolTipText("Importing by name looks up the name on the classpath and datapath.");

  importByLocationUI = new Button(composite, SWT.RADIO);
  importByLocationUI.setText("Import By Location");
  importByLocationUI.setToolTipText("Importing by location requires a relative or absolute URL");

  String defaultBy = CDEpropertyPage.getImportByDefault(editor.getProject());
  if (defaultBy.equals("location")) {
    importByNameUI.setSelection(false);
    importByLocationUI.setSelection(true);
  } else {
    importByNameUI.setSelection(true);
    importByLocationUI.setSelection(false);
  }

  baseFileNameUI.setFocus();
  return composite;
}
 
Example 16
Source File: LayerSideControls.java    From gama with GNU General Public License v3.0 4 votes vote down vote up
private void fillCameraParameters(final ParameterExpandBar viewer, final LayeredDisplayView view) {
	final Composite contents = createContentsComposite(viewer);
	final IDisplaySurface ds = view.getDisplaySurface();
	final IScope scope = ds.getScope();
	final LayeredDisplayData data = ds.getData();

	EditorFactory.create(scope, contents, "FreeFly Camera", !data.isArcBallCamera(),
			(EditorListener<Boolean>) val -> {
				ds.runAndUpdate(() -> {
					data.setArcBallCamera(!val);
				});

			});
	final boolean cameraLocked = data.cameraInteractionDisabled();
	EditorFactory.create(scope, contents, "Lock camera:", cameraLocked, (EditorListener<Boolean>) newValue -> {
		preset.setActive(!newValue);
		cameraPos.setActive(!newValue);
		cameraTarget.setActive(!newValue);
		cameraUp.setActive(!newValue);
		zoom.setActive(!newValue);
		data.disableCameraInteractions(newValue);
	});

	preset = EditorFactory.choose(scope, contents, "Preset camera:", "Choose...", true, view.getCameraNames(),
			(EditorListener<String>) newValue -> {
				if (newValue.isEmpty()) { return; }
				data.setPresetCamera(newValue);
				ds.updateDisplay(true);
			});

	cameraPos = EditorFactory.create(scope, contents, "Position:", data.getCameraPos(),
			(EditorListener<ILocation>) newValue -> {
				data.setCameraPos((GamaPoint) newValue);
				ds.updateDisplay(true);
			});
	cameraTarget = EditorFactory.create(scope, contents, "Target:", data.getCameraLookPos(),
			(EditorListener<ILocation>) newValue -> {
				data.setCameraLookPos((GamaPoint) newValue);
				ds.updateDisplay(true);
			});
	cameraUp = EditorFactory.create(scope, contents, "Orientation:", data.getCameraUpVector(),
			(EditorListener<ILocation>) newValue -> {
				data.setCameraUpVector((GamaPoint) newValue);
				ds.updateDisplay(true);
			});
	preset.setActive(!cameraLocked);
	cameraPos.setActive(!cameraLocked);
	cameraTarget.setActive(!cameraLocked);
	cameraUp.setActive(!cameraLocked);
	zoom.setActive(!cameraLocked);
	data.addListener((p, v) -> {
		switch (p) {
			case CAMERA_POS:
				cameraPos.getParam().setValue(scope, data.getCameraPos());
				cameraPos.forceUpdateValueAsynchronously();
				copyCameraAndKeystoneDefinition(scope, data);
				break;
			case CAMERA_TARGET:
				cameraTarget.getParam().setValue(scope, data.getCameraLookPos());
				cameraTarget.forceUpdateValueAsynchronously();
				copyCameraAndKeystoneDefinition(scope, data);
				break;
			case CAMERA_UP:
				cameraUp.getParam().setValue(scope, data.getCameraUpVector());
				cameraUp.forceUpdateValueAsynchronously();
				copyCameraAndKeystoneDefinition(scope, data);
				break;
			case CAMERA_PRESET:
				preset.getParam().setValue(scope, "Choose...");
				preset.forceUpdateValueAsynchronously();
				copyCameraAndKeystoneDefinition(scope, data);
				break;

			default:
				;
		}
	});
	final Label l = new Label(contents, SWT.None);
	l.setText("");
	final Button copy = new Button(contents, SWT.PUSH);
	copy.setText("Copy as facets");
	copy.setLayoutData(new GridData(SWT.END, SWT.FILL, false, false));
	copy.setToolTipText(
			"Copy the definition of the camera properties to the clipboard in a format suitable for pasting them in the definition of a display in GAML");
	copy.addSelectionListener(new SelectionAdapter() {

		@Override
		public void widgetSelected(final SelectionEvent e) {
			final String text = cameraDefinitionToCopy();
			WorkbenchHelper.copy(text);
		}

	});
	createItem(viewer, "Camera", null, contents);

}
 
Example 17
Source File: StaticHTMLController.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public void setViewer( IViewer viewer )
{
	this.viewer = viewer;

	if ( !( viewer instanceof AbstractViewer ) )
	{
		return;
	}

	Composite viewerUI = (Composite) ( (SWTAbstractViewer) viewer ).getUI( );

	if ( viewerUI == null )
	{
		return;
	}
	pane = new Composite( viewerUI, SWT.NONE );
	pane.setLayoutData( new GridData( GridData.HORIZONTAL_ALIGN_FILL ) );

	RowLayout rowLayout = new RowLayout( );
	rowLayout.type = SWT.HORIZONTAL;
	rowLayout.spacing = 5;
	pane.setLayout( rowLayout );

	for ( Iterator iter = buttons.iterator( ); iter.hasNext( ); )
	{
		ButtonInfo buttonInfo = (ButtonInfo) iter.next( );
		Button button = new Button( pane, SWT.PUSH );

		button.setText( buttonInfo.text );
		button.setToolTipText( buttonInfo.toolTip );
		if ( buttonInfo.selectionListener != null )
		{
			button.addSelectionListener( buttonInfo.selectionListener );
		}
	}

	GridData gd = new GridData( GridData.END, GridData.CENTER, false, false );
	gd.heightHint = 10;
	gd.widthHint = 100;
	progressBar = new ProgressBar( viewerUI, SWT.INDETERMINATE );
	progressBar.setLayoutData( gd );
	setBusy( true );
}
 
Example 18
Source File: RadarWebLabelSheet.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
@Override
protected Composite getComponent( Composite parent )
{
	cmpContent = new Composite( parent, SWT.NONE );
	{
		GridLayout glMain = new GridLayout( );
		glMain.numColumns = 2;
		cmpContent.setLayout( glMain );
	}

	Group grpLine = new Group( cmpContent, SWT.NONE );
	GridLayout glLine1a = new GridLayout( 2, false );
	grpLine.setLayout( glLine1a );
	grpLine.setLayoutData( new GridData( GridData.FILL_BOTH ) );
	grpLine.setText( Messages.getString( "RadarSeriesMarkerSheet.Label.WebLabel" ) ); //$NON-NLS-1$
	
	btnWebLabels = getContext( ).getUIFactory( )
			.createChartCheckbox( grpLine,
					SWT.NONE,
					defSeries.isShowCatLabels( ) );
	{
		btnWebLabels.setText( Messages.getString( "RadarSeriesAttributeComposite.Lbl.ShowWeb" ) ); //$NON-NLS-1$
		GridData gd = new GridData( GridData.FILL_VERTICAL );
		gd.horizontalSpan = 2;
		btnWebLabels.setLayoutData( gd );
		btnWebLabels.setSelectionState( series.isSetShowWebLabels( ) ? ( series.isShowWebLabels( ) ? ChartCheckbox.STATE_SELECTED
				: ChartCheckbox.STATE_UNSELECTED )
				: ChartCheckbox.STATE_GRAYED );
		btnWebLabels.addListener( SWT.Selection, this );
	}
	// Web Label Configuration
	LabelAttributesContext attributesContext = getLabelAttributeContext( );

	if ( series.getWebLabel( ) == null )
	{
		org.eclipse.birt.chart.model.component.Label lab = LabelImpl.create( );
		series.setWebLabel( lab );
	}

	webLabelAttr = new LabelAttributesComposite( grpLine,
			SWT.NONE,
			getContext( ),
			attributesContext,
			null,
			series,
			null,
			"webLabel", //$NON-NLS-1$
			defSeries,
			getChart( ).getUnits( ) );
	webLabelAttr.setEnabled( !( series.isSetShowWebLabels( ) && !series.isShowWebLabels( ) ) );
	GridData wla = new GridData( GridData.FILL_HORIZONTAL );
	wla.horizontalSpan = 2;
	webLabelAttr.setLayoutData( wla );
	webLabelAttr.addListener( this );
	webLabelAttr.setDefaultLabelValue( LabelImpl.createDefault( ) );

	btnWLFormatSpecifier = new Button( grpLine, SWT.PUSH );
	{
		GridData gdBTNFormatSpecifier = new GridData( );
		gdBTNFormatSpecifier.horizontalIndent = -3;
		gdBTNFormatSpecifier.horizontalSpan = 2;
		btnWLFormatSpecifier.setLayoutData( gdBTNFormatSpecifier );
		btnWLFormatSpecifier.setToolTipText( Messages.getString( "WebLabel.Tooltip.FormatSpecifier" ) ); //$NON-NLS-1$
		btnWLFormatSpecifier.addListener( SWT.Selection, this );
		btnWLFormatSpecifier.setText( Messages.getString( "Format.Button.Web.Label" ) ); //$NON-NLS-1$
	}

	webLabelAttr.setEnabled( !( series.isSetShowWebLabels( ) && !series.isShowWebLabels( ) ) );
	btnWLFormatSpecifier.setEnabled( !( series.isSetShowCatLabels( ) && !series.isShowWebLabels( ) ) );

	return cmpContent;
}
 
Example 19
Source File: TableView.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
private void editButton( TableItem row, int rownr, int colnr ) {
  beforeEdit = getItemText( row );
  fieldChanged = false;

  ColumnInfo colinfo = columns[colnr - 1];

  if ( colinfo.isReadOnly() ) {
    return;
  }

  if ( colinfo.getDisabledListener() != null ) {
    boolean disabled = colinfo.getDisabledListener().isFieldDisabled( rownr );
    if ( disabled ) {
      return;
    }
  }

  button = new Button( table, SWT.PUSH );
  props.setLook( button, Props.WIDGET_STYLE_TABLE );
  String buttonText = columns[colnr - 1].getButtonText();
  if ( buttonText != null ) {
    button.setText( buttonText );
  }
  button.setImage( GUIResource.getInstance().getImage( "ui/images/edittext.svg" ) );

  SelectionListener selAdpt = colinfo.getSelectionAdapter();
  if ( selAdpt != null ) {
    button.addSelectionListener( selAdpt );
  }

  buttonRownr = rownr;
  buttonColnr = colnr;

  // button.addTraverseListener(lsTraverse);
  buttonContent = row.getText( colnr );

  String tooltip = columns[colnr - 1].getToolTip();
  if ( tooltip != null ) {
    button.setToolTipText( tooltip );
  } else {
    button.setToolTipText( "" );
  }
  button.addTraverseListener( lsTraverse ); // hop to next field
  button.addTraverseListener( new TraverseListener() {
    @Override
    public void keyTraversed( TraverseEvent arg0 ) {
      closeActiveButton();
    }
  } );

  editor.horizontalAlignment = SWT.LEFT;
  editor.verticalAlignment = SWT.TOP;
  editor.grabHorizontal = false;
  editor.grabVertical = false;

  Point size = button.computeSize( SWT.DEFAULT, SWT.DEFAULT );
  editor.minimumWidth = size.x;
  editor.minimumHeight = size.y - 2;

  // setRowNums();
  editor.layout();

  // Open the text editor in the correct column of the selected row.
  editor.setEditor( button );

  button.setFocus();

  // if the button loses focus, destroy it...
  /*
   * button.addFocusListener(new FocusAdapter() { public void focusLost(FocusEvent e) { button.dispose(); } } );
   */
}
 
Example 20
Source File: AbstractSection.java    From uima-uimaj with Apache License 2.0 3 votes vote down vote up
/**
 * New radio button.
 *
 * @param parent the parent
 * @param label the label
 * @param toolTip the tool tip
 * @param selected the selected
 * @return the button
 */
// **************************************************
public Button newRadioButton(Composite parent, String label, String toolTip, boolean selected) {
  Button button = toolkit.createButton(parent, label, SWT.RADIO);
  button.setToolTipText(toolTip);
  button.setSelection(selected);
  button.addListener(SWT.Selection, this);
  return button;
}