Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Plugin Development Environment (PDE) » Help with CTabItem | Not able to view the component
Help with CTabItem | Not able to view the component [message #603284] Fri, 13 November 2009 15:17 Go to next message
JavaGalaxy  is currently offline JavaGalaxy Friend
Messages: 6
Registered: November 2009
Junior Member

I am new to Plugin development. I am struck with simple problem.

Can anyone help me what is wrong with below code? I can't see anything in the display, its grayed out.

public class MyTab extends CTabItem {

public MyTab(final CTabFolder tabFolder, int style) {
super(tabFolder, style);


final Composite composite = new Composite(tabFolder, style);
GridLayout layout = new GridLayout(3, false);
//layout.marginHeight = layout.marginWidth = 20;

final Canvas canvas = new Canvas(composite, SWT.BORDER);
//canvas.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

Group moduleGroup = new Group(canvas, SWT.NULL);
moduleGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
moduleGroup.setLayout(new GridLayout(2, false));

Text atlPathText = new Text(moduleGroup, SWT.SINGLE | SWT.BORDER);
atlPathText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

final Button browseWorkspace = new Button(moduleGroup, SWT.RIGHT);



And this class is been invoked from another Java file that extends TrayDialog as below

protected Control createDialogArea(Composite parent) {
Composite rootContainer = (Composite) super.createDialogArea(parent);
CTabFolder tabFolder = new CTabFolder(rootContainer, SWT.TOP);
CTabItem info = new MyTab(tabFolder, SWT.NONE);

When the print isShowing() and getBounds(), I get true and 0,0,0,0

Re: Help with CTabItem | Not able to view the component [message #603530 is a reply to message #603284] Mon, 23 November 2009 15:42 Go to previous message
Artur Kronenberg is currently offline Artur KronenbergFriend
Messages: 159
Registered: August 2009
Senior Member

first and most important rule: Read documentation :) amp;start=0&S=ce633c2fab8a3bbe4d2c9575e449e52f

> IMPORTANT: This class is not intended to be subclassed.

> public class MyTab extends CTabItem {

A CTabItem is not a class you should subclass. A CTabItem is just added to the CTabFolder. You basically say:


The item you create has a setControl method. There you add the control you want to display in this Item. If you decide to create your Item in a seperate class, that is no problem. the Control you set on the Item can be a composite, that has the CTabFolder as a parent. This will still work.

Have fun trying it,

Previous Topic:Help with CTabItem | Not able to view the component
Next Topic:Include resources inside bundle jar
Goto Forum:

Current Time: Fri Aug 14 02:39:33 GMT 2020

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

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

Back to the top