/** * Handles the given exception, which occurred during edit/save. */ protected void handleException(DebugException e) { Throwable cause = e.getStatus().getException(); if (cause instanceof InvalidTypeException) { IStatus status = new Status(IStatus.ERROR, JDIDebugUIPlugin.getUniqueIdentifier(), IDebugUIConstants.INTERNAL_ERROR, cause.getMessage(), null); JDIDebugUIPlugin.statusDialog(ActionMessages.JavaObjectValueEditor_3, status); } else { JDIDebugUIPlugin.statusDialog(e.getStatus()); } }
@Override public IStatus runInUIThread(IProgressMonitor monitor) { try { rendering.goToAddress(address); } catch (DebugException e) { if (getTableViewer() != null) getTableViewer().handlePresentationFailure(null, e.getStatus()); } return Status.OK_STATUS; }}; job.setSystem(true);
public void breakpointHasRuntimeException(final IJavaLineBreakpoint breakpoint, final DebugException exception) { IStatus status; Throwable wrappedException= exception.getStatus().getException(); if (wrappedException instanceof InvocationException) { InvocationException ie= (InvocationException) wrappedException; ObjectReference ref= ie.exception(); status= new Status(IStatus.ERROR,JDIDebugUIPlugin.getUniqueIdentifier(), IStatus.ERROR, ref.referenceType().name(), null); } else { status= exception.getStatus(); } openConditionErrorDialog(breakpoint, DebugUIMessages.JavaDebugOptionsManager_Conditional_breakpoint_encountered_runtime_exception__1, status); }
@Override protected IStatus run(IProgressMonitor jobMonitor) { if (!jobMonitor.isCanceled()) { fTarget.breakpointAdded(fBreakpoint); try { fResumee.resume(); } catch (DebugException e) { cancel(); return e.getStatus(); } } return Status.OK_STATUS; } };
protected void showException(Throwable exception) { if (exception instanceof DebugException) { DebugException de = (DebugException)exception; Throwable t= de.getStatus().getException(); if (t != null) { // show underlying exception showUnderlyingException(t); return; } } ByteArrayOutputStream bos= new ByteArrayOutputStream(); PrintStream ps= new PrintStream(bos, true); exception.printStackTrace(ps); final String message = bos.toString(); Runnable r = new Runnable() { public void run() { try { getSourceViewer().getDocument().replace(fSnippetEnd, 0, message); selectAndReveal(fSnippetEnd, message.length()); } catch (BadLocationException e) { } } }; async(r); }
public static void log(Throwable t) { Throwable top = t; if (t instanceof DebugException) { DebugException de = (DebugException) t; IStatus status = de.getStatus(); if (status.getException() != null) { top = status.getException(); } } log(new Status(IStatus.ERROR, getUniqueIdentifier(), 1033, "Internal error in jBPM Plugin: ", top ) ); }
public void evaluationComplete(IEvaluationResult result) { if (result.hasErrors()) { StringBuffer error= new StringBuffer(DebugUIMessages.JavaDetailFormattersManager_Detail_formatter_error___1); DebugException exception= result.getException(); if (exception != null) { Throwable throwable= exception.getStatus().getException(); error.append("\n\t\t"); //$NON-NLS-1$ if (throwable instanceof InvocationException) { error.append(MessageFormat.format(DebugUIMessages.JavaDetailFormattersManager_An_exception_occurred___0__3, new String[] {((InvocationException) throwable).exception().referenceType().name()})); } else { error.append(exception.getStatus().getMessage()); } } else { String[] errors= result.getErrorMessages(); for (int i= 0, length= errors.length; i < length; i++) { error.append("\n\t\t").append(errors[i]); //$NON-NLS-1$ } } fListener.detailComputed(fValue, error.toString()); } else { try { valueToString(result.getValue()); } catch (DebugException e) { fListener.detailComputed(fValue, e.getStatus().getMessage()); } } }
private String generateHoverForLocal(IJavaStackFrame frame, String varName) { String variableText= null; try { IVariable variable= frame.findVariable(varName); if (variable != null) { variableText= getVariableText(variable); } } catch (DebugException x) { if (x.getStatus().getCode() != IJavaThread.ERR_THREAD_NOT_SUSPENDED) { JDIDebugUIPlugin.log(x); } } return variableText; }
getMemoryFromMemoryBlock(); } catch (DebugException e) { DebugUIPlugin.log(e.getStatus()); getTableRendering(fInput).displayError(e); return lineCache.toArray(); reorganizeLines(lineCache, renderingRowSize); } catch (DebugException e) { DebugUIPlugin.log(e.getStatus()); getTableRendering(fInput).displayError(e); return lineCache.toArray();
/** * Determines if the passed object is a primitive type or not * @param obj the obj to test * @return true if the object is primitive, false otherwise */ protected boolean isPrimitiveType(Object obj) { if(obj instanceof IJavaVariable) { try { return !fgPrimitiveTypes.contains(removeArray(((IJavaVariable) obj).getReferenceTypeName())); } catch (DebugException e) { if(!(e.getStatus().getException() instanceof ClassNotLoadedException)) { JDIDebugUIPlugin.log(e); } return false; } } else if(obj instanceof JavaInspectExpression) { try { JavaInspectExpression exp = (JavaInspectExpression)obj; IValue value = exp.getValue(); if (value != null) { return fgPrimitiveTypes.contains(removeArray(value.getReferenceTypeName())); } } catch (DebugException e) {JDIDebugUIPlugin.log(e);} } return false; }
private void init(ISelection selection) { fStructure= null; Object element = ((IStructuredSelection) selection).getFirstElement(); if (element instanceof IVariable) { try { IValue value= ((IVariable) element).getValue(); ILogicalStructureType type= getLogicalStructure(value); fStructure = type; } catch (DebugException e) { DebugUIPlugin.log(e.getStatus()); } } setEnabled(fView.isShowLogicalStructure()); }
protected void run() { IJavaStackFrame stackFrame= getStackFrameContext(); if (stackFrame != null) { try { String returnType = Signature.getReturnType(stackFrame.getSignature()); if (Signature.SIG_VOID.equals(returnType)) { // no evaluation required for void methods stackFrame.forceReturn(((IJavaDebugTarget)stackFrame.getDebugTarget()).voidValue()); return; } } catch (DebugException e) { JDIDebugUIPlugin.statusDialog(e.getStatus()); return; } } fTargetFrame = stackFrame; // perform evaluation otherwise super.run(); }
/** * Runs this action in the UI thread. * @param selection the current selection */ private void runInForeground(final IStructuredSelection selection, boolean isShift) { fIsShift = isShift; final MultiStatus status= new MultiStatus(DebugUIPlugin.getUniqueIdentifier(), DebugException.REQUEST_FAILED, getStatusMessage(), null); BusyIndicator.showWhile(Display.getCurrent(), () -> { Iterator<?> selectionIter = selection.iterator(); while (selectionIter.hasNext()) { Object element = selectionIter.next(); try { // Action's enablement could have been changed since // it was last enabled. Check that the action is still // enabled before running the action. if (isEnabledFor(element)) { doAction(element); } } catch (DebugException e) { status.merge(e.getStatus()); } } }); reportErrors(status); }
protected void run() { IWorkbenchPart part= getTargetPart(); if (part instanceof JavaSnippetEditor) { ((JavaSnippetEditor)part).evalSelection(JavaSnippetEditor.RESULT_INSPECT); return; } Object selection= getSelectedObject(); if (!(selection instanceof IStructuredSelection)) { super.run(); return; } //inspecting from the context of the variables view Iterator variables = ((IStructuredSelection)selection).iterator(); while (variables.hasNext()) { IJavaVariable var = (IJavaVariable)variables.next(); try { JavaInspectExpression expr = new JavaInspectExpression(var.getName(), (IJavaValue)var.getValue()); DebugPlugin.getDefault().getExpressionManager().addExpression(expr); } catch (DebugException e) { JDIDebugUIPlugin.statusDialog(e.getStatus()); } } showExpressionView(); }
/** * @see ActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection) */ public void selectionChanged(IAction action, ISelection selection) { fStructure= null; Object element = ((IStructuredSelection) selection).getFirstElement(); if (element instanceof IJavaVariable) { try { IValue value= ((IJavaVariable) element).getValue(); if (value instanceof JavaStructureErrorValue) { value= ((JavaStructureErrorValue) value).getParentValue(); } ILogicalStructureType type= getLogicalStructure(value); if (type instanceof JavaLogicalStructure) { JavaLogicalStructure javaStructure= (JavaLogicalStructure) type; if (!javaStructure.isContributed()) { fStructure= javaStructure; } } } catch (DebugException e) { JDIDebugUIPlugin.log(e.getStatus()); } } action.setEnabled(fStructure != null); }
public static String[] getErrorMessages(IEvaluationResult result) { if (result == null) { return new String[0]; } String messages[]= result.getErrorMessages(); if (messages.length > 0) { return messages; } DebugException exception= result.getException(); if (exception != null ) { Throwable cause= exception.getStatus().getException(); if (cause instanceof InvocationException) { String nestedMessage= ((InvocationException) cause).exception().referenceType().name(); return new String[] { MessageFormat.format(DisplayMessages.JavaInspectExpression_0, new String[] {nestedMessage}) }; } return new String[] { exception.getMessage() }; } return new String[0]; } }
public void run(IAction action) { IStructuredSelection currentSelection = getCurrentSelection(); if (currentSelection != null && (currentSelection.getFirstElement() instanceof IJavaVariable)){ IJavaVariable var = (IJavaVariable) currentSelection.getFirstElement(); try { JDIReferenceListValue referenceList = new JDIReferenceListValue((IJavaObject) var.getValue()); InspectPopupDialog ipd = new InspectPopupDialog(getShell(), getAnchor((IDebugView) getPart().getAdapter(IDebugView.class)), PopupInspectAction.ACTION_DEFININITION_ID, new JavaInspectExpression(MessageFormat.format(Messages.AllReferencesActionDelegate_1,new String[]{var.getName()}),referenceList)); ipd.open(); } catch (DebugException e) { JDIDebugUIPlugin.statusDialog(e.getStatus()); } } else { JDIDebugUIPlugin.statusDialog(new Status(IStatus.WARNING,JDIDebugUIPlugin.getUniqueIdentifier(),Messages.AllReferencesActionDelegate_0)); } }
protected void evaluate(String snippet) { if (getThread() == null) { WaitThread eThread= new WaitThread(Display.getCurrent(), this); eThread.start(); eThread.block(); } if (getThread() == null) { IStatus status = new Status(IStatus.ERROR, JDIDebugUIPlugin.getUniqueIdentifier(), IJavaDebugUIConstants.INTERNAL_ERROR, SnippetMessages.getString("SnippetEditor.error.nocontext"), null); //$NON-NLS-1$ ErrorDialog.openError(getShell(), SnippetMessages.getString("SnippetEditor.error.evaluating"), null, status); //$NON-NLS-1$ evaluationEnds(); return; } boolean hitBreakpoints= JDIDebugModel.getPreferences().getBoolean(JDIDebugModel.PREF_SUSPEND_FOR_BREAKPOINTS_DURING_EVALUATION); try { getEvaluationEngine().evaluate(snippet,getThread(), this, hitBreakpoints); } catch (DebugException e) { JDIDebugUIPlugin.log(e); ErrorDialog.openError(getShell(), SnippetMessages.getString("SnippetEditor.error.evaluating"), null, e.getStatus()); //$NON-NLS-1$ evaluationEnds(); } }
protected void shutDownVM() { DebugPlugin.getDefault().removeDebugEventFilter(this); // The real shut down IDebugTarget target= fVM; if (fVM != null) { try { IBreakpoint bp = ScrapbookLauncher.getDefault().getMagicBreakpoint(fVM); if (bp != null) { fVM.breakpointRemoved(bp, null); } if (getThread() != null) { getThread().resume(); } fVM.terminate(); } catch (DebugException e) { JDIDebugUIPlugin.log(e); ErrorDialog.openError(getShell(), SnippetMessages.getString("SnippetEditor.error.shutdown"), null, e.getStatus()); //$NON-NLS-1$ return; } vmTerminated(); ScrapbookLauncher.getDefault().cleanup(target); } }
evaluationListener.valueToString(value); } catch (DebugException e) { listener.detailComputed(value, e.getStatus().getMessage());