use of org.eclipse.core.runtime.preferences.IEclipsePreferences in project linuxtools by eclipse.
the class CreaterepoTreeTest method addTestPreferences.
/**
* Add some test tags in the preferences.
*
* @throws BackingStoreException
*/
private void addTestPreferences() throws BackingStoreException {
IEclipsePreferences pref = project.getEclipsePreferences();
pref.put(CreaterepoPreferenceConstants.PREF_DISTRO_TAG, preparePrefValue(DISTRO_TAGS));
pref.put(CreaterepoPreferenceConstants.PREF_CONTENT_TAG, preparePrefValue(CONTENT_TAGS));
pref.put(CreaterepoPreferenceConstants.PREF_REPO_TAG, preparePrefValue(REPO_TAGS));
pref.flush();
}
use of org.eclipse.core.runtime.preferences.IEclipsePreferences in project linuxtools by eclipse.
the class CreaterepoTreeTest method tearDown.
/**
* Clear the preferences after each test.
*
* @throws BackingStoreException
*/
@After
public void tearDown() throws BackingStoreException {
IEclipsePreferences pref = project.getEclipsePreferences();
pref.clear();
pref.flush();
assertEquals(0, pref.keys().length);
}
use of org.eclipse.core.runtime.preferences.IEclipsePreferences in project linuxtools by eclipse.
the class RPMQuery method eval.
/**
* Uses RPM to eval the given string.
* @param project Underlying project.
* @param toEval The string to be evaled.
* @return The value of the evaluation.
* @throws CoreException If there is IOException when calling.
* @since 2.1
*/
public static String eval(IProject project, String toEval) throws CoreException {
IEclipsePreferences node = DefaultScope.INSTANCE.getNode(IRPMConstants.RPM_CORE_ID);
// $NON-NLS-1$
String rpmCmd = node.get(IRPMConstants.RPM_CMD, "");
List<String> command = new ArrayList<>();
command.add(rpmCmd);
// $NON-NLS-1$
command.add("--eval");
command.add(toEval);
try {
return Utils.runCommandToString(project, command.toArray(new String[command.size()]));
} catch (IOException e) {
throw new CoreException(new Status(IStatus.ERROR, IRPMConstants.RPM_CORE_ID, e.getMessage(), e));
}
}
use of org.eclipse.core.runtime.preferences.IEclipsePreferences in project linuxtools by eclipse.
the class RPMQuery method query.
private static String query(IFile rpmFile, String... args) {
IEclipsePreferences node = DefaultScope.INSTANCE.getNode(IRPMConstants.RPM_CORE_ID);
// $NON-NLS-1$
String rpmCmd = node.get(IRPMConstants.RPM_CMD, "");
List<String> command = new ArrayList<>();
command.add(rpmCmd);
command.addAll(Arrays.asList(args));
command.add(rpmFile.getLocation().toOSString());
try {
return Utils.runCommandToString(command.toArray(new String[command.size()]));
} catch (IOException e) {
// ignore - nothing that deserves showing to the user
}
// $NON-NLS-1$
return "";
}
use of org.eclipse.core.runtime.preferences.IEclipsePreferences in project linuxtools by eclipse.
the class MetadataPageTest method tearDown.
/**
* Clear the project preferences.
*
* @throws BackingStoreException
*/
@After
public void tearDown() throws BackingStoreException {
IEclipsePreferences pref = project.getEclipsePreferences();
pref.clear();
pref.flush();
assertEquals(0, pref.keys().length);
}
Aggregations