summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorNeil Guzman2013-09-11 17:03:45 (EDT)
committer Alexander Kurtakov2013-10-09 05:36:18 (EDT)
commit1cfb57451f64d197cc97233bd3f8494b8e078eb6 (patch)
tree78c71083dcfbc0f0176503d650d27ecabd0e0579
parentb10789fa892f0882521a9f267f244f1ca128b82f (diff)
downloadorg.eclipse.linuxtools-1cfb57451f64d197cc97233bd3f8494b8e078eb6.zip
org.eclipse.linuxtools-1cfb57451f64d197cc97233bd3f8494b8e078eb6.tar.gz
org.eclipse.linuxtools-1cfb57451f64d197cc97233bd3f8494b8e078eb6.tar.bz2
RPM: Add menu for building RPMsrefs/changes/80/16380/11
New menu items have been added, as well as reorganized, to accomodate 3 new RPM options: Build SRPM, Build RPMS, and Build All. The purpose is to remove it from the export page and make it similar to eclipse-fedorapackager building functions. Bug: 279648 Change-Id: I5ede34422e570e2bc87ddd5c54985f086113cdfb Signed-off-by: Neil Guzman <nguzman@redhat.com> Reviewed-on: https://git.eclipse.org/r/16380 Tested-by: Hudson CI 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.rpmlint/plugin.xml2
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/plugin.properties2
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/plugin.xml134
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/actions/Messages.java2
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/actions/messages.properties2
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui/OSGI-INF/l10n/bundle.properties7
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui/plugin.xml130
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/Activator.java14
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/RPMExportWizard.java3
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/handlers/SpecfileEditorRPMBuildHandler.java124
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/rpm_strings.properties5
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/rpm/ui/RPMExportOperation.java (renamed from rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/RPMExportOperation.java)29
12 files changed, 380 insertions, 74 deletions
diff --git a/rpm/org.eclipse.linuxtools.rpm.rpmlint/plugin.xml b/rpm/org.eclipse.linuxtools.rpm.rpmlint/plugin.xml
index 7e8bcbb..870e784 100644
--- a/rpm/org.eclipse.linuxtools.rpm.rpmlint/plugin.xml
+++ b/rpm/org.eclipse.linuxtools.rpm.rpmlint/plugin.xml
@@ -49,7 +49,7 @@
<extension
point="org.eclipse.ui.menus">
<menuContribution
- locationURI="popup:org.eclipse.linuxtools.rpm.ui.popup">
+ locationURI="popup:org.eclipse.linuxtools.rpm.ui.popup?before=org.eclipse.linuxtools.rpm.ui.miscsep">
<command
commandId="rpmlint.toggleRpmlint.command"
label="%addremovewarnings.name" >
diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/plugin.properties b/rpm/org.eclipse.linuxtools.rpm.ui.editor/plugin.properties
index 508b7a1..320c353 100644
--- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/plugin.properties
+++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/plugin.properties
@@ -35,4 +35,4 @@ command.tooltip = Add or Remove Comments
command.label.0 = Organize patches
command.tooltip.0 = Organize patches numerically
command.label.1 = Show Outline
-command.tooltip.1 = Display project outline of .spec file \ No newline at end of file
+command.tooltip.1 = Display project outline of .spec file
diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/plugin.xml b/rpm/org.eclipse.linuxtools.rpm.ui.editor/plugin.xml
index 9ccf2be..1b4d17b 100644
--- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/plugin.xml
+++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/plugin.xml
@@ -307,58 +307,7 @@
<extension
point="org.eclipse.ui.menus">
<menuContribution
- locationURI="popup:org.eclipse.linuxtools.rpm.ui.popup">
- <command
- commandId="rpmEditor.toggleComment.command"
- label="%command.label"
- tooltip="%command.tooltip">
- <visibleWhen>
- <iterate operator="or" ifEmpty="false">
- <or>
- <adapt type="org.eclipse.core.resources.IResource">
- <test property="org.eclipse.core.resources.name" value="*.spec"/>
- </adapt>
- <with variable="activeEditorId">
- <equals value="org.eclipse.linuxtools.rpm.ui.editor.SpecfileEditor"/>
- </with>
- </or>
- </iterate>
- </visibleWhen>
- </command>
- <command
- commandId="rpmEditor.organizePatches.command"
- label="%command.label.0"
- tooltip="%command.tooltip.0">
- <visibleWhen>
- <iterate operator="or" ifEmpty="false">
- <or>
- <adapt type="org.eclipse.core.resources.IResource">
- <test property="org.eclipse.core.resources.name" value="*.spec"/>
- </adapt>
- <with variable="activeEditorId">
- <equals value="org.eclipse.linuxtools.rpm.ui.editor.SpecfileEditor"/>
- </with>
- </or>
- </iterate>
- </visibleWhen>
- </command>
- <command
- commandId="rpmEditor.showOutline.command"
- label="%command.label.1"
- tooltip="%command.tooltip.1">
- <visibleWhen>
- <iterate operator="or" ifEmpty="false">
- <or>
- <adapt type="org.eclipse.core.resources.IResource">
- <test property="org.eclipse.core.resources.name" value="*.spec"/>
- </adapt>
- <with variable="activeEditorId">
- <equals value="org.eclipse.linuxtools.rpm.ui.editor.SpecfileEditor"/>
- </with>
- </or>
- </iterate>
- </visibleWhen>
- </command>
+ locationURI="popup:org.eclipse.linuxtools.rpm.ui.popup?before=org.eclipse.linuxtools.rpm.ui.sourcesep">
<command
commandId="rpmEditor.downloadSources.command"
label="%command.name.2"
@@ -412,6 +361,87 @@
</visibleWhen>
</command>
</menuContribution>
+ <menuContribution
+ locationURI="popup:org.eclipse.linuxtools.rpm.ui.popup?before=org.eclipse.linuxtools.rpm.ui.miscsep">
+ <command
+ commandId="rpmEditor.toggleComment.command"
+ label="%command.label"
+ tooltip="%command.tooltip">
+ <visibleWhen>
+ <iterate
+ ifEmpty="false"
+ operator="or">
+ <or>
+ <adapt
+ type="org.eclipse.core.resources.IResource">
+ <test
+ property="org.eclipse.core.resources.name"
+ value="*.spec">
+ </test>
+ </adapt>
+ <with
+ variable="activeEditorId">
+ <equals
+ value="org.eclipse.linuxtools.rpm.ui.editor.SpecfileEditor">
+ </equals>
+ </with>
+ </or>
+ </iterate>
+ </visibleWhen>
+ </command>
+ <command
+ commandId="rpmEditor.organizePatches.command"
+ label="%command.label.0"
+ tooltip="%command.tooltip.0">
+ <visibleWhen>
+ <iterate
+ ifEmpty="false"
+ operator="or">
+ <or>
+ <adapt
+ type="org.eclipse.core.resources.IResource">
+ <test
+ property="org.eclipse.core.resources.name"
+ value="*.spec">
+ </test>
+ </adapt>
+ <with
+ variable="activeEditorId">
+ <equals
+ value="org.eclipse.linuxtools.rpm.ui.editor.SpecfileEditor">
+ </equals>
+ </with>
+ </or>
+ </iterate>
+ </visibleWhen>
+ </command>
+ <command
+ commandId="rpmEditor.showOutline.command"
+ label="%command.label.1"
+ tooltip="%command.tooltip.1">
+ <visibleWhen>
+ <iterate
+ ifEmpty="false"
+ operator="or">
+ <or>
+ <adapt
+ type="org.eclipse.core.resources.IResource">
+ <test
+ property="org.eclipse.core.resources.name"
+ value="*.spec">
+ </test>
+ </adapt>
+ <with
+ variable="activeEditorId">
+ <equals
+ value="org.eclipse.linuxtools.rpm.ui.editor.SpecfileEditor">
+ </equals>
+ </with>
+ </or>
+ </iterate>
+ </visibleWhen>
+ </command>
+ </menuContribution>
</extension>
<!-- Compare support-->
<extension point="org.eclipse.compare.contentMergeViewers">
diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/actions/Messages.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/actions/Messages.java
index ef79822..14325e4 100644
--- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/actions/Messages.java
+++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/actions/Messages.java
@@ -4,7 +4,7 @@
* 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:
* Red Hat - initial API and implementation
*******************************************************************************/
diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/actions/messages.properties b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/actions/messages.properties
index 289d8ae..09d1f5c 100644
--- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/actions/messages.properties
+++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/actions/messages.properties
@@ -32,4 +32,4 @@ PrepareSources_prepareSources=Preparing sources for {0}
PrepareSources_consoleName=rpmbuild({0})
# RPMHandlerUtils
-RPMHandlerUtils_cannotCreateRPMProject=Error trying to retrieve the RPM Project. \ No newline at end of file
+RPMHandlerUtils_cannotCreateRPMProject=Error trying to retrieve the RPM Project.
diff --git a/rpm/org.eclipse.linuxtools.rpm.ui/OSGI-INF/l10n/bundle.properties b/rpm/org.eclipse.linuxtools.rpm.ui/OSGI-INF/l10n/bundle.properties
index 27a3c70..926def0 100644
--- a/rpm/org.eclipse.linuxtools.rpm.ui/OSGI-INF/l10n/bundle.properties
+++ b/rpm/org.eclipse.linuxtools.rpm.ui/OSGI-INF/l10n/bundle.properties
@@ -14,4 +14,9 @@ Bundle-Vendor.0 = Eclipse Linux Tools
Bundle-Name.0 = RPM UI Plug-in
extension.name = RPM
-menu.label = RPM \ No newline at end of file
+menu.label = RPM
+
+command.name.0 = Build SRPM
+command.name.1 = Build RPMS
+command.name.2 = Build ALL
+command.name.3 = RPM Build Command
diff --git a/rpm/org.eclipse.linuxtools.rpm.ui/plugin.xml b/rpm/org.eclipse.linuxtools.rpm.ui/plugin.xml
index fd56a2f..1ad0bec 100644
--- a/rpm/org.eclipse.linuxtools.rpm.ui/plugin.xml
+++ b/rpm/org.eclipse.linuxtools.rpm.ui/plugin.xml
@@ -118,11 +118,137 @@
name="%extension.name"
point="org.eclipse.ui.menus">
<menuContribution
- locationURI="popup:org.eclipse.ui.popup.any?after=additions" >
- <menu id="org.eclipse.linuxtools.rpm.ui.popup"
+ locationURI="popup:org.eclipse.ui.popup.any?before=additions" >
+ <menu
+ icon="icons/rpm.gif"
+ id="org.eclipse.linuxtools.rpm.ui.popup"
label="%menu.label">
+ <separator
+ name="org.eclipse.linuxtools.rpm.ui.buildsep"
+ visible="true">
+ </separator>
+ <separator
+ name="org.eclipse.linuxtools.rpm.ui.sourcesep"
+ visible="true">
+ </separator>
+ <separator
+ name="org.eclipse.linuxtools.rpm.ui.miscsep"
+ visible="true">
+ </separator>
</menu>
</menuContribution>
+ <menuContribution
+ locationURI="popup:org.eclipse.linuxtools.rpm.ui.popup?before=org.eclipse.linuxtools.rpm.ui.buildsep">
+ <command
+ commandId="rpmEditor.build.command"
+ label="%command.name.0"
+ tooltip="%command.name.0">
+ <visibleWhen>
+ <iterate
+ ifEmpty="false"
+ operator="or">
+ <or>
+ <adapt
+ type="org.eclipse.core.resources.IResource">
+ <test
+ property="org.eclipse.core.resources.name"
+ value="*.spec">
+ </test>
+ </adapt>
+ <with
+ variable="activeEditorId">
+ <equals
+ value="org.eclipse.linuxtools.rpm.ui.editor.SpecfileEditor">
+ </equals>
+ </with>
+ </or>
+ </iterate>
+ </visibleWhen>
+ <parameter
+ name="buildType"
+ value="SOURCE">
+ </parameter>
+ </command>
+ <command
+ commandId="rpmEditor.build.command"
+ label="%command.name.1"
+ tooltip="%command.name.1">
+ <visibleWhen>
+ <iterate
+ ifEmpty="false"
+ operator="or">
+ <or>
+ <adapt
+ type="org.eclipse.core.resources.IResource">
+ <test
+ property="org.eclipse.core.resources.name"
+ value="*.spec">
+ </test>
+ </adapt>
+ <with
+ variable="activeEditorId">
+ <equals
+ value="org.eclipse.linuxtools.rpm.ui.editor.SpecfileEditor">
+ </equals>
+ </with>
+ </or>
+ </iterate>
+ </visibleWhen>
+ <parameter
+ name="buildType"
+ value="BINARY">
+ </parameter>
+ </command>
+ <command
+ commandId="rpmEditor.build.command"
+ label="%command.name.2"
+ tooltip="%command.name.2">
+ <visibleWhen>
+ <iterate
+ ifEmpty="false"
+ operator="or">
+ <or>
+ <adapt
+ type="org.eclipse.core.resources.IResource">
+ <test
+ property="org.eclipse.core.resources.name"
+ value="*.spec">
+ </test>
+ </adapt>
+ <with
+ variable="activeEditorId">
+ <equals
+ value="org.eclipse.linuxtools.rpm.ui.editor.SpecfileEditor">
+ </equals>
+ </with>
+ </or>
+ </iterate>
+ </visibleWhen>
+ <parameter
+ name="buildType"
+ value="ALL">
+ </parameter>
+ </command>
+ </menuContribution>
+ </extension>
+ <extension
+ point="org.eclipse.ui.commands">
+ <command
+ id="rpmEditor.build.command"
+ name="%command.name.3">
+ <commandParameter
+ id="buildType"
+ name="buildType"
+ optional="true">
+ </commandParameter>
+ </command>
+ </extension>
+ <extension
+ point="org.eclipse.ui.handlers">
+ <handler
+ class="org.eclipse.linuxtools.internal.rpm.ui.handlers.SpecfileEditorRPMBuildHandler"
+ commandId="rpmEditor.build.command">
+ </handler>
</extension>
</plugin>
diff --git a/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/Activator.java b/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/Activator.java
index 0fbc7c4..c5c896f 100644
--- a/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/Activator.java
+++ b/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/Activator.java
@@ -10,6 +10,8 @@
*******************************************************************************/
package org.eclipse.linuxtools.internal.rpm.ui;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
@@ -52,4 +54,16 @@ public class Activator extends AbstractUIPlugin {
public static Activator getDefault() {
return plugin;
}
+
+ /**
+ * Log an error.
+ *
+ * @param message A human-readable message.
+ * @param exception The exception to log.
+ */
+ public static void logError(String message, Throwable exception) {
+ IStatus status = new Status(IStatus.ERROR, PLUGIN_ID, message,
+ exception);
+ getDefault().getLog().log(status);
+ }
}
diff --git a/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/RPMExportWizard.java b/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/RPMExportWizard.java
index 3c1bb38..20a16b7 100644
--- a/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/RPMExportWizard.java
+++ b/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/RPMExportWizard.java
@@ -16,6 +16,7 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.linuxtools.rpm.core.IRPMConstants;
+import org.eclipse.linuxtools.rpm.ui.RPMExportOperation;
import org.eclipse.ui.IExportWizard;
import org.eclipse.ui.IWorkbench;
@@ -45,7 +46,7 @@ public class RPMExportWizard extends Wizard implements IExportWizard {
public boolean performFinish() {
// Create a new instance of the RPMExportOperation runnable
final RPMExportOperation rpmExport = new RPMExportOperation(mainPage
- .getSelectedRPMProject(), mainPage.getExportType());
+ .getSelectedRPMProject(), mainPage.getExportType().toString());
// Run the export
rpmExport.setUser(true);
rpmExport.schedule();
diff --git a/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/handlers/SpecfileEditorRPMBuildHandler.java b/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/handlers/SpecfileEditorRPMBuildHandler.java
new file mode 100644
index 0000000..2782fa1
--- /dev/null
+++ b/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/handlers/SpecfileEditorRPMBuildHandler.java
@@ -0,0 +1,124 @@
+/*******************************************************************************
+ * Copyright (c) 2013 Red Hat, Inc.
+ * 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:
+ * Red Hat - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.rpm.ui.handlers;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.QualifiedName;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.linuxtools.internal.rpm.ui.Activator;
+import org.eclipse.linuxtools.internal.rpm.ui.Messages;
+import org.eclipse.linuxtools.rpm.core.IRPMConstants;
+import org.eclipse.linuxtools.rpm.core.RPMProject;
+import org.eclipse.linuxtools.rpm.core.RPMProjectLayout;
+import org.eclipse.linuxtools.rpm.ui.RPMExportOperation;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IFileEditorInput;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchSite;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.eclipse.ui.part.EditorPart;
+
+/**
+ * Common functionality of all build handlers.
+ *
+ * @since 1.0.0
+ */
+public class SpecfileEditorRPMBuildHandler extends AbstractHandler {
+
+ protected RPMProject rpj;
+
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ final IResource resource = getResource(event);
+ final String eventBuildType = event.getParameter("buildType"); //$NON-NLS-1$
+ rpj = getRPMProject(resource);
+ Job job = new RPMExportOperation(rpj, eventBuildType);
+ job.setUser(true);
+ job.schedule();
+ return null;
+ }
+
+ /**
+ * Extract the IResource that was selected when the event was fired.
+ * @param event The fired execution event.
+ * @return The resource that was selected.
+ */
+ private static IResource getResource(ExecutionEvent event) {
+ IWorkbenchPart part = HandlerUtil.getActivePart(event);
+ if (part == null) {
+ return null;
+ }
+ if (part instanceof EditorPart) {
+ IEditorInput input = ((EditorPart) part).getEditorInput();
+ if (input instanceof IFileEditorInput) {
+ return ((IFileEditorInput) input).getFile();
+ }
+ return null;
+ }
+ IWorkbenchSite site = part.getSite();
+ if (site == null) {
+ return null;
+ }
+ ISelectionProvider provider = site.getSelectionProvider();
+ if (provider == null) {
+ return null;
+ }
+ ISelection selection = provider.getSelection();
+ if (selection instanceof IStructuredSelection) {
+ Object element = ((IStructuredSelection) selection)
+ .getFirstElement();
+ if (element instanceof IResource) {
+ return (IResource) element;
+ } else if (element instanceof IAdaptable) {
+ IAdaptable adaptable = (IAdaptable) element;
+ return (IResource) adaptable.getAdapter(IResource.class);
+ } else {
+ return null;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Get an RPMProject for the resource creating a new instance to an RPMProject.
+ * @param resource The resource to check its parent project.
+ * @return The RPMProject of the resource passed in.
+ */
+ private static RPMProject getRPMProject(IResource resource) {
+ RPMProject rc = null;
+ try {
+ IProject parentProject = resource.getProject();
+
+ // determine if project selected is an RPMProject
+ if (parentProject.hasNature(IRPMConstants.RPM_NATURE_ID)) {
+ if (parentProject.getPersistentProperty(new QualifiedName(IRPMConstants.RPM_CORE_ID, IRPMConstants.SPECS_FOLDER)) != null){
+ rc = new RPMProject(parentProject, RPMProjectLayout.RPMBUILD);
+ } else {
+ rc = new RPMProject(parentProject, RPMProjectLayout.FLAT);
+ }
+ } else {
+ rc = new RPMProject(parentProject, RPMProjectLayout.FLAT);
+ }
+ } catch (CoreException e) {
+ Activator.logError(Messages.getString("SpecfileEditorRPMBuildHandler.logRPMProjectError"), e); //$NON-NLS-1$
+ }
+ return rc;
+ }
+}
diff --git a/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/rpm_strings.properties b/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/rpm_strings.properties
index 090a15b..8575707 100644
--- a/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/rpm_strings.properties
+++ b/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/rpm_strings.properties
@@ -179,4 +179,7 @@ RPMNewProject.0=New RPM Project
RPMNewProject.1=Create a new RPM project
RPMNewProject.2=Created project will have a standard rpmbuild structure.
-NewProjectCreationPage.0=Working sets \ No newline at end of file
+NewProjectCreationPage.0=Working sets
+
+# SpecfileEditorRPMBuildHandler
+SpecfileEditorRPMBuildHandler.logRPMProjectError=Unable to get the RPM Project.
diff --git a/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/RPMExportOperation.java b/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/rpm/ui/RPMExportOperation.java
index 1667c68..34b660c 100644
--- a/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/RPMExportOperation.java
+++ b/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/rpm/ui/RPMExportOperation.java
@@ -8,13 +8,16 @@
* Contributors:
* Red Hat - initial API and implementation
*******************************************************************************/
-package org.eclipse.linuxtools.internal.rpm.ui;
+package org.eclipse.linuxtools.rpm.ui;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.linuxtools.internal.rpm.ui.BuildType;
+import org.eclipse.linuxtools.internal.rpm.ui.Messages;
+import org.eclipse.linuxtools.internal.rpm.ui.RpmConsole;
import org.eclipse.linuxtools.rpm.core.RPMProject;
import org.eclipse.ui.console.IOConsole;
import org.eclipse.ui.console.IOConsoleOutputStream;
@@ -22,7 +25,7 @@ import org.osgi.framework.FrameworkUtil;
/**
* Job for handling rpm exports.
- *
+ * @since 1.0.0
*/
public class RPMExportOperation extends Job {
private RPMProject rpmProject;
@@ -30,19 +33,19 @@ public class RPMExportOperation extends Job {
/**
* Creates the job for exporting rpms.
- *
+ *
* @param rpmProject The project to use as base for the export operation.
- * @param exportType The export type.
+ * @param exportType The export type. [SOURCE, BINARY, ALL]
*/
- public RPMExportOperation(RPMProject rpmProject, BuildType exportType) {
+ public RPMExportOperation(RPMProject rpmProject, String exportType) {
super(Messages.getString("RPMExportWizard.0")); //$NON-NLS-1$
this.rpmProject = rpmProject;
- this.exportType = exportType;
+ this.exportType = BuildType.valueOf(exportType);
}
/**
* @see org.eclipse.jface.operation.IRunnableWithProgress#run(IProgressMonitor)
- *
+ *
*/
@Override
public IStatus run(IProgressMonitor monitor) {
@@ -54,8 +57,8 @@ public class RPMExportOperation extends Job {
switch (exportType) {
case ALL:
try {
- monitor.setTaskName(Messages
- .getString("RPMExportOperation.Executing_RPM_Export")); //$NON-NLS-1$
+ monitor.beginTask(Messages
+ .getString("RPMExportOperation.Executing_RPM_Export"), IProgressMonitor.UNKNOWN); //$NON-NLS-1$
result = rpmProject.buildAll(out);
} catch (CoreException e) {
result = new Status(IStatus.ERROR, FrameworkUtil.getBundle(this.getClass()).getSymbolicName(),
@@ -64,8 +67,8 @@ public class RPMExportOperation extends Job {
break;
case BINARY:
- monitor.setTaskName(Messages
- .getString("RPMExportOperation.Executing_RPM_Export")); //$NON-NLS-1$
+ monitor.beginTask(Messages
+ .getString("RPMExportOperation.Executing_RPM_Export"), IProgressMonitor.UNKNOWN); //$NON-NLS-1$
try {
result = rpmProject.buildBinaryRPM(out);
} catch (CoreException e) {
@@ -75,8 +78,8 @@ public class RPMExportOperation extends Job {
break;
case SOURCE:
- monitor.setTaskName(Messages
- .getString("RPMExportOperation.Executing_SRPM_Export")); //$NON-NLS-1$
+ monitor.beginTask(Messages
+ .getString("RPMExportOperation.Executing_SRPM_Export"), IProgressMonitor.UNKNOWN); //$NON-NLS-1$
try {
result = rpmProject.buildSourceRPM(out);
} catch (CoreException e) {