By now, in this sample plug-in, it already can show:
1) a Expeditor launch item;
2) a custom perspective with custom views and Symphony views;
3) some new Symphony documents of three kinds repeatedly;
4) a status bar to show the new documents’ type;
5) a custom engine of spell check;
6) a early startup when Symphony was startup.
7) a custom help document
The following figure shows this sample plug-in's overview image.
Figure 5.5.1 overview image
On the Expeditor platform and the Symphony developing environment, user maybe need custom views and Symphony views at same time, maybe need use custom view to operate Symphony view, maybe need other typical application of Eclipse and Expeditor such as status bar, early startup, custom spell check, custom help document etc.
According to the scenario above, this plug-in first create a perspective, and then add 3 views on this perspective. One used for new buttons which create 3 kinds of new Symphony document, the other one used to show description and another used to show multi Symphony document views. Then add early startup which invoked when Symphony was startup, a status bar and a sample help.
Showing developer:
How to use Expeditor launch item;
How to create a custom perspective and add custom views and Symphony views;
How to create new Symphony documents of three kinds repeatedly;
How to add a status bar to show the new documents’ type;
How to create a custom engine of spell check;
How to add custom early startup when Symphony was startup.
How to add a custom help document
Please refer to this guide chapter 1 part 3: Setting up the integrated development environment. It shows how to prepare your symphony develop environment step by step.
By now, for developer, if you got this plug-in and do a quick view of this plug-in's functions, just import this sample plug-in into eclipse from a exit project using eclipse import function. Otherwise the following sections show you how to build this plug-in.
Figure 5.5.2 Import this sample plug-in
Figure 5.5.3 Select this sample zip file
By now, there are five goals:
1) Open a custom perspective from launch item;
2) Add two custom views and multi-Symphony view;
3) Add a status bar show new file’s type.
4) Add a early startup;
5) Add custom help content.
1) Launch the Eclipse development environment
2) Click File > New > Project
3) Select “Plug-in Project”, and click “Next”
4) Type com.ibm.productivity.tools.samples.customizing in the Project name field. Click Next.
5) Type a descriptive name in the Plug-in Name field, e.g. Customizing sample.
6) Click Finish.
Figure 5.5.4 New project last step image
The following table lists some of the plug-in dependencies used by Document Library (plug-in names are abbreviated):
Plug-in |
Description |
org.eclipse.core.runtime, org.eclipse.ui |
Eclipse core plug-ins |
com.ibm.productivity.tools.ui.views com.ibm.productivity.tools.core |
Lotus Symphony API plug-in |
com.ibm.rcp.textanalyzer |
RCP user interface APIs |
Perform the following steps to add the plug-in dependency.
1) Click the Dependencies tab of the spreadsheet sample plug-in manifest.
2) Click Add.
3) Add the following plug-ins:
· com.ibm.productivity.tools.ui.views
· com.ibm.productivity.tools.core
· com.ibm.rcp.textanalyzer
Figure 5.5.5. Dependencies plug-ins image
1) Click the Extensions tab.
2) Click Add.
3) Add the following extension: org.eclipse.ui.perspectives.
4) Click Finish.
5) Right click the added extension and select New > perspective.
6) Click the plugin.xml tab.
7) Copy and paste over with the following into the plugin.xml for a quick finish.
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.2"?>
<plugin>
<extension
point="com.ibm.rcp.ui.launcherSet">
<LauncherSet
id="com.ibm.productivity.tools.samples.views.LauncherSet"
label="Show Customizing Sample">
<perspectiveLaunchItem
autoStart="false"
iconUrl="resource/Customizing.gif"
id="com.ibm.productivity.tools.samples.views.perspectiveLaunchItem"
label="Show Customizing Sample"
perspectiveId="com.ibm.productivity.tools.samples.customizing.perspective">
</perspectiveLaunchItem>
</LauncherSet>
</extension>
<extension
point="org.eclipse.ui.perspectives">
<perspective
class = "com.ibm.productivity.tools.samples.customizing.Prespective"
icon="resource/Customizing.gif"
name = "customizing"
id = "com.ibm.productivity.tools.samples.customizing.perspective"
/>
</extension>
<extension
point="org.eclipse.ui.views">
<view
category="com.ibm.productivity.tools.samples.customizing"
allowMultiple="true"
class="com.ibm.productivity.tools.samples.customizing.view.WriterView"
id="com.ibm.productivity.tools.samples.customizing.writerview"
icon="resource/Customizing.gif"
name="Document">
</view>
<view
category="com.ibm.productivity.tools.samples.customizing"
allowMultiple="true"
class="com.ibm.productivity.tools.samples.customizing.view.SpreadsheetView"
id="com.ibm.productivity.tools.samples.customizing.spreadsheetview"
icon="resource/Customizing.gif"
name="Spreadsheet">
</view>
<view
category="com.ibm.productivity.tools.samples.customizing"
allowMultiple="true"
class="com.ibm.productivity.tools.samples.customizing.view.PresentationView"
id="com.ibm.productivity.tools.samples.customizing.presentationview"
icon="resource/Customizing.gif"
name="Presentation">
</view>
<view
category="com.ibm.productivity.tools.samples.customizing"
allowMultiple="true"
class="com.ibm.productivity.tools.samples.customizing.view.OpenFilesView"
id="com.ibm.productivity.tools.samples.customizing.openfilesview"
icon="resource/Openfiles.gif"
name="New Files">
</view>
<view
category="com.ibm.productivity.tools.samples.customizing"
allowMultiple="true"
class="com.ibm.productivity.tools.samples.customizing.view.DescriptionView"
id="com.ibm.productivity.tools.samples.customizing.descriptionview"
icon="resource/Openfiles.gif"
name="Description">
</view>
<category
id="com.ibm.productivity.tools.samples.customizing"
name="customizing Category">
</category>
</extension>
<extension
point="com.ibm.rcp.ui.controlSets">
<controlSet
visible="true"
id="com.ibm.productivity.tools.samples.customizing.controlset">
<statusLine
path="BEGIN_GROUP"
id="com.ibm.productivity.tools.samples.customizing.statusline">
<groupMarker name="additions"/>
</statusLine>
<control
statusLinePath="com.ibm.productivity.tools.samples.customizing.statusline/additions"
class="com.ibm.productivity.tools.samples.customizing.StatusbarItem" id="com.ibm.productivity.tools.samples.customizing.control"/>
</controlSet>
</extension>
<extension
point="com.ibm.rcp.textanalyzer.Engines">
<engine
class="com.ibm.productivity.tools.samples.customizing.engine.Engine"
interface="com.ibm.rcp.textanalyzer.spellchecker.SpellCheckerEngine"
locales="en-US,zh-CN"
name="CustomizingEngine"
platform="All"
provider="IBM"
thirdParty="false"/>
</extension>
<extension point="org.eclipse.ui.startup">
<startup class="com.ibm.productivity.tools.samples.customizing.Startup"/>
</extension>
<extension point="org.eclipse.help.toc">
<toc file="help.xml" primary="true"/>
</extension>
</plugin>
Figure 5.5.6 Extensions overview image
8) New a class named Prespective which implements IPerspectiveFactory. The main method in this class as follow;
public void createInitialLayout( IPageLayout layout ) {
//set editor area to invisible so that the view shows maximized.
layout.setEditorAreaVisible(false);
//add the expeditor view to this perspective
layout.addView(OpenFilesView.VIEW_ID, IPageLayout.LEFT, 0.25f, layout.getEditorArea());
layout.addView(DescriptionView.VIEW_ID, IPageLayout.BOTTOM, 0.4f, OpenFilesView.VIEW_ID);
layout.addView(WriterView.VIEW_ID, IPageLayout.RIGHT, 0.75f, layout.getEditorArea());
}
The method createInitialLayout () specified the views layout on the page.
Figure 5.5.7 Sample package explorer
Following is core code snippet for the function, for details, refer to this sample code.
1) Add a launch item to launch a perspective.
First add extension point (com.ibm.rcp.ui.launcherSet), then new a perspectiveLaunchItem and set this item’s perspectiveId attribute value as the perspective’s id which will be launched.
2) Add custom view and Symphony views.
For custom view please refer Eclipse’s org.eclipse.ui.views extension point reference. For Symphony views please refer to section 2.3 chapter 2 part 5 of this guide.
3) Add a status bar
Please refer to section 2.6 chapter 2 part 3 of this guide.
4) Add a custom early startup.
First add extension point (org.eclipse.ui.startup), then new a class implements IStartup to do something when symphony startup.
<extension point="org.eclipse.ui.startup">
<startup
class="com.ibm.productivity.tools.samples.customizing.Startup"/>
</extension>
5) Add a custom help context:
First add extension point (org.eclipse.help.toc), then specified the toc file which context pointing to the custom help file.
<extension point="org.eclipse.help.toc">
<toc file="help.xml" primary="true"/>
</extension>
In the toc file, pointing to the help file’s position. For details, please refer this sample.
<?xml version="1.0" encoding="UTF-8"?>
<?NLS TYPE="org.eclipse.help.toc"?>
<toc label="Customizing Sample of Contents">
<topic
label="Customizing Sample Topic" href="help/help.htm">
</topic>
</toc>
When next, add a custom dictionary for spell check , activities which are assigned a name and description that provide information about an activity and etc.