List of usage examples for org.eclipse.jface.dialogs IDialogConstants OK_ID
int OK_ID
To view the source code for org.eclipse.jface.dialogs IDialogConstants OK_ID.
Click Source Link
From source file:com.byterefinery.rmbench.dialogs.PrinterSetupDialog.java
License:Open Source License
private void updateOKButton() { getButton(IDialogConstants.OK_ID).setEnabled(selectedPrinter != null); }
From source file:com.byterefinery.rmbench.dialogs.TargetTableChooser.java
License:Open Source License
protected Control createDialogArea(Composite container) { Composite parent = (Composite) super.createDialogArea(container); Label targetLabel = new Label(parent, SWT.NONE); targetLabel.setText(Messages.TargetTableChooser_message); org.eclipse.swt.widgets.Table viewerTable = new org.eclipse.swt.widgets.Table(parent, SWT.FULL_SELECTION | SWT.V_SCROLL | SWT.SINGLE | SWT.BORDER); TableLayout tableLayout = new TableLayout(); TableColumn column;//from ww w .j a v a 2 s. c om column = new TableColumn(viewerTable, SWT.NONE); column.setText(Messages.ForeignKeyConfigurator_Table_Schema); tableLayout.addColumnData(new ColumnWeightData(10)); column = new TableColumn(viewerTable, SWT.NONE); column.setText(Messages.ForeignKeyConfigurator_Table_Name); tableLayout.addColumnData(new ColumnWeightData(20)); viewerTable.setLayout(tableLayout); tableViewer = new TableViewer(viewerTable); tableViewer.getTable().setHeaderVisible(true); tableViewer.setContentProvider(new ArrayContentProvider()); tableViewer.setLabelProvider(new TablesViewerLabelProvider()); tableViewer.setInput(tables); tableViewer.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { Table selectedTable = (Table) ((IStructuredSelection) event.getSelection()).getFirstElement(); boolean needsImport = !diagram.containsTable(selectedTable); if (needsImport) { importCheck.setEnabled(true); importCheck.setSelection(true); doImport = true; } else { importCheck.setEnabled(false); doImport = false; } getButton(IDialogConstants.OK_ID).setEnabled(true); } }); tableViewer.addDoubleClickListener(new IDoubleClickListener() { public void doubleClick(DoubleClickEvent event) { okPressed(); } }); GridData gd = new GridData(GridData.FILL_BOTH); gd.heightHint = convertHeightInCharsToPixels(15); gd.widthHint = convertWidthInCharsToPixels(55); tableViewer.getTable().setLayoutData(gd); tableViewer.getTable().setFont(container.getFont()); importCheck = new Button(parent, SWT.CHECK); importCheck.setText(Messages.TargetTableChooser_importCheck); importCheck.setEnabled(false); importCheck.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { doImport = importCheck.getSelection(); } }); return container; }
From source file:com.centurylink.mdw.plugin.designer.DesignerPerspective.java
License:Apache License
public static void promptForShowPerspective(IWorkbenchWindow activeWindow, WorkflowElement workflowElement) { if (MdwPlugin.isRcp()) return;// ww w . j ava2 s . c o m IPerspectiveDescriptor pd = activeWindow.getActivePage().getPerspective(); if (!"mdw.perspectives.designer".equals(pd.getId())) { boolean switchPerspective = false; String switchPref = MdwPlugin.getStringPref(PreferenceConstants.PREFS_SWITCH_TO_DESIGNER_PERSPECTIVE); if (switchPref == null || switchPref.length() == 0) { String message = "Resources of type '" + workflowElement.getTitle() + "' are associated with MDW Designer Perspective. Switch to this perspective now?"; String toggleMessage = "Remember my answer and don't ask me again"; MessageDialogWithToggle mdwt = MessageDialogWithToggle.openYesNoQuestion(activeWindow.getShell(), "Switch Perspective", message, toggleMessage, false, MdwPlugin.getDefault().getPreferenceStore(), PreferenceConstants.PREFS_SWITCH_TO_DESIGNER_PERSPECTIVE); switchPerspective = mdwt.getReturnCode() == IDialogConstants.YES_ID || mdwt.getReturnCode() == IDialogConstants.OK_ID; } else { switchPerspective = switchPref.equalsIgnoreCase("always"); } if (switchPerspective) { try { showPerspective(activeWindow); } catch (Exception ex) { PluginMessages.uiError(activeWindow.getShell(), ex, "Show Perspective", workflowElement.getProject()); } } } }
From source file:com.centurylink.mdw.plugin.designer.dialogs.ActivityInstanceDialog.java
License:Apache License
protected void createButtonsForButtonBar(Composite parent) { if (mode.equals(Mode.VIEW)) { createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); return;/*from w ww . j av a2 s . c o m*/ } if (mode.equals(Mode.RETRY)) { retryButton = createButton(parent, -1, "Retry", false); retryButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() { public void run() { statusMessage = activity.getProject().getDesignerProxy().retryActivityInstance(activity, activityInstanceVO); } }); if (statusMessage == null || statusMessage.trim().length() == 0) MessageDialog.openInformation(getShell(), "Retry Activity", "Activity instance: " + activityInstanceVO.getId() + " retried"); else MessageDialog.openError(getShell(), "Retry Activity", statusMessage); close(); } }); if (!activity.getProcess().isUserAuthorized(UserRoleVO.PROCESS_EXECUTION)) retryButton.setEnabled(false); } if (mode.equals(Mode.SKIP)) { skipButton = createButton(parent, -1, "Proceed", false); skipButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() { public void run() { statusMessage = activity.getProject().getDesignerProxy().skipActivityInstance(activity, activityInstanceVO, completionCode); } }); if (statusMessage == null || statusMessage.trim().length() == 0) MessageDialog.openInformation(getShell(), "Skip Activity", "Activity instance: " + activityInstanceVO.getId() + " skipped with completion code: " + completionCode + "."); else MessageDialog.openError(getShell(), "Skip Activity", statusMessage); close(); } }); if (!activity.getProcess().isUserAuthorized(UserRoleVO.PROCESS_EXECUTION)) skipButton.setEnabled(false); } createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, true); }
From source file:com.centurylink.mdw.plugin.designer.dialogs.ArchivedProcessSaveDialog.java
License:Apache License
protected void createButtonsForButtonBar(Composite parent) { createButton(parent, IDialogConstants.OK_ID, respondingToClose ? "Save" : "OK", false); if (respondingToClose) { Button dontSaveButton = createButton(parent, IDialogConstants.CLOSE_ID, "Don't Save", true); dontSaveButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { dontSavePressed();/*w w w . ja v a 2 s. co m*/ } }); dontSaveButton.forceFocus(); } Button cancelButton = createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, !respondingToClose); if (!respondingToClose) cancelButton.forceFocus(); }
From source file:com.centurylink.mdw.plugin.designer.dialogs.AttributeDialog.java
License:Apache License
@Override protected void createButtonsForButtonBar(Composite parent) { Button okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); okButton.forceFocus();/* w w w . j a v a 2 s . c o m*/ }
From source file:com.centurylink.mdw.plugin.designer.dialogs.CopyDialog.java
License:Apache License
@Override protected Control createDialogArea(Composite parent) { String message = ""; Composite composite = (Composite) super.createDialogArea(parent); composite.getShell()//from w w w . j av a2s. c om .setText("Copy " + originalName + (originalVersion == null ? "" : " v" + originalVersion)); new Label(composite, SWT.NONE).setText("New Name:"); newNameTextField = new Text(composite, SWT.BORDER | SWT.SINGLE); GridData gd = new GridData(SWT.LEFT); gd.widthHint = 200; newNameTextField.setLayoutData(gd); newName = getUniqueName(originalName); newNameTextField.setText(newName); newNameTextField.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { String name = newNameTextField.getText().trim(); if (nameAlreadyExists(name)) { getButton(IDialogConstants.OK_ID).setEnabled(false); WarningTray tray = getWarningTray(); tray.setMessage(workflowElement.getTitle() + " name already exists:\n'" + name + "'"); tray.open(); } else { newName = name; getWarningTray().close(); getButton(IDialogConstants.OK_ID).setEnabled(true); } } }); new Label(composite, SWT.NONE).setText(message); return composite; }
From source file:com.centurylink.mdw.plugin.designer.dialogs.ExportAsDialog.java
License:Apache License
@Override protected Control createDialogArea(Composite parent) { Composite composite = (Composite) super.createDialogArea(parent); composite.getShell().setText("Export Process"); GridLayout gl = new GridLayout(); gl.numColumns = 2;/*from w w w . ja va 2 s .c o m*/ composite.setLayout(gl); Label msgLabel = new Label(composite, SWT.NONE); msgLabel.setText("Save process '" + processVersion.getName() + "' as image."); GridData gd = new GridData(GridData.BEGINNING); gd.horizontalSpan = 2; msgLabel.setLayoutData(gd); Group exportFormatGroup = new Group(composite, SWT.NONE); exportFormatGroup.setText("Format to Export"); gl = new GridLayout(); exportFormatGroup.setLayout(gl); gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.HORIZONTAL_ALIGN_FILL); exportFormatGroup.setLayoutData(gd); bpmnButton = new Button(exportFormatGroup, SWT.RADIO | SWT.LEFT); bpmnButton.setText(BPMN2); htmlButton = new Button(exportFormatGroup, SWT.RADIO | SWT.LEFT); htmlButton.setText(HTML); docxButton = new Button(exportFormatGroup, SWT.RADIO | SWT.LEFT); docxButton.setText(MS_WORD); jpegButton = new Button(exportFormatGroup, SWT.RADIO | SWT.LEFT); jpegButton.setText("JPEG"); jpegButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { boolean sel = jpegButton.getSelection(); if (sel) { docButton.setSelection(false); attrsButton.setSelection(false); varsButton.setSelection(false); } docButton.setEnabled(!sel); attrsButton.setEnabled(!sel); varsButton.setEnabled(!sel); } }); pngButton = new Button(exportFormatGroup, SWT.RADIO | SWT.LEFT); pngButton.setText(PNG); pngButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { boolean sel = pngButton.getSelection(); if (sel) { docButton.setSelection(false); attrsButton.setSelection(false); varsButton.setSelection(false); } docButton.setEnabled(!sel); attrsButton.setEnabled(!sel); varsButton.setEnabled(!sel); } }); rtfButton = new Button(exportFormatGroup, SWT.RADIO | SWT.LEFT); rtfButton.setText(RTF); pdfButton = new Button(exportFormatGroup, SWT.RADIO | SWT.LEFT); pdfButton.setText(PDF); IPreferenceStore prefsStore = MdwPlugin.getDefault().getPreferenceStore(); String format = prefsStore.getString(PreferenceConstants.PREFS_PROCESS_EXPORT_FORMAT); if (FORMATS.get(HTML).equals(format) || format == null) htmlButton.setSelection(true); else if (FORMATS.get(MS_WORD).equals(format)) docxButton.setSelection(true); else if (FORMATS.get(JPG).equals(format)) jpegButton.setSelection(true); else if (FORMATS.get(PNG).equals(format)) pngButton.setSelection(true); else if (FORMATS.get(BPMN2).equals(format)) bpmnButton.setSelection(true); else if (FORMATS.get(RTF).equals(format)) rtfButton.setSelection(true); else if (FORMATS.get(PDF).equals(format)) pdfButton.setSelection(true); Composite comp2 = new Composite(composite, SWT.NONE); gl = new GridLayout(); gl.marginTop = -5; comp2.setLayout(gl); // inclusion options Group optionsGroup = new Group(comp2, SWT.NONE); optionsGroup.setText("Include"); gl = new GridLayout(); optionsGroup.setLayout(gl); gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.HORIZONTAL_ALIGN_FILL); optionsGroup.setLayoutData(gd); docButton = new Button(optionsGroup, SWT.CHECK | SWT.LEFT); docButton.setText("Documentation"); attrsButton = new Button(optionsGroup, SWT.CHECK | SWT.LEFT); attrsButton.setText("Attributes"); varsButton = new Button(optionsGroup, SWT.CHECK | SWT.LEFT); varsButton.setText("Variables"); docButton.setSelection(prefsStore.getBoolean(PreferenceConstants.PREFS_PROCESS_EXPORT_DOCUMENTATION)); attrsButton.setSelection(prefsStore.getBoolean(PreferenceConstants.PREFS_PROCESS_EXPORT_ATTRIBUTES)); varsButton.setSelection(prefsStore.getBoolean(PreferenceConstants.PREFS_PROCESS_EXPORT_VARIABLES)); // activity order Group activityOrderGroup = new Group(comp2, SWT.NONE); activityOrderGroup.setText("Element Order"); activityOrderGroup.setLayout(new GridLayout()); activityOrderGroup .setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.HORIZONTAL_ALIGN_FILL)); sequenceIdButton = new Button(activityOrderGroup, SWT.RADIO | SWT.LEFT); sequenceIdButton.setText("Sequence Number"); referenceIdButton = new Button(activityOrderGroup, SWT.RADIO | SWT.LEFT); referenceIdButton.setText("Reference ID"); logicalIdButton = new Button(activityOrderGroup, SWT.RADIO | SWT.LEFT); logicalIdButton.setText("Logical ID"); String sort = prefsStore.getString(PreferenceConstants.PREFS_PROCESS_EXPORT_ELEMENT_ORDER); if (Node.ID_REFERENCE.equals(sort)) referenceIdButton.setSelection(true); else if (Node.ID_LOGICAL.equals(sort)) logicalIdButton.setSelection(true); else sequenceIdButton.setSelection(true); filepathText = new Text(composite, SWT.SINGLE | SWT.BORDER); gd = new GridData(GridData.BEGINNING | GridData.HORIZONTAL_ALIGN_FILL); gd.widthHint = 250; filepathText.setLayoutData(gd); filepathText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { filepath = filepathText.getText().trim(); getButton(IDialogConstants.OK_ID).setEnabled(filepath.length() > 0); } }); browseButton = new Button(composite, SWT.PUSH); browseButton.setText("Browse..."); browseButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { FileSaveDialog dlg = new FileSaveDialog(getShell()); dlg.setFilterExtensions(new String[] { "*." + getFileExtension() }); dlg.setFileName(getFileName()); String filepath = dlg.open(); if (filepath != null) filepathText.setText(filepath); } }); return composite; }
From source file:com.centurylink.mdw.plugin.designer.dialogs.ExportAsDialog.java
License:Apache License
protected void createButtonsForButtonBar(Composite parent) { Button saveBtn = createButton(parent, IDialogConstants.OK_ID, "Save", false); saveBtn.setEnabled(false);/* w w w. j a v a2s. c om*/ createButton(parent, IDialogConstants.CANCEL_ID, "Cancel", true); }
From source file:com.centurylink.mdw.plugin.designer.dialogs.ProcessInstanceFilterDialog.java
License:Apache License
@Override protected void createButtonsForButtonBar(Composite parent) { createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); Button resetButton = createButton(parent, RESET_ID, "Reset", false); resetButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { resetFields();// www . jav a2 s. c om } }); createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); }