Re: get all highlight information (position + color)

Peter Cheung <[email protected]> Sat, 15 Apr 2017 16:22:52 +0000
Newsgroups gmane.comp.java.netbeans.modules.openide.devel
Message-ID <SINPR04MB0527AD09C6A4886D16ABC2FDB5040@SINPR04MB0527.apcprd04.prod.outlook.com>
I am doing something like this https://atom.io/packages/minimap-highlight-selected , show the current occurrence words in my minimal plugin.

I am nearly defeat atom editor's minmap. I need to get the occurrences word information (position+color).

Thanks
Peter.




________________________________
From: geertjan wielenga <[email protected]>
Sent: Saturday, April 15, 2017 11:58 PM
To: [email protected]
Subject: [platform-dev] Re: get all highlight information (position + color)



On 15-4-2017 17:48, Peter Cheung wrote:

Sorry, you email dropped to my junk box. I am enhancing my minimal plugin and want to show the highlighted occurrences words. So I need to know what positions of the current occurrence word.


Below is my code up to, but seems can get the information I want:


Lookup.Result<HighlightsLayerFactory> factories = lookup.lookup(new Lookup.Template<HighlightsLayerFactory>(HighlightsLayerFactory.class));

Lookup.Template is deprecated: http://bits.netbeans.org/dev/javadoc/org-openide-util-lookup/org/openide/util/Lookup.Template.html
Lookup.Template (Lookup API) - NetBeans<http://bits.netbeans.org/dev/javadoc/org-openide-util-lookup/org/openide/util/Lookup.Template.html>
bits.netbeans.org
Parameters: type - the class of service we are looking for or null to leave unspecified id - the ID of the item/service we are looking for or null to leave unspecified




Here is a tutorial about this topic of mark occurrences, though still no idea what it is you're trying to do with these APIs.

https://platform.netbeans.org/tutorials/nbm-mark-occurrences.html
NetBeans Mark Occurrences Module Tutorial<https://platform.netbeans.org/tutorials/nbm-mark-occurrences.html>
platform.netbeans.org
NetBeans Mark Occurrences Module Tutorial. This tutorial demonstrates how to create a NetBeans module that highlights all instances of a selected word in an ...




Gj



Collection<? extends HighlightsLayerFactory> all = factories.allInstances();

HashMap<String, HighlightsLayer> layers = new HashMap<String, HighlightsLayer>();

Iterator it = layers.entrySet().iterator();

while (it.hasNext()) {

Map.Entry pair = (Map.Entry) it.next();

ModuleLib.log(pair.getKey() + " = " + pair.getValue());

}


Thanks for helping


________________________________
From: geertjan wielenga <[email protected]><mailto:[email protected]>
Sent: Saturday, April 15, 2017 11:38 PM
To: [email protected]<mailto:[email protected]>
Subject: [platform-dev] Re: get all highlight information (position + color)



I doubt anyone can help you -- not sure what it is you're talking about. Are you talking about the Output window? Or an editor? Which editor?


And why -- what is the use case you're trying to address?


Gj

On 10-4-2017 5:49, Peter Cheung wrote:

Hi

    May I know how to get all highlight information (position + color)?

thanks

from Peter