use of org.eclipse.ui.preferences.ScopedPreferenceStore in project linuxtools by eclipse.
the class RpmlintParser method getMixedUseOfTabsAndSpaces.
private static int getMixedUseOfTabsAndSpaces(String refferedContent) {
int lineNbr = -1;
if (refferedContent.indexOf("(spaces: line") > -1) {
// $NON-NLS-1$
String tabsAndSpacesPref = new ScopedPreferenceStore(InstanceScope.INSTANCE, Activator.PLUGIN_ID).getString(PreferenceConstants.P_RPMLINT_TABS_AND_SPACES);
// $NON-NLS-1$
String[] spacesAndTabs = refferedContent.split("line");
if (tabsAndSpacesPref == PreferenceConstants.P_RPMLINT_SPACES) {
lineNbr = Integer.parseInt(// $NON-NLS-1$
spacesAndTabs[1].split(",")[0].trim());
} else {
lineNbr = Integer.parseInt(spacesAndTabs[2].replaceFirst("\\)", EMPTY_STRING).trim());
}
}
return lineNbr;
}
use of org.eclipse.ui.preferences.ScopedPreferenceStore in project linuxtools by eclipse.
the class PreferenceInitializer method initializeDefaultPreferences.
@Override
public void initializeDefaultPreferences() {
IPreferenceStore store = new ScopedPreferenceStore(InstanceScope.INSTANCE, Activator.PLUGIN_ID);
store.setDefault(PreferenceConstants.P_RPMLINT_PATH, PreferenceConstants.DP_RPMLINT_PATH);
store.setDefault(PreferenceConstants.P_RPMLINT_TABS_AND_SPACES, PreferenceConstants.P_RPMLINT_SPACES);
}
use of org.eclipse.ui.preferences.ScopedPreferenceStore in project linuxtools by eclipse.
the class CreaterepoCommandCreatorTest method setProjectPreferences.
/**
* Set test project preferences.
*
* @throws BackingStoreException
*/
private void setProjectPreferences() throws BackingStoreException {
// enable use of project preferences
IPreferenceStore prefStore = new ScopedPreferenceStore(InstanceScope.INSTANCE, Activator.PLUGIN_ID);
prefStore.setValue(CreaterepoPreferenceConstants.PREF_GENERAL_ENABLED, true);
// --simple-md-filenames should not be used because project properties are enabled
prefStore.setValue(CreaterepoPreferenceConstants.PREF_UNIQUE_MD_NAME, false);
// set the project preferences
IEclipsePreferences pref = project.getEclipsePreferences();
// --unique-md-filenames
pref.putBoolean(CreaterepoPreferenceConstants.PREF_UNIQUE_MD_NAME, true);
// --no-database
pref.putBoolean(CreaterepoPreferenceConstants.PREF_GENERATE_DB, false);
// --skip-symlinks
pref.putBoolean(CreaterepoPreferenceConstants.PREF_IGNORE_SYMLINKS, true);
// --pretty
pref.putBoolean(CreaterepoPreferenceConstants.PREF_PRETTY_XML, false);
// --workers 13
pref.putInt(CreaterepoPreferenceConstants.PREF_WORKERS, 13);
// --checkts
pref.putBoolean(CreaterepoPreferenceConstants.PREF_CHECK_TS, true);
// --changelog-limit 37
pref.putInt(CreaterepoPreferenceConstants.PREF_CHANGELOG_LIMIT, 37);
// --checksum sha512
pref.put(CreaterepoPreferenceConstants.PREF_CHECKSUM, ICreaterepoChecksums.SHA512);
// --compress-type xz
pref.put(CreaterepoPreferenceConstants.PREF_COMPRESSION_TYPE, ICreaterepoCompressionTypes.XZ);
// enable deltas
// --deltas
prefStore.setValue(CreaterepoPreferenceConstants.PREF_DELTA_ENABLE, true);
// --num-deltas 13
pref.putInt(CreaterepoPreferenceConstants.PREF_NUM_DELTAS, 13);
// --max-delta-rpm-size 37
pref.putInt(CreaterepoPreferenceConstants.PREF_MAX_DELTA_SIZE, 37);
// --oldpackagedirs /tmp --oldpackagedirs /home
// $NON-NLS-1$
pref.put(CreaterepoPreferenceConstants.PREF_OLD_PACKAGE_DIRS, "/tmp;/home");
// --distro cpeid,distrotag --distro tag2 --distro tag3 --distro tag4
// $NON-NLS-1$
pref.put(CreaterepoPreferenceConstants.PREF_DISTRO_TAG, "cpeid,distrotag;tag2;tag3;tag4");
// $NON-NLS-1$
pref.put(CreaterepoPreferenceConstants.PREF_CONTENT_TAG, "");
pref.flush();
}
use of org.eclipse.ui.preferences.ScopedPreferenceStore in project linuxtools by eclipse.
the class UiUtils method pluginSanityCheck.
public static void pluginSanityCheck() throws IOException {
boolean exists = (new File(PreferenceConstants.RPMMACRO_FILE)).exists();
// it with the appropriate command.
if (!exists && Files.exists(Paths.get("/usr/bin/rpmdev-setuptree"))) {
// $NON-NLS-1$
// $NON-NLS-1$
org.eclipse.linuxtools.rpm.core.utils.Utils.runCommandToInputStream("rpmdev-setuptree");
}
// Check RPM tool preference.
IPreferenceStore store = new ScopedPreferenceStore(InstanceScope.INSTANCE, FrameworkUtil.getBundle(UiUtils.class).getSymbolicName());
String currentRpmTool = store.getString(PreferenceConstants.P_CURRENT_RPMTOOLS);
if (!Files.exists(Paths.get("/usr/bin/yum"))) {
// $NON-NLS-1$
if (currentRpmTool.equals(PreferenceConstants.DP_RPMTOOLS_YUM)) {
store.setValue(PreferenceConstants.P_CURRENT_RPMTOOLS, PreferenceConstants.DP_RPMTOOLS_RPM);
}
} else if (!Files.exists(Paths.get("/usr/bin/urpmq"))) {
// $NON-NLS-1$
if (currentRpmTool.equals(PreferenceConstants.DP_RPMTOOLS_URPM)) {
store.setValue(PreferenceConstants.P_CURRENT_RPMTOOLS, PreferenceConstants.DP_RPMTOOLS_RPM);
}
}
}
Aggregations