Hi,
I'm trying to add a TabbedPropertySheet based on the following tutorial: http://www.eclipse.org/articles/Article-Tabbed-Properties/tabbed_properties_view.html A difference is that I'm using a TreeViewer but that shouldn't matter.
I'm just getting the message "Properties are not available".
Thats is how I implemented it so far
The view: (Contributor ID is unique [org.test.view])
public class MyTreeView extends ViewPart implements TabbedPropertySheetPageContributor{
public String getContributorId() {
return getSite().getId();
}
public Object getAdapter(Class adapter) {
if (adapter == IPropertySheetPage.class)
return new TabbedPropertySheetPage((ITabbedPropertySheetPageContributor) this);
return super.getAdapter(adapter);
}
public void createPartControl(Composite parent) {
...
getSite().setSelectionProvider(viewer);
}
}
The plugin.xml
<extension point="org.eclipse.ui.views.properties.tabbed.propertyContributor">
<propertyContributor contributorId="org.test.view">
<propertyCategory category="sample"/>
</propertyContributor>
</extension>
<extension point="org.eclipse.ui.views.properties.tabbed.propertyTabs">
<propertyTabs contributorId="org.test.view">
<propertyTab
category="sample"
id="org.test.TestTab"
label="Test"/>
</propertyTabs>
</extension>
<extension point="org.eclipse.ui.views.properties.tabbed.propertySections">
<propertySections contributorId="org.test.view">
<propertySection
class="org.test.properties.TestSection"
id="org.test.TestSection"
tab="org.test.TestTab">
</propertySection>
</propertySections>
</extension>
The property page with the control:
public class TestSection extends AbstractPropertySection {
private Text labelText;
public TestSection() {
}
@Override
public void createControls(Composite parent,
TabbedPropertySheetPage aTabbedPropertySheetPage) {
super.createControls(parent, aTabbedPropertySheetPage);
Composite composite = getWidgetFactory()
.createFlatFormComposite(parent);
FormData data;
labelText = getWidgetFactory().createText(composite, ""); //$NON-NLS-1$
data = new FormData();
data.left = new FormAttachment(0, STANDARD_LABEL_WIDTH);
data.right = new FormAttachment(100, 0);
data.top = new FormAttachment(0, ITabbedPropertyConstants.VSPACE);
labelText.setLayoutData(data);
CLabel labelLabel = getWidgetFactory()
.createCLabel(composite, "Label:"); //$NON-NLS-1$
data = new FormData();
data.left = new FormAttachment(0, 0);
data.right = new FormAttachment(labelText,
-ITabbedPropertyConstants.HSPACE);
data.top = new FormAttachment(labelText, 0, SWT.CENTER);
labelLabel.setLayoutData(data);
}
@Override
public void setInput(IWorkbenchPart part, ISelection selection) {
super.setInput(part, selection);
Assert.isTrue(selection instanceof IStructuredSelection);
Object input = ((IStructuredSelection) selection).getFirstElement();
Assert.isTrue(input instanceof Action);
Action action = (Action)input;
this.labelText.setText(action.getDescription());
}
The problem is that the method createControls in the class TestSection is not being called.
Does anybody have an idea what I am doing wrong?
Thanks in advance
Lars