コード例 #1
0
  public NbEditorToolBar(JTextComponent component) {
    this.componentRef = new WeakReference(component);

    setFloatable(false);
    // mkleint - instead of here, assign the border in CloneableEditor and MultiView module.
    //        // special border installed by core or no border if not available
    //        Border b = (Border)UIManager.get("Nb.Editor.Toolbar.border"); //NOI18N
    //        setBorder(b);
    addMouseListener(sharedMouseListener);

    installModulesInstallationListener();
    installNoOpActionMappings();

    lookupResult =
        MimeLookup.getLookup(DocumentUtilities.getMimeType(component))
            .lookupResult(KeyBindingSettings.class);
    lookupResult.addLookupListener(
        WeakListeners.create(LookupListener.class, keybindingsTracker, lookupResult));

    String mimeType = DocumentUtilities.getMimeType(component);
    preferences =
        MimeLookup.getLookup(mimeType == null ? MimePath.EMPTY : MimePath.parse(mimeType))
            .lookup(Preferences.class);
    preferences.addPreferenceChangeListener(
        WeakListeners.create(PreferenceChangeListener.class, prefsTracker, preferences));

    refreshToolbarButtons();
    setBorderPainted(true);
  }
コード例 #2
0
 public static void initKeyBindingList(String mimeType) {
   Collection<? extends KeyBindingSettings> c =
       MimeLookup.getLookup(mimeType).lookupAll(KeyBindingSettings.class);
   if (!c.isEmpty()) {
     // just do something with the collection
     c.iterator().next();
   }
 }
コード例 #3
0
 public @Override void setLineNumberEnabled(boolean lineNumberEnabled) {
   Preferences prefs = MimeLookup.getLookup(MimePath.EMPTY).lookup(Preferences.class);
   boolean visible =
       prefs.getBoolean(
           SimpleValueNames.LINE_NUMBER_VISIBLE,
           EditorPreferencesDefaults.defaultLineNumberVisible);
   prefs.putBoolean(SimpleValueNames.LINE_NUMBER_VISIBLE, !visible);
 }
コード例 #4
0
 public ClojureEditorKit(String mimetype) {
   super();
   this.MIME_TYPE = mimetype;
   if (MIME_TYPE.equals("text/x-clojure")) {
     Lookup l = MimeLookup.getLookup(MimePath.get("text/x-clojure"));
     Preferences p = l.lookup(Preferences.class);
     p.put(SimpleValueNames.CODE_FOLDING_ENABLE, Boolean.TRUE.toString());
   }
 }
コード例 #5
0
  public ReplTopComponent(String replName, ReplPanel replPanel) {
    _projectName = replName;

    initComponents();
    setName(getBundleProperty("CTL_ReplTopComponent", _projectName));
    setToolTipText(getBundleProperty("HINT_ReplTopComponent", _projectName));
    setIcon(ImageUtilities.loadImage(ICON_PATH, true));
    Lookup l = MimeLookup.getLookup(MimePath.get("text/x-clojure"));
    Preferences p = l.lookup(Preferences.class);
    p.put(SimpleValueNames.CODE_FOLDING_ENABLE, "true");
    // Create project repl
    this._replPanel = replPanel; // ??new ReplPanel(special);
    // ??_replPanel.setName("replPanel" + projectName);
    jScrollPane1.setViewportView(_replPanel);
  }
コード例 #6
0
 /**
  * Test reformatting of array initializer with newlines on
  *
  * @see http://www.netbeans.org/issues/show_bug.cgi?id=47069
  */
 public void testReformatArrayInitializerWithNewline() {
   //        Settings.setValue(JavaKit.class, JavaSettingsNames.JAVA_FORMAT_NEWLINE_BEFORE_BRACE,
   // Boolean.TRUE);
   Preferences prefs = MimeLookup.getLookup(JavaKit.JAVA_MIME_TYPE).lookup(Preferences.class);
   String originalPlacement =
       prefs.get(
           FmtOptions.methodDeclBracePlacement, CodeStyle.BracePlacement.SAME_LINE.toString());
   assertTrue(!originalPlacement.equals(CodeStyle.BracePlacement.NEW_LINE.toString()));
   prefs.put(FmtOptions.methodDeclBracePlacement, CodeStyle.BracePlacement.NEW_LINE.toString());
   setLoadDocumentText("int[] foo = new int[] {1, 2, 3};");
   reformat();
   assertDocumentText(
       "Incorrect array initializer with newline reformatting",
       "int[] foo = new int[] {1, 2, 3};");
   prefs.put(FmtOptions.methodDeclBracePlacement, originalPlacement);
 }
コード例 #7
0
  private SemanticHighlighter(@NonNull StyledDocument document) {
    super(document, TemplateParserDataDefinitions.REFERENCE_PARSE_TREE);

    Lookup lookup =
        MimeLookup.getLookup(MimePath.parse(StringTemplateEditorKit.TEMPLATE_MIME_TYPE));
    FontColorSettings settings = lookup.lookup(FontColorSettings.class);
    this.templateDeclarationAttributes = getFontAndColors(settings, "templateDeclaration");
    this.templateUseAttributes = getFontAndColors(settings, "templateUse");
    this.regionDeclarationAttributes = getFontAndColors(settings, "regionDeclaration");
    this.regionUseAttributes = getFontAndColors(settings, "regionUse");
    this.dictionaryDeclarationAttributes = getFontAndColors(settings, "dictionaryDeclaration");
    this.dictionaryUseAttributes = getFontAndColors(settings, "dictionaryUse");
    this.parameterDeclarationAttributes = getFontAndColors(settings, "parameterDeclaration");
    this.parameterUseAttributes = getFontAndColors(settings, "parameterUse");
    this.attributeUseAttributes = getFontAndColors(settings, "attributeUse");
    this.expressionOptionAttributes = getFontAndColors(settings, "expressionOption");
  }
コード例 #8
0
 private CompletionSettings(String mimeType) {
   this.preferences =
       (mimeType != null ? MimeLookup.getLookup(mimeType) : MimeLookup.getLookup(MimePath.EMPTY))
           .lookup(Preferences.class);
 }
コード例 #9
0
 public @Override boolean isLineNumberEnabled() {
   Preferences prefs = MimeLookup.getLookup(MimePath.EMPTY).lookup(Preferences.class);
   return prefs.getBoolean(
       SimpleValueNames.LINE_NUMBER_VISIBLE, EditorPreferencesDefaults.defaultLineNumberVisible);
 }