Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Wohlfart2012-11-06 16:59:23 +0000
committerPaul Webster2012-11-06 16:59:23 +0000
commit4cac48946e0db189dd49bb049092a179085caa8b (patch)
treecdbb3781417e433678667f63e30bf1c33e573576
parentd9d36fea3b940ebd64761a4f733ee21be88b1eba (diff)
downloadeclipse.platform.ui-4cac48946e0db189dd49bb049092a179085caa8b.tar.gz
eclipse.platform.ui-4cac48946e0db189dd49bb049092a179085caa8b.tar.xz
eclipse.platform.ui-4cac48946e0db189dd49bb049092a179085caa8b.zip
Bug 383497 - "Build Project" key binding no longer works in 4.2 / junov20121106-165923
Provide a default handler for Build Project
-rw-r--r--bundles/org.eclipse.ui.ide/META-INF/MANIFEST.MF2
-rw-r--r--bundles/org.eclipse.ui.ide/plugin.xml1
-rw-r--r--bundles/org.eclipse.ui.ide/pom.xml2
-rw-r--r--bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/handlers/BuildProjectHandler.java76
4 files changed, 79 insertions, 2 deletions
diff --git a/bundles/org.eclipse.ui.ide/META-INF/MANIFEST.MF b/bundles/org.eclipse.ui.ide/META-INF/MANIFEST.MF
index b299f6b4cb6..791f390ae41 100644
--- a/bundles/org.eclipse.ui.ide/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.ui.ide/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Plugin.name
Bundle-SymbolicName: org.eclipse.ui.ide; singleton:=true
-Bundle-Version: 3.8.1.qualifier
+Bundle-Version: 3.8.2.qualifier
Bundle-ClassPath: e4-ide.jar,
.
Bundle-Activator: org.eclipse.ui.internal.ide.IDEWorkbenchPlugin
diff --git a/bundles/org.eclipse.ui.ide/plugin.xml b/bundles/org.eclipse.ui.ide/plugin.xml
index 2a02a22ba15..e8622b3bf1b 100644
--- a/bundles/org.eclipse.ui.ide/plugin.xml
+++ b/bundles/org.eclipse.ui.ide/plugin.xml
@@ -847,6 +847,7 @@
name="%command.buildProject.name"
description="%command.buildProject.description"
categoryId="org.eclipse.ui.category.project"
+ defaultHandler="org.eclipse.ui.internal.ide.handlers.BuildProjectHandler"
id="org.eclipse.ui.project.buildProject">
</command>
<command
diff --git a/bundles/org.eclipse.ui.ide/pom.xml b/bundles/org.eclipse.ui.ide/pom.xml
index cb6024f9db0..786a5868d6b 100644
--- a/bundles/org.eclipse.ui.ide/pom.xml
+++ b/bundles/org.eclipse.ui.ide/pom.xml
@@ -21,6 +21,6 @@
</parent>
<groupId>eclipse.platform.ui</groupId>
<artifactId>org.eclipse.ui.ide</artifactId>
- <version>3.8.1-SNAPSHOT</version>
+ <version>3.8.2-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/handlers/BuildProjectHandler.java b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/handlers/BuildProjectHandler.java
new file mode 100644
index 00000000000..c69d87e8ebe
--- /dev/null
+++ b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/handlers/BuildProjectHandler.java
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * Copyright (c) 2012 IBM Corporation 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:
+ * IBM Corporation - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.ui.internal.ide.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.IncrementalProjectBuilder;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.actions.BuildAction;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.eclipse.ui.part.FileEditorInput;
+
+/**
+ * Default Handler for 'Build Project' command
+ *
+ * @since 4.3
+ *
+ */
+public class BuildProjectHandler extends AbstractHandler {
+
+ /**
+ * @throws ExecutionException
+ */
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event);
+ if (window != null) {
+
+ ISelection currentSelection = HandlerUtil
+ .getCurrentSelection(event);
+
+ if (currentSelection instanceof IStructuredSelection) {
+ runBuildAction(window, currentSelection);
+ } else {
+ currentSelection = extractSelectionFromEditorInput(HandlerUtil
+ .getActiveEditorInput(event));
+ runBuildAction(window, currentSelection);
+ }
+ }
+ return null;
+ }
+
+ private ISelection extractSelectionFromEditorInput(
+ IEditorInput activeEditorInput) {
+ if (activeEditorInput instanceof FileEditorInput) {
+ IProject project = ((FileEditorInput) activeEditorInput).getFile()
+ .getProject();
+ return new StructuredSelection(project);
+ }
+
+ return null;
+ }
+
+ private void runBuildAction(IWorkbenchWindow window,
+ ISelection currentSelection) {
+ BuildAction buildAction = new BuildAction(window,
+ IncrementalProjectBuilder.INCREMENTAL_BUILD);
+ buildAction.selectionChanged((IStructuredSelection) currentSelection);
+ buildAction.run();
+ }
+
+} \ No newline at end of file

Back to the top