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

Collapse All | Expand All

(-)src/org/eclipse/ui/ide/dialogs/PathVariableSelectionDialog.java (+1 lines)
Lines 88-93 Link Here
88
                        updateExtendButtonState();
88
                        updateExtendButtonState();
89
                    }
89
                    }
90
                });
90
                });
91
        pathVariablesGroup.setSaveVariablesOnChange(true);
91
        setShellStyle(getShellStyle() | SWT.SHEET);
92
        setShellStyle(getShellStyle() | SWT.SHEET);
92
    }
93
    }
93
94
(-)src/org/eclipse/ui/internal/ide/dialogs/PathVariableDialog.java (-23 / +28 lines)
Lines 318-324 Link Here
318
        Composite buttonsComposite = new Composite(contents, SWT.NONE);
318
        Composite buttonsComposite = new Composite(contents, SWT.NONE);
319
        buttonsComposite.setLayoutData(new GridData(SWT.END, SWT.CENTER, false,
319
        buttonsComposite.setLayoutData(new GridData(SWT.END, SWT.CENTER, false,
320
        		false, 1, 1));
320
        		false, 1, 1));
321
        GridLayout layout = new GridLayout(1, true);
321
        GridLayout layout = new GridLayout(0, true);
322
        layout.marginWidth = 0;
322
        layout.marginWidth = 0;
323
        layout.marginHeight = 0;
323
        layout.marginHeight = 0;
324
        buttonsComposite.setLayout(layout);
324
        buttonsComposite.setLayout(layout);
Lines 355-382 Link Here
355
	        setButtonLayoutData(folderButton);
355
	        setButtonLayoutData(folderButton);
356
        }
356
        }
357
357
358
    	variableButton = new Button(buttonsComposite, SWT.PUSH);
358
        // the workspace path variable manager does not support variables.
359
    	variableButton.setText(IDEWorkbenchMessages.PathVariableDialog_variable);
359
        if (currentResource != null) {
360
360
        	layout.numColumns++;
361
 	    variableButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false,
361
	    	variableButton = new Button(buttonsComposite, SWT.PUSH);
362
    		false));
362
	    	variableButton.setText(IDEWorkbenchMessages.PathVariableDialog_variable);
363
363
	
364
        variableButton.addSelectionListener(new SelectionAdapter() {
364
	 	    variableButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false,
365
            public void widgetSelected(SelectionEvent e) {
365
	    		false));
366
                selectVariable();
366
	
367
            }
367
	        variableButton.addSelectionListener(new SelectionAdapter() {
368
        });
368
	            public void widgetSelected(SelectionEvent e) {
369
        setButtonLayoutData(variableButton);
369
	                selectVariable();
370
	            }
371
	        });
372
	        setButtonLayoutData(variableButton);
370
373
371
        // variable value label
374
	        // variable value label
372
        variableResolvedValueLabel = new Label(contents, SWT.LEAD);
375
	        variableResolvedValueLabel = new Label(contents, SWT.LEAD);
373
        variableResolvedValueLabel.setText(resolvedValueLabelText);
376
	        variableResolvedValueLabel.setText(resolvedValueLabelText);
374
377
375
        // variable value field.  Attachments done after all widgets created.
378
	        // variable value field.  Attachments done after all widgets created.
376
        variableResolvedValueField = new Label(contents, SWT.LEAD | SWT.SINGLE | SWT.READ_ONLY);
379
	        variableResolvedValueField = new Label(contents, SWT.LEAD | SWT.SINGLE | SWT.READ_ONLY);
377
        variableResolvedValueField.setText(TextProcessor.process(getVariableResolvedValue()));
380
	        variableResolvedValueField.setText(TextProcessor.process(getVariableResolvedValue()));
378
        variableResolvedValueField.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true,
381
	        variableResolvedValueField.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true,
379
        		false, 2, 1));
382
	        		false, 2, 1));
383
        }
380
    }
384
    }
381
385
382
    private IPathVariableManager getPathVariableManager() {
386
    private IPathVariableManager getPathVariableManager() {
Lines 439-445 Link Here
439
        validationStatus = IMessageProvider.NONE;
443
        validationStatus = IMessageProvider.NONE;
440
        okButton.setEnabled(validateVariableValue() && validateVariableName());
444
        okButton.setEnabled(validateVariableValue() && validateVariableName());
441
        locationEntered = true;
445
        locationEntered = true;
442
        variableResolvedValueField.setText(TextProcessor.process(getVariableResolvedValue()));        
446
        if (variableResolvedValueField != null)
447
        	variableResolvedValueField.setText(TextProcessor.process(getVariableResolvedValue()));        
443
    }
448
    }
444
449
445
    /**
450
    /**
(-)src/org/eclipse/ui/internal/ide/dialogs/PathVariablesGroup.java (+21 lines)
Lines 131-136 Link Here
131
    // reference to the workspace's path variable manager
131
    // reference to the workspace's path variable manager
132
    private IPathVariableManager pathVariableManager;
132
    private IPathVariableManager pathVariableManager;
133
133
134
    // if set to true, variables will be saved after each change
135
    private boolean saveVariablesOnChange = false;
136
    
134
    // file image
137
    // file image
135
    private final Image FILE_IMG = PlatformUI.getWorkbench().getSharedImages()
138
    private final Image FILE_IMG = PlatformUI.getWorkbench().getSharedImages()
136
            .getImage(ISharedImages.IMG_OBJ_FILE);
139
            .getImage(ISharedImages.IMG_OBJ_FILE);
Lines 208-213 Link Here
208
211
209
        // the UI must be updated
212
        // the UI must be updated
210
        updateWidgetState();
213
        updateWidgetState();
214
        saveVariablesIfRequired();
211
    }
215
    }
212
216
213
    /**
217
    /**
Lines 435-440 Link Here
435
439
436
        // now we must refresh the UI state
440
        // now we must refresh the UI state
437
        updateWidgetState();
441
        updateWidgetState();
442
        saveVariablesIfRequired();
438
    }
443
    }
439
444
440
    /**
445
    /**
Lines 453-458 Link Here
453
    }
458
    }
454
459
455
    /**
460
    /**
461
     * Automatically save the path variable list when new variables
462
     * are added, changed, or removed by the user. 
463
     * @param value 
464
     *
465
     */
466
    public void setSaveVariablesOnChange(boolean value) {
467
    	saveVariablesOnChange = value;
468
    }
469
    
470
    private void saveVariablesIfRequired() {
471
    	if (saveVariablesOnChange) {
472
    		performOk();
473
    	}
474
    }
475
    /**
456
     * Returns the selected variables.
476
     * Returns the selected variables.
457
     *  
477
     *  
458
     * @return the selected variables. Returns an empty array if 
478
     * @return the selected variables. Returns an empty array if 
Lines 656-661 Link Here
656
            tempPathVariables.remove(varName);
676
            tempPathVariables.remove(varName);
657
        }
677
        }
658
        updateWidgetState();
678
        updateWidgetState();
679
        saveVariablesIfRequired();
659
    }
680
    }
660
681
661
    private boolean canChangeSelection() {
682
    private boolean canChangeSelection() {

Return to bug 310446