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

The following examples show how to use org.eclipse.swt.widgets.Button#dispose() . 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: DotExportRadioGroupFieldEditor.java    From gef with Eclipse Public License 2.0 6 votes vote down vote up
public void clear() {
	this.labelsAndValues = null;
	if (radioButtons != null) {
		for (Button radioButton : radioButtons) {
			radioButton.dispose();
		}

		showDotExportHintLabel();
		hideOpenExportedFileBooleanFieldEditor();
		// do synchronous layout
		Display.getDefault().syncExec(new Runnable() {

			@Override
			public void run() {
				parent.layout();
			}
		});
	}
}
 
Example 2
Source File: DynamicAddRemoveLineComposite.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void dispose() {
	super.dispose();
	if (regionForAdd != null && !regionForAdd.isDisposed()) {
		regionForAdd.dispose();
	}
	//		for (Region region : regions) {
	//			if (region != null && !region.isDisposed()) {
	//				region.dispose();
	//			}
	//		}
	for (Control composite : controls) {
		if (!composite.isDisposed()) {
			composite.dispose();
		}
	}
	for (Button toDispose : removes) {
		if (toDispose != null && !toDispose.isDisposed()) {
			toDispose.dispose();
		}
	}
}
 
Example 3
Source File: VisibilityTester.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
public void removeTester ( final Button button )
{
    button.dispose ();
    if ( this.dialog != null )
    {
        this.dialog.layout ();
    }
    checkDisposeDialog ();
}
 
Example 4
Source File: IndexTabWrapper.java    From ermasterr with Apache License 2.0 5 votes vote down vote up
private void clearButtonAndEditor() {
    for (final Button checkButton : checkButtonList) {
        checkButton.dispose();
    }

    checkButtonList.clear();

    for (final TableEditor editor : editorList) {
        editor.dispose();
    }

    editorList.clear();
}
 
Example 5
Source File: ChartMakerDialog.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void handleEvent(@Nullable Event event) {
    if (event == null) {
        return;
    }

    /* Dispose the button of the series */
    Button button = (Button) checkNotNull(event.widget);
    button.dispose();

    /* Remove the series from the list */
    ChartSeries series = findRemoveButtonOwner(button);
    fSelectedSeries.remove(series);
    fSeriesTable.refresh();

    /* Refresh controls */
    tryResetXFilter();
    fSelectionXTable.refresh();

    tryResetYFilter();
    fSelectionYTable.refresh();

    /* Disable OK button if no series are made */
    if (fSelectedSeries.isEmpty()) {
        getButton(IDialogConstants.OK_ID).setEnabled(false);
        fWarningLabel.setVisible(false);
    }

    configureLogscaleCheckboxes();
}
 
Example 6
Source File: IndexTabWrapper.java    From erflute with Apache License 2.0 5 votes vote down vote up
private void clearButtonAndEditor() {
    for (final Button checkButton : checkButtonList) {
        checkButton.dispose();
    }
    checkButtonList.clear();
    for (final TableEditor editor : editorList) {
        editor.dispose();
    }
    editorList.clear();
}
 
Example 7
Source File: OperationsComposite.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void dispose() {
    super.dispose();
    for (final OperationViewer text : operationViewers) {
        if (text != null) {
            text.dispose();
        }
    }
    for (final Button toDispose : removes) {
        if (toDispose != null && !toDispose.isDisposed()) {
            toDispose.dispose();
        }
    }
}
 
Example 8
Source File: OperationGroupViewer.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
public void dispose() {
    for (final OperationViewer text : operationViewers) {
        if (text != null) {
            text.dispose();
        }
    }
    for (final Button toDispose : removes) {
        if (toDispose != null && !toDispose.isDisposed()) {
            toDispose.dispose();
        }
    }
    getOperations().removeListChangeListener(operationListlistener);
}
 
Example 9
Source File: DynamicAddRemoveLineComposite.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
public void removeAllLines() {
int size = removes.size() ;
for(Button remove : removes){
	remove.dispose() ;
}
removes.clear();
for(Control control : controls){
	control.dispose() ;
}
controls.clear();

layoutComposite();
for(int i = 0 ; i< size ; i++)
	lineRemoved(i);	
}
 
Example 10
Source File: IndexTabWrapper.java    From ermaster-b with Apache License 2.0 5 votes vote down vote up
private void clearButtonAndEditor() {
	for (Button checkButton : this.checkButtonList) {
		checkButton.dispose();
	}

	this.checkButtonList.clear();

	for (TableEditor editor : this.editorList) {
		editor.dispose();
	}

	this.editorList.clear();
}
 
Example 11
Source File: MenuButton.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public Point computeSize( int wHint, int hHint, boolean changed )
{

	int width;
	int height;

	Button tmp = new Button( this, button.getStyle( ) );
	if ( text != null )
	{
		tmp.setText( text );
		height = tmp.computeSize( SWT.DEFAULT, SWT.DEFAULT ).y;
	}
	else
	{
		tmp.setText( "" ); //$NON-NLS-1$
		height = tmp.computeSize( SWT.DEFAULT, SWT.DEFAULT ).y;
	}
	if ( image != null )
		tmp.setImage( image );
	Point size = tmp.computeSize( SWT.DEFAULT, SWT.DEFAULT );
	tmp.dispose( );

	if ( menu != null )
	{
		width = size.x + WIDTH_MORE;
	}
	else
		width = size.x;

	if ( isFixed && image != null )
	{
		int imageWidth = image.getImageData( ).width;
		if ( imageWidth > IMAGE_WIDTH )
			width -= ( imageWidth - IMAGE_WIDTH );

	}
	if ( !isFixed )
		height = size.y;
	defaultSize = new Point( width, height );
	if ( wHint != SWT.DEFAULT )
		width = wHint;
	if ( hHint != SWT.DEFAULT )
		height = hHint;

	return new Point( width, height );
}
 
Example 12
Source File: MenuButton.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public Point computeSize( int wHint, int hHint, boolean changed )
{

	int width;
	int height;

	Button tmp = new Button( this, button.getStyle( ) );
	if ( text != null )
	{
		tmp.setText( text );
		height = tmp.computeSize( SWT.DEFAULT, SWT.DEFAULT ).y;
	}
	else
	{
		tmp.setText( "" ); //$NON-NLS-1$
		height = tmp.computeSize( SWT.DEFAULT, SWT.DEFAULT ).y;
	}
	if ( image != null )
		tmp.setImage( image );
	Point size = tmp.computeSize( SWT.DEFAULT, SWT.DEFAULT );
	tmp.dispose( );

	if ( menu != null )
	{
		width = size.x + WIDTH_MORE;
	}
	else
		width = size.x;

	if ( isFixed && image != null )
	{
		int imageWidth = image.getImageData( ).width;
		if ( imageWidth > IMAGE_WIDTH )
			width -= ( imageWidth - IMAGE_WIDTH );

	}
	if ( !isFixed )
		height = size.y;
	defaultSize = new Point( width, height );
	if ( wHint != SWT.DEFAULT )
		width = wHint;
	if ( hHint != SWT.DEFAULT )
		height = hHint;

	return new Point( width, height );
}
 
Example 13
Source File: AbstractEntryComposite.java    From ice with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void refresh() {

	logger.info("Refresh called for " + entry.getName());
	if (label != null) {
		label.dispose();
		label = null;
	}

	if (widget != null) {
		logger.info("Disposing widget - "
				+ widget.getClass().getCanonicalName());
		widget.dispose();
		widget = null;
	}

	for (Button button : buttons) {
		if (!button.isDisposed()) {
			button.dispose();
		}
	}

	// Remove all of the previous buttons.
	buttons.clear();

	// Print an error if this Entry has been prematurely disposed.
	if (isDisposed()) {
		logger.info("EntryComposite Message: "
				+ "This composite has been prematurely disposed!");
		return;
	}

	// Remove the resize listener.
	if (resizeListener != null) {
		removeControlListener(resizeListener);
		resizeListener = null;
	}

	// Re-render the Composite
	render();

	// Re-draw the Composite
	layout();

	return;
}
 
Example 14
Source File: AggregateSection.java    From uima-uimaj with Apache License 2.0 4 votes vote down vote up
@Override
public void initialize(IManagedForm form) {
  super.initialize(form);

  Composite sectionClient = new2ColumnComposite(this.getSection());

  // Table Container has table and buttons on bottom
  Composite tableContainer = newComposite(sectionClient);
  enableBorders(tableContainer);
  toolkit.paintBordersFor(tableContainer);

  filesTable = newTable(tableContainer, SWT.FULL_SELECTION, 150);

  filesTable.setHeaderVisible(true);

  newTableColumn(filesTable, 50, SWT.LEFT, "Delegate");
  newTableColumn(filesTable, 75, SWT.LEFT, "Key Name");

  // This little code fragment is an attempt to get the right sizing for the buttons
  // Was wrong on Mac platforms
  //   Word below is the longer of the two words in the button container
  Button tempForSize = toolkit.createButton(tableContainer, "Remove", SWT.PUSH);
  Point p = tempForSize.computeSize(SWT.DEFAULT, SWT.DEFAULT);
  tempForSize.dispose();
  
  Composite bottomButtonContainer = newButtonContainer(tableContainer, HORIZONTAL_BUTTONS, 3* p.x);

  addButton = newPushButton(bottomButtonContainer, S_ADD,
          "Click here to add a locally defined AE or CAS Consumer delegate", ENABLED);
  removeButton = newPushButton(bottomButtonContainer, "Remove",
          "Click here to remove the selected item", ENABLED);

  Composite sideButtonContainer = newButtonContainer(sectionClient, VERTICAL_BUTTONS, 80);

  // this next just serves as a spacer
  spacer(sideButtonContainer);
  spacer(sideButtonContainer);

  addToFlowButton = newPushButton(sideButtonContainer, ">>",
          "Click here to add the selected item to the flow", !ENABLED);
  removeFromFlowButton = newPushButton(sideButtonContainer, "<<",
          "Click here to remove the selected item from the flow", !ENABLED);

  spacer(sideButtonContainer);

  addRemoteButton = newPushButton(sideButtonContainer, "AddRemote",
          "Click here to add a Remote Analysis Engine", ENABLED);
  findAnalysisEngineButton = newPushButton(sideButtonContainer, "Find AE",
          "Click here to search for an Analysis Engine", ENABLED);

  addButton.setSize(removeButton.getSize());

  filesTable.addListener(SWT.MouseDown, this);
  filesTable.addListener(SWT.MouseHover, this);
}