Java Code Examples for org.eclipse.jface.dialogs.IDialogConstants#OK_LABEL

The following examples show how to use org.eclipse.jface.dialogs.IDialogConstants#OK_LABEL . 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: ValidationDialog.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected Control createButtonBar(Composite parent) {
	Composite blank = new Composite(parent, SWT.NONE);
	blank.setLayoutData(new GridData(1,1));
	Composite buttonbar = new Composite(parent, SWT.None);
	buttonbar.setLayout(new GridLayout(3,false));
	buttonbar.setLayoutData(new GridData(SWT.RIGHT, SWT.FILL, false, false));
	if(messageType == YES_NO_SEEDETAILS || messageType == YES_NO){
		super.createButton(buttonbar, YES, IDialogConstants.YES_LABEL, false);	
		super.createButton(buttonbar, NO, IDialogConstants.NO_LABEL, true);
	}
	if(messageType == OK_SEEDETAILS || messageType == OK_ONLY){
		super.createButton(buttonbar, OK, IDialogConstants.OK_LABEL, true);
	}
	if(messageType == YES_NO_SEEDETAILS || messageType == OK_SEEDETAILS ){
		super.createButton(buttonbar, SEE_DETAILS, seeDetails, false);
	}
	return buttonBar;
}
 
Example 2
Source File: HyperlinkMessageDialog.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
public static String[] getButtonLabels(int kind)
{
	switch (kind)
	{
		case ERROR:
		case INFORMATION:
		case WARNING:
			return new String[] { IDialogConstants.OK_LABEL };
		case CONFIRM:
			return new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL };
		case QUESTION:
			return new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL };
		case QUESTION_WITH_CANCEL:
			return new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL,
					IDialogConstants.CANCEL_LABEL };
		default:
			throw new IllegalArgumentException("Illegal value for kind in HyperlinkMessageDialog.open()"); //$NON-NLS-1$
	}
}
 
Example 3
Source File: PromptingDialog.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Prompt for the given resources using the specific condition. The prompt dialog will
 * have the title specified.
 */
public PromptingDialog(Shell shell, IResource[] resources, IPromptCondition condition, String title) {
	this.condition = condition;
	this.resources = resources;
	this.title = title;
	this.shell = shell;
	this.hasMultipleResources = resources.length > 1;
	if (hasMultipleResources) {
		buttons = new String[] {
			IDialogConstants.YES_LABEL, 
			IDialogConstants.YES_TO_ALL_LABEL, 
			IDialogConstants.NO_LABEL, 
			IDialogConstants.CANCEL_LABEL};
	} else {
		buttons = new String[] {IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL};
	}			 
}
 
Example 4
Source File: MessageDialogScrollable.java    From MergeProcessor with Apache License 2.0 5 votes vote down vote up
/**
 * @param kind
 * @return
 */
private static String[] getButtonLabels(int kind) {
	String[] dialogButtonLabels;
	switch (kind) {
	case ERROR: // fall through to WARNING
	case INFORMATION: // fall through to WARNING
	case WARNING: {
		dialogButtonLabels = new String[] { IDialogConstants.OK_LABEL };
		break;
	}
	case CONFIRM: {
		dialogButtonLabels = new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL };
		break;
	}
	case QUESTION: {
		dialogButtonLabels = new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL };
		break;
	}
	case QUESTION_WITH_CANCEL: {
		dialogButtonLabels = new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL,
				IDialogConstants.CANCEL_LABEL };
		break;
	}
	default: {
		throw new IllegalArgumentException("Illegal value for kind in MessageDialog.open()"); //$NON-NLS-1$
	}
	}
	return dialogButtonLabels;
}
 
Example 5
Source File: DocumentPropertySection.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
private void editDocumentAction(final ISelection selection) {
    if (!selection.isEmpty()) {
        final Document selectedDocument = (Document) ((IStructuredSelection) selection).getFirstElement();
        final DocumentWizard documentWizard = new DocumentWizard(getEObject(), selectedDocument, true);
        final Dialog dialog = new CustomWizardDialog(Display.getDefault().getActiveShell(), documentWizard,
                IDialogConstants.OK_LABEL);
        dialog.open();
        documentListViewer.refresh();
        documentListViewer.setSelection(new StructuredSelection(documentWizard.getDocumentWorkingCopy()));
    }
}
 
Example 6
Source File: TSWizardDialog.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates and return a new wizard closing dialog without opening it.
 * 
 * @return MessageDalog
 */
private MessageDialog createWizardClosingDialog() {
	MessageDialog result = new MessageDialog(getShell(),
			JFaceResources.getString("WizardClosingDialog.title"), //$NON-NLS-1$
			null,
			JFaceResources.getString("WizardClosingDialog.message"), //$NON-NLS-1$
			MessageDialog.QUESTION,
			new String[] { IDialogConstants.OK_LABEL }, 0) {
		protected int getShellStyle() {
			return super.getShellStyle() | SWT.SHEET;
		}
	};
	return result;
}
 
Example 7
Source File: DialogUtils.java    From saros with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Opens a MessageDialog of the type {@link MessageDialog#INFORMATION} and dispatches a call to
 * forceActive (which gives a visual hint on the taskbar that the application wants focus).
 *
 * @param shell the parent shell
 * @param dialogTitle the dialog title, or <code>null</code> if none
 * @param dialogMessage the dialog message
 * @return
 */
public static int openInformationMessageDialog(
    Shell shell, String dialogTitle, String dialogMessage) {
  MessageDialog md =
      new MessageDialog(
          shell,
          dialogTitle,
          null,
          dialogMessage,
          MessageDialog.INFORMATION,
          new String[] {IDialogConstants.OK_LABEL},
          0);
  return openWindow(md);
}
 
Example 8
Source File: HsAbstractProgressDialog.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 创建关闭对话框
 * @return MessageDalog
 */
private MessageDialog createWizardClosingDialog() {
	MessageDialog result = new MessageDialog(getShell(),
			Messages.getString("dialog.HsabstractProgressDialog.closeTtile"), //$NON-NLS-1$
			null, Messages.getString("dialog.HsabstractProgressDialog.closeMsg"), //$NON-NLS-1$
			MessageDialog.QUESTION, new String[] { IDialogConstants.OK_LABEL }, 0) {
		protected int getShellStyle() {
			return super.getShellStyle() | SWT.SHEET;
		}
	};
	return result;
}
 
Example 9
Source File: DialogWithUrls.java    From WebpifyYourAndroidApp with Apache License 2.0 5 votes vote down vote up
static String[] getButtonLabels(int kind) {
	String[] dialogButtonLabels;
	switch (kind) {
	case ERROR:
	case INFORMATION:
	case WARNING: {
		dialogButtonLabels = new String[] { IDialogConstants.OK_LABEL };
		break;
	}
	case CONFIRM: {
		dialogButtonLabels = new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL };
		break;
	}
	case QUESTION: {
		dialogButtonLabels = new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL };
		break;
	}
	case QUESTION_WITH_CANCEL: {
		dialogButtonLabels = new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL,
				IDialogConstants.CANCEL_LABEL };
		break;
	}
	default: {
		throw new IllegalArgumentException("Illegal value for kind in MessageDialog.open()"); //$NON-NLS-1$
	}
	}
	return dialogButtonLabels;
}
 
Example 10
Source File: TSWizardDialog.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates and return a new wizard closing dialog without opening it.
 * 
 * @return MessageDalog
 */
private MessageDialog createWizardClosingDialog() {
	MessageDialog result = new MessageDialog(getShell(),
			JFaceResources.getString("WizardClosingDialog.title"), //$NON-NLS-1$
			null,
			JFaceResources.getString("WizardClosingDialog.message"), //$NON-NLS-1$
			MessageDialog.QUESTION,
			new String[] { IDialogConstants.OK_LABEL }, 0) {
		protected int getShellStyle() {
			return super.getShellStyle() | SWT.SHEET;
		}
	};
	return result;
}
 
Example 11
Source File: DialogUtils.java    From saros with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Opens a MessageDialog of the type {@link MessageDialog#ERROR} and dispatches a call to
 * forceActive (which gives a visual hint on the taskbar that the application wants focus).
 *
 * @param shell the parent shell
 * @param dialogTitle the dialog title, or <code>null</code> if none
 * @param dialogMessage the dialog message
 * @return
 */
public static int openErrorMessageDialog(Shell shell, String dialogTitle, String dialogMessage) {
  MessageDialog md =
      new MessageDialog(
          shell,
          dialogTitle,
          null,
          dialogMessage,
          MessageDialog.ERROR,
          new String[] {IDialogConstants.OK_LABEL},
          0);
  return openWindow(md);
}
 
Example 12
Source File: CompletionProposalComputerRegistry.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Log the status and inform the user about a misbehaving extension.
 *
 * @param descriptor the descriptor of the misbehaving extension
 * @param status a status object that will be logged
 */
void informUser(CompletionProposalComputerDescriptor descriptor, IStatus status) {
	JavaPlugin.log(status);
       String title= JavaTextMessages.CompletionProposalComputerRegistry_error_dialog_title;
       CompletionProposalCategory category= descriptor.getCategory();
       IContributor culprit= descriptor.getContributor();
       Set<String> affectedPlugins= getAffectedContributors(category, culprit);

	final String avoidHint;
	final String culpritName= culprit == null ? null : culprit.getName();
	if (affectedPlugins.isEmpty())
		avoidHint= Messages.format(JavaTextMessages.CompletionProposalComputerRegistry_messageAvoidanceHint, new Object[] {culpritName, category.getDisplayName()});
	else
		avoidHint= Messages.format(JavaTextMessages.CompletionProposalComputerRegistry_messageAvoidanceHintWithWarning, new Object[] {culpritName, category.getDisplayName(), toString(affectedPlugins)});

	String message= status.getMessage();
       // inlined from MessageDialog.openError
       MessageDialog dialog = new MessageDialog(JavaPlugin.getActiveWorkbenchShell(), title, null /* default image */, message, MessageDialog.ERROR, new String[] { IDialogConstants.OK_LABEL }, 0) {
       	@Override
		protected Control createCustomArea(Composite parent) {
       		Link link= new Link(parent, SWT.NONE);
       		link.setText(avoidHint);
       		link.addSelectionListener(new SelectionAdapter() {
       			@Override
				public void widgetSelected(SelectionEvent e) {
       				PreferencesUtil.createPreferenceDialogOn(getShell(), "org.eclipse.jdt.ui.preferences.CodeAssistPreferenceAdvanced", null, null).open(); //$NON-NLS-1$
       			}
       		});
       		GridData gridData= new GridData(SWT.FILL, SWT.BEGINNING, true, false);
       		gridData.widthHint= this.getMinimumMessageWidth();
			link.setLayoutData(gridData);
       		return link;
       	}
       };
       dialog.open();
}
 
Example 13
Source File: UnbindProjectAction.java    From codewind-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public RemoveDialog(Shell parentShell, String msg, List<CodewindEclipseApplication> apps) {
	super(parentShell, Messages.UnbindActionTitle, null, msg, MessageDialog.QUESTION,
			0, IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL);
	this.apps = apps;
}
 
Example 14
Source File: RenameTypeWizardSimilarElementsOptionsDialog.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
public RenameTypeWizardSimilarElementsOptionsDialog(Shell parentShell, int defaultStrategy) {
	super(parentShell, RefactoringMessages.RenameTypeWizardSimilarElementsOptionsDialog_title, null, new String(), INFORMATION, new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }, 0);
	fSelectedStrategy= defaultStrategy;
}
 
Example 15
Source File: InputDialogWithLongMessage.java    From Pydev with Eclipse Public License 1.0 4 votes vote down vote up
protected String getOkButtonLabel() {
    return IDialogConstants.OK_LABEL;
}
 
Example 16
Source File: CheckstylePropertyPage.java    From eclipse-cs with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public void widgetSelected(SelectionEvent e) {

  Object source = e.getSource();
  // edit filter
  if (source == mBtnEditFilter) {

    ISelection selection = mFilterList.getSelection();
    openFilterEditor(selection);
    getContainer().updateButtons();
  }
  if (source == mMainTab) {
    mFileSetsEditor.refresh();
    getContainer().updateButtons();

  } else if (source == mChkSyncFormatter) {
    mProjectConfig.setSyncFormatter(mChkSyncFormatter.getSelection());
  } else if (source == mChkSimpleConfig) {
    try {

      mProjectConfig.setUseSimpleConfig(mChkSimpleConfig.getSelection());

      boolean showWarning = CheckstyleUIPluginPrefs
              .getBoolean(CheckstyleUIPluginPrefs.PREF_FILESET_WARNING);
      if (mProjectConfig.isUseSimpleConfig() && showWarning) {
        MessageDialogWithToggle dialog = new MessageDialogWithToggle(getShell(),
                Messages.CheckstylePropertyPage_titleWarnFilesets, null,
                Messages.CheckstylePropertyPage_msgWarnFilesets, MessageDialog.WARNING,
                new String[] { IDialogConstants.OK_LABEL }, 0,
                Messages.CheckstylePropertyPage_mgsWarnFileSetNagOption, showWarning) {
          /**
           * Overwritten because we don't want to store which button the user pressed but the
           * state of the toggle.
           *
           * @see MessageDialogWithToggle#buttonPressed(int)
           */
          @Override
          protected void buttonPressed(int buttonId) {
            getPrefStore().setValue(getPrefKey(), getToggleState());
            setReturnCode(buttonId);
            close();
          }

        };
        dialog.setPrefStore(CheckstyleUIPlugin.getDefault().getPreferenceStore());
        dialog.setPrefKey(CheckstyleUIPluginPrefs.PREF_FILESET_WARNING);
        dialog.open();

      }

      createFileSetsArea(mFileSetsContainer);
      mFileSetsContainer.redraw();
      mFileSetsContainer.update();
      mFileSetsContainer.layout();
    } catch (CheckstylePluginException ex) {
      CheckstyleUIPlugin.errorDialog(getShell(), Messages.errorChangingFilesetEditor, ex, true);
    }
  }

}
 
Example 17
Source File: InputQueryDialog.java    From texlipse with Eclipse Public License 1.0 3 votes vote down vote up
/**
 * Same kind of constructor as in InputDialog.
 * This class just doesn't create extra components.
 * 
 * @param title dialog title
 * @param message dialog message
 * @param def default text for the textfield
 * @param vali validator for the text
 */
public InputQueryDialog(Shell shell, String title, String message, String def, IInputValidator vali) {
    super(shell, title, null, message, QUESTION, new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }, 0);
    initialText = def;
    input = def;
    validator = vali;
}
 
Example 18
Source File: M2DocTypeSelectionDialog.java    From M2Doc with Eclipse Public License 1.0 3 votes vote down vote up
/**
 * Constructor.
 * 
 * @param parentShell
 *            the parent {@link Shell}
 * @param variableName
 *            the variable name
 * @param defaultType
 *            the default type of the variable
 * @param nsURIs
 *            the {@link List} of regitered {@link EPackage#getNsURI() nsURI}
 */
public M2DocTypeSelectionDialog(Shell parentShell, String variableName, String defaultType, List<String> nsURIs) {
    super(parentShell, "Select a variable type for " + variableName, null, "Select a type.", MessageDialog.QUESTION,
            new String[] {IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }, 0);
    this.nsURIs = nsURIs;
    this.defaultType = defaultType;
}
 
Example 19
Source File: StyleListFieldEditor.java    From texlipse with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Constructor with default values for many fields.
 * This is the preferred constructor.
 * 
 * @param shell parent shell
 * @param title dialog title
 * @param message dialog message
 * @param vali validator for the text
 */
public KeyValueInputDialog(Shell shell, String title, String message, IInputValidator vali) {
    this(shell, title, null, message, QUESTION, new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }, 0);
    validator = vali;
    
}
 
Example 20
Source File: KeyValueListFieldEditor.java    From texlipse with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Constructor with default values for many fields.
 * This is the preferred way to construct this class.
 * 
 * @param shell parent shell
 * @param title dialog title
 * @param message dialog message
 * @param items items for the list
 */
public EnvVarInputDialog(Shell shell, String title, String message, String[] items) {
    this(shell, title, null, message, QUESTION, new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }, 0);
    this.items = items;
}