aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeil Guzman2013-12-06 12:25:17 (EST)
committerAlexander Kurtakov2013-12-12 09:08:44 (EST)
commitbfd6650197bcaabdd6ae7453a10b2912997588c2 (patch)
tree622bf3bd16423cc5d46e2bef65c53b34ffefea44
parent4bed1bb27ad699bc7ddc707c0a2f9c4dcb94cfce (diff)
downloadorg.eclipse.linuxtools-bfd6650197bcaabdd6ae7453a10b2912997588c2.zip
org.eclipse.linuxtools-bfd6650197bcaabdd6ae7453a10b2912997588c2.tar.gz
org.eclipse.linuxtools-bfd6650197bcaabdd6ae7453a10b2912997588c2.tar.bz2
RPM: createrepo update commandrefs/changes/51/19451/7
Same as execute but calls --update. Added button on form pages. Change-Id: Iee3ad1c3569cc3f473263c2d643916162d1940ec Signed-off-by: Neil Guzman <nguzman@redhat.com> Reviewed-on: https://git.eclipse.org/r/19451 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/icons/refresh.gifbin0 -> 327 bytes
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.createrepo/plugin.properties3
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.createrepo/plugin.xml23
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/handler/CreaterepoCommandHandler.java (renamed from rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/handler/CreaterepoExecuteCommandHandler.java)13
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/rpm/createrepo/CreaterepoPreferenceConstants.java3
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/rpm/createrepo/CreaterepoProject.java19
6 files changed, 55 insertions, 6 deletions
diff --git a/rpm/org.eclipse.linuxtools.rpm.createrepo/icons/refresh.gif b/rpm/org.eclipse.linuxtools.rpm.createrepo/icons/refresh.gif
new file mode 100644
index 0000000..3ca04d0
--- /dev/null
+++ b/rpm/org.eclipse.linuxtools.rpm.createrepo/icons/refresh.gif
Binary files differ
diff --git a/rpm/org.eclipse.linuxtools.rpm.createrepo/plugin.properties b/rpm/org.eclipse.linuxtools.rpm.createrepo/plugin.properties
index 3b2549f..417a89c 100644
--- a/rpm/org.eclipse.linuxtools.rpm.createrepo/plugin.properties
+++ b/rpm/org.eclipse.linuxtools.rpm.createrepo/plugin.properties
@@ -18,4 +18,5 @@ contentType.name = Repo File Content Type
delta.preference.name = Deltas
nature.name = Createrepo Nature
-execute.command = Execute Command
+execute.command = Execute
+update.command = Update
diff --git a/rpm/org.eclipse.linuxtools.rpm.createrepo/plugin.xml b/rpm/org.eclipse.linuxtools.rpm.createrepo/plugin.xml
index 617bc9d..e516a4d 100644
--- a/rpm/org.eclipse.linuxtools.rpm.createrepo/plugin.xml
+++ b/rpm/org.eclipse.linuxtools.rpm.createrepo/plugin.xml
@@ -56,9 +56,23 @@
locationURI="toolbar:formsToolbar">
<command
commandId="org.eclipse.linuxtools.rpm.createrepo.executeCommand"
+ icon="icons/refresh.gif"
+ style="push"
+ tooltip="%update.command">
+ <parameter
+ name="executionType"
+ value="refresh">
+ </parameter>
+ </command>
+ <command
+ commandId="org.eclipse.linuxtools.rpm.createrepo.executeCommand"
icon="icons/run_exc.gif"
style="push"
- tooltip="%execute.command">
+ tooltip="%main.name">
+ <parameter
+ name="executionType"
+ value="createrepo">
+ </parameter>
</command>
</menuContribution>
</extension>
@@ -67,12 +81,17 @@
<command
id="org.eclipse.linuxtools.rpm.createrepo.executeCommand"
name="%execute.command">
+ <commandParameter
+ id="executionType"
+ name="executionType"
+ optional="false">
+ </commandParameter>
</command>
</extension>
<extension
point="org.eclipse.ui.handlers">
<handler
- class="org.eclipse.linuxtools.internal.rpm.createrepo.handler.CreaterepoExecuteCommandHandler"
+ class="org.eclipse.linuxtools.internal.rpm.createrepo.handler.CreaterepoCommandHandler"
commandId="org.eclipse.linuxtools.rpm.createrepo.executeCommand">
</handler>
</extension>
diff --git a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/handler/CreaterepoExecuteCommandHandler.java b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/handler/CreaterepoCommandHandler.java
index 36949cf..b371733 100644
--- a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/handler/CreaterepoExecuteCommandHandler.java
+++ b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/handler/CreaterepoCommandHandler.java
@@ -22,7 +22,6 @@ import org.eclipse.linuxtools.internal.rpm.createrepo.Activator;
import org.eclipse.linuxtools.internal.rpm.createrepo.Messages;
import org.eclipse.linuxtools.rpm.createrepo.CreaterepoProject;
import org.eclipse.linuxtools.rpm.createrepo.CreaterepoUtils;
-import org.eclipse.linuxtools.rpm.createrepo.ICreaterepoConstants;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPage;
@@ -30,7 +29,10 @@ import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.console.MessageConsoleStream;
import org.eclipse.ui.ide.ResourceUtil;
-public class CreaterepoExecuteCommandHandler extends AbstractHandler {
+/**
+ * Handle the execution of the Update and Execute button.
+ */
+public class CreaterepoCommandHandler extends AbstractHandler {
/*
* (non-Javadoc)
@@ -38,6 +40,7 @@ public class CreaterepoExecuteCommandHandler extends AbstractHandler {
*/
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
+ final String executionType = event.getParameter("executionType"); //$NON-NLS-1$
try {
IWorkbench wb = PlatformUI.getWorkbench();
IWorkbenchPage wbPage = wb.getActiveWorkbenchWindow().getActivePage();
@@ -51,7 +54,11 @@ public class CreaterepoExecuteCommandHandler extends AbstractHandler {
monitor.beginTask(Messages.CreaterepoProject_executeCreaterepo, IProgressMonitor.UNKNOWN);
MessageConsoleStream os = CreaterepoUtils.findConsole(Messages.CreaterepoProject_consoleName)
.newMessageStream();
- return project.createrepo(os);
+ if (executionType.equals("refresh")) { //$NON-NLS-1$
+ return project.update(os);
+ } else {
+ return project.createrepo(os);
+ }
} catch (CoreException e) {
Activator.logError(Messages.Createrepo_errorExecuting, e);
} finally {
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 0fb1398..59f5f0e 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
@@ -47,6 +47,9 @@ public final class CreaterepoPreferenceConstants {
/****/ public static final String PREF_VERBOSE = "verbose"; //$NON-NLS-1$
/****/ public static final String PREF_PROFILE = "profile"; //$NON-NLS-1$
+ // Misc
+ /****/ public static final String PREF_UPDATE = "update"; //$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 ea8aca4..bfff0d5 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
@@ -152,6 +152,25 @@ public class CreaterepoProject {
}
/**
+ * Execute the createrepo command with a call to update.
+ *
+ * @param os Direct execution stream to this.
+ * @return The status of the execution.
+ * @throws CoreException Thrown when failure to execute command.
+ */
+ public IStatus update(OutputStream os) throws CoreException {
+ if (!getContentFolder().exists()) {
+ createContentFolder();
+ }
+ Createrepo createrepo = new Createrepo();
+ List<String> commands = getCommandArguments();
+ commands.add(ICreaterepoConstants.DASH.concat(CreaterepoPreferenceConstants.PREF_UPDATE));
+ IStatus result = createrepo.execute(os, this, commands);
+ getProject().refreshLocal(IResource.DEPTH_INFINITE, monitor);
+ return result;
+ }
+
+ /**
* Get the project.
*
* @return The project.