Révision 3924

TXM/trunk/bundles/org.txm.rcp/src/main/java/org/txm/rcp/utils/LanguageSwitchHandler.java (revision 3924)
87 87
		ArrayList<String> values = new ArrayList<>();
88 88
		values.add("fr"); //$NON-NLS-1$
89 89
		values.add("en"); //$NON-NLS-1$
90
		values.add("ru"); //$NON-NLS-1$
90
		//values.add("ru"); //$NON-NLS-1$
91 91
		
92 92
		if (!values.contains(locale)) { // set selected locale
93 93
			locale = "en"; //$NON-NLS-1$
......
110 110
			PlatformUI.getWorkbench().restart();
111 111
		}
112 112
		else {
113
			Log.warning(
114
					"** Error: TXM language configuration could not be set. You can set TXM language by editing HOME/TXM-<version>/.txm/TXM.ini) configuration file by adding '-nl\n<language code>' before the '-vmargs' line."); //$NON-NLS-1$
113
			Log.warning("** Error: TXM language configuration could not be set. You can set TXM language by editing HOME/TXM-<version>/.txm/TXM.ini) configuration file by adding '-nl\n<language code>' before the '-vmargs' line."); //$NON-NLS-1$
115 114
		}
116 115
		
117 116
		return null;
......
154 153
		System.out.println(TXMUIMessages.tXMiniColon + location);
155 154
		Log.severe(TXMUIMessages.tXMiniColon + location);
156 155
		try {
157
			
158 156
			BufferedReader in = new BufferedReader(new FileReader(fileName));
159 157
			BufferedWriter out = new BufferedWriter(new FileWriter(location.getFile()));
160 158
			try {
......
164 162
				while (line != null) {
165 163
					
166 164
					// write nl before vmargs
167
					if (line.equals("-vmargs") && !isNlWiritten) //$NON-NLS-1$
168
					{
165
					if (line.equals("-vmargs") && !isNlWiritten) { //$NON-NLS-1$
166
					
169 167
						out.write("-nl"); //$NON-NLS-1$
170 168
						out.newLine();
171 169
						out.write(locale);
......
220 218
				}
221 219
			}
222 220
		}
223
		catch (FileNotFoundException e) {
221
		catch (Exception e) {
224 222
			org.txm.utils.logger.Log.printStackTrace(e);
225 223
		}
226
		catch (IOException e) {
227
			org.txm.utils.logger.Log.printStackTrace(e);
228
		}
229 224
	}
230 225
	
231 226
	/**
......
236 231
	public static boolean changeLocaleConfigIni(String locale) {
237 232
		
238 233
		Location configArea = Platform.getConfigurationLocation();
239
		
240 234
		if (configArea == null) {
241 235
			return false;
242 236
		}
243 237
		
244
		String fileName = Platform.getConfigurationLocation().getURL().getFile() +
245
				System.getProperty("file.separator") + "config.ini"; //$NON-NLS-1$ //$NON-NLS-2$
238
		String fileName = Platform.getConfigurationLocation().getURL().getFile() + System.getProperty("file.separator") + "config.ini"; //$NON-NLS-1$ //$NON-NLS-2$
246 239
		
247 240
		File file = new File(fileName);
248 241
		if (!file.exists()) {
......
268 261
							out.write("osgi.nl=" + locale); //$NON-NLS-1$
269 262
							isNlWritten = true;
270 263
						}
271
						else
264
						else {
272 265
							out.write(line);
266
						}
273 267
					}
274
					else
268
					else {
275 269
						out.write(line);
270
					}
276 271
					
277 272
					out.newLine();
278 273
					line = in.readLine();
......
303 298
				}
304 299
			}
305 300
		}
306
		catch (FileNotFoundException e) {
301
		catch (Exception e) {
307 302
			org.txm.utils.logger.Log.printStackTrace(e);
308 303
		}
309
		catch (IOException e) {
310
			org.txm.utils.logger.Log.printStackTrace(e);
311
		}
312 304
		
313 305
		String txt;
314 306
		try {
TXM/trunk/bundles/org.txm.core/src/java/org/txm/core/preferences/TXMPreferences.java (revision 3924)
2072 2072
	// end of fixme
2073 2073
	
2074 2074
	public String getProjectPreferenceValue(Project project, String key) {
2075
		
2075 2076
		String defaultValue = this.getString(key);
2076 2077
		return getProjectPreferenceValue(project, key, defaultValue);
2077 2078
	}
2078 2079
	
2079 2080
	public String getProjectPreferenceValue(Project project, String key, String defaultValue) {
2081
		
2082
		if (project.getPreferencesScope() == null) return defaultValue;
2083
		
2080 2084
		Preferences node = project.getPreferencesScope().getNode(commandPreferencesNodeQualifier);
2081 2085
		return node.get(key, defaultValue);
2082 2086
	}
2083 2087
	
2084 2088
	public void setProjectPreferenceValue(Project project, String key, String value) {
2089
		
2090
		if (project.getPreferencesScope() == null) return;
2091
		
2085 2092
		Preferences node = project.getPreferencesScope().getNode(commandPreferencesNodeQualifier);
2086 2093
		node.put(key, value);
2087 2094
	}

Formats disponibles : Unified diff