@Override public Document createDefaultDocument() { BaseDocument doc = new NbEditorDocument(MIMENames.FORTRAN_MIME_TYPE); // Force '\n' as write line separator // !!! move to initDocument() doc.putProperty(BaseDocument.WRITE_LINE_SEPARATOR_PROP, BaseDocument.LS_LF); return doc; }
/** Add document to registry. Doesn't search for repetitive * adding. * @return registry unique ID of the document */ public static synchronized int addDocument(BaseDocument doc) { Integer docID = getIDInteger(doc); if (docID != null) { // already added return docID.intValue(); } if (docRefsCount >= docRefs.length) { docRefs = realloc(docRefs); } docRefs[docRefsCount] = new WeakReference(doc); doc.putProperty(BaseDocument.ID_PROP, new Integer(docRefsCount)); return docRefsCount++; }
/** * Add document to registry. Doesn't search for repetitive adding. * * @return registry unique ID of the document */ public static synchronized int addDocument(BaseDocument doc) { Integer docID = getIDInteger(doc); if (docID != null) { // already added return docID.intValue(); } if (docRefsCount >= docRefs.length) { docRefs = realloc(docRefs); } docRefs[docRefsCount] = new WeakReference(doc); doc.putProperty(BaseDocument.ID_PROP, new Integer(docRefsCount)); return docRefsCount++; }
/** Initialize document by adding the draw-layers for example. */ @Override protected void initDocument(BaseDocument doc) { super.initDocument(doc); Language<CppTokenId> language = getLanguage(); doc.putProperty(Language.class, language); doc.putProperty(InputAttributes.class, getLexerAttributes(language, doc)); // make sure that preferences in mime lookup are inited CodeStyle.getDefault(doc); }
public static synchronized CppUpToDateStatusProvider get(BaseDocument doc) { if (doc == null) { return null; } CppUpToDateStatusProvider provider = (CppUpToDateStatusProvider) doc.getProperty(CppUpToDateStatusProvider.class); if (provider == null) { doc.putProperty(CppUpToDateStatusProvider.class, provider = new CppUpToDateStatusProvider()); } return provider; }
private void findSupportChange(PropertyChangeEvent evt) { // set all finders to null putProperty(STRING_FINDER_PROP, null); putProperty(STRING_BWD_FINDER_PROP, null); putProperty(BLOCKS_FINDER_PROP, null); DrawLayerFactory.HighlightSearchLayer hsl = (DrawLayerFactory.HighlightSearchLayer) findLayer(DrawLayerFactory.HIGHLIGHT_SEARCH_LAYER_NAME); Boolean b = (Boolean) FindSupport.getFindSupport().getPropertyNoInit(SettingsNames.FIND_HIGHLIGHT_SEARCH); hsl.setEnabled((b != null) ? b.booleanValue() : false); fireChangedUpdate(createDocumentEvent(0, getLength(), DocumentEvent.EventType.CHANGE)); // refresh // whole // document }
private void findSupportChange(PropertyChangeEvent evt) { // set all finders to null putProperty(STRING_FINDER_PROP, null); putProperty(STRING_BWD_FINDER_PROP, null); putProperty(BLOCKS_FINDER_PROP, null); DrawLayerFactory.HighlightSearchLayer hsl = (DrawLayerFactory.HighlightSearchLayer)findLayer( DrawLayerFactory.HIGHLIGHT_SEARCH_LAYER_NAME); Boolean b = (Boolean)FindSupport.getFindSupport().getPropertyNoInit( SettingsNames.FIND_HIGHLIGHT_SEARCH); hsl.setEnabled((b != null) ? b.booleanValue() : false); fireChangedUpdate(createDocumentEvent(0, getLength(), DocumentEvent.EventType.CHANGE)); // refresh whole document }
/** Initialize document by adding the draw-layers for example. */ @Override protected void initDocument(BaseDocument doc) { super.initDocument(doc); doc.putProperty(Language.class, getLanguage()); initCodeStyle(doc); }
int readBufferSize = SettingsUtil.getPositiveInteger(kitClass, SettingsNames.READ_BUFFER_SIZE, SettingsDefaults.defaultReadBufferSize); putProperty(SettingsNames.READ_BUFFER_SIZE, new Integer(readBufferSize)); int writeBufferSize = SettingsUtil.getPositiveInteger(kitClass, SettingsNames.WRITE_BUFFER_SIZE, SettingsDefaults.defaultWriteBufferSize); putProperty(SettingsNames.WRITE_BUFFER_SIZE, new Integer(writeBufferSize)); int markDistance = SettingsUtil.getPositiveInteger(kitClass, SettingsNames.MARK_DISTANCE, SettingsDefaults.defaultMarkDistance); putProperty(SettingsNames.MARK_DISTANCE, new Integer(markDistance)); int maxMarkDistance = SettingsUtil.getPositiveInteger(kitClass, SettingsNames.MAX_MARK_DISTANCE, SettingsDefaults.defaultMaxMarkDistance); putProperty(SettingsNames.MAX_MARK_DISTANCE, new Integer(maxMarkDistance)); int minMarkDistance = SettingsUtil.getPositiveInteger(kitClass, SettingsNames.MIN_MARK_DISTANCE, SettingsDefaults.defaultMinMarkDistance); putProperty(SettingsNames.MIN_MARK_DISTANCE, new Integer(minMarkDistance)); int readMarkDistance = SettingsUtil.getPositiveInteger(kitClass, SettingsNames.READ_MARK_DISTANCE, SettingsDefaults.defaultReadMarkDistance); putProperty(SettingsNames.READ_MARK_DISTANCE, new Integer(readMarkDistance)); int syntaxUpdateBatchSize = SettingsUtil.getPositiveInteger(kitClass, SettingsNames.SYNTAX_UPDATE_BATCH_SIZE, SettingsDefaults.defaultSyntaxUpdateBatchSize); putProperty(SettingsNames.SYNTAX_UPDATE_BATCH_SIZE, new Integer(syntaxUpdateBatchSize)); int lineBatchSize = SettingsUtil.getPositiveInteger(kitClass,
putProperty(SettingsNames.READ_BUFFER_SIZE, new Integer(readBufferSize)); putProperty(SettingsNames.WRITE_BUFFER_SIZE, new Integer(writeBufferSize)); putProperty(SettingsNames.MARK_DISTANCE, new Integer(markDistance)); putProperty(SettingsNames.MAX_MARK_DISTANCE, new Integer(maxMarkDistance)); putProperty(SettingsNames.MIN_MARK_DISTANCE, new Integer(minMarkDistance)); putProperty(SettingsNames.READ_MARK_DISTANCE, new Integer(readMarkDistance)); int syntaxUpdateBatchSize = SettingsUtil.getPositiveInteger(kitClass, SettingsNames.SYNTAX_UPDATE_BATCH_SIZE, SettingsDefaults.defaultSyntaxUpdateBatchSize); putProperty(SettingsNames.SYNTAX_UPDATE_BATCH_SIZE, new Integer(syntaxUpdateBatchSize)); putProperty(SettingsNames.LINE_BATCH_SIZE, new Integer(lineBatchSize)); putProperty(SettingsNames.NEXT_WORD_FINDER, SettingsUtil.getValue(kitClass, SettingsNames.NEXT_WORD_FINDER, new FinderFactory.NextWordFwdFinder( this, stopOnEOL, false))); putProperty(SettingsNames.PREVIOUS_WORD_FINDER, SettingsUtil.getValue(kitClass, SettingsNames.PREVIOUS_WORD_FINDER, new FinderFactory.PreviousWordBwdFinder(this, stopOnEOL, false)));
/** Get finder depending on find properties */ public FinderFactory.StringFinder getStringFinder(BaseDocument doc, Map props) { FinderFactory.StringFinder stringFinder = (FinderFactory.StringFinder)doc.getProperty(BaseDocument.STRING_FINDER_PROP); if (stringFinder == null) { stringFinder = getFinderCreator().createFinder(doc, getValidFindProperties(props)); doc.putProperty(BaseDocument.STRING_FINDER_PROP, stringFinder); } return stringFinder; }
/** Get opposite direction finder depending on find properties */ public FinderFactory.StringFinder getStringBwdFinder(BaseDocument doc, Map props) { FinderFactory.StringFinder stringBwdFinder = (FinderFactory.StringFinder) doc.getProperty(BaseDocument.STRING_BWD_FINDER_PROP); if (stringBwdFinder == null) { stringBwdFinder = getFinderCreator().createBwdFinder(doc, getValidFindProperties(props)); doc.putProperty(BaseDocument.STRING_BWD_FINDER_PROP, stringBwdFinder); } return stringBwdFinder; }
@Override public void run() { int offset = context.getOffset(); if (FortranHotCharIndent.INSTANCE.getKeywordBasedReformatBlock(doc, offset, context.getText())) { Indent indent = Indent.get(doc); indent.lock(); try { doc.putProperty("abbrev-ignore-modification", Boolean.TRUE); // NOI18N indent.reindent(offset); } catch (BadLocationException ex) { Exceptions.printStackTrace(ex); } finally { doc.putProperty("abbrev-ignore-modification", Boolean.FALSE); // NOI18N indent.unlock(); } } } });
/** Get opposite direction finder depending on find properties */ public FinderFactory.StringFinder getStringBwdFinder(BaseDocument doc, Map props) { FinderFactory.StringFinder stringBwdFinder = (FinderFactory.StringFinder)doc.getProperty(BaseDocument.STRING_BWD_FINDER_PROP); if (stringBwdFinder == null) { stringBwdFinder = getFinderCreator().createBwdFinder(doc, getValidFindProperties(props)); doc.putProperty(BaseDocument.STRING_BWD_FINDER_PROP, stringBwdFinder); } return stringBwdFinder; }
/** Get finder depending on find properties */ public FinderFactory.StringFinder getStringFinder(BaseDocument doc, Map props) { FinderFactory.StringFinder stringFinder = (FinderFactory.StringFinder) doc.getProperty(BaseDocument.STRING_FINDER_PROP); if (stringFinder == null) { stringFinder = getFinderCreator().createFinder(doc, getValidFindProperties(props)); doc.putProperty(BaseDocument.STRING_FINDER_PROP, stringFinder); } return stringFinder; }
newDoc.putProperty(Language.class, language); String mimeType = (String) oldDoc.getProperty("mimeType"); newDoc.putProperty("mimeType", mimeType); newDoc.insertString(0, oldSource, null); edits.applyToDocument(newDoc);
doc.putProperty(BaseDocument.READ_LINE_SEPARATOR_PROP, ((LineSeparatorConversion.InitialSeparatorReader)reader).getInitialSeparator());
doc.putProperty("HTML_FORMATTER_ACTS_ON_TOP_LEVEL", Boolean.TRUE);
putProperty(GapStart.class, getDocumentContent()); putProperty(READ_LINE_SEPARATOR_PROP, Analyzer.getPlatformLS());
putProperty(READ_LINE_SEPARATOR_PROP, Analyzer.getPlatformLS());