mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +02:00
[270671] - support for post launch actions
This commit is contained in:
parent
a99fb95237
commit
32896c6f39
3 changed files with 176 additions and 45 deletions
|
@ -39,12 +39,52 @@ public class MultiLaunchConfigurationDelegate extends LaunchConfigurationDelegat
|
||||||
public static String MULTI_LAUNCH_CONSTANTS_PREFIX = "org.eclipse.cdt.launch.launchGroup"; //$NON-NLS-1$
|
public static String MULTI_LAUNCH_CONSTANTS_PREFIX = "org.eclipse.cdt.launch.launchGroup"; //$NON-NLS-1$
|
||||||
|
|
||||||
public static class LaunchElement {
|
public static class LaunchElement {
|
||||||
public int index;
|
public static final String POST_LAUNCH_WAIT_FOR_TERM = "wait";
|
||||||
public boolean enabled;
|
public static final String POST_LAUNCH_CONTINUE = "";
|
||||||
public String mode;
|
public static final String POST_LAUNCH_DELAY_3_SEC = "delay 3s";
|
||||||
public String action;
|
public static final String POST_LAUNCH_DELAY_PREFIX = "delay";
|
||||||
public String name;
|
private int index;
|
||||||
public ILaunchConfiguration data;
|
private boolean enabled;
|
||||||
|
private String mode;
|
||||||
|
private String action;
|
||||||
|
private String name;
|
||||||
|
private ILaunchConfiguration data;
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
public void setAction(String action) {
|
||||||
|
this.action = action;
|
||||||
|
}
|
||||||
|
public String getAction() {
|
||||||
|
return action;
|
||||||
|
}
|
||||||
|
public void setMode(String mode) {
|
||||||
|
this.mode = mode;
|
||||||
|
}
|
||||||
|
public String getMode() {
|
||||||
|
return mode;
|
||||||
|
}
|
||||||
|
public void setEnabled(boolean enabled) {
|
||||||
|
this.enabled = enabled;
|
||||||
|
}
|
||||||
|
public boolean isEnabled() {
|
||||||
|
return enabled;
|
||||||
|
}
|
||||||
|
public void setIndex(int index) {
|
||||||
|
this.index = index;
|
||||||
|
}
|
||||||
|
public int getIndex() {
|
||||||
|
return index;
|
||||||
|
}
|
||||||
|
public void setData(ILaunchConfiguration data) {
|
||||||
|
this.data = data;
|
||||||
|
}
|
||||||
|
public ILaunchConfiguration getData() {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public MultiLaunchConfigurationDelegate() {
|
public MultiLaunchConfigurationDelegate() {
|
||||||
|
@ -84,7 +124,7 @@ public class MultiLaunchConfigurationDelegate extends LaunchConfigurationDelegat
|
||||||
private boolean isChild(ILaunch launch2, ArrayList<LaunchElement> input) {
|
private boolean isChild(ILaunch launch2, ArrayList<LaunchElement> input) {
|
||||||
for (Iterator<LaunchElement> iterator = input.iterator(); iterator.hasNext();) {
|
for (Iterator<LaunchElement> iterator = input.iterator(); iterator.hasNext();) {
|
||||||
LaunchElement le = iterator.next();
|
LaunchElement le = iterator.next();
|
||||||
if (le.name.equals(launch2.getLaunchConfiguration().getName())) { return true; }
|
if (le.getName().equals(launch2.getLaunchConfiguration().getName())) { return true; }
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -123,15 +163,15 @@ public class MultiLaunchConfigurationDelegate extends LaunchConfigurationDelegat
|
||||||
|
|
||||||
for (Iterator<LaunchElement> iterator = input.iterator(); iterator.hasNext();) {
|
for (Iterator<LaunchElement> iterator = input.iterator(); iterator.hasNext();) {
|
||||||
LaunchElement le = iterator.next();
|
LaunchElement le = iterator.next();
|
||||||
if (le.enabled == false) continue;
|
if (le.isEnabled() == false) continue;
|
||||||
// find launch
|
// find launch
|
||||||
final ILaunchConfiguration conf = findLaunch(le.name);
|
final ILaunchConfiguration conf = findLaunch(le.getName());
|
||||||
// not found, skip (error?)
|
// not found, skip (error?)
|
||||||
if (conf == null) continue;
|
if (conf == null) continue;
|
||||||
// determine mode for each launch
|
// determine mode for each launch
|
||||||
final String localMode;
|
final String localMode;
|
||||||
if (le.mode != null && !le.mode.equals(DEFAULT_MODE)) {
|
if (le.getMode() != null && !le.getMode().equals(DEFAULT_MODE)) {
|
||||||
localMode = le.mode;
|
localMode = le.getMode();
|
||||||
} else {
|
} else {
|
||||||
localMode = mode;
|
localMode = mode;
|
||||||
}
|
}
|
||||||
|
@ -151,7 +191,8 @@ public class MultiLaunchConfigurationDelegate extends LaunchConfigurationDelegat
|
||||||
try {
|
try {
|
||||||
if (configuration.getName().equals(conf.getName())) throw new StackOverflowError();
|
if (configuration.getName().equals(conf.getName())) throw new StackOverflowError();
|
||||||
// LAUNCH child here
|
// LAUNCH child here
|
||||||
DebugUIPlugin.buildAndLaunch(conf, localMode, new SubProgressMonitor(monitor, 1000 / input.size()));
|
ILaunch subLaunch = DebugUIPlugin.buildAndLaunch(conf, localMode, new SubProgressMonitor(monitor, 1000 / input.size()));
|
||||||
|
postLaunchAction(subLaunch, le.getAction(), monitor);
|
||||||
|
|
||||||
} catch (StackOverflowError e) {
|
} catch (StackOverflowError e) {
|
||||||
PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
|
PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
|
||||||
|
@ -174,6 +215,43 @@ public class MultiLaunchConfigurationDelegate extends LaunchConfigurationDelegat
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void postLaunchAction(ILaunch subLaunch, String action, IProgressMonitor monitor) {
|
||||||
|
if (action==null) return;
|
||||||
|
if (LaunchElement.POST_LAUNCH_WAIT_FOR_TERM.equals(action)) {
|
||||||
|
monitor.subTask("Waiting for termination of "+subLaunch.getLaunchConfiguration().getName());
|
||||||
|
while (!subLaunch.isTerminated() && !monitor.isCanceled()) {
|
||||||
|
try {
|
||||||
|
Thread.sleep(1000);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
monitor.subTask("");
|
||||||
|
} else
|
||||||
|
if (action.startsWith(LaunchElement.POST_LAUNCH_DELAY_PREFIX)) {
|
||||||
|
String num = action.substring(LaunchElement.POST_LAUNCH_DELAY_PREFIX.length()).trim();
|
||||||
|
int k = 1000;
|
||||||
|
if (num.endsWith("ms")) {
|
||||||
|
num = num.substring(0,num.length()-2);
|
||||||
|
k = 1;
|
||||||
|
} else if (num.endsWith("s")) {
|
||||||
|
num = num.substring(0,num.length()-1);
|
||||||
|
}
|
||||||
|
int parseInt;
|
||||||
|
try {
|
||||||
|
parseInt = Integer.parseInt(num);
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
parseInt = 3;
|
||||||
|
k = 1000;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
Thread.sleep(parseInt * k);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
// ok
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected void buildProjects(IProject[] projects, IProgressMonitor monitor) throws CoreException {
|
protected void buildProjects(IProject[] projects, IProgressMonitor monitor) throws CoreException {
|
||||||
// do nothing, project can be rebuild for each launch individually
|
// do nothing, project can be rebuild for each launch individually
|
||||||
|
|
||||||
|
@ -211,15 +289,15 @@ public class MultiLaunchConfigurationDelegate extends LaunchConfigurationDelegat
|
||||||
String name = prop.substring(k + 1);
|
String name = prop.substring(k + 1);
|
||||||
if (name.equals(NAME_PROP)) {
|
if (name.equals(NAME_PROP)) {
|
||||||
MultiLaunchConfigurationDelegate.LaunchElement el = new MultiLaunchConfigurationDelegate.LaunchElement();
|
MultiLaunchConfigurationDelegate.LaunchElement el = new MultiLaunchConfigurationDelegate.LaunchElement();
|
||||||
el.index = index;
|
el.setIndex(index);
|
||||||
el.name = (String) attrs.get(attr);
|
el.setName((String) attrs.get(attr));
|
||||||
el.action = (String) attrs.get(getProp(index, ACTION_PROP));
|
el.setAction((String) attrs.get(getProp(index, ACTION_PROP)));
|
||||||
el.mode = (String) attrs.get(getProp(index, MODE_PROP));
|
el.setMode((String) attrs.get(getProp(index, MODE_PROP)));
|
||||||
el.enabled = "true".equals(attrs.get(getProp(index, ENABLED_PROP))); //$NON-NLS-1$
|
el.setEnabled("true".equals(attrs.get(getProp(index, ENABLED_PROP)))); //$NON-NLS-1$
|
||||||
try {
|
try {
|
||||||
el.data = findLaunch(el.name);
|
el.setData(findLaunch(el.getName()));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
el.data = null;
|
el.setData(null);
|
||||||
}
|
}
|
||||||
while (index >= input.size()) {
|
while (index >= input.size()) {
|
||||||
input.add(null);
|
input.add(null);
|
||||||
|
@ -244,10 +322,10 @@ public class MultiLaunchConfigurationDelegate extends LaunchConfigurationDelegat
|
||||||
for (Iterator<LaunchElement> iterator = input.iterator(); iterator.hasNext();) {
|
for (Iterator<LaunchElement> iterator = input.iterator(); iterator.hasNext();) {
|
||||||
MultiLaunchConfigurationDelegate.LaunchElement el = iterator.next();
|
MultiLaunchConfigurationDelegate.LaunchElement el = iterator.next();
|
||||||
if (el == null) continue;
|
if (el == null) continue;
|
||||||
configuration.setAttribute(MultiLaunchConfigurationDelegate.getProp(i, NAME_PROP), el.name);
|
configuration.setAttribute(MultiLaunchConfigurationDelegate.getProp(i, NAME_PROP), el.getName());
|
||||||
configuration.setAttribute(MultiLaunchConfigurationDelegate.getProp(i, ACTION_PROP), el.action);
|
configuration.setAttribute(MultiLaunchConfigurationDelegate.getProp(i, ACTION_PROP), el.getAction());
|
||||||
configuration.setAttribute(MultiLaunchConfigurationDelegate.getProp(i, MODE_PROP), el.mode);
|
configuration.setAttribute(MultiLaunchConfigurationDelegate.getProp(i, MODE_PROP), el.getMode());
|
||||||
configuration.setAttribute(MultiLaunchConfigurationDelegate.getProp(i, ENABLED_PROP), el.enabled + ""); //$NON-NLS-1$
|
configuration.setAttribute(MultiLaunchConfigurationDelegate.getProp(i, ENABLED_PROP), el.isEnabled() + ""); //$NON-NLS-1$
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
package org.eclipse.cdt.launch.internal.ui;
|
package org.eclipse.cdt.launch.internal.ui;
|
||||||
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
import org.eclipse.cdt.launch.internal.MultiLaunchConfigurationDelegate;
|
import org.eclipse.cdt.launch.internal.MultiLaunchConfigurationDelegate;
|
||||||
|
import org.eclipse.cdt.launch.internal.MultiLaunchConfigurationDelegate.LaunchElement;
|
||||||
import org.eclipse.cdt.launch.ui.ComboControlledStackComposite;
|
import org.eclipse.cdt.launch.ui.ComboControlledStackComposite;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.debug.core.DebugPlugin;
|
import org.eclipse.debug.core.DebugPlugin;
|
||||||
|
@ -29,10 +31,12 @@ import org.eclipse.swt.events.SelectionAdapter;
|
||||||
import org.eclipse.swt.events.SelectionEvent;
|
import org.eclipse.swt.events.SelectionEvent;
|
||||||
import org.eclipse.swt.graphics.Rectangle;
|
import org.eclipse.swt.graphics.Rectangle;
|
||||||
import org.eclipse.swt.layout.GridData;
|
import org.eclipse.swt.layout.GridData;
|
||||||
|
import org.eclipse.swt.layout.GridLayout;
|
||||||
import org.eclipse.swt.widgets.Button;
|
import org.eclipse.swt.widgets.Button;
|
||||||
import org.eclipse.swt.widgets.Combo;
|
import org.eclipse.swt.widgets.Combo;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
import org.eclipse.swt.widgets.Control;
|
import org.eclipse.swt.widgets.Control;
|
||||||
|
import org.eclipse.swt.widgets.Label;
|
||||||
import org.eclipse.swt.widgets.Shell;
|
import org.eclipse.swt.widgets.Shell;
|
||||||
import org.eclipse.ui.dialogs.PatternFilter;
|
import org.eclipse.ui.dialogs.PatternFilter;
|
||||||
|
|
||||||
|
@ -46,6 +50,7 @@ public class MultiLaunchConfigurationSelectionDialog extends TitleAreaDialog imp
|
||||||
private ISelection fSelection;
|
private ISelection fSelection;
|
||||||
private ILaunchGroup[] launchGroups;
|
private ILaunchGroup[] launchGroups;
|
||||||
private String mode;
|
private String mode;
|
||||||
|
private String action;
|
||||||
private boolean isDefaultMode;
|
private boolean isDefaultMode;
|
||||||
private ViewerFilter emptyTypeFilter;
|
private ViewerFilter emptyTypeFilter;
|
||||||
private IStructuredSelection fInitialSelection;
|
private IStructuredSelection fInitialSelection;
|
||||||
|
@ -160,9 +165,30 @@ public class MultiLaunchConfigurationSelectionDialog extends TitleAreaDialog imp
|
||||||
isDefaultMode = ((Button) e.widget).getSelection();
|
isDefaultMode = ((Button) e.widget).getSelection();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
checkBox.setSelection(isDefaultMode);
|
||||||
|
|
||||||
|
createPostLaunchControl(comp);
|
||||||
return comp;
|
return comp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void createPostLaunchControl(Composite parent) {
|
||||||
|
Composite comp = new Composite(parent, SWT.NONE);
|
||||||
|
comp.setLayout(new GridLayout(2, false));
|
||||||
|
comp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||||
|
Label label = new Label(comp, SWT.NONE);
|
||||||
|
label.setText("Post launch action:");
|
||||||
|
Combo combo = new Combo(comp, SWT.READ_ONLY);
|
||||||
|
combo.add(LaunchElement.POST_LAUNCH_CONTINUE);
|
||||||
|
combo.add(LaunchElement.POST_LAUNCH_WAIT_FOR_TERM);
|
||||||
|
combo.add(LaunchElement.POST_LAUNCH_DELAY_3_SEC);
|
||||||
|
combo.addSelectionListener(new SelectionAdapter() {
|
||||||
|
public void widgetSelected(SelectionEvent e) {
|
||||||
|
action = ((Combo) e.widget).getText();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
combo.setText(action==null?LaunchElement.POST_LAUNCH_CONTINUE:action);
|
||||||
|
}
|
||||||
|
|
||||||
public ILaunchConfiguration getSelectedLaunchConfiguration() {
|
public ILaunchConfiguration getSelectedLaunchConfiguration() {
|
||||||
if (fSelection != null && !fSelection.isEmpty()) {
|
if (fSelection != null && !fSelection.isEmpty()) {
|
||||||
Object firstElement = ((IStructuredSelection) fSelection).getFirstElement();
|
Object firstElement = ((IStructuredSelection) fSelection).getFirstElement();
|
||||||
|
@ -178,6 +204,10 @@ public class MultiLaunchConfigurationSelectionDialog extends TitleAreaDialog imp
|
||||||
else
|
else
|
||||||
return mode;
|
return mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getAction(){
|
||||||
|
return action;
|
||||||
|
}
|
||||||
|
|
||||||
public static MultiLaunchConfigurationSelectionDialog createDialog(Shell shell, String title, String groupId) {
|
public static MultiLaunchConfigurationSelectionDialog createDialog(Shell shell, String title, String groupId) {
|
||||||
return new MultiLaunchConfigurationSelectionDialog(shell, title, groupId);
|
return new MultiLaunchConfigurationSelectionDialog(shell, title, groupId);
|
||||||
|
@ -200,8 +230,10 @@ public class MultiLaunchConfigurationSelectionDialog extends TitleAreaDialog imp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setInitialSelection(ILaunchConfiguration data) {
|
public void setInitialSelection(LaunchElement el) {
|
||||||
fInitialSelection = new StructuredSelection(data);
|
action = el.getAction();
|
||||||
|
isDefaultMode = el.getMode().equals(MultiLaunchConfigurationDelegate.DEFAULT_MODE);
|
||||||
|
fInitialSelection = new StructuredSelection(el.getData());
|
||||||
fSelection = fInitialSelection;
|
fSelection = fInitialSelection;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
import org.eclipse.cdt.launch.internal.MultiLaunchConfigurationDelegate;
|
import org.eclipse.cdt.launch.internal.MultiLaunchConfigurationDelegate;
|
||||||
|
import org.eclipse.cdt.launch.internal.MultiLaunchConfigurationDelegate.LaunchElement;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.debug.core.ILaunchConfiguration;
|
import org.eclipse.debug.core.ILaunchConfiguration;
|
||||||
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
|
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
|
||||||
|
@ -14,7 +15,9 @@ import org.eclipse.debug.ui.ILaunchConfigurationDialog;
|
||||||
import org.eclipse.debug.ui.ILaunchConfigurationTab;
|
import org.eclipse.debug.ui.ILaunchConfigurationTab;
|
||||||
import org.eclipse.jface.dialogs.Dialog;
|
import org.eclipse.jface.dialogs.Dialog;
|
||||||
import org.eclipse.jface.viewers.BaseLabelProvider;
|
import org.eclipse.jface.viewers.BaseLabelProvider;
|
||||||
|
import org.eclipse.jface.viewers.CheckStateChangedEvent;
|
||||||
import org.eclipse.jface.viewers.CheckboxTreeViewer;
|
import org.eclipse.jface.viewers.CheckboxTreeViewer;
|
||||||
|
import org.eclipse.jface.viewers.ICheckStateListener;
|
||||||
import org.eclipse.jface.viewers.ISelectionChangedListener;
|
import org.eclipse.jface.viewers.ISelectionChangedListener;
|
||||||
import org.eclipse.jface.viewers.IStructuredContentProvider;
|
import org.eclipse.jface.viewers.IStructuredContentProvider;
|
||||||
import org.eclipse.jface.viewers.ITableLabelProvider;
|
import org.eclipse.jface.viewers.ITableLabelProvider;
|
||||||
|
@ -23,6 +26,7 @@ import org.eclipse.jface.viewers.SelectionChangedEvent;
|
||||||
import org.eclipse.jface.viewers.StructuredSelection;
|
import org.eclipse.jface.viewers.StructuredSelection;
|
||||||
import org.eclipse.jface.viewers.Viewer;
|
import org.eclipse.jface.viewers.Viewer;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
|
import org.eclipse.swt.events.SelectionAdapter;
|
||||||
import org.eclipse.swt.events.SelectionEvent;
|
import org.eclipse.swt.events.SelectionEvent;
|
||||||
import org.eclipse.swt.events.SelectionListener;
|
import org.eclipse.swt.events.SelectionListener;
|
||||||
import org.eclipse.swt.graphics.Image;
|
import org.eclipse.swt.graphics.Image;
|
||||||
|
@ -41,7 +45,7 @@ import org.eclipse.ui.PlatformUI;
|
||||||
*/
|
*/
|
||||||
public class MultiLaunchConfigurationTabGroup extends AbstractLaunchConfigurationTabGroup {
|
public class MultiLaunchConfigurationTabGroup extends AbstractLaunchConfigurationTabGroup {
|
||||||
static class ContentProvider implements IStructuredContentProvider, ITreeContentProvider {
|
static class ContentProvider implements IStructuredContentProvider, ITreeContentProvider {
|
||||||
protected ArrayList input;
|
protected ArrayList<LaunchElement> input;
|
||||||
|
|
||||||
public Object[] getElements(Object inputElement) {
|
public Object[] getElements(Object inputElement) {
|
||||||
return getChildren(inputElement);
|
return getChildren(inputElement);
|
||||||
|
@ -81,13 +85,13 @@ public class MultiLaunchConfigurationTabGroup extends AbstractLaunchConfiguratio
|
||||||
return null;
|
return null;
|
||||||
if (columnIndex == 0) {
|
if (columnIndex == 0) {
|
||||||
MultiLaunchConfigurationDelegate.LaunchElement el = (MultiLaunchConfigurationDelegate.LaunchElement) element;
|
MultiLaunchConfigurationDelegate.LaunchElement el = (MultiLaunchConfigurationDelegate.LaunchElement) element;
|
||||||
if (el.data == null) {
|
if (el.getData() == null) {
|
||||||
Image errorImage = PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_ERROR_TSK);
|
Image errorImage = PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_ERROR_TSK);
|
||||||
return errorImage;
|
return errorImage;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String key = el.data.getType().getIdentifier();
|
String key = el.getData().getType().getIdentifier();
|
||||||
return DebugPluginImages.getImage(key);
|
return DebugPluginImages.getImage(key);
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
Image errorImage = PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_ERROR_TSK);
|
Image errorImage = PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_ERROR_TSK);
|
||||||
|
@ -103,14 +107,14 @@ public class MultiLaunchConfigurationTabGroup extends AbstractLaunchConfiguratio
|
||||||
MultiLaunchConfigurationDelegate.LaunchElement el = (MultiLaunchConfigurationDelegate.LaunchElement) element;
|
MultiLaunchConfigurationDelegate.LaunchElement el = (MultiLaunchConfigurationDelegate.LaunchElement) element;
|
||||||
if (columnIndex == 0)
|
if (columnIndex == 0)
|
||||||
try {
|
try {
|
||||||
return (el.data != null) ? el.data.getType().getName() + "::" + el.name : el.name; //$NON-NLS-1$
|
return (el.getData() != null) ? el.getData().getType().getName() + "::" + el.getName() : el.getName(); //$NON-NLS-1$
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
return el.name;
|
return el.getName();
|
||||||
}
|
}
|
||||||
if (columnIndex == 1)
|
if (columnIndex == 1)
|
||||||
return el.mode;
|
return el.getMode();
|
||||||
if (columnIndex == 2)
|
if (columnIndex == 2)
|
||||||
return el.action;
|
return el.getAction();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -210,6 +214,9 @@ public class MultiLaunchConfigurationTabGroup extends AbstractLaunchConfiguratio
|
||||||
TreeColumn col2 = new TreeColumn(table, SWT.NONE);
|
TreeColumn col2 = new TreeColumn(table, SWT.NONE);
|
||||||
col2.setText(LaunchMessages.getString("MultiLaunchConfigurationTabGroup.7")); //$NON-NLS-1$
|
col2.setText(LaunchMessages.getString("MultiLaunchConfigurationTabGroup.7")); //$NON-NLS-1$
|
||||||
col2.setWidth(100);
|
col2.setWidth(100);
|
||||||
|
TreeColumn col3 = new TreeColumn(table, SWT.NONE);
|
||||||
|
col3.setText("Action");
|
||||||
|
col3.setWidth(100);
|
||||||
|
|
||||||
treeViewer.setInput(input);
|
treeViewer.setInput(input);
|
||||||
final ButtonComposite buts = new ButtonComposite(comp, SWT.NONE) {
|
final ButtonComposite buts = new ButtonComposite(comp, SWT.NONE) {
|
||||||
|
@ -223,13 +230,13 @@ public class MultiLaunchConfigurationTabGroup extends AbstractLaunchConfiguratio
|
||||||
if (conf==null) return;
|
if (conf==null) return;
|
||||||
MultiLaunchConfigurationDelegate.LaunchElement el = new MultiLaunchConfigurationDelegate.LaunchElement();
|
MultiLaunchConfigurationDelegate.LaunchElement el = new MultiLaunchConfigurationDelegate.LaunchElement();
|
||||||
input.add(el);
|
input.add(el);
|
||||||
el.index = input.size() - 1;
|
el.setIndex(input.size() - 1);
|
||||||
el.enabled = true;
|
el.setEnabled(true);
|
||||||
el.name = conf.getName();
|
el.setName(conf.getName());
|
||||||
el.data = conf;
|
el.setData(conf);
|
||||||
el.mode = dialog.getMode();
|
el.setMode(dialog.getMode());
|
||||||
treeViewer.refresh(true);
|
treeViewer.refresh(true);
|
||||||
treeViewer.setChecked(el, el.enabled);
|
treeViewer.setChecked(el, el.isEnabled());
|
||||||
updateWidgetEnablement();
|
updateWidgetEnablement();
|
||||||
updateLaunchConfigurationDialog();
|
updateLaunchConfigurationDialog();
|
||||||
}
|
}
|
||||||
|
@ -251,17 +258,17 @@ public class MultiLaunchConfigurationTabGroup extends AbstractLaunchConfiguratio
|
||||||
.get(index);
|
.get(index);
|
||||||
MultiLaunchConfigurationSelectionDialog dialog = MultiLaunchConfigurationSelectionDialog.createDialog(treeViewer
|
MultiLaunchConfigurationSelectionDialog dialog = MultiLaunchConfigurationSelectionDialog.createDialog(treeViewer
|
||||||
.getControl().getShell(), LaunchMessages.getString("MultiLaunchConfigurationTabGroup.9"), //$NON-NLS-1$
|
.getControl().getShell(), LaunchMessages.getString("MultiLaunchConfigurationTabGroup.9"), //$NON-NLS-1$
|
||||||
el.mode
|
el.getMode()
|
||||||
);
|
);
|
||||||
dialog.setInitialSelection(el.data);
|
dialog.setInitialSelection(el);
|
||||||
if (dialog.open() == Dialog.OK) {
|
if (dialog.open() == Dialog.OK) {
|
||||||
ILaunchConfiguration conf = dialog.getSelectedLaunchConfiguration();
|
ILaunchConfiguration conf = dialog.getSelectedLaunchConfiguration();
|
||||||
if (conf==null) return;
|
if (conf==null) return;
|
||||||
el.name = conf.getName();
|
el.setName(conf.getName());
|
||||||
el.data = conf;
|
el.setData(conf);
|
||||||
el.mode = dialog.getMode();
|
el.setMode(dialog.getMode());
|
||||||
|
el.setAction(dialog.getAction());
|
||||||
treeViewer.refresh(true);
|
treeViewer.refresh(true);
|
||||||
treeViewer.setChecked(el, el.enabled);
|
|
||||||
updateWidgetEnablement();
|
updateWidgetEnablement();
|
||||||
updateLaunchConfigurationDialog();
|
updateLaunchConfigurationDialog();
|
||||||
}
|
}
|
||||||
|
@ -329,6 +336,20 @@ public class MultiLaunchConfigurationTabGroup extends AbstractLaunchConfiguratio
|
||||||
buts.updateWidgetEnablement();
|
buts.updateWidgetEnablement();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
treeViewer.getTree().addSelectionListener(new SelectionAdapter(){
|
||||||
|
@Override
|
||||||
|
public void widgetDefaultSelected(SelectionEvent e) {
|
||||||
|
buts.editPressed();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
treeViewer.addCheckStateListener(new ICheckStateListener(){
|
||||||
|
public void checkStateChanged(CheckStateChangedEvent event) {
|
||||||
|
((LaunchElement)event.getElement()).setEnabled(event.getChecked());
|
||||||
|
updateLaunchConfigurationDialog();
|
||||||
|
}
|
||||||
|
});
|
||||||
buts.updateWidgetEnablement();
|
buts.updateWidgetEnablement();
|
||||||
GridData layoutData = new GridData(GridData.GRAB_VERTICAL);
|
GridData layoutData = new GridData(GridData.GRAB_VERTICAL);
|
||||||
layoutData.verticalAlignment = SWT.BEGINNING;
|
layoutData.verticalAlignment = SWT.BEGINNING;
|
||||||
|
@ -345,7 +366,7 @@ public class MultiLaunchConfigurationTabGroup extends AbstractLaunchConfiguratio
|
||||||
for (Iterator iterator = input.iterator(); iterator.hasNext();) {
|
for (Iterator iterator = input.iterator(); iterator.hasNext();) {
|
||||||
MultiLaunchConfigurationDelegate.LaunchElement el = (MultiLaunchConfigurationDelegate.LaunchElement) iterator
|
MultiLaunchConfigurationDelegate.LaunchElement el = (MultiLaunchConfigurationDelegate.LaunchElement) iterator
|
||||||
.next();
|
.next();
|
||||||
treeViewer.setChecked(el, el.enabled);
|
treeViewer.setChecked(el, el.isEnabled());
|
||||||
}
|
}
|
||||||
treeViewer.refresh(true);
|
treeViewer.refresh(true);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue