Hi
Shenxue Zhou,
It works as expected, but when it hides or shows
properties (UI), I am seeing an exception in the console. Am I missing
something here.
!ENTRY org.eclipse.sapphire.ui 4 0 2011-05-21
18:52:21.221
!MESSAGE Widget is disposed
!STACK
0
org.eclipse.swt.SWTException: Widget is disposed
at
org.eclipse.swt.SWT.error(SWT.java:4083)
at
org.eclipse.swt.SWT.error(SWT.java:3998)
at
org.eclipse.swt.SWT.error(SWT.java:3969)
at
org.eclipse.swt.widgets.Widget.error(Widget.java:468)
at
org.eclipse.swt.widgets.Widget.checkWidget(Widget.java:340)
at
org.eclipse.swt.widgets.Combo.getItemCount(Combo.java:690)
at
org.eclipse.sapphire.ui.internal.binding.ComboBinding.removeMalformedItem(ComboBinding.java:103)
at
org.eclipse.sapphire.ui.internal.binding.AbstractEnumBinding.doUpdateModel(AbstractEnumBinding.java:75)
at
org.eclipse.sapphire.ui.internal.binding.AbstractBinding.updateModel(AbstractBinding.java:105)
at
org.eclipse.sapphire.ui.internal.binding.ComboBinding$1.widgetSelected(ComboBinding.java:64)
at
org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:234)
at
org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at
org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
at
org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4066)
at
org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3657)
at
org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2640)
at
org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2604)
at
org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2438)
at
org.eclipse.ui.internal.Workbench$7.run(Workbench.java:671)
at
org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:664)
at
org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at
org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
at
org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown
Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
Source)
at java.lang.reflect.Method.invoke(Unknown
Source)
at
org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619)
at
org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
at org.eclipse.equinox.launcher.Main.main(Main.java:1383)
On Sat, May 21, 2011 at 2:22 AM, Shenxue Zhou
<shenxue.zhou@xxxxxxxxxx> wrote:
Here is
some code snippet for the if-else syntax in sdef file:
<if>
<condition><class>ColumnScaleCondition</class></condition>
<then>
<property-editor>Scale</property-editor>
</then>
</if>
And here is the ColumnScaleCondition
class:
public final
class ColumnScaleCondition
extends
SapphireModelCondition
{
@Override
public boolean
evaluate()
{
....
}
@Override
public
List<String> getDependencies()
{
return
Collections.singletonList( IColumnDescriptor.PROP_TYPE.getName()
);
}
}
Make sure you
import the package of your condition class in the sdef
file:
<import>
<package>...</package>
</import>
Sent: Friday, May 20, 2011 2:14 PM
To: Konstantin
Komissarchik
Cc: Sapphire project
Subject: Re:
[sapphire-dev] Sapphire Query on Section, Multi List,
Enablement
Konstantin,
I couldn't extract the correct syntax for if-else
block, can you please give an example XML section on sdef file to achieve if
else.
Thanks,
-Naga
On Fri, May 20, 2011 at 10:14 PM, Nagarajan Murugesan
<nagarajan.m@xxxxxxxxx> wrote:
Thanks
Konstantin,
Can you please point me to some examples for
@PropertyListeners implementation?
On Thu, May 19, 2011 at 9:23 PM, Konstantin
Komissarchik
<konstantin.komissarchik@xxxxxxxxxx> wrote:
Could you send an
e-mail to webmaster@xxxxxxxxxxx detailing the
issues that you are having with the forum system?
> 1. Section -
Expand/Collapse
We don’t support this
yet. Please open an enhancement request. Another approach to dealing
with a lot of content is to break it up among multiple nodes in the
content outline. For instance, you could have an Advanced node beneath
your main node rather than a collapsible Advanced section.
> 2. Multiple Chose
values arranged horizontally
We have two ways of
presenting multi-select lists: a slush bucket and a checkbox list. I
suppose I can see how I horizontal arrangement of checkboxes could also
be useful, especially if you know that the set of possible values is
small, such as with some enums. Please open an enhancement
request.
> 3.
Enablement
> … disabled as
expected but the values previously entered in the XML is not going
away
Enablement does not
clear content. To clear content, you can use @PropertyListeners
annotation to register listeners on your controlling properties. The
listener will be called when property changes and can reach out and
clear related properties as necessary. I suppose you could also register
a listener on the property that needs clearing and look at the
property’s enablement state instead. Such a listener could be written
generically and then attached to any number of properties. Hmm… that
makes me wonder if we should consider supporting this scenario out of
the box. I can certainly see value of a @ClearOnDisable annotation.
Maybe go ahead and open an enhancement request for this
too.
> 4. Hide
You can use the if-else
sdef construct to control what is shown based on the condition that you
specify. We don’t have many examples of this in samples right now. The
only one I found is in DefinitionEditor.sdef from the sapphire.sdk
plugin.
The condition class
that is used with if-else construct is “live” in that it can update
itself. The UI listens on condition changing and acts accordingly. Take
a look at SapphireModelCondition class which is a good base class for
conditions that need to react to changes in the model.
Note that you can also
use conditions to hide content outline nodes. There is a property in the
node’s definition that accepts a “visible-when” condition.
From:
Nagarajan Murugesan [mailto:nagarajan.m@xxxxxxxxx]
Sent: Wednesday, May
18, 2011 11:29 PM
To: Konstantin
Komissarchik
Subject: Sapphire Query on Section, Multi List,
Enablement
Hi Konstantin,
Sorry
to bother you again, I have few more queries.
I assure you, I will
put those communications back in forum once it back alive for wider
audience. please help on email till then.
1. Section -
Expand/Collapse
- I add a section in the sdef like 'Advanced
Options', I want this to be collopsed by default, when required user can
expand and fill in details. Is there a <hint> available for
this?
2. Multiple Chose values arranged horizontally
- I have
a property which will accept multiple choice of comma seprated values,
is there a way I can arrange the options as check box horizontally.
Currently the examples are having only slash bucket, which occupies more
screen space than what we want
Example:
Property: Option1
Option2 Option3 (Check boxes)
3. Enablement
One of the problem
I am seeing with Enablement annotation,
<item1>
<item2>
<item3>
I defined
<item2> and <item3> are enabled only when <item1> set
to a particular value. Lets say user first time select that value in
<item1> and set required property in <item2> and
<item3>. when he goes back to <item1> and changes its value.
<item2> and <item3> are disabled as expected but the values
previously entered in the XML is not going away. How do we remove those
value from xml when we disable that field?
4. Hide
I have seen
the example to hide some additional property based on a selection (in
Contact, IAssistance). But it works only the sub properties
like
<selection>
<option1>
<option2>
</selection>
<option1>
and <option2> can be hidden and shown based on the
selection.
Is there a way I can hide the UI of non sub properties
like
<item1>
<item2>
<item3>
if
<item1> set to particular value <item2> and <item3>
should be
removed.
Thanks,
-Naga
_______________________________________________
sapphire-dev
mailing list
sapphire-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/sapphire-dev