Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAxel Richard2017-03-10 10:30:18 -0500
committerSarika Sinha2017-12-11 00:47:08 -0500
commitca4c3de585c743486c2df55b551ec3f2dfd9b6a2 (patch)
treee408d2fd23d7014b1db5116fce46d5ce6e4f0bfb /org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui
parent8803c89e9471914c5a66f0f869cd4fea67357576 (diff)
downloadeclipse.platform.debug-ca4c3de585c743486c2df55b551ec3f2dfd9b6a2.tar.gz
eclipse.platform.debug-ca4c3de585c743486c2df55b551ec3f2dfd9b6a2.tar.xz
eclipse.platform.debug-ca4c3de585c743486c2df55b551ec3f2dfd9b6a2.zip
Bug 41353 - Launch configuration prototypesI20171211-2000
First implementation of the launch configuration prototypes mechanism. Change-Id: I21a2a97b83aa9cb1be79153bbc4b72171cc6be20 Signed-off-by: Axel Richard <axel.richard@obeo.fr>
Diffstat (limited to 'org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui')
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugPluginImages.java13
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIMessages.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIMessages.properties4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IDebugHelpContextIds.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IInternalDebugUIConstants.java14
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/groups/GroupLaunchConfigurationSelectionDialog.java10
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/launchconfigurations/ExportLaunchConfigurationsWizardPage.java3
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/launchconfigurations/ImportLaunchConfigurationsWizardPage.java5
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/CreateLaunchConfigurationPrototypeAction.java147
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/DeleteLaunchConfigurationAction.java5
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupViewer.java11
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTreeContentProvider.java50
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationView.java30
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsDialog.java66
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.java40
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.properties42
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LinkPrototypeAction.java159
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/ResetWithPrototypeValuesAction.java129
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/UnlinkPrototypeAction.java128
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceLookupUIMessages.java6
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceLookupUIMessages.properties6
21 files changed, 843 insertions, 33 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugPluginImages.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugPluginImages.java
index b1d01231a..68ec975bd 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugPluginImages.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugPluginImages.java
@@ -12,6 +12,7 @@
* Wind River Systems - Pawel Piech - Added Modules view (bug 211158)
* Lars.Vogel <Lars.Vogel@gmail.com> - Bug 430620
* Lucas Bullen <lbullen@redhat.com> - Bug 518652
+ * Axel Richard (Obeo) - Bug 41353 - Launch configurations prototypes
*******************************************************************************/
package org.eclipse.debug.internal.ui;
@@ -117,6 +118,10 @@ public class DebugPluginImages {
declareRegistryImage(IInternalDebugUIConstants.IMG_DLCL_NEW_CONFIG, DLCL + "new_con.png"); //$NON-NLS-1$
declareRegistryImage(IInternalDebugUIConstants.IMG_DLCL_DELETE_CONFIG, DLCL + "rem_co.png"); //$NON-NLS-1$
declareRegistryImage(IInternalDebugUIConstants.IMG_DLCL_FILTER_CONFIGS, DLCL + "filter_ps.png"); //$NON-NLS-1$
+ declareRegistryImage(IInternalDebugUIConstants.IMG_DLCL_NEW_PROTO, DLCL + "new_proto.png"); //$NON-NLS-1$
+ declareRegistryImage(IInternalDebugUIConstants.IMG_DLCL_LINK_PROTO, DLCL + "link_proto.png"); //$NON-NLS-1$
+ declareRegistryImage(IInternalDebugUIConstants.IMG_DLCL_UNLINK_PROTO, DLCL + "unlink_proto.png"); //$NON-NLS-1$
+ declareRegistryImage(IInternalDebugUIConstants.IMG_DLCL_RESET_PROTO, DLCL + "reset_proto.png"); //$NON-NLS-1$
declareRegistryImage(IInternalDebugUIConstants.IMG_DLCL_DISCONNECT, DLCL + "disconnect_co.png"); //$NON-NLS-1$
declareRegistryImage(IInternalDebugUIConstants.IMG_DLCL_SUSPEND, DLCL + "suspend_co.png"); //$NON-NLS-1$
declareRegistryImage(IInternalDebugUIConstants.IMG_DLCL_RESUME, DLCL + "resume_co.png"); //$NON-NLS-1$
@@ -156,6 +161,10 @@ public class DebugPluginImages {
declareRegistryImage(IInternalDebugUIConstants.IMG_ELCL_DUPLICATE_CONFIG, ELCL + "copy_edit_co.png"); //$NON-NLS-1$
declareRegistryImage(IInternalDebugUIConstants.IMG_ELCL_NEW_CONFIG, ELCL + "new_con.png"); //$NON-NLS-1$
declareRegistryImage(IInternalDebugUIConstants.IMG_ELCL_DELETE_CONFIG, ELCL + "delete_config.png"); //$NON-NLS-1$
+ declareRegistryImage(IInternalDebugUIConstants.IMG_ELCL_NEW_PROTO, ELCL + "new_proto.png"); //$NON-NLS-1$
+ declareRegistryImage(IInternalDebugUIConstants.IMG_ELCL_LINK_PROTO, ELCL + "link_proto.png"); //$NON-NLS-1$
+ declareRegistryImage(IInternalDebugUIConstants.IMG_ELCL_UNLINK_PROTO, ELCL + "unlink_proto.png"); //$NON-NLS-1$
+ declareRegistryImage(IInternalDebugUIConstants.IMG_ELCL_RESET_PROTO, ELCL + "reset_proto.png"); //$NON-NLS-1$
declareRegistryImage(IInternalDebugUIConstants.IMG_ELCL_SUSPEND, ELCL + "suspend_co.png"); //$NON-NLS-1$
declareRegistryImage(IInternalDebugUIConstants.IMG_ELCL_RESUME, ELCL + "resume_co.png"); //$NON-NLS-1$
declareRegistryImage(IInternalDebugUIConstants.IMG_ELCL_STEP_RETURN, ELCL + "stepreturn_co.png"); //$NON-NLS-1$
@@ -209,12 +218,15 @@ public class DebugPluginImages {
declareRegistryImage(IInternalDebugUIConstants.IMG_OBJECT_MEMORY, OBJECT + "memory_obj.png"); //$NON-NLS-1$
declareRegistryImage(IInternalDebugUIConstants.IMG_OBJS_BREAKPOINT_TYPE, OBJECT + "brkp_type.png"); //$NON-NLS-1$
declareRegistryImage(IInternalDebugUIConstants.IMG_OBJS_LAUNCH_GROUP, OBJECT + "lgroup_obj.png"); //$NON-NLS-1$
+ declareRegistryImage(IInternalDebugUIConstants.IMG_OBJS_CHECK, OBJECT + "check.png"); //$NON-NLS-1$
+ declareRegistryImage(IInternalDebugUIConstants.IMG_OBJS_UNCHECK, OBJECT + "uncheck.png"); //$NON-NLS-1$
// tabs
declareRegistryImage(IInternalDebugUIConstants.IMG_OBJS_COMMON_TAB, OBJECT + "common_tab.png"); //$NON-NLS-1$
declareRegistryImage(IInternalDebugUIConstants.IMG_OBJS_REFRESH_TAB, OBJECT + "refresh_tab.png"); //$NON-NLS-1$
declareRegistryImage(IInternalDebugUIConstants.IMG_OBJS_PERSPECTIVE_TAB, OBJECT + "persp_tab.png"); //$NON-NLS-1$
declareRegistryImage(IDebugUIConstants.IMG_OBJS_ENVIRONMENT, OBJECT + "environment_obj.png"); //$NON-NLS-1$
+ declareRegistryImage(IInternalDebugUIConstants.IMG_OBJS_PROTO_TAB, OBJECT + "proto_tab.png"); //$NON-NLS-1$
// Views
declareRegistryImage(IDebugUIConstants.IMG_VIEW_BREAKPOINTS, VIEW + "breakpoint_view.png"); //$NON-NLS-1$
@@ -240,6 +252,7 @@ public class DebugPluginImages {
declareRegistryImage(IInternalDebugUIConstants.IMG_OVR_TRANSPARENT, OVR + "transparent.png"); //$NON-NLS-1$
declareRegistryImage(IDebugUIConstants.IMG_OVR_SKIP_BREAKPOINT, OVR + "skip_breakpoint_ov.png"); //$NON-NLS-1$
declareRegistryImage(IInternalDebugUIConstants.IMG_OVR_SHOW_LOGICAL_STRUCTURE, OVR + "var_cntnt_prvdr_ov.png"); //$NON-NLS-1$
+ declareRegistryImage(IDebugUIConstants.IMG_OVR_PROTOTYPE, OVR + "prototype.png"); //$NON-NLS-1$
//source location
declareRegistryImage(IInternalDebugUIConstants.IMG_SRC_LOOKUP_MENU, ELCL + "edtsrclkup_co.png"); //$NON-NLS-1$
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIMessages.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIMessages.java
index aeae3b518..3ad431651 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIMessages.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIMessages.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 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
@@ -9,6 +9,7 @@
* IBM - Initial API and implementation
* Wind River Systems - Ted Williams - [Memory View] Memory View: Workflow Enhancements (Bug 215432)
* Remy Chi Jian Suen - Make WorkingDirectoryBlock from JDT a Debug API class (Bug 221973)
+ * Obeo - Axel Richard - Launch configurations prototypes (Bug 41353)
*******************************************************************************/
package org.eclipse.debug.internal.ui;
@@ -244,6 +245,7 @@ public class DebugUIMessages extends NLS {
public static String GroupLaunch_Error;
public static String GroupLaunchConfigurationSelectionDialog_0;
public static String GroupLaunchConfigurationSelectionDialog_1;
+ public static String GroupLaunchConfigurationSelectionDialog_2;
public static String GroupLaunchConfigurationSelectionDialog_10;
public static String GroupLaunchConfigurationSelectionDialog_11;
public static String GroupLaunchConfigurationSelectionDialog_12;
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIMessages.properties b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIMessages.properties
index 386d6fe44..6f7a9d77d 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIMessages.properties
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIMessages.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2000, 2012 IBM Corporation and others.
+# Copyright (c) 2000, 2017 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
@@ -9,6 +9,7 @@
# IBM Corporation - initial API and implementation
# Wind River Systems - Ted Williams - [Memory View] Memory View: Workflow Enhancements (Bug 215432)
# Remy Chi Jian Suen - Make WorkingDirectoryBlock from JDT a Debug API class (Bug 221973)
+# Obeo - Axel Richard - Launch configurations prototypes (Bug 41353)
###############################################################################
DebugUIPlugin_23=Build in Progress
@@ -123,6 +124,7 @@ GroupLaunchConfigurationSelectionDialog_7=Select a launch configuration
GroupLaunchConfigurationSelectionDialog_8=&Post launch action:
GroupLaunchConfigurationSelectionDialog_9=&Seconds:
GroupLaunchConfigurationSelectionDialog_1=Selected launch mode is not supported for selected launch configuration(s)
+GroupLaunchConfigurationSelectionDialog_2=The selection contains prototype(s)
GroupLaunchConfigurationSelectionDialog_10=Enter valid number of seconds
GroupLaunchConfigurationSelectionDialog_11=Select only one launch configuration
GroupLaunchConfigurationSelectionDialog_12=Add Launch Configuration
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IDebugHelpContextIds.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IDebugHelpContextIds.java
index 2ae06eff4..868bbcffc 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IDebugHelpContextIds.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IDebugHelpContextIds.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 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
@@ -9,6 +9,7 @@
* IBM Corporation - initial API and implementation
* QNX Software Systems - Mikhail Khodjaiants - Registers View (Bug 53640)
* Wind River Systems - Pawel Piech - Added Modules view (bug 211158)
+ * Axel Richard (Obeo) - Bug 41353 - Launch configurations prototypes
*******************************************************************************/
package org.eclipse.debug.internal.ui;
@@ -140,6 +141,7 @@ public interface IDebugHelpContextIds {
public static final String LAUNCH_CONFIGURATION_DIALOG_PERSPECTIVE_TAB = PREFIX + "launch_configuration_dialog_perspective_tab"; //$NON-NLS-1$
public static final String LAUNCH_CONFIGURATION_DIALOG_REFRESH_TAB = PREFIX + "launch_configuration_dialog_refresh_tab"; //$NON-NLS-1$
public static final String LAUNCH_CONFIGURATION_DIALOG_ENVIRONMENT_TAB = PREFIX + "launch_configuration_dialog_environment_tab"; //$NON-NLS-1$
+ public static final String LAUNCH_CONFIGURATION_DIALOG_PROTOTYPE_TAB = PREFIX + "launch_configuration_dialog_prototype_tab"; //$NON-NLS-1$
// Working set page
public static final String WORKING_SET_PAGE = PREFIX + "working_set_page_context"; //$NON-NLS-1$
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IInternalDebugUIConstants.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IInternalDebugUIConstants.java
index 093a9648c..b404e9fa9 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IInternalDebugUIConstants.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IInternalDebugUIConstants.java
@@ -10,6 +10,7 @@
* QNX Software Systems - Mikhail Khodjaiants - Bug 114664
* Wind River Systems - Pawel Piech - Added Modules view (bug 211158)
* Lucas Bullen (Red Hat Inc.) - Bug 518652
+ * Axel Richard (Obeo) - Bug 41353 - Launch configurations prototypes
*******************************************************************************/
package org.eclipse.debug.internal.ui;
@@ -70,6 +71,10 @@ public interface IInternalDebugUIConstants {
public static final String IMG_DLCL_DUPLICATE_CONFIG = "IMG_DLCL_DUPLICATE_CONFIG"; //$NON-NLS-1$
public static final String IMG_DLCL_DELETE_CONFIG = "IMG_DLCL_DELETE_CONFIG"; //$NON-NLS-1$
public static final String IMG_DLCL_FILTER_CONFIGS = "IMG_DLCL_FILTER_CONFIGS"; //$NON-NLS-1$
+ public static final String IMG_DLCL_NEW_PROTO = "IMG_DLCL_NEW_PROTO"; //$NON-NLS-1$
+ public static final String IMG_DLCL_LINK_PROTO = "IMG_DLCL_LINK_PROTO"; //$NON-NLS-1$
+ public static final String IMG_DLCL_UNLINK_PROTO = "IMG_DLCL_UNLINK_PROTO"; //$NON-NLS-1$
+ public static final String IMG_DLCL_RESET_PROTO = "IMG_DLCL_RESET_PROTO"; //$NON-NLS-1$
public static final String IMG_DLCL_SUSPEND = "IMG_DLCL_SUSPEND"; //$NON-NLS-1$
public static final String IMG_DLCL_RESUME = "IMG_DLCL_RESUME"; //$NON-NLS-1$
public static final String IMG_DLCL_STEP_RETURN = "IMG_DLCL_STEP_RETURN"; //$NON-NLS-1$
@@ -114,6 +119,10 @@ public interface IInternalDebugUIConstants {
public static final String IMG_ELCL_DELETE_CONFIG = "IMG_ELCL_DELETE_CONFIG"; //$NON-NLS-1$
public static final String IMG_ELCL_FILTER_CONFIGS = "IMG_ELCL_FILTER_CONFIGS"; //$NON-NLS-1$
public static final String IMG_ELCL_DUPLICATE_CONFIG = "IMG_ELCL_DUPLICATE_CONFIG"; //$NON-NLS-1$
+ public static final String IMG_ELCL_NEW_PROTO = "IMG_ELCL_NEW_PROTO"; //$NON-NLS-1$
+ public static final String IMG_ELCL_LINK_PROTO = "IMG_ELCL_LINK_PROTO"; //$NON-NLS-1$
+ public static final String IMG_ELCL_UNLINK_PROTO = "IMG_ELCL_UNLINK_PROTO"; //$NON-NLS-1$
+ public static final String IMG_ELCL_RESET_PROTO = "IMG_ELCL_RESET_PROTO"; //$NON-NLS-1$
public static final String IMG_ELCL_SUSPEND = "IMG_ELCL_SUSPEND"; //$NON-NLS-1$
public static final String IMG_ELCL_RESUME = "IMG_ELCL_RESUME"; //$NON-NLS-1$
public static final String IMG_ELCL_STEP_RETURN = "IMG_ELCL_STEP_RETURN"; //$NON-NLS-1$
@@ -140,7 +149,10 @@ public interface IInternalDebugUIConstants {
public static final String IMG_OBJECT_MEMORY_CHANGED="IMG_OBJECT_MEMORY_CHANGED"; //$NON-NLS-1$
public static final String IMG_OBJECT_MEMORY="IMG_OBJECT_MEMORY"; //$NON-NLS-1$
public static final String IMG_OBJS_BREAKPOINT_TYPE="IMG_OBJ_BREAKPOINT_TYPE"; //$NON-NLS-1$
- public static final String IMG_OBJS_LAUNCH_GROUP = "IMG_OBJ_LAUNCH_GROUP"; //$NON-NLS-1$
+ public static final String IMG_OBJS_LAUNCH_GROUP = "IMG_OBJ_LAUNCH_GROUP"; //$NON-NLS-1$
+ public static final String IMG_OBJS_CHECK = "IMG_OBJS_CHECK"; //$NON-NLS-1$
+ public static final String IMG_OBJS_UNCHECK = "IMG_OBJS_UNCHECK"; //$NON-NLS-1$
+ public static final String IMG_OBJS_PROTO_TAB = "IMG_OBJS_PROTO_TAB"; //$NON-NLS-1$
// wizard images
public static final String IMG_WIZBAN_IMPORT_BREAKPOINTS = "IMG_WIZBAN_IMPORT_BREAKPOINTS"; //$NON-NLS-1$
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/groups/GroupLaunchConfigurationSelectionDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/groups/GroupLaunchConfigurationSelectionDialog.java
index 3b951a736..2b5f0ac04 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/groups/GroupLaunchConfigurationSelectionDialog.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/groups/GroupLaunchConfigurationSelectionDialog.java
@@ -9,6 +9,7 @@
* QNX Software Systems - initial API and implementation
* Freescale Semiconductor
* SSI Schaefer
+ * Axel Richard (Obeo) - Bug 41353 - Launch configurations prototypes
*******************************************************************************/
package org.eclipse.debug.internal.ui.groups;
@@ -104,10 +105,10 @@ class GroupLaunchConfigurationSelectionDialog extends TitleAreaDialog implements
if (type.equals(groupType)) {
// we're hiding ourselves. if we're the only group,
// don't show the type.
- return getLaunchManager().getLaunchConfigurations(type).length > 1;
+ return getLaunchManager().getLaunchConfigurations(type, ILaunchConfiguration.CONFIGURATION).length > 1;
}
- return getLaunchManager().getLaunchConfigurations(type).length > 0;
+ return getLaunchManager().getLaunchConfigurations(type, ILaunchConfiguration.CONFIGURATION).length > 0;
} else if (element instanceof ILaunchConfiguration) {
ILaunchConfiguration c = (ILaunchConfiguration) element;
if (c.getName().equals(self.getName()) && c.getType().equals(groupType)) {
@@ -388,7 +389,10 @@ class GroupLaunchConfigurationSelectionDialog extends TitleAreaDialog implements
}
setErrorMessage(isValid ? null : DebugUIMessages.GroupLaunchConfigurationSelectionDialog_1);
}
-
+ if (isValid && sel.isPrototype()) {
+ isValid = false;
+ setErrorMessage(DebugUIMessages.GroupLaunchConfigurationSelectionDialog_2);
+ }
if (!isValid) {
break;
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/launchconfigurations/ExportLaunchConfigurationsWizardPage.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/launchconfigurations/ExportLaunchConfigurationsWizardPage.java
index 7425eb494..e3084a035 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/launchconfigurations/ExportLaunchConfigurationsWizardPage.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/launchconfigurations/ExportLaunchConfigurationsWizardPage.java
@@ -9,6 +9,7 @@
* IBM Corporation - initial API and implementation
* Lars Vogel <Lars.Vogel@vogella.com> - Bug 490755
* Lucas Bullen <lbullen@redhat.com> & Ian Pun <ipun@redhat.com> - Bug 518652
+ * Axel Richard (Obeo) - Bug 41353 - Launch configurations prototypes
*******************************************************************************/
package org.eclipse.debug.internal.ui.importexport.launchconfigurations;
@@ -87,7 +88,7 @@ public class ExportLaunchConfigurationsWizardPage extends WizardPage {
public Object[] getChildren(Object parentElement) {
if(parentElement instanceof ILaunchConfigurationType) {
try {
- return lm.getLaunchConfigurations((ILaunchConfigurationType) parentElement);
+ return lm.getLaunchConfigurations((ILaunchConfigurationType) parentElement, ILaunchConfiguration.CONFIGURATION | ILaunchConfiguration.PROTOTYPE);
}
catch (Exception e) {
DebugUIPlugin.logErrorMessage(e.getMessage());
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/launchconfigurations/ImportLaunchConfigurationsWizardPage.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/launchconfigurations/ImportLaunchConfigurationsWizardPage.java
index 4cd723ce9..61703d169 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/launchconfigurations/ImportLaunchConfigurationsWizardPage.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/launchconfigurations/ImportLaunchConfigurationsWizardPage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2013 IBM Corporation and others.
+ * Copyright (c) 2007, 2017 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
@@ -7,6 +7,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Axel Richard (Obeo) - Bug 41353 - Launch configurations prototypes
*******************************************************************************/
package org.eclipse.debug.internal.ui.importexport.launchconfigurations;
@@ -110,7 +111,7 @@ public class ImportLaunchConfigurationsWizardPage extends WizardResourceImportPa
if(child.isFile()) {
Path childpath = new Path(child.getAbsolutePath());
String extension = childpath.getFileExtension();
- if(extension != null && extension.equals(ILaunchConfiguration.LAUNCH_CONFIGURATION_FILE_EXTENSION)) {
+ if (extension != null && (extension.equals(ILaunchConfiguration.LAUNCH_CONFIGURATION_FILE_EXTENSION) || extension.equals(ILaunchConfiguration.LAUNCH_CONFIGURATION_PROTOTYPE_FILE_EXTENSION))) {
newelement = new DebugFileSystemElement(provider.getLabel(child), this, provider.isFolder(child));
newelement.setFileSystemObject(child);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/CreateLaunchConfigurationPrototypeAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/CreateLaunchConfigurationPrototypeAction.java
new file mode 100644
index 000000000..d817072d6
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/CreateLaunchConfigurationPrototypeAction.java
@@ -0,0 +1,147 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Obeo.
+ * 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:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.internal.ui.launchConfigurations;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationType;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.internal.ui.DebugUIPlugin;
+import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
+import org.eclipse.debug.ui.DebugUITools;
+import org.eclipse.debug.ui.ILaunchConfigurationDialog;
+import org.eclipse.debug.ui.ILaunchConfigurationTab;
+import org.eclipse.debug.ui.ILaunchConfigurationTabGroup;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.Viewer;
+
+/**
+ * Creates a new launch configuration prototype based on the selection.
+ *
+ * @since 3.13
+ */
+public class CreateLaunchConfigurationPrototypeAction extends AbstractLaunchConfigurationAction {
+
+ /**
+ * Action identifier for IDebugView#getAction(String)
+ */
+ public static final String ID_CREATE_PROTOTYPE_ACTION = DebugUIPlugin.getUniqueIdentifier() + ".ID_CREATE_PROTOTYPE_ACTION"; //$NON-NLS-1$
+
+ /**
+ * Constructs an action to create a launch configuration prototype
+ *
+ * @param viewer the viewer
+ * @param mode the mode the action applies to
+ */
+ public CreateLaunchConfigurationPrototypeAction(Viewer viewer, String mode) {
+ super(LaunchConfigurationsMessages.CreateLaunchConfigurationPrototypeAction_Ne_w_1, viewer, mode);
+ }
+
+ /**
+ * @see AbstractLaunchConfigurationAction#performAction()
+ */
+ @Override
+ protected void performAction() {
+ Object object = getStructuredSelection().getFirstElement();
+ // double click with Ctrl key mask results in empty selection: bug
+ // 156087 do no work if the selection is null
+ if (object != null) {
+ ILaunchConfigurationType type = null;
+ // Construct a new configuration prototype of the selected type
+ if (object instanceof ILaunchConfiguration) {
+ ILaunchConfiguration config = (ILaunchConfiguration) object;
+ try {
+ type = config.getType();
+ } catch (CoreException e) {
+ errorDialog(e);
+ return;
+ }
+ } else {
+ type = (ILaunchConfigurationType) object;
+ }
+ try {
+ ILaunchConfigurationWorkingCopy wc = type.newPrototypeInstance(null, DebugPlugin.getDefault().getLaunchManager().generateLaunchConfigurationName(LaunchConfigurationsMessages.CreateLaunchConfigurationPrototypeAction_New_prototype_2));
+ ILaunchConfigurationTabGroup tabGroup = LaunchConfigurationPresentationManager.getDefault().getTabGroup(wc, getMode());
+ // this only works because this action is only present when the
+ // dialog is open
+ ILaunchConfigurationDialog dialog = LaunchConfigurationsDialog.getCurrentlyVisibleLaunchConfigurationDialog();
+ tabGroup.createTabs(dialog, dialog.getMode());
+ ILaunchConfigurationTab[] tabs = tabGroup.getTabs();
+ for (int i = 0; i < tabs.length; i++) {
+ tabs[i].setLaunchConfigurationDialog(dialog);
+ }
+ tabGroup.setDefaults(wc);
+ tabGroup.dispose();
+ wc.doSave();
+ } catch (CoreException e) {
+ errorDialog(e);
+ return;
+ }
+ }
+ }
+
+ /**
+ * @see org.eclipse.ui.actions.SelectionListenerAction#updateSelection(org.eclipse.jface.viewers.IStructuredSelection)
+ */
+ @Override
+ protected boolean updateSelection(IStructuredSelection selection) {
+ if (selection.size() == 1) {
+ Object object = getStructuredSelection().getFirstElement();
+ if (object != null) {
+ ILaunchConfigurationType type = null;
+ // Construct a new configuration prototype of the selected type
+ if (object instanceof ILaunchConfiguration) {
+ ILaunchConfiguration config = (ILaunchConfiguration) object;
+ try {
+ type = config.getType();
+ } catch (CoreException e) {
+ errorDialog(e);
+ }
+ } else {
+ type = (ILaunchConfigurationType) object;
+ }
+ if (type != null) {
+ return type.supportsPrototypes();
+ }
+ }
+ }
+ return false;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.action.Action#getDisabledImageDescriptor()
+ */
+ @Override
+ public ImageDescriptor getDisabledImageDescriptor() {
+ return DebugUITools.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_NEW_PROTO);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.action.Action#getImageDescriptor()
+ */
+ @Override
+ public ImageDescriptor getImageDescriptor() {
+ return DebugUITools.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_NEW_PROTO);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.action.Action#getToolTipText()
+ */
+ @Override
+ public String getToolTipText() {
+ return LaunchConfigurationsMessages.LaunchConfigurationsDialog_2;
+ }
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/DeleteLaunchConfigurationAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/DeleteLaunchConfigurationAction.java
index 0c1eebba3..9f1ebac3f 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/DeleteLaunchConfigurationAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/DeleteLaunchConfigurationAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2013 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 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
@@ -7,6 +7,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Axel Richard (Obeo) - Bug 41353 - Launch configurations prototypes
*******************************************************************************/
package org.eclipse.debug.internal.ui.launchConfigurations;
@@ -70,7 +71,7 @@ public class DeleteLaunchConfigurationAction extends AbstractLaunchConfiguration
while (iterator.hasNext()) {
ILaunchConfiguration configuration = (ILaunchConfiguration)iterator.next();
try {
- configuration.delete();
+ configuration.delete(ILaunchConfiguration.UPDATE_PROTOTYPE_CHILDREN);
} catch (CoreException e) {
errorDialog(e);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupViewer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupViewer.java
index f3ba24630..2a02359e6 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupViewer.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupViewer.java
@@ -10,6 +10,7 @@
* Mohamed Hussein (Mentor Graphics) - Added getWarningMessage (Bug 386673)
* Robert Roth - Used consistent apply button location (Bug 432832)
* Lucas Bullen (Red Hat Inc.) - Added export configuration message (Bug 518652)
+ * Axel Richard (Obeo) - Bug 41353 - Launch configurations prototypes
*******************************************************************************/
package org.eclipse.debug.internal.ui.launchConfigurations;
@@ -347,11 +348,15 @@ public class LaunchConfigurationTabGroupViewer {
int width = parent.getBounds().width - 30;
SWTFactory.createWrapLabel(parent, LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_1, 1, width);
SWTFactory.createWrapCLabel(parent, LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_2, DebugUITools.getImage(IInternalDebugUIConstants.IMG_ELCL_NEW_CONFIG), 1, width);
+ SWTFactory.createWrapCLabel(parent, LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_9, DebugUITools.getImage(IInternalDebugUIConstants.IMG_ELCL_NEW_PROTO), 1, width);
SWTFactory.createWrapCLabel(parent, LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_7, DebugUITools.getImage(IInternalDebugUIConstants.IMG_ELCL_EXPORT_CONFIG), 1, width);
SWTFactory.createWrapCLabel(parent, LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_6, DebugUITools.getImage(IInternalDebugUIConstants.IMG_ELCL_DUPLICATE_CONFIG), 1, width);
SWTFactory.createWrapCLabel(parent, LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_4, DebugUITools.getImage(IInternalDebugUIConstants.IMG_ELCL_DELETE_CONFIG), 1, width);
- SWTFactory.createWrapCLabel(parent, LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_8, DebugUITools.getImage(IInternalDebugUIConstants.IMG_ELCL_FILTER_CONFIGS), 1, width);
- SWTFactory.createWrapCLabel(parent, LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_3, DebugUITools.getImage(IInternalDebugUIConstants.IMG_OVR_TRANSPARENT), 1, width);
+ SWTFactory.createWrapCLabel(parent, LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_8, DebugUITools.getImage(IInternalDebugUIConstants.IMG_ELCL_FILTER_CONFIGS), 1, width);
+ SWTFactory.createWrapCLabel(parent, LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_3, DebugUITools.getImage(IInternalDebugUIConstants.IMG_OVR_TRANSPARENT), 1, width);
+ SWTFactory.createWrapCLabel(parent, LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_10, DebugUITools.getImage(IInternalDebugUIConstants.IMG_ELCL_LINK_PROTO), 1, width);
+ SWTFactory.createWrapCLabel(parent, LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_11, DebugUITools.getImage(IInternalDebugUIConstants.IMG_ELCL_UNLINK_PROTO), 1, width);
+ SWTFactory.createWrapCLabel(parent, LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_12, DebugUITools.getImage(IInternalDebugUIConstants.IMG_ELCL_RESET_PROTO), 1, width);
SWTFactory.createHorizontalSpacer(parent, 2);
Link link = new Link(parent, SWT.LEFT | SWT.WRAP);
@@ -1511,7 +1516,7 @@ public class LaunchConfigurationTabGroupViewer {
getLaunchConfigurationDialog().run(true, false, runnable);
}
else {
- saved[0] = fWorkingCopy.doSave();
+ saved[0] = fWorkingCopy.doSave(ILaunchConfiguration.UPDATE_PROTOTYPE_CHILDREN);
}
}
updateButtons();
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTreeContentProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTreeContentProvider.java
index 14a06251d..2f655af3c 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTreeContentProvider.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTreeContentProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 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
@@ -8,6 +8,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
* Lars Vogel <Lars.Vogel@vogella.com> - Bug 490755
+ * Axel Richard (Obeo) - Bug 41353 - Launch configurations prototypes
*******************************************************************************/
package org.eclipse.debug.internal.ui.launchConfigurations;
@@ -74,17 +75,30 @@ public class LaunchConfigurationTreeContentProvider implements ITreeContentProvi
*/
@Override
public Object[] getChildren(Object parentElement) {
- if (parentElement instanceof ILaunchConfiguration) {
- return EMPTY_ARRAY;
- } else if (parentElement instanceof ILaunchConfigurationType) {
- try {
- ILaunchConfigurationType type = (ILaunchConfigurationType)parentElement;
- return getLaunchManager().getLaunchConfigurations(type);
- } catch (CoreException e) {
- DebugUIPlugin.errorDialog(getShell(), LaunchConfigurationsMessages.LaunchConfigurationDialog_Error_19, LaunchConfigurationsMessages.LaunchConfigurationDialog_An_exception_occurred_while_retrieving_launch_configurations_20, e); //
+ try {
+ if (parentElement instanceof ILaunchConfiguration) {
+ if (((ILaunchConfiguration) parentElement).isPrototype()) {
+ return ((ILaunchConfiguration) parentElement).getPrototypeChildren().toArray();
+ }
+ } else if (parentElement instanceof ILaunchConfigurationType) {
+ List<ILaunchConfiguration> configs = new ArrayList<>();
+ ILaunchConfigurationType type = (ILaunchConfigurationType) parentElement;
+ ILaunchConfiguration[] launchConfigurations = getLaunchManager().getLaunchConfigurations(type, ILaunchConfiguration.CONFIGURATION);
+ for (ILaunchConfiguration launchConfig : launchConfigurations) {
+ if (launchConfig.getPrototype() == null) {
+ configs.add(launchConfig);
+ }
+ }
+ ILaunchConfiguration[] prototypes = getLaunchManager().getLaunchConfigurations(type, ILaunchConfiguration.PROTOTYPE);
+ for (ILaunchConfiguration prototype : prototypes) {
+ configs.add(prototype);
+ }
+ return configs.toArray(new ILaunchConfiguration[0]);
+ } else {
+ return getLaunchManager().getLaunchConfigurationTypes();
}
- } else {
- return getLaunchManager().getLaunchConfigurationTypes();
+ } catch (CoreException e) {
+ DebugUIPlugin.errorDialog(getShell(), LaunchConfigurationsMessages.LaunchConfigurationDialog_Error_19, LaunchConfigurationsMessages.LaunchConfigurationDialog_An_exception_occurred_while_retrieving_launch_configurations_20, e); //
}
return EMPTY_ARRAY;
}
@@ -99,7 +113,12 @@ public class LaunchConfigurationTreeContentProvider implements ITreeContentProvi
return null;
}
try {
- return ((ILaunchConfiguration)element).getType();
+ ILaunchConfiguration prototype = ((ILaunchConfiguration) element).getPrototype();
+ if (prototype != null) {
+ return prototype;
+ } else {
+ return ((ILaunchConfiguration) element).getType();
+ }
} catch (CoreException e) {
DebugUIPlugin.errorDialog(getShell(), LaunchConfigurationsMessages.LaunchConfigurationDialog_Error_19, LaunchConfigurationsMessages.LaunchConfigurationDialog_An_exception_occurred_while_retrieving_launch_configurations_20, e); //
}
@@ -115,6 +134,13 @@ public class LaunchConfigurationTreeContentProvider implements ITreeContentProvi
@Override
public boolean hasChildren(Object element) {
if (element instanceof ILaunchConfiguration) {
+ if (((ILaunchConfiguration) element).isPrototype()) {
+ try {
+ return ((ILaunchConfiguration) element).getPrototypeChildren().size() > 0;
+ } catch (CoreException e) {
+ DebugUIPlugin.errorDialog(getShell(), LaunchConfigurationsMessages.LaunchConfigurationDialog_Error_19, LaunchConfigurationsMessages.LaunchConfigurationDialog_An_exception_occurred_while_retrieving_launch_configurations_20, e); //
+ }
+ }
return false;
}
return getChildren(element).length > 0;
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationView.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationView.java
index 73f7087c1..ab40eec23 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationView.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationView.java
@@ -8,6 +8,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
* Ian Pun (Red Hat Inc.) - Bug 518652
+ * Axel Richard (Obeo) - Bug 41353 - Launch configurations prototypes
*******************************************************************************/
package org.eclipse.debug.internal.ui.launchConfigurations;
@@ -76,10 +77,14 @@ public class LaunchConfigurationView extends AbstractDebugView implements ILaunc
* Actions
*/
private CreateLaunchConfigurationAction fCreateAction;
+ private CreateLaunchConfigurationPrototypeAction fCreatePrototypeAction;
private DeleteLaunchConfigurationAction fDeleteAction;
private DuplicateLaunchConfigurationAction fDuplicateAction;
private ExportLaunchConfigurationAction fExportAction;
private CollapseAllLaunchConfigurationAction fCollapseAllAction;
+ private LinkPrototypeAction fLinkPrototypeAction;
+ private UnlinkPrototypeAction fUnlinkPrototypeAction;
+ private ResetWithPrototypeValuesAction fResetWithPrototypeValuesAction;
/**
* Action for providing filtering to the Launch Configuration Dialog
@@ -196,6 +201,9 @@ public class LaunchConfigurationView extends AbstractDebugView implements ILaunc
fCreateAction = new CreateLaunchConfigurationAction(getViewer(), getLaunchGroup().getMode());
setAction(CreateLaunchConfigurationAction.ID_CREATE_ACTION, fCreateAction);
+ fCreatePrototypeAction = new CreateLaunchConfigurationPrototypeAction(getViewer(), getLaunchGroup().getMode());
+ setAction(CreateLaunchConfigurationPrototypeAction.ID_CREATE_PROTOTYPE_ACTION, fCreatePrototypeAction);
+
fDeleteAction = new DeleteLaunchConfigurationAction(getViewer(), getLaunchGroup().getMode());
setAction(DeleteLaunchConfigurationAction.ID_DELETE_ACTION, fDeleteAction);
setAction(IDebugView.REMOVE_ACTION, fDeleteAction);
@@ -212,6 +220,14 @@ public class LaunchConfigurationView extends AbstractDebugView implements ILaunc
fFilterAction = new FilterLaunchConfigurationAction();
setAction(FilterLaunchConfigurationAction.ID_FILTER_ACTION, fFilterAction);
+ fLinkPrototypeAction = new LinkPrototypeAction(getViewer(), getLaunchGroup().getMode());
+ setAction(LinkPrototypeAction.ID_LINK_PROTOTYPE_ACTION, fLinkPrototypeAction);
+
+ fUnlinkPrototypeAction = new UnlinkPrototypeAction(getViewer(), getLaunchGroup().getMode());
+ setAction(UnlinkPrototypeAction.ID_UNLINK_PROTOTYPE_ACTION, fUnlinkPrototypeAction);
+
+ fResetWithPrototypeValuesAction = new ResetWithPrototypeValuesAction(getViewer(), getLaunchGroup().getMode());
+ setAction(ResetWithPrototypeValuesAction.ID_RESET_WITH_PROTOTYPE_VALUES_ACTION, fResetWithPrototypeValuesAction);
}
/**
@@ -228,10 +244,14 @@ public class LaunchConfigurationView extends AbstractDebugView implements ILaunc
@Override
protected void fillContextMenu(IMenuManager menu) {
menu.add(fCreateAction);
+ menu.add(fCreatePrototypeAction);
menu.add(fExportAction);
menu.add(fDuplicateAction);
menu.add(fDeleteAction);
menu.add(new Separator());
+ menu.add(fLinkPrototypeAction);
+ menu.add(fUnlinkPrototypeAction);
+ menu.add(fResetWithPrototypeValuesAction);
}
/**
@@ -255,11 +275,15 @@ public class LaunchConfigurationView extends AbstractDebugView implements ILaunc
@Override
public void dispose() {
fCreateAction.dispose();
+ fCreatePrototypeAction.dispose();
fDeleteAction.dispose();
fDuplicateAction.dispose();
fExportAction.dispose();
fFilterAction = null;
fCollapseAllAction = null;
+ fLinkPrototypeAction.dispose();
+ fUnlinkPrototypeAction.dispose();
+ fResetWithPrototypeValuesAction.dispose();
getLaunchManager().removeLaunchConfigurationListener(this);
}
@@ -295,7 +319,11 @@ public class LaunchConfigurationView extends AbstractDebugView implements ILaunc
if (viewer != null) {
try {
viewer.getControl().setRedraw(false);
- viewer.add(configuration.getType(), configuration);
+ if (configuration.getPrototype() != null) {
+ viewer.add(configuration.getPrototype(), configuration);
+ } else {
+ viewer.add(configuration.getType(), configuration);
+ }
// if moved, remove original now
if (from != null) {
viewer.remove(from);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsDialog.java
index 3d3a9d78a..e889e8d76 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsDialog.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsDialog.java
@@ -9,6 +9,7 @@
* IBM Corporation - initial API and implementation
* Sebastian Davids - Bug 137923
* Mohamed Hussein (Mentor Graphics) - Added s/getWarningMessage (Bug 386673)
+ * Axel Richard (Obeo) - Bug 41353 - Launch configurations prototypes
*******************************************************************************/
package org.eclipse.debug.internal.ui.launchConfigurations;
@@ -516,6 +517,7 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun
*/
protected void createToolbarActions(ToolBarManager tmanager) {
tmanager.add(getNewAction());
+ tmanager.add(getNewPrototypeAction());
tmanager.add(getExportAction());
tmanager.add(getDuplicateAction());
tmanager.add(getDeleteAction());
@@ -617,14 +619,22 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun
getDuplicateAction().setConfirmationRequestor(requestor);
getExportAction().setConfirmationRequestor(requestor);
getNewAction().setConfirmationRequestor(requestor);
+ getNewPrototypeAction().setConfirmationRequestor(requestor);
+ getLinkPrototypeAction().setConfirmationRequestor(requestor);
+ getUnlinkPrototypeAction().setConfirmationRequestor(requestor);
+ getResetWithPrototypeValuesAction().setConfirmationRequestor(requestor);
((StructuredViewer) viewer).addPostSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
handleLaunchConfigurationSelectionChanged(event);
getNewAction().setEnabled(getNewAction().isEnabled());
+ getNewPrototypeAction().setEnabled(getNewPrototypeAction().isEnabled());
getDeleteAction().setEnabled(getDeleteAction().isEnabled());
getExportAction().setEnabled(getExportAction().isEnabled());
getDuplicateAction().setEnabled(getDuplicateAction().isEnabled());
+ getLinkPrototypeAction().setEnabled(getLinkPrototypeAction().isEnabled());
+ getUnlinkPrototypeAction().setEnabled(getUnlinkPrototypeAction().isEnabled());
+ getResetWithPrototypeValuesAction().setEnabled(getResetWithPrototypeValuesAction().isEnabled());
}
});
return comp;
@@ -875,6 +885,50 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun
}
/**
+ * Gets the new prototype menu action
+ *
+ * @return the new prototype menu action
+ *
+ * @since 3.13
+ */
+ protected AbstractLaunchConfigurationAction getNewPrototypeAction() {
+ return (AbstractLaunchConfigurationAction) fLaunchConfigurationView.getAction(CreateLaunchConfigurationPrototypeAction.ID_CREATE_PROTOTYPE_ACTION);
+ }
+
+ /**
+ * Gets the link prototype menu action
+ *
+ * @return the link prototype menu action
+ *
+ * @since 3.13
+ */
+ protected AbstractLaunchConfigurationAction getLinkPrototypeAction() {
+ return (AbstractLaunchConfigurationAction) fLaunchConfigurationView.getAction(LinkPrototypeAction.ID_LINK_PROTOTYPE_ACTION);
+ }
+
+ /**
+ * Gets the unlink prototype menu action
+ *
+ * @return the unlink prototype menu action
+ *
+ * @since 3.13
+ */
+ protected AbstractLaunchConfigurationAction getUnlinkPrototypeAction() {
+ return (AbstractLaunchConfigurationAction) fLaunchConfigurationView.getAction(UnlinkPrototypeAction.ID_UNLINK_PROTOTYPE_ACTION);
+ }
+
+ /**
+ * Gets the reset with prototype values menu action
+ *
+ * @return the reset with prototype values menu action
+ *
+ * @since 3.13
+ */
+ protected AbstractLaunchConfigurationAction getResetWithPrototypeValuesAction() {
+ return (AbstractLaunchConfigurationAction) fLaunchConfigurationView.getAction(ResetWithPrototypeValuesAction.ID_RESET_WITH_PROTOTYPE_VALUES_ACTION);
+ }
+
+ /**
* Returns the reserved name set (if there is one), <code>null</code> otherwise
* @return the reserved name set or <code>null</code>
* @since 3.3
@@ -1312,6 +1366,15 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun
}
/**
+ * Refresh the launch configurations' tree viewer
+ *
+ * @since 3.13
+ */
+ protected void refreshLaunchConfigurationView() {
+ fLaunchConfigurationView.getTreeViewer().refresh();
+ }
+
+ /**
* resize the dialog to show all relevant content
*/
protected void resize() {
@@ -1604,6 +1667,9 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun
getExportAction().setEnabled(getExportAction().isEnabled());
getDeleteAction().setEnabled(getDeleteAction().isEnabled());
getDuplicateAction().setEnabled(getDuplicateAction().isEnabled());
+ getLinkPrototypeAction().setEnabled(getLinkPrototypeAction().isEnabled());
+ getUnlinkPrototypeAction().setEnabled(getUnlinkPrototypeAction().isEnabled());
+ getResetWithPrototypeValuesAction().setEnabled(getResetWithPrototypeValuesAction().isEnabled());
fTabViewer.refresh();
getButton(ID_LAUNCH_BUTTON).setEnabled(fTabViewer.canLaunch() & fTabViewer.canLaunchWithModes() & !fTabViewer.hasDuplicateDelegates());
} else {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.java
index eacb87f84..8bbe5942a 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.java
@@ -8,6 +8,7 @@
* Contributors:
* IBM - Initial API and implementation
* Ian Pun & Lucas Bullen (Red Hat Inc.) - Bug 518652
+ * Axel Richard (Obeo) - Bug 41353 - Launch configurations prototypes
*******************************************************************************/
package org.eclipse.debug.internal.ui.launchConfigurations;
@@ -49,6 +50,15 @@ public class LaunchConfigurationsMessages extends NLS {
public static String CommonTab_8;
public static String CommonTab_9;
+ public static String CommonTab_AttributeLabel_ConsoleEncoding;
+ public static String CommonTab_AttributeLabel_CaptureOutput;
+ public static String CommonTab_AttributeLabel_CaptureInConsole;
+ public static String CommonTab_AttributeLabel_CaptureStdInFile;
+ public static String CommonTab_AttributeLabel_CaptureInFile;
+ public static String CommonTab_AttributeLabel_AppendToFile;
+ public static String CommonTab_AttributeLabel_LaunchInBackground;
+ public static String CommonTab_AttributeLabel_FavoriteGroups;
+
public static String CompileErrorProjectPromptStatusHandler_0;
public static String CompileErrorProjectPromptStatusHandler_1;
public static String CompileErrorPromptStatusHandler_0;
@@ -140,6 +150,11 @@ public class LaunchConfigurationsMessages extends NLS {
public static String CreateLaunchConfigurationAction_Ne_w_1;
public static String ExportLaunchConfigurationAction_Export_1;
public static String CreateLaunchConfigurationAction_New_configuration_2;
+ public static String CreateLaunchConfigurationPrototypeAction_Ne_w_1;
+ public static String CreateLaunchConfigurationPrototypeAction_New_prototype_2;
+ public static String LinkPrototypeAction_Link_prototype_1;
+ public static String UnlinkPrototypeAction_Unlink_prototype_1;
+ public static String ResetWithPrototypeValuesAction_Reset_with_prototype_values_1;
public static String EnvironmentTab_Variable_1;
public static String EnvironmentTab_Value_2;
@@ -158,6 +173,21 @@ public class LaunchConfigurationsMessages extends NLS {
public static String EnvironmentTab_18;
public static String EnvironmentTab_19;
public static String EnvironmentTab_20;
+ public static String EnvironmentTab_AttributeLabel_AppendEnvironmentVariables;
+ public static String EnvironmentTab_AttributeLabel_EnvironmentVariables;
+
+ public static String PrototypeTab_Prototype_1;
+ public static String PrototypeTab_Label_2;
+ public static String PrototypeTab_Link_Button_Label_3;
+ public static String PrototypeTab_Unlink_Button_Label_4;
+ public static String PrototypeTab_Select_Message_5;
+ public static String PrototypeTab_Select_Empty_Message_6;
+ public static String PrototypeTab_Select_Prototype_Error_7;
+ public static String PrototypeTab_Reset_Button_Label_8;
+ public static String PrototypeTab_Reset_Menu_Action_9;
+ public static String PrototypeTab_Explanation_Label_10;
+ public static String PrototypeTab_Explanation_Label_11;
+ public static String PrototypeTab_Explanation_Label_12;
public static String FavoritesDialog_1;
public static String FavoritesDialog_2;
@@ -189,7 +219,11 @@ public class LaunchConfigurationsMessages extends NLS {
public static String LaunchConfigurationTabGroupViewer_3;
public static String LaunchConfigurationTabGroupViewer_4;
public static String LaunchConfigurationTabGroupViewer_5;
- public static String LaunchConfigurationTabGroupViewer_6;
+ public static String LaunchConfigurationTabGroupViewer_6;
+ public static String LaunchConfigurationTabGroupViewer_9;
+ public static String LaunchConfigurationTabGroupViewer_10;
+ public static String LaunchConfigurationTabGroupViewer_11;
+ public static String LaunchConfigurationTabGroupViewer_12;
public static String LaunchConfigurationTabGroupViewer_7;
public static String SaveScopeResourcesHandler_1;
@@ -200,9 +234,13 @@ public class LaunchConfigurationsMessages extends NLS {
public static String LaunchConfigurationsDialog_0;
public static String LaunchConfigurationsDialog_1;
+ public static String LaunchConfigurationsDialog_2;
public static String LaunchConfigurationsDialog_4;
public static String LaunchConfigurationsDialog_5;
public static String LaunchConfigurationsDialog_6;
+ public static String LaunchConfigurationsDialog_7;
+ public static String LaunchConfigurationsDialog_8;
+ public static String LaunchConfigurationsDialog_9;
public static String FilterLaunchConfigurationAction_0;
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.properties b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.properties
index 72d08e819..c7451e5d9 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.properties
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.properties
@@ -8,6 +8,7 @@
# Contributors:
# IBM Corporation - initial API and implementation
# Ian Pun & Lucas Bullen (Red Hat Inc.) - Bug 518652
+# Axel Richard (Obeo) - Bug 41353 - Launch configurations prototypes
###############################################################################
CommonTab__Browse_6=&Browse...
@@ -41,6 +42,14 @@ CommonTab_6=Output Fi&le:
CommonTab_7=File &System...
CommonTab_8=No file specified for process output
CommonTab_9=Variables...
+CommonTab_AttributeLabel_ConsoleEncoding=Console encoding
+CommonTab_AttributeLabel_CaptureOutput=Capture output
+CommonTab_AttributeLabel_CaptureInConsole=Capture in console
+CommonTab_AttributeLabel_CaptureStdInFile=Capture standard input file
+CommonTab_AttributeLabel_CaptureInFile=Capture in file
+CommonTab_AttributeLabel_AppendToFile=Append to file
+CommonTab_AttributeLabel_LaunchInBackground=Launch in background
+CommonTab_AttributeLabel_FavoriteGroups=Favorite groups
CompileErrorPromptStatusHandler_0=Errors in Workspace
CompileErrorPromptStatusHandler_1=Errors exist in a required project. Continue launch?
@@ -56,13 +65,17 @@ LaunchConfigurationDialog__Name__16=&Name:
LaunchConfigurationDialog_An_exception_occurred_while_retrieving_launch_configurations_20=An exception occurred while retrieving launch configurations
LaunchConfigurationTabGroupViewer_1=Configure launch settings from this dialog:
-LaunchConfigurationTabGroupViewer_2=- Press the 'New' button to create a configuration of the selected type.
+LaunchConfigurationTabGroupViewer_2=- Press the 'New configuration' button to create a configuration of the selected type.
LaunchConfigurationTabGroupViewer_3=- Edit or view an existing configuration by selecting it.
LaunchConfigurationTabGroupViewer_4=- Press the 'Delete' button to remove the selected configuration.
LaunchConfigurationTabGroupViewer_6=- Press the 'Duplicate' button to copy the selected configuration.
LaunchConfigurationTabGroupViewer_5=Configure launch perspective settings from the <a>'Perspectives'</a> preference page.
LaunchConfigurationTabGroupViewer_7=- Press the 'Export' button to export the selected configurations.
LaunchConfigurationTabGroupViewer_8=- Press the 'Filter' button to configure filtering options.
+LaunchConfigurationTabGroupViewer_9=- Press the 'New prototype' button to create a launch configuration prototype of the selected type.
+LaunchConfigurationTabGroupViewer_10=- Select launch configuration(s) and then select 'Link prototype' menu item to link a prototype.
+LaunchConfigurationTabGroupViewer_11=- Select launch configuration(s) and then select 'Unlink prototype' menu item to unlink a prototype.
+LaunchConfigurationTabGroupViewer_12=- Select launch configuration(s) and then select 'Reset with prototype values' menu item to reset with prototype values.
LaunchConfigurationTabGroupViewer_13=Select a supported <a>launch mode</a>.
LaunchConfigurationTabGroupViewer_14=This configuration does not support some of the launch modes: {0}
LaunchConfigurationTabGroupViewer_15=More than one launcher available - <a>Select other...</a>
@@ -104,9 +117,13 @@ LaunchConfigurationsDialog_Warning_2=Warning
LaunchConfigurationsDialog_Information_3=Information
LaunchConfigurationsDialog_0=New launch configuration
LaunchConfigurationsDialog_1=Delete selected launch configuration(s)
+LaunchConfigurationsDialog_2=New launch configuration prototype
LaunchConfigurationsDialog_4=Filter launch configurations...
LaunchConfigurationsDialog_5=Duplicates the currently selected launch configuration
LaunchConfigurationsDialog_6=Export launch configuration
+LaunchConfigurationsDialog_7=Link prototype
+LaunchConfigurationsDialog_8=Unlink prototype
+LaunchConfigurationsDialog_9=Reset with prototype values
LaunchConfigurationSelectionDialog_0=Select Configuration
LaunchConfigurationSelectionDialog_1=&Select a configuration to launch:
LaunchConfigurationView_0=Filter matched {0} of {1} items
@@ -150,9 +167,14 @@ DuplicateLaunchConfigurationAction__Duplicate_1=&Duplicate
DeleteLaunchConfigurationAction_Dele_te_1=Dele&te
-CreateLaunchConfigurationAction_Ne_w_1=Ne&w
+CreateLaunchConfigurationAction_Ne_w_1=Ne&w configuration
ExportLaunchConfigurationAction_Export_1=E&xport
CreateLaunchConfigurationAction_New_configuration_2=New_configuration
+CreateLaunchConfigurationPrototypeAction_Ne_w_1=New &prototype
+CreateLaunchConfigurationPrototypeAction_New_prototype_2=New_prototype
+LinkPrototypeAction_Link_prototype_1=&Link prototype
+UnlinkPrototypeAction_Unlink_prototype_1=&Unlink prototype
+ResetWithPrototypeValuesAction_Reset_with_prototype_values_1=&Reset with prototype values
EnvironmentTab_Variable_1=Variable
EnvironmentTab_Value_2=Value
@@ -177,6 +199,22 @@ EnvironmentTab_17=Re&place native environment with specified environment
EnvironmentTab_18=Se&lect...
EnvironmentTab_19=Select &environment variables to add:
EnvironmentTab_20=Select Environment Variables
+EnvironmentTab_AttributeLabel_AppendEnvironmentVariables=Append environment to native environment
+EnvironmentTab_AttributeLabel_EnvironmentVariables=Environment variables
+
+#PrototypeTab
+PrototypeTab_Prototype_1=Prototype
+PrototypeTab_Label_2=Prototype:
+PrototypeTab_Link_Button_Label_3=Link...
+PrototypeTab_Unlink_Button_Label_4=Unlink
+PrototypeTab_Select_Message_5=Please select a prototype
+PrototypeTab_Select_Empty_Message_6=You have to select a prototype
+PrototypeTab_Select_Prototype_Error_7=The prototype doesn't exists. Please select a valid prototype.
+PrototypeTab_Reset_Button_Label_8=Reset
+PrototypeTab_Reset_Menu_Action_9=Reset selected checked attribute(s) with prototype value(s)
+PrototypeTab_Explanation_Label_10=- Values of checked attributes from prototype are applied on associated launch configurations.
+PrototypeTab_Explanation_Label_11=- Values of unchecked attributes from prototype are not applied on associated launch configurations.
+PrototypeTab_Explanation_Label_12=- Grayed state attributes have different values in the launch configuration and the associated prototype.
FavoritesDialog_1=Organize {0} Favorites
FavoritesDialog_2=Fa&vorites:
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LinkPrototypeAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LinkPrototypeAction.java
new file mode 100644
index 000000000..a1b28b72d
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LinkPrototypeAction.java
@@ -0,0 +1,159 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Obeo.
+ * 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:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.internal.ui.launchConfigurations;
+
+import java.util.Collection;
+import java.util.HashSet;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationType;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.internal.ui.DebugUIPlugin;
+import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
+import org.eclipse.debug.ui.DebugUITools;
+import org.eclipse.debug.ui.ILaunchConfigurationDialog;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.DecoratingLabelProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.window.Window;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.dialogs.ElementListSelectionDialog;
+
+/**
+ * Link attributes from a prototype to the selected launch configuration(s).
+ *
+ * @since 3.13
+ */
+public class LinkPrototypeAction extends AbstractLaunchConfigurationAction {
+
+ /**
+ * Action identifier for IDebugView#getAction(String)
+ */
+ public static final String ID_LINK_PROTOTYPE_ACTION = DebugUIPlugin.getUniqueIdentifier() + ".ID_LINK_PROTOTYPE_ACTION"; //$NON-NLS-1$
+
+ /**
+ * Constructs an action to apply a prototype to a launch configuration
+ *
+ * @param viewer the viewer
+ * @param mode the mode the action applies to
+ */
+ public LinkPrototypeAction(Viewer viewer, String mode) {
+ super(LaunchConfigurationsMessages.LinkPrototypeAction_Link_prototype_1, viewer, mode);
+ }
+
+ /**
+ * @see AbstractLaunchConfigurationAction#performAction()
+ */
+ @Override
+ protected void performAction() {
+ try {
+ ILaunchConfiguration firstLaunchConfiguration = (ILaunchConfiguration) getStructuredSelection().getFirstElement();
+ ILaunchConfigurationType type = firstLaunchConfiguration.getType();
+ ILaunchConfiguration[] prototypes = type.getPrototypes();
+ // Select the prototype
+ DecoratingLabelProvider labelProvider = new DecoratingLabelProvider(DebugUITools.newDebugModelPresentation(), PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator());
+ ElementListSelectionDialog selectPrototypeDialog = new ElementListSelectionDialog(getShell(), labelProvider);
+ selectPrototypeDialog.setElements(prototypes);
+ selectPrototypeDialog.setMultipleSelection(false);
+ selectPrototypeDialog.setEmptySelectionMessage("You have to select a prototype."); //$NON-NLS-1$
+ selectPrototypeDialog.setTitle("Please select a prototype"); //$NON-NLS-1$
+ int open = selectPrototypeDialog.open();
+ if (open == Window.OK) {
+ Object selectedPrototype = selectPrototypeDialog.getFirstResult();
+ for (Object launchConfiguration : getStructuredSelection().toList()) {
+ if (launchConfiguration instanceof ILaunchConfiguration) {
+ // Link the prototype attributes to the selected launch
+ // configuration
+ ILaunchConfigurationWorkingCopy workingCopy = ((ILaunchConfiguration) launchConfiguration).getWorkingCopy();
+ workingCopy.setPrototype((ILaunchConfiguration) selectedPrototype, true);
+ workingCopy.doSave();
+ // if only one configuration is selected, refresh the
+ // tabs to display visible attributes values from the
+ // prototype
+ if (getStructuredSelection().size() == 1) {
+ ILaunchConfigurationDialog dialog = LaunchConfigurationsDialog.getCurrentlyVisibleLaunchConfigurationDialog();
+ if (dialog instanceof LaunchConfigurationsDialog) {
+ ((LaunchConfigurationsDialog) dialog).getTabViewer().setInput(workingCopy);
+ }
+ }
+ }
+ }
+ getViewer().refresh();
+ }
+ } catch (CoreException e) {
+ errorDialog(e);
+ }
+ }
+
+ /**
+ * @see org.eclipse.ui.actions.SelectionListenerAction#updateSelection(org.eclipse.jface.viewers.IStructuredSelection)
+ */
+ @Override
+ protected boolean updateSelection(IStructuredSelection selection) {
+ // Enable action only if launch configuration(s) of the same type
+ // is(are) selected and the launch configuration type allows prototypes
+ Collection<ILaunchConfigurationType> launchConfigurationTypes = new HashSet<>();
+ for (Object object : selection.toList()) {
+ if (object instanceof ILaunchConfiguration) {
+ if (((ILaunchConfiguration) object).isPrototype()) {
+ return false;
+ } else {
+ ILaunchConfigurationType type = null;
+ try {
+ type = ((ILaunchConfiguration) object).getType();
+ } catch (CoreException e) {
+ DebugUIPlugin.log(e.getStatus());
+ }
+ if (type != null) {
+ launchConfigurationTypes.add(type);
+ } else {
+ return false;
+ }
+ }
+ } else {
+ return false;
+ }
+ }
+ if (launchConfigurationTypes.size() == 1) {
+ return launchConfigurationTypes.iterator().next().supportsPrototypes();
+ }
+ return false;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.action.Action#getDisabledImageDescriptor()
+ */
+ @Override
+ public ImageDescriptor getDisabledImageDescriptor() {
+ return DebugUITools.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_LINK_PROTO);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.action.Action#getImageDescriptor()
+ */
+ @Override
+ public ImageDescriptor getImageDescriptor() {
+ return DebugUITools.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_LINK_PROTO);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.action.Action#getToolTipText()
+ */
+ @Override
+ public String getToolTipText() {
+ return LaunchConfigurationsMessages.LaunchConfigurationsDialog_7;
+ }
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/ResetWithPrototypeValuesAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/ResetWithPrototypeValuesAction.java
new file mode 100644
index 000000000..944182212
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/ResetWithPrototypeValuesAction.java
@@ -0,0 +1,129 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Obeo.
+ * 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:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.internal.ui.launchConfigurations;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.internal.ui.DebugUIPlugin;
+import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
+import org.eclipse.debug.ui.DebugUITools;
+import org.eclipse.debug.ui.ILaunchConfigurationDialog;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.Viewer;
+
+/**
+ * Reset selected launch configuration(s) attributes with values from associated
+ * prototype(s).
+ *
+ * @since 3.13
+ */
+public class ResetWithPrototypeValuesAction extends AbstractLaunchConfigurationAction {
+
+ /**
+ * Action identifier for IDebugView#getAction(String)
+ */
+ public static final String ID_RESET_WITH_PROTOTYPE_VALUES_ACTION = DebugUIPlugin.getUniqueIdentifier() + ".ID_RESET_WITH_PROTOTYPE_VALUES_ACTION"; //$NON-NLS-1$
+
+ /**
+ * Constructs an action to reset a launch configuration with prototype
+ * values
+ *
+ * @param viewer the viewer
+ * @param mode the mode the action applies to
+ */
+ public ResetWithPrototypeValuesAction(Viewer viewer, String mode) {
+ super(LaunchConfigurationsMessages.ResetWithPrototypeValuesAction_Reset_with_prototype_values_1, viewer, mode);
+ }
+
+ /**
+ * @see AbstractLaunchConfigurationAction#performAction()
+ */
+ @Override
+ protected void performAction() {
+ try {
+ for (Object launchConfiguration : getStructuredSelection().toList()) {
+ if (launchConfiguration instanceof ILaunchConfiguration) {
+ ILaunchConfigurationWorkingCopy workingCopy = ((ILaunchConfiguration) launchConfiguration).getWorkingCopy();
+ workingCopy.setPrototype(((ILaunchConfiguration) launchConfiguration).getPrototype(), true);
+ workingCopy.doSave();
+ // if only one configuration is selected, refresh the
+ // tabs to display visible attributes values from the
+ // prototype
+ if (getStructuredSelection().size() == 1) {
+ ILaunchConfigurationDialog dialog = LaunchConfigurationsDialog.getCurrentlyVisibleLaunchConfigurationDialog();
+ if (dialog instanceof LaunchConfigurationsDialog) {
+ ((LaunchConfigurationsDialog) dialog).getTabViewer().setInput(workingCopy);
+ }
+ }
+ }
+ }
+ } catch (CoreException e) {
+ errorDialog(e);
+ }
+ }
+
+ /**
+ * @see org.eclipse.ui.actions.SelectionListenerAction#updateSelection(org.eclipse.jface.viewers.IStructuredSelection)
+ */
+ @Override
+ protected boolean updateSelection(IStructuredSelection selection) {
+ boolean onlyLaunchConfigurationWithPrototypeSelected = false;
+ for (Object object : selection.toList()) {
+ if (object instanceof ILaunchConfiguration) {
+ if (((ILaunchConfiguration) object).isPrototype()) {
+ return false;
+ } else {
+ try {
+ if (((ILaunchConfiguration) object).getPrototype() != null) {
+ onlyLaunchConfigurationWithPrototypeSelected = true;
+ } else {
+ return false;
+ }
+ } catch (CoreException e) {
+ DebugUIPlugin.log(e.getStatus());
+ }
+ }
+ } else {
+ return false;
+ }
+ }
+ return onlyLaunchConfigurationWithPrototypeSelected;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.action.Action#getDisabledImageDescriptor()
+ */
+ @Override
+ public ImageDescriptor getDisabledImageDescriptor() {
+ return DebugUITools.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_RESET_PROTO);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.action.Action#getImageDescriptor()
+ */
+ @Override
+ public ImageDescriptor getImageDescriptor() {
+ return DebugUITools.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_RESET_PROTO);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.action.Action#getToolTipText()
+ */
+ @Override
+ public String getToolTipText() {
+ return LaunchConfigurationsMessages.LaunchConfigurationsDialog_9;
+ }
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/UnlinkPrototypeAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/UnlinkPrototypeAction.java
new file mode 100644
index 000000000..f1cbc5d50
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/UnlinkPrototypeAction.java
@@ -0,0 +1,128 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Obeo.
+ * 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:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.internal.ui.launchConfigurations;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.internal.ui.DebugUIPlugin;
+import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
+import org.eclipse.debug.ui.DebugUITools;
+import org.eclipse.debug.ui.ILaunchConfigurationDialog;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.Viewer;
+
+/**
+ * Unlink prototype to the selected launch configuration(s).
+ *
+ * @since 3.13
+ */
+public class UnlinkPrototypeAction extends AbstractLaunchConfigurationAction {
+
+ /**
+ * Action identifier for IDebugView#getAction(String)
+ */
+ public static final String ID_UNLINK_PROTOTYPE_ACTION = DebugUIPlugin.getUniqueIdentifier() + ".ID_UNLINK_PROTOTYPE_ACTION"; //$NON-NLS-1$
+
+ /**
+ * Constructs an action to unlink a prototype to a launch configuration
+ *
+ * @param viewer the viewer
+ * @param mode the mode the action applies to
+ */
+ public UnlinkPrototypeAction(Viewer viewer, String mode) {
+ super(LaunchConfigurationsMessages.UnlinkPrototypeAction_Unlink_prototype_1, viewer, mode);
+ }
+
+ /**
+ * @see AbstractLaunchConfigurationAction#performAction()
+ */
+ @Override
+ protected void performAction() {
+ try {
+ for (Object launchConfiguration : getStructuredSelection().toList()) {
+ if (launchConfiguration instanceof ILaunchConfiguration) {
+ ILaunchConfigurationWorkingCopy workingCopy = ((ILaunchConfiguration) launchConfiguration).getWorkingCopy();
+ workingCopy.setPrototype(null, false);
+ workingCopy.doSave();
+ // if only one configuration is selected, refresh the
+ // tabs to display visible attributes values from the
+ // prototype
+ if (getStructuredSelection().size() == 1) {
+ ILaunchConfigurationDialog dialog = LaunchConfigurationsDialog.getCurrentlyVisibleLaunchConfigurationDialog();
+ if (dialog instanceof LaunchConfigurationsDialog) {
+ ((LaunchConfigurationsDialog) dialog).getTabViewer().setInput(workingCopy);
+ }
+ }
+ }
+ }
+ getViewer().refresh();
+ } catch (CoreException e) {
+ errorDialog(e);
+ }
+ }
+
+ /**
+ * @see org.eclipse.ui.actions.SelectionListenerAction#updateSelection(org.eclipse.jface.viewers.IStructuredSelection)
+ */
+ @Override
+ protected boolean updateSelection(IStructuredSelection selection) {
+ boolean onlyLaunchConfigurationWithPrototypeSelected = false;
+ for (Object object : selection.toList()) {
+ if (object instanceof ILaunchConfiguration) {
+ if (((ILaunchConfiguration) object).isPrototype()) {
+ return false;
+ } else {
+ try {
+ if (((ILaunchConfiguration) object).getPrototype() != null) {
+ onlyLaunchConfigurationWithPrototypeSelected = true;
+ } else {
+ return false;
+ }
+ } catch (CoreException e) {
+ DebugUIPlugin.log(e.getStatus());
+ }
+ }
+ } else {
+ return false;
+ }
+ }
+ return onlyLaunchConfigurationWithPrototypeSelected;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.action.Action#getDisabledImageDescriptor()
+ */
+ @Override
+ public ImageDescriptor getDisabledImageDescriptor() {
+ return DebugUITools.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_UNLINK_PROTO);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.action.Action#getImageDescriptor()
+ */
+ @Override
+ public ImageDescriptor getImageDescriptor() {
+ return DebugUITools.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_UNLINK_PROTO);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.action.Action#getToolTipText()
+ */
+ @Override
+ public String getToolTipText() {
+ return LaunchConfigurationsMessages.LaunchConfigurationsDialog_8;
+ }
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceLookupUIMessages.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceLookupUIMessages.java
index a4e9ef95e..696d7c0b3 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceLookupUIMessages.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceLookupUIMessages.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2009 IBM Corporation and others.
+ * Copyright (c) 2003, 2017 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
@@ -8,6 +8,7 @@
* Contributors:
* IBM - Initial API and implementation
* QNX Software Systems - Mikhail Khodjaiants - Bug 114664
+ * Axel Richard (Obeo) - Bug 41353 - Launch configurations prototypes
*******************************************************************************/
package org.eclipse.debug.internal.ui.sourcelookup;
@@ -37,6 +38,9 @@ public class SourceLookupUIMessages extends NLS {
public static String sourceTab_tabTitle;
public static String sourceTab_defaultButton;
+ public static String sourceTab_AttributeLabel_SourceLocatorMemento;
+ public static String sourceTab_AttributeLabel_SourceLocatorID;
+
public static String addSourceLocation_title;
public static String addSourceLocation_description;
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceLookupUIMessages.properties b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceLookupUIMessages.properties
index 5c56dd2f3..3158c2f3d 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceLookupUIMessages.properties
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceLookupUIMessages.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2003, 2013 IBM Corporation and others.
+# Copyright (c) 2003, 2017 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
@@ -8,6 +8,7 @@
# Contributors:
# IBM Corporation - initial API and implementation
# QNX Software Systems - Mikhail Khodjaiants - Bug 114664
+# Axel Richard (Obeo) - Bug 41353 - Launch configurations prototypes
###############################################################################
# Source search launch configuration tab/errors/dialogs
@@ -21,6 +22,9 @@ sourceTab_addButton = &Add...
sourceTab_tabTitle = Source
sourceTab_defaultButton = Restore Defa&ult
+sourceTab_AttributeLabel_SourceLocatorMemento=Source locator memento
+sourceTab_AttributeLabel_SourceLocatorID=Source locator ID
+
addSourceLocation_title = Add Source
addSourceLocation_description = Add a container to the source lookup path

Back to the top