mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 22:52:11 +02:00
Add Examples.tutorial project
This commit is contained in:
parent
096546c188
commit
79ed051718
29 changed files with 1949 additions and 0 deletions
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
|
@ -0,0 +1 @@
|
|||
bin
|
28
rse/examples/org.eclipse.rse.examples.tutorial/.project
Normal file
28
rse/examples/org.eclipse.rse.examples.tutorial/.project
Normal file
|
@ -0,0 +1,28 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>org.eclipse.rse.examples.tutorial</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.ManifestBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.SchemaBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.pde.PluginNature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
|
@ -0,0 +1,16 @@
|
|||
Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: RSE Tutorial Examples
|
||||
Bundle-SymbolicName: org.eclipse.rse.examples.developer;singleton:=true
|
||||
Bundle-Version: 1.0.0
|
||||
Bundle-Activator: samples.RSESamplesPlugin
|
||||
Bundle-Vendor: Eclipse.org
|
||||
Bundle-Localization: plugin
|
||||
Require-Bundle: org.eclipse.ui,
|
||||
org.eclipse.ui.views,
|
||||
org.eclipse.core.runtime,
|
||||
org.eclipse.core.resources,
|
||||
org.eclipse.rse.ui,
|
||||
org.eclipse.rse.core,
|
||||
org.eclipse.rse.services
|
||||
Eclipse-LazyStart: true
|
22
rse/examples/org.eclipse.rse.examples.tutorial/about.html
Normal file
22
rse/examples/org.eclipse.rse.examples.tutorial/about.html
Normal file
|
@ -0,0 +1,22 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
|
||||
<html>
|
||||
<head>
|
||||
<title>About</title>
|
||||
<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1">
|
||||
</head>
|
||||
<body lang="EN-US">
|
||||
<h2>About This Content</h2>
|
||||
|
||||
<p>April 25, 2006</p>
|
||||
<h3>License</h3>
|
||||
|
||||
<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the
|
||||
Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
|
||||
For purposes of the EPL, "Program" will mean the Content.</p>
|
||||
|
||||
<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is being redistributed by another party ("Redistributor") and different terms and conditions may
|
||||
apply to your use of any object code in the Content. Check the Redistributor's license that was provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
|
||||
indicated below, the terms and conditions of the EPL still apply to any source code in the Content.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,12 @@
|
|||
source.. = src/
|
||||
output.. = bin/
|
||||
bin.includes = META-INF/,\
|
||||
.,\
|
||||
about.html,\
|
||||
icons/,\
|
||||
plugin.xml
|
||||
src.includes = META-INF/,\
|
||||
about.html,\
|
||||
icons/,\
|
||||
plugin.xml
|
||||
|
Binary file not shown.
After Width: | Height: | Size: 138 B |
Binary file not shown.
After Width: | Height: | Size: 903 B |
Binary file not shown.
After Width: | Height: | Size: 200 B |
Binary file not shown.
After Width: | Height: | Size: 217 B |
BIN
rse/examples/org.eclipse.rse.examples.tutorial/icons/team.gif
Normal file
BIN
rse/examples/org.eclipse.rse.examples.tutorial/icons/team.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 916 B |
Binary file not shown.
After Width: | Height: | Size: 930 B |
38
rse/examples/org.eclipse.rse.examples.tutorial/plugin.xml
Normal file
38
rse/examples/org.eclipse.rse.examples.tutorial/plugin.xml
Normal file
|
@ -0,0 +1,38 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright (c) 2006 IBM Corporation. All rights reserved.
|
||||
This program and the accompanying materials are made available under the terms
|
||||
of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
||||
available at http://www.eclipse.org/legal/epl-v10.html
|
||||
|
||||
Initial Contributors:
|
||||
The following IBM employees contributed to the Remote System Explorer
|
||||
component that contains this file: David McKnight, Kushal Munir,
|
||||
Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||
Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||
|
||||
Contributors:
|
||||
Martin Oberhuber (Wind River) - Adapted original tutorial code to Open RSE.
|
||||
-->
|
||||
<?eclipse version="3.1"?>
|
||||
<plugin>
|
||||
<!-- ======================================= -->
|
||||
<!-- SubSystem Configuration -->
|
||||
<!-- ======================================= -->
|
||||
<extension
|
||||
point="org.eclipse.rse.ui.subsystemConfiguration">
|
||||
<configuration
|
||||
id="samples.subsystems.factory"
|
||||
systemTypes="Linux;Unix;Windows"
|
||||
name="Teams"
|
||||
class="samples.subsystems.DeveloperSubSystemConfiguration"
|
||||
category="users"
|
||||
vendor="Eclipse.org"
|
||||
description="Example Developer Subsystem"
|
||||
iconlive="icons/systemconnectionlive.gif"
|
||||
icon="icons/systemconnection.gif"
|
||||
>
|
||||
</configuration>
|
||||
</extension>
|
||||
</plugin>
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding='UTF-8'?>
|
||||
<!DOCTYPE MessageFile SYSTEM "../com.ibm.etools.systems.core/messageFile.dtd">
|
||||
<!-- This is a message file used by SystemMessage and SystemMessageDialog -->
|
||||
<MessageFile Version="1.0">
|
||||
<Component Name="RSE Samples" Abbr="RSS">
|
||||
<Subcomponent Name="General" Abbr="G">
|
||||
<MessageList>
|
||||
<Message ID="1001" Indicator="E">
|
||||
<LevelOne>Sample message</LevelOne>
|
||||
<LevelTwo>This is a sample with one substution variable: %1</LevelTwo>
|
||||
</Message>
|
||||
</MessageList>
|
||||
</Subcomponent>
|
||||
</Component>
|
||||
</MessageFile>
|
|
@ -0,0 +1,164 @@
|
|||
/********************************************************************************
|
||||
* Copyright (c) 2006 IBM Corporation. All rights reserved.
|
||||
* This program and the accompanying materials are made available under the terms
|
||||
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
||||
* available at http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Initial Contributors:
|
||||
* The following IBM employees contributed to the Remote System Explorer
|
||||
* component that contains this file: David McKnight, Kushal Munir,
|
||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||
*
|
||||
* Contributors:
|
||||
* Martin Oberhuber (Wind River) - Adapted original tutorial code to Open RSE.
|
||||
********************************************************************************/
|
||||
|
||||
package samples;
|
||||
|
||||
import java.util.MissingResourceException;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import org.eclipse.core.resources.IWorkspace;
|
||||
import org.eclipse.core.resources.ResourcesPlugin;
|
||||
import org.eclipse.core.runtime.IAdapterManager;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.rse.core.SystemBasePlugin;
|
||||
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
|
||||
import org.eclipse.rse.services.clientserver.messages.SystemMessageFile;
|
||||
import org.osgi.framework.BundleContext;
|
||||
|
||||
import samples.subsystems.DeveloperSubSystemConfigurationAdapterFactory;
|
||||
|
||||
/**
|
||||
* The activator class controls the plug-in life cycle
|
||||
*/
|
||||
public class RSESamplesPlugin extends SystemBasePlugin {
|
||||
//The shared instance.
|
||||
private static RSESamplesPlugin plugin;
|
||||
//Resource bundle.
|
||||
private ResourceBundle resourceBundle;
|
||||
private static SystemMessageFile messageFile = null;
|
||||
|
||||
/**
|
||||
* The constructor.
|
||||
*/
|
||||
public RSESamplesPlugin() {
|
||||
super();
|
||||
plugin = this;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is called upon plug-in activation
|
||||
*/
|
||||
public void start(BundleContext context) throws Exception {
|
||||
super.start(context);
|
||||
messageFile = getMessageFile("rseSamplesMessages.xml"); //$NON-NLS-1$
|
||||
|
||||
IAdapterManager manager = Platform.getAdapterManager();
|
||||
samples.model.DeveloperAdapterFactory factory = new samples.model.DeveloperAdapterFactory();
|
||||
manager.registerAdapters(factory, samples.model.TeamResource.class);
|
||||
manager.registerAdapters(factory, samples.model.DeveloperResource.class);
|
||||
|
||||
DeveloperSubSystemConfigurationAdapterFactory sscaf = new DeveloperSubSystemConfigurationAdapterFactory();
|
||||
sscaf.registerWithManager(manager);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is called when the plug-in is stopped
|
||||
*/
|
||||
public void stop(BundleContext context) throws Exception {
|
||||
super.stop(context);
|
||||
plugin = null;
|
||||
resourceBundle = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the shared instance.
|
||||
*/
|
||||
public static RSESamplesPlugin getDefault() {
|
||||
return plugin;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the workspace instance.
|
||||
*/
|
||||
public static IWorkspace getWorkspace() {
|
||||
return ResourcesPlugin.getWorkspace();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the string from the plugin's resource bundle,
|
||||
* or 'key' if not found.
|
||||
*/
|
||||
public static String getResourceString(String key) {
|
||||
ResourceBundle bundle= RSESamplesPlugin.getDefault().getResourceBundle();
|
||||
try {
|
||||
return (bundle != null) ? bundle.getString(key) : key;
|
||||
} catch (MissingResourceException e) {
|
||||
return key;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the plugin's resource bundle,
|
||||
*/
|
||||
public ResourceBundle getResourceBundle() {
|
||||
try {
|
||||
if (resourceBundle == null)
|
||||
resourceBundle = ResourceBundle.getBundle("samples.rseSamplesResources"); //$NON-NLS-1$
|
||||
} catch (MissingResourceException x) {
|
||||
resourceBundle = null;
|
||||
}
|
||||
return resourceBundle;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see AbstractUIPlugin#initializeDefaultPreferences
|
||||
*/
|
||||
//protected void initializeDefaultPreferences(IPreferenceStore store)
|
||||
//{
|
||||
// super.initializeDefaultPreferences(store);
|
||||
// //RSESamplesPreferencePage.initDefaults(store);
|
||||
//}
|
||||
|
||||
/**
|
||||
* Initialize the image registry by declaring all of the required graphics.
|
||||
*/
|
||||
protected void initializeImageRegistry()
|
||||
{
|
||||
String path = getIconPath();
|
||||
putImageInRegistry("ICON_ID_TEAM", path+"/team.gif"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
putImageInRegistry("ICON_ID_DEVELOPER", path+"/developer.gif"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
putImageInRegistry("ICON_ID_TEAMFILTER", path+"/teamFilter.gif"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
putImageInRegistry("ICON_ID_DEVELOPERFILTER", path+"/developerFilter.gif"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
// TO RETRIEVE AN ICON, CALL GETIMAGE OR GETIMAGEDESCRIPTOR WITH ITS XXX_ID ID
|
||||
}
|
||||
|
||||
/**
|
||||
* Load a message file for this plugin.
|
||||
* @param messageFileName - the name of the message xml file. Will look for it in this plugin's install folder.
|
||||
* @return a message file object containing the parsed contents of the message file, or null if not found.
|
||||
*/
|
||||
public SystemMessageFile getMessageFile(String messageFileName)
|
||||
{
|
||||
return loadMessageFile(getBundle(), messageFileName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return our message file
|
||||
*/
|
||||
public static SystemMessageFile getPluginMessageFile()
|
||||
{
|
||||
return messageFile;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve a message from this plugin's message file
|
||||
*/
|
||||
public static SystemMessage getPluginMessage(String msgId)
|
||||
{
|
||||
return getMessage(messageFile, msgId);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
/********************************************************************************
|
||||
* Copyright (c) 2006 IBM Corporation. All rights reserved.
|
||||
* This program and the accompanying materials are made available under the terms
|
||||
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
||||
* available at http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Initial Contributors:
|
||||
* The following IBM employees contributed to the Remote System Explorer
|
||||
* component that contains this file: David McKnight, Kushal Munir,
|
||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||
*
|
||||
* Contributors:
|
||||
* Martin Oberhuber (Wind River) - Adapted original tutorial code to Open RSE.
|
||||
********************************************************************************/
|
||||
|
||||
package samples.model;
|
||||
|
||||
import org.eclipse.core.runtime.IAdapterFactory;
|
||||
import org.eclipse.rse.ui.view.AbstractSystemRemoteAdapterFactory;
|
||||
import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
|
||||
import org.eclipse.ui.views.properties.IPropertySource;
|
||||
|
||||
/**
|
||||
* This factory maps requests for an adapter object from a given remote object.
|
||||
*/
|
||||
public class DeveloperAdapterFactory extends AbstractSystemRemoteAdapterFactory
|
||||
implements IAdapterFactory
|
||||
{
|
||||
private TeamResourceAdapter teamAdapter = new TeamResourceAdapter();
|
||||
private DeveloperResourceAdapter developerAdapter = new DeveloperResourceAdapter();
|
||||
|
||||
/**
|
||||
* Constructor for DeveloperAdapterFactory.
|
||||
*/
|
||||
public DeveloperAdapterFactory() {
|
||||
super();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.ui.view.AbstractSystemRemoteAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
|
||||
*/
|
||||
public Object getAdapter(Object adaptableObject, Class adapterType) {
|
||||
ISystemViewElementAdapter adapter = null;
|
||||
if (adaptableObject instanceof TeamResource)
|
||||
adapter = teamAdapter;
|
||||
else if (adaptableObject instanceof DeveloperResource)
|
||||
adapter = developerAdapter;
|
||||
// these lines are very important!
|
||||
if ((adapter != null) && (adapterType == IPropertySource.class))
|
||||
adapter.setPropertySourceInput(adaptableObject);
|
||||
return adapter;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,100 @@
|
|||
/********************************************************************************
|
||||
* Copyright (c) 2006 IBM Corporation. All rights reserved.
|
||||
* This program and the accompanying materials are made available under the terms
|
||||
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
||||
* available at http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Initial Contributors:
|
||||
* The following IBM employees contributed to the Remote System Explorer
|
||||
* component that contains this file: David McKnight, Kushal Munir,
|
||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||
*
|
||||
* Contributors:
|
||||
* Martin Oberhuber (Wind River) - Adapted original tutorial code to Open RSE.
|
||||
********************************************************************************/
|
||||
|
||||
package samples.model;
|
||||
|
||||
import org.eclipse.rse.core.internal.subsystems.AbstractResource;
|
||||
import org.eclipse.rse.core.subsystems.ISubSystem;
|
||||
|
||||
/**
|
||||
* This models a remote resource representing a developer defined on a particular system.
|
||||
*/
|
||||
public class DeveloperResource extends AbstractResource {
|
||||
|
||||
private String name;
|
||||
private String id;
|
||||
private String deptNbr;
|
||||
|
||||
/**
|
||||
* Default constructor for DeveloperResource.
|
||||
*/
|
||||
public DeveloperResource()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for DeveloperResource when given parent subsystem.
|
||||
*/
|
||||
public DeveloperResource(ISubSystem parentSubSystem)
|
||||
{
|
||||
super(parentSubSystem);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the name.
|
||||
* @return String
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the name.
|
||||
* @param name The name to set
|
||||
*/
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the id.
|
||||
* @return String
|
||||
*/
|
||||
public String getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the id.
|
||||
* @param id The id to set
|
||||
*/
|
||||
public void setId(String id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
/**
|
||||
* Returns the deptNbr.
|
||||
* @return String
|
||||
*/
|
||||
public String getDeptNbr()
|
||||
{
|
||||
return deptNbr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the deptNbr.
|
||||
* @param deptNbr The deptNbr to set
|
||||
*/
|
||||
public void setDeptNbr(String deptNbr)
|
||||
{
|
||||
this.deptNbr = deptNbr;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,221 @@
|
|||
/********************************************************************************
|
||||
* Copyright (c) 2006 IBM Corporation. All rights reserved.
|
||||
* This program and the accompanying materials are made available under the terms
|
||||
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
||||
* available at http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Initial Contributors:
|
||||
* The following IBM employees contributed to the Remote System Explorer
|
||||
* component that contains this file: David McKnight, Kushal Munir,
|
||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||
*
|
||||
* Contributors:
|
||||
* Martin Oberhuber (Wind River) - Adapted original tutorial code to Open RSE.
|
||||
********************************************************************************/
|
||||
|
||||
package samples.model;
|
||||
|
||||
import org.eclipse.jface.resource.ImageDescriptor;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.rse.ui.SystemMenuManager;
|
||||
import org.eclipse.rse.ui.view.AbstractSystemViewAdapter;
|
||||
import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.ui.views.properties.IPropertyDescriptor;
|
||||
import org.eclipse.ui.views.properties.PropertyDescriptor;
|
||||
|
||||
import samples.RSESamplesPlugin;
|
||||
|
||||
/**
|
||||
* This is the adapter which enables us to work with our remote developer resources.
|
||||
*/
|
||||
public class DeveloperResourceAdapter extends AbstractSystemViewAdapter
|
||||
implements ISystemRemoteElementAdapter
|
||||
{
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public DeveloperResourceAdapter() {
|
||||
super();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#addActions(org.eclipse.rse.ui.SystemMenuManager, org.eclipse.jface.viewers.IStructuredSelection, org.eclipse.swt.widgets.Shell, java.lang.String)
|
||||
*/
|
||||
public void addActions(SystemMenuManager menu,
|
||||
IStructuredSelection selection, Shell parent, String menuGroup)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.ui.model.IWorkbenchAdapter#getImageDescriptor(Object)
|
||||
*/
|
||||
public ImageDescriptor getImageDescriptor(Object object)
|
||||
{
|
||||
return RSESamplesPlugin.getDefault().getImageDescriptor("ICON_ID_DEVELOPER"); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#getText(java.lang.Object)
|
||||
*/
|
||||
public String getText(Object element)
|
||||
{
|
||||
return ((DeveloperResource)element).getName();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#getAbsoluteName(java.lang.Object)
|
||||
*/
|
||||
public String getAbsoluteName(Object object)
|
||||
{
|
||||
DeveloperResource devr = (DeveloperResource)object;
|
||||
return "Devr_" + devr.getId(); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#getType(java.lang.Object)
|
||||
*/
|
||||
public String getType(Object element)
|
||||
{
|
||||
return RSESamplesPlugin.getResourceString("property.devr_resource.type"); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.ui.model.IWorkbenchAdapter#getParent(Object)
|
||||
*/
|
||||
public Object getParent(Object o)
|
||||
{
|
||||
return null; // not really used, which is good because it is ambiguous
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#hasChildren(java.lang.Object)
|
||||
*/
|
||||
public boolean hasChildren(Object element)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.ui.model.IWorkbenchAdapter#getChildren(Object)
|
||||
*/
|
||||
public Object[] getChildren(Object o)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#internalGetPropertyDescriptors()
|
||||
*/
|
||||
protected IPropertyDescriptor[] internalGetPropertyDescriptors()
|
||||
{
|
||||
// the following array should be made static to it isn't created every time
|
||||
PropertyDescriptor[] ourPDs = new PropertyDescriptor[2];
|
||||
ourPDs[0] = new PropertyDescriptor("devr_id", //$NON-NLS-1$
|
||||
RSESamplesPlugin.getResourceString("property.devr_id.name")); //$NON-NLS-1$
|
||||
ourPDs[0].setDescription(
|
||||
RSESamplesPlugin.getResourceString("property.devr_id.desc")); //$NON-NLS-1$
|
||||
ourPDs[1] = new PropertyDescriptor("devr_dept", //$NON-NLS-1$
|
||||
RSESamplesPlugin.getResourceString("property.devr_dept.name")); //$NON-NLS-1$
|
||||
ourPDs[1].setDescription(
|
||||
RSESamplesPlugin.getResourceString("property.devr_dept.desc")); //$NON-NLS-1$
|
||||
return ourPDs;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#internalGetPropertyValue(java.lang.Object)
|
||||
*/
|
||||
protected Object internalGetPropertyValue(Object key)
|
||||
{
|
||||
// propertySourceInput holds the currently selected object
|
||||
DeveloperResource devr = (DeveloperResource)propertySourceInput;
|
||||
if (key.equals("devr_id")) //$NON-NLS-1$
|
||||
return devr.getId();
|
||||
else if (key.equals("devr_dept")) //$NON-NLS-1$
|
||||
return devr.getDeptNbr();
|
||||
return null;
|
||||
}
|
||||
// --------------------------------------
|
||||
// ISystemRemoteElementAdapter methods...
|
||||
// --------------------------------------
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getAbsoluteParentName(java.lang.Object)
|
||||
*/
|
||||
public String getAbsoluteParentName(Object element)
|
||||
{
|
||||
return "root"; // not really applicable as we have no unique hierarchy //$NON-NLS-1$
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getSubSystemFactoryId(java.lang.Object)
|
||||
*/
|
||||
public String getSubSystemFactoryId(Object element)
|
||||
{
|
||||
return "samples.subsystems.factory"; // as declared in extension in plugin.xml //$NON-NLS-1$
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getRemoteTypeCategory(java.lang.Object)
|
||||
*/
|
||||
public String getRemoteTypeCategory(Object element)
|
||||
{
|
||||
return "developers"; // Course grained. Same for all our remote resources. //$NON-NLS-1$
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getRemoteType(java.lang.Object)
|
||||
*/
|
||||
public String getRemoteType(Object element)
|
||||
{
|
||||
return "developer"; // Fine grained. Unique to this resource type. //$NON-NLS-1$
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getRemoteSubType(java.lang.Object)
|
||||
*/
|
||||
public String getRemoteSubType(Object element)
|
||||
{
|
||||
return null; // Very fine grained. We don't use it.
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#refreshRemoteObject(java.lang.Object, java.lang.Object)
|
||||
*/
|
||||
public boolean refreshRemoteObject(Object oldElement, Object newElement)
|
||||
{
|
||||
DeveloperResource oldDevr= (DeveloperResource)oldElement;
|
||||
DeveloperResource newDevr = (DeveloperResource)newElement;
|
||||
newDevr.setName(oldDevr.getName());
|
||||
return false;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getRemoteParent(org.eclipse.swt.widgets.Shell, java.lang.Object)
|
||||
*/
|
||||
public Object getRemoteParent(Shell shell, Object element) throws Exception
|
||||
{
|
||||
return null; // maybe this would be a Department obj, if we fully fleshed out our model
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getRemoteParentNamesInUse(org.eclipse.swt.widgets.Shell, java.lang.Object)
|
||||
*/
|
||||
public String[] getRemoteParentNamesInUse(Shell shell, Object element)
|
||||
throws Exception
|
||||
{
|
||||
// developers names do not have to be unique! So we don't need to implement this!
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#supportsUserDefinedActions(java.lang.Object)
|
||||
*/
|
||||
public boolean supportsUserDefinedActions(Object object) {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,82 @@
|
|||
/********************************************************************************
|
||||
* Copyright (c) 2006 IBM Corporation. All rights reserved.
|
||||
* This program and the accompanying materials are made available under the terms
|
||||
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
||||
* available at http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Initial Contributors:
|
||||
* The following IBM employees contributed to the Remote System Explorer
|
||||
* component that contains this file: David McKnight, Kushal Munir,
|
||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||
*
|
||||
* Contributors:
|
||||
* Martin Oberhuber (Wind River) - Adapted original tutorial code to Open RSE.
|
||||
********************************************************************************/
|
||||
|
||||
package samples.model;
|
||||
|
||||
import org.eclipse.rse.core.internal.subsystems.AbstractResource;
|
||||
import org.eclipse.rse.core.subsystems.ISubSystem;
|
||||
|
||||
/**
|
||||
* This models a remote resource representing a team defined on a particular system.
|
||||
*/
|
||||
public class TeamResource extends AbstractResource {
|
||||
|
||||
private String name;
|
||||
private DeveloperResource[] developers;
|
||||
|
||||
/**
|
||||
* Default constructor
|
||||
*/
|
||||
public TeamResource()
|
||||
{
|
||||
super();
|
||||
}
|
||||
/**
|
||||
* Constructor for TeamResource when given a parent subsystem.
|
||||
*/
|
||||
public TeamResource(ISubSystem parentSubSystem)
|
||||
{
|
||||
super(parentSubSystem);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the name.
|
||||
* @return String
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the name.
|
||||
* @param name The name to set
|
||||
*/
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the developers.
|
||||
* @return DeveloperResource[]
|
||||
*/
|
||||
public DeveloperResource[] getDevelopers()
|
||||
{
|
||||
return developers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the developers.
|
||||
* @param developers The developers to set
|
||||
*/
|
||||
public void setDevelopers(DeveloperResource[] developers)
|
||||
{
|
||||
this.developers = developers;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,225 @@
|
|||
/********************************************************************************
|
||||
* Copyright (c) 2006 IBM Corporation. All rights reserved.
|
||||
* This program and the accompanying materials are made available under the terms
|
||||
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
||||
* available at http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Initial Contributors:
|
||||
* The following IBM employees contributed to the Remote System Explorer
|
||||
* component that contains this file: David McKnight, Kushal Munir,
|
||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||
*
|
||||
* Contributors:
|
||||
* Martin Oberhuber (Wind River) - Adapted original tutorial code to Open RSE.
|
||||
********************************************************************************/
|
||||
|
||||
package samples.model;
|
||||
|
||||
import org.eclipse.jface.resource.ImageDescriptor;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.rse.ui.SystemMenuManager;
|
||||
import org.eclipse.rse.ui.view.AbstractSystemViewAdapter;
|
||||
import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.ui.views.properties.IPropertyDescriptor;
|
||||
|
||||
import samples.RSESamplesPlugin;
|
||||
import samples.subsystems.DeveloperSubSystem;
|
||||
|
||||
/**
|
||||
* This is the adapter which enables us to work with our remote team resources.
|
||||
*/
|
||||
public class TeamResourceAdapter extends AbstractSystemViewAdapter implements
|
||||
ISystemRemoteElementAdapter {
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
public TeamResourceAdapter() {
|
||||
super();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#addActions(org.eclipse.rse.ui.SystemMenuManager, org.eclipse.jface.viewers.IStructuredSelection, org.eclipse.swt.widgets.Shell, java.lang.String)
|
||||
*/
|
||||
public void addActions(SystemMenuManager menu,
|
||||
IStructuredSelection selection, Shell parent, String menuGroup)
|
||||
{
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#getImageDescriptor(java.lang.Object)
|
||||
*/
|
||||
public ImageDescriptor getImageDescriptor(Object element)
|
||||
{
|
||||
return RSESamplesPlugin.getDefault().getImageDescriptor("ICON_ID_TEAM"); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#getText(java.lang.Object)
|
||||
*/
|
||||
public String getText(Object element)
|
||||
{
|
||||
return ((TeamResource)element).getName();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#getAbsoluteName(java.lang.Object)
|
||||
*/
|
||||
public String getAbsoluteName(Object object)
|
||||
{
|
||||
TeamResource team = (TeamResource)object;
|
||||
return "Team_"+team.getName(); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#getType(java.lang.Object)
|
||||
*/
|
||||
public String getType(Object element)
|
||||
{
|
||||
return RSESamplesPlugin.getResourceString("property.team_resource.type"); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#getParent(java.lang.Object)
|
||||
*/
|
||||
public Object getParent(Object element)
|
||||
{
|
||||
return null; // not really used, which is good because it is ambiguous
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#hasChildren(java.lang.Object)
|
||||
*/
|
||||
public boolean hasChildren(Object element)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#getChildren(java.lang.Object)
|
||||
*/
|
||||
public Object[] getChildren(Object element)
|
||||
{
|
||||
return ((TeamResource)element).getDevelopers();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.ibm.etools.systems.core.ui.view.AbstractSystemViewAdapter#internalGetPropertyDescriptors()
|
||||
*/
|
||||
protected IPropertyDescriptor[] internalGetPropertyDescriptors()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#internalGetPropertyValue(java.lang.Object)
|
||||
*/
|
||||
protected Object internalGetPropertyValue(Object key)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* Intercept of parent method to indicate these objects can be renamed using the RSE-supplied
|
||||
* rename action.
|
||||
*/
|
||||
public boolean canRename(Object element)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Intercept of parent method to actually do the rename. RSE supplies the rename GUI, but
|
||||
* defers the action work of renaming to this adapter method.
|
||||
*/
|
||||
public boolean doRename(Shell shell, Object element, String newName)
|
||||
{
|
||||
((TeamResource)element).setName(newName);
|
||||
return true;
|
||||
}
|
||||
// --------------------------------------
|
||||
// ISystemRemoteElementAdapter methods...
|
||||
// --------------------------------------
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getAbsoluteParentName(java.lang.Object)
|
||||
*/
|
||||
public String getAbsoluteParentName(Object element)
|
||||
{
|
||||
return "root"; // not really applicable as we have no unique hierarchy //$NON-NLS-1$
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getSubSystemFactoryId(java.lang.Object)
|
||||
*/
|
||||
public String getSubSystemFactoryId(Object element)
|
||||
{
|
||||
return "samples.subsystems.factory"; // as declared in extension in plugin.xml //$NON-NLS-1$
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getRemoteTypeCategory(java.lang.Object)
|
||||
*/
|
||||
public String getRemoteTypeCategory(Object element)
|
||||
{
|
||||
return "developers"; // Course grained. Same for all our remote resources. //$NON-NLS-1$
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getRemoteType(java.lang.Object)
|
||||
*/
|
||||
public String getRemoteType(Object element)
|
||||
{
|
||||
return "team"; // Fine grained. Unique to this resource type. //$NON-NLS-1$
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getRemoteSubType(java.lang.Object)
|
||||
*/
|
||||
public String getRemoteSubType(Object element)
|
||||
{
|
||||
return null; // Very fine grained. We don't use it.
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#refreshRemoteObject(java.lang.Object, java.lang.Object)
|
||||
*/
|
||||
public boolean refreshRemoteObject(Object oldElement, Object newElement)
|
||||
{
|
||||
TeamResource oldTeam = (TeamResource)oldElement;
|
||||
TeamResource newTeam = (TeamResource)newElement;
|
||||
newTeam.setName(oldTeam.getName());
|
||||
return false; // If developer objects held references to their team names, we'd have to return true
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getRemoteParent(org.eclipse.swt.widgets.Shell, java.lang.Object)
|
||||
*/
|
||||
public Object getRemoteParent(Shell shell, Object element) throws Exception
|
||||
{
|
||||
return null; // maybe this would be a Project or Roster object, or leave as null if this is the root
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getRemoteParentNamesInUse(org.eclipse.swt.widgets.Shell, java.lang.Object)
|
||||
*/
|
||||
public String[] getRemoteParentNamesInUse(Shell shell, Object element)
|
||||
throws Exception
|
||||
{
|
||||
DeveloperSubSystem ourSS = (DeveloperSubSystem)getSubSystem(element);
|
||||
TeamResource[] allTeams = ourSS.getAllTeams();
|
||||
String[] allNames = new String[allTeams.length];
|
||||
for (int idx=0; idx<allTeams.length; idx++)
|
||||
allNames[idx] = allTeams[idx].getName();
|
||||
return allNames; // Return list of all team names
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#supportsUserDefinedActions(java.lang.Object)
|
||||
*/
|
||||
public boolean supportsUserDefinedActions(Object object) {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
################################################################################
|
||||
# Copyright (c) 2006 IBM Corporation. All rights reserved.
|
||||
# This program and the accompanying materials are made available under the terms
|
||||
# of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
||||
# available at http://www.eclipse.org/legal/epl-v10.html
|
||||
#
|
||||
# Initial Contributors:
|
||||
# The following IBM employees contributed to the Remote System Explorer
|
||||
# component that contains this file: David McKnight, Kushal Munir,
|
||||
# Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||
# Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||
#
|
||||
# Contributors:
|
||||
# Martin Oberhuber (Wind River) - Adapted original tutorial code to Open RSE.
|
||||
################################################################################
|
||||
|
||||
pp.size.label=Size
|
||||
pp.size.tooltip=Cumulative size, in bytes
|
||||
pp.files.label=Files
|
||||
pp.files.tooltip=Cumulative number of files
|
||||
pp.folders.label=Folders
|
||||
pp.folders.tooltip=Cumulative number of folders
|
||||
pp.stopButton.label=Stop
|
||||
pp.stopButton.tooltip=Cancel the thread
|
||||
|
||||
connectorservice.devr.name=DeveloperConnectorService
|
||||
connectorservice.devr.desc=Manages connections to faked remote developer resources.
|
||||
|
||||
property.devr_resource.type=Developer resource
|
||||
property.devr_id.name=Id
|
||||
property.devr_id.desc=ID number
|
||||
property.devr_dept.name=Department
|
||||
property.devr_dept.desc=Department number
|
||||
|
||||
property.team_resource.type=Team resource
|
||||
|
||||
filter.default.name=All Teams
|
||||
|
||||
property.type.teamfilter=Team filter
|
||||
property.type.devrfilter=Developer filter
|
||||
|
||||
filter.team.dlgtitle=Change Team Filter
|
||||
filter.team.pagetitle=Team Filter
|
||||
filter.team.pagetext=Create a new filter to list teams
|
||||
|
||||
filter.devr.dlgtitle=Change Developer Filter
|
||||
filter.devr.pagetitle=Developer Filter
|
||||
filter.devr.pagetext=Create a new filter to list developers
|
||||
filter.devr.teamprompt.label=Parent team
|
||||
filter.devr.teamprompt.tooltip=Specify the team within which to list developers
|
||||
filter.devr.devrprompt.label=Developers
|
||||
filter.devr.devrprompt.tooltip=Specify a simple or generic developer name pattern
|
|
@ -0,0 +1,99 @@
|
|||
/********************************************************************************
|
||||
* Copyright (c) 2006 IBM Corporation. All rights reserved.
|
||||
* This program and the accompanying materials are made available under the terms
|
||||
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
||||
* available at http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Initial Contributors:
|
||||
* The following IBM employees contributed to the Remote System Explorer
|
||||
* component that contains this file: David McKnight, Kushal Munir,
|
||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||
*
|
||||
* Contributors:
|
||||
* Martin Oberhuber (Wind River) - Adapted original tutorial code to Open RSE.
|
||||
********************************************************************************/
|
||||
|
||||
package samples.subsystems;
|
||||
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.rse.core.subsystems.AbstractConnectorService;
|
||||
import org.eclipse.rse.model.IHost;
|
||||
|
||||
import samples.RSESamplesPlugin;
|
||||
|
||||
/**
|
||||
* Our system class that manages connecting to, and disconnecting from,
|
||||
* our remote server-side code.
|
||||
*/
|
||||
public class DeveloperConnectorService extends AbstractConnectorService {
|
||||
|
||||
private boolean connected = false;
|
||||
|
||||
/**
|
||||
* Constructor for DeveloperConnectorService.
|
||||
* @param host
|
||||
*/
|
||||
public DeveloperConnectorService(IHost host)
|
||||
{
|
||||
super(
|
||||
RSESamplesPlugin.getResourceString("connectorservice.devr.name"), //$NON-NLS-1$
|
||||
RSESamplesPlugin.getResourceString("connectorservice.devr.desc"), //$NON-NLS-1$
|
||||
host,
|
||||
0
|
||||
);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.core.subsystems.IConnectorService#isConnected()
|
||||
*/
|
||||
public boolean isConnected()
|
||||
{
|
||||
return connected;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.core.subsystems.AbstractConnectorService#internalConnect(org.eclipse.core.runtime.IProgressMonitor)
|
||||
*/
|
||||
protected void internalConnect(IProgressMonitor monitor) throws Exception
|
||||
{
|
||||
super.internalConnect(monitor);
|
||||
// pretend. Normally, we'd connect to our remote server-side code here
|
||||
connected=true;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.core.subsystems.AbstractConnectorService#internalDisconnect(org.eclipse.core.runtime.IProgressMonitor)
|
||||
*/
|
||||
public void internalDisconnect(IProgressMonitor monitor) throws Exception
|
||||
{
|
||||
super.internalDisconnect(monitor);
|
||||
// pretend. Normally, we'd disconnect from our remote server-side code here
|
||||
connected=false;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.core.subsystems.IConnectorService#supportsRemoteServerLaunching()
|
||||
*/
|
||||
public boolean supportsRemoteServerLaunching()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.core.subsystems.IConnectorService#hasRemoteServerLauncherProperties()
|
||||
*/
|
||||
public boolean hasRemoteServerLauncherProperties()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.core.subsystems.IConnectorService#supportsServerLaunchProperties()
|
||||
*/
|
||||
public boolean supportsServerLaunchProperties()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,77 @@
|
|||
/********************************************************************************
|
||||
* Copyright (c) 2006 IBM Corporation. All rights reserved.
|
||||
* This program and the accompanying materials are made available under the terms
|
||||
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
||||
* available at http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Initial Contributors:
|
||||
* The following IBM employees contributed to the Remote System Explorer
|
||||
* component that contains this file: David McKnight, Kushal Munir,
|
||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||
*
|
||||
* Contributors:
|
||||
* Martin Oberhuber (Wind River) - Adapted original tutorial code to Open RSE.
|
||||
********************************************************************************/
|
||||
|
||||
package samples.subsystems;
|
||||
|
||||
import org.eclipse.rse.core.subsystems.AbstractConnectorServiceManager;
|
||||
import org.eclipse.rse.core.subsystems.IConnectorService;
|
||||
import org.eclipse.rse.core.subsystems.ISubSystem;
|
||||
import org.eclipse.rse.model.IHost;
|
||||
|
||||
/**
|
||||
* This class manages our DeveloperConnectorService objects, so that if we
|
||||
* ever have multiple subsystem factories, different subsystems can share
|
||||
* the same system object if they share the communication layer.
|
||||
*/
|
||||
public class DeveloperConnectorServiceManager extends
|
||||
AbstractConnectorServiceManager {
|
||||
|
||||
private static DeveloperConnectorServiceManager inst;
|
||||
|
||||
/**
|
||||
* Constructor for DeveloperConnectorServiceManager.
|
||||
*/
|
||||
public DeveloperConnectorServiceManager()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return singleton instance
|
||||
*/
|
||||
public static DeveloperConnectorServiceManager getTheDeveloperConnectorServiceManager()
|
||||
{
|
||||
if (inst == null)
|
||||
inst = new DeveloperConnectorServiceManager();
|
||||
return inst;
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.core.subsystems.AbstractConnectorServiceManager#createConnectorService(org.eclipse.rse.model.IHost)
|
||||
*/
|
||||
public IConnectorService createConnectorService(IHost host)
|
||||
{
|
||||
return new DeveloperConnectorService(host);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.core.subsystems.AbstractConnectorServiceManager#sharesSystem(org.eclipse.rse.core.subsystems.ISubSystem)
|
||||
*/
|
||||
public boolean sharesSystem(ISubSystem otherSubSystem)
|
||||
{
|
||||
return (otherSubSystem instanceof IDeveloperSubSystem);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.core.subsystems.AbstractConnectorServiceManager#getSubSystemCommonInterface(org.eclipse.rse.core.subsystems.ISubSystem)
|
||||
*/
|
||||
public Class getSubSystemCommonInterface(ISubSystem subsystem)
|
||||
{
|
||||
return IDeveloperSubSystem.class;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,206 @@
|
|||
/********************************************************************************
|
||||
* Copyright (c) 2006 IBM Corporation. All rights reserved.
|
||||
* This program and the accompanying materials are made available under the terms
|
||||
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
||||
* available at http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Initial Contributors:
|
||||
* The following IBM employees contributed to the Remote System Explorer
|
||||
* component that contains this file: David McKnight, Kushal Munir,
|
||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||
*
|
||||
* Contributors:
|
||||
* Martin Oberhuber (Wind River) - Adapted original tutorial code to Open RSE.
|
||||
********************************************************************************/
|
||||
|
||||
package samples.subsystems;
|
||||
|
||||
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
|
||||
import org.eclipse.rse.ui.SystemWidgetHelpers;
|
||||
import org.eclipse.rse.ui.filters.SystemFilterStringEditPane;
|
||||
import org.eclipse.swt.events.ModifyEvent;
|
||||
import org.eclipse.swt.events.ModifyListener;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Control;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.swt.widgets.Text;
|
||||
|
||||
import samples.RSESamplesPlugin;
|
||||
|
||||
/**
|
||||
* Our specialized filter string edit pane for developer filters.
|
||||
*/
|
||||
public class DeveloperFilterStringEditPane extends SystemFilterStringEditPane {
|
||||
|
||||
// gui widgets
|
||||
private Text textTeam, textDevr;
|
||||
|
||||
/**
|
||||
* Constructor for DeveloperFilterStringEditPane.
|
||||
* @param shell - parent window
|
||||
*/
|
||||
public DeveloperFilterStringEditPane(Shell shell)
|
||||
{
|
||||
super(shell);
|
||||
}
|
||||
|
||||
/**
|
||||
* Override of parent method.
|
||||
* This is where we populate the client area.
|
||||
* @param parent - the composite that will be the parent of the returned client area composite
|
||||
* @return Control - a client-area composite populated with widgets.
|
||||
*
|
||||
* @see org.eclipse.rse.ui.SystemWidgetHelpers
|
||||
*/
|
||||
public Control createContents(Composite parent)
|
||||
{
|
||||
// Inner composite
|
||||
int nbrColumns = 1;
|
||||
Composite composite_prompts = SystemWidgetHelpers.createComposite(parent, nbrColumns);
|
||||
((GridLayout)composite_prompts.getLayout()).marginWidth = 0;
|
||||
|
||||
// CREATE TEAM-PARENT PROMPT
|
||||
textTeam = SystemWidgetHelpers.createLabeledTextField(
|
||||
composite_prompts,
|
||||
null,
|
||||
RSESamplesPlugin.getResourceString("filter.devr.teamprompt.label"), //$NON-NLS-1$
|
||||
RSESamplesPlugin.getResourceString("filter.devr.teamprompt.tooltip") //$NON-NLS-1$
|
||||
);
|
||||
|
||||
// CREATE DEVELOPER PROMPT
|
||||
textDevr = SystemWidgetHelpers.createLabeledTextField(
|
||||
composite_prompts,
|
||||
null,
|
||||
RSESamplesPlugin.getResourceString("filter.devr.devrprompt.label"), //$NON-NLS-1$
|
||||
RSESamplesPlugin.getResourceString("filter.devr.devrprompt.tooltip") //$NON-NLS-1$
|
||||
);
|
||||
|
||||
resetFields();
|
||||
doInitializeFields();
|
||||
|
||||
// add keystroke listeners...
|
||||
textTeam.addModifyListener(
|
||||
new ModifyListener()
|
||||
{
|
||||
public void modifyText(ModifyEvent e)
|
||||
{
|
||||
validateStringInput();
|
||||
}
|
||||
}
|
||||
);
|
||||
textDevr.addModifyListener(
|
||||
new ModifyListener()
|
||||
{
|
||||
public void modifyText(ModifyEvent e)
|
||||
{
|
||||
validateStringInput();
|
||||
}
|
||||
}
|
||||
);
|
||||
return composite_prompts;
|
||||
}
|
||||
/**
|
||||
* Override of parent method.
|
||||
* Return the control to recieve initial focus.
|
||||
*/
|
||||
public Control getInitialFocusControl()
|
||||
{
|
||||
return textTeam;
|
||||
}
|
||||
|
||||
/**
|
||||
* Override of parent method.
|
||||
* Initialize the input fields based on the inputFilterString, and perhaps refProvider.
|
||||
* This can be called before createContents, so test for null widgets first!
|
||||
* Prior to this being called, resetFields is called to set the initial default state prior to input
|
||||
*/
|
||||
protected void doInitializeFields()
|
||||
{
|
||||
if (textTeam == null)
|
||||
return; // do nothing
|
||||
if (inputFilterString != null)
|
||||
{
|
||||
int idx = inputFilterString.indexOf('/');
|
||||
if (idx < 0)
|
||||
textTeam.setText(inputFilterString);
|
||||
else
|
||||
{
|
||||
textTeam.setText(inputFilterString.substring(0,idx));
|
||||
textDevr.setText(inputFilterString.substring(idx+1));
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Override of parent method.
|
||||
* This is called in the change filter dialog when the user selects "new", or selects another string.
|
||||
*/
|
||||
protected void resetFields()
|
||||
{
|
||||
textTeam.setText(""); //$NON-NLS-1$
|
||||
textDevr.setText("*"); //$NON-NLS-1$
|
||||
}
|
||||
/**
|
||||
* Override of parent method.
|
||||
* Called by parent to decide if information is complete enough to enable finish.
|
||||
*/
|
||||
protected boolean areFieldsComplete()
|
||||
{
|
||||
if ((textTeam == null) || (textDevr == null))
|
||||
return false;
|
||||
else
|
||||
return (textTeam.getText().trim().length()>0) && (textDevr.getText().trim().length()>0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Override of parent method.
|
||||
* Get the filter string in its current form.
|
||||
* Functional opposite of doInitializeFields, which tears apart the input string in update mode,
|
||||
* to populate the GUIs. This method creates the filter string from the information in the GUI.
|
||||
*/
|
||||
public String getFilterString()
|
||||
{
|
||||
if ((textTeam == null) || (textDevr == null))
|
||||
return inputFilterString; // return what we were given.
|
||||
else
|
||||
{
|
||||
String teamName = textTeam.getText().trim();
|
||||
String devrName = textDevr.getText().trim();
|
||||
return teamName + "/" + devrName; //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Override of parent method.
|
||||
* Does complete verification of input fields. If this
|
||||
* method returns null, there are no errors and the dialog or wizard can close.
|
||||
*
|
||||
* @return error message if there is one, else null if ok
|
||||
*/
|
||||
public SystemMessage verify()
|
||||
{
|
||||
errorMessage = null;
|
||||
Control controlInError = null;
|
||||
|
||||
/*
|
||||
errorMessage = validateTeamInput(); // todo: implement if we want to syntax check input
|
||||
if (errorMessage != null)
|
||||
controlInError = textTeam;
|
||||
else
|
||||
{
|
||||
errorMessage = validateDevrInput(); // todo: implement to syntax check input
|
||||
if (errorMessage != null)
|
||||
controlInError = textDevr;
|
||||
}
|
||||
*/
|
||||
|
||||
if (errorMessage != null)
|
||||
{
|
||||
if (controlInError != null)
|
||||
controlInError.setFocus();
|
||||
}
|
||||
return errorMessage;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,229 @@
|
|||
/********************************************************************************
|
||||
* Copyright (c) 2006 IBM Corporation. All rights reserved.
|
||||
* This program and the accompanying materials are made available under the terms
|
||||
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
||||
* available at http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Initial Contributors:
|
||||
* The following IBM employees contributed to the Remote System Explorer
|
||||
* component that contains this file: David McKnight, Kushal Munir,
|
||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||
*
|
||||
* Contributors:
|
||||
* Martin Oberhuber (Wind River) - Adapted original tutorial code to Open RSE.
|
||||
********************************************************************************/
|
||||
|
||||
package samples.subsystems;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.rse.core.subsystems.IConnectorService;
|
||||
import org.eclipse.rse.core.subsystems.SubSystem;
|
||||
import org.eclipse.rse.model.IHost;
|
||||
import org.eclipse.rse.services.clientserver.NamePatternMatcher;
|
||||
|
||||
import samples.model.DeveloperResource;
|
||||
import samples.model.TeamResource;
|
||||
|
||||
/**
|
||||
* This is our subsystem, which manages the remote connection and resources for
|
||||
* a particular system connection object.
|
||||
*/
|
||||
public class DeveloperSubSystem extends SubSystem
|
||||
{
|
||||
private TeamResource[] teams; // faked-out master list of teams
|
||||
private Vector devVector = new Vector(); // faked-out master list of developers
|
||||
private static int employeeId = 123456; // employee Id factory
|
||||
|
||||
/**
|
||||
* @param host
|
||||
* @param connectorService
|
||||
*/
|
||||
public DeveloperSubSystem(IHost host, IConnectorService connectorService) {
|
||||
super(host, connectorService);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.core.subsystems.SubSystem#initializeSubSystem(org.eclipse.core.runtime.IProgressMonitor)
|
||||
*/
|
||||
public void initializeSubSystem(IProgressMonitor monitor) {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.core.subsystems.ISubSystem#uninitializeSubSystem(org.eclipse.core.runtime.IProgressMonitor)
|
||||
*/
|
||||
public void uninitializeSubSystem(IProgressMonitor monitor) {
|
||||
}
|
||||
|
||||
/**
|
||||
* For drag and drop, and clipboard support of remote objects.
|
||||
*
|
||||
* Return the remote object within the subsystem that corresponds to
|
||||
* the specified unique ID. Because each subsystem maintains it's own
|
||||
* objects, it's the responsability of the subsystem to determine
|
||||
* how an ID (or key) for a given object maps to the real object.
|
||||
* By default this returns null.
|
||||
*/
|
||||
public Object getObjectWithAbsoluteName(String key)
|
||||
{
|
||||
// Functional opposite of getAbsoluteName(Object) in our resource adapters
|
||||
if (key.startsWith("Team_")) //$NON-NLS-1$
|
||||
{
|
||||
String teamName = key.substring(5);
|
||||
TeamResource[] allTeams = getAllTeams();
|
||||
for (int idx=0; idx<allTeams.length; idx++)
|
||||
if (allTeams[idx].getName().equals(teamName))
|
||||
return allTeams[idx];
|
||||
}
|
||||
else if (key.startsWith("Devr_")) //$NON-NLS-1$
|
||||
{
|
||||
String devrId = key.substring(5);
|
||||
DeveloperResource[] devrs = getAllDevelopers();
|
||||
for (int idx=0; idx<devrs.length; idx++)
|
||||
if (devrs[idx].getId().equals(devrId))
|
||||
return devrs[idx];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* When a filter is expanded, this is called for each filter string in the filter.
|
||||
* Using the criteria of the filter string, it must return objects representing remote resources.
|
||||
* For us, this will be an array of TeamResource objects.
|
||||
*
|
||||
* @param monitor - the progress monitor in effect while this operation performs
|
||||
* @param filterString - one of the filter strings from the expanded filter.
|
||||
*/
|
||||
protected Object[] internalResolveFilterString(IProgressMonitor monitor, String filterString)
|
||||
throws java.lang.reflect.InvocationTargetException,
|
||||
java.lang.InterruptedException
|
||||
{
|
||||
int slashIdx = filterString.indexOf('/');
|
||||
if (slashIdx < 0)
|
||||
{
|
||||
// Fake it out for now and return dummy list.
|
||||
// In reality, this would communicate with remote server-side code/data.
|
||||
TeamResource[] allTeams = getAllTeams();
|
||||
|
||||
// Now, subset master list, based on filter string...
|
||||
NamePatternMatcher subsetter = new NamePatternMatcher(filterString);
|
||||
Vector v = new Vector();
|
||||
for (int idx=0; idx<allTeams.length; idx++)
|
||||
{
|
||||
if (subsetter.matches(allTeams[idx].getName()))
|
||||
v.addElement(allTeams[idx]);
|
||||
}
|
||||
TeamResource[] teams = new TeamResource[v.size()];
|
||||
for (int idx=0; idx<v.size(); idx++)
|
||||
teams[idx] = (TeamResource)v.elementAt(idx);
|
||||
return teams;
|
||||
}
|
||||
else
|
||||
{
|
||||
String teamName = filterString.substring(0, slashIdx);
|
||||
String devrName = filterString.substring(slashIdx+1);
|
||||
TeamResource[] allTeams = getAllTeams();
|
||||
TeamResource match = null;
|
||||
for (int idx=0; (match==null) && (idx<allTeams.length); idx++)
|
||||
if (allTeams[idx].getName().equals(teamName))
|
||||
match = allTeams[idx];
|
||||
if (match != null)
|
||||
{
|
||||
DeveloperResource[] allDevrs = match.getDevelopers();
|
||||
// Now, subset master list, based on filter string...
|
||||
NamePatternMatcher subsetter = new NamePatternMatcher(devrName);
|
||||
Vector v = new Vector();
|
||||
for (int idx=0; idx<allDevrs.length; idx++)
|
||||
{
|
||||
if (subsetter.matches(allDevrs[idx].getName()))
|
||||
v.addElement(allDevrs[idx]);
|
||||
}
|
||||
DeveloperResource[] devrs = new DeveloperResource[v.size()];
|
||||
for (int idx=0; idx<v.size(); idx++)
|
||||
devrs[idx] = (DeveloperResource)v.elementAt(idx);
|
||||
return devrs;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* When a remote resource is expanded, this is called to return the children of the resource, if
|
||||
* the resource's adapter states the resource object is expandable. <br>
|
||||
* For us, it is a Team resource that was expanded, and an array of Developer resources will be returned.
|
||||
*
|
||||
* @param monitor - the progress monitor in effect while this operation performs
|
||||
* @param parent - the parent resource object being expanded
|
||||
* @param filterString - typically defaults to "*". In future additional user-specific quick-filters may be supported.
|
||||
*/
|
||||
protected Object[] internalResolveFilterString(IProgressMonitor monitor, Object parent, String filterString)
|
||||
throws java.lang.reflect.InvocationTargetException,
|
||||
java.lang.InterruptedException
|
||||
{
|
||||
// typically we ignore the filter string as it is always "*"
|
||||
// until support is added for "quick filters" the user can specify/select
|
||||
// at the time they expand a remote resource.
|
||||
|
||||
TeamResource team = (TeamResource)parent;
|
||||
return team.getDevelopers();
|
||||
}
|
||||
|
||||
// ------------------
|
||||
// Our own methods...
|
||||
// ------------------
|
||||
/**
|
||||
* Get the list of all teams. Normally this would involve a trip the server, but we
|
||||
* fake it out and return a hard-coded local list.
|
||||
*/
|
||||
public TeamResource[] getAllTeams()
|
||||
{
|
||||
if (teams == null)
|
||||
teams = createTeams("Team ", 4);
|
||||
return teams;
|
||||
}
|
||||
/**
|
||||
* Get the list of all developers. Normally this would involve a trip the server, but we
|
||||
* fake it out and return a hard-coded local list.
|
||||
*/
|
||||
public DeveloperResource[] getAllDevelopers()
|
||||
{
|
||||
DeveloperResource[] allDevrs = new DeveloperResource[devVector.size()];
|
||||
for (int idx=0; idx<allDevrs.length; idx++)
|
||||
allDevrs[idx] = (DeveloperResource)devVector.elementAt(idx);
|
||||
return allDevrs;
|
||||
}
|
||||
/*
|
||||
* Create and return a dummy set of teams
|
||||
*/
|
||||
private TeamResource[] createTeams(String prefix, int howMany)
|
||||
{
|
||||
TeamResource[] teams = new TeamResource[howMany];
|
||||
for (int idx=0; idx<teams.length; idx++)
|
||||
{
|
||||
teams[idx] = new TeamResource(this);
|
||||
teams[idx].setName(prefix + (idx+1));
|
||||
teams[idx].setDevelopers(createDevelopers(teams[idx].getName()+" developer",idx+1));
|
||||
}
|
||||
return teams;
|
||||
}
|
||||
|
||||
/*
|
||||
* Create and return a dummy set of developers
|
||||
*/
|
||||
private DeveloperResource[] createDevelopers(String prefix, int nbr)
|
||||
{
|
||||
DeveloperResource[] devrs = new DeveloperResource[nbr];
|
||||
for (int idx=0; idx<devrs.length; idx++)
|
||||
{
|
||||
devrs[idx] = new DeveloperResource(this);
|
||||
devrs[idx].setName(prefix + (idx+1));
|
||||
devrs[idx].setId(Integer.toString(employeeId++));
|
||||
devrs[idx].setDeptNbr(Integer.toString((idx+1)*100));
|
||||
devVector.add(devrs[idx]); // update master list
|
||||
}
|
||||
return devrs;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,110 @@
|
|||
/********************************************************************************
|
||||
* Copyright (c) 2006 IBM Corporation. All rights reserved.
|
||||
* This program and the accompanying materials are made available under the terms
|
||||
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
||||
* available at http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Initial Contributors:
|
||||
* The following IBM employees contributed to the Remote System Explorer
|
||||
* component that contains this file: David McKnight, Kushal Munir,
|
||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||
*
|
||||
* Contributors:
|
||||
* Martin Oberhuber (Wind River) - Adapted original tutorial code to Open RSE.
|
||||
********************************************************************************/
|
||||
|
||||
package samples.subsystems;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
import org.eclipse.rse.core.subsystems.IConnectorService;
|
||||
import org.eclipse.rse.core.subsystems.ISubSystem;
|
||||
import org.eclipse.rse.core.subsystems.SubSystemConfiguration;
|
||||
import org.eclipse.rse.filters.ISystemFilter;
|
||||
import org.eclipse.rse.filters.ISystemFilterPool;
|
||||
import org.eclipse.rse.filters.ISystemFilterPoolManager;
|
||||
import org.eclipse.rse.internal.filters.SystemFilter;
|
||||
import org.eclipse.rse.model.IHost;
|
||||
|
||||
import samples.RSESamplesPlugin;
|
||||
|
||||
/**
|
||||
* This is our subsystem factory, which creates instances of our subsystems,
|
||||
* and supplies the subsystem and filter actions to their popup menus.
|
||||
*/
|
||||
public class DeveloperSubSystemConfiguration extends SubSystemConfiguration {
|
||||
|
||||
/**
|
||||
* Constructor for DeveloperSubSystemConfiguration.
|
||||
*/
|
||||
public DeveloperSubSystemConfiguration() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of our subsystem.
|
||||
*/
|
||||
public ISubSystem createSubSystemInternal(IHost conn) {
|
||||
return new DeveloperSubSystem(conn, getConnectorService(conn));
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.core.subsystems.ISubSystemConfiguration#getConnectorService(org.eclipse.rse.model.IHost)
|
||||
*/
|
||||
public IConnectorService getConnectorService(IHost host) {
|
||||
return DeveloperConnectorServiceManager.getTheDeveloperConnectorServiceManager()
|
||||
.getConnectorService(host, IDeveloperSubSystem.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Intercept of parent method that creates an initial default filter pool.
|
||||
* We intercept so that we can create an initial filter in that pool, which will
|
||||
* list all teams.
|
||||
*/
|
||||
protected ISystemFilterPool createDefaultFilterPool(ISystemFilterPoolManager mgr)
|
||||
{
|
||||
ISystemFilterPool defaultPool = null;
|
||||
try {
|
||||
defaultPool = mgr.createSystemFilterPool(getDefaultFilterPoolName(mgr.getName(), getId()), true); // true=>is deletable by user
|
||||
Vector strings = new Vector();
|
||||
strings.add("*"); //$NON-NLS-1$
|
||||
//--tutorial part 1
|
||||
//mgr.createSystemFilter(defaultPool, "All teams", strings);
|
||||
//--tutorial part 2
|
||||
ISystemFilter filter = mgr.createSystemFilter(defaultPool,
|
||||
RSESamplesPlugin.getResourceString("filter.default.name"), //$NON-NLS-1$
|
||||
strings);
|
||||
filter.setType("team"); //$NON-NLS-1$
|
||||
} catch (Exception exc) {}
|
||||
return defaultPool;
|
||||
}
|
||||
|
||||
/**
|
||||
* Intercept of parent method so we can supply our own value shown in the property
|
||||
* sheet for the "type" property when a filter is selected within our subsystem.
|
||||
*
|
||||
* Requires this line in rseSamplesResources.properties: property.type.teamfilter=Team filter
|
||||
*/
|
||||
public String getTranslatedFilterTypeProperty(SystemFilter selectedFilter)
|
||||
{
|
||||
//--tutorial part 1
|
||||
//return RSESamplesPlugin.getResourceString("property.type.teamfilter"); //$NON-NLS-1$
|
||||
//--tutorial part 2
|
||||
String type = selectedFilter.getType();
|
||||
if (type == null)
|
||||
type = "team"; //$NON-NLS-1$
|
||||
if (type.equals("team")) //$NON-NLS-1$
|
||||
return RSESamplesPlugin.getResourceString("property.type.teamfilter"); //$NON-NLS-1$
|
||||
else
|
||||
return RSESamplesPlugin.getResourceString("property.type.devrfilter"); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.core.subsystems.SubSystemConfiguration#supportsServerLaunchProperties(org.eclipse.rse.model.IHost)
|
||||
*/
|
||||
public boolean supportsServerLaunchProperties(IHost host) {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,107 @@
|
|||
/********************************************************************************
|
||||
* Copyright (c) 2006 IBM Corporation. All rights reserved.
|
||||
* This program and the accompanying materials are made available under the terms
|
||||
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
||||
* available at http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Initial Contributors:
|
||||
* The following IBM employees contributed to the Remote System Explorer
|
||||
* component that contains this file: David McKnight, Kushal Munir,
|
||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||
*
|
||||
* Contributors:
|
||||
* Martin Oberhuber (Wind River) - Adapted original tutorial code to Open RSE.
|
||||
********************************************************************************/
|
||||
|
||||
package samples.subsystems;
|
||||
|
||||
import org.eclipse.jface.action.IAction;
|
||||
import org.eclipse.jface.resource.ImageDescriptor;
|
||||
import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
|
||||
import org.eclipse.rse.filters.ISystemFilter;
|
||||
import org.eclipse.rse.filters.ISystemFilterPool;
|
||||
import org.eclipse.rse.ui.filters.actions.SystemChangeFilterAction;
|
||||
import org.eclipse.rse.ui.filters.actions.SystemNewFilterAction;
|
||||
import org.eclipse.rse.ui.view.SubsystemFactoryAdapter;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
|
||||
import samples.RSESamplesPlugin;
|
||||
|
||||
/**
|
||||
* Adds functionality to the basic SubSystemConfiguration.
|
||||
*/
|
||||
public class DeveloperSubSystemConfigurationAdapter extends
|
||||
SubsystemFactoryAdapter
|
||||
{
|
||||
|
||||
/**
|
||||
* Constructor for DeveloperSubSystemConfigurationAdapter.
|
||||
*/
|
||||
public DeveloperSubSystemConfigurationAdapter()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Override of parent method, to affect what is returned for the New Filter-> actions.
|
||||
* We intercept here, versus getNewFilterPoolFilterAction, so that we can return multiple
|
||||
* actions versus just one.
|
||||
*/
|
||||
protected IAction[] getNewFilterPoolFilterActions(ISubSystemConfiguration factory, ISystemFilterPool selectedPool, Shell shell)
|
||||
{
|
||||
SystemNewFilterAction teamAction = (SystemNewFilterAction)super.getNewFilterPoolFilterAction(factory, selectedPool, shell);
|
||||
teamAction.setWizardPageTitle(RSESamplesPlugin.getResourceString("filter.team.pagetitle")); //$NON-NLS-1$
|
||||
teamAction.setPage1Description(RSESamplesPlugin.getResourceString("filter.team.pagetext")); //$NON-NLS-1$
|
||||
teamAction.setType("team"); //$NON-NLS-1$
|
||||
teamAction.setText(RSESamplesPlugin.getResourceString("filter.team.pagetitle") + "..."); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
|
||||
SystemNewFilterAction devrAction = (SystemNewFilterAction)super.getNewFilterPoolFilterAction(factory, selectedPool, shell);
|
||||
devrAction.setWizardPageTitle(RSESamplesPlugin.getResourceString("filter.devr.pagetitle")); //$NON-NLS-1$
|
||||
devrAction.setPage1Description(RSESamplesPlugin.getResourceString("filter.devr.pagetext")); //$NON-NLS-1$
|
||||
devrAction.setType("devr"); //$NON-NLS-1$
|
||||
devrAction.setText(RSESamplesPlugin.getResourceString("filter.devr.pagetitle") + "..."); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
devrAction.setFilterStringEditPane(new DeveloperFilterStringEditPane(shell));
|
||||
|
||||
IAction[] actions = new IAction[2];
|
||||
actions[0] = teamAction;
|
||||
actions[1] = devrAction;
|
||||
return actions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Override of parent method for returning the change-filter action, so we can affect it.
|
||||
*/
|
||||
protected IAction getChangeFilterAction(ISubSystemConfiguration factory, ISystemFilter selectedFilter, Shell shell)
|
||||
{
|
||||
SystemChangeFilterAction action = (SystemChangeFilterAction)super.getChangeFilterAction(factory, selectedFilter, shell);
|
||||
String type = selectedFilter.getType();
|
||||
if (type == null)
|
||||
type = "team"; //$NON-NLS-1$
|
||||
if (type.equals("team")) //$NON-NLS-1$
|
||||
{
|
||||
action.setDialogTitle(RSESamplesPlugin.getResourceString("filter.team.dlgtitle")); //$NON-NLS-1$
|
||||
}
|
||||
else
|
||||
{
|
||||
action.setDialogTitle(RSESamplesPlugin.getResourceString("filter.devr.dlgtitle")); //$NON-NLS-1$
|
||||
action.setFilterStringEditPane(new DeveloperFilterStringEditPane(shell));
|
||||
}
|
||||
return action;
|
||||
}
|
||||
|
||||
/**
|
||||
* Override of parent method for returning the image for filters in our subsystem.
|
||||
*/
|
||||
public ImageDescriptor getSystemFilterImage(ISystemFilter filter)
|
||||
{
|
||||
String type = filter.getType();
|
||||
if (type == null)
|
||||
type = "team"; //$NON-NLS-1$
|
||||
if (type.equals("team")) //$NON-NLS-1$
|
||||
return RSESamplesPlugin.getDefault().getImageDescriptor("ICON_ID_TEAMFILTER"); //$NON-NLS-1$
|
||||
else
|
||||
return RSESamplesPlugin.getDefault().getImageDescriptor("ICON_ID_DEVELOPERFILTER"); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
/********************************************************************************
|
||||
* Copyright (c) 2006 IBM Corporation. All rights reserved.
|
||||
* This program and the accompanying materials are made available under the terms
|
||||
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
||||
* available at http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Initial Contributors:
|
||||
* The following IBM employees contributed to the Remote System Explorer
|
||||
* component that contains this file: David McKnight, Kushal Munir,
|
||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||
*
|
||||
* Contributors:
|
||||
* Martin Oberhuber (Wind River) - Adapted original tutorial code to Open RSE.
|
||||
********************************************************************************/
|
||||
|
||||
package samples.subsystems;
|
||||
|
||||
import org.eclipse.core.runtime.IAdapterFactory;
|
||||
import org.eclipse.core.runtime.IAdapterManager;
|
||||
import org.eclipse.rse.core.subsystems.util.ISubsystemConfigurationAdapter;
|
||||
|
||||
/**
|
||||
* @author martin.oberhuber@windriver.com
|
||||
*
|
||||
*/
|
||||
public class DeveloperSubSystemConfigurationAdapterFactory implements
|
||||
IAdapterFactory {
|
||||
|
||||
private ISubsystemConfigurationAdapter ssConfigAdapter = new DeveloperSubSystemConfigurationAdapter();
|
||||
|
||||
/**
|
||||
* @see IAdapterFactory#getAdapterList()
|
||||
*/
|
||||
public Class[] getAdapterList()
|
||||
{
|
||||
return new Class[] {ISubsystemConfigurationAdapter.class};
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by our plugin's startup method to register our adaptable object types
|
||||
* with the platform. We prefer to do it here to isolate/encapsulate all factory
|
||||
* logic in this one place.
|
||||
*/
|
||||
public void registerWithManager(IAdapterManager manager)
|
||||
{
|
||||
manager.registerAdapters(this, DeveloperSubSystemConfiguration.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
|
||||
*/
|
||||
public Object getAdapter(Object adaptableObject, Class adapterType)
|
||||
{
|
||||
Object adapter = null;
|
||||
if (adaptableObject instanceof DeveloperSubSystemConfiguration)
|
||||
adapter = ssConfigAdapter;
|
||||
|
||||
return adapter;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
/********************************************************************************
|
||||
* Copyright (c) 2006 IBM Corporation. All rights reserved.
|
||||
* This program and the accompanying materials are made available under the terms
|
||||
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
||||
* available at http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Initial Contributors:
|
||||
* The following IBM employees contributed to the Remote System Explorer
|
||||
* component that contains this file: David McKnight, Kushal Munir,
|
||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||
*
|
||||
* Contributors:
|
||||
* Martin Oberhuber (Wind River) - Adapted original tutorial code to Open RSE.
|
||||
********************************************************************************/
|
||||
|
||||
package samples.subsystems;
|
||||
|
||||
public interface IDeveloperSubSystem {
|
||||
|
||||
}
|
Loading…
Add table
Reference in a new issue