From a4743e1ac9a4c27e92665e758c2146324cd56f6c Mon Sep 17 00:00:00 2001 From: David Dykstal Date: Thu, 14 Dec 2006 22:04:00 +0000 Subject: [PATCH] [142968] fixed some "com.ibm.*" strings in the tutorial. --- .../tutorial/FolderInfoPropertyPage2.html | 116 +++++++++++------- .../guide/tutorial/ShowJarContents2.html | 52 +++++--- .../guide/tutorial/popup.html | 27 +++- 3 files changed, 129 insertions(+), 66 deletions(-) diff --git a/rse/doc/org.eclipse.rse.doc.isv/guide/tutorial/FolderInfoPropertyPage2.html b/rse/doc/org.eclipse.rse.doc.isv/guide/tutorial/FolderInfoPropertyPage2.html index 40b45e2e818..0ed02dc049e 100755 --- a/rse/doc/org.eclipse.rse.doc.isv/guide/tutorial/FolderInfoPropertyPage2.html +++ b/rse/doc/org.eclipse.rse.doc.isv/guide/tutorial/FolderInfoPropertyPage2.html @@ -15,22 +15,26 @@

 package samples.ui.propertypages;
 
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.events.*;
-
-import RSESamples.*;
 import org.eclipse.rse.files.ui.propertypages.SystemAbstractRemoteFilePropertyPageExtensionAction;
-import com.ibm.etools.systems.subsystems.*;
-import com.ibm.etools.systems.core.ui.*;
+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 java.util.*;
+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 
+public class FolderInfoPropertyPage
+	extends SystemAbstractRemoteFilePropertyPageExtensionAction
 	implements SelectionListener
 {
 	// gui widgets...
@@ -47,33 +51,45 @@ public class FolderInfoPropertyPage
 	/**
 	 * Constructor for FolderInfoPropertyPage.
 	 */
-	public FolderInfoPropertyPage()
+	public FolderInfoPropertyPage()
 	{
 		super();
 	}
 
 	// --------------------------
-	// Parent method overrides...
+	// Parent method overrides...
 	// --------------------------
 	
-	/**
-	 * @see org.eclipse.rse.ui.propertypages.SystemBasePropertyPage#createContentArea(Composite)
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.rse.files.ui.propertypages.SystemAbstractRemoteFilePropertyPageExtensionAction#createContentArea(org.eclipse.swt.widgets.Composite)
 	 */
-	protected Control createContentArea(Composite parent)
+	protected Control createContentArea(Composite parent)
 	{
 		Composite composite = SystemWidgetHelpers.createComposite(parent, 2);
-		ResourceBundle rb = RSESamplesPlugin.getDefault().getResourceBundle();
 		// draw the gui		
-		sizeLabel = SystemWidgetHelpers.createLabeledLabel(composite, rb, "pp.size.", false);
-		filesLabel = SystemWidgetHelpers.createLabeledLabel(composite, rb, "pp.files.", false);
-		foldersLabel = SystemWidgetHelpers.createLabeledLabel(composite, rb, "pp.folders.", false);
-		stopButton = SystemWidgetHelpers.createPushButton(composite, null, rb, "pp.stopButton.");
+		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"));
+		// 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();
@@ -87,8 +103,9 @@ public class FolderInfoPropertyPage
 	/**
 	 * Intercept from PreferencePage. Called when user presses Cancel button.
 	 * We stop the background thread.
+	 * @see org.eclipse.jface.preference.PreferencePage#performCancel()
 	 */
-	public boolean performCancel() 
+	public boolean performCancel() 
 	{
 		killThread();
 		return true;
@@ -99,7 +116,7 @@ public class FolderInfoPropertyPage
 	 * If the user presses the X to close this dialog, we 
 	 *  need to stop that background thread.
 	 */
-	public void dispose()
+	public void dispose()
 	{
 		killThread();
 		super.dispose();
@@ -109,9 +126,9 @@ public class FolderInfoPropertyPage
 	 * Private method to kill our background thread.
 	 * Control doesn't return until it ends.
 	 */
-	private void killThread()
+	private void killThread()
 	{
-		if (!stopped && workerThread.isAlive())
+		if (!stopped && workerThread.isAlive())
 		{
 		    stopped = true;
 		    try {
@@ -121,13 +138,14 @@ public class FolderInfoPropertyPage
 	}
 
 	// -------------------------------------------
-	// Methods from SelectionListener interface...
+	// Methods from SelectionListener interface...
 	// -------------------------------------------
 	
 	/**
 	 * From SelectionListener
+	 * @see SelectionListener#widgetSelected(SelectionEvent)
 	 */
-	public void widgetSelected(SelectionEvent event) 
+	public void widgetSelected(SelectionEvent event) 
 	{
 		if (event.getSource() == stopButton)
 		{
@@ -137,27 +155,29 @@ public class FolderInfoPropertyPage
 	}
 	/**
 	 * From SelectionListener
+	 * @see SelectionListener#widgetDefaultSelected(SelectionEvent)
 	 */
-	public void widgetDefaultSelected(SelectionEvent event) {}
-	
+	public void widgetDefaultSelected(SelectionEvent event)
+	{
+	}
 
 	// ----------------
-	// Inner classes...
+	// Inner classes...
 	// ----------------
 	/**
 	 * Inner class encapsulating the background work to be done, so it may be executed
 	 *  in background thread.
 	 */
-	private class RunnableClass extends Thread
+	private class RunnableClass extends Thread
 	{
 		IRemoteFile inputFolder;
 		
-		RunnableClass(IRemoteFile inputFolder)
+		RunnableClass(IRemoteFile inputFolder)
 		{
 			this.inputFolder = inputFolder;
 		}
 		
-		public void run()
+		public void run()
 		{
 			if (stopped)
 			  return;
@@ -174,12 +194,14 @@ public class FolderInfoPropertyPage
 		 * Recursively walk a folder, updating the running tallies. 
 		 * Update the GUI after processing each subfolder.
 		 */
-		private void walkFolder(IRemoteFile currFolder)
+		private void walkFolder(IRemoteFile currFolder)
 		{
-			IRemoteFile[] folders = currFolder.getParentRemoteFileSubSystem().listFoldersAndFiles(currFolder);
-			if ((folders != null) && (folders.length>0))
+			try
 			{
-				for (int idx=0; !stopped && (idx<folders.length); idx++)
+			IRemoteFile[] folders = currFolder.getParentRemoteFileSubSystem().listFoldersAndFiles( currFolder, null);
+			if ((folders != null) && (folders.length>0))
+			{
+				for (int idx=0; !stopped && (idx<folders.length); idx++)
 				{
 					// is this a folder? 
 					if (folders[idx].isDirectory())
@@ -196,17 +218,22 @@ public class FolderInfoPropertyPage
 					}
 				}
 			}
-		} // end of walkFolder method
+			}
+			catch (SystemMessageException e)
+			{
+				
+			}
+		} // end of walkFolder method
 
-	} // end of inner class
+	} // end of inner class
 	
 	/**
 	 * Inner class encapsulating the GUI work to be done from the
 	 *  background thread.
 	 */
-	private class RunnableGUIClass implements Runnable
+	private class RunnableGUIClass implements Runnable
 	{
-		public void run()
+		public void run()
 		{
 			if (stopButton.isDisposed())
 			  return; 
@@ -220,7 +247,7 @@ public class FolderInfoPropertyPage
 			{				
 				setValid(true); // re-enable OK button								
 				stopButton.setEnabled(false); // disable Stop button				
-				clearMessage(); // clear "Processing..." message
+				clearMessage(); // clear "Processing..." message
 			}			  
 		}
 	}	
@@ -229,14 +256,13 @@ public class FolderInfoPropertyPage
 	/**
 	 * Update the GUI with the current status
 	 */
-	private void updateGUI()
+	private void updateGUI()
 	{
 		Display.getDefault().asyncExec(guiUpdater);
 	}
 
+
 }
-
-
 

diff --git a/rse/doc/org.eclipse.rse.doc.isv/guide/tutorial/ShowJarContents2.html b/rse/doc/org.eclipse.rse.doc.isv/guide/tutorial/ShowJarContents2.html index 7464bd93eab..a316ea3ddae 100755 --- a/rse/doc/org.eclipse.rse.doc.isv/guide/tutorial/ShowJarContents2.html +++ b/rse/doc/org.eclipse.rse.doc.isv/guide/tutorial/ShowJarContents2.html @@ -15,37 +15,49 @@

 package samples.ui.actions;
 
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.rse.core.model.IHost;
 import org.eclipse.rse.files.ui.actions.SystemAbstractRemoteFilePopupMenuExtensionAction;
-import com.ibm.etools.systems.subsystems.*;
+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;
 
-/**
- * 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
-	extends SystemAbstractRemoteFilePopupMenuExtensionAction
-{
+public class ShowJarContents2 extends SystemAbstractRemoteFilePopupMenuExtensionAction {
 
-	/**
-	 * Constructor for ShowJarContents.
-	 */
-	public ShowJarContents()
-	{
+	public ShowJarContents2() {
 		super();
 	}
 
+	public void run() {
+		IRemoteFile selectedFile = getFirstSelectedRemoteFile();
+		String cmdToRun = "jar -tvf " + selectedFile.getAbsolutePath();
+		runCommand(cmdToRun);
+	}
+
+	private void runCommand(String command) {
+		IRemoteCmdSubSystem cmdss = getRemoteCmdSubSystem();
+		if (cmdss != null && cmdss.isConnected()) {
+			RemoteCommandHelpers.runUniversalCommand(getShell(), command, ".", cmdss);
+		} else {
+			MessageDialog.openError(getShell(), "No command subsystem", "Found no command subsystem");
+		}
+	}
+	
 	/**
-	 * @see org.eclipse.rse.ui.actions.SystemAbstractPopupMenuExtensionAction#run()
+	 * Gets the Command subsystem associated with the current host
 	 */
-	public void run()
-	{
-		IRemoteFile selectedFile = getFirstSelectedRemoteFile();
-		String cmdToRun = "jar -tvf " + selectedFile.getAbsolutePath();
-		runCommand(cmdToRun);
+	private IRemoteCmdSubSystem getRemoteCmdSubSystem() {
+		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;
 	}
 
 }
-
 

diff --git a/rse/doc/org.eclipse.rse.doc.isv/guide/tutorial/popup.html b/rse/doc/org.eclipse.rse.doc.isv/guide/tutorial/popup.html index 68e1b827574..bfdbcdd105f 100755 --- a/rse/doc/org.eclipse.rse.doc.isv/guide/tutorial/popup.html +++ b/rse/doc/org.eclipse.rse.doc.isv/guide/tutorial/popup.html @@ -68,13 +68,38 @@ Press Finish to create the ShowJarC
  • Edit the generated ShowJarContents.java file as follows:
      -
    1. Add import statement for import com.ibm.etools.systems.subsystems.*;
    2. Add the following three statements to the body of the run() method:
    3. 
       		IRemoteFile selectedFile = getFirstSelectedRemoteFile();
       		String cmdToRun = "jar -tvf " + selectedFile.getAbsolutePath();
       		runCommand(cmdToRun);  
         
      +
    4. Add the following two methods to find the subsystem and run the command:
    5. +
      
      +	private void runCommand(String command) {
      +		IRemoteCmdSubSystem cmdss = getRemoteCmdSubSystem();
      +		if (cmdss != null && cmdss.isConnected()) {
      +			RemoteCommandHelpers.runUniversalCommand(getShell(), command, ".", cmdss);
      +		} else {
      +			MessageDialog.openError(getShell(), "No command subsystem", "Found no command subsystem");
      +		}
      +	}
      +	
      +	/**
      +	 * Gets the Command subsystem associated with the current host
      +	 */
      +	private IRemoteCmdSubSystem getRemoteCmdSubSystem() {
      +		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;
      +	}
      +  
      +
    6. User the "Source -> Organize Imports" context menu item to add the appropriate import statements.
    The final result after editing is shown
    here.