private static void setupContext(final JEditorPane editorPane, Pair<Line.Part, FileObject> context) { assert SwingUtilities.isEventDispatchThread(); if (context != null) { final Line.Part lp = context.first(); final FileObject file = context.second(); //System.err.println("WatchPanel.setupContext("+file+", "+line+", "+offset+")"); // Do the binding for text files only: if (file != null && file.getMIMEType().startsWith("text/")) { // NOI18N String origText = editorPane.getText(); DialogBinding.bindComponentToFile(file, lp.getLine().getLineNumber(), lp.getColumn(), lp.getLength(), editorPane); Document editPaneDoc = editorPane.getDocument(); //editPaneDoc.putProperty("org.netbeans.modules.editor.java.JavaCompletionProvider.skipAccessibilityCheck", "true"); editorPane.setText(origText); } } setupUI(editorPane); }
private void evaluate(Session session, final DebuggerEngine engine, //final Debugger dbg, Line.Part lp, EditorCookie ec) { final Line line = lp.getLine(); if (line == null) { return; int lineNo = lp.getLine().getLineNumber(); int column = lp.getColumn(); final int offset = NbDocument.findLineOffset(doc, lineNo) + column; boolean[] isFunctionPtr = new boolean[] { false };
Part lp = (Part) getAttachedAnnotatable(); if (lp == null) return null; Line line = lp.getLine (); DataObject dob = DataEditorSupport.findDataObject (line); EditorCookie ec = dob.getCookie (EditorCookie.class); int offset = NbDocument.findLineOffset ( ec.getDocument (), lp.getLine ().getLineNumber () ) + lp.getColumn (); TokenHierarchy tokenHierarchy = TokenHierarchy.get (document); if (tokenHierarchy == null) return null;
String text = Utils.getELIdentifier(doc, ep,NbDocument.findLineOffset(doc, lp.getLine().getLineNumber()) + lp.getColumn()); Utils.log("JspTooltip: ELIdentifier = " + text); doc, ep, NbDocument.findLineOffset(doc, lp.getLine().getLineNumber()) + lp.getColumn() ); Utils.log("isScriptlet: " + isScriptlet); doc, ep, NbDocument.findLineOffset(doc, lp.getLine().getLineNumber()) + lp.getColumn() ); textForTooltip = text;
String cdiAnnotationType = cdiAnnotation.getAnnotationType(); if ( cdiAnnotationType.equals( annotationType)){ Line cdiLine = cdiAnnotation.getPart().getLine(); if ( cdiLine.getLineNumber() == lineNumber ){ int length = cdiAnnotation.getPart().getLength(); if ( length == desc.getLength() ){ doAction( comp , annotationType, cdiAnnotation.getPart(),
return null; Line line = lp.getLine (); DataObject dob = DataEditorSupport.findDataObject (line); if (dob == null) {
return null; Line line = lp.getLine (); DataObject dob = DataEditorSupport.findDataObject (line); if (dob == null) {
return null; Line line = lp.getLine (); DataObject dob = DataEditorSupport.findDataObject (line); if (dob == null) {
return null; Line line = lp.getLine (); DataObject dob = DataEditorSupport.findDataObject (line); if (dob == null) {
/** Add annotation to this Annotatable class * @param anno annotation which will be attached to this class */ @Override protected void addAnnotation(final Annotation anno) { super.addAnnotation(anno); final StyledDocument doc = position.getCloneableEditorSupport().getDocument(); // document is not opened and so the annotation will be added to document later if (doc == null) { return; } position.getCloneableEditorSupport().prepareDocument().waitFinished(); doc.render(new Runnable() { public void run() { try { synchronized (getAnnotations()) { if (!anno.isInDocument()) { anno.setInDocument(true); NbDocument.addAnnotation(doc, position.getPosition(), length, anno); } } } catch (IOException ex) { Logger.getLogger(DocumentLine.class.getName()).log(Level.WARNING, null, ex); } } }); }
public String getShortDescription() { Utils.log("JspTooltip: getShortDescription"); toolTipText = null; DebuggerEngine currentEngine = DebuggerManager.getDebuggerManager (). getCurrentEngine (); if (currentEngine == null) return null; JPDADebugger d = (JPDADebugger) currentEngine.lookupFirst (null, JPDADebugger.class); if (d == null) return null; Line.Part lp = (Line.Part) getAttachedAnnotatable(); if (lp != null) { Line line = lp.getLine (); DataObject dob = DataEditorSupport.findDataObject(line); EditorCookie ec = (EditorCookie) dob.getCookie(EditorCookie.class); if (ec != null) { // Only for editable dataobjects try { doc = ec.openDocument (); rp.post(this); } catch (IOException e) { } } } return toolTipText; }
/** Remove annotation to this Annotatable class * @param anno annotation which will be detached from this class */ @Override protected void removeAnnotation(final Annotation anno) { super.removeAnnotation(anno); final StyledDocument doc = position.getCloneableEditorSupport().getDocument(); // document is not opened and so no annotation is attached to it if (doc == null) { return; } position.getCloneableEditorSupport().prepareDocument().waitFinished(); doc.render(new Runnable() { public void run() { synchronized (getAnnotations()) { if (anno.isInDocument()) { anno.setInDocument(false); NbDocument.removeAnnotation(doc, anno); } } } }); }
public String getShortDescription () { // [TODO] hack for org.netbeans.modules.debugger.jpda.actions.MethodChooser that disables tooltips if ("true".equals(System.getProperty("org.netbeans.modules.debugger.jpda.doNotShowTooltips"))) { // NOI18N return null; } DebuggerEngine currentEngine = DebuggerManager.getDebuggerManager (). getCurrentEngine (); if (currentEngine == null) return null; JPDADebugger d = currentEngine.lookupFirst(null, JPDADebugger.class); if (d == null) return null; Part lp = (Part) getAttachedAnnotatable(); if (lp == null) return null; Line line = lp.getLine (); DataObject dob = DataEditorSupport.findDataObject (line); if (dob == null) return null; EditorCookie ec = dob.getCookie(EditorCookie.class); if (ec == null) return null; // Only for editable dataobjects this.lp = lp; this.ec = ec; RequestProcessor.getDefault ().post (this); return null; }
/** Add annotation to this Annotatable class * @param anno annotation which will be attached to this class */ protected void addAnnotation(Annotation anno) { super.addAnnotation(anno); StyledDocument doc = position.getCloneableEditorSupport ().getDocument (); // document is not opened and so the annotation will be added to document later if (doc == null) return; position.getCloneableEditorSupport().prepareDocument().waitFinished(); try { if (!anno.isInDocument()) { anno.setInDocument(true); NbDocument.addAnnotation(doc, position.getPosition(), length, anno); } } catch (IOException ex) { ErrorManager.getDefault ().notify ( ErrorManager.EXCEPTION, ex); } }
/** Add annotation to this Annotatable class * @param anno annotation which will be attached to this class */ protected void addAnnotation(Annotation anno) { super.addAnnotation(anno); StyledDocument doc = position.getCloneableEditorSupport ().getDocument (); // document is not opened and so the annotation will be added to document later if (doc == null) return; position.getCloneableEditorSupport().prepareDocument().waitFinished(); try { if (!anno.isInDocument()) { anno.setInDocument(true); NbDocument.addAnnotation(doc, position.getPosition(), length, anno); } } catch (IOException ex) { ErrorManager.getDefault ().notify ( ErrorManager.EXCEPTION, ex); } }