![](/images/blogjava_net/leeguannan/snapaaaaaa.gif)
我用代码硬生生的把Eclipse-RCP丑陋的Coolbar替换掉了,但是不爽的是,Viewer上使用的是CTabFolder,而这个CTabFolder的产生,我没有办法操控,希望有高手指点。
修改代码如下:
1
package
test;
2![](/Images/OutliningIndicators/None.gif)
3
import
org.eclipse.swt.SWT;
4
import
org.eclipse.swt.graphics.Point;
5
import
org.eclipse.swt.layout.FillLayout;
6
import
org.eclipse.swt.widgets.Composite;
7
import
org.eclipse.swt.widgets.Shell;
8
import
org.eclipse.ui.application.ActionBarAdvisor;
9
import
org.eclipse.ui.application.IActionBarConfigurer;
10
import
org.eclipse.ui.application.IWorkbenchWindowConfigurer;
11
import
org.eclipse.ui.application.WorkbenchWindowAdvisor;
12
import
org.eclipse.ui.internal.WindowTrimProxy;
13
import
org.eclipse.ui.internal.WorkbenchMessages;
14
import
org.eclipse.ui.internal.WorkbenchWindowConfigurer;
15
import
org.eclipse.ui.internal.layout.TrimLayout;
16![](/Images/OutliningIndicators/None.gif)
17
import
com.hexapixel.widgets.generic.ColorCache;
18
import
com.hexapixel.widgets.ribbon.RibbonTab;
19
import
com.hexapixel.widgets.ribbon.RibbonTabFolder;
20![](/Images/OutliningIndicators/None.gif)
21![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
public
class
ApplicationWorkbenchWindowAdvisor
extends
WorkbenchWindowAdvisor
{
22![](/Images/OutliningIndicators/InBlock.gif)
23
private TrimLayout defaultLayout;
24
private Composite topComposite;
25
private WindowTrimProxy topCompositeTrim;
26
private Composite pageComposite;
27
28![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
public ApplicationWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer)
{
29
super(configurer);
30
}
31![](/Images/OutliningIndicators/InBlock.gif)
32![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
public ActionBarAdvisor createActionBarAdvisor(IActionBarConfigurer configurer)
{
33
return new ApplicationActionBarAdvisor(configurer);
34
}
35
36![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
public void preWindowOpen()
{
37
IWorkbenchWindowConfigurer configurer = getWindowConfigurer();
38
configurer.setInitialSize(new Point(400, 300));
39
configurer.setShowCoolBar(false);
40
configurer.setShowStatusLine(false);
41
configurer.setTitle("Hello RCP");
42
}
43![](/Images/OutliningIndicators/InBlock.gif)
44
@Override
45![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
public void createWindowContents(Shell shell)
{
46
shell.setBackground(ColorCache.getInstance().getColor(182, 206, 238));
47
// TODO Auto-generated method stub
48
defaultLayout = new TrimLayout();
49
defaultLayout.setSpacing(2, 2, 2, 2);
50
defaultLayout.setMargins(2, 2);
51
shell.setLayout(defaultLayout);
52
53
//topComposite
54
topComposite = new Composite(shell, SWT.None);
55
topComposite.setLayout(new FillLayout(SWT.VERTICAL));
56
topComposite.setBackground(ColorCache.getInstance().getColor(182, 206, 238));
57
58
final RibbonTabFolder ftf = new RibbonTabFolder(topComposite, SWT.NONE);
59
RibbonTab ft0 = new RibbonTab(ftf, "Home");
60
RibbonTab ft1 = new RibbonTab(ftf, "Insert");
61
new RibbonTab(ftf, "Page Layout");
62
new RibbonTab(ftf, "References");
63
64
topCompositeTrim = new WindowTrimProxy(topComposite,"org.eclipse.ui.internal.WorkbenchWindow.topBar", WorkbenchMessages.TrimCommon_Main_TrimName, SWT.NONE, true);
65
66
67
68
69
pageComposite = (Composite) ((WorkbenchWindowConfigurer) getWindowConfigurer()).createPageComposite(shell);
70
setLayoutDataForContents();
71
}
72![](/Images/OutliningIndicators/InBlock.gif)
73![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
private void setLayoutDataForContents()
{
74
updateLayoutDataForContents();
75
76
}
77![](/Images/OutliningIndicators/InBlock.gif)
78![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
private void updateLayoutDataForContents()
{
79![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
if (defaultLayout == null)
{
80
return;
81
}
82
defaultLayout.addTrim(SWT.TOP, topCompositeTrim);
83
topComposite.setVisible(true);
84
85
pageComposite.setBackground(ColorCache.getInstance().getColor(182, 206, 238));
86
defaultLayout.setCenterControl(pageComposite);
87
88
}
89
90
}
91
![](/Images/OutliningIndicators/None.gif)
2
![](/Images/OutliningIndicators/None.gif)
3
![](/Images/OutliningIndicators/None.gif)
4
![](/Images/OutliningIndicators/None.gif)
5
![](/Images/OutliningIndicators/None.gif)
6
![](/Images/OutliningIndicators/None.gif)
7
![](/Images/OutliningIndicators/None.gif)
8
![](/Images/OutliningIndicators/None.gif)
9
![](/Images/OutliningIndicators/None.gif)
10
![](/Images/OutliningIndicators/None.gif)
11
![](/Images/OutliningIndicators/None.gif)
12
![](/Images/OutliningIndicators/None.gif)
13
![](/Images/OutliningIndicators/None.gif)
14
![](/Images/OutliningIndicators/None.gif)
15
![](/Images/OutliningIndicators/None.gif)
16
![](/Images/OutliningIndicators/None.gif)
17
![](/Images/OutliningIndicators/None.gif)
18
![](/Images/OutliningIndicators/None.gif)
19
![](/Images/OutliningIndicators/None.gif)
20
![](/Images/OutliningIndicators/None.gif)
21
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
![](/Images/OutliningIndicators/ContractedBlock.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/9b8a8a44dd1c74ae49c20a7cd451974e.gif)
22
![](/Images/OutliningIndicators/InBlock.gif)
23
![](/Images/OutliningIndicators/InBlock.gif)
24
![](/Images/OutliningIndicators/InBlock.gif)
25
![](/Images/OutliningIndicators/InBlock.gif)
26
![](/Images/OutliningIndicators/InBlock.gif)
27
![](/Images/OutliningIndicators/InBlock.gif)
28
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![](/Images/OutliningIndicators/ContractedSubBlock.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/9b8a8a44dd1c74ae49c20a7cd451974e.gif)
29
![](/Images/OutliningIndicators/InBlock.gif)
30
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
31
![](/Images/OutliningIndicators/InBlock.gif)
32
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![](/Images/OutliningIndicators/ContractedSubBlock.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/9b8a8a44dd1c74ae49c20a7cd451974e.gif)
33
![](/Images/OutliningIndicators/InBlock.gif)
34
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
35
![](/Images/OutliningIndicators/InBlock.gif)
36
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![](/Images/OutliningIndicators/ContractedSubBlock.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/9b8a8a44dd1c74ae49c20a7cd451974e.gif)
37
![](/Images/OutliningIndicators/InBlock.gif)
38
![](/Images/OutliningIndicators/InBlock.gif)
39
![](/Images/OutliningIndicators/InBlock.gif)
40
![](/Images/OutliningIndicators/InBlock.gif)
41
![](/Images/OutliningIndicators/InBlock.gif)
42
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
43
![](/Images/OutliningIndicators/InBlock.gif)
44
![](/Images/OutliningIndicators/InBlock.gif)
45
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![](/Images/OutliningIndicators/ContractedSubBlock.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/9b8a8a44dd1c74ae49c20a7cd451974e.gif)
46
![](/Images/OutliningIndicators/InBlock.gif)
47
![](/Images/OutliningIndicators/InBlock.gif)
48
![](/Images/OutliningIndicators/InBlock.gif)
49
![](/Images/OutliningIndicators/InBlock.gif)
50
![](/Images/OutliningIndicators/InBlock.gif)
51
![](/Images/OutliningIndicators/InBlock.gif)
52
![](/Images/OutliningIndicators/InBlock.gif)
53
![](/Images/OutliningIndicators/InBlock.gif)
54
![](/Images/OutliningIndicators/InBlock.gif)
55
![](/Images/OutliningIndicators/InBlock.gif)
56
![](/Images/OutliningIndicators/InBlock.gif)
57
![](/Images/OutliningIndicators/InBlock.gif)
58
![](/Images/OutliningIndicators/InBlock.gif)
59
![](/Images/OutliningIndicators/InBlock.gif)
60
![](/Images/OutliningIndicators/InBlock.gif)
61
![](/Images/OutliningIndicators/InBlock.gif)
62
![](/Images/OutliningIndicators/InBlock.gif)
63
![](/Images/OutliningIndicators/InBlock.gif)
64
![](/Images/OutliningIndicators/InBlock.gif)
65
![](/Images/OutliningIndicators/InBlock.gif)
66
![](/Images/OutliningIndicators/InBlock.gif)
67
![](/Images/OutliningIndicators/InBlock.gif)
68
![](/Images/OutliningIndicators/InBlock.gif)
69
![](/Images/OutliningIndicators/InBlock.gif)
70
![](/Images/OutliningIndicators/InBlock.gif)
71
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
72
![](/Images/OutliningIndicators/InBlock.gif)
73
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![](/Images/OutliningIndicators/ContractedSubBlock.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/9b8a8a44dd1c74ae49c20a7cd451974e.gif)
74
![](/Images/OutliningIndicators/InBlock.gif)
75
![](/Images/OutliningIndicators/InBlock.gif)
76
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
77
![](/Images/OutliningIndicators/InBlock.gif)
78
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![](/Images/OutliningIndicators/ContractedSubBlock.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/9b8a8a44dd1c74ae49c20a7cd451974e.gif)
79
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![](/Images/OutliningIndicators/ContractedSubBlock.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/9b8a8a44dd1c74ae49c20a7cd451974e.gif)
80
![](/Images/OutliningIndicators/InBlock.gif)
81
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
82
![](/Images/OutliningIndicators/InBlock.gif)
83
![](/Images/OutliningIndicators/InBlock.gif)
84
![](/Images/OutliningIndicators/InBlock.gif)
85
![](/Images/OutliningIndicators/InBlock.gif)
86
![](/Images/OutliningIndicators/InBlock.gif)
87
![](/Images/OutliningIndicators/InBlock.gif)
88
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
89
![](/Images/OutliningIndicators/InBlock.gif)
90
![](/Images/OutliningIndicators/ExpandedBlockEnd.gif)
91
![](/Images/OutliningIndicators/None.gif)