use of org.osgi.service.prefs.Preferences in project hale by halestudio.
the class ContentTypeSettings method setDefaultCharset.
public void setDefaultCharset(String userCharset) throws CoreException {
Preferences contentTypeNode = ContentTypeManager.getInstance().getPreferences(context).node(contentType.getId());
ContentType.setPreference(contentTypeNode, ContentType.PREF_DEFAULT_CHARSET, userCharset);
try {
contentTypeNode.flush();
} catch (BackingStoreException bse) {
String message = NLS.bind(ContentMessages.content_errorSavingSettings, contentType.getId());
IStatus status = new Status(IStatus.ERROR, ContentMessages.OWNER_NAME, 0, message, bse);
throw new CoreException(status);
}
}
use of org.osgi.service.prefs.Preferences in project hale by halestudio.
the class ContentType method removeFileSpec.
@Override
public void removeFileSpec(String fileSpec, int type) throws CoreException {
Assert.isLegal(type == FILE_EXTENSION_SPEC || type == FILE_NAME_SPEC || type == FILE_PATTERN_SPEC, // $NON-NLS-1$
"Unknown type: " + type);
synchronized (this) {
if (!internalRemoveFileSpec(fileSpec, type | SPEC_USER_DEFINED))
return;
}
// persist the change
Preferences contentTypeNode = manager.getPreferences().node(id);
final String[] userSet = getFileSpecs(type | IGNORE_PRE_DEFINED);
String preferenceKey = getPreferenceKey(type);
String newValue = Util.toListString(userSet);
setPreference(contentTypeNode, preferenceKey, newValue);
try {
contentTypeNode.flush();
} catch (BackingStoreException bse) {
String message = NLS.bind(ContentMessages.content_errorSavingSettings, id);
IStatus status = new Status(IStatus.ERROR, ContentMessages.OWNER_NAME, 0, message, bse);
throw new CoreException(status);
}
// notify listeners
manager.fireContentTypeChangeEvent(this);
}
use of org.osgi.service.prefs.Preferences in project hale by halestudio.
the class ContentType method addFileSpec.
@Override
public void addFileSpec(String fileSpec, int type) throws CoreException {
Assert.isLegal(type == FILE_EXTENSION_SPEC || type == FILE_NAME_SPEC || type == FILE_PATTERN_SPEC, // $NON-NLS-1$
"Unknown type: " + type);
String[] userSet;
synchronized (this) {
if (!internalAddFileSpec(fileSpec, type | SPEC_USER_DEFINED))
return;
userSet = getFileSpecs(type | IGNORE_PRE_DEFINED);
}
// persist using preferences
Preferences contentTypeNode = manager.getPreferences().node(id);
String newValue = Util.toListString(userSet);
// we are adding stuff, newValue must be non-null
Assert.isNotNull(newValue);
setPreference(contentTypeNode, getPreferenceKey(type), newValue);
try {
contentTypeNode.flush();
} catch (BackingStoreException bse) {
String message = NLS.bind(ContentMessages.content_errorSavingSettings, id);
IStatus status = new Status(IStatus.ERROR, ContentMessages.OWNER_NAME, 0, message, bse);
throw new CoreException(status);
}
// notify listeners
manager.fireContentTypeChangeEvent(this);
}
use of org.osgi.service.prefs.Preferences in project arduino-eclipse-plugin by Sloeber.
the class Activator method testKnownIssues.
private static void testKnownIssues() {
{
org.osgi.service.prefs.Preferences myScope = InstanceScope.INSTANCE.getNode("org.eclipse.cdt.core").node("indexer");
myScope.put("indexAllFiles", "false");
myScope.put("indexUnusedHeadersWithDefaultLang", "false");
try {
myScope.flush();
} catch (BackingStoreException e) {
e.printStackTrace();
}
}
String errorString = new String();
String addString = new String();
IPath installPath = ConfigurationPreferences.getInstallationPath();
File installFile = installPath.toFile();
if (installFile.exists()) {
if (!installFile.canWrite()) {
errorString += addString + "The folder " + installPath.toString() + " exists but Sloeber does not have write access to it.\n";
errorString += "Alternatively use the environment var " + SLOEBER_HOME + ".";
addString = "\nand\n";
}
} else {
if (!installFile.getParentFile().canWrite()) {
errorString += addString + "Sloeber does not have write access to " + installFile.getParentFile().toString() + " and therefore can not create the folder " + installPath.toString();
errorString += "\nAlternatively use the environment var " + SLOEBER_HOME + ".";
addString = "\nand\n";
}
}
if (isInstallPathToLong()) {
errorString += errorString + addString;
errorString += "Due to issues with long pathnames on Windows, the Sloeber installation path must be less than 40 characters. \n";
errorString += "Your current path: " + installPath.toString();
errorString += " is too long and the plugin will no longer function correctly for all boards.\n";
errorString += "Please visit issue #705 for details. https://github.com/Sloeber/arduino-eclipse-plugin/issues/705\n";
errorString += "Alternatively use the environment var " + SLOEBER_HOME + ".";
addString = "\nand\n";
}
if (installPath.toString().contains(" ")) {
errorString += addString + "The installpath can not contain spaces " + installPath.toString();
addString = "\nand\n";
}
String workSpacePath = ResourcesPlugin.getWorkspace().getRoot().getLocation().toString();
if (workSpacePath.contains(" ")) {
errorString += addString + "The Workspacepath can not contain spaces " + workSpacePath;
addString = "\nand\n";
}
Preferences myScope = InstanceScope.INSTANCE.getNode("org.eclipse.cdt.core").node("indexer");
String indexAllFiles = myScope.get("indexAllFiles", new String());
String indexUnusedHeaders = myScope.get("indexUnusedHeadersWithDefaultLang", new String());
if (!"false".equalsIgnoreCase(indexAllFiles)) {
errorString += addString + "The indexer option \"index source files not included in the build\" must be off in windows->preferences->C/C++->indexer ";
addString = "\nand\n";
}
if (!"false".equalsIgnoreCase(indexUnusedHeaders)) {
errorString += addString + "The indexer option \"index unused headers\" must be off in windows->preferences->C/C++->indexer ";
addString = "\nand\n";
}
if (!errorString.isEmpty()) {
errorString += "\n\nSloeber might still function but if you get strange results you know where to look.\n";
errorString += "Do not create an issue if you see this!!!";
Common.log(new Status(IStatus.ERROR, PLUGIN_ID, errorString));
}
}
use of org.osgi.service.prefs.Preferences in project erlide_eclipse by erlang.
the class RuntimeInfoLoader method store.
public static void store(final RuntimeInfo info, final Preferences root) {
final Preferences node = root.node(info.getName());
final String code = PreferencesUtils.packList(info.getCodePath());
node.put(RuntimeInfoLoader.CODE_PATH, code);
node.put(RuntimeInfoLoader.HOME_DIR, info.getOtpHome());
node.put(RuntimeInfoLoader.ARGS, info.getArgs());
}
Aggregations