1 11 package org.eclipse.debug.internal.ui.launchConfigurations; 12 13 import org.eclipse.core.runtime.CoreException; 14 import org.eclipse.core.runtime.IStatus; 15 import org.eclipse.debug.core.ILaunchConfiguration; 16 import org.eclipse.debug.core.IStatusHandler; 17 import org.eclipse.debug.internal.ui.DebugUIPlugin; 18 import org.eclipse.debug.internal.ui.IInternalDebugUIConstants; 19 import org.eclipse.debug.ui.DebugUITools; 20 import org.eclipse.jface.dialogs.IDialogConstants; 21 import org.eclipse.jface.dialogs.MessageDialog; 22 import org.eclipse.jface.dialogs.MessageDialogWithToggle; 23 import org.eclipse.jface.preference.IPreferenceStore; 24 import org.eclipse.swt.widgets.Shell; 25 26 27 public class CompileErrorPromptStatusHandler implements IStatusHandler { 28 29 32 public Object handleStatus(IStatus status, Object source) throws CoreException { 33 if (source instanceof ILaunchConfiguration) { 34 ILaunchConfiguration config = (ILaunchConfiguration)source; 35 if (DebugUITools.isPrivate(config)) { 36 return Boolean.TRUE; 37 } 38 } 39 40 Shell shell = DebugUIPlugin.getShell(); 41 String title = LaunchConfigurationsMessages.CompileErrorPromptStatusHandler_0; 42 String message = LaunchConfigurationsMessages.CompileErrorPromptStatusHandler_1; 43 IPreferenceStore store = DebugUIPlugin.getDefault().getPreferenceStore(); 44 45 String pref = store.getString(IInternalDebugUIConstants.PREF_CONTINUE_WITH_COMPILE_ERROR); 46 if (pref != null) { 47 if (pref.equals(MessageDialogWithToggle.ALWAYS)) { 48 return Boolean.TRUE; 49 } 50 } 51 52 MessageDialogWithToggle dialog = new MessageDialogWithToggle(shell, title, null, message, MessageDialog.WARNING, 53 new String [] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL}, 1, null, false); 54 dialog.setPrefKey(IInternalDebugUIConstants.PREF_CONTINUE_WITH_COMPILE_ERROR); 55 dialog.setPrefStore(store); 56 dialog.open(); 57 58 int returnValue = dialog.getReturnCode(); 59 if (returnValue == IDialogConstants.YES_ID) { 60 return Boolean.TRUE; 61 } 62 return Boolean.FALSE; 63 } 64 } 65 | Popular Tags |