javax.swing.text.StyledDocument.putProperty()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(6.4k)|赞(0)|评价(0)|浏览(129)

本文整理了Java中javax.swing.text.StyledDocument.putProperty()方法的一些代码示例,展示了StyledDocument.putProperty()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。StyledDocument.putProperty()方法的具体详情如下:
包路径:javax.swing.text.StyledDocument
类名称:StyledDocument
方法名:putProperty

StyledDocument.putProperty介绍

暂无

代码示例

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide-loaders

  1. /** Let's the super method create the document and also annotates it
  2. * with Title and StreamDescription properities.
  3. *
  4. * @param kit kit to user to create the document
  5. * @return the document annotated by the properties
  6. */
  7. protected StyledDocument createStyledDocument (EditorKit kit) {
  8. StyledDocument doc = super.createStyledDocument (kit);
  9. // set document name property
  10. doc.putProperty(javax.swing.text.Document.TitleProperty,
  11. FileUtil.getFileDisplayName(obj.getPrimaryFile())
  12. );
  13. // set dataobject to stream desc property
  14. doc.putProperty(javax.swing.text.Document.StreamDescriptionProperty,
  15. obj
  16. );
  17. return doc;
  18. }

代码示例来源:origin: org.netbeans.api/org-openide-text

  1. /** Method that can be overriden by children to create empty
  2. * styled document or attach additional document properties to it.
  3. *
  4. * @param kit the kit to use
  5. * @return styled document to use
  6. */
  7. protected StyledDocument createStyledDocument(EditorKit kit) {
  8. StyledDocument sd = createNetBeansDocument(kit.createDefaultDocument());
  9. sd.putProperty("mimeType", (mimeType != null) ? mimeType : cesEnv().getMimeType()); // NOI18N
  10. return sd;
  11. }

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

  1. /** Method that can be overriden by children to create empty
  2. * styled document or attach additional document properties to it.
  3. *
  4. * @param kit the kit to use
  5. * @return styled document to use
  6. */
  7. protected StyledDocument createStyledDocument (EditorKit kit) {
  8. StyledDocument sd = createNetBeansDocument (kit.createDefaultDocument ());
  9. sd.putProperty("mimeType", mimeType != null ? mimeType : env().getMimeType()); // NOI18N
  10. return sd;
  11. }

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

  1. /** Method that can be overriden by children to create empty
  2. * styled document or attach additional document properties to it.
  3. *
  4. * @param kit the kit to use
  5. * @return styled document to use
  6. */
  7. protected StyledDocument createStyledDocument (EditorKit kit) {
  8. StyledDocument sd = createNetBeansDocument (kit.createDefaultDocument ());
  9. sd.putProperty("mimeType", mimeType != null ? mimeType : env().getMimeType()); // NOI18N
  10. return sd;
  11. }

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-source

  1. private StyledDocument setupSlowDocumentProperties(StyledDocument doc) {
  2. assert !SwingUtilities.isEventDispatchThread();
  3. if (doc != null && !Boolean.TRUE.equals(doc.getProperty(EXTRA_DOCUMENT_PROPERTIES))) {
  4. // setup language flavor lexing attributes
  5. Language<?> language = (Language<?>) doc.getProperty(Language.class);
  6. assert language != null : "no language for " + doc;
  7. if (language != null) {
  8. InputAttributes lexerAttrs = (InputAttributes)doc.getProperty(InputAttributes.class);
  9. assert lexerAttrs != null : "no language attributes for " + doc;
  10. if (lexerAttrs == null) {
  11. lexerAttrs = new InputAttributes();
  12. doc.putProperty(InputAttributes.class, lexerAttrs);
  13. }
  14. Filter<?> filter = getDefaultFilter(language, doc);
  15. assert filter != null : "no language filter for " + doc + " with language " + language;
  16. if (filter != null) {
  17. lexerAttrs.setValue(language, CndLexerUtilities.LEXER_FILTER, filter, true); // NOI18N
  18. }
  19. }
  20. // try to setup document's extra properties during non-EDT load if needed
  21. PropertiesProviders.addProperty(getDataObject(), doc);
  22. doc.putProperty(EXTRA_DOCUMENT_PROPERTIES, Boolean.TRUE);
  23. rebuildDocumentControls(doc);
  24. }
  25. return doc;
  26. }

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-mobility-editor

  1. public static void actionPerformed(final Document document) {
  2. if (!((document instanceof StyledDocument) && (document instanceof BaseDocument))) return;
  3. final StyledDocument doc = (StyledDocument)document;
  4. final Project p = J2MEProjectUtils.getProjectForDocument(doc);
  5. if (p != null) {
  6. final ProjectConfigurationsHelper pch = p.getLookup().lookup(ProjectConfigurationsHelper.class);
  7. if (pch != null && pch.isPreprocessorOn()) try {
  8. J2MEProjectUtilitiesProvider utilProvider = Lookup.getDefault().lookup(J2MEProjectUtilitiesProvider.class);
  9. if (utilProvider == null) return; //we do not run in full NetBeans, but this should not happen here (no editor)
  10. final Source ppSource = utilProvider.createPPDocumentSource(doc);
  11. final Destination ppDestination = utilProvider.createPPDocumentDestination(doc);
  12. final ProjectConfiguration conf = pch.getActiveConfiguration();
  13. final HashMap<String,String> identifiers=new HashMap<String,String>(pch.getAbilitiesFor(conf));
  14. identifiers.put(conf.getDisplayName(),null);
  15. final CommentingPreProcessor cpp =new CommentingPreProcessor(ppSource, ppDestination, identifiers);
  16. //note: nbr transaction is already locked here
  17. try {
  18. doc.putProperty(TextSwitcher.SKIP_DUCUMENT_CHANGES, TextSwitcher.SKIP_DUCUMENT_CHANGES);
  19. NbDocument.runAtomic(doc,cpp); // NOI18N
  20. } finally {
  21. doc.putProperty(TextSwitcher.SKIP_DUCUMENT_CHANGES, null);
  22. }
  23. } catch (PreprocessorException pe) {
  24. ErrorManager.getDefault().notify(pe);
  25. }
  26. }
  27. }
  28. }

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-gsf

  1. @Override
  2. protected StyledDocument createStyledDocument (EditorKit kit) {
  3. org.netbeans.api.lexer.Language lexerlanguage = language.getGsfLanguage().getLexerLanguage();
  4. StyledDocument doc = super.createStyledDocument(kit);
  5. // Enter the file object in to InputAtrributes. It can be used by lexer.
  6. InputAttributes attributes = new InputAttributes();
  7. FileObject fileObject = NbEditorUtilities.getFileObject(doc);
  8. attributes.setValue(lexerlanguage, FileObject.class, fileObject, false);
  9. doc.putProperty(InputAttributes.class, attributes);
  10. return doc;
  11. }

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-source

  1. private GuardedSectionsProvider getGuardedSectionsProvider(final StyledDocument doc, EditorKit kit) {
  2. Object o = doc.getProperty(GuardedSectionsProvider.class);
  3. if (o instanceof GuardedSectionsProvider) {
  4. return (GuardedSectionsProvider) o;
  5. }
  6. String mimeType = kit.getContentType();
  7. CndUtils.assertTrueInConsole(mimeType != null, "unexpected null content type"); // NOI18N
  8. if (mimeType != null) {
  9. GuardedSectionsFactory gsf = GuardedSectionsFactory.find(mimeType);
  10. if (gsf != null) {
  11. GuardedSectionsProvider gsp = gsf.create(new GuardedEditorSupportImpl(doc));
  12. doc.putProperty(GuardedSectionsProvider.class, gsp);
  13. return gsp;
  14. }
  15. }
  16. return null;
  17. }

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-source

  1. doc.putProperty(DefaultEditorKit.EndOfLineStringProperty, "\n"); //NOI18N

代码示例来源:origin: org.netbeans.api/org-openide-text

  1. myDoc.putProperty("beforeSaveStart", beforeSaveStart);
  2. myDoc.putProperty("beforeSaveEnd", saveToMemory);

相关文章