This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 107732

Summary: Consider placing braces matcher files into a subdir
Product: editor Reporter: Jesse Glick <jglick>
Component: -- Other --Assignee: issues@editor <issues>
Status: RESOLVED FIXED    
Severity: blocker Keywords: API
Priority: P2    
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:
Bug Depends on:    
Bug Blocks: 103187    

Description Jesse Glick 2007-06-21 22:44:38 UTC
I am working on resolving outstanding issues with folder ordering. Under the new system, folders containing some files
with positions and some without trigger warnings. The problem with BracesMatcherFactory instances is that they are
placed at top level: Editors/* or Editors/text/x-java/* etc. But they seem to need to be ordered (at least there was an
ordering attr there before, and the code seems to care: "Find the first provider that accepts the context"). So then all
of the many other files under Editors/* have ambiguous positions relative to them:

Not all children in Editors/ marked with the position attribute: [text, UpToDateStatusProvider, Keybindings,
AnnotationTypes, SideBar, org-netbeans-modules-diff-builtin-visualizer-editable-DiffHighlightsLayerFactory.instance,
Popup, FontsColors, org-netbeans-modules-editor-bracesmatching-BracesMatchHighlighting$Factory.instance,
org-netbeans-modules-editor-lib2-highlighting-Factory.instance,
org-netbeans-modules-editor-impl-highlighting-HLFactory.instance, Toolbars, application], but some are:
[org-netbeans-modules-editor-bracesmatching-LegacyEssMatcher.instance,
org-netbeans-modules-editor-bracesmatching-DefaultMatcher.instance]

Also it looks strange to me for these files to be at top level when almost everything else is in a subdir with a
meaningful name: Popup, SideBar, etc.

Suggest moving org-netbeans-modules-editor-bracesmatching-LegacyEssMatcher.instance and
org-netbeans-modules-editor-bracesmatching-DefaultMatcher.instance into a subdir such as Editors/BracesMatchers or
whatever you like. Experiments confirm that MimeLookup.getLookup(MimePath) does _not_ find them there by default; I
guess you need to create a Class2LayerFolder for BMF?

If you don't have any time and trust me to do it, let me know. It is I think an API change (instances need to be
registered in a different place), but the API is new anyway.
Comment 1 Vitezslav Stejskal 2007-06-26 10:23:43 UTC
Ok, I'll move them to subfolders. It'll be cleaner.
Comment 2 Vitezslav Stejskal 2007-06-26 10:33:20 UTC
I'd like to change the way how instances of BracesMatcherFactory are registered in MimeLookup. Currently they are
registered in folders for mime types (eg. Editors/text/x-java). The proposed change is to move them to the
'BracesMatchers' subfolder (eg. Editors/text/x-java/BracesMatchers). As Jesse explained it'll make it easier to maintain
instance files ordering in situations when there is multiple matchers registered for the same mime type (or for the 'all
languages' root).

This is an incompatible change, but the API has not been released yet. I'll update all existing implementations in
modules. Thanks.
Comment 3 Vitezslav Stejskal 2007-06-28 11:58:32 UTC
In trunk.

Checking in dev/java/editor/src/org/netbeans/modules/java/editor/resources/layer.xml;
/cvs/java/editor/src/org/netbeans/modules/java/editor/resources/layer.xml,v  <--  layer.xml
new revision: 1.32; previous revision: 1.31
done
RCS file: /cvs/editor/bracesmatching/src/org/netbeans/modules/editor/bracesmatching/BMFClass2LayerFolder.java,v
done
Checking in dev/editor/bracesmatching/src/org/netbeans/modules/editor/bracesmatching/BMFClass2LayerFolder.java;
/cvs/editor/bracesmatching/src/org/netbeans/modules/editor/bracesmatching/BMFClass2LayerFolder.java,v  <-- 
BMFClass2LayerFolder.java
initial revision: 1.1
done
Checking in dev/editor/bracesmatching/src/org/netbeans/modules/editor/bracesmatching/layer.xml;
/cvs/editor/bracesmatching/src/org/netbeans/modules/editor/bracesmatching/layer.xml,v  <--  layer.xml
new revision: 1.3; previous revision: 1.2
done
RCS file: /cvs/editor/bracesmatching/src/META-INF/services/org.netbeans.spi.editor.mimelookup.Class2LayerFolder,v
done
Checking in dev/editor/bracesmatching/src/META-INF/services/org.netbeans.spi.editor.mimelookup.Class2LayerFolder;
/cvs/editor/bracesmatching/src/META-INF/services/org.netbeans.spi.editor.mimelookup.Class2LayerFolder,v  <-- 
org.netbeans.spi.editor.mimelookup.Class2LayerFolder
initial revision: 1.1
done
Checking in dev/javadoc/src/org/netbeans/modules/javadoc/resources/mf-layer.xml;
/cvs/javadoc/src/org/netbeans/modules/javadoc/resources/mf-layer.xml,v  <--  mf-layer.xml
new revision: 1.65; previous revision: 1.64
done
Comment 4 Vitezslav Stejskal 2007-06-28 11:59:35 UTC
forgot to reassign
Comment 5 Vitezslav Stejskal 2007-06-28 12:00:25 UTC
.
Comment 6 Vitezslav Stejskal 2007-06-28 12:25:04 UTC
Jesse, I'm still getting this warning:

[exec] WARNING [org.openide.filesystems.Ordering]: Not all children in / marked with the position attribute:
[org-netbeans-modules-javadoc-JavadocBracesMatcher.instance,
org-netbeans-modules-editor-java-JavaBracesMatcher.instance], but some are:
[org-netbeans-modules-editor-bracesmatching-LegacyEssMatcher.instance,
org-netbeans-modules-editor-bracesmatching-DefaultMatcher.instance]

The warning is right. LegacyMatcher and DefaultMatcher have the position attribute; they are both registered in
Editors/BracesMatchers (ie. for all languages). Neither JavadocBracesMatcher nor JavaBracesMatcher need the position,
because they are registered for their respective mime types and should automatically have precedence over the matchers
for all languages. Is this something that CompoundFolderChildren should take care of?
Comment 7 Jesse Glick 2007-07-10 01:33:25 UTC
Use position="0" for files which you specifically know do not need to be ordered yet are in a folder alongside some
files which do need to be ordered.