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


Java IResourceStatus.BUILD_FAILED属性代码示例

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


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

示例1: openError

/**
 * Convenience method for showing an error dialog 
 * @param shell a valid shell or null
 * @param exception the exception to be report
 * @param title the title to be displayed
 * @param flags customizing attributes for the error handling
 * @return IStatus the status that was displayed to the user
 */
public static IStatus openError(Shell providedShell, String title, String message, Throwable exception, int flags) {
	// Unwrap InvocationTargetExceptions
	if (exception instanceof InvocationTargetException) {
		Throwable target = ((InvocationTargetException)exception).getTargetException();
		// re-throw any runtime exceptions or errors so they can be handled by the workbench
		if (target instanceof RuntimeException) {
			throw (RuntimeException)target;
		}
		if (target instanceof Error) {
			throw (Error)target;
		} 
		return openError(providedShell, title, message, target, flags);
	}
	
	// Determine the status to be displayed (and possibly logged)
	IStatus status = null;
	boolean log = false;
	if (exception instanceof CoreException) {
		status = ((CoreException)exception).getStatus();
		log = ((flags & LOG_CORE_EXCEPTIONS) > 0);
	} else if (exception instanceof TeamException) {
		status = ((TeamException)exception).getStatus();
		log = ((flags & LOG_TEAM_EXCEPTIONS) > 0);
	} else if (exception instanceof InterruptedException) {
		return new SVNStatus(IStatus.OK, Policy.bind("ok")); //$NON-NLS-1$
	} else if (exception != null) {
		status = new SVNStatus(IStatus.ERROR, Policy.bind("internal"), exception); //$NON-NLS-1$
		log = ((flags & LOG_OTHER_EXCEPTIONS) > 0);
		if (title == null) title = Policy.bind("SimpleInternal"); //$NON-NLS-1$
	}
	
	// Check for a build error and report it differently
	if (status.getCode() == IResourceStatus.BUILD_FAILED) {
		message = Policy.bind("buildError"); //$NON-NLS-1$
		log = true;
	}
	
	// Check for multi-status with only one child
	if (status.isMultiStatus() && status.getChildren().length == 1) {
		status = status.getChildren()[0];
	}
	if (status.isOK()) return status;
	
	// Log if the user requested it
	if (log) SVNUIPlugin.log(status);
	// Create a runnable that will display the error status
	
	String svnInterface = SVNUIPlugin.getPlugin().getPreferenceStore().getString(ISVNUIConstants.PREF_SVNINTERFACE);
	boolean loadError = svnInterface.equals("javahl") && status != null && status.getMessage() != null && status.getMessage().equals(SVNClientManager.UNABLE_TO_LOAD_DEFAULT_CLIENT);
	
	if (!loadError || loadErrorHandled) {
		final String displayTitle = title;
		final String displayMessage = message;
		final IStatus displayStatus = status;
		final IOpenableInShell openable = new IOpenableInShell() {
			public void open(Shell shell) {
				if (displayStatus.getSeverity() == IStatus.INFO && !displayStatus.isMultiStatus()) {
					MessageDialog.openInformation(shell, Policy.bind("information"), displayStatus.getMessage()); //$NON-NLS-1$
				} else {
					ErrorDialog.openError(shell, displayTitle, displayMessage, displayStatus);
				}
			}
		};
		openDialog(providedShell, openable, flags);
	}
	
	if (loadError) loadErrorHandled = true;
	
	// return the status we display
	return status;
}
 
开发者ID:subclipse,项目名称:subclipse,代码行数:79,代码来源:SVNUIPlugin.java


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