Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Nebula » HowTo: open a view perspecitve with a ribbonbutton?
HowTo: open a view perspecitve with a ribbonbutton? [message #598326] Thu, 01 October 2009 11:48 Go to next message
Wok Show is currently offline Wok ShowFriend
Messages: 40
Registered: July 2009
Member
hi everybody,

i tried to bind the RibbonTabFolder and Buttons in the ApplicationWorkbenchWindowAdvisor, so if i want to open a new view/perspective in the shell with the RibbonButton it doesn'n work, wh

here is my code:


public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor {

private TrimLayout defaultLayout;
private Composite topComposite;
private WindowTrimProxy topCompositeTrim;
private Composite pageComposite;
IWorkbenchWindowConfigurer configurer;

public ApplicationWorkbenchWindowAdvisor(
IWorkbenchWindowConfigurer configurer) {
super(configurer);
}

public ActionBarAdvisor createActionBarAdvisor(
IActionBarConfigurer configurer) {
return new ApplicationActionBarAdvisor(configurer);
}

public void preWindowOpen() {
configurer = getWindowConfigurer();
configurer.setInitialSize(new Point(400, 300));
configurer.setShowCoolBar(false);
configurer.setShowStatusLine(false);
configurer.setTitle("RCP Application");
}

public void createWindowContents(Shell shell) {

configurer = getWindowConfigurer();

shell.setBackground(ColorCache.getInstance().getColor(182, 206, 238));
// TODO Auto-generated method stub
defaultLayout = new TrimLayout();
// defaultLayout.setSpacing(2, 2, 2, 2);
// defaultLayout.setMargins(2, 2);
shell.setLayout(defaultLayout);

// topComposite
topComposite = new Composite(shell, SWT.None);
topComposite.setLayout(new FillLayout(SWT.VERTICAL));
topComposite.setBackground(ColorCache.getInstance().getColor (182, 206,
238));

final RibbonTabFolder ftf = new RibbonTabFolder(topComposite, SWT.NONE);
RibbonTab ft0 = new RibbonTab(ftf, "Home");
RibbonTab ft1 = new RibbonTab(ftf, "Insert");
new RibbonTab(ftf, "Page Layout");
new RibbonTab(ftf, "References");

RibbonTooltip toolTip = new RibbonTooltip("RibbonTooltip", "This is a RibbonTooltip content text.\n\nhttp://www.snakedj.ch - \\c255000000swiss java blog \\x\nhttp://www.jugr.ch - \\c255000000Java User Group Graubünden \\x", ImageCache.getImage("tooltip.jpg"), ImageCache.getImage("questionmark.gif"), "Press F1 for more help");
RibbonGroup group1 = new RibbonGroup(ft0, "Button1", toolTip);
RibbonButton b1 = new RibbonButton(group1, ImageCache.getImage("olb_picture4.gif"), "Button1",RibbonButton.STYLE_ARROW_DOWN);
RibbonButton b2 = new RibbonButton(group1, ImageCache.getImage("olb_picture5.gif"), "J2EE",RibbonButton.STYLE_NO_DEPRESS);
new RibbonButton(group1, ImageCache.getImage("olb_picture6.gif"), "J2ME",RibbonButton.STYLE_ARROW_DOWN);

b2.addSelectionListener(new SelectionListener() {

@Override
public void widgetSelected(SelectionEvent e) {
// MessageDialog.openError(new Shell(), "Test", "dsfasf");



try {
getWindowConfigurer().getWindow().getActivePage().showView("de.ribbon.test.view ");
} catch (PartInitException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}

// showView("de.ribbon.test.view");


}

@Override
public void widgetDefaultSelected(SelectionEvent e) {
MessageDialog.openError(new Shell(), "Test2222", "dsfasf111111");

}
});

topCompositeTrim = new WindowTrimProxy(topComposite,
"org.eclipse.ui.internal.WorkbenchWindow.topBar",
WorkbenchMessages.TrimCommon_Main_TrimName, SWT.NONE, true);

pageComposite = (Composite) ((WorkbenchWindowConfigurer) getWindowConfigurer())
.createPageComposite(shell);


setLayoutDataForContents();
}

private void setLayoutDataForContents() {
updateLayoutDataForContents();

}

private void updateLayoutDataForContents() {
if (defaultLayout == null) {
return;
}
defaultLayout.addTrim(SWT.TOP, topCompositeTrim);
topComposite.setVisible(true);


pageComposite.setBackground(ColorCache.getInstance().getColo r(182, 206,
238));

defaultLayout.setCenterControl(pageComposite);

}
}
y?

thanks a lot.

greez DC
Re: HowTo: open a view perspecitve with a ribbonbutton? [message #598334 is a reply to message #598326] Thu, 01 October 2009 16:40 Go to previous message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Ribbon is not a Nebula Component so we don't give support for this.

Tom

Chau schrieb:
> hi everybody,
>
> i tried to bind the RibbonTabFolder and Buttons in the
> ApplicationWorkbenchWindowAdvisor, so if i want to open a new
> view/perspective in the shell with the RibbonButton it doesn'n work, wh
>
> here is my code:
>
>
> public class ApplicationWorkbenchWindowAdvisor extends
> WorkbenchWindowAdvisor {
>
> private TrimLayout defaultLayout;
> private Composite topComposite;
> private WindowTrimProxy topCompositeTrim;
> private Composite pageComposite;
> IWorkbenchWindowConfigurer configurer;
>
> public ApplicationWorkbenchWindowAdvisor(
> IWorkbenchWindowConfigurer configurer) {
> super(configurer);
> }
>
> public ActionBarAdvisor createActionBarAdvisor(
> IActionBarConfigurer configurer) {
> return new ApplicationActionBarAdvisor(configurer);
> }
>
> public void preWindowOpen() {
> configurer = getWindowConfigurer();
> configurer.setInitialSize(new Point(400, 300));
> configurer.setShowCoolBar(false);
> configurer.setShowStatusLine(false);
> configurer.setTitle("RCP Application");
> }
>
> public void createWindowContents(Shell shell) {
>
> configurer = getWindowConfigurer();
>
> shell.setBackground(ColorCache.getInstance().getColor(182, 206,
> 238));
> // TODO Auto-generated method stub
> defaultLayout = new TrimLayout();
> // defaultLayout.setSpacing(2, 2, 2, 2);
> // defaultLayout.setMargins(2, 2);
> shell.setLayout(defaultLayout);
>
> // topComposite
> topComposite = new Composite(shell, SWT.None);
> topComposite.setLayout(new FillLayout(SWT.VERTICAL));
>
> topComposite.setBackground(ColorCache.getInstance().getColor (182, 206,
> 238));
>
> final RibbonTabFolder ftf = new RibbonTabFolder(topComposite,
> SWT.NONE);
> RibbonTab ft0 = new RibbonTab(ftf, "Home");
> RibbonTab ft1 = new RibbonTab(ftf, "Insert");
> new RibbonTab(ftf, "Page Layout");
> new RibbonTab(ftf, "References");
>
> RibbonTooltip toolTip = new RibbonTooltip("RibbonTooltip", "This
> is a RibbonTooltip content text.\n\nhttp://www.snakedj.ch -
> \\c255000000swiss java blog \\x\nhttp://www.jugr.ch - \\c255000000Java
> User Group Graubünden \\x", ImageCache.getImage("tooltip.jpg"),
> ImageCache.getImage("questionmark.gif"), "Press F1 for more help");
> RibbonGroup group1 = new RibbonGroup(ft0, "Button1", toolTip);
> RibbonButton b1 = new RibbonButton(group1,
> ImageCache.getImage("olb_picture4.gif"),
> "Button1",RibbonButton.STYLE_ARROW_DOWN);
> RibbonButton b2 = new RibbonButton(group1,
> ImageCache.getImage("olb_picture5.gif"),
> "J2EE",RibbonButton.STYLE_NO_DEPRESS);
> new RibbonButton(group1,
> ImageCache.getImage("olb_picture6.gif"),
> "J2ME",RibbonButton.STYLE_ARROW_DOWN);
>
> b2.addSelectionListener(new SelectionListener() {
>
> @Override
> public void widgetSelected(SelectionEvent e) {
> // MessageDialog.openError(new Shell(), "Test", "dsfasf");
>
>
>
> try {
>
> getWindowConfigurer().getWindow().getActivePage().showView("de.ribbon.test.view ");
>
> } catch (PartInitException e1) {
> // TODO Auto-generated catch block
> e1.printStackTrace();
> }
>
> // showView("de.ribbon.test.view");
>
>
> }
>
> @Override
> public void widgetDefaultSelected(SelectionEvent e) {
> MessageDialog.openError(new Shell(), "Test2222",
> "dsfasf111111");
>
> }
> });
>
> topCompositeTrim = new WindowTrimProxy(topComposite,
> "org.eclipse.ui.internal.WorkbenchWindow.topBar",
> WorkbenchMessages.TrimCommon_Main_TrimName, SWT.NONE,
> true);
>
> pageComposite = (Composite) ((WorkbenchWindowConfigurer)
> getWindowConfigurer())
> .createPageComposite(shell);
>
>
> setLayoutDataForContents();
> }
>
> private void setLayoutDataForContents() {
> updateLayoutDataForContents();
>
> }
>
> private void updateLayoutDataForContents() {
> if (defaultLayout == null) {
> return;
> }
> defaultLayout.addTrim(SWT.TOP, topCompositeTrim);
> topComposite.setVisible(true);
>
>
>
> pageComposite.setBackground(ColorCache.getInstance().getColo r(182, 206,
> 238));
>
> defaultLayout.setCenterControl(pageComposite);
>
> }
> }
> y?
>
> thanks a lot.
>
> greez DC
Previous Topic:HowTo: open a view perspecitve with a ribbonbutton?
Next Topic:Drag & Drop within Compositetable
Goto Forum:
  


Current Time: Thu Sep 19 10:55:04 GMT 2024

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

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

Back to the top