NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

Programmatically doing 'Find Usages"
Goto page 1, 2  Next
 
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Developers
View previous topic :: View next topic  
Author Message
sundud



Joined: 14 Nov 2016
Posts: 9

PostPosted: Mon Nov 14, 2016 10:39 pm    Post subject: Programmatically doing 'Find Usages" Reply with quote

Hi Folks,

Pardon my newbie questions:

Background: i am writing a new search and recommend plugin for Java development (please correct if this is not the right forum)

1. Specifically, i am requesting suggestions for sample/open source code for "Find Usages". I wish to provide some additional user action based on the search results.

2. Once the user clicks on a particular field (i have that working using the sample CopyFQNAction plugin), i would like to display a new button.

Use case:

User selects any java.util.logging.Logger.log() statements in a Java file and the code should find all instances of similar log() statements in all the open projects (same as what is being done by 'Find Usages'. However, rather than display these in the Usage output window, i want to analyze the statement and provide logging recommendations to the user.

Thanks,
Sunil
Back to top
geertjan



Joined: 22 Jan 2014
Posts: 979

PostPosted: Mon Nov 14, 2016 10:41 pm    Post subject: Programmatically doing 'Find Usages" Reply with quote

Could you not, instead of the below, have a menu item in the Usage output window to process the statements?

I.e., after the usages are displayed, you'd have a way of accessing those usages in the Usage output window and then do something with them?

Gj

On 14-11-2016 23:38, Sunil Dudani wrote:

Quote:

Hi Folks,

Pardon my newbie questions:

Background: i am writing a new search and recommend plugin for Java development (please correct if this is not the right forum)

1. Specifically, i am requesting suggestions for sample/open source code for "Find Usages". I wish to provide some additional user action based on the search results.

2. Once the user clicks on a particular field (i have that working using the sample CopyFQNAction plugin), i would like to display a new button.

Use case:

User selects any java.util.logging.Logger.log() statements in a Java file and the code should find all instances of similar log() statements in all the open projects (same as what is being done by 'Find Usages'. However, rather than display these in the Usage output window, i want to analyze the statement and provide logging recommendations to the user.

Thanks,
Sunil
Back to top
sundud



Joined: 14 Nov 2016
Posts: 9

PostPosted: Mon Nov 14, 2016 11:04 pm    Post subject: Programmatically doing 'Find Usages" Reply with quote

I want to provide a plugin specific 'Log Recommendations' menu item rather than piggy back on the 'Find Usage'.

Thanks

On 11/14/2016 2:40 PM, geertjan wielenga wrote:

Quote:

Could you not, instead of the below, have a menu item in the Usage output window to process the statements?

I.e., after the usages are displayed, you'd have a way of accessing those usages in the Usage output window and then do something with them?

Gj

On 14-11-2016 23:38, Sunil Dudani wrote:

Quote:

Hi Folks,

Pardon my newbie questions:

Background: i am writing a new search and recommend plugin for Java development (please correct if this is not the right forum)

1. Specifically, i am requesting suggestions for sample/open source code for "Find Usages". I wish to provide some additional user action based on the search results.

2. Once the user clicks on a particular field (i have that working using the sample CopyFQNAction plugin), i would like to display a new button.

Use case:

User selects any java.util.logging.Logger.log() statements in a Java file and the code should find all instances of similar log() statements in all the open projects (same as what is being done by 'Find Usages'. However, rather than display these in the Usage output window, i want to analyze the statement and provide logging recommendations to the user.

Thanks,
Sunil

Back to top
geertjan



Joined: 22 Jan 2014
Posts: 979

PostPosted: Mon Nov 14, 2016 11:05 pm    Post subject: Programmatically doing 'Find Usages" Reply with quote

You're going to have to provide more info, sorry. When/where/how will that menu item be shown, what's the workflow for using it.

Gj

On 15-11-2016 0:03, Sunil Dudani wrote:

Quote:

I want to provide a plugin specific 'Log Recommendations' menu item rather than piggy back on the 'Find Usage'.

Thanks

On 11/14/2016 2:40 PM, geertjan wielenga wrote:

Quote:

Could you not, instead of the below, have a menu item in the Usage output window to process the statements?

I.e., after the usages are displayed, you'd have a way of accessing those usages in the Usage output window and then do something with them?

Gj

On 14-11-2016 23:38, Sunil Dudani wrote:

Quote:

Hi Folks,

Pardon my newbie questions:

Background: i am writing a new search and recommend plugin for Java development (please correct if this is not the right forum)

1. Specifically, i am requesting suggestions for sample/open source code for "Find Usages". I wish to provide some additional user action based on the search results.

2. Once the user clicks on a particular field (i have that working using the sample CopyFQNAction plugin), i would like to display a new button.

Use case:

User selects any java.util.logging.Logger.log() statements in a Java file and the code should find all instances of similar log() statements in all the open projects (same as what is being done by 'Find Usages'. However, rather than display these in the Usage output window, i want to analyze the statement and provide logging recommendations to the user.

Thanks,
Sunil


Back to top
sundud



Joined: 14 Nov 2016
Posts: 9

PostPosted: Mon Nov 14, 2016 11:12 pm    Post subject: Programmatically doing 'Find Usages" Reply with quote

Note that i want the user to be able to select any Logger instance variable used in a Class, not just the Logger constructor. A 'Find Usage' on the instance variable does not search for usages of the variable Class across modules.

I can get the Class name when the user selects (put the cursor) the variable by comparing the Element.asType().toString() to "java.util.logging.Logger"

Thanks

On 11/14/2016 2:40 PM, geertjan wielenga wrote:

Quote:

Could you not, instead of the below, have a menu item in the Usage output window to process the statements?

I.e., after the usages are displayed, you'd have a way of accessing those usages in the Usage output window and then do something with them?

Gj

On 14-11-2016 23:38, Sunil Dudani wrote:

Quote:

Hi Folks,

Pardon my newbie questions:

Background: i am writing a new search and recommend plugin for Java development (please correct if this is not the right forum)

1. Specifically, i am requesting suggestions for sample/open source code for "Find Usages". I wish to provide some additional user action based on the search results.

2. Once the user clicks on a particular field (i have that working using the sample CopyFQNAction plugin), i would like to display a new button.

Use case:

User selects any java.util.logging.Logger.log() statements in a Java file and the code should find all instances of similar log() statements in all the open projects (same as what is being done by 'Find Usages'. However, rather than display these in the Usage output window, i want to analyze the statement and provide logging recommendations to the user.

Thanks,
Sunil

Back to top
geertjan



Joined: 22 Jan 2014
Posts: 979

PostPosted: Mon Nov 14, 2016 11:13 pm    Post subject: Programmatically doing 'Find Usages" Reply with quote

https://blogs.oracle.com/geertjan/entry/custom_declarative_hints_in_netbeans

https://blogs.oracle.com/geertjan/entry/oh_no_vector

Gj

On 15-11-2016 0:11, Sunil Dudani wrote:

Quote:

Note that i want the user to be able to select any Logger instance variable used in a Class, not just the Logger constructor. A 'Find Usage' on the instance variable does not search for usages of the variable Class across modules.

I can get the Class name when the user selects (put the cursor) the variable by comparing the Element.asType().toString() to "java.util.logging.Logger"

Thanks

On 11/14/2016 2:40 PM, geertjan wielenga wrote:

Quote:

Could you not, instead of the below, have a menu item in the Usage output window to process the statements?

I.e., after the usages are displayed, you'd have a way of accessing those usages in the Usage output window and then do something with them?

Gj

On 14-11-2016 23:38, Sunil Dudani wrote:

Quote:

Hi Folks,

Pardon my newbie questions:

Background: i am writing a new search and recommend plugin for Java development (please correct if this is not the right forum)

1. Specifically, i am requesting suggestions for sample/open source code for "Find Usages". I wish to provide some additional user action based on the search results.

2. Once the user clicks on a particular field (i have that working using the sample CopyFQNAction plugin), i would like to display a new button.

Use case:

User selects any java.util.logging.Logger.log() statements in a Java file and the code should find all instances of similar log() statements in all the open projects (same as what is being done by 'Find Usages'. However, rather than display these in the Usage output window, i want to analyze the statement and provide logging recommendations to the user.

Thanks,
Sunil


Back to top
geertjan



Joined: 22 Jan 2014
Posts: 979

PostPosted: Mon Nov 14, 2016 11:17 pm    Post subject: Programmatically doing 'Find Usages" Reply with quote

PS: it would really help to know what you are trying to achieve -- what does this mean: "analyze the statement and provide logging recommendations to the user". What kind of analysis and logging recommendations are you talking about?

On 15-11-2016 0:13, geertjan wielenga wrote:

Quote:

https://blogs.oracle.com/geertjan/entry/custom_declarative_hints_in_netbeans

https://blogs.oracle.com/geertjan/entry/oh_no_vector

Gj

On 15-11-2016 0:11, Sunil Dudani wrote:

Quote:

Note that i want the user to be able to select any Logger instance variable used in a Class, not just the Logger constructor. A 'Find Usage' on the instance variable does not search for usages of the variable Class across modules.

I can get the Class name when the user selects (put the cursor) the variable by comparing the Element.asType().toString() to "java.util.logging.Logger"

Thanks

On 11/14/2016 2:40 PM, geertjan wielenga wrote:

Quote:

Could you not, instead of the below, have a menu item in the Usage output window to process the statements?

I.e., after the usages are displayed, you'd have a way of accessing those usages in the Usage output window and then do something with them?

Gj

On 14-11-2016 23:38, Sunil Dudani wrote:

Quote:

Hi Folks,

Pardon my newbie questions:

Background: i am writing a new search and recommend plugin for Java development (please correct if this is not the right forum)

1. Specifically, i am requesting suggestions for sample/open source code for "Find Usages". I wish to provide some additional user action based on the search results.

2. Once the user clicks on a particular field (i have that working using the sample CopyFQNAction plugin), i would like to display a new button.

Use case:

User selects any java.util.logging.Logger.log() statements in a Java file and the code should find all instances of similar log() statements in all the open projects (same as what is being done by 'Find Usages'. However, rather than display these in the Usage output window, i want to analyze the statement and provide logging recommendations to the user.

Thanks,
Sunil



Back to top
satory



Joined: 28 May 2013
Posts: 23

PostPosted: Mon Nov 14, 2016 11:20 pm    Post subject: Programmatically doing 'Find Usages" Reply with quote

Sunil,
Are you trying to do something like this?
http://www.eclipse.org/recommenders/

But in Netbeans?

Regards

John
Quote:
On 14 Nov 2016, at 23:16, geertjan wielenga <address-removed ([email]address-removed[/email])> wrote:
PS: it would really help to know what you are trying to achieve -- what does this mean: "analyze the statement and provide logging recommendations to the user". What kind of analysis and logging recommendations are you talking about? On 15-11-2016 0:13, geertjan wielenga wrote:
Quote:
https://blogs.oracle.com/geertjan/entry/custom_declarative_hints_in_netbeans https://blogs.oracle.com/geertjan/entry/oh_no_vector Gj On 15-11-2016 0:11, Sunil Dudani wrote:
Quote:

Note that i want the user to be able to select any Logger instance variable used in a Class, not just the Logger constructor. A 'Find Usage' on the instance variable does not search for usages of the variable Class across modules.
I can get the Class name when the user selects (put the cursor) the variable by comparing the Element.asType().toString() to "java.util.logging.Logger"
Thanks On 11/14/2016 2:40 PM, geertjan wielenga wrote:
Quote:
Could you not, instead of the below, have a menu item in the Usage output window to process the statements? I.e., after the usages are displayed, you'd have a way of accessing those usages in the Usage output window and then do something with them? Gj On 14-11-2016 23:38, Sunil Dudani wrote:
Quote:

Hi Folks, Pardon my newbie questions: Background: i am writing a new search and recommend plugin for Java development (please correct if this is not the right forum) 1. Specifically, i am requesting suggestions for sample/open source code for "Find Usages". I wish to provide some additional user action based on the search results. 2. Once the user clicks on a particular field (i have that working using the sample CopyFQNAction plugin), i would like to display a new button. Use case: User selects any java.util.logging.Logger.log() statements in a Java file and the code should find all instances of similar log() statements in all the open projects (same as what is being done by 'Find Usages'. However, rather than display these in the Usage output window, i want to analyze the statement and provide logging recommendations to the user. Thanks, Sunil


Back to top
geertjan



Joined: 22 Jan 2014
Posts: 979

PostPosted: Mon Nov 14, 2016 11:21 pm    Post subject: Programmatically doing 'Find Usages" Reply with quote

https://blogs.oracle.com/geertjan/entry/eclipse_recommenders_for_netbeans_ide

https://blogs.oracle.com/geertjan/entry/eclipse_recommenders_for_netbeans_ide1

Gj

On 15-11-2016 0:19, John McDonnell wrote:

Quote:
Sunil,
Are you trying to do something like this?
http://www.eclipse.org/recommenders/

But in Netbeans?

Regards

John
Quote:
On 14 Nov 2016, at 23:16, geertjan wielenga <address-removed ([email]address-removed[/email])> wrote:
PS: it would really help to know what you are trying to achieve -- what does this mean: "analyze the statement and provide logging recommendations to the user". What kind of analysis and logging recommendations are you talking about? On 15-11-2016 0:13, geertjan wielenga wrote:
Quote:
https://blogs.oracle.com/geertjan/entry/custom_declarative_hints_in_netbeans https://blogs.oracle.com/geertjan/entry/oh_no_vector Gj On 15-11-2016 0:11, Sunil Dudani wrote:
Quote:

Note that i want the user to be able to select any Logger instance variable used in a Class, not just the Logger constructor. A 'Find Usage' on the instance variable does not search for usages of the variable Class across modules.
I can get the Class name when the user selects (put the cursor) the variable by comparing the Element.asType().toString() to "java.util.logging.Logger"
Thanks On 11/14/2016 2:40 PM, geertjan wielenga wrote:
Quote:
Could you not, instead of the below, have a menu item in the Usage output window to process the statements? I.e., after the usages are displayed, you'd have a way of accessing those usages in the Usage output window and then do something with them? Gj On 14-11-2016 23:38, Sunil Dudani wrote:
Quote:

Hi Folks, Pardon my newbie questions: Background: i am writing a new search and recommend plugin for Java development (please correct if this is not the right forum) 1. Specifically, i am requesting suggestions for sample/open source code for "Find Usages". I wish to provide some additional user action based on the search results. 2. Once the user clicks on a particular field (i have that working using the sample CopyFQNAction plugin), i would like to display a new button. Use case: User selects any java.util.logging.Logger.log() statements in a Java file and the code should find all instances of similar log() statements in all the open projects (same as what is being done by 'Find Usages'. However, rather than display these in the Usage output window, i want to analyze the statement and provide logging recommendations to the user. Thanks, Sunil




Back to top
sundud



Joined: 14 Nov 2016
Posts: 9

PostPosted: Mon Nov 14, 2016 11:22 pm    Post subject: Programmatically doing 'Find Usages" Reply with quote

Curious, but i am looking to develop a plugin and while i have outlined the basic use case below, it is specific for a company/product internal functionality.

It is not something that i can disclose in an open forum.
The links below are blogs on the some related functionality of NB, which are great but do not serve my purpose.

On 11/14/2016 3:16 PM, geertjan wielenga wrote:

Quote:

PS: it would really help to know what you are trying to achieve -- what does this mean: "analyze the statement and provide logging recommendations to the user". What kind of analysis and logging recommendations are you talking about?

On 15-11-2016 0:13, geertjan wielenga wrote:

Quote:

https://blogs.oracle.com/geertjan/entry/custom_declarative_hints_in_netbeans

https://blogs.oracle.com/geertjan/entry/oh_no_vector

Gj

On 15-11-2016 0:11, Sunil Dudani wrote:

Quote:

Note that i want the user to be able to select any Logger instance variable used in a Class, not just the Logger constructor. A 'Find Usage' on the instance variable does not search for usages of the variable Class across modules.

I can get the Class name when the user selects (put the cursor) the variable by comparing the Element.asType().toString() to "java.util.logging.Logger"

Thanks

On 11/14/2016 2:40 PM, geertjan wielenga wrote:

Quote:

Could you not, instead of the below, have a menu item in the Usage output window to process the statements?

I.e., after the usages are displayed, you'd have a way of accessing those usages in the Usage output window and then do something with them?

Gj

On 14-11-2016 23:38, Sunil Dudani wrote:

Quote:

Hi Folks,

Pardon my newbie questions:

Background: i am writing a new search and recommend plugin for Java development (please correct if this is not the right forum)

1. Specifically, i am requesting suggestions for sample/open source code for "Find Usages". I wish to provide some additional user action based on the search results.

2. Once the user clicks on a particular field (i have that working using the sample CopyFQNAction plugin), i would like to display a new button.

Use case:

User selects any java.util.logging.Logger.log() statements in a Java file and the code should find all instances of similar log() statements in all the open projects (same as what is being done by 'Find Usages'. However, rather than display these in the Usage output window, i want to analyze the statement and provide logging recommendations to the user.

Thanks,
Sunil




Back to top
geertjan



Joined: 22 Jan 2014
Posts: 979

PostPosted: Mon Nov 14, 2016 11:24 pm    Post subject: Programmatically doing 'Find Usages" Reply with quote

We can't help without knowing what it is you want to achieve.

At least you need to be able to explain what kind of analysis and recommendations are applicable, otherwise how can we help suggest where it fits into NetBeans? Simply creating a menu item is normally not the right or optimal way to extend NetBeans -- depending on what you actually need to do, you will need to plug into a specific part of NetBeans to get the data that you need.

Gj

On 15-11-2016 0:21, Sunil Dudani wrote:

Quote:

Curious, but i am looking to develop a plugin and while i have outlined the basic use case below, it is specific for a company/product internal functionality.

It is not something that i can disclose in an open forum.
The links below are blogs on the some related functionality of NB, which are great but do not serve my purpose.

On 11/14/2016 3:16 PM, geertjan wielenga wrote:

Quote:

PS: it would really help to know what you are trying to achieve -- what does this mean: "analyze the statement and provide logging recommendations to the user". What kind of analysis and logging recommendations are you talking about?

On 15-11-2016 0:13, geertjan wielenga wrote:

Quote:

https://blogs.oracle.com/geertjan/entry/custom_declarative_hints_in_netbeans

https://blogs.oracle.com/geertjan/entry/oh_no_vector

Gj

On 15-11-2016 0:11, Sunil Dudani wrote:

Quote:

Note that i want the user to be able to select any Logger instance variable used in a Class, not just the Logger constructor. A 'Find Usage' on the instance variable does not search for usages of the variable Class across modules.

I can get the Class name when the user selects (put the cursor) the variable by comparing the Element.asType().toString() to "java.util.logging.Logger"

Thanks

On 11/14/2016 2:40 PM, geertjan wielenga wrote:

Quote:

Could you not, instead of the below, have a menu item in the Usage output window to process the statements?

I.e., after the usages are displayed, you'd have a way of accessing those usages in the Usage output window and then do something with them?

Gj

On 14-11-2016 23:38, Sunil Dudani wrote:

Quote:

Hi Folks,

Pardon my newbie questions:

Background: i am writing a new search and recommend plugin for Java development (please correct if this is not the right forum)

1. Specifically, i am requesting suggestions for sample/open source code for "Find Usages". I wish to provide some additional user action based on the search results.

2. Once the user clicks on a particular field (i have that working using the sample CopyFQNAction plugin), i would like to display a new button.

Use case:

User selects any java.util.logging.Logger.log() statements in a Java file and the code should find all instances of similar log() statements in all the open projects (same as what is being done by 'Find Usages'. However, rather than display these in the Usage output window, i want to analyze the statement and provide logging recommendations to the user.

Thanks,
Sunil





Back to top
sundud



Joined: 14 Nov 2016
Posts: 9

PostPosted: Mon Nov 14, 2016 11:26 pm    Post subject: Programmatically doing 'Find Usages" Reply with quote

Thanks John.
Not so much of a recommendation for new code but analytics for existing code for all usages of the various Logger methods.
Sunil

On 11/14/2016 3:19 PM, John McDonnell wrote:

Quote:
Sunil,
Are you trying to do something like this?
http://www.eclipse.org/recommenders/

But in Netbeans?

Regards

John
Quote:
On 14 Nov 2016, at 23:16, geertjan wielenga <address-removed ([email]address-removed[/email])> wrote:
PS: it would really help to know what you are trying to achieve -- what does this mean: "analyze the statement and provide logging recommendations to the user". What kind of analysis and logging recommendations are you talking about? On 15-11-2016 0:13, geertjan wielenga wrote:
Quote:
https://blogs.oracle.com/geertjan/entry/custom_declarative_hints_in_netbeans https://blogs.oracle.com/geertjan/entry/oh_no_vector Gj On 15-11-2016 0:11, Sunil Dudani wrote:
Quote:

Note that i want the user to be able to select any Logger instance variable used in a Class, not just the Logger constructor. A 'Find Usage' on the instance variable does not search for usages of the variable Class across modules.
I can get the Class name when the user selects (put the cursor) the variable by comparing the Element.asType().toString() to "java.util.logging.Logger"
Thanks On 11/14/2016 2:40 PM, geertjan wielenga wrote:
Quote:
Could you not, instead of the below, have a menu item in the Usage output window to process the statements? I.e., after the usages are displayed, you'd have a way of accessing those usages in the Usage output window and then do something with them? Gj On 14-11-2016 23:38, Sunil Dudani wrote:
Quote:

Hi Folks, Pardon my newbie questions: Background: i am writing a new search and recommend plugin for Java development (please correct if this is not the right forum) 1. Specifically, i am requesting suggestions for sample/open source code for "Find Usages". I wish to provide some additional user action based on the search results. 2. Once the user clicks on a particular field (i have that working using the sample CopyFQNAction plugin), i would like to display a new button. Use case: User selects any java.util.logging.Logger.log() statements in a Java file and the code should find all instances of similar log() statements in all the open projects (same as what is being done by 'Find Usages'. However, rather than display these in the Usage output window, i want to analyze the statement and provide logging recommendations to the user. Thanks, Sunil




Back to top
sundud



Joined: 14 Nov 2016
Posts: 9

PostPosted: Mon Nov 14, 2016 11:31 pm    Post subject: Programmatically doing 'Find Usages" Reply with quote

Well, the logging recommendations have nothing to do with Netbeans and are product specific. I am just using Netbeans to provide a UI and it APIs to our recommendations. If you can just point me to the appropriate Netbeans APIs that i can use for this, it would suffice.
Thanks.

On 11/14/2016 3:23 PM, geertjan wielenga wrote:

Quote:

We can't help without knowing what it is you want to achieve.

At least you need to be able to explain what kind of analysis and recommendations are applicable, otherwise how can we help suggest where it fits into NetBeans? Simply creating a menu item is normally not the right or optimal way to extend NetBeans -- depending on what you actually need to do, you will need to plug into a specific part of NetBeans to get the data that you need.

Gj

On 15-11-2016 0:21, Sunil Dudani wrote:

Quote:

Curious, but i am looking to develop a plugin and while i have outlined the basic use case below, it is specific for a company/product internal functionality.

It is not something that i can disclose in an open forum.
The links below are blogs on the some related functionality of NB, which are great but do not serve my purpose.

On 11/14/2016 3:16 PM, geertjan wielenga wrote:

Quote:

PS: it would really help to know what you are trying to achieve -- what does this mean: "analyze the statement and provide logging recommendations to the user". What kind of analysis and logging recommendations are you talking about?

On 15-11-2016 0:13, geertjan wielenga wrote:

Quote:

https://blogs.oracle.com/geertjan/entry/custom_declarative_hints_in_netbeans

https://blogs.oracle.com/geertjan/entry/oh_no_vector

Gj

On 15-11-2016 0:11, Sunil Dudani wrote:

Quote:

Note that i want the user to be able to select any Logger instance variable used in a Class, not just the Logger constructor. A 'Find Usage' on the instance variable does not search for usages of the variable Class across modules.

I can get the Class name when the user selects (put the cursor) the variable by comparing the Element.asType().toString() to "java.util.logging.Logger"

Thanks

On 11/14/2016 2:40 PM, geertjan wielenga wrote:

Quote:

Could you not, instead of the below, have a menu item in the Usage output window to process the statements?

I.e., after the usages are displayed, you'd have a way of accessing those usages in the Usage output window and then do something with them?

Gj

On 14-11-2016 23:38, Sunil Dudani wrote:

Quote:

Hi Folks,

Pardon my newbie questions:

Background: i am writing a new search and recommend plugin for Java development (please correct if this is not the right forum)

1. Specifically, i am requesting suggestions for sample/open source code for "Find Usages". I wish to provide some additional user action based on the search results.

2. Once the user clicks on a particular field (i have that working using the sample CopyFQNAction plugin), i would like to display a new button.

Use case:

User selects any java.util.logging.Logger.log() statements in a Java file and the code should find all instances of similar log() statements in all the open projects (same as what is being done by 'Find Usages'. However, rather than display these in the Usage output window, i want to analyze the statement and provide logging recommendations to the user.

Thanks,
Sunil






Back to top
sundud



Joined: 14 Nov 2016
Posts: 9

PostPosted: Tue Nov 15, 2016 12:43 am    Post subject: Programmatically doing 'Find Usages" Reply with quote

Have i got the wrong alias? since this is a plugin question and i am not trying to extend NetBeans. And is address-removed ([email]address-removed[/email]) the right alias.
Thanks.

On 11/14/2016 3:23 PM, geertjan wielenga wrote:

Quote:

We can't help without knowing what it is you want to achieve.

At least you need to be able to explain what kind of analysis and recommendations are applicable, otherwise how can we help suggest where it fits into NetBeans? Simply creating a menu item is normally not the right or optimal way to extend NetBeans -- depending on what you actually need to do, you will need to plug into a specific part of NetBeans to get the data that you need.

Gj

On 15-11-2016 0:21, Sunil Dudani wrote:

Quote:

Curious, but i am looking to develop a plugin and while i have outlined the basic use case below, it is specific for a company/product internal functionality.

It is not something that i can disclose in an open forum.
The links below are blogs on the some related functionality of NB, which are great but do not serve my purpose.

On 11/14/2016 3:16 PM, geertjan wielenga wrote:

Quote:

PS: it would really help to know what you are trying to achieve -- what does this mean: "analyze the statement and provide logging recommendations to the user". What kind of analysis and logging recommendations are you talking about?

On 15-11-2016 0:13, geertjan wielenga wrote:

Quote:

https://blogs.oracle.com/geertjan/entry/custom_declarative_hints_in_netbeans

https://blogs.oracle.com/geertjan/entry/oh_no_vector

Gj

On 15-11-2016 0:11, Sunil Dudani wrote:

Quote:

Note that i want the user to be able to select any Logger instance variable used in a Class, not just the Logger constructor. A 'Find Usage' on the instance variable does not search for usages of the variable Class across modules.

I can get the Class name when the user selects (put the cursor) the variable by comparing the Element.asType().toString() to "java.util.logging.Logger"

Thanks

On 11/14/2016 2:40 PM, geertjan wielenga wrote:

Quote:

Could you not, instead of the below, have a menu item in the Usage output window to process the statements?

I.e., after the usages are displayed, you'd have a way of accessing those usages in the Usage output window and then do something with them?

Gj

On 14-11-2016 23:38, Sunil Dudani wrote:

Quote:

Hi Folks,

Pardon my newbie questions:

Background: i am writing a new search and recommend plugin for Java development (please correct if this is not the right forum)

1. Specifically, i am requesting suggestions for sample/open source code for "Find Usages". I wish to provide some additional user action based on the search results.

2. Once the user clicks on a particular field (i have that working using the sample CopyFQNAction plugin), i would like to display a new button.

Use case:

User selects any java.util.logging.Logger.log() statements in a Java file and the code should find all instances of similar log() statements in all the open projects (same as what is being done by 'Find Usages'. However, rather than display these in the Usage output window, i want to analyze the statement and provide logging recommendations to the user.

Thanks,
Sunil






Back to top
geertjan



Joined: 22 Jan 2014
Posts: 979

PostPosted: Tue Nov 15, 2016 5:08 am    Post subject: Programmatically doing 'Find Usages" Reply with quote

On 15-11-2016 0:31, Sunil Dudani wrote:

Quote:

Well, the logging recommendations have nothing to do with Netbeans and are product specific. I am just using Netbeans to provide a UI and it APIs to our recommendations. If you can just point me to the appropriate Netbeans APIs that i can use for this, it would suffice.

It really depends on the workflow -- somehow you need to communicate with us what you're trying to achieve, otherwise it's impossible to advise.

Gj

Quote:

Thanks.

On 11/14/2016 3:23 PM, geertjan wielenga wrote:

Quote:

We can't help without knowing what it is you want to achieve.

At least you need to be able to explain what kind of analysis and recommendations are applicable, otherwise how can we help suggest where it fits into NetBeans? Simply creating a menu item is normally not the right or optimal way to extend NetBeans -- depending on what you actually need to do, you will need to plug into a specific part of NetBeans to get the data that you need.

Gj

On 15-11-2016 0:21, Sunil Dudani wrote:

Quote:

Curious, but i am looking to develop a plugin and while i have outlined the basic use case below, it is specific for a company/product internal functionality.

It is not something that i can disclose in an open forum.
The links below are blogs on the some related functionality of NB, which are great but do not serve my purpose.

On 11/14/2016 3:16 PM, geertjan wielenga wrote:

Quote:

PS: it would really help to know what you are trying to achieve -- what does this mean: "analyze the statement and provide logging recommendations to the user". What kind of analysis and logging recommendations are you talking about?

On 15-11-2016 0:13, geertjan wielenga wrote:

Quote:

https://blogs.oracle.com/geertjan/entry/custom_declarative_hints_in_netbeans

https://blogs.oracle.com/geertjan/entry/oh_no_vector

Gj

On 15-11-2016 0:11, Sunil Dudani wrote:

Quote:

Note that i want the user to be able to select any Logger instance variable used in a Class, not just the Logger constructor. A 'Find Usage' on the instance variable does not search for usages of the variable Class across modules.

I can get the Class name when the user selects (put the cursor) the variable by comparing the Element.asType().toString() to "java.util.logging.Logger"

Thanks

On 11/14/2016 2:40 PM, geertjan wielenga wrote:

Quote:

Could you not, instead of the below, have a menu item in the Usage output window to process the statements?

I.e., after the usages are displayed, you'd have a way of accessing those usages in the Usage output window and then do something with them?

Gj

On 14-11-2016 23:38, Sunil Dudani wrote:

Quote:

Hi Folks,

Pardon my newbie questions:

Background: i am writing a new search and recommend plugin for Java development (please correct if this is not the right forum)

1. Specifically, i am requesting suggestions for sample/open source code for "Find Usages". I wish to provide some additional user action based on the search results.

2. Once the user clicks on a particular field (i have that working using the sample CopyFQNAction plugin), i would like to display a new button.

Use case:

User selects any java.util.logging.Logger.log() statements in a Java file and the code should find all instances of similar log() statements in all the open projects (same as what is being done by 'Find Usages'. However, rather than display these in the Usage output window, i want to analyze the statement and provide logging recommendations to the user.

Thanks,
Sunil







Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Developers All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo