public void createExceptionPane(Exception cause, String queryString) throws PartInitException { StringBuilder buf = new StringBuilder(256); buf.append(Messages.OQLPane_ExecutedQuery); buf.append(queryString); Throwable t = null; if (cause instanceof SnapshotException) { buf.append(Messages.OQLPane_ProblemReported); buf.append(cause.getMessage()); t = cause.getCause(); } else { t = cause; } if (t != null) { buf.append("\n\n"); // $NON-NLS-1$ StringWriter w = new StringWriter(); PrintWriter o = new PrintWriter(w); t.printStackTrace(o); o.flush(); buf.append(w.toString()); } try { AbstractEditorPane pane = EditorPaneRegistry.instance().createNewPane("TextViewPane"); // $NON-NLS-1$ if (pane == null) throw new PartInitException(Messages.OQLPane_PaneNotFound); // no pane state -> do not include in navigation history createResultPane(pane, buf.toString()); } catch (CoreException e) { throw new PartInitException(ErrorHelper.createErrorStatus(e)); } }
private void initQueryResult(QueryResult queryResult, PaneState state) { IOQLQuery.Result subject = (IOQLQuery.Result) (queryResult).getSubject(); queryViewer.getDocument().set(subject.getOQLQuery()); AbstractEditorPane pane = EditorPaneRegistry.instance().createNewPane(subject, this.getClass()); if (state == null) { for (PaneState child : getPaneState().getChildren()) { if (queryString.getText().equals(child.getIdentifier())) { state = child; break; } } if (state == null) { state = new PaneState(PaneType.COMPOSITE_CHILD, getPaneState(), queryString.getText(), true); state.setImage(getTitleImage()); } } pane.setPaneState(state); createResultPane(pane, queryResult); }