/** * Returns the existing dialog settings for the persisted state of the caught and uncaught check * boxes. If no section exists then a new one is created * * @return the dialog settings section for the type dialog extension * @since 3.4 */ private IDialogSettings getDialogSettings() { IDialogSettings allSetttings = DLTKDebugUIPlugin.getDefault().getDialogSettings(); IDialogSettings section = allSetttings.getSection(DIALOG_SETTINGS); if (section == null) { section = allSetttings.addNewSection(DIALOG_SETTINGS); section.put(CAUGHT_CHECKED, true); section.put(UNCAUGHT_CHECKED, true); } return section; }
protected void displayResult(final IScriptEvaluationResult result) { // Errors if (result.hasErrors()) { final Display display = DLTKDebugUIPlugin.getStandardDisplay(); display.asyncExec( new Runnable() { public void run() { if (display.isDisposed()) { return; } reportErrors(result); evaluationCleanup(); } }); return; } final String snippet = result.getSnippet(); IScriptValue resultValue = result.getValue(); final String typeName = resultValue.getType().getName(); IDebugModelPresentation presentation = getDebugModelPresentation(result.getThread().getModelIdentifier()); presentation.computeDetail( resultValue, new IValueDetailListener() { public void detailComputed(IValue value, String result) { displayStringResult( snippet, MessageFormat.format( Messages.ScriptDisplayAction_displayResult, new Object[] {typeName, trimDisplayResult(result)})); } }); presentation.dispose(); // displayStringResult(snippet, getExceptionMessage(x)); }
/* (non-Javadoc) * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) */ public void run(IAction action) { String natureId = ScriptDebugManager.getInstance().getNatureByDebugModel(getDebugModelId()); fToolkit = DLTKUILanguageManager.getLanguageToolkit(natureId); IDialogSettings settings = getDialogSettings(); AddExceptionTypeDialogExtension ext = new AddExceptionTypeDialogExtension( null, settings.getBoolean(CAUGHT_CHECKED), settings.getBoolean(UNCAUGHT_CHECKED)); TypeSelectionDialog2 dialog = new TypeSelectionDialog2( DLTKUIPlugin.getActiveWorkbenchShell(), false, PlatformUI.getWorkbench().getProgressService(), SearchEngine.createWorkspaceScope(fToolkit.getCoreToolkit()), IDLTKSearchConstants.TYPE, ext, fToolkit); dialog.setMessage(Messages.AddExceptionAction_search); dialog.setTitle(Messages.AddExceptionAction_addExceptionBreakpoint); if (dialog.open() == IDialogConstants.OK_ID) { Object[] types = dialog.getResult(); if (types != null && types.length > 0) { boolean caught = ext.shouldHandleCaughtExceptions(); boolean uncaught = ext.shouldHandleUncaughtExceptions(); Object[] results = dialog.getResult(); if (results != null && results.length > 0) { try { createBreakpoint(caught, uncaught, (IType) results[0]); settings.put(CAUGHT_CHECKED, caught); settings.put(UNCAUGHT_CHECKED, uncaught); } catch (CoreException e) { DLTKDebugUIPlugin.errorDialog( Messages.AddExceptionAction_unableToCreateBreakpoint, e.getStatus()); } } } } }