use of org.eclipse.core.runtime.preferences.IPreferencesService in project org.csstudio.display.builder by kasemir.
the class Preferences method getLegacyFontCalibration.
/**
* @return Legacy font size calibration
*/
public static double getLegacyFontCalibration() {
double factor = 0.75;
final IPreferencesService prefs = Platform.getPreferencesService();
if (prefs != null)
factor = prefs.getDouble(ModelPlugin.ID, LEGACY_FONT_CALIBRATION, factor, null);
return factor;
}
use of org.eclipse.core.runtime.preferences.IPreferencesService in project org.csstudio.display.builder by kasemir.
the class Preferences method getMacros.
/**
* @return Global macros set in preferences, or <code>null</code>
*/
public static Macros getMacros() {
// Fall-back value used in MacroHierarchyUnitTest
String macro_def = "<EXAMPLE_MACRO>Value from Preferences</EXAMPLE_MACRO><TEST>true</TEST>";
final IPreferencesService prefs = Platform.getPreferencesService();
if (prefs != null)
macro_def = prefs.getString(ModelPlugin.ID, MACROS, macro_def, null);
if (macro_def.isEmpty())
return null;
try {
return MacroXMLUtil.readMacros(macro_def);
} catch (Exception ex) {
return null;
}
}
use of org.eclipse.core.runtime.preferences.IPreferencesService in project org.csstudio.display.builder by kasemir.
the class Preferences method getHiddenWidgets.
public static Set<String> getHiddenWidgets() {
final Set<String> deprecated = new HashSet<>();
final IPreferencesService prefs = Platform.getPreferencesService();
if (prefs != null) {
final String list = prefs.getString(Plugin.ID, "hidden_widget_types", "", null);
for (String item : list.split(" *, *")) {
final String type = item.trim();
if (!type.isEmpty())
deprecated.add(type);
}
}
return deprecated;
}
use of org.eclipse.core.runtime.preferences.IPreferencesService in project org.csstudio.display.builder by kasemir.
the class Preferences method getArchives.
public static ArchiveDataSource[] getArchives() {
final ArrayList<ArchiveDataSource> archives = new ArrayList<ArchiveDataSource>();
final IPreferencesService prefs = Platform.getPreferencesService();
final String urls = prefs.getString(Activator.PLUGIN_ID, ARCHIVES, "", null);
// data source specs are separated by '*'
final String[] specs = urls.split(ITEM_SEPARATOR_RE);
for (String spec : specs) {
// Each spec is "<name>|<key>|<url>"
if (spec.length() <= 0)
continue;
try {
final String[] segs = spec.split(COMPONENT_SEPARATOR_RE);
final String name = segs[0];
final int key = Integer.parseInt(segs[1]);
final String url = segs[2];
archives.add(new ArchiveDataSource(url, key, name));
} catch (Throwable ex) {
throw new Error("Error in archive preference '" + spec + "'");
}
}
return archives.toArray(new ArchiveDataSource[archives.size()]);
}
use of org.eclipse.core.runtime.preferences.IPreferencesService in project org.csstudio.display.builder by kasemir.
the class Preferences method getScrollStep.
public static Duration getScrollStep() {
int scroll_step = 5;
final IPreferencesService prefs = Platform.getPreferencesService();
if (prefs != null) {
// Check related legacy preference, then current one
scroll_step = prefs.getInt(Activator.PLUGIN_ID, "future_buffer", scroll_step, null);
scroll_step = prefs.getInt(Activator.PLUGIN_ID, SCROLL_STEP, scroll_step, null);
}
return Duration.ofSeconds(scroll_step);
}
Aggregations