View | Details | Raw Unified | Return to bug 203124 | Differences between
and this patch

Collapse All | Expand All

(-)guide/tutorial/DeveloperFilterStringEditPane.html (-210 / +210 lines)
Lines 1-210 Link Here
1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2
<html>
2
<html>
3
3
4
<head>
4
<head>
5
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
5
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
6
<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
6
<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
7
<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." >
7
<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." >
8
<LINK REL="STYLESHEET" HREF="../../book.css" TYPE="text/css">
8
<LINK REL="STYLESHEET" HREF="../../book.css" TYPE="text/css">
9
<title>DeveloperFilterStringEditPane Class After Editing</title>
9
<title>DeveloperFilterStringEditPane Class After Editing</title>
10
</head>
10
</head>
11
11
12
<body>
12
<body>
13
<h1>DeveloperFilterStringEditPane Class After Editing</h1>
13
<h1>DeveloperFilterStringEditPane Class After Editing</h1>
14
<pre><samp>
14
<pre><samp>
15
package samples.subsystems;
15
package samples.subsystems;
16
16
17
<strong>import org.eclipse.rse.services.clientserver.messages.SystemMessage;
17
<strong>import org.eclipse.rse.services.clientserver.messages.SystemMessage;
18
import org.eclipse.rse.ui.SystemWidgetHelpers;</strong>
18
import org.eclipse.rse.ui.SystemWidgetHelpers;</strong>
19
import org.eclipse.rse.ui.filters.SystemFilterStringEditPane;
19
import org.eclipse.rse.ui.filters.SystemFilterStringEditPane;
20
<strong>import org.eclipse.swt.events.ModifyEvent;
20
<strong>import org.eclipse.swt.events.ModifyEvent;
21
import org.eclipse.swt.events.ModifyListener;
21
import org.eclipse.swt.events.ModifyListener;
22
import org.eclipse.swt.layout.GridLayout;
22
import org.eclipse.swt.layout.GridLayout;
23
import org.eclipse.swt.widgets.Composite;
23
import org.eclipse.swt.widgets.Composite;
24
import org.eclipse.swt.widgets.Control;
24
import org.eclipse.swt.widgets.Control;
25
import org.eclipse.swt.widgets.Shell;
25
import org.eclipse.swt.widgets.Shell;
26
import org.eclipse.swt.widgets.Text;</strong>
26
import org.eclipse.swt.widgets.Text;</strong>
27
27
28
<strong>import samples.RSESamplesPlugin;</strong>
28
<strong>import samples.RSESamplesPlugin;</strong>
29
29
30
/**
30
/**
31
 * Our specialized filter string edit pane for developer filters.
31
 * Our specialized filter string edit pane for developer filters.
32
 */
32
 */
33
public class DeveloperFilterStringEditPane extends SystemFilterStringEditPane {
33
public class DeveloperFilterStringEditPane extends SystemFilterStringEditPane {
34
34
35
	// gui widgets
35
	// gui widgets
36
	<strong>private Text textTeam, textDevr;</strong>
36
	<strong>private Text textTeam, textDevr;</strong>
37
37
38
	/**
38
	/**
39
	 * Constructor for DeveloperFilterStringEditPane.
39
	 * Constructor for DeveloperFilterStringEditPane.
40
	 * @param shell - parent window
40
	 * @param shell - parent window
41
	 */
41
	 */
42
	public DeveloperFilterStringEditPane(Shell shell)
42
	public DeveloperFilterStringEditPane(Shell shell)
43
	{
43
	{
44
		super(shell);
44
		super(shell);
45
	}
45
	}
46
46
47
	/**
47
	/**
48
	 * Override of parent method.
48
	 * Override of parent method.
49
	 * This is where we populate the client area.
49
	 * This is where we populate the client area.
50
	 * @param parent - the composite that will be the parent of the returned client area composite
50
	 * @param parent - the composite that will be the parent of the returned client area composite
51
	 * @return Control - a client-area composite populated with widgets.
51
	 * @return Control - a client-area composite populated with widgets.
52
	 * 
52
	 * 
53
	 * @see org.eclipse.rse.ui.SystemWidgetHelpers
53
	 * @see org.eclipse.rse.ui.SystemWidgetHelpers
54
	 */
54
	 */
55
	<strong>public Control createContents(Composite parent) 
55
	<strong>public Control createContents(Composite parent) 
56
	{		
56
	{		
57
		// Inner composite
57
		// Inner composite
58
		int nbrColumns = 1;
58
		int nbrColumns = 1;
59
		Composite composite_prompts = SystemWidgetHelpers.createComposite(parent, nbrColumns);	
59
		Composite composite_prompts = SystemWidgetHelpers.createComposite(parent, nbrColumns);	
60
		((GridLayout)composite_prompts.getLayout()).marginWidth = 0;
60
		((GridLayout)composite_prompts.getLayout()).marginWidth = 0;
61
		
61
		
62
		// CREATE TEAM-PARENT PROMPT
62
		// CREATE TEAM-PARENT PROMPT
63
		textTeam = SystemWidgetHelpers.createLabeledTextField(
63
		textTeam = SystemWidgetHelpers.createLabeledTextField(
64
			composite_prompts,
64
			composite_prompts,
65
			null,
65
			null,
66
			RSESamplesPlugin.getResourceString("filter.devr.teamprompt.label"), //$NON-NLS-1$
66
			RSESamplesPlugin.getResourceString("filter.devr.teamprompt.label"), //$NON-NLS-1$
67
			RSESamplesPlugin.getResourceString("filter.devr.teamprompt.tooltip") //$NON-NLS-1$
67
			RSESamplesPlugin.getResourceString("filter.devr.teamprompt.tooltip") //$NON-NLS-1$
68
		); 
68
		); 
69
69
70
		// CREATE DEVELOPER PROMPT
70
		// CREATE DEVELOPER PROMPT
71
		textDevr = SystemWidgetHelpers.createLabeledTextField(
71
		textDevr = SystemWidgetHelpers.createLabeledTextField(
72
			composite_prompts,
72
			composite_prompts,
73
			null,
73
			null,
74
			RSESamplesPlugin.getResourceString("filter.devr.devrprompt.label"), //$NON-NLS-1$
74
			RSESamplesPlugin.getResourceString("filter.devr.devrprompt.label"), //$NON-NLS-1$
75
			RSESamplesPlugin.getResourceString("filter.devr.devrprompt.tooltip") //$NON-NLS-1$
75
			RSESamplesPlugin.getResourceString("filter.devr.devrprompt.tooltip") //$NON-NLS-1$
76
		); 
76
		); 
77
		
77
		
78
		resetFields();
78
		resetFields();
79
		doInitializeFields();
79
		doInitializeFields();
80
		  		  
80
		  		  
81
		// add keystroke listeners...
81
		// add keystroke listeners...
82
		textTeam.addModifyListener(
82
		textTeam.addModifyListener(
83
			new ModifyListener() 
83
			new ModifyListener() 
84
			{
84
			{
85
				public void modifyText(ModifyEvent e) 
85
				public void modifyText(ModifyEvent e) 
86
				{
86
				{
87
					validateStringInput();
87
					validateStringInput();
88
				}
88
				}
89
			}
89
			}
90
		);		
90
		);		
91
		textDevr.addModifyListener(
91
		textDevr.addModifyListener(
92
			new ModifyListener() 
92
			new ModifyListener() 
93
			{
93
			{
94
				public void modifyText(ModifyEvent e) 
94
				public void modifyText(ModifyEvent e) 
95
				{
95
				{
96
					validateStringInput();
96
					validateStringInput();
97
				}
97
				}
98
			}
98
			}
99
		);		
99
		);		
100
		return composite_prompts;
100
		return composite_prompts;
101
	}</strong>
101
	}</strong>
102
102
103
	/**
103
	/**
104
	 * Override of parent method.
104
	 * Override of parent method.
105
	 * Return the control to recieve initial focus. 
105
	 * Return the control to recieve initial focus. 
106
	 */
106
	 */
107
	<strong>public Control getInitialFocusControl()
107
	<strong>public Control getInitialFocusControl()
108
	{
108
	{
109
		return textTeam;
109
		return textTeam;
110
	}</strong>	
110
	}</strong>	
111
111
112
	/**
112
	/**
113
	 * Override of parent method.
113
	 * Override of parent method.
114
	 * Initialize the input fields based on the inputFilterString, and perhaps refProvider.
114
	 * Initialize the input fields based on the inputFilterString, and perhaps refProvider.
115
	 * This can be called before createContents, so test for null widgets first!
115
	 * This can be called before createContents, so test for null widgets first!
116
	 * Prior to this being called, resetFields is called to set the initial default state prior to input
116
	 * Prior to this being called, resetFields is called to set the initial default state prior to input
117
	 */		
117
	 */		
118
	<strong>protected void doInitializeFields()
118
	<strong>protected void doInitializeFields()
119
	{
119
	{
120
		if (textTeam == null)
120
		if (textTeam == null)
121
		  return; // do nothing
121
		  return; // do nothing
122
		if (inputFilterString != null)
122
		if (inputFilterString != null)
123
		{
123
		{
124
			int idx = inputFilterString.indexOf('/');
124
			int idx = inputFilterString.indexOf('/');
125
			if (idx &lt; 0)
125
			if (idx &lt; 0)
126
		      textTeam.setText(inputFilterString);
126
		      textTeam.setText(inputFilterString);
127
		    else
127
		    else
128
		    {
128
		    {
129
		    	textTeam.setText(inputFilterString.substring(0,idx));
129
		    	textTeam.setText(inputFilterString.substring(0,idx));
130
		    	textDevr.setText(inputFilterString.substring(idx+1));
130
		    	textDevr.setText(inputFilterString.substring(idx+1));
131
		    }
131
		    }
132
		}
132
		}
133
	}</strong>	
133
	}</strong>	
134
134
135
	/**
135
	/**
136
	 * Override of parent method.
136
	 * Override of parent method.
137
	 * This is called in the change filter dialog when the user selects "new", or selects another string.
137
	 * This is called in the change filter dialog when the user selects "new", or selects another string.
138
	 */
138
	 */
139
	<strong>protected void resetFields()
139
	<strong>protected void resetFields()
140
	{
140
	{
141
	    textTeam.setText(""); //$NON-NLS-1$		
141
	    textTeam.setText(""); //$NON-NLS-1$		
142
	    textDevr.setText("*"); //$NON-NLS-1$
142
	    textDevr.setText("*"); //$NON-NLS-1$
143
	}</strong>
143
	}</strong>
144
144
145
	/**
145
	/**
146
	 * Override of parent method.
146
	 * Override of parent method.
147
	 * Called by parent to decide if information is complete enough to enable finish. 
147
	 * Called by parent to decide if information is complete enough to enable finish. 
148
	 */
148
	 */
149
	<strong>protected boolean areFieldsComplete()
149
	<strong>protected boolean areFieldsComplete()
150
	{
150
	{
151
		if ((textTeam == null) || (textDevr == null))
151
		if ((textTeam == null) || (textDevr == null))
152
		  return false;
152
		  return false;
153
		else
153
		else
154
		  return (textTeam.getText().trim().length()>0) && (textDevr.getText().trim().length()>0);
154
		  return (textTeam.getText().trim().length()&gt;0) &amp;&amp; (textDevr.getText().trim().length()&gt;0);
155
	}</strong>
155
	}</strong>
156
	
156
	
157
	/**
157
	/**
158
	 * Override of parent method.
158
	 * Override of parent method.
159
	 * Get the filter string in its current form. 
159
	 * Get the filter string in its current form. 
160
	 * Functional opposite of doInitializeFields, which tears apart the input string in update mode,
160
	 * Functional opposite of doInitializeFields, which tears apart the input string in update mode,
161
	 *  to populate the GUIs. This method creates the filter string from the information in the GUI.
161
	 *  to populate the GUIs. This method creates the filter string from the information in the GUI.
162
	 */
162
	 */
163
	<strong>public String getFilterString()
163
	<strong>public String getFilterString()
164
	{
164
	{
165
		if ((textTeam == null) || (textDevr == null))
165
		if ((textTeam == null) || (textDevr == null))
166
		  return inputFilterString; // return what we were given.
166
		  return inputFilterString; // return what we were given.
167
		else
167
		else
168
		{
168
		{
169
			String teamName = textTeam.getText().trim();
169
			String teamName = textTeam.getText().trim();
170
			String devrName = textDevr.getText().trim();
170
			String devrName = textDevr.getText().trim();
171
			return teamName + "/" + devrName; //$NON-NLS-1$
171
			return teamName + "/" + devrName; //$NON-NLS-1$
172
		}
172
		}
173
	}</strong>	
173
	}</strong>	
174
174
175
	/**
175
	/**
176
	 * Override of parent method.
176
	 * Override of parent method.
177
	 * Does complete verification of input fields. If this 
177
	 * Does complete verification of input fields. If this 
178
	 * method returns null, there are no errors and the dialog or wizard can close.
178
	 * method returns null, there are no errors and the dialog or wizard can close.
179
	 *
179
	 *
180
	 * @return error message if there is one, else null if ok
180
	 * @return error message if there is one, else null if ok
181
	 */
181
	 */
182
	<strong>public SystemMessage verify() 
182
	<strong>public SystemMessage verify() 
183
	{
183
	{
184
		errorMessage = null;
184
		errorMessage = null;
185
		Control controlInError = null;
185
		Control controlInError = null;
186
		
186
		
187
		/*
187
		/*
188
		errorMessage = validateTeamInput(); // todo: implement if we want to syntax check input
188
		errorMessage = validateTeamInput(); // todo: implement if we want to syntax check input
189
		if (errorMessage != null)
189
		if (errorMessage != null)
190
		  controlInError = textTeam;
190
		  controlInError = textTeam;
191
		else
191
		else
192
		{
192
		{
193
		   errorMessage = validateDevrInput(); // todo: implement to syntax check input
193
		   errorMessage = validateDevrInput(); // todo: implement to syntax check input
194
		   if (errorMessage != null)
194
		   if (errorMessage != null)
195
		     controlInError = textDevr;
195
		     controlInError = textDevr;
196
		}
196
		}
197
		*/
197
		*/
198
		
198
		
199
		if (errorMessage != null)
199
		if (errorMessage != null)
200
		{
200
		{
201
			if (controlInError != null)
201
			if (controlInError != null)
202
		      controlInError.setFocus();
202
		      controlInError.setFocus();
203
		}
203
		}
204
		return errorMessage;		
204
		return errorMessage;		
205
	}</strong>	
205
	}</strong>	
206
206
207
}
207
}
208
</samp></pre>
208
</samp></pre>
209
</body>
209
</body>
210
</html>
210
</html>
(-)guide/tutorial/FolderInfoPropertyPage2.html (-269 / +269 lines)
Lines 1-269 Link Here
1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2
<html>
2
<html>
3
3
4
<head>
4
<head>
5
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
5
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
6
<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
6
<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
7
<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." >
7
<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." >
8
<LINK REL="STYLESHEET" HREF="../../book.css" TYPE="text/css">
8
<LINK REL="STYLESHEET" HREF="../../book.css" TYPE="text/css">
9
<title>FolderInfoPropertyPage Class After Editing</title>
9
<title>FolderInfoPropertyPage Class After Editing</title>
10
</head>
10
</head>
11
11
12
<body bgcolor="#ffffff">
12
<body bgcolor="#ffffff">
13
<h1>FolderInfoPropertyPage Class After Editing</h1>
13
<h1>FolderInfoPropertyPage Class After Editing</h1>
14
<p>
14
<p>
15
<pre><samp>
15
<pre><samp>
16
package samples.ui.propertypages;
16
package samples.ui.propertypages;
17
17
18
import org.eclipse.rse.files.ui.propertypages.SystemAbstractRemoteFilePropertyPageExtensionAction;
18
import org.eclipse.rse.files.ui.propertypages.SystemAbstractRemoteFilePropertyPageExtensionAction;
19
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
19
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
20
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
20
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
21
import org.eclipse.rse.ui.SystemWidgetHelpers;
21
import org.eclipse.rse.ui.SystemWidgetHelpers;
22
import org.eclipse.swt.events.SelectionEvent;
22
import org.eclipse.swt.events.SelectionEvent;
23
import org.eclipse.swt.events.SelectionListener;
23
import org.eclipse.swt.events.SelectionListener;
24
import org.eclipse.swt.widgets.Button;
24
import org.eclipse.swt.widgets.Button;
25
import org.eclipse.swt.widgets.Composite;
25
import org.eclipse.swt.widgets.Composite;
26
import org.eclipse.swt.widgets.Control;
26
import org.eclipse.swt.widgets.Control;
27
import org.eclipse.swt.widgets.Display;
27
import org.eclipse.swt.widgets.Display;
28
import org.eclipse.swt.widgets.Label;
28
import org.eclipse.swt.widgets.Label;
29
29
30
import samples.RSESamplesPlugin;
30
import samples.RSESamplesPlugin;
31
31
32
/**
32
/**
33
 * A sample property page for a remote object, which in this case is scoped via the
33
 * A sample property page for a remote object, which in this case is scoped via the
34
 *  extension point xml to only apply to folder objects.
34
 *  extension point xml to only apply to folder objects.
35
 */
35
 */
36
public class FolderInfoPropertyPage
36
public class FolderInfoPropertyPage
37
	extends SystemAbstractRemoteFilePropertyPageExtensionAction
37
	extends SystemAbstractRemoteFilePropertyPageExtensionAction
38
	implements SelectionListener
38
	implements SelectionListener
39
{
39
{
40
	// gui widgets...
40
	// gui widgets...
41
	private Label sizeLabel, filesLabel, foldersLabel;
41
	private Label sizeLabel, filesLabel, foldersLabel;
42
	private Button stopButton;
42
	private Button stopButton;
43
	// state...
43
	// state...
44
	private int totalSize = 0;
44
	private int totalSize = 0;
45
	private int totalFolders = 0;
45
	private int totalFolders = 0;
46
	private int totalFiles = 0;
46
	private int totalFiles = 0;
47
	private boolean stopped = false;
47
	private boolean stopped = false;
48
	private Thread workerThread;
48
	private Thread workerThread;
49
	private Runnable guiUpdater;
49
	private Runnable guiUpdater;
50
50
51
	/**
51
	/**
52
	 * Constructor for FolderInfoPropertyPage.
52
	 * Constructor for FolderInfoPropertyPage.
53
	 */
53
	 */
54
	public FolderInfoPropertyPage()
54
	public FolderInfoPropertyPage()
55
	{
55
	{
56
		super();
56
		super();
57
	}
57
	}
58
58
59
	// --------------------------
59
	// --------------------------
60
	// Parent method overrides...
60
	// Parent method overrides...
61
	// --------------------------
61
	// --------------------------
62
	
62
	
63
63
64
	/* (non-Javadoc)
64
	/* (non-Javadoc)
65
	 * @see org.eclipse.rse.files.ui.propertypages.SystemAbstractRemoteFilePropertyPageExtensionAction#createContentArea(org.eclipse.swt.widgets.Composite)
65
	 * @see org.eclipse.rse.files.ui.propertypages.SystemAbstractRemoteFilePropertyPageExtensionAction#createContentArea(org.eclipse.swt.widgets.Composite)
66
	 */
66
	 */
67
	protected Control createContentArea(Composite parent)
67
	protected Control createContentArea(Composite parent)
68
	{
68
	{
69
		Composite composite = SystemWidgetHelpers.createComposite(parent, 2);
69
		Composite composite = SystemWidgetHelpers.createComposite(parent, 2);
70
		// draw the gui		
70
		// draw the gui		
71
		sizeLabel = SystemWidgetHelpers.createLabeledLabel(composite, 
71
		sizeLabel = SystemWidgetHelpers.createLabeledLabel(composite, 
72
				RSESamplesPlugin.getResourceString("pp.size.label"), //$NON-NLS-1$
72
				RSESamplesPlugin.getResourceString("pp.size.label"), //$NON-NLS-1$
73
				RSESamplesPlugin.getResourceString("pp.size.tooltip"), //$NON-NLS-1$
73
				RSESamplesPlugin.getResourceString("pp.size.tooltip"), //$NON-NLS-1$
74
				false);
74
				false);
75
		filesLabel = SystemWidgetHelpers.createLabeledLabel(composite, 
75
		filesLabel = SystemWidgetHelpers.createLabeledLabel(composite, 
76
				RSESamplesPlugin.getResourceString("pp.files.label"), //$NON-NLS-1$
76
				RSESamplesPlugin.getResourceString("pp.files.label"), //$NON-NLS-1$
77
				RSESamplesPlugin.getResourceString("pp.files.tooltip"), //$NON-NLS-1$
77
				RSESamplesPlugin.getResourceString("pp.files.tooltip"), //$NON-NLS-1$
78
				false);
78
				false);
79
		foldersLabel = SystemWidgetHelpers.createLabeledLabel(composite, 
79
		foldersLabel = SystemWidgetHelpers.createLabeledLabel(composite, 
80
				RSESamplesPlugin.getResourceString("pp.folders.label"), //$NON-NLS-1$
80
				RSESamplesPlugin.getResourceString("pp.folders.label"), //$NON-NLS-1$
81
				RSESamplesPlugin.getResourceString("pp.folders.tooltip"), //$NON-NLS-1$
81
				RSESamplesPlugin.getResourceString("pp.folders.tooltip"), //$NON-NLS-1$
82
				false);
82
				false);
83
		stopButton = SystemWidgetHelpers.createPushButton(composite, null, 
83
		stopButton = SystemWidgetHelpers.createPushButton(composite, null, 
84
				RSESamplesPlugin.getResourceString("pp.stopButton.label"), //$NON-NLS-1$
84
				RSESamplesPlugin.getResourceString("pp.stopButton.label"), //$NON-NLS-1$
85
				RSESamplesPlugin.getResourceString("pp.stopButton.tooltip") //$NON-NLS-1$
85
				RSESamplesPlugin.getResourceString("pp.stopButton.tooltip") //$NON-NLS-1$
86
				);
86
				);
87
		stopButton.addSelectionListener(this);
87
		stopButton.addSelectionListener(this);
88
		
88
		
89
		setValid(false); // Disable OK button until thread is done
89
		setValid(false); // Disable OK button until thread is done
90
		
90
		
91
		// show "Processing..." message
91
		// show "Processing..." message
92
		setMessage(RSESamplesPlugin.getPluginMessage("RSSG1002")); //$NON-NLS-1$
92
		setMessage(RSESamplesPlugin.getPluginMessage("RSSG1002")); //$NON-NLS-1$
93
		
93
		
94
		// create instance of Runnable to allow asynchronous GUI updates from background thread	   
94
		// create instance of Runnable to allow asynchronous GUI updates from background thread	   
95
		guiUpdater = new RunnableGUIClass();
95
		guiUpdater = new RunnableGUIClass();
96
		// spawn a thread to calculate the information
96
		// spawn a thread to calculate the information
97
		workerThread = new RunnableClass(getRemoteFile());
97
		workerThread = new RunnableClass(getRemoteFile());
98
		workerThread.start();
98
		workerThread.start();
99
		
99
		
100
		return composite;
100
		return composite;
101
	}
101
	}
102
	
102
	
103
	/**
103
	/**
104
	 * Intercept from PreferencePage. Called when user presses Cancel button.
104
	 * Intercept from PreferencePage. Called when user presses Cancel button.
105
	 * We stop the background thread.
105
	 * We stop the background thread.
106
	 * @see org.eclipse.jface.preference.PreferencePage#performCancel()
106
	 * @see org.eclipse.jface.preference.PreferencePage#performCancel()
107
	 */
107
	 */
108
	public boolean performCancel() 
108
	public boolean performCancel() 
109
	{
109
	{
110
		killThread();
110
		killThread();
111
		return true;
111
		return true;
112
	}			
112
	}			
113
	
113
	
114
	/**
114
	/**
115
	 * Intercept from DialogPage. Called when dialog going away.
115
	 * Intercept from DialogPage. Called when dialog going away.
116
	 * If the user presses the X to close this dialog, we 
116
	 * If the user presses the X to close this dialog, we 
117
	 *  need to stop that background thread.
117
	 *  need to stop that background thread.
118
	 */
118
	 */
119
	public void dispose()
119
	public void dispose()
120
	{
120
	{
121
		killThread();
121
		killThread();
122
		super.dispose();
122
		super.dispose();
123
	}
123
	}
124
	
124
	
125
	/**
125
	/**
126
	 * Private method to kill our background thread.
126
	 * Private method to kill our background thread.
127
	 * Control doesn't return until it ends.
127
	 * Control doesn't return until it ends.
128
	 */
128
	 */
129
	private void killThread()
129
	private void killThread()
130
	{
130
	{
131
		if (!stopped && workerThread.isAlive())
131
		if (!stopped &amp;&amp; workerThread.isAlive())
132
		{
132
		{
133
		    stopped = true;
133
		    stopped = true;
134
		    try {
134
		    try {
135
		      workerThread.join(); // wait for thread to end
135
		      workerThread.join(); // wait for thread to end
136
		    } catch (InterruptedException exc) {}
136
		    } catch (InterruptedException exc) {}
137
		}		
137
		}		
138
	}
138
	}
139
139
140
	// -------------------------------------------
140
	// -------------------------------------------
141
	// Methods from SelectionListener interface...
141
	// Methods from SelectionListener interface...
142
	// -------------------------------------------
142
	// -------------------------------------------
143
	
143
	
144
	/**
144
	/**
145
	 * From SelectionListener
145
	 * From SelectionListener
146
	 * @see SelectionListener#widgetSelected(SelectionEvent)
146
	 * @see SelectionListener#widgetSelected(SelectionEvent)
147
	 */
147
	 */
148
	public void widgetSelected(SelectionEvent event) 
148
	public void widgetSelected(SelectionEvent event) 
149
	{
149
	{
150
		if (event.getSource() == stopButton)
150
		if (event.getSource() == stopButton)
151
		{
151
		{
152
			stopped = true;
152
			stopped = true;
153
			stopButton.setEnabled(false);
153
			stopButton.setEnabled(false);
154
		}
154
		}
155
	}
155
	}
156
	/**
156
	/**
157
	 * From SelectionListener
157
	 * From SelectionListener
158
	 * @see SelectionListener#widgetDefaultSelected(SelectionEvent)
158
	 * @see SelectionListener#widgetDefaultSelected(SelectionEvent)
159
	 */
159
	 */
160
	public void widgetDefaultSelected(SelectionEvent event)
160
	public void widgetDefaultSelected(SelectionEvent event)
161
	{
161
	{
162
	}
162
	}
163
163
164
	// ----------------
164
	// ----------------
165
	// Inner classes...
165
	// Inner classes...
166
	// ----------------
166
	// ----------------
167
	/**
167
	/**
168
	 * Inner class encapsulating the background work to be done, so it may be executed
168
	 * Inner class encapsulating the background work to be done, so it may be executed
169
	 *  in background thread.
169
	 *  in background thread.
170
	 */
170
	 */
171
	private class RunnableClass extends Thread
171
	private class RunnableClass extends Thread
172
	{
172
	{
173
		IRemoteFile inputFolder;
173
		IRemoteFile inputFolder;
174
		
174
		
175
		RunnableClass(IRemoteFile inputFolder)
175
		RunnableClass(IRemoteFile inputFolder)
176
		{
176
		{
177
			this.inputFolder = inputFolder;
177
			this.inputFolder = inputFolder;
178
		}
178
		}
179
		
179
		
180
		public void run()
180
		public void run()
181
		{
181
		{
182
			if (stopped)
182
			if (stopped)
183
			  return;
183
			  return;
184
			walkFolder(inputFolder);						
184
			walkFolder(inputFolder);						
185
			updateGUI();
185
			updateGUI();
186
			if (!stopped)
186
			if (!stopped)
187
			{
187
			{
188
				stopped = true;
188
				stopped = true;
189
				updateGUI();
189
				updateGUI();
190
			}
190
			}
191
		}
191
		}
192
		
192
		
193
		/**
193
		/**
194
		 * Recursively walk a folder, updating the running tallies. 
194
		 * Recursively walk a folder, updating the running tallies. 
195
		 * Update the GUI after processing each subfolder.
195
		 * Update the GUI after processing each subfolder.
196
		 */
196
		 */
197
		private void walkFolder(IRemoteFile currFolder)
197
		private void walkFolder(IRemoteFile currFolder)
198
		{
198
		{
199
			try
199
			try
200
			{
200
			{
201
			IRemoteFile[] folders = currFolder.getParentRemoteFileSubSystem().listFoldersAndFiles( currFolder, null);
201
			IRemoteFile[] folders = currFolder.getParentRemoteFileSubSystem().listFoldersAndFiles( currFolder, null);
202
			if ((folders != null) && (folders.length>0))
202
			if ((folders != null) &amp;&amp; (folders.length&gt;0))
203
			{
203
			{
204
				for (int idx=0; !stopped && (idx&lt;folders.length); idx++)
204
				for (int idx=0; !stopped &amp;&amp; (idx&lt;folders.length); idx++)
205
				{
205
				{
206
					// is this a folder? 
206
					// is this a folder? 
207
					if (folders[idx].isDirectory())
207
					if (folders[idx].isDirectory())
208
					{
208
					{
209
						++totalFolders;
209
						++totalFolders;
210
						walkFolder(folders[idx]);
210
						walkFolder(folders[idx]);
211
						updateGUI();
211
						updateGUI();
212
					}
212
					}
213
					// is this a file?
213
					// is this a file?
214
					else
214
					else
215
					{
215
					{
216
						++totalFiles;
216
						++totalFiles;
217
						totalSize += folders[idx].getLength();
217
						totalSize += folders[idx].getLength();
218
					}
218
					}
219
				}
219
				}
220
			}
220
			}
221
			}
221
			}
222
			catch (SystemMessageException e)
222
			catch (SystemMessageException e)
223
			{
223
			{
224
				
224
				
225
			}
225
			}
226
		} // end of walkFolder method
226
		} // end of walkFolder method
227
227
228
	} // end of inner class
228
	} // end of inner class
229
	
229
	
230
	/**
230
	/**
231
	 * Inner class encapsulating the GUI work to be done from the
231
	 * Inner class encapsulating the GUI work to be done from the
232
	 *  background thread.
232
	 *  background thread.
233
	 */
233
	 */
234
	private class RunnableGUIClass implements Runnable
234
	private class RunnableGUIClass implements Runnable
235
	{
235
	{
236
		public void run()
236
		public void run()
237
		{
237
		{
238
			if (stopButton.isDisposed())
238
			if (stopButton.isDisposed())
239
			  return; 
239
			  return; 
240
			if (!stopped)
240
			if (!stopped)
241
			{
241
			{
242
				sizeLabel.setText(Integer.toString(totalSize));		
242
				sizeLabel.setText(Integer.toString(totalSize));		
243
				filesLabel.setText(Integer.toString(totalFiles));
243
				filesLabel.setText(Integer.toString(totalFiles));
244
				foldersLabel.setText(Integer.toString(totalFolders));
244
				foldersLabel.setText(Integer.toString(totalFolders));
245
			}
245
			}
246
			else if (stopped)
246
			else if (stopped)
247
			{				
247
			{				
248
				setValid(true); // re-enable OK button								
248
				setValid(true); // re-enable OK button								
249
				stopButton.setEnabled(false); // disable Stop button				
249
				stopButton.setEnabled(false); // disable Stop button				
250
				clearMessage(); // clear "Processing..." message
250
				clearMessage(); // clear "Processing..." message
251
			}			  
251
			}			  
252
		}
252
		}
253
	}	
253
	}	
254
254
255
	
255
	
256
	/**
256
	/**
257
	 * Update the GUI with the current status
257
	 * Update the GUI with the current status
258
	 */
258
	 */
259
	private void updateGUI()
259
	private void updateGUI()
260
	{
260
	{
261
		Display.getDefault().asyncExec(guiUpdater);
261
		Display.getDefault().asyncExec(guiUpdater);
262
	}
262
	}
263
263
264
264
265
}
265
}
266
</samp></pre>
266
</samp></pre>
267
</p>
267
</p>
268
</body>
268
</body>
269
</html>
269
</html>
(-)guide/tutorial/pdeProject.html (-105 / +105 lines)
Lines 1-105 Link Here
1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2
<html>
2
<html>
3
3
4
<head>
4
<head>
5
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
5
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
6
<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
6
<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
7
<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." >
7
<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." >
8
<LINK REL="STYLESHEET" HREF="../../book.css" TYPE="text/css">
8
<LINK REL="STYLESHEET" HREF="../../book.css" TYPE="text/css">
9
<title>Creating a Plug-in Project</title>
9
<title>Creating a Plug-in Project</title>
10
</head>
10
</head>
11
11
12
<body>
12
<body>
13
<h1>Creating a Plug-in Project</h1>
13
<h1>Creating a Plug-in Project</h1>
14
<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>
14
<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>
15
<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>
15
<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>
16
<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>
16
<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>
17
<p>The following tutorial uses numbered steps to indicate where you are required to do something as you follow along.</p>
17
<p>The following tutorial uses numbered steps to indicate where you are required to do something as you follow along.</p>
18
<h2>Step By Step: Creating an RSE Plug-in Project</h2>
18
<h2>Step By Step: Creating an RSE Plug-in Project</h2>
19
<ol>
19
<ol>
20
<li>Select <b>File-&gt;New-&gt;Project.</b></li>
20
<li>Select <b>File-&gt;New-&gt;Project.</b></li>
21
<li>In the dialog box select the <b>Plug-in Project</b> wizard. Click <b>Next &gt;</b>.
21
<li>In the dialog box select the <b>Plug-in Project</b> wizard. Click <b>Next &gt;</b>.
22
<br /><img src="pdeProj_1.png">
22
<br><img src="pdeProj_1.png">
23
</li>
23
</li>
24
<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>.
24
<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>.
25
<br /><img src="pdeProj_wiz_page1.png">
25
<br><img src="pdeProj_wiz_page1.png">
26
</li>
26
</li>
27
<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>.
27
<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>.
28
<br /><img src="pdeProj_wiz_page2.png">
28
<br><img src="pdeProj_wiz_page2.png">
29
</li>
29
</li>
30
<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>.
30
<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>.
31
<br /><img src="pdeProj_wiz_page3.png">
31
<br><img src="pdeProj_wiz_page3.png">
32
</li>
32
</li>
33
<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>
33
<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>
34
<li>Go to the dependencies tab of the plug-in editor and add the following plugins to the list:
34
<li>Go to the dependencies tab of the plug-in editor and add the following plugins to the list:
35
<ul>
35
<ul>
36
<li>org.eclipse.core.resources</li>
36
<li>org.eclipse.core.resources</li>
37
<li>org.eclipse.rse.ui</li>
37
<li>org.eclipse.rse.ui</li>
38
<li>org.eclipse.rse.services</li>
38
<li>org.eclipse.rse.services</li>
39
<li>org.eclipse.rse.files.ui</li>
39
<li>org.eclipse.rse.files.ui</li>
40
<li>org.eclipse.rse.shells.ui</li>
40
<li>org.eclipse.rse.shells.ui</li>
41
<li>org.eclipse.rse.subsystems.files.core</li>
41
<li>org.eclipse.rse.subsystems.files.core</li>
42
<li>org.eclipse.rse.subsystems.shells.core</li>
42
<li>org.eclipse.rse.subsystems.shells.core</li>
43
</ul>
43
</ul>
44
</li>
44
</li>
45
<li>Now go to the MANIFEST.MF tab of the plugin properties.
45
<li>Now go to the MANIFEST.MF tab of the plugin properties.
46
This shows the source for the MANIFEST.MF file associated with this plugin.
46
This shows the source for the MANIFEST.MF file associated with this plugin.
47
Change the Bundle-SymbolicName line adding a singleton:=true directive.
47
Change the Bundle-SymbolicName line adding a singleton:=true directive.
48
<pre><code>
48
<pre><code>
49
Bundle-SymbolicName:RSESamples;singleton:=true
49
Bundle-SymbolicName:RSESamples;singleton:=true
50
</code></pre>
50
</code></pre>
51
This allows us to add extensions to the plugin at a later point.
51
This allows us to add extensions to the plugin at a later point.
52
Save the plugin properties and close the editor.
52
Save the plugin properties and close the editor.
53
</li>
53
</li>
54
<li>
54
<li>
55
Right-click on the RSESamples project and create a plugin.xml file.
55
Right-click on the RSESamples project and create a plugin.xml file.
56
Normally this would be created if you used a template to create your plugin.
56
Normally this would be created if you used a template to create your plugin.
57
We will use this file to add extensions to RSE but for now it will just be a skeleton with the following contents:
57
We will use this file to add extensions to RSE but for now it will just be a skeleton with the following contents:
58
<pre><code>
58
<pre><code>
59
&lt;plugin&gt;
59
&lt;plugin&gt;
60
&lt;/plugin&gt;
60
&lt;/plugin&gt;
61
</code></pre>
61
</code></pre>
62
Add the lines above to the empty plugin.xml file and save it.
62
Add the lines above to the empty plugin.xml file and save it.
63
</li>
63
</li>
64
<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.
64
<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.
65
Change it as described below. Reference the source <a href="RSESamplesPlugin.html">here</a> for the details.
65
Change it as described below. Reference the source <a href="RSESamplesPlugin.html">here</a> for the details.
66
<ul>
66
<ul>
67
<li>Extend SystemBasePlugin instead of AbstractUIPlugin</li>
67
<li>Extend SystemBasePlugin instead of AbstractUIPlugin</li>
68
<li>Add the declaration for resourceBundle</li>
68
<li>Add the declaration for resourceBundle</li>
69
<li>Add the declaration for messageFile</li>
69
<li>Add the declaration for messageFile</li>
70
<li>Invoke the superclass constructor from this constructor</li>
70
<li>Invoke the superclass constructor from this constructor</li>
71
<li>Add the initializeImageRegistry() method</li>
71
<li>Add the initializeImageRegistry() method</li>
72
<li>Add the getMessageFile() method</li>
72
<li>Add the getMessageFile() method</li>
73
<li>Add the getResourceBundle() method</li>
73
<li>Add the getResourceBundle() method</li>
74
<li>Add the static getWorkspace() method</li>
74
<li>Add the static getWorkspace() method</li>
75
<li>Add the static getResourceString(String) method</li>
75
<li>Add the static getResourceString(String) method</li>
76
<li>Add the static getPluginMessageFile() method</li>
76
<li>Add the static getPluginMessageFile() method</li>
77
<li>Add the static getPluginMessage(String) method</li>
77
<li>Add the static getPluginMessage(String) method</li>
78
</ul>
78
</ul>
79
</li>
79
</li>
80
<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>
80
<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>
81
<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):
81
<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):
82
<pre><code>
82
<pre><code>
83
&lt;?xml version=&quot;1.0&quot; encoding='UTF-8'?&gt;
83
&lt;?xml version=&quot;1.0&quot; encoding='UTF-8'?&gt;
84
&lt;!DOCTYPE MessageFile SYSTEM &quot;../org.eclipse.rse.ui/messageFile.dtd&quot;&gt;
84
&lt;!DOCTYPE MessageFile SYSTEM &quot;../org.eclipse.rse.ui/messageFile.dtd&quot;&gt;
85
&lt;!-- This is a message file used by SystemMessage and SystemMessageDialog --&gt;
85
&lt;!-- This is a message file used by SystemMessage and SystemMessageDialog --&gt;
86
&lt;<b>MessageFile</b> Version=&quot;1.0&quot;&gt;
86
&lt;<b>MessageFile</b> Version=&quot;1.0&quot;&gt;
87
     &lt;<b>Component</b> Name=&quot;RSE Samples&quot; Abbr=&quot;RSS&quot;&gt;
87
     &lt;<b>Component</b> Name=&quot;RSE Samples&quot; Abbr=&quot;RSS&quot;&gt;
88
          &lt;<b>Subcomponent</b> Name=&quot;General&quot; Abbr=&quot;G&quot;&gt;
88
          &lt;<b>Subcomponent</b> Name=&quot;General&quot; Abbr=&quot;G&quot;&gt;
89
                &lt;<b>MessageList</b>&gt;
89
                &lt;<b>MessageList</b>&gt;
90
                    &lt;<b>Message</b> ID=&quot;1001&quot; Indicator=&quot;E&quot;&gt;
90
                    &lt;<b>Message</b> ID=&quot;1001&quot; Indicator=&quot;E&quot;&gt;
91
                          &lt;<b>LevelOne</b>&gt;Sample message&lt;/<b>LevelOne</b>&gt;		
91
                          &lt;<b>LevelOne</b>&gt;Sample message&lt;/<b>LevelOne</b>&gt;		
92
                          &lt;<b>LevelTwo</b>&gt;This is a sample with one substitution variable: %1&lt;/<b>LevelTwo</b>&gt;
92
                          &lt;<b>LevelTwo</b>&gt;This is a sample with one substitution variable: %1&lt;/<b>LevelTwo</b>&gt;
93
                    &lt;/<b>Message</b>&gt;
93
                    &lt;/<b>Message</b>&gt;
94
                &lt;/<b>MessageList</b>&gt;
94
                &lt;/<b>MessageList</b>&gt;
95
          &lt;/<b>Subcomponent</b>&gt;
95
          &lt;/<b>Subcomponent</b>&gt;
96
     &lt;/<b>Component</b>&gt;
96
     &lt;/<b>Component</b>&gt;
97
&lt;/<b>MessageFile</b>&gt;
97
&lt;/<b>MessageFile</b>&gt;
98
</code></pre>
98
</code></pre>
99
Save and close the file.
99
Save and close the file.
100
</li>
100
</li>
101
<li>Your plugin is created and you are ready to go. Now you only need to add the code to implement the extension points.
101
<li>Your plugin is created and you are ready to go. Now you only need to add the code to implement the extension points.
102
</li>
102
</li>
103
</ol>
103
</ol>
104
</body>
104
</body>
105
</html>
105
</html>
(-)guide/tutorial/DeveloperSubSystem2.html (-2 / +2 lines)
Lines 108-114 Link Here
108
			// Now, subset master list, based on filter string...
108
			// Now, subset master list, based on filter string...
109
			NamePatternMatcher subsetter = new NamePatternMatcher(filterString);
109
			NamePatternMatcher subsetter = new NamePatternMatcher(filterString);
110
			Vector v = new Vector();
110
			Vector v = new Vector();
111
			for (int idx=0; idx &lt1; allTeams.length; idx++)
111
			for (int idx=0; idx &lt; allTeams.length; idx++)
112
			{
112
			{
113
				if (subsetter.matches(allTeams[idx].getName()))
113
				if (subsetter.matches(allTeams[idx].getName()))
114
				  v.addElement(allTeams[idx]);
114
				  v.addElement(allTeams[idx]);
Lines 124-130 Link Here
124
			String devrName = filterString.substring(slashIdx+1);
124
			String devrName = filterString.substring(slashIdx+1);
125
			TeamResource[] allTeams = getAllTeams();
125
			TeamResource[] allTeams = getAllTeams();
126
			TeamResource match = null;
126
			TeamResource match = null;
127
			for (int idx=0; (match==null) && (idx &lt; allTeams.length); idx++)
127
			for (int idx=0; (match==null) &amp;&amp; (idx &lt; allTeams.length); idx++)
128
			   if (allTeams[idx].getName().equals(teamName))
128
			   if (allTeams[idx].getName().equals(teamName))
129
			     match = allTeams[idx];
129
			     match = allTeams[idx];
130
			if (match != null)
130
			if (match != null)
(-)guide/tutorial/TeamResourceAdapter.html (-228 / +228 lines)
Lines 1-228 Link Here
1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2
<html>
2
<html>
3
3
4
<head>
4
<head>
5
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
5
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
6
<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
6
<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
7
<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." >
7
<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." >
8
<LINK REL="STYLESHEET" HREF="../../book.css" TYPE="text/css">
8
<LINK REL="STYLESHEET" HREF="../../book.css" TYPE="text/css">
9
<title>TeamResourceAdapter Class After Editing</title>
9
<title>TeamResourceAdapter Class After Editing</title>
10
</head>
10
</head>
11
11
12
<body>
12
<body>
13
<h1>TeamResourceAdapter Class After Editing</h1>
13
<h1>TeamResourceAdapter Class After Editing</h1>
14
<pre><samp>
14
<pre><samp>
15
package samples.model;
15
package samples.model;
16
16
17
import org.eclipse.jface.resource.ImageDescriptor;
17
import org.eclipse.jface.resource.ImageDescriptor;
18
import org.eclipse.jface.viewers.IStructuredSelection;
18
import org.eclipse.jface.viewers.IStructuredSelection;
19
import org.eclipse.rse.ui.SystemMenuManager;
19
import org.eclipse.rse.ui.SystemMenuManager;
20
import org.eclipse.rse.ui.view.AbstractSystemViewAdapter;
20
import org.eclipse.rse.ui.view.AbstractSystemViewAdapter;
21
import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter;
21
import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter;
22
import org.eclipse.swt.widgets.Shell;
22
import org.eclipse.swt.widgets.Shell;
23
import org.eclipse.ui.views.properties.IPropertyDescriptor;
23
import org.eclipse.ui.views.properties.IPropertyDescriptor;
24
24
25
<strong>import samples.RSESamplesPlugin;</strong>
25
<strong>import samples.RSESamplesPlugin;</strong>
26
<strong>import samples.subsystems.DeveloperSubSystem;</strong>
26
<strong>import samples.subsystems.DeveloperSubSystem;</strong>
27
27
28
/**
28
/**
29
 * This is the adapter which enables us to work with our remote team resources.
29
 * This is the adapter which enables us to work with our remote team resources.
30
 */
30
 */
31
public class TeamResourceAdapter extends AbstractSystemViewAdapter implements
31
public class TeamResourceAdapter extends AbstractSystemViewAdapter implements
32
		ISystemRemoteElementAdapter {
32
		ISystemRemoteElementAdapter {
33
33
34
	/**
34
	/**
35
	 * Constructor.
35
	 * Constructor.
36
	 */
36
	 */
37
	public TeamResourceAdapter() {
37
	public TeamResourceAdapter() {
38
		super();
38
		super();
39
	}
39
	}
40
40
41
	/* (non-Javadoc)
41
	/* (non-Javadoc)
42
	 * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#addActions(org.eclipse.rse.ui.SystemMenuManager, 
42
	 * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#addActions(org.eclipse.rse.ui.SystemMenuManager, 
43
	 * org.eclipse.jface.viewers.IStructuredSelection, org.eclipse.swt.widgets.Shell, java.lang.String)
43
	 * org.eclipse.jface.viewers.IStructuredSelection, org.eclipse.swt.widgets.Shell, java.lang.String)
44
	 */
44
	 */
45
	public void addActions(SystemMenuManager menu,
45
	public void addActions(SystemMenuManager menu,
46
			IStructuredSelection selection, Shell parent, String menuGroup)
46
			IStructuredSelection selection, Shell parent, String menuGroup)
47
	{
47
	{
48
	}
48
	}
49
49
50
	/* (non-Javadoc)
50
	/* (non-Javadoc)
51
	 * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#getImageDescriptor(java.lang.Object)
51
	 * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#getImageDescriptor(java.lang.Object)
52
	 */
52
	 */
53
	public ImageDescriptor getImageDescriptor(Object element)
53
	public ImageDescriptor getImageDescriptor(Object element)
54
	{
54
	{
55
		<strong>return RSESamplesPlugin.getDefault().getImageDescriptor("ICON_ID_TEAM");</strong>
55
		<strong>return RSESamplesPlugin.getDefault().getImageDescriptor("ICON_ID_TEAM");</strong>
56
	}
56
	}
57
57
58
	/* (non-Javadoc)
58
	/* (non-Javadoc)
59
	 * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#getText(java.lang.Object)
59
	 * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#getText(java.lang.Object)
60
	 */
60
	 */
61
	public String getText(Object element)
61
	public String getText(Object element)
62
	{
62
	{
63
		<strong>return ((TeamResource)element).getName();</strong>
63
		<strong>return ((TeamResource)element).getName();</strong>
64
	}
64
	}
65
65
66
	/* (non-Javadoc)
66
	/* (non-Javadoc)
67
	 * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#getAbsoluteName(java.lang.Object)
67
	 * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#getAbsoluteName(java.lang.Object)
68
	 */
68
	 */
69
	<a id="getAbsoluteName"/>public String getAbsoluteName(Object object)
69
	<a id="getAbsoluteName"></a>public String getAbsoluteName(Object object)
70
	{
70
	{
71
		<strong>TeamResource team = (TeamResource)object;
71
		<strong>TeamResource team = (TeamResource)object;
72
		return "Team_"+team.getName();</strong>
72
		return "Team_"+team.getName();</strong>
73
	}
73
	}
74
74
75
	/* (non-Javadoc)
75
	/* (non-Javadoc)
76
	 * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#getType(java.lang.Object)
76
	 * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#getType(java.lang.Object)
77
	 */
77
	 */
78
	public String getType(Object element)
78
	public String getType(Object element)
79
	{
79
	{
80
		<strong>return RSESamplesPlugin.getResourceString("property.team_resource.type");</strong>
80
		<strong>return RSESamplesPlugin.getResourceString("property.team_resource.type");</strong>
81
	}
81
	}
82
82
83
	/* (non-Javadoc)
83
	/* (non-Javadoc)
84
	 * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#getParent(java.lang.Object)
84
	 * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#getParent(java.lang.Object)
85
	 */
85
	 */
86
	public Object getParent(Object element)
86
	public Object getParent(Object element)
87
	{
87
	{
88
		return null; // not really used, which is good because it is ambiguous
88
		return null; // not really used, which is good because it is ambiguous
89
	}
89
	}
90
	
90
	
91
	/* (non-Javadoc)
91
	/* (non-Javadoc)
92
	 * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#hasChildren(java.lang.Object)
92
	 * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#hasChildren(java.lang.Object)
93
	 */
93
	 */
94
	public boolean hasChildren(Object element)
94
	public boolean hasChildren(Object element)
95
	{
95
	{
96
		<strong>return true;</strong>
96
		<strong>return true;</strong>
97
	}
97
	}
98
98
99
	/* (non-Javadoc)
99
	/* (non-Javadoc)
100
	 * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#getChildren(java.lang.Object)
100
	 * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#getChildren(java.lang.Object)
101
	 */
101
	 */
102
	public Object[] getChildren(Object element)
102
	public Object[] getChildren(Object element)
103
	{
103
	{
104
		<strong>return ((TeamResource)element).getDevelopers();</strong>
104
		<strong>return ((TeamResource)element).getDevelopers();</strong>
105
	}
105
	}
106
106
107
	/**
107
	/**
108
	 * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#internalGetPropertyDescriptors()
108
	 * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#internalGetPropertyDescriptors()
109
	 */
109
	 */
110
	protected IPropertyDescriptor[] internalGetPropertyDescriptors()
110
	protected IPropertyDescriptor[] internalGetPropertyDescriptors()
111
	{
111
	{
112
		return null;
112
		return null;
113
	}
113
	}
114
114
115
	/* (non-Javadoc)
115
	/* (non-Javadoc)
116
	 * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#internalGetPropertyValue(java.lang.Object)
116
	 * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#internalGetPropertyValue(java.lang.Object)
117
	 */
117
	 */
118
	protected Object internalGetPropertyValue(Object key)
118
	protected Object internalGetPropertyValue(Object key)
119
	{
119
	{
120
		return null;
120
		return null;
121
	}
121
	}
122
122
123
	/**
123
	/**
124
	 * Intercept of parent method to indicate these objects can be renamed using the RSE-supplied
124
	 * Intercept of parent method to indicate these objects can be renamed using the RSE-supplied
125
	 *  rename action.
125
	 *  rename action.
126
	 */
126
	 */
127
	<a id="canRename"/>public boolean canRename(Object element)
127
	<a id="canRename"></a>public boolean canRename(Object element)
128
	{
128
	{
129
		<strong>return true;</strong>
129
		<strong>return true;</strong>
130
	}
130
	}
131
	
131
	
132
	/**
132
	/**
133
	 * Intercept of parent method to actually do the rename. RSE supplies the rename GUI, but 
133
	 * Intercept of parent method to actually do the rename. RSE supplies the rename GUI, but 
134
	 *  defers the action work of renaming to this adapter method.
134
	 *  defers the action work of renaming to this adapter method.
135
	 */
135
	 */
136
	<a id="doRename"/>public boolean doRename(Shell shell, Object element, String newName)
136
	<a id="doRename"></a>public boolean doRename(Shell shell, Object element, String newName)
137
	{
137
	{
138
		<strong>((TeamResource)element).setName(newName);
138
		<strong>((TeamResource)element).setName(newName);
139
		return true;</strong>
139
		return true;</strong>
140
	}
140
	}
141
	// --------------------------------------
141
	// --------------------------------------
142
	// ISystemRemoteElementAdapter methods...
142
	// ISystemRemoteElementAdapter methods...
143
	// --------------------------------------
143
	// --------------------------------------
144
144
145
	/* (non-Javadoc)
145
	/* (non-Javadoc)
146
	 * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getAbsoluteParentName(java.lang.Object)
146
	 * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getAbsoluteParentName(java.lang.Object)
147
	 */
147
	 */
148
	public String getAbsoluteParentName(Object element)
148
	public String getAbsoluteParentName(Object element)
149
	{
149
	{
150
		<strong>return "root";</strong> // not really applicable as we have no unique hierarchy
150
		<strong>return "root";</strong> // not really applicable as we have no unique hierarchy
151
	}
151
	}
152
152
153
	/* (non-Javadoc)
153
	/* (non-Javadoc)
154
	 * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getSubSystemConfigurationId(java.lang.Object)
154
	 * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getSubSystemConfigurationId(java.lang.Object)
155
	 */
155
	 */
156
	public String getSubSystemConfigurationId(Object element)
156
	public String getSubSystemConfigurationId(Object element)
157
	{
157
	{
158
		<strong>return "samples.subsystems.factory";</strong> // as declared in extension in plugin.xml 
158
		<strong>return "samples.subsystems.factory";</strong> // as declared in extension in plugin.xml 
159
	}
159
	}
160
160
161
	/* (non-Javadoc)
161
	/* (non-Javadoc)
162
	 * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getRemoteTypeCategory(java.lang.Object)
162
	 * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getRemoteTypeCategory(java.lang.Object)
163
	 */
163
	 */
164
	public String getRemoteTypeCategory(Object element)
164
	public String getRemoteTypeCategory(Object element)
165
	{
165
	{
166
		<strong>return "developers";</strong> // Course grained. Same for all our remote resources.
166
		<strong>return "developers";</strong> // Course grained. Same for all our remote resources.
167
	}
167
	}
168
168
169
	/* (non-Javadoc)
169
	/* (non-Javadoc)
170
	 * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getRemoteType(java.lang.Object)
170
	 * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getRemoteType(java.lang.Object)
171
	 */
171
	 */
172
	public String getRemoteType(Object element)
172
	public String getRemoteType(Object element)
173
	{
173
	{
174
		<strong>return "team";</strong> // Fine grained. Unique to this resource type.
174
		<strong>return "team";</strong> // Fine grained. Unique to this resource type.
175
	}
175
	}
176
176
177
	/* (non-Javadoc)
177
	/* (non-Javadoc)
178
	 * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getRemoteSubType(java.lang.Object)
178
	 * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getRemoteSubType(java.lang.Object)
179
	 */
179
	 */
180
	public String getRemoteSubType(Object element)
180
	public String getRemoteSubType(Object element)
181
	{
181
	{
182
		return null; // Very fine grained. We don't use it.
182
		return null; // Very fine grained. We don't use it.
183
	}
183
	}
184
184
185
	/* (non-Javadoc)
185
	/* (non-Javadoc)
186
	 * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#refreshRemoteObject(java.lang.Object, java.lang.Object)
186
	 * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#refreshRemoteObject(java.lang.Object, java.lang.Object)
187
	 */
187
	 */
188
	<a id="refreshRemoteObject"/>public boolean refreshRemoteObject(Object oldElement, Object newElement)
188
	<a id="refreshRemoteObject"></a>public boolean refreshRemoteObject(Object oldElement, Object newElement)
189
	{
189
	{
190
		<strong>TeamResource oldTeam = (TeamResource)oldElement;
190
		<strong>TeamResource oldTeam = (TeamResource)oldElement;
191
		TeamResource newTeam = (TeamResource)newElement;
191
		TeamResource newTeam = (TeamResource)newElement;
192
		newTeam.setName(oldTeam.getName());
192
		newTeam.setName(oldTeam.getName());
193
		return false;</strong> // If developer objects held references to their team names, we'd have to return true
193
		return false;</strong> // If developer objects held references to their team names, we'd have to return true
194
	}
194
	}
195
195
196
	/* (non-Javadoc)
196
	/* (non-Javadoc)
197
	 * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getRemoteParent(org.eclipse.swt.widgets.Shell, java.lang.Object)
197
	 * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getRemoteParent(org.eclipse.swt.widgets.Shell, java.lang.Object)
198
	 */
198
	 */
199
	public Object getRemoteParent(Shell shell, Object element) throws Exception
199
	public Object getRemoteParent(Shell shell, Object element) throws Exception
200
	{
200
	{
201
		return null; // maybe this would be a Project or Roster object, or leave as null if this is the root 
201
		return null; // maybe this would be a Project or Roster object, or leave as null if this is the root 
202
	}
202
	}
203
203
204
	/* (non-Javadoc)
204
	/* (non-Javadoc)
205
	 * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getRemoteParentNamesInUse(org.eclipse.swt.widgets.Shell, java.lang.Object)
205
	 * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getRemoteParentNamesInUse(org.eclipse.swt.widgets.Shell, java.lang.Object)
206
	 */
206
	 */
207
	<a id="getNames"/>public String[] getRemoteParentNamesInUse(Shell shell, Object element)
207
	<a id="getNames"></a>public String[] getRemoteParentNamesInUse(Shell shell, Object element)
208
			throws Exception
208
			throws Exception
209
	{
209
	{
210
		<strong>DeveloperSubSystem ourSS = (DeveloperSubSystem)getSubSystem(element);
210
		<strong>DeveloperSubSystem ourSS = (DeveloperSubSystem)getSubSystem(element);
211
		TeamResource[] allTeams = ourSS.getAllTeams();
211
		TeamResource[] allTeams = ourSS.getAllTeams();
212
		String[] allNames = new String[allTeams.length];
212
		String[] allNames = new String[allTeams.length];
213
		for (int idx = 0; idx &lt; allTeams.length; idx++)
213
		for (int idx = 0; idx &lt; allTeams.length; idx++)
214
		  allNames[idx] = allTeams[idx].getName();
214
		  allNames[idx] = allTeams[idx].getName();
215
		return allNames;</strong> // Return list of all team names 	
215
		return allNames;</strong> // Return list of all team names 	
216
	}
216
	}
217
217
218
	/* (non-Javadoc)
218
	/* (non-Javadoc)
219
	 * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#supportsUserDefinedActions(java.lang.Object)
219
	 * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#supportsUserDefinedActions(java.lang.Object)
220
	 */
220
	 */
221
	public boolean supportsUserDefinedActions(Object object) {
221
	public boolean supportsUserDefinedActions(Object object) {
222
		<strong>return false;</strong>
222
		<strong>return false;</strong>
223
	}
223
	}
224
224
225
}
225
}
226
</samp></pre>
226
</samp></pre>
227
</body>
227
</body>
228
</html>
228
</html>
(-)guide/tutorial/popup.html (-2 / +2 lines)
Lines 97-103 Link Here
97
<pre><code>
97
<pre><code>
98
	public void runCommand(String command) {
98
	public void runCommand(String command) {
99
		IRemoteCmdSubSystem cmdss = getRemoteCmdSubSystem();
99
		IRemoteCmdSubSystem cmdss = getRemoteCmdSubSystem();
100
		if (cmdss != null && cmdss.isConnected()) {
100
		if (cmdss != null &amp;&amp; cmdss.isConnected()) {
101
			// Run the command in a visible shell
101
			// Run the command in a visible shell
102
			RemoteCommandHelpers.runUniversalCommand(getShell(), command, ".", cmdss); //$NON-NLS-1$
102
			RemoteCommandHelpers.runUniversalCommand(getShell(), command, ".", cmdss); //$NON-NLS-1$
103
		} else {
103
		} else {
Lines 111-117 Link Here
111
	public IRemoteCmdSubSystem getRemoteCmdSubSystem() {
111
	public IRemoteCmdSubSystem getRemoteCmdSubSystem() {
112
		IHost myHost = getSubSystem().getHost();
112
		IHost myHost = getSubSystem().getHost();
113
		IRemoteCmdSubSystem[] subsys = RemoteCommandHelpers.getCmdSubSystems(myHost);
113
		IRemoteCmdSubSystem[] subsys = RemoteCommandHelpers.getCmdSubSystems(myHost);
114
		for (int i = 0; i < subsys.length; i++) {
114
		for (int i = 0; i &lt; subsys.length; i++) {
115
			if (subsys[i].getSubSystemConfiguration().supportsCommands()) {
115
			if (subsys[i].getSubSystemConfiguration().supportsCommands()) {
116
				return subsys[i];
116
				return subsys[i];
117
			}
117
			}
(-)guide/tutorial/DeveloperSubSystemConfiguration.html (-1 / +1 lines)
Lines 59-65 Link Here
59
	 * We intercept so that we can create an initial filter in that pool, which will
59
	 * We intercept so that we can create an initial filter in that pool, which will
60
	 *  list all teams.
60
	 *  list all teams.
61
	 */
61
	 */
62
	<a id="createDefaultFilterPool"/><strong>protected ISystemFilterPool createDefaultFilterPool(ISystemFilterPoolManager mgr)
62
	<a id="createDefaultFilterPool"></a><strong>protected ISystemFilterPool createDefaultFilterPool(ISystemFilterPoolManager mgr)
63
	{
63
	{
64
		ISystemFilterPool defaultPool = null;
64
		ISystemFilterPool defaultPool = null;
65
		try {
65
		try {
(-)guide/tutorial/ShowJarContents2.html (-117 / +117 lines)
Lines 1-117 Link Here
1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2
<html>
2
<html>
3
3
4
<head>
4
<head>
5
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
5
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
6
<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
6
<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
7
<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." >
7
<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." >
8
<LINK REL="STYLESHEET" HREF="../../book.css" TYPE="text/css">
8
<LINK REL="STYLESHEET" HREF="../../book.css" TYPE="text/css">
9
<title>ShowJarContents Class After Editing</title>
9
<title>ShowJarContents Class After Editing</title>
10
</head>
10
</head>
11
11
12
<body bgcolor="#ffffff">
12
<body bgcolor="#ffffff">
13
<h1>ShowJarContents Class After Editing</h1>
13
<h1>ShowJarContents Class After Editing</h1>
14
<pre><samp>
14
<pre><samp>
15
package samples.ui.actions;
15
package samples.ui.actions;
16
16
17
import java.util.ArrayList;
17
import java.util.ArrayList;
18
import java.util.Iterator;
18
import java.util.Iterator;
19
import java.util.List;
19
import java.util.List;
20
20
21
import org.eclipse.jface.action.IAction;
21
import org.eclipse.jface.action.IAction;
22
import org.eclipse.jface.dialogs.MessageDialog;
22
import org.eclipse.jface.dialogs.MessageDialog;
23
import org.eclipse.jface.viewers.IStructuredSelection;
23
import org.eclipse.jface.viewers.IStructuredSelection;
24
import org.eclipse.rse.core.model.IHost;
24
import org.eclipse.rse.core.model.IHost;
25
import org.eclipse.rse.core.subsystems.ISubSystem;
25
import org.eclipse.rse.core.subsystems.ISubSystem;
26
import org.eclipse.rse.shells.ui.RemoteCommandHelpers;
26
import org.eclipse.rse.shells.ui.RemoteCommandHelpers;
27
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
27
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
28
import org.eclipse.rse.subsystems.shells.core.subsystems.IRemoteCmdSubSystem;
28
import org.eclipse.rse.subsystems.shells.core.subsystems.IRemoteCmdSubSystem;
29
import org.eclipse.rse.ui.SystemBasePlugin;
29
import org.eclipse.rse.ui.SystemBasePlugin;
30
import org.eclipse.swt.widgets.Shell;
30
import org.eclipse.swt.widgets.Shell;
31
import org.eclipse.ui.IObjectActionDelegate;
31
import org.eclipse.ui.IObjectActionDelegate;
32
import org.eclipse.ui.IWorkbenchPart;
32
import org.eclipse.ui.IWorkbenchPart;
33
33
34
/**
34
/**
35
 * An action that runs a command to display the contents of a Jar file.
35
 * An action that runs a command to display the contents of a Jar file.
36
 * The plugin.xml file restricts this action so it only appears for .jar files.
36
 * The plugin.xml file restricts this action so it only appears for .jar files.
37
 */
37
 */
38
public class ShowJarContents implements IObjectActionDelegate {
38
public class ShowJarContents implements IObjectActionDelegate {
39
	private List _selectedFiles;
39
	private List _selectedFiles;
40
40
41
	/**
41
	/**
42
	 * Constructor for ShowJarContents.
42
	 * Constructor for ShowJarContents.
43
	 */
43
	 */
44
	public ShowJarContents() {
44
	public ShowJarContents() {
45
		_selectedFiles = new ArrayList();
45
		_selectedFiles = new ArrayList();
46
	}
46
	}
47
47
48
	protected Shell getShell() {
48
	protected Shell getShell() {
49
		return SystemBasePlugin.getActiveWorkbenchShell();
49
		return SystemBasePlugin.getActiveWorkbenchShell();
50
	}
50
	}
51
51
52
	protected IRemoteFile getFirstSelectedRemoteFile() {
52
	protected IRemoteFile getFirstSelectedRemoteFile() {
53
		if (_selectedFiles.size() > 0) {
53
		if (_selectedFiles.size() > 0) {
54
			return (IRemoteFile) _selectedFiles.get(0);
54
			return (IRemoteFile) _selectedFiles.get(0);
55
		}
55
		}
56
		return null;
56
		return null;
57
	}
57
	}
58
58
59
	protected ISubSystem getSubSystem() {
59
	protected ISubSystem getSubSystem() {
60
		return getFirstSelectedRemoteFile().getParentRemoteFileSubSystem();
60
		return getFirstSelectedRemoteFile().getParentRemoteFileSubSystem();
61
	}
61
	}
62
62
63
	/* (non-Javadoc)
63
	/* (non-Javadoc)
64
	 * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
64
	 * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
65
	 */
65
	 */
66
	public void run(IAction action) {
66
	public void run(IAction action) {
67
		IRemoteFile selectedFile = getFirstSelectedRemoteFile();
67
		IRemoteFile selectedFile = getFirstSelectedRemoteFile();
68
		String cmdToRun = "jar -tvf " + selectedFile.getAbsolutePath(); //$NON-NLS-1$
68
		String cmdToRun = "jar -tvf " + selectedFile.getAbsolutePath(); //$NON-NLS-1$
69
		try {
69
		try {
70
			runCommand(cmdToRun);
70
			runCommand(cmdToRun);
71
		} catch (Exception e) {
71
		} catch (Exception e) {
72
			String excType = e.getClass().getName();
72
			String excType = e.getClass().getName();
73
			MessageDialog.openError(getShell(), excType, excType + ": " + e.getLocalizedMessage()); //$NON-NLS-1$
73
			MessageDialog.openError(getShell(), excType, excType + ": " + e.getLocalizedMessage()); //$NON-NLS-1$
74
			e.printStackTrace();
74
			e.printStackTrace();
75
		}
75
		}
76
	}
76
	}
77
77
78
	public IRemoteCmdSubSystem getRemoteCmdSubSystem() {
78
	public IRemoteCmdSubSystem getRemoteCmdSubSystem() {
79
		//get the Command subsystem associated with the current host
79
		//get the Command subsystem associated with the current host
80
		IHost myHost = getSubSystem().getHost();
80
		IHost myHost = getSubSystem().getHost();
81
		IRemoteCmdSubSystem[] subsys = RemoteCommandHelpers.getCmdSubSystems(myHost);
81
		IRemoteCmdSubSystem[] subsys = RemoteCommandHelpers.getCmdSubSystems(myHost);
82
		for (int i = 0; i < subsys.length; i++) {
82
		for (int i = 0; i &lt; subsys.length; i++) {
83
			if (subsys[i].getSubSystemConfiguration().supportsCommands()) {
83
			if (subsys[i].getSubSystemConfiguration().supportsCommands()) {
84
				return subsys[i];
84
				return subsys[i];
85
			}
85
			}
86
		}
86
		}
87
		return null;
87
		return null;
88
	}
88
	}
89
89
90
	public void runCommand(String command) throws Exception {
90
	public void runCommand(String command) throws Exception {
91
		IRemoteCmdSubSystem cmdss = getRemoteCmdSubSystem();
91
		IRemoteCmdSubSystem cmdss = getRemoteCmdSubSystem();
92
		if (cmdss != null && cmdss.isConnected()) {
92
		if (cmdss != null &amp;&amp; cmdss.isConnected()) {
93
			// Run the command in a visible shell
93
			// Run the command in a visible shell
94
			RemoteCommandHelpers.runUniversalCommand(getShell(), command, ".", cmdss); //$NON-NLS-1$
94
			RemoteCommandHelpers.runUniversalCommand(getShell(), command, ".", cmdss); //$NON-NLS-1$
95
		} else {
95
		} else {
96
			MessageDialog.openError(getShell(), "No command subsystem", "Found no command subsystem");
96
			MessageDialog.openError(getShell(), "No command subsystem", "Found no command subsystem");
97
		}
97
		}
98
	}
98
	}
99
99
100
	public void selectionChanged(org.eclipse.jface.action.IAction action, org.eclipse.jface.viewers.ISelection selection) {
100
	public void selectionChanged(org.eclipse.jface.action.IAction action, org.eclipse.jface.viewers.ISelection selection) {
101
		_selectedFiles.clear();
101
		_selectedFiles.clear();
102
		// store the selected jars to be used when running
102
		// store the selected jars to be used when running
103
		Iterator theSet = ((IStructuredSelection) selection).iterator();
103
		Iterator theSet = ((IStructuredSelection) selection).iterator();
104
		while (theSet.hasNext()) {
104
		while (theSet.hasNext()) {
105
			Object obj = theSet.next();
105
			Object obj = theSet.next();
106
			if (obj instanceof IRemoteFile) {
106
			if (obj instanceof IRemoteFile) {
107
				_selectedFiles.add(obj);
107
				_selectedFiles.add(obj);
108
			}
108
			}
109
		}
109
		}
110
	}
110
	}
111
111
112
	public void setActivePart(IAction action, IWorkbenchPart targetPart) {
112
	public void setActivePart(IAction action, IWorkbenchPart targetPart) {
113
	}
113
	}
114
}
114
}
115
</samp></pre>
115
</samp></pre>
116
</body>
116
</body>
117
</html>
117
</html>
(-)guide/tutorial/index.html (-1 / +21 lines)
Line 1 Link Here
1
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>

	<head>
		<meta http-equiv="content-type" content="text/html;charset=utf-8">
		<meta name="generator" content="Adobe GoLive">
		<title>RSE Tutorials</title>
	</head>

	<body>
		<p>Note: This page exists only to provide a root page for debugging the 
		tutorial and should not 
		be accessible from any page or the table of contents.</p>
		<p><a href="pdeProject.html">Getting Started</a></p>
		<p><a href="propertypage.html">Property Page Tutorial</a></p>
		<p><a href="subsystem.html">Subsystem Tutorial</a></p>
		<p><a href="popup.html">Popup Menu Tutorial</a></p>
	</body>

</html>
1
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2
3
<html>
4
5
	<head>
6
		<meta http-equiv="content-type" content="text/html;charset=utf-8">
7
		<meta name="generator" content="Adobe GoLive">
8
		<title>RSE Tutorials</title>
9
	</head>
10
11
	<body>
12
		<p>Note: This page exists only to provide a root page for debugging the 
13
		tutorial and should not 
14
		be accessible from any page or the table of contents.</p>
15
		<p><a href="pdeProject.html">Getting Started</a></p>
16
		<p><a href="propertypage.html">Property Page Tutorial</a></p>
17
		<p><a href="subsystem.html">Subsystem Tutorial</a></p>
18
		<p><a href="popup.html">Popup Menu Tutorial</a></p>
19
	</body>
20
21
</html>
(-)guide/tutorial/DeveloperSubSystem.html (-1 / +1 lines)
Lines 125-131 Link Here
125
	 * @param parent - the parent resource object being expanded
125
	 * @param parent - the parent resource object being expanded
126
	 * @param filterString - typically defaults to "*". In future additional user-specific quick-filters may be supported.
126
	 * @param filterString - typically defaults to "*". In future additional user-specific quick-filters may be supported.
127
	 */
127
	 */
128
	<a id="resolveFilterString"/>protected Object[] internalResolveFilterString(Object parent, String filterString, IProgressMonitor monitor)
128
	<a id="resolveFilterString"></a>protected Object[] internalResolveFilterString(Object parent, String filterString, IProgressMonitor monitor)
129
         throws java.lang.reflect.InvocationTargetException,
129
         throws java.lang.reflect.InvocationTargetException,
130
                java.lang.InterruptedException
130
                java.lang.InterruptedException
131
	{
131
	{
(-)guide/tutorial/RSESamplesPlugin.html (-2 / +1 lines)
Lines 11-17 Link Here
11
11
12
<body>
12
<body>
13
<h1>RSESamplesPlugin Class</h1>
13
<h1>RSESamplesPlugin Class</h1>
14
<pre><samp>
15
<pre><code>
14
<pre><code>
16
package rsesamples;
15
package rsesamples;
17
16
Lines 168-173 Link Here
168
	}
167
	}
169
168
170
}
169
}
171
</code></pre></samp></pre>
170
</code></pre>
172
</body>
171
</body>
173
</html>
172
</html>
(-)guide/plugin/propertypage.html (-1 / +1 lines)
Lines 12-18 Link Here
12
<body bgcolor="#ffffff">
12
<body bgcolor="#ffffff">
13
<h1>Plugging In Property Pages</h1>
13
<h1>Plugging In Property Pages</h1>
14
<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 
14
<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 
15
from the base Eclipse Platform is used to contribute property pages.<BR/>
15
from the base Eclipse Platform is used to contribute property pages.<BR>
16
What is a property page?
16
What is a property page?
17
It is a page that shows up in the Eclipse <A href="propertypage_figure2.gif">Properties dialog</A> that users
17
It is a page that shows up in the Eclipse <A href="propertypage_figure2.gif">Properties dialog</A> that users
18
get to by right-clicking on an object within any tree or table view, and selecting
18
get to by right-clicking on an object within any tree or table view, and selecting
(-)guide/rse_int.html (+1 lines)
Lines 19-24 Link Here
19
  <li><a href="rse_int_architecture.html">Architectural Overview</a>,</li>
19
  <li><a href="rse_int_architecture.html">Architectural Overview</a>,</li>
20
  <li><a href="usingAPIs.html">API Description</a> as well as some extensive</li>
20
  <li><a href="usingAPIs.html">API Description</a> as well as some extensive</li>
21
  <li><a href="tutorials.html">Tutorials</a></li>.
21
  <li><a href="tutorials.html">Tutorials</a></li>.
22
</ul>
22
</div>
23
</div>
23
24
24
<h2>Provisional API</h2>
25
<h2>Provisional API</h2>
(-)guide/tutorials.html (-1 / +1 lines)
Lines 14-20 Link Here
14
extend the RSE:
14
extend the RSE:
15
<ul>
15
<ul>
16
<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.
16
<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.
17
<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.
17
<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.
18
<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.
18
<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.
19
</ul>
19
</ul>
20
<p>The source code for all tutorials is available in the RSE-examples package, which 
20
<p>The source code for all tutorials is available in the RSE-examples package, which 
(-)guide/api/messages/uiMessageAPI.html (-1 / +1 lines)
Lines 15-21 Link Here
15
</p>
15
</p>
16
<ul>
16
<ul>
17
<li>Static methods in the
17
<li>Static methods in the
18
<samp><A href="../../../reference/api/org/eclipse/rse/ui/SystemBasePlugin.html"org.eclipse.rse.ui.SystemBasePlugin</A></samp>
18
<samp><A href="../../../reference/api/org/eclipse/rse/ui/SystemBasePlugin.html">org.eclipse.rse.ui.SystemBasePlugin</A></samp>
19
class to load the message file and extract messages from it.
19
class to load the message file and extract messages from it.
20
<li>Classes in the
20
<li>Classes in the
21
<samp><A href="../../../reference/api/org/eclipse/rse/ui/messages/package-summary.html">org.eclipse.rse.ui.messages</A></samp>
21
<samp><A href="../../../reference/api/org/eclipse/rse/ui/messages/package-summary.html">org.eclipse.rse.ui.messages</A></samp>
(-)samples/samples.html (-1 / +1 lines)
Lines 10-15 Link Here
10
</head>
10
</head>
11
11
12
<body>
12
<body>
13
<h1>Installing The Examples
13
<h1>Installing The Examples</h1>
14
</body>
14
</body>
15
</html>
15
</html>
(-)customBuildCallbacks.xml (+1 lines)
Lines 1-3 Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
1
<!-- ===================================================================== -->
2
<!-- ===================================================================== -->
2
<!-- Custom targets called from a project's generated build.xml            -->
3
<!-- Custom targets called from a project's generated build.xml            -->
3
<!-- Set customBuildCallbacks=<path/to/this/file> in your build.properties.-->
4
<!-- Set customBuildCallbacks=<path/to/this/file> in your build.properties.-->
(-)guide/api/actions/uiActionsAPI.html (-1 / +1 lines)
Lines 31-37 Link Here
31
31
32
<h2>RSE-Supplied Base Classes for Actions</h2>
32
<h2>RSE-Supplied Base Classes for Actions</h2>
33
<p>Here are the primary base classes the RSE supplies for actions, all of which are found in the
33
<p>Here are the primary base classes the RSE supplies for actions, all of which are found in the
34
package <samp><A href="../../../reference/api/org/eclipse/rse/ui/actions/package-summary.html"org.eclipse.rse.ui.actions</A></samp>
34
package <samp><A href="../../../reference/api/org/eclipse/rse/ui/actions/package-summary.html">org.eclipse.rse.ui.actions</A></samp>
35
in the plugin <samp>org.eclipse.rse.ui</samp>:</p>
35
in the plugin <samp>org.eclipse.rse.ui</samp>:</p>
36
<TABLE border="1">
36
<TABLE border="1">
37
	<TBODY>
37
	<TBODY>

Return to bug 203124