Navigating between Property Pages with a Link [message #287401] |
Wed, 29 June 2005 15:39 |
Eclipse User |
|
|
|
Originally posted by: mark_melvin.amis.com
Hi there,
I am trying madly to finish a feature today, and I wanted to be able to
switch PropertyPages in my Project's properties dialog, using a Link. I
have done this with my preference pages and it is very useful and
user-friendly. However, I cannot see how to do this in a PropertyDialog
without using a discouraged, internal class.
I have a subclass of PropertyPage, so here is what I tried to do:
final Link link= new Link(composite, SWT.NONE);
final String target=
" org.eclipse.ui.externaltools.propertypages.BuilderPropertyPa ge ";
//$NON-NLS-1$
link.setText("<a>ShowMe1</a>"); //$NON-NLS-1$
link.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
PreferencesUtil.createPropertyDialogOn(getShell(),
getProject(), target, null, null);
}
});
But this does nothing. It appears that this method is not smart enough
to re-use the current PropertyDilaog (the way
PreferencesUtil#createPreferenceDialogOn works).
So, I managed to switch pages by making my selection listener do the
following:
public void widgetSelected(SelectionEvent e) {
if (getContainer() instanceof PropertyDialog) {
((PropertyDialog) getContainer()).setCurrentPageId(target);
}
}
This works, however, PropertyDialog is internal, and I get warnings. I
can't see any other way to do this. Hopefully I am missing something??
Thanks,
Mark.
|
|
|
|
Powered by
FUDForum. Page generated in 0.03421 seconds