Difference between revisions of "Tutorial: Project Development"

From Developer Documents
Jump to navigation Jump to search
m
m
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
Our customer wants a tool to aid in production of motion pictures. In this tutorial series we are going to create a YouMovie movies producer tool over Simantics Platform. This part of the tutorial trail includes creation of a plugins, a perspective extension and exposing it all as a feature.
+
Our customer wants a tool to aid in production of motion pictures. In this tutorial series we are going to create a Movie Production tool over Simantics Platform. In this part we create a UI plugin, a perspective and a feature.
  
 
==Step 1: Create UI Plugin==
 
==Step 1: Create UI Plugin==
Line 7: Line 7:
 
*'' '''File''' >> '''New''' >> '''Plug-in Development''' >> '''Plug-in Project''' >> '''Next >'''
 
*'' '''File''' >> '''New''' >> '''Plug-in Development''' >> '''Plug-in Project''' >> '''Next >'''
  
Project name for feature is ''com.acme.movie.ui''. '''Next >'''.  
+
Project name for the feature is ''com.acme.movie.ui''. '''Next >'''.  
You do have a use for activator, so keep that checked. The plug-in makes UI contributions, but is not a rich client application. '''Finish'''
+
In the wizard you should know that you'll have a use for an activator, check that, the plug-in makes UI contributions, but is not a rich client application. '''Finish'''
  
 
Open the plugin from plugin.xml. From Overview page make sure ''This plug-in is a singleton''.
 
Open the plugin from plugin.xml. From Overview page make sure ''This plug-in is a singleton''.
Also add
 
  
 
==Step 2: Create Perspective==
 
==Step 2: Create Perspective==
Perspective is a viewport on how to work with the project ([http://www.eclipse.org/articles/using-perspectives
+
Perspective is a viewport to work is done in a project ([http://www.eclipse.org/articles/using-perspectives/PerspectiveArticle.html Read More]). We need a movie production perspective. The plan is to  
/PerspectiveArticle.html Read More]). We need a movie production perspective. The plan is to  
 
 
have a model browser (left), an editor for diagram representations (center), a properties view (bottom) and a database view (right). Here is a sketch.  
 
have a model browser (left), an editor for diagram representations (center), a properties view (bottom) and a database view (right). Here is a sketch.  
  
Line 38: Line 36:
  
  
The empty perspective needs content, lets start with the Model Browser. It should be located on the left-hand side as planned in the sketch. Simantics has such component, its identifier is ''org.simantics.structural.ui.modelBrowser''. We are going to add an perspective extension that states that in this perspective there is a Model Browser that is located to the left of the editor area. FYI the identifier of the editor area is ''org.eclipse.ui.editorss''.  
+
The empty perspective needs content, lets start with the Model Browser. It should be located on the left-hand side as planned in the sketch. Simantics has such component, its identifier is ''org.simantics.structural.ui.modelBrowser''. We are going to add a perspective extension that states that, in this perspective there is a Model Browser that is located to the left of the editor area. FYI the identifier of the editor area is ''org.eclipse.ui.editorss''.  
  
 
Add Model Browser View to the perspective.  
 
Add Model Browser View to the perspective.  
Line 72: Line 70:
  
 
==Step 3: Create Feature==
 
==Step 3: Create Feature==
Feature is a set of plug-ins grouped into a single manageable unit. Open wizard.
+
Feature is a set of plug-ins grouped into a single manageable unit.  
  
*'' '''File''' >> '''New''' >> '''Plug-in Development''' >> '''Feature Project''' >> '''Next >'''
+
Create feature
 
+
* ''Open wizard '''File''' >> '''New''' >> '''Plug-in Development''' >> '''Feature Project''' >> '''Next >'''
Project name for feature is ''com.acme.movie.feature''. '''Next >'''.  
+
* Project name for feature is ''com.acme.movie.feature''. '''Next >'''.  
The feature includes both ''com.acme.*'' plugins (.ontology, .ui), check in. '''Finish'''
+
* The feature includes both ''com.acme.movie.ontology'' and ''.ui'' plugins, check in. '''Finish'''
  
 
==Step 4: Create Product==
 
==Step 4: Create Product==
In final release the application would be delivered as a Feature using Simantics Project Managed. But for developing reasons we are going to create a product.  
+
In the final release the application would be delivered as a Feature. Features can be installed from an update site using Simantics Project Manager (SPM). But for development we are going to create a product.  
  
 
Create a new product configuration
 
Create a new product configuration
Line 88: Line 86:
 
Create Product extension
 
Create Product extension
 
* Open ''Movie.product''
 
* Open ''Movie.product''
* Select ''New Product''
+
* Select ''New Product''. A wizard will open. Leave Defining Plug-in as ''com.acme.movie.ui'' and Product ID ''product''.  
A wizard will open. Leave Defining Plug-in as ''com.acme.movie.ui'' and Product ID ''product''. Select ''org.simantics.workbench.application'' as Product Application. '''Finish'''.
+
* Select ''org.simantics.workbench.application'' as Product Application. '''Finish'''.
 
 
 
 
 
 
 
 
 
*Open ''Movie.product'' and ''Overview'' tab sheet from the editor bottom.
 
*Open ''Movie.product'' and ''Overview'' tab sheet from the editor bottom.
 
** Add values for ID, Version and Name; say com.acme.movie, 1.0 and "Motion Picture Production Manager"
 
** Add values for ID, Version and Name; say com.acme.movie, 1.0 and "Motion Picture Production Manager"
Line 110: Line 104:
 
* Click ''Launch an Eclipse application''
 
* Click ''Launch an Eclipse application''
  
If everything goes fine a simantics platform should start and open up. There will be no default perspective but you can choose your "Movie Production" perspective. It should look like this, if not, you can look for help in the tutorial source codes at at https://www.simulationsite.net/svn/simantics/tutorials/trunk/
+
If everything goes fine a simantics platform should start and open up. There will be no default perspective but you can choose your "Movie Production" perspective. It should look like this, if not, you can look for help in the tutorial source codes at https://www.simulationsite.net/svn/simantics/tutorials/trunk/
  
 
[[file:tutorial_perspective.png]]
 
[[file:tutorial_perspective.png]]

Revision as of 14:06, 19 October 2010

Our customer wants a tool to aid in production of motion pictures. In this tutorial series we are going to create a Movie Production tool over Simantics Platform. In this part we create a UI plugin, a perspective and a feature.

Step 1: Create UI Plugin

To create the a new plugin, open the wizard.

  • File >> New >> Plug-in Development >> Plug-in Project >> Next >

Project name for the feature is com.acme.movie.ui. Next >. In the wizard you should know that you'll have a use for an activator, check that, the plug-in makes UI contributions, but is not a rich client application. Finish

Open the plugin from plugin.xml. From Overview page make sure This plug-in is a singleton.

Step 2: Create Perspective

Perspective is a viewport to work is done in a project (Read More). We need a movie production perspective. The plan is to have a model browser (left), an editor for diagram representations (center), a properties view (bottom) and a database view (right). Here is a sketch.

Sketch.png


Lets start. Add Movie Production perspective.

  • Open com.acme.movie.ui / META-INF/MANIFEST.MF >> Extensions
  • Add a new extension, org.eclipse.ui.perspectives
  • A node will appear, select it, right click new >> perspective. Select it.
  • Add info, put com.acme.movie.ui.perspective as id, "Movie Production" as name, and com.acme.movie.ui.PerspectiveFactory as class name.
  • Create perspective factory class. Click on the blue underlined "Class *:" link, a class instantiation wizard will open. Finish.
  • Make editor permanently visible. Edit the class

<syntaxhighlight lang="java">

   public class PerspectiveFactory implements IPerspectiveFactory {
     @Override
     public void createInitialLayout(IPageLayout layout) {
       layout.setEditorAreaVisible(true);		
     }
   }

</syntaxhighlight>


The empty perspective needs content, lets start with the Model Browser. It should be located on the left-hand side as planned in the sketch. Simantics has such component, its identifier is org.simantics.structural.ui.modelBrowser. We are going to add a perspective extension that states that, in this perspective there is a Model Browser that is located to the left of the editor area. FYI the identifier of the editor area is org.eclipse.ui.editorss.

Add Model Browser View to the perspective.

  • Add new extension org.eclipse.ui.perspectiveExtensions
  • Put com.acme.movie.ui.perspective as targetID
  • Add model browser
    • com.acme.movie.ui.perspective >> right-click >> new >> view
    • id = org.simantics.structural.ui.modelBrowser
    • relationship = left
    • relative = org.eclipse.ui.editorss
    • ratio = 0.2
    • visible = true
    • closable = false


Apply the same steps to add property view at the bottom.

  • com.acme.movie.ui.perspective >> right-click >> new >> view
  • id = org.simantics.browsing.ui.graph.propertyView
  • relationship = left, org.eclipse.ui.editorss
  • ratio = 0.7
  • visible = true
  • closable = false


And symbol library on the right.

  • com.acme.movie.ui.perspective >> right-click >> new >> view
  • id = org.simantics.diagram.symbollibrary
  • relationship = left
  • relative = org.eclipse.ui.editorss
  • ratio = 0.6
  • visible = true
  • closable = false

Step 3: Create Feature

Feature is a set of plug-ins grouped into a single manageable unit.

Create feature

  • Open wizard File >> New >> Plug-in Development >> Feature Project >> Next >
  • Project name for feature is com.acme.movie.feature. Next >.
  • The feature includes both com.acme.movie.ontology and .ui plugins, check in. Finish

Step 4: Create Product

In the final release the application would be delivered as a Feature. Features can be installed from an update site using Simantics Project Manager (SPM). But for development we are going to create a product.

Create a new product configuration

  • File >> New >> Plug-in Development >> Product Configuration >> Next >
  • Select com.acme.movie.ui as parent folder and put Movie.product for filename. Finish

Create Product extension

  • Open Movie.product
  • Select New Product. A wizard will open. Leave Defining Plug-in as com.acme.movie.ui and Product ID product.
  • Select org.simantics.workbench.application as Product Application. Finish.
  • Open Movie.product and Overview tab sheet from the editor bottom.
    • Add values for ID, Version and Name; say com.acme.movie, 1.0 and "Motion Picture Production Manager"
    • Choose org.simantics.workbench.product as Product and org.simantics.workbench.application as Application
    • Select "The product configuration is based on: features"
  • Open Dependencies tab sheet from the editor bottom.
    • Add org.simantics.sdk
    • Add com.acme.movie.feature
    • Save file.


Step 5: Run it

OK, you have now a feature and a product configuration. Give it a go.

  • Open Movie.product
  • Click Launch an Eclipse application

If everything goes fine a simantics platform should start and open up. There will be no default perspective but you can choose your "Movie Production" perspective. It should look like this, if not, you can look for help in the tutorial source codes at https://www.simulationsite.net/svn/simantics/tutorials/trunk/

Tutorial perspective.png