Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » How to change the appearance of an editor-tab
How to change the appearance of an editor-tab [message #528889] Thu, 22 April 2010 10:11 Go to next message
Rudi Missing name is currently offline Rudi Missing nameFriend
Messages: 17
Registered: July 2009
Junior Member
Hello,

in my RCP-based app, there are multiple editors opened at the same time. Obviously just the content of the editor which has the focus is visible, the other editors are presented by a tab respectively, in the exact same manner as the code editors in Eclipse as an IDE.

The difference between the editors in my app and the code editors in Eclipse as an IDE is, that the content of the editors is not just modified by the user across the GUI by selecting the correspondent editor-tab, it is also modified by background threads when the editor hasn't the focus. In order that the user has not to check every tab for changes by clicking on it, I would like to indicate the change of a hidden editor in some way, for example by changing the font of the tab (size, color, type) or even better by changing the background of the tab to red. For example the console view of the Eclipse IDE does exactly this: when it is in the background and its content changes, the font on the tab is changed to bold.

Could you please give me a hint, how I can solve my problem?

thank you in advance,
Rudi
Re: How to change the appearance of an editor-tab [message #528955 is a reply to message #528889] Thu, 22 April 2010 13:44 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

For one, changing the editor in the background should mark it as dirty
(firing the corresponding DIRTY property).

The other call you can make (I'm not sure if it works in an editor) is
org.eclipse.ui.progress.IWorkbenchSiteProgressService.warnOf ContentChange()

Simply use getSite().getService(*) to get your service.

PW

--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm


Re: How to change the appearance of an editor-tab [message #529143 is a reply to message #528955] Fri, 23 April 2010 08:15 Go to previous messageGo to next message
Rudi Missing name is currently offline Rudi Missing nameFriend
Messages: 17
Registered: July 2009
Junior Member
Hi Paul,

thank you for the fast reply.

First I must make an important correction on my problem, it dosn't concern editors, it concerns views. But the problem is still the same.

Based on your hints I tried to use the IWorkbenchSiteProgressService. Unfortunately the method warnOfContentChange() has no effect. So I tested some other methods from the IWorkbenchSiteProgressService. By executing the following code, I got a result:


	Job job = new Job("myJob") {

		@Override
		protected IStatus run(IProgressMonitor monitor) {

			long now = System.currentTimeMillis();
			while (System.currentTimeMillis() < now + 10000)
				;

			return Status.OK_STATUS;
		}
	};

	job.setUser(true);
	IWorkbenchSiteProgressService service = (IWorkbenchSiteProgressService)this.getSite().getService(IWorkbenchSiteProgressService.class);
	service.schedule(job);
	


Whith this code, the font of the tab of the respective view changes to italic, and after the job terminates it changes back to standard. This could be a solution, but the effect is to few, that is to say the user will not notice this change, the font should at least change the color or even better, the whole tab should change the color or start blinking.

If this is the way to go, could you please give me a hint, how I can have an impact on the change of the tab?

By searching the internet for this problem, I encountered the constant IPresentablePart.PROP_HIGHLIGHT_IF_BACK. I tried to execute firePropertyChange(IPresentablePart.PROP_HIGHLIGHT_IF_BACK) inside my view, but this has also no effect. Is it possible, that I must activate something on the IFolderLayout which contains my views, in order that PROP_HIGHLIGHT_IF_BACK has an effect?

I hope on your help, because this is an important requirement for me, or rather our customer Smile

Thank you,
Rudi
Re: How to change the appearance of an editor-tab [message #529230 is a reply to message #529143] Fri, 23 April 2010 14:12 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Rudi wrote:

>
> Whith this code, the font of the tab of the respective view changes to
> italic, and after the job terminates it changes back to standard.

This is probably as good as it gets. If the progress service is from
the view,
org.eclipse.ui.progress.IWorkbenchSiteProgressService.warnOf ContentChange()
executes site.getPane().showHighlight();

That fires firePropertyChange(IPresentablePart.PROP_HIGHLIGHT_IF_BACK);
which in the default presentation bolds the tab.

Just like if the Console view receives output while it's not on top.


Later,
PW


--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm


Re: How to change the appearance of an editor-tab [message #529797 is a reply to message #529230] Tue, 27 April 2010 09:24 Go to previous messageGo to next message
Rudi Missing name is currently offline Rudi Missing nameFriend
Messages: 17
Registered: July 2009
Junior Member
Paul Webster wrote on Fri, 23 April 2010 10:12

That fires firePropertyChange(IPresentablePart.PROP_HIGHLIGHT_IF_BACK);
which in the default presentation bolds the tab.

Just like if the Console view receives output while it's not on top.



Hi Paul,

this is exactly what I'm looking for. I have just one more problem. In my App all tabs of views and editors have already a bold font, so this mechanism dosn't work. Apart from this, the effect of changeing the font to bold is to few, because the user will not notice this change.

Is it possible to change the type of presentation, which is used to allert the user by
firePropertyChange(IPresentablePart.PROP_HIGHLIGHT_IF_BACK)
, for example instead of changeing the font to bold I would like that at least the font changes to a different color. Or even better, that the background of the whole tab changes. Do you have one more hint?


Thank you in advance,
Rudi
Re: How to change the appearance of an editor-tab [message #530488 is a reply to message #529797] Thu, 29 April 2010 18:32 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Rudi wrote:
> Is it possible to change the type of presentation, which is used to
> allert the user by
> firePropertyChange(IPresentablePart.PROP_HIGHLIGHT_IF_BACK), for example
> instead of changeing the font to bold I would like that at least the
> font changes to a different color. Or even better, that the background
> of the whole tab changes. Do you have one more hint?

It's possible to change the entire presentation (a lot of work) but not
to customize that particular tab bolding (unless one of the fonts under
Preferences>General>Appearance>Color and Fonts can change it).

PW

--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm


Re: How to change the appearance of an editor-tab [message #530943 is a reply to message #530488] Mon, 03 May 2010 07:05 Go to previous message
Rudi Missing name is currently offline Rudi Missing nameFriend
Messages: 17
Registered: July 2009
Junior Member
Hi Paul,

thank you anyway. As a tradeoff I will solve this problem by changeing the image on the tab and open a feature request on eclipse, maybe other users are interested too in this feature.


Best regards,
Rudi
Previous Topic:WorkbenchWindowControlContribution moves to incorrect position
Next Topic:PopUp sub-category
Goto Forum:
  


Current Time: Fri Apr 19 21:38:50 GMT 2024

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

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

Back to the top