Skip to main content



      Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Move some coolbar actions location to the right most
Move some coolbar actions location to the right most [message #80031] Sun, 30 March 2008 23:36 Go to next message
Eclipse UserFriend
Hi all,

Our app has its perspective switcher hidden and we want to change the
location of coolbar actions that has generic functionality (like Help,
Preferences, etc) to the right most. What classes should we override for
this ?

Thanks in advanced for any help.

Best Regards,

Setya
Re: Move some coolbar actions location to the right most [message #80125 is a reply to message #80031] Mon, 31 March 2008 04:07 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: fappel.innoopract.com

Hi,

I'm not aware of a simple solution for this, but overriding
WorkbenchWindowAdvisor#createWindowContents() will work.


Ciao
Frank

-----Ursprüngliche Nachricht-----
Von: Setya [mailto:jsetya@gmail.com]
Bereitgestellt: Montag, 31. März 2008 05:37
Bereitgestellt in: eclipse.technology.rap
Unterhaltung: Move some coolbar actions location to the right most
Betreff: Move some coolbar actions location to the right most


Hi all,

Our app has its perspective switcher hidden and we want to change the
location of coolbar actions that has generic functionality (like Help,
Preferences, etc) to the right most. What classes should we override for
this ?

Thanks in advanced for any help.

Best Regards,

Setya
Re: Move some coolbar actions location to the right most [message #80185 is a reply to message #80125] Mon, 31 March 2008 05:01 Go to previous messageGo to next message
Eclipse UserFriend
I've done a similar thing sometime ago using the
WorkbenchWindowAdvisor#createWindowContents() like Frank said with
success. Just override it, and set your own layout for the shell. If you
need any more details just let me know.

Tiago

Frank Appel wrote:
> Hi,
>
> I'm not aware of a simple solution for this, but overriding
> WorkbenchWindowAdvisor#createWindowContents() will work.
>
>
> Ciao
> Frank
>
> -----Ursprüngliche Nachricht-----
> Von: Setya [mailto:jsetya@gmail.com]
> Bereitgestellt: Montag, 31. März 2008 05:37
> Bereitgestellt in: eclipse.technology.rap
> Unterhaltung: Move some coolbar actions location to the right most
> Betreff: Move some coolbar actions location to the right most
>
>
> Hi all,
>
> Our app has its perspective switcher hidden and we want to change the
> location of coolbar actions that has generic functionality (like Help,
> Preferences, etc) to the right most. What classes should we override for
> this ?
>
> Thanks in advanced for any help.
>
> Best Regards,
>
> Setya
>
Re: Move some coolbar actions location to the right most [message #80241 is a reply to message #80185] Mon, 31 March 2008 07:12 Go to previous messageGo to next message
Eclipse UserFriend
Tiago,

> I've done a similar thing sometime ago using the
> WorkbenchWindowAdvisor#createWindowContents() like Frank said with
> success. Just override it, and set your own layout for the shell. If you
> need any more details just let me know.

Thank you.

I've tried to override WorkbenchWindowAdvisor#createWindowContents() using
some snippet I found from this newsgroup:

@Override
public void createWindowContents(Shell shell)
{
final IWorkbenchWindowConfigurer configurer = getWindowConfigurer();

if (configurer.getShowMenuBar())
{
final Menu menu = configurer.createMenuBar();
shell.setMenuBar(menu);
}

shell.setLayout(new FormLayout());

Composite banner = createUpperBannerArea(shell);
FormData data = new FormData();
data.top = new FormAttachment(0, 0);
data.left = new FormAttachment(0, 0);
data.right = new FormAttachment(100, 0);
data.bottom = new FormAttachment(10, 0);
banner.setLayoutData(data);

Control coolbar = createCoolbar(shell,banner);

Control page = configurer.createPageComposite(shell);
data = new FormData();
data.top = new FormAttachment(coolbar, 5, SWT.BOTTOM);
data.left = new FormAttachment(0, 5);
data.right = new FormAttachment(100, -5);
data.bottom = new FormAttachment(100, -5);
page.setLayoutData(data);

Control statusLine = configurer.createStatusLineControl(shell);
data = new FormData();
data.top = new FormAttachment(page, 5, SWT.BOTTOM);
data.left = new FormAttachment(0, 5);
data.right = new FormAttachment(100, -5);
statusLine.setLayoutData(data);
}

private Control createCoolbar(Shell shell,Control sibling)
{
Composite coolBarContainer = new Composite(shell,SWT.NONE);

FormData formData = new FormData();
formData.top = new FormAttachment(sibling, 5, SWT.BOTTOM);
formData.left = new FormAttachment(0, 5);
formData.right = new FormAttachment(100, -5);
formData.bottom = new FormAttachment(15, 0);
coolBarContainer.setLayoutData(formData);

GridLayout layout = new GridLayout(2,false);
layout.marginHeight = 0;
layout.marginWidth = 0;
coolBarContainer.setLayout(layout);

//The left most coolbar
getWindowConfigurer().createCoolBarControl(coolBarContainer) ;

//The right most coolbar
CoolBar coolBar = new CoolBar(coolBarContainer,SWT.NONE);
coolBar.setLayoutData(new GridData(SWT.END,SWT.CENTER,true,true));

ICoolBarManager coolBarManager = new CoolBarManager(coolBar);

IAction action = new
HelpAction(HelpAction.ID_MENU_HELP,CorePlugin.getPluginResou rceString(HelpAction.CAPTION_MENU_HELP));

action.setImageDescriptor(CorePlugin.getInstance().getImageD escriptor(CorePlugin.getPluginResourceString(HelpAction.ICON _MENU_FILE_HELP)));
action.setActionDefinitionId(HelpAction.DEFINITION_ID_MENU_H ELP);

action.setToolTipText(CorePlugin.getPluginResourceString(Hel pAction.TOOLTIP_MENU_HELP));
action.setEnabled(true);

getWindowConfigurer().getActionBarConfigurer().registerGloba lAction(action);

coolBarManager.add(action);

return coolBarContainer;
}

The actions on the left coolbar were displayed, but not actions on the
right.
Also the status line won't show up either.

Best Regards,

Setya
Re: Move some coolbar actions location to the right most [message #80377 is a reply to message #80241] Mon, 31 March 2008 10:32 Go to previous messageGo to next message
Eclipse UserFriend
Try the following code:

@Override
public final void preWindowOpen() {
final IWorkbenchWindowConfigurer configurer =
getWindowConfigurer();
configurer.setShowStatusLine(true);
}

In there you can set other properties like setShowProgressIndicator and
others.

Tiago

Setya wrote:
> Tiago,
>
>> I've done a similar thing sometime ago using the
>> WorkbenchWindowAdvisor#createWindowContents() like Frank said with
>> success. Just override it, and set your own layout for the shell. If
>> you need any more details just let me know.
>
> Thank you.
>
> I've tried to override WorkbenchWindowAdvisor#createWindowContents()
> using some snippet I found from this newsgroup:
>
> @Override
> public void createWindowContents(Shell shell) {
> final IWorkbenchWindowConfigurer configurer = getWindowConfigurer();
> if (configurer.getShowMenuBar()) {
> final Menu menu = configurer.createMenuBar();
> shell.setMenuBar(menu);
> }
> shell.setLayout(new FormLayout());
>
> Composite banner = createUpperBannerArea(shell);
> FormData data = new FormData();
> data.top = new FormAttachment(0, 0);
> data.left = new FormAttachment(0, 0);
> data.right = new FormAttachment(100, 0);
> data.bottom = new FormAttachment(10, 0);
> banner.setLayoutData(data);
>
> Control coolbar = createCoolbar(shell,banner);
> Control page = configurer.createPageComposite(shell);
> data = new FormData();
> data.top = new FormAttachment(coolbar, 5, SWT.BOTTOM);
> data.left = new FormAttachment(0, 5);
> data.right = new FormAttachment(100, -5);
> data.bottom = new FormAttachment(100, -5);
> page.setLayoutData(data);
>
> Control statusLine = configurer.createStatusLineControl(shell);
> data = new FormData();
> data.top = new FormAttachment(page, 5, SWT.BOTTOM);
> data.left = new FormAttachment(0, 5);
> data.right = new FormAttachment(100, -5);
> statusLine.setLayoutData(data);
> }
>
> private Control createCoolbar(Shell shell,Control sibling)
> {
> Composite coolBarContainer = new Composite(shell,SWT.NONE);
>
> FormData formData = new FormData();
> formData.top = new FormAttachment(sibling, 5, SWT.BOTTOM);
> formData.left = new FormAttachment(0, 5);
> formData.right = new FormAttachment(100, -5);
> formData.bottom = new FormAttachment(15, 0);
> coolBarContainer.setLayoutData(formData);
>
> GridLayout layout = new GridLayout(2,false);
> layout.marginHeight = 0;
> layout.marginWidth = 0;
> coolBarContainer.setLayout(layout);
> //The left most coolbar
> getWindowConfigurer().createCoolBarControl(coolBarContainer) ;
> //The right most coolbar
> CoolBar coolBar = new CoolBar(coolBarContainer,SWT.NONE);
> coolBar.setLayoutData(new GridData(SWT.END,SWT.CENTER,true,true));
>
> ICoolBarManager coolBarManager = new CoolBarManager(coolBar);
>
> IAction action = new
> HelpAction(HelpAction.ID_MENU_HELP,CorePlugin.getPluginResou rceString(HelpAction.CAPTION_MENU_HELP));
>
> action.setImageDescriptor(CorePlugin.getInstance().getImageD escriptor(CorePlugin.getPluginResourceString(HelpAction.ICON _MENU_FILE_HELP)));
>
> action.setActionDefinitionId(HelpAction.DEFINITION_ID_MENU_H ELP);
>
> action.setToolTipText(CorePlugin.getPluginResourceString(Hel pAction.TOOLTIP_MENU_HELP));
>
> action.setEnabled(true);
>
> getWindowConfigurer().getActionBarConfigurer().registerGloba lAction(action);
>
> coolBarManager.add(action);
> return coolBarContainer;
> }
>
> The actions on the left coolbar were displayed, but not actions on the
> right.
> Also the status line won't show up either.
>
> Best Regards,
>
> Setya
>
>
>
Re: Move some coolbar actions location to the right most [message #80435 is a reply to message #80377] Mon, 31 March 2008 23:24 Go to previous messageGo to next message
Eclipse UserFriend
Tiago,

> @Override
> public final void preWindowOpen() {
> final IWorkbenchWindowConfigurer configurer =
> getWindowConfigurer();
> configurer.setShowStatusLine(true);
> }

Thanks.

I'm aware of those settings. But by default status line is shown as long
as we don't override WorkbenchWindowAdvisor#createWindowContents(Shell).

From my code I gave earlier it turns out that I have to change :

Control page = configurer.createPageComposite(shell);
[..]
data.bottom = new FormAttachment(100, -5);
[..]

into :

Control page = configurer.createPageComposite(shell);
[..]
data.bottom = new FormAttachment(100, -25);
[..]

But I'm not sure if this really does the trick, it only reserves some
space at the bottom most for the status line to fill.

How's your implementation to move some coolbar actions to the right most ?

Best Regards,

Setya
Re: Move some coolbar actions location to the right most [message #81097 is a reply to message #80435] Thu, 03 April 2008 05:07 Go to previous messageGo to next message
Eclipse UserFriend
Setya wrote:
> Tiago,
>
>> @Override
>> public final void preWindowOpen() {
>> final IWorkbenchWindowConfigurer configurer =
>> getWindowConfigurer();
>> configurer.setShowStatusLine(true);
>> }
>
> Thanks.
>
> I'm aware of those settings. But by default status line is shown as long
> as we don't override WorkbenchWindowAdvisor#createWindowContents(Shell).
> From my code I gave earlier it turns out that I have to change :
> Control page = configurer.createPageComposite(shell);
> [..]
> data.bottom = new FormAttachment(100, -5);
> [..]
>
> into :
>
> Control page = configurer.createPageComposite(shell);
> [..]
> data.bottom = new FormAttachment(100, -25);
> [..]
>
> But I'm not sure if this really does the trick, it only reserves some
> space at the bottom most for the status line to fill.
>
> How's your implementation to move some coolbar actions to the right most ?
>
> Best Regards,
>
> Setya
>

Hi,

What I do is I set the Shell layout to GridLayout:

public final void createWindowContents(final Shell shell) {
shell.setLayout(new GridLayout());
[...]

Then I create a new Composite where I'm putting the cool bar and align
it to the right like:

[...]
final Composite toolComposite = new Composite(shell, SWT.NONE);
toolComposite.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER,
true, false));
final Control toolbar =
configurer.createCoolBarControl(toolComposite);
[...]

Hope it helps.

Tiago
Re: Move some coolbar actions location to the right most [message #81126 is a reply to message #81097] Thu, 03 April 2008 06:30 Go to previous message
Eclipse UserFriend
Hi,

> What I do is I set the Shell layout to GridLayout:

> public final void createWindowContents(final Shell shell) {
> shell.setLayout(new GridLayout());
> [...]

> Then I create a new Composite where I'm putting the cool bar and align
> it to the right like:

> [...]
> final Composite toolComposite = new Composite(shell, SWT.NONE);
> toolComposite.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER,
> true, false));
> final Control toolbar =
> configurer.createCoolBarControl(toolComposite);
> [...]

I've got it.

Thank you very much for the snippets.


Regards,

Setya
Previous Topic:WG: gsoc product file info
Next Topic:Redirect user to another page after closing application
Goto Forum:
  


Current Time: Sat Aug 30 22:36:16 EDT 2025

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

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

Back to the top