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

Collapse All | Expand All

(-)UI/org/eclipse/rse/internal/ui/view/SystemViewAPIProviderForSubSystems.java (+1 lines)
Lines 18-23 Link Here
18
package org.eclipse.rse.internal.ui.view;
18
package org.eclipse.rse.internal.ui.view;
19
import org.eclipse.rse.core.model.IHost;
19
import org.eclipse.rse.core.model.IHost;
20
import org.eclipse.rse.core.subsystems.ISubSystem;
20
import org.eclipse.rse.core.subsystems.ISubSystem;
21
import org.eclipse.rse.ui.view.SystemAbstractAPIProvider;
21
22
22
23
23
/**
24
/**
(-)UI/org/eclipse/rse/internal/ui/view/SystemTestFilterStringAPIProviderImpl.java (+1 lines)
Lines 22-27 Link Here
22
import org.eclipse.rse.core.model.ISystemViewInputProvider;
22
import org.eclipse.rse.core.model.ISystemViewInputProvider;
23
import org.eclipse.rse.core.subsystems.ISubSystem;
23
import org.eclipse.rse.core.subsystems.ISubSystem;
24
import org.eclipse.rse.ui.SystemBasePlugin;
24
import org.eclipse.rse.ui.SystemBasePlugin;
25
import org.eclipse.rse.ui.view.SystemAbstractAPIProvider;
25
26
26
27
27
/**
28
/**
(-)UI/org/eclipse/rse/internal/ui/view/SystemViewAPIProviderForConnections.java (+1 lines)
Lines 17-22 Link Here
17
package org.eclipse.rse.internal.ui.view;
17
package org.eclipse.rse.internal.ui.view;
18
import org.eclipse.core.runtime.NullProgressMonitor;
18
import org.eclipse.core.runtime.NullProgressMonitor;
19
import org.eclipse.rse.core.model.IHost;
19
import org.eclipse.rse.core.model.IHost;
20
import org.eclipse.rse.ui.view.SystemAbstractAPIProvider;
20
21
21
/**
22
/**
22
 * This class is a provider of root nodes to the remote systems tree viewer part.
23
 * This class is a provider of root nodes to the remote systems tree viewer part.
(-)UI/org/eclipse/rse/internal/ui/view/SystemSelectRemoteObjectAPIProviderImpl.java (-3 / +4 lines)
Lines 29-42 Link Here
29
import org.eclipse.rse.core.filters.ISystemFilterStringReference;
29
import org.eclipse.rse.core.filters.ISystemFilterStringReference;
30
import org.eclipse.rse.core.filters.SystemFilterUtil;
30
import org.eclipse.rse.core.filters.SystemFilterUtil;
31
import org.eclipse.rse.core.model.IHost;
31
import org.eclipse.rse.core.model.IHost;
32
import org.eclipse.rse.core.model.ISystemViewInputProvider;
33
import org.eclipse.rse.core.subsystems.ISubSystem;
32
import org.eclipse.rse.core.subsystems.ISubSystem;
34
import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
33
import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
35
import org.eclipse.rse.ui.SystemBasePlugin;
34
import org.eclipse.rse.ui.SystemBasePlugin;
36
import org.eclipse.rse.ui.internal.model.SystemNewConnectionPromptObject;
35
import org.eclipse.rse.ui.internal.model.SystemNewConnectionPromptObject;
37
import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter;
36
import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter;
37
import org.eclipse.rse.ui.view.ISystemSelectRemoteObjectAPIProvider;
38
import org.eclipse.rse.ui.view.ISystemSelectRemoteObjectAPIProviderCaller;
38
import org.eclipse.rse.ui.view.ISystemSelectRemoteObjectAPIProviderCaller;
39
import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
39
import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
40
import org.eclipse.rse.ui.view.SystemAbstractAPIProvider;
40
import org.eclipse.rse.ui.view.SystemAdapterHelpers;
41
import org.eclipse.rse.ui.view.SystemAdapterHelpers;
41
import org.eclipse.swt.widgets.Shell;
42
import org.eclipse.swt.widgets.Shell;
42
43
Lines 53-60 Link Here
53
 */
54
 */
54
public class SystemSelectRemoteObjectAPIProviderImpl 
55
public class SystemSelectRemoteObjectAPIProviderImpl 
55
       extends SystemAbstractAPIProvider
56
       extends SystemAbstractAPIProvider
56
       implements ISystemViewInputProvider
57
       implements ISystemSelectRemoteObjectAPIProvider
57
{
58
 {
58
59
59
60
60
	protected ISubSystem subsystem = null;
61
	protected ISubSystem subsystem = null;
(-)UI/org/eclipse/rse/internal/ui/view/SystemResourceSelectionInputProvider.java (-142 lines)
Removed Link Here
1
/********************************************************************************
2
 * Copyright (c) 2004, 2007 IBM Corporation and others. All rights reserved.
3
 * This program and the accompanying materials are made available under the terms
4
 * of the Eclipse Public License v1.0 which accompanies this distribution, and is 
5
 * available at http://www.eclipse.org/legal/epl-v10.html
6
 * 
7
 * Initial Contributors:
8
 * The following IBM employees contributed to the Remote System Explorer
9
 * component that contains this file: David McKnight, Kushal Munir, 
10
 * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, 
11
 * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
12
 * 
13
 * Contributors:
14
 * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType
15
 * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
16
 * Martin Oberhuber (Wind River) - [202866] Fix exceptions in RSE browse dialog when SystemRegistry is not yet fully initialized
17
 ********************************************************************************/
18
19
package org.eclipse.rse.internal.ui.view;
20
import org.eclipse.rse.core.IRSESystemType;
21
import org.eclipse.rse.core.RSECorePlugin;
22
import org.eclipse.rse.core.model.IHost;
23
import org.eclipse.rse.core.model.ISystemRegistry;
24
import org.eclipse.rse.core.subsystems.ISubSystem;
25
26
27
public abstract class SystemResourceSelectionInputProvider extends SystemAbstractAPIProvider
28
{		
29
	private IHost _connection = null;
30
	private boolean _onlyConnection = false;
31
	private boolean _allowNew = true;
32
	private IRSESystemType[] _systemTypes;
33
	private String _category = null;
34
	
35
	public SystemResourceSelectionInputProvider(IHost connection)
36
	{
37
		_connection = connection;
38
	}
39
	
40
	public SystemResourceSelectionInputProvider()
41
	{
42
		// choose random host
43
		ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
44
		IHost[] hosts = registry.getHosts();
45
		if (hosts != null && hosts.length>0) {
46
			_connection = hosts[0];
47
		}
48
	}
49
	
50
	public IHost getSystemConnection()
51
	{
52
		return _connection;
53
	}
54
	
55
	public boolean allowMultipleConnections()
56
	{
57
		return !_onlyConnection;
58
	}
59
	
60
	public void setAllowNewConnection(boolean flag)
61
	{
62
		_allowNew = flag;
63
	}
64
	
65
	public boolean allowNewConnection()
66
	{
67
		return _allowNew;
68
	}
69
	
70
	public void setSystemConnection(IHost connection, boolean onlyConnection)
71
	{
72
		_connection = connection;
73
		_onlyConnection = onlyConnection;
74
	}
75
	
76
	public IRSESystemType[] getSystemTypes()
77
	{
78
		return _systemTypes;
79
	}
80
	
81
	public void setSystemTypes(IRSESystemType[] types)
82
	{
83
		_systemTypes = types;
84
	}
85
	
86
	public Object[] getSystemViewRoots()
87
	{
88
		if (_connection == null)
89
		{
90
			ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
91
			IHost[] hosts = registry.getHosts();
92
			if (hosts!=null && hosts.length!=0) {
93
				_connection = registry.getHosts()[0];
94
			}
95
		}
96
		return getConnectionChildren(_connection);
97
	}
98
99
	public boolean hasSystemViewRoots()
100
	{
101
		return false;
102
	}
103
104
	public Object[] getConnectionChildren(IHost selectedConnection)
105
	{
106
		if (selectedConnection != null)
107
		{
108
			ISubSystem ss = getSubSystem(selectedConnection);
109
			if (ss!=null) {
110
				return ss.getChildren();
111
			}
112
		}
113
		return new Object[0];
114
	}
115
116
	public boolean hasConnectionChildren(IHost selectedConnection)
117
	{
118
		if (selectedConnection != null)
119
		{
120
			ISubSystem ss = getSubSystem(selectedConnection);
121
			if (ss!=null) {
122
				return ss.hasChildren();
123
			}
124
		}
125
		return false;
126
	}
127
	
128
	protected abstract ISubSystem getSubSystem(IHost selectedConnection);
129
	
130
	
131
	public void setCategory(String category)
132
	{
133
		_category = category;
134
	}
135
	
136
	public String getCategory()
137
	{
138
		return _category;
139
	}
140
	
141
	
142
}
(-)UI/org/eclipse/rse/internal/ui/view/SystemViewAPIProviderForFilterStrings.java (+1 lines)
Lines 30-35 Link Here
30
import org.eclipse.rse.core.subsystems.ISubSystem;
30
import org.eclipse.rse.core.subsystems.ISubSystem;
31
import org.eclipse.rse.ui.ISystemMessages;
31
import org.eclipse.rse.ui.ISystemMessages;
32
import org.eclipse.rse.ui.RSEUIPlugin;
32
import org.eclipse.rse.ui.RSEUIPlugin;
33
import org.eclipse.rse.ui.view.SystemAbstractAPIProvider;
33
34
34
35
35
/**
36
/**
(-)UI/org/eclipse/rse/internal/ui/view/SystemTableViewPart.java (-3 / +4 lines)
Lines 95-100 Link Here
95
import org.eclipse.rse.ui.messages.ISystemMessageLine;
95
import org.eclipse.rse.ui.messages.ISystemMessageLine;
96
import org.eclipse.rse.ui.model.ISystemShellProvider;
96
import org.eclipse.rse.ui.model.ISystemShellProvider;
97
import org.eclipse.rse.ui.view.IRSEViewPart;
97
import org.eclipse.rse.ui.view.IRSEViewPart;
98
import org.eclipse.rse.ui.view.ISystemTableViewColumnManager;
98
import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
99
import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
99
import org.eclipse.rse.ui.view.SystemTableView;
100
import org.eclipse.rse.ui.view.SystemTableView;
100
import org.eclipse.rse.ui.view.SystemTableViewProvider;
101
import org.eclipse.rse.ui.view.SystemTableViewProvider;
Lines 806-812 Link Here
806
	    class SelectColumnsDialog extends SystemPromptDialog
807
	    class SelectColumnsDialog extends SystemPromptDialog
807
		{
808
		{
808
	        private ISystemViewElementAdapter _adapter;
809
	        private ISystemViewElementAdapter _adapter;
809
	        private SystemTableViewColumnManager _columnManager;
810
	        private ISystemTableViewColumnManager _columnManager;
810
			private IPropertyDescriptor[] _uniqueDescriptors;
811
			private IPropertyDescriptor[] _uniqueDescriptors;
811
			private ArrayList _currentDisplayedDescriptors;
812
			private ArrayList _currentDisplayedDescriptors;
812
			private ArrayList _availableDescriptors;
813
			private ArrayList _availableDescriptors;
Lines 820-826 Link Here
820
			private Button _downButton;
821
			private Button _downButton;
821
			
822
			
822
823
823
			public SelectColumnsDialog(Shell shell, ISystemViewElementAdapter viewAdapter, SystemTableViewColumnManager columnManager)
824
			public SelectColumnsDialog(Shell shell, ISystemViewElementAdapter viewAdapter, ISystemTableViewColumnManager columnManager)
824
			{
825
			{
825
				super(shell, SystemResources.RESID_TABLE_SELECT_COLUMNS_LABEL);
826
				super(shell, SystemResources.RESID_TABLE_SELECT_COLUMNS_LABEL);
826
				setToolTipText(SystemResources.RESID_TABLE_SELECT_COLUMNS_TOOLTIP);
827
				setToolTipText(SystemResources.RESID_TABLE_SELECT_COLUMNS_TOOLTIP);
Lines 1092-1098 Link Here
1092
		}
1093
		}
1093
		public void run()
1094
		public void run()
1094
		{
1095
		{
1095
		    SystemTableViewColumnManager mgr = _viewer.getColumnManager();		    
1096
		    ISystemTableViewColumnManager mgr = _viewer.getColumnManager();		    
1096
		    ISystemViewElementAdapter adapter = _viewer.getAdapterForContents();
1097
		    ISystemViewElementAdapter adapter = _viewer.getAdapterForContents();
1097
		    SelectColumnsDialog dlg = new SelectColumnsDialog(getShell(), adapter, mgr);
1098
		    SelectColumnsDialog dlg = new SelectColumnsDialog(getShell(), adapter, mgr);
1098
		    if (dlg.open() == Window.OK)
1099
		    if (dlg.open() == Window.OK)
(-)UI/org/eclipse/rse/internal/ui/view/SystemViewAPIProviderForFilters.java (+1 lines)
Lines 41-46 Link Here
41
import org.eclipse.rse.ui.RSEUIPlugin;
41
import org.eclipse.rse.ui.RSEUIPlugin;
42
import org.eclipse.rse.ui.SystemBasePlugin;
42
import org.eclipse.rse.ui.SystemBasePlugin;
43
import org.eclipse.rse.ui.subsystems.ISubSystemConfigurationAdapter;
43
import org.eclipse.rse.ui.subsystems.ISubSystemConfigurationAdapter;
44
import org.eclipse.rse.ui.view.SystemAbstractAPIProvider;
44
45
45
46
46
47
(-)UI/org/eclipse/rse/internal/ui/view/SystemTableViewColumnManager.java (-1 / +2 lines)
Lines 20-30 Link Here
20
20
21
import org.eclipse.jface.viewers.Viewer;
21
import org.eclipse.jface.viewers.Viewer;
22
import org.eclipse.rse.ui.SystemPreferencesManager;
22
import org.eclipse.rse.ui.SystemPreferencesManager;
23
import org.eclipse.rse.ui.view.ISystemTableViewColumnManager;
23
import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
24
import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
24
import org.eclipse.ui.views.properties.IPropertyDescriptor;
25
import org.eclipse.ui.views.properties.IPropertyDescriptor;
25
26
26
27
27
public class SystemTableViewColumnManager
28
public class SystemTableViewColumnManager implements ISystemTableViewColumnManager
28
{
29
{
29
    private Viewer _viewer;
30
    private Viewer _viewer;
30
	protected HashMap _descriptorCache;
31
	protected HashMap _descriptorCache;
(-)UI/org/eclipse/rse/internal/ui/view/SystemResourceSelectionForm.java (-636 lines)
Removed Link Here
1
/********************************************************************************
2
 * Copyright (c) 2006, 2007 IBM Corporation and others. All rights reserved.
3
 * This program and the accompanying materials are made available under the terms
4
 * of the Eclipse Public License v1.0 which accompanies this distribution, and is 
5
 * available at http://www.eclipse.org/legal/epl-v10.html
6
 * 
7
 * Initial Contributors:
8
 * The following IBM employees contributed to the Remote System Explorer
9
 * component that contains this file: David McKnight, Kushal Munir, 
10
 * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, 
11
 * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
12
 * 
13
 * Contributors:
14
 * Kevin Doyle (IBM) - Added getSystemViewForm()
15
 * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType
16
 * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
17
 * Martin Oberhuber (Wind River) - [190442] made SystemActionViewerFilter API
18
 * Martin Oberhuber (Wind River) - [202866] Fix exceptions in RSE browse dialog when SystemRegistry is not yet fully initialized
19
 ********************************************************************************/
20
21
package org.eclipse.rse.internal.ui.view;
22
23
import java.util.HashMap;
24
import java.util.Iterator;
25
import java.util.List;
26
27
import org.eclipse.core.runtime.IAdaptable;
28
import org.eclipse.jface.viewers.ISelection;
29
import org.eclipse.jface.viewers.ISelectionChangedListener;
30
import org.eclipse.jface.viewers.IStructuredSelection;
31
import org.eclipse.jface.viewers.SelectionChangedEvent;
32
import org.eclipse.jface.wizard.WizardPage;
33
import org.eclipse.rse.core.IRSESystemType;
34
import org.eclipse.rse.core.RSECorePlugin;
35
import org.eclipse.rse.core.filters.ISystemFilterReference;
36
import org.eclipse.rse.core.model.IHost;
37
import org.eclipse.rse.core.model.ISystemRegistry;
38
import org.eclipse.rse.core.subsystems.ISubSystem;
39
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
40
import org.eclipse.rse.ui.SystemActionViewerFilter;
41
import org.eclipse.rse.ui.SystemWidgetHelpers;
42
import org.eclipse.rse.ui.dialogs.SystemPromptDialog;
43
import org.eclipse.rse.ui.messages.ISystemMessageLine;
44
import org.eclipse.rse.ui.validators.IValidatorRemoteSelection;
45
import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter;
46
import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
47
import org.eclipse.rse.ui.view.SystemAdapterHelpers;
48
import org.eclipse.rse.ui.widgets.SystemHostCombo;
49
import org.eclipse.swt.SWT;
50
import org.eclipse.swt.events.SelectionAdapter;
51
import org.eclipse.swt.events.SelectionEvent;
52
import org.eclipse.swt.graphics.Point;
53
import org.eclipse.swt.layout.GridData;
54
import org.eclipse.swt.layout.GridLayout;
55
import org.eclipse.swt.widgets.Composite;
56
import org.eclipse.swt.widgets.Control;
57
import org.eclipse.swt.widgets.Label;
58
import org.eclipse.swt.widgets.Shell;
59
import org.eclipse.swt.widgets.Text;
60
61
62
public class SystemResourceSelectionForm implements ISelectionChangedListener
63
{	
64
	private Shell _shell;
65
	private boolean _multipleSelection = true;
66
	protected static final int PROMPT_WIDTH = 400; // The maximum width of the dialog's prompt, in pixels.
67
	
68
	private SystemResourceSelectionInputProvider _inputProvider;
69
	private SystemHostCombo _connectionCombo;
70
	private SystemViewForm _systemViewForm;
71
	private Composite _propertySheetContainer;
72
    protected SystemPropertySheetForm _ps;
73
	
74
	private Text _pathText;
75
	private boolean _isValid;
76
	private ISystemMessageLine _msgLine;
77
	protected Object previousSelection = null;
78
	private IValidatorRemoteSelection _selectionValidator = null;
79
	private boolean  showPropertySheet = false;
80
81
	
82
	protected Object  caller;
83
	protected boolean callerInstanceOfWizardPage, callerInstanceOfSystemPromptDialog;	
84
85
	protected String    _verbiage = null;
86
	protected Label     verbiageLabel;
87
	private Composite _container;
88
	
89
	// history
90
	private HashMap _history;
91
	
92
	// outputs 
93
	protected IHost outputConnection = null;
94
	protected Object[] outputObjects = null;	
95
	
96
	
97
	public SystemResourceSelectionForm(Shell shell, Composite parent, Object caller,
98
			SystemResourceSelectionInputProvider inputProvider, String verbiage,
99
			boolean multipleSelection, 
100
			ISystemMessageLine msgLine)
101
	{
102
		_msgLine= msgLine;
103
		_history = new HashMap();
104
		_inputProvider = inputProvider;
105
		_multipleSelection = multipleSelection;
106
		_shell = shell;
107
		_verbiage = verbiage;
108
		this.caller = caller;
109
		callerInstanceOfWizardPage = (caller instanceof WizardPage);
110
		callerInstanceOfSystemPromptDialog = (caller instanceof SystemPromptDialog);
111
	        
112
		createControls(parent);
113
	}	
114
	
115
	public void setMessageLine(ISystemMessageLine msgLine)
116
	{
117
		_msgLine = msgLine;
118
	}
119
	
120
	   /**
121
     * Return first selected object
122
     */	
123
    public Object getSelectedObject()
124
    {
125
    	if ((outputObjects != null) && (outputObjects.length>=1))
126
    	  return outputObjects[0];
127
    	else
128
    	  return null;
129
    }
130
    /**
131
     * Return all selected objects. 
132
     */	
133
    public Object[] getSelectedObjects()
134
    {
135
    	return outputObjects;
136
    }
137
    
138
    /**
139
     * Return the embedded System Tree object.
140
     * Will be null until createControls is called.
141
     */
142
    public SystemViewForm getSystemViewForm()
143
    {
144
    	return _systemViewForm;
145
    }
146
    
147
	public void createControls(Composite parent)
148
	{
149
    	_container = SystemWidgetHelpers.createComposite(parent, showPropertySheet ? 2 : 1);  
150
		//Composite container = new Composite(parent, SWT.NULL);
151
152
153
		// INNER COMPOSITE
154
		int gridColumns = 2;
155
		Composite composite_prompts = SystemWidgetHelpers.createFlushComposite(_container, gridColumns);	
156
157
        // PROPERTY SHEET COMPOSITE
158
		if (showPropertySheet)
159
		{
160
			createPropertySheet(_container, _shell);
161
		}
162
163
164
        // MESSAGE/VERBIAGE TEXT AT TOP
165
        verbiageLabel = SystemWidgetHelpers.createVerbiage(composite_prompts, _verbiage, gridColumns, false, PROMPT_WIDTH);
166
  
167
    	
168
		boolean allowMultipleConnnections = _inputProvider.allowMultipleConnections();
169
		if (!allowMultipleConnnections)
170
		{
171
			//Label connectionLabel = SystemWidgetHelpers.createLabel(composite_prompts, _inputProvider.getSystemConnection().getHostName());
172
		}
173
		else
174
		{
175
			IRSESystemType[] systemTypes = _inputProvider.getSystemTypes();
176
			String category = _inputProvider.getCategory();
177
		
178
			if (systemTypes != null)
179
			{
180
				_connectionCombo = new SystemHostCombo(composite_prompts, SWT.NULL, systemTypes, _inputProvider.getSystemConnection(), _inputProvider.allowNewConnection());	
181
			}
182
			else if (category != null)
183
			{
184
				_connectionCombo = new SystemHostCombo(composite_prompts, SWT.NULL, _inputProvider.getSystemConnection(), _inputProvider.allowNewConnection(), category);	
185
			}
186
			else
187
			{
188
				_connectionCombo = new SystemHostCombo(composite_prompts, SWT.NULL, 
189
						SystemWidgetHelpers.getValidSystemTypes(null),
190
						_inputProvider.getSystemConnection(),
191
						_inputProvider.allowNewConnection());	
192
				
193
			}
194
			_connectionCombo.addSelectionListener(new SelectionAdapter() 
195
					{
196
				   public void widgetSelected(SelectionEvent evt) 
197
				   {
198
					   IHost connection = _connectionCombo.getHost();
199
					   connectionChanged(connection);
200
				   }}
201
					);	
202
			_connectionCombo.listenToConnectionEvents(true);
203
		}
204
		
205
		_pathText = SystemWidgetHelpers.createReadonlyTextField(composite_prompts);
206
		_systemViewForm = new SystemViewForm(_shell, composite_prompts, SWT.NULL, _inputProvider, !_multipleSelection, _msgLine);
207
		_systemViewForm.addSelectionChangedListener(this);		
208
		
209
			
210
		GridLayout layout = new GridLayout();
211
		GridData gdata = new GridData(GridData.FILL_BOTH);
212
		composite_prompts.setLayout(layout);
213
		composite_prompts.setLayoutData(gdata);
214
			
215
		doInitializeFields();
216
	}
217
	
218
	private void doInitializeFields()
219
	{
220
		  setPageComplete();
221
		  return; 
222
	}
223
	
224
	/**
225
	 * Create the property sheet viewer
226
	 */
227
	private void createPropertySheet(Composite outerParent, Shell shell)
228
	{
229
		_propertySheetContainer = SystemWidgetHelpers.createFlushComposite(outerParent, 1);	
230
		((GridData)_propertySheetContainer.getLayoutData()).grabExcessVerticalSpace = true;
231
		((GridData)_propertySheetContainer.getLayoutData()).verticalAlignment = GridData.FILL;
232
233
        // PROPERTY SHEET VIEWER
234
        _ps = new SystemPropertySheetForm(shell,_propertySheetContainer, SWT.BORDER, _msgLine);			
235
	}
236
	
237
	public Control getInitialFocusControl()
238
	{
239
		return _systemViewForm.getTreeControl();
240
	}
241
	
242
	public void applyViewerFilter(SystemActionViewerFilter filter)
243
	{
244
		if (filter != null)
245
		{
246
			_systemViewForm.getSystemView().addFilter(filter);
247
		}
248
	}
249
    
250
	/**
251
	 * Completes processing of the wizard page or dialog. If this 
252
	 * method returns true, the wizard/dialog will close; 
253
	 * otherwise, it will stay active.
254
	 *
255
	 * @return true if no errors
256
	 */
257
	public boolean verify() 
258
	{
259
		if (_isValid)
260
		{
261
			if (_msgLine != null)
262
			{
263
				_msgLine.clearErrorMessage();    		
264
			}
265
			return true;
266
		}
267
		else
268
		{
269
			return false;
270
		}
271
	}
272
	
273
	protected ISystemViewElementAdapter getViewAdapter(Object selection)
274
	{
275
		if (selection != null && selection instanceof IAdaptable)
276
		{
277
			return (ISystemViewElementAdapter)((IAdaptable)selection).getAdapter(ISystemViewElementAdapter.class);
278
		}
279
		return null;
280
	}
281
	
282
	protected ISystemRemoteElementAdapter getRemoteAdapter(Object selection)
283
	{
284
		if (selection != null && selection instanceof IAdaptable)
285
		{
286
			return SystemAdapterHelpers.getRemoteAdapter(selection);
287
		}
288
		return null;
289
	}
290
	
291
	protected ISystemRemoteElementAdapter[] getRemoteAdapters(ISelection selection)
292
	{
293
		Object[] selectedObjects = getSelections(selection);
294
		ISystemRemoteElementAdapter[] adapters = new ISystemRemoteElementAdapter[selectedObjects.length];
295
		for (int idx=0; idx<adapters.length; idx++)
296
		{
297
			adapters[idx] = getRemoteAdapter(selectedObjects[idx]);
298
		}
299
		return adapters;
300
	}
301
	
302
	
303
	public void connectionChanged(IHost connection)
304
	{
305
		IHost previousConnection = _inputProvider.getSystemConnection();
306
		 if (previousConnection != connection)
307
		   {				 	
308
			
309
			   _inputProvider.setSystemConnection(connection, false);
310
			   		
311
			   _systemViewForm.refresh();
312
			   Object oldSelection = _history.get(connection);	
313
			   if (oldSelection != null)
314
			   {
315
				   setPreSelection(oldSelection);
316
			   }
317
		   }
318
	}
319
320
	public void setVerbiage(String verbiage)
321
	{
322
		_verbiage = verbiage;
323
	}
324
	
325
	public boolean setPreSelection(Object selection)
326
	{
327
		ISystemViewElementAdapter adapter = getViewAdapter(selection);
328
		if (adapter != null)
329
		{
330
			Object parent = adapter.getParent(selection);
331
			ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
332
			ISubSystem ss = adapter.getSubSystem(selection);
333
			IHost connection = ss.getHost();
334
			if (_inputProvider.allowMultipleConnections())
335
			{
336
				if (_connectionCombo.getHost()!= connection)
337
		 		{
338
		 			_connectionCombo.select(connection);
339
		 		}
340
			}
341
			List filterRefs = registry.findFilterReferencesFor(selection, ss, false);
342
			
343
			SystemView systemView = _systemViewForm.getSystemView();
344
			if (filterRefs.size() > 0)
345
			{
346
				ISystemFilterReference ref = (ISystemFilterReference)filterRefs.get(0);
347
				systemView.expandTo(ref, selection);
348
349
				return true;
350
			}
351
			else
352
			{
353
				if (setPreSelection(parent))
354
				{
355
					systemView.expandTo(parent, selection);
356
					return true;
357
				}				
358
			}
359
		}
360
		return false;
361
	}
362
363
    
364
    protected void setPathText(String text)
365
    {
366
    	_pathText.setText(text);
367
    }
368
  
369
    
370
    public Object[] getOutputObjects()
371
    {
372
    	return outputObjects;
373
    }
374
    
375
    /**
376
     * Return selected connection
377
     */	
378
    public IHost getSelectedConnection()
379
    {
380
    	return outputConnection;
381
    }
382
    
383
    /**
384
	 * Return first item currently selected.
385
	 */
386
	protected Object getFirstSelection(ISelection selection)
387
	{
388
		IStructuredSelection sSelection = (IStructuredSelection)selection;
389
		if (sSelection != null)
390
		{
391
	      Iterator selectionIterator = sSelection.iterator();
392
	      if (selectionIterator.hasNext())
393
	        return selectionIterator.next();
394
	      else
395
	        return null;
396
		}		
397
		return null;
398
	}	
399
	/**
400
	 * Return all items currently selected.
401
	 */
402
	protected Object[] getSelections(ISelection selection)
403
	{
404
		IStructuredSelection sSelection = (IStructuredSelection)selection;
405
		if (sSelection != null)
406
		{
407
		  Object[] selectedObjects = new Object[sSelection.size()]; 
408
	      Iterator selectionIterator = sSelection.iterator();
409
	      int idx = 0;
410
	      while (selectionIterator.hasNext())
411
	      	selectedObjects[idx++] = selectionIterator.next();
412
	      return selectedObjects;
413
		}		
414
		return null;
415
	}	
416
	
417
    
418
	private void setPathTextFromSelection(Object selection)
419
	{
420
		ISystemViewElementAdapter adapter = getViewAdapter(selection);
421
		String text = adapter.getAbsoluteName(selection);
422
	
423
		setPathText(text);
424
	}
425
	
426
	/**
427
	 * Show or hide the property sheet. This is called after the contents are created when the user
428
	 *  toggles the Details button.
429
	 * @param shell Use getShell() in your dialog or wizard page
430
	 * @param contents Use getContents() in your dialog or wizard page
431
	 * @return new state -> true if showing, false if hiding
432
	 */
433
	public boolean toggleShowPropertySheet(Shell shell, Control contents) 
434
	{
435
	    Point windowSize = shell.getSize();
436
	    Point oldSize = contents.computeSize(SWT.DEFAULT, SWT.DEFAULT);
437
438
		if (showPropertySheet) // hiding?
439
		{
440
          _ps.dispose();
441
442
          _propertySheetContainer.dispose();
443
         _ps = null;
444
         _propertySheetContainer = null;
445
          ((GridLayout)_container.getLayout()).numColumns = 1;
446
		}
447
		else // showing?
448
		{
449
		  //createPropertySheet((Composite)contents, shell);
450
          ((GridLayout)_container.getLayout()).numColumns = 2;
451
		  createPropertySheet(_container, shell);
452
		}
453
454
	    Point newSize = contents.computeSize(SWT.DEFAULT, SWT.DEFAULT);
455
	    shell.setSize(new Point(windowSize.x + (newSize.x - oldSize.x), windowSize.y));
456
	    
457
		if (_ps != null)
458
		{
459
		  ISelection s = _systemViewForm.getSelection();
460
		  if (s != null)
461
		    _ps.selectionChanged(s);		  
462
		}
463
	    
464
		showPropertySheet = !showPropertySheet;
465
		return showPropertySheet;
466
	}
467
	
468
	
469
//  ---------------------------------------------------
470
	// METHODS FOR SELECTION CHANGED LISTENER INTERFACE... 
471
	// ---------------------------------------------------
472
	/**
473
	 * User selected something in the _systemViewForm.
474
	 */
475
	public void selectionChanged(SelectionChangedEvent e)
476
	{
477
		_isValid = true;
478
		ISelection selection = e.getSelection();
479
		outputObjects = null;
480
		int selectionSize = ((IStructuredSelection)selection).size();
481
		if ((selectionSize > 1) && !_systemViewForm.sameParent())
482
		{
483
			clearErrorMessage();
484
			
485
			setPathText(""); //$NON-NLS-1$
486
			setPageComplete();
487
		    return; // don't enable OK/Add if selections from different parents
488
		}
489
		
490
		if (_ps != null)
491
			  _ps.selectionChanged(selection);
492
 
493
		Object selectedObject = getFirstSelection(selection);
494
		if (selectedObject == previousSelection && selectionSize == 1)
495
		{
496
			// DKM we null set this before, so we need to reset it
497
			outputObjects = getSelections(selection);
498
			return;	
499
		}
500
		clearErrorMessage();
501
		setPathText(""); //$NON-NLS-1$
502
		setPageComplete();
503
504
		previousSelection = selectedObject;  
505
		if (selectedObject != null)
506
		{
507
508
		  ISystemRemoteElementAdapter remoteAdapter = getRemoteAdapter(selectedObject);
509
		  if (remoteAdapter != null)
510
		  {
511
			setPathTextFromSelection(selectedObject);
512
			
513
			outputObjects = getSelections(selection);			
514
			outputConnection = remoteAdapter.getSubSystem(selectedObject).getHost();
515
			
516
		 	_history.put(outputConnection, previousSelection);
517
		  }
518
		  else
519
		  {
520
			  ISystemViewElementAdapter elementAdapter = (ISystemViewElementAdapter)((IAdaptable)selectedObject).getAdapter(ISystemViewElementAdapter.class);
521
			  if (elementAdapter != null)
522
			  {
523
					setPathTextFromSelection(selectedObject);
524
					
525
					outputObjects = getSelections(selection);			
526
					outputConnection = elementAdapter.getSubSystem(selectedObject).getHost();
527
					
528
				 	_history.put(outputConnection, previousSelection);
529
			  }
530
		  }
531
		  
532
		  
533
		  if (_selectionValidator != null) 
534
		  {
535
			  SystemMessage selectionMsg  = _selectionValidator.isValid(outputConnection, getSelections(selection), getRemoteAdapters(selection));
536
537
		  	  if (selectionMsg != null)
538
		  	  {
539
		  	  	_isValid = false;
540
		  	    setErrorMessage(selectionMsg);
541
		  	  }
542
		  }
543
		  setPageComplete();
544
		}
545
		
546
	}
547
	
548
	/**
549
	 * This method can be called by the dialog or wizard page host, to decide whether to enable
550
	 * or disable the next, final or ok buttons. It returns true if the minimal information is
551
	 * available and is correct.
552
	 */
553
	public boolean isPageComplete()
554
	{
555
		return ( (_pathText.getText().length() > 0) ) && _isValid;
556
	}
557
	
558
	/**
559
	 * Inform caller of page-complete status of this form
560
	 */
561
	public void setPageComplete()
562
	{
563
		if (callerInstanceOfWizardPage)
564
		{
565
		  ((WizardPage)caller).setPageComplete(isPageComplete());
566
		}
567
		else if (callerInstanceOfSystemPromptDialog)
568
		{
569
		  ((SystemPromptDialog)caller).setPageComplete(isPageComplete());
570
		}		
571
	}
572
  
573
    /**
574
     * Show the property sheet on the right hand side, to show the properties of the
575
     * selected object.
576
     * <p>
577
     * Default is false
578
     */
579
    public void setShowPropertySheet(boolean show)
580
    {
581
    	this.showPropertySheet = show;
582
    }
583
 
584
   
585
	
586
    /**
587
     * Specify a validator to use when the user selects a remote file or folder.
588
     * This allows you to decide if OK should be enabled or not for that remote file or folder.
589
     */
590
    public void setSelectionValidator(IValidatorRemoteSelection selectionValidator)
591
    {
592
    	_selectionValidator = selectionValidator;
593
    }
594
595
    protected void clearErrorMessage()
596
    {
597
    	if (_msgLine != null)
598
    	  _msgLine.clearErrorMessage();
599
    }
600
    protected void setErrorMessage(String msg)
601
    {
602
    	if (_msgLine != null)
603
    	  if (msg != null)
604
    	    _msgLine.setErrorMessage(msg);
605
    	  else
606
    	    _msgLine.clearErrorMessage();
607
    }
608
    protected void setErrorMessage(SystemMessage msg)
609
    {
610
    	if (_msgLine != null)
611
    	  if (msg != null)
612
    	    _msgLine.setErrorMessage(msg);
613
    	  else
614
    	    _msgLine.clearErrorMessage();
615
    }
616
    
617
618
    /**
619
     * Set the message shown as the text at the top of the form. Eg, "Select a file"
620
     */
621
    public void setMessage(String message)
622
    {
623
    	this._verbiage = message;
624
    	if (verbiageLabel != null)
625
    	  verbiageLabel.setText(message);
626
    }
627
    /**
628
     * Set the tooltip text for the remote systems tree from which an item is selected.
629
     */
630
    public void setSelectionTreeToolTipText(String tip)
631
    {
632
    	_systemViewForm.setToolTipText(tip);
633
    }
634
635
636
}
(-)UI/org/eclipse/rse/internal/ui/view/SystemViewAdapterFactory.java (-179 lines)
Removed Link Here
1
/********************************************************************************
2
 * Copyright (c) 2006, 2007 IBM Corporation and others. All rights reserved.
3
 * This program and the accompanying materials are made available under the terms
4
 * of the Eclipse Public License v1.0 which accompanies this distribution, and is 
5
 * available at http://www.eclipse.org/legal/epl-v10.html
6
 * 
7
 * Initial Contributors:
8
 * The following IBM employees contributed to the Remote System Explorer
9
 * component that contains this file: David McKnight, Kushal Munir, 
10
 * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, 
11
 * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
12
 * 
13
 * Contributors:
14
 * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
15
 * Martin Oberhuber (Wind River) - [190271] Move ISystemViewInputProvider to Core
16
 * Xuan Chen        (IBM)        - [222263] Need to provide a PropertySet Adapter for System Team View
17
 ********************************************************************************/
18
19
package org.eclipse.rse.internal.ui.view;
20
21
import org.eclipse.core.runtime.IAdapterFactory;
22
import org.eclipse.core.runtime.IAdapterManager;
23
import org.eclipse.rse.core.filters.ISystemFilter;
24
import org.eclipse.rse.core.filters.ISystemFilterPool;
25
import org.eclipse.rse.core.filters.ISystemFilterPoolReference;
26
import org.eclipse.rse.core.filters.ISystemFilterReference;
27
import org.eclipse.rse.core.filters.ISystemFilterString;
28
import org.eclipse.rse.core.model.IHost;
29
import org.eclipse.rse.core.model.ISystemMessageObject;
30
import org.eclipse.rse.core.model.ISystemProfile;
31
import org.eclipse.rse.core.model.ISystemViewInputProvider;
32
import org.eclipse.rse.core.subsystems.ISubSystem;
33
import org.eclipse.rse.core.subsystems.ISystemDragDropAdapter;
34
import org.eclipse.rse.internal.ui.view.team.SystemTeamViewCategoryAdapter;
35
import org.eclipse.rse.internal.ui.view.team.SystemTeamViewCategoryNode;
36
import org.eclipse.rse.internal.ui.view.team.SystemTeamViewProfileAdapter;
37
import org.eclipse.rse.internal.ui.view.team.SystemTeamViewPropertySetAdapter;
38
import org.eclipse.rse.internal.ui.view.team.SystemTeamViewPropertySetNode;
39
import org.eclipse.rse.internal.ui.view.team.SystemTeamViewSubSystemConfigurationAdapter;
40
import org.eclipse.rse.internal.ui.view.team.SystemTeamViewSubSystemConfigurationNode;
41
import org.eclipse.rse.ui.SystemBasePlugin;
42
import org.eclipse.rse.ui.internal.model.SystemNewConnectionPromptObject;
43
import org.eclipse.rse.ui.model.ISystemPromptableObject;
44
import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
45
import org.eclipse.ui.IActionFilter;
46
import org.eclipse.ui.model.IWorkbenchAdapter;
47
import org.eclipse.ui.progress.IDeferredWorkbenchAdapter;
48
import org.eclipse.ui.views.properties.IPropertySource;
49
50
/**
51
 * This factory maps requests for an adapter object from a given
52
 *  element object.
53
 */
54
public class SystemViewAdapterFactory implements IAdapterFactory {
55
56
	private SystemViewRootInputAdapter rootAdapter = new SystemViewRootInputAdapter();
57
	private SystemViewConnectionAdapter connectionAdapter = new SystemViewConnectionAdapter();
58
	private SystemViewSubSystemAdapter subsystemAdapter = new SystemViewSubSystemAdapter();
59
	private SystemViewFilterPoolAdapter filterPoolAdapter = new SystemViewFilterPoolAdapter();
60
	private SystemViewFilterAdapter filterAdapter = new SystemViewFilterAdapter();
61
	private SystemViewFilterPoolReferenceAdapter filterPoolReferenceAdapter = new SystemViewFilterPoolReferenceAdapter();
62
	private SystemViewFilterReferenceAdapter filterReferenceAdapter = new SystemViewFilterReferenceAdapter();
63
	private SystemViewMessageAdapter msgAdapter = new SystemViewMessageAdapter();
64
	private SystemViewPromptableAdapter promptAdapter = new SystemViewPromptableAdapter();
65
	private SystemViewNewConnectionPromptAdapter newConnPromptAdapter = new SystemViewNewConnectionPromptAdapter();
66
	private SystemTeamViewProfileAdapter profileAdapter = new SystemTeamViewProfileAdapter();
67
	private SystemTeamViewCategoryAdapter categoryAdapter = new SystemTeamViewCategoryAdapter();
68
	private SystemTeamViewSubSystemConfigurationAdapter subsysFactoryAdapter = new SystemTeamViewSubSystemConfigurationAdapter();
69
	private SystemTeamViewPropertySetAdapter propertySetAdapter = new SystemTeamViewPropertySetAdapter();
70
71
	private SystemViewFilterStringAdapter filterStringAdapter = new SystemViewFilterStringAdapter();
72
73
	/**
74
	 * @see IAdapterFactory#getAdapterList()
75
	 */
76
	public Class[] getAdapterList() {
77
		return new Class[] { ISystemViewElementAdapter.class, ISystemDragDropAdapter.class, IPropertySource.class, IWorkbenchAdapter.class,
78
													IActionFilter.class, IDeferredWorkbenchAdapter.class };
79
	}
80
81
	/**
82
	 * Called by our plugin's startup method to register our adaptable object types 
83
	 * with the platform. We prefer to do it here to isolate/encapsulate all factory
84
	 * logic in this one place.
85
	 * @param manager the adapter manager controlling this factory
86
	 */
87
	public void registerWithManager(IAdapterManager manager) {
88
		manager.registerAdapters(this, ISystemViewInputProvider.class);
89
		manager.registerAdapters(this, ISystemProfile.class);
90
		manager.registerAdapters(this, IHost.class);
91
		manager.registerAdapters(this, ISubSystem.class);
92
		manager.registerAdapters(this, ISystemFilter.class);
93
		manager.registerAdapters(this, ISystemFilterPool.class);
94
		manager.registerAdapters(this, ISystemFilterPoolReference.class);
95
		manager.registerAdapters(this, ISystemFilterReference.class);
96
		manager.registerAdapters(this, ISystemFilterString.class);
97
		manager.registerAdapters(this, ISystemMessageObject.class);
98
		manager.registerAdapters(this, ISystemPromptableObject.class);
99
		manager.registerAdapters(this, SystemTeamViewCategoryNode.class);
100
		manager.registerAdapters(this, SystemTeamViewSubSystemConfigurationNode.class);
101
		manager.registerAdapters(this, SystemTeamViewPropertySetNode.class);
102
103
		// FIXME - UDAs no longer in core
104
		//manager.registerAdapters(this, SystemTeamViewCompileTypeNode.class);
105
		//manager.registerAdapters(this, SystemTeamViewCompileCommandNode.class);	
106
		//manager.registerAdapters(this, SystemUDActionElement.class);
107
	}
108
109
	/* (non-Javadoc)
110
	 * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
111
	 */
112
	public Object getAdapter(Object adaptableObject, Class adapterType) {
113
		Object adapter = null;
114
		if (adaptableObject instanceof ISystemViewElementAdapter)
115
			adapter = adaptableObject;
116
		else if (adaptableObject instanceof ISystemDragDropAdapter)
117
			adapter = adaptableObject;
118
		else if (adaptableObject instanceof ISystemViewInputProvider)
119
			adapter = rootAdapter;
120
		else if (adaptableObject instanceof ISystemProfile)
121
			adapter = profileAdapter;
122
		else if (adaptableObject instanceof IHost)
123
			adapter = connectionAdapter;
124
		else if (adaptableObject instanceof ISubSystem)
125
			adapter = subsystemAdapter;
126
		else if (adaptableObject instanceof ISystemFilterPoolReference)
127
			adapter = filterPoolReferenceAdapter;
128
		else if (adaptableObject instanceof ISystemFilterPool)
129
			adapter = filterPoolAdapter;
130
		else if (adaptableObject instanceof ISystemFilterReference)
131
			adapter = filterReferenceAdapter;
132
		else if (adaptableObject instanceof ISystemFilterString)
133
			adapter = filterStringAdapter;
134
		else if (adaptableObject instanceof ISystemFilter)
135
			adapter = filterAdapter;
136
		else if (adaptableObject instanceof ISystemMessageObject)
137
			adapter = msgAdapter;
138
		else if (adaptableObject instanceof ISystemPromptableObject) {
139
140
			if (adaptableObject instanceof SystemNewConnectionPromptObject) {
141
				adapter = newConnPromptAdapter;
142
			} else {
143
				adapter = promptAdapter;
144
			}
145
		} else if (adaptableObject instanceof SystemTeamViewCategoryNode)
146
			adapter = categoryAdapter;
147
		else if (adaptableObject instanceof SystemTeamViewSubSystemConfigurationNode) adapter = subsysFactoryAdapter;
148
		else if (adaptableObject instanceof SystemTeamViewPropertySetNode) adapter = propertySetAdapter;
149
150
		/** FIXME - UDAs no longer in core
151
		 else if (adaptableObject instanceof SystemTeamViewCompileTypeNode)
152
		 adapter = getCompileTypeAdapter();
153
		 else if (adaptableObject instanceof SystemTeamViewCompileCommandNode)
154
		 adapter = getCompileCommandAdapter();	      	      
155
		 else if (adaptableObject instanceof SystemUDActionElement)
156
		 adapter = getUserActionAdapter();
157
		 */
158
159
		if ((adapter != null) && (adapterType == IPropertySource.class)) {
160
			((ISystemViewElementAdapter) adapter).setPropertySourceInput(adaptableObject);
161
		} else if (adapter == null) {
162
			SystemBasePlugin.logWarning("No adapter found for object of type: " + adaptableObject.getClass().getName()); //$NON-NLS-1$
163
		}
164
		return adapter;
165
	}
166
167
	/**
168
	 * Because we use singletons for our adapters, it is possible to speed up 
169
	 * access to them by simply returning them from here.
170
	 * <p>
171
	 * This method returns the RSE adapter for profile objects
172
	 * @return SystemViewProfileAdapter
173
	 * 
174
	 * @deprecated Call getAdapter(...) directly with a <code>ISystemProfile</code>. instance as adaptable object.
175
	 */
176
	public SystemTeamViewProfileAdapter getProfileAdapter() {
177
		return profileAdapter;
178
	}
179
}
(-)UI/org/eclipse/rse/internal/ui/view/SystemViewAPIProviderForFilterPools.java (+1 lines)
Lines 20-25 Link Here
20
import org.eclipse.rse.core.filters.ISystemFilterPoolReference;
20
import org.eclipse.rse.core.filters.ISystemFilterPoolReference;
21
import org.eclipse.rse.core.model.IHost;
21
import org.eclipse.rse.core.model.IHost;
22
import org.eclipse.rse.core.subsystems.ISubSystem;
22
import org.eclipse.rse.core.subsystems.ISubSystem;
23
import org.eclipse.rse.ui.view.SystemAbstractAPIProvider;
23
24
24
25
25
/**
26
/**
(-)UI/org/eclipse/rse/internal/ui/view/SystemEmptyListAPIProviderImpl.java (+1 lines)
Lines 18-23 Link Here
18
package org.eclipse.rse.internal.ui.view;
18
package org.eclipse.rse.internal.ui.view;
19
import org.eclipse.rse.core.model.IHost;
19
import org.eclipse.rse.core.model.IHost;
20
import org.eclipse.rse.core.model.ISystemViewInputProvider;
20
import org.eclipse.rse.core.model.ISystemViewInputProvider;
21
import org.eclipse.rse.ui.view.SystemAbstractAPIProvider;
21
22
22
23
23
/**
24
/**
(-)UI/org/eclipse/rse/internal/ui/view/SystemViewDataDropAdapter.java (-1 / +1 lines)
Lines 114-120 Link Here
114
		for (int i = 0;i < tokens.length; i++)
114
		for (int i = 0;i < tokens.length; i++)
115
		{
115
		{
116
			String srcStr = tokens[i];
116
			String srcStr = tokens[i];
117
			if (srcStr.equals("org.eclipse.ui.navigator.ProjectExplorer"))
117
			if (srcStr.equals("org.eclipse.ui.navigator.ProjectExplorer")) //$NON-NLS-1$
118
			{
118
			{
119
				return true;
119
				return true;
120
			}
120
			}
(-)UI/org/eclipse/rse/internal/ui/view/SystemViewForm.java (-518 lines)
Removed Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2008 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Initial Contributors:
9
 * The following IBM employees contributed to the Remote System Explorer
10
 * component that contains this file: David McKnight, Kushal Munir, 
11
 * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, 
12
 * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
13
 * 
14
 * Contributors:
15
 * Kevin Doyle (IBM) - [187553] - Removed code and related methods for toolbar/button bar.
16
 * Martin Oberhuber (Wind River) - [190271] Move ISystemViewInputProvider to Core
17
 * David McKnight    (IBM)   - [187711] select SystemView APIs exposed by the ISystemTree interface
18
 *******************************************************************************/
19
package org.eclipse.rse.internal.ui.view;
20
import java.util.List;
21
import java.util.Vector;
22
23
import org.eclipse.jface.action.ToolBarManager;
24
import org.eclipse.jface.viewers.ISelection;
25
import org.eclipse.jface.viewers.ISelectionChangedListener;
26
import org.eclipse.jface.viewers.ViewerFilter;
27
import org.eclipse.jface.wizard.WizardPage;
28
import org.eclipse.rse.core.filters.ISystemFilter;
29
import org.eclipse.rse.core.filters.ISystemFilterReference;
30
import org.eclipse.rse.core.model.ISystemViewInputProvider;
31
import org.eclipse.rse.core.subsystems.ISubSystem;
32
import org.eclipse.rse.ui.dialogs.SystemPromptDialog;
33
import org.eclipse.rse.ui.messages.ISystemMessageLine;
34
import org.eclipse.rse.ui.view.ISystemLongRunningRequestListener;
35
import org.eclipse.rse.ui.view.ISystemTree;
36
import org.eclipse.rse.ui.view.SystemLongRunningRequestEvent;
37
import org.eclipse.swt.SWT;
38
import org.eclipse.swt.events.MouseAdapter;
39
import org.eclipse.swt.events.MouseEvent;
40
import org.eclipse.swt.events.MouseListener;
41
import org.eclipse.swt.layout.GridData;
42
import org.eclipse.swt.layout.GridLayout;
43
import org.eclipse.swt.widgets.Button;
44
import org.eclipse.swt.widgets.Composite;
45
import org.eclipse.swt.widgets.Item;
46
import org.eclipse.swt.widgets.Shell;
47
import org.eclipse.swt.widgets.ToolBar;
48
import org.eclipse.swt.widgets.Tree;
49
import org.eclipse.swt.widgets.TreeItem;
50
51
52
/**
53
 * This re-usable widget is for a single widget that displays a 
54
 *  toolbar underneath which is a systems view tree.
55
 */
56
public class SystemViewForm extends Composite implements  ISystemTree
57
{
58
	private ToolBar        toolbar = null;
59
	private ToolBarManager toolbarMgr = null;
60
	private Button         refreshButton, getListButton;
61
	private SystemView     tree = null;
62
	private ISystemMessageLine msgLine = null;
63
	private boolean        showActions = true;
64
	private boolean        deferLoading = false;	
65
	private boolean        requestInProgress = false;
66
    private ISystemViewInputProvider inputProvider = null;
67
    private ISystemViewInputProvider emptyProvider = new SystemEmptyListAPIProviderImpl();
68
    private Vector         requestListeners = null;
69
	public static final int DEFAULT_WIDTH = 300;
70
	public static final int DEFAULT_HEIGHT = 300;
71
	
72
	// the following allows us to identify dialog/wizard hosting this widget so we can 
73
	// disable it's close capability while a remote request is in place.
74
	protected Object  caller;
75
	protected boolean callerInstanceOfWizardPage, callerInstanceOfSystemPromptDialog;
76
	
77
	// viewer filters
78
	protected ViewerFilter[] initViewerFilters = null;
79
	
80
	/**
81
	 * Constructor
82
	 * @param shell The owning window
83
	 * @param parent The owning composite
84
	 * @param style The swt style to apply to the overall composite. Typically SWT.NULL
85
	 * @param inputProvider Who is supplying the roots for the system viewer?
86
     * @param singleSelectionMode Are users allowed to select multiple things at once?
87
	 * @param msgLine where to show messages and tooltip text
88
	 */
89
	public SystemViewForm(Shell shell, Composite parent, int style, ISystemViewInputProvider inputProvider, 
90
	                      boolean singleSelectionMode, ISystemMessageLine msgLine)
91
	{
92
		this(shell, parent, style, inputProvider, singleSelectionMode, msgLine, 1, 1);	
93
	}
94
	/**
95
	 * Constructor when you want to span more than one column or row
96
	 * @param shell The owning window
97
	 * @param parent The owning composite
98
	 * @param style The swt style to apply to the overall composite. Typically SWT.NULL
99
	 * @param inputProvider Who is supplying the roots for the system viewer?
100
     * @param singleSelectionMode Are users allowed to select multiple things at once?
101
	 * @param msgLine where to show messages and tooltip text
102
	 * @param horizontalSpan how many columns in parent composite to span
103
	 * @param verticalSpan how many rows in parent composite to span
104
	 */
105
	public SystemViewForm(Shell shell, Composite parent, int style, ISystemViewInputProvider inputProvider, 
106
	                      boolean singleSelectionMode, ISystemMessageLine msgLine,  
107
	                      int horizontalSpan, int verticalSpan)
108
	{
109
		this(shell, parent, style, inputProvider, singleSelectionMode, msgLine, horizontalSpan, verticalSpan, null);
110
	}
111
	
112
	/**
113
	 * Constructor when you want to span more than one column or row
114
	 * @param shell The owning window
115
	 * @param parent The owning composite
116
	 * @param style The swt style to apply to the overall composite. Typically SWT.NULL
117
	 * @param inputProvider Who is supplying the roots for the system viewer?
118
     * @param singleSelectionMode Are users allowed to select multiple things at once?
119
	 * @param msgLine where to show messages and tooltip text
120
	 * @param horizontalSpan how many columns in parent composite to span
121
	 * @param verticalSpan how many rows in parent composite to span
122
	 * @param initViewerFilters the initial viewer filters to apply.
123
	 */
124
	public SystemViewForm(Shell shell, Composite parent, int style, ISystemViewInputProvider inputProvider, 
125
	                      boolean singleSelectionMode, ISystemMessageLine msgLine,  
126
	                      int horizontalSpan, int verticalSpan, ViewerFilter[] initViewerFilters)
127
	{
128
		super(parent, style);	
129
		this.inputProvider = inputProvider;
130
		this.msgLine = msgLine;
131
		callerInstanceOfWizardPage = (caller instanceof WizardPage);
132
		callerInstanceOfSystemPromptDialog = (caller instanceof SystemPromptDialog);				
133
		prepareComposite(1, horizontalSpan, verticalSpan);
134
    
135
	    // set viewer filters
136
	    this.initViewerFilters = initViewerFilters;
137
	    
138
	    createSystemView(shell, inputProvider, singleSelectionMode);
139
	    
140
	}
141
	
142
	/**
143
	 * Return the toolbar widget manager
144
	 */
145
	public ToolBarManager getToolBarManager()
146
	{
147
		return toolbarMgr;
148
	}
149
	/**
150
	 * Return the system view tree viewer
151
	 */
152
	public SystemView getSystemView()
153
	{
154
		return tree;
155
	}
156
	/**
157
	 * Return the system view tree viewer tree widget
158
	 */
159
	public Tree getTreeControl()
160
	{
161
		return tree.getTree();
162
	}
163
164
    /**
165
     * Set the tree's tooltip text
166
     */
167
    public void setToolTipText(String tip)
168
    {
169
    	tree.getTree().setToolTipText(tip);
170
    }
171
        
172
    /**
173
     * Refresh contents
174
     */
175
    public void refresh()
176
    {
177
    	tree.refreshAll();
178
    }
179
180
    /**
181
     * Reset contents
182
     */
183
    public void reset(ISystemViewInputProvider inputProvider)
184
    {
185
    	this.inputProvider = inputProvider;
186
    	if (deferLoading)
187
    	{
188
    	  tree.setSelection(null);
189
    	  tree.setInputProvider(emptyProvider);
190
    	}
191
    	else
192
    	{
193
    	  tree.setSelection(null);
194
    	  tree.setInputProvider(inputProvider);
195
    	}
196
    }
197
198
	/*
199
	 * Turn off right-click actions
200
	 *
201
	 NOW SET VIA INPUT PROVIDER METHODS
202
	public void setShowActions(boolean show)
203
	{
204
		this.showActions = show;
205
		if (tree != null)
206
		  tree.setShowActions(show);
207
	}*/
208
	    
209
	/**
210
	 * Disable/Enable all the child controls.
211
	 */
212
	public void setEnabled(boolean enabled)
213
	{
214
		if (toolbar != null)
215
		  toolbar.setEnabled(enabled);
216
		tree.setEnabled(enabled);
217
		//if ((tree != null) && (tree.getTree() != null))
218
		//  tree.getTree().setEnabled(enabled);		
219
		//super.setEnabled(enabled);
220
	}
221
	/**
222
	 * Register a listener interested in an item is selected in the system view
223
     * @see #removeSelectionChangedListener(ISelectionChangedListener)
224
     */
225
    public void addSelectionChangedListener(ISelectionChangedListener listener) 
226
    {
227
	    tree.addSelectionChangedListener(listener);
228
    }
229
    /** 
230
     * Remove a previously set system view selection listener.
231
     * @see #addSelectionChangedListener(ISelectionChangedListener)
232
     */
233
    public void removeSelectionChangedListener(ISelectionChangedListener listener) 
234
    {
235
	    tree.removeSelectionChangedListener(listener);
236
    }
237
    /**
238
     * Add a listener that is informed when a remote list request starts and stops.
239
     * This allows for the listener to do things like disable the Close button
240
     */
241
    public void addListRequestListener(ISystemLongRunningRequestListener listener)
242
    {
243
    	if (requestListeners == null)
244
    	  requestListeners = new Vector();
245
    	requestListeners.addElement(listener);
246
    }
247
    /**
248
     * Add a listener that is informed when a remote list request starts and stops.
249
     * This allows for the listener to do things like disable the Close button
250
     */
251
    public void removeListRequestListener(ISystemLongRunningRequestListener listener)
252
    {
253
    	if (requestListeners != null)
254
    	  requestListeners.removeElement(listener);
255
    }
256
    
257
    /**
258
     * Return the selection of the tree viewer
259
     */
260
    public ISelection getSelection()
261
    {
262
    	return tree.getSelection();
263
    }
264
	
265
266
	// --------------------------------------------	
267
	// ISystemTree methods to facilitate our GUI...
268
	//  ... all these are delegated to the SystemView tree
269
	// --------------------------------------------
270
    /**
271
     * Returns true if any of the selected items are currently expanded
272
     */
273
    public boolean areAnySelectedItemsExpanded()
274
    {
275
    	return tree.areAnySelectedItemsExpanded();
276
    }    
277
    /**
278
     * Returns true if any of the selected items are expandable but not yet expanded
279
     */
280
    public boolean areAnySelectedItemsExpandable()
281
    {
282
    	return tree.areAnySelectedItemsExpandable();
283
    }
284
	/**
285
	 * This is called to ensure all elements in a multiple-selection have the same parent in the
286
	 *  tree viewer. If they don't we automatically disable all actions. 
287
	 * <p>
288
	 * Designed to be as fast as possible by going directly to the SWT widgets
289
	 */
290
	public boolean sameParent()
291
	{
292
		return tree.sameParent();
293
	}
294
	/**
295
	 * This is called to accurately get the parent object for the current selection
296
	 *  for this viewer. 
297
	 * <p>
298
	 * The getParent() method in the adapter is very unreliable... adapters can't be sure
299
	 * of the context which can change via filtering and view options.
300
	 */
301
	public Object getSelectedParent()
302
	{
303
		return tree.getSelectedParent();
304
	}
305
	/**
306
	 * This returns the element immediately before the first selected element in this tree level.
307
	 * Often needed for enablement decisions for move up actions.
308
	 */
309
	public Object getPreviousElement()
310
	{
311
		 return tree.getPreviousElement();
312
	}
313
	/**
314
	 * This returns the element immediately after the last selected element in this tree level
315
	 * Often needed for enablement decisions for move down actions.
316
	 */
317
	public Object getNextElement()
318
	{
319
		 return tree.getNextElement();
320
	}
321
322
	/**
323
	 * This is called to walk the tree back up to the roots and return the visible root
324
	 *  node for the first selected object.
325
	 */
326
	public Object getRootParent()
327
	{
328
		return tree.getRootParent();
329
	}
330
	/**
331
	 * This returns an array containing each element in the tree, up to but not including the root.
332
	 * The array is in reverse order, starting at the leaf and going up.
333
	 */
334
	public Object[] getElementNodes(Object element)
335
	{
336
		return tree.getElementNodes(element);
337
	}
338
	/**
339
	 * Helper method to determine if a given object is currently selected.
340
	 * Does consider if a child node of the given object is currently selected.
341
	 */
342
	public boolean isSelectedOrChildSelected(Object parentElement)
343
	{
344
		return tree.isSelectedOrChildSelected(parentElement);
345
	}
346
347
	/**
348
	 * Return the number of immediate children in the tree, for the given tree node
349
	 */
350
    public int getChildCount(Object element)
351
	{
352
        return tree.getChildCount(element);
353
	}
354
355
    /**
356
     * Called when a property is updated and we need to inform the Property Sheet viewer.
357
     * There is no formal mechanism for this so we simulate a selection changed event as
358
     *  this is the only event the property sheet listens for.
359
     */
360
    public void updatePropertySheet()
361
    {
362
        tree.updatePropertySheet();
363
    }
364
	
365
    /**
366
     * Called to select an object within the tree, and optionally expand it
367
     */   
368
    public void select(Object element, boolean expand)
369
    {
370
        tree.select(element, expand);
371
    }
372
	
373
    /**
374
     * Returns the tree item of the first selected object. Used for setViewerItem in a resource
375
     *  change event.
376
     */
377
    public Item getViewerItem()
378
    {
379
    	return tree.getViewerItem();
380
    }	
381
    
382
    /**
383
     * Returns true if it is ok to close the dialog or wizard page. Returns false if there
384
     *  is a remote request currently in progress.
385
     */
386
    public boolean okToClose()
387
    {
388
    	return !requestInProgress; //d43433
389
    }
390
391
	// -----------------------
392
	// INTERNAL-USE METHODS...
393
	// -----------------------
394
	/**
395
	 * Prepares this composite control and sets the default layout data.
396
	 * @param Number of columns the new group will contain.     
397
	 */
398
	protected Composite prepareComposite(int numColumns,
399
	                                     int horizontalSpan, int verticalSpan)	
400
	{
401
		Composite composite = this;
402
		//GridLayout
403
		GridLayout layout = new GridLayout();
404
		layout.numColumns = numColumns;
405
		layout.marginWidth = 0;
406
		layout.marginHeight = 0;
407
		layout.horizontalSpacing = 0;		
408
		layout.verticalSpacing = 0;		
409
		composite.setLayout(layout);
410
		//GridData
411
		GridData data = new GridData();
412
		data.verticalAlignment = GridData.FILL;
413
		data.horizontalAlignment = GridData.FILL;
414
	    data.grabExcessHorizontalSpace = true;        
415
	    data.grabExcessVerticalSpace = true;	    
416
	    data.widthHint = DEFAULT_WIDTH;	    
417
	    data.heightHint = DEFAULT_HEIGHT;	
418
	    data.horizontalSpan = horizontalSpan;
419
	    data.verticalSpan = verticalSpan;    
420
		composite.setLayoutData(data);
421
		return composite;
422
	}
423
	
424
	protected void createSystemView(Shell shell, ISystemViewInputProvider inputProvider, boolean singleSelectionMode)
425
	{
426
		// TREE
427
        int style = (singleSelectionMode ? SWT.SINGLE : SWT.MULTI) | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER;
428
		tree = new SystemView(shell, this, style, deferLoading ? emptyProvider : inputProvider, msgLine, initViewerFilters);        
429
	    GridData treeData = new GridData();
430
	    treeData.horizontalAlignment = GridData.FILL;
431
	    treeData.verticalAlignment = GridData.FILL;	    
432
	    treeData.grabExcessHorizontalSpace = true;
433
	    treeData.grabExcessVerticalSpace = true;	    
434
	    treeData.widthHint = 300;        
435
	    treeData.heightHint= 200;
436
	    tree.getTree().setLayoutData(treeData);  	  	    		
437
	    tree.setShowActions(showActions);
438
	}
439
	
440
	protected void addOurMouseListener()
441
	{
442
	   MouseListener mouseListener = new MouseAdapter() 
443
	   {
444
		   public void mouseDown(MouseEvent e) 
445
		   {
446
			   //requestActivation();
447
		   }
448
	   };	
449
	   toolbar.addMouseListener(mouseListener);
450
	}
451
452
    /**
453
     * Fire long running request listener event
454
     */
455
    protected void fireRequestStartEvent()
456
    {
457
    	if (requestListeners != null)
458
    	{
459
    		SystemLongRunningRequestEvent event = new SystemLongRunningRequestEvent(); 
460
    		for (int idx=0; idx<requestListeners.size(); idx++)
461
    		   ((ISystemLongRunningRequestListener)requestListeners.elementAt(idx)).startingLongRunningRequest(event);
462
    	}
463
    }
464
465
    /**
466
     * Fire long running request listener event
467
     */
468
    protected void fireRequestStopEvent()
469
    {
470
    	if (requestListeners != null)
471
    	{
472
    		SystemLongRunningRequestEvent event = new SystemLongRunningRequestEvent(); 
473
    		for (int idx=0; idx<requestListeners.size(); idx++)
474
    		   ((ISystemLongRunningRequestListener)requestListeners.elementAt(idx)).endingLongRunningRequest(event);
475
    	}
476
    }
477
478
    
479
480
    /**
481
     * wrapper method to satisfy the ISystemTree interface
482
     */
483
	public void createTreeItems(TreeItem widget, Object[] children)
484
	{
485
		tree.createTreeItems(widget, children);
486
	}
487
	
488
    /**
489
     * wrapper method to satisfy the ISystemTree interface
490
     */
491
	public List findAllRemoteItemReferences(Object element,
492
			Object elementObject, List matches) {
493
		return tree.findAllRemoteItemReferences(element, elementObject, matches);
494
	}
495
	
496
    /**
497
     * wrapper method to satisfy the ISystemTree interface
498
     */
499
	public Item findFirstRemoteItemReference(Object remoteObject,
500
			Item parentItem) {
501
		return tree.findFirstRemoteItemReference(remoteObject, parentItem);
502
	}
503
	
504
    /**
505
     * wrapper method to satisfy the ISystemTree interface
506
     */
507
	public Tree getTree() {
508
		return tree.getTree();
509
	}
510
	
511
    /**
512
     * wrapper method to satisfy the ISystemTree interface
513
     */
514
	public ISystemFilterReference revealAndExpand(ISubSystem parentSubSystem,
515
			ISystemFilter filter) {
516
		return tree.revealAndExpand(parentSubSystem, filter);
517
	}
518
}
(-)UI/org/eclipse/rse/internal/ui/view/SystemAbstractAPIProvider.java (-213 lines)
Removed Link Here
1
/********************************************************************************
2
 * Copyright (c) 2002, 2008 IBM Corporation and others. All rights reserved.
3
 * This program and the accompanying materials are made available under the terms
4
 * of the Eclipse Public License v1.0 which accompanies this distribution, and is 
5
 * available at http://www.eclipse.org/legal/epl-v10.html
6
 * 
7
 * Initial Contributors:
8
 * The following IBM employees contributed to the Remote System Explorer
9
 * component that contains this file: David McKnight, Kushal Munir, 
10
 * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, 
11
 * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
12
 * 
13
 * Contributors:
14
 * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
15
 * Tobias Schwarz   (Wind River) - [173267] "empty list" should not be displayed 
16
 * Martin Oberhuber (Wind River) - [190271] Move ISystemViewInputProvider to Core
17
 * Martin Oberhuber (Wind River) - [218524][api] Remove deprecated ISystemViewInputProvider#getShell()
18
 ********************************************************************************/
19
20
package org.eclipse.rse.internal.ui.view;
21
import org.eclipse.core.runtime.Platform;
22
import org.eclipse.core.runtime.Preferences;
23
import org.eclipse.jface.viewers.Viewer;
24
import org.eclipse.rse.core.RSECorePlugin;
25
import org.eclipse.rse.core.model.ISystemMessageObject;
26
import org.eclipse.rse.core.model.ISystemRegistry;
27
import org.eclipse.rse.core.model.ISystemViewInputProvider;
28
import org.eclipse.rse.core.model.SystemMessageObject;
29
import org.eclipse.rse.ui.ISystemMessages;
30
import org.eclipse.rse.ui.ISystemPreferencesConstants;
31
import org.eclipse.rse.ui.RSEUIPlugin;
32
import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter;
33
import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
34
import org.eclipse.rse.ui.view.SystemAdapterHelpers;
35
import org.eclipse.swt.widgets.Shell;
36
37
38
39
/**
40
 * This is a base class that a provider of root nodes to the remote systems tree viewer part can
41
 * use as a parent class.
42
 */
43
public abstract class SystemAbstractAPIProvider 
44
       implements ISystemViewInputProvider
45
{
46
	protected Viewer viewer;
47
	protected ISystemRegistry sr;
48
	
49
	protected Object[] emptyList = new Object[0];
50
	protected Object[] msgList   = new Object[1];
51
	/**
52
	 * @deprecated Use {@link #checkForEmptyList(Object[], Object, boolean)} instead.
53
	 */
54
	protected SystemMessageObject nullObject     = null;
55
	protected SystemMessageObject canceledObject = null;	
56
	protected SystemMessageObject errorObject    = null;	
57
	
58
	private Preferences fPrefStore = null;
59
	
60
	/**
61
	 * Constructor 
62
	 */
63
	public SystemAbstractAPIProvider()
64
	{
65
		super();
66
		sr = RSECorePlugin.getTheSystemRegistry();
67
	}
68
	
69
    /**
70
	 * This is the method required by the IAdaptable interface.
71
	 * Given an adapter class type, return an object castable to the type, or
72
	 *  null if this is not possible.
73
	 */
74
    public Object getAdapter(Class adapterType)
75
    {
76
   	    return Platform.getAdapterManager().getAdapter(this, adapterType);	
77
    }           
78
79
    /*
80
     * (non-Javadoc)
81
     * @see org.eclipse.rse.ui.view.ISystemViewInputProvider#setViewer(java.lang.Object)
82
     */
83
    public void setViewer(Object viewer)
84
    {
85
    	this.viewer = (Viewer)viewer;
86
    }
87
    
88
    /*
89
     * (non-Javadoc)
90
     * @see org.eclipse.rse.ui.view.ISystemViewInputProvider#getViewer()
91
     */
92
    public Object getViewer()
93
    {
94
    	return viewer;
95
    }
96
97
    protected final void initMsgObjects()
98
 	{
99
 		nullObject     = new SystemMessageObject(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_EXPAND_EMPTY),ISystemMessageObject.MSGTYPE_EMPTY, null);
100
 		canceledObject = new SystemMessageObject(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_LIST_CANCELED),ISystemMessageObject.MSGTYPE_CANCEL, null);
101
 		errorObject    = new SystemMessageObject(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_EXPAND_FAILED),ISystemMessageObject.MSGTYPE_ERROR, null);
102
 	}
103
104
    /**
105
     * <i>Callable by subclasses. Do not override</i><br>
106
     * In getChildren, return <samp>checkForEmptyList(children, parent, true/false)<.samp>
107
     * versus your array directly. This method checks for a null array which is
108
     * not allowed and replaces it with an empty array. 
109
     * If true is passed then it returns the "Empty list" message object if the array is null or empty
110
     * 
111
     * @param children The list of children.
112
     * @param parent The parent for the children.
113
     * @param returnNullMsg <code>true</code> if an "Empty List" message should be returned.
114
     * @return The list of children, a list with the "Empty List" message object or an empty list.
115
     */
116
    protected Object[] checkForEmptyList(Object[] children, Object parent, boolean returnNullMsg) {
117
    	if ((children == null) || (children.length == 0)) {
118
    		if (fPrefStore == null) {
119
    			fPrefStore = RSEUIPlugin.getDefault().getPluginPreferences();
120
    		}
121
    		if (!returnNullMsg
122
    				|| (fPrefStore != null && !fPrefStore
123
    						.getBoolean(ISystemPreferencesConstants.SHOW_EMPTY_LISTS))) {
124
    			return emptyList;
125
    		} else {
126
    			return new Object[] {
127
    				new SystemMessageObject(
128
    					RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_EXPAND_EMPTY),
129
    					ISystemMessageObject.MSGTYPE_EMPTY, 
130
    					parent)};
131
    		}
132
    	}
133
    	return children;
134
    }
135
    
136
    /**
137
     * In getChildren, return checkForNull(children, true/false) vs your array directly.
138
     * This method checks for a null array which not allow and replaces it with an empty array.
139
     * If true is passed then it returns the "Empty list" message object if the array is null or empty
140
     * 
141
     * @deprecated Use {@link #checkForEmptyList(Object[], Object, boolean)} instead.
142
     */
143
    protected Object[] checkForNull(Object[] children, boolean returnNullMsg)
144
    {
145
	   if ((children == null) || (children.length==0))
146
	   {
147
	   	 if (!returnNullMsg)
148
           return emptyList;
149
         else
150
         {
151
	 	   if (nullObject == null)
152
	 	     initMsgObjects();
153
	 	   msgList[0] = nullObject;
154
	 	   return msgList;
155
         }
156
	   }
157
       else
158
         return children;
159
    }
160
161
    /**
162
     * Return the "Operation cancelled by user" msg as an object array so can be used to answer getChildren()
163
     */
164
    protected Object[] getCancelledMessageObject()
165
    {    	
166
		 if (canceledObject == null)
167
		   initMsgObjects();
168
		 msgList[0] = canceledObject;
169
		 return msgList;
170
    }    
171
172
    /**
173
     * Return the "Operation failed" msg as an object array so can be used to answer getChildren()
174
     */
175
    protected Object[] getFailedMessageObject()
176
    {    	
177
		 if (errorObject == null)
178
		   initMsgObjects();
179
		 msgList[0] = errorObject;
180
		 return msgList;
181
    }    
182
183
	/**
184
	 * Return true if we are listing connections or not, so we know whether we are interested in 
185
	 *  connection-add events
186
	 */
187
	public boolean showingConnections()
188
	{
189
		return false;
190
	}
191
192
	// ------------------
193
	// HELPER METHODS...
194
	// ------------------	
195
    /**
196
     * Returns the implementation of ISystemViewElement for the given
197
     * object.  Returns null if the adapter is not defined or the
198
     * object is not adaptable.
199
     */
200
    protected ISystemViewElementAdapter getViewAdapter(Object o) 
201
    {
202
    	return SystemAdapterHelpers.getViewAdapter(o);
203
    }
204
    
205
    /**
206
     * Returns the implementation of ISystemRemoteElement for the given
207
     * object.  Returns null if this object does not adaptable to this.
208
     */
209
    protected ISystemRemoteElementAdapter getRemoteAdapter(Object o) 
210
    {
211
    	return SystemAdapterHelpers.getRemoteAdapter(o);
212
    }
213
}
(-)UI/org/eclipse/rse/internal/ui/dialogs/SystemTestFilterStringDialog.java (-216 lines)
Removed Link Here
1
/********************************************************************************
2
 * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved.
3
 * This program and the accompanying materials are made available under the terms
4
 * of the Eclipse Public License v1.0 which accompanies this distribution, and is 
5
 * available at http://www.eclipse.org/legal/epl-v10.html
6
 * 
7
 * Initial Contributors:
8
 * The following IBM employees contributed to the Remote System Explorer
9
 * component that contains this file: David McKnight, Kushal Munir, 
10
 * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, 
11
 * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
12
 * 
13
 * Contributors:
14
 * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
15
 * Martin Oberhuber (Wind River) - [175680] Deprecate obsolete ISystemRegistry methods
16
 ********************************************************************************/
17
18
package org.eclipse.rse.internal.ui.dialogs;
19
import org.eclipse.jface.viewers.ISelectionChangedListener;
20
import org.eclipse.jface.viewers.SelectionChangedEvent;
21
import org.eclipse.rse.core.RSECorePlugin;
22
import org.eclipse.rse.core.model.IHost;
23
import org.eclipse.rse.core.model.ISystemRegistry;
24
import org.eclipse.rse.core.subsystems.ISubSystem;
25
import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
26
import org.eclipse.rse.internal.ui.SystemResources;
27
import org.eclipse.rse.internal.ui.view.SystemTestFilterStringAPIProviderImpl;
28
import org.eclipse.rse.internal.ui.view.SystemViewForm;
29
import org.eclipse.rse.ui.SystemWidgetHelpers;
30
import org.eclipse.rse.ui.dialogs.SystemPromptDialog;
31
import org.eclipse.rse.ui.widgets.SystemHostCombo;
32
import org.eclipse.swt.SWT;
33
import org.eclipse.swt.events.SelectionEvent;
34
import org.eclipse.swt.events.SelectionListener;
35
import org.eclipse.swt.layout.GridData;
36
import org.eclipse.swt.widgets.Composite;
37
import org.eclipse.swt.widgets.Control;
38
import org.eclipse.swt.widgets.Label;
39
import org.eclipse.swt.widgets.Shell;
40
41
42
43
/**
44
 * Dialog for testing a filter string. Typically called from a create/update filter string dialog.
45
 * <p>
46
 * Caller must supply the subsystem which owns this existing or potential filter string.
47
 * <p>
48
 * This dialog contains a dropdown for selecting connections to use in the test. Only connections which
49
 * contain subsystems with the same parent factory as the given subsystem factory are shown.
50
 *
51
 */
52
public class SystemTestFilterStringDialog
53
       extends SystemPromptDialog
54
       implements  ISelectionChangedListener, SelectionListener
55
{
56
	protected ISubSystem subsystem = null;
57
	protected ISystemRegistry sr = null;
58
	protected String subsystemConfigurationId = null;
59
	protected String filterString = null;
60
    protected SystemTestFilterStringAPIProviderImpl inputProvider = null;
61
	// GUI widgets
62
    protected Label prompt, promptValue;
63
	protected SystemViewForm tree;
64
	protected SystemHostCombo connectionCombo;
65
66
	/**
67
	 * Constructor
68
	 * @param shell The shell to hang the dialog off of
69
	 * @param subsystem The contextual subsystem that owns this filter string
70
	 * @param filterString The filter string that is to be tested.
71
	 */
72
	public SystemTestFilterStringDialog(Shell shell, ISubSystem subsystem, String filterString)
73
	{
74
		this(shell, SystemResources.RESID_TESTFILTERSTRING_TITLE, subsystem, filterString);			
75
	}
76
	/**
77
	 * Constructor when unique title desired
78
	 * @param shell The shell to hang the dialog off of
79
	 * @param title The title to give the dialog
80
	 * @param subsystem The contextual subsystem that owns this filter string
81
	 * @param filterString The filter string that is to be tested.
82
	 */
83
	public SystemTestFilterStringDialog(Shell shell, String title, ISubSystem subsystem, String filterString)
84
	{
85
		super(shell, title);	
86
        setCancelButtonLabel(SystemResources.BUTTON_CLOSE);
87
        setShowOkButton(false);		
88
		setBlockOnOpen(true); // always modal	
89
		this.subsystem = subsystem;
90
		this.filterString = filterString;
91
		this.subsystemConfigurationId = subsystem.getSubSystemConfiguration().getId();
92
		sr = RSECorePlugin.getTheSystemRegistry();
93
		setNeedsProgressMonitor(true);
94
		//pack();
95
	}	
96
97
    // ------------------
98
    // PUBLIC METHODS...
99
    // ------------------
100
    // ------------------
101
    // PRIVATE METHODS...
102
    // ------------------
103
	/**
104
     * Private method.
105
	 * @see SystemPromptDialog#getInitialFocusControl()
106
	 */
107
	protected Control getInitialFocusControl()
108
	{
109
		//return tree.getTreeControl();
110
		return connectionCombo.getCombo();
111
	}
112
113
	/**
114
     * Private method.
115
	 * @see SystemPromptDialog#createInner(Composite)
116
	 */
117
	protected Control createInner(Composite parent)
118
	{
119
		// Inner composite
120
		int gridColumns = 2;
121
		Composite composite_prompts = SystemWidgetHelpers.createComposite(parent, gridColumns);	
122
123
        // connection selection combo
124
        connectionCombo = SystemWidgetHelpers.createConnectionCombo(composite_prompts, null, null, subsystem.getSubSystemConfiguration(),
125
                                                                    null, null, subsystem.getHost(), gridColumns, false);
126
127
        // filter string prompt
128
       // Composite promptComposite = composite_prompts;
129
        Composite promptComposite = connectionCombo;
130
        prompt = SystemWidgetHelpers.createLabel(promptComposite, SystemResources.RESID_TESTFILTERSTRING_PROMPT_LABEL, SystemResources.RESID_TESTFILTERSTRING_PROMPT_TOOLTIP);
131
        promptValue = SystemWidgetHelpers.createLabel(promptComposite, SystemResources.RESID_TESTFILTERSTRING_PROMPT_LABEL, SystemResources.RESID_TESTFILTERSTRING_PROMPT_TOOLTIP);
132
133
        promptValue.setToolTipText(filterString); // Since the dialog is not resizable, this is the way to show the whole string
134
135
        // Make sure the label width is not longer than the window width
136
        // Otherwise the combo box dropdown arrow above it will be pushed beyond the window and invisible
137
        //promptValue.setText(filterString);
138
139
        String label = filterString;
140
141
        if ( label.length() > 30)
142
           label = label.substring(0,30) + " ...";   // Use ... to show that not entire string is displayed //$NON-NLS-1$
143
        promptValue.setText( label);
144
145
        //Point point = promptValue.computeSize(SWT.DEFAULT, SWT.DEFAULT);
146
        //GridData data = new GridData();	
147
	    //data.widthHint = point.x < 230 ? point.x : 230;
148
	    GridData data = new GridData();	
149
	    data.widthHint =  200;
150
	    promptValue.setLayoutData(data);	
151
152
		// TREE
153
		inputProvider = new SystemTestFilterStringAPIProviderImpl(subsystem, filterString);		  		
154
		tree = new SystemViewForm(getShell(), composite_prompts, SWT.NULL, inputProvider, false, getMessageLine(), gridColumns, 1);
155
156
	    // add selection listeners
157
		//tree.addSelectionChangedListener(this);				
158
        connectionCombo.addSelectionListener(this);
159
160
		return composite_prompts;
161
	}
162
163
	/**
164
	 * Override of parent. Must pass selected object onto the form for initializing fields.
165
	 * Called by SystemDialogAction's default run() method after dialog instantiated.
166
	 */
167
	public void setInputObject(Object inputObject)
168
	{
169
		super.setInputObject(inputObject);
170
	}
171
172
    /**
173
     * When re-using this dialog between runs, call this to reset its contents.
174
     * Assumption: original input subsystem factory Id doesn't change between runs
175
     */
176
    public void reset(ISubSystem subsystem, String filterString)
177
    {
178
		this.subsystem = subsystem;
179
		this.filterString = filterString;
180
		//this.subsystemConfigurationId = subsystem.getParentSubSystemConfiguration().getId();
181
    	inputProvider.setSubSystem(subsystem);
182
    	inputProvider.setFilterString(filterString);
183
    	tree.reset(inputProvider);    		
184
    }
185
186
    /**
187
     * ISelectionChangedListener interface method
188
     */
189
    public void selectionChanged(SelectionChangedEvent event)
190
    {
191
    }	
192
    public void widgetDefaultSelected(SelectionEvent event)
193
    {
194
    }
195
    public void widgetSelected(SelectionEvent event)
196
    {
197
198
    	//if (src == connectionCombo.getCombo())
199
    	{
200
    		//System.out.println("connection changed");
201
    		IHost newConnection = connectionCombo.getHost();
202
    		ISubSystem newSubSystem = null;
203
			ISubSystemConfiguration config = sr.getSubSystemConfiguration(subsystemConfigurationId);
204
			if (config!=null) {
205
				ISubSystem[] newSubSystems = config.getSubSystems(newConnection, true);
206
				if (newSubSystems != null && newSubSystems.length > 0) {
207
		    		  newSubSystem = newSubSystems[0];
208
				      subsystemConfigurationId = subsystem.getSubSystemConfiguration().getId();
209
				}
210
			}
211
    		inputProvider.setSubSystem(newSubSystem);
212
    		tree.reset(inputProvider);    		
213
    	}
214
    }
215
216
}
(-)UI/org/eclipse/rse/internal/ui/dialogs/SystemResolveFilterStringDialog.java (-1 / +2 lines)
Lines 19-27 Link Here
19
import org.eclipse.rse.core.subsystems.ISubSystem;
19
import org.eclipse.rse.core.subsystems.ISubSystem;
20
import org.eclipse.rse.internal.ui.SystemResources;
20
import org.eclipse.rse.internal.ui.SystemResources;
21
import org.eclipse.rse.internal.ui.view.SystemResolveFilterStringAPIProviderImpl;
21
import org.eclipse.rse.internal.ui.view.SystemResolveFilterStringAPIProviderImpl;
22
import org.eclipse.rse.internal.ui.view.SystemViewForm;
23
import org.eclipse.rse.ui.SystemWidgetHelpers;
22
import org.eclipse.rse.ui.SystemWidgetHelpers;
24
import org.eclipse.rse.ui.dialogs.SystemPromptDialog;
23
import org.eclipse.rse.ui.dialogs.SystemPromptDialog;
24
import org.eclipse.rse.ui.dialogs.SystemTestFilterStringDialog;
25
import org.eclipse.rse.ui.view.SystemViewForm;
25
import org.eclipse.swt.SWT;
26
import org.eclipse.swt.SWT;
26
import org.eclipse.swt.layout.GridData;
27
import org.eclipse.swt.layout.GridData;
27
import org.eclipse.swt.widgets.Composite;
28
import org.eclipse.swt.widgets.Composite;
(-)UI/org/eclipse/rse/internal/ui/dialogs/SystemControlEnableState.java (-1 / +1 lines)
Lines 20-26 Link Here
20
import java.util.List;
20
import java.util.List;
21
21
22
import org.eclipse.rse.internal.ui.view.SystemPropertySheetForm;
22
import org.eclipse.rse.internal.ui.view.SystemPropertySheetForm;
23
import org.eclipse.rse.internal.ui.view.SystemViewForm;
23
import org.eclipse.rse.ui.view.SystemViewForm;
24
import org.eclipse.swt.widgets.Composite;
24
import org.eclipse.swt.widgets.Composite;
25
import org.eclipse.swt.widgets.Control;
25
import org.eclipse.swt.widgets.Control;
26
26
(-)UI/org/eclipse/rse/internal/ui/filters/dialogs/SystemFilterNewFilterPoolWizardMainPageInterface.java (-1 / +1 lines)
Lines 18-24 Link Here
18
package org.eclipse.rse.internal.ui.filters.dialogs;
18
package org.eclipse.rse.internal.ui.filters.dialogs;
19
19
20
import org.eclipse.rse.core.filters.ISystemFilterPoolManager;
20
import org.eclipse.rse.core.filters.ISystemFilterPoolManager;
21
import org.eclipse.rse.internal.ui.filters.SystemFilterPoolDialogOutputs;
21
import org.eclipse.rse.ui.filters.SystemFilterPoolDialogOutputs;
22
import org.eclipse.rse.ui.validators.ISystemValidator;
22
import org.eclipse.rse.ui.validators.ISystemValidator;
23
import org.eclipse.rse.ui.wizards.ISystemWizardPage;
23
import org.eclipse.rse.ui.wizards.ISystemWizardPage;
24
24
(-)UI/org/eclipse/rse/internal/ui/filters/dialogs/SystemFilterNewFilterPoolWizard.java (-1 / +2 lines)
Lines 21-32 Link Here
21
import org.eclipse.rse.core.filters.ISystemFilterPool;
21
import org.eclipse.rse.core.filters.ISystemFilterPool;
22
import org.eclipse.rse.core.filters.ISystemFilterPoolManager;
22
import org.eclipse.rse.core.filters.ISystemFilterPoolManager;
23
import org.eclipse.rse.internal.ui.SystemResources;
23
import org.eclipse.rse.internal.ui.SystemResources;
24
import org.eclipse.rse.internal.ui.filters.SystemFilterPoolDialogOutputs;
25
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
24
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
26
import org.eclipse.rse.ui.ISystemIconConstants;
25
import org.eclipse.rse.ui.ISystemIconConstants;
27
import org.eclipse.rse.ui.ISystemMessages;
26
import org.eclipse.rse.ui.ISystemMessages;
28
import org.eclipse.rse.ui.RSEUIPlugin;
27
import org.eclipse.rse.ui.RSEUIPlugin;
28
import org.eclipse.rse.ui.filters.SystemFilterPoolDialogOutputs;
29
import org.eclipse.rse.ui.filters.actions.SystemFilterAbstractFilterPoolAction;
29
import org.eclipse.rse.ui.filters.actions.SystemFilterAbstractFilterPoolAction;
30
import org.eclipse.rse.ui.filters.dialogs.SystemFilterPoolWizardInterface;
30
import org.eclipse.rse.ui.messages.SystemMessageDialog;
31
import org.eclipse.rse.ui.messages.SystemMessageDialog;
31
import org.eclipse.rse.ui.validators.ValidatorFolderName;
32
import org.eclipse.rse.ui.validators.ValidatorFolderName;
32
import org.eclipse.rse.ui.wizards.AbstractSystemWizard;
33
import org.eclipse.rse.ui.wizards.AbstractSystemWizard;
(-)UI/org/eclipse/rse/internal/ui/filters/dialogs/SystemFilterWorkWithFilterPoolsDialog.java (-2 / +2 lines)
Lines 43-50 Link Here
43
import org.eclipse.rse.internal.ui.actions.SystemFilterMoveFilterPoolAction;
43
import org.eclipse.rse.internal.ui.actions.SystemFilterMoveFilterPoolAction;
44
import org.eclipse.rse.internal.ui.actions.SystemFilterNewFilterPoolAction;
44
import org.eclipse.rse.internal.ui.actions.SystemFilterNewFilterPoolAction;
45
import org.eclipse.rse.internal.ui.actions.SystemFilterWorkWithFilterPoolsRefreshAllAction;
45
import org.eclipse.rse.internal.ui.actions.SystemFilterWorkWithFilterPoolsRefreshAllAction;
46
import org.eclipse.rse.internal.ui.filters.SystemFilterPoolDialogInterface;
47
import org.eclipse.rse.internal.ui.filters.SystemFilterPoolDialogOutputs;
48
import org.eclipse.rse.internal.ui.filters.SystemFilterPoolManagerUIProvider;
46
import org.eclipse.rse.internal.ui.filters.SystemFilterPoolManagerUIProvider;
49
import org.eclipse.rse.internal.ui.filters.SystemFilterWorkWithFilterPoolsTreeViewer;
47
import org.eclipse.rse.internal.ui.filters.SystemFilterWorkWithFilterPoolsTreeViewer;
50
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
48
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
Lines 58-63 Link Here
58
import org.eclipse.rse.ui.dialogs.SystemPromptDialog;
56
import org.eclipse.rse.ui.dialogs.SystemPromptDialog;
59
import org.eclipse.rse.ui.dialogs.SystemSimpleContentElement;
57
import org.eclipse.rse.ui.dialogs.SystemSimpleContentElement;
60
import org.eclipse.rse.ui.dialogs.SystemSimpleContentProvider;
58
import org.eclipse.rse.ui.dialogs.SystemSimpleContentProvider;
59
import org.eclipse.rse.ui.filters.SystemFilterPoolDialogInterface;
60
import org.eclipse.rse.ui.filters.SystemFilterPoolDialogOutputs;
61
import org.eclipse.rse.ui.filters.SystemFilterUIHelpers;
61
import org.eclipse.rse.ui.filters.SystemFilterUIHelpers;
62
import org.eclipse.rse.ui.filters.actions.SystemFilterAbstractFilterPoolAction;
62
import org.eclipse.rse.ui.filters.actions.SystemFilterAbstractFilterPoolAction;
63
import org.eclipse.rse.ui.messages.ISystemMessageLine;
63
import org.eclipse.rse.ui.messages.ISystemMessageLine;
(-)UI/org/eclipse/rse/internal/ui/filters/dialogs/SystemNewFilterWizardNamePage.java (-485 lines)
Removed Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2002, 2008 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Initial Contributors:
9
 * The following IBM employees contributed to the Remote System Explorer
10
 * component that contains this file: David McKnight, Kushal Munir, 
11
 * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, 
12
 * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
13
 * 
14
 * Contributors:
15
 * David Dykstal (IBM) - [160403] filters should be connection private by default
16
 *******************************************************************************/
17
18
package org.eclipse.rse.internal.ui.filters.dialogs;
19
import org.eclipse.rse.core.filters.ISystemFilterPool;
20
import org.eclipse.rse.core.filters.ISystemFilterPoolSelectionValidator;
21
import org.eclipse.rse.core.filters.ISystemFilterPoolWrapper;
22
import org.eclipse.rse.core.filters.ISystemFilterPoolWrapperInformation;
23
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
24
import org.eclipse.rse.ui.SystemWidgetHelpers;
25
import org.eclipse.rse.ui.filters.dialogs.ISystemNewFilterWizardConfigurator;
26
import org.eclipse.rse.ui.filters.dialogs.SystemNewFilterWizard;
27
import org.eclipse.rse.ui.validators.ISystemValidator;
28
import org.eclipse.rse.ui.wizards.AbstractSystemWizardPage;
29
import org.eclipse.swt.events.ModifyEvent;
30
import org.eclipse.swt.events.ModifyListener;
31
import org.eclipse.swt.events.SelectionEvent;
32
import org.eclipse.swt.events.SelectionListener;
33
import org.eclipse.swt.widgets.Button;
34
import org.eclipse.swt.widgets.Combo;
35
import org.eclipse.swt.widgets.Composite;
36
import org.eclipse.swt.widgets.Control;
37
import org.eclipse.swt.widgets.Label;
38
import org.eclipse.swt.widgets.Text;
39
40
41
42
43
/**
44
 * Second page of the New Filter wizard that prompts for the name of the filter.
45
 */
46
public class SystemNewFilterWizardNamePage 
47
	   extends AbstractSystemWizardPage
48
	   implements SelectionListener
49
{
50
	
51
	protected Text  nameText;
52
	protected Button uniqueCB;
53
	protected Label poolVerbiage;
54
	protected Label poolComboLabel;	
55
	protected Combo poolWrapperCombo;
56
	protected Combo poolCombo;
57
	protected SystemMessage errorMessage;
58
	protected String inputFilterName;
59
	protected boolean contentsCreated;
60
	protected boolean userEditedName;
61
	protected boolean ignoreChanges;
62
	protected ISystemValidator nameValidator;
63
	protected ISystemValidator[] nameValidators;
64
	protected ISystemFilterPoolSelectionValidator filterPoolSelectionValidator;
65
	protected ISystemFilterPool[] poolsToSelectFrom = null;
66
    protected ISystemFilterPoolWrapper[] poolWrappers = null;
67
    protected ISystemFilterPoolWrapperInformation poolWrapperInformation;
68
	protected ISystemFilterPool parentPool = null;
69
  	private ISystemNewFilterWizardConfigurator configurator;  
70
  	
71
	/**
72
	 * Constructor.
73
	 */
74
	public SystemNewFilterWizardNamePage(SystemNewFilterWizard wizard, ISystemFilterPool parentPool, ISystemNewFilterWizardConfigurator data)
75
	{
76
		super(wizard, "SetNewFilterName", data.getPage2Title(), data.getPage2Description());	           //$NON-NLS-1$
77
	    this.parentPool = parentPool;
78
	    this.configurator = data;
79
		setHelp(data.getPage2HelpID());
80
	}
81
82
	// ---------------------------------
83
	// INPUT METHODS...
84
	// ---------------------------------
85
	/**
86
	 * Set the filter name to default the entry field to
87
	 */
88
	public void setFilterName(String filterName)
89
	{
90
		this.inputFilterName = filterName;
91
		if (nameText != null)
92
		  nameText.setText(inputFilterName);
93
	}
94
	/**
95
	 * Set the validator to use to verify the filter name is correct
96
	 */
97
	public void setFilterNameValidator(ISystemValidator nameValidator)
98
	{
99
		this.nameValidator = nameValidator;
100
	}
101
    /**
102
     * Call if you want to allow the user to select the filter pool to create this filter in.
103
     */
104
    public void setAllowFilterPoolSelection(ISystemFilterPool[] poolsToSelectFrom,
105
                                             ISystemValidator[] nameValidators)
106
    {
107
    	this.poolsToSelectFrom = poolsToSelectFrom;
108
    	this.nameValidators = nameValidators;
109
    	if ((poolsToSelectFrom != null) && (poolsToSelectFrom.length>0))    	
110
    	{
111
    	  if (parentPool == null) 
112
    	     parentPool = poolsToSelectFrom[0];
113
    	}
114
    }    
115
    /**
116
     * This is an alternative to {@link #setAllowFilterPoolSelection(ISystemFilterPool[], ISystemValidator[])}
117
     * <p>
118
     * If you want to prompt the user for the parent filter pool to create this filter in, 
119
     *  but want to not use the term "pool" say, you can use an array of euphamisms. That is,
120
     *  you can pass an array of objects that map to filter pools, but have a different 
121
     *  display name that is shown in the dropdown.
122
     * <p>
123
     * Of course, if you want to do this, then you will likely want to offer a different
124
     *  label and tooltip for the prompt, and different verbiage above the prompt. The 
125
     *  object this method accepts as a parameter encapsulates all that information, and
126
     *  there is a default class you can use for this.
127
     */
128
    public void setAllowFilterPoolSelection(ISystemFilterPoolWrapperInformation poolWrappersToSelectFrom,
129
                                             ISystemValidator[] nameValidators)    
130
    {
131
    	this.poolWrapperInformation = poolWrappersToSelectFrom;
132
    	this.nameValidators = nameValidators;
133
    	if (parentPool == null) 
134
    	  parentPool = poolWrappersToSelectFrom.getPreSelectWrapper().getSystemFilterPool();
135
    }    
136
	/**
137
	 * Set the validator to call when the user selects a filter pool. Optional.
138
	 */
139
	public void setFilterPoolSelectionValidator(ISystemFilterPoolSelectionValidator validator)
140
	{
141
	     filterPoolSelectionValidator = validator;	
142
	     //System.out.println("Inside setFilterPoolSelectionValidator. Non null? " + (validator != null));
143
	}
144
	
145
	// ---------------------------------
146
	// LIFECYCLE METHODS...
147
	// ---------------------------------
148
149
	/**
150
	 * Populate the dialog area with our widgets. Return the composite they are in.
151
	 */
152
	public Control createContents(Composite parent)
153
	{
154
155
		int nbrColumns = 2;
156
		Composite composite_prompts = SystemWidgetHelpers.createComposite(parent, nbrColumns);
157
				
158
		SystemWidgetHelpers.createVerbiage(composite_prompts, configurator.getPage2NameVerbiage(), nbrColumns, false, 200);
159
		nameText = SystemWidgetHelpers.createLabeledTextField(composite_prompts, null, configurator.getPage2NamePromptLabel(), configurator.getPage2NamePromptTooltip());
160
		
161
        addSeparatorLine(composite_prompts, nbrColumns);
162
        addFillerLine(composite_prompts, nbrColumns);
163
        
164
        // allow the user to create this filter uniquely for this connection, which means putting it in a
165
        //  special filter pool we will create, just for this connection. This option is not shown if we are
166
        //  already told which filter pool to create the filter in, such as in Show Filter Pools mode, when
167
        //  the user selects New Filter to create a filter in the selected pool. We assume in this case the
168
        //  will go in whatever filter is selected.
169
        if ((poolsToSelectFrom!=null) || (poolWrapperInformation!=null))
170
        {
171
			uniqueCB = SystemWidgetHelpers.createCheckBox(composite_prompts, nbrColumns, configurator.getPage2UniqueToConnectionLabel(), null);
172
			uniqueCB.setToolTipText(configurator.getPage2UniqueToConnectionToolTip()); 
173
			uniqueCB.addSelectionListener(this);
174
			uniqueCB.setSelection(true); // [160403] filters should be connection private by default
175
        }
176
		        
177
        addFillerLine(composite_prompts, nbrColumns);
178
        
179
        if (poolsToSelectFrom != null)
180
        {
181
		   	poolVerbiage = SystemWidgetHelpers.createVerbiage(composite_prompts, configurator.getPage2PoolVerbiage(), nbrColumns, false, 200);
182
		   	poolVerbiage.setToolTipText(configurator.getPage2PoolVerbiageTip());
183
           	poolCombo = SystemWidgetHelpers.createLabeledReadonlyCombo(composite_prompts, null, configurator.getPage2PoolPromptLabel(), configurator.getPage2PoolPromptTooltip());
184
			poolComboLabel = SystemWidgetHelpers.getLastLabel();
185
           	String[] poolNames = new String[poolsToSelectFrom.length];
186
		   	int filterPoolSelectionIndex = 0;
187
           	for (int idx=0; idx<poolNames.length; idx++)
188
           	{
189
           	  	ISystemFilterPool pool = poolsToSelectFrom[idx];
190
           	  	if (pool == parentPool)
191
           	    	filterPoolSelectionIndex = idx;
192
              	poolNames[idx] = pool.getSystemFilterPoolManager().getName()+"."+pool.getName(); //$NON-NLS-1$
193
           	}
194
           	if ((nameValidator == null) && (nameValidators!=null))
195
             	nameValidator = nameValidators[filterPoolSelectionIndex];
196
           	poolCombo.setItems(poolNames);         
197
           	poolCombo.select(filterPoolSelectionIndex);
198
           	poolCombo.addSelectionListener(this);
199
           	if ((uniqueCB!=null) && uniqueCB.getSelection())
200
           	{
201
				poolVerbiage.setEnabled(false);
202
				poolComboLabel.setEnabled(false);
203
           		poolCombo.setEnabled(false);
204
           	}
205
        }
206
        else if (poolWrapperInformation != null)
207
        {
208
		 	poolVerbiage = SystemWidgetHelpers.createVerbiage(composite_prompts, poolWrapperInformation.getVerbiageLabel(), nbrColumns, false, 200);
209
		   	//poolWrapperCombo = SystemWidgetHelpers.createLabeledCombo(composite_prompts, null, poolWrapperInformation.getResourceBundle(), poolWrapperInformation.getPromptRBKey()); // d47323
210
		   	poolWrapperCombo = SystemWidgetHelpers.createLabeledReadonlyCombo(composite_prompts, null, poolWrapperInformation.getPromptLabel(), poolWrapperInformation.getPromptTooltip());
211
			poolComboLabel = SystemWidgetHelpers.getLastLabel();
212
		   	poolWrappers = poolWrapperInformation.getWrappers();
213
           	String[] poolNames = new String[poolWrappers.length];
214
		   	int filterPoolSelectionIndex = 0;
215
           	for (int idx=0; idx<poolNames.length; idx++)
216
           	{
217
           	  	if (poolWrapperInformation.getPreSelectWrapper() == poolWrappers[idx])
218
           	    	filterPoolSelectionIndex = idx;
219
              	poolNames[idx] = poolWrappers[idx].getDisplayName();
220
           	}
221
           	if ((nameValidator == null) && (nameValidators!=null))
222
             	nameValidator = nameValidators[filterPoolSelectionIndex];
223
           	poolWrapperCombo.setItems(poolNames);           
224
           	poolWrapperCombo.select(filterPoolSelectionIndex);
225
           	poolWrapperCombo.addSelectionListener(this);
226
			if ((uniqueCB!=null) && uniqueCB.getSelection())
227
			{
228
				poolVerbiage.setEnabled(false);
229
				poolComboLabel.setEnabled(false);
230
				poolWrapperCombo.setEnabled(false);
231
			}
232
        }
233
		
234
		// initialize inputs
235
        if (nameValidator != null)
236
        {
237
        	int maxNameLength = nameValidator.getMaximumNameLength();
238
        	if (maxNameLength >= 0)
239
        	  nameText.setTextLimit(maxNameLength);
240
        }
241
		if (inputFilterName != null)
242
		  nameText.setText(inputFilterName);
243
		  
244
		// add keystroke listeners...
245
		nameText.addModifyListener(
246
			new ModifyListener() {
247
				public void modifyText(ModifyEvent e) {
248
					if (ignoreChanges)
249
					  return;
250
					userEditedName = true;
251
					validateNameInput();
252
				}
253
			}
254
		);		
255
		
256
		setPageComplete();		        
257
		contentsCreated = true;
258
		return composite_prompts;
259
	}	
260
	/**
261
	 * Return the Control to be given initial focus.
262
	 * Override from parent. Return control to be given initial focus.
263
	 */
264
	protected Control getInitialFocusControl()
265
	{
266
        return nameText;
267
	}
268
	
269
	/**
270
	 * Completes processing of the wizard. If this 
271
	 * method returns true, the wizard will close; 
272
	 * otherwise, it will stay active.
273
	 * This method is an override from the parent Wizard class. 
274
	 *
275
	 * @return whether the wizard finished successfully
276
	 */
277
	public boolean performFinish() 
278
	{
279
		if (!contentsCreated)
280
		  return true;
281
		return (verify() == null);
282
	}
283
284
	/**
285
	 * Return true if the page is complete, so to enable Finish.
286
	 * Called by wizard framework.
287
	 */
288
	public boolean isPageComplete()
289
	{
290
		boolean pageComplete = (errorMessage == null) && (nameText!=null);
291
		if (pageComplete)
292
		  pageComplete = (nameText.getText().trim().length() > 0);
293
		return pageComplete;
294
	}
295
	
296
	/**
297
	 * Inform caller of page-complete status of this page
298
	 */
299
	public void setPageComplete()
300
	{
301
		setPageComplete(isPageComplete());
302
	}	
303
	/**
304
	 * User has selected something
305
	 */
306
	public void widgetSelected(SelectionEvent e)
307
	{
308
		Object src = e.getSource();
309
		if (src == poolCombo)
310
		{
311
		  	int selection = poolCombo.getSelectionIndex();	
312
		  	if ((selection >= 0) && (nameValidators!=null))
313
		    	nameValidator = nameValidators[selection];
314
		}
315
		else if (src == poolWrapperCombo)
316
		{
317
		  	int selection = poolWrapperCombo.getSelectionIndex();	
318
		  	if ((selection >= 0) && (nameValidators!=null))
319
		    	nameValidator = nameValidators[selection];
320
		}
321
		else if (src == uniqueCB)
322
		{
323
			boolean selected = uniqueCB.getSelection();
324
			if (poolVerbiage != null)
325
			  	poolVerbiage.setEnabled(!selected);
326
			if (poolCombo != null)
327
			 	poolCombo.setEnabled(!selected);
328
			if (poolWrapperCombo != null)
329
				poolWrapperCombo.setEnabled(!selected);
330
			if (poolComboLabel != null)
331
				poolComboLabel.setEnabled(!selected);
332
		}
333
		verify();
334
		setPageComplete();
335
	}
336
	/**
337
	 * User has selected something and pressed Enter
338
	 */
339
	public void widgetDefaultSelected(SelectionEvent e)
340
	{
341
	}
342
	// ---------------------------------
343
	// VERIFICATION METHODS...
344
	// ---------------------------------
345
	/**
346
	 * Verify all contents
347
	 */	    
348
	public SystemMessage verify()
349
	{
350
		errorMessage = null;
351
		Control controlInError = null;
352
353
		if ((errorMessage == null) && (filterPoolSelectionValidator != null))
354
		{
355
			errorMessage = filterPoolSelectionValidator.validate(getParentSystemFilterPool());
356
			if (poolCombo != null)
357
			  controlInError = poolCombo;
358
			else if (poolWrapperCombo != null)
359
			  controlInError = poolCombo;
360
		}		
361
		if ((errorMessage == null) && (nameValidator != null))
362
		{
363
	        errorMessage = nameValidator.validate(nameText.getText().trim());
364
			controlInError = nameText;
365
		}		
366
367
		if (errorMessage != null)
368
		{
369
		  	if (controlInError != null)
370
		  	  controlInError.setFocus();
371
		  	setErrorMessage(errorMessage);
372
		}
373
		else
374
		    clearErrorMessage();
375
		return errorMessage;
376
	}    	
377
  	/**
378
	 * This hook method is called whenever the text changes in the filter name input field.
379
	 */
380
	protected SystemMessage validateNameInput() 
381
	{			
382
	    errorMessage= null;			
383
		if (nameValidator != null)
384
	      errorMessage = nameValidator.validate(nameText.getText().trim());
385
		if ((errorMessage == null) && (filterPoolSelectionValidator != null))
386
			errorMessage = filterPoolSelectionValidator.validate(getParentSystemFilterPool());
387
		setPageComplete();
388
		if (errorMessage != null)
389
		  setErrorMessage(errorMessage);		
390
		else
391
		  clearErrorMessage();
392
		return errorMessage;
393
	}
394
395
    
396
	// ---------------------------------
397
	// METHODS FOR EXTRACTING USER DATA 
398
	// ---------------------------------
399
	/**
400
	 * Return name of filter
401
	 * Call this after finish ends successfully.
402
	 */	    
403
	public String getFilterName()
404
	{
405
		if (nameText != null)
406
		  return nameText.getText().trim();
407
		else
408
		  return inputFilterName;
409
	}    	
410
	/**
411
	 * Return the filter pool that was explicitly chosen by the user,
412
	 *  or implicitly set by the caller.
413
	 */
414
	public ISystemFilterPool getParentSystemFilterPool()
415
	{
416
		ISystemFilterPool pool = null;
417
		// do we prompt with a list of filter pools? Yes, just return selected...
418
		if (poolCombo != null)
419
		{
420
		  int selection = poolCombo.getSelectionIndex();
421
		  if (selection < 0)
422
		    selection = 0;
423
		  pool = poolsToSelectFrom[selection];
424
		}
425
		// do we prompt using a wrapper of some kind, such a profile or a command set,
426
		// from which we deduce the pool? If so, deduce pool from selected wrapper....
427
		else if (poolWrapperCombo != null)
428
		{
429
		  int selection = poolWrapperCombo.getSelectionIndex();
430
		  if (selection < 0)
431
		    selection = 0;
432
		  pool = poolWrappers[selection].getSystemFilterPool();
433
		}
434
		// else no prompt so we must have been given the explicit filter pool in which
435
		// to create this filter. Eg, in Show Filter Pools mode and the user selects a
436
		// filter pool and choose New Filter from it.
437
		else
438
		  pool = parentPool;
439
		//System.out.println("Inside getParentSystemFilterPool. returning " + pool.getName());
440
	    return pool;
441
	}	
442
	
443
	/**
444
	 * Return the user's decision whether to create this filter uniquely
445
	 *  for this connection, or for all applicable connections.
446
	 */
447
	public boolean getUniqueToThisConnection()
448
	{
449
		if (uniqueCB != null)
450
			return uniqueCB.getSelection();
451
		else
452
		 	return false;
453
	}
454
455
	// -------------------------------	
456
	// INTERCEPT OF WIZARDPAGE METHODS
457
	// -------------------------------
458
	/**
459
	 * This is called when a page is given focus or loses focus
460
	 */
461
	public void setVisible(boolean visible)
462
	{
463
		super.setVisible(visible);
464
		if (visible)
465
		{
466
			if (!userEditedName && (nameText!=null))
467
			{
468
				String defaultName = ((SystemNewFilterWizard)getWizard()).getDefaultFilterName();
469
				if (defaultName != null)
470
				{
471
					ignoreChanges = true;
472
				    nameText.setText(defaultName);
473
				    ignoreChanges = false;
474
				}
475
			}
476
		    verify();
477
		    //System.out.println("Wizard size = " + ((SystemNewFilterWizard)getWizard()).getShell().getSize());
478
		}
479
	}
480
481
	// --------------------------------------------------------------	
482
	// ALL THE MRI ON THIS PAGE IS CONFIGURABLE. CALL HERE TO SET IT. 		
483
	// --------------------------------------------------------------
484
	
485
}
(-)UI/org/eclipse/rse/internal/ui/filters/dialogs/SystemFilterPoolWizardInterface.java (-28 lines)
Removed Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2002, 2007 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Initial Contributors:
9
 * The following IBM employees contributed to the Remote System Explorer
10
 * component that contains this file: David McKnight, Kushal Munir, 
11
 * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, 
12
 * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
13
 * 
14
 * Contributors:
15
 * {Name} (company) - description of contribution.
16
 *******************************************************************************/
17
18
package org.eclipse.rse.internal.ui.filters.dialogs;
19
import org.eclipse.rse.internal.ui.filters.SystemFilterPoolDialogInterface;
20
import org.eclipse.rse.ui.wizards.ISystemWizard;
21
22
/**
23
 * An interface for filter pool wizards to implement
24
 */
25
public interface SystemFilterPoolWizardInterface 
26
       extends ISystemWizard, SystemFilterPoolDialogInterface
27
{
28
}
(-)UI/org/eclipse/rse/internal/ui/filters/dialogs/SystemFilterPoolWizardDialog.java (-2 / +3 lines)
Lines 16-25 Link Here
16
 *******************************************************************************/
16
 *******************************************************************************/
17
17
18
package org.eclipse.rse.internal.ui.filters.dialogs;
18
package org.eclipse.rse.internal.ui.filters.dialogs;
19
import org.eclipse.rse.internal.ui.filters.SystemFilterPoolDialogInterface;
20
import org.eclipse.rse.internal.ui.filters.SystemFilterPoolDialogOutputs;
21
import org.eclipse.rse.ui.dialogs.SystemWizardDialog;
19
import org.eclipse.rse.ui.dialogs.SystemWizardDialog;
20
import org.eclipse.rse.ui.filters.SystemFilterPoolDialogInterface;
21
import org.eclipse.rse.ui.filters.SystemFilterPoolDialogOutputs;
22
import org.eclipse.rse.ui.filters.actions.SystemFilterAbstractFilterPoolAction;
22
import org.eclipse.rse.ui.filters.actions.SystemFilterAbstractFilterPoolAction;
23
import org.eclipse.rse.ui.filters.dialogs.SystemFilterPoolWizardInterface;
23
import org.eclipse.swt.widgets.Shell;
24
import org.eclipse.swt.widgets.Shell;
24
25
25
26
(-)UI/org/eclipse/rse/internal/ui/filters/dialogs/SystemFilterNewFilterPoolWizardDefaultMainPage.java (-1 / +1 lines)
Lines 19-27 Link Here
19
import org.eclipse.jface.wizard.Wizard;
19
import org.eclipse.jface.wizard.Wizard;
20
import org.eclipse.rse.core.filters.ISystemFilterPoolManager;
20
import org.eclipse.rse.core.filters.ISystemFilterPoolManager;
21
import org.eclipse.rse.internal.ui.SystemResources;
21
import org.eclipse.rse.internal.ui.SystemResources;
22
import org.eclipse.rse.internal.ui.filters.SystemFilterPoolDialogOutputs;
23
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
22
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
24
import org.eclipse.rse.ui.SystemWidgetHelpers;
23
import org.eclipse.rse.ui.SystemWidgetHelpers;
24
import org.eclipse.rse.ui.filters.SystemFilterPoolDialogOutputs;
25
import org.eclipse.rse.ui.filters.actions.SystemFilterAbstractFilterPoolAction;
25
import org.eclipse.rse.ui.filters.actions.SystemFilterAbstractFilterPoolAction;
26
import org.eclipse.rse.ui.validators.ISystemValidator;
26
import org.eclipse.rse.ui.validators.ISystemValidator;
27
import org.eclipse.rse.ui.validators.ValidatorFilterPoolName;
27
import org.eclipse.rse.ui.validators.ValidatorFilterPoolName;
(-)UI/org/eclipse/rse/ui/view/ISystemTree.java (+54 lines)
Lines 19-24 Link Here
19
19
20
import java.util.List;
20
import java.util.List;
21
21
22
import org.eclipse.jface.viewers.IDoubleClickListener;
23
import org.eclipse.jface.viewers.ISelectionChangedListener;
24
import org.eclipse.jface.viewers.ViewerFilter;
22
import org.eclipse.rse.core.filters.ISystemFilter;
25
import org.eclipse.rse.core.filters.ISystemFilter;
23
import org.eclipse.rse.core.filters.ISystemFilterReference;
26
import org.eclipse.rse.core.filters.ISystemFilterReference;
24
import org.eclipse.rse.core.subsystems.ISubSystem;
27
import org.eclipse.rse.core.subsystems.ISubSystem;
Lines 179-183 Link Here
179
	 */
182
	 */
180
	public List findAllRemoteItemReferences(Object element, Object elementObject, List matches);
183
	public List findAllRemoteItemReferences(Object element, Object elementObject, List matches);
181
	
184
	
185
	/**
186
	 * Sets the auto expand level for the corresponding tree
187
	 * @param level the level to expand
188
	 * @since 3.0
189
	 */
190
	public void setAutoExpandLevel(int level);
191
	
192
	/**
193
	 * Adds a double-click listener
194
	 * @param listener the listener to add
195
	 * @since 3.0
196
	 */
197
	public void addDoubleClickListener(IDoubleClickListener listener);
198
	
199
	/**
200
	 * Checks whether the element is expandable or not
201
	 * @param elementOrTreePath the object to expand
202
	 * @return whether the item is expandable
203
	 * @since 3.0
204
	 */
205
	public boolean isExpandable(Object elementOrTreePath);
206
207
	/**
208
	 * Expands the parent object down to the remote object
209
	 * @param parentObject the parent object
210
	 * @param remoteObject the child object
211
	 * @since 3.0
212
	 */
213
	public void expandTo(Object parentObject, Object remoteObject);
214
	
215
	/**
216
	 * Expand to the object specified by the filter string
217
	 * @param filterString the string represending the object to expand to
218
	 * @since 3.0
219
	 */
220
	public void expandTo(String filterString);
221
	
222
	/**
223
	 * Adds a view filter
224
	 * @param filter the view filter
225
	 * @since 3.0
226
	 */
227
	public void addFilter(ViewerFilter filter);
182
	
228
	
229
230
	/**
231
	 * Adds a selection changed listener
232
	 * @param listener the listener
233
	 * @since 3.0
234
	 */
235
	public void addSelectionChangedListener(ISelectionChangedListener listener);
236
183
}
237
}
(-)UI/org/eclipse/rse/ui/view/SystemTableViewProvider.java (-3 / +2 lines)
Lines 38-44 Link Here
38
import org.eclipse.rse.core.filters.ISystemFilterReference;
38
import org.eclipse.rse.core.filters.ISystemFilterReference;
39
import org.eclipse.rse.core.model.ISystemContainer;
39
import org.eclipse.rse.core.model.ISystemContainer;
40
import org.eclipse.rse.core.subsystems.ISubSystem;
40
import org.eclipse.rse.core.subsystems.ISubSystem;
41
import org.eclipse.rse.internal.ui.view.SystemTableViewColumnManager;
42
import org.eclipse.rse.internal.ui.view.SystemViewPromptableAdapter;
41
import org.eclipse.rse.internal.ui.view.SystemViewPromptableAdapter;
43
import org.eclipse.rse.internal.ui.view.SystemViewRootInputAdapter;
42
import org.eclipse.rse.internal.ui.view.SystemViewRootInputAdapter;
44
import org.eclipse.swt.graphics.Image;
43
import org.eclipse.swt.graphics.Image;
Lines 69-82 Link Here
69
	 * Maps ImageDescriptor->Image.
68
	 * Maps ImageDescriptor->Image.
70
	 */
69
	 */
71
	private Map imageTable = new Hashtable(40);
70
	private Map imageTable = new Hashtable(40);
72
	private SystemTableViewColumnManager _columnManager;
71
	private ISystemTableViewColumnManager _columnManager;
73
	private HashMap cache;
72
	private HashMap cache;
74
	/**
73
	/**
75
	 * Constructor for table view provider where a column manager is present.
74
	 * Constructor for table view provider where a column manager is present.
76
	 * In this case, the columns are customizable by the user.
75
	 * In this case, the columns are customizable by the user.
77
	 * @param columnManager
76
	 * @param columnManager
78
	 */
77
	 */
79
	public SystemTableViewProvider(SystemTableViewColumnManager columnManager)
78
	public SystemTableViewProvider(ISystemTableViewColumnManager columnManager)
80
	{
79
	{
81
		super();
80
		super();
82
		_columnManager= columnManager;
81
		_columnManager= columnManager;
(-)UI/org/eclipse/rse/ui/view/SystemTableView.java (-3 / +3 lines)
Lines 487-493 Link Here
487
			return new IPropertyDescriptor[0];
487
			return new IPropertyDescriptor[0];
488
	}
488
	}
489
489
490
	public SystemTableViewColumnManager getColumnManager()
490
	public ISystemTableViewColumnManager getColumnManager()
491
	{
491
	{
492
	    return _columnManager;
492
	    return _columnManager;
493
	}
493
	}
Lines 1406-1412 Link Here
1406
	 * Get the common "Open to->" action for opening a new Remote System Explorer view,
1406
	 * Get the common "Open to->" action for opening a new Remote System Explorer view,
1407
	 *  scoped to the currently selected object.
1407
	 *  scoped to the currently selected object.
1408
	 */
1408
	 */
1409
	protected SystemOpenExplorerPerspectiveAction getOpenToPerspectiveAction()
1409
	private SystemOpenExplorerPerspectiveAction getOpenToPerspectiveAction()
1410
	{
1410
	{
1411
		if (_openToPerspectiveAction == null)
1411
		if (_openToPerspectiveAction == null)
1412
		{
1412
		{
Lines 1419-1425 Link Here
1419
		return _openToPerspectiveAction;
1419
		return _openToPerspectiveAction;
1420
	}
1420
	}
1421
1421
1422
	protected SystemShowInTableAction getShowInTableAction()
1422
	private SystemShowInTableAction getShowInTableAction()
1423
	{
1423
	{
1424
		if (_showInTableAction == null)
1424
		if (_showInTableAction == null)
1425
		{
1425
		{
(-)UI/org/eclipse/rse/ui/actions/SystemBaseSubMenuAction.java (-1 / +1 lines)
Lines 42-48 Link Here
42
42
43
{
43
{
44
	
44
	
45
    protected SystemSubMenuManager subMenu = null;
45
    private SystemSubMenuManager subMenu = null;
46
    protected String actionLabel;
46
    protected String actionLabel;
47
    protected String menuID;
47
    protected String menuID;
48
    protected boolean createMenuEachTime = true;
48
    protected boolean createMenuEachTime = true;
(-)UI/org/eclipse/rse/ui/actions/SystemTestFilterStringAction.java (-1 / +1 lines)
Lines 19-25 Link Here
19
import org.eclipse.jface.dialogs.Dialog;
19
import org.eclipse.jface.dialogs.Dialog;
20
import org.eclipse.rse.core.subsystems.ISubSystem;
20
import org.eclipse.rse.core.subsystems.ISubSystem;
21
import org.eclipse.rse.internal.ui.SystemResources;
21
import org.eclipse.rse.internal.ui.SystemResources;
22
import org.eclipse.rse.internal.ui.dialogs.SystemTestFilterStringDialog;
22
import org.eclipse.rse.ui.dialogs.SystemTestFilterStringDialog;
23
import org.eclipse.swt.widgets.Shell;
23
import org.eclipse.swt.widgets.Shell;
24
24
25
25
(-)UI/org/eclipse/rse/internal/ui/filters/SystemFilterPoolDialogInterface.java (-41 lines)
Removed Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2002, 2007 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Initial Contributors:
9
 * The following IBM employees contributed to the Remote System Explorer
10
 * component that contains this file: David McKnight, Kushal Munir, 
11
 * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, 
12
 * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
13
 * 
14
 * Contributors:
15
 * {Name} (company) - description of contribution.
16
 *******************************************************************************/
17
18
package org.eclipse.rse.internal.ui.filters;
19
import org.eclipse.rse.ui.filters.actions.SystemFilterAbstractFilterPoolAction;
20
21
22
/**
23
 * Common interface for dialogs or wizards that work with filter pools.
24
 */
25
public interface SystemFilterPoolDialogInterface 
26
{
27
28
29
	/**
30
	 * Allow base action to pass instance of itself for callback to get info
31
	 */
32
    public void setFilterPoolDialogActionCaller(SystemFilterAbstractFilterPoolAction caller);
33
    /**
34
     * Return an object containing user-specified information pertinent to filter pool actions
35
     */
36
    public SystemFilterPoolDialogOutputs getFilterPoolDialogOutputs();    
37
    /**
38
     * Set the help context id for this wizard
39
     */
40
    public void setHelpContextId(String id);
41
}
(-)UI/org/eclipse/rse/internal/ui/filters/SystemFilterPoolDialogInputs.java (-46 lines)
Removed Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2002, 2007 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Initial Contributors:
9
 * The following IBM employees contributed to the Remote System Explorer
10
 * component that contains this file: David McKnight, Kushal Munir, 
11
 * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, 
12
 * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
13
 * 
14
 * Contributors:
15
 * {Name} (company) - description of contribution.
16
 *******************************************************************************/
17
18
package org.eclipse.rse.internal.ui.filters;
19
//import org.eclipse.rse.core.*;
20
import org.eclipse.rse.core.filters.ISystemFilterPoolManager;
21
import org.eclipse.rse.core.filters.ISystemFilterPoolManagerProvider;
22
import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManager;
23
import org.eclipse.rse.ui.dialogs.SystemSimpleContentElement;
24
import org.eclipse.rse.ui.filters.dialogs.SystemFilterDialogInputs;
25
26
27
28
/**
29
 * A class capturing the attributes commonly needed by dialogs that
30
 * work with filter pools.
31
 */
32
public class SystemFilterPoolDialogInputs extends SystemFilterDialogInputs
33
{
34
35
36
    public ISystemFilterPoolManagerProvider poolManagerProvider = null;
37
	public ISystemFilterPoolManager[] poolManagers = null;
38
	public ISystemFilterPoolReferenceManager refManager = null;
39
	public int mgrSelection = 0;
40
	public String poolNamePrompt;	
41
	public String poolNameTip;	
42
	public String poolMgrNamePrompt;
43
	public String poolMgrNameTip;	
44
	
45
    public SystemSimpleContentElement filterPoolTreeRoot;
46
}
(-)UI/org/eclipse/rse/internal/ui/filters/SystemFilterPoolDialogOutputs.java (-37 lines)
Removed Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2002, 2007 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Initial Contributors:
9
 * The following IBM employees contributed to the Remote System Explorer
10
 * component that contains this file: David McKnight, Kushal Munir, 
11
 * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, 
12
 * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
13
 * 
14
 * Contributors:
15
 * {Name} (company) - description of contribution.
16
 *******************************************************************************/
17
18
package org.eclipse.rse.internal.ui.filters;
19
//import org.eclipse.rse.core.*;
20
import org.eclipse.rse.core.filters.ISystemFilterPool;
21
import org.eclipse.rse.ui.dialogs.SystemSimpleContentElement;
22
23
24
25
/**
26
 * A class capturing the attributes commonly returned by dialogs that
27
 * work with filter pools.
28
 */
29
public class SystemFilterPoolDialogOutputs 
30
{
31
32
33
	public String filterPoolName;
34
	public String filterPoolManagerName;	
35
    public SystemSimpleContentElement filterPoolTreeRoot;	
36
    public ISystemFilterPool newPool;
37
}
(-)UI/org/eclipse/rse/internal/ui/actions/SystemFilterWorkWithFilterPoolsAction.java (-1 / +1 lines)
Lines 21-33 Link Here
21
import org.eclipse.rse.core.filters.ISystemFilterPoolManager;
21
import org.eclipse.rse.core.filters.ISystemFilterPoolManager;
22
import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManagerProvider;
22
import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManagerProvider;
23
import org.eclipse.rse.internal.ui.SystemResources;
23
import org.eclipse.rse.internal.ui.SystemResources;
24
import org.eclipse.rse.internal.ui.filters.SystemFilterPoolDialogInterface;
25
import org.eclipse.rse.internal.ui.filters.SystemFilterPoolManagerUIProvider;
24
import org.eclipse.rse.internal.ui.filters.SystemFilterPoolManagerUIProvider;
26
import org.eclipse.rse.internal.ui.filters.dialogs.SystemFilterWorkWithFilterPoolsDialog;
25
import org.eclipse.rse.internal.ui.filters.dialogs.SystemFilterWorkWithFilterPoolsDialog;
27
import org.eclipse.rse.ui.ISystemContextMenuConstants;
26
import org.eclipse.rse.ui.ISystemContextMenuConstants;
28
import org.eclipse.rse.ui.ISystemIconConstants;
27
import org.eclipse.rse.ui.ISystemIconConstants;
29
import org.eclipse.rse.ui.RSEUIPlugin;
28
import org.eclipse.rse.ui.RSEUIPlugin;
30
import org.eclipse.rse.ui.dialogs.SystemSimpleContentElement;
29
import org.eclipse.rse.ui.dialogs.SystemSimpleContentElement;
30
import org.eclipse.rse.ui.filters.SystemFilterPoolDialogInterface;
31
import org.eclipse.rse.ui.filters.SystemFilterUIHelpers;
31
import org.eclipse.rse.ui.filters.SystemFilterUIHelpers;
32
import org.eclipse.rse.ui.filters.actions.SystemFilterAbstractFilterPoolAction;
32
import org.eclipse.rse.ui.filters.actions.SystemFilterAbstractFilterPoolAction;
33
import org.eclipse.rse.ui.validators.ValidatorFilterPoolName;
33
import org.eclipse.rse.ui.validators.ValidatorFilterPoolName;
(-)UI/org/eclipse/rse/internal/ui/actions/SystemFilterNewFilterPoolAction.java (-2 / +2 lines)
Lines 22-38 Link Here
22
import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManager;
22
import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManager;
23
import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManagerProvider;
23
import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManagerProvider;
24
import org.eclipse.rse.internal.ui.SystemResources;
24
import org.eclipse.rse.internal.ui.SystemResources;
25
import org.eclipse.rse.internal.ui.filters.SystemFilterPoolDialogOutputs;
26
import org.eclipse.rse.internal.ui.filters.dialogs.SystemFilterNewFilterPoolWizard;
25
import org.eclipse.rse.internal.ui.filters.dialogs.SystemFilterNewFilterPoolWizard;
27
import org.eclipse.rse.internal.ui.filters.dialogs.SystemFilterPoolWizardDialog;
26
import org.eclipse.rse.internal.ui.filters.dialogs.SystemFilterPoolWizardDialog;
28
import org.eclipse.rse.internal.ui.filters.dialogs.SystemFilterPoolWizardInterface;
29
import org.eclipse.rse.internal.ui.filters.dialogs.SystemFilterWorkWithFilterPoolsDialog;
27
import org.eclipse.rse.internal.ui.filters.dialogs.SystemFilterWorkWithFilterPoolsDialog;
30
import org.eclipse.rse.ui.ISystemContextMenuConstants;
28
import org.eclipse.rse.ui.ISystemContextMenuConstants;
31
import org.eclipse.rse.ui.ISystemIconConstants;
29
import org.eclipse.rse.ui.ISystemIconConstants;
32
import org.eclipse.rse.ui.RSEUIPlugin;
30
import org.eclipse.rse.ui.RSEUIPlugin;
33
import org.eclipse.rse.ui.actions.ISystemWizardAction;
31
import org.eclipse.rse.ui.actions.ISystemWizardAction;
34
import org.eclipse.rse.ui.dialogs.SystemSimpleContentElement;
32
import org.eclipse.rse.ui.dialogs.SystemSimpleContentElement;
33
import org.eclipse.rse.ui.filters.SystemFilterPoolDialogOutputs;
35
import org.eclipse.rse.ui.filters.actions.SystemFilterAbstractFilterPoolWizardAction;
34
import org.eclipse.rse.ui.filters.actions.SystemFilterAbstractFilterPoolWizardAction;
35
import org.eclipse.rse.ui.filters.dialogs.SystemFilterPoolWizardInterface;
36
import org.eclipse.swt.widgets.Shell;
36
import org.eclipse.swt.widgets.Shell;
37
37
38
38
(-)UI/org/eclipse/rse/internal/ui/actions/SystemFilterSelectFilterPoolsAction.java (-1 / +1 lines)
Lines 24-35 Link Here
24
import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManager;
24
import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManager;
25
import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManagerProvider;
25
import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManagerProvider;
26
import org.eclipse.rse.internal.ui.SystemResources;
26
import org.eclipse.rse.internal.ui.SystemResources;
27
import org.eclipse.rse.internal.ui.filters.SystemFilterPoolDialogInterface;
28
import org.eclipse.rse.ui.ISystemContextMenuConstants;
27
import org.eclipse.rse.ui.ISystemContextMenuConstants;
29
import org.eclipse.rse.ui.ISystemIconConstants;
28
import org.eclipse.rse.ui.ISystemIconConstants;
30
import org.eclipse.rse.ui.RSEUIPlugin;
29
import org.eclipse.rse.ui.RSEUIPlugin;
31
import org.eclipse.rse.ui.dialogs.SystemSimpleContentElement;
30
import org.eclipse.rse.ui.dialogs.SystemSimpleContentElement;
32
import org.eclipse.rse.ui.dialogs.SystemSimpleSelectDialog;
31
import org.eclipse.rse.ui.dialogs.SystemSimpleSelectDialog;
32
import org.eclipse.rse.ui.filters.SystemFilterPoolDialogInterface;
33
import org.eclipse.rse.ui.filters.SystemFilterUIHelpers;
33
import org.eclipse.rse.ui.filters.SystemFilterUIHelpers;
34
import org.eclipse.rse.ui.filters.actions.SystemFilterAbstractFilterPoolAction;
34
import org.eclipse.rse.ui.filters.actions.SystemFilterAbstractFilterPoolAction;
35
import org.eclipse.swt.widgets.Shell;
35
import org.eclipse.swt.widgets.Shell;
(-)UI/org/eclipse/rse/ui/dialogs/SystemSelectAnythingDialog.java (-4 / +4 lines)
Lines 23-30 Link Here
23
import org.eclipse.jface.viewers.SelectionChangedEvent;
23
import org.eclipse.jface.viewers.SelectionChangedEvent;
24
import org.eclipse.rse.core.RSECorePlugin;
24
import org.eclipse.rse.core.RSECorePlugin;
25
import org.eclipse.rse.core.model.ISystemViewInputProvider;
25
import org.eclipse.rse.core.model.ISystemViewInputProvider;
26
import org.eclipse.rse.internal.ui.view.SystemViewForm;
27
import org.eclipse.rse.ui.SystemActionViewerFilter;
26
import org.eclipse.rse.ui.SystemActionViewerFilter;
27
import org.eclipse.rse.ui.view.SystemViewForm;
28
import org.eclipse.swt.SWT;
28
import org.eclipse.swt.SWT;
29
import org.eclipse.swt.widgets.Composite;
29
import org.eclipse.swt.widgets.Composite;
30
import org.eclipse.swt.widgets.Control;
30
import org.eclipse.swt.widgets.Control;
Lines 48-57 Link Here
48
	{
48
	{
49
		
49
		
50
		_view = new SystemViewForm(getShell(), parent, SWT.NONE, getInputProvider(), true, this); 
50
		_view = new SystemViewForm(getShell(), parent, SWT.NONE, getInputProvider(), true, this); 
51
		_view.getSystemView().addSelectionChangedListener(this);	
51
		_view.getSystemTree().addSelectionChangedListener(this);	
52
		
52
		
53
		if (_filter != null){
53
		if (_filter != null){
54
			_view.getSystemView().addFilter(_filter);
54
			_view.getSystemTree().addFilter(_filter);
55
		}
55
		}
56
		
56
		
57
		return _view.getTreeControl();
57
		return _view.getTreeControl();
Lines 104-110 Link Here
104
		_filter = filter;
104
		_filter = filter;
105
		if (_view != null)
105
		if (_view != null)
106
		{
106
		{
107
			_view.getSystemView().addFilter(filter);
107
			_view.getSystemTree().addFilter(filter);
108
		}
108
		}
109
109
110
	}
110
	}
(-)UI/org/eclipse/rse/ui/dialogs/SystemRemoteResourceDialog.java (-2 / +2 lines)
Lines 22-32 Link Here
22
22
23
import org.eclipse.rse.core.IRSESystemType;
23
import org.eclipse.rse.core.IRSESystemType;
24
import org.eclipse.rse.core.model.IHost;
24
import org.eclipse.rse.core.model.IHost;
25
import org.eclipse.rse.internal.ui.view.SystemResourceSelectionForm;
26
import org.eclipse.rse.internal.ui.view.SystemResourceSelectionInputProvider;
27
import org.eclipse.rse.ui.SystemActionViewerFilter;
25
import org.eclipse.rse.ui.SystemActionViewerFilter;
28
import org.eclipse.rse.ui.messages.ISystemMessageLine;
26
import org.eclipse.rse.ui.messages.ISystemMessageLine;
29
import org.eclipse.rse.ui.validators.IValidatorRemoteSelection;
27
import org.eclipse.rse.ui.validators.IValidatorRemoteSelection;
28
import org.eclipse.rse.ui.view.SystemResourceSelectionForm;
29
import org.eclipse.rse.ui.view.SystemResourceSelectionInputProvider;
30
import org.eclipse.swt.widgets.Composite;
30
import org.eclipse.swt.widgets.Composite;
31
import org.eclipse.swt.widgets.Control;
31
import org.eclipse.swt.widgets.Control;
32
import org.eclipse.swt.widgets.Shell;
32
import org.eclipse.swt.widgets.Shell;
(-)UI/org/eclipse/rse/ui/filters/actions/SystemFilterAbstractFilterPoolWizardAction.java (-2 / +3 lines)
Lines 20-29 Link Here
20
20
21
import org.eclipse.jface.dialogs.Dialog;
21
import org.eclipse.jface.dialogs.Dialog;
22
import org.eclipse.jface.resource.ImageDescriptor;
22
import org.eclipse.jface.resource.ImageDescriptor;
23
import org.eclipse.rse.internal.ui.filters.SystemFilterPoolDialogInterface;
24
import org.eclipse.rse.internal.ui.filters.dialogs.SystemFilterPoolWizardDialog;
23
import org.eclipse.rse.internal.ui.filters.dialogs.SystemFilterPoolWizardDialog;
25
import org.eclipse.rse.internal.ui.filters.dialogs.SystemFilterPoolWizardInterface;
26
import org.eclipse.rse.ui.ISystemContextMenuConstants;
24
import org.eclipse.rse.ui.ISystemContextMenuConstants;
25
import org.eclipse.rse.ui.filters.SystemFilterPoolDialogInterface;
26
import org.eclipse.rse.ui.filters.dialogs.SystemFilterPoolWizardInterface;
27
import org.eclipse.swt.widgets.Shell;
27
import org.eclipse.swt.widgets.Shell;
28
28
29
29
Lines 82-87 Link Here
82
82
83
	/**
83
	/**
84
	 * Return the wizard so we can customize it prior to showing it.
84
	 * Return the wizard so we can customize it prior to showing it.
85
	 * @since 3.0
85
	 */
86
	 */
86
	public abstract SystemFilterPoolWizardInterface getFilterPoolWizard();
87
	public abstract SystemFilterPoolWizardInterface getFilterPoolWizard();
87
88
(-)UI/org/eclipse/rse/ui/filters/actions/SystemFilterAbstractFilterPoolAction.java (-2 / +3 lines)
Lines 30-39 Link Here
30
import org.eclipse.rse.core.filters.ISystemFilterReference;
30
import org.eclipse.rse.core.filters.ISystemFilterReference;
31
import org.eclipse.rse.core.filters.ISystemFilterString;
31
import org.eclipse.rse.core.filters.ISystemFilterString;
32
import org.eclipse.rse.core.filters.ISystemFilterStringReference;
32
import org.eclipse.rse.core.filters.ISystemFilterStringReference;
33
import org.eclipse.rse.internal.ui.filters.SystemFilterPoolDialogInputs;
34
import org.eclipse.rse.internal.ui.filters.SystemFilterPoolDialogInterface;
35
import org.eclipse.rse.ui.actions.SystemBaseDialogAction;
33
import org.eclipse.rse.ui.actions.SystemBaseDialogAction;
36
import org.eclipse.rse.ui.dialogs.SystemSimpleContentElement;
34
import org.eclipse.rse.ui.dialogs.SystemSimpleContentElement;
35
import org.eclipse.rse.ui.filters.SystemFilterPoolDialogInputs;
36
import org.eclipse.rse.ui.filters.SystemFilterPoolDialogInterface;
37
import org.eclipse.swt.widgets.Shell;
37
import org.eclipse.swt.widgets.Shell;
38
38
39
39
Lines 466-471 Link Here
466
	/**
466
	/**
467
	 * Where you create the dialog meeting our interface. If you override
467
	 * Where you create the dialog meeting our interface. If you override
468
	 * createDialog, then override this to return null
468
	 * createDialog, then override this to return null
469
	 * @since 3.0
469
	 */
470
	 */
470
	public abstract SystemFilterPoolDialogInterface createFilterPoolDialog(Shell parent);
471
	public abstract SystemFilterPoolDialogInterface createFilterPoolDialog(Shell parent);
471
472
(-)UI/org/eclipse/rse/internal/ui/view/team/SystemTeamViewPropertySetAdapter.java (-1 / +1 lines)
Lines 242-248 Link Here
242
	public String getMementoHandleKey(Object element)
242
	public String getMementoHandleKey(Object element)
243
	{
243
	{
244
		SystemTeamViewPropertySetNode factory = (SystemTeamViewPropertySetNode)element;	
244
		SystemTeamViewPropertySetNode factory = (SystemTeamViewPropertySetNode)element;	
245
		return  factory.getLabel(); //$NON-NLS-1$  
245
		return  factory.getLabel(); 
246
	}
246
	}
247
247
248
	/**
248
	/**
(-)UI/org/eclipse/rse/ui/filters/dialogs/SystemNewFilterWizard.java (-1 lines)
Lines 35-41 Link Here
35
import org.eclipse.rse.core.filters.ISystemFilterPoolWrapperInformation;
35
import org.eclipse.rse.core.filters.ISystemFilterPoolWrapperInformation;
36
import org.eclipse.rse.core.filters.ISystemFilterReference;
36
import org.eclipse.rse.core.filters.ISystemFilterReference;
37
import org.eclipse.rse.internal.ui.SystemResources;
37
import org.eclipse.rse.internal.ui.SystemResources;
38
import org.eclipse.rse.internal.ui.filters.dialogs.SystemNewFilterWizardNamePage;
39
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
38
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
40
import org.eclipse.rse.ui.ISystemIconConstants;
39
import org.eclipse.rse.ui.ISystemIconConstants;
41
import org.eclipse.rse.ui.ISystemMessages;
40
import org.eclipse.rse.ui.ISystemMessages;
(-)subsystems/org/eclipse/rse/core/subsystems/SubSystemConfiguration.java (-1 / +2 lines)
Lines 58-63 Link Here
58
import org.eclipse.rse.core.filters.ISystemFilterPoolManager;
58
import org.eclipse.rse.core.filters.ISystemFilterPoolManager;
59
import org.eclipse.rse.core.filters.ISystemFilterPoolReference;
59
import org.eclipse.rse.core.filters.ISystemFilterPoolReference;
60
import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManager;
60
import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManager;
61
import org.eclipse.rse.core.filters.ISystemFilterPoolWrapperInformation;
61
import org.eclipse.rse.core.filters.ISystemFilterString;
62
import org.eclipse.rse.core.filters.ISystemFilterString;
62
import org.eclipse.rse.core.model.IHost;
63
import org.eclipse.rse.core.model.IHost;
63
import org.eclipse.rse.core.model.ILabeledObject;
64
import org.eclipse.rse.core.model.ILabeledObject;
Lines 1414-1420 Link Here
1414
	 * Overridable entry for child classes to supply their own flavour of ISystemFilterPoolWrapperInformation for
1415
	 * Overridable entry for child classes to supply their own flavour of ISystemFilterPoolWrapperInformation for
1415
	 *  the new filter wizards.
1416
	 *  the new filter wizards.
1416
	 */
1417
	 */
1417
	protected SystemFilterPoolWrapperInformation getNewFilterWizardPoolWrapperInformation()
1418
	protected ISystemFilterPoolWrapperInformation getNewFilterWizardPoolWrapperInformation()
1418
	{
1419
	{
1419
		return new SystemFilterPoolWrapperInformation(SystemResources.RESID_NEWFILTER_PAGE2_PROFILE_LABEL, SystemResources.RESID_NEWFILTER_PAGE2_PROFILE_TOOLTIP, 
1420
		return new SystemFilterPoolWrapperInformation(SystemResources.RESID_NEWFILTER_PAGE2_PROFILE_LABEL, SystemResources.RESID_NEWFILTER_PAGE2_PROFILE_TOOLTIP, 
1420
				SystemResources.RESID_NEWFILTER_PAGE2_PROFILE_VERBIAGE);
1421
				SystemResources.RESID_NEWFILTER_PAGE2_PROFILE_VERBIAGE);
(-)UI/org/eclipse/rse/internal/ui/view/monitor/SystemMonitorViewPart.java (-5 / +5 lines)
Lines 25-31 Link Here
25
25
26
import java.util.ArrayList;
26
import java.util.ArrayList;
27
import java.util.Vector;
27
import java.util.Vector;
28
 
28
29
import org.eclipse.core.runtime.IAdaptable;
29
import org.eclipse.core.runtime.IAdaptable;
30
import org.eclipse.jface.action.IMenuManager;
30
import org.eclipse.jface.action.IMenuManager;
31
import org.eclipse.jface.action.IStatusLineManager;
31
import org.eclipse.jface.action.IStatusLineManager;
Lines 49-55 Link Here
49
import org.eclipse.rse.internal.ui.SystemPropertyResources;
49
import org.eclipse.rse.internal.ui.SystemPropertyResources;
50
import org.eclipse.rse.internal.ui.SystemResources;
50
import org.eclipse.rse.internal.ui.SystemResources;
51
import org.eclipse.rse.internal.ui.view.SystemTableTreeViewProvider;
51
import org.eclipse.rse.internal.ui.view.SystemTableTreeViewProvider;
52
import org.eclipse.rse.internal.ui.view.SystemTableViewColumnManager;
53
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
52
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
54
import org.eclipse.rse.ui.ISystemIconConstants;
53
import org.eclipse.rse.ui.ISystemIconConstants;
55
import org.eclipse.rse.ui.RSEUIPlugin;
54
import org.eclipse.rse.ui.RSEUIPlugin;
Lines 58-63 Link Here
58
import org.eclipse.rse.ui.messages.ISystemMessageLine;
57
import org.eclipse.rse.ui.messages.ISystemMessageLine;
59
import org.eclipse.rse.ui.model.ISystemShellProvider;
58
import org.eclipse.rse.ui.model.ISystemShellProvider;
60
import org.eclipse.rse.ui.view.IRSEViewPart;
59
import org.eclipse.rse.ui.view.IRSEViewPart;
60
import org.eclipse.rse.ui.view.ISystemTableViewColumnManager;
61
import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
61
import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
62
import org.eclipse.rse.ui.view.SystemTableView;
62
import org.eclipse.rse.ui.view.SystemTableView;
63
import org.eclipse.swt.SWT;
63
import org.eclipse.swt.SWT;
Lines 311-317 Link Here
311
	    class SelectColumnsDialog extends SystemPromptDialog
311
	    class SelectColumnsDialog extends SystemPromptDialog
312
		{
312
		{
313
	        private ISystemViewElementAdapter _adapter;
313
	        private ISystemViewElementAdapter _adapter;
314
	        private SystemTableViewColumnManager _columnManager;
314
	        private ISystemTableViewColumnManager _columnManager;
315
			private IPropertyDescriptor[] _uniqueDescriptors;
315
			private IPropertyDescriptor[] _uniqueDescriptors;
316
			private ArrayList _currentDisplayedDescriptors;
316
			private ArrayList _currentDisplayedDescriptors;
317
			private ArrayList _availableDescriptors;
317
			private ArrayList _availableDescriptors;
Lines 325-331 Link Here
325
			private Button _downButton;
325
			private Button _downButton;
326
			
326
			
327
327
328
			public SelectColumnsDialog(Shell shell, ISystemViewElementAdapter viewAdapter, SystemTableViewColumnManager columnManager)
328
			public SelectColumnsDialog(Shell shell, ISystemViewElementAdapter viewAdapter, ISystemTableViewColumnManager columnManager)
329
			{
329
			{
330
				super(shell, SystemResources.RESID_TABLE_SELECT_COLUMNS_LABEL);
330
				super(shell, SystemResources.RESID_TABLE_SELECT_COLUMNS_LABEL);
331
				setToolTipText(SystemResources.RESID_TABLE_SELECT_COLUMNS_TOOLTIP);
331
				setToolTipText(SystemResources.RESID_TABLE_SELECT_COLUMNS_TOOLTIP);
Lines 600-606 Link Here
600
		public void run()
600
		public void run()
601
		{
601
		{
602
			SystemTableView viewer = getViewer();
602
			SystemTableView viewer = getViewer();
603
		    SystemTableViewColumnManager mgr = viewer.getColumnManager();		    
603
		    ISystemTableViewColumnManager mgr = viewer.getColumnManager();		    
604
		    ISystemViewElementAdapter adapter = viewer.getAdapterForContents();
604
		    ISystemViewElementAdapter adapter = viewer.getAdapterForContents();
605
		    SelectColumnsDialog dlg = new SelectColumnsDialog(getShell(), adapter, mgr);
605
		    SelectColumnsDialog dlg = new SelectColumnsDialog(getShell(), adapter, mgr);
606
		    if (dlg.open() == Window.OK)
606
		    if (dlg.open() == Window.OK)
(-)UI/org/eclipse/rse/ui/RSEUIPlugin.java (-1 / +1 lines)
Lines 57-69 Link Here
57
import org.eclipse.rse.internal.ui.actions.SystemShowPreferencesPageAction;
57
import org.eclipse.rse.internal.ui.actions.SystemShowPreferencesPageAction;
58
import org.eclipse.rse.internal.ui.subsystems.SubSystemConfigurationProxyAdapterFactory;
58
import org.eclipse.rse.internal.ui.subsystems.SubSystemConfigurationProxyAdapterFactory;
59
import org.eclipse.rse.internal.ui.view.SubSystemConfigurationAdapterFactory;
59
import org.eclipse.rse.internal.ui.view.SubSystemConfigurationAdapterFactory;
60
import org.eclipse.rse.internal.ui.view.SystemViewAdapterFactory;
61
import org.eclipse.rse.internal.ui.view.team.SystemTeamViewResourceAdapterFactory;
60
import org.eclipse.rse.internal.ui.view.team.SystemTeamViewResourceAdapterFactory;
62
import org.eclipse.rse.persistence.IRSEPersistenceManager;
61
import org.eclipse.rse.persistence.IRSEPersistenceManager;
63
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
62
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
64
import org.eclipse.rse.services.clientserver.messages.SystemMessageFile;
63
import org.eclipse.rse.services.clientserver.messages.SystemMessageFile;
65
import org.eclipse.rse.ui.internal.model.SystemRegistryUI;
64
import org.eclipse.rse.ui.internal.model.SystemRegistryUI;
66
import org.eclipse.rse.ui.model.ISystemRegistryUI;
65
import org.eclipse.rse.ui.model.ISystemRegistryUI;
66
import org.eclipse.rse.ui.view.SystemViewAdapterFactory;
67
import org.osgi.framework.BundleContext;
67
import org.osgi.framework.BundleContext;
68
68
69
69
(-)UI/org/eclipse/rse/ui/filters/SystemFilterPoolDialogInputs.java (+46 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2002, 2007 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Initial Contributors:
9
 * The following IBM employees contributed to the Remote System Explorer
10
 * component that contains this file: David McKnight, Kushal Munir, 
11
 * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, 
12
 * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
13
 * 
14
 * Contributors:
15
 * {Name} (company) - description of contribution.
16
 *******************************************************************************/
17
18
package org.eclipse.rse.ui.filters;
19
//import org.eclipse.rse.core.*;
20
import org.eclipse.rse.core.filters.ISystemFilterPoolManager;
21
import org.eclipse.rse.core.filters.ISystemFilterPoolManagerProvider;
22
import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManager;
23
import org.eclipse.rse.ui.dialogs.SystemSimpleContentElement;
24
import org.eclipse.rse.ui.filters.dialogs.SystemFilterDialogInputs;
25
26
27
28
/**
29
 * A class capturing the attributes commonly needed by dialogs that
30
 * work with filter pools.
31
 */
32
public class SystemFilterPoolDialogInputs extends SystemFilterDialogInputs
33
{
34
35
36
    public ISystemFilterPoolManagerProvider poolManagerProvider = null;
37
	public ISystemFilterPoolManager[] poolManagers = null;
38
	public ISystemFilterPoolReferenceManager refManager = null;
39
	public int mgrSelection = 0;
40
	public String poolNamePrompt;	
41
	public String poolNameTip;	
42
	public String poolMgrNamePrompt;
43
	public String poolMgrNameTip;	
44
	
45
    public SystemSimpleContentElement filterPoolTreeRoot;
46
}
(-)UI/org/eclipse/rse/ui/view/SystemResourceSelectionForm.java (+634 lines)
Added Link Here
1
/********************************************************************************
2
 * Copyright (c) 2006, 2007 IBM Corporation and others. All rights reserved.
3
 * This program and the accompanying materials are made available under the terms
4
 * of the Eclipse Public License v1.0 which accompanies this distribution, and is 
5
 * available at http://www.eclipse.org/legal/epl-v10.html
6
 * 
7
 * Initial Contributors:
8
 * The following IBM employees contributed to the Remote System Explorer
9
 * component that contains this file: David McKnight, Kushal Munir, 
10
 * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, 
11
 * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
12
 * 
13
 * Contributors:
14
 * Kevin Doyle (IBM) - Added getSystemViewForm()
15
 * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType
16
 * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
17
 * Martin Oberhuber (Wind River) - [190442] made SystemActionViewerFilter API
18
 * Martin Oberhuber (Wind River) - [202866] Fix exceptions in RSE browse dialog when SystemRegistry is not yet fully initialized
19
 ********************************************************************************/
20
21
package org.eclipse.rse.ui.view;
22
23
import java.util.HashMap;
24
import java.util.Iterator;
25
import java.util.List;
26
27
import org.eclipse.core.runtime.IAdaptable;
28
import org.eclipse.jface.viewers.ISelection;
29
import org.eclipse.jface.viewers.ISelectionChangedListener;
30
import org.eclipse.jface.viewers.IStructuredSelection;
31
import org.eclipse.jface.viewers.SelectionChangedEvent;
32
import org.eclipse.jface.wizard.WizardPage;
33
import org.eclipse.rse.core.IRSESystemType;
34
import org.eclipse.rse.core.RSECorePlugin;
35
import org.eclipse.rse.core.filters.ISystemFilterReference;
36
import org.eclipse.rse.core.model.IHost;
37
import org.eclipse.rse.core.model.ISystemRegistry;
38
import org.eclipse.rse.core.subsystems.ISubSystem;
39
import org.eclipse.rse.internal.ui.view.SystemPropertySheetForm;
40
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
41
import org.eclipse.rse.ui.SystemActionViewerFilter;
42
import org.eclipse.rse.ui.SystemWidgetHelpers;
43
import org.eclipse.rse.ui.dialogs.SystemPromptDialog;
44
import org.eclipse.rse.ui.messages.ISystemMessageLine;
45
import org.eclipse.rse.ui.validators.IValidatorRemoteSelection;
46
import org.eclipse.rse.ui.widgets.SystemHostCombo;
47
import org.eclipse.swt.SWT;
48
import org.eclipse.swt.events.SelectionAdapter;
49
import org.eclipse.swt.events.SelectionEvent;
50
import org.eclipse.swt.graphics.Point;
51
import org.eclipse.swt.layout.GridData;
52
import org.eclipse.swt.layout.GridLayout;
53
import org.eclipse.swt.widgets.Composite;
54
import org.eclipse.swt.widgets.Control;
55
import org.eclipse.swt.widgets.Label;
56
import org.eclipse.swt.widgets.Shell;
57
import org.eclipse.swt.widgets.Text;
58
59
60
public class SystemResourceSelectionForm implements ISelectionChangedListener
61
{	
62
	private Shell _shell;
63
	private boolean _multipleSelection = true;
64
	protected static final int PROMPT_WIDTH = 400; // The maximum width of the dialog's prompt, in pixels.
65
	
66
	private SystemResourceSelectionInputProvider _inputProvider;
67
	private SystemHostCombo _connectionCombo;
68
	private SystemViewForm _systemViewForm;
69
	private Composite _propertySheetContainer;
70
    private SystemPropertySheetForm _ps;
71
	
72
	private Text _pathText;
73
	private boolean _isValid;
74
	private ISystemMessageLine _msgLine;
75
	protected Object previousSelection = null;
76
	private IValidatorRemoteSelection _selectionValidator = null;
77
	private boolean  showPropertySheet = false;
78
79
	
80
	protected Object  caller;
81
	protected boolean callerInstanceOfWizardPage, callerInstanceOfSystemPromptDialog;	
82
83
	protected String    _verbiage = null;
84
	protected Label     verbiageLabel;
85
	private Composite _container;
86
	
87
	// history
88
	private HashMap _history;
89
	
90
	// outputs 
91
	protected IHost outputConnection = null;
92
	protected Object[] outputObjects = null;	
93
	
94
	
95
	public SystemResourceSelectionForm(Shell shell, Composite parent, Object caller,
96
			SystemResourceSelectionInputProvider inputProvider, String verbiage,
97
			boolean multipleSelection, 
98
			ISystemMessageLine msgLine)
99
	{
100
		_msgLine= msgLine;
101
		_history = new HashMap();
102
		_inputProvider = inputProvider;
103
		_multipleSelection = multipleSelection;
104
		_shell = shell;
105
		_verbiage = verbiage;
106
		this.caller = caller;
107
		callerInstanceOfWizardPage = (caller instanceof WizardPage);
108
		callerInstanceOfSystemPromptDialog = (caller instanceof SystemPromptDialog);
109
	        
110
		createControls(parent);
111
	}	
112
	
113
	public void setMessageLine(ISystemMessageLine msgLine)
114
	{
115
		_msgLine = msgLine;
116
	}
117
	
118
	   /**
119
     * Return first selected object
120
     */	
121
    public Object getSelectedObject()
122
    {
123
    	if ((outputObjects != null) && (outputObjects.length>=1))
124
    	  return outputObjects[0];
125
    	else
126
    	  return null;
127
    }
128
    /**
129
     * Return all selected objects. 
130
     */	
131
    public Object[] getSelectedObjects()
132
    {
133
    	return outputObjects;
134
    }
135
    
136
    /**
137
     * Return the embedded System Tree object.
138
     * Will be null until createControls is called.
139
     */
140
    public SystemViewForm getSystemViewForm()
141
    {
142
    	return _systemViewForm;
143
    }
144
    
145
	public void createControls(Composite parent)
146
	{
147
    	_container = SystemWidgetHelpers.createComposite(parent, showPropertySheet ? 2 : 1);  
148
		//Composite container = new Composite(parent, SWT.NULL);
149
150
151
		// INNER COMPOSITE
152
		int gridColumns = 2;
153
		Composite composite_prompts = SystemWidgetHelpers.createFlushComposite(_container, gridColumns);	
154
155
        // PROPERTY SHEET COMPOSITE
156
		if (showPropertySheet)
157
		{
158
			createPropertySheet(_container, _shell);
159
		}
160
161
162
        // MESSAGE/VERBIAGE TEXT AT TOP
163
        verbiageLabel = SystemWidgetHelpers.createVerbiage(composite_prompts, _verbiage, gridColumns, false, PROMPT_WIDTH);
164
  
165
    	
166
		boolean allowMultipleConnnections = _inputProvider.allowMultipleConnections();
167
		if (!allowMultipleConnnections)
168
		{
169
			//Label connectionLabel = SystemWidgetHelpers.createLabel(composite_prompts, _inputProvider.getSystemConnection().getHostName());
170
		}
171
		else
172
		{
173
			IRSESystemType[] systemTypes = _inputProvider.getSystemTypes();
174
			String category = _inputProvider.getCategory();
175
		
176
			if (systemTypes != null)
177
			{
178
				_connectionCombo = new SystemHostCombo(composite_prompts, SWT.NULL, systemTypes, _inputProvider.getSystemConnection(), _inputProvider.allowNewConnection());	
179
			}
180
			else if (category != null)
181
			{
182
				_connectionCombo = new SystemHostCombo(composite_prompts, SWT.NULL, _inputProvider.getSystemConnection(), _inputProvider.allowNewConnection(), category);	
183
			}
184
			else
185
			{
186
				_connectionCombo = new SystemHostCombo(composite_prompts, SWT.NULL, 
187
						SystemWidgetHelpers.getValidSystemTypes(null),
188
						_inputProvider.getSystemConnection(),
189
						_inputProvider.allowNewConnection());	
190
				
191
			}
192
			_connectionCombo.addSelectionListener(new SelectionAdapter() 
193
					{
194
				   public void widgetSelected(SelectionEvent evt) 
195
				   {
196
					   IHost connection = _connectionCombo.getHost();
197
					   connectionChanged(connection);
198
				   }}
199
					);	
200
			_connectionCombo.listenToConnectionEvents(true);
201
		}
202
		
203
		_pathText = SystemWidgetHelpers.createReadonlyTextField(composite_prompts);
204
		_systemViewForm = new SystemViewForm(_shell, composite_prompts, SWT.NULL, _inputProvider, !_multipleSelection, _msgLine);
205
		_systemViewForm.addSelectionChangedListener(this);		
206
		
207
			
208
		GridLayout layout = new GridLayout();
209
		GridData gdata = new GridData(GridData.FILL_BOTH);
210
		composite_prompts.setLayout(layout);
211
		composite_prompts.setLayoutData(gdata);
212
			
213
		doInitializeFields();
214
	}
215
	
216
	private void doInitializeFields()
217
	{
218
		  setPageComplete();
219
		  return; 
220
	}
221
	
222
	/**
223
	 * Create the property sheet viewer
224
	 */
225
	private void createPropertySheet(Composite outerParent, Shell shell)
226
	{
227
		_propertySheetContainer = SystemWidgetHelpers.createFlushComposite(outerParent, 1);	
228
		((GridData)_propertySheetContainer.getLayoutData()).grabExcessVerticalSpace = true;
229
		((GridData)_propertySheetContainer.getLayoutData()).verticalAlignment = GridData.FILL;
230
231
        // PROPERTY SHEET VIEWER
232
        _ps = new SystemPropertySheetForm(shell,_propertySheetContainer, SWT.BORDER, _msgLine);			
233
	}
234
	
235
	public Control getInitialFocusControl()
236
	{
237
		return _systemViewForm.getTreeControl();
238
	}
239
	
240
	public void applyViewerFilter(SystemActionViewerFilter filter)
241
	{
242
		if (filter != null)
243
		{
244
			_systemViewForm.getSystemTree().addFilter(filter);
245
		}
246
	}
247
    
248
	/**
249
	 * Completes processing of the wizard page or dialog. If this 
250
	 * method returns true, the wizard/dialog will close; 
251
	 * otherwise, it will stay active.
252
	 *
253
	 * @return true if no errors
254
	 */
255
	public boolean verify() 
256
	{
257
		if (_isValid)
258
		{
259
			if (_msgLine != null)
260
			{
261
				_msgLine.clearErrorMessage();    		
262
			}
263
			return true;
264
		}
265
		else
266
		{
267
			return false;
268
		}
269
	}
270
	
271
	protected ISystemViewElementAdapter getViewAdapter(Object selection)
272
	{
273
		if (selection != null && selection instanceof IAdaptable)
274
		{
275
			return (ISystemViewElementAdapter)((IAdaptable)selection).getAdapter(ISystemViewElementAdapter.class);
276
		}
277
		return null;
278
	}
279
	
280
	protected ISystemRemoteElementAdapter getRemoteAdapter(Object selection)
281
	{
282
		if (selection != null && selection instanceof IAdaptable)
283
		{
284
			return SystemAdapterHelpers.getRemoteAdapter(selection);
285
		}
286
		return null;
287
	}
288
	
289
	protected ISystemRemoteElementAdapter[] getRemoteAdapters(ISelection selection)
290
	{
291
		Object[] selectedObjects = getSelections(selection);
292
		ISystemRemoteElementAdapter[] adapters = new ISystemRemoteElementAdapter[selectedObjects.length];
293
		for (int idx=0; idx<adapters.length; idx++)
294
		{
295
			adapters[idx] = getRemoteAdapter(selectedObjects[idx]);
296
		}
297
		return adapters;
298
	}
299
	
300
	
301
	public void connectionChanged(IHost connection)
302
	{
303
		IHost previousConnection = _inputProvider.getSystemConnection();
304
		 if (previousConnection != connection)
305
		   {				 	
306
			
307
			   _inputProvider.setSystemConnection(connection, false);
308
			   		
309
			   _systemViewForm.refresh();
310
			   Object oldSelection = _history.get(connection);	
311
			   if (oldSelection != null)
312
			   {
313
				   setPreSelection(oldSelection);
314
			   }
315
		   }
316
	}
317
318
	public void setVerbiage(String verbiage)
319
	{
320
		_verbiage = verbiage;
321
	}
322
	
323
	public boolean setPreSelection(Object selection)
324
	{
325
		ISystemViewElementAdapter adapter = getViewAdapter(selection);
326
		if (adapter != null)
327
		{
328
			Object parent = adapter.getParent(selection);
329
			ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
330
			ISubSystem ss = adapter.getSubSystem(selection);
331
			IHost connection = ss.getHost();
332
			if (_inputProvider.allowMultipleConnections())
333
			{
334
				if (_connectionCombo.getHost()!= connection)
335
		 		{
336
		 			_connectionCombo.select(connection);
337
		 		}
338
			}
339
			List filterRefs = registry.findFilterReferencesFor(selection, ss, false);
340
			
341
			ISystemTree systemTree = _systemViewForm.getSystemTree();
342
			if (filterRefs.size() > 0)
343
			{
344
				ISystemFilterReference ref = (ISystemFilterReference)filterRefs.get(0);
345
				systemTree.expandTo(ref, selection);
346
347
				return true;
348
			}
349
			else
350
			{
351
				if (setPreSelection(parent))
352
				{
353
					systemTree.expandTo(parent, selection);
354
					return true;
355
				}				
356
			}
357
		}
358
		return false;
359
	}
360
361
    
362
    protected void setPathText(String text)
363
    {
364
    	_pathText.setText(text);
365
    }
366
  
367
    
368
    public Object[] getOutputObjects()
369
    {
370
    	return outputObjects;
371
    }
372
    
373
    /**
374
     * Return selected connection
375
     */	
376
    public IHost getSelectedConnection()
377
    {
378
    	return outputConnection;
379
    }
380
    
381
    /**
382
	 * Return first item currently selected.
383
	 */
384
	protected Object getFirstSelection(ISelection selection)
385
	{
386
		IStructuredSelection sSelection = (IStructuredSelection)selection;
387
		if (sSelection != null)
388
		{
389
	      Iterator selectionIterator = sSelection.iterator();
390
	      if (selectionIterator.hasNext())
391
	        return selectionIterator.next();
392
	      else
393
	        return null;
394
		}		
395
		return null;
396
	}	
397
	/**
398
	 * Return all items currently selected.
399
	 */
400
	protected Object[] getSelections(ISelection selection)
401
	{
402
		IStructuredSelection sSelection = (IStructuredSelection)selection;
403
		if (sSelection != null)
404
		{
405
		  Object[] selectedObjects = new Object[sSelection.size()]; 
406
	      Iterator selectionIterator = sSelection.iterator();
407
	      int idx = 0;
408
	      while (selectionIterator.hasNext())
409
	      	selectedObjects[idx++] = selectionIterator.next();
410
	      return selectedObjects;
411
		}		
412
		return null;
413
	}	
414
	
415
    
416
	private void setPathTextFromSelection(Object selection)
417
	{
418
		ISystemViewElementAdapter adapter = getViewAdapter(selection);
419
		String text = adapter.getAbsoluteName(selection);
420
	
421
		setPathText(text);
422
	}
423
	
424
	/**
425
	 * Show or hide the property sheet. This is called after the contents are created when the user
426
	 *  toggles the Details button.
427
	 * @param shell Use getShell() in your dialog or wizard page
428
	 * @param contents Use getContents() in your dialog or wizard page
429
	 * @return new state -> true if showing, false if hiding
430
	 */
431
	public boolean toggleShowPropertySheet(Shell shell, Control contents) 
432
	{
433
	    Point windowSize = shell.getSize();
434
	    Point oldSize = contents.computeSize(SWT.DEFAULT, SWT.DEFAULT);
435
436
		if (showPropertySheet) // hiding?
437
		{
438
          _ps.dispose();
439
440
          _propertySheetContainer.dispose();
441
         _ps = null;
442
         _propertySheetContainer = null;
443
          ((GridLayout)_container.getLayout()).numColumns = 1;
444
		}
445
		else // showing?
446
		{
447
		  //createPropertySheet((Composite)contents, shell);
448
          ((GridLayout)_container.getLayout()).numColumns = 2;
449
		  createPropertySheet(_container, shell);
450
		}
451
452
	    Point newSize = contents.computeSize(SWT.DEFAULT, SWT.DEFAULT);
453
	    shell.setSize(new Point(windowSize.x + (newSize.x - oldSize.x), windowSize.y));
454
	    
455
		if (_ps != null)
456
		{
457
		  ISelection s = _systemViewForm.getSelection();
458
		  if (s != null)
459
		    _ps.selectionChanged(s);		  
460
		}
461
	    
462
		showPropertySheet = !showPropertySheet;
463
		return showPropertySheet;
464
	}
465
	
466
	
467
//  ---------------------------------------------------
468
	// METHODS FOR SELECTION CHANGED LISTENER INTERFACE... 
469
	// ---------------------------------------------------
470
	/**
471
	 * User selected something in the _systemViewForm.
472
	 */
473
	public void selectionChanged(SelectionChangedEvent e)
474
	{
475
		_isValid = true;
476
		ISelection selection = e.getSelection();
477
		outputObjects = null;
478
		int selectionSize = ((IStructuredSelection)selection).size();
479
		if ((selectionSize > 1) && !_systemViewForm.sameParent())
480
		{
481
			clearErrorMessage();
482
			
483
			setPathText(""); //$NON-NLS-1$
484
			setPageComplete();
485
		    return; // don't enable OK/Add if selections from different parents
486
		}
487
		
488
		if (_ps != null)
489
			  _ps.selectionChanged(selection);
490
 
491
		Object selectedObject = getFirstSelection(selection);
492
		if (selectedObject == previousSelection && selectionSize == 1)
493
		{
494
			// DKM we null set this before, so we need to reset it
495
			outputObjects = getSelections(selection);
496
			return;	
497
		}
498
		clearErrorMessage();
499
		setPathText(""); //$NON-NLS-1$
500
		setPageComplete();
501
502
		previousSelection = selectedObject;  
503
		if (selectedObject != null)
504
		{
505
506
		  ISystemRemoteElementAdapter remoteAdapter = getRemoteAdapter(selectedObject);
507
		  if (remoteAdapter != null)
508
		  {
509
			setPathTextFromSelection(selectedObject);
510
			
511
			outputObjects = getSelections(selection);			
512
			outputConnection = remoteAdapter.getSubSystem(selectedObject).getHost();
513
			
514
		 	_history.put(outputConnection, previousSelection);
515
		  }
516
		  else
517
		  {
518
			  ISystemViewElementAdapter elementAdapter = (ISystemViewElementAdapter)((IAdaptable)selectedObject).getAdapter(ISystemViewElementAdapter.class);
519
			  if (elementAdapter != null)
520
			  {
521
					setPathTextFromSelection(selectedObject);
522
					
523
					outputObjects = getSelections(selection);			
524
					outputConnection = elementAdapter.getSubSystem(selectedObject).getHost();
525
					
526
				 	_history.put(outputConnection, previousSelection);
527
			  }
528
		  }
529
		  
530
		  
531
		  if (_selectionValidator != null) 
532
		  {
533
			  SystemMessage selectionMsg  = _selectionValidator.isValid(outputConnection, getSelections(selection), getRemoteAdapters(selection));
534
535
		  	  if (selectionMsg != null)
536
		  	  {
537
		  	  	_isValid = false;
538
		  	    setErrorMessage(selectionMsg);
539
		  	  }
540
		  }
541
		  setPageComplete();
542
		}
543
		
544
	}
545
	
546
	/**
547
	 * This method can be called by the dialog or wizard page host, to decide whether to enable
548
	 * or disable the next, final or ok buttons. It returns true if the minimal information is
549
	 * available and is correct.
550
	 */
551
	public boolean isPageComplete()
552
	{
553
		return ( (_pathText.getText().length() > 0) ) && _isValid;
554
	}
555
	
556
	/**
557
	 * Inform caller of page-complete status of this form
558
	 */
559
	public void setPageComplete()
560
	{
561
		if (callerInstanceOfWizardPage)
562
		{
563
		  ((WizardPage)caller).setPageComplete(isPageComplete());
564
		}
565
		else if (callerInstanceOfSystemPromptDialog)
566
		{
567
		  ((SystemPromptDialog)caller).setPageComplete(isPageComplete());
568
		}		
569
	}
570
  
571
    /**
572
     * Show the property sheet on the right hand side, to show the properties of the
573
     * selected object.
574
     * <p>
575
     * Default is false
576
     */
577
    public void setShowPropertySheet(boolean show)
578
    {
579
    	this.showPropertySheet = show;
580
    }
581
 
582
   
583
	
584
    /**
585
     * Specify a validator to use when the user selects a remote file or folder.
586
     * This allows you to decide if OK should be enabled or not for that remote file or folder.
587
     */
588
    public void setSelectionValidator(IValidatorRemoteSelection selectionValidator)
589
    {
590
    	_selectionValidator = selectionValidator;
591
    }
592
593
    protected void clearErrorMessage()
594
    {
595
    	if (_msgLine != null)
596
    	  _msgLine.clearErrorMessage();
597
    }
598
    protected void setErrorMessage(String msg)
599
    {
600
    	if (_msgLine != null)
601
    	  if (msg != null)
602
    	    _msgLine.setErrorMessage(msg);
603
    	  else
604
    	    _msgLine.clearErrorMessage();
605
    }
606
    protected void setErrorMessage(SystemMessage msg)
607
    {
608
    	if (_msgLine != null)
609
    	  if (msg != null)
610
    	    _msgLine.setErrorMessage(msg);
611
    	  else
612
    	    _msgLine.clearErrorMessage();
613
    }
614
    
615
616
    /**
617
     * Set the message shown as the text at the top of the form. Eg, "Select a file"
618
     */
619
    public void setMessage(String message)
620
    {
621
    	this._verbiage = message;
622
    	if (verbiageLabel != null)
623
    	  verbiageLabel.setText(message);
624
    }
625
    /**
626
     * Set the tooltip text for the remote systems tree from which an item is selected.
627
     */
628
    public void setSelectionTreeToolTipText(String tip)
629
    {
630
    	_systemViewForm.setToolTipText(tip);
631
    }
632
633
634
}
(-)UI/org/eclipse/rse/ui/view/ISystemTableViewColumnManager.java (+23 lines)
Added Link Here
1
/********************************************************************************
2
 * Copyright (c) 2008 IBM Corporation. All rights reserved.
3
 * This program and the accompanying materials are made available under the terms
4
 * of the Eclipse Public License v1.0 which accompanies this distribution, and is 
5
 * available at http://www.eclipse.org/legal/epl-v10.html
6
 * 
7
 * Initial Contributors:
8
 * The following IBM employees contributed to the Remote System Explorer
9
 * component that contains this file: David McKnight.
10
 * 
11
 * Contributors:
12
 * {Name} (company) - description of contribution.
13
 ********************************************************************************/
14
package org.eclipse.rse.ui.view;
15
16
import org.eclipse.ui.views.properties.IPropertyDescriptor;
17
18
public interface ISystemTableViewColumnManager {
19
20
	public IPropertyDescriptor[] getVisibleDescriptors(ISystemViewElementAdapter adapter);
21
	
22
	public void setCustomDescriptors(ISystemViewElementAdapter adapter, IPropertyDescriptor[] descriptors);
23
}
(-)UI/org/eclipse/rse/ui/view/SystemResourceSelectionInputProvider.java (+142 lines)
Added Link Here
1
/********************************************************************************
2
 * Copyright (c) 2004, 2007 IBM Corporation and others. All rights reserved.
3
 * This program and the accompanying materials are made available under the terms
4
 * of the Eclipse Public License v1.0 which accompanies this distribution, and is 
5
 * available at http://www.eclipse.org/legal/epl-v10.html
6
 * 
7
 * Initial Contributors:
8
 * The following IBM employees contributed to the Remote System Explorer
9
 * component that contains this file: David McKnight, Kushal Munir, 
10
 * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, 
11
 * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
12
 * 
13
 * Contributors:
14
 * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType
15
 * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
16
 * Martin Oberhuber (Wind River) - [202866] Fix exceptions in RSE browse dialog when SystemRegistry is not yet fully initialized
17
 ********************************************************************************/
18
19
package org.eclipse.rse.ui.view;
20
import org.eclipse.rse.core.IRSESystemType;
21
import org.eclipse.rse.core.RSECorePlugin;
22
import org.eclipse.rse.core.model.IHost;
23
import org.eclipse.rse.core.model.ISystemRegistry;
24
import org.eclipse.rse.core.subsystems.ISubSystem;
25
26
27
public abstract class SystemResourceSelectionInputProvider extends SystemAbstractAPIProvider
28
{		
29
	private IHost _connection = null;
30
	private boolean _onlyConnection = false;
31
	private boolean _allowNew = true;
32
	private IRSESystemType[] _systemTypes;
33
	private String _category = null;
34
	
35
	public SystemResourceSelectionInputProvider(IHost connection)
36
	{
37
		_connection = connection;
38
	}
39
	
40
	public SystemResourceSelectionInputProvider()
41
	{
42
		// choose random host
43
		ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
44
		IHost[] hosts = registry.getHosts();
45
		if (hosts != null && hosts.length>0) {
46
			_connection = hosts[0];
47
		}
48
	}
49
	
50
	public IHost getSystemConnection()
51
	{
52
		return _connection;
53
	}
54
	
55
	public boolean allowMultipleConnections()
56
	{
57
		return !_onlyConnection;
58
	}
59
	
60
	public void setAllowNewConnection(boolean flag)
61
	{
62
		_allowNew = flag;
63
	}
64
	
65
	public boolean allowNewConnection()
66
	{
67
		return _allowNew;
68
	}
69
	
70
	public void setSystemConnection(IHost connection, boolean onlyConnection)
71
	{
72
		_connection = connection;
73
		_onlyConnection = onlyConnection;
74
	}
75
	
76
	public IRSESystemType[] getSystemTypes()
77
	{
78
		return _systemTypes;
79
	}
80
	
81
	public void setSystemTypes(IRSESystemType[] types)
82
	{
83
		_systemTypes = types;
84
	}
85
	
86
	public Object[] getSystemViewRoots()
87
	{
88
		if (_connection == null)
89
		{
90
			ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
91
			IHost[] hosts = registry.getHosts();
92
			if (hosts!=null && hosts.length!=0) {
93
				_connection = registry.getHosts()[0];
94
			}
95
		}
96
		return getConnectionChildren(_connection);
97
	}
98
99
	public boolean hasSystemViewRoots()
100
	{
101
		return false;
102
	}
103
104
	public Object[] getConnectionChildren(IHost selectedConnection)
105
	{
106
		if (selectedConnection != null)
107
		{
108
			ISubSystem ss = getSubSystem(selectedConnection);
109
			if (ss!=null) {
110
				return ss.getChildren();
111
			}
112
		}
113
		return new Object[0];
114
	}
115
116
	public boolean hasConnectionChildren(IHost selectedConnection)
117
	{
118
		if (selectedConnection != null)
119
		{
120
			ISubSystem ss = getSubSystem(selectedConnection);
121
			if (ss!=null) {
122
				return ss.hasChildren();
123
			}
124
		}
125
		return false;
126
	}
127
	
128
	protected abstract ISubSystem getSubSystem(IHost selectedConnection);
129
	
130
	
131
	public void setCategory(String category)
132
	{
133
		_category = category;
134
	}
135
	
136
	public String getCategory()
137
	{
138
		return _category;
139
	}
140
	
141
	
142
}
(-)UI/org/eclipse/rse/ui/view/SystemAbstractAPIProvider.java (+210 lines)
Added Link Here
1
/********************************************************************************
2
 * Copyright (c) 2002, 2008 IBM Corporation and others. All rights reserved.
3
 * This program and the accompanying materials are made available under the terms
4
 * of the Eclipse Public License v1.0 which accompanies this distribution, and is 
5
 * available at http://www.eclipse.org/legal/epl-v10.html
6
 * 
7
 * Initial Contributors:
8
 * The following IBM employees contributed to the Remote System Explorer
9
 * component that contains this file: David McKnight, Kushal Munir, 
10
 * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, 
11
 * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
12
 * 
13
 * Contributors:
14
 * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
15
 * Tobias Schwarz   (Wind River) - [173267] "empty list" should not be displayed 
16
 * Martin Oberhuber (Wind River) - [190271] Move ISystemViewInputProvider to Core
17
 * Martin Oberhuber (Wind River) - [218524][api] Remove deprecated ISystemViewInputProvider#getShell()
18
 ********************************************************************************/
19
20
package org.eclipse.rse.ui.view;
21
import org.eclipse.core.runtime.Platform;
22
import org.eclipse.core.runtime.Preferences;
23
import org.eclipse.jface.viewers.Viewer;
24
import org.eclipse.rse.core.RSECorePlugin;
25
import org.eclipse.rse.core.model.ISystemMessageObject;
26
import org.eclipse.rse.core.model.ISystemRegistry;
27
import org.eclipse.rse.core.model.ISystemViewInputProvider;
28
import org.eclipse.rse.core.model.SystemMessageObject;
29
import org.eclipse.rse.ui.ISystemMessages;
30
import org.eclipse.rse.ui.ISystemPreferencesConstants;
31
import org.eclipse.rse.ui.RSEUIPlugin;
32
import org.eclipse.swt.widgets.Shell;
33
34
35
36
/**
37
 * This is a base class that a provider of root nodes to the remote systems tree viewer part can
38
 * use as a parent class.
39
 */
40
public abstract class SystemAbstractAPIProvider 
41
       implements ISystemViewInputProvider
42
{
43
	protected Viewer viewer;
44
	protected ISystemRegistry sr;
45
	
46
	protected Object[] emptyList = new Object[0];
47
	protected Object[] msgList   = new Object[1];
48
	/**
49
	 * @deprecated Use {@link #checkForEmptyList(Object[], Object, boolean)} instead.
50
	 */
51
	protected SystemMessageObject nullObject     = null;
52
	protected SystemMessageObject canceledObject = null;	
53
	protected SystemMessageObject errorObject    = null;	
54
	
55
	private Preferences fPrefStore = null;
56
	
57
	/**
58
	 * Constructor 
59
	 */
60
	public SystemAbstractAPIProvider()
61
	{
62
		super();
63
		sr = RSECorePlugin.getTheSystemRegistry();
64
	}
65
	
66
    /**
67
	 * This is the method required by the IAdaptable interface.
68
	 * Given an adapter class type, return an object castable to the type, or
69
	 *  null if this is not possible.
70
	 */
71
    public Object getAdapter(Class adapterType)
72
    {
73
   	    return Platform.getAdapterManager().getAdapter(this, adapterType);	
74
    }           
75
76
    /*
77
     * (non-Javadoc)
78
     * @see org.eclipse.rse.ui.view.ISystemViewInputProvider#setViewer(java.lang.Object)
79
     */
80
    public void setViewer(Object viewer)
81
    {
82
    	this.viewer = (Viewer)viewer;
83
    }
84
    
85
    /*
86
     * (non-Javadoc)
87
     * @see org.eclipse.rse.ui.view.ISystemViewInputProvider#getViewer()
88
     */
89
    public Object getViewer()
90
    {
91
    	return viewer;
92
    }
93
94
    protected final void initMsgObjects()
95
 	{
96
 		nullObject     = new SystemMessageObject(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_EXPAND_EMPTY),ISystemMessageObject.MSGTYPE_EMPTY, null);
97
 		canceledObject = new SystemMessageObject(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_LIST_CANCELED),ISystemMessageObject.MSGTYPE_CANCEL, null);
98
 		errorObject    = new SystemMessageObject(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_EXPAND_FAILED),ISystemMessageObject.MSGTYPE_ERROR, null);
99
 	}
100
101
    /**
102
     * <i>Callable by subclasses. Do not override</i><br>
103
     * In getChildren, return <samp>checkForEmptyList(children, parent, true/false)<.samp>
104
     * versus your array directly. This method checks for a null array which is
105
     * not allowed and replaces it with an empty array. 
106
     * If true is passed then it returns the "Empty list" message object if the array is null or empty
107
     * 
108
     * @param children The list of children.
109
     * @param parent The parent for the children.
110
     * @param returnNullMsg <code>true</code> if an "Empty List" message should be returned.
111
     * @return The list of children, a list with the "Empty List" message object or an empty list.
112
     */
113
    protected Object[] checkForEmptyList(Object[] children, Object parent, boolean returnNullMsg) {
114
    	if ((children == null) || (children.length == 0)) {
115
    		if (fPrefStore == null) {
116
    			fPrefStore = RSEUIPlugin.getDefault().getPluginPreferences();
117
    		}
118
    		if (!returnNullMsg
119
    				|| (fPrefStore != null && !fPrefStore
120
    						.getBoolean(ISystemPreferencesConstants.SHOW_EMPTY_LISTS))) {
121
    			return emptyList;
122
    		} else {
123
    			return new Object[] {
124
    				new SystemMessageObject(
125
    					RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_EXPAND_EMPTY),
126
    					ISystemMessageObject.MSGTYPE_EMPTY, 
127
    					parent)};
128
    		}
129
    	}
130
    	return children;
131
    }
132
    
133
    /**
134
     * In getChildren, return checkForNull(children, true/false) vs your array directly.
135
     * This method checks for a null array which not allow and replaces it with an empty array.
136
     * If true is passed then it returns the "Empty list" message object if the array is null or empty
137
     * 
138
     * @deprecated Use {@link #checkForEmptyList(Object[], Object, boolean)} instead.
139
     */
140
    protected Object[] checkForNull(Object[] children, boolean returnNullMsg)
141
    {
142
	   if ((children == null) || (children.length==0))
143
	   {
144
	   	 if (!returnNullMsg)
145
           return emptyList;
146
         else
147
         {
148
	 	   if (nullObject == null)
149
	 	     initMsgObjects();
150
	 	   msgList[0] = nullObject;
151
	 	   return msgList;
152
         }
153
	   }
154
       else
155
         return children;
156
    }
157
158
    /**
159
     * Return the "Operation cancelled by user" msg as an object array so can be used to answer getChildren()
160
     */
161
    protected Object[] getCancelledMessageObject()
162
    {    	
163
		 if (canceledObject == null)
164
		   initMsgObjects();
165
		 msgList[0] = canceledObject;
166
		 return msgList;
167
    }    
168
169
    /**
170
     * Return the "Operation failed" msg as an object array so can be used to answer getChildren()
171
     */
172
    protected Object[] getFailedMessageObject()
173
    {    	
174
		 if (errorObject == null)
175
		   initMsgObjects();
176
		 msgList[0] = errorObject;
177
		 return msgList;
178
    }    
179
180
	/**
181
	 * Return true if we are listing connections or not, so we know whether we are interested in 
182
	 *  connection-add events
183
	 */
184
	public boolean showingConnections()
185
	{
186
		return false;
187
	}
188
189
	// ------------------
190
	// HELPER METHODS...
191
	// ------------------	
192
    /**
193
     * Returns the implementation of ISystemViewElement for the given
194
     * object.  Returns null if the adapter is not defined or the
195
     * object is not adaptable.
196
     */
197
    protected ISystemViewElementAdapter getViewAdapter(Object o) 
198
    {
199
    	return SystemAdapterHelpers.getViewAdapter(o);
200
    }
201
    
202
    /**
203
     * Returns the implementation of ISystemRemoteElement for the given
204
     * object.  Returns null if this object does not adaptable to this.
205
     */
206
    protected ISystemRemoteElementAdapter getRemoteAdapter(Object o) 
207
    {
208
    	return SystemAdapterHelpers.getRemoteAdapter(o);
209
    }
210
}
(-)UI/org/eclipse/rse/ui/filters/SystemFilterPoolDialogInterface.java (+41 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2002, 2007 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Initial Contributors:
9
 * The following IBM employees contributed to the Remote System Explorer
10
 * component that contains this file: David McKnight, Kushal Munir, 
11
 * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, 
12
 * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
13
 * 
14
 * Contributors:
15
 * {Name} (company) - description of contribution.
16
 *******************************************************************************/
17
18
package org.eclipse.rse.ui.filters;
19
import org.eclipse.rse.ui.filters.actions.SystemFilterAbstractFilterPoolAction;
20
21
22
/**
23
 * Common interface for dialogs or wizards that work with filter pools.
24
 */
25
public interface SystemFilterPoolDialogInterface 
26
{
27
28
29
	/**
30
	 * Allow base action to pass instance of itself for callback to get info
31
	 */
32
    public void setFilterPoolDialogActionCaller(SystemFilterAbstractFilterPoolAction caller);
33
    /**
34
     * Return an object containing user-specified information pertinent to filter pool actions
35
     */
36
    public SystemFilterPoolDialogOutputs getFilterPoolDialogOutputs();    
37
    /**
38
     * Set the help context id for this wizard
39
     */
40
    public void setHelpContextId(String id);
41
}
(-)UI/org/eclipse/rse/ui/filters/SystemFilterPoolDialogOutputs.java (+37 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2002, 2007 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Initial Contributors:
9
 * The following IBM employees contributed to the Remote System Explorer
10
 * component that contains this file: David McKnight, Kushal Munir, 
11
 * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, 
12
 * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
13
 * 
14
 * Contributors:
15
 * {Name} (company) - description of contribution.
16
 *******************************************************************************/
17
18
package org.eclipse.rse.ui.filters;
19
//import org.eclipse.rse.core.*;
20
import org.eclipse.rse.core.filters.ISystemFilterPool;
21
import org.eclipse.rse.ui.dialogs.SystemSimpleContentElement;
22
23
24
25
/**
26
 * A class capturing the attributes commonly returned by dialogs that
27
 * work with filter pools.
28
 */
29
public class SystemFilterPoolDialogOutputs 
30
{
31
32
33
	public String filterPoolName;
34
	public String filterPoolManagerName;	
35
    public SystemSimpleContentElement filterPoolTreeRoot;	
36
    public ISystemFilterPool newPool;
37
}
(-)UI/org/eclipse/rse/ui/view/SystemViewForm.java (+540 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2008 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Initial Contributors:
9
 * The following IBM employees contributed to the Remote System Explorer
10
 * component that contains this file: David McKnight, Kushal Munir, 
11
 * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, 
12
 * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
13
 * 
14
 * Contributors:
15
 * Kevin Doyle (IBM) - [187553] - Removed code and related methods for toolbar/button bar.
16
 * Martin Oberhuber (Wind River) - [190271] Move ISystemViewInputProvider to Core
17
 * David McKnight    (IBM)   - [187711] select SystemView APIs exposed by the ISystemTree interface
18
 *******************************************************************************/
19
package org.eclipse.rse.ui.view;
20
import java.util.List;
21
import java.util.Vector;
22
23
import org.eclipse.jface.action.ToolBarManager;
24
import org.eclipse.jface.viewers.IDoubleClickListener;
25
import org.eclipse.jface.viewers.ISelection;
26
import org.eclipse.jface.viewers.ISelectionChangedListener;
27
import org.eclipse.jface.viewers.ViewerFilter;
28
import org.eclipse.jface.wizard.WizardPage;
29
import org.eclipse.rse.core.filters.ISystemFilter;
30
import org.eclipse.rse.core.filters.ISystemFilterReference;
31
import org.eclipse.rse.core.model.ISystemViewInputProvider;
32
import org.eclipse.rse.core.subsystems.ISubSystem;
33
import org.eclipse.rse.internal.ui.view.SystemEmptyListAPIProviderImpl;
34
import org.eclipse.rse.internal.ui.view.SystemView;
35
import org.eclipse.rse.ui.dialogs.SystemPromptDialog;
36
import org.eclipse.rse.ui.messages.ISystemMessageLine;
37
import org.eclipse.swt.SWT;
38
import org.eclipse.swt.events.MouseAdapter;
39
import org.eclipse.swt.events.MouseEvent;
40
import org.eclipse.swt.events.MouseListener;
41
import org.eclipse.swt.layout.GridData;
42
import org.eclipse.swt.layout.GridLayout;
43
import org.eclipse.swt.widgets.Button;
44
import org.eclipse.swt.widgets.Composite;
45
import org.eclipse.swt.widgets.Item;
46
import org.eclipse.swt.widgets.Shell;
47
import org.eclipse.swt.widgets.ToolBar;
48
import org.eclipse.swt.widgets.Tree;
49
import org.eclipse.swt.widgets.TreeItem;
50
51
52
/**
53
 * This re-usable widget is for a single widget that displays a 
54
 *  toolbar underneath which is a systems view tree.
55
 */
56
public class SystemViewForm extends Composite implements  ISystemTree
57
{
58
	private ToolBar        toolbar = null;
59
	private ToolBarManager toolbarMgr = null;
60
	private Button         refreshButton, getListButton;
61
	private SystemView     tree = null;
62
	private ISystemMessageLine msgLine = null;
63
	private boolean        showActions = true;
64
	private boolean        deferLoading = false;	
65
	private boolean        requestInProgress = false;
66
    private ISystemViewInputProvider inputProvider = null;
67
    private ISystemViewInputProvider emptyProvider = new SystemEmptyListAPIProviderImpl();
68
    private Vector         requestListeners = null;
69
	public static final int DEFAULT_WIDTH = 300;
70
	public static final int DEFAULT_HEIGHT = 300;
71
	
72
	// the following allows us to identify dialog/wizard hosting this widget so we can 
73
	// disable it's close capability while a remote request is in place.
74
	protected Object  caller;
75
	protected boolean callerInstanceOfWizardPage, callerInstanceOfSystemPromptDialog;
76
	
77
	// viewer filters
78
	protected ViewerFilter[] initViewerFilters = null;
79
	
80
	/**
81
	 * Constructor
82
	 * @param shell The owning window
83
	 * @param parent The owning composite
84
	 * @param style The swt style to apply to the overall composite. Typically SWT.NULL
85
	 * @param inputProvider Who is supplying the roots for the system viewer?
86
     * @param singleSelectionMode Are users allowed to select multiple things at once?
87
	 * @param msgLine where to show messages and tooltip text
88
	 */
89
	public SystemViewForm(Shell shell, Composite parent, int style, ISystemViewInputProvider inputProvider, 
90
	                      boolean singleSelectionMode, ISystemMessageLine msgLine)
91
	{
92
		this(shell, parent, style, inputProvider, singleSelectionMode, msgLine, 1, 1);	
93
	}
94
	/**
95
	 * Constructor when you want to span more than one column or row
96
	 * @param shell The owning window
97
	 * @param parent The owning composite
98
	 * @param style The swt style to apply to the overall composite. Typically SWT.NULL
99
	 * @param inputProvider Who is supplying the roots for the system viewer?
100
     * @param singleSelectionMode Are users allowed to select multiple things at once?
101
	 * @param msgLine where to show messages and tooltip text
102
	 * @param horizontalSpan how many columns in parent composite to span
103
	 * @param verticalSpan how many rows in parent composite to span
104
	 */
105
	public SystemViewForm(Shell shell, Composite parent, int style, ISystemViewInputProvider inputProvider, 
106
	                      boolean singleSelectionMode, ISystemMessageLine msgLine,  
107
	                      int horizontalSpan, int verticalSpan)
108
	{
109
		this(shell, parent, style, inputProvider, singleSelectionMode, msgLine, horizontalSpan, verticalSpan, null);
110
	}
111
	
112
	/**
113
	 * Constructor when you want to span more than one column or row
114
	 * @param shell The owning window
115
	 * @param parent The owning composite
116
	 * @param style The swt style to apply to the overall composite. Typically SWT.NULL
117
	 * @param inputProvider Who is supplying the roots for the system viewer?
118
     * @param singleSelectionMode Are users allowed to select multiple things at once?
119
	 * @param msgLine where to show messages and tooltip text
120
	 * @param horizontalSpan how many columns in parent composite to span
121
	 * @param verticalSpan how many rows in parent composite to span
122
	 * @param initViewerFilters the initial viewer filters to apply.
123
	 */
124
	public SystemViewForm(Shell shell, Composite parent, int style, ISystemViewInputProvider inputProvider, 
125
	                      boolean singleSelectionMode, ISystemMessageLine msgLine,  
126
	                      int horizontalSpan, int verticalSpan, ViewerFilter[] initViewerFilters)
127
	{
128
		super(parent, style);	
129
		this.inputProvider = inputProvider;
130
		this.msgLine = msgLine;
131
		callerInstanceOfWizardPage = (caller instanceof WizardPage);
132
		callerInstanceOfSystemPromptDialog = (caller instanceof SystemPromptDialog);				
133
		prepareComposite(1, horizontalSpan, verticalSpan);
134
    
135
	    // set viewer filters
136
	    this.initViewerFilters = initViewerFilters;
137
	    
138
	    createSystemView(shell, inputProvider, singleSelectionMode);
139
	    
140
	}
141
	
142
	/**
143
	 * Return the toolbar widget manager
144
	 */
145
	public ToolBarManager getToolBarManager()
146
	{
147
		return toolbarMgr;
148
	}
149
	/**
150
	 * Return the system view tree viewer
151
	 */
152
	public ISystemTree getSystemTree()
153
	{
154
		return tree;
155
	}
156
	/**
157
	 * Return the system view tree viewer tree widget
158
	 */
159
	public Tree getTreeControl()
160
	{
161
		return tree.getTree();
162
	}
163
164
    /**
165
     * Set the tree's tooltip text
166
     */
167
    public void setToolTipText(String tip)
168
    {
169
    	tree.getTree().setToolTipText(tip);
170
    }
171
        
172
    /**
173
     * Refresh contents
174
     */
175
    public void refresh()
176
    {
177
    	tree.refreshAll();
178
    }
179
180
    /**
181
     * Reset contents
182
     */
183
    public void reset(ISystemViewInputProvider inputProvider)
184
    {
185
    	this.inputProvider = inputProvider;
186
    	if (deferLoading)
187
    	{
188
    	  tree.setSelection(null);
189
    	  tree.setInputProvider(emptyProvider);
190
    	}
191
    	else
192
    	{
193
    	  tree.setSelection(null);
194
    	  tree.setInputProvider(inputProvider);
195
    	}
196
    }
197
198
	/*
199
	 * Turn off right-click actions
200
	 *
201
	 NOW SET VIA INPUT PROVIDER METHODS
202
	public void setShowActions(boolean show)
203
	{
204
		this.showActions = show;
205
		if (tree != null)
206
		  tree.setShowActions(show);
207
	}*/
208
	    
209
	/**
210
	 * Disable/Enable all the child controls.
211
	 */
212
	public void setEnabled(boolean enabled)
213
	{
214
		if (toolbar != null)
215
		  toolbar.setEnabled(enabled);
216
		tree.setEnabled(enabled);
217
		//if ((tree != null) && (tree.getTree() != null))
218
		//  tree.getTree().setEnabled(enabled);		
219
		//super.setEnabled(enabled);
220
	}
221
	/**
222
	 * Register a listener interested in an item is selected in the system view
223
     * @see #removeSelectionChangedListener(ISelectionChangedListener)
224
     */
225
    public void addSelectionChangedListener(ISelectionChangedListener listener) 
226
    {
227
	    tree.addSelectionChangedListener(listener);
228
    }
229
    /** 
230
     * Remove a previously set system view selection listener.
231
     * @see #addSelectionChangedListener(ISelectionChangedListener)
232
     */
233
    public void removeSelectionChangedListener(ISelectionChangedListener listener) 
234
    {
235
	    tree.removeSelectionChangedListener(listener);
236
    }
237
    /**
238
     * Add a listener that is informed when a remote list request starts and stops.
239
     * This allows for the listener to do things like disable the Close button
240
     */
241
    public void addListRequestListener(ISystemLongRunningRequestListener listener)
242
    {
243
    	if (requestListeners == null)
244
    	  requestListeners = new Vector();
245
    	requestListeners.addElement(listener);
246
    }
247
    /**
248
     * Add a listener that is informed when a remote list request starts and stops.
249
     * This allows for the listener to do things like disable the Close button
250
     */
251
    public void removeListRequestListener(ISystemLongRunningRequestListener listener)
252
    {
253
    	if (requestListeners != null)
254
    	  requestListeners.removeElement(listener);
255
    }
256
    
257
    /**
258
     * Return the selection of the tree viewer
259
     */
260
    public ISelection getSelection()
261
    {
262
    	return tree.getSelection();
263
    }
264
	
265
266
	// --------------------------------------------	
267
	// ISystemTree methods to facilitate our GUI...
268
	//  ... all these are delegated to the SystemView tree
269
	// --------------------------------------------
270
    /**
271
     * Returns true if any of the selected items are currently expanded
272
     */
273
    public boolean areAnySelectedItemsExpanded()
274
    {
275
    	return tree.areAnySelectedItemsExpanded();
276
    }    
277
    /**
278
     * Returns true if any of the selected items are expandable but not yet expanded
279
     */
280
    public boolean areAnySelectedItemsExpandable()
281
    {
282
    	return tree.areAnySelectedItemsExpandable();
283
    }
284
	/**
285
	 * This is called to ensure all elements in a multiple-selection have the same parent in the
286
	 *  tree viewer. If they don't we automatically disable all actions. 
287
	 * <p>
288
	 * Designed to be as fast as possible by going directly to the SWT widgets
289
	 */
290
	public boolean sameParent()
291
	{
292
		return tree.sameParent();
293
	}
294
	/**
295
	 * This is called to accurately get the parent object for the current selection
296
	 *  for this viewer. 
297
	 * <p>
298
	 * The getParent() method in the adapter is very unreliable... adapters can't be sure
299
	 * of the context which can change via filtering and view options.
300
	 */
301
	public Object getSelectedParent()
302
	{
303
		return tree.getSelectedParent();
304
	}
305
	/**
306
	 * This returns the element immediately before the first selected element in this tree level.
307
	 * Often needed for enablement decisions for move up actions.
308
	 */
309
	public Object getPreviousElement()
310
	{
311
		 return tree.getPreviousElement();
312
	}
313
	/**
314
	 * This returns the element immediately after the last selected element in this tree level
315
	 * Often needed for enablement decisions for move down actions.
316
	 */
317
	public Object getNextElement()
318
	{
319
		 return tree.getNextElement();
320
	}
321
322
	/**
323
	 * This is called to walk the tree back up to the roots and return the visible root
324
	 *  node for the first selected object.
325
	 */
326
	public Object getRootParent()
327
	{
328
		return tree.getRootParent();
329
	}
330
	/**
331
	 * This returns an array containing each element in the tree, up to but not including the root.
332
	 * The array is in reverse order, starting at the leaf and going up.
333
	 */
334
	public Object[] getElementNodes(Object element)
335
	{
336
		return tree.getElementNodes(element);
337
	}
338
	/**
339
	 * Helper method to determine if a given object is currently selected.
340
	 * Does consider if a child node of the given object is currently selected.
341
	 */
342
	public boolean isSelectedOrChildSelected(Object parentElement)
343
	{
344
		return tree.isSelectedOrChildSelected(parentElement);
345
	}
346
347
	/**
348
	 * Return the number of immediate children in the tree, for the given tree node
349
	 */
350
    public int getChildCount(Object element)
351
	{
352
        return tree.getChildCount(element);
353
	}
354
355
    /**
356
     * Called when a property is updated and we need to inform the Property Sheet viewer.
357
     * There is no formal mechanism for this so we simulate a selection changed event as
358
     *  this is the only event the property sheet listens for.
359
     */
360
    public void updatePropertySheet()
361
    {
362
        tree.updatePropertySheet();
363
    }
364
	
365
    /**
366
     * Called to select an object within the tree, and optionally expand it
367
     */   
368
    public void select(Object element, boolean expand)
369
    {
370
        tree.select(element, expand);
371
    }
372
	
373
    /**
374
     * Returns the tree item of the first selected object. Used for setViewerItem in a resource
375
     *  change event.
376
     */
377
    public Item getViewerItem()
378
    {
379
    	return tree.getViewerItem();
380
    }	
381
    
382
    /**
383
     * Returns true if it is ok to close the dialog or wizard page. Returns false if there
384
     *  is a remote request currently in progress.
385
     */
386
    public boolean okToClose()
387
    {
388
    	return !requestInProgress; //d43433
389
    }
390
391
	// -----------------------
392
	// INTERNAL-USE METHODS...
393
	// -----------------------
394
	/**
395
	 * Prepares this composite control and sets the default layout data.
396
	 * @param Number of columns the new group will contain.     
397
	 */
398
	protected Composite prepareComposite(int numColumns,
399
	                                     int horizontalSpan, int verticalSpan)	
400
	{
401
		Composite composite = this;
402
		//GridLayout
403
		GridLayout layout = new GridLayout();
404
		layout.numColumns = numColumns;
405
		layout.marginWidth = 0;
406
		layout.marginHeight = 0;
407
		layout.horizontalSpacing = 0;		
408
		layout.verticalSpacing = 0;		
409
		composite.setLayout(layout);
410
		//GridData
411
		GridData data = new GridData();
412
		data.verticalAlignment = GridData.FILL;
413
		data.horizontalAlignment = GridData.FILL;
414
	    data.grabExcessHorizontalSpace = true;        
415
	    data.grabExcessVerticalSpace = true;	    
416
	    data.widthHint = DEFAULT_WIDTH;	    
417
	    data.heightHint = DEFAULT_HEIGHT;	
418
	    data.horizontalSpan = horizontalSpan;
419
	    data.verticalSpan = verticalSpan;    
420
		composite.setLayoutData(data);
421
		return composite;
422
	}
423
	
424
	protected void createSystemView(Shell shell, ISystemViewInputProvider inputProvider, boolean singleSelectionMode)
425
	{
426
		// TREE
427
        int style = (singleSelectionMode ? SWT.SINGLE : SWT.MULTI) | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER;
428
		tree = new SystemView(shell, this, style, deferLoading ? emptyProvider : inputProvider, msgLine, initViewerFilters);        
429
	    GridData treeData = new GridData();
430
	    treeData.horizontalAlignment = GridData.FILL;
431
	    treeData.verticalAlignment = GridData.FILL;	    
432
	    treeData.grabExcessHorizontalSpace = true;
433
	    treeData.grabExcessVerticalSpace = true;	    
434
	    treeData.widthHint = 300;        
435
	    treeData.heightHint= 200;
436
	    tree.getTree().setLayoutData(treeData);  	  	    		
437
	    tree.setShowActions(showActions);
438
	}
439
	
440
	protected void addOurMouseListener()
441
	{
442
	   MouseListener mouseListener = new MouseAdapter() 
443
	   {
444
		   public void mouseDown(MouseEvent e) 
445
		   {
446
			   //requestActivation();
447
		   }
448
	   };	
449
	   toolbar.addMouseListener(mouseListener);
450
	}
451
452
    /**
453
     * Fire long running request listener event
454
     */
455
    protected void fireRequestStartEvent()
456
    {
457
    	if (requestListeners != null)
458
    	{
459
    		SystemLongRunningRequestEvent event = new SystemLongRunningRequestEvent(); 
460
    		for (int idx=0; idx<requestListeners.size(); idx++)
461
    		   ((ISystemLongRunningRequestListener)requestListeners.elementAt(idx)).startingLongRunningRequest(event);
462
    	}
463
    }
464
465
    /**
466
     * Fire long running request listener event
467
     */
468
    protected void fireRequestStopEvent()
469
    {
470
    	if (requestListeners != null)
471
    	{
472
    		SystemLongRunningRequestEvent event = new SystemLongRunningRequestEvent(); 
473
    		for (int idx=0; idx<requestListeners.size(); idx++)
474
    		   ((ISystemLongRunningRequestListener)requestListeners.elementAt(idx)).endingLongRunningRequest(event);
475
    	}
476
    }
477
478
    
479
480
    /**
481
     * wrapper method to satisfy the ISystemTree interface
482
     */
483
	public void createTreeItems(TreeItem widget, Object[] children)
484
	{
485
		tree.createTreeItems(widget, children);
486
	}
487
	
488
    /**
489
     * wrapper method to satisfy the ISystemTree interface
490
     */
491
	public List findAllRemoteItemReferences(Object element,
492
			Object elementObject, List matches) {
493
		return tree.findAllRemoteItemReferences(element, elementObject, matches);
494
	}
495
	
496
    /**
497
     * wrapper method to satisfy the ISystemTree interface
498
     */
499
	public Item findFirstRemoteItemReference(Object remoteObject,
500
			Item parentItem) {
501
		return tree.findFirstRemoteItemReference(remoteObject, parentItem);
502
	}
503
	
504
    /**
505
     * wrapper method to satisfy the ISystemTree interface
506
     */
507
	public Tree getTree() {
508
		return tree.getTree();
509
	}
510
	
511
    /**
512
     * wrapper method to satisfy the ISystemTree interface
513
     */
514
	public ISystemFilterReference revealAndExpand(ISubSystem parentSubSystem,
515
			ISystemFilter filter) {
516
		return tree.revealAndExpand(parentSubSystem, filter);
517
	}
518
	public void addDoubleClickListener(IDoubleClickListener listener) {
519
		tree.addDoubleClickListener(listener);
520
	}
521
	public void addFilter(ViewerFilter filter) {
522
		tree.addFilter(filter);
523
		
524
	}
525
	public void expandTo(Object parentObject, Object remoteObject) {
526
		tree.expandTo(parentObject, remoteObject);
527
		
528
	}
529
	public void expandTo(String filterString) {
530
		tree.expandTo(filterString);
531
		
532
	}
533
	public boolean isExpandable(Object elementOrTreePath) {
534
		return tree.isExpandable(elementOrTreePath);
535
	}
536
	public void setAutoExpandLevel(int level) {
537
		tree.setAutoExpandLevel(level);
538
	}
539
	
540
}
(-)UI/org/eclipse/rse/ui/view/SystemViewAdapterFactory.java (+178 lines)
Added Link Here
1
/********************************************************************************
2
 * Copyright (c) 2006, 2007 IBM Corporation and others. All rights reserved.
3
 * This program and the accompanying materials are made available under the terms
4
 * of the Eclipse Public License v1.0 which accompanies this distribution, and is 
5
 * available at http://www.eclipse.org/legal/epl-v10.html
6
 * 
7
 * Initial Contributors:
8
 * The following IBM employees contributed to the Remote System Explorer
9
 * component that contains this file: David McKnight, Kushal Munir, 
10
 * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, 
11
 * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
12
 * 
13
 * Contributors:
14
 * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
15
 * Martin Oberhuber (Wind River) - [190271] Move ISystemViewInputProvider to Core
16
 * Xuan Chen        (IBM)        - [222263] Need to provide a PropertySet Adapter for System Team View
17
 ********************************************************************************/
18
19
package org.eclipse.rse.ui.view;
20
21
import org.eclipse.core.runtime.IAdapterFactory;
22
import org.eclipse.core.runtime.IAdapterManager;
23
import org.eclipse.rse.core.filters.ISystemFilter;
24
import org.eclipse.rse.core.filters.ISystemFilterPool;
25
import org.eclipse.rse.core.filters.ISystemFilterPoolReference;
26
import org.eclipse.rse.core.filters.ISystemFilterReference;
27
import org.eclipse.rse.core.filters.ISystemFilterString;
28
import org.eclipse.rse.core.model.IHost;
29
import org.eclipse.rse.core.model.ISystemMessageObject;
30
import org.eclipse.rse.core.model.ISystemProfile;
31
import org.eclipse.rse.core.model.ISystemViewInputProvider;
32
import org.eclipse.rse.core.subsystems.ISubSystem;
33
import org.eclipse.rse.core.subsystems.ISystemDragDropAdapter;
34
import org.eclipse.rse.internal.ui.view.SystemViewConnectionAdapter;
35
import org.eclipse.rse.internal.ui.view.SystemViewFilterAdapter;
36
import org.eclipse.rse.internal.ui.view.SystemViewFilterPoolAdapter;
37
import org.eclipse.rse.internal.ui.view.SystemViewFilterPoolReferenceAdapter;
38
import org.eclipse.rse.internal.ui.view.SystemViewFilterReferenceAdapter;
39
import org.eclipse.rse.internal.ui.view.SystemViewFilterStringAdapter;
40
import org.eclipse.rse.internal.ui.view.SystemViewMessageAdapter;
41
import org.eclipse.rse.internal.ui.view.SystemViewNewConnectionPromptAdapter;
42
import org.eclipse.rse.internal.ui.view.SystemViewPromptableAdapter;
43
import org.eclipse.rse.internal.ui.view.SystemViewRootInputAdapter;
44
import org.eclipse.rse.internal.ui.view.SystemViewSubSystemAdapter;
45
import org.eclipse.rse.internal.ui.view.team.SystemTeamViewCategoryAdapter;
46
import org.eclipse.rse.internal.ui.view.team.SystemTeamViewCategoryNode;
47
import org.eclipse.rse.internal.ui.view.team.SystemTeamViewProfileAdapter;
48
import org.eclipse.rse.internal.ui.view.team.SystemTeamViewPropertySetAdapter;
49
import org.eclipse.rse.internal.ui.view.team.SystemTeamViewPropertySetNode;
50
import org.eclipse.rse.internal.ui.view.team.SystemTeamViewSubSystemConfigurationAdapter;
51
import org.eclipse.rse.internal.ui.view.team.SystemTeamViewSubSystemConfigurationNode;
52
import org.eclipse.rse.ui.SystemBasePlugin;
53
import org.eclipse.rse.ui.internal.model.SystemNewConnectionPromptObject;
54
import org.eclipse.rse.ui.model.ISystemPromptableObject;
55
import org.eclipse.ui.IActionFilter;
56
import org.eclipse.ui.model.IWorkbenchAdapter;
57
import org.eclipse.ui.progress.IDeferredWorkbenchAdapter;
58
import org.eclipse.ui.views.properties.IPropertySource;
59
60
/**
61
 * This factory maps requests for an adapter object from a given
62
 *  element object.
63
 */
64
public class SystemViewAdapterFactory implements IAdapterFactory {
65
66
	private SystemViewRootInputAdapter rootAdapter = new SystemViewRootInputAdapter();
67
	private SystemViewConnectionAdapter connectionAdapter = new SystemViewConnectionAdapter();
68
	private SystemViewSubSystemAdapter subsystemAdapter = new SystemViewSubSystemAdapter();
69
	private SystemViewFilterPoolAdapter filterPoolAdapter = new SystemViewFilterPoolAdapter();
70
	private SystemViewFilterAdapter filterAdapter = new SystemViewFilterAdapter();
71
	private SystemViewFilterPoolReferenceAdapter filterPoolReferenceAdapter = new SystemViewFilterPoolReferenceAdapter();
72
	private SystemViewFilterReferenceAdapter filterReferenceAdapter = new SystemViewFilterReferenceAdapter();
73
	private SystemViewMessageAdapter msgAdapter = new SystemViewMessageAdapter();
74
	private SystemViewPromptableAdapter promptAdapter = new SystemViewPromptableAdapter();
75
	private SystemViewNewConnectionPromptAdapter newConnPromptAdapter = new SystemViewNewConnectionPromptAdapter();
76
	private SystemTeamViewProfileAdapter profileAdapter = new SystemTeamViewProfileAdapter();
77
	private SystemTeamViewCategoryAdapter categoryAdapter = new SystemTeamViewCategoryAdapter();
78
	private SystemTeamViewSubSystemConfigurationAdapter subsysFactoryAdapter = new SystemTeamViewSubSystemConfigurationAdapter();
79
	private SystemTeamViewPropertySetAdapter propertySetAdapter = new SystemTeamViewPropertySetAdapter();
80
81
	private SystemViewFilterStringAdapter filterStringAdapter = new SystemViewFilterStringAdapter();
82
83
	/**
84
	 * @see IAdapterFactory#getAdapterList()
85
	 */
86
	public Class[] getAdapterList() {
87
		return new Class[] { ISystemViewElementAdapter.class, ISystemDragDropAdapter.class, IPropertySource.class, IWorkbenchAdapter.class,
88
													IActionFilter.class, IDeferredWorkbenchAdapter.class };
89
	}
90
91
	/**
92
	 * Called by our plugin's startup method to register our adaptable object types 
93
	 * with the platform. We prefer to do it here to isolate/encapsulate all factory
94
	 * logic in this one place.
95
	 * @param manager the adapter manager controlling this factory
96
	 */
97
	public void registerWithManager(IAdapterManager manager) {
98
		manager.registerAdapters(this, ISystemViewInputProvider.class);
99
		manager.registerAdapters(this, ISystemProfile.class);
100
		manager.registerAdapters(this, IHost.class);
101
		manager.registerAdapters(this, ISubSystem.class);
102
		manager.registerAdapters(this, ISystemFilter.class);
103
		manager.registerAdapters(this, ISystemFilterPool.class);
104
		manager.registerAdapters(this, ISystemFilterPoolReference.class);
105
		manager.registerAdapters(this, ISystemFilterReference.class);
106
		manager.registerAdapters(this, ISystemFilterString.class);
107
		manager.registerAdapters(this, ISystemMessageObject.class);
108
		manager.registerAdapters(this, ISystemPromptableObject.class);
109
		manager.registerAdapters(this, SystemTeamViewCategoryNode.class);
110
		manager.registerAdapters(this, SystemTeamViewSubSystemConfigurationNode.class);
111
		manager.registerAdapters(this, SystemTeamViewPropertySetNode.class);
112
113
		// FIXME - UDAs no longer in core
114
		//manager.registerAdapters(this, SystemTeamViewCompileTypeNode.class);
115
		//manager.registerAdapters(this, SystemTeamViewCompileCommandNode.class);	
116
		//manager.registerAdapters(this, SystemUDActionElement.class);
117
	}
118
119
	/* (non-Javadoc)
120
	 * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
121
	 */
122
	public Object getAdapter(Object adaptableObject, Class adapterType) {
123
		Object adapter = null;
124
		if (adaptableObject instanceof ISystemViewElementAdapter)
125
			adapter = adaptableObject;
126
		else if (adaptableObject instanceof ISystemDragDropAdapter)
127
			adapter = adaptableObject;
128
		else if (adaptableObject instanceof ISystemViewInputProvider)
129
			adapter = rootAdapter;
130
		else if (adaptableObject instanceof ISystemProfile)
131
			adapter = profileAdapter;
132
		else if (adaptableObject instanceof IHost)
133
			adapter = connectionAdapter;
134
		else if (adaptableObject instanceof ISubSystem)
135
			adapter = subsystemAdapter;
136
		else if (adaptableObject instanceof ISystemFilterPoolReference)
137
			adapter = filterPoolReferenceAdapter;
138
		else if (adaptableObject instanceof ISystemFilterPool)
139
			adapter = filterPoolAdapter;
140
		else if (adaptableObject instanceof ISystemFilterReference)
141
			adapter = filterReferenceAdapter;
142
		else if (adaptableObject instanceof ISystemFilterString)
143
			adapter = filterStringAdapter;
144
		else if (adaptableObject instanceof ISystemFilter)
145
			adapter = filterAdapter;
146
		else if (adaptableObject instanceof ISystemMessageObject)
147
			adapter = msgAdapter;
148
		else if (adaptableObject instanceof ISystemPromptableObject) {
149
150
			if (adaptableObject instanceof SystemNewConnectionPromptObject) {
151
				adapter = newConnPromptAdapter;
152
			} else {
153
				adapter = promptAdapter;
154
			}
155
		} else if (adaptableObject instanceof SystemTeamViewCategoryNode)
156
			adapter = categoryAdapter;
157
		else if (adaptableObject instanceof SystemTeamViewSubSystemConfigurationNode) adapter = subsysFactoryAdapter;
158
		else if (adaptableObject instanceof SystemTeamViewPropertySetNode) adapter = propertySetAdapter;
159
160
		/** FIXME - UDAs no longer in core
161
		 else if (adaptableObject instanceof SystemTeamViewCompileTypeNode)
162
		 adapter = getCompileTypeAdapter();
163
		 else if (adaptableObject instanceof SystemTeamViewCompileCommandNode)
164
		 adapter = getCompileCommandAdapter();	      	      
165
		 else if (adaptableObject instanceof SystemUDActionElement)
166
		 adapter = getUserActionAdapter();
167
		 */
168
169
		if ((adapter != null) && (adapterType == IPropertySource.class)) {
170
			((ISystemViewElementAdapter) adapter).setPropertySourceInput(adaptableObject);
171
		} else if (adapter == null) {
172
			SystemBasePlugin.logWarning("No adapter found for object of type: " + adaptableObject.getClass().getName()); //$NON-NLS-1$
173
		}
174
		return adapter;
175
	}
176
177
178
}
(-)UI/org/eclipse/rse/ui/filters/dialogs/SystemFilterPoolWizardInterface.java (+28 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2002, 2007 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Initial Contributors:
9
 * The following IBM employees contributed to the Remote System Explorer
10
 * component that contains this file: David McKnight, Kushal Munir, 
11
 * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, 
12
 * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
13
 * 
14
 * Contributors:
15
 * {Name} (company) - description of contribution.
16
 *******************************************************************************/
17
18
package org.eclipse.rse.ui.filters.dialogs;
19
import org.eclipse.rse.ui.filters.SystemFilterPoolDialogInterface;
20
import org.eclipse.rse.ui.wizards.ISystemWizard;
21
22
/**
23
 * An interface for filter pool wizards to implement
24
 */
25
public interface SystemFilterPoolWizardInterface 
26
       extends ISystemWizard, SystemFilterPoolDialogInterface
27
{
28
}
(-)UI/org/eclipse/rse/ui/filters/dialogs/SystemNewFilterWizardNamePage.java (+483 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2002, 2008 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Initial Contributors:
9
 * The following IBM employees contributed to the Remote System Explorer
10
 * component that contains this file: David McKnight, Kushal Munir, 
11
 * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, 
12
 * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
13
 * 
14
 * Contributors:
15
 * David Dykstal (IBM) - [160403] filters should be connection private by default
16
 *******************************************************************************/
17
18
package org.eclipse.rse.ui.filters.dialogs;
19
import org.eclipse.rse.core.filters.ISystemFilterPool;
20
import org.eclipse.rse.core.filters.ISystemFilterPoolSelectionValidator;
21
import org.eclipse.rse.core.filters.ISystemFilterPoolWrapper;
22
import org.eclipse.rse.core.filters.ISystemFilterPoolWrapperInformation;
23
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
24
import org.eclipse.rse.ui.SystemWidgetHelpers;
25
import org.eclipse.rse.ui.validators.ISystemValidator;
26
import org.eclipse.rse.ui.wizards.AbstractSystemWizardPage;
27
import org.eclipse.swt.events.ModifyEvent;
28
import org.eclipse.swt.events.ModifyListener;
29
import org.eclipse.swt.events.SelectionEvent;
30
import org.eclipse.swt.events.SelectionListener;
31
import org.eclipse.swt.widgets.Button;
32
import org.eclipse.swt.widgets.Combo;
33
import org.eclipse.swt.widgets.Composite;
34
import org.eclipse.swt.widgets.Control;
35
import org.eclipse.swt.widgets.Label;
36
import org.eclipse.swt.widgets.Text;
37
38
39
40
41
/**
42
 * Second page of the New Filter wizard that prompts for the name of the filter.
43
 */
44
public class SystemNewFilterWizardNamePage 
45
	   extends AbstractSystemWizardPage
46
	   implements SelectionListener
47
{
48
	
49
	protected Text  nameText;
50
	protected Button uniqueCB;
51
	protected Label poolVerbiage;
52
	protected Label poolComboLabel;	
53
	protected Combo poolWrapperCombo;
54
	protected Combo poolCombo;
55
	protected SystemMessage errorMessage;
56
	protected String inputFilterName;
57
	protected boolean contentsCreated;
58
	protected boolean userEditedName;
59
	protected boolean ignoreChanges;
60
	protected ISystemValidator nameValidator;
61
	protected ISystemValidator[] nameValidators;
62
	protected ISystemFilterPoolSelectionValidator filterPoolSelectionValidator;
63
	protected ISystemFilterPool[] poolsToSelectFrom = null;
64
    protected ISystemFilterPoolWrapper[] poolWrappers = null;
65
    protected ISystemFilterPoolWrapperInformation poolWrapperInformation;
66
	protected ISystemFilterPool parentPool = null;
67
  	private ISystemNewFilterWizardConfigurator configurator;  
68
  	
69
	/**
70
	 * Constructor.
71
	 */
72
	public SystemNewFilterWizardNamePage(SystemNewFilterWizard wizard, ISystemFilterPool parentPool, ISystemNewFilterWizardConfigurator data)
73
	{
74
		super(wizard, "SetNewFilterName", data.getPage2Title(), data.getPage2Description());	           //$NON-NLS-1$
75
	    this.parentPool = parentPool;
76
	    this.configurator = data;
77
		setHelp(data.getPage2HelpID());
78
	}
79
80
	// ---------------------------------
81
	// INPUT METHODS...
82
	// ---------------------------------
83
	/**
84
	 * Set the filter name to default the entry field to
85
	 */
86
	public void setFilterName(String filterName)
87
	{
88
		this.inputFilterName = filterName;
89
		if (nameText != null)
90
		  nameText.setText(inputFilterName);
91
	}
92
	/**
93
	 * Set the validator to use to verify the filter name is correct
94
	 */
95
	public void setFilterNameValidator(ISystemValidator nameValidator)
96
	{
97
		this.nameValidator = nameValidator;
98
	}
99
    /**
100
     * Call if you want to allow the user to select the filter pool to create this filter in.
101
     */
102
    public void setAllowFilterPoolSelection(ISystemFilterPool[] poolsToSelectFrom,
103
                                             ISystemValidator[] nameValidators)
104
    {
105
    	this.poolsToSelectFrom = poolsToSelectFrom;
106
    	this.nameValidators = nameValidators;
107
    	if ((poolsToSelectFrom != null) && (poolsToSelectFrom.length>0))    	
108
    	{
109
    	  if (parentPool == null) 
110
    	     parentPool = poolsToSelectFrom[0];
111
    	}
112
    }    
113
    /**
114
     * This is an alternative to {@link #setAllowFilterPoolSelection(ISystemFilterPool[], ISystemValidator[])}
115
     * <p>
116
     * If you want to prompt the user for the parent filter pool to create this filter in, 
117
     *  but want to not use the term "pool" say, you can use an array of euphamisms. That is,
118
     *  you can pass an array of objects that map to filter pools, but have a different 
119
     *  display name that is shown in the dropdown.
120
     * <p>
121
     * Of course, if you want to do this, then you will likely want to offer a different
122
     *  label and tooltip for the prompt, and different verbiage above the prompt. The 
123
     *  object this method accepts as a parameter encapsulates all that information, and
124
     *  there is a default class you can use for this.
125
     */
126
    public void setAllowFilterPoolSelection(ISystemFilterPoolWrapperInformation poolWrappersToSelectFrom,
127
                                             ISystemValidator[] nameValidators)    
128
    {
129
    	this.poolWrapperInformation = poolWrappersToSelectFrom;
130
    	this.nameValidators = nameValidators;
131
    	if (parentPool == null) 
132
    	  parentPool = poolWrappersToSelectFrom.getPreSelectWrapper().getSystemFilterPool();
133
    }    
134
	/**
135
	 * Set the validator to call when the user selects a filter pool. Optional.
136
	 */
137
	public void setFilterPoolSelectionValidator(ISystemFilterPoolSelectionValidator validator)
138
	{
139
	     filterPoolSelectionValidator = validator;	
140
	     //System.out.println("Inside setFilterPoolSelectionValidator. Non null? " + (validator != null));
141
	}
142
	
143
	// ---------------------------------
144
	// LIFECYCLE METHODS...
145
	// ---------------------------------
146
147
	/**
148
	 * Populate the dialog area with our widgets. Return the composite they are in.
149
	 */
150
	public Control createContents(Composite parent)
151
	{
152
153
		int nbrColumns = 2;
154
		Composite composite_prompts = SystemWidgetHelpers.createComposite(parent, nbrColumns);
155
				
156
		SystemWidgetHelpers.createVerbiage(composite_prompts, configurator.getPage2NameVerbiage(), nbrColumns, false, 200);
157
		nameText = SystemWidgetHelpers.createLabeledTextField(composite_prompts, null, configurator.getPage2NamePromptLabel(), configurator.getPage2NamePromptTooltip());
158
		
159
        addSeparatorLine(composite_prompts, nbrColumns);
160
        addFillerLine(composite_prompts, nbrColumns);
161
        
162
        // allow the user to create this filter uniquely for this connection, which means putting it in a
163
        //  special filter pool we will create, just for this connection. This option is not shown if we are
164
        //  already told which filter pool to create the filter in, such as in Show Filter Pools mode, when
165
        //  the user selects New Filter to create a filter in the selected pool. We assume in this case the
166
        //  will go in whatever filter is selected.
167
        if ((poolsToSelectFrom!=null) || (poolWrapperInformation!=null))
168
        {
169
			uniqueCB = SystemWidgetHelpers.createCheckBox(composite_prompts, nbrColumns, configurator.getPage2UniqueToConnectionLabel(), null);
170
			uniqueCB.setToolTipText(configurator.getPage2UniqueToConnectionToolTip()); 
171
			uniqueCB.addSelectionListener(this);
172
			uniqueCB.setSelection(true); // [160403] filters should be connection private by default
173
        }
174
		        
175
        addFillerLine(composite_prompts, nbrColumns);
176
        
177
        if (poolsToSelectFrom != null)
178
        {
179
		   	poolVerbiage = SystemWidgetHelpers.createVerbiage(composite_prompts, configurator.getPage2PoolVerbiage(), nbrColumns, false, 200);
180
		   	poolVerbiage.setToolTipText(configurator.getPage2PoolVerbiageTip());
181
           	poolCombo = SystemWidgetHelpers.createLabeledReadonlyCombo(composite_prompts, null, configurator.getPage2PoolPromptLabel(), configurator.getPage2PoolPromptTooltip());
182
			poolComboLabel = SystemWidgetHelpers.getLastLabel();
183
           	String[] poolNames = new String[poolsToSelectFrom.length];
184
		   	int filterPoolSelectionIndex = 0;
185
           	for (int idx=0; idx<poolNames.length; idx++)
186
           	{
187
           	  	ISystemFilterPool pool = poolsToSelectFrom[idx];
188
           	  	if (pool == parentPool)
189
           	    	filterPoolSelectionIndex = idx;
190
              	poolNames[idx] = pool.getSystemFilterPoolManager().getName()+"."+pool.getName(); //$NON-NLS-1$
191
           	}
192
           	if ((nameValidator == null) && (nameValidators!=null))
193
             	nameValidator = nameValidators[filterPoolSelectionIndex];
194
           	poolCombo.setItems(poolNames);         
195
           	poolCombo.select(filterPoolSelectionIndex);
196
           	poolCombo.addSelectionListener(this);
197
           	if ((uniqueCB!=null) && uniqueCB.getSelection())
198
           	{
199
				poolVerbiage.setEnabled(false);
200
				poolComboLabel.setEnabled(false);
201
           		poolCombo.setEnabled(false);
202
           	}
203
        }
204
        else if (poolWrapperInformation != null)
205
        {
206
		 	poolVerbiage = SystemWidgetHelpers.createVerbiage(composite_prompts, poolWrapperInformation.getVerbiageLabel(), nbrColumns, false, 200);
207
		   	//poolWrapperCombo = SystemWidgetHelpers.createLabeledCombo(composite_prompts, null, poolWrapperInformation.getResourceBundle(), poolWrapperInformation.getPromptRBKey()); // d47323
208
		   	poolWrapperCombo = SystemWidgetHelpers.createLabeledReadonlyCombo(composite_prompts, null, poolWrapperInformation.getPromptLabel(), poolWrapperInformation.getPromptTooltip());
209
			poolComboLabel = SystemWidgetHelpers.getLastLabel();
210
		   	poolWrappers = poolWrapperInformation.getWrappers();
211
           	String[] poolNames = new String[poolWrappers.length];
212
		   	int filterPoolSelectionIndex = 0;
213
           	for (int idx=0; idx<poolNames.length; idx++)
214
           	{
215
           	  	if (poolWrapperInformation.getPreSelectWrapper() == poolWrappers[idx])
216
           	    	filterPoolSelectionIndex = idx;
217
              	poolNames[idx] = poolWrappers[idx].getDisplayName();
218
           	}
219
           	if ((nameValidator == null) && (nameValidators!=null))
220
             	nameValidator = nameValidators[filterPoolSelectionIndex];
221
           	poolWrapperCombo.setItems(poolNames);           
222
           	poolWrapperCombo.select(filterPoolSelectionIndex);
223
           	poolWrapperCombo.addSelectionListener(this);
224
			if ((uniqueCB!=null) && uniqueCB.getSelection())
225
			{
226
				poolVerbiage.setEnabled(false);
227
				poolComboLabel.setEnabled(false);
228
				poolWrapperCombo.setEnabled(false);
229
			}
230
        }
231
		
232
		// initialize inputs
233
        if (nameValidator != null)
234
        {
235
        	int maxNameLength = nameValidator.getMaximumNameLength();
236
        	if (maxNameLength >= 0)
237
        	  nameText.setTextLimit(maxNameLength);
238
        }
239
		if (inputFilterName != null)
240
		  nameText.setText(inputFilterName);
241
		  
242
		// add keystroke listeners...
243
		nameText.addModifyListener(
244
			new ModifyListener() {
245
				public void modifyText(ModifyEvent e) {
246
					if (ignoreChanges)
247
					  return;
248
					userEditedName = true;
249
					validateNameInput();
250
				}
251
			}
252
		);		
253
		
254
		setPageComplete();		        
255
		contentsCreated = true;
256
		return composite_prompts;
257
	}	
258
	/**
259
	 * Return the Control to be given initial focus.
260
	 * Override from parent. Return control to be given initial focus.
261
	 */
262
	protected Control getInitialFocusControl()
263
	{
264
        return nameText;
265
	}
266
	
267
	/**
268
	 * Completes processing of the wizard. If this 
269
	 * method returns true, the wizard will close; 
270
	 * otherwise, it will stay active.
271
	 * This method is an override from the parent Wizard class. 
272
	 *
273
	 * @return whether the wizard finished successfully
274
	 */
275
	public boolean performFinish() 
276
	{
277
		if (!contentsCreated)
278
		  return true;
279
		return (verify() == null);
280
	}
281
282
	/**
283
	 * Return true if the page is complete, so to enable Finish.
284
	 * Called by wizard framework.
285
	 */
286
	public boolean isPageComplete()
287
	{
288
		boolean pageComplete = (errorMessage == null) && (nameText!=null);
289
		if (pageComplete)
290
		  pageComplete = (nameText.getText().trim().length() > 0);
291
		return pageComplete;
292
	}
293
	
294
	/**
295
	 * Inform caller of page-complete status of this page
296
	 */
297
	public void setPageComplete()
298
	{
299
		setPageComplete(isPageComplete());
300
	}	
301
	/**
302
	 * User has selected something
303
	 */
304
	public void widgetSelected(SelectionEvent e)
305
	{
306
		Object src = e.getSource();
307
		if (src == poolCombo)
308
		{
309
		  	int selection = poolCombo.getSelectionIndex();	
310
		  	if ((selection >= 0) && (nameValidators!=null))
311
		    	nameValidator = nameValidators[selection];
312
		}
313
		else if (src == poolWrapperCombo)
314
		{
315
		  	int selection = poolWrapperCombo.getSelectionIndex();	
316
		  	if ((selection >= 0) && (nameValidators!=null))
317
		    	nameValidator = nameValidators[selection];
318
		}
319
		else if (src == uniqueCB)
320
		{
321
			boolean selected = uniqueCB.getSelection();
322
			if (poolVerbiage != null)
323
			  	poolVerbiage.setEnabled(!selected);
324
			if (poolCombo != null)
325
			 	poolCombo.setEnabled(!selected);
326
			if (poolWrapperCombo != null)
327
				poolWrapperCombo.setEnabled(!selected);
328
			if (poolComboLabel != null)
329
				poolComboLabel.setEnabled(!selected);
330
		}
331
		verify();
332
		setPageComplete();
333
	}
334
	/**
335
	 * User has selected something and pressed Enter
336
	 */
337
	public void widgetDefaultSelected(SelectionEvent e)
338
	{
339
	}
340
	// ---------------------------------
341
	// VERIFICATION METHODS...
342
	// ---------------------------------
343
	/**
344
	 * Verify all contents
345
	 */	    
346
	public SystemMessage verify()
347
	{
348
		errorMessage = null;
349
		Control controlInError = null;
350
351
		if ((errorMessage == null) && (filterPoolSelectionValidator != null))
352
		{
353
			errorMessage = filterPoolSelectionValidator.validate(getParentSystemFilterPool());
354
			if (poolCombo != null)
355
			  controlInError = poolCombo;
356
			else if (poolWrapperCombo != null)
357
			  controlInError = poolCombo;
358
		}		
359
		if ((errorMessage == null) && (nameValidator != null))
360
		{
361
	        errorMessage = nameValidator.validate(nameText.getText().trim());
362
			controlInError = nameText;
363
		}		
364
365
		if (errorMessage != null)
366
		{
367
		  	if (controlInError != null)
368
		  	  controlInError.setFocus();
369
		  	setErrorMessage(errorMessage);
370
		}
371
		else
372
		    clearErrorMessage();
373
		return errorMessage;
374
	}    	
375
  	/**
376
	 * This hook method is called whenever the text changes in the filter name input field.
377
	 */
378
	protected SystemMessage validateNameInput() 
379
	{			
380
	    errorMessage= null;			
381
		if (nameValidator != null)
382
	      errorMessage = nameValidator.validate(nameText.getText().trim());
383
		if ((errorMessage == null) && (filterPoolSelectionValidator != null))
384
			errorMessage = filterPoolSelectionValidator.validate(getParentSystemFilterPool());
385
		setPageComplete();
386
		if (errorMessage != null)
387
		  setErrorMessage(errorMessage);		
388
		else
389
		  clearErrorMessage();
390
		return errorMessage;
391
	}
392
393
    
394
	// ---------------------------------
395
	// METHODS FOR EXTRACTING USER DATA 
396
	// ---------------------------------
397
	/**
398
	 * Return name of filter
399
	 * Call this after finish ends successfully.
400
	 */	    
401
	public String getFilterName()
402
	{
403
		if (nameText != null)
404
		  return nameText.getText().trim();
405
		else
406
		  return inputFilterName;
407
	}    	
408
	/**
409
	 * Return the filter pool that was explicitly chosen by the user,
410
	 *  or implicitly set by the caller.
411
	 */
412
	public ISystemFilterPool getParentSystemFilterPool()
413
	{
414
		ISystemFilterPool pool = null;
415
		// do we prompt with a list of filter pools? Yes, just return selected...
416
		if (poolCombo != null)
417
		{
418
		  int selection = poolCombo.getSelectionIndex();
419
		  if (selection < 0)
420
		    selection = 0;
421
		  pool = poolsToSelectFrom[selection];
422
		}
423
		// do we prompt using a wrapper of some kind, such a profile or a command set,
424
		// from which we deduce the pool? If so, deduce pool from selected wrapper....
425
		else if (poolWrapperCombo != null)
426
		{
427
		  int selection = poolWrapperCombo.getSelectionIndex();
428
		  if (selection < 0)
429
		    selection = 0;
430
		  pool = poolWrappers[selection].getSystemFilterPool();
431
		}
432
		// else no prompt so we must have been given the explicit filter pool in which
433
		// to create this filter. Eg, in Show Filter Pools mode and the user selects a
434
		// filter pool and choose New Filter from it.
435
		else
436
		  pool = parentPool;
437
		//System.out.println("Inside getParentSystemFilterPool. returning " + pool.getName());
438
	    return pool;
439
	}	
440
	
441
	/**
442
	 * Return the user's decision whether to create this filter uniquely
443
	 *  for this connection, or for all applicable connections.
444
	 */
445
	public boolean getUniqueToThisConnection()
446
	{
447
		if (uniqueCB != null)
448
			return uniqueCB.getSelection();
449
		else
450
		 	return false;
451
	}
452
453
	// -------------------------------	
454
	// INTERCEPT OF WIZARDPAGE METHODS
455
	// -------------------------------
456
	/**
457
	 * This is called when a page is given focus or loses focus
458
	 */
459
	public void setVisible(boolean visible)
460
	{
461
		super.setVisible(visible);
462
		if (visible)
463
		{
464
			if (!userEditedName && (nameText!=null))
465
			{
466
				String defaultName = ((SystemNewFilterWizard)getWizard()).getDefaultFilterName();
467
				if (defaultName != null)
468
				{
469
					ignoreChanges = true;
470
				    nameText.setText(defaultName);
471
				    ignoreChanges = false;
472
				}
473
			}
474
		    verify();
475
		    //System.out.println("Wizard size = " + ((SystemNewFilterWizard)getWizard()).getShell().getSize());
476
		}
477
	}
478
479
	// --------------------------------------------------------------	
480
	// ALL THE MRI ON THIS PAGE IS CONFIGURABLE. CALL HERE TO SET IT. 		
481
	// --------------------------------------------------------------
482
	
483
}
(-)UI/org/eclipse/rse/ui/view/ISystemSelectRemoteObjectAPIProvider.java (+98 lines)
Added Link Here
1
/********************************************************************************
2
 * Copyright (c) 2008 IBM Corporation. All rights reserved.
3
 * This program and the accompanying materials are made available under the terms
4
 * of the Eclipse Public License v1.0 which accompanies this distribution, and is 
5
 * available at http://www.eclipse.org/legal/epl-v10.html
6
 * 
7
 * Initial Contributors:
8
 * The following IBM employees contributed to the Remote System Explorer
9
 * component that contains this file: David McKnight.
10
 * 
11
 * Contributors:
12
 * {Name} (company) - description of contribution.
13
 ********************************************************************************/
14
package org.eclipse.rse.ui.view;
15
16
import org.eclipse.rse.core.IRSESystemType;
17
import org.eclipse.rse.core.filters.ISystemFilter;
18
import org.eclipse.rse.core.model.IHost;
19
import org.eclipse.rse.core.model.ISystemViewInputProvider;
20
21
public interface ISystemSelectRemoteObjectAPIProvider 
22
		extends ISystemViewInputProvider
23
{
24
	/**
25
	 * This method is called by the connection adapter when the user expands
26
	 *  a connection. This method must return the child objects to show for that
27
	 *  connection.
28
	 */
29
	public Object[] getConnectionChildren(IHost selectedConnection);
30
	
31
	/**
32
	 * Get the name of the item to select when the first filter is expanded.
33
	 * Called by the filter adapter.
34
	 */
35
	public String getPreSelectFilterChild();
36
	
37
	/**
38
	 * Get the actual object of the item to select when the first filter is expanded.
39
	 * Called by the GUI form after expansion, so it can select this object
40
	 */
41
	public Object getPreSelectFilterChildObject();
42
	
43
	/**
44
	 * Set the filter string to use to resolve the inputs. 
45
	 * If this is an absolute filter string, it gets turned into a quick filter string,
46
	 *  so that the user sees it and can expand it. If it is a relative filter string 
47
	 *  to apply to all expansions, it is used to decorate all filtering as the user drills down.
48
	 */
49
	public void setFilterString(String string);
50
	
51
	/**
52
	 * Set actual child object of the first filter to preselect. Called
53
	 * by the filter adapter once the children are resolved and a match on
54
	 * the name is found.
55
	 */
56
	public void setPreSelectFilterChildObject(Object obj);
57
58
	/**
59
	 * Set child of the first filter to preselect 
60
	 */
61
	public void setPreSelectFilterChild(String name);
62
	
63
	/**
64
	 * Set the quick filters to be exposed to the user. These will be shown to the
65
	 *  user when they expand a connection.
66
	 * @see org.eclipse.rse.core.filters.SystemFilterSimple
67
	 */
68
	public void setQuickFilters(ISystemFilter[] filters);
69
70
	
71
	/**
72
	 * Specify whether the user should see the "New Connection..." special connection prompt
73
	 */
74
	public void setShowNewConnectionPrompt(boolean show);
75
	
76
	
77
	/** 
78
	 * Default or Restrict to a specific connection.
79
	 * If default mode, it is preselected.
80
	 * If only mode, it is the only connection listed.
81
	 * @param connection The connection to default or restrict to
82
	 * @param onlyMode true if this is to be the only connection shown in the list
83
	 */
84
	public void setSystemConnection(IHost connection, boolean onlyMode);
85
86
87
	/**
88
	 * Specify system types to restrict what types of connections
89
	 * the user can create, and see.
90
	 * This will override subsystemConfigurationId,if that has been set!
91
	 * 
92
     * @param systemTypes An array of system types, or
93
     *     <code>null</code> to allow all registered valid system types.
94
     *     A system type is valid if at least one subsystem configuration
95
     *     is registered against it.
96
	 */
97
	public void setSystemTypes(IRSESystemType[] systemTypes);
98
}
(-)UI/org/eclipse/rse/ui/dialogs/SystemTestFilterStringDialog.java (+215 lines)
Added Link Here
1
/********************************************************************************
2
 * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved.
3
 * This program and the accompanying materials are made available under the terms
4
 * of the Eclipse Public License v1.0 which accompanies this distribution, and is 
5
 * available at http://www.eclipse.org/legal/epl-v10.html
6
 * 
7
 * Initial Contributors:
8
 * The following IBM employees contributed to the Remote System Explorer
9
 * component that contains this file: David McKnight, Kushal Munir, 
10
 * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, 
11
 * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
12
 * 
13
 * Contributors:
14
 * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
15
 * Martin Oberhuber (Wind River) - [175680] Deprecate obsolete ISystemRegistry methods
16
 ********************************************************************************/
17
18
package org.eclipse.rse.ui.dialogs;
19
import org.eclipse.jface.viewers.ISelectionChangedListener;
20
import org.eclipse.jface.viewers.SelectionChangedEvent;
21
import org.eclipse.rse.core.RSECorePlugin;
22
import org.eclipse.rse.core.model.IHost;
23
import org.eclipse.rse.core.model.ISystemRegistry;
24
import org.eclipse.rse.core.subsystems.ISubSystem;
25
import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
26
import org.eclipse.rse.internal.ui.SystemResources;
27
import org.eclipse.rse.internal.ui.view.SystemTestFilterStringAPIProviderImpl;
28
import org.eclipse.rse.ui.SystemWidgetHelpers;
29
import org.eclipse.rse.ui.view.SystemViewForm;
30
import org.eclipse.rse.ui.widgets.SystemHostCombo;
31
import org.eclipse.swt.SWT;
32
import org.eclipse.swt.events.SelectionEvent;
33
import org.eclipse.swt.events.SelectionListener;
34
import org.eclipse.swt.layout.GridData;
35
import org.eclipse.swt.widgets.Composite;
36
import org.eclipse.swt.widgets.Control;
37
import org.eclipse.swt.widgets.Label;
38
import org.eclipse.swt.widgets.Shell;
39
40
41
42
/**
43
 * Dialog for testing a filter string. Typically called from a create/update filter string dialog.
44
 * <p>
45
 * Caller must supply the subsystem which owns this existing or potential filter string.
46
 * <p>
47
 * This dialog contains a dropdown for selecting connections to use in the test. Only connections which
48
 * contain subsystems with the same parent factory as the given subsystem factory are shown.
49
 *
50
 */
51
public class SystemTestFilterStringDialog
52
       extends SystemPromptDialog
53
       implements  ISelectionChangedListener, SelectionListener
54
{
55
	protected ISubSystem subsystem = null;
56
	protected ISystemRegistry sr = null;
57
	protected String subsystemConfigurationId = null;
58
	protected String filterString = null;
59
    protected SystemTestFilterStringAPIProviderImpl inputProvider = null;
60
	// GUI widgets
61
    protected Label prompt, promptValue;
62
	protected SystemViewForm tree;
63
	protected SystemHostCombo connectionCombo;
64
65
	/**
66
	 * Constructor
67
	 * @param shell The shell to hang the dialog off of
68
	 * @param subsystem The contextual subsystem that owns this filter string
69
	 * @param filterString The filter string that is to be tested.
70
	 */
71
	public SystemTestFilterStringDialog(Shell shell, ISubSystem subsystem, String filterString)
72
	{
73
		this(shell, SystemResources.RESID_TESTFILTERSTRING_TITLE, subsystem, filterString);			
74
	}
75
	/**
76
	 * Constructor when unique title desired
77
	 * @param shell The shell to hang the dialog off of
78
	 * @param title The title to give the dialog
79
	 * @param subsystem The contextual subsystem that owns this filter string
80
	 * @param filterString The filter string that is to be tested.
81
	 */
82
	public SystemTestFilterStringDialog(Shell shell, String title, ISubSystem subsystem, String filterString)
83
	{
84
		super(shell, title);	
85
        setCancelButtonLabel(SystemResources.BUTTON_CLOSE);
86
        setShowOkButton(false);		
87
		setBlockOnOpen(true); // always modal	
88
		this.subsystem = subsystem;
89
		this.filterString = filterString;
90
		this.subsystemConfigurationId = subsystem.getSubSystemConfiguration().getId();
91
		sr = RSECorePlugin.getTheSystemRegistry();
92
		setNeedsProgressMonitor(true);
93
		//pack();
94
	}	
95
96
    // ------------------
97
    // PUBLIC METHODS...
98
    // ------------------
99
    // ------------------
100
    // PRIVATE METHODS...
101
    // ------------------
102
	/**
103
     * Private method.
104
	 * @see SystemPromptDialog#getInitialFocusControl()
105
	 */
106
	protected Control getInitialFocusControl()
107
	{
108
		//return tree.getTreeControl();
109
		return connectionCombo.getCombo();
110
	}
111
112
	/**
113
     * Private method.
114
	 * @see SystemPromptDialog#createInner(Composite)
115
	 */
116
	protected Control createInner(Composite parent)
117
	{
118
		// Inner composite
119
		int gridColumns = 2;
120
		Composite composite_prompts = SystemWidgetHelpers.createComposite(parent, gridColumns);	
121
122
        // connection selection combo
123
        connectionCombo = SystemWidgetHelpers.createConnectionCombo(composite_prompts, null, null, subsystem.getSubSystemConfiguration(),
124
                                                                    null, null, subsystem.getHost(), gridColumns, false);
125
126
        // filter string prompt
127
       // Composite promptComposite = composite_prompts;
128
        Composite promptComposite = connectionCombo;
129
        prompt = SystemWidgetHelpers.createLabel(promptComposite, SystemResources.RESID_TESTFILTERSTRING_PROMPT_LABEL, SystemResources.RESID_TESTFILTERSTRING_PROMPT_TOOLTIP);
130
        promptValue = SystemWidgetHelpers.createLabel(promptComposite, SystemResources.RESID_TESTFILTERSTRING_PROMPT_LABEL, SystemResources.RESID_TESTFILTERSTRING_PROMPT_TOOLTIP);
131
132
        promptValue.setToolTipText(filterString); // Since the dialog is not resizable, this is the way to show the whole string
133
134
        // Make sure the label width is not longer than the window width
135
        // Otherwise the combo box dropdown arrow above it will be pushed beyond the window and invisible
136
        //promptValue.setText(filterString);
137
138
        String label = filterString;
139
140
        if ( label.length() > 30)
141
           label = label.substring(0,30) + " ...";   // Use ... to show that not entire string is displayed //$NON-NLS-1$
142
        promptValue.setText( label);
143
144
        //Point point = promptValue.computeSize(SWT.DEFAULT, SWT.DEFAULT);
145
        //GridData data = new GridData();	
146
	    //data.widthHint = point.x < 230 ? point.x : 230;
147
	    GridData data = new GridData();	
148
	    data.widthHint =  200;
149
	    promptValue.setLayoutData(data);	
150
151
		// TREE
152
		inputProvider = new SystemTestFilterStringAPIProviderImpl(subsystem, filterString);		  		
153
		tree = new SystemViewForm(getShell(), composite_prompts, SWT.NULL, inputProvider, false, getMessageLine(), gridColumns, 1);
154
155
	    // add selection listeners
156
		//tree.addSelectionChangedListener(this);				
157
        connectionCombo.addSelectionListener(this);
158
159
		return composite_prompts;
160
	}
161
162
	/**
163
	 * Override of parent. Must pass selected object onto the form for initializing fields.
164
	 * Called by SystemDialogAction's default run() method after dialog instantiated.
165
	 */
166
	public void setInputObject(Object inputObject)
167
	{
168
		super.setInputObject(inputObject);
169
	}
170
171
    /**
172
     * When re-using this dialog between runs, call this to reset its contents.
173
     * Assumption: original input subsystem factory Id doesn't change between runs
174
     */
175
    public void reset(ISubSystem subsystem, String filterString)
176
    {
177
		this.subsystem = subsystem;
178
		this.filterString = filterString;
179
		//this.subsystemConfigurationId = subsystem.getParentSubSystemConfiguration().getId();
180
    	inputProvider.setSubSystem(subsystem);
181
    	inputProvider.setFilterString(filterString);
182
    	tree.reset(inputProvider);    		
183
    }
184
185
    /**
186
     * ISelectionChangedListener interface method
187
     */
188
    public void selectionChanged(SelectionChangedEvent event)
189
    {
190
    }	
191
    public void widgetDefaultSelected(SelectionEvent event)
192
    {
193
    }
194
    public void widgetSelected(SelectionEvent event)
195
    {
196
197
    	//if (src == connectionCombo.getCombo())
198
    	{
199
    		//System.out.println("connection changed");
200
    		IHost newConnection = connectionCombo.getHost();
201
    		ISubSystem newSubSystem = null;
202
			ISubSystemConfiguration config = sr.getSubSystemConfiguration(subsystemConfigurationId);
203
			if (config!=null) {
204
				ISubSystem[] newSubSystems = config.getSubSystems(newConnection, true);
205
				if (newSubSystems != null && newSubSystems.length > 0) {
206
		    		  newSubSystem = newSubSystems[0];
207
				      subsystemConfigurationId = subsystem.getSubSystemConfiguration().getId();
208
				}
209
			}
210
    		inputProvider.setSubSystem(newSubSystem);
211
    		tree.reset(inputProvider);    		
212
    	}
213
    }
214
215
}
(-)src/org/eclipse/rse/internal/subsystems/files/core/SystemFileAPIProviderImpl.java (-1 / +1 lines)
Lines 21-29 Link Here
21
import org.eclipse.rse.core.model.IHost;
21
import org.eclipse.rse.core.model.IHost;
22
import org.eclipse.rse.core.model.ISystemRegistry;
22
import org.eclipse.rse.core.model.ISystemRegistry;
23
import org.eclipse.rse.core.subsystems.ISubSystem;
23
import org.eclipse.rse.core.subsystems.ISubSystem;
24
import org.eclipse.rse.internal.ui.view.SystemAbstractAPIProvider;
25
import org.eclipse.rse.subsystems.files.core.model.ISystemFileAPIProvider;
24
import org.eclipse.rse.subsystems.files.core.model.ISystemFileAPIProvider;
26
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem;
25
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem;
26
import org.eclipse.rse.ui.view.SystemAbstractAPIProvider;
27
27
28
28
29
/**
29
/**
(-)src/org/eclipse/rse/files/ui/dialogs/SystemRemoteFileDialog.java (-3 / +3 lines)
Lines 23-31 Link Here
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.internal.subsystems.files.core.SystemFileResources;
25
import org.eclipse.rse.internal.subsystems.files.core.SystemFileResources;
26
import org.eclipse.rse.internal.ui.view.SystemView;
27
import org.eclipse.rse.ui.SystemActionViewerFilter;
26
import org.eclipse.rse.ui.SystemActionViewerFilter;
28
import org.eclipse.rse.ui.dialogs.SystemRemoteResourceDialog;
27
import org.eclipse.rse.ui.dialogs.SystemRemoteResourceDialog;
28
import org.eclipse.rse.ui.view.ISystemTree;
29
import org.eclipse.swt.widgets.Composite;
29
import org.eclipse.swt.widgets.Composite;
30
import org.eclipse.swt.widgets.Control;
30
import org.eclipse.swt.widgets.Control;
31
import org.eclipse.swt.widgets.Shell;
31
import org.eclipse.swt.widgets.Shell;
Lines 70-76 Link Here
70
	protected Control createContents(Composite parent) 
70
	protected Control createContents(Composite parent) 
71
	{
71
	{
72
		Control control = super.createContents(parent);
72
		Control control = super.createContents(parent);
73
		_form.getSystemViewForm().getSystemView().addDoubleClickListener(new IDoubleClickListener() {
73
		_form.getSystemViewForm().getSystemTree().addDoubleClickListener(new IDoubleClickListener() {
74
			public void doubleClick(DoubleClickEvent event) {
74
			public void doubleClick(DoubleClickEvent event) {
75
				handleDoubleClick(event);
75
				handleDoubleClick(event);
76
			}
76
			}
Lines 84-90 Link Here
84
	 */
84
	 */
85
	protected void handleDoubleClick(DoubleClickEvent event) 
85
	protected void handleDoubleClick(DoubleClickEvent event) 
86
	{
86
	{
87
		SystemView tree = _form.getSystemViewForm().getSystemView();
87
		ISystemTree tree = _form.getSystemViewForm().getSystemTree();
88
		IStructuredSelection s = (IStructuredSelection) event.getSelection();
88
		IStructuredSelection s = (IStructuredSelection) event.getSelection();
89
		Object element = s.getFirstElement();
89
		Object element = s.getFirstElement();
90
		if (element == null)
90
		if (element == null)
(-)src/org/eclipse/rse/files/ui/dialogs/SystemSelectRemoteFileOrFolderDialog.java (-4 / +4 lines)
Lines 26-38 Link Here
26
import org.eclipse.rse.files.ui.widgets.SystemSelectRemoteFileOrFolderForm;
26
import org.eclipse.rse.files.ui.widgets.SystemSelectRemoteFileOrFolderForm;
27
import org.eclipse.rse.internal.subsystems.files.core.SystemFileResources;
27
import org.eclipse.rse.internal.subsystems.files.core.SystemFileResources;
28
import org.eclipse.rse.internal.ui.SystemResources;
28
import org.eclipse.rse.internal.ui.SystemResources;
29
import org.eclipse.rse.internal.ui.view.SystemView;
30
import org.eclipse.rse.internal.ui.view.SystemViewForm;
31
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
29
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
32
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
30
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
33
import org.eclipse.rse.ui.dialogs.SystemPromptDialog;
31
import org.eclipse.rse.ui.dialogs.SystemPromptDialog;
34
import org.eclipse.rse.ui.messages.ISystemMessageLine;
32
import org.eclipse.rse.ui.messages.ISystemMessageLine;
35
import org.eclipse.rse.ui.validators.IValidatorRemoteSelection;
33
import org.eclipse.rse.ui.validators.IValidatorRemoteSelection;
34
import org.eclipse.rse.ui.view.ISystemTree;
35
import org.eclipse.rse.ui.view.SystemViewForm;
36
import org.eclipse.swt.widgets.Composite;
36
import org.eclipse.swt.widgets.Composite;
37
import org.eclipse.swt.widgets.Control;
37
import org.eclipse.swt.widgets.Control;
38
import org.eclipse.swt.widgets.Shell;
38
import org.eclipse.swt.widgets.Shell;
Lines 421-427 Link Here
421
    protected Control createContents(Composite parent) 
421
    protected Control createContents(Composite parent) 
422
	{
422
	{
423
    	Control control = super.createContents(parent);
423
    	Control control = super.createContents(parent);
424
    	form.getSystemViewForm().getSystemView().addDoubleClickListener(new IDoubleClickListener() {
424
    	form.getSystemViewForm().getSystemTree().addDoubleClickListener(new IDoubleClickListener() {
425
			public void doubleClick(DoubleClickEvent event) {
425
			public void doubleClick(DoubleClickEvent event) {
426
				handleDoubleClick(event);
426
				handleDoubleClick(event);
427
			}
427
			}
Lines 435-441 Link Here
435
	 */
435
	 */
436
	protected void handleDoubleClick(DoubleClickEvent event) 
436
	protected void handleDoubleClick(DoubleClickEvent event) 
437
	{
437
	{
438
		SystemView tree = form.getSystemViewForm().getSystemView();
438
		ISystemTree tree = form.getSystemViewForm().getSystemTree();
439
		IStructuredSelection s = (IStructuredSelection) event.getSelection();
439
		IStructuredSelection s = (IStructuredSelection) event.getSelection();
440
		Object element = s.getFirstElement();
440
		Object element = s.getFirstElement();
441
		if (element == null)
441
		if (element == null)
(-)src/org/eclipse/rse/files/ui/dialogs/SystemRemoteFileSelectionInputProvider.java (-1 / +1 lines)
Lines 19-26 Link Here
19
19
20
import org.eclipse.rse.core.model.IHost;
20
import org.eclipse.rse.core.model.IHost;
21
import org.eclipse.rse.core.subsystems.ISubSystem;
21
import org.eclipse.rse.core.subsystems.ISubSystem;
22
import org.eclipse.rse.internal.ui.view.SystemResourceSelectionInputProvider;
23
import org.eclipse.rse.subsystems.files.core.model.RemoteFileUtility;
22
import org.eclipse.rse.subsystems.files.core.model.RemoteFileUtility;
23
import org.eclipse.rse.ui.view.SystemResourceSelectionInputProvider;
24
24
25
25
26
public class SystemRemoteFileSelectionInputProvider extends
26
public class SystemRemoteFileSelectionInputProvider extends
(-)src/org/eclipse/rse/internal/files/ui/actions/SystemSelectFileTypesAction.java (-158 lines)
Removed Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2002, 2007 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Initial Contributors:
9
 * The following IBM employees contributed to the Remote System Explorer
10
 * component that contains this file: David McKnight, Kushal Munir, 
11
 * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, 
12
 * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
13
 * 
14
 * Contributors:
15
 * {Name} (company) - description of contribution.
16
 *******************************************************************************/
17
18
package org.eclipse.rse.internal.files.ui.actions;
19
20
21
import java.util.ArrayList;
22
import java.util.Arrays;
23
import java.util.Iterator;
24
import java.util.List;
25
26
import org.eclipse.jface.dialogs.Dialog;
27
import org.eclipse.rse.internal.subsystems.files.core.SystemFileResources;
28
import org.eclipse.rse.subsystems.files.core.model.RemoteFileFilterString;
29
import org.eclipse.rse.ui.actions.SystemBaseDialogAction;
30
import org.eclipse.rse.ui.dialogs.SystemSelectFileTypesDialog;
31
import org.eclipse.swt.widgets.Shell;
32
33
34
/**
35
 * The action for allowing the user to select one or more file types, using the Eclipse
36
 *  dialog for this. The types are from the file editor registry, as specified in the
37
 *  Workbench preferences.
38
 * <p>
39
 * To set preselected types, use {@link #setTypes(List)} or {@link #setTypes(String[])}.
40
 * Or, if you have single string of comma-separated types, call {@link #setTypes(String)}.
41
 * <p>
42
 * After running, and checking wasCancelled(), you can query the selected types
43
 * using one of:
44
 * <ol>
45
 *   <li>{@link #getTypes()} to retrieve the selected types as a List
46
 *   <li>{@link #getTypesArray()} to retrieve the selected types as a String array
47
 *   <li>{@link #getTypesString()} to retrieve the selected types as a single String of comma-delimited selections
48
 * <p>
49
 * Note the types are remembered after running, so a subsequent run will result in the previous types
50
 * being preselected, assuming you re-use the same instance of this class.
51
 * 
52
 * @see org.eclipse.rse.ui.dialogs.SystemSelectFileTypesDialog
53
 */
54
public class SystemSelectFileTypesAction extends SystemBaseDialogAction 
55
{
56
	protected List types = new ArrayList();
57
	    
58
	/**
59
	 * Constructor
60
     * To set preselected types, use {@link #setTypes(List)} or {@link #setTypes(String[])}.
61
     * Note the types are remember after running, so a subsequent run will result in the previous types
62
     * being preselected.
63
	 */
64
	public SystemSelectFileTypesAction(Shell shell)
65
	{
66
		super(SystemFileResources.ACTION_SELECTFILETYPES_LABEL, SystemFileResources.ACTION_SELECTFILETYPES_TOOLTIP, null, shell);
67
	}	
68
69
    /**
70
     * Set the current input types as a String array.
71
     * Each type is a file name extension, without the dot, as in "java" or "class"
72
     */
73
    public void setTypes(String[] types)
74
    {
75
    	this.types = Arrays.asList(types);
76
    }
77
    /**
78
     * Set the current input types as a java.util List, such as ArrayList
79
     * Each type is a file name extension, without the dot, as in "java" or "class"
80
     */
81
    public void setTypes(List types)
82
    {
83
    	this.types = types;
84
    }
85
    /**
86
     * Set the current input types given a comma-separated list as a single String.
87
     */
88
    public void setTypes(String typeString)
89
    {
90
    	setTypes(RemoteFileFilterString.parseTypes(typeString));
91
    }
92
93
    /**
94
     * Get the selected file types after running the action. Returns an ArrayList
95
     */
96
    public List getTypes()
97
    {
98
    	return types;
99
    }
100
    /**
101
     * Get the selected file types after running the action. Returns a String array
102
     */
103
    public String[] getTypesArray()
104
    {
105
    	String[] typesArray = new String[types.size()];
106
    	Iterator i = types.iterator();
107
    	int idx=0;
108
    	while (i.hasNext())
109
    	  typesArray[idx++] = (String)i.next();
110
    	return typesArray;
111
    }
112
    /**
113
     * Get the selected file types as a concatenated list of strings, comma-separated
114
     */
115
    public String getTypesString()
116
    {
117
    	return RemoteFileFilterString.getTypesString(getTypesArray());
118
    }
119
    
120
    /**
121
     * Return true if the dialog was cancelled by the user.
122
     * Only valid after calling run().
123
     */
124
    public boolean wasCancelled()
125
    {
126
    	return (getValue() == null);
127
    }
128
129
130
    /**
131
     * Create and return the dialog
132
     */
133
    public Dialog createDialog(Shell parent)
134
    {
135
		SystemSelectFileTypesDialog dialog =
136
			new SystemSelectFileTypesDialog(getShell(), types);
137
	    return dialog;    	
138
    }
139
    
140
    /**
141
     * Parent abstract method.
142
     * Called after dialog runs, to retrieve the value from the dialog.
143
     * Will return null if dialog cancelled.
144
     */
145
    public Object getDialogValue(Dialog dlg)
146
    {
147
    	Object[] result = ((SystemSelectFileTypesDialog)dlg).getResult();
148
    	if (result != null)
149
    	{
150
			types = new ArrayList(result.length);
151
			for (int idx = 0; idx < result.length; idx++)
152
			   types.add(result[idx]);
153
    	    return types;
154
    	}
155
    	else
156
    	  return null;
157
    }
158
}
(-)src/org/eclipse/rse/files/ui/widgets/SystemSelectRemoteFileOrFolderForm.java (-6 / +8 lines)
Lines 39-45 Link Here
39
import org.eclipse.rse.internal.subsystems.files.core.SystemFileResources;
39
import org.eclipse.rse.internal.subsystems.files.core.SystemFileResources;
40
import org.eclipse.rse.internal.ui.view.SystemPropertySheetForm;
40
import org.eclipse.rse.internal.ui.view.SystemPropertySheetForm;
41
import org.eclipse.rse.internal.ui.view.SystemSelectRemoteObjectAPIProviderImpl;
41
import org.eclipse.rse.internal.ui.view.SystemSelectRemoteObjectAPIProviderImpl;
42
import org.eclipse.rse.internal.ui.view.SystemViewForm;
43
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
42
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
44
import org.eclipse.rse.subsystems.files.core.model.ISystemFileRemoteTypes;
43
import org.eclipse.rse.subsystems.files.core.model.ISystemFileRemoteTypes;
45
import org.eclipse.rse.subsystems.files.core.model.RemoteFileFilterString;
44
import org.eclipse.rse.subsystems.files.core.model.RemoteFileFilterString;
Lines 54-60 Link Here
54
import org.eclipse.rse.ui.messages.ISystemMessageLine;
53
import org.eclipse.rse.ui.messages.ISystemMessageLine;
55
import org.eclipse.rse.ui.validators.IValidatorRemoteSelection;
54
import org.eclipse.rse.ui.validators.IValidatorRemoteSelection;
56
import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter;
55
import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter;
56
import org.eclipse.rse.ui.view.ISystemSelectRemoteObjectAPIProvider;
57
import org.eclipse.rse.ui.view.SystemAdapterHelpers;
57
import org.eclipse.rse.ui.view.SystemAdapterHelpers;
58
import org.eclipse.rse.ui.view.SystemViewForm;
58
import org.eclipse.swt.SWT;
59
import org.eclipse.swt.SWT;
59
import org.eclipse.swt.graphics.Point;
60
import org.eclipse.swt.graphics.Point;
60
import org.eclipse.swt.layout.GridData;
61
import org.eclipse.swt.layout.GridData;
Lines 107-113 Link Here
107
    protected Label                   verbiageLabel, spacer1, spacer2;
108
    protected Label                   verbiageLabel, spacer1, spacer2;
108
	protected Text                    nameEntryValue;
109
	protected Text                    nameEntryValue;
109
	protected SystemViewForm          tree;
110
	protected SystemViewForm          tree;
110
    protected SystemPropertySheetForm ps;
111
    private SystemPropertySheetForm ps;
111
	protected ISystemMessageLine      msgLine;	
112
	protected ISystemMessageLine      msgLine;	
112
	protected Composite               outerParent, ps_composite;	
113
	protected Composite               outerParent, ps_composite;	
113
	// inputs
114
	// inputs
Lines 135-141 Link Here
135
	protected IHost outputConnection = null;
136
	protected IHost outputConnection = null;
136
	// state
137
	// state
137
	//protected ResourceBundle rb;
138
	//protected ResourceBundle rb;
138
    protected SystemSelectRemoteObjectAPIProviderImpl inputProvider = null;
139
    protected ISystemSelectRemoteObjectAPIProvider inputProvider = null;
139
    protected ISystemFilter preSelectFilter;
140
    protected ISystemFilter preSelectFilter;
140
    protected String       preSelectFilterChild;
141
    protected String       preSelectFilterChild;
141
    protected boolean      preSelectRoot;
142
    protected boolean      preSelectRoot;
Lines 195-201 Link Here
195
	 * Returns the input provider that drives the contents of the tree
196
	 * Returns the input provider that drives the contents of the tree
196
	 * Subclasses can override to provide custom tree contents
197
	 * Subclasses can override to provide custom tree contents
197
	 */
198
	 */
198
	protected SystemSelectRemoteObjectAPIProviderImpl getInputProvider()
199
	protected ISystemSelectRemoteObjectAPIProvider getInputProvider()
199
	{
200
	{
200
		if (inputProvider == null)
201
		if (inputProvider == null)
201
		{
202
		{
Lines 753-759 Link Here
753
		  //tree.setToolTipText(treeTip); //EXTREMELY ANNOYING!
754
		  //tree.setToolTipText(treeTip); //EXTREMELY ANNOYING!
754
		if (autoExpandDepth != 0)
755
		if (autoExpandDepth != 0)
755
		{
756
		{
756
		  tree.getSystemView().setAutoExpandLevel(autoExpandDepth);
757
		  tree.getSystemTree().setAutoExpandLevel(autoExpandDepth);
757
		  tree.reset(inputProvider);
758
		  tree.reset(inputProvider);
758
		}
759
		}
759
760
Lines 803-809 Link Here
803
     */
804
     */
804
    protected IHost internalGetConnection()
805
    protected IHost internalGetConnection()
805
    {
806
    {
806
    	Object parent = tree.getSystemView().getRootParent();
807
    	Object parent = tree.getSystemTree().getRootParent();
807
    	if (parent instanceof IHost)
808
    	if (parent instanceof IHost)
808
    	{
809
    	{
809
    		return (IHost)parent;
810
    		return (IHost)parent;
Lines 1058-1061 Link Here
1058
	public void setAllowFolderSelection(boolean allow) {
1059
	public void setAllowFolderSelection(boolean allow) {
1059
	    allowFolderSelection = allow;
1060
	    allowFolderSelection = allow;
1060
	}
1061
	}
1062
1061
}
1063
}
(-)src/org/eclipse/rse/files/ui/widgets/SystemSelectRemoteFilesForm.java (-1 / +1 lines)
Lines 25-32 Link Here
25
import org.eclipse.core.runtime.IStatus;
25
import org.eclipse.core.runtime.IStatus;
26
import org.eclipse.jface.viewers.ICheckStateListener;
26
import org.eclipse.jface.viewers.ICheckStateListener;
27
import org.eclipse.rse.core.IRSESystemType;
27
import org.eclipse.rse.core.IRSESystemType;
28
import org.eclipse.rse.files.ui.actions.SystemSelectFileTypesAction;
28
import org.eclipse.rse.internal.files.ui.Activator;
29
import org.eclipse.rse.internal.files.ui.Activator;
29
import org.eclipse.rse.internal.files.ui.actions.SystemSelectFileTypesAction;
30
import org.eclipse.rse.internal.ui.SystemResources;
30
import org.eclipse.rse.internal.ui.SystemResources;
31
import org.eclipse.rse.internal.ui.view.SystemViewLabelAndContentProvider;
31
import org.eclipse.rse.internal.ui.view.SystemViewLabelAndContentProvider;
32
import org.eclipse.rse.services.clientserver.messages.CommonMessages;
32
import org.eclipse.rse.services.clientserver.messages.CommonMessages;
(-)src/org/eclipse/rse/files/ui/widgets/SystemFileFilterStringEditPane.java (-1 / +1 lines)
Lines 28-37 Link Here
28
import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManagerProvider;
28
import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManagerProvider;
29
import org.eclipse.rse.core.subsystems.ISubSystem;
29
import org.eclipse.rse.core.subsystems.ISubSystem;
30
import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
30
import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
31
import org.eclipse.rse.files.ui.actions.SystemSelectFileTypesAction;
31
import org.eclipse.rse.internal.files.ui.Activator;
32
import org.eclipse.rse.internal.files.ui.Activator;
32
import org.eclipse.rse.internal.files.ui.FileResources;
33
import org.eclipse.rse.internal.files.ui.FileResources;
33
import org.eclipse.rse.internal.files.ui.ISystemFileConstants;
34
import org.eclipse.rse.internal.files.ui.ISystemFileConstants;
34
import org.eclipse.rse.internal.files.ui.actions.SystemSelectFileTypesAction;
35
import org.eclipse.rse.internal.subsystems.files.core.SystemFileResources;
35
import org.eclipse.rse.internal.subsystems.files.core.SystemFileResources;
36
import org.eclipse.rse.services.clientserver.messages.SimpleSystemMessage;
36
import org.eclipse.rse.services.clientserver.messages.SimpleSystemMessage;
37
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
37
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
(-)src/org/eclipse/rse/internal/files/ui/search/SystemSearchSelectFileTypesAction.java (-1 / +1 lines)
Lines 18-24 Link Here
18
package org.eclipse.rse.internal.files.ui.search;
18
package org.eclipse.rse.internal.files.ui.search;
19
19
20
import org.eclipse.jface.dialogs.Dialog;
20
import org.eclipse.jface.dialogs.Dialog;
21
import org.eclipse.rse.internal.files.ui.actions.SystemSelectFileTypesAction;
21
import org.eclipse.rse.files.ui.actions.SystemSelectFileTypesAction;
22
import org.eclipse.swt.widgets.Shell;
22
import org.eclipse.swt.widgets.Shell;
23
23
24
24
(-)src/org/eclipse/rse/internal/files/ui/search/SystemSearchRemoteFolderForm.java (-2 / +2 lines)
Lines 10-18 Link Here
10
package org.eclipse.rse.internal.files.ui.search;
10
package org.eclipse.rse.internal.files.ui.search;
11
11
12
import org.eclipse.rse.files.ui.widgets.SystemSelectRemoteFileOrFolderForm;
12
import org.eclipse.rse.files.ui.widgets.SystemSelectRemoteFileOrFolderForm;
13
import org.eclipse.rse.internal.ui.view.SystemSelectRemoteObjectAPIProviderImpl;
14
import org.eclipse.rse.subsystems.files.core.model.ISystemFileRemoteTypes;
13
import org.eclipse.rse.subsystems.files.core.model.ISystemFileRemoteTypes;
15
import org.eclipse.rse.ui.messages.ISystemMessageLine;
14
import org.eclipse.rse.ui.messages.ISystemMessageLine;
15
import org.eclipse.rse.ui.view.ISystemSelectRemoteObjectAPIProvider;
16
16
17
/**
17
/**
18
 * The selection form to use is search selection dialogs.
18
 * The selection form to use is search selection dialogs.
Lines 32-38 Link Here
32
	 * Returns an instance of the search input provider {@link SystemSearchRemoteObjectAPIProvider}
32
	 * Returns an instance of the search input provider {@link SystemSearchRemoteObjectAPIProvider}
33
	 * @see org.eclipse.rse.files.ui.widgets.SystemSelectRemoteFileOrFolderForm#getInputProvider()
33
	 * @see org.eclipse.rse.files.ui.widgets.SystemSelectRemoteFileOrFolderForm#getInputProvider()
34
	 */
34
	 */
35
	protected SystemSelectRemoteObjectAPIProviderImpl getInputProvider() {
35
	protected ISystemSelectRemoteObjectAPIProvider getInputProvider() {
36
		
36
		
37
		if (inputProvider == null) {
37
		if (inputProvider == null) {
38
		    // create the input provider that drives the contents of the tree
38
		    // create the input provider that drives the contents of the tree
(-)src/org/eclipse/rse/files/ui/actions/SystemSelectFileTypesAction.java (+158 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2002, 2007 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Initial Contributors:
9
 * The following IBM employees contributed to the Remote System Explorer
10
 * component that contains this file: David McKnight, Kushal Munir, 
11
 * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, 
12
 * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
13
 * 
14
 * Contributors:
15
 * {Name} (company) - description of contribution.
16
 *******************************************************************************/
17
18
package org.eclipse.rse.files.ui.actions;
19
20
21
import java.util.ArrayList;
22
import java.util.Arrays;
23
import java.util.Iterator;
24
import java.util.List;
25
26
import org.eclipse.jface.dialogs.Dialog;
27
import org.eclipse.rse.internal.subsystems.files.core.SystemFileResources;
28
import org.eclipse.rse.subsystems.files.core.model.RemoteFileFilterString;
29
import org.eclipse.rse.ui.actions.SystemBaseDialogAction;
30
import org.eclipse.rse.ui.dialogs.SystemSelectFileTypesDialog;
31
import org.eclipse.swt.widgets.Shell;
32
33
34
/**
35
 * The action for allowing the user to select one or more file types, using the Eclipse
36
 *  dialog for this. The types are from the file editor registry, as specified in the
37
 *  Workbench preferences.
38
 * <p>
39
 * To set preselected types, use {@link #setTypes(List)} or {@link #setTypes(String[])}.
40
 * Or, if you have single string of comma-separated types, call {@link #setTypes(String)}.
41
 * <p>
42
 * After running, and checking wasCancelled(), you can query the selected types
43
 * using one of:
44
 * <ol>
45
 *   <li>{@link #getTypes()} to retrieve the selected types as a List
46
 *   <li>{@link #getTypesArray()} to retrieve the selected types as a String array
47
 *   <li>{@link #getTypesString()} to retrieve the selected types as a single String of comma-delimited selections
48
 * <p>
49
 * Note the types are remembered after running, so a subsequent run will result in the previous types
50
 * being preselected, assuming you re-use the same instance of this class.
51
 * 
52
 * @see org.eclipse.rse.ui.dialogs.SystemSelectFileTypesDialog
53
 */
54
public class SystemSelectFileTypesAction extends SystemBaseDialogAction 
55
{
56
	protected List types = new ArrayList();
57
	    
58
	/**
59
	 * Constructor
60
     * To set preselected types, use {@link #setTypes(List)} or {@link #setTypes(String[])}.
61
     * Note the types are remember after running, so a subsequent run will result in the previous types
62
     * being preselected.
63
	 */
64
	public SystemSelectFileTypesAction(Shell shell)
65
	{
66
		super(SystemFileResources.ACTION_SELECTFILETYPES_LABEL, SystemFileResources.ACTION_SELECTFILETYPES_TOOLTIP, null, shell);
67
	}	
68
69
    /**
70
     * Set the current input types as a String array.
71
     * Each type is a file name extension, without the dot, as in "java" or "class"
72
     */
73
    public void setTypes(String[] types)
74
    {
75
    	this.types = Arrays.asList(types);
76
    }
77
    /**
78
     * Set the current input types as a java.util List, such as ArrayList
79
     * Each type is a file name extension, without the dot, as in "java" or "class"
80
     */
81
    public void setTypes(List types)
82
    {
83
    	this.types = types;
84
    }
85
    /**
86
     * Set the current input types given a comma-separated list as a single String.
87
     */
88
    public void setTypes(String typeString)
89
    {
90
    	setTypes(RemoteFileFilterString.parseTypes(typeString));
91
    }
92
93
    /**
94
     * Get the selected file types after running the action. Returns an ArrayList
95
     */
96
    public List getTypes()
97
    {
98
    	return types;
99
    }
100
    /**
101
     * Get the selected file types after running the action. Returns a String array
102
     */
103
    public String[] getTypesArray()
104
    {
105
    	String[] typesArray = new String[types.size()];
106
    	Iterator i = types.iterator();
107
    	int idx=0;
108
    	while (i.hasNext())
109
    	  typesArray[idx++] = (String)i.next();
110
    	return typesArray;
111
    }
112
    /**
113
     * Get the selected file types as a concatenated list of strings, comma-separated
114
     */
115
    public String getTypesString()
116
    {
117
    	return RemoteFileFilterString.getTypesString(getTypesArray());
118
    }
119
    
120
    /**
121
     * Return true if the dialog was cancelled by the user.
122
     * Only valid after calling run().
123
     */
124
    public boolean wasCancelled()
125
    {
126
    	return (getValue() == null);
127
    }
128
129
130
    /**
131
     * Create and return the dialog
132
     */
133
    public Dialog createDialog(Shell parent)
134
    {
135
		SystemSelectFileTypesDialog dialog =
136
			new SystemSelectFileTypesDialog(getShell(), types);
137
	    return dialog;    	
138
    }
139
    
140
    /**
141
     * Parent abstract method.
142
     * Called after dialog runs, to retrieve the value from the dialog.
143
     * Will return null if dialog cancelled.
144
     */
145
    public Object getDialogValue(Dialog dlg)
146
    {
147
    	Object[] result = ((SystemSelectFileTypesDialog)dlg).getResult();
148
    	if (result != null)
149
    	{
150
			types = new ArrayList(result.length);
151
			for (int idx = 0; idx < result.length; idx++)
152
			   types.add(result[idx]);
153
    	    return types;
154
    	}
155
    	else
156
    	  return null;
157
    }
158
}
(-)plugin.xml (+13 lines)
Lines 36-41 Link Here
36
               id="actions.jar.show">
36
               id="actions.jar.show">
37
         </action>
37
         </action>
38
      </objectContribution>
38
      </objectContribution>
39
      <objectContribution
40
            objectClass="org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile"
41
            nameFilter="*"
42
            id="actions.simplecommand">
43
         <action
44
               label="Simple Command"
45
               tooltip="list contents of this direcotry"
46
               class="samples.ui.actions.TestSimpleCommandOperation"
47
               menubarPath="additions"
48
               enablesFor="1"
49
               id="actions.simplecommand.">
50
         </action>
51
      </objectContribution>
39
	</extension>
52
	</extension>
40
53
41
	<!-- ======================================= -->
54
	<!-- ======================================= -->
(-)src/samples/ui/actions/TestRemoteCommandShellOperation.java (+67 lines)
Added Link Here
1
/********************************************************************************
2
 * Copyright (c) 2007 IBM Corporation. All rights reserved.
3
 * This program and the accompanying materials are made available under the terms
4
 * of the Eclipse Public License v1.0 which accompanies this distribution, and is 
5
 * available at http://www.eclipse.org/legal/epl-v10.html
6
 * 
7
 * Initial Contributors:
8
 * The following IBM employees contributed to the Remote System Explorer
9
 * component that contains this file: David McKnight.
10
 * 
11
 * Contributors:
12
 * {Name} (company) - description of contribution.
13
 ********************************************************************************/
14
package samples.ui.actions;
15
16
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
17
import org.eclipse.rse.subsystems.shells.core.model.RemoteCommandShellOperation;
18
import org.eclipse.rse.subsystems.shells.core.model.RemoteOutput;
19
import org.eclipse.rse.subsystems.shells.core.subsystems.IRemoteCmdSubSystem;
20
import org.eclipse.swt.widgets.Shell;
21
22
public class TestRemoteCommandShellOperation extends
23
		RemoteCommandShellOperation {
24
	
25
	private boolean _commandOutputStarted = false;
26
27
	public TestRemoteCommandShellOperation(Shell shell, IRemoteCmdSubSystem cmdSubSystem, IRemoteFile pwd)
28
	{
29
		super(shell, cmdSubSystem, pwd);
30
	}
31
32
	
33
	public void handleCommandFinished(String cmd) {
34
		// TODO Auto-generated method stub
35
36
	}
37
38
	public void handleOutputChanged(String command, Object output) {
39
		
40
		if (output instanceof RemoteOutput)
41
		{			
42
			String text = ((RemoteOutput)output).getText();
43
			
44
			System.out.println("updating output"+text);
45
			
46
			if (!_commandOutputStarted)
47
			{
48
				_commandOutputStarted = text.indexOf("BEGIN-END-TAG:") > 0;
49
			}
50
			else
51
			{
52
				if (text.indexOf("BEGIN-END-TAG:") > 0){
53
					_commandOutputStarted = false;
54
				}
55
				else {
56
					processOutput(text);
57
				}
58
			}
59
		}
60
	}
61
	
62
	private void processOutput(String text)
63
	{
64
		System.out.println("line = " + text);
65
	}
66
67
}
(-)src/samples/ui/actions/TestSimpleCommandOperation.java (+106 lines)
Added Link Here
1
/********************************************************************************
2
 * Copyright (c) 2006, 2007 IBM Corporation and others. All rights reserved.
3
 * This program and the accompanying materials are made available under the terms
4
 * of the Eclipse Public License v1.0 which accompanies this distribution, and is 
5
 * available at http://www.eclipse.org/legal/epl-v10.html
6
 * 
7
 * Initial Contributors:
8
 * The following IBM employees contributed to the Remote System Explorer
9
 * component that contains this file: David McKnight, Kushal Munir, 
10
 * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, 
11
 * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
12
 * 
13
 * Contributors:
14
 * Martin Oberhuber (Wind River) - Adapted original tutorial code to Open RSE.
15
 * David Dykstal (IBM) - formatting for tutorial
16
 ********************************************************************************/
17
18
package samples.ui.actions;
19
20
import java.util.ArrayList;
21
import java.util.Iterator;
22
import java.util.List;
23
24
import org.eclipse.jface.action.IAction;
25
import org.eclipse.jface.viewers.IStructuredSelection;
26
import org.eclipse.rse.core.model.IHost;
27
import org.eclipse.rse.core.subsystems.ISubSystem;
28
import org.eclipse.rse.shells.ui.RemoteCommandHelpers;
29
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
30
import org.eclipse.rse.subsystems.shells.core.subsystems.IRemoteCmdSubSystem;
31
import org.eclipse.rse.ui.SystemBasePlugin;
32
import org.eclipse.swt.widgets.Shell;
33
import org.eclipse.ui.IObjectActionDelegate;
34
import org.eclipse.ui.IWorkbenchPart;
35
36
/**
37
 * An action that runs a command to display the contents of a Jar file.
38
 * The plugin.xml file restricts this action so it only appears for .jar files.
39
 */
40
public class TestSimpleCommandOperation implements IObjectActionDelegate {
41
	private List _selectedFiles;
42
43
	/**
44
	 * Constructor for ShowJarContents.
45
	 */
46
	public TestSimpleCommandOperation() {
47
		_selectedFiles = new ArrayList();
48
	}
49
50
	protected Shell getShell() {
51
		return SystemBasePlugin.getActiveWorkbenchShell();
52
	}
53
54
	protected IRemoteFile getFirstSelectedRemoteFile() {
55
		if (_selectedFiles.size() > 0) {
56
			return (IRemoteFile) _selectedFiles.get(0);
57
		}
58
		return null;
59
	}
60
61
	protected ISubSystem getSubSystem() {
62
		return getFirstSelectedRemoteFile().getParentRemoteFileSubSystem();
63
	}
64
65
	/* (non-Javadoc)
66
	 * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
67
	 */
68
	public void run(IAction action) {
69
		IRemoteFile selectedFile = getFirstSelectedRemoteFile();
70
		
71
		TestRemoteCommandShellOperation op = new TestRemoteCommandShellOperation(getShell(), getRemoteCmdSubSystem(), selectedFile);
72
73
		op.run();
74
		op.sendCommand("ls -l");	
75
		op.sendCommand("exit");
76
	}
77
78
	public IRemoteCmdSubSystem getRemoteCmdSubSystem() {
79
		//get the Command subsystem associated with the current host
80
		IHost myHost = getSubSystem().getHost();
81
		IRemoteCmdSubSystem[] subsys = RemoteCommandHelpers.getCmdSubSystems(myHost);
82
		for (int i = 0; i < subsys.length; i++) {
83
			if (subsys[i].getSubSystemConfiguration().supportsCommands()) {
84
				return subsys[i];
85
			}
86
		}
87
		return null;
88
	}
89
90
91
92
	public void selectionChanged(org.eclipse.jface.action.IAction action, org.eclipse.jface.viewers.ISelection selection) {
93
		_selectedFiles.clear();
94
		// store the selected jars to be used when running
95
		Iterator theSet = ((IStructuredSelection) selection).iterator();
96
		while (theSet.hasNext()) {
97
			Object obj = theSet.next();
98
			if (obj instanceof IRemoteFile) {
99
				_selectedFiles.add(obj);
100
			}
101
		}
102
	}
103
104
	public void setActivePart(IAction action, IWorkbenchPart targetPart) {
105
	}
106
}

Return to bug 225506