aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeil Guzman2013-11-28 14:57:02 (EST)
committerAlexander Kurtakov2013-12-05 10:46:57 (EST)
commitfac15073fe4fac885ee6ce68c34c02a408b72dc9 (patch)
treed2b5dea5f8e7c7ceb436d8af89e7f41b09dc516f
parentac8df23dfb9589e89da50858261b9dfc7160d131 (diff)
downloadorg.eclipse.linuxtools-fac15073fe4fac885ee6ce68c34c02a408b72dc9.zip
org.eclipse.linuxtools-fac15073fe4fac885ee6ce68c34c02a408b72dc9.tar.gz
org.eclipse.linuxtools-fac15073fe4fac885ee6ce68c34c02a408b72dc9.tar.bz2
RPM: createrepo plugin preferencesrefs/changes/46/19146/5
Added preference pages for createrepo. These preference pages will contain the command line arguments for the createrepo command execution. Change-Id: I80ae275264b97fed7fadffce399b6d3d55a5ece0 Signed-off-by: Neil Guzman <nguzman@redhat.com> Reviewed-on: https://git.eclipse.org/r/19146 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/plugin.properties3
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.createrepo/plugin.xml22
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/Messages.java42
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/form/ImportRPMsPage.java21
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/messages.properties24
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/preference/CreaterepoDeltaPreferencePage.java130
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/preference/CreaterepoPreferenceInitializer.java69
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/preference/CreaterepoPreferencePage.java215
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/rpm/createrepo/CreaterepoPreferenceConstants.java36
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/rpm/createrepo/ICreaterepoChecksums.java38
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/rpm/createrepo/ICreaterepoCompressionTypes.java38
11 files changed, 615 insertions, 23 deletions
diff --git a/rpm/org.eclipse.linuxtools.rpm.createrepo/plugin.properties b/rpm/org.eclipse.linuxtools.rpm.createrepo/plugin.properties
index e1fc8c1..6fc7f49 100644
--- a/rpm/org.eclipse.linuxtools.rpm.createrepo/plugin.properties
+++ b/rpm/org.eclipse.linuxtools.rpm.createrepo/plugin.properties
@@ -12,8 +12,9 @@ Bundle-Name = RPM Createrepo Plug-in
Bundle-Vendor = Eclipse Linux Tools
editor.name = Repo Editor
-category.name = Createrepo
+main.name = Createrepo
wizard.name = Createrepo Wizard
contentType.name = Repo File Content Type
+delta.preference.name = Deltas
execute.command = Execute Command
diff --git a/rpm/org.eclipse.linuxtools.rpm.createrepo/plugin.xml b/rpm/org.eclipse.linuxtools.rpm.createrepo/plugin.xml
index 947cc8d..13bdce5 100644
--- a/rpm/org.eclipse.linuxtools.rpm.createrepo/plugin.xml
+++ b/rpm/org.eclipse.linuxtools.rpm.createrepo/plugin.xml
@@ -15,7 +15,7 @@
point="org.eclipse.ui.newWizards">
<category
id="org.eclipse.linuxtools.rpm.createrepo"
- name="%category.name">
+ name="%main.name">
</category>
<wizard
category="org.eclipse.linuxtools.rpm.createrepo"
@@ -76,4 +76,24 @@
commandId="org.eclipse.linuxtools.rpm.createrepo.executeCommand">
</handler>
</extension>
+ <extension
+ point="org.eclipse.ui.preferencePages">
+ <page
+ class="org.eclipse.linuxtools.internal.rpm.createrepo.preference.CreaterepoPreferencePage"
+ id="org.eclipse.linuxtools.rpm.createrepo.preferences"
+ name="%main.name">
+ </page>
+ <page
+ category="org.eclipse.linuxtools.rpm.createrepo.preferences"
+ class="org.eclipse.linuxtools.internal.rpm.createrepo.preference.CreaterepoDeltaPreferencePage"
+ id="org.eclipse.linuxtools.rpm.createrepo.preferences.delta"
+ name="%delta.preference.name">
+ </page>
+ </extension>
+ <extension
+ point="org.eclipse.equinox.preferences.preferences">
+ <initializer
+ class="org.eclipse.linuxtools.internal.rpm.createrepo.preference.CreaterepoPreferenceInitializer">
+ </initializer>
+ </extension>
</plugin>
diff --git a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/Messages.java b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/Messages.java
index bb859b8..5f06d66 100644
--- a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/Messages.java
+++ b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/Messages.java
@@ -133,6 +133,48 @@ public final class Messages {
/****/
public static String CreaterepoResourceChangeListener_errorGettingResource;
+ // CreaterepoPreferencePage
+ /****/
+ public static String CreaterepoPreferencePage_description;
+ /****/
+ public static String CreaterepoPreferencePage_generalGroupLabel;
+ /****/
+ public static String CreaterepoPreferencePage_booleanChecksumName;
+ /****/
+ public static String CreaterepoPreferencePage_booleanGenerateSQLDB;
+ /****/
+ public static String CreaterepoPreferencePage_booleanIgnoreSymlinks;
+ /****/
+ public static String CreaterepoPreferencePage_booleanPrettyXML;
+ /****/
+ public static String CreaterepoPreferencePage_numWorkers;
+ /****/
+ public static String CreaterepoPreferencePage_updateGroupLabel;
+ /****/
+ public static String CreaterepoPreferencePage_booleanCheckTS;
+ /****/
+ public static String CreaterepoPreferencePage_checkTSNote;
+ /****/
+ public static String CreaterepoPreferencePage_changelogGroupLabel;
+ /****/
+ public static String CreaterepoPreferencePage_numChangelogLimit;
+ /****/
+ public static String CreaterepoPreferencePage_checksumGroupLabel;
+ /****/
+ public static String CreaterepoPreferencePage_compressionGroupLabel;
+
+ // CreaterepoDeltaPreferencePage
+ /****/
+ public static String CreaterepoDeltaPreferencePage_description;
+ /****/
+ public static String CreaterepoDeltaPreferencePage_groupLabel;
+ /****/
+ public static String CreaterepoDeltaPreferencePage_booleanEnableLabel;
+ /****/
+ public static String CreaterepoDeltaPreferencePage_maxNumberOfDeltas;
+ /****/
+ public static String CreaterepoDeltaPreferencePage_maxDeltaSize;
+
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
diff --git a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/form/ImportRPMsPage.java b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/form/ImportRPMsPage.java
index 7f68fad..bc7d267 100644
--- a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/form/ImportRPMsPage.java
+++ b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/form/ImportRPMsPage.java
@@ -285,13 +285,6 @@ public class ImportRPMsPage extends FormPage implements IResourceChangeListener
}
}
}
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.swt.events.SelectionAdapter#widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent)
- */
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {/* not implemented */}
}
/**
@@ -320,13 +313,6 @@ public class ImportRPMsPage extends FormPage implements IResourceChangeListener
}
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.swt.events.SelectionAdapter#widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent)
- */
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {/* not implemented */}
-
/**
* Delete the resource if the tree item has the same name as it.
*
@@ -370,13 +356,6 @@ public class ImportRPMsPage extends FormPage implements IResourceChangeListener
executeCreaterepo.setUser(true);
executeCreaterepo.schedule();
}
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.swt.events.SelectionAdapter#widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent)
- */
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {/* not implemented */}
}
/*
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 a61b720..98b8da0 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
@@ -83,3 +83,27 @@ MetadataPage_errorSavingPreferences=Error occured saving the data to preferences
# CreaterepoResourceChangeListener
CreaterepoResourceChangeListener_errorGettingResource=Error trying to get the resource from the editor.
+
+# CreaterepoPreferencePage
+CreaterepoPreferencePage_description=Configure the execution properties of createrepo.
+CreaterepoPreferencePage_generalGroupLabel=General
+CreaterepoPreferencePage_booleanChecksumName=Include the file's checksum in the metadata filename
+CreaterepoPreferencePage_booleanGenerateSQLDB=Generate sqlite database for use with yum
+CreaterepoPreferencePage_booleanIgnoreSymlinks=Ignore symlinks of packages
+CreaterepoPreferencePage_booleanPrettyXML=Output xml files in pretty format
+CreaterepoPreferencePage_numWorkers=Number of workers to read rpms (0 is automatic):
+CreaterepoPreferencePage_updateGroupLabel=Updates
+CreaterepoPreferencePage_booleanCheckTS=Generate metadata when its timestamps are older than its rpms'
+CreaterepoPreferencePage_checkTSNote=NOTE: This command will not notice when packages have been removed \
+ from repo. Update first then execute the command.
+CreaterepoPreferencePage_changelogGroupLabel=Changelog
+CreaterepoPreferencePage_numChangelogLimit=Limit of changelog entries (0 is automatic):
+CreaterepoPreferencePage_checksumGroupLabel=Checksum
+CreaterepoPreferencePage_compressionGroupLabel=Compresion
+
+# CreaterepoDeltaPreferencePage
+CreaterepoDeltaPreferencePage_description=Configure delta execution properties of createrepo.
+CreaterepoDeltaPreferencePage_groupLabel=Delta options
+CreaterepoDeltaPreferencePage_booleanEnableLabel=Generate deltarpms and the delta metadata
+CreaterepoDeltaPreferencePage_maxNumberOfDeltas=The number of older versions to make deltas against:
+CreaterepoDeltaPreferencePage_maxDeltaSize=Max size of an rpm to run deltarpm against (MByte):
diff --git a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/preference/CreaterepoDeltaPreferencePage.java b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/preference/CreaterepoDeltaPreferencePage.java
new file mode 100644
index 0000000..7e01d09
--- /dev/null
+++ b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/preference/CreaterepoDeltaPreferencePage.java
@@ -0,0 +1,130 @@
+/*******************************************************************************
+ * 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.preference;
+
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.jface.preference.BooleanFieldEditor;
+import org.eclipse.jface.preference.FieldEditor;
+import org.eclipse.jface.preference.FieldEditorPreferencePage;
+import org.eclipse.jface.preference.IntegerFieldEditor;
+import org.eclipse.jface.util.PropertyChangeEvent;
+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;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+import org.eclipse.ui.preferences.ScopedPreferenceStore;
+
+/**
+ * Keep track of delta specific options and pass it onto the createrepo command
+ * when executing.
+ */
+public class CreaterepoDeltaPreferencePage extends FieldEditorPreferencePage
+ implements IWorkbenchPreferencePage {
+
+ private Composite parent;
+ private BooleanFieldEditor bfeEnableDeltas;
+ private IntegerFieldEditor ifeMaxNumDeltas;
+ private IntegerFieldEditor ifeMaxSizeDeltas;
+ private Group optionsGroup;
+ private Composite enableContainer;
+
+ public CreaterepoDeltaPreferencePage() {
+ super(GRID);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
+ */
+ @Override
+ public void init(IWorkbench workbench) {
+ setPreferenceStore(new ScopedPreferenceStore(InstanceScope.INSTANCE, Activator.PLUGIN_ID));
+ setDescription(Messages.CreaterepoDeltaPreferencePage_description);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.preference.FieldEditorPreferencePage#checkState()
+ */
+ @Override
+ public void checkState() {
+ super.checkState();
+ // catches the setValidRange rule
+ if (!isValid()) {
+ bfeEnableDeltas.setEnabled(false, enableContainer);
+ } else {
+ bfeEnableDeltas.setEnabled(true, enableContainer);
+ ifeMaxNumDeltas.setEnabled(bfeEnableDeltas.getBooleanValue(), optionsGroup);
+ ifeMaxSizeDeltas.setEnabled(bfeEnableDeltas.getBooleanValue(), optionsGroup);
+ setErrorMessage(null);
+ setValid(true);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
+ */
+ @Override
+ public void propertyChange(PropertyChangeEvent event) {
+ if (event.getProperty().equals(FieldEditor.VALUE)) {
+ checkState();
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
+ */
+ @Override
+ protected void createFieldEditors() {
+ parent = getFieldEditorParent();
+ GridLayout layout = new GridLayout();
+
+ enableContainer = new Composite(parent, SWT.SHADOW_NONE);
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).span(2,1).indent(0, 20).applyTo(enableContainer);
+ bfeEnableDeltas = new BooleanFieldEditor(CreaterepoPreferenceConstants.PREF_DELTA_ENABLE,
+ Messages.CreaterepoDeltaPreferencePage_booleanEnableLabel, enableContainer);
+ bfeEnableDeltas.load();
+ bfeEnableDeltas.setPropertyChangeListener(this);
+ addField(bfeEnableDeltas);
+
+ optionsGroup = new Group(parent, SWT.SHADOW_ETCHED_IN);
+ optionsGroup.setText(Messages.CreaterepoDeltaPreferencePage_groupLabel);
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(optionsGroup);
+
+ // max deltas.
+ ifeMaxNumDeltas = new IntegerFieldEditor(CreaterepoPreferenceConstants.PREF_NUM_DELTAS,
+ Messages.CreaterepoDeltaPreferencePage_maxNumberOfDeltas, optionsGroup);
+ ifeMaxNumDeltas.setValidRange(0, Integer.MAX_VALUE);
+ ifeMaxNumDeltas.load();
+ addField(ifeMaxNumDeltas);
+
+ // max delta size. stored in megabytes for convenience to user
+ ifeMaxSizeDeltas = new IntegerFieldEditor(CreaterepoPreferenceConstants.PREF_MAX_DELTA_SIZE,
+ Messages.CreaterepoDeltaPreferencePage_maxDeltaSize, optionsGroup);
+ ifeMaxSizeDeltas.setValidRange(0, Integer.MAX_VALUE);
+ ifeMaxSizeDeltas.load();
+ addField(ifeMaxSizeDeltas);
+
+ // spaces around the group
+ layout = (GridLayout) optionsGroup.getLayout();
+ layout.marginWidth = 5;
+ layout.marginHeight = 5;
+ }
+
+}
diff --git a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/preference/CreaterepoPreferenceInitializer.java b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/preference/CreaterepoPreferenceInitializer.java
new file mode 100644
index 0000000..8654657
--- /dev/null
+++ b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/preference/CreaterepoPreferenceInitializer.java
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * 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.preference;
+
+import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
+import org.eclipse.core.runtime.preferences.DefaultScope;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.linuxtools.internal.rpm.createrepo.Activator;
+import org.eclipse.linuxtools.rpm.createrepo.CreaterepoPreferenceConstants;
+
+/**
+ * Initialize the default preferences.
+ */
+public class CreaterepoPreferenceInitializer extends
+ AbstractPreferenceInitializer {
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
+ */
+ @Override
+ public void initializeDefaultPreferences() {
+ // initial preferences
+ IEclipsePreferences node = DefaultScope.INSTANCE.getNode(Activator.PLUGIN_ID);
+ // CreaterepoPreferencePage
+ node.putBoolean(CreaterepoPreferenceConstants.PREF_UNIQUE_MD_NAME, CreaterepoPreferenceConstants.DEFAULT_UNIQUE_MD_NAME);
+ node.putBoolean(CreaterepoPreferenceConstants.PREF_GENERATE_DB, CreaterepoPreferenceConstants.DEFAULT_GENERATE_DB);
+ node.putBoolean(CreaterepoPreferenceConstants.PREF_IGNORE_SYMLINKS, CreaterepoPreferenceConstants.DEFAULT_IGNORE_SYMLINKS);
+ node.putBoolean(CreaterepoPreferenceConstants.PREF_PRETTY_XML, CreaterepoPreferenceConstants.DEFAULT_PRETTY);
+ node.putInt(CreaterepoPreferenceConstants.PREF_WORKERS, CreaterepoPreferenceConstants.DEFAULT_NUM_WORKERS);
+ node.putBoolean(CreaterepoPreferenceConstants.PREF_CHECK_TS, CreaterepoPreferenceConstants.DEFAULT_CHECK_TS);
+ node.putInt(CreaterepoPreferenceConstants.PREF_CHANGELOG_LIMIT, CreaterepoPreferenceConstants.DEFAULT_CHANGELOG_LIMIT);
+ node.put(CreaterepoPreferenceConstants.PREF_CHECKSUM, CreaterepoPreferenceConstants.DEFAULT_CHECKSUM);
+ node.put(CreaterepoPreferenceConstants.PREF_COMPRESSION_TYPE, CreaterepoPreferenceConstants.DEFAULT_COMPRESS_TYPE);
+
+ // CreaterepoDeltaPreferencePage
+ node.putBoolean(CreaterepoPreferenceConstants.PREF_DELTA_ENABLE, CreaterepoPreferenceConstants.DEFAULT_DELTA_ENABLE);
+ node.putInt(CreaterepoPreferenceConstants.PREF_NUM_DELTAS, CreaterepoPreferenceConstants.DEFAULT_NUM_DELTAS);
+ node.putInt(CreaterepoPreferenceConstants.PREF_MAX_DELTA_SIZE, CreaterepoPreferenceConstants.DEFAULT_MAX_DELTA_SIZE);
+
+ // default preferences
+ IPreferenceStore prefStore = Activator.getDefault().getPreferenceStore();
+ // CreaterepoPreferencePage
+ prefStore.setDefault(CreaterepoPreferenceConstants.PREF_UNIQUE_MD_NAME, CreaterepoPreferenceConstants.DEFAULT_UNIQUE_MD_NAME);
+ prefStore.setDefault(CreaterepoPreferenceConstants.PREF_GENERATE_DB, CreaterepoPreferenceConstants.DEFAULT_GENERATE_DB);
+ prefStore.setDefault(CreaterepoPreferenceConstants.PREF_IGNORE_SYMLINKS, CreaterepoPreferenceConstants.DEFAULT_IGNORE_SYMLINKS);
+ prefStore.setDefault(CreaterepoPreferenceConstants.PREF_PRETTY_XML, CreaterepoPreferenceConstants.DEFAULT_PRETTY);
+ prefStore.setDefault(CreaterepoPreferenceConstants.PREF_WORKERS, CreaterepoPreferenceConstants.DEFAULT_NUM_WORKERS);
+ prefStore.setDefault(CreaterepoPreferenceConstants.PREF_CHECK_TS, CreaterepoPreferenceConstants.DEFAULT_CHECK_TS);
+ prefStore.setDefault(CreaterepoPreferenceConstants.PREF_CHANGELOG_LIMIT, CreaterepoPreferenceConstants.DEFAULT_CHANGELOG_LIMIT);
+ prefStore.setDefault(CreaterepoPreferenceConstants.PREF_CHECKSUM, CreaterepoPreferenceConstants.DEFAULT_CHECKSUM);
+ prefStore.setDefault(CreaterepoPreferenceConstants.PREF_COMPRESSION_TYPE, CreaterepoPreferenceConstants.DEFAULT_COMPRESS_TYPE);
+
+ // CreaterepoDeltaPreferencePage
+ prefStore.setDefault(CreaterepoPreferenceConstants.PREF_DELTA_ENABLE, CreaterepoPreferenceConstants.DEFAULT_DELTA_ENABLE);
+ prefStore.setDefault(CreaterepoPreferenceConstants.PREF_NUM_DELTAS, CreaterepoPreferenceConstants.DEFAULT_NUM_DELTAS);
+ prefStore.setDefault(CreaterepoPreferenceConstants.PREF_MAX_DELTA_SIZE, CreaterepoPreferenceConstants.DEFAULT_MAX_DELTA_SIZE);
+ }
+
+}
diff --git a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/preference/CreaterepoPreferencePage.java b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/preference/CreaterepoPreferencePage.java
new file mode 100644
index 0000000..b3066e4
--- /dev/null
+++ b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/preference/CreaterepoPreferencePage.java
@@ -0,0 +1,215 @@
+/*******************************************************************************
+ * 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.preference;
+
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.jface.preference.BooleanFieldEditor;
+import org.eclipse.jface.preference.FieldEditor;
+import org.eclipse.jface.preference.FieldEditorPreferencePage;
+import org.eclipse.jface.preference.IntegerFieldEditor;
+import org.eclipse.jface.preference.RadioGroupFieldEditor;
+import org.eclipse.jface.util.PropertyChangeEvent;
+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.linuxtools.rpm.createrepo.ICreaterepoChecksums;
+import org.eclipse.linuxtools.rpm.createrepo.ICreaterepoCompressionTypes;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+import org.eclipse.ui.preferences.ScopedPreferenceStore;
+
+/**
+ * Keep track of the options to be passed to the command line when
+ * executing the createrepo command.
+ */
+public class CreaterepoPreferencePage extends FieldEditorPreferencePage implements
+ IWorkbenchPreferencePage {
+
+ private Group generalGroup;
+ private BooleanFieldEditor bfeIncludeChecksum;
+ private BooleanFieldEditor bfeSQLDB;
+ private BooleanFieldEditor bfeIgnoreSymlinks;
+ private BooleanFieldEditor bfePrettyXML;
+ private IntegerFieldEditor ifeSpawns;
+
+ private Group updatesGroup;
+ private BooleanFieldEditor bfeSameFilename;
+
+ private Group changelogGroup;
+ private IntegerFieldEditor ifeChangelogLimit;
+
+ private RadioGroupFieldEditor rgfeChecksums;
+ private RadioGroupFieldEditor rgfeCompressionTypes;
+
+ public CreaterepoPreferencePage() {
+ super(GRID);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
+ */
+ @Override
+ public void init(IWorkbench workbench) {
+ setPreferenceStore(new ScopedPreferenceStore(InstanceScope.INSTANCE, Activator.PLUGIN_ID));
+ setDescription(Messages.CreaterepoPreferencePage_description);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
+ */
+ @Override
+ public void propertyChange(PropertyChangeEvent event) {
+ if (event.getProperty().equals(FieldEditor.VALUE)) {
+ checkState();
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
+ */
+ @Override
+ protected void createFieldEditors() {
+ Composite parent = getFieldEditorParent();
+ GridData data = new GridData();
+ // general group
+ generalGroup = new Group(parent, SWT.SHADOW_ETCHED_IN);
+ generalGroup.setText(Messages.CreaterepoPreferencePage_generalGroupLabel);
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).span(2, 1).applyTo(generalGroup);
+
+ // generate unique metadata filenames
+ bfeIncludeChecksum = new BooleanFieldEditor(CreaterepoPreferenceConstants.PREF_UNIQUE_MD_NAME,
+ Messages.CreaterepoPreferencePage_booleanChecksumName, generalGroup);
+ bfeIncludeChecksum.load();
+ bfeIncludeChecksum.setPropertyChangeListener(this);
+ addField(bfeIncludeChecksum);
+
+ // generate sqlite databases
+ bfeSQLDB = new BooleanFieldEditor(CreaterepoPreferenceConstants.PREF_GENERATE_DB,
+ Messages.CreaterepoPreferencePage_booleanGenerateSQLDB, generalGroup);
+ bfeSQLDB.load();
+ bfeSQLDB.setPropertyChangeListener(this);
+ addField(bfeSQLDB);
+
+ // ignore symlinks for packages
+ bfeIgnoreSymlinks = new BooleanFieldEditor(CreaterepoPreferenceConstants.PREF_IGNORE_SYMLINKS,
+ Messages.CreaterepoPreferencePage_booleanIgnoreSymlinks, generalGroup);
+ bfeIgnoreSymlinks.load();
+ bfeIgnoreSymlinks.setPropertyChangeListener(this);
+ addField(bfeIgnoreSymlinks);
+
+ // output files in pretty xml format
+ bfePrettyXML = new BooleanFieldEditor(CreaterepoPreferenceConstants.PREF_PRETTY_XML,
+ Messages.CreaterepoPreferencePage_booleanPrettyXML, generalGroup);
+ bfePrettyXML.load();
+ bfePrettyXML.setPropertyChangeListener(this);
+ addField(bfePrettyXML);
+
+ // number of workers
+ ifeSpawns = new IntegerFieldEditor(CreaterepoPreferenceConstants.PREF_WORKERS,
+ Messages.CreaterepoPreferencePage_numWorkers, generalGroup);
+ // more than 128 is alot. limiting. (createrepo warning)
+ ifeSpawns.setValidRange(0, 128);
+ ifeSpawns.load();
+ addField(ifeSpawns);
+ updateGroupSpacing(generalGroup);
+
+ // updates group
+ updatesGroup = new Group(parent, SWT.SHADOW_ETCHED_IN);
+ updatesGroup.setText(Messages.CreaterepoPreferencePage_updateGroupLabel);
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).span(2, 1).hint(10, SWT.DEFAULT).applyTo(updatesGroup);
+
+ // don't generate repo metadata, if their timestamps are newer than its rpms
+ bfeSameFilename = new BooleanFieldEditor(CreaterepoPreferenceConstants.PREF_CHECK_TS,
+ Messages.CreaterepoPreferencePage_booleanCheckTS, updatesGroup);
+ bfeSameFilename.load();
+ bfeSameFilename.setPropertyChangeListener(this);
+ addField(bfeSameFilename);
+
+ // note of caution
+ Label lblCheckTs = new Label(updatesGroup, SWT.WRAP);
+ lblCheckTs.setText(Messages.CreaterepoPreferencePage_checkTSNote);
+ data = new GridData();
+ data.widthHint = 130;
+ data.horizontalAlignment = SWT.FILL;
+ data.grabExcessHorizontalSpace = true;
+ data.horizontalIndent = 5;
+ lblCheckTs.setLayoutData(data);
+ updateGroupSpacing(updatesGroup);
+
+ // changelog group
+ changelogGroup = new Group(parent, SWT.SHADOW_ETCHED_IN);
+ changelogGroup.setText(Messages.CreaterepoPreferencePage_changelogGroupLabel);
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).span(2, 1).hint(10, SWT.DEFAULT).applyTo(changelogGroup);
+
+ // don't generate repo metadata, if their timestamps are newer than its rpms
+ ifeChangelogLimit = new IntegerFieldEditor(CreaterepoPreferenceConstants.PREF_CHANGELOG_LIMIT,
+ Messages.CreaterepoPreferencePage_numChangelogLimit, changelogGroup);
+ ifeChangelogLimit.load();
+ ifeChangelogLimit.setPropertyChangeListener(this);
+ addField(ifeChangelogLimit);
+ updateGroupSpacing(changelogGroup);
+
+ Composite checksumsContainer = new Composite(parent, SWT.NONE);
+ checksumsContainer.setLayout(new GridLayout());
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).indent(0, 20).grab(true, false).applyTo(checksumsContainer);
+ // available checksums
+ rgfeChecksums = new RadioGroupFieldEditor(CreaterepoPreferenceConstants.PREF_CHECKSUM,
+ Messages.CreaterepoPreferencePage_checksumGroupLabel, 1, new String[][]{
+ {ICreaterepoChecksums.SHA1, ICreaterepoChecksums.SHA1},
+ {ICreaterepoChecksums.MD5, ICreaterepoChecksums.MD5},
+ {ICreaterepoChecksums.SHA256, ICreaterepoChecksums.SHA256},
+ {ICreaterepoChecksums.SHA512, ICreaterepoChecksums.SHA512}
+ }, checksumsContainer, true);
+ rgfeChecksums.load();
+ rgfeChecksums.setPropertyChangeListener(this);
+ addField(rgfeChecksums);
+
+ Composite compressContainer = new Composite(parent, SWT.NONE);
+ compressContainer.setLayout(new GridLayout());
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).indent(0, 20).grab(true, false).applyTo(compressContainer);
+ // available compression types
+ rgfeCompressionTypes = new RadioGroupFieldEditor(CreaterepoPreferenceConstants.PREF_COMPRESSION_TYPE,
+ Messages.CreaterepoPreferencePage_compressionGroupLabel, 1, new String[][]{
+ {ICreaterepoCompressionTypes.COMPAT, ICreaterepoCompressionTypes.COMPAT},
+ {ICreaterepoCompressionTypes.XZ, ICreaterepoCompressionTypes.XZ},
+ {ICreaterepoCompressionTypes.GZ, ICreaterepoCompressionTypes.GZ},
+ {ICreaterepoCompressionTypes.BZ2, ICreaterepoCompressionTypes.BZ2}
+ }, compressContainer, true);
+ rgfeCompressionTypes.load();
+ rgfeCompressionTypes.setPropertyChangeListener(this);
+ addField(rgfeCompressionTypes);
+ }
+
+ /**
+ * Make sure there is space above the group as well as space
+ * between the contents of the group and its border.
+ *
+ * @param group The group to update the spacing of.
+ */
+ private static void updateGroupSpacing(Group group) {
+ GridLayout layout = (GridLayout) group.getLayout();
+ GridData data = (GridData) group.getLayoutData();
+ layout.marginWidth = 5;
+ layout.marginHeight = 5;
+ data.verticalIndent = 20;
+ }
+
+}
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 a0cbcb0..cc730d0 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
@@ -23,4 +23,40 @@ public final class CreaterepoPreferenceConstants {
/****/ public static final String PREF_REPO_TAG = "repo"; //$NON-NLS-1$
/****/ public static final String PREF_REVISION = "revision"; //$NON-NLS-1$
+ // CreaterepoPreferencePage
+ /****/ public static final String PREF_UNIQUE_MD_NAME = "md-filenames"; //$NON-NLS-1$
+ /****/ public static final String PREF_GENERATE_DB = "database"; //$NON-NLS-1$
+ /****/ public static final String PREF_IGNORE_SYMLINKS = "skip-symlinks"; //$NON-NLS-1$
+ /****/ public static final String PREF_PRETTY_XML = "pretty"; //$NON-NLS-1$
+ /****/ public static final String PREF_WORKERS = "workers"; //$NON-NLS-1$
+ /****/ public static final String PREF_CHECK_TS = "checkts"; //$NON-NLS-1$
+ /****/ public static final String PREF_CHANGELOG_LIMIT = "changelog-limit"; //$NON-NLS-1$
+ /****/ public static final String PREF_CHECKSUM = "checksum"; //$NON-NLS-1$
+ /****/ public static final String PREF_COMPRESSION_TYPE = "compress-type"; //$NON-NLS-1$
+
+ // CreaterepoDeltaPreferencePage
+ /****/ public static final String PREF_DELTA_ENABLE = "deltas"; //$NON-NLS-1$
+ /****/ 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$
+
+ /*
+ * Preference Values.
+ */
+ // CreaterepoPreferencePage
+ /****/ public static final boolean DEFAULT_UNIQUE_MD_NAME = true;
+ /****/ public static final boolean DEFAULT_GENERATE_DB = true;
+ /****/ public static final boolean DEFAULT_IGNORE_SYMLINKS = false;
+ /****/ public static final boolean DEFAULT_PRETTY = false;
+ // createrepo will automatically set workers if 0
+ /****/ public static final int DEFAULT_NUM_WORKERS = 0;
+ /****/ public static final boolean DEFAULT_CHECK_TS = false;
+ // createrepo will automatically set limit to whatever is in rpm if 0
+ /****/ public static final int DEFAULT_CHANGELOG_LIMIT = 0;
+ /****/ public static final String DEFAULT_CHECKSUM = ICreaterepoChecksums.SHA256;
+ /****/ public static final String DEFAULT_COMPRESS_TYPE = ICreaterepoCompressionTypes.COMPAT;
+
+ // CreaterepoDeltaPreferencePage
+ /****/ public static final boolean DEFAULT_DELTA_ENABLE = false;
+ /****/ public static final int DEFAULT_NUM_DELTAS = 1;
+ /****/ public static final int DEFAULT_MAX_DELTA_SIZE = 10;
}
diff --git a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/rpm/createrepo/ICreaterepoChecksums.java b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/rpm/createrepo/ICreaterepoChecksums.java
new file mode 100644
index 0000000..c38b83b
--- /dev/null
+++ b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/rpm/createrepo/ICreaterepoChecksums.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * 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.rpm.createrepo;
+
+/**
+ * Valid checksums that createrepo command uses.
+ */
+public interface ICreaterepoChecksums {
+
+ /**
+ * Default checksum.
+ */
+ String SHA256 = "sha256"; //$NON-NLS-1$
+
+ /**
+ * Old default. Older versions of yum (3.0.x) not supported.
+ */
+ String SHA1 = "sha1"; //$NON-NLS-1$
+
+ /**
+ * MD5.
+ */
+ String MD5 = "md5"; //$NON-NLS-1$
+
+ /**
+ * SHA512.
+ */
+ String SHA512 = "sha512"; //$NON-NLS-1$
+
+}
diff --git a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/rpm/createrepo/ICreaterepoCompressionTypes.java b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/rpm/createrepo/ICreaterepoCompressionTypes.java
new file mode 100644
index 0000000..2ff69f7
--- /dev/null
+++ b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/rpm/createrepo/ICreaterepoCompressionTypes.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * 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.rpm.createrepo;
+
+/**
+ * Valid compression types that createrepo command uses.
+ */
+public interface ICreaterepoCompressionTypes {
+
+ /**
+ * Default compression type.
+ */
+ String COMPAT = "compat"; //$NON-NLS-1$
+
+ /**
+ * May not be available.
+ */
+ String XZ = "xz"; //$NON-NLS-1$
+
+ /**
+ * GZ.
+ */
+ String GZ = "gz"; //$NON-NLS-1$
+
+ /**
+ * BZ2.
+ */
+ String BZ2 = "bz2"; //$NON-NLS-1$
+
+}