Document getDocument() { return getOperation().getHierarchy().getComponent().getDocument(); }
public void init(FoldOperation operation) { this.operation = operation; String mimeType = DocumentUtilities.getMimeType(operation.getHierarchy().getComponent()); prefs = MimeLookup.getLookup(mimeType).lookup(Preferences.class); }
private FileObject getFileObject() { FoldHierarchy h = (operation != null) ? operation.getHierarchy() : null; javax.swing.text.JTextComponent comp = (h != null) ? h.getComponent() : null; Document doc = (comp != null) ? comp.getDocument() : null; DataObject dob = (doc != null) ? NbEditorUtilities.getDataObject(doc) : null; if (dob != null) { return dob.getPrimaryFile(); } return null; }
/** Initialize this manager */ @Override public void init(FoldOperation operation) { this.operation = operation; EditorKit kit = org.netbeans.editor.Utilities.getKit(operation.getHierarchy().getComponent()); if (kit instanceof NbEditorKit) { String contentType = ((NbEditorKit) kit).getContentType(); if (contentType != null) { Preferences prefs = MimeLookup.getLookup(contentType).lookup(Preferences.class); if (prefs != null) { foldInitialCommentsPreset = prefs.getBoolean(CODE_FOLDING_COLLAPSE_INITIAL_COMMENT, false); foldIncludesPreset = prefs.getBoolean(CODE_FOLDING_COLLAPSE_IMPORT, false); foldCodeBlocksPreset = prefs.getBoolean(CODE_FOLDING_COLLAPSE_METHOD, false); foldCommentPreset = prefs.getBoolean(CODE_FOLDING_COLLAPSE_JAVADOC, false); } } } }
public synchronized void initFolds(FoldHierarchyTransaction transaction) { Document doc = operation.getHierarchy().getComponent().getDocument(); file = DataLoadersBridge.getDefault().getFileObject(doc); if (file != null) { currentFolds = new HashMap<FoldInfo, Fold>(); task = JavaElementFoldTask.getTask(file); task.setGsfFoldManager(GsfFoldManager.this); } }
/** * Initialize this manager. * * @param operation fold hierarchy operation dedicated to the fold manager. */ public void init (FoldOperation operation) { Document d = operation.getHierarchy ().getComponent ().getDocument (); if (d instanceof NbEditorDocument) { this.doc = d; this.operation = operation; parserManager = ParserManagerImpl.getImpl (doc); parserManager.addASTEvaluator (this); parserManager.fire ( parserManager.getState (), null, Collections.<String,Set<ASTEvaluator>>singletonMap (FOLD, Collections.<ASTEvaluator>singleton (this)), parserManager.getAST () ); } }
FoldHierarchy hierarchy = getOperation().getHierarchy(); hierarchy.lock(); try {
public void initFolds(FoldHierarchyTransaction transaction) { try { doc = getOperation().getHierarchy().getComponent().getDocument(); updateFolds(SyntaxUpdateTokens.getTokenInfoList(doc), transaction); } catch (BadLocationException e) { ErrorManager.getDefault().notify(e); } }
return; FoldHierarchy fh = operation.getHierarchy (); Fold fold = operation.getHierarchy ().getRootFold (); List<Fold> existingFolds = new ArrayList<Fold> (); collectFolds(fold, existingFolds);
public void run() { Document document = operation.getHierarchy().getComponent().getDocument(); if (!insideRender) { startTime = System.currentTimeMillis(); operation.getHierarchy().lock(); operation.getHierarchy().unlock();
Document doc = manager.operation.getHierarchy().getComponent().getDocument(); int startOffset = ts.offset(); int endOffset = startOffset + token.length();