Skip to main content



      Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Content not displayed with Common Navigator
Content not displayed with Common Navigator [message #453167] Mon, 24 July 2006 06:01 Go to next message
Eclipse UserFriend
Hi,

I've been trying to implement a navigator view using documentation found
here
:http://scribbledideas.blogspot.com/2006/05/building-common- navigator-based-viewer_22.html.

I followed the different steps, and I created navigatorContent extension
and added a ITreeContentProvider. When i debug my code i see that
ContentProvider.getElements() method is called and I return a small arrays
of ebjects. BUT, nothing is displayed in the tree. Also it seems that the
LabelProvider is not called for the object i returned in content provider.

May be i'm wrong with triggerPoint or possibleChildren extensions, i don't
really know how to setup them as i setup the
viewerContentBinding.contentExtension.isRoot to true.

Any ideas or suggestions are welcome.
Re: Content not displayed with Common Navigator [message #453266 is a reply to message #453167] Tue, 25 July 2006 05:43 Go to previous messageGo to next message
Eclipse UserFriend
Hi Nico,

I got a similar problem with the CNF.

I want to provide content (and only my content) directly to the top level
of the navigator. Therefore I need to access the root. It seems that it is
not straightforward what the originally root is, or how to set it.

When I run my plugin containing the common navigator as an eclipse
application,
everything works fine. I found out that the root is an IWorkspaceRoot but
I've got no idea who told this to my navigator nor when or where. This
workaround helps me for the moment but is not satisfying in the long run.
The dependencies to org.eclipse.core.resources polute my plugin structure.

Furthermore when I now run the same code as an RCP application, the root
is null. Seems that another plugin maybe from the eclipse sdk had set the
root element to an IWorkspaceRoot.
With a null-root-element, no content is displayed in the navigator. My
content providers are accessed in the correct way (getElements() when you
enable 'isRoot') but my returned elements are not shown. I think, that my
context extension couldn't be enabled, since there is no way to extend a
null-content.

So I would be happy for any replies, which could help me to provide
content at the root level of the navigator. Eighter by changing the root
element to an accessible type or by having an idea how to define the
extensions to provide a trigger point or enablement for null-elements.

thank you for answers
Re: Content not displayed with Common Navigator [message #453267 is a reply to message #453266] Tue, 25 July 2006 07:20 Go to previous messageGo to next message
Eclipse UserFriend
I think our problem is solved.
There is a comment from anonymous at Michael Elder's blog:
http://www.blogger.com/comment.g?blogID=28446986&postID= 114815241695120152
He / She wrotes:

<<<<<<
One more comment. "RCP" replated exception in Eclipse 3.2RC7 is not
thrown, but navigator is always empty. Reason is that Null is setted as
initial inpu contents. Override method in your WorkbenchAdvisor to provide
initial contents:

@Override
public IAdaptable getDefaultPageInput() {
return ResourcesPlugin.getWorkspace().getRoot();
}

Make sure you completely clear your runtime workspace(also .metadata) to
force Eclipse call this method.
>>>>>>>

The first impression is great, I'm going to work on more complex content
providers.
So the navigator-root is most likely the current workbench-page-input.
Set it if it's null.
Re: Content not displayed with Common Navigator [message #453320 is a reply to message #453267] Wed, 26 July 2006 03:54 Go to previous messageGo to next message
Eclipse UserFriend
Solved too !

Thanks for having seen this workaround , even if I don't really know what
it does ...

Sebastian Fuchs wrote:

> I think our problem is solved.
> There is a comment from anonymous at Michael Elder's blog:
> http://www.blogger.com/comment.g?blogID=28446986&postID= 114815241695120152
> He / She wrotes:

> <<<<<<
> One more comment. "RCP" replated exception in Eclipse 3.2RC7 is not
> thrown, but navigator is always empty. Reason is that Null is setted as
> initial inpu contents. Override method in your WorkbenchAdvisor to provide
> initial contents:

> @Override
> public IAdaptable getDefaultPageInput() {
> return ResourcesPlugin.getWorkspace().getRoot();
> }

> Make sure you completely clear your runtime workspace(also .metadata) to
> force Eclipse call this method.
>>>>>>>>

> The first impression is great, I'm going to work on more complex content
> providers.
> So the navigator-root is most likely the current workbench-page-input.
> Set it if it's null.
Re: Content not displayed with Common Navigator [message #453349 is a reply to message #453267] Thu, 27 July 2006 04:05 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

As i said in my other reply to this post, the solution you describe solves
the problem. I added the getDefaultPageInput() method , and I made sure
that workspace was cleanup; that worked fine.

In fact to make sure the workspace was cleaned up I checked "Clean
workspace data before launching" option of the run configuration. Now if i
uncheck this box again, the navigator is not running anymore : it seems
that Navigator only works if the workspace is clean , which a bit shame ...

Could you confirm that ?

Sebastian Fuchs wrote:

> I think our problem is solved.
> There is a comment from anonymous at Michael Elder's blog:
> http://www.blogger.com/comment.g?blogID=28446986&postID= 114815241695120152
> He / She wrotes:

> <<<<<<
> One more comment. "RCP" replated exception in Eclipse 3.2RC7 is not
> thrown, but navigator is always empty. Reason is that Null is setted as
> initial inpu contents. Override method in your WorkbenchAdvisor to provide
> initial contents:

> @Override
> public IAdaptable getDefaultPageInput() {
> return ResourcesPlugin.getWorkspace().getRoot();
> }

> Make sure you completely clear your runtime workspace(also .metadata) to
> force Eclipse call this method.
>>>>>>>>

> The first impression is great, I'm going to work on more complex content
> providers.
> So the navigator-root is most likely the current workbench-page-input.
> Set it if it's null.
Re: Content not displayed with Common Navigator [message #453652 is a reply to message #453349] Mon, 07 August 2006 05:29 Go to previous messageGo to next message
Eclipse UserFriend
Hi Nico,

no I can't confirm that.

Setting the DefaultPageInput only gives a root to the CommonNavigator.
Or better: Somwhere in the CommonNavigator-API someone told the navigator
to get the DefaultPageInput as its root. Before we set it, it was null.
That's why nothing was shown: there was no trigger point or enablement
where our content could hook.

AFAIK cleaning up the workspace in our case only makes shure that the
DefaultInputPage is really set.

Maybe you accidently cleaned up something else important ?
Re: Content not displayed with Common Navigator [message #454063 is a reply to message #453652] Fri, 18 August 2006 09:18 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

When I breakpoint on getElements() method of the root content provider I
see that the inputElement argument is correctly set only if I clean the
workspace before running. If contains a WorkspaceRoot instance.
If i run again, without cleaning the workspace, getElements() method
argument is null.
I also noticed that getDefaultPageInput() is only called if the workspace
is empty. It is never called again once there's something in .metadata.

> Hi Nico,

> no I can't confirm that.

> Setting the DefaultPageInput only gives a root to the CommonNavigator.
> Or better: Somwhere in the CommonNavigator-API someone told the navigator
> to get the DefaultPageInput as its root. Before we set it, it was null.
> That's why nothing was shown: there was no trigger point or enablement
> where our content could hook.

> AFAIK cleaning up the workspace in our case only makes shure that the
> DefaultInputPage is really set.

> Maybe you accidently cleaned up something else important ?
Re: Content not displayed with Common Navigator [message #454136 is a reply to message #454063] Mon, 21 August 2006 08:19 Go to previous messageGo to next message
Eclipse UserFriend
hi nico,

I've got no idea about solving your DefaultPageInput / .metadata / clean
workspace - problem. I don't know wheter it's an eclipse issue or your
fault.

For my applications I don't need to have got the WorkspaceRoot as my
NavigatorRoot. I only need a type which I can access and test (for
trigger-points etc.)
If this is possible for you too, set the DefaultPageInput to any type you
created. Maybe to an empty (no methods) Interface 'MyRoot'. Hook your
content in the ExtensionPoints to 'MyRoot'.

Please let me know if it works.

regards
Sebastian
Re: Content not displayed with Common Navigator [message #454153 is a reply to message #454136] Mon, 21 August 2006 13:01 Go to previous messageGo to next message
Eclipse UserFriend
Hi Sebastian,

Thanks again for your help.

As my application is an RCP app. I don't care about WorkspaceRoot. As you
recommended i modified getDefaultPageInput so that it returns an object of
my own. I've also added a trigger-point on my content provider so it gets
called when Navigator sees my root element.

Unfortunatelly i still get the same behaviour :

If my workspace is cleaned (no .metadata dir), getDefaultPageInput is
called, then getElements on my content provider is called and everything
works perfectelly.
On further runs, with unclean workspace, getDefaultPageInput is not
called. getElements is called with a null argument. Even if getElements
returns a non-null array, elements don't get displayed in the navigator.

May be I shouldn't a bug report , but i'd like to know if some others
people have experienced this kind of troubles with CNF in RCP apps ...

Nico
Re: Content not displayed with Common Navigator [message #454189 is a reply to message #454153] Tue, 22 August 2006 04:01 Go to previous messageGo to next message
Eclipse UserFriend
Hi Nico,

sounds strange.

I suggest to check, wheter there is another (3rd party or eclipse)-plugin
which sets the DefaultPageInput by its own, maybe depending on the
metadata status.
Only run those plugins you need in your launch configuration.

I don't think that this is a bug, since there is no comment about on the
relevant sites (yet). But when you report a bug you must make sure that
the error is reproducable. Maybe going through this procedure helps you
finding our 'blind passenger'.

Sebastian
Re: Content not displayed with Common Navigator [message #454193 is a reply to message #454189] Tue, 22 August 2006 04:55 Go to previous messageGo to next message
Eclipse UserFriend
> I suggest to check, wheter there is another (3rd party or eclipse)-plugin
> which sets the DefaultPageInput by its own, maybe depending on the
> metadata status.
> Only run those plugins you need in your launch configuration.

I'll check that ...

> I don't think that this is a bug, since there is no comment about on the
> relevant sites (yet). But when you report a bug you must make sure that
> the error is reproducable. Maybe going through this procedure helps you
> finding our 'blind passenger'.

I've found bung 145233
https://bugs.eclipse.org/bugs/show_bug.cgi?id=145233 .
Some user comments describes quite the same behaviour as I have ...
Re: Content not displayed with Common Navigator [message #454210 is a reply to message #454189] Tue, 22 August 2006 15:23 Go to previous messageGo to next message
Eclipse UserFriend
> I suggest to check, wheter there is another (3rd party or eclipse)-plugin
> which sets the DefaultPageInput by its own, maybe depending on the
> metadata status.
> Only run those plugins you need in your launch configuration.

Into the run configuration, I've only selected my own plugins. I've then
pressed "Add required" button to add required plugin.
Re: Content not displayed with Common Navigator [message #454249 is a reply to message #454210] Wed, 23 August 2006 04:07 Go to previous messageGo to next message
Eclipse UserFriend
Hi Nico,

I've read your comment on the buglist.

I wonder why the CNF works for me. I've got a more complicated business
modell with a composite pattern and some inherited types. Everything works
as described in Michael D. Elder's blog.

According to comment #1 in the buglist, I think it is not a good way to
override the CommonNavigator class. The CNF is designed just to present
the content you provided. Your task as a client is to provide the correct
content for a special data-type.

Our problem is (I think I solved it for my case now) that we want to
provide content at the top level and therefor must access and define the
root. I look forward to Michael D. Elder's extension of the CNF extension
points to provide a root input by declaration. (this is the way I
understood his comment #18). in my opinion this is the most straight
forward way to configure the navigator integratively.

I suggest to build and export your rcp-app and run it independently from
the ide. Use the build-in log instead of stdout. Inspect th logfiles for
errors. This way I often solved dependency problems between plugins, I
wasn't able to recognize in an ide-launch.
Furthermore having a clean log is a quality requirement. (not by
suppressing logging but by solving the errors :-)

regards
Sebastian
Re: Content not displayed with Common Navigator [message #454254 is a reply to message #454249] Wed, 23 August 2006 05:46 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

I followd what your recommended an exported my application to a standalone
product.
As you may have seen on bug comment list (comment #21), I've tried two
versions of getDefaultPageInput().
When I use the one which returns ResourcesPlugin.getWorkspace().getRoot();
, i get the following error in .log :

!SESSION 2006-08-23 11:26:34.531
-----------------------------------------------
eclipse.buildId=unknown
java.version=1.5.0_07
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=fr_FR
Command-line arguments: -os win32 -ws win32 -arch x86

!ENTRY org.eclipse.ui 4 4 2006-08-23 11:27:04.845
!MESSAGE Unable to save page input: R/, because it does not adapt to
IPersistableElement

When i try with the version which return my dummy NavigatorRoot, i get
quite the same:
!SESSION 2006-08-23 11:33:04.953
-----------------------------------------------
eclipse.buildId=unknown
java.version=1.5.0_07
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=fr_FR
Command-line arguments: -os win32 -ws win32 -arch x86

!ENTRY org.eclipse.ui 4 4 2006-08-23 11:33:31.100
!MESSAGE Unable to save page input:
org.escapek.client.ui.repository.navigator.NavigatorRoot@2bfdff, because
it does not adapt to IPersistableElement

So, could it be that CommonNavigator can't persist neither my own root
neither the root he gets from ResourcesPlugin.getWorkspace().getRoot(),
because both are not IPersistableElement ? It would explain why further
starts (with a non-clean workspace) give a null inputElement because it
couldn't restore root state.

Now i'll try to implement IPersitableElement into my NavigatorRoot. Do you
have any code sample of a root element you use ?

Thanks,

Nico.
Re: Content not displayed with Common Navigator [message #454255 is a reply to message #454254] Wed, 23 August 2006 06:17 Go to previous messageGo to next message
Eclipse UserFriend
Ok, I think that i'm on the way .... ;)

I use the following getDefaultPageInput(), which return my dummy root.

public IAdaptable getDefaultPageInput()
{
IAdaptable root = new NavigatorRoot();
return root;
}

public class NavigatorRoot implements IAdaptable, IPersistableElement,
IElementFactory
{
public NavigatorRoot()
{ }

public Object getAdapter(Class adapter)
{
if(adapter == IPersistableElement.class)
return this;
return null;
}

public String getFactoryId()
{
return this.getClass().getCanonicalName();
}

public void saveState(IMemento memento)
{
// TODO Auto-generated method stub
return;
}

public IAdaptable createElement(IMemento memento)
{
return new NavigatorRoot();
}
}

In fact , I'just added IPersistableElement, and IElementFactory. This is
yet a bit messy, but by using this code, everything works fine !!!!

I can see more clearer now; but this makes me say that there may be a
problem when using ResourcesPlugin.getWorkspace().getRoot() to
getInitialInput, as the result seems to be not persistable.
Re: Content not displayed with Common Navigator [message #454258 is a reply to message #454255] Wed, 23 August 2006 08:49 Go to previous messageGo to next message
Eclipse UserFriend
I'm glad that you are stepping foreward now.

Sadly, I've got no clue what part in your application tries to persist
your root element. Sorry, I think I can't help you any more at this point.
I can only guess that something makes use of workspace mechanisms. Maybe
there is some reference to IRessource or something similar.

For my application I don't care about the workspace at all. My own
implementation of a NavigatorRoot is nothing but a singleton pattern class
and of course implements IAdaptable where I return 'this' in getAdapter()
when the asked class equales 'this.getClass()'. That's all and it works
fine.

For persistence issues I use a database behind hibernate. But that's not
the matter, because the application works with (memory) business modells
all over its aspects.

Sebastian
Re: Content not displayed with Common Navigator [message #454259 is a reply to message #454258] Wed, 23 August 2006 09:31 Go to previous messageGo to next message
Eclipse UserFriend
> I'm glad that you are stepping foreward now.

I'm glad too ! :)

Thanks again.
Re: Content not displayed with Common Navigator [message #455224 is a reply to message #454255] Mon, 18 September 2006 12:52 Go to previous messageGo to next message
Eclipse UserFriend
Nico,

I followed your discussion with great interest. Unfortunately the CN in
my RCP (still) doesn't display anything when I try your code:

getDefaultPageInput() is called
getAdapter() is called with IWorkbenchAdapter as argument --> is
obviously not an IPersistableElement.class --> null is returned --> end
of the story
getFactoryID() is not called
createElement() is not called
Re: Content not displayed with Common Navigator [message #455233 is a reply to message #455224] Mon, 18 September 2006 14:00 Go to previous messageGo to next message
Eclipse UserFriend
> Nico,
>
> I followed your discussion with great interest. Unfortunately the CN in
> my RCP (still) doesn't display anything when I try your code:
>
> getDefaultPageInput() is called
> getAdapter() is called with IWorkbenchAdapter as argument --> is
> obviously not an IPersistableElement.class --> null is returned --> end
> of the story
> getFactoryID() is not called
> createElement() is not called

Is there _tested_, _really_ working sample code available somewhere? (
not just suggestions or shoulds or coulds ) After one week of googling,
blogging, newsreading, trying, failing, trying again, failing again I'm
rather desperate.
Re: Content not displayed with Common Navigator [message #455242 is a reply to message #455233] Tue, 19 September 2006 05:32 Go to previous messageGo to next message
Eclipse UserFriend
Geri,

can you keep me in the loop, I'm struggeling at the same point :-(

Regards
Martin
"Geri Broser" <gerold.broser@easyklick.com> schrieb im Newsbeitrag
news:eemmr7$vlc$1@utils.eclipse.org...
>> Nico,
>>
>> I followed your discussion with great interest. Unfortunately the CN in
>> my RCP (still) doesn't display anything when I try your code:
>>
>> getDefaultPageInput() is called
>> getAdapter() is called with IWorkbenchAdapter as argument --> is
>> obviously not an IPersistableElement.class --> null is returned --> end
>> of the story
>> getFactoryID() is not called
>> createElement() is not called
>
> Is there _tested_, _really_ working sample code available somewhere? ( not
> just suggestions or shoulds or coulds ) After one week of googling,
> blogging, newsreading, trying, failing, trying again, failing again I'm
> rather desperate.
Re: Content not displayed with Common Navigator [message #455245 is a reply to message #454255] Tue, 19 September 2006 06:30 Go to previous messageGo to next message
Eclipse UserFriend
Hi

this is Sebastian again.
Seeing this discussion still on top, I made a deep look into Nico's post
again.

1.
Maybe you should try to use a static Navigator Root.
Use a singleton pattern or access it in a static context.
Make sure it's always identically the same.
Here is an example:

public class NavigatorRoot() implements IAdaptable {

private static NavigatorRoot singletonInstance = new NavigatorRoot();

private NavigatorRoot(){
// construction not allowed
}

public static NavigatorRoot getRoot(){
return singletonInstance;
}

public Object getAdapter(Class adapter){
if (adapter.isAssignableFrom(this.getClass()))
return this;
return null;
}
}

...

public IAdaptable getDefaultPageInput(){
return NavigatorRoot.getRoot();
}

2.
What for do you need the IPersistable-Interface ?
If you provide an Adapter for this type, don't be afraid when someone
requests it.
Is your NavigatorRoot really 'IPersistable' ? Or isn't it just an ordinary
type you are able to compare and define content for ?

3.
Nico, are you making progress ?

regards
Sebastian
Re: Content not displayed with Common Navigator [message #455260 is a reply to message #455245] Tue, 19 September 2006 08:54 Go to previous messageGo to next message
Eclipse UserFriend
> 1.
> Maybe you should try to use a static Navigator Root.
> Use a singleton pattern or access it in a static context.
> Make sure it's always identically the same.
> Here is an example:
>
> public class NavigatorRoot() implements IAdaptable {
>
> private static NavigatorRoot singletonInstance = new NavigatorRoot();
>
> private NavigatorRoot(){
> // construction not allowed
> }
>
> public static NavigatorRoot getRoot(){
> return singletonInstance;
> }
>
> public Object getAdapter(Class adapter){
> if (adapter.isAssignableFrom(this.getClass()))
> return this;
> return null;
> }
> }
>
> ..
>
> public IAdaptable getDefaultPageInput(){
> return NavigatorRoot.getRoot();
> }

The argument adapter to getAdapter(Class adapter) is still an
org.eclipse.ui.model.IWorkbenchAdapter which IS NOT extended
(=subinterfaced) by org.eclipse.core.runtime.IAdaptable (according to
Eclipse v3.2 API doc ).

Hence, comparing an IWorkbenchAdapter (adapter) with an IAdaptable
(NavigatorRoot), java.lang.Class.isAssignableFrom has no other choice
than returning false ( according to Java 1.5.0 API doc ).

Or are there still knots in my brains?

P.S.: Can you tell us of which type is the argument Class adapter when
you run/debug your code as a RCP?
Re: Content not displayed with Common Navigator [message #455266 is a reply to message #455260] Tue, 19 September 2006 10:24 Go to previous messageGo to next message
Eclipse UserFriend
hi geri,

> The argument adapter to getAdapter(Class adapter) is still an
> org.eclipse.ui.model.IWorkbenchAdapter which IS NOT extended
> (=subinterfaced) by org.eclipse.core.runtime.IAdaptable (according to
> Eclipse v3.2 API doc ).

correct. nor by 'NavigatorRoot' eighter, of course.

> Hence, comparing an IWorkbenchAdapter (adapter) with an IAdaptable
> (NavigatorRoot), java.lang.Class.isAssignableFrom has no other choice
> than returning false ( according to Java 1.5.0 API doc ).

actually, the getAdapter method compares the argument to 'NavigatorRoot',
but you are right - because 'NavigatorRoot' implements 'IAdaptable' it
compares to 'IAdaptable' too.
and you are also right, that the method returns null for IWorkbenchAdapter
- but this is irrelevant for showing content.

> Or are there still knots in my brains?
1. we want to provide content at the cnf root level.

2. the cnf always takes the defaultPageInput as its root.

3. the common way to set the defaultPageInput (the default is the
WorkspaceRoot) is by overriding 'public IAdaptable getDefaultPageInput()'.

4. we create our own type (NavigatorRoot) to be able to compare
(instanceof) to something we know.

5. the reason for implementing 'IAdaptable' is, that only then we are able
to return our type through 'getDefaultPageInput()'.
it is a convention to react on the class' own type when querying for an
adapter.

6. by extension point declaration we hook our content to NavigatorRoot
(instanceof) and do the steps desribed at Michael D. Elder's blog in our
context.

works fine.

> P.S.: Can you tell us of which type is the argument Class adapter when
> you run/debug your code as a RCP?
the argument in my application is of the type
'org.eclipse.ui.model.IWorkbenchAdapter'.

it is not relevant, what or who queries our type for an adapter. you don't
have to care about it. it is not possible and it makes no sence to fulfill
any possible type-queries within our NavigatorRoot. it reacts on its own
type and returns null otherwise because we don't have got related objects
for our context.
it is very common in an extendable system to ask objects for adapters of
any type. the requested type belongs to the caller's context. for instance
the caller wants to know, wheter there is a new object opened or set,
which it can handle. in our case: it can't handle our object (because it
returns no adapter for the requested type). you can find more information
about the desing pattern 'Adapter' in the gang of four's design pattern
book.

what is positive for your application is, that your type made it to the
defaultPageInput. otherwise your getAdapter() method wouldn't be called or
you got a NullPointerException. nothing else matters.
now declare your content providers and label providers as your model and
context require. this can be tricky too, sometimes.

regards
sebastian
Re: Content not displayed with Common Navigator [message #455504 is a reply to message #455266] Wed, 27 September 2006 04:53 Go to previous messageGo to next message
Eclipse UserFriend
Thx for the comprehensive info, which took a while to digest.

Finally I managed it working. The main task was ...

public void preStartup() {
WorkbenchAdapterBuilder.registerAdapters();
}

.... in ApplicationWorkbenchAdvisor, where WorkbenchAdapterBuilder
resides in org.eclipse.ui.internal.ide.model. Which is not mentioned in
the API doc due to its internal nature.

Thx a lot for all your assistance.
Re: Content not displayed with Common Navigator [message #455507 is a reply to message #455504] Wed, 27 September 2006 13:50 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: leonardo.coelho.siliconstrategy.com.br

Hi, guys.

I?m sorry, but i need to reopen this conversation ?cause i?m facing some
problems.

I followed the discussion and tried to use my own NavigatorRoot and it
didn?t work. An interesting event: when i set :

public IAdaptable getDefaultPageInput() {
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
return root;
}

My Navigator shows only the label of the projects in the workspace, but
it doesn?t show any content inside them...

Can Someone post any comments about it? Has everybody made this work fine?

Regards,

=============================/============================== ====
Leonardo Coelho
=============================/============================== =====



Geri Broser escreveu:
> Thx for the comprehensive info, which took a while to digest.
>
> Finally I managed it working. The main task was ...
>
> public void preStartup() {
> WorkbenchAdapterBuilder.registerAdapters();
> }
>
> ... in ApplicationWorkbenchAdvisor, where WorkbenchAdapterBuilder
> resides in org.eclipse.ui.internal.ide.model. Which is not mentioned in
> the API doc due to its internal nature.
>
> Thx a lot for all your assistance.

--
Re: Content not displayed with Common Navigator [message #455512 is a reply to message #455507] Wed, 27 September 2006 14:58 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: leonardo.coelho.siliconstrategy.com.br

Oh, great. I?ve already got it!

Thx anyway!

=============================/============================== ====
Leonardo Coelho
=============================/============================== =====


Leonardo Coelho escreveu:
> Hi, guys.
>
> I?m sorry, but i need to reopen this conversation ?cause i?m facing some
> problems.
>
> I followed the discussion and tried to use my own NavigatorRoot and it
> didn?t work. An interesting event: when i set :
>
> public IAdaptable getDefaultPageInput() {
> IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
> return root;
> }
>
> My Navigator shows only the label of the projects in the workspace, but
> it doesn?t show any content inside them...
>
> Can Someone post any comments about it? Has everybody made this work fine?
>
> Regards,
>
> =============================/============================== ====
> Leonardo Coelho
> =============================/============================== =====
>
>
>
> Geri Broser escreveu:
>> Thx for the comprehensive info, which took a while to digest.
>>
>> Finally I managed it working. The main task was ...
>>
>> public void preStartup() {
>> WorkbenchAdapterBuilder.registerAdapters();
>> }
>>
>> ... in ApplicationWorkbenchAdvisor, where WorkbenchAdapterBuilder
>> resides in org.eclipse.ui.internal.ide.model. Which is not mentioned
>> in the API doc due to its internal nature.
>>
>> Thx a lot for all your assistance.
>

--
Re: Content not displayed with Common Navigator [message #456102 is a reply to message #455504] Thu, 12 October 2006 13:17 Go to previous messageGo to next message
Eclipse UserFriend
I tried this too and it works. However it opens up an entirely new thread of issues. All these workbench adaptor etc. are currently internal but... if the CNF is now a public plugin, some of this needs to be externalized to enable "standard" behaviour of a navigator view of IResource items, at least something that's "public" that implements the functional equivalent of:
WorkbenchAdapterBuilder.registerAdapters();
Re: Content not displayed with Common Navigator [message #457484 is a reply to message #454255] Wed, 01 November 2006 10:55 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: alex.levato.ca

Just a followup for anyone else using the Common Navigator in an RCP
environment.

The root of the problem stems from the fact that the
CommonNavigator.getInitialInput() retrieves the initial input for the
viewer from the page's initial input.

It then uses the initial input object to check against the trigger points
in your extension plug in ( to see if your content provider can provide
children for this type ). However, IF the initial input is null, then your
extension plugin can never provide trigger points ( and neither will any
other extension ) because the code in
NavigatorContentDescriptor.isTriggerPoint() will return false if the input
is null.

So, what does this mean to an RCP implementor:

In your RCP, your workbench advisor SHOULD derive from the
WorkbenchAdvisor class ( rather than the IDEWorkbenchAdvisor, which is an
internal class and hence should not be subclassed. More on this later ) .
However, the default workbench advisor does not implement
getDefaultInput() ( it returns null ). So, if you do not override
getDefaultInput in your workbench advisor, your content will never be
displayed in the common navigator ( because of the behavior of the
isTriggerPoint() code above ).

Ok. So now you implement getDefaultInput in your advisor. If you simply
return the WorkspaceRoot, your navigator will work the first time you
start your app ( since there is no workspace metadata saved, the code will
ask your advisor for the default input object). However, the next time you
start the app, eclipse will try to restore from the workspace metadata
saved when it shuts down, and since WorkspaceRoot does not implement
IPersistable, your input from the previous session was not persisted. And
so, the restore code will try to read the input from the metadata and
return null.... And now your navigator does not work anymore (because the
input is null).

Therefore, you need to return an object from getDefaultInput() which is
persistable. This is what the previous poster has done. However, there is
still one piece of the puzzle. For eclipse to restore an object which was
persisted to saved data, it needs a factory to build the new object from
the metadata info. This is why you need to implement your "default input"
object as implementing IElementFactory ( or any other class you want to
use). Finally, you have to define an extension to the
org.eclipse.ui.elementFactories extension point an point it at your
factory so that eclipse can lookup your factory and restore your default
input object.

And now everything should work.
Re: Content not displayed with Common Navigator [message #459190 is a reply to message #457484] Tue, 28 November 2006 17:46 Go to previous messageGo to next message
Eclipse UserFriend
Alex,

thank you for the great write-up. I'd like to ask two more questions. In my
scenario I'd like to use CNF to provide the projects and provide the layer
below that myself, not bound to files or folders. I'm already struggeling on
the first point:

1) How does the standard ResourceNavigator provide the workbench contents if
it doesn't fit IPersistable- does even the IDE already subclass it?

2) The ResourcesPlugin is provided by org.eclipse.ui.ide instead of
org.eclipse.ui.navigator. This leads to using CNF requiring IDE, which adds
large size to the final RCP app and, even worse, java projects, wizards and
the like that is hard to get rid of- is it possible to use CNF in RCP apps
without relying on the IDE?

Thanks for your great support,
Andreas

"Alex Levato" <alex@levato.ca> wrote in message
news:6822c82feda362ee9e4191c20fb9ab12$1@www.eclipse.org...
> Just a followup for anyone else using the Common Navigator in an RCP
> environment.
>
> The root of the problem stems from the fact that the
> CommonNavigator.getInitialInput() retrieves the initial input for the
> viewer from the page's initial input.
> It then uses the initial input object to check against the trigger points
> in your extension plug in ( to see if your content provider can provide
> children for this type ). However, IF the initial input is null, then your
> extension plugin can never provide trigger points ( and neither will any
> other extension ) because the code in
> NavigatorContentDescriptor.isTriggerPoint() will return false if the input
> is null.
>
> So, what does this mean to an RCP implementor:
>
> In your RCP, your workbench advisor SHOULD derive from the
> WorkbenchAdvisor class ( rather than the IDEWorkbenchAdvisor, which is an
> internal class and hence should not be subclassed. More on this later ) .
> However, the default workbench advisor does not implement
> getDefaultInput() ( it returns null ). So, if you do not override
> getDefaultInput in your workbench advisor, your content will never be
> displayed in the common navigator ( because of the behavior of the
> isTriggerPoint() code above ).
>
> Ok. So now you implement getDefaultInput in your advisor. If you simply
> return the WorkspaceRoot, your navigator will work the first time you
> start your app ( since there is no workspace metadata saved, the code will
> ask your advisor for the default input object). However, the next time you
> start the app, eclipse will try to restore from the workspace metadata
> saved when it shuts down, and since WorkspaceRoot does not implement
> IPersistable, your input from the previous session was not persisted. And
> so, the restore code will try to read the input from the metadata and
> return null.... And now your navigator does not work anymore (because the
> input is null).
>
> Therefore, you need to return an object from getDefaultInput() which is
> persistable. This is what the previous poster has done. However, there is
> still one piece of the puzzle. For eclipse to restore an object which was
> persisted to saved data, it needs a factory to build the new object from
> the metadata info. This is why you need to implement your "default input"
> object as implementing IElementFactory ( or any other class you want to
> use). Finally, you have to define an extension to the
> org.eclipse.ui.elementFactories extension point an point it at your
> factory so that eclipse can lookup your factory and restore your default
> input object.
>
> And now everything should work.
Re: Content not displayed with Common Navigator [message #459191 is a reply to message #455512] Tue, 28 November 2006 17:49 Go to previous messageGo to next message
Eclipse UserFriend
Leonardo,

what was your problem?

Thanks,
Andreas
Re: Content not displayed with Common Navigator [message #459205 is a reply to message #459190] Wed, 29 November 2006 03:25 Go to previous messageGo to next message
Eclipse UserFriend
After rechecking- the ResourceNavigator class is contributed by
org.eclipse.ui.ide, not the plugin. Result is still the same though?

"Andreas Goetz" <cpuidle@gmx.de> wrote in message
news:ekie5s$cbl$1@utils.eclipse.org...
> Alex,
<snip>
> 2) The ResourcesPlugin is provided by org.eclipse.ui.ide instead of
> org.eclipse.ui.navigator. This leads to using CNF requiring IDE, which
> adds large size to the final RCP app and, even worse, java projects,
> wizards and the like that is hard to get rid of- is it possible to use CNF
> in RCP apps without relying on the IDE?
>
> Thanks for your great support,
> Andreas
Re: Content not displayed with Common Navigator- Sample available [message #459277 is a reply to message #457484] Wed, 29 November 2006 17:03 Go to previous messageGo to next message
Eclipse UserFriend
If anybody is interested, I've finally managed to get all the pieces
together with the excellent help provided here. Code available if anybody
needs it.

Best,
Andreas
Re: Content not displayed with Common Navigator- Sample available [message #459278 is a reply to message #459277] Wed, 29 November 2006 18:03 Go to previous messageGo to next message
Eclipse UserFriend
Hi Andreas,

I'm interested in seeing your sample code.

Thanks for the offer.

Charlie


Andreas Goetz wrote:
> If anybody is interested, I've finally managed to get all the pieces
> together with the excellent help provided here. Code available if anybody
> needs it.
>
> Best,
> Andreas
>
>
Re: Content not displayed with Common Navigator- Sample available [message #459308 is a reply to message #459278] Thu, 30 November 2006 05:41 Go to previous messageGo to next message
Eclipse UserFriend
I've put the sample together with a quick tutorial and some helpful links
here:

http://www.cpuidle.de/blog/?p=48

Cheers,
Andi

"Charle Kelly" <Eclipse@CharlieKelly.com> wrote in message
news:ekl3j7$1bf$1@utils.eclipse.org...
> Hi Andreas,
>
> I'm interested in seeing your sample code.
>
> Thanks for the offer.
>
> Charlie
Re: Content not displayed with Common Navigator- Sample available [message #459652 is a reply to message #459308] Tue, 05 December 2006 10:29 Go to previous messageGo to next message
Eclipse UserFriend
Hi Andreas,

I ran the code example from your site, but the navigator view was empty, although I had all kinds of files and folders in the RCP application's workspace. I deleted the .metadata folder as well, as suggested in some previous posts, but no luck.

Am I missing something?

Cheers,
Zsolt
Re: Content not displayed with Common Navigator- Sample available [message #459679 is a reply to message #459652] Wed, 06 December 2006 07:34 Go to previous messageGo to next message
Eclipse UserFriend
Same problem for me. I have to admit I've only tested until error messages
were gone from the log. No idea sofar- what do the experts say?

Thanks,
Andi

"Zsolt T
Re: Content not displayed with Common Navigator [message #459836 is a reply to message #455504] Thu, 07 December 2006 11:24 Go to previous messageGo to next message
Eclipse UserFriend
Nico, Sebastian, Geri,

still not entirely working for me. I've followed all steps described (wrote
the whole thing up under Eclipse Common Navigator Framework in RCP
Applications at http://www.cpuidle.de/blog/?p=48).
The RCP app does now run and the logfile stays clean, no exceptions.
Unfortunately, no projects are displayed either. I did somehow get it
working once but can't reproduce it. The difference ist that when
..metadata\.plugins\org.eclipse.core.resources\.projects is filled on
startup, the projects are found and new ones can be created. If I remove the
..plugins directory and restart, the naviagor stays empty, even when
refreshing the workspace.

Any idea how to initialize the workspace?

Thanks for your help,
Andreas

"Geri Broser" <gerold.broser@easyklick.com> wrote in message
news:efde71$2p0$1@utils.eclipse.org...
> Thx for the comprehensive info, which took a while to digest.
>
> Finally I managed it working. The main task was ...
>
> public void preStartup() {
> WorkbenchAdapterBuilder.registerAdapters();
> }
>
> ... in ApplicationWorkbenchAdvisor, where WorkbenchAdapterBuilder resides
> in org.eclipse.ui.internal.ide.model. Which is not mentioned in the API
> doc due to its internal nature.
>
> Thx a lot for all your assistance.
Re: Content not displayed with Common Navigator- Sample available [message #460038 is a reply to message #459679] Tue, 12 December 2006 03:36 Go to previous messageGo to next message
Eclipse UserFriend
Problem solved, post updated.

The navigator was correctly setup, but was yet missing all content or
actions. These need to be specifically configured:

1) Add the ResourceContent viewerContribution to actually expose workbench
resources
2) Add the org.eclipse.ui.navigator.resources.* filters and actions to
provide functionality for the resources

Cheers,
Andi

"Andreas Goetz" <cpuidle@gmx.de> wrote in message
news:el6dad$5co$1@utils.eclipse.org...
> Same problem for me. I have to admit I've only tested until error messages
> were gone from the log. No idea sofar- what do the experts say?
>
> Thanks,
> Andi
>
> "Zsolt T
Re: Content not displayed with Common Navigator- Sample available [message #460047 is a reply to message #460038] Tue, 12 December 2006 09:17 Go to previous message
Eclipse UserFriend
Thanks, everything is working now!

Cheers,
Zsolt
Previous Topic:open with menu
Next Topic:Plugin-driven status line
Goto Forum:
  


Current Time: Sat Mar 22 00:01:04 EDT 2025

Powered by FUDForum. Page generated in 0.05482 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top