IBM Rational Synergy for Eclipse Interface
© Copyright IBM Corporation 2005, 2011
U.S. Government Users Restricted Rights - Use, duplication, or disclosure
restricted by GSA ADP Schedule Contract with IBM Corp.
The IBM® Rational® Synergy for Eclipse Interface provides many extension points that can be used to further extend the capability of the Integration. The integration itself has been written by using its own extension points.
This document is written for the plug-in writers who wish to use the extension points provided by the integration and add additional features to the integration.
Please refer to the section Reference for integration's javadoc.
This Integration consists of seven eclipse plug-ins. The plug-ins can be categorized into UI and non-UI plug-ins.
Non UI
Plug-ins
Util
Plug-in
Connection
Plug-in
Core
Plug-in
Team
Plug-in
Mylyn UI Plug-in
UI Plug-ins
Help
Plug-in
UI
Plug-in
Extension
Plug-in
Mylyn
Core Plug-in
The diagram below describes the dependencies among the plug-ins. It also indicates the relationship between extension plug-in and extender plug-in.
- Mylyn Core Plugin extends the Eclipse Mylyn core extension points to handle communication between Eclipse Mylyn and IBM Rational Synergy.
- Mylyn UI Plugin extends the Eclipse Mylyn UI extension points to add IBM Rational Synergy repository specific functionality to the Mylyn views.
The picture below represents the class diagram of the classes involved in model:
To interact with IBM Rational Synergy you need to have the name of the Connection. A Connection uniquely represents a IBM Rational Synergy database.
The code segment below iterates through the list of available connections.
HashMap map = CorePlugin.getDefault().getConnectionMap();
for (Iterator it = map.values().iterator(); it.hasNext();)
{
CMSRegisteredConnectionNew
connection = (CMSRegisteredConnectionNew) it.next();
if(connection!=null)
{
String connectionName = connection. connectionName;
// Do something
}
}
To make any call to get data from a IBM Rational Synergy database, you need to have an instance of com.telelogic.synergy.integration.core.cmsessions.CMApi
The
following code will get an instance of CMApi for a given Connection connectionName. If the password for this Connection is
blank, It will prompt for a password.
CMApi api = null;
try
{
api
= UIPlugin.getCCMObject(connectionName);
}catch(CmsException e)
{
UIPlugin.logMessage(e.toString(),this.getClass().getName(), Message.ERROR);
UIPlugin.reportMessage(e.toString(),Message.ERROR);
return false;
}
The following
code will also get an instance of CMApi for a given Connection connectionName. However, it will not prompt if the password
for Connection is blank, because the CorePlugin does
not have GUI components.
CMApi api = null;
api = CorePlugin.getCCMObject(connectionName);
The following code will allow you to write Strings to the Eclipse Console, identified as an Error, Warning, or Information.
UIPlugin.reportMessage(messageString,Message.ERROR); // Error, written in red color
UIPlugin.reportMessage(messageString,Message.WARNING); // Warning written in blue color
UIPlugin.reportMessage(messageString,Message.INFORMATION);
// Message written in black color
Some IBM Rational Synergy operations require a default task. The
following code segment can be used to enforce a default task.
int forcetask=0;
Display.getDefault().syncExec(new Runnable(){
public void run() {
while forcetask ==0){
try{
forcetask = UIPlugin.forceDefTask(connectionName);
}catch(CmsException e){
UIPlugin.logMessage(e.toString(),
this.getClass().getName(), Message.ERROR);
forcetask =-1;
return;
}
}
}
});
if(forcetask==-1) return ;
Some team operations
change the team status of files and folders. The following code illustrates how
to refresh the team status of resources.
final
IResource []resset = {res};
//res represents an IResource to
be
refreshed
final
ArrayList<IResource> lowlist = UIPlugin.getLowestLevelResources(
resset);
Display.getDefault().syncExec(new Runnable(){
public void run()
{
ArrayList clist = new ArrayList();
clist.add(connectionName); // Add all the connections to
be refreshed
// Refresh Task
View
CMSTaskView tview = UIPlugin.getTaskViewInstance();
if(tview=!null && tview.getViewer().getContentProvider()!=null)
for(int i=0;
i< clist.size();i++){
String
conName = (String) clist.get(i);
tview.refreshConnection(conName);
}
}
// Refresh
History View
CMSHistoryView hview = UIPlugin.getHistoryViewInstance();
if(hview!=null && hview.getViewer().getContentProvider()!=null)
{
IResource lres = hview.getCurrentResource();
if(lres!=null){
hview.showHistory(lres);
}
}
CMSRepositoryView rview = UIPlugin.getRepositoryViewInstance();
if(rview!=null && rview.getViewer().getContentProvider()!=null)
{
for(int i=0;
i< clist.size();i++)
{
String
conName = (String) clist.get(i);
rview.refreshConnection(conName);
}
}
// Refresh CR
View
CMSRepositoryView cview = UIPlugin.getChangeRequestViewInstance();
if(cview!=null
&& cview.getViewer().getContentProvider()!=null)
{
for(int i=0;
i< clist.size();i++)
{
String
conName = (String) clist.get(i);
cview.refreshConnection(conName);
}
}
UIPlugin.refreshResource((IResource[])lowlist.toArray(
new IResource[lowlist.size()]));
}
});
While writing a
plug-in for the integration you may need to know the current settings of the
Team Preference for IBM Rational Synergy. The static data member preference of class com.telelogic.synergy.integration.ui.UIPlugin stores the values of preference settings.
This data member is always up to date.
The code segment
below demonstrates how to use this variable.
PreferenceDefaultData2 tempdata = UIPlugin.preferencenew ;
// The variable tempdata should be not
be stored. It is temporary.
Refer to javadoc for description of members of class PreferenceDefaultData
The code segment
below demonstrates how to get list of workspace projects controlled by IBM
Rational Synergy Team provider.
IProject wrkprojects[] = UIPlugin.getWorkspace().getRoot().getProjects();
ArrayList plist = new ArrayList();
for(int m=0;m<wrkprojects.length;m++){
IProject
prj = wrkprojects[m];
CMSRepositoryProvider
provider = (CMSRepositoryProvider)
RepositoryProvider.getProvider(
prj, TeamPlugin.getTypeId());
//TeamPlugin
is from package com.telelogic.synergy.integration.team
if(provider==null)
continue;
plist.add(prj);
}