update the status line [message #551862] |
Mon, 09 August 2010 20:12 |
|
Hi,
I am trying to add to my RCP a status line which will indicate the connection stage between my app and an external application. I added code in the ApplicationWorkbenchWindowAdvisor.postWindowOpen() which shows the initial state, this code works fine. I've added an observer in one of my ViewParts (I have 6 in the perspective) which listens for connection stage change. I get notification on connection stage change an execute an asyncExec , the code to update the status line runs, but the line is not updated. What am I missing?
here is the code withing the runnable I pass the asyncExec:
IActionBars bars = getViewSite().getActionBars();
bars.getStatusLineManager().setMessage("IB changed connection stage : ");
bars.getStatusLineManager().isDirty();
bars.getStatusLineManager().update(true);
System.out.println("IB changed connection stage : " + stage);
if I stop in a break point the isDirty returns false.
Thanks,
Nir
|
|
|
Re: update the status line [message #552257 is a reply to message #551862] |
Wed, 11 August 2010 13:05 |
|
Hi,
OK I figured it out. It seems that every view has its own status line. At the beginning I added an observer at the ApplicationWorkbenchWindowAdvisor, but then after I changed the focus to one of my 6 views, the status line disappeared. So eventually I made a singleton class which observes the connection and each time I setFocus() on a view I pass to the observer object, the status line of that view:
public void setFocus() {
Activator.getDefault().getConnStateMngr().setStatusLine(getViewSite().getActionBars().getStatusLineManager(), m_accountContent.getDisplay());
}
It works, but I have a feeling I am missing something with the status line and there has to be a more simple way.
Can anyone through some light on the subject?
Thanks,
Nir
|
|
|
Re: update the status line [message #552692 is a reply to message #552257] |
Fri, 13 August 2010 08:07 |
Eclipse User |
|
|
|
Originally posted by: news2008.torsten-keil.net
Hi Nir,
just add a global status line contribution using the
org.eclipse.ui.menus extension point like this:
<extension point="org.eclipse.ui.menus">
<menuContribution
locationURI="toolbar:org.eclipse.ui.trim.status?after=END_GROUP ">
<toolbar
id="<your toolbar id here>">
<control
class="<your WorkbenchStatusItem>"
id="<id>">
</control>
</toolbar>
</menuContribution>
</extension>
where your WorkbenchStatusItem extends
WorkbenchWindowControlContribution and implements some kind of
connection listener to update the item depending on the connection state.
Torsten
Am 11.08.2010 15:05, schrieb nir dweck:
> Hi,
> OK I figured it out. It seems that every view has its own status line.
> At the beginning I added an observer at the
> ApplicationWorkbenchWindowAdvisor, but then after I changed the focus to
> one of my 6 views, the status line disappeared. So eventually I made a
> singleton class which observes the connection and each time I setFocus()
> on a view I pass to the observer object, the status line of that view:
> public void setFocus() {
> Activator.getDefault().getConnStateMngr().setStatusLine(getV iewSite().getActionBars().getStatusLineManager(),
> m_accountContent.getDisplay());
> }
>
>
> It works, but I have a feeling I am missing something with the status
> line and there has to be a more simple way. Can anyone through some
> light on the subject?
> Thanks,
> Nir
|
|
|
Powered by
FUDForum. Page generated in 0.04621 seconds