1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-22 14:12:10 +02:00

[203124] Fix HTML errors in rse.doc.isv (patch by Olivier Thomann)

This commit is contained in:
Martin Oberhuber 2007-09-12 19:02:08 +00:00
parent fcb877ed59
commit bd2910e381
17 changed files with 943 additions and 942 deletions

View file

@ -1,3 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- ===================================================================== -->
<!-- Custom targets called from a project's generated build.xml -->
<!-- Set customBuildCallbacks=<path/to/this/file> in your build.properties.-->

View file

@ -31,7 +31,7 @@ help simplify the creation of action classes, especially when used together with
<h2>RSE-Supplied Base Classes for Actions</h2>
<p>Here are the primary base classes the RSE supplies for actions, all of which are found in the
package <samp><A href="../../../reference/api/org/eclipse/rse/ui/actions/package-summary.html"org.eclipse.rse.ui.actions</A></samp>
package <samp><A href="../../../reference/api/org/eclipse/rse/ui/actions/package-summary.html">org.eclipse.rse.ui.actions</A></samp>
in the plugin <samp>org.eclipse.rse.ui</samp>:</p>
<TABLE border="1">
<TBODY>

View file

@ -15,7 +15,7 @@ you use:
</p>
<ul>
<li>Static methods in the
<samp><A href="../../../reference/api/org/eclipse/rse/ui/SystemBasePlugin.html"org.eclipse.rse.ui.SystemBasePlugin</A></samp>
<samp><A href="../../../reference/api/org/eclipse/rse/ui/SystemBasePlugin.html">org.eclipse.rse.ui.SystemBasePlugin</A></samp>
class to load the message file and extract messages from it.
<li>Classes in the
<samp><A href="../../../reference/api/org/eclipse/rse/ui/messages/package-summary.html">org.eclipse.rse.ui.messages</A></samp>

View file

@ -12,7 +12,7 @@
<body bgcolor="#ffffff">
<h1>Plugging In Property Pages</h1>
<p>The <samp><a href="../../../org.eclipse.platform.doc.isv/reference/extension-points/org_eclipse_ui_propertyPages.html">org.eclipse.ui.propertyPages</a></samp> extension point
from the base Eclipse Platform is used to contribute property pages.<BR/>
from the base Eclipse Platform is used to contribute property pages.<BR>
What is a property page?
It is a page that shows up in the Eclipse <A href="propertypage_figure2.gif">Properties dialog</A> that users
get to by right-clicking on an object within any tree or table view, and selecting

View file

@ -19,6 +19,7 @@ It provides an
<li><a href="rse_int_architecture.html">Architectural Overview</a>,</li>
<li><a href="usingAPIs.html">API Description</a> as well as some extensive</li>
<li><a href="tutorials.html">Tutorials</a></li>.
</ul>
</div>
<h2>Provisional API</h2>

View file

@ -1,210 +1,210 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
<meta name="copyright" content="Copyright (c) IBM Corporation and others 2002, 2006. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." >
<LINK REL="STYLESHEET" HREF="../../book.css" TYPE="text/css">
<title>DeveloperFilterStringEditPane Class After Editing</title>
</head>
<body>
<h1>DeveloperFilterStringEditPane Class After Editing</h1>
<pre><samp>
package samples.subsystems;
<strong>import org.eclipse.rse.services.clientserver.messages.SystemMessage;
import org.eclipse.rse.ui.SystemWidgetHelpers;</strong>
import org.eclipse.rse.ui.filters.SystemFilterStringEditPane;
<strong>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;</strong>
<strong>import samples.RSESamplesPlugin;</strong>
/**
* Our specialized filter string edit pane for developer filters.
*/
public class DeveloperFilterStringEditPane extends SystemFilterStringEditPane {
// gui widgets
<strong>private Text textTeam, textDevr;</strong>
/**
* 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
*/
<strong>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;
}</strong>
/**
* Override of parent method.
* Return the control to recieve initial focus.
*/
<strong>public Control getInitialFocusControl()
{
return textTeam;
}</strong>
/**
* 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
*/
<strong>protected void doInitializeFields()
{
if (textTeam == null)
return; // do nothing
if (inputFilterString != null)
{
int idx = inputFilterString.indexOf('/');
if (idx &lt; 0)
textTeam.setText(inputFilterString);
else
{
textTeam.setText(inputFilterString.substring(0,idx));
textDevr.setText(inputFilterString.substring(idx+1));
}
}
}</strong>
/**
* Override of parent method.
* This is called in the change filter dialog when the user selects "new", or selects another string.
*/
<strong>protected void resetFields()
{
textTeam.setText(""); //$NON-NLS-1$
textDevr.setText("*"); //$NON-NLS-1$
}</strong>
/**
* Override of parent method.
* Called by parent to decide if information is complete enough to enable finish.
*/
<strong>protected boolean areFieldsComplete()
{
if ((textTeam == null) || (textDevr == null))
return false;
else
return (textTeam.getText().trim().length()>0) && (textDevr.getText().trim().length()>0);
}</strong>
/**
* 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.
*/
<strong>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$
}
}</strong>
/**
* 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
*/
<strong>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;
}</strong>
}
</samp></pre>
</body>
</html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
<meta name="copyright" content="Copyright (c) IBM Corporation and others 2002, 2006. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." >
<LINK REL="STYLESHEET" HREF="../../book.css" TYPE="text/css">
<title>DeveloperFilterStringEditPane Class After Editing</title>
</head>
<body>
<h1>DeveloperFilterStringEditPane Class After Editing</h1>
<pre><samp>
package samples.subsystems;
<strong>import org.eclipse.rse.services.clientserver.messages.SystemMessage;
import org.eclipse.rse.ui.SystemWidgetHelpers;</strong>
import org.eclipse.rse.ui.filters.SystemFilterStringEditPane;
<strong>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;</strong>
<strong>import samples.RSESamplesPlugin;</strong>
/**
* Our specialized filter string edit pane for developer filters.
*/
public class DeveloperFilterStringEditPane extends SystemFilterStringEditPane {
// gui widgets
<strong>private Text textTeam, textDevr;</strong>
/**
* 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
*/
<strong>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;
}</strong>
/**
* Override of parent method.
* Return the control to recieve initial focus.
*/
<strong>public Control getInitialFocusControl()
{
return textTeam;
}</strong>
/**
* 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
*/
<strong>protected void doInitializeFields()
{
if (textTeam == null)
return; // do nothing
if (inputFilterString != null)
{
int idx = inputFilterString.indexOf('/');
if (idx &lt; 0)
textTeam.setText(inputFilterString);
else
{
textTeam.setText(inputFilterString.substring(0,idx));
textDevr.setText(inputFilterString.substring(idx+1));
}
}
}</strong>
/**
* Override of parent method.
* This is called in the change filter dialog when the user selects "new", or selects another string.
*/
<strong>protected void resetFields()
{
textTeam.setText(""); //$NON-NLS-1$
textDevr.setText("*"); //$NON-NLS-1$
}</strong>
/**
* Override of parent method.
* Called by parent to decide if information is complete enough to enable finish.
*/
<strong>protected boolean areFieldsComplete()
{
if ((textTeam == null) || (textDevr == null))
return false;
else
return (textTeam.getText().trim().length()&gt;0) &amp;&amp; (textDevr.getText().trim().length()&gt;0);
}</strong>
/**
* 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.
*/
<strong>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$
}
}</strong>
/**
* 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
*/
<strong>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;
}</strong>
}
</samp></pre>
</body>
</html>

View file

@ -125,7 +125,7 @@ public class DeveloperSubSystem extends SubSystem
* @param parent - the parent resource object being expanded
* @param filterString - typically defaults to "*". In future additional user-specific quick-filters may be supported.
*/
<a id="resolveFilterString"/>protected Object[] internalResolveFilterString(Object parent, String filterString, IProgressMonitor monitor)
<a id="resolveFilterString"></a>protected Object[] internalResolveFilterString(Object parent, String filterString, IProgressMonitor monitor)
throws java.lang.reflect.InvocationTargetException,
java.lang.InterruptedException
{

View file

@ -108,7 +108,7 @@ public class DeveloperSubSystem extends SubSystem
// Now, subset master list, based on filter string...
NamePatternMatcher subsetter = new NamePatternMatcher(filterString);
Vector v = new Vector();
for (int idx=0; idx &lt1; allTeams.length; idx++)
for (int idx=0; idx &lt; allTeams.length; idx++)
{
if (subsetter.matches(allTeams[idx].getName()))
v.addElement(allTeams[idx]);
@ -124,7 +124,7 @@ public class DeveloperSubSystem extends SubSystem
String devrName = filterString.substring(slashIdx+1);
TeamResource[] allTeams = getAllTeams();
TeamResource match = null;
for (int idx=0; (match==null) && (idx &lt; allTeams.length); idx++)
for (int idx=0; (match==null) &amp;&amp; (idx &lt; allTeams.length); idx++)
if (allTeams[idx].getName().equals(teamName))
match = allTeams[idx];
if (match != null)

View file

@ -59,7 +59,7 @@ public class DeveloperSubSystemConfiguration extends SubSystemConfiguration {
* We intercept so that we can create an initial filter in that pool, which will
* list all teams.
*/
<a id="createDefaultFilterPool"/><strong>protected ISystemFilterPool createDefaultFilterPool(ISystemFilterPoolManager mgr)
<a id="createDefaultFilterPool"></a><strong>protected ISystemFilterPool createDefaultFilterPool(ISystemFilterPoolManager mgr)
{
ISystemFilterPool defaultPool = null;
try {

View file

@ -1,269 +1,269 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
<meta name="copyright" content="Copyright (c) IBM Corporation and others 2002, 2006. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." >
<LINK REL="STYLESHEET" HREF="../../book.css" TYPE="text/css">
<title>FolderInfoPropertyPage Class After Editing</title>
</head>
<body bgcolor="#ffffff">
<h1>FolderInfoPropertyPage Class After Editing</h1>
<p>
<pre><samp>
package samples.ui.propertypages;
import org.eclipse.rse.files.ui.propertypages.SystemAbstractRemoteFilePropertyPageExtensionAction;
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
import org.eclipse.rse.ui.SystemWidgetHelpers;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import samples.RSESamplesPlugin;
/**
* A sample property page for a remote object, which in this case is scoped via the
* extension point xml to only apply to folder objects.
*/
public class FolderInfoPropertyPage
extends SystemAbstractRemoteFilePropertyPageExtensionAction
implements SelectionListener
{
// gui widgets...
private Label sizeLabel, filesLabel, foldersLabel;
private Button stopButton;
// state...
private int totalSize = 0;
private int totalFolders = 0;
private int totalFiles = 0;
private boolean stopped = false;
private Thread workerThread;
private Runnable guiUpdater;
/**
* Constructor for FolderInfoPropertyPage.
*/
public FolderInfoPropertyPage()
{
super();
}
// --------------------------
// Parent method overrides...
// --------------------------
/* (non-Javadoc)
* @see org.eclipse.rse.files.ui.propertypages.SystemAbstractRemoteFilePropertyPageExtensionAction#createContentArea(org.eclipse.swt.widgets.Composite)
*/
protected Control createContentArea(Composite parent)
{
Composite composite = SystemWidgetHelpers.createComposite(parent, 2);
// draw the gui
sizeLabel = SystemWidgetHelpers.createLabeledLabel(composite,
RSESamplesPlugin.getResourceString("pp.size.label"), //$NON-NLS-1$
RSESamplesPlugin.getResourceString("pp.size.tooltip"), //$NON-NLS-1$
false);
filesLabel = SystemWidgetHelpers.createLabeledLabel(composite,
RSESamplesPlugin.getResourceString("pp.files.label"), //$NON-NLS-1$
RSESamplesPlugin.getResourceString("pp.files.tooltip"), //$NON-NLS-1$
false);
foldersLabel = SystemWidgetHelpers.createLabeledLabel(composite,
RSESamplesPlugin.getResourceString("pp.folders.label"), //$NON-NLS-1$
RSESamplesPlugin.getResourceString("pp.folders.tooltip"), //$NON-NLS-1$
false);
stopButton = SystemWidgetHelpers.createPushButton(composite, null,
RSESamplesPlugin.getResourceString("pp.stopButton.label"), //$NON-NLS-1$
RSESamplesPlugin.getResourceString("pp.stopButton.tooltip") //$NON-NLS-1$
);
stopButton.addSelectionListener(this);
setValid(false); // Disable OK button until thread is done
// show "Processing..." message
setMessage(RSESamplesPlugin.getPluginMessage("RSSG1002")); //$NON-NLS-1$
// create instance of Runnable to allow asynchronous GUI updates from background thread
guiUpdater = new RunnableGUIClass();
// spawn a thread to calculate the information
workerThread = new RunnableClass(getRemoteFile());
workerThread.start();
return composite;
}
/**
* Intercept from PreferencePage. Called when user presses Cancel button.
* We stop the background thread.
* @see org.eclipse.jface.preference.PreferencePage#performCancel()
*/
public boolean performCancel()
{
killThread();
return true;
}
/**
* Intercept from DialogPage. Called when dialog going away.
* If the user presses the X to close this dialog, we
* need to stop that background thread.
*/
public void dispose()
{
killThread();
super.dispose();
}
/**
* Private method to kill our background thread.
* Control doesn't return until it ends.
*/
private void killThread()
{
if (!stopped && workerThread.isAlive())
{
stopped = true;
try {
workerThread.join(); // wait for thread to end
} catch (InterruptedException exc) {}
}
}
// -------------------------------------------
// Methods from SelectionListener interface...
// -------------------------------------------
/**
* From SelectionListener
* @see SelectionListener#widgetSelected(SelectionEvent)
*/
public void widgetSelected(SelectionEvent event)
{
if (event.getSource() == stopButton)
{
stopped = true;
stopButton.setEnabled(false);
}
}
/**
* From SelectionListener
* @see SelectionListener#widgetDefaultSelected(SelectionEvent)
*/
public void widgetDefaultSelected(SelectionEvent event)
{
}
// ----------------
// Inner classes...
// ----------------
/**
* Inner class encapsulating the background work to be done, so it may be executed
* in background thread.
*/
private class RunnableClass extends Thread
{
IRemoteFile inputFolder;
RunnableClass(IRemoteFile inputFolder)
{
this.inputFolder = inputFolder;
}
public void run()
{
if (stopped)
return;
walkFolder(inputFolder);
updateGUI();
if (!stopped)
{
stopped = true;
updateGUI();
}
}
/**
* Recursively walk a folder, updating the running tallies.
* Update the GUI after processing each subfolder.
*/
private void walkFolder(IRemoteFile currFolder)
{
try
{
IRemoteFile[] folders = currFolder.getParentRemoteFileSubSystem().listFoldersAndFiles( currFolder, null);
if ((folders != null) && (folders.length>0))
{
for (int idx=0; !stopped && (idx&lt;folders.length); idx++)
{
// is this a folder?
if (folders[idx].isDirectory())
{
++totalFolders;
walkFolder(folders[idx]);
updateGUI();
}
// is this a file?
else
{
++totalFiles;
totalSize += folders[idx].getLength();
}
}
}
}
catch (SystemMessageException e)
{
}
} // end of walkFolder method
} // end of inner class
/**
* Inner class encapsulating the GUI work to be done from the
* background thread.
*/
private class RunnableGUIClass implements Runnable
{
public void run()
{
if (stopButton.isDisposed())
return;
if (!stopped)
{
sizeLabel.setText(Integer.toString(totalSize));
filesLabel.setText(Integer.toString(totalFiles));
foldersLabel.setText(Integer.toString(totalFolders));
}
else if (stopped)
{
setValid(true); // re-enable OK button
stopButton.setEnabled(false); // disable Stop button
clearMessage(); // clear "Processing..." message
}
}
}
/**
* Update the GUI with the current status
*/
private void updateGUI()
{
Display.getDefault().asyncExec(guiUpdater);
}
}
</samp></pre>
</p>
</body>
</html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
<meta name="copyright" content="Copyright (c) IBM Corporation and others 2002, 2006. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." >
<LINK REL="STYLESHEET" HREF="../../book.css" TYPE="text/css">
<title>FolderInfoPropertyPage Class After Editing</title>
</head>
<body bgcolor="#ffffff">
<h1>FolderInfoPropertyPage Class After Editing</h1>
<p>
<pre><samp>
package samples.ui.propertypages;
import org.eclipse.rse.files.ui.propertypages.SystemAbstractRemoteFilePropertyPageExtensionAction;
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
import org.eclipse.rse.ui.SystemWidgetHelpers;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import samples.RSESamplesPlugin;
/**
* A sample property page for a remote object, which in this case is scoped via the
* extension point xml to only apply to folder objects.
*/
public class FolderInfoPropertyPage
extends SystemAbstractRemoteFilePropertyPageExtensionAction
implements SelectionListener
{
// gui widgets...
private Label sizeLabel, filesLabel, foldersLabel;
private Button stopButton;
// state...
private int totalSize = 0;
private int totalFolders = 0;
private int totalFiles = 0;
private boolean stopped = false;
private Thread workerThread;
private Runnable guiUpdater;
/**
* Constructor for FolderInfoPropertyPage.
*/
public FolderInfoPropertyPage()
{
super();
}
// --------------------------
// Parent method overrides...
// --------------------------
/* (non-Javadoc)
* @see org.eclipse.rse.files.ui.propertypages.SystemAbstractRemoteFilePropertyPageExtensionAction#createContentArea(org.eclipse.swt.widgets.Composite)
*/
protected Control createContentArea(Composite parent)
{
Composite composite = SystemWidgetHelpers.createComposite(parent, 2);
// draw the gui
sizeLabel = SystemWidgetHelpers.createLabeledLabel(composite,
RSESamplesPlugin.getResourceString("pp.size.label"), //$NON-NLS-1$
RSESamplesPlugin.getResourceString("pp.size.tooltip"), //$NON-NLS-1$
false);
filesLabel = SystemWidgetHelpers.createLabeledLabel(composite,
RSESamplesPlugin.getResourceString("pp.files.label"), //$NON-NLS-1$
RSESamplesPlugin.getResourceString("pp.files.tooltip"), //$NON-NLS-1$
false);
foldersLabel = SystemWidgetHelpers.createLabeledLabel(composite,
RSESamplesPlugin.getResourceString("pp.folders.label"), //$NON-NLS-1$
RSESamplesPlugin.getResourceString("pp.folders.tooltip"), //$NON-NLS-1$
false);
stopButton = SystemWidgetHelpers.createPushButton(composite, null,
RSESamplesPlugin.getResourceString("pp.stopButton.label"), //$NON-NLS-1$
RSESamplesPlugin.getResourceString("pp.stopButton.tooltip") //$NON-NLS-1$
);
stopButton.addSelectionListener(this);
setValid(false); // Disable OK button until thread is done
// show "Processing..." message
setMessage(RSESamplesPlugin.getPluginMessage("RSSG1002")); //$NON-NLS-1$
// create instance of Runnable to allow asynchronous GUI updates from background thread
guiUpdater = new RunnableGUIClass();
// spawn a thread to calculate the information
workerThread = new RunnableClass(getRemoteFile());
workerThread.start();
return composite;
}
/**
* Intercept from PreferencePage. Called when user presses Cancel button.
* We stop the background thread.
* @see org.eclipse.jface.preference.PreferencePage#performCancel()
*/
public boolean performCancel()
{
killThread();
return true;
}
/**
* Intercept from DialogPage. Called when dialog going away.
* If the user presses the X to close this dialog, we
* need to stop that background thread.
*/
public void dispose()
{
killThread();
super.dispose();
}
/**
* Private method to kill our background thread.
* Control doesn't return until it ends.
*/
private void killThread()
{
if (!stopped &amp;&amp; workerThread.isAlive())
{
stopped = true;
try {
workerThread.join(); // wait for thread to end
} catch (InterruptedException exc) {}
}
}
// -------------------------------------------
// Methods from SelectionListener interface...
// -------------------------------------------
/**
* From SelectionListener
* @see SelectionListener#widgetSelected(SelectionEvent)
*/
public void widgetSelected(SelectionEvent event)
{
if (event.getSource() == stopButton)
{
stopped = true;
stopButton.setEnabled(false);
}
}
/**
* From SelectionListener
* @see SelectionListener#widgetDefaultSelected(SelectionEvent)
*/
public void widgetDefaultSelected(SelectionEvent event)
{
}
// ----------------
// Inner classes...
// ----------------
/**
* Inner class encapsulating the background work to be done, so it may be executed
* in background thread.
*/
private class RunnableClass extends Thread
{
IRemoteFile inputFolder;
RunnableClass(IRemoteFile inputFolder)
{
this.inputFolder = inputFolder;
}
public void run()
{
if (stopped)
return;
walkFolder(inputFolder);
updateGUI();
if (!stopped)
{
stopped = true;
updateGUI();
}
}
/**
* Recursively walk a folder, updating the running tallies.
* Update the GUI after processing each subfolder.
*/
private void walkFolder(IRemoteFile currFolder)
{
try
{
IRemoteFile[] folders = currFolder.getParentRemoteFileSubSystem().listFoldersAndFiles( currFolder, null);
if ((folders != null) &amp;&amp; (folders.length&gt;0))
{
for (int idx=0; !stopped &amp;&amp; (idx&lt;folders.length); idx++)
{
// is this a folder?
if (folders[idx].isDirectory())
{
++totalFolders;
walkFolder(folders[idx]);
updateGUI();
}
// is this a file?
else
{
++totalFiles;
totalSize += folders[idx].getLength();
}
}
}
}
catch (SystemMessageException e)
{
}
} // end of walkFolder method
} // end of inner class
/**
* Inner class encapsulating the GUI work to be done from the
* background thread.
*/
private class RunnableGUIClass implements Runnable
{
public void run()
{
if (stopButton.isDisposed())
return;
if (!stopped)
{
sizeLabel.setText(Integer.toString(totalSize));
filesLabel.setText(Integer.toString(totalFiles));
foldersLabel.setText(Integer.toString(totalFolders));
}
else if (stopped)
{
setValid(true); // re-enable OK button
stopButton.setEnabled(false); // disable Stop button
clearMessage(); // clear "Processing..." message
}
}
}
/**
* Update the GUI with the current status
*/
private void updateGUI()
{
Display.getDefault().asyncExec(guiUpdater);
}
}
</samp></pre>
</p>
</body>
</html>

View file

@ -11,7 +11,6 @@
<body>
<h1>RSESamplesPlugin Class</h1>
<pre><samp>
<pre><code>
package rsesamples;
@ -168,6 +167,6 @@ public class RSESamplesPlugin extends SystemBasePlugin {
}
}
</code></pre></samp></pre>
</code></pre>
</body>
</html>

View file

@ -1,117 +1,117 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
<meta name="copyright" content="Copyright (c) IBM Corporation and others 2002, 2007. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." >
<LINK REL="STYLESHEET" HREF="../../book.css" TYPE="text/css">
<title>ShowJarContents Class After Editing</title>
</head>
<body bgcolor="#ffffff">
<h1>ShowJarContents Class After Editing</h1>
<pre><samp>
package samples.ui.actions;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.core.subsystems.ISubSystem;
import org.eclipse.rse.shells.ui.RemoteCommandHelpers;
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
import org.eclipse.rse.subsystems.shells.core.subsystems.IRemoteCmdSubSystem;
import org.eclipse.rse.ui.SystemBasePlugin;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IObjectActionDelegate;
import org.eclipse.ui.IWorkbenchPart;
/**
* An action that runs a command to display the contents of a Jar file.
* The plugin.xml file restricts this action so it only appears for .jar files.
*/
public class ShowJarContents implements IObjectActionDelegate {
private List _selectedFiles;
/**
* Constructor for ShowJarContents.
*/
public ShowJarContents() {
_selectedFiles = new ArrayList();
}
protected Shell getShell() {
return SystemBasePlugin.getActiveWorkbenchShell();
}
protected IRemoteFile getFirstSelectedRemoteFile() {
if (_selectedFiles.size() > 0) {
return (IRemoteFile) _selectedFiles.get(0);
}
return null;
}
protected ISubSystem getSubSystem() {
return getFirstSelectedRemoteFile().getParentRemoteFileSubSystem();
}
/* (non-Javadoc)
* @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
*/
public void run(IAction action) {
IRemoteFile selectedFile = getFirstSelectedRemoteFile();
String cmdToRun = "jar -tvf " + selectedFile.getAbsolutePath(); //$NON-NLS-1$
try {
runCommand(cmdToRun);
} catch (Exception e) {
String excType = e.getClass().getName();
MessageDialog.openError(getShell(), excType, excType + ": " + e.getLocalizedMessage()); //$NON-NLS-1$
e.printStackTrace();
}
}
public IRemoteCmdSubSystem getRemoteCmdSubSystem() {
//get the Command subsystem associated with the current host
IHost myHost = getSubSystem().getHost();
IRemoteCmdSubSystem[] subsys = RemoteCommandHelpers.getCmdSubSystems(myHost);
for (int i = 0; i < subsys.length; i++) {
if (subsys[i].getSubSystemConfiguration().supportsCommands()) {
return subsys[i];
}
}
return null;
}
public void runCommand(String command) throws Exception {
IRemoteCmdSubSystem cmdss = getRemoteCmdSubSystem();
if (cmdss != null && cmdss.isConnected()) {
// Run the command in a visible shell
RemoteCommandHelpers.runUniversalCommand(getShell(), command, ".", cmdss); //$NON-NLS-1$
} else {
MessageDialog.openError(getShell(), "No command subsystem", "Found no command subsystem");
}
}
public void selectionChanged(org.eclipse.jface.action.IAction action, org.eclipse.jface.viewers.ISelection selection) {
_selectedFiles.clear();
// store the selected jars to be used when running
Iterator theSet = ((IStructuredSelection) selection).iterator();
while (theSet.hasNext()) {
Object obj = theSet.next();
if (obj instanceof IRemoteFile) {
_selectedFiles.add(obj);
}
}
}
public void setActivePart(IAction action, IWorkbenchPart targetPart) {
}
}
</samp></pre>
</body>
</html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
<meta name="copyright" content="Copyright (c) IBM Corporation and others 2002, 2007. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." >
<LINK REL="STYLESHEET" HREF="../../book.css" TYPE="text/css">
<title>ShowJarContents Class After Editing</title>
</head>
<body bgcolor="#ffffff">
<h1>ShowJarContents Class After Editing</h1>
<pre><samp>
package samples.ui.actions;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.core.subsystems.ISubSystem;
import org.eclipse.rse.shells.ui.RemoteCommandHelpers;
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
import org.eclipse.rse.subsystems.shells.core.subsystems.IRemoteCmdSubSystem;
import org.eclipse.rse.ui.SystemBasePlugin;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IObjectActionDelegate;
import org.eclipse.ui.IWorkbenchPart;
/**
* An action that runs a command to display the contents of a Jar file.
* The plugin.xml file restricts this action so it only appears for .jar files.
*/
public class ShowJarContents implements IObjectActionDelegate {
private List _selectedFiles;
/**
* Constructor for ShowJarContents.
*/
public ShowJarContents() {
_selectedFiles = new ArrayList();
}
protected Shell getShell() {
return SystemBasePlugin.getActiveWorkbenchShell();
}
protected IRemoteFile getFirstSelectedRemoteFile() {
if (_selectedFiles.size() > 0) {
return (IRemoteFile) _selectedFiles.get(0);
}
return null;
}
protected ISubSystem getSubSystem() {
return getFirstSelectedRemoteFile().getParentRemoteFileSubSystem();
}
/* (non-Javadoc)
* @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
*/
public void run(IAction action) {
IRemoteFile selectedFile = getFirstSelectedRemoteFile();
String cmdToRun = "jar -tvf " + selectedFile.getAbsolutePath(); //$NON-NLS-1$
try {
runCommand(cmdToRun);
} catch (Exception e) {
String excType = e.getClass().getName();
MessageDialog.openError(getShell(), excType, excType + ": " + e.getLocalizedMessage()); //$NON-NLS-1$
e.printStackTrace();
}
}
public IRemoteCmdSubSystem getRemoteCmdSubSystem() {
//get the Command subsystem associated with the current host
IHost myHost = getSubSystem().getHost();
IRemoteCmdSubSystem[] subsys = RemoteCommandHelpers.getCmdSubSystems(myHost);
for (int i = 0; i &lt; subsys.length; i++) {
if (subsys[i].getSubSystemConfiguration().supportsCommands()) {
return subsys[i];
}
}
return null;
}
public void runCommand(String command) throws Exception {
IRemoteCmdSubSystem cmdss = getRemoteCmdSubSystem();
if (cmdss != null &amp;&amp; cmdss.isConnected()) {
// Run the command in a visible shell
RemoteCommandHelpers.runUniversalCommand(getShell(), command, ".", cmdss); //$NON-NLS-1$
} else {
MessageDialog.openError(getShell(), "No command subsystem", "Found no command subsystem");
}
}
public void selectionChanged(org.eclipse.jface.action.IAction action, org.eclipse.jface.viewers.ISelection selection) {
_selectedFiles.clear();
// store the selected jars to be used when running
Iterator theSet = ((IStructuredSelection) selection).iterator();
while (theSet.hasNext()) {
Object obj = theSet.next();
if (obj instanceof IRemoteFile) {
_selectedFiles.add(obj);
}
}
}
public void setActivePart(IAction action, IWorkbenchPart targetPart) {
}
}
</samp></pre>
</body>
</html>

View file

@ -1,228 +1,228 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
<meta name="copyright" content="Copyright (c) IBM Corporation and others 2002, 2006. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." >
<LINK REL="STYLESHEET" HREF="../../book.css" TYPE="text/css">
<title>TeamResourceAdapter Class After Editing</title>
</head>
<body>
<h1>TeamResourceAdapter Class After Editing</h1>
<pre><samp>
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;
<strong>import samples.RSESamplesPlugin;</strong>
<strong>import samples.subsystems.DeveloperSubSystem;</strong>
/**
* 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)
{
<strong>return RSESamplesPlugin.getDefault().getImageDescriptor("ICON_ID_TEAM");</strong>
}
/* (non-Javadoc)
* @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#getText(java.lang.Object)
*/
public String getText(Object element)
{
<strong>return ((TeamResource)element).getName();</strong>
}
/* (non-Javadoc)
* @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#getAbsoluteName(java.lang.Object)
*/
<a id="getAbsoluteName"/>public String getAbsoluteName(Object object)
{
<strong>TeamResource team = (TeamResource)object;
return "Team_"+team.getName();</strong>
}
/* (non-Javadoc)
* @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#getType(java.lang.Object)
*/
public String getType(Object element)
{
<strong>return RSESamplesPlugin.getResourceString("property.team_resource.type");</strong>
}
/* (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)
{
<strong>return true;</strong>
}
/* (non-Javadoc)
* @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#getChildren(java.lang.Object)
*/
public Object[] getChildren(Object element)
{
<strong>return ((TeamResource)element).getDevelopers();</strong>
}
/**
* @see org.eclipse.rse.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.
*/
<a id="canRename"/>public boolean canRename(Object element)
{
<strong>return true;</strong>
}
/**
* 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.
*/
<a id="doRename"/>public boolean doRename(Shell shell, Object element, String newName)
{
<strong>((TeamResource)element).setName(newName);
return true;</strong>
}
// --------------------------------------
// ISystemRemoteElementAdapter methods...
// --------------------------------------
/* (non-Javadoc)
* @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getAbsoluteParentName(java.lang.Object)
*/
public String getAbsoluteParentName(Object element)
{
<strong>return "root";</strong> // not really applicable as we have no unique hierarchy
}
/* (non-Javadoc)
* @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getSubSystemConfigurationId(java.lang.Object)
*/
public String getSubSystemConfigurationId(Object element)
{
<strong>return "samples.subsystems.factory";</strong> // as declared in extension in plugin.xml
}
/* (non-Javadoc)
* @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getRemoteTypeCategory(java.lang.Object)
*/
public String getRemoteTypeCategory(Object element)
{
<strong>return "developers";</strong> // Course grained. Same for all our remote resources.
}
/* (non-Javadoc)
* @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getRemoteType(java.lang.Object)
*/
public String getRemoteType(Object element)
{
<strong>return "team";</strong> // Fine grained. Unique to this resource type.
}
/* (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)
*/
<a id="refreshRemoteObject"/>public boolean refreshRemoteObject(Object oldElement, Object newElement)
{
<strong>TeamResource oldTeam = (TeamResource)oldElement;
TeamResource newTeam = (TeamResource)newElement;
newTeam.setName(oldTeam.getName());
return false;</strong> // 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)
*/
<a id="getNames"/>public String[] getRemoteParentNamesInUse(Shell shell, Object element)
throws Exception
{
<strong>DeveloperSubSystem ourSS = (DeveloperSubSystem)getSubSystem(element);
TeamResource[] allTeams = ourSS.getAllTeams();
String[] allNames = new String[allTeams.length];
for (int idx = 0; idx &lt; allTeams.length; idx++)
allNames[idx] = allTeams[idx].getName();
return allNames;</strong> // Return list of all team names
}
/* (non-Javadoc)
* @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#supportsUserDefinedActions(java.lang.Object)
*/
public boolean supportsUserDefinedActions(Object object) {
<strong>return false;</strong>
}
}
</samp></pre>
</body>
</html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
<meta name="copyright" content="Copyright (c) IBM Corporation and others 2002, 2006. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." >
<LINK REL="STYLESHEET" HREF="../../book.css" TYPE="text/css">
<title>TeamResourceAdapter Class After Editing</title>
</head>
<body>
<h1>TeamResourceAdapter Class After Editing</h1>
<pre><samp>
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;
<strong>import samples.RSESamplesPlugin;</strong>
<strong>import samples.subsystems.DeveloperSubSystem;</strong>
/**
* 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)
{
<strong>return RSESamplesPlugin.getDefault().getImageDescriptor("ICON_ID_TEAM");</strong>
}
/* (non-Javadoc)
* @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#getText(java.lang.Object)
*/
public String getText(Object element)
{
<strong>return ((TeamResource)element).getName();</strong>
}
/* (non-Javadoc)
* @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#getAbsoluteName(java.lang.Object)
*/
<a id="getAbsoluteName"></a>public String getAbsoluteName(Object object)
{
<strong>TeamResource team = (TeamResource)object;
return "Team_"+team.getName();</strong>
}
/* (non-Javadoc)
* @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#getType(java.lang.Object)
*/
public String getType(Object element)
{
<strong>return RSESamplesPlugin.getResourceString("property.team_resource.type");</strong>
}
/* (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)
{
<strong>return true;</strong>
}
/* (non-Javadoc)
* @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#getChildren(java.lang.Object)
*/
public Object[] getChildren(Object element)
{
<strong>return ((TeamResource)element).getDevelopers();</strong>
}
/**
* @see org.eclipse.rse.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.
*/
<a id="canRename"></a>public boolean canRename(Object element)
{
<strong>return true;</strong>
}
/**
* 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.
*/
<a id="doRename"></a>public boolean doRename(Shell shell, Object element, String newName)
{
<strong>((TeamResource)element).setName(newName);
return true;</strong>
}
// --------------------------------------
// ISystemRemoteElementAdapter methods...
// --------------------------------------
/* (non-Javadoc)
* @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getAbsoluteParentName(java.lang.Object)
*/
public String getAbsoluteParentName(Object element)
{
<strong>return "root";</strong> // not really applicable as we have no unique hierarchy
}
/* (non-Javadoc)
* @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getSubSystemConfigurationId(java.lang.Object)
*/
public String getSubSystemConfigurationId(Object element)
{
<strong>return "samples.subsystems.factory";</strong> // as declared in extension in plugin.xml
}
/* (non-Javadoc)
* @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getRemoteTypeCategory(java.lang.Object)
*/
public String getRemoteTypeCategory(Object element)
{
<strong>return "developers";</strong> // Course grained. Same for all our remote resources.
}
/* (non-Javadoc)
* @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getRemoteType(java.lang.Object)
*/
public String getRemoteType(Object element)
{
<strong>return "team";</strong> // Fine grained. Unique to this resource type.
}
/* (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)
*/
<a id="refreshRemoteObject"></a>public boolean refreshRemoteObject(Object oldElement, Object newElement)
{
<strong>TeamResource oldTeam = (TeamResource)oldElement;
TeamResource newTeam = (TeamResource)newElement;
newTeam.setName(oldTeam.getName());
return false;</strong> // 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)
*/
<a id="getNames"></a>public String[] getRemoteParentNamesInUse(Shell shell, Object element)
throws Exception
{
<strong>DeveloperSubSystem ourSS = (DeveloperSubSystem)getSubSystem(element);
TeamResource[] allTeams = ourSS.getAllTeams();
String[] allNames = new String[allTeams.length];
for (int idx = 0; idx &lt; allTeams.length; idx++)
allNames[idx] = allTeams[idx].getName();
return allNames;</strong> // Return list of all team names
}
/* (non-Javadoc)
* @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#supportsUserDefinedActions(java.lang.Object)
*/
public boolean supportsUserDefinedActions(Object object) {
<strong>return false;</strong>
}
}
</samp></pre>
</body>
</html>

View file

@ -1,105 +1,105 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
<meta name="copyright" content="Copyright (c) IBM Corporation and others 2002, 2007. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." >
<LINK REL="STYLESHEET" HREF="../../book.css" TYPE="text/css">
<title>Creating a Plug-in Project</title>
</head>
<body>
<h1>Creating a Plug-in Project</h1>
<p>To use any Eclipse extension point, including those defined by the Remote System Explorer, you must first create a plug-in project using the plug-in development environment (PDE), which you will do shortly. At its simplest, a plug-in project requires a <tt>MANIFEST.MF</tt> file describing the plugin and its dependencies and, if extending the workbench a <samp>plugin.xml</samp> file identifying the extension points being implemented, and a set of Java classes implementing those extension points. There is usually also a plug-in class file that is used as the overall manager of the project, and point of integration that other classes can rely on.</p>
<p><i>If you already have a plugin project, you will need to update it slightly to make it extend SystemBasePlugin and add the few methods it requires. You may wish to examine these steps to see what methods to add. The Eclipse environment will keep your classpaths and plugin dependecies in sync for you.</i></p>
<p>Eclipse supplies a number of plug-in project templates, which generate a number of project files that illustrate examples of various Eclipse extension points. While you are free to pick one of these, or indeed start with any existing plug-in project if you have one, in the RSE tutorials everything is created by hand so as to keep focused on the RSE-required classes and files.</p>
<p>The following tutorial uses numbered steps to indicate where you are required to do something as you follow along.</p>
<h2>Step By Step: Creating an RSE Plug-in Project</h2>
<ol>
<li>Select <b>File-&gt;New-&gt;Project.</b></li>
<li>In the dialog box select the <b>Plug-in Project</b> wizard. Click <b>Next &gt;</b>.
<br /><img src="pdeProj_1.png">
</li>
<li>In the first page of the wizard enter <b>&quot;RSESamples&quot;</b> for the project name (without the quotes). Click <b>Next &gt;</b>.
<br /><img src="pdeProj_wiz_page1.png">
</li>
<li>In the second page of the wizard enter your company for the <b>Plug-in Provider</b>, change the <b>Activator</b> to be "rsesamples.RSESamplesPlugin", and click <b>Next &gt;</b>.
<br /><img src="pdeProj_wiz_page2.png">
</li>
<li>In the third page of the wizard uncheck the "Create a plug-in using one of the templates" checkbox and click <b>Finish</b>.
<br /><img src="pdeProj_wiz_page3.png">
</li>
<li>Your new plugin project is created and visible in the Package Explorer of the Plug-in Development perspective. Your new plugin properties are also open in the plug-in editor.</li>
<li>Go to the dependencies tab of the plug-in editor and add the following plugins to the list:
<ul>
<li>org.eclipse.core.resources</li>
<li>org.eclipse.rse.ui</li>
<li>org.eclipse.rse.services</li>
<li>org.eclipse.rse.files.ui</li>
<li>org.eclipse.rse.shells.ui</li>
<li>org.eclipse.rse.subsystems.files.core</li>
<li>org.eclipse.rse.subsystems.shells.core</li>
</ul>
</li>
<li>Now go to the MANIFEST.MF tab of the plugin properties.
This shows the source for the MANIFEST.MF file associated with this plugin.
Change the Bundle-SymbolicName line adding a singleton:=true directive.
<pre><code>
Bundle-SymbolicName:RSESamples;singleton:=true
</code></pre>
This allows us to add extensions to the plugin at a later point.
Save the plugin properties and close the editor.
</li>
<li>
Right-click on the RSESamples project and create a plugin.xml file.
Normally this would be created if you used a template to create your plugin.
We will use this file to add extensions to RSE but for now it will just be a skeleton with the following contents:
<pre><code>
&lt;plugin&gt;
&lt;/plugin&gt;
</code></pre>
Add the lines above to the empty plugin.xml file and save it.
</li>
<li>Expand the <b>src</b> folder, then the <b>rsesamples</b> package folder, and double-click on <samp><b>RSESamplesPlugin.java</b></samp> to edit this class.
Change it as described below. Reference the source <a href="RSESamplesPlugin.html">here</a> for the details.
<ul>
<li>Extend SystemBasePlugin instead of AbstractUIPlugin</li>
<li>Add the declaration for resourceBundle</li>
<li>Add the declaration for messageFile</li>
<li>Invoke the superclass constructor from this constructor</li>
<li>Add the initializeImageRegistry() method</li>
<li>Add the getMessageFile() method</li>
<li>Add the getResourceBundle() method</li>
<li>Add the static getWorkspace() method</li>
<li>Add the static getResourceString(String) method</li>
<li>Add the static getPluginMessageFile() method</li>
<li>Add the static getPluginMessage(String) method</li>
</ul>
</li>
<li>Create the project's resources file for translatable strings: right-click on the <b>RSESamples</b> project and select <b>New-&gt;File</b> to open the <b>New File</b> wizard. Enter <samp><b>rseSamplesResources.properties</b></samp> for the file name, as was specified in the call to <samp>loadResourceBundle</samp> in the plug-in class's constructor. Press <b>Finish</b> to create the file. You will populate as you go through the tutorials, so for now just <i>close</i> the editor opened for the file.</li>
<li>Create the project's RSE-style messages file for translatable messages: right-click on the <b>RSESamples</b> project and select <b>New-&gt;File</b> to get the <b>New File</b> wizard. Enter <samp><b>rseSamplesMessages.xml</b></samp> for the file name, as was specified in the call to <samp>loadMessageFile</samp> in the plug-in class's constructor. Press <b>Finish</b> to create the file. You will see the XML editor open for the new file. Press the <b>Source</b> tab at the bottom of the editor, and enter the following lines (so that you can add messages to the file later on):
<pre><code>
&lt;?xml version=&quot;1.0&quot; encoding='UTF-8'?&gt;
&lt;!DOCTYPE MessageFile SYSTEM &quot;../org.eclipse.rse.ui/messageFile.dtd&quot;&gt;
&lt;!-- This is a message file used by SystemMessage and SystemMessageDialog --&gt;
&lt;<b>MessageFile</b> Version=&quot;1.0&quot;&gt;
&lt;<b>Component</b> Name=&quot;RSE Samples&quot; Abbr=&quot;RSS&quot;&gt;
&lt;<b>Subcomponent</b> Name=&quot;General&quot; Abbr=&quot;G&quot;&gt;
&lt;<b>MessageList</b>&gt;
&lt;<b>Message</b> ID=&quot;1001&quot; Indicator=&quot;E&quot;&gt;
&lt;<b>LevelOne</b>&gt;Sample message&lt;/<b>LevelOne</b>&gt;
&lt;<b>LevelTwo</b>&gt;This is a sample with one substitution variable: %1&lt;/<b>LevelTwo</b>&gt;
&lt;/<b>Message</b>&gt;
&lt;/<b>MessageList</b>&gt;
&lt;/<b>Subcomponent</b>&gt;
&lt;/<b>Component</b>&gt;
&lt;/<b>MessageFile</b>&gt;
</code></pre>
Save and close the file.
</li>
<li>Your plugin is created and you are ready to go. Now you only need to add the code to implement the extension points.
</li>
</ol>
</body>
</html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
<meta name="copyright" content="Copyright (c) IBM Corporation and others 2002, 2007. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." >
<LINK REL="STYLESHEET" HREF="../../book.css" TYPE="text/css">
<title>Creating a Plug-in Project</title>
</head>
<body>
<h1>Creating a Plug-in Project</h1>
<p>To use any Eclipse extension point, including those defined by the Remote System Explorer, you must first create a plug-in project using the plug-in development environment (PDE), which you will do shortly. At its simplest, a plug-in project requires a <tt>MANIFEST.MF</tt> file describing the plugin and its dependencies and, if extending the workbench a <samp>plugin.xml</samp> file identifying the extension points being implemented, and a set of Java classes implementing those extension points. There is usually also a plug-in class file that is used as the overall manager of the project, and point of integration that other classes can rely on.</p>
<p><i>If you already have a plugin project, you will need to update it slightly to make it extend SystemBasePlugin and add the few methods it requires. You may wish to examine these steps to see what methods to add. The Eclipse environment will keep your classpaths and plugin dependecies in sync for you.</i></p>
<p>Eclipse supplies a number of plug-in project templates, which generate a number of project files that illustrate examples of various Eclipse extension points. While you are free to pick one of these, or indeed start with any existing plug-in project if you have one, in the RSE tutorials everything is created by hand so as to keep focused on the RSE-required classes and files.</p>
<p>The following tutorial uses numbered steps to indicate where you are required to do something as you follow along.</p>
<h2>Step By Step: Creating an RSE Plug-in Project</h2>
<ol>
<li>Select <b>File-&gt;New-&gt;Project.</b></li>
<li>In the dialog box select the <b>Plug-in Project</b> wizard. Click <b>Next &gt;</b>.
<br><img src="pdeProj_1.png">
</li>
<li>In the first page of the wizard enter <b>&quot;RSESamples&quot;</b> for the project name (without the quotes). Click <b>Next &gt;</b>.
<br><img src="pdeProj_wiz_page1.png">
</li>
<li>In the second page of the wizard enter your company for the <b>Plug-in Provider</b>, change the <b>Activator</b> to be "rsesamples.RSESamplesPlugin", and click <b>Next &gt;</b>.
<br><img src="pdeProj_wiz_page2.png">
</li>
<li>In the third page of the wizard uncheck the "Create a plug-in using one of the templates" checkbox and click <b>Finish</b>.
<br><img src="pdeProj_wiz_page3.png">
</li>
<li>Your new plugin project is created and visible in the Package Explorer of the Plug-in Development perspective. Your new plugin properties are also open in the plug-in editor.</li>
<li>Go to the dependencies tab of the plug-in editor and add the following plugins to the list:
<ul>
<li>org.eclipse.core.resources</li>
<li>org.eclipse.rse.ui</li>
<li>org.eclipse.rse.services</li>
<li>org.eclipse.rse.files.ui</li>
<li>org.eclipse.rse.shells.ui</li>
<li>org.eclipse.rse.subsystems.files.core</li>
<li>org.eclipse.rse.subsystems.shells.core</li>
</ul>
</li>
<li>Now go to the MANIFEST.MF tab of the plugin properties.
This shows the source for the MANIFEST.MF file associated with this plugin.
Change the Bundle-SymbolicName line adding a singleton:=true directive.
<pre><code>
Bundle-SymbolicName:RSESamples;singleton:=true
</code></pre>
This allows us to add extensions to the plugin at a later point.
Save the plugin properties and close the editor.
</li>
<li>
Right-click on the RSESamples project and create a plugin.xml file.
Normally this would be created if you used a template to create your plugin.
We will use this file to add extensions to RSE but for now it will just be a skeleton with the following contents:
<pre><code>
&lt;plugin&gt;
&lt;/plugin&gt;
</code></pre>
Add the lines above to the empty plugin.xml file and save it.
</li>
<li>Expand the <b>src</b> folder, then the <b>rsesamples</b> package folder, and double-click on <samp><b>RSESamplesPlugin.java</b></samp> to edit this class.
Change it as described below. Reference the source <a href="RSESamplesPlugin.html">here</a> for the details.
<ul>
<li>Extend SystemBasePlugin instead of AbstractUIPlugin</li>
<li>Add the declaration for resourceBundle</li>
<li>Add the declaration for messageFile</li>
<li>Invoke the superclass constructor from this constructor</li>
<li>Add the initializeImageRegistry() method</li>
<li>Add the getMessageFile() method</li>
<li>Add the getResourceBundle() method</li>
<li>Add the static getWorkspace() method</li>
<li>Add the static getResourceString(String) method</li>
<li>Add the static getPluginMessageFile() method</li>
<li>Add the static getPluginMessage(String) method</li>
</ul>
</li>
<li>Create the project's resources file for translatable strings: right-click on the <b>RSESamples</b> project and select <b>New-&gt;File</b> to open the <b>New File</b> wizard. Enter <samp><b>rseSamplesResources.properties</b></samp> for the file name, as was specified in the call to <samp>loadResourceBundle</samp> in the plug-in class's constructor. Press <b>Finish</b> to create the file. You will populate as you go through the tutorials, so for now just <i>close</i> the editor opened for the file.</li>
<li>Create the project's RSE-style messages file for translatable messages: right-click on the <b>RSESamples</b> project and select <b>New-&gt;File</b> to get the <b>New File</b> wizard. Enter <samp><b>rseSamplesMessages.xml</b></samp> for the file name, as was specified in the call to <samp>loadMessageFile</samp> in the plug-in class's constructor. Press <b>Finish</b> to create the file. You will see the XML editor open for the new file. Press the <b>Source</b> tab at the bottom of the editor, and enter the following lines (so that you can add messages to the file later on):
<pre><code>
&lt;?xml version=&quot;1.0&quot; encoding='UTF-8'?&gt;
&lt;!DOCTYPE MessageFile SYSTEM &quot;../org.eclipse.rse.ui/messageFile.dtd&quot;&gt;
&lt;!-- This is a message file used by SystemMessage and SystemMessageDialog --&gt;
&lt;<b>MessageFile</b> Version=&quot;1.0&quot;&gt;
&lt;<b>Component</b> Name=&quot;RSE Samples&quot; Abbr=&quot;RSS&quot;&gt;
&lt;<b>Subcomponent</b> Name=&quot;General&quot; Abbr=&quot;G&quot;&gt;
&lt;<b>MessageList</b>&gt;
&lt;<b>Message</b> ID=&quot;1001&quot; Indicator=&quot;E&quot;&gt;
&lt;<b>LevelOne</b>&gt;Sample message&lt;/<b>LevelOne</b>&gt;
&lt;<b>LevelTwo</b>&gt;This is a sample with one substitution variable: %1&lt;/<b>LevelTwo</b>&gt;
&lt;/<b>Message</b>&gt;
&lt;/<b>MessageList</b>&gt;
&lt;/<b>Subcomponent</b>&gt;
&lt;/<b>Component</b>&gt;
&lt;/<b>MessageFile</b>&gt;
</code></pre>
Save and close the file.
</li>
<li>Your plugin is created and you are ready to go. Now you only need to add the code to implement the extension points.
</li>
</ol>
</body>
</html>

View file

@ -97,7 +97,7 @@ Use the "Source -&gt; Organize Imports" context menu item to add the appropriate
<pre><code>
public void runCommand(String command) {
IRemoteCmdSubSystem cmdss = getRemoteCmdSubSystem();
if (cmdss != null && cmdss.isConnected()) {
if (cmdss != null &amp;&amp; cmdss.isConnected()) {
// Run the command in a visible shell
RemoteCommandHelpers.runUniversalCommand(getShell(), command, ".", cmdss); //$NON-NLS-1$
} else {
@ -111,7 +111,7 @@ Use the "Source -&gt; Organize Imports" context menu item to add the appropriate
public IRemoteCmdSubSystem getRemoteCmdSubSystem() {
IHost myHost = getSubSystem().getHost();
IRemoteCmdSubSystem[] subsys = RemoteCommandHelpers.getCmdSubSystems(myHost);
for (int i = 0; i < subsys.length; i++) {
for (int i = 0; i &lt; subsys.length; i++) {
if (subsys[i].getSubSystemConfiguration().supportsCommands()) {
return subsys[i];
}

View file

@ -14,7 +14,7 @@
extend the RSE:
<ul>
<li>Popup menu actions for remote resources should now be contributed via the standard Eclipse extension point, <tt>org.eclipse.ui.popupMenus</tt>. An example of this usage is provided in the <tt>org.eclipse.rse.examples.tutorial</tt> plug-in.
<li>Property pages should for remote resources now be contributed via the standard Eclipse extension point, <tt>org.eclipse.ui.propertyPages<tt>. An example of this usage is provided in the <tt>org.eclipse.rse.examples.tutorial</tt> plug-in.
<li>Property pages should for remote resources now be contributed via the standard Eclipse extension point, <tt>org.eclipse.ui.propertyPages</tt>. An example of this usage is provided in the <tt>org.eclipse.rse.examples.tutorial</tt> plug-in.
<li><a href="tutorial/subsystem.html">Creating a subsystem configuration</a> for working with remote resources, using the <a href="plugin/subsystem.html">org.eclipse.rse.core.subsystemConfigurations</a> extension point.
</ul>
<p>The source code for all tutorials is available in the RSE-examples package, which

View file

@ -10,6 +10,6 @@
</head>
<body>
<h1>Installing The Examples
<h1>Installing The Examples</h1>
</body>
</html>