property sheet and mulitpage editor. [message #154342] |
Sat, 16 October 2004 19:22 |
Eclipse User |
|
|
|
Originally posted by: boby.vt.edu
Hi,
i have a problem with property sheet and multipage editor. i looked at
the posts but they didnt help me. i think i have added what all is
required for the property viewer to show the properties of the model,
but its not showing up. Any help is much appreciated.
Thanks
Basically i made the main page implement IAdaptable and then added code
for getAdapter as follows
public Object getAdapter(Class type) {
if (type == IPropertySheetPage.class) {
PropertySheetPage page = new PropertySheetPage();
page.setRootEntry(GEFPlugin.createUndoablePropertySheetEntry (
getDelegatingCommandStack()));
return page;
}
return super.getAdapter(type);
}
where delegatingcommandStack delegates everything defined in the
CommandStack except event listners. The stack is copied from the
networkEditor example.
Then in the model i implemented IPropertySource and added the following code
protected static IPropertyDescriptor[] descriptors;
public static final String NAME = "name"; //$NON-NLS-1$
static {
descriptors = new IPropertyDescriptor[] {
new TextPropertyDescriptor(NAME, "Name")};
}
public IPropertyDescriptor[] getPropertyDescriptors() {
return descriptors;
}
public Object getPropertyValue(Object propName) {
if (NAME.equals(propName))
return getName();
return null;
}
public void setPropertyValue(Object id, Object value){
if (id == NAME)
setName((String)value);
}
public boolean isPropertySet(Object propName){
return true;
}
public Object getEditableValue(){
return this;
}
public void resetPropertyValue(Object propName){
}
|
|
|
Re: property sheet and mulitpage editor. [message #154413 is a reply to message #154342] |
Mon, 18 October 2004 16:14 |
Eclipse User |
|
|
|
Originally posted by: boby.vt.edu
i solved the problem. it was just that my model component was
implemented in two parts and i was implementing IPropertySource at the
wrong part
Boby George wrote:
> Hi,
> i have a problem with property sheet and multipage editor. i looked at
> the posts but they didnt help me. i think i have added what all is
> required for the property viewer to show the properties of the model,
> but its not showing up. Any help is much appreciated.
> Thanks
>
> Basically i made the main page implement IAdaptable and then added code
> for getAdapter as follows
>
> public Object getAdapter(Class type) {
> if (type == IPropertySheetPage.class) {
> PropertySheetPage page = new PropertySheetPage();
> page.setRootEntry(GEFPlugin.createUndoablePropertySheetEntry (
> getDelegatingCommandStack()));
> return page;
> }
> return super.getAdapter(type);
> }
>
> where delegatingcommandStack delegates everything defined in the
> CommandStack except event listners. The stack is copied from the
> networkEditor example.
>
> Then in the model i implemented IPropertySource and added the following
> code
> protected static IPropertyDescriptor[] descriptors;
> public static final String NAME = "name"; //$NON-NLS-1$
> static {
> descriptors = new IPropertyDescriptor[] {
> new TextPropertyDescriptor(NAME, "Name")};
> }
> public IPropertyDescriptor[] getPropertyDescriptors() {
> return descriptors;
> }
>
> public Object getPropertyValue(Object propName) {
> if (NAME.equals(propName))
> return getName();
> return null;
> }
>
> public void setPropertyValue(Object id, Object value){
> if (id == NAME)
> setName((String)value);
> }
>
> public boolean isPropertySet(Object propName){
> return true;
> }
>
> public Object getEditableValue(){
> return this;
> }
> public void resetPropertyValue(Object propName){
> }
|
|
|
Powered by
FUDForum. Page generated in 0.02799 seconds