Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [ve-dev] Few questions please




"Janak Mulani" <janak.mulani@xxxxxxxxx>
Sent by: ve-dev-admin@xxxxxxxxxxx

09/13/2004 12:35 PM

Please respond to
ve-dev

To
"ve-Dev@Eclipse. Org" <ve-dev@xxxxxxxxxxx>
cc
Subject
[ve-dev] Few questions please





Dear VE Team:

Many thanks for the help provided. Some more questions please:

---------------------------------------------------------------------
1. We are trying to define an EClass in an ecore file like the
ConstraintComponent Class (pl see the attachment):

a. How to create a JavaObjectInstance of this class?
  We looked up the code for ConstrainComponent but it is creating an
EObject.
  Is there a way to get a JavaObjectInstance or conver an EObject to
JavaObjectInstance?


---- You can't convert. It isn't a JavaClass. Only JavaClasses that exist in your classpath of your java project, such as java.awt.Container, etc., can be an IJavaObjectInstance (PS: Don't refer to JavaObjectInstance, refer to IJavaObjectInstance, JavaObjectInstance is just an implementation and will remain internal, IJavaObjectInstance will eventually become API). If you want a java class, it needs to be in a jar somewhere in your classpath for the project that current editors java class comes from.

     So the question is do you really want it to be a java class. Java classes will be code generated into your code. In our case the ConstraintComponent is not a java class. So it is not generated into the code. The decoders understand what a ConstraintComponent is and instead generates the "jpanel.add(getJWhatever(), {constraint})" code from the object.

b. The EClass has some SFs of type int. How do we specify int eType?

----------------------------------------------------------------------------
-
2. We have debugged the JPanel/BorderLayout/JButton code that generates the
_expression_:

                jPanel.add(getJButton(), Border.NORTH);

Two Commands are Created:

i. ApplyAttributeSettingCmd (which adds button to ConstraintComponent) by
setting the component SF of ConstraintComponent.

ii. VCEPresetCommand & ApplyAttributeSettingCommand commands which sets the
SF components of container JPanel and adds ConstraintComponent to JPanel.

We observed that for the 1st command no CodeGen adapters are called because
the "owner" ConstraintComponent is not notified  "if
(owner.eNotificationRequired())" while setting the SF "component" with the
child object (JButton). The stack trace is as follows:


------- The reason it wasn't notified is because at that point in time there
are no decoders on the ConstraintComponent. We were in the process of creating it and
didn't exist before this point.
The decoders aren't added until the apply of the constraint component to JPanel.
At that point in time the JPanel decoder sees the addition and will go and add
the decoders to the new guy.

EStructuralFeatureImpl$InternalSettingDelegateSingleEObjectResolving(EStruct
uralFeatureImpl$InternalSettingDelegateSingleEObject).dynamicSet(InternalEOb
ject, EStructuralFeature$Internal$DynamicValueHolder, int, Object) line:
2132
EObjectImpl(BasicEObjectImpl).eDynamicSet(EStructuralFeature, Object) line:
524
EObjectImpl(BasicEObjectImpl).eSet(EStructuralFeature, Object) line: 508
ApplyAttributeSettingCommand.execute() line: 70.

We would like to have a similar behaviour when we set SF "containment" on
our ULCComponent with a layout value object while we are adding it to a
conatiner. We would not like our ULCComponent to be notified while this SF
is being set. Is there a way to do this declaratively or through code?

At present whenever we try to set the SF "containment" on a ULCComponent
that is being added to a container, expressionDecoder is called. Since there
is no source to be generated we return null _expression_ as a result of which
the SF is disposed() from the model.

We got over this by defining our own expressionDecoder and decoderHelper
that for SF "containment" returns null _expression_ and marks the _expression_
as NO_SRC thus avoiding the dispose() of the SF from Model. See the code
snippet from AbstractExpressionDecoder.generate(EStructuralFeature,
Object[]) below:

                String result = null;
                                 try {
                                                  result = fhelper.generate(args);
                                 } catch (CodeGenException e) {
                                 }

                                 if (fExprRef.isStateSet(CodeExpressionRef.STATE_NO_SRC)) {
                                                  fhelper.adaptToCompositionModel(this);
                                                  return result ;
                                 }

                                 if (result == null && !(fhelper instanceof SimpleAttributeDecoderHelper))
{
                                                  // Specialized decoder may not be applicable, try a vanilla one
                                                  fhelper = new SimpleAttributeDecoderHelper(fbeanPart, fExpr,
fFeatureMapper, this);
                                                  JavaVEPlugin.log("generate():  *Defaulting* to a SimpleAttr. Helper",
Level.FINE); //$NON-NLS-1$
                                                  result = fhelper.generate(args);
                                 }

                                 if (result != null) {
                                                  fExprRef.setState(CodeExpressionRef.STATE_EXIST, true);
                                                  fExprRef.setState(CodeExpressionRef.STATE_IN_SYNC, true);
                                                  fhelper.adaptToCompositionModel(this);
                                 } else {
                                                  fExprRef.dispose();
                                 }



--------------------------------------------------------------

3. In reply to our question about probable release date for VE 1.0 you
mentioned that you are wrapping it up. Could you please tell us the probable
date of release? It will help us to plan the release date of ULC VE for
Eclipse 3.0.


---- Within weeks.

-------------------------------------------------------------------

Many thanks,

Janak

Attachment: boxPaneContainment.ecore
Description: Binary data


Back to the top