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)
Help with CTabItem | Not able to view the component [message #497970] 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 #499653 is a reply to message #497970] 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 Smile

http://www.jarvana.com/jarvana/view/org/eclipse/platform/doc /isv/3.3.0-v20070621/isv-3.3.0-v20070621.jar!/reference/api/ org/eclipse/swt/custom/CTabItem.html

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

[Updated on: Mon, 23 November 2009 15:43]

Report message to a moderator

Previous Topic:How to catch delete function in launch configuration un eclipse
Next Topic:Help with CTabItem | Not able to view the component
Goto Forum:
  


Current Time: Sat Aug 08 13:10:01 GMT 2020

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

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

Back to the top