@SuppressWarnings({"HardCodedStringLiteral"}) public void showEmpty() { myCurrentEntity = null; try { myHTMLViewer.read(new StringReader("<html><body></body></html>"), null); } catch (IOException e) { // can't be } }
/** * Loads the model editor with the text from the given stream reader, discards any previous * content in the editor. * * @param reader A character stream reader * @param object An object describing the stream; this might be a string, a File, a URL, etc. * @throws IOException Thrown if there was an IO error reading the input stream. */ public void read(Reader reader, Object object) throws IOException { editor.getDocument().removeUndoableEditListener(undoManager); editor.read(reader, object); // For some unknown reason the listeners have to be added both here // and in the constructor, if they're not added here the editor won't // be listening. editor.getDocument().addDocumentListener(this); editor.getDocument().addUndoableEditListener(undoManager); }
public void showPageFor(RefEntity refEntity, CommonProblemDescriptor descriptor) { try { String html = generateHTML(refEntity, descriptor); myHTMLViewer.read(new StringReader(html), null); setupStyle(); myHTMLViewer.setCaretPosition(0); } catch (Exception e) { showEmpty(); } finally { myCurrentEntity = refEntity; myCurrentDescriptor = descriptor; } }
private void showPageFromHistory(RefEntity newEntity) { InspectionTool tool = getTool(newEntity); try { if (tool instanceof DescriptorProviderInspection && !(tool instanceof CommonInspectionToolWrapper)) { showEmpty(); } else { try { String html = generateHTML(newEntity, tool); myHTMLViewer.read(new StringReader(html), null); setupStyle(); myHTMLViewer.setCaretPosition(0); } catch (Exception e) { showEmpty(); } } } finally { myCurrentEntity = newEntity; myCurrentDescriptor = null; } }