⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 loganddisplaysaferunnable.java

📁 eclipseme的最新版本的source,欢迎j2me程序员使用
💻 JAVA
字号:
/**
 * Copyright (c) 2003-2005 Craig Setera
 * All Rights Reserved.
 * Licensed under the Eclipse Public License - v 1.0
 * For more information see http://www.eclipse.org/legal/epl-v10.html
 */
package eclipseme.ui.internal.utils;

import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.swt.widgets.Shell;

import eclipseme.core.internal.EclipseMECorePlugin;
import eclipseme.core.internal.utils.LoggingSafeRunnable;

/**
 * Simple implementation of the ISafeRunnable interface that logs and displays
 * the exception.
 * <p />
 * Copyright (c) 2003-2005 Craig Setera<br>
 * All Rights Reserved.<br>
 * Licensed under the Eclipse Public License - v 1.0<p/>
 * <br>
 * $Revision: 1.3 $
 * <br>
 * $Date: 2005/07/07 02:36:26 $
 * <br>
 * @author Craig Setera
 */
public abstract class LogAndDisplaySafeRunnable extends LoggingSafeRunnable {
	private Shell shell;
	private String action;
	
	public LogAndDisplaySafeRunnable(Shell shell, String action) {
		this.shell = shell;
		this.action = action;
	}
	
	/**
	 * @see org.eclipse.core.runtime.ISafeRunnable#handleException(java.lang.Throwable)
	 */
	public void handleException(Throwable exception) {
		super.handleException(exception);
		
		IStatus status = EclipseMECorePlugin.newStatus(
				IStatus.ERROR, 
				-999, 
				exception.getMessage(),
				exception);
		
		ErrorDialog.openError(
			shell,
			"Error Occurred",
			"An error occurred during " + action,
			status);
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -