Example usage for org.springframework.ide.eclipse.core SpringCorePreferences getProjectPreferences

List of usage examples for org.springframework.ide.eclipse.core SpringCorePreferences getProjectPreferences

Introduction

In this page you can find the example usage for org.springframework.ide.eclipse.core SpringCorePreferences getProjectPreferences.

Prototype

public static SpringCorePreferences getProjectPreferences(IProject project, String qualifier) 

Source Link

Usage

From source file:org.eclipse.virgo.ide.jdt.internal.core.util.ClasspathUtils.java

/**
 * Returns configured source attachment paths for a given jar resource path.
 * @param project the java project which preferences needs to be checked.
 * @param file the jar that needs a source attachment
 *//* www.  j av a  2 s. c  o m*/
public static IPath getSourceAttachment(IJavaProject project, File file) {
    SpringCorePreferences prefs = SpringCorePreferences.getProjectPreferences(project.getProject(),
            JdtCorePlugin.PLUGIN_ID);
    String value = prefs.getString("source.attachment-" + file.getName(), null);
    if (value != null) {
        return new Path(value);
    }
    return null;
}

From source file:org.eclipse.virgo.ide.jdt.internal.core.util.ClasspathUtils.java

/**
 * Stores the configured source attachments paths in the projects settings area.
 * @param project the java project to store the preferences for
 * @param containerSuggestion the configured classpath container entries
 *//*  w  w  w .j ava2 s.  co  m*/
public static void storeSourceAttachments(IJavaProject project, IClasspathContainer containerSuggestion) {
    SpringCorePreferences prefs = SpringCorePreferences.getProjectPreferences(project.getProject(),
            JdtCorePlugin.PLUGIN_ID);
    for (IClasspathEntry entry : containerSuggestion.getClasspathEntries()) {
        IPath path = entry.getPath();
        IPath sourcePath = entry.getSourceAttachmentPath();
        if (sourcePath != null) {
            prefs.putString("source.attachment-" + path.lastSegment().toString(), sourcePath.toString());
        }
    }
}