Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoreutarass2008-05-19 18:38:52 +0000
committereutarass2008-05-19 18:38:52 +0000
commita14d5f1565f99ed710c8c65c24f2408519fe14eb (patch)
tree39adf235616742c9ab8378996a9f92200d3791b3 /plugins/org.eclipse.tm.tcf.debug.ui
parentc77daaffd45e5ddf9d64f728b62d32c7734e5576 (diff)
downloadorg.eclipse.tcf-a14d5f1565f99ed710c8c65c24f2408519fe14eb.tar.gz
org.eclipse.tcf-a14d5f1565f99ed710c8c65c24f2408519fe14eb.tar.xz
org.eclipse.tcf-a14d5f1565f99ed710c8c65c24f2408519fe14eb.zip
Added UI that allows manual configuration of remote TCF peers
Diffstat (limited to 'plugins/org.eclipse.tm.tcf.debug.ui')
-rw-r--r--plugins/org.eclipse.tm.tcf.debug.ui/icons/attribute.gifbin0 -> 207 bytes
-rw-r--r--plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/launch/PeerPropsDialog.java363
-rw-r--r--plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/launch/TCFMainTab.java151
-rw-r--r--plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/launch/TestErrorsDialog.java8
4 files changed, 506 insertions, 16 deletions
diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/icons/attribute.gif b/plugins/org.eclipse.tm.tcf.debug.ui/icons/attribute.gif
new file mode 100644
index 000000000..0f0769269
--- /dev/null
+++ b/plugins/org.eclipse.tm.tcf.debug.ui/icons/attribute.gif
Binary files differ
diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/launch/PeerPropsDialog.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/launch/PeerPropsDialog.java
new file mode 100644
index 000000000..8d5d8d60f
--- /dev/null
+++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/launch/PeerPropsDialog.java
@@ -0,0 +1,363 @@
+package org.eclipse.tm.internal.tcf.debug.ui.launch;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Map;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.jface.viewers.ICellModifier;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.TextCellEditor;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerComparator;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Item;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.tm.internal.tcf.debug.ui.ImageCache;
+import org.eclipse.tm.tcf.protocol.IPeer;
+
+class PeerPropsDialog extends Dialog {
+
+ private static final int
+ SIZING_TABLE_WIDTH = 400,
+ SIZING_TABLE_HEIGHT = 200;
+
+ private static final String[] column_names = { "Name", "Value" };
+
+ /*
+ private static final String[] attr_names = {
+ IPeer.ATTR_TRANSPORT_NAME,
+ IPeer.ATTR_IP_HOST,
+ IPeer.ATTR_IP_PORT,
+ IPeer.ATTR_IP_ALIASES,
+ IPeer.ATTR_IP_ADDRESSES,
+ IPeer.ATTR_OS_NAME,
+ IPeer.ATTR_PROXY,
+ };
+ */
+
+ private final Image image;
+ private final Map<String,String> attrs;
+ private final ArrayList<Attribute> attr_list;
+ private final boolean create_new;
+ private final boolean enable_editing;
+
+ private Text id_text;
+ private Text name_text;
+ private Table attr_table;
+ private TableViewer table_viewer;
+ private Image attr_image;
+
+ private class Attribute {
+ String name;
+ String value;
+ }
+
+ private class AttributeLabelProvider extends LabelProvider implements ITableLabelProvider {
+
+ public Image getColumnImage(Object element, int column) {
+ if (column == 0) return attr_image;
+ return null;
+ }
+
+ public String getColumnText(Object element, int column) {
+ Attribute a = (Attribute)element;
+ return column == 0 ? a.name : a.value;
+ }
+
+ public String getText(Object element) {
+ TableColumn column = attr_table.getSortColumn();
+ if (column == null) return "";
+ return getColumnText(element, attr_table.indexOf(column));
+ }
+ }
+
+ protected PeerPropsDialog(Shell parent, Image image, Map<String,String> attrs, boolean enable_editing) {
+ super(parent);
+ this.image = image;
+ this.attrs = attrs;
+ create_new = attrs.isEmpty();
+ if (create_new) {
+ attrs.put(IPeer.ATTR_ID, "USR:" + System.currentTimeMillis());
+ }
+ this.enable_editing = enable_editing;
+ attr_list = new ArrayList<Attribute>();
+ }
+
+ @Override
+ protected void configureShell(Shell shell) {
+ super.configureShell(shell);
+ shell.setText("TCF Peer Properties");
+ shell.setImage(image);
+ }
+
+ @Override
+ protected void createButtonsForButtonBar(Composite parent) {
+ createButton(parent, IDialogConstants.OK_ID, "&OK", true);
+ }
+
+ @Override
+ protected Control createDialogArea(Composite parent) {
+ Composite composite = (Composite)super.createDialogArea(parent);
+
+ createTextFields(composite);
+ createAttrTable(composite);
+
+ composite.setSize(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
+ return composite;
+ }
+
+ private void createTextFields(Composite parent) {
+ Font font = parent.getFont();
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout(2, false);
+ composite.setFont(font);
+ composite.setLayout(layout);
+ composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ Label id_label = new Label(composite, SWT.WRAP);
+ id_label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
+ id_label.setFont(font);
+ id_label.setText("Peer &ID:");
+
+ id_text = new Text(composite, SWT.SINGLE | SWT.BORDER);
+ id_text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ id_text.setFont(font);
+ id_text.setEditable(false);
+
+ Label name_label = new Label(composite, SWT.WRAP);
+ name_label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
+ name_label.setFont(font);
+ name_label.setText("Peer &name:");
+
+ name_text = new Text(composite, SWT.SINGLE | SWT.BORDER);
+ name_text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ name_text.setFont(font);
+ name_text.setEditable(create_new || enable_editing);
+ }
+
+ private void createAttrTable(Composite parent) {
+ Font font = parent.getFont();
+ Label props_label = new Label(parent, SWT.WRAP);
+ props_label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ props_label.setFont(font);
+ props_label.setText("Peer &properties:");
+
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout(2, false);
+ composite.setFont(font);
+ composite.setLayout(layout);
+ composite.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true, 2, 1));
+
+ attr_table = new Table(composite, SWT.SINGLE | SWT.BORDER |
+ SWT.H_SCROLL | SWT.V_SCROLL |
+ SWT.FULL_SELECTION | SWT.HIDE_SELECTION);
+ attr_table.setFont(font);
+ GridData data = new GridData(GridData.FILL_BOTH);
+ data.widthHint = SIZING_TABLE_WIDTH;
+ data.heightHint = SIZING_TABLE_HEIGHT;
+ attr_table.setLayoutData(data);
+
+ for (int i = 0; i < column_names.length; i++) {
+ final TableColumn column = new TableColumn(attr_table, SWT.LEAD, i);
+ column.setMoveable(false);
+ column.setText(column_names[i]);
+ column.setWidth(SIZING_TABLE_WIDTH / column_names.length);
+ column.addSelectionListener(new SelectionAdapter() {
+
+ public void widgetSelected(SelectionEvent e) {
+ if (column == attr_table.getSortColumn()) {
+ switch (attr_table.getSortDirection()) {
+ case SWT.NONE:
+ attr_table.setSortDirection(SWT.DOWN);
+ break;
+ case SWT.DOWN:
+ attr_table.setSortDirection(SWT.UP);
+ break;
+ case SWT.UP:
+ attr_table.setSortDirection(SWT.NONE);
+ break;
+ }
+ }
+ else {
+ attr_table.setSortColumn(column);
+ attr_table.setSortDirection(SWT.DOWN);
+ }
+ table_viewer.refresh();
+ }
+ });
+ }
+ attr_table.setHeaderVisible(true);
+ attr_table.setLinesVisible(true);
+
+ attr_image = ImageCache.getImageDescriptor("icons/attribute.gif").createImage();
+ attr_table.addDisposeListener(new DisposeListener() {
+ public void widgetDisposed(DisposeEvent e) {
+ attr_image.dispose();
+ attr_image = null;
+ }
+ });
+
+ table_viewer = new TableViewer(attr_table);
+ table_viewer.setUseHashlookup(true);
+ table_viewer.setColumnProperties(column_names);
+
+ CellEditor[] editors = new CellEditor[column_names.length];
+ for (int i = 0; i < column_names.length; i++) {
+ TextCellEditor editor = new TextCellEditor(attr_table);
+ ((Text)editor.getControl()).setTextLimit(250);
+ editors[i] = editor;
+ }
+ table_viewer.setCellEditors(editors);
+
+ table_viewer.setCellModifier(new ICellModifier() {
+
+ public boolean canModify(Object element, String property) {
+ return enable_editing;
+ }
+
+ public Object getValue(Object element, String property) {
+ if (element instanceof Item) element = ((Item)element).getData();
+ Attribute a = (Attribute)element;
+ return property.equals(column_names[0]) ? a.name : a.value;
+ }
+
+ public void modify(Object element, String property, Object value) {
+ if (element instanceof Item) element = ((Item)element).getData();
+ Attribute a = (Attribute)element;
+ if (property.equals(column_names[0])) {
+ a.name = (String)value;
+ }
+ else {
+ a.value = (String)value;
+ }
+ table_viewer.update(element, new String[] { property });
+ }
+ });
+
+ String[] keys = attrs.keySet().toArray(new String[attrs.size()]);
+ Arrays.sort(keys);
+ for (String key : keys) {
+ if (key.equals(IPeer.ATTR_ID)) {
+ id_text.setText(attrs.get(key));
+ }
+ else if (key.equals(IPeer.ATTR_NAME)) {
+ name_text.setText(attrs.get(key));
+ }
+ else {
+ Attribute a = new Attribute();
+ a.name = key;
+ a.value = attrs.get(key);
+ attr_list.add(a);
+ }
+ }
+
+ table_viewer.setContentProvider(new IStructuredContentProvider() {
+
+ public Object[] getElements(Object input) {
+ assert input == attr_list;
+ return attr_list.toArray();
+ }
+
+ public void dispose() {
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
+ });
+
+ table_viewer.setLabelProvider(new AttributeLabelProvider());
+ table_viewer.setInput(attr_list);
+ table_viewer.setComparator(new ViewerComparator() {
+ @Override
+ public int compare(Viewer viewer, Object e1, Object e2) {
+ switch (attr_table.getSortDirection()) {
+ case SWT.UP : return -super.compare(viewer, e1, e2);
+ case SWT.DOWN: return +super.compare(viewer, e1, e2);
+ }
+ return 0;
+ }
+ });
+
+ createTableButtons(composite);
+ }
+
+ private void createTableButtons(Composite parent) {
+ Font font = parent.getFont();
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ composite.setFont(font);
+ composite.setLayout(layout);
+ composite.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
+
+ final Button button_new = new Button(composite, SWT.PUSH);
+ button_new.setText("&Add");
+ button_new.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
+ button_new.setEnabled(enable_editing);
+ button_new.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ Attribute a = new Attribute();
+ a.name = "";
+ a.value = "";
+ attr_list.add(a);
+ table_viewer.add(a);
+ table_viewer.setSelection(new StructuredSelection(a), true);
+ attr_table.setFocus();
+ }
+ });
+
+ final Button button_remove = new Button(composite, SWT.PUSH);
+ button_remove.setText("&Remove");
+ button_remove.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
+ button_remove.setEnabled(enable_editing);
+ button_remove.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ Attribute a = (Attribute) ((IStructuredSelection)
+ table_viewer.getSelection()).getFirstElement();
+ if (a == null) return;
+ attr_list.remove(a);
+ table_viewer.remove(a);
+ }
+ });
+ }
+
+ @Override
+ protected void okPressed() {
+ if (enable_editing) {
+ String id = attrs.get(IPeer.ATTR_ID);
+ String nm = name_text.getText();
+ attrs.clear();
+ for (Attribute a : attr_list) attrs.put(a.name, a.value);
+ attrs.put(IPeer.ATTR_ID, id);
+ attrs.put(IPeer.ATTR_NAME, nm);
+ }
+ else if (create_new) {
+ attrs.put(IPeer.ATTR_NAME, name_text.getText());
+ }
+ super.okPressed();
+ }
+}
diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/launch/TCFMainTab.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/launch/TCFMainTab.java
index 07bc42b13..c6113dab6 100644
--- a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/launch/TCFMainTab.java
+++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/launch/TCFMainTab.java
@@ -24,13 +24,13 @@ import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.ui.AbstractLaunchConfigurationTab;
import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.window.Window;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CLabel;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Rectangle;
@@ -50,6 +50,7 @@ import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeColumn;
import org.eclipse.swt.widgets.TreeItem;
import org.eclipse.tm.internal.tcf.debug.launch.TCFLaunchDelegate;
+import org.eclipse.tm.internal.tcf.debug.launch.TCFUserDefPeer;
import org.eclipse.tm.internal.tcf.debug.ui.Activator;
import org.eclipse.tm.tcf.protocol.IChannel;
import org.eclipse.tm.tcf.protocol.IPeer;
@@ -67,6 +68,7 @@ public class TCFMainTab extends AbstractLaunchConfigurationTab {
private Text peer_id_text;
private Text program_text;
private Tree peer_tree;
+ private Runnable update_peer_buttons;
private final PeerInfo peer_info = new PeerInfo();
private Display display;
@@ -222,15 +224,26 @@ public class TCFMainTab extends AbstractLaunchConfigurationTab {
createVerticalSpacer(group, top_layout.numColumns);
Label peer_label = new Label(group, SWT.NONE);
- peer_label.setText("Available targets:");
+ peer_label.setText("&Available targets:");
peer_label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
peer_label.setFont(font);
loadChildren(peer_info);
+ createPeerListArea(group);
+ }
+
+ private void createPeerListArea(Composite parent) {
+ Font font = parent.getFont();
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout(2, false);
+ composite.setFont(font);
+ composite.setLayout(layout);
+ composite.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true, 2, 1));
- peer_tree = new Tree(group, SWT.VIRTUAL | SWT.BORDER | SWT.SINGLE);
- GridData gd = new GridData(GridData.FILL, GridData.FILL, true, true, 2, 1);
+ peer_tree = new Tree(composite, SWT.VIRTUAL | SWT.BORDER | SWT.SINGLE);
+ GridData gd = new GridData(GridData.FILL_BOTH);
gd.minimumHeight = 150;
+ gd.minimumWidth = 470;
peer_tree.setLayoutData(gd);
for (int i = 0; i < 5; i++) {
@@ -283,10 +296,27 @@ public class TCFMainTab extends AbstractLaunchConfigurationTab {
}
}
});
- peer_tree.addSelectionListener(new SelectionListener() {
+ peer_tree.addSelectionListener(new SelectionAdapter() {
+ @Override
public void widgetDefaultSelected(SelectionEvent e) {
+ TreeItem[] selections = peer_tree.getSelection();
+ if (selections.length == 0) return;
+ assert selections.length == 1;
+ final PeerInfo info = findPeerInfo(selections[0]);
+ if (info == null) return;
+ new PeerPropsDialog(getShell(), getImage(), info.attrs,
+ info.peer instanceof TCFUserDefPeer).open();
+ if (!(info.peer instanceof TCFUserDefPeer)) return;
+ Protocol.invokeLater(new Runnable() {
+ public void run() {
+ ((TCFUserDefPeer)info.peer).updateAttributes(info.attrs);
+ TCFUserDefPeer.savePeers();
+ }
+ });
}
+ @Override
public void widgetSelected(SelectionEvent e) {
+ update_peer_buttons.run();
TreeItem[] selections = peer_tree.getSelection();
if (selections.length > 0) {
assert selections.length == 1;
@@ -295,13 +325,84 @@ public class TCFMainTab extends AbstractLaunchConfigurationTab {
}
}
});
+
+ createPeerButtons(composite);
+ }
+
+ private void createPeerButtons(Composite parent) {
+ Font font = parent.getFont();
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ composite.setFont(font);
+ composite.setLayout(layout);
+ composite.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
+
+ final Button button_new = new Button(composite, SWT.PUSH);
+ button_new.setText("N&ew...");
+ button_new.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
+ button_new.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ final Map<String,String> attrs = new HashMap<String,String>();
+ if (new PeerPropsDialog(getShell(), getImage(), attrs, true).open() != Window.OK) return;
+ Protocol.invokeLater(new Runnable() {
+ public void run() {
+ new TCFUserDefPeer(attrs);
+ TCFUserDefPeer.savePeers();
+ }
+ });
+ }
+ });
- createVerticalSpacer(group, top_layout.numColumns);
+ final Button button_edit = new Button(composite, SWT.PUSH);
+ button_edit.setText("E&dit...");
+ button_edit.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
+ button_edit.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ TreeItem[] selection = peer_tree.getSelection();
+ if (selection.length == 0) return;
+ final PeerInfo info = findPeerInfo(selection[0]);
+ if (info == null) return;
+ if (new PeerPropsDialog(getShell(), getImage(), info.attrs,
+ info.peer instanceof TCFUserDefPeer).open() != Window.OK) return;
+ if (!(info.peer instanceof TCFUserDefPeer)) return;
+ Protocol.invokeLater(new Runnable() {
+ public void run() {
+ ((TCFUserDefPeer)info.peer).updateAttributes(info.attrs);
+ TCFUserDefPeer.savePeers();
+ }
+ });
+ }
+ });
+
+ final Button button_remove = new Button(composite, SWT.PUSH);
+ button_remove.setText("&Remove");
+ button_remove.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
+ button_remove.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ TreeItem[] selection = peer_tree.getSelection();
+ if (selection.length == 0) return;
+ final PeerInfo info = findPeerInfo(selection[0]);
+ if (info == null) return;
+ if (!(info.peer instanceof TCFUserDefPeer)) return;
+ Protocol.invokeLater(new Runnable() {
+ public void run() {
+ ((TCFUserDefPeer)info.peer).dispose();
+ TCFUserDefPeer.savePeers();
+ }
+ });
+ }
+ });
- Button button_test = new Button(group, SWT.PUSH);
- button_test.setText("Run &Diagnostics");
- button_test.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
+ createVerticalSpacer(composite, 20);
+
+ final Button button_test = new Button(composite, SWT.PUSH);
+ button_test.setText("Run &Tests");
+ button_test.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
button_test.addSelectionListener(new SelectionAdapter() {
+ @Override
public void widgetSelected(SelectionEvent e) {
TreeItem[] selection = peer_tree.getSelection();
if (selection.length > 0) {
@@ -311,10 +412,11 @@ public class TCFMainTab extends AbstractLaunchConfigurationTab {
}
});
- Button button_loop = new Button(group, SWT.PUSH);
- button_loop.setText("Diagnostics &Loop");
- button_loop.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
+ final Button button_loop = new Button(composite, SWT.PUSH);
+ button_loop.setText("Tests &Loop");
+ button_loop.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
button_loop.addSelectionListener(new SelectionAdapter() {
+ @Override
public void widgetSelected(SelectionEvent e) {
TreeItem[] selection = peer_tree.getSelection();
if (selection.length > 0) {
@@ -323,6 +425,20 @@ public class TCFMainTab extends AbstractLaunchConfigurationTab {
}
}
});
+
+ update_peer_buttons = new Runnable() {
+
+ public void run() {
+ PeerInfo info = null;
+ TreeItem[] selection = peer_tree.getSelection();
+ if (selection.length > 0) info = findPeerInfo(selection[0]);
+ button_edit.setEnabled(info != null);
+ button_remove.setEnabled(info != null && info.peer instanceof TCFUserDefPeer);
+ button_test.setEnabled(info != null);
+ button_loop.setEnabled(info != null);
+ }
+ };
+ update_peer_buttons.run();
}
private void createProgramGroup(Composite parent) {
@@ -380,7 +496,10 @@ public class TCFMainTab extends AbstractLaunchConfigurationTab {
if (id != null) {
peer_id_text.setText(id);
TreeItem item = findItem(findPeerInfo(id));
- if (item != null) peer_tree.setSelection(item);
+ if (item != null) {
+ peer_tree.setSelection(item);
+ update_peer_buttons.run();
+ }
}
program_text.setText(configuration.getAttribute(
TCFLaunchDelegate.ATTR_PROGRAM_FILE, "")); //$NON-NLS-1$
@@ -540,7 +659,10 @@ public class TCFMainTab extends AbstractLaunchConfigurationTab {
for (int i = 0; i < items.length; i++) fillItem(items[i], arr[i]);
String id = peer_id_text.getText();
TreeItem item = findItem(findPeerInfo(id));
- if (item != null) peer_tree.setSelection(item);
+ if (item != null) {
+ peer_tree.setSelection(item);
+ update_peer_buttons.run();
+ }
}
}
@@ -606,6 +728,7 @@ public class TCFMainTab extends AbstractLaunchConfigurationTab {
button_cancel.setText("&Cancel");
button_cancel.setLayoutData(new GridData(GridData.END, GridData.CENTER, false, false));
button_cancel.addSelectionListener(new SelectionAdapter() {
+ @Override
public void widgetSelected(SelectionEvent e) {
Protocol.invokeLater(new Runnable() {
public void run() {
diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/launch/TestErrorsDialog.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/launch/TestErrorsDialog.java
index e351548f9..55b140a91 100644
--- a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/launch/TestErrorsDialog.java
+++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/launch/TestErrorsDialog.java
@@ -29,8 +29,9 @@ import org.eclipse.swt.widgets.Text;
class TestErrorsDialog extends Dialog {
- private final int SIZING_TEXT_WIDTH = 600;
- private final int SIZING_TEXT_HEIGHT = 400;
+ private static final int
+ SIZING_TEXT_WIDTH = 600,
+ SIZING_TEXT_HEIGHT = 400;
private Collection<Throwable> errors;
private Image image;
@@ -42,16 +43,19 @@ class TestErrorsDialog extends Dialog {
this.errors = errors;
}
+ @Override
protected void configureShell(Shell shell) {
super.configureShell(shell);
shell.setText("Connection Diagnostic errors");
shell.setImage(image);
}
+ @Override
protected void createButtonsForButtonBar(Composite parent) {
createButton(parent, IDialogConstants.OK_ID, "&OK", true);
}
+ @Override
protected Control createDialogArea(Composite parent) {
Composite composite = (Composite)super.createDialogArea(parent);
composite.setSize(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT));

Back to the top