Search in sources :

Example 51 with IPreferencesService

use of org.eclipse.core.runtime.preferences.IPreferencesService in project erlide_eclipse by erlang.

the class DialyzerPreferences method getPLTPathsFromPreferences.

private static Collection<String> getPLTPathsFromPreferences() {
    final IPreferencesService service = Platform.getPreferencesService();
    final String key = "default_plt_files";
    final String pluginId = "org.erlide.ui";
    final String pltFilesString = service.getString(pluginId, key, "", null);
    return DialyzerPreferences.getPltFiles(pltFilesString);
}
Also used : IPreferencesService(org.eclipse.core.runtime.preferences.IPreferencesService)

Example 52 with IPreferencesService

use of org.eclipse.core.runtime.preferences.IPreferencesService in project erlide_eclipse by erlang.

the class DialyzerPreferences method getAlternatePLTFileDirectoryFromPreferences.

public static String getAlternatePLTFileDirectoryFromPreferences() {
    final IPreferencesService service = Platform.getPreferencesService();
    final String key = "alternate_plt_file_directory";
    final String pluginId = "org.erlide.ui";
    return service.getString(pluginId, key, "", null);
}
Also used : IPreferencesService(org.eclipse.core.runtime.preferences.IPreferencesService)

Example 53 with IPreferencesService

use of org.eclipse.core.runtime.preferences.IPreferencesService in project webtools.sourceediting by eclipse.

the class WorkspaceTaskScanner method init.

private boolean init(IResource resource) {
    IProject project = getProject(resource);
    IPreferencesService preferencesService = Platform.getPreferencesService();
    IScopeContext[] lookupOrder = new IScopeContext[] { new ProjectScope(project), new InstanceScope(), new DefaultScope() };
    boolean proceed = preferencesService.getBoolean(TaskTagPreferenceKeys.TASK_TAG_NODE, TaskTagPreferenceKeys.TASK_TAG_ENABLE, false, lookupOrder);
    if (Logger.DEBUG_TASKSPREFS) {
        // $NON-NLS-1$ //$NON-NLS-2$
        System.out.println(getClass().getName() + " scan of " + resource.getFullPath() + ":" + proceed);
    }
    if (proceed) {
        String[] tags = StringUtils.unpack(preferencesService.getString(TaskTagPreferenceKeys.TASK_TAG_NODE, TaskTagPreferenceKeys.TASK_TAG_TAGS, null, lookupOrder));
        String[] priorities = StringUtils.unpack(preferencesService.getString(TaskTagPreferenceKeys.TASK_TAG_NODE, TaskTagPreferenceKeys.TASK_TAG_PRIORITIES, null, lookupOrder));
        String[] currentIgnoreContentTypeIDs = StringUtils.unpack(preferencesService.getString(TaskTagPreferenceKeys.TASK_TAG_NODE, TaskTagPreferenceKeys.TASK_TAG_CONTENTTYPES_IGNORED, null, lookupOrder));
        if (Logger.DEBUG_TASKSPREFS) {
            // $NON-NLS-1$
            System.out.print(getClass().getName() + " tags: ");
            for (int i = 0; i < tags.length; i++) {
                if (i > 0) {
                    // $NON-NLS-1$
                    System.out.print(",");
                }
                System.out.print(tags[i]);
            }
            System.out.println();
            // $NON-NLS-1$
            System.out.print(getClass().getName() + " priorities: ");
            for (int i = 0; i < priorities.length; i++) {
                if (i > 0) {
                    // $NON-NLS-1$
                    System.out.print(",");
                }
                System.out.print(priorities[i]);
            }
            System.out.println();
            // $NON-NLS-1$
            System.out.print(getClass().getName() + " ignored content types: ");
            for (int i = 0; i < currentIgnoreContentTypeIDs.length; i++) {
                if (i > 0) {
                    // $NON-NLS-1$
                    System.out.print(",");
                }
                System.out.print(currentIgnoreContentTypeIDs[i]);
            }
            System.out.println();
        }
        fCurrentIgnoreContentTypes = new IContentType[currentIgnoreContentTypeIDs.length];
        IContentTypeManager contentTypeManager = Platform.getContentTypeManager();
        for (int i = 0; i < currentIgnoreContentTypeIDs.length; i++) {
            fCurrentIgnoreContentTypes[i] = contentTypeManager.getContentType(currentIgnoreContentTypeIDs[i]);
        }
        int max = Math.min(tags.length, priorities.length);
        fCurrentTaskTags = new TaskTag[max];
        for (int i = 0; i < max; i++) {
            int priority = TaskTag.PRIORITY_NORMAL;
            try {
                priority = Integer.parseInt(priorities[i]);
            } catch (NumberFormatException e) {
            // default to normal priority
            }
            fCurrentTaskTags[i] = new TaskTag(tags[i], priority);
        }
    }
    return proceed;
}
Also used : ProjectScope(org.eclipse.core.resources.ProjectScope) TaskTag(org.eclipse.wst.sse.core.internal.provisional.tasks.TaskTag) DefaultScope(org.eclipse.core.runtime.preferences.DefaultScope) IProject(org.eclipse.core.resources.IProject) IPreferencesService(org.eclipse.core.runtime.preferences.IPreferencesService) IScopeContext(org.eclipse.core.runtime.preferences.IScopeContext) InstanceScope(org.eclipse.core.runtime.preferences.InstanceScope) IContentTypeManager(org.eclipse.core.runtime.content.IContentTypeManager)

Example 54 with IPreferencesService

use of org.eclipse.core.runtime.preferences.IPreferencesService in project webtools.sourceediting by eclipse.

the class PrefUtil method getProperty.

private static String getProperty(String property) {
    // Importance order is:
    // default-default < instanceScope < configurationScope < systemProperty
    // < envVar
    String value = null;
    if (value == null) {
        value = System.getenv(property);
    }
    if (value == null) {
        value = System.getProperty(property);
    }
    if (value == null) {
        IPreferencesService preferencesService = Platform.getPreferencesService();
        String key = property;
        if (property != null && property.startsWith(SSECorePlugin.ID)) {
            // +1, include the "."
            key = property.substring(SSECorePlugin.ID.length() + 1, property.length());
        }
        InstanceScope instance = new InstanceScope();
        ConfigurationScope config = new ConfigurationScope();
        Preferences instanceNode = instance.getNode(SSECorePlugin.ID);
        Preferences configNode = config.getNode(SSECorePlugin.ID);
        value = preferencesService.get(key, getDefault(property), new Preferences[] { configNode, instanceNode });
    }
    return value;
}
Also used : InstanceScope(org.eclipse.core.runtime.preferences.InstanceScope) IEclipsePreferences(org.eclipse.core.runtime.preferences.IEclipsePreferences) Preferences(org.osgi.service.prefs.Preferences) IPreferencesService(org.eclipse.core.runtime.preferences.IPreferencesService) ConfigurationScope(org.eclipse.core.runtime.preferences.ConfigurationScope)

Example 55 with IPreferencesService

use of org.eclipse.core.runtime.preferences.IPreferencesService in project webtools.sourceediting by eclipse.

the class TaskScanningJob method isEnabledOnProject.

private boolean isEnabledOnProject(IProject p) {
    IPreferencesService preferencesService = Platform.getPreferencesService();
    IScopeContext[] lookupOrder = new IScopeContext[] { new ProjectScope(p), new InstanceScope(), new DefaultScope() };
    return preferencesService.getBoolean(TaskTagPreferenceKeys.TASK_TAG_NODE, TaskTagPreferenceKeys.TASK_TAG_ENABLE, false, lookupOrder);
}
Also used : ProjectScope(org.eclipse.core.resources.ProjectScope) IScopeContext(org.eclipse.core.runtime.preferences.IScopeContext) InstanceScope(org.eclipse.core.runtime.preferences.InstanceScope) DefaultScope(org.eclipse.core.runtime.preferences.DefaultScope) 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