Bug 80918 - There is no API to switch navigator panels programmatically
There is no API to switch navigator panels programmatically
Status: RESOLVED FIXED
Product: platform
Classification: Unclassified
Component: Navigator
5.x
All All
: P2 (vote)
: 6.x
Assigned To: David Simonek
issues@platform
plan60
: API, API_REVIEW_FAST
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2006-07-24 07:47 UTC by Vitaly Bychkov
Modified: 2008-12-22 19:33 UTC (History)
7 users (show)

See Also:
Issue Type: ENHANCEMENT
:


Attachments
diff of the impl (18.73 KB, patch)
2006-08-29 13:49 UTC, David Simonek
Details | Diff
new patch - requests integrated (26.10 KB, application/octet-stream)
2006-08-30 16:18 UTC, David Simonek
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Vitaly Bychkov 2006-07-24 07:47:23 UTC
There is no API to switch navigator panels programmatically.
In our project we have 2 main aspects:
source and diagramm.
We have multiview editor with 2 views(source and diagramm)
also we have navigator with 2 panels source(xml) and logical.
By specification we should switch navigator panel accordingly to editor
switches. More over navigator panels should be available to user at all
editor states to switch them manually.

So it is neccessary for us to switch navigator panels programmatically.
But there is no available navigator API to do it.
I can't use NavigatorLookupHint and different content types because all
navigator panels should be available to user.
Comment 1 David Simonek 2006-08-29 13:37:59 UTC
I have prepared API, implementation with tests, will attach and request fast
track API change.
Comment 2 David Simonek 2006-08-29 13:49:20 UTC
Created attachment 33359 [details]
diff of the impl
Comment 3 David Simonek 2006-08-29 13:52:01 UTC
New API is simple:

static NavigatorHandler.activatePanel (NavigatorPanel panel);

As there was no programmatic Navigator API (just SPI), I created new API class
NavigatorHandler and put the method here.

Note, there is missing apichange item, I'll add it soon.
Comment 4 Jaroslav Tulach 2006-08-29 20:31:06 UTC
Y01 Sometimes the distinction between api and spi is fuzzy, so these days I 
mostly ask whether some API will be used by the same group of people or by 
different ones. Imho, in this case only those who provide the 
NavigationPanel's can use the new NavigatorHandler interface. So it seems 
these APIs are probably for the same groups and as such should be in the same 
package.

Y02 Please extend arch.xml#usecases with description of how this is supposed 
to be used. I have read the test, but I am still not sure the usage is clear 
for me. #1 - only providers of NavigatorPanel can use the new method, #2 - 
when, how am I supposed to know my panel is currently active? 

Y03 api package refers to spi, in NetBeans we usually prevent that, but this 
may be obsoleted by Y01

Just my personal preference: Maybe there should be a way for a NavigatorPanel 
to "requestActive", this would require a listener or any other callback[1] on 
NavigatorPanel2 that the infrastructure would listen to.

[1] The possible ways to do callbacks are described at the bottom of:
http://openide.netbeans.org/tutorial/api-design.html
Comment 5 David Simonek 2006-08-30 12:08:44 UTC
Thanks for comments...

Y01: OK, no problem with that, I'll move into SPI. But why we have such strong
naming distinction then?

Y02: Yes, will do.
#1: anybody who can get instance of NavigatorPanel can use new method (which
typically is only NavigatorPanel provider)
#2: between calls to NavigatorPanel.panelActivated() and panelDeactivated()

"personal preference" (Y04?): I slightly prefer my original design, because it's
easier to use for clients, as there is no extra "attach" method which clients
must provide (possibly without knowing why). Just store instance of their
NavigatorPanel impl in constructor of their NavigatorPanel impl and use it to
call activatePanel when they want to. But I have no strong opinion on this.
Comment 6 David Simonek 2006-08-30 16:18:58 UTC
Created attachment 33424 [details]
new patch - requests integrated
Comment 7 David Simonek 2006-09-19 13:43:58 UTC
API integrated into main trunk, thanks for review and comments...

Directory /cvs/core/navigator/test/unit/src/org/netbeans/spi added to the repository
Directory /cvs/core/navigator/test/unit/src/org/netbeans/spi/navigator added to
the repository
cvs server: scheduling file
`test/unit/src/org/netbeans/spi/navigator/NavigatorHandlerTest.java' for addition
cvs server: scheduling file
`test/unit/src/org/netbeans/modules/navigator/resources/NavigatorHandlerTestProvider.xml'
for addition
cvs server: scheduling file
`src/org/netbeans/spi/navigator/NavigatorHandler.java' for addition
cvs server: use 'cvs commit' to add these files permanently
Checking in arch.xml;
/cvs/core/navigator/arch.xml,v  <--  arch.xml
new revision: 1.10; previous revision: 1.9
done
Checking in manifest.mf;
/cvs/core/navigator/manifest.mf,v  <--  manifest.mf
new revision: 1.6; previous revision: 1.5
done
Checking in apichanges.xml;
/cvs/core/navigator/apichanges.xml,v  <--  apichanges.xml
new revision: 1.4; previous revision: 1.3
done
Checking in src/org/netbeans/modules/navigator/NavigatorController.java;
/cvs/core/navigator/src/org/netbeans/modules/navigator/NavigatorController.java,v
 <--  NavigatorController.java
new revision: 1.12; previous revision: 1.11
done
Checking in src/org/netbeans/modules/navigator/NavigatorTC.java;
/cvs/core/navigator/src/org/netbeans/modules/navigator/NavigatorTC.java,v  <-- 
NavigatorTC.java
new revision: 1.10; previous revision: 1.9
done
RCS file: /cvs/core/navigator/src/org/netbeans/spi/navigator/NavigatorHandler.java,v
done
Checking in src/org/netbeans/spi/navigator/NavigatorHandler.java;
/cvs/core/navigator/src/org/netbeans/spi/navigator/NavigatorHandler.java,v  <--
 NavigatorHandler.java
initial revision: 1.1
done
RCS file:
/cvs/core/navigator/test/unit/src/org/netbeans/spi/navigator/NavigatorHandlerTest.java,v
done
Checking in test/unit/src/org/netbeans/spi/navigator/NavigatorHandlerTest.java;
/cvs/core/navigator/test/unit/src/org/netbeans/spi/navigator/NavigatorHandlerTest.java,v
 <--  NavigatorHandlerTest.java
initial revision: 1.1
done
Checking in nbproject/project.properties;
/cvs/core/navigator/nbproject/project.properties,v  <--  project.properties
new revision: 1.8; previous revision: 1.7
done
RCS file:
/cvs/core/navigator/test/unit/src/org/netbeans/modules/navigator/resources/NavigatorHandlerTestProvider.xml,v
done
Checking in
test/unit/src/org/netbeans/modules/navigator/resources/NavigatorHandlerTestProvider.xml;
/cvs/core/navigator/test/unit/src/org/netbeans/modules/navigator/resources/NavigatorHandlerTestProvider.xml,v
 <--  NavigatorHandlerTestProvider.xml
initial revision: 1.1
done


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