Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 332048

Summary: ValidateEditException when saving calendar sample editor
Product: z_Archived Reporter: Shenxue Zhou <shenxue.zhou>
Component: SapphireAssignee: Konstantin Komissarchik <konstantin>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: konstantin
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Shenxue Zhou CLA 2010-12-07 11:44:23 EST
Build Identifier: M20100909-0800

When Calendar/Contact editor is open and there are no contact records, trying to create new event/new contact would result in the following exception:

org.eclipse.sapphire.modeling.ValidateEditException

at org.eclipse.sapphire.ui.xml.XmlEditorResourceStore.validateSave(XmlEditorResourceStore.java:157)

at org.eclipse.sapphire.ui.xml.XmlEditorResourceStore.validateEdit(XmlEditorResourceStore.java:149)

at org.eclipse.sapphire.modeling.xml.XmlNode.validateEdit(XmlNode.java:80)

at org.eclipse.sapphire.modeling.xml.XmlElement.addChildElement(XmlElement.java:479)

at org.eclipse.sapphire.modeling.xml.XmlElement.addChildElement(XmlElement.java:547)

at org.eclipse.sapphire.modeling.xml.StandardXmlListBindingImpl.addUnderlyingObject(StandardXmlListBindingImpl.java:129)

at org.eclipse.sapphire.modeling.LayeredListBindingImpl.add(LayeredListBindingImpl.java:58)

at org.eclipse.sapphire.modeling.ModelElementList.addNewElement(ModelElementList.java:243)

at org.eclipse.sapphire.ui.swt.renderer.actions.internal.OutlineNodeAddActionHandlerFactory$AddActionHandler.run(OutlineNodeAddActionHandlerFactory.java:112)

at org.eclipse.sapphire.ui.SapphireActionHandler.execute(SapphireActionHandler.java:89)

at org.eclipse.sapphire.ui.SapphireActionLink$1.linkActivated(SapphireActionLink.java:107)

at org.eclipse.ui.forms.widgets.FormText.activateLink(FormText.java:1552)

at org.eclipse.ui.forms.widgets.FormText.handleMouseClick(FormText.java:1355)

at org.eclipse.ui.forms.widgets.FormText.access$16(FormText.java:1326)

.......................................

Reproducible: Always
Comment 1 Konstantin Komissarchik CLA 2010-12-07 16:07:07 EST
This appears to be a long-standing issue rather than a recent regression.
Comment 2 Konstantin Komissarchik CLA 2010-12-07 16:49:40 EST
I have a fix implemented. Tested the following scenarios:

Scenario A

1. Create calendar.xml at a location that does not have contacts.xml.
2. Add an event and an attendee.
3. Save.
4. Confirm no exception and contacts.xml not created.

Scenario B

Just like A, except between steps 1 and 2, visit the contacts.xml tab to make sure the xml editor is initialized on a missing file. You should see a message in the editor pane about file not being present. That's expected.

Scenario C

1. Create calendar.xml at a location that does not have contacts.xml.
2. Add an event and an attendee.
3. Enter e-mail for attendee. This requires writing to contacts.xml. Verify that contacts.xml file is created.
4. Visit contacts.xml tab to confirm file content.
5. Save.
6. Confirm no exception.

Scenario D

Just like A, except between steps 1 and 2, visit the contacts.xml tab to make sure the xml editor is initialized on a missing file.
Comment 3 Konstantin Komissarchik CLA 2010-12-07 16:50:15 EST
Shenxue,

Please verify the fix. Once verified, add a note here and I will close this bug.
Comment 4 Shenxue Zhou CLA 2010-12-08 11:39:08 EST
I'm getting compiler errors on the sample project:


In the generated Contact.java:
public ModelElementHandle<IAddress> getAddress()

But in the IContact.java:

    // *** Address ***
    
    @Type( base = IAddress.class )
    @XmlBinding( path = "address" )
    
    ImpliedElementProperty PROP_ADDRESS = new ImpliedElementProperty( TYPE, "Address" );

    IAddress getAddress();

The compiler error I'm getting is:

The return type is incompatible with IContact.getAddress()	Contact.java	/org.eclipse.sapphire.samples/.apt_generated/org/eclipse/sapphire/samples/contacts/internal	line 46	Java Problem

If I revert the Address property from ImpliedElementProperty type to ElementProperty, then the compiler error goes away.
Comment 5 Shenxue Zhou CLA 2010-12-08 11:42:57 EST
Even after I revert the Address property and sample project builds, running the contact editor and adding a new contact would result the following exception:

Caused by: java.lang.RuntimeException: Could not find property Street in org.eclipse.sapphire.samples.contacts.IContact
	at org.eclipse.sapphire.ui.SapphirePart.resolve(SapphirePart.java:438)
	at org.eclipse.sapphire.ui.SapphirePart.resolve(SapphirePart.java:417)
	at org.eclipse.sapphire.ui.SapphirePropertyEditor.init(SapphirePropertyEditor.java:124)
	at org.eclipse.sapphire.ui.SapphirePart.init(SapphirePart.java:144)
	at org.eclipse.sapphire.ui.SapphirePart.create(SapphirePart.java:661)
	at org.eclipse.sapphire.ui.SapphirePartContainer.init(SapphirePartContainer.java:63)
	at org.eclipse.sapphire.ui.SapphirePart.init(SapphirePart.java:144)
	at org.eclipse.sapphire.ui.SapphirePart.create(SapphirePart.java:661)
	at org.eclipse.sapphire.ui.SapphirePageBook.changePage(SapphirePageBook.java:164)
	at org.eclipse.sapphire.ui.SapphirePageBook.changePage(SapphirePageBook.java:146)
	at org.eclipse.sapphire.ui.SapphireWithDirective.updateCurrentPage(SapphireWithDirective.java:322)
	at org.eclipse.sapphire.ui.SapphireWithDirective.init(SapphireWithDirective.java:72)
	at org.eclipse.sapphire.ui.SapphirePart.init(SapphirePart.java:144)
	at org.eclipse.sapphire.ui.SapphirePart.create(SapphirePart.java:661)
	at org.eclipse.sapphire.ui.SapphirePartContainer.init(SapphirePartContainer.java:63)
	at org.eclipse.sapphire.ui.SapphireSection.init(SapphireSection.java:68)
	at org.eclipse.sapphire.ui.SapphirePart.init(SapphirePart.java:144)
	at org.eclipse.sapphire.ui.editor.views.masterdetails.MasterDetailsContentNode.init(MasterDetailsContentNode.java:230)
	at org.eclipse.sapphire.ui.SapphirePart.init(SapphirePart.java:144)
	at org.eclipse.sapphire.ui.editor.views.masterdetails.MasterDetailsContentNode$6.createNode(MasterDetailsContentNode.java:314)
	at org.eclipse.sapphire.ui.editor.views.masterdetails.internal.ListPropertyNodeFactory.createNodes(ListPropertyNodeFactory.java:83)
	at org.eclipse.sapphire.ui.editor.views.masterdetails.MasterDetailsContentNode.getChildNodes(MasterDetailsContentNode.java:610)
	at org.eclipse.sapphire.ui.editor.views.masterdetails.MasterDetailsPage$2.hasChildren(MasterDetailsPage.java:450)
	at org.eclipse.jface.viewers.AbstractTreeViewer.isExpandable(AbstractTreeViewer.java:2086)
	at org.eclipse.jface.viewers.TreeViewer.isExpandable(TreeViewer.java:588)
	at org.eclipse.jface.viewers.AbstractTreeViewer.isExpandable(AbstractTreeViewer.java:2112)
	at org.eclipse.jface.viewers.AbstractTreeViewer.updatePlus(AbstractTreeViewer.java:2794)
	at org.eclipse.jface.viewers.TreeViewer.updatePlus(TreeViewer.java:852)
	at org.eclipse.jface.viewers.AbstractTreeViewer.internalRefresh(AbstractTreeViewer.java:1832)
	at org.eclipse.jface.viewers.AbstractTreeViewer.internalRefresh(AbstractTreeViewer.java:1799)
	at org.eclipse.jface.viewers.AbstractTreeViewer.internalRefresh(AbstractTreeViewer.java:1785)
	at org.eclipse.jface.viewers.StructuredViewer$7.run(StructuredViewer.java:1487)
	at org.eclipse.jface.viewers.StructuredViewer.preservingSelection(StructuredViewer.java:1422)
	at org.eclipse.jface.viewers.TreeViewer.preservingSelection(TreeViewer.java:403)
	at org.eclipse.jface.viewers.StructuredViewer.preservingSelection(StructuredViewer.java:1383)
	at org.eclipse.jface.viewers.StructuredViewer.refresh(StructuredViewer.java:1485)
	at org.eclipse.jface.viewers.ColumnViewer.refresh(ColumnViewer.java:537)
	at org.eclipse.ui.dialogs.FilteredTree$NotifyingTreeViewer.refresh(FilteredTree.java:1208)
	at org.eclipse.sapphire.ui.editor.views.masterdetails.MasterDetailsPage$4.handleNodeStructureChange(MasterDetailsPage.java:522)
	at org.eclipse.sapphire.ui.editor.views.masterdetails.MasterDetailsContentTree.notifyOfNodeStructureChange(MasterDetailsContentTree.java:286)
	at org.eclipse.sapphire.ui.editor.views.masterdetails.MasterDetailsContentNode$7.run(MasterDetailsContentNode.java:672)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:134)
	... 23 more
Comment 6 Konstantin Komissarchik CLA 2010-12-08 12:46:43 EST
You need to sync to the latest and re-build your dev environment and target.
Comment 7 Shenxue Zhou CLA 2010-12-09 11:52:58 EST
With the new build, I'm about to add new event and new contact. Please go ahead to close this bug.
Comment 8 Konstantin Komissarchik CLA 2010-12-09 11:54:34 EST
Closing, based on Shenxue's verification.