Search in sources :

Example 6 with IPreferencesService

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;
}
Also used : IPreferencesService(org.eclipse.core.runtime.preferences.IPreferencesService)

Example 7 with IPreferencesService

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;
    }
}
Also used : IPreferencesService(org.eclipse.core.runtime.preferences.IPreferencesService)

Example 8 with IPreferencesService

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;
}
Also used : IPreferencesService(org.eclipse.core.runtime.preferences.IPreferencesService) HashSet(java.util.HashSet)

Example 9 with IPreferencesService

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()]);
}
Also used : ArrayList(java.util.ArrayList) ArchiveDataSource(org.csstudio.trends.databrowser3.model.ArchiveDataSource) IPreferencesService(org.eclipse.core.runtime.preferences.IPreferencesService)

Example 10 with IPreferencesService

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);
}
Also used : IPreferencesService(org.eclipse.core.runtime.preferences.IPreferencesService)

Aggregations

IPreferencesService (org.eclipse.core.runtime.preferences.IPreferencesService)96 IFile (org.eclipse.core.resources.IFile)26 ArrayList (java.util.ArrayList)15 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)15 WorkspaceJob (org.eclipse.core.resources.WorkspaceJob)14 IProject (org.eclipse.core.resources.IProject)13 CoreException (org.eclipse.core.runtime.CoreException)13 Module (org.eclipse.titan.designer.AST.Module)11 ProjectSourceParser (org.eclipse.titan.designer.parsers.ProjectSourceParser)11 List (java.util.List)10 File (java.io.File)8 TextSelection (org.eclipse.jface.text.TextSelection)8 Path (org.eclipse.core.runtime.Path)6 IContainer (org.eclipse.core.resources.IContainer)5 IMarker (org.eclipse.core.resources.IMarker)5 IPath (org.eclipse.core.runtime.IPath)5 SubMonitor (org.eclipse.core.runtime.SubMonitor)5 RefactoringStatus (org.eclipse.ltk.core.refactoring.RefactoringStatus)5 IOException (java.io.IOException)4 IStatus (org.eclipse.core.runtime.IStatus)4