Lines 1-17
Link Here
|
1 |
/******************************************************************************** |
1 |
/******************************************************************************** |
2 |
* Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved. |
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 |
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 |
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 |
5 |
* available at http://www.eclipse.org/legal/epl-v10.html |
6 |
* |
6 |
* |
7 |
* Initial Contributors: |
7 |
* Initial Contributors: |
8 |
* The following IBM employees contributed to the Remote System Explorer |
8 |
* The following IBM employees contributed to the Remote System Explorer |
9 |
* component that contains this file: David McKnight, Kushal Munir, |
9 |
* component that contains this file: David McKnight, Kushal Munir, |
10 |
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, |
10 |
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, |
11 |
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. |
11 |
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. |
12 |
* |
12 |
* |
13 |
* Contributors: |
13 |
* Contributors: |
14 |
* Martin Oberhuber (Wind River) - [175262] IHost.getSystemType() should return IRSESystemType |
14 |
* Martin Oberhuber (Wind River) - [175262] IHost.getSystemType() should return IRSESystemType |
15 |
* Martin Oberhuber (Wind River) - [186640] Add IRSESystemType.testProperty() |
15 |
* Martin Oberhuber (Wind River) - [186640] Add IRSESystemType.testProperty() |
16 |
* Justin Lin (IBM) - [244051] JJ: Environment Variables property page allows duplicates... |
16 |
* Justin Lin (IBM) - [244051] JJ: Environment Variables property page allows duplicates... |
17 |
********************************************************************************/ |
17 |
********************************************************************************/ |
Lines 87-105
Link Here
|
87 |
public class EnvironmentVariable { |
87 |
public class EnvironmentVariable { |
88 |
protected String _name; |
88 |
protected String _name; |
89 |
protected String _value; |
89 |
protected String _value; |
90 |
|
90 |
|
91 |
public EnvironmentVariable(String name, String value) |
91 |
public EnvironmentVariable(String name, String value) |
92 |
{ |
92 |
{ |
93 |
_name = name; |
93 |
_name = name; |
94 |
_value = value; |
94 |
_value = value; |
95 |
} |
95 |
} |
96 |
|
96 |
|
97 |
public String getName() { return _name;} |
97 |
public String getName() { return _name;} |
98 |
public String getValue() { return _value;} |
98 |
public String getValue() { return _value;} |
99 |
public void setName(String name) {_name = name;} |
99 |
public void setName(String name) {_name = name;} |
100 |
public void setValue(String value) { _value = value;} |
100 |
public void setValue(String value) { _value = value;} |
101 |
} |
101 |
} |
102 |
|
102 |
|
103 |
protected class EnvironmentVariablesTableContentProvider implements IStructuredContentProvider, |
103 |
protected class EnvironmentVariablesTableContentProvider implements IStructuredContentProvider, |
104 |
ITableLabelProvider, |
104 |
ITableLabelProvider, |
105 |
ICellModifier, ICellEditorValidator |
105 |
ICellModifier, ICellEditorValidator |
Lines 161-167
Link Here
|
161 |
} |
161 |
} |
162 |
|
162 |
|
163 |
// yantzi:2.1.2 Added ability to directly edit in env var table |
163 |
// yantzi:2.1.2 Added ability to directly edit in env var table |
164 |
|
164 |
|
165 |
/* (non-Javadoc) |
165 |
/* (non-Javadoc) |
166 |
* @see org.eclipse.jface.viewers.ICellModifier#canModify(java.lang.Object, java.lang.String) |
166 |
* @see org.eclipse.jface.viewers.ICellModifier#canModify(java.lang.Object, java.lang.String) |
167 |
*/ |
167 |
*/ |
Lines 174-185
Link Here
|
174 |
*/ |
174 |
*/ |
175 |
public Object getValue(Object element, String property) { |
175 |
public Object getValue(Object element, String property) { |
176 |
if (VAR_NAME.equals(property)) |
176 |
if (VAR_NAME.equals(property)) |
177 |
{ |
177 |
{ |
178 |
return ((EnvironmentVariable) element).getName(); |
178 |
return ((EnvironmentVariable) element).getName(); |
179 |
} |
179 |
} |
180 |
else // VAR_VALUE |
180 |
else // VAR_VALUE |
181 |
{ |
181 |
{ |
182 |
return ((EnvironmentVariable) element).getValue(); |
182 |
return ((EnvironmentVariable) element).getValue(); |
183 |
} |
183 |
} |
184 |
} |
184 |
} |
185 |
|
185 |
|
Lines 187-208
Link Here
|
187 |
* @see org.eclipse.jface.viewers.ICellModifier#modify(java.lang.Object, java.lang.String, java.lang.Object) |
187 |
* @see org.eclipse.jface.viewers.ICellModifier#modify(java.lang.Object, java.lang.String, java.lang.Object) |
188 |
*/ |
188 |
*/ |
189 |
public void modify(Object element, String property, Object value) { |
189 |
public void modify(Object element, String property, Object value) { |
190 |
if (VAR_NAME.equals(property)) |
190 |
if (VAR_NAME.equals(property)) |
191 |
{ |
191 |
{ |
192 |
SystemMessage msg = validateName((String)value); |
192 |
SystemMessage msg = validateName((String)value); |
193 |
if (msg != null) |
193 |
if (msg != null) |
194 |
{ |
194 |
{ |
195 |
getMessageLine().setErrorMessage(msg); |
195 |
getMessageLine().setErrorMessage(msg); |
196 |
} |
196 |
} |
197 |
else |
197 |
else |
198 |
{ |
198 |
{ |
199 |
if (invalidNameChars != null && invalidNameChars.indexOf(' ') != -1) |
199 |
if (invalidNameChars != null && invalidNameChars.indexOf(' ') != -1) |
200 |
{ |
200 |
{ |
201 |
((EnvironmentVariable) ((TableItem)element).getData()).setName(((String) value).trim()); |
201 |
((EnvironmentVariable) ((TableItem)element).getData()).setName(((String) value).trim()); |
202 |
} |
202 |
} |
203 |
else |
203 |
else |
204 |
{ |
204 |
{ |
205 |
((EnvironmentVariable) ((TableItem)element).getData()).setName((String) value); |
205 |
((EnvironmentVariable) ((TableItem)element).getData()).setName((String) value); |
206 |
} |
206 |
} |
207 |
getMessageLine().clearErrorMessage(); |
207 |
getMessageLine().clearErrorMessage(); |
208 |
} |
208 |
} |
Lines 212-224
Link Here
|
212 |
((EnvironmentVariable) ((TableItem)element).getData()).setValue((String) value); |
212 |
((EnvironmentVariable) ((TableItem)element).getData()).setValue((String) value); |
213 |
} |
213 |
} |
214 |
|
214 |
|
215 |
envVarTableViewer.refresh(); |
215 |
envVarTableViewer.refresh(); |
216 |
} |
216 |
} |
217 |
|
217 |
|
218 |
/* (non-Javadoc) |
218 |
/* (non-Javadoc) |
219 |
* @see org.eclipse.jface.viewers.ICellEditorValidator#isValid(java.lang.Object) |
219 |
* @see org.eclipse.jface.viewers.ICellEditorValidator#isValid(java.lang.Object) |
220 |
*/ |
220 |
*/ |
221 |
public String isValid(Object value) |
221 |
public String isValid(Object value) |
222 |
{ |
222 |
{ |
223 |
SystemMessage msg = validateName((String) value); |
223 |
SystemMessage msg = validateName((String) value); |
224 |
if (msg != null) |
224 |
if (msg != null) |
Lines 246-267
Link Here
|
246 |
this.invalidNameChars = invalidNameChars; |
246 |
this.invalidNameChars = invalidNameChars; |
247 |
envVars = new Vector(); |
247 |
envVars = new Vector(); |
248 |
provider = new EnvironmentVariablesTableContentProvider(); |
248 |
provider = new EnvironmentVariablesTableContentProvider(); |
249 |
|
249 |
|
250 |
if (selectedObject instanceof ISubSystem) |
250 |
if (selectedObject instanceof ISubSystem) |
251 |
{ |
251 |
{ |
252 |
systemType = ((ISubSystem) selectedObject).getHost().getSystemType(); |
252 |
systemType = ((ISubSystem) selectedObject).getHost().getSystemType(); |
253 |
} |
253 |
} |
254 |
|
254 |
|
255 |
} |
255 |
} |
256 |
|
256 |
|
257 |
/** |
257 |
/** |
258 |
* @see org.eclipse.rse.ui.SystemBaseForm#createContents(Composite) |
258 |
* @see org.eclipse.rse.ui.SystemBaseForm#createContents(Composite) |
259 |
*/ |
259 |
*/ |
260 |
public Control createContents(Composite parent) { |
260 |
public Control createContents(Composite parent) { |
261 |
|
261 |
|
262 |
SystemWidgetHelpers.createLabel(parent, SystemResources.RESID_SUBSYSTEM_ENVVAR_DESCRIPTION); |
262 |
SystemWidgetHelpers.createLabel(parent, SystemResources.RESID_SUBSYSTEM_ENVVAR_DESCRIPTION); |
263 |
|
263 |
|
264 |
// Environment Variables List |
264 |
// Environment Variables List |
265 |
envVarTable = new Table(parent, SWT.FULL_SELECTION |SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER); |
265 |
envVarTable = new Table(parent, SWT.FULL_SELECTION |SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER); |
266 |
envVarTable.setLinesVisible(true); |
266 |
envVarTable.setLinesVisible(true); |
267 |
envVarTable.setHeaderVisible(true); |
267 |
envVarTable.setHeaderVisible(true); |
Lines 273-298
Link Here
|
273 |
tableLayout.addColumnData(new ColumnWeightData(100, true)); |
273 |
tableLayout.addColumnData(new ColumnWeightData(100, true)); |
274 |
tableLayout.addColumnData(new ColumnWeightData(100, true)); |
274 |
tableLayout.addColumnData(new ColumnWeightData(100, true)); |
275 |
envVarTable.setLayout(tableLayout); |
275 |
envVarTable.setLayout(tableLayout); |
276 |
|
276 |
|
277 |
GridData gd = new GridData(GridData.FILL_BOTH); |
277 |
GridData gd = new GridData(GridData.FILL_BOTH); |
278 |
gd.grabExcessHorizontalSpace = true; |
278 |
gd.grabExcessHorizontalSpace = true; |
279 |
gd.grabExcessVerticalSpace = true; |
279 |
gd.grabExcessVerticalSpace = true; |
280 |
gd.heightHint = 200; |
280 |
gd.heightHint = 200; |
281 |
envVarTable.setLayoutData(gd); |
281 |
envVarTable.setLayoutData(gd); |
282 |
|
282 |
|
283 |
// Name column |
283 |
// Name column |
284 |
TableColumn hostnameColumn = new TableColumn(envVarTable, SWT.NONE); |
284 |
TableColumn hostnameColumn = new TableColumn(envVarTable, SWT.NONE); |
285 |
hostnameColumn.setText(SystemResources.RESID_SUBSYSTEM_ENVVAR_NAME_TITLE); |
285 |
hostnameColumn.setText(SystemResources.RESID_SUBSYSTEM_ENVVAR_NAME_TITLE); |
286 |
|
286 |
|
287 |
// Value column |
287 |
// Value column |
288 |
TableColumn sysTypeColumn = new TableColumn(envVarTable, SWT.NONE); |
288 |
TableColumn sysTypeColumn = new TableColumn(envVarTable, SWT.NONE); |
289 |
sysTypeColumn.setText(SystemResources.RESID_SUBSYSTEM_ENVVAR_VALUE_TITLE); |
289 |
sysTypeColumn.setText(SystemResources.RESID_SUBSYSTEM_ENVVAR_VALUE_TITLE); |
290 |
|
290 |
|
291 |
envVarTableViewer = new TableViewer(envVarTable); |
291 |
envVarTableViewer = new TableViewer(envVarTable); |
292 |
envVarTableViewer.setContentProvider(provider); |
292 |
envVarTableViewer.setContentProvider(provider); |
293 |
envVarTableViewer.setLabelProvider(provider); |
293 |
envVarTableViewer.setLabelProvider(provider); |
294 |
|
294 |
|
295 |
// yantzi:2.1.2 Added ability to directly edit in env var table |
295 |
// yantzi:2.1.2 Added ability to directly edit in env var table |
296 |
envVarTableViewer.setCellModifier(provider); |
296 |
envVarTableViewer.setCellModifier(provider); |
297 |
envVarTableViewer.setColumnProperties(COLUMN_PROPERTIES); |
297 |
envVarTableViewer.setColumnProperties(COLUMN_PROPERTIES); |
298 |
|
298 |
|
Lines 301-310
Link Here
|
301 |
cellEditors[0].setValidator(provider); |
301 |
cellEditors[0].setValidator(provider); |
302 |
cellEditors[1] = new TextCellEditor(envVarTable); |
302 |
cellEditors[1] = new TextCellEditor(envVarTable); |
303 |
envVarTableViewer.setCellEditors(cellEditors); |
303 |
envVarTableViewer.setCellEditors(cellEditors); |
304 |
|
304 |
|
305 |
envVarTableViewer.setInput(selectedObject); |
305 |
envVarTableViewer.setInput(selectedObject); |
306 |
|
306 |
|
307 |
// Create the buttons for add, change, remove, move up and move down |
307 |
// Create the buttons for add, change, remove, move up and move down |
308 |
Composite buttonBar = SystemWidgetHelpers.createComposite(parent, 5); |
308 |
Composite buttonBar = SystemWidgetHelpers.createComposite(parent, 5); |
309 |
|
309 |
|
310 |
addButton = SystemWidgetHelpers.createPushButton(buttonBar, SystemResources.RESID_PREF_SIGNON_ADD_LABEL, null); |
310 |
addButton = SystemWidgetHelpers.createPushButton(buttonBar, SystemResources.RESID_PREF_SIGNON_ADD_LABEL, null); |
Lines 332-338
Link Here
|
332 |
moveDownButton.setEnabled(false); |
332 |
moveDownButton.setEnabled(false); |
333 |
|
333 |
|
334 |
SystemWidgetHelpers.setCompositeHelp(parent, RSEUIPlugin.HELPPREFIX + "envv0000"); //$NON-NLS-1$ |
334 |
SystemWidgetHelpers.setCompositeHelp(parent, RSEUIPlugin.HELPPREFIX + "envv0000"); //$NON-NLS-1$ |
335 |
|
335 |
|
336 |
return parent; |
336 |
return parent; |
337 |
} |
337 |
} |
338 |
|
338 |
|
Lines 352-388
Link Here
|
352 |
{ |
352 |
{ |
353 |
existingNames[i] = ((EnvironmentVariable) envVars.get(i))._name; |
353 |
existingNames[i] = ((EnvironmentVariable) envVars.get(i))._name; |
354 |
} |
354 |
} |
355 |
|
355 |
|
356 |
return existingNames; |
356 |
return existingNames; |
357 |
} |
357 |
} |
358 |
|
358 |
|
359 |
/** |
359 |
/** |
360 |
* @see org.eclipse.swt.events.SelectionListener#widgetSelected(SelectionEvent) |
360 |
* @see org.eclipse.swt.events.SelectionListener#widgetSelected(SelectionEvent) |
361 |
*/ |
361 |
*/ |
362 |
public void widgetSelected(SelectionEvent e) { |
362 |
public void widgetSelected(SelectionEvent e) { |
363 |
|
363 |
|
364 |
if (e.getSource() == addButton) |
364 |
if (e.getSource() == addButton) |
365 |
{ |
365 |
{ |
366 |
// Prompt the user for the new environment variable |
366 |
// Prompt the user for the new environment variable |
367 |
EnvironmentVariablesPromptDialog dialog = |
367 |
EnvironmentVariablesPromptDialog dialog = |
368 |
new EnvironmentVariablesPromptDialog( |
368 |
new EnvironmentVariablesPromptDialog( |
369 |
getShell(), |
369 |
getShell(), |
370 |
SystemResources.RESID_SUBSYSTEM_ENVVAR_ADD_TITLE, |
370 |
SystemResources.RESID_SUBSYSTEM_ENVVAR_ADD_TITLE, |
371 |
systemType, |
371 |
systemType, |
372 |
invalidNameChars, |
372 |
invalidNameChars, |
373 |
getVariableNames(), |
373 |
getVariableNames(), |
374 |
false); |
374 |
false); |
375 |
|
375 |
|
376 |
if (dialog.open() == Window.OK) { |
376 |
if (dialog.open() == Window.OK) { |
377 |
// Add new variable to model |
377 |
// Add new variable to model |
378 |
EnvironmentVariable var = new EnvironmentVariable(dialog.getName(), dialog.getValue()); |
378 |
EnvironmentVariable var = new EnvironmentVariable(dialog.getName(), dialog.getValue()); |
379 |
envVars.add(var); |
379 |
envVars.add(var); |
380 |
envVarTableViewer.refresh(); |
380 |
envVarTableViewer.refresh(); |
381 |
|
381 |
|
382 |
//dy defect 47040 position table so new variable is shown |
382 |
//dy defect 47040 position table so new variable is shown |
383 |
envVarTableViewer.reveal(var); |
383 |
envVarTableViewer.reveal(var); |
384 |
} |
384 |
} |
385 |
} |
385 |
} |
386 |
else if (e.getSource() == removeButton) |
386 |
else if (e.getSource() == removeButton) |
387 |
{ |
387 |
{ |
388 |
int[] selections = envVarTable.getSelectionIndices(); |
388 |
int[] selections = envVarTable.getSelectionIndices(); |
Lines 401-420
Link Here
|
401 |
{ |
401 |
{ |
402 |
int[] selections = envVarTable.getSelectionIndices(); |
402 |
int[] selections = envVarTable.getSelectionIndices(); |
403 |
envVarTable.deselectAll(); |
403 |
envVarTable.deselectAll(); |
404 |
|
404 |
|
405 |
if (selections != null) { |
405 |
if (selections != null) { |
406 |
// Move the selected objects up one position in the table |
406 |
// Move the selected objects up one position in the table |
407 |
Object temp; |
407 |
Object temp; |
408 |
for (int loop=0; loop < selections.length; loop++) { |
408 |
for (int loop=0; loop < selections.length; loop++) { |
409 |
temp = envVars.remove(selections[loop]); |
409 |
temp = envVars.remove(selections[loop]); |
410 |
envVars.add(selections[loop] - 1, temp); |
410 |
envVars.add(selections[loop] - 1, temp); |
411 |
} |
411 |
} |
412 |
|
412 |
|
413 |
envVarTableViewer.refresh(); |
413 |
envVarTableViewer.refresh(); |
414 |
|
414 |
|
415 |
//dy defect 47040 position table so top variable is shown |
415 |
//dy defect 47040 position table so top variable is shown |
416 |
envVarTableViewer.reveal(envVars.get(selections[0] - 1)); |
416 |
envVarTableViewer.reveal(envVars.get(selections[0] - 1)); |
417 |
|
417 |
|
418 |
// Reselect the entries |
418 |
// Reselect the entries |
419 |
for (int loop=0; loop < selections.length; loop++) { |
419 |
for (int loop=0; loop < selections.length; loop++) { |
420 |
if (selections[loop] > 0) |
420 |
if (selections[loop] > 0) |
Lines 428-436
Link Here
|
428 |
{ |
428 |
{ |
429 |
int[] selections = envVarTable.getSelectionIndices(); |
429 |
int[] selections = envVarTable.getSelectionIndices(); |
430 |
envVarTable.deselectAll(); |
430 |
envVarTable.deselectAll(); |
431 |
|
431 |
|
432 |
// move the selected entries down one position in the table |
432 |
// move the selected entries down one position in the table |
433 |
if (selections != null) { |
433 |
if (selections != null) { |
434 |
Object temp; |
434 |
Object temp; |
435 |
for (int loop=selections.length - 1; loop >= 0; loop--) { |
435 |
for (int loop=selections.length - 1; loop >= 0; loop--) { |
436 |
if (selections[loop] < envVars.size() - 1) { |
436 |
if (selections[loop] < envVars.size() - 1) { |
Lines 443-449
Link Here
|
443 |
|
443 |
|
444 |
//dy defect 47040 position table so bottom variable is shown |
444 |
//dy defect 47040 position table so bottom variable is shown |
445 |
envVarTableViewer.reveal(envVars.get(selections[selections.length - 1] + 1)); |
445 |
envVarTableViewer.reveal(envVars.get(selections[selections.length - 1] + 1)); |
446 |
|
446 |
|
447 |
// reselect the entries |
447 |
// reselect the entries |
448 |
for (int loop=0; loop < selections.length; loop++) { |
448 |
for (int loop=0; loop < selections.length; loop++) { |
449 |
if (selections[loop] < envVars.size() - 1) |
449 |
if (selections[loop] < envVars.size() - 1) |
Lines 467-481
Link Here
|
467 |
for (int loop = 0; loop < selectionIndices.length; loop++) { |
467 |
for (int loop = 0; loop < selectionIndices.length; loop++) { |
468 |
if (selectionIndices[loop] == 0) |
468 |
if (selectionIndices[loop] == 0) |
469 |
upEnabled = false; |
469 |
upEnabled = false; |
470 |
|
470 |
|
471 |
if (selectionIndices[loop] == (envVarTable.getItemCount() - 1)) |
471 |
if (selectionIndices[loop] == (envVarTable.getItemCount() - 1)) |
472 |
downEnabled = false; |
472 |
downEnabled = false; |
473 |
} |
473 |
} |
474 |
|
474 |
|
475 |
if (selectionIndices.length == 1) |
475 |
if (selectionIndices.length == 1) |
476 |
{ |
476 |
{ |
477 |
changeButton.setEnabled(true); |
477 |
changeButton.setEnabled(true); |
478 |
} |
478 |
} |
479 |
else |
479 |
else |
480 |
{ |
480 |
{ |
481 |
changeButton.setEnabled(false); |
481 |
changeButton.setEnabled(false); |
Lines 497-503
Link Here
|
497 |
|
497 |
|
498 |
/** |
498 |
/** |
499 |
* Set the input for the environment variables table |
499 |
* Set the input for the environment variables table |
500 |
*/ |
500 |
*/ |
501 |
public void setEnvVars(Vector envVars) |
501 |
public void setEnvVars(Vector envVars) |
502 |
{ |
502 |
{ |
503 |
this.envVars = envVars; |
503 |
this.envVars = envVars; |
Lines 506-514
Link Here
|
506 |
envVarTableViewer.refresh(); |
506 |
envVarTableViewer.refresh(); |
507 |
} |
507 |
} |
508 |
} |
508 |
} |
509 |
|
509 |
|
510 |
/** |
510 |
/** |
511 |
* Helper method so the same code can be run when the user selets the chagne button or |
511 |
* Helper method so the same code can be run when the user selets the chagne button or |
512 |
* double clicks in the table. |
512 |
* double clicks in the table. |
513 |
*/ |
513 |
*/ |
514 |
private void changeCurrentlySelectedVariable() |
514 |
private void changeCurrentlySelectedVariable() |
Lines 518-541
Link Here
|
518 |
{ |
518 |
{ |
519 |
EnvironmentVariablesPromptDialog dialog = new |
519 |
EnvironmentVariablesPromptDialog dialog = new |
520 |
EnvironmentVariablesPromptDialog( |
520 |
EnvironmentVariablesPromptDialog( |
521 |
getShell(), |
521 |
getShell(), |
522 |
SystemResources.RESID_SUBSYSTEM_ENVVAR_CHANGE_TITLE, |
522 |
SystemResources.RESID_SUBSYSTEM_ENVVAR_CHANGE_TITLE, |
523 |
systemType, |
523 |
systemType, |
524 |
invalidNameChars, |
524 |
invalidNameChars, |
525 |
getVariableNames(), |
525 |
getVariableNames(), |
526 |
true); |
526 |
true); |
527 |
dialog.setName(((EnvironmentVariable)envVars.get(selections[0])).getName()); |
527 |
dialog.setName(((EnvironmentVariable)envVars.get(selections[0])).getName()); |
528 |
dialog.setValue(((EnvironmentVariable)envVars.get(selections[0])).getValue()); |
528 |
dialog.setValue(((EnvironmentVariable)envVars.get(selections[0])).getValue()); |
529 |
|
529 |
|
530 |
if (dialog.open() == Window.OK) |
530 |
if (dialog.open() == Window.OK) |
531 |
{ |
531 |
{ |
532 |
envVars.remove(selections[0]); |
532 |
envVars.remove(selections[0]); |
533 |
envVars.add(selections[0], new EnvironmentVariable(dialog.getName(), dialog.getValue())); |
533 |
envVars.add(selections[0], new EnvironmentVariable(dialog.getName(), dialog.getValue())); |
534 |
envVarTableViewer.refresh(); |
534 |
envVarTableViewer.refresh(); |
535 |
} |
535 |
} |
536 |
} |
536 |
} |
537 |
} |
537 |
} |
538 |
|
538 |
|
539 |
/** |
539 |
/** |
540 |
* @see org.eclipse.swt.events.MouseListener#mouseDoubleClick(MouseEvent) |
540 |
* @see org.eclipse.swt.events.MouseListener#mouseDoubleClick(MouseEvent) |
541 |
*/ |
541 |
*/ |
Lines 568-574
Link Here
|
568 |
String name = value; |
568 |
String name = value; |
569 |
if (name == null || name.trim().equals("")) //$NON-NLS-1$ |
569 |
if (name == null || name.trim().equals("")) //$NON-NLS-1$ |
570 |
{ |
570 |
{ |
571 |
msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_COMM_ENVVAR_NONAME); |
571 |
msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_COMM_ENVVAR_NONAME); |
572 |
} |
572 |
} |
573 |
else |
573 |
else |
574 |
{ |
574 |
{ |
Lines 580-596
Link Here
|
580 |
} |
580 |
} |
581 |
|
581 |
|
582 |
// first check for invalid characters |
582 |
// first check for invalid characters |
583 |
if (invalidNameChars != null) |
583 |
for (int i = 0; i < invalidNameChars.length() && msg == null; i++) |
584 |
{ |
584 |
{ |
585 |
for (int i = 0; i < invalidNameChars.length() && msg == null; i++) |
585 |
if (name.indexOf(invalidNameChars.charAt(i)) != -1) |
586 |
{ |
586 |
{ |
587 |
if (name.indexOf(invalidNameChars.charAt(i)) != -1) |
587 |
msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_COMM_ENVVAR_INVALIDCHAR); |
588 |
{ |
|
|
589 |
msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_COMM_ENVVAR_INVALIDCHAR); |
590 |
} |
591 |
} |
588 |
} |
592 |
} |
589 |
} |
593 |
|
590 |
} |
|
|
591 |
if (msg == null) { |
594 |
// next check for duplicate env var names |
592 |
// next check for duplicate env var names |
595 |
int itemCount = envVarTable.getItemCount(); |
593 |
int itemCount = envVarTable.getItemCount(); |
596 |
for (int i = 0; i < itemCount; i++) { |
594 |
for (int i = 0; i < itemCount; i++) { |
Lines 602-610
Link Here
|
602 |
break; |
600 |
break; |
603 |
} |
601 |
} |
604 |
} |
602 |
} |
605 |
} |
603 |
} |
606 |
} |
604 |
} |
607 |
|
605 |
|
608 |
return msg; |
606 |
return msg; |
609 |
} |
607 |
} |
610 |
} |
608 |
} |