use of org.eclipse.core.runtime.preferences.IEclipsePreferences in project webtools.sourceediting by eclipse.
the class ContentBasedPreferenceGateway method getDefaultPreferences.
private static Preferences getDefaultPreferences(IContentType contentType) {
IEclipsePreferences eclipsePreferences = Platform.getPreferencesService().getRootNode();
// TODO: eventaully need extension mechanism to avoid these hard coded
// mechanism.
// The idea is to load/store based on plugin's preferences, where the
// content type was contributed
// Eventually, too, we could do more "dynamic lookup" to get parent
// types for defaults, etc.
// Get default plugin preferences
String pluginPreferenceLocation = DefaultScope.SCOPE + IPath.SEPARATOR + getContributorPluginId(contentType);
Preferences pluginPreferences = eclipsePreferences.node(pluginPreferenceLocation);
return pluginPreferences;
}
use of org.eclipse.core.runtime.preferences.IEclipsePreferences in project webtools.sourceediting by eclipse.
the class ContentBasedPreferenceGateway method getPreferences.
public static Preferences getPreferences(IContentType contentType) {
IEclipsePreferences eclipsePreferences = Platform.getPreferencesService().getRootNode();
// TODO: eventaully need extension mechanism to avoid these hard coded
// mechanism.
// The idea is to load/store based on plugin's preferences, where the
// content type was contributed
// Eventually, too, we could do more "dynamic lookup" to get parent
// types for defaults, etc.
// Get instance plugin preferences
String pluginPreferenceLocation = Plugin.PLUGIN_PREFERENCE_SCOPE + IPath.SEPARATOR + getContributorPluginId(contentType);
Preferences pluginPreferences = eclipsePreferences.node(pluginPreferenceLocation);
// return contentPreferences;
return pluginPreferences;
}
use of org.eclipse.core.runtime.preferences.IEclipsePreferences in project webtools.sourceediting by eclipse.
the class TagModelQuery method getEmbeddedMimeType.
private String getEmbeddedMimeType(Node node) {
String type = DEFAULT_MIMETYPE;
if (node instanceof IDOMNode) {
IStructuredModel model = ((IDOMNode) node).getModel();
String baseLocation = model.getBaseLocation();
if (!baseLocation.equals(IModelManager.UNMANAGED_MODEL)) {
IPath path = new Path(baseLocation);
if (path.segmentCount() > 1) {
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(path.segment(0));
if (project.isAccessible()) {
String key = createPreferenceKey(path);
IEclipsePreferences preferences = new ProjectScope(project).getNode(JSPCorePlugin.getDefault().getBundle().getSymbolicName());
type = preferences.get(key, DEFAULT_MIMETYPE);
}
}
}
}
return type;
}
use of org.eclipse.core.runtime.preferences.IEclipsePreferences in project webtools.sourceediting by eclipse.
the class JSPIndexManager method isForcedFullReIndexNeeded.
/* (non-Javadoc)
* @see org.eclipse.wst.sse.core.indexing.AbstractIndexManager#isForcedFullReIndexNeeded()
* Add a versioning check so we can force a re-index if needed
*/
protected boolean isForcedFullReIndexNeeded() {
IEclipsePreferences node = InstanceScope.INSTANCE.getNode(JSPCorePlugin.getDefault().getBundle().getSymbolicName());
String stored = node.get(JSPIndexManager.class.getName(), null);
return !INDEX_VERSION.equals(stored) || super.isForcedFullReIndexNeeded();
}
use of org.eclipse.core.runtime.preferences.IEclipsePreferences in project webtools.sourceediting by eclipse.
the class MainTab method save.
private void save() {
IEclipsePreferences defaultPreferences = new DefaultScope().getNode(TaskTagPreferenceKeys.TASK_TAG_NODE);
String defaultTags = defaultPreferences.get(TaskTagPreferenceKeys.TASK_TAG_TAGS, null);
String defaultPriorities = defaultPreferences.get(TaskTagPreferenceKeys.TASK_TAG_PRIORITIES, null);
StringBuffer buf = new StringBuffer();
for (int i = 0; i < fTaskTags.length; i++) {
if (i > 0) {
// $NON-NLS-1$
buf.append(",");
}
buf.append(fTaskTags[i].getTag());
}
String currentTags = buf.toString();
if (currentTags.equals(defaultTags) && !fPreferencesLookupOrder[0].getName().equals(DefaultScope.SCOPE)) {
if (_debugPreferences) {
// $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
System.out.println(getClass().getName() + " removing " + TaskTagPreferenceKeys.TASK_TAG_TAGS + " from scope " + fPreferencesLookupOrder[0].getName() + ":" + fPreferencesLookupOrder[0].getLocation());
}
fPreferencesLookupOrder[0].getNode(TaskTagPreferenceKeys.TASK_TAG_NODE).remove(TaskTagPreferenceKeys.TASK_TAG_TAGS);
} else {
fOwner.requestRedetection();
if (_debugPreferences) {
// $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
System.out.println(getClass().getName() + " setting " + TaskTagPreferenceKeys.TASK_TAG_TAGS + " \"" + currentTags + "\" in scope " + fPreferencesLookupOrder[0].getName() + ":" + fPreferencesLookupOrder[0].getLocation());
}
fPreferencesLookupOrder[0].getNode(TaskTagPreferenceKeys.TASK_TAG_NODE).put(TaskTagPreferenceKeys.TASK_TAG_TAGS, currentTags);
}
StringBuffer buf2 = new StringBuffer();
for (int i = 0; i < fTaskTags.length; i++) {
if (i > 0) {
// $NON-NLS-1$
buf2.append(",");
}
buf2.append(String.valueOf(fTaskTags[i].getPriority()));
}
String priorities = buf2.toString();
if (priorities.equals(defaultPriorities) && !fPreferencesLookupOrder[0].getName().equals(DefaultScope.SCOPE)) {
if (_debugPreferences) {
// $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
System.out.println(getClass().getName() + " removing " + TaskTagPreferenceKeys.TASK_TAG_PRIORITIES + " from scope " + fPreferencesLookupOrder[0].getName() + ":" + fPreferencesLookupOrder[0].getLocation());
}
fPreferencesLookupOrder[0].getNode(TaskTagPreferenceKeys.TASK_TAG_NODE).remove(TaskTagPreferenceKeys.TASK_TAG_PRIORITIES);
} else {
fOwner.requestRedetection();
if (_debugPreferences) {
// $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
System.out.println(getClass().getName() + " setting " + TaskTagPreferenceKeys.TASK_TAG_PRIORITIES + " \"" + priorities + "\" in scope " + fPreferencesLookupOrder[0].getName() + ":" + fPreferencesLookupOrder[0].getLocation());
}
fPreferencesLookupOrder[0].getNode(TaskTagPreferenceKeys.TASK_TAG_NODE).put(TaskTagPreferenceKeys.TASK_TAG_PRIORITIES, priorities);
}
}
Aggregations