use of org.eclipse.core.runtime.preferences.IPreferencesService in project translationstudio8 by heartsome.
the class FileFormatUtils method checkAutomaticOO.
/**
* 检查是否启用 Open Office
*/
private static void checkAutomaticOO(List<ConverterBean> list) {
IPreferencesService service = Platform.getPreferencesService();
String qualifier = Activator.getDefault().getBundle().getSymbolicName();
boolean automaticOO = service.getBoolean(qualifier, IPreferenceConstants.AUTOMATIC_OO, false, null);
if (!automaticOO) {
list.remove(new ConverterBean("MS Office Document to XLIFF Conveter", null));
}
}
use of org.eclipse.core.runtime.preferences.IPreferencesService in project tesb-studio-se by Talend.
the class AnsiConsoleUtils method getDebugConsoleFgColor.
public static Color getDebugConsoleFgColor() {
IPreferencesService ps = Platform.getPreferencesService();
String value = ps.getString(DEBUG_CONSOLE_PLUGIN_ID, "org.eclipse.debug.ui.outColor", DEBUG_CONSOLE_FALLBACK_FGCOLOR, null);
return colorFromStringRgb(value);
}
use of org.eclipse.core.runtime.preferences.IPreferencesService in project knime-core by knime.
the class ImportPreferencesAction method run.
/**
* Invoke the Import wizards selection Wizard.
*/
@Override
public void run() {
IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (workbenchWindow == null) {
// action has been disposed
return;
}
FileDialog fileDialog = new FileDialog(workbenchWindow.getShell(), SWT.OPEN);
fileDialog.setFilterExtensions(new String[] { "*.epf", "*.*" });
fileDialog.setText("Specify the preferences file to import.");
String filePath = fileDialog.open();
if (filePath == null || filePath.trim().length() == 0) {
return;
}
File inFile = new File(filePath);
if (!inFile.isFile() || !inFile.canRead()) {
MessageDialog.openError(workbenchWindow.getShell(), "File Selection Error", "Unable to read from specified location.");
return;
}
InputStream in = null;
try {
in = new BufferedInputStream(new FileInputStream(inFile));
IPreferencesService prefService = Platform.getPreferencesService();
LOGGER.info("Importing preferences from file " + inFile.getAbsolutePath() + " now ...");
IExportedPreferences prefs = prefService.readPreferences(in);
IPreferenceFilter filter = new IPreferenceFilter() {
@Override
public String[] getScopes() {
return new String[] { InstanceScope.SCOPE, ConfigurationScope.SCOPE, "profile" };
}
@Override
@SuppressWarnings("rawtypes")
public Map getMapping(final String scope) {
// this filter is applicable for all nodes
return null;
}
};
/* Calling this method with filters and not the applyPreferences
* without filters is very important! The other method does not
* merge the preferences but deletes all default values. */
prefService.applyPreferences(prefs, new IPreferenceFilter[] { filter });
LOGGER.info("Import of preferences successfully finished.");
} catch (Throwable t) {
String msg = "Unable to read preferences from selected file";
if (t.getMessage() != null && !t.getMessage().isEmpty()) {
msg = t.getMessage();
}
MessageDialog.openError(workbenchWindow.getShell(), "Error Importing Preferences", msg);
return;
} finally {
if (in != null) {
try {
in.close();
} catch (IOException e) {
// ignore
}
}
}
}
use of org.eclipse.core.runtime.preferences.IPreferencesService in project yamcs-studio by yamcs.
the class PreferencesHelper method getConsolePopupLevel.
public static ConsolePopupLevel getConsolePopupLevel() {
final IPreferencesService service = Platform.getPreferencesService();
String popupLevelString = service.getString(OPIBuilderPlugin.PLUGIN_ID, POPUP_CONSOLE, ConsolePopupLevel.ALL.toString(), null);
return ConsolePopupLevel.valueOf(popupLevelString);
}
use of org.eclipse.core.runtime.preferences.IPreferencesService in project erlide_eclipse by erlang.
the class ErlangCoreLogger method getLogFile.
public static String getLogFile() {
final IPreferencesService service = Platform.getPreferencesService();
final String pluginId = ErlangCore.PLUGIN_ID;
String file = System.getProperty("erlide.log_file");
if (file == null) {
file = service.getString(pluginId, "log_file", "erlide.log", null);
}
final IPath path = new Path(file);
String location;
if (!path.isAbsolute()) {
final IPath wroot = ResourcesPlugin.getWorkspace().getRoot().getLocation();
location = wroot.append(file).toPortableString();
} else {
location = file;
}
new File(location).getParentFile().mkdirs();
return location;
}
Aggregations