Skip to main content



      Home
Home » Archived » Visual Editor (VE) » Editor refreshing
Editor refreshing [message #103398] Wed, 24 August 2005 17:27 Go to next message
Eclipse UserFriend
Originally posted by: danijel_zecevic.hotmail.com

Hello,

how is implemented source refreshing in VE (when you change something in
model by editing propery in property view) and how is implemented model
refreshig when source is edited?

In other words how does the notification of one editor looks
like, when editing in other. Is it posible to tell which part of VE is doing
this.

Is JavaVisualEditorModelChangeController responsible for any of this actions
or are you checking for new actions in action registry...

Thank you,

Danijel
Re: Editor refreshing [message #103445 is a reply to message #103398] Wed, 24 August 2005 18:11 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: richkulp.us.NO_SPAM.ibm.com

They are all very interconnected. They know about each other.

See
http://www.eclipse.org/vep/WebContent/docs/architecture/arch itecture.html


--
Thanks,
Rich Kulp
Re: Editor refreshing [message #103498 is a reply to message #103445] Thu, 25 August 2005 02:06 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: danijel_zecevic.hotmail.com

Hello,

can you describe a implementation of this interconnection. I know that there
is one class for editor which extends CompilationUnitEditor and has
graphical and source editor, but I dont understand what happens when you add
a child to a model of Composite. As much as I understand the model is some
data structure made out of source.

How does model refreshes source when model is changed. I can see that
XMLTextViewer is updated by listening command stack. But I can't figure how
is model refreshing source and other way, how is changed source notifying
model (where is the point that says reload model or generate code).

I would realy need to know how you got this working.

Thank you,

Danijel



"Rich Kulp" <richkulp@us.NO_SPAM.ibm.com> wrote in message
news:deiran$t09$1@news.eclipse.org...
> They are all very interconnected. They know about each other.
>
> See
> http://www.eclipse.org/vep/WebContent/docs/architecture/arch itecture.html
>
>
> --
> Thanks,
> Rich Kulp
Re: Editor refreshing [message #103542 is a reply to message #103498] Thu, 25 August 2005 05:24 Go to previous message
Eclipse UserFriend
Hi ddd,

> ... I dont understand what happens when you add
> a child to a model of Composite. As much as I understand the model is some
> data structure made out of source.

The model is an EMF one that describes instances of Java classes and
relationships between then. For example, suppose you have a Button
whose background color is set to red. You have two IJavaInstance
objects - one for the button and one you are going to create for the
color. There is an EReference which represents the relationship between
the two. Code to set the button might be something like:

IJavaInstance buttonInstance = getSelectedElement();
ResourceSet rSet = buttonInstance.eResource().getResourceSet();
// Create a color for rgb 128,128,128
IJavaInstance colorInstance =
Utilities.createJavaObject(rSet,"org.eclipse.swt.graphics.Color ","new
Color(null,128,128,128)");
// Get the EReference for the background feature
EReference backgroundSF =
buttonInstance.eClass().getEStructuralFeature("background");
// Set the color
buttonInstance.eSet(backgroundSF,colorInstance):

This is over simplified but it's basically what occurs in the VE. When
you use the property sheet an IJavaInstance is created for the object
you that is the property value and this is set into the source
IJavaInstance for the appropiate EReference.

EMF has Adapter objects that are also known as notifiers. Whenever the
IJavaInstance is changed (a feature set, removed, etc...) the adapters
are notified. The VE has several important adapters

BeanProxyAdapter - this listens to changes and updates the live
JavaBeans on the target VM
BeanDecoderAdapter - this listens to changes and updates the source code

Which adapter is used for which IJavaInstance is determined by
decorators on the JavaClass that are defined in .override files which is
basically a big pluggable factory pattern that allows the VE to be
customized for particular classes.

There are many other adapters that are often placed on objects by things
like the GEF edit parts who need to listen to changes to update their
children or a TreeEditPart who might need to listen so it can update its
label if a "text" property used in the label is changed.

> How does model refreshes source when model is changed. I can see that
> XMLTextViewer is updated by listening command stack. But I can't figure how
> is model refreshing source and other way, how is changed source notifying
> model (where is the point that says reload model or generate code).

The source is driven by the BeanDecoderAdapter. The first place to look
would be to debug this and do simple scenarios like using the property
sheet to change String or int properties.

Composite is a bit more complex because of the relationship between the
child Control and its parent, but the idea is the same and it's just a
twist that involves having the initialization code for the Control know
about its parent.

The command stack listener is used for the XMLTextViewer but this is a
kludge. All commands are executed through a stack which provides hooks
for an undo framework and it's a good global point to be told whenever
any change to the model occured. It's used by the XMLTextViewer to do a
global refresh however with no precision - what you want is the
adapter/notifier framework.

Best regards,

Joe Winchester
Re: Editor refreshing [message #610378 is a reply to message #103398] Wed, 24 August 2005 18:11 Go to previous message
Eclipse UserFriend
Originally posted by: richkulp.us.NO_SPAM.ibm.com

They are all very interconnected. They know about each other.

See
http://www.eclipse.org/vep/WebContent/docs/architecture/arch itecture.html


--
Thanks,
Rich Kulp
Re: Editor refreshing [message #610382 is a reply to message #103445] Thu, 25 August 2005 02:06 Go to previous message
Eclipse UserFriend
Hello,

can you describe a implementation of this interconnection. I know that there
is one class for editor which extends CompilationUnitEditor and has
graphical and source editor, but I dont understand what happens when you add
a child to a model of Composite. As much as I understand the model is some
data structure made out of source.

How does model refreshes source when model is changed. I can see that
XMLTextViewer is updated by listening command stack. But I can't figure how
is model refreshing source and other way, how is changed source notifying
model (where is the point that says reload model or generate code).

I would realy need to know how you got this working.

Thank you,

Danijel



"Rich Kulp" <richkulp@us.NO_SPAM.ibm.com> wrote in message
news:deiran$t09$1@news.eclipse.org...
> They are all very interconnected. They know about each other.
>
> See
> http://www.eclipse.org/vep/WebContent/docs/architecture/arch itecture.html
>
>
> --
> Thanks,
> Rich Kulp
Re: Editor refreshing [message #610384 is a reply to message #103498] Thu, 25 August 2005 05:24 Go to previous message
Eclipse UserFriend
Hi ddd,

> ... I dont understand what happens when you add
> a child to a model of Composite. As much as I understand the model is some
> data structure made out of source.

The model is an EMF one that describes instances of Java classes and
relationships between then. For example, suppose you have a Button
whose background color is set to red. You have two IJavaInstance
objects - one for the button and one you are going to create for the
color. There is an EReference which represents the relationship between
the two. Code to set the button might be something like:

IJavaInstance buttonInstance = getSelectedElement();
ResourceSet rSet = buttonInstance.eResource().getResourceSet();
// Create a color for rgb 128,128,128
IJavaInstance colorInstance =
Utilities.createJavaObject(rSet,"org.eclipse.swt.graphics.Color ","new
Color(null,128,128,128)");
// Get the EReference for the background feature
EReference backgroundSF =
buttonInstance.eClass().getEStructuralFeature("background");
// Set the color
buttonInstance.eSet(backgroundSF,colorInstance):

This is over simplified but it's basically what occurs in the VE. When
you use the property sheet an IJavaInstance is created for the object
you that is the property value and this is set into the source
IJavaInstance for the appropiate EReference.

EMF has Adapter objects that are also known as notifiers. Whenever the
IJavaInstance is changed (a feature set, removed, etc...) the adapters
are notified. The VE has several important adapters

BeanProxyAdapter - this listens to changes and updates the live
JavaBeans on the target VM
BeanDecoderAdapter - this listens to changes and updates the source code

Which adapter is used for which IJavaInstance is determined by
decorators on the JavaClass that are defined in .override files which is
basically a big pluggable factory pattern that allows the VE to be
customized for particular classes.

There are many other adapters that are often placed on objects by things
like the GEF edit parts who need to listen to changes to update their
children or a TreeEditPart who might need to listen so it can update its
label if a "text" property used in the label is changed.

> How does model refreshes source when model is changed. I can see that
> XMLTextViewer is updated by listening command stack. But I can't figure how
> is model refreshing source and other way, how is changed source notifying
> model (where is the point that says reload model or generate code).

The source is driven by the BeanDecoderAdapter. The first place to look
would be to debug this and do simple scenarios like using the property
sheet to change String or int properties.

Composite is a bit more complex because of the relationship between the
child Control and its parent, but the idea is the same and it's just a
twist that involves having the initialization code for the Control know
about its parent.

The command stack listener is used for the XMLTextViewer but this is a
kludge. All commands are executed through a stack which provides hooks
for an undo framework and it's a good global point to be told whenever
any change to the model occured. It's used by the XMLTextViewer to do a
global refresh however with no precision - what you want is the
adapter/notifier framework.

Best regards,

Joe Winchester
Previous Topic:How to VE with Eclipse 3.0.0
Next Topic:Another code generation for SWT/JFACE
Goto Forum:
  


Current Time: Wed May 28 23:16:30 EDT 2025

Powered by FUDForum. Page generated in 0.03264 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top