View | Details | Raw Unified | Return to bug 189749
Collapse All | Expand All

(-)src/org/eclipse/rse/core/model/ISystemRegistry.java (-8 / +1 lines)
Lines 183-189 Link Here
183
183
184
	/**
184
	/**
185
	 * Return the profiles currently selected by the user as his "active" profiles
185
	 * Return the profiles currently selected by the user as his "active" profiles
186
	 * @see ISystemProfileManager.getActiveSystemProfiles()
186
	 * @see ISystemProfileManager#getActiveSystemProfiles()
187
	 */
187
	 */
188
	public ISystemProfile[] getActiveSystemProfiles();
188
	public ISystemProfile[] getActiveSystemProfiles();
189
189
Lines 208-220 Link Here
208
	public String[] getAllSystemProfileNames();
208
	public String[] getAllSystemProfileNames();
209
209
210
	/**
210
	/**
211
	 * Return all defined profile names as a vector
212
	 * @deprecated use getAllSystemProfileManager().getSystemProfiles()
213
	 *     and process the array to get a vector
214
	 */
215
	public Vector getAllSystemProfileNamesVector();
216
217
	/**
218
	 * Get a SystemProfile given its name
211
	 * Get a SystemProfile given its name
219
	 */
212
	 */
220
	public ISystemProfile getSystemProfile(String profileName);
213
	public ISystemProfile getSystemProfile(String profileName);
(-)src/org/eclipse/rse/core/model/ISystemProfileManager.java (-34 lines)
Lines 16-24 Link Here
16
16
17
package org.eclipse.rse.core.model;
17
package org.eclipse.rse.core.model;
18
18
19
import java.util.List;
20
import java.util.Vector;
21
22
/**
19
/**
23
 * Manages a list of SystemProfile objects. System profiles
20
 * Manages a list of SystemProfile objects. System profiles
24
 * should be created, deleted, restored, activated, and deactivated though
21
 * should be created, deleted, restored, activated, and deactivated though
Lines 61-71 Link Here
61
	public String[] getSystemProfileNames();
58
	public String[] getSystemProfileNames();
62
59
63
	/**
60
	/**
64
	 * @return a vector of all existing profile names.
65
	 */
66
	public Vector getSystemProfileNamesVector();
67
68
	/**
69
	 * Get a profile given its name.
61
	 * Get a profile given its name.
70
	 * @param name the name of the profile
62
	 * @param name the name of the profile
71
	 * @return the profile
63
	 * @return the profile
Lines 83-95 Link Here
83
	public String[] getActiveSystemProfileNames();
75
	public String[] getActiveSystemProfileNames();
84
76
85
	/**
77
	/**
86
	 * Get the index of a profile given its name.
87
	 * @param profileName the name of the profile to look for.
88
	 * @return 0-based position of the given active profile within the list of active profiles.
89
	 */
90
	public int getActiveSystemProfilePosition(String profileName);
91
92
	/**
93
	 * @return the default private profile created at first touch.
78
	 * @return the default private profile created at first touch.
94
	 * Will return null if it has been renamed.
79
	 * Will return null if it has been renamed.
95
	 */
80
	 */
Lines 133-160 Link Here
133
	public boolean isSystemProfileActive(String profileName);
118
	public boolean isSystemProfileActive(String profileName);
134
119
135
	/**
120
	/**
136
	 * @return The list of profiles known to this manager. This list is generated
137
	 * at the point of this call and may thus be manipulated by the caller.
138
	 */
139
	public List getProfiles();
140
	
141
	/**
142
	 * Adds a system profile to this profile manager.
121
	 * Adds a system profile to this profile manager.
143
	 * @param profile The system profile to add. 
122
	 * @param profile The system profile to add. 
144
	 */
123
	 */
145
	public void addSystemProfile(ISystemProfile profile);
124
	public void addSystemProfile(ISystemProfile profile);
146
	
125
	
147
	//	/**
148
	//	 * Reusable method to return a name validator for renaming a profile.
149
	//	 * @param the current profile name on updates. Can be null for new profiles. Used
150
	//	 *  to remove from the existing name list the current connection.
151
	//	 */
152
	//	public ISystemValidator getProfileNameValidator(String profileName);
153
	//	/**
154
	//	 * Reusable method to return a name validator for renaming a profile.
155
	//	 * @param the current profile object on updates. Can be null for new profiles. Used
156
	//	 *  to remove from the existing name list the current connection.
157
	//	 */
158
	//	public ISystemValidator getProfileNameValidator(ISystemProfile profile);
159
160
}
126
}
(-)src/org/eclipse/rse/internal/core/model/SystemProfileManager.java (-52 lines)
Lines 18-27 Link Here
18
package org.eclipse.rse.internal.core.model;
18
package org.eclipse.rse.internal.core.model;
19
19
20
import java.util.ArrayList;
20
import java.util.ArrayList;
21
import java.util.Arrays;
22
import java.util.Iterator;
21
import java.util.Iterator;
23
import java.util.List;
22
import java.util.List;
24
import java.util.Vector;
25
23
26
import org.eclipse.rse.core.RSECorePlugin;
24
import org.eclipse.rse.core.RSECorePlugin;
27
import org.eclipse.rse.core.RSEPreferencesManager;
25
import org.eclipse.rse.core.RSEPreferencesManager;
Lines 135-157 Link Here
135
//		return profileNames;
133
//		return profileNames;
136
	}
134
	}
137
135
138
	/* (non-Javadoc)
139
	 * @see org.eclipse.rse.core.model.ISystemProfileManager#getSystemProfileNamesVector()
140
	 */
141
	public Vector getSystemProfileNamesVector() {
142
		List names = Arrays.asList(getSystemProfileNames()); 
143
		Vector result = new Vector(names.size());
144
		result.addAll(names);
145
		return result;
146
//		if (profileNamesVector == null) {
147
//			ISystemProfile[] profiles = getSystemProfiles();
148
//			profileNamesVector = new Vector(profiles.length);
149
//			for (int idx = 0; idx < profiles.length; idx++)
150
//				profileNamesVector.addElement(profiles[idx].getName());
151
//		}
152
//		return profileNamesVector;
153
	}
154
155
//	/**
136
//	/**
156
//	 * Something changed so invalide cache of profiles so it will be regenerated
137
//	 * Something changed so invalide cache of profiles so it will be regenerated
157
//	 */
138
//	 */
Lines 367-396 Link Here
367
		return activeProfileNames;
348
		return activeProfileNames;
368
	}
349
	}
369
350
370
	/**
371
	 * @return the profile names currently selected by the user as "active" profiles
372
	 * @deprecated
373
	 */
374
	public Vector getActiveSystemProfileNamesVector() {
375
		String[] profileNames = RSEPreferencesManager.getActiveProfiles();
376
		Vector v = new Vector(profileNames.length);
377
		for (int idx = 0; idx < profileNames.length; idx++)
378
			v.addElement(profileNames[idx]);
379
		return v;
380
	}
381
382
	/* (non-Javadoc)
383
	 * @see org.eclipse.rse.core.model.ISystemProfileManager#getActiveSystemProfilePosition(java.lang.String)
384
	 */
385
	public int getActiveSystemProfilePosition(String profileName) {
386
		String[] profiles = getActiveSystemProfileNames();
387
		int pos = -1;
388
		for (int idx = 0; (pos < 0) && (idx < profiles.length); idx++) {
389
			if (profiles[idx].equals(profileName)) pos = idx;
390
		}
391
		return pos;
392
	}
393
394
	/* (non-Javadoc)
351
	/* (non-Javadoc)
395
	 * @see org.eclipse.rse.core.model.ISystemProfileManager#getDefaultPrivateSystemProfile()
352
	 * @see org.eclipse.rse.core.model.ISystemProfileManager#getDefaultPrivateSystemProfile()
396
	 */
353
	 */
Lines 406-420 Link Here
406
	}
363
	}
407
364
408
	/* (non-Javadoc)
365
	/* (non-Javadoc)
409
	 * @see org.eclipse.rse.core.model.ISystemProfileManager#getProfiles()
410
	 */
411
	public List getProfiles() {
412
		List result = new ArrayList(_profiles.size());
413
		result.addAll(_profiles);
414
		return result;
415
	}
416
	
417
	/* (non-Javadoc)
418
	 * @see org.eclipse.rse.core.model.ISystemProfileManager#getSize()
366
	 * @see org.eclipse.rse.core.model.ISystemProfileManager#getSize()
419
	 */
367
	 */
420
	public int getSize() {
368
	public int getSize() {
(-)src/org/eclipse/rse/tests/persistence/PersistenceTest.java (-11 / +8 lines)
Lines 13-21 Link Here
13
13
14
package org.eclipse.rse.tests.persistence;
14
package org.eclipse.rse.tests.persistence;
15
15
16
import java.util.Iterator;
17
import java.util.List;
18
19
import org.eclipse.core.runtime.OperationCanceledException;
16
import org.eclipse.core.runtime.OperationCanceledException;
20
import org.eclipse.core.runtime.jobs.IJobManager;
17
import org.eclipse.core.runtime.jobs.IJobManager;
21
import org.eclipse.core.runtime.jobs.Job;
18
import org.eclipse.core.runtime.jobs.Job;
Lines 74-88 Link Here
74
		/*
71
		/*
75
		 * There should be three profiles
72
		 * There should be three profiles
76
		 */
73
		 */
77
		List profiles = registry.getSystemProfileManager().getProfiles();
74
		ISystemProfile[] profiles = registry.getSystemProfileManager().getSystemProfiles();
78
		assertEquals(3, profiles.size());
75
		assertEquals(3, profiles.length);
79
		
76
		
80
		/*
77
		/*
81
		 * One should be default private profile
78
		 * One should be default private profile
82
		 */
79
		 */
83
		boolean found = false;
80
		boolean found = false;
84
		for (Iterator z = profiles.iterator(); z.hasNext() && !found;) {
81
		for (int i = 0; i < profiles.length && !found; i++) {
85
			ISystemProfile p = (ISystemProfile) z.next();
82
			ISystemProfile p = profiles[i];
86
			found = p.isDefaultPrivate();
83
			found = p.isDefaultPrivate();
87
		}
84
		}
88
		assertTrue("Default private profile not found", found);
85
		assertTrue("Default private profile not found", found);
Lines 91-98 Link Here
91
		 * One should be the team profile
88
		 * One should be the team profile
92
		 */
89
		 */
93
		found = false;
90
		found = false;
94
		for (Iterator z = profiles.iterator(); z.hasNext() && !found;) {
91
		for (int i = 0; i < profiles.length && !found; i++) {
95
			ISystemProfile p = (ISystemProfile) z.next();
92
			ISystemProfile p = profiles[i];
96
			found = p.getName().equals("Team");
93
			found = p.getName().equals("Team");
97
		}
94
		}
98
		assertTrue("Team profile not found", found);
95
		assertTrue("Team profile not found", found);
Lines 101-108 Link Here
101
		 * One should be the test profile
98
		 * One should be the test profile
102
		 */
99
		 */
103
		found = false;
100
		found = false;
104
		for (Iterator z = profiles.iterator(); z.hasNext() && !found;) {
101
		for (int i = 0; i < profiles.length && !found; i++) {
105
			ISystemProfile p = (ISystemProfile) z.next();
102
			ISystemProfile p = profiles[i];
106
			found = p.getName().equals("bogus");
103
			found = p.getName().equals("bogus");
107
		}
104
		}
108
		assertTrue("bogus profile not found", found);
105
		assertTrue("bogus profile not found", found);
(-)model/org/eclipse/rse/ui/internal/model/SystemRegistry.java (-8 lines)
Lines 519-532 Link Here
519
	{
519
	{
520
		return getSystemProfileManager().getSystemProfileNames();
520
		return getSystemProfileManager().getSystemProfileNames();
521
	}
521
	}
522
	/**
523
	 * Return all defined profile names as a vector
524
	 */
525
	public Vector getAllSystemProfileNamesVector()
526
	{
527
		Vector v = getSystemProfileManager().getSystemProfileNamesVector();
528
		return v;
529
	}
530
522
531
	/**
523
	/**
532
	 * Get a SystemProfile given its name
524
	 * Get a SystemProfile given its name
(-)UI/org/eclipse/rse/ui/validators/ValidatorConnectionName.java (-4 / +5 lines)
Lines 17-22 Link Here
17
package org.eclipse.rse.ui.validators;
17
package org.eclipse.rse.ui.validators;
18
import java.util.Vector;
18
import java.util.Vector;
19
19
20
import org.eclipse.rse.core.RSECorePlugin;
20
import org.eclipse.rse.core.model.IHost;
21
import org.eclipse.rse.core.model.IHost;
21
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
22
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
22
import org.eclipse.rse.ui.ISystemMessages;
23
import org.eclipse.rse.ui.ISystemMessages;
Lines 60-70 Link Here
60
	public static boolean validateNameNotInUse(String proposedName, Shell shell)
61
	public static boolean validateNameNotInUse(String proposedName, Shell shell)
61
	{
62
	{
62
		SystemMessage msg = null;
63
		SystemMessage msg = null;
63
		Vector profileNames = RSEUIPlugin.getTheSystemProfileManager().getSystemProfileNamesVector();
64
    	String[] names = RSECorePlugin.getTheSystemRegistry().getSystemProfileManager().getSystemProfileNames();
64
		String profileName = null;
65
    	String profileName = null;
65
		for (int idx=0; (msg==null)&& (idx<profileNames.size()); idx++)
66
    	for (int idx = 0; (msg == null) && (idx < names.length); idx++)
66
		{
67
		{
67
			profileName = (String)profileNames.elementAt(idx);
68
			profileName = names[idx];
68
			IHost[] conns = RSEUIPlugin.getTheSystemProfileManager().getSystemProfile(profileName).getHosts();
69
			IHost[] conns = RSEUIPlugin.getTheSystemProfileManager().getSystemProfile(profileName).getHosts();
69
			for (int jdx=0; (msg==null) && (jdx<conns.length); jdx++)
70
			for (int jdx=0; (msg==null) && (jdx<conns.length); jdx++)
70
			{				
71
			{				
(-)UI/org/eclipse/rse/ui/validators/ValidatorFactory.java (-3 / +6 lines)
Lines 11-16 Link Here
11
11
12
package org.eclipse.rse.ui.validators;
12
package org.eclipse.rse.ui.validators;
13
13
14
import java.util.Arrays;
14
import java.util.Vector;
15
import java.util.Vector;
15
16
16
import org.eclipse.rse.core.RSECorePlugin;
17
import org.eclipse.rse.core.RSECorePlugin;
Lines 29-37 Link Here
29
	 */
30
	 */
30
	public static ISystemValidator getProfileNameValidator(String profileName) {
31
	public static ISystemValidator getProfileNameValidator(String profileName) {
31
		ISystemProfileManager manager = RSECorePlugin.getTheSystemRegistry().getSystemProfileManager();
32
		ISystemProfileManager manager = RSECorePlugin.getTheSystemRegistry().getSystemProfileManager();
32
		Vector profileNames = manager.getSystemProfileNamesVector();
33
    	String[] nameArray = manager.getSystemProfileNames();
33
		if (profileName != null) profileNames.remove(profileName);
34
    	Vector names = new Vector(nameArray.length);
34
		ISystemValidator nameValidator = new ValidatorProfileName(profileNames);
35
    	names.addAll(Arrays.asList(nameArray));
36
		if (profileName != null) names.remove(profileName);
37
		ISystemValidator nameValidator = new ValidatorProfileName(names);
35
		return nameValidator;
38
		return nameValidator;
36
	}
39
	}
37
40
(-)UI/org/eclipse/rse/internal/ui/view/team/SystemTeamViewProfileAdapter.java (-1 / +4 lines)
Lines 20-25 Link Here
20
 ********************************************************************************/
20
 ********************************************************************************/
21
21
22
package org.eclipse.rse.internal.ui.view.team;
22
package org.eclipse.rse.internal.ui.view.team;
23
import java.util.Arrays;
23
import java.util.Hashtable;
24
import java.util.Hashtable;
24
import java.util.Vector;
25
import java.util.Vector;
25
26
Lines 379-385 Link Here
379
	 */
380
	 */
380
    public ISystemValidator getNameValidator(Object element)
381
    public ISystemValidator getNameValidator(Object element)
381
    {
382
    {
382
    	Vector names = RSECorePlugin.getTheSystemRegistry().getSystemProfileManager().getSystemProfileNamesVector();
383
    	String[] nameArray = RSECorePlugin.getTheSystemRegistry().getSystemProfileManager().getSystemProfileNames();
384
    	Vector names = new Vector(nameArray.length);
385
    	names.addAll(Arrays.asList(nameArray));
383
    	ISystemValidator validator = new ValidatorProfileName(names);
386
    	ISystemValidator validator = new ValidatorProfileName(names);
384
		return validator;
387
		return validator;
385
    }
388
    }

Return to bug 189749