Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMickael Istria2019-03-29 09:29:55 -0400
committerMickael Istria2019-04-02 16:01:33 -0400
commit27ffa28c237adb1de4de7339c16583845b0f79a0 (patch)
tree4ed99f33e9976439e2f47572ff5065ac425c2a01
parentb037e13091441bad5d98acc54d1da88421a85fa8 (diff)
downloadeclipse.platform.debug-27ffa28c237adb1de4de7339c16583845b0f79a0.tar.gz
eclipse.platform.debug-27ffa28c237adb1de4de7339c16583845b0f79a0.tar.xz
eclipse.platform.debug-27ffa28c237adb1de4de7339c16583845b0f79a0.zip
Bug 545544 - Contribute Launch/Debug configuration to Quick AccessI20190408-0600I20190407-1800I20190406-1800
Change-Id: Ic0cc44a599bc749953db99d885ff31e38132bcbc Signed-off-by: Mickael Istria <mistria@redhat.com>
-rw-r--r--org.eclipse.debug.ui/META-INF/MANIFEST.MF4
-rw-r--r--org.eclipse.debug.ui/plugin.xml6
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/quickaccess/AbstractLaunchQuickAccessProvider.java95
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/quickaccess/DebugQuickAccessProvider.java25
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/quickaccess/LaunchQuickAccessElement.java67
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/quickaccess/ProfileQuickAccessProvider.java24
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/quickaccess/RunQuickAccessProvider.java24
7 files changed, 244 insertions, 1 deletions
diff --git a/org.eclipse.debug.ui/META-INF/MANIFEST.MF b/org.eclipse.debug.ui/META-INF/MANIFEST.MF
index 69deca556..3f01e1570 100644
--- a/org.eclipse.debug.ui/META-INF/MANIFEST.MF
+++ b/org.eclipse.debug.ui/META-INF/MANIFEST.MF
@@ -39,6 +39,7 @@ Export-Package: org.eclipse.debug.internal.ui;
org.eclipse.debug.internal.ui.memory.provisional;x-internal:=true,
org.eclipse.debug.internal.ui.model.elements;x-friends:="org.eclipse.debug.examples.ui,org.eclipse.jdt.debug.ui,org.eclipse.wst.jsdt.debug.ui",
org.eclipse.debug.internal.ui.preferences;x-internal:=true,
+ org.eclipse.debug.internal.ui.quickaccess;x-internal:=true,
org.eclipse.debug.internal.ui.sourcelookup;x-friends:="org.eclipse.debug.tests",
org.eclipse.debug.internal.ui.sourcelookup.browsers;x-internal:=true,
org.eclipse.debug.internal.ui.stringsubstitution;x-friends:="org.eclipse.jdt.debug.ui",
@@ -78,7 +79,7 @@ Export-Package: org.eclipse.debug.internal.ui;
org.eclipse.debug.ui.stringsubstitution
Require-Bundle: org.eclipse.core.expressions;bundle-version="[3.4.0,4.0.0)",
org.eclipse.core.variables;bundle-version="[3.2.800,4.0.0)",
- org.eclipse.ui;bundle-version="[3.111.0,4.0.0)",
+ org.eclipse.ui;bundle-version="[3.113.0,4.0.0)",
org.eclipse.ui.console;bundle-version="[3.5.300,4.0.0)",
org.eclipse.help;bundle-version="[3.4.0,4.0.0)",
org.eclipse.debug.core;bundle-version="[3.9.0,4.0.0)";visibility:=reexport,
@@ -86,6 +87,7 @@ Require-Bundle: org.eclipse.core.expressions;bundle-version="[3.4.0,4.0.0)",
org.eclipse.ui.workbench.texteditor;bundle-version="[3.5.0,4.0.0)",
org.eclipse.ui.ide;bundle-version="[3.5.0,4.0.0)",
org.eclipse.ui.editors;bundle-version="[3.5.0,4.0.0)",
+ org.eclipse.ui.workbench;bundle-version="[3.114.0,4.0.0)",
org.eclipse.core.runtime;bundle-version="[3.11.0,4.0.0)",
org.eclipse.core.filesystem;bundle-version="[1.2.0,2.0.0)",
org.eclipse.core.resources;bundle-version="[3.5.0,4.0.0)",
diff --git a/org.eclipse.debug.ui/plugin.xml b/org.eclipse.debug.ui/plugin.xml
index 03c0cabfe..ff66860d4 100644
--- a/org.eclipse.debug.ui/plugin.xml
+++ b/org.eclipse.debug.ui/plugin.xml
@@ -3316,4 +3316,10 @@ M4 = Platform-specific fourth key
</enablement>
</decorator>
</extension>
+ <extension
+ point="org.eclipse.ui.quickAccess">
+ <provider class="org.eclipse.debug.internal.ui.quickaccess.RunQuickAccessProvider"/>
+ <provider class="org.eclipse.debug.internal.ui.quickaccess.DebugQuickAccessProvider"/>
+ <provider class="org.eclipse.debug.internal.ui.quickaccess.ProfileQuickAccessProvider"/>
+ </extension>
</plugin>
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/quickaccess/AbstractLaunchQuickAccessProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/quickaccess/AbstractLaunchQuickAccessProvider.java
new file mode 100644
index 000000000..dca05cb4e
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/quickaccess/AbstractLaunchQuickAccessProvider.java
@@ -0,0 +1,95 @@
+/*******************************************************************************
+ * Copyright (c) 2019 Red Hat Inc. others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * - Mickael Istria (Red Hat Inc.)
+ *******************************************************************************/
+package org.eclipse.debug.internal.ui.quickaccess;
+
+import java.util.Arrays;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationListener;
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.debug.core.ILaunchMode;
+import org.eclipse.debug.internal.ui.DebugPluginImages;
+import org.eclipse.debug.internal.ui.DebugUIPlugin;
+import org.eclipse.debug.ui.IDebugUIConstants;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.quickaccess.QuickAccessElement;
+import org.eclipse.ui.quickaccess.QuickAccessProvider;
+
+public abstract class AbstractLaunchQuickAccessProvider extends QuickAccessProvider {
+
+ protected final ILaunchManager manager;
+ protected final ILaunchMode launchMode;
+
+ public AbstractLaunchQuickAccessProvider(ILaunchMode launchMode) {
+ super();
+ manager = DebugPlugin.getDefault().getLaunchManager();
+ this.launchMode = launchMode;
+ manager.addLaunchConfigurationListener(new ILaunchConfigurationListener() {
+ @Override
+ public void launchConfigurationRemoved(ILaunchConfiguration configuration) {
+ reset();
+ }
+
+ @Override
+ public void launchConfigurationChanged(ILaunchConfiguration configuration) {
+ reset();
+ }
+
+ @Override
+ public void launchConfigurationAdded(ILaunchConfiguration configuration) {
+ reset();
+ }
+ });
+ }
+
+ @Override
+ public String getId() {
+ return getClass().getName();
+ }
+
+ @Override
+ public String getName() {
+ return Action.removeMnemonics(launchMode.getLabel());
+ }
+
+ @Override
+ public ImageDescriptor getImageDescriptor() {
+ return DebugPluginImages.getImageDescriptor(IDebugUIConstants.IMG_OBJS_LAUNCH_RUN);
+ }
+
+ @Override
+ public QuickAccessElement[] getElements() {
+ try {
+ return Arrays.stream(manager.getLaunchConfigurations()).filter(config -> {
+ try {
+ return config.getType().supportsMode(launchMode.getIdentifier());
+ } catch (CoreException e) {
+ DebugUIPlugin.log(e);
+ return false;
+ }
+ }).map(config -> new LaunchQuickAccessElement(this, config, launchMode)).toArray(QuickAccessElement[]::new);
+ } catch (CoreException e) {
+ DebugUIPlugin.log(e);
+ return new QuickAccessElement[0];
+ }
+ }
+
+ @Override
+ protected void doReset() {
+ }
+
+} \ No newline at end of file
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/quickaccess/DebugQuickAccessProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/quickaccess/DebugQuickAccessProvider.java
new file mode 100644
index 000000000..b1a9590b1
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/quickaccess/DebugQuickAccessProvider.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2019 Red Hat Inc. others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * - Mickael Istria (Red Hat Inc.)
+ *******************************************************************************/
+package org.eclipse.debug.internal.ui.quickaccess;
+
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunchManager;
+
+public class DebugQuickAccessProvider extends AbstractLaunchQuickAccessProvider {
+
+ public DebugQuickAccessProvider() {
+ super(DebugPlugin.getDefault().getLaunchManager().getLaunchMode(ILaunchManager.DEBUG_MODE));
+ }
+
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/quickaccess/LaunchQuickAccessElement.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/quickaccess/LaunchQuickAccessElement.java
new file mode 100644
index 000000000..82e726b08
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/quickaccess/LaunchQuickAccessElement.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2019 Red Hat Inc. others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * - Mickael Istria (Red Hat Inc.)
+ *******************************************************************************/
+package org.eclipse.debug.internal.ui.quickaccess;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchMode;
+import org.eclipse.debug.internal.ui.DebugPluginImages;
+import org.eclipse.debug.internal.ui.DebugUIPlugin;
+import org.eclipse.debug.ui.DebugUITools;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.quickaccess.QuickAccessElement;
+import org.eclipse.ui.quickaccess.QuickAccessProvider;
+
+public class LaunchQuickAccessElement extends QuickAccessElement {
+
+ private ILaunchConfiguration launch;
+ private ILaunchMode launchMode;
+
+ public LaunchQuickAccessElement(QuickAccessProvider provider, ILaunchConfiguration launch, ILaunchMode launchMode) {
+ super(provider);
+ this.launch = launch;
+ this.launchMode = launchMode;
+ }
+
+ @Override
+ public String getLabel() {
+ return launch.getName();
+ }
+
+ @Override
+ public String getMatchLabel() {
+ return getLabel() + ' ' + launchMode.getLabel();
+ }
+
+ @Override
+ public ImageDescriptor getImageDescriptor() {
+ try {
+ return DebugPluginImages.getImageDescriptor(launch.getType().getIdentifier());
+ } catch (CoreException e) {
+ DebugUIPlugin.log(e);
+ return null;
+ }
+ }
+
+ @Override
+ public String getId() {
+ return launch.getName() + '/' + launchMode.getIdentifier();
+ }
+
+ @Override
+ public void execute() {
+ DebugUITools.launch(launch, launchMode.getIdentifier());
+ }
+
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/quickaccess/ProfileQuickAccessProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/quickaccess/ProfileQuickAccessProvider.java
new file mode 100644
index 000000000..2e3186f7c
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/quickaccess/ProfileQuickAccessProvider.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2019 Red Hat Inc. others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * - Mickael Istria (Red Hat Inc.)
+ *******************************************************************************/
+package org.eclipse.debug.internal.ui.quickaccess;
+
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunchManager;
+
+public class ProfileQuickAccessProvider extends AbstractLaunchQuickAccessProvider {
+
+ public ProfileQuickAccessProvider() {
+ super(DebugPlugin.getDefault().getLaunchManager().getLaunchMode(ILaunchManager.PROFILE_MODE));
+ }
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/quickaccess/RunQuickAccessProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/quickaccess/RunQuickAccessProvider.java
new file mode 100644
index 000000000..deb23c295
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/quickaccess/RunQuickAccessProvider.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2019 Red Hat Inc. others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * - Mickael Istria (Red Hat Inc.)
+ *******************************************************************************/
+package org.eclipse.debug.internal.ui.quickaccess;
+
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunchManager;
+
+public class RunQuickAccessProvider extends AbstractLaunchQuickAccessProvider {
+
+ public RunQuickAccessProvider() {
+ super(DebugPlugin.getDefault().getLaunchManager().getLaunchMode(ILaunchManager.RUN_MODE));
+ }
+}

Back to the top