diff options
author | Alexander Kurtakov | 2013-02-18 20:18:47 +0000 |
---|---|---|
committer | Camilo Bernal | 2013-02-19 20:30:26 +0000 |
commit | 6ca70f120b9556af2c9eb6a666ac20582d161e78 (patch) | |
tree | 49916d8547e19803dff44d9fda16c489f426c4fd /rpm | |
parent | eb9647b9debe8aecfea16aefe0087cdca17aec6f (diff) | |
download | org.eclipse.linuxtools-6ca70f120b9556af2c9eb6a666ac20582d161e78.tar.gz org.eclipse.linuxtools-6ca70f120b9556af2c9eb6a666ac20582d161e78.tar.xz org.eclipse.linuxtools-6ca70f120b9556af2c9eb6a666ac20582d161e78.zip |
Do not allow enabling rpmlint if no rpmlint is installed.
Change-Id: Ib98ec1918c5f2643ba4acfff2ab414c4bd6ff8a3
Reviewed-on: https://git.eclipse.org/r/10452
Tested-by: Hudson CI
Reviewed-by: Camilo Bernal <cabernal@redhat.com>
IP-Clean: Camilo Bernal <cabernal@redhat.com>
Tested-by: Camilo Bernal <cabernal@redhat.com>
Diffstat (limited to 'rpm')
-rw-r--r-- | rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/actions/ToggleRpmlintNatureAction.java | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/actions/ToggleRpmlintNatureAction.java b/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/actions/ToggleRpmlintNatureAction.java index 704f931eea..d276e93cda 100644 --- a/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/actions/ToggleRpmlintNatureAction.java +++ b/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/actions/ToggleRpmlintNatureAction.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 *******************************************************************************/ @@ -16,20 +16,29 @@ import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IProjectDescription; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.preferences.InstanceScope; +import org.eclipse.jface.dialogs.ErrorDialog; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.linuxtools.internal.rpm.rpmlint.Activator; import org.eclipse.linuxtools.internal.rpm.rpmlint.builder.RpmlintNature; +import org.eclipse.linuxtools.internal.rpm.rpmlint.preferences.PreferenceConstants; +import org.eclipse.linuxtools.rpm.core.utils.Utils; +import org.eclipse.ui.PlatformUI; import org.eclipse.ui.handlers.HandlerUtil; +import org.eclipse.ui.preferences.ScopedPreferenceStore; /** - * Toggle rpmlint nature for the given project. + * Toggle rpmlint nature for the given project. * As a result this enables/disables rpmlint builder. * */ public class ToggleRpmlintNatureAction extends AbstractHandler { - /** + /** * @param event The event * @return Null. */ @@ -54,11 +63,26 @@ public class ToggleRpmlintNatureAction extends AbstractHandler { /** * Toggles sample nature on a project - * + * * @param project * to have sample nature added or removed */ private void toggleNature(IProject project) { + String rpmlintPath = new ScopedPreferenceStore(InstanceScope.INSTANCE,Activator.PLUGIN_ID).getString( + PreferenceConstants.P_RPMLINT_PATH); + if(!Utils.fileExist(rpmlintPath)) { + IStatus warning = new Status( + IStatus.WARNING, + Activator.PLUGIN_ID, + 1, + Messages.RunRpmlintAction_1, + null); + ErrorDialog.openError(PlatformUI.getWorkbench() + .getActiveWorkbenchWindow().getShell(), + Messages.RunRpmlintAction_2, + null, warning); + return; + } try { IProjectDescription description = project.getDescription(); String[] natures = description.getNatureIds(); |