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

(-)src/org/eclipse/pde/internal/ui/editor/product/JRESection.java (-15 / +16 lines)
Lines 10-16 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.pde.internal.ui.editor.product;
11
package org.eclipse.pde.internal.ui.editor.product;
12
12
13
import java.util.TreeSet;
13
import java.util.ArrayList;
14
14
15
import org.eclipse.core.runtime.IPath;
15
import org.eclipse.core.runtime.IPath;
16
import org.eclipse.core.runtime.Platform;
16
import org.eclipse.core.runtime.Platform;
Lines 36-43 Link Here
36
import org.eclipse.swt.custom.CTabFolder;
36
import org.eclipse.swt.custom.CTabFolder;
37
import org.eclipse.swt.custom.CTabItem;
37
import org.eclipse.swt.custom.CTabItem;
38
import org.eclipse.swt.dnd.Clipboard;
38
import org.eclipse.swt.dnd.Clipboard;
39
import org.eclipse.swt.events.ModifyEvent;
40
import org.eclipse.swt.events.ModifyListener;
41
import org.eclipse.swt.events.SelectionAdapter;
39
import org.eclipse.swt.events.SelectionAdapter;
42
import org.eclipse.swt.events.SelectionEvent;
40
import org.eclipse.swt.events.SelectionEvent;
43
import org.eclipse.swt.graphics.Color;
41
import org.eclipse.swt.graphics.Color;
Lines 61-67 Link Here
61
	private Button fExecutionEnvironmentsButton;
59
	private Button fExecutionEnvironmentsButton;
62
	private ComboPart fJREsCombo;
60
	private ComboPart fJREsCombo;
63
	private ComboPart fEEsCombo;
61
	private ComboPart fEEsCombo;
64
	private TreeSet fEEChoices;
62
	private ArrayList fEEChoices;
65
	private boolean fBlockChanges;
63
	private boolean fBlockChanges;
66
64
67
	private static final String[] TAB_LABELS = {"linux", "macosx", "solaris", "win32"}; //$NON-NLS-1$  //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
65
	private static final String[] TAB_LABELS = {"linux", "macosx", "solaris", "win32"}; //$NON-NLS-1$  //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
Lines 124-131 Link Here
124
		String[] installs = VMHelper.getVMInstallNames();
122
		String[] installs = VMHelper.getVMInstallNames();
125
		fJREsCombo.setItems(installs);
123
		fJREsCombo.setItems(installs);
126
		fJREsCombo.add("", 0); //$NON-NLS-1$
124
		fJREsCombo.add("", 0); //$NON-NLS-1$
127
		fJREsCombo.addModifyListener(new ModifyListener() {
125
		fJREsCombo.addSelectionListener(new SelectionAdapter(){
128
			public void modifyText(ModifyEvent e) {
126
			public void widgetSelected(SelectionEvent e) {
129
				if(!fBlockChanges)
127
				if(!fBlockChanges)
130
					setJRE(fJREsCombo.getSelection());
128
					setJRE(fJREsCombo.getSelection());
131
			}
129
			}
Lines 146-152 Link Here
146
		fEERadioButton.addSelectionListener(new SelectionAdapter() {
144
		fEERadioButton.addSelectionListener(new SelectionAdapter() {
147
			public void widgetSelected(SelectionEvent e) {
145
			public void widgetSelected(SelectionEvent e) {
148
				updateWidgets();
146
				updateWidgets();
149
				setEE(fEEsCombo.getSelection());
147
				setEE(fEEsCombo.getSelectionIndex());
150
			}
148
			}
151
		});
149
		});
152
150
Lines 154-163 Link Here
154
		fEEsCombo.createControl(client, toolkit, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY);
152
		fEEsCombo.createControl(client, toolkit, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY);
155
		fEEsCombo.getControl().setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
153
		fEEsCombo.getControl().setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
156
		initializeExecutionEnvironments();
154
		initializeExecutionEnvironments();
157
		fEEsCombo.addModifyListener(new ModifyListener() {
155
		fEEsCombo.addSelectionListener(new SelectionAdapter(){
158
			public void modifyText(ModifyEvent e) {
156
			public void widgetSelected(SelectionEvent e) {
159
				if(!fBlockChanges)
157
				if(!fBlockChanges)
160
					setEE(fEEsCombo.getSelection());
158
					setEE(fEEsCombo.getSelectionIndex());
161
			}
159
			}
162
		});
160
		});
163
		
161
		
Lines 179-188 Link Here
179
		getProductModel().addModelChangedListener(this);		
177
		getProductModel().addModelChangedListener(this);		
180
	}
178
	}
181
	
179
	
182
	private void setEE(String eeName){
		IExecutionEnvironment ee = VMHelper.getExecutionEnvironment(eeName);
180
	private void setEE(int selectionIndex){
183
		if (ee != null){
181
		if (selectionIndex >= 0 && selectionIndex < fEEChoices.size()){
184
			IPath eePath = JavaRuntime.newJREContainerPath(ee);
182
			IExecutionEnvironment ee = (IExecutionEnvironment)fEEChoices.get(selectionIndex);
185
			getJVMLocations().setJREContainerPath(getOS(fLastTab), eePath);
183
			if (ee != null){
184
				IPath eePath = JavaRuntime.newJREContainerPath(ee);
185
				getJVMLocations().setJREContainerPath(getOS(fLastTab), eePath);
186
			}
186
		}
187
		}
187
	}
188
	}
188
	
189
	
Lines 195-201 Link Here
195
	}
196
	}
196
	
197
	
197
	private void initializeExecutionEnvironments(){
198
	private void initializeExecutionEnvironments(){
198
		fEEChoices = new TreeSet();
199
		fEEChoices = new ArrayList();
199
		IExecutionEnvironmentsManager manager = JavaRuntime.getExecutionEnvironmentsManager();
200
		IExecutionEnvironmentsManager manager = JavaRuntime.getExecutionEnvironmentsManager();
200
		IExecutionEnvironment[] envs = manager.getExecutionEnvironments();
201
		IExecutionEnvironment[] envs = manager.getExecutionEnvironments();
201
		for (int i = 0; i < envs.length; i++)
202
		for (int i = 0; i < envs.length; i++)

Return to bug 172793