Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Sapphire » Customise samples(How to customise the sapphire samples)
Customise samples [message #1374867] Thu, 22 May 2014 20:51 Go to next message
psilos panipsilos is currently offline psilos panipsilosFriend
Messages: 23
Registered: June 2013
Junior Member
Hi ,

I am new to sapphire. I downloaded and tried the samples. In order to become familiar with sapphire i want to start customising one of the existing samples to make it meet my needs. So i started by adding a new text field "version" in the class item.java in the catalog sample.

@Required
@XmlBinding( path = "Version" )

ValueProperty PROP_VERSION = new ValueProperty( TYPE, "Version" );

Value<String> getVersion();
void setVersion( String value );

However the field "version" does not appear in the editor "catalog.xml" when i try to add a new item. I only added some information in the item.java. Do i need to modify any other file as well?

In general, my question is how to add new fields in the existing samples and how the changes are propagated in the editor. Do i need to compile the sample somehow?
Re: Customise samples [message #1374884 is a reply to message #1374867] Thu, 22 May 2014 21:04 Go to previous messageGo to next message
Konstantin Komissarchik is currently offline Konstantin KomissarchikFriend
Messages: 1077
Registered: July 2009
Senior Member
You need to reference the new property in CatalogEditor.sdef, the UI definition file. If you open this file in Eclipse with Sapphire SDK installed, it will open in the sdef editor. Then find the section where other related properties are referenced and add the new one.

For an end-to-end overview of Sapphire, see the introduction document.
Re: Customise samples [message #1374944 is a reply to message #1374884] Thu, 22 May 2014 21:39 Go to previous messageGo to next message
psilos panipsilos is currently offline psilos panipsilosFriend
Messages: 23
Registered: June 2013
Junior Member
thnx for your quick reply.

I did what you proposed but still I cannot see the "Version" field.

I added the property in the CatalogEditor.sdef:

<section>
<id>CatalogItemMainSection</id>
<content>
<property-editor>Name</property-editor>
<property-editor>Category</property-editor>
<property-editor>Manufacturer</property-editor>
<property-editor>Description</property-editor>
<property-editor>Version</property-editor>
</content>
<label>item</label>
</section>

Is there something else that I m missing?

I also get the following error in the console.Do you think it s related to my issue?

#######################################################################
Problems occurred when invoking code from plug-in: "org.eclipse.ui.workbench".

java.lang.IllegalStateException: CatalogEditorPageState element is already disposed.
at org.eclipse.sapphire.ElementImpl.assertNotDisposed(ElementImpl.java:1042)
at org.eclipse.sapphire.ElementImpl.property(ElementImpl.java:386)
at org.eclipse.sapphire.samples.catalog.CatalogEditorPageState$Impl.getContentOutlineState(Unknown Source)
at org.eclipse.sapphire.ui.forms.swt.MasterDetailsEditorPage.isDetailsMaximized(MasterDetailsEditorPage.java:479)
at org.eclipse.sapphire.ui.forms.swt.MasterDetailsEditorPage$4.partClosed(MasterDetailsEditorPage.java:358)
at org.eclipse.ui.internal.WorkbenchPage$21.run(WorkbenchPage.java:4878)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.ui.internal.WorkbenchPage.firePartClosed(WorkbenchPage.java:4876)
at org.eclipse.ui.internal.e4.compatibility.CompatibilityPart$1.handleEvent(CompatibilityPart.java:101)
at org.eclipse.e4.ui.services.internal.events.UIEventHandler$1.run(UIEventHandler.java:41)
at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:180)
at org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchronizer.java:150)
at org.eclipse.swt.widgets.Display.syncExec(Display.java:4650)
at org.eclipse.e4.ui.internal.workbench.swt.E4Application$1.syncExec(E4Application.java:205)
at org.eclipse.e4.ui.services.internal.events.UIEventHandler.handleEvent(UIEventHandler.java:38)
at org.eclipse.equinox.internal.event.EventHandlerWrapper.handleEvent(EventHandlerWrapper.java:197)
at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:197)
at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:1)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
at org.eclipse.equinox.internal.event.EventAdminImpl.dispatchEvent(EventAdminImpl.java:135)
at org.eclipse.equinox.internal.event.EventAdminImpl.sendEvent(EventAdminImpl.java:78)
at org.eclipse.equinox.internal.event.EventComponent.sendEvent(EventComponent.java:39)
at org.eclipse.e4.ui.services.internal.events.EventBroker.send(EventBroker.java:80)
at org.eclipse.e4.ui.internal.workbench.UIEventPublisher.notifyChanged(UIEventPublisher.java:58)
at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:374)
at org.eclipse.e4.ui.model.application.ui.impl.UIElementImpl.setWidget(UIElementImpl.java:248)
at org.eclipse.e4.ui.workbench.renderers.swt.SWTPartRenderer.unbindWidget(SWTPartRenderer.java:140)
at org.eclipse.e4.ui.workbench.renderers.swt.SWTPartRenderer.disposeWidget(SWTPartRenderer.java:161)
at org.eclipse.e4.ui.workbench.renderers.swt.ContributedPartRenderer.disposeWidget(ContributedPartRenderer.java:273)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeRemoveGui(PartRenderingEngine.java:899)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.access$3(PartRenderingEngine.java:828)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$8.run(PartRenderingEngine.java:823)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.removeGui(PartRenderingEngine.java:808)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$1.handleEvent(PartRenderingEngine.java:153)
at org.eclipse.e4.ui.services.internal.events.UIEventHandler$1.run(UIEventHandler.java:41)
at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:180)
at org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchronizer.java:150)
at org.eclipse.swt.widgets.Display.syncExec(Display.java:4650)
at org.eclipse.e4.ui.internal.workbench.swt.E4Application$1.syncExec(E4Application.java:205)
at org.eclipse.e4.ui.services.internal.events.UIEventHandler.handleEvent(UIEventHandler.java:38)
at org.eclipse.equinox.internal.event.EventHandlerWrapper.handleEvent(EventHandlerWrapper.java:197)
at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:197)
at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:1)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
at org.eclipse.equinox.internal.event.EventAdminImpl.dispatchEvent(EventAdminImpl.java:135)
at org.eclipse.equinox.internal.event.EventAdminImpl.sendEvent(EventAdminImpl.java:78)
at org.eclipse.equinox.internal.event.EventComponent.sendEvent(EventComponent.java:39)
at org.eclipse.e4.ui.services.internal.events.EventBroker.send(EventBroker.java:80)
at org.eclipse.e4.ui.internal.workbench.UIEventPublisher.notifyChanged(UIEventPublisher.java:58)
at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:374)
at org.eclipse.e4.ui.model.application.ui.impl.UIElementImpl.setToBeRendered(UIElementImpl.java:290)
at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.hidePart(PartServiceImpl.java:1178)
at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.hidePart(PartServiceImpl.java:1113)
at org.eclipse.e4.ui.workbench.renderers.swt.StackRenderer.closePart(StackRenderer.java:1120)
at org.eclipse.e4.ui.workbench.renderers.swt.StackRenderer.access$5(StackRenderer.java:1102)
at org.eclipse.e4.ui.workbench.renderers.swt.StackRenderer$12.close(StackRenderer.java:996)
at org.eclipse.swt.custom.CTabFolder.onMouse(CTabFolder.java:1852)
at org.eclipse.swt.custom.CTabFolder$1.handleEvent(CTabFolder.java:284)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4166)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1466)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1489)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1474)
at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1279)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4012)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3651)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1113)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:997)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:140)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:611)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:567)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124)
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:354)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:181)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:636)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:591)
at org.eclipse.equinox.launcher.Main.run(Main.java:1450)
Re: Customise samples [message #1375337 is a reply to message #1374944] Fri, 23 May 2014 01:39 Go to previous messageGo to next message
Greg Amerson is currently offline Greg AmersonFriend
Messages: 119
Registered: March 2010
Senior Member
Do you have the Eclipse SDK installed (PDE) and have the samples plugin in your workspace and are you launching a new Eclipse runtime workbench to see your changes?
Re: Customise samples [message #1376176 is a reply to message #1375337] Fri, 23 May 2014 09:45 Go to previous messageGo to next message
psilos panipsilos is currently offline psilos panipsilosFriend
Messages: 23
Registered: June 2013
Junior Member
Thank you Greg. Now it works fine

So once I customise my editor how do i "export" it so that I can use it in my java projects? In ohter words, how I can i distribute my editor?

I guess this is an eclipse plug-ins related question. Shall i create a separate post?
Re: Customise samples [message #1376197 is a reply to message #1376176] Fri, 23 May 2014 09:55 Go to previous messageGo to next message
Greg Amerson is currently offline Greg AmersonFriend
Messages: 119
Registered: March 2010
Senior Member
Yeah those PDE/plugin related questions should likely go into another forum as they are not specific to Sapphire. But recent versions of Eclipse have a "self-hosted" mode which is nice... you can just install the plugin from your workspace directly into the running Eclipse instance. Right click the project > Export > Deployable plugins > then on that wizard page on the bottom there is an option for : "Install into host. Repository:" and it should be automatically set to the value that will install your plugin into your running Eclipse.

Good luck! Smile
Re: Customise samples [message #1376294 is a reply to message #1376197] Fri, 23 May 2014 10:45 Go to previous message
psilos panipsilos is currently offline psilos panipsilosFriend
Messages: 23
Registered: June 2013
Junior Member
Thank you Greg.

quick and straightforward. It worked!!! Smile
Previous Topic:Make whole editor read-only
Next Topic:Last call for Sapphire 8
Goto Forum:
  


Current Time: Wed Apr 24 17:12:49 GMT 2024

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

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

Back to the top