当前位置: 首页>>代码示例>>Java>>正文


Java IDialogConstants.CANCEL_LABEL属性代码示例

本文整理汇总了Java中org.eclipse.jface.dialogs.IDialogConstants.CANCEL_LABEL属性的典型用法代码示例。如果您正苦于以下问题:Java IDialogConstants.CANCEL_LABEL属性的具体用法?Java IDialogConstants.CANCEL_LABEL怎么用?Java IDialogConstants.CANCEL_LABEL使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.eclipse.jface.dialogs.IDialogConstants的用法示例。


在下文中一共展示了IDialogConstants.CANCEL_LABEL属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: MultipleDeletionDialog

public MultipleDeletionDialog(Shell shell, String title, boolean hasMultiple) {
	this.title = title;
	this.shell = shell;
	this.hasMultiple = hasMultiple;
	if (hasMultiple) {
		buttons = new String[] {
			IDialogConstants.YES_LABEL, 
			IDialogConstants.YES_TO_ALL_LABEL, 
			IDialogConstants.NO_LABEL, 
			IDialogConstants.CANCEL_LABEL
		};
	} else {
		buttons = new String[] { 
				IDialogConstants.YES_LABEL,
				IDialogConstants.NO_LABEL, 
				IDialogConstants.CANCEL_LABEL 
		};
	}	 
}
 
开发者ID:convertigo,项目名称:convertigo-eclipse,代码行数:19,代码来源:MultipleDeletionDialog.java

示例2: processChanges

/**
 * This method has been copied and adapted from org.eclipse.xtext.ui.preferences.OptionsConfigurationBlock.
 */
@Override
protected boolean processChanges(IWorkbenchPreferenceContainer container) {
	boolean needsBuild = !getPreferenceChanges().isEmpty() | projectSpecificChanged;
	boolean doBuild = false;
	if (needsBuild) {
		int count = getRebuildCount();
		if (count > rebuildCount) {
			needsBuild = false;
			rebuildCount = count;
		}
	}
	if (needsBuild) {
		String[] strings = getFullBuildDialogStrings(project == null);
		if (strings != null) {
			MessageDialog dialog = new MessageDialog(this.getShell(), strings[0], null, strings[1],
					MessageDialog.QUESTION,
					new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL,
							IDialogConstants.CANCEL_LABEL },
					2);
			int res = dialog.open();
			if (res == 0) {
				doBuild = true;
			} else if (res != 1) {
				return false;
			}
		}
	}
	if (container != null) {
		if (doBuild) {
			incrementRebuildCount();
			container.registerUpdateJob(getBuildJob(getProject()));
		}
	} else {
		if (doBuild) {
			getBuildJob(getProject()).schedule();
		}
	}
	return true;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:42,代码来源:N4JSBuilderPreferencePage.java

示例3: showDialog

private Boolean showDialog ( final ConfirmationCallback cb, final Display display, final Shell parentShell, final String dialogTitle )
{
    switch ( cb.getConfirmationType () )
    {
        case CONFIRM:
            return MessageDialog.openConfirm ( parentShell, dialogTitle, cb.getLabel () ) ? true : null;
        case ERROR:
            MessageDialog.openError ( parentShell, dialogTitle, cb.getLabel () );
            return true;
        case WARNING:
            MessageDialog.openWarning ( parentShell, dialogTitle, cb.getLabel () );
            return true;
        case INFORMATION:
            MessageDialog.openInformation ( parentShell, dialogTitle, cb.getLabel () );
            return true;
        case QUESTION:
            return MessageDialog.openQuestion ( parentShell, dialogTitle, cb.getLabel () );
        case QUESTION_WITH_CANCEL:
        {
            final MessageDialog dialog = new MessageDialog ( parentShell, dialogTitle, null, cb.getLabel (), MessageDialog.QUESTION_WITH_CANCEL, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }, 0 );
            final int result = dialog.open ();
            if ( result == 2 /*CANCEL*/)
            {
                return null;
            }
            else
            {
                return result == Window.OK;
            }
        }
        default:
            throw new IllegalArgumentException ( String.format ( "Unable to process type: %s", cb.getConfirmationType () ) );
    }
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:34,代码来源:ConfirmationDialogFuture.java

示例4: queryOverwrite

/**
 * The default implementation of this <code>IOverwriteQuery</code> method asks the user whether the existing
 * resource at the given path should be overwritten.
 *
 * @param pathString
 *            the path of the archive
 * @return the user's reply: one of <code>"YES"</code>, <code>"NO"</code>, <code>"ALL"</code>, or
 *         <code>"CANCEL"</code>
 */
@Override
public String queryOverwrite(String pathString) {

	IPath path = Path.fromOSString(pathString);

	String messageString;
	// Break the message up if there is a file name and a directory
	// and there are at least 2 segments.
	if (path.getFileExtension() == null || path.segmentCount() < 2) {
		messageString = NLS.bind(IDEWorkbenchMessages.WizardDataTransfer_existsQuestion, pathString);
	} else {
		messageString = NLS.bind(IDEWorkbenchMessages.WizardDataTransfer_overwriteNameAndPathQuestion,
				path.lastSegment(),
				path.removeLastSegments(1).toOSString());
	}

	final MessageDialog dialog = new MessageDialog(getContainer()
			.getShell(), IDEWorkbenchMessages.Question,
			null, messageString, MessageDialog.QUESTION, new String[] {
		IDialogConstants.YES_LABEL,
		IDialogConstants.YES_TO_ALL_LABEL,
		IDialogConstants.NO_LABEL,
		IDialogConstants.NO_TO_ALL_LABEL,
		IDialogConstants.CANCEL_LABEL }, 0) {
		@Override
		protected int getShellStyle() {
			return super.getShellStyle() | SWT.SHEET;
		}
	};
	String[] response = new String[] { YES, ALL, NO, NO_ALL, CANCEL };
	// run in syncExec because callback is from an operation,
	// which is probably not running in the UI thread.
	getControl().getDisplay().syncExec(new Runnable() {
		@Override
		public void run() {
			dialog.open();
		}
	});
	return dialog.getReturnCode() < 0 ? CANCEL : response[dialog.getReturnCode()];
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:49,代码来源:AbstractExportToSingleFileWizardPage.java

示例5: checkValidWorkspace

/**
 * Return true if the argument directory is ok to use as a workspace and false otherwise. A version check will be
 * performed, and a confirmation box may be displayed on the argument shell if an older version is detected.
 *
 * @return true if the argument URL is ok to use as a workspace and false otherwise.
 */
private boolean checkValidWorkspace(final Shell shell, final URL url) {
	// a null url is not a valid workspace
	if (url == null) {
		return false;
	}

	if (WORKSPACE_CHECK_REFERENCE_BUNDLE_VERSION == null) {
		// no reference bundle installed, no check possible
		return true;
	}

	final Version version = readWorkspaceVersion(url);
	// if the version could not be read, then there is not any existing
	// workspace data to trample, e.g., perhaps its a new directory that
	// is just starting to be used as a workspace
	if (version == null) {
		return true;
	}

	final Version ide_version = toMajorMinorVersion(WORKSPACE_CHECK_REFERENCE_BUNDLE_VERSION);
	final Version workspace_version = toMajorMinorVersion(version);
	final int versionCompareResult = workspace_version.compareTo(ide_version);

	// equality test is required since any version difference (newer
	// or older) may result in data being trampled
	if (versionCompareResult == 0) {
		return true;
	}

	// At this point workspace has been detected to be from a version
	// other than the current ide version -- find out if the user wants
	// to use it anyhow.
	int severity;
	String title;
	String message;
	if (versionCompareResult < 0) {
		// Workspace < IDE. Update must be possible without issues,
		// so only inform user about it.
		severity = INFORMATION;
		title = IDEApplication_versionTitle_olderWorkspace;
		message = NLS.bind(IDEApplication_versionMessage_olderWorkspace, url.getFile());
	} else {
		// Workspace > IDE. It must have been opened with a newer IDE version.
		// Downgrade might be problematic, so warn user about it.
		severity = WARNING;
		title = IDEApplication_versionTitle_newerWorkspace;
		message = NLS.bind(IDEApplication_versionMessage_newerWorkspace, url.getFile());
	}

	final MessageDialog dialog = new MessageDialog(shell, title, null, message, severity,
			new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }, 0);
	return dialog.open() == Window.OK;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:59,代码来源:N4JSApplication.java


注:本文中的org.eclipse.jface.dialogs.IDialogConstants.CANCEL_LABEL属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。