Skip to main content

This CGIT instance is deprecated, and repositories have been moved to Gitlab or Github. See the repository descriptions for specific locations.

summaryrefslogtreecommitdiffstats
blob: f82290144a4e55d02b11d9d1e23ea425b91a53dc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/********************************************************************************
 * Copyright (c) 2006 IBM Corporation. All rights reserved.
 * This program and the accompanying materials are made available under the terms
 * of the Eclipse Public License v1.0 which accompanies this distribution, and is 
 * available at http://www.eclipse.org/legal/epl-v10.html
 * 
 * Initial Contributors:
 * The following IBM employees contributed to the Remote System Explorer
 * component that contains this file: David McKnight, Kushal Munir, 
 * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, 
 * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
 * 
 * Contributors:
 * Martin Oberhuber (Wind River) - Adapted original tutorial code to Open RSE.
 ********************************************************************************/

package samples.subsystems;

import org.eclipse.jface.action.IAction;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.rse.core.filters.ISystemFilter;
import org.eclipse.rse.core.filters.ISystemFilterPool;
import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
import org.eclipse.rse.ui.filters.actions.SystemChangeFilterAction;
import org.eclipse.rse.ui.filters.actions.SystemNewFilterAction;
import org.eclipse.rse.ui.view.SubSystemConfigurationAdapter;
import org.eclipse.swt.widgets.Shell;

import samples.RSESamplesPlugin;

/**
 * Adds functionality to the basic SubSystemConfiguration.
 */
public class DeveloperSubSystemConfigurationAdapter extends
		SubSystemConfigurationAdapter
{

	/**
	 * Constructor for DeveloperSubSystemConfigurationAdapter.
	 */
	public DeveloperSubSystemConfigurationAdapter()
	{
		super();
	}

	/**
	 * Override of parent method, to affect what is returned for the New Filter-> actions.
	 * We intercept here, versus getNewFilterPoolFilterAction, so that we can return multiple
	 *  actions versus just one.
	 */
	protected IAction[] getNewFilterPoolFilterActions(ISubSystemConfiguration factory, ISystemFilterPool selectedPool, Shell shell)
	{
	  	SystemNewFilterAction teamAction = (SystemNewFilterAction)super.getNewFilterPoolFilterAction(factory, selectedPool, shell);
	  	teamAction.setWizardPageTitle(RSESamplesPlugin.getResourceString("filter.team.pagetitle")); //$NON-NLS-1$
	  	teamAction.setPage1Description(RSESamplesPlugin.getResourceString("filter.team.pagetext")); //$NON-NLS-1$
	  	teamAction.setType("team"); //$NON-NLS-1$
	  	teamAction.setText(RSESamplesPlugin.getResourceString("filter.team.pagetitle") + "..."); //$NON-NLS-1$ //$NON-NLS-2$
	  	
	  	SystemNewFilterAction devrAction = (SystemNewFilterAction)super.getNewFilterPoolFilterAction(factory, selectedPool, shell);    	
	  	devrAction.setWizardPageTitle(RSESamplesPlugin.getResourceString("filter.devr.pagetitle")); //$NON-NLS-1$
	  	devrAction.setPage1Description(RSESamplesPlugin.getResourceString("filter.devr.pagetext")); //$NON-NLS-1$
	  	devrAction.setType("devr"); //$NON-NLS-1$
	  	devrAction.setText(RSESamplesPlugin.getResourceString("filter.devr.pagetitle") + "..."); //$NON-NLS-1$ //$NON-NLS-2$
	  	devrAction.setFilterStringEditPane(new DeveloperFilterStringEditPane(shell));    	
	  	
	  	IAction[] actions = new IAction[2];
	  	actions[0] = teamAction;
	  	actions[1] = devrAction;
	  	return actions;
	 }
	  
	/**
	 * Override of parent method for returning the change-filter action, so we can affect it.
	 */
	protected IAction getChangeFilterAction(ISubSystemConfiguration factory, ISystemFilter selectedFilter, Shell shell)
	{
		SystemChangeFilterAction action = (SystemChangeFilterAction)super.getChangeFilterAction(factory, selectedFilter, shell);
	  	String type = selectedFilter.getType();
	  	if (type == null)
	  	  type = "team"; //$NON-NLS-1$ 
	  	if (type.equals("team")) //$NON-NLS-1$
	  	{
	  		action.setDialogTitle(RSESamplesPlugin.getResourceString("filter.team.dlgtitle")); //$NON-NLS-1$
	  	}
	  	else
	  	{
	  		action.setDialogTitle(RSESamplesPlugin.getResourceString("filter.devr.dlgtitle")); //$NON-NLS-1$
	  		action.setFilterStringEditPane(new DeveloperFilterStringEditPane(shell));
	  	}    
	  	return action;
	}    	

	/**
	 * Override of parent method for returning the image for filters in our subsystem.
	 * @see org.eclipse.rse.ui.view.SubSystemConfigurationAdapter#getSystemFilterImage(org.eclipse.rse.core.filters.ISystemFilter)
	 */
	public ImageDescriptor getSystemFilterImage(ISystemFilter filter)
	{
	  	String type = filter.getType();
	  	if (type == null)
	  	  type = "team"; //$NON-NLS-1$
	  	if (type.equals("team")) //$NON-NLS-1$
	   	  return RSESamplesPlugin.getDefault().getImageDescriptor("ICON_ID_TEAMFILTER"); //$NON-NLS-1$
	   	else
	   	  return RSESamplesPlugin.getDefault().getImageDescriptor("ICON_ID_DEVELOPERFILTER"); //$NON-NLS-1$
	}

}

Back to the top