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
Hi,

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);

setText("Info123");

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

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));
moduleGroup.setText("Module");

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

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

}

}

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);
System.out.println(info.isShowing());
System.out.println(info.getBounds());
}

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

Thanks
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
Hey,

first and most important rule: Read documentation :)

http://www.eclipse.org/forums/index.php?t=msg&th=157895& amp;start=0&S=ce633c2fab8a3bbe4d2c9575e449e52f

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


Quote:
> 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:

CTabFolder.addItem(CTabItem).

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,

best,
Artur
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