\r
import java.io.File;\r
import java.io.IOException;\r
+import java.util.ArrayList;\r
+import java.util.List;\r
\r
import org.eclipse.core.runtime.preferences.ConfigurationScope;\r
import org.eclipse.core.runtime.preferences.IScopeContext;\r
try {\r
if(installed != null)\r
installedVersion = ModelicaManager.getOMCVersion(installed);\r
-\r
- builtInVersion = ModelicaManager.getOMCVersion(builtIn);\r
+ if (builtIn != null)\r
+ builtInVersion = ModelicaManager.getOMCVersion(builtIn);\r
} catch (IOException e) {\r
}\r
\r
-\r
- String[][] options;\r
- if(installed != null) {\r
- options = new String[][] \r
- {{CUSTOM_PATH, CUSTOM_PATH},\r
- {"Local installation (" + installedVersion + ")", installed.getAbsolutePath() },\r
- {"Built-in (" + builtInVersion + ")", builtIn.getAbsolutePath()},\r
- };\r
- } else {\r
- options = new String[][] \r
- {{CUSTOM_PATH, CUSTOM_PATH},\r
- {"Built-in (" + builtInVersion + ")", builtIn.getAbsolutePath()},\r
- }; \r
+ List<String[]> optionList = new ArrayList<String[]>();\r
+ optionList.add(new String[]{CUSTOM_PATH, CUSTOM_PATH});\r
+ if (installed != null) {\r
+ optionList.add(new String[]{"Local installation (" + installedVersion + ")", installed.getAbsolutePath() });\r
}\r
+ if (builtIn != null) {\r
+ optionList.add(new String[]{"Built-in (" + builtInVersion + ")", builtIn.getAbsolutePath()});\r
+ }\r
+ \r
+ String[][] options = optionList.toArray(new String[optionList.size()][]);\r
+ \r
\r
rg = new RadioGroupFieldEditor(OpenModelicaPreferences.OM_HOME,\r
"&Choose the used OpenModelica version", 1,\r
\r
@Override\r
protected void fireValueChanged(String property, Object oldValue, Object newValue) {\r
- if((installed != null &&newValue.equals(installed.getAbsolutePath())) || newValue.equals(builtIn.getAbsolutePath())) {\r
+ if((installed != null &&newValue.equals(installed.getAbsolutePath())) || (builtIn != null && newValue.equals(builtIn.getAbsolutePath()))) {\r
path.setStringValue((String)newValue);\r
path.setEnabled(false, getFieldEditorParent());\r
} else {\r