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

The following examples show how to use org.eclipse.jface.dialogs.IDialogConstants#YES_TO_ALL_ID . 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: ReorgQueries.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private boolean getResult(int[] result) throws OperationCanceledException {
	switch(result[0]){
		case IDialogConstants.YES_TO_ALL_ID:
			fYesToAll= true;
			return true;
		case IDialogConstants.YES_ID:
			return true;
		case IDialogConstants.CANCEL_ID:
			throw new OperationCanceledException();
		case IDialogConstants.NO_ID:
			return false;
		case IDialogConstants.NO_TO_ALL_ID:
			fNoToAll= true;
			return false;
		default:
			Assert.isTrue(false);
			return false;
	}
}
 
Example 2
Source File: MessageDialogWithPrompt.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void buttonPressed(int buttonId) {
    super.buttonPressed(buttonId);

    final boolean toggleState = getToggleState();
    final IPreferenceStore prefStore = getPrefStore();
    final String prefKey = getPrefKey();
    if (buttonId != IDialogConstants.CANCEL_ID
            && prefStore != null && prefKey != null) {
        switch (buttonId) {
            case IDialogConstants.YES_ID:
            case IDialogConstants.YES_TO_ALL_ID:
            case IDialogConstants.PROCEED_ID:
            case IDialogConstants.OK_ID:
                prefStore.setValue(prefKey, toggleState);
                break;
            case IDialogConstants.NO_ID:
            case IDialogConstants.NO_TO_ALL_ID:
                break;
        }
    }
}
 
Example 3
Source File: Question.java    From olca-app with Mozilla Public License 2.0 6 votes vote down vote up
public static int askWithAll(String title, String message) {
	String[] labels = new String[] {
			IDialogConstants.YES_LABEL,
			IDialogConstants.YES_TO_ALL_LABEL,
			IDialogConstants.NO_LABEL,
			IDialogConstants.CANCEL_LABEL };
	MessageDialog dialog = new MessageDialog(
			UI.shell(), title, null, message,
			MessageDialog.QUESTION, labels, 0);
	int result = dialog.open();
	if (result == 0)
		return IDialogConstants.YES_ID;
	if (result == 1)
		return IDialogConstants.YES_TO_ALL_ID;
	if (result == 2)
		return IDialogConstants.NO_ID;
	if (result == 3)
		return IDialogConstants.NO_TO_ALL_ID;
	return IDialogConstants.CANCEL_ID;
}
 
Example 4
Source File: DefaultLabImportUiHandler.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public OverwriteState askOverwrite(IPatient patient, ILabResult oldResult,
	TransientLabResult newResult){
	QueryOverwriteDialogRunnable runnable =
		new QueryOverwriteDialogRunnable(patient, oldResult, newResult);
	Display.getDefault().syncExec(runnable);
	int retVal = runnable.result;
	
	if (retVal == IDialogConstants.YES_TO_ALL_ID) {
		return OverwriteState.OVERWRITEALL;
	} else if (retVal == IDialogConstants.YES_ID) {
		return OverwriteState.OVERWRITE;
	}
	return OverwriteState.IGNORE;
}
 
Example 5
Source File: ReorgQueries.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
private Runnable createQueryRunnable(final String question, final int[] result) {
	return new Runnable() {
		public void run() {
			int[] resultId= getResultIDs();

			MessageDialog dialog= new MessageDialog(
				fShell,
				fDialogTitle,
				null,
				question,
				MessageDialog.QUESTION,
				getButtonLabels(),
				0);
			dialog.open();

			if (dialog.getReturnCode() == -1) { //MessageDialog closed without choice => cancel | no
				//see also https://bugs.eclipse.org/bugs/show_bug.cgi?id=48400
				result[0]= fAllowCancel ? IDialogConstants.CANCEL_ID : IDialogConstants.NO_ID;
			} else {
				result[0]= resultId[dialog.getReturnCode()];
			}
		}

		private String[] getButtonLabels() {
			if (YesYesToAllNoNoToAllQuery.this.fAllowCancel)
				return new String[] {
					IDialogConstants.YES_LABEL,
					IDialogConstants.YES_TO_ALL_LABEL,
					IDialogConstants.NO_LABEL,
					IDialogConstants.NO_TO_ALL_LABEL,
					IDialogConstants.CANCEL_LABEL };
			else
				return new String[] {
					IDialogConstants.YES_LABEL,
					IDialogConstants.YES_TO_ALL_LABEL,
					IDialogConstants.NO_LABEL,
					IDialogConstants.NO_TO_ALL_LABEL};
		}

		private int[] getResultIDs() {
			if (YesYesToAllNoNoToAllQuery.this.fAllowCancel)
				return new int[] {
					IDialogConstants.YES_ID,
					IDialogConstants.YES_TO_ALL_ID,
					IDialogConstants.NO_ID,
					IDialogConstants.NO_TO_ALL_ID,
					IDialogConstants.CANCEL_ID};
			else
				return new int[] {
					IDialogConstants.YES_ID,
					IDialogConstants.YES_TO_ALL_ID,
					IDialogConstants.NO_ID,
					IDialogConstants.NO_TO_ALL_ID};
		}
	};
}