Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Visual Editor (VE) » VE questions - .override files
VE questions - .override files [message #101866] Wed, 10 August 2005 14:54 Go to next message
hanys is currently offline hanysFriend
Messages: 188
Registered: July 2009
Senior Member
Hi all,

I have some questions about VE.

QUESTIONS:
1) Where can I find it?
2) What parses .override files?
3) How I test if some override file is processed?
4) Where may I start?
5) Which are mechanisms To Extend VE for example (are they only
decorators?):
-custom gode generation parsing


I tried to start with tutorial from Dr Gili Mendel et al.,
but it seams that it ignores that .override file and throws NPE,
when it tries to find decorator for "text" property.

I don't know what is wrong. Can somebody help me?

Thanks in advance.
John
Re: VE questions - .override files [message #101997 is a reply to message #101866] Thu, 11 August 2005 14:34 Go to previous messageGo to next message
Joe Winchester is currently offline Joe WinchesterFriend
Messages: 496
Registered: July 2009
Senior Member
Hi John,

> 1) Where can I find it? 2) What parses .override files?

BeanInfoClassAdapter.

> 3) How I test if some override file is processed?

What I usually do is put a breakpoint in
protected void applyExtensionDocTo(...);
This will be called for every class and interface that the class being
edited touches so there is a bit of noise, but just check the JavaClass
argument each time it gets stopped until it comes across your one. Then
debug further to see what's going wrong with your .override.

Common errors I always find are a) that the beaninfo.registrations
extension does not actually declare the /override folder. b) there are
XML errors however these should get put into the .log file and catching
SAXParseException also helps to find these.

> 4) Where may I start?

Try breakpoints in BeanInfoClassAdapter and also be sure the /override
file is declared correctly in the plugin.xml

> 5) Which are mechanisms To Extend VE for example (are they only
> decorators?):
> -custom gode generation parsing

There are many but unfortunately we don't document them all. However we
do use them all, so anything and everything that is done by Swing/SWT or
RCP is done through extension points. The best way is to find a class
that does what you want and look at it. For example Composite.override
declares a relationship to children, as does JTabbedPane.override.

What's the scenario you're trying to get working through a .override ?
If you describe it hopefully it'll help to point you towards useful
existing .override files to look at and get inspiration from.

> I tried to start with tutorial from Dr Gili Mendel et al., but it seams
> that it ignores that .override file and throws NPE,

Can you post the stack trace place ? Is this you running the actually
finished complete code that throws the NPE or your implementation you
built following the sample ? If it's the former this is our bug and we
need to fix it.

> when it tries to find decorator for "text" property.

You're not the first person to mention this - someone else had the same
problem. We'll look into it

Best regards,

Joe Winchester
Re: VE questions - .override files [message #102028 is a reply to message #101997] Thu, 11 August 2005 15:44 Go to previous messageGo to next message
hanys is currently offline hanysFriend
Messages: 188
Registered: July 2009
Senior Member
Thank you for your help.

I little more describe what I want to do:
1) I want to create VE which code is in HTML which describes UI
components for example SWT components.
2) Then I want to create Code Generation/Decoding from SWT objects
hierarchy to HTML source code and vice versa.
3) When I looked at the architectural overview of the VE I, realized
that I need to create some decoder classes to do that task.
But I don't know if its all I need. I certainly need some mapping
layer from HTML to SWT(view).

If you can provide me some suggestions where I may start, I will be
happy.


What concerns of NPE in that tutorial example code it is caused by usage
java 1.5. And when I use java 1.4 I forgot to clean all workspace projects.
Now it runs fine.

Thanks in advance
John Cage
Re: VE questions - .override files [message #102082 is a reply to message #102028] Fri, 12 August 2005 11:59 Go to previous messageGo to next message
hanys is currently offline hanysFriend
Messages: 188
Registered: July 2009
Senior Member
Hi Joe,

I need to help with where to start to build mapping LAYER between:
source code -> Graphical representation
Graphical representation -> source code

,where source code is not in JAVA language.


It is only for imagination of what I want to do (it is not real thing, but
real thing will be very close to it):
What is called, when I move for example some SWT button, to make a code
synchronization with graphical representation of that button. If I need to
store destination SWT button's properties in HTML for example in tag
<button>. And what is called, when I changed HTML <button> tag in html
source code, to update corresponding SWT Button.

Thanks
John Cage
Re: VE questions - .override files [message #102244 is a reply to message #102082] Mon, 15 August 2005 16:09 Go to previous messageGo to next message
Gili Mendel is currently offline Gili MendelFriend
Messages: 338
Registered: July 2009
Senior Member
John Cage wrote:
> Hi Joe,
>
> I need to help with where to start to build mapping LAYER between:
> source code -> Graphical representation
> Graphical representation -> source code
>
> ,where source code is not in JAVA language.
>
>
> It is only for imagination of what I want to do (it is not real thing, but
> real thing will be very close to it):
> What is called, when I move for example some SWT button, to make a code
> synchronization with graphical representation of that button. If I need to
> store destination SWT button's properties in HTML for example in tag
> <button>. And what is called, when I changed HTML <button> tag in html
> source code, to update corresponding SWT Button.
>
> Thanks
> John Cage
>
>
Strat by putting a break point on
CompositionDecoderAdapter.notifyChanged - high level changes in the model
MemberDecoderAdapter.notifyChanged - Creation of a new bean
BeanDecoderAdapter.notifyChanged - Property changes for an existing bean
Re: VE questions - .override files [message #103109 is a reply to message #102244] Tue, 23 August 2005 10:08 Go to previous messageGo to next message
hanys is currently offline hanysFriend
Messages: 188
Registered: July 2009
Senior Member
Hi all,

Questions:
1. Can I have the 2 similar adapters associated with the same class?
2. If not what is the key to associate adapter with class? Is it xis:type
attribute?
3. Can somebody describe packages and adapters which they contains?
4. I tried to add a adapter to SWT Control (and then to Button too). But I
didn't find if I done it good, because the adapter instance specified by me
was no instantiated!
I done it this way described below, what is wrong?

Comments ad. 4) Log file is empty and Control.override file is
processed.
5. What is difference between .overried files where its structure begins
with
<xmi:XMI xmi:version="2.0"

and where its structure begins with:

<event:AddMany xmi:version="2.0"



Thanks,
John Cage

------------------------------------------------------------ -----------------------------
Ad 4)

It is my Button.override file located in:
PLUG-IN_HOME/overrides/org/eclipse/swt/widgets/
<?xml version="1.0" encoding="UTF-8"?>

<xmi:XMI xmi:version="2.0"

xmlns:xmi="http://www.omg.org/XMI"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xmlns:org.eclipse.ve.internal.cde.decorators="http:///org/eclipse/ve/internal/cde/decorators.ecore"

xmlns:org.eclipse.ve.internal.cde.utility="http:///org/eclipse/ve/internal/cde/utility.ecore"

xmlns:org.eclipse.ve.internal.jcm="http:///org/eclipse/ve/internal/jcm.ecore"

xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"

xmlns:event="event.xmi">


<event:AddMany xmi:version="2.0"

xmlns:xmi="http://www.omg.org/XMI"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xmlns:org.eclipse.ve.internal.cde.decorators="http:///org/eclipse/ve/internal/cde/decorators.ecore"

xmlns:org.eclipse.ve.internal.cde.utility="http:///org/eclipse/ve/internal/cde/utility.ecore"

xmlns:org.eclipse.ve.internal.jcm="http:///org/eclipse/ve/internal/jcm.ecore"

xmlns:codeGenHelpers=" platform:/plugin/org.eclipse.ve.java.core/overrides/codegenH elpers.ecore "

xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"

xmlns:event="event.xmi"

featureName="eAnnotations">

<addedEObjects xsi:type="org.eclipse.ve.internal.jcm:BeanDecorator"

beanLocation="GLOBAL_LOCAL"

beanReturn="false"

beanProxyClassName="myplugin/myplugin.adapters.MyBeanProxyAdapter "
/>

</event:AddMany>

</xmi:XMI>



Here is my adapter class:

package myplugin.adpaters;

import org.eclipse.ve.internal.java.core.IBeanProxyDomain;
import org.eclipse.ve.internal.swt.ControlProxyAdapter;

public class MyBeanProxyAdapter extends ControlProxyAdapter {

public MyBeanProxyAdapter(IBeanProxyDomain domain) {
super(domain);
System.out.println("MyBeanProxyAdapter");
}
}





This is my registration extension point:

<extension

point="org.eclipse.jem.beaninfo.registrations">

<registration

container="SWT_CONTAINER"

plugin="org.eclipse.swt">

<override

package="org.eclipse.swt.widgets"

path="overrides/org/eclipse/swt/widgets">

</override>

</registration>

</extension>
Re: VE questions - .override files [message #103177 is a reply to message #103109] Tue, 23 August 2005 19:12 Go to previous messageGo to next message
Joe Winchester is currently offline Joe WinchesterFriend
Messages: 496
Registered: July 2009
Senior Member
Hi John,

> 1. Can I have the 2 similar adapters associated with the same class?

No you can't - for example there is one ClassDescriptorDecorator or one
PropertyDescriptorDecorator. What you can do however if there is an
existing one (for example one supplied by the VE base code) is locate it
and modify it in your .override. Is this what you want to do ?

> 2. If not what is the key to associate adapter with class? Is it xis:type
> attribute?

If you look at the existing .override files the most common is probably
that an adapter is added to the class itself, or that one is added to an
attribute. The way one is added is to declare it as an "annotations"
feature of an EMF object. The best way I find is to find an example
similar to what you want to do and then find someone that does something
close to what you want. Do you want to add a decorator to an existing
Class, a new class that is your own one, modify an existing decorator on
an existing class, or do any of the above for an attribute (i.e. the
"foo" feature)

> 3. Can somebody describe packages and adapters which they contains?

The most common adapter is probably ClassDescriptorDecorator that lets
you change the GEF edit policies and the BeanProxyAdapter that controls
the target VM interaction. PropertyDescriptorDecorator lets you change
stuff related to the property sheet. We don't have a full set of docs -
we are trying to work on a tutorial however that should cover most of
the major decorators however and just focus on the EMF model. The
existing tutorial we created sort of touched each subsystem but not
really in depth. One thing that would be good is if you could give some
suggestions for what the tutorial should cover. Right now we were going
to have a "refactor" menu and cover examples such as:

Change background color (Just to show how to set a simple property)
Add a new child (Just to show how to deal with the Swing and SWT
parent/child relationships)
Morph (To show how to change the EMF type)
Group/Ungroup (To show how to band a set of controls and put them into a
single new parent and the reverse)

These would cover what are most of the common scenarios where people
want to update the EMF model. Can you think of anything else we should
cover ?

> 4. I tried to add a adapter to SWT Control (and then to Button too). But I
> didn't find if I done it good, because the adapter instance specified by me
> was no instantiated!

Why is your Button.override in the folder
/overrides/org/eclipse/swt/widgets ? This would normally be reserved
for classes in the package org.eclipse.swt.widgets. If your custom
widget you're trying to customize is called com.mystuff.foo then it
should be in the folder

MY_PLUGIN_HOME/com/mystuff/foo/MyOwnClass

Also be sure to have the extension point declaring your override folder.
Basically what occurs is that some trigger in the build path is
detected and then for a given package an override folder is used. Look
in jfc and swt ve plugins for how they work and the basic idea is

<extension
point="org.eclipse.jem.beaninfo.registrations">
<registration
plugin="com.mystuff">
<override
package="com.mystuff.foo"
path="overrides/com/mystuff/foo">
</override>

In this case if the user of your plugin adds com.mystuff to the build
path (that contains your runtime) then your .override files for classs
in the package com.mystuff.foo should be in the folder
/overrides/mystuff/foo.

Best regards,

Joe Winchester
Re: VE questions - .override files [message #103194 is a reply to message #103177] Tue, 23 August 2005 20:03 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: richkulp.us.NO_SPAM.ibm.com

Slight typos:

>
> Why is your Button.override in the folder
> /overrides/org/eclipse/swt/widgets ? This would normally be reserved
> for classes in the package org.eclipse.swt.widgets. If your custom
> widget you're trying to customize is called com.mystuff.foo then it
> should be in the folder
>

--- MY_PLUGIN_HOME/overrides/com/mystuff/foo/MyOwnClass
>

> Also be sure to have the extension point declaring your override folder.
> Basically what occurs is that some trigger in the build path is
> detected and then for a given package an override folder is used. Look
> in jfc and swt ve plugins for how they work and the basic idea is
>
> <extension
> point="org.eclipse.jem.beaninfo.registrations">
> <registration
> plugin="com.mystuff">
> <override
> package="com.mystuff.foo"
> path="overrides/com/mystuff/foo">
> </override>
>
> In this case if the user of your plugin adds com.mystuff to the build
> path (that contains your runtime) then your .override files for classs
> in the package com.mystuff.foo should be in the folder

--- /overrides/com/mystuff/foo.

>
> Best regards,
>
> Joe Winchester

--
Thanks,
Rich Kulp
Re: VE questions - .override files [message #103571 is a reply to message #103194] Thu, 25 August 2005 10:01 Go to previous messageGo to next message
hanys is currently offline hanysFriend
Messages: 188
Registered: July 2009
Senior Member
Hi Joe,
Thank you for your help.

Regarding what will be very usefull in VE TUTORIAL here are some IDEAS:

1) code generation/reverse parsing to/from XML source code
- can you provide example how to make own decoder from to XML to
JAVA BEANS tree
You can map for example 2 Swing components(JPanel and JButton)
to DOM SOURCE MODEL which can be saved in a XML file,
and on the contrary decoding from XML source code to JAVA BEANS
Tree and instantiating and than changing properties of these components.


2) How to extend VE to easily create own editor with
- How to add to VE one XML editor page
- or replace JAVA page with XML page

3) how to map VE on my own file extension for example (.xmlui)

Thanks,
John Cage
Re: VE questions - .override files [message #103621 is a reply to message #103571] Thu, 25 August 2005 14:26 Go to previous messageGo to next message
hanys is currently offline hanysFriend
Messages: 188
Registered: July 2009
Senior Member
Hi joe,
I have another concrete question:

Scenario:
What regards XML code generation from JAVA BEANS, I looked at
BeanDecoderAdapter and there is something what I need :).
There is method switch in notifyChanged method. I want to implement another
one which will generate XML source.
But this adapter is directly referenced by other VE classes. What is your
proposed solution for this problem?

Question:
How I add or replace my own adpater (XMLBeanDeboderAdapater) which can be
subclass of BeanDecoderAdapter or not, if it is not nessesary.
I don't know. I didn't find BeanDecoderAdapter in any of the .override
files. How can I switch it for my another one? Or how can I add my custom
adapter?

Thank you,
John Cage
Re: VE questions - .override files [message #103878 is a reply to message #103621] Fri, 26 August 2005 11:54 Go to previous message
hanys is currently offline hanysFriend
Messages: 188
Registered: July 2009
Senior Member
Hi all,
I have some problems, can somebody help me?

I want to attach to my bean, which extends JButton one model adapter, to
listen model changes made via property sheet. But my adapter's metohd
notifyChanged(Notification notification) wasn't called, but adapter was
instantiated.

I want to catch every notification made via graphical editing and put them
into XML file.

Now I only test if this method is called, but she doesn't.
Here is what I'm doing. Can you tell me where is the problem?


My observation:
My adapter is instantiated when I put the button from palette to JPanel and
then adapter instantiates, but when is doing the process of reverse parsing
the Adapter is not instantiated.



--------------LOOK AT MY SOURCE EXCERPT BELOW----------

------------------------- ADAPTER CLASS --------------------------
package adapters;

import org.apache.log4j.Logger;
import org.apache.log4j.lf5.LF5Appender;
import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.Notifier;



public class MyBeanDecoderAdapter implements Adapter {
Logger c = Logger.getLogger("asdsa");
LF5Appender a = new LF5Appender();

public void notifyChanged(Notification notification) {
c.info("notifyChanged");
}

public Notifier getTarget() {
c.info("getTarget");
return null;
}

public void setTarget(Notifier newTarget) {
c.info("setTarget");
}

public boolean isAdapterForType(Object type) {
c.info("isAdapterForType");
return false;
}
}




------------------------- mybutton.override CLASS
excerpt --------------------------
<addedEObjects
xsi:type=" org.eclipse.ve.internal.cde.decorators:ClassDescriptorDecora tor "

modelAdapterClassname="myplugin/adapters.MyBeanDecoderAdapter "/>


</event:AddMany>









Thanks you,

John Cage
Re: VE questions - .override files [message #610247 is a reply to message #101866] Thu, 11 August 2005 14:34 Go to previous message
Joe Winchester is currently offline Joe WinchesterFriend
Messages: 496
Registered: July 2009
Senior Member
Hi John,

> 1) Where can I find it? 2) What parses .override files?

BeanInfoClassAdapter.

> 3) How I test if some override file is processed?

What I usually do is put a breakpoint in
protected void applyExtensionDocTo(...);
This will be called for every class and interface that the class being
edited touches so there is a bit of noise, but just check the JavaClass
argument each time it gets stopped until it comes across your one. Then
debug further to see what's going wrong with your .override.

Common errors I always find are a) that the beaninfo.registrations
extension does not actually declare the /override folder. b) there are
XML errors however these should get put into the .log file and catching
SAXParseException also helps to find these.

> 4) Where may I start?

Try breakpoints in BeanInfoClassAdapter and also be sure the /override
file is declared correctly in the plugin.xml

> 5) Which are mechanisms To Extend VE for example (are they only
> decorators?):
> -custom gode generation parsing

There are many but unfortunately we don't document them all. However we
do use them all, so anything and everything that is done by Swing/SWT or
RCP is done through extension points. The best way is to find a class
that does what you want and look at it. For example Composite.override
declares a relationship to children, as does JTabbedPane.override.

What's the scenario you're trying to get working through a .override ?
If you describe it hopefully it'll help to point you towards useful
existing .override files to look at and get inspiration from.

> I tried to start with tutorial from Dr Gili Mendel et al., but it seams
> that it ignores that .override file and throws NPE,

Can you post the stack trace place ? Is this you running the actually
finished complete code that throws the NPE or your implementation you
built following the sample ? If it's the former this is our bug and we
need to fix it.

> when it tries to find decorator for "text" property.

You're not the first person to mention this - someone else had the same
problem. We'll look into it

Best regards,

Joe Winchester
Re: VE questions - .override files [message #610252 is a reply to message #101997] Thu, 11 August 2005 15:44 Go to previous message
hanys is currently offline hanysFriend
Messages: 188
Registered: July 2009
Senior Member
Thank you for your help.

I little more describe what I want to do:
1) I want to create VE which code is in HTML which describes UI
components for example SWT components.
2) Then I want to create Code Generation/Decoding from SWT objects
hierarchy to HTML source code and vice versa.
3) When I looked at the architectural overview of the VE I, realized
that I need to create some decoder classes to do that task.
But I don't know if its all I need. I certainly need some mapping
layer from HTML to SWT(view).

If you can provide me some suggestions where I may start, I will be
happy.


What concerns of NPE in that tutorial example code it is caused by usage
java 1.5. And when I use java 1.4 I forgot to clean all workspace projects.
Now it runs fine.

Thanks in advance
John Cage
Re: VE questions - .override files [message #610261 is a reply to message #102028] Fri, 12 August 2005 11:59 Go to previous message
hanys is currently offline hanysFriend
Messages: 188
Registered: July 2009
Senior Member
Hi Joe,

I need to help with where to start to build mapping LAYER between:
source code -> Graphical representation
Graphical representation -> source code

,where source code is not in JAVA language.


It is only for imagination of what I want to do (it is not real thing, but
real thing will be very close to it):
What is called, when I move for example some SWT button, to make a code
synchronization with graphical representation of that button. If I need to
store destination SWT button's properties in HTML for example in tag
<button>. And what is called, when I changed HTML <button> tag in html
source code, to update corresponding SWT Button.

Thanks
John Cage
Re: VE questions - .override files [message #610279 is a reply to message #102082] Mon, 15 August 2005 16:09 Go to previous message
Gili Mendel is currently offline Gili MendelFriend
Messages: 338
Registered: July 2009
Senior Member
John Cage wrote:
> Hi Joe,
>
> I need to help with where to start to build mapping LAYER between:
> source code -> Graphical representation
> Graphical representation -> source code
>
> ,where source code is not in JAVA language.
>
>
> It is only for imagination of what I want to do (it is not real thing, but
> real thing will be very close to it):
> What is called, when I move for example some SWT button, to make a code
> synchronization with graphical representation of that button. If I need to
> store destination SWT button's properties in HTML for example in tag
> <button>. And what is called, when I changed HTML <button> tag in html
> source code, to update corresponding SWT Button.
>
> Thanks
> John Cage
>
>
Strat by putting a break point on
CompositionDecoderAdapter.notifyChanged - high level changes in the model
MemberDecoderAdapter.notifyChanged - Creation of a new bean
BeanDecoderAdapter.notifyChanged - Property changes for an existing bean
Re: VE questions - .override files [message #610354 is a reply to message #102244] Tue, 23 August 2005 10:08 Go to previous message
hanys is currently offline hanysFriend
Messages: 188
Registered: July 2009
Senior Member
Hi all,

Questions:
1. Can I have the 2 similar adapters associated with the same class?
2. If not what is the key to associate adapter with class? Is it xis:type
attribute?
3. Can somebody describe packages and adapters which they contains?
4. I tried to add a adapter to SWT Control (and then to Button too). But I
didn't find if I done it good, because the adapter instance specified by me
was no instantiated!
I done it this way described below, what is wrong?

Comments ad. 4) Log file is empty and Control.override file is
processed.
5. What is difference between .overried files where its structure begins
with
<xmi:XMI xmi:version="2.0"

and where its structure begins with:

<event:AddMany xmi:version="2.0"



Thanks,
John Cage

------------------------------------------------------------ -----------------------------
Ad 4)

It is my Button.override file located in:
PLUG-IN_HOME/overrides/org/eclipse/swt/widgets/
<?xml version="1.0" encoding="UTF-8"?>

<xmi:XMI xmi:version="2.0"

xmlns:xmi="http://www.omg.org/XMI"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xmlns:org.eclipse.ve.internal.cde.decorators="http:///org/eclipse/ve/internal/cde/decorators.ecore"

xmlns:org.eclipse.ve.internal.cde.utility="http:///org/eclipse/ve/internal/cde/utility.ecore"

xmlns:org.eclipse.ve.internal.jcm="http:///org/eclipse/ve/internal/jcm.ecore"

xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"

xmlns:event="event.xmi">


<event:AddMany xmi:version="2.0"

xmlns:xmi="http://www.omg.org/XMI"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xmlns:org.eclipse.ve.internal.cde.decorators="http:///org/eclipse/ve/internal/cde/decorators.ecore"

xmlns:org.eclipse.ve.internal.cde.utility="http:///org/eclipse/ve/internal/cde/utility.ecore"

xmlns:org.eclipse.ve.internal.jcm="http:///org/eclipse/ve/internal/jcm.ecore"

xmlns:codeGenHelpers=" platform:/plugin/org.eclipse.ve.java.core/overrides/codegenH elpers.ecore "

xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"

xmlns:event="event.xmi"

featureName="eAnnotations">

<addedEObjects xsi:type="org.eclipse.ve.internal.jcm:BeanDecorator"

beanLocation="GLOBAL_LOCAL"

beanReturn="false"

beanProxyClassName="myplugin/myplugin.adapters.MyBeanProxyAdapter "
/>

</event:AddMany>

</xmi:XMI>



Here is my adapter class:

package myplugin.adpaters;

import org.eclipse.ve.internal.java.core.IBeanProxyDomain;
import org.eclipse.ve.internal.swt.ControlProxyAdapter;

public class MyBeanProxyAdapter extends ControlProxyAdapter {

public MyBeanProxyAdapter(IBeanProxyDomain domain) {
super(domain);
System.out.println("MyBeanProxyAdapter");
}
}





This is my registration extension point:

<extension

point="org.eclipse.jem.beaninfo.registrations">

<registration

container="SWT_CONTAINER"

plugin="org.eclipse.swt">

<override

package="org.eclipse.swt.widgets"

path="overrides/org/eclipse/swt/widgets">

</override>

</registration>

</extension>
Re: VE questions - .override files [message #610359 is a reply to message #103109] Tue, 23 August 2005 19:12 Go to previous message
Joe Winchester is currently offline Joe WinchesterFriend
Messages: 496
Registered: July 2009
Senior Member
Hi John,

> 1. Can I have the 2 similar adapters associated with the same class?

No you can't - for example there is one ClassDescriptorDecorator or one
PropertyDescriptorDecorator. What you can do however if there is an
existing one (for example one supplied by the VE base code) is locate it
and modify it in your .override. Is this what you want to do ?

> 2. If not what is the key to associate adapter with class? Is it xis:type
> attribute?

If you look at the existing .override files the most common is probably
that an adapter is added to the class itself, or that one is added to an
attribute. The way one is added is to declare it as an "annotations"
feature of an EMF object. The best way I find is to find an example
similar to what you want to do and then find someone that does something
close to what you want. Do you want to add a decorator to an existing
Class, a new class that is your own one, modify an existing decorator on
an existing class, or do any of the above for an attribute (i.e. the
"foo" feature)

> 3. Can somebody describe packages and adapters which they contains?

The most common adapter is probably ClassDescriptorDecorator that lets
you change the GEF edit policies and the BeanProxyAdapter that controls
the target VM interaction. PropertyDescriptorDecorator lets you change
stuff related to the property sheet. We don't have a full set of docs -
we are trying to work on a tutorial however that should cover most of
the major decorators however and just focus on the EMF model. The
existing tutorial we created sort of touched each subsystem but not
really in depth. One thing that would be good is if you could give some
suggestions for what the tutorial should cover. Right now we were going
to have a "refactor" menu and cover examples such as:

Change background color (Just to show how to set a simple property)
Add a new child (Just to show how to deal with the Swing and SWT
parent/child relationships)
Morph (To show how to change the EMF type)
Group/Ungroup (To show how to band a set of controls and put them into a
single new parent and the reverse)

These would cover what are most of the common scenarios where people
want to update the EMF model. Can you think of anything else we should
cover ?

> 4. I tried to add a adapter to SWT Control (and then to Button too). But I
> didn't find if I done it good, because the adapter instance specified by me
> was no instantiated!

Why is your Button.override in the folder
/overrides/org/eclipse/swt/widgets ? This would normally be reserved
for classes in the package org.eclipse.swt.widgets. If your custom
widget you're trying to customize is called com.mystuff.foo then it
should be in the folder

MY_PLUGIN_HOME/com/mystuff/foo/MyOwnClass

Also be sure to have the extension point declaring your override folder.
Basically what occurs is that some trigger in the build path is
detected and then for a given package an override folder is used. Look
in jfc and swt ve plugins for how they work and the basic idea is

<extension
point="org.eclipse.jem.beaninfo.registrations">
<registration
plugin="com.mystuff">
<override
package="com.mystuff.foo"
path="overrides/com/mystuff/foo">
</override>

In this case if the user of your plugin adds com.mystuff to the build
path (that contains your runtime) then your .override files for classs
in the package com.mystuff.foo should be in the folder
/overrides/mystuff/foo.

Best regards,

Joe Winchester
Re: VE questions - .override files [message #610360 is a reply to message #103177] Tue, 23 August 2005 20:03 Go to previous message
Eclipse UserFriend
Originally posted by: richkulp.us.NO_SPAM.ibm.com

Slight typos:

>
> Why is your Button.override in the folder
> /overrides/org/eclipse/swt/widgets ? This would normally be reserved
> for classes in the package org.eclipse.swt.widgets. If your custom
> widget you're trying to customize is called com.mystuff.foo then it
> should be in the folder
>

--- MY_PLUGIN_HOME/overrides/com/mystuff/foo/MyOwnClass
>

> Also be sure to have the extension point declaring your override folder.
> Basically what occurs is that some trigger in the build path is
> detected and then for a given package an override folder is used. Look
> in jfc and swt ve plugins for how they work and the basic idea is
>
> <extension
> point="org.eclipse.jem.beaninfo.registrations">
> <registration
> plugin="com.mystuff">
> <override
> package="com.mystuff.foo"
> path="overrides/com/mystuff/foo">
> </override>
>
> In this case if the user of your plugin adds com.mystuff to the build
> path (that contains your runtime) then your .override files for classs
> in the package com.mystuff.foo should be in the folder

--- /overrides/com/mystuff/foo.

>
> Best regards,
>
> Joe Winchester

--
Thanks,
Rich Kulp
Re: VE questions - .override files [message #610386 is a reply to message #103194] Thu, 25 August 2005 10:01 Go to previous message
hanys is currently offline hanysFriend
Messages: 188
Registered: July 2009
Senior Member
Hi Joe,
Thank you for your help.

Regarding what will be very usefull in VE TUTORIAL here are some IDEAS:

1) code generation/reverse parsing to/from XML source code
- can you provide example how to make own decoder from to XML to
JAVA BEANS tree
You can map for example 2 Swing components(JPanel and JButton)
to DOM SOURCE MODEL which can be saved in a XML file,
and on the contrary decoding from XML source code to JAVA BEANS
Tree and instantiating and than changing properties of these components.


2) How to extend VE to easily create own editor with
- How to add to VE one XML editor page
- or replace JAVA page with XML page

3) how to map VE on my own file extension for example (.xmlui)

Thanks,
John Cage
Re: VE questions - .override files [message #610390 is a reply to message #103571] Thu, 25 August 2005 14:26 Go to previous message
hanys is currently offline hanysFriend
Messages: 188
Registered: July 2009
Senior Member
Hi joe,
I have another concrete question:

Scenario:
What regards XML code generation from JAVA BEANS, I looked at
BeanDecoderAdapter and there is something what I need :).
There is method switch in notifyChanged method. I want to implement another
one which will generate XML source.
But this adapter is directly referenced by other VE classes. What is your
proposed solution for this problem?

Question:
How I add or replace my own adpater (XMLBeanDeboderAdapater) which can be
subclass of BeanDecoderAdapter or not, if it is not nessesary.
I don't know. I didn't find BeanDecoderAdapter in any of the .override
files. How can I switch it for my another one? Or how can I add my custom
adapter?

Thank you,
John Cage
Re: VE questions - .override files [message #610409 is a reply to message #103621] Fri, 26 August 2005 11:54 Go to previous message
hanys is currently offline hanysFriend
Messages: 188
Registered: July 2009
Senior Member
Hi all,
I have some problems, can somebody help me?

I want to attach to my bean, which extends JButton one model adapter, to
listen model changes made via property sheet. But my adapter's metohd
notifyChanged(Notification notification) wasn't called, but adapter was
instantiated.

I want to catch every notification made via graphical editing and put them
into XML file.

Now I only test if this method is called, but she doesn't.
Here is what I'm doing. Can you tell me where is the problem?


My observation:
My adapter is instantiated when I put the button from palette to JPanel and
then adapter instantiates, but when is doing the process of reverse parsing
the Adapter is not instantiated.



--------------LOOK AT MY SOURCE EXCERPT BELOW----------

------------------------- ADAPTER CLASS --------------------------
package adapters;

import org.apache.log4j.Logger;
import org.apache.log4j.lf5.LF5Appender;
import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.Notifier;



public class MyBeanDecoderAdapter implements Adapter {
Logger c = Logger.getLogger("asdsa");
LF5Appender a = new LF5Appender();

public void notifyChanged(Notification notification) {
c.info("notifyChanged");
}

public Notifier getTarget() {
c.info("getTarget");
return null;
}

public void setTarget(Notifier newTarget) {
c.info("setTarget");
}

public boolean isAdapterForType(Object type) {
c.info("isAdapterForType");
return false;
}
}




------------------------- mybutton.override CLASS
excerpt --------------------------
<addedEObjects
xsi:type=" org.eclipse.ve.internal.cde.decorators:ClassDescriptorDecora tor "

modelAdapterClassname="myplugin/adapters.MyBeanDecoderAdapter "/>


</event:AddMany>









Thanks you,

John Cage
Previous Topic:report
Next Topic:Indexed Propeties to be Supported?
Goto Forum:
  


Current Time: Fri Apr 19 06:34:29 GMT 2024

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

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

Back to the top