|
Re: how could i change my editor to a dirty state [message #144798 is a reply to message #144789] |
Wed, 28 July 2004 07:25   |
Eclipse User |
|
|
|
Originally posted by: rlemaigr.ulb.ac.be
Hello,
Do you use the property sheet entry provided by GEF =
(UndoablePropertySheetEntry) ?
Don't ask me what it is, I don't know, but the result is all the model =
modifications you do through the properties view will be embedded in a =
Command and executed through the CommandStack.
So, as a result:
- the editor dirty state should update when you change smthg in the =
properties view,
- all the modifications done through the properties view should be =
undoable,
- when you change smthg in the model (with Command & CommandStack), if t=
he =
properties view is opened, it should update to reflect the change.
Here is the code to add in the editor class:
private PropertySheetPage propPage;
public Object getAdapter(Class aClass)
{
...
else if (aClass =3D=3D IPropertySheetPage.class)
return getPropertySheetPage();
...
}
public PropertySheetPage getPropertySheetPage()
{
if (propPage =3D=3D null)
{
propPage =3D new PropertySheetPage();
propPage.setRootEntry(GEFPlugin.createUndoablePropertySheetE ntry(getCo=
mmandStack()));
}
return propPage;
}
also, make sure the isDirty method is properly (I don't know if this is =
=
really "properly" but it works) implemented:
public boolean isDirty()
{
return getCommandStack().isDirty();
}
Hope this will help,
r=E9gis
On Wed, 28 Jul 2004 10:20:00 +0000 (UTC), PL Fisher =
<penzhan8451@sina.com> wrote:
> Hi,
>
> When i changed a model's property in properties view ,and how could =
i
> notify
>
> the editor and make it's state dirty?
>
>
> Thanks in advance!
>
-- =
Using Opera's revolutionary e-mail client: http://www.opera.com/m2/
|
|
|
Re: how could i change my editor to a dirty state [message #145002 is a reply to message #144798] |
Wed, 28 July 2004 11:29  |
Eclipse User |
|
|
|
Originally posted by: penzhan8451.sina.com
Thanks for your answer!
In my editor , getAdapter() implemented liked below:
public Object getAdapter(Class type) {
if (type == IContentOutlinePage.class)
return getOutlinePage();
return super.getAdapter(type);
}
The method super.getAdapter(type) had done many works include your
mentioned in eclipse 2.1.3. But PropertySheetEntry had been called
insted of UndoablePropertySheetEntry .
Thanks in advance !
rlemaigr@ulb.ac.be wrote:
> Hello,
> Do you use the property sheet entry provided by GEF
> (UndoablePropertySheetEntry) ?
> Don't ask me what it is, I don't know, but the result is all the model
> modifications you do through the properties view will be embedded in a
> Command and executed through the CommandStack.
> So, as a result:
> - the editor dirty state should update when you change smthg in the
> properties view,
> - all the modifications done through the properties view should be
> undoable,
> - when you change smthg in the model (with Command & CommandStack), if the
> properties view is opened, it should update to reflect the change.
> Here is the code to add in the editor class:
> private PropertySheetPage propPage;
> public Object getAdapter(Class aClass)
> {
> ...
> else if (aClass == IPropertySheetPage.class)
> return getPropertySheetPage();
> ...
> }
> public PropertySheetPage getPropertySheetPage()
> {
> if (propPage == null)
> {
> propPage = new PropertySheetPage();
>
propPage.setRootEntry(GEFPlugin.createUndoablePropertySheetE ntry(getCommandStack()));
> }
> return propPage;
> }
> also, make sure the isDirty method is properly (I don't know if this is
> really "properly" but it works) implemented:
> public boolean isDirty()
> {
> return getCommandStack().isDirty();
> }
> Hope this will help,
> régis
> On Wed, 28 Jul 2004 10:20:00 +0000 (UTC), PL Fisher
> <penzhan8451@sina.com> wrote:
> > Hi,
> >
> > When i changed a model's property in properties view ,and how could i
> > notify
> >
> > the editor and make it's state dirty?
> >
> >
> > Thanks in advance!
> >
|
|
|
Powered by
FUDForum. Page generated in 0.03788 seconds