aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeil Guzman2013-12-06 11:53:04 (EST)
committerAlexander Kurtakov2013-12-12 09:04:28 (EST)
commit27ecba0070e01339c6dab09272d2c43415c81885 (patch)
tree79a8403373570b600356521359463a7646a5b8bc
parent508dfb345dedd9f26dc4f57b5a2ad72dd460d482 (diff)
downloadorg.eclipse.linuxtools-27ecba0070e01339c6dab09272d2c43415c81885.zip
org.eclipse.linuxtools-27ecba0070e01339c6dab09272d2c43415c81885.tar.gz
org.eclipse.linuxtools-27ecba0070e01339c6dab09272d2c43415c81885.tar.bz2
RPM: createrepo execution from preferencesrefs/changes/46/19446/8
Gathers preference values and constructs what the execution of the createrepo command will be like. Repository form page changed to allow user to press ENTER key when editing the revision text field to save into preferences. Change-Id: I695d217a7e4251e8d5a3ca872f5c143bf3fd6716 Signed-off-by: Neil Guzman <nguzman@redhat.com> Reviewed-on: https://git.eclipse.org/r/19446 Reviewed-by: Alexander Kurtakov <akurtako@redhat.com> IP-Clean: Alexander Kurtakov <akurtako@redhat.com> Tested-by: Alexander Kurtakov <akurtako@redhat.com>
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/Activator.java12
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/Createrepo.java20
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/CreaterepoCommandCreator.java185
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/form/MetadataPage.java15
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/messages.properties3
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/preference/CreaterepoDeltaPropertyPage.java6
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/preference/CreaterepoGeneralPropertyPage.java31
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/rpm/createrepo/CreaterepoPreferenceConstants.java7
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/rpm/createrepo/CreaterepoProject.java5
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/rpm/createrepo/ICreaterepoConstants.java5
10 files changed, 258 insertions, 31 deletions
diff --git a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/Activator.java b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/Activator.java
index c11d732..e7b016c 100644
--- a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/Activator.java
+++ b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/Activator.java
@@ -80,11 +80,21 @@ public class Activator extends AbstractUIPlugin {
*
* @return True if it is being used, false otherwise.
*/
- public static boolean isConfEnabled() {
+ public static boolean isProjectPrefEnabled() {
return getDefault().getPreferenceStore().getBoolean(CreaterepoPreferenceConstants.PREF_GENERAL_ENABLED);
}
/**
+ * Get the enabled status of using the delta preferences of
+ * createrepo.
+ *
+ * @return True if it is being used, false otherwise.
+ */
+ public static boolean isDeltaPrefEnabled() {
+ return getDefault().getPreferenceStore().getBoolean(CreaterepoPreferenceConstants.PREF_DELTA_ENABLE);
+ }
+
+ /**
* Log an error.
*
* @param message A human-readable message.
diff --git a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/Createrepo.java b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/Createrepo.java
index 246d948..d1c02b7 100644
--- a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/Createrepo.java
+++ b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/Createrepo.java
@@ -19,6 +19,7 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.linuxtools.rpm.core.utils.Utils;
+import org.eclipse.linuxtools.rpm.createrepo.CreaterepoPreferenceConstants;
import org.eclipse.linuxtools.rpm.createrepo.CreaterepoProject;
import org.eclipse.linuxtools.rpm.createrepo.ICreaterepoConstants;
import org.osgi.framework.FrameworkUtil;
@@ -28,17 +29,27 @@ import org.osgi.framework.FrameworkUtil;
*/
public class Createrepo {
+ /*
+ * Default commands that every execution will have.
+ */
+ private static final String[] DEFAULT_ARGUMENTS = {
+ CreaterepoPreferenceConstants.PREF_VERBOSE, CreaterepoPreferenceConstants.PREF_PROFILE};
+
/**
* Holds the command line switches.
*/
private List<String> commandSwitches;
/**
- * Initialize the command switches to only be "createrepo".
+ * Initialize the command switches to be "createrepo" and
+ * default command arguments.
*/
public Createrepo() {
commandSwitches = new ArrayList<String>();
commandSwitches.add(ICreaterepoConstants.CREATEREPO_COMMAND);
+ for (String arg : DEFAULT_ARGUMENTS) {
+ commandSwitches.add(ICreaterepoConstants.DASH.concat(arg));
+ }
}
/**
@@ -55,7 +66,14 @@ public class Createrepo {
public IStatus execute(final OutputStream os, CreaterepoProject project, List<String> commands) throws CoreException {
commandSwitches.addAll(commands);
commandSwitches.add(project.getContentFolder().getLocation().toOSString());
+ /* Display what the execution looks like */
+ String commandString = ICreaterepoConstants.EMPTY_STRING;
+ for (String arg : commandSwitches) {
+ commandString = commandString.concat(arg + " "); //$NON-NLS-1$
+ }
+ commandString = commandString.concat("\n"); //$NON-NLS-1$
try {
+ os.write(commandString.getBytes());
return Utils.runCommand(os, project.getProject(), commandSwitches.toArray(new String[commandSwitches.size()]));
} catch (IOException e) {
IStatus status = new Status(
diff --git a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/CreaterepoCommandCreator.java b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/CreaterepoCommandCreator.java
new file mode 100644
index 0000000..be393f8
--- /dev/null
+++ b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/CreaterepoCommandCreator.java
@@ -0,0 +1,185 @@
+/*******************************************************************************
+ * Copyright (c) 2013 Red Hat Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Neil Guzman - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.rpm.createrepo;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.linuxtools.rpm.createrepo.CreaterepoPreferenceConstants;
+import org.eclipse.linuxtools.rpm.createrepo.ICreaterepoConstants;
+
+/**
+ * Class to create and format the commands.
+ */
+public class CreaterepoCommandCreator {
+
+ // commands that are either used or not used
+ private static final String[] BOOLEAN_COMMANDS = {
+ // general
+ CreaterepoPreferenceConstants.PREF_UNIQUE_MD_NAME,
+ CreaterepoPreferenceConstants.PREF_GENERATE_DB,
+ CreaterepoPreferenceConstants.PREF_IGNORE_SYMLINKS,
+ CreaterepoPreferenceConstants.PREF_PRETTY_XML,
+ CreaterepoPreferenceConstants.PREF_CHECK_TS,
+ };
+
+ // commands that determine used state by arguments passed with it
+ private static final String[] STRING_COMMANDS = {
+ // general
+ CreaterepoPreferenceConstants.PREF_CHECKSUM,
+ CreaterepoPreferenceConstants.PREF_COMPRESSION_TYPE,
+ };
+
+ private static final String[] STRING_META_COMMANDS = {
+ // metadata
+ CreaterepoPreferenceConstants.PREF_REVISION,
+ CreaterepoPreferenceConstants.PREF_DISTRO_TAG,
+ CreaterepoPreferenceConstants.PREF_CONTENT_TAG,
+ CreaterepoPreferenceConstants.PREF_REPO_TAG
+ };
+
+ // commands that determine used state by int passed with it
+ private static final String[] INT_COMMANDS = {
+ // general
+ CreaterepoPreferenceConstants.PREF_WORKERS,
+ CreaterepoPreferenceConstants.PREF_CHANGELOG_LIMIT,
+ };
+
+ private static final String[] INT_DELTA_COMMANDS = {
+ // deltas
+ CreaterepoPreferenceConstants.PREF_MAX_DELTA_SIZE,
+ CreaterepoPreferenceConstants.PREF_NUM_DELTAS,
+ };
+
+ private IEclipsePreferences projectPreferences;
+ private IPreferenceStore preferenceStore;
+ private boolean project;
+ private boolean delta;
+
+ public CreaterepoCommandCreator(IEclipsePreferences projectPreferences) {
+ project = Activator.isProjectPrefEnabled();
+ delta = Activator.isDeltaPrefEnabled();
+ this.projectPreferences = projectPreferences;
+ preferenceStore = Activator.getDefault().getPreferenceStore();
+ }
+
+ /**
+ * Get all the command arguments.
+ *
+ * @return A list of all the command arguments.
+ */
+ public List<String> getCommands() {
+ List<String> commands = new ArrayList<String>();
+ commands.addAll(prepareBooleanCommands());
+ commands.addAll(prepareStringCommands());
+ commands.addAll(prepareIntCommands());
+ return commands;
+ }
+
+ /**
+ * These commands are either added to the execution or not, depending
+ * on the enabled status from the preferences.
+ *
+ * @return The command options to add.
+ */
+ public List<String> prepareBooleanCommands() {
+ List<String> commands = new ArrayList<String>();
+ if (delta) {
+ commands.add(ICreaterepoConstants.DASH.concat(CreaterepoPreferenceConstants.PREF_DELTA_ENABLE));
+ }
+ for (String arg : BOOLEAN_COMMANDS) {
+ // if project preferences are enabled, use the preferences from there
+ boolean value = project ? projectPreferences.getBoolean(arg, preferenceStore.getDefaultBoolean(arg))
+ : preferenceStore.getBoolean(arg);
+ // if the value returned is true, that means the switch should be added
+ if (value) {
+ if (arg.equals(CreaterepoPreferenceConstants.PREF_UNIQUE_MD_NAME)) {
+ arg = ICreaterepoConstants.DASH.concat("unique-").concat(arg); //$NON-NLS-1$
+ } else {
+ arg = ICreaterepoConstants.DASH.concat(arg);
+ }
+ commands.add(arg);
+ } else {
+ // only add the switch if its one of these options
+ if (arg.equals(CreaterepoPreferenceConstants.PREF_UNIQUE_MD_NAME)) {
+ arg = ICreaterepoConstants.DASH.concat("simple-").concat(arg); //$NON-NLS-1$
+ commands.add(arg);
+ } else if (arg.equals(CreaterepoPreferenceConstants.PREF_GENERATE_DB)) {
+ arg = ICreaterepoConstants.DASH.concat("no-").concat(arg); //$NON-NLS-1$
+ commands.add(arg);
+ }
+ }
+ }
+ return commands;
+ }
+
+ /**
+ * Prepare the commands that require a string passed with them
+ * when executing.
+ *
+ * @return The command options to add.
+ */
+ public List<String> prepareStringCommands() {
+ List<String> commands = new ArrayList<String>();
+ for (String arg : STRING_COMMANDS) {
+ String value = project ? projectPreferences.get(arg, preferenceStore.getDefaultString(arg))
+ : preferenceStore.getString(arg);
+ arg = ICreaterepoConstants.DASH.concat(arg);
+ if (!value.isEmpty()) {
+ commands.add(arg);
+ commands.add(value);
+ }
+ }
+ for (String arg : STRING_META_COMMANDS) {
+ String value = projectPreferences.get(arg, preferenceStore.getDefaultString(arg));
+ arg = ICreaterepoConstants.DASH.concat(arg);
+ for (String tag : value.split(ICreaterepoConstants.DELIMITER)) {
+ if (!tag.isEmpty()) {
+ commands.add(arg);
+ commands.add(tag);
+ }
+ }
+ }
+ return commands;
+ }
+
+ /**
+ * Prepare the commands that require an integer passed with them
+ * when executing. Differs from prepareStringCommands() by how it
+ * retrieves the values from the preferences.
+ *
+ * @return The command options to add.
+ */
+ public List<String> prepareIntCommands() {
+ List<String> commands = new ArrayList<String>();
+ if (delta) {
+ for (String arg : INT_DELTA_COMMANDS) {
+ int value = projectPreferences.getInt(arg, preferenceStore.getDefaultInt(arg));
+ arg = ICreaterepoConstants.DASH.concat(arg);
+ commands.add(arg);
+ commands.add(Integer.toString(value));
+ }
+ } else {
+ for (String arg : INT_COMMANDS) {
+ // if project preferences are enabled, use the preferences from there
+ int value = project ? projectPreferences.getInt(arg, preferenceStore.getDefaultInt(arg))
+ : preferenceStore.getInt(arg);
+ arg = ICreaterepoConstants.DASH.concat(arg);
+ commands.add(arg);
+ commands.add(Integer.toString(value));
+ }
+ }
+ return commands;
+ }
+
+}
diff --git a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/form/MetadataPage.java b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/form/MetadataPage.java
index 1d6f106..ae8ffab 100644
--- a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/form/MetadataPage.java
+++ b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/form/MetadataPage.java
@@ -127,6 +127,17 @@ public class MetadataPage extends FormPage {
if (!prefRevisionTxt.isEmpty()) {
revisionTxt.setText(prefRevisionTxt);
}
+ revisionTxt.addSelectionListener(new SelectionAdapter() {
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.swt.events.SelectionListener#widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent)
+ */
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ String revisionText = revisionTxt.getText().trim();
+ savePreferences(CreaterepoPreferenceConstants.PREF_REVISION, revisionText);
+ }
+ });
revSection.setClient(sectionClient);
//---------- REVISION SECTION END
@@ -161,8 +172,8 @@ public class MetadataPage extends FormPage {
| SWT.VERTICAL | SWT.LEFT_TO_RIGHT | SWT.SMOOTH);
tagsTreeViewer.setContentProvider(new CreaterepoTreeContentProvider());
tagsTreeViewer.setLabelProvider(new CreaterepoTreeLabelProvider());
- CreaterepoCategoryModel test = new CreaterepoCategoryModel(project);
- tagsTreeViewer.setInput(test);
+ CreaterepoCategoryModel model = new CreaterepoCategoryModel(project);
+ tagsTreeViewer.setInput(model);
// change the tag text field on change (make editing tag easier)
tagsTreeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
diff --git a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/messages.properties b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/messages.properties
index b6b63d0..7d2a451 100644
--- a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/messages.properties
+++ b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/messages.properties
@@ -71,7 +71,8 @@ RemoveButtonListener_error=Error occured while trying to remove the RPMs.
MetadataPage_title=Metadata
MetadataPage_formHeaderText=Repository Tags and Revision
MetadataPage_sectionTitleRevision=Revision
-MetadataPage_sectionInstructionRevision=Update the repository revision number. Changes take effect after execution.
+MetadataPage_sectionInstructionRevision=Update the repository revision number. Must press the ENTER key to save \
+ change. Changes take effect after execution.
MetadataPage_labelRevision=&Revision:
MetadataPage_sectionTitleTags=Tags
MetadataPage_sectionInstructionTags=Add or remove as many tags per category as needed. Changes take effect after execution.
diff --git a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/preference/CreaterepoDeltaPropertyPage.java b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/preference/CreaterepoDeltaPropertyPage.java
index a19a18a..e88e1c5 100644
--- a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/preference/CreaterepoDeltaPropertyPage.java
+++ b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/preference/CreaterepoDeltaPropertyPage.java
@@ -13,6 +13,7 @@ package org.eclipse.linuxtools.internal.rpm.createrepo.preference;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.preference.BooleanFieldEditor;
import org.eclipse.jface.preference.IntegerFieldEditor;
+import org.eclipse.linuxtools.internal.rpm.createrepo.Activator;
import org.eclipse.linuxtools.internal.rpm.createrepo.Messages;
import org.eclipse.linuxtools.rpm.createrepo.CreaterepoPreferenceConstants;
import org.eclipse.swt.SWT;
@@ -51,7 +52,7 @@ public class CreaterepoDeltaPropertyPage extends CreaterepoPropertyPage {
bfeEnableDeltas = new BooleanFieldEditor(
CreaterepoPreferenceConstants.PREF_DELTA_ENABLE,
Messages.CreaterepoDeltaPropertyPage_booleanEnableLabel, composite);
- bfeEnableDeltas.setPreferenceStore(preferenceStore);
+ bfeEnableDeltas.setPreferenceStore(Activator.getDefault().getPreferenceStore());
bfeEnableDeltas.load();
bfeEnableDeltas.setPropertyChangeListener(this);
@@ -97,6 +98,7 @@ public class CreaterepoDeltaPropertyPage extends CreaterepoPropertyPage {
*/
@Override
public void performDefaults() {
+ Activator.getDefault().getPreferenceStore().setToDefault(CreaterepoPreferenceConstants.PREF_DELTA_ENABLE);
bfeEnableDeltas.loadDefault();
ifeNumDeltas.loadDefault();
ifeMaxSizeDeltas.loadDefault();
@@ -108,7 +110,7 @@ public class CreaterepoDeltaPropertyPage extends CreaterepoPropertyPage {
*/
@Override
public boolean performOk() {
- getPreferenceStore().setValue(CreaterepoPreferenceConstants.PREF_DELTA_ENABLE,
+ Activator.getDefault().getPreferenceStore().setValue(CreaterepoPreferenceConstants.PREF_DELTA_ENABLE,
bfeEnableDeltas.getBooleanValue());
getPreferenceStore().setValue(CreaterepoPreferenceConstants.PREF_NUM_DELTAS,
ifeNumDeltas.getIntValue());
diff --git a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/preference/CreaterepoGeneralPropertyPage.java b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/preference/CreaterepoGeneralPropertyPage.java
index 34e3a58..9d37812 100644
--- a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/preference/CreaterepoGeneralPropertyPage.java
+++ b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/preference/CreaterepoGeneralPropertyPage.java
@@ -10,8 +10,6 @@
*******************************************************************************/
package org.eclipse.linuxtools.internal.rpm.createrepo.preference;
-import org.eclipse.core.resources.ProjectScope;
-import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.preference.BooleanFieldEditor;
import org.eclipse.jface.preference.IntegerFieldEditor;
@@ -102,7 +100,8 @@ public class CreaterepoGeneralPropertyPage extends CreaterepoPropertyPage {
layoutData.grabExcessHorizontalSpace = true;
btnProjectSettings.setText(Messages.CreaterepoGeneralPropertyPage_projectSettings);
btnProjectSettings.setLayoutData(layoutData);
- btnProjectSettings.setSelection(loadBoolean(CreaterepoPreferenceConstants.PREF_GENERAL_ENABLED));
+ btnProjectSettings.setSelection(Activator.getDefault().getPreferenceStore()
+ .getBoolean(CreaterepoPreferenceConstants.PREF_GENERAL_ENABLED));
btnProjectSettings.addSelectionListener(new SelectionAdapter() {
/*
* (non-Javadoc)
@@ -257,20 +256,6 @@ public class CreaterepoGeneralPropertyPage extends CreaterepoPropertyPage {
return composite;
}
- /**
- * Return the boolean value of the preference key.
- *
- * @param preferenceKey The preference key to get the boolean value of.
- * @return The boolean value of the preference key.
- */
- protected boolean loadBoolean(String preferenceKey) {
- IEclipsePreferences projectPreferences = new ProjectScope(project)
- .getNode(Activator.PLUGIN_ID);
- boolean value = projectPreferences.getBoolean(preferenceKey,
- getPreferenceStore().getDefaultBoolean(preferenceKey));
- return value;
- }
-
/*
* (non-Javadoc)
* @see org.eclipse.jface.preference.PreferencePage#performDefaults()
@@ -278,8 +263,8 @@ public class CreaterepoGeneralPropertyPage extends CreaterepoPropertyPage {
@Override
public void performDefaults() {
// load the defaults UI
- btnProjectSettings.setSelection(getPreferenceStore().getDefaultBoolean(
- CreaterepoPreferenceConstants.PREF_GENERAL_ENABLED));
+ btnProjectSettings.setSelection(Activator.getDefault().getPreferenceStore()
+ .getDefaultBoolean(CreaterepoPreferenceConstants.PREF_GENERAL_ENABLED));
bfeIncludeChecksum.loadDefault();
bfeSQLDB.loadDefault();
bfeIgnoreSymlinks.loadDefault();
@@ -292,7 +277,7 @@ public class CreaterepoGeneralPropertyPage extends CreaterepoPropertyPage {
rgfeCompressionTypes.loadDefault();
// set the defaults preferences
- getPreferenceStore().setToDefault(CreaterepoPreferenceConstants.PREF_GENERAL_ENABLED);
+ Activator.getDefault().getPreferenceStore().setToDefault(CreaterepoPreferenceConstants.PREF_GENERAL_ENABLED);
getPreferenceStore().setToDefault(CreaterepoPreferenceConstants.PREF_UNIQUE_MD_NAME);
getPreferenceStore().setToDefault(CreaterepoPreferenceConstants.PREF_GENERATE_DB);
getPreferenceStore().setToDefault(CreaterepoPreferenceConstants.PREF_IGNORE_SYMLINKS);
@@ -314,7 +299,8 @@ public class CreaterepoGeneralPropertyPage extends CreaterepoPropertyPage {
public boolean performOk() {
// only save when using project specific settings
if (btnProjectSettings.getSelection()) {
- getPreferenceStore().setValue(CreaterepoPreferenceConstants.PREF_GENERAL_ENABLED, true);
+ Activator.getDefault().getPreferenceStore().setValue(CreaterepoPreferenceConstants.PREF_GENERAL_ENABLED,
+ true);
getPreferenceStore().setValue(CreaterepoPreferenceConstants.PREF_UNIQUE_MD_NAME,
bfeIncludeChecksum.getBooleanValue());
getPreferenceStore().setValue(CreaterepoPreferenceConstants.PREF_GENERATE_DB,
@@ -337,7 +323,8 @@ public class CreaterepoGeneralPropertyPage extends CreaterepoPropertyPage {
getSelectedRadioButton(rgfeCompressionTypes.getRadioBoxControl(compressContainer),
rgfeCompressionTypes.getPreferenceName()));
} else {
- getPreferenceStore().setValue(CreaterepoPreferenceConstants.PREF_GENERAL_ENABLED, false);
+ Activator.getDefault().getPreferenceStore().setValue(CreaterepoPreferenceConstants.PREF_GENERAL_ENABLED,
+ false);
}
return true;
}
diff --git a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/rpm/createrepo/CreaterepoPreferenceConstants.java b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/rpm/createrepo/CreaterepoPreferenceConstants.java
index 8dae19e..0fb1398 100644
--- a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/rpm/createrepo/CreaterepoPreferenceConstants.java
+++ b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/rpm/createrepo/CreaterepoPreferenceConstants.java
@@ -11,7 +11,8 @@
package org.eclipse.linuxtools.rpm.createrepo;
/**
- * Constants used for createrepo preferences.
+ * Constants used for createrepo preferences, as well as the command
+ * arguments of the execution.
*/
public final class CreaterepoPreferenceConstants {
@@ -42,6 +43,10 @@ public final class CreaterepoPreferenceConstants {
/****/ public static final String PREF_NUM_DELTAS = "num-deltas"; //$NON-NLS-1$
/****/ public static final String PREF_MAX_DELTA_SIZE = "max-delta-rpm-size"; //$NON-NLS-1$
+ // Defaults
+ /****/ public static final String PREF_VERBOSE = "verbose"; //$NON-NLS-1$
+ /****/ public static final String PREF_PROFILE = "profile"; //$NON-NLS-1$
+
/*
* Preference Values.
*/
diff --git a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/rpm/createrepo/CreaterepoProject.java b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/rpm/createrepo/CreaterepoProject.java
index 538ebba..ea8aca4 100644
--- a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/rpm/createrepo/CreaterepoProject.java
+++ b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/rpm/createrepo/CreaterepoProject.java
@@ -31,6 +31,7 @@ import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.linuxtools.internal.rpm.createrepo.Activator;
import org.eclipse.linuxtools.internal.rpm.createrepo.Createrepo;
+import org.eclipse.linuxtools.internal.rpm.createrepo.CreaterepoCommandCreator;
import org.eclipse.linuxtools.internal.rpm.createrepo.Messages;
import org.osgi.framework.FrameworkUtil;
@@ -215,8 +216,10 @@ public class CreaterepoProject {
*
* @return The command arguments.
*/
- private static List<String> getCommandArguments() {
+ private List<String> getCommandArguments() {
List<String> commands = new ArrayList<String>();
+ CreaterepoCommandCreator creator = new CreaterepoCommandCreator(projectPreferences);
+ commands.addAll(creator.getCommands());
return commands;
}
diff --git a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/rpm/createrepo/ICreaterepoConstants.java b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/rpm/createrepo/ICreaterepoConstants.java
index f7f9ed3..08af455 100644
--- a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/rpm/createrepo/ICreaterepoConstants.java
+++ b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/rpm/createrepo/ICreaterepoConstants.java
@@ -46,4 +46,9 @@ public interface ICreaterepoConstants {
*/
String CREATEREPO_COMMAND = "createrepo"; //$NON-NLS-1$
+ /**
+ * Dashes used for commands.
+ */
+ String DASH = "--"; //$NON-NLS-1$
+
}