Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Common Navigator + RCP
Common Navigator + RCP [message #486705] Fri, 18 September 2009 11:59 Go to next message
Simon Chemouil is currently offline Simon Chemouil
Messages: 24
Registered: July 2009
Junior Member
Hi there,

I have integrated a few CNF-based views in my RCP app, including the
standard Project Explorer view.

The problem I had is getting the proper icons/labels when using the
Project Explorer view directly in my RCP app.
(Please not that I faced the other common problem with custom navigators
to supply my own input, but solved it by inheriting from CommonViewer).

I have found a solution detailed here: http://www.cpuidle.de/blog/?p=48

It worked but is a kind of a hack I'd like to avoid. I found this
problem dates back to 2005 (when the answer was given on Eclipse
newsgroups). I am using RCP with 3.5 and I would have hoped a cleaner
solution would be available. Maybe I am missing something.

But without the workaround, I get no images / label ! (actually, no
labels if I don't call org.eclipse.ui.ide.IDE.registerAdapters();
and no images if I don't call the declareWorkbenchImages hack)

This bug marked it as fixed:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=153933
... but I couldn't find the "new" way to do it.

Is there any new, better solution ?

Thanks for your help,

--
Simon Chemouil
Re: Common Navigator + RCP [message #486793 is a reply to message #486705] Sat, 19 September 2009 01:01 Go to previous messageGo to next message
Francis Upton IV is currently offline Francis Upton IV
Messages: 472
Registered: July 2009
Location: Oakland, CA
Senior Member
Simon Chemouil wrote on Fri, 18 September 2009 11:59
Hi there,

I have integrated a few CNF-based views in my RCP app, including the
standard Project Explorer view.

The problem I had is getting the proper icons/labels when using the
Project Explorer view directly in my RCP app.
(Please not that I faced the other common problem with custom navigators
to supply my own input, but solved it by inheriting from CommonViewer).

I have found a solution detailed here: http://www.cpuidle.de/blog/?p=48

It worked but is a kind of a hack I'd like to avoid. I found this
problem dates back to 2005 (when the answer was given on Eclipse
newsgroups). I am using RCP with 3.5 and I would have hoped a cleaner
solution would be available. Maybe I am missing something.

But without the workaround, I get no images / label ! (actually, no
labels if I don't call org.eclipse.ui.ide.IDE.registerAdapters();
and no images if I don't call the declareWorkbenchImages hack)

This bug marked it as fixed:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=153933
... but I couldn't find the "new" way to do it.

Is there any new, better solution ?

Thanks for your help,

--
Simon Chemouil


Nope, still sucks, still unfixed. We tried in 3.5. Here is the bug to follow:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=234252

Turns out it's not an easy problem to fix.


Re: Common Navigator + RCP [message #486941 is a reply to message #486793] Mon, 21 September 2009 04:56 Go to previous messageGo to next message
Simon Chemouil is currently offline Simon Chemouil
Messages: 24
Registered: July 2009
Junior Member
Francis Upton a écrit :
> Nope, still sucks, still unfixed. We tried in 3.5. Here is the bug to
> follow:
>
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=234252
>
> Turns out it's not an easy problem to fix.

Hi Francis,

Thanks for your answer. I see this is tricky to solve, but I really hope
it will make it into 3.6. I guess a lot of RCP developers face this and
waste time on finding the solution. In the mean time I casted a vote for
the bug.

I have posted a bit too soon last time and I still have something not
working with my Project Explorer, hopefully you can help.

When I start my application, the Project Explorer view is empty, even if
I select it (left-click). It's only when I right click into it is filled
with projects (I'm triggering something, but I have a hard time
finding out what it is by debugging it because a breakpoint on a right
click makes X freeze).

I have tried various unsuccessful approaches, including calling refresh
on the Project Explorer's CommonViewer manually in the postStartup()
method of my Workbench advisor (it finds the view just fine, but the
refresh doesn't do a thing).

Maybe I'm doing something wrong. Here's a summary of my actions:
- I'm integrating the Project Explorer directly (no inheritance to
provide the initial input)
-> org.eclipse.ui.navigator.ProjectExplorer in my perspective
- In my application WorkbenchAdvisor, I used the declareImages() hack
- I call org.eclipse.ui.ide.IDE.registerAdapters(); in my preStart()
method


With this, images and labels are present but only after a right-click
which somehow enables my Project view. I can't find what I am missing,
either another hack to force the proper initialization by emulating the
right-click, or some enablement technique.


Thanks a lot, any suggestion is greatly appreciated.

--
Simon Chemouil
Re: Common Navigator + RCP [message #486961 is a reply to message #486941] Mon, 21 September 2009 06:23 Go to previous messageGo to next message
Simon Chemouil is currently offline Simon Chemouil
Messages: 24
Registered: July 2009
Junior Member
Simon Chemouil a écrit :
> Thanks a lot, any suggestion is greatly appreciated.

I managed to solve my problem by adding this to my WorkbenchAdvisor:

@Override
public void postStartup() {

super.postStartup();
IWorkbenchWindow[] workbenchs =
PlatformUI.getWorkbench().getWorkbenchWindows();

ProjectExplorer view = null;
for (IWorkbenchWindow workbench : workbenchs) {
for (IWorkbenchPage page : workbench.getPages()) {
view = (ProjectExplorer)
page.findView("org.eclipse.ui.navigator.ProjectExplorer");
break;
}
}

if (view == null) {
return;
}

view.getCommonViewer().setInput(ResourcesPlugin.getWorkspace ().getRoot());

}


The problem was that the input of the Common Viewer was null for some
reason, until there was a right-click into the Project Explorer which
triggered it...

I don't understand why the setInput() wasn't called earlier in the case
of a Project Explorer, I thought it should be a reusable component that
self-configures itself when it comes to the input.

(btw, maybe there's a cleaner way / better place to make the call, but I
need to be sure the Project Explorer is instanciated and I need to get a
handle on it, and since I'm using the class as an external component I
can't have it register itself to my WorkbenchAdvisor).

I'm posting this in case someone has the same problem :)

Thanks again for your help and looking forward to remove the hacks when
I switch to 3.6

--
Simon
Re: Common Navigator + RCP [message #637175 is a reply to message #486961] Thu, 04 November 2010 09:16 Go to previous message
Jesper Mattsson is currently offline Jesper Mattsson
Messages: 1
Registered: November 2010
Junior Member
I had the same problem. It turns out is was due to an old test workspace from before I had overridden getDefaultPageInput(). Deleting the test workspace solved the problem.
Previous Topic:Building RCP application
Next Topic:How to do an easy localization of eclipse platform parts?
Goto Forum:
  


Current Time: Thu Aug 21 08:07:58 EDT 2014

Powered by FUDForum. Page generated in 0.01597 seconds