mahesh bhagirath
mahesh bhagirath

Reputation: 173

Header not showing above Property Sheet in Eclipse RCP

I'm working on an Eclipse RCP application where I want to add a header above a PropertySheet using a Composite and a Label. However, while the PropertySheet is displaying correctly, the header is not showing up. Below is my current code:

public class CustomPropertySheetPage extends ExtendedPropertySheetPage {

public CustomPropertySheetPage(AdapterFactoryEditingDomain adapterFactoryEditingDomain) {
    super(adapterFactoryEditingDomain); 
}

@Override
public void createControl(Composite parent) {
    // Set a layout for the parent composite
    parent.setLayout(new GridLayout());

    // Create a composite for the header
    Composite headerComposite = new Composite(parent, SWT.NONE);
    headerComposite.setLayout(new GridLayout());
    headerComposite.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));

    // Add a label to act as the header
    Label headerLabel = new Label(headerComposite, SWT.NONE);
    headerLabel.setText("Extended Properties Header");
    headerLabel.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, true, false));

    // Create a composite for the property sheet
    Composite propertySheetComposite = new Composite(parent, SWT.NONE);
    propertySheetComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

    // Call the super method to create the actual property sheet controls below the
    // header
    super.createControl(propertySheetComposite);
}

}

Issue: The PropertySheet shows up, but the header is missing. I suspect it has something to do with how I am setting the layout or how the controls are added.

What I’ve Tried: Ensuring that the header is created after calling super.createControl(parent). Setting a GridLayout for the composite.

Question: How can I modify this code to properly display the header above the PropertySheet? Should I restructure how the layout is managed?

Upvotes: 0

Views: 19

Answers (0)

Related Questions