Skip to main content



      Home
Home » Archived » Sapphire » Running a sapphire application in a simple java main method
Running a sapphire application in a simple java main method [message #759906] Wed, 30 November 2011 09:30 Go to next message
Eclipse UserFriend
Hello,

I have the following simple interface


package snippets.sapphire.model;


import org.eclipse.sapphire.modeling.ModelElementType;
import org.eclipse.sapphire.modeling.Value;
import org.eclipse.sapphire.modeling.ValueProperty;
import org.eclipse.sapphire.modeling.annotations.Label;
import org.eclipse.sapphire.modeling.xml.annotations.XmlBinding;

public interface IName
{
    ModelElementType TYPE       = new ModelElementType( IName.class );
    
    // title
    @XmlBinding( path = "title" )
    @Label( standard = "&title" )
    ValueProperty    PROP_TITLE = new ValueProperty( TYPE, "Title" );
    Value< String > getTitle();   
    void setTitle( String value );
    
    // first name
    @XmlBinding( path = "firstName" )
    @Label( standard = "&firstName" )
    ValueProperty PROP_FIRST = new ValueProperty( TYPE, "FirstName" );
    Value< String > getFirstName();
    void setFirstName( String value );
    
}


My NameUI.sdef file ( probably incorrect) is shown below:

<?xml version="1.0" encoding="UTF-8"?>
<definition>
    <import>
        <package>snippets.sapphire.model</package>
        <definition>IName</definition>
    </import>
    <composite>
        <content>
            <property-editor>Title</property-editor>
            <property-editor>First</property-editor>
        </content>
    </composite>
</definition>


At this point all I would like to do as a beginner is to execute it so I can see the UI and play with these properties.

My attempt to instantiate the above is shown below - of course it does not work - hence where I am stuck.

package snippets.sapphire.ui;


import javax.inject.Inject;

import org.eclipse.e4.core.contexts.Active;
import org.eclipse.swt.widgets.Shell;

import snippets.sapphire.model.IName;

public class NameApp
{  
    @Inject
    @Active
    Shell shell;

    public static void main( String[] args )
    {
        IName name = IName.TYPE.instantiate();

        // WHAT DO I PUT HERE
    }
    
}



I am using eclipse 4.3 (Juno) stable release with its sapphire 0.4 downloaded from the update site.

Thanks for any help.
Re: Running a sapphire application in a simple java main method [message #760027 is a reply to message #759906] Wed, 30 November 2011 20:14 Go to previous messageGo to next message
Eclipse UserFriend
You cannot launch into Eclipse IDE/RCP in this manner (via a main method). Instead, you should contribute your UI via one of the available Eclipse extension points, such as by creating an editor, a view, a wizard or a command that launches a dialog. For a good example of how to do this, see the EzBug sample in the samples plugin. It shows you quite a few different entry points. The EzBug sample is also used in the intro article.

http://www.eclipse.org/sapphire/documentation/latest/introduction/index.html

Thanks,

- Konstantin
Re: Running a sapphire application in a simple java main method [message #760029 is a reply to message #760027] Wed, 30 November 2011 20:43 Go to previous messageGo to next message
Eclipse UserFriend
Thanks Konstantin.

I was hoping there was some simple mechanism to play-around with sapphire.

[Updated on: Wed, 30 November 2011 20:44] by Moderator

Re: Running a sapphire application in a simple java main method [message #760031 is a reply to message #760027] Wed, 30 November 2011 21:23 Go to previous messageGo to next message
Eclipse UserFriend
Hello Konstantin,
When I install eclipse 4.2 and checkout the Sapphire's example samples, there are many errors, including the EzBug samples.

Is this due to to API changes?

Thanks
Re: Running a sapphire application in a simple java main method [message #760050 is a reply to message #760031] Thu, 01 December 2011 00:57 Go to previous messageGo to next message
Eclipse UserFriend
Sapphire 0.4 is compatible with Eclipse 4.2 M3. Did you install Sapphire SDK into your Eclipse? You need to have SDK installed in order to build Sapphire-based code, including the samples.

- Konstantin
Re: Running a sapphire application in a simple java main method [message #760055 is a reply to message #760050] Thu, 01 December 2011 01:08 Go to previous messageGo to next message
Eclipse UserFriend
Yes,
All the Sapphire artifacts from 4.2m3 Juno update site have been successfully installed, but the errors still exist when the sapphire samples are checked-out from CVS.
Re: Running a sapphire application in a simple java main method [message #760118 is a reply to message #760055] Thu, 01 December 2011 06:17 Go to previous message
Eclipse UserFriend
If you are installing Sapphire SDK from Juno M3 updating site and then getting the latest version of samples from CVS, you are getting incompatible snapshots. To compile the latest samples, you need a newer version of Sapphire. Try this update site instead:

https://hudson.eclipse.org/hudson/job/sapphire-0.4.x/lastSuccessfulBuild/artifact/build/repository/

- Konstantin
Previous Topic:Section in Form Page is not getting Expanded
Next Topic:Instantiation a popup test UI of Sapphire
Goto Forum:
  


Current Time: Thu Nov 06 17:24:46 EST 2025

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

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

Back to the top