Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!
Bug 220057 - Members/Hierarchy-View: Create extensionpoint to plug in own actions into the contextmenu
Members/Hierarchy-View: Create extensionpoint to plug in own actions into the...
Status: VERIFIED FIXED
Product: java
Classification: Unclassified
Component: Navigation
7.3
PC Windows 7
: P3 (vote)
: 7.3
Assigned To: Tomas Zezula
issues@java
:
Depends on: 224499
Blocks:
  Show dependency treegraph
 
Reported: 2012-10-14 00:34 UTC by markiewb
Modified: 2013-02-12 09:10 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
:


Attachments
hardcoded actions in ElementNode (16.13 KB, image/png)
2012-10-14 00:35 UTC, markiewb
Details
Patch which appends actions from a layer.xml-path to the contextmenu of ElementNode/TypeNode (5.44 KB, patch)
2012-10-15 16:50 UTC, markiewb
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description markiewb 2012-10-14 00:34:13 UTC
[ JDK VERSION : 1.6.35 ]

From a discussion @ netdev-mailinglist:

Currently there is no way to extend the context menu of the members
+hierarchy view, because the current actions are hardcoded.

For example: 
org.netbeans.modules.java.navigation.ElementNode.getActions
(boolean):java
x.swing.Action[] (see screenshot from java.navigation)

So please create a extensionpoint to plug in own actions into the 
contextmenu of Members/Hierarchy-View.

FYI: There was a proposal to use 
<code>org.openide.util.Utilities.actionsForPath</code>

For example:<code>
 Action[] actions = org.openide.util.Utilities.actionsForPath(
                 "/de.orat.navigator.actions").toArray(new Action[]{});
        JPopupMenu menu = Utilities.actionsToPopup(actions, getLookup());
</code>
Comment 1 markiewb 2012-10-14 00:35:16 UTC
Created attachment 125926 [details]
hardcoded actions in ElementNode
Comment 2 Tomas Zezula 2012-10-15 08:25:52 UTC
What is the use case? Which actions should be added?
Defining the extension point is an API contract (both SPI the folder on system fs and API the content of Lookup) which needs to be kept compatible, the API should be created only for some use cases.
The actions from U.aFP() should be appended to the UI spec actions to prevent added actions to worse the discoverability o the UI spec actions.
Comment 3 markiewb 2012-10-15 16:50:06 UTC
Created attachment 125978 [details]
Patch which appends actions from a layer.xml-path to the contextmenu of ElementNode/TypeNode

Hello Tomas,

(In reply to comment #2)
> What is the use case? Which actions should be added?
> Defining the extension point is an API contract (both SPI the folder on system
> fs and API the content of Lookup) which needs to be kept compatible, the API
> should be created only for some use cases.

usecases are the integration of current/future actions which react on TreePathHandle like
* call hierarchy (when selected a method) (f.e. find usages is already supported)
* toggle method breakpoint (when selected a method)
* toggle class breakpoint (when selected a class)
* run/debug main method (when selected a class with a main method)
* run/debug test (when selected a class with testmethods or when selected a testmethod)
* add as profiling root (when selected a method)
* integration of the "Copy FQN" plugin http://plugins.netbeans.org/plugin/42975/ (when selected a method/class/other member)
* ...

> The actions from U.aFP() should be appended to the UI spec actions to prevent
> added actions to worse the discoverability o the UI spec actions.

yes, the actions could appended to the current actions. See the proposed patch attached to this issue.

Greetings markiewb
Comment 4 Tomas Zezula 2012-10-16 12:57:15 UTC
Fixed jet-main 8548c33070e3.
The folders are:

Navigation/Members/text/x-java/Actions
Navigation/Hierarchy/text/x-java/Actions
Comment 5 markiewb 2012-10-16 13:44:23 UTC
(In reply to comment #4)
> Fixed jet-main 8548c33070e3.
> The folders are:
> 
> Navigation/Members/text/x-java/Actions
> Navigation/Hierarchy/text/x-java/Actions

Thank you!
Comment 6 Tomas Zezula 2012-10-16 14:06:39 UTC
Not at all.
Comment 7 Quality Engineering 2012-10-17 02:02:28 UTC
Integrated into 'main-golden', will be available in build *201210170002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/8548c33070e3
User: Tomas Zezula <tzezula@netbeans.org>
Log: #220057:Members/Hierarchy-View: Create extensionpoint to plug in own actions into the contextmenu
Comment 8 markiewb 2012-12-28 08:50:13 UTC
(In reply to comment #4)
> Fixed jet-main 8548c33070e3.
> The folders are:
> 
> Navigation/Members/text/x-java/Actions
> Navigation/Hierarchy/text/x-java/Actions

Small correction: the valid extension points (taken from sourcecode) are

{{{
Navigator/Actions/Members/text/x-java
Navigator/Actions/Hierarchy/text/x-java
}}}

@Tomas: Is there any other API-spec-document to be updated?
Comment 9 Tomas Zezula 2013-01-04 17:22:10 UTC
Yes,
it should be updated in arch.xml.
I've created an issue #224499 for it.


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