org.eclipse.swt.widgets.Button Java Examples
The following examples show how to use
org.eclipse.swt.widgets.Button.
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: TimeNowActionController.java From neoscada with Eclipse Public License 1.0 | 6 votes |
public TimeNowActionController ( final ControllerManager controllerManager, final ChartContext chartContext, final TimeNowAction controller ) { super ( controllerManager.getContext (), chartContext, controller ); final Composite space = chartContext.getExtensionSpaceProvider ().getExtensionSpace (); if ( space != null ) { this.button = new Button ( space, SWT.PUSH ); this.button.setText ( Messages.TimeNowActionController_Label ); this.button.setToolTipText ( Messages.TimeNowActionController_Description ); this.button.addSelectionListener ( new SelectionAdapter () { @Override public void widgetSelected ( final SelectionEvent e ) { action (); }; } ); space.layout (); } else { this.button = null; } }
Example #2
Source File: DbImportPage.java From olca-app with Mozilla Public License 2.0 | 6 votes |
private void createExistingSection(Composite body) { Button existingCheck = new Button(body, SWT.RADIO); existingCheck.setText("Existing database"); existingCheck.setSelection(true); Controls.onSelect(existingCheck, (e) -> { setSelection(config.EXISTING_MODE); }); Composite composite = new Composite(body, SWT.NONE); UI.gridLayout(composite, 1); UI.gridData(composite, true, false); existingViewer = new ComboViewer(composite); UI.gridData(existingViewer.getControl(), true, false); existingViewer.setLabelProvider(new DbLabel()); existingViewer.setContentProvider(ArrayContentProvider.getInstance()); existingViewer.addSelectionChangedListener(e -> selectDatabase()); fillExistingViewer(); }
Example #3
Source File: SWTFactory.java From APICloud-Studio with GNU General Public License v3.0 | 6 votes |
/** * Creates and returns a new push button with the given label and/or image. * * @param parent * parent control * @param label * button label or <code>null</code> * @param image * image or <code>null</code> * @return a new push button */ public static Button createPushButton(Composite parent, String label, Image image) { Button button = new Button(parent, SWT.PUSH); button.setFont(parent.getFont()); if (image != null) { button.setImage(image); } if (label != null) { button.setText(label); } GridData gd = new GridData(); button.setLayoutData(gd); SWTFactory.setButtonDimensionHint(button); return button; }
Example #4
Source File: SWTFactory.java From APICloud-Studio with GNU General Public License v3.0 | 6 votes |
/** * Creates a check box button using the parents' font * * @param parent * the parent to add the button to * @param label * the label for the button * @param image * the image for the button * @param checked * the initial checked state of the button * @param hspan * the horizontal span to take up in the parent composite * @return a new checked button set to the initial checked state */ public static Button createCheckButton(Composite parent, String label, Image image, boolean checked, int hspan) { Button button = new Button(parent, SWT.CHECK); button.setFont(parent.getFont()); button.setSelection(checked); if (image != null) { button.setImage(image); } if (label != null) { button.setText(label); } GridData gd = new GridData(); gd.horizontalSpan = hspan; button.setLayoutData(gd); setButtonDimensionHint(button); return button; }
Example #5
Source File: InvoiceCorrectionWizardDialog.java From elexis-3-core with Eclipse Public License 1.0 | 6 votes |
@Override protected void buttonPressed(int buttonId){ super.buttonPressed(buttonId); if (IDialogConstants.NEXT_ID == buttonId) { Button nextBtn = getButton(IDialogConstants.NEXT_ID); // the text of the button will be changed if ("Korrigierte Rechnung öffnen".equals(nextBtn.getText())) { if (invoiceCorrectionDTO != null) { invoiceCorrectionDTO.setOpenNewInvoice(true); finishPressed(); return; } } else if (invoiceCorrectionDTO != null && invoiceCorrectionDTO.isCorrectionSuccess()) { nextBtn.setEnabled(true); nextBtn.setText("Korrigierte Rechnung öffnen"); } getButton(IDialogConstants.CANCEL_ID).setEnabled(false); getButton(IDialogConstants.FINISH_ID).setVisible(true); } }
Example #6
Source File: SmartTypingConfigurationBlock.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
private void addAutoclosingSection(Composite composite) { GridLayout layout= new GridLayout(); layout.numColumns= 1; composite.setLayout(layout); String label; Button master, slave; label= PreferencesMessages.JavaEditorPreferencePage_closeStrings; addCheckBox(composite, label, PreferenceConstants.EDITOR_CLOSE_STRINGS, 0); label= PreferencesMessages.JavaEditorPreferencePage_closeBrackets; addCheckBox(composite, label, PreferenceConstants.EDITOR_CLOSE_BRACKETS, 0); label= PreferencesMessages.JavaEditorPreferencePage_closeBraces; addCheckBox(composite, label, PreferenceConstants.EDITOR_CLOSE_BRACES, 0); label= PreferencesMessages.JavaEditorPreferencePage_closeJavaDocs; master= addCheckBox(composite, label, PreferenceConstants.EDITOR_CLOSE_JAVADOCS, 0); label= PreferencesMessages.JavaEditorPreferencePage_addJavaDocTags; slave= addCheckBox(composite, label, PreferenceConstants.EDITOR_ADD_JAVADOC_TAGS, 0); createDependency(master, slave); }
Example #7
Source File: InputParameterDialog.java From birt with Eclipse Public License 1.0 | 6 votes |
private void initRadioButton( Button button, IParameterSelectionChoice choice, String choiceLabel ) { if ( ( choice.getValue( ) == defaultValue ) || ( choice.getValue( ) != null && choice.getValue( ) .equals( defaultValue ) ) ) { button.setSelection( true ); putConfigValue( paramterHandleName, button.getData( ) ); clearSelectRadio( radioItems ); } else if ( defaultValue == null && choiceLabel.equals( InputParameterSelectionChoice.NULLVALUECHOICE ) ) { button.setSelection( true ); removeConfigValue( paramterHandleName ); clearSelectRadio( radioItems ); } radioItems.add( button ); }
Example #8
Source File: BaseStepDialog.java From pentaho-kettle with Apache License 2.0 | 6 votes |
/** * Aligns the buttons as right-aligned on the dialog. * * @param buttons the array of buttons to align * @param width the standardized width of all the buttons * @param margin the margin between buttons * @param lastControl (optional) the bottom most control used for aligning the buttons relative to the bottom of the * controls on the dialog */ protected static void rightAlignButtons( Button[] buttons, int width, int margin, Control lastControl ) { for ( int i = buttons.length - 1; i >= 0; --i ) { FormData formData = createDefaultFormData( buttons[ i ], width, margin, lastControl ); // Set the right side of the buttons (either offset from the edge, or relative to the previous button) if ( i == buttons.length - 1 ) { formData.left = new FormAttachment( 100, -( width + margin ) ); } else { formData.left = new FormAttachment( buttons[ i + 1 ], -( 2 * ( width + margin ) ) - margin ); } // Apply the layout data buttons[ i ].setLayoutData( formData ); } }
Example #9
Source File: FilterViewer.java From tracecompass with Eclipse Public License 2.0 | 6 votes |
FilterEqualsNodeComposite(Composite parent, TmfFilterEqualsNode node) { super(parent, node); fNode = node; createAspectControls(); createValueText(fNode); new Label(this, SWT.NONE); fIgnoreCaseButton = new Button(this, SWT.CHECK); fIgnoreCaseButton.setSelection(fNode.isIgnoreCase()); fIgnoreCaseButton.setText(Messages.FilterViewer_IgnoreCaseButtonText); fIgnoreCaseButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { fNode.setIgnoreCase(fIgnoreCaseButton.getSelection()); fViewer.refresh(fNode); } }); }
Example #10
Source File: PTChooserEditor.java From nebula with Eclipse Public License 2.0 | 6 votes |
/** * Creates the "plus" button * * @param buttonHolder aprent composite */ private void createPlusButton(final Composite buttonHolder) { final Button plusButton = new Button(buttonHolder, SWT.PUSH); plusButton.setText("..."); plusButton.setToolTipText(ResourceManager.getLabel(ResourceManager.EDIT_PROPERTY)); plusButton.setEnabled(property.isEnabled()); plusButton.addListener(SWT.Selection, event -> { openWindow(widget, item, property); }); plusButton.addListener(SWT.FocusIn, event -> { widget.updateDescriptionPanel(property); }); plusButton.pack(); }
Example #11
Source File: AssignChoicePage.java From tesb-studio-se with Apache License 2.0 | 6 votes |
public void createControl(Composite parent) { setTitle(Messages.getString("AssignChoicePage_title"));//$NON-NLS-1$ setDescription(Messages.getString("AssignChoicePage_message"));//$NON-NLS-1$ Composite composite = new Composite(parent, SWT.NONE); composite.setLayout(new GridLayout(1, false)); newJob = new Button(composite, SWT.RADIO); newJob.setText(Messages.getString("AssignChoicePage_newJobLabel"));//$NON-NLS-1$ assignJob = new Button(composite, SWT.RADIO); assignJob.setText(Messages.getString("AssignChoicePage_assignJobLabel"));//$NON-NLS-1$ newJob.setSelection(true); setControl(composite); }
Example #12
Source File: MappingDialog.java From pentaho-kettle with Apache License 2.0 | 6 votes |
/** * Enables or disables the mapping button. We can only enable it if the target steps 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 sourceStepname The mapping output step * @param targetStepname The target step to verify * @throws KettleException */ private void enableMappingButton( final Button button, boolean input, String sourceStepname, String targetStepname ) throws KettleException { if ( input ) { return; // nothing to do } boolean enabled = false; if ( mappingTransMeta != null ) { StepMeta mappingInputStep = mappingTransMeta.findMappingInputStep( sourceStepname ); if ( mappingInputStep != null ) { StepMeta mappingOutputStep = transMeta.findMappingOutputStep( targetStepname ); RowMetaInterface requiredFields = mappingOutputStep.getStepMetaInterface().getRequiredFields( transMeta ); if ( requiredFields != null && requiredFields.size() > 0 ) { enabled = true; } } } button.setEnabled( enabled ); }
Example #13
Source File: XYGraphConfigDialog.java From nebula with Eclipse Public License 2.0 | 6 votes |
@Override protected void createButtonsForButtonBar(Composite parent) { ((GridLayout) parent.getLayout()).numColumns++; Button button = new Button(parent, SWT.PUSH); button.setText("Apply"); GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL); int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH); Point minSize = button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); data.widthHint = Math.max(widthHint, minSize.x); button.setLayoutData(data); button.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { applyChanges(); } }); super.createButtonsForButtonBar(parent); Shell shell = parent.getShell(); if (shell != null) { shell.setDefaultButton(button); } }
Example #14
Source File: SelectConnectorConfigurationWizardPage.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
protected void createRemoveButton(Composite composite) { removeButton = new Button(composite,SWT.PUSH) ; removeButton.setText(Messages.removeData); removeButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { if (!configurationViewers.getSelection().isEmpty()) { final Object selection = ((StructuredSelection) configurationViewers.getSelection()).getFirstElement(); if(selection instanceof ConnectorConfiguration){ final Resource r = ((ConnectorConfiguration)selection).eResource() ; final String fileName = URI.decode(r.getURI().lastSegment()) ; final IRepositoryFileStore artifact = configurationStore.getChild(fileName, true) ; if(artifact != null){ if(FileActionDialog.confirmDeletionQuestion(fileName)){ artifact.delete(); } } configurationViewers.setInput(new Object()); } } } }); removeButton.setEnabled(false); }
Example #15
Source File: MasterSelectionDialog.java From neoscada with Eclipse Public License 1.0 | 5 votes |
private void update () { final Button button = getButton ( OK ); if ( button == null ) { // too early return; } button.setEnabled ( getMaster () != null ); }
Example #16
Source File: OpenDiagramWizardPage.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
@Override protected Composite doCreateControl(final Composite parent, final DataBindingContext context) { final Composite mainComposite = super.doCreateControl(parent, context); final Button removeProcessButton = new Button(mainComposite, SWT.FLAT); removeProcessButton.setLayoutData(swtDefaults().hint(90, SWT.DEFAULT).create()); removeProcessButton.setText(Messages.removeProcessLabel); removeProcessButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { final AbstractManageDiagramWizard wizard = (AbstractManageDiagramWizard) getWizard(); if (wizard.confirmDelete(getSelectedDiagrams())) { wizard.deleteDiagrams(getSelectedDiagrams(), getViewer()); } } }); context.bindValue(SWTObservables.observeEnabled(removeProcessButton), ViewersObservables.observeSingleSelection(getDiagramTree().getViewer()), neverUpdateValueStrategy().create(), updateValueStrategy().withConverter(convertSelectionToBooleanForRemoveEnablement()).create()); // Separator final Composite blank = new Composite(mainComposite, SWT.NONE); blank.setLayoutData(new GridData(SWT.DEFAULT, 40)); return mainComposite; }
Example #17
Source File: SWTCheckBoxListWidget.java From atdl4j with MIT License | 5 votes |
public void removeListener(Listener listener) { for ( Button b : multiCheckBox ) { b.removeListener( SWT.Selection, listener ); } }
Example #18
Source File: MainView.java From mappwidget with Apache License 2.0 | 5 votes |
private void setCompliete(Composite top, final Button runButton, final ProgressBar progressBar) { top.getDisplay().asyncExec(new Runnable() { @Override public void run() { runButton.setEnabled(true); } }); }
Example #19
Source File: DocumentWizardPage.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
private void createSingleMultipleRadioGroup(final Composite parent, final EMFDataBindingContext emfDataBindingContext) { //FILLER final Label filler = new Label(parent, SWT.NONE); filler.setLayoutData(GridDataFactory.swtDefaults().grab(false, false).create()); final Composite radioContainer = new Composite(parent, SWT.NONE); radioContainer.setLayout(GridLayoutFactory.fillDefaults().numColumns(2).margins(0, 0).create()); radioContainer.setLayoutData(GridDataFactory.swtDefaults().grab(true, false).create()); final Button radioButtonSingle = createRadioButtonSingle(radioContainer); final Button radioButtonMultiple = createRadioButtonMultiple(radioContainer); final SelectObservableValue isMultipleObservableValue = new SelectObservableValue(Boolean.class); isMultipleObservableValue.addOption(false, SWTObservables.observeSelection(radioButtonSingle)); isMultipleObservableValue.addOption(true, SWTObservables.observeSelection(radioButtonMultiple)); final IObservableValue multipleObserveValue = EMFObservables.observeValue(document, ProcessPackage.Literals.DOCUMENT__MULTIPLE); emfDataBindingContext.bindValue( isMultipleObservableValue, multipleObserveValue); multipleObserveValue.addValueChangeListener(new IValueChangeListener() { @Override public void handleValueChange(final ValueChangeEvent event) { validate(emfDataBindingContext); } }); }
Example #20
Source File: LoadDialog.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
private void createOptionComposite() { Composite group = new Composite(fDialogComposite, SWT.BORDER); group.setLayout(new GridLayout(1, true)); group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); fForceButton = new Button(group, SWT.CHECK); fForceButton.setText(Messages.TraceControl_ForceButtonText); fForceButton.setSelection(true); }
Example #21
Source File: ActorMappingConfigurationWizardPage.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
protected void createExportButton(final Composite composite) { final Button exportButton = new Button(composite, SWT.PUSH); exportButton.setText(Messages.exportActorMappingFile); exportButton.setLayoutData(GridDataFactory.swtDefaults().align(SWT.END, SWT.CENTER).create()); exportButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { final ExportActorMappingAction action = new ExportActorMappingAction(); action.setConfiguration(configuration); action.setProcess(process); action.run(); } }); }
Example #22
Source File: ViewCostBenefitModel.java From arx with Apache License 2.0 | 5 votes |
/** * Creates an input field * @param caption * @param callback * @return */ private Text createInputField(String caption, final Callback<Double> callback) { // Label Label label = new Label(root, SWT.NONE); label.setText(caption); // Text field final Text text = new Text(root, SWT.BORDER | SWT.SINGLE); text.setText("0"); //$NON-NLS-1$ text.setToolTipText("0"); //$NON-NLS-1$ text.setLayoutData(SWTUtil.createFillHorizontallyGridData()); text.setEditable(false); // Button Button btn1 = new Button(root, SWT.FLAT); btn1.setText(Resources.getMessage("ViewCostBenefitModel.0")); //$NON-NLS-1$ btn1.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent arg0) { String value = controller.actionShowInputDialog(root.getShell(), Resources.getMessage("ViewCostBenefitModel.5"), //$NON-NLS-1$ Resources.getMessage("ViewCostBenefitModel.6"), //$NON-NLS-1$ text.getToolTipText(), validator); if (value != null) { callback.call(Double.valueOf(value)); update(); } } }); // Return return text; }
Example #23
Source File: WidgetTask.java From Flashtool with GNU General Public License v3.0 | 5 votes |
public static void setEnabled(final Button item, final boolean status) { Display.getDefault().asyncExec( new Runnable() { public void run() { item.setEnabled(status); } } ); }
Example #24
Source File: FileMatchPatternEditDialog.java From eclipse-cs with GNU Lesser General Public License v2.1 | 5 votes |
/** * @see TitleAreaDialog#createDialogArea(org.eclipse.swt.widgets.Composite) */ @Override protected Control createDialogArea(Composite parent) { Composite composite = (Composite) super.createDialogArea(parent); Composite dialog = new Composite(composite, SWT.NONE); dialog.setLayoutData(new GridData(GridData.FILL_BOTH)); dialog.setLayout(new GridLayout(1, false)); Label nameLabel = new Label(dialog, SWT.NULL); nameLabel.setText(Messages.FileMatchPatternEditDialog_lblRegex); mFileMatchPatternText = new Text(dialog, SWT.SINGLE | SWT.BORDER); mFileMatchPatternText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); mIncludeButton = new Button(dialog, SWT.CHECK); mIncludeButton.setText(Messages.FileMatchPatternEditDialog_chkIncludesFiles); mIncludeButton.setLayoutData(new GridData()); // integrate content assist ContentAssistHandler.createHandlerForText(mFileMatchPatternText, createContentAssistant()); // init the controls if (mPattern != null) { mFileMatchPatternText.setText(mPattern.getMatchPattern()); mIncludeButton.setSelection(mPattern.isIncludePattern()); } else { mIncludeButton.setSelection(true); } this.setTitleImage(CheckstyleUIPluginImages.getImage(CheckstyleUIPluginImages.PLUGIN_LOGO)); this.setTitle(Messages.FileMatchPatternEditDialog_title); this.setMessage(Messages.FileMatchPatternEditDialog_message); return dialog; }
Example #25
Source File: CommonStepDialog.java From pentaho-kettle with Apache License 2.0 | 5 votes |
protected Button buildGetFieldsButton( final Composite parent, final SelectionAdapter listener ) { // get fields button wGet = new Button( parent, SWT.PUSH ); updateGetFieldsButtonStatus(); wGet.setText( BaseMessages.getString( PKG, "CommonStepDialog.Button.GetFields" ) ); //$NON-NLS-1$ props.setLook( wGet ); wGet.setLayoutData( new FormDataBuilder().right( 100, 0 ).bottom( 100, 0 ).result() ); wGet.addSelectionListener( listener ); return wGet; }
Example #26
Source File: ReportConfigurationTab.java From spotbugs with GNU Lesser General Public License v2.1 | 5 votes |
@Override public void setEnabled(boolean enabled) { minPriorityCombo.setEnabled(enabled); ofConcernRankCombo.setEnabled(enabled); troublingRankCombo.setEnabled(enabled); scaryRankCombo.setEnabled(enabled); scariestRankCombo.setEnabled(enabled); minRankSlider.setEnabled(enabled); for (Button checkBox : chkEnableBugCategoryList) { checkBox.setEnabled(enabled); } super.setEnabled(enabled); }
Example #27
Source File: OptionsConfigurationBlock.java From birt with Eclipse Public License 1.0 | 5 votes |
protected RadioComposite addRadioButton( Composite parent, String[] labels, Key key, String[] values, int indent ) { ControlData data = new ControlData( key, values ); GridData gd = new GridData( GridData.HORIZONTAL_ALIGN_FILL ); gd.horizontalSpan = 3; gd.horizontalIndent = indent; RadioComposite composite = new RadioComposite( parent, SWT.NONE ); composite.setLayoutData( gd ); GridLayout layout = new GridLayout( 3, false ); composite.setLayout( layout ); composite.setText( labels[0] ); for ( int i = 1; i < labels.length; i++ ) { Button radioBtn = new Button( composite, SWT.RADIO ); radioBtn.setFont( JFaceResources.getDialogFont( ) ); radioBtn.setLayoutData( new GridData( ) ); radioBtn.setText( labels[i] ); } composite.setData( data ); composite.addSelectionListener( getSelectionListener( ) ); String currValue = getValue( key ); composite.setSelection( data.getSelection( currValue ) ); fRadioButtons.add( composite ); updateRadioComposite( composite ); return composite; }
Example #28
Source File: SWTRadioButtonListWidget.java From atdl4j with MIT License | 5 votes |
public void setValue(String value, boolean setValueAsControl) { for ( int i = 0; i < buttons.size(); i++ ) { Button b = buttons.get( i ); if ( setValueAsControl || parameter == null ) { b.setSelection( value.equals( getListItems().get( i ).getEnumID() ) ); } else { b.setSelection( value.equals( parameter.getEnumPair().get( i ).getWireValue() ) ); } } }
Example #29
Source File: LicenseAgreementDialog.java From tmxeditor8 with GNU General Public License v2.0 | 5 votes |
@Override protected Control createDialogArea(Composite parent) { Composite tparent = (Composite) super.createDialogArea(parent); GridLayout layout = new GridLayout(); layout.marginTop = 5; layout.marginWidth = 10; tparent.setLayout(layout); GridData parentData = new GridData(SWT.FILL, SWT.FILL, true, true); parentData.heightHint = 380; tparent.setLayoutData(parentData); Label lbl = new Label(tparent, SWT.NONE); lbl.setText(Messages.getString("license.LicenseAgreementDialog.label")); lbl.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); Text text = new Text(tparent, SWT.MULTI | SWT.WRAP | SWT.V_SCROLL); text.setEditable(false); text.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE)); text.setText(Messages.getString("license.LicenseAgreementDialog.agreement")); GridData textData = new GridData(GridData.FILL_BOTH); text.setLayoutData(textData); agreeBtn = new Button(tparent, SWT.CHECK); agreeBtn.setText(Messages.getString("license.LicenseAgreementDialog.agreeBtn")); agreeBtn.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); agreeBtn.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { getButton(IDialogConstants.OK_ID).setEnabled(agreeBtn.getSelection()); } }); return super.createDialogArea(parent); }
Example #30
Source File: CodewindPrefsParentPage.java From codewind-eclipse with Eclipse Public License 2.0 | 5 votes |
private void setStopAppsSelection(String selection) { for (Button button : stopAppsButtons) { if (button.getData().equals(selection)) { button.setSelection(true); break; } } }