Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/META-INF/MANIFEST.MF1
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/editor/AbstractTcfLaunchTabContainerEditorPage.java8
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/editor/MemoryMapEditorPage.java10
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/editor/PathMapEditorPage.java33
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/editor/tabs/MemoryMapTab.java116
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/editor/tabs/PathMapTab.java80
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/editor/tabs/TableUtils.java77
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/editor/pages/TreeViewerExplorerEditorPage.java7
8 files changed, 284 insertions, 48 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/META-INF/MANIFEST.MF b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/META-INF/MANIFEST.MF
index 8f3c91c9a..cd1941a40 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/META-INF/MANIFEST.MF
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/META-INF/MANIFEST.MF
@@ -37,6 +37,7 @@ Bundle-Localization: plugin
Export-Package: org.eclipse.tcf.te.tcf.launch.ui.activator;x-internal:=true,
org.eclipse.tcf.te.tcf.launch.ui.attach,
org.eclipse.tcf.te.tcf.launch.ui.editor,
+ org.eclipse.tcf.te.tcf.launch.ui.editor.tabs,
org.eclipse.tcf.te.tcf.launch.ui.filetransfer,
org.eclipse.tcf.te.tcf.launch.ui.help,
org.eclipse.tcf.te.tcf.launch.ui.internal.services;x-internal:=true,
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/editor/AbstractTcfLaunchTabContainerEditorPage.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/editor/AbstractTcfLaunchTabContainerEditorPage.java
index 1d1699ff2..2f4bd3e6a 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/editor/AbstractTcfLaunchTabContainerEditorPage.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/editor/AbstractTcfLaunchTabContainerEditorPage.java
@@ -39,7 +39,7 @@ public abstract class AbstractTcfLaunchTabContainerEditorPage extends AbstractLa
* @param input The editor input.
* @return The peer model.
*/
- IPeerModel getPeerModel(Object input) {
+ public IPeerModel getPeerModel(Object input) {
return (IPeerModel)((IAdaptable)input).getAdapter(IPeerModel.class);
}
@@ -48,7 +48,7 @@ public abstract class AbstractTcfLaunchTabContainerEditorPage extends AbstractLa
* @param peerModel The peer model.
* @return The launch configuration.
*/
- ILaunchConfigurationWorkingCopy getLaunchConfig(final IPeerModel peerModel) {
+ public ILaunchConfigurationWorkingCopy getLaunchConfig(final IPeerModel peerModel) {
ILaunchConfigurationWorkingCopy wc = null;
if (peerModel != null) {
IPropertiesAccessService service = ServiceManager.getInstance().getService(peerModel, IPropertiesAccessService.class);
@@ -113,9 +113,9 @@ public abstract class AbstractTcfLaunchTabContainerEditorPage extends AbstractLa
}
/**
- * Check if the launch config has changed.
+ * Check if the launch configuration has changed.
* If it has changed, the page is set dirty.
- * @return <code>true</code> if the launch config has changed since last save.
+ * @return <code>true</code> if the launch configuration has changed since last save.
*/
public boolean checkLaunchConfigDirty() {
boolean dirty = false;
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/editor/MemoryMapEditorPage.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/editor/MemoryMapEditorPage.java
index 1785a5957..a6b5a6b94 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/editor/MemoryMapEditorPage.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/editor/MemoryMapEditorPage.java
@@ -13,6 +13,7 @@ import org.eclipse.debug.ui.AbstractLaunchConfigurationTab;
import org.eclipse.debug.ui.IDebugView;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.tcf.internal.debug.ui.launch.TCFMemoryMapTab;
+import org.eclipse.tcf.te.tcf.launch.ui.editor.tabs.MemoryMapTab;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorSite;
import org.eclipse.ui.ISelectionListener;
@@ -40,14 +41,7 @@ public class MemoryMapEditorPage extends AbstractTcfLaunchTabContainerEditorPage
*/
@Override
protected AbstractLaunchConfigurationTab createLaunchConfigurationTab() {
- return new TCFMemoryMapTab() {
- @Override
- protected void updateLaunchConfigurationDialog() {
- super.updateLaunchConfigurationDialog();
- performApply(getLaunchConfig(getPeerModel(getEditorInput())));
- checkLaunchConfigDirty();
- }
- };
+ return new MemoryMapTab(this);
}
/* (non-Javadoc)
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/editor/PathMapEditorPage.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/editor/PathMapEditorPage.java
index 8466085af..4f9890de3 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/editor/PathMapEditorPage.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/editor/PathMapEditorPage.java
@@ -10,11 +10,7 @@
package org.eclipse.tcf.te.tcf.launch.ui.editor;
import org.eclipse.debug.ui.AbstractLaunchConfigurationTab;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.tcf.internal.debug.ui.launch.TCFPathMapTab;
-import org.eclipse.tcf.te.tcf.launch.ui.nls.Messages;
+import org.eclipse.tcf.te.tcf.launch.ui.editor.tabs.PathMapTab;
/**
* TCF path map launch configuration tab container page implementation.
@@ -26,31 +22,6 @@ public class PathMapEditorPage extends AbstractTcfLaunchTabContainerEditorPage {
*/
@Override
protected AbstractLaunchConfigurationTab createLaunchConfigurationTab() {
- return new TCFPathMapTab() {
- @Override
- protected void updateLaunchConfigurationDialog() {
- super.updateLaunchConfigurationDialog();
- performApply(getLaunchConfig(getPeerModel(getEditorInput())));
- checkLaunchConfigDirty();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.internal.debug.ui.launch.TCFPathMapTab#createControl(org.eclipse.swt.widgets.Composite)
- */
- @Override
- public void createControl(Composite parent) {
- super.createControl(parent);
-
- TableViewer viewer = getViewer();
- if (viewer != null) {
- TableColumn[] columns = viewer.getTable().getColumns();
- for (TableColumn column : columns) {
- String label = column.getText();
- String key = "PathMapEditorPage_column_" + label.toLowerCase(); //$NON-NLS-1$
- if (Messages.hasString(key)) column.setText(Messages.getString(key));
- }
- }
- }
- };
+ return new PathMapTab(this);
}
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/editor/tabs/MemoryMapTab.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/editor/tabs/MemoryMapTab.java
new file mode 100644
index 000000000..4de976108
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/editor/tabs/MemoryMapTab.java
@@ -0,0 +1,116 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Wind River Systems, Inc. and others. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.launch.ui.editor.tabs;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.tcf.internal.debug.ui.commands.MemoryMapWidget;
+import org.eclipse.tcf.internal.debug.ui.launch.TCFMemoryMapTab;
+import org.eclipse.tcf.internal.debug.ui.model.TCFNode;
+import org.eclipse.tcf.te.tcf.launch.ui.editor.AbstractTcfLaunchTabContainerEditorPage;
+
+/**
+ * Customized TCF memory map launch configuration tab implementation to work better
+ * inside an configuration editor tab.
+ */
+public class MemoryMapTab extends TCFMemoryMapTab {
+ // Reference to the parent editor page
+ private final AbstractTcfLaunchTabContainerEditorPage parentEditorPage;
+
+ /**
+ * Local memory map widget implementation.
+ */
+ protected static class MyMemoryMapWidget extends MemoryMapWidget {
+
+ /**
+ * Constructor
+ *
+ * @param composite The parent composite.
+ * @param node The TCF node
+ */
+ public MyMemoryMapWidget(Composite composite, TCFNode node) {
+ super(composite, node);
+
+ TableViewer viewer = getViewer();
+ if (viewer != null) {
+ Table table = viewer.getTable();
+ Object layoutData = table.getLayoutData();
+ if (layoutData instanceof GridData) {
+ ((GridData)layoutData).widthHint = SWT.DEFAULT;
+ }
+
+ TableColumn[] columns = table.getColumns();
+ for (int i = 0; i < columns.length; i++) {
+ switch (i) {
+ case 0:
+ columns[i].setWidth(37);
+ break;
+ case 1:
+ case 2:
+ columns[i].setWidth(10);
+ break;
+ case 4:
+ columns[i].setWidth(18);
+ break;
+ default:
+ columns[i].setWidth(7);
+ break;
+ }
+ }
+
+ TableUtils.adjustTableColumnWidth(viewer);
+ }
+ }
+
+ }
+
+ /**
+ * Constructor
+ *
+ * @param parentEditorPage The parent editor page. Must not be <code>null</code>.
+ */
+ public MemoryMapTab(AbstractTcfLaunchTabContainerEditorPage parentEditorPage) {
+ super();
+ Assert.isNotNull(parentEditorPage);
+ this.parentEditorPage = parentEditorPage;
+ }
+
+ /**
+ * Returns the parent editor page.
+ *
+ * @return The parent editor page.
+ */
+ public final AbstractTcfLaunchTabContainerEditorPage getParentEditorPage() {
+ return parentEditorPage;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.internal.debug.ui.launch.TCFPathMapTab#updateLaunchConfigurationDialog()
+ */
+ @Override
+ protected void updateLaunchConfigurationDialog() {
+ super.updateLaunchConfigurationDialog();
+ performApply(parentEditorPage.getLaunchConfig(parentEditorPage.getPeerModel(parentEditorPage.getEditorInput())));
+ parentEditorPage.checkLaunchConfigDirty();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.internal.debug.ui.launch.TCFMemoryMapTab#createWidget(org.eclipse.swt.widgets.Composite, org.eclipse.tcf.internal.debug.ui.model.TCFNode)
+ */
+ @Override
+ protected MemoryMapWidget createWidget(Composite composite, TCFNode node) {
+ return new MyMemoryMapWidget(composite, node);
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/editor/tabs/PathMapTab.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/editor/tabs/PathMapTab.java
new file mode 100644
index 000000000..6664050db
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/editor/tabs/PathMapTab.java
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Wind River Systems, Inc. and others. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.launch.ui.editor.tabs;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.tcf.internal.debug.ui.launch.TCFPathMapTab;
+import org.eclipse.tcf.te.tcf.launch.ui.editor.AbstractTcfLaunchTabContainerEditorPage;
+import org.eclipse.tcf.te.tcf.launch.ui.nls.Messages;
+
+/**
+ * Customized TCF path map launch configuration tab implementation to work better
+ * inside an configuration editor tab.
+ */
+public class PathMapTab extends TCFPathMapTab {
+ // Reference to the parent editor page
+ private final AbstractTcfLaunchTabContainerEditorPage parentEditorPage;
+
+ /**
+ * Constructor
+ *
+ * @param parentEditorPage The parent editor page. Must not be <code>null</code>.
+ */
+ public PathMapTab(AbstractTcfLaunchTabContainerEditorPage parentEditorPage) {
+ super();
+ Assert.isNotNull(parentEditorPage);
+ this.parentEditorPage = parentEditorPage;
+ }
+
+ /**
+ * Returns the parent editor page.
+ *
+ * @return The parent editor page.
+ */
+ public final AbstractTcfLaunchTabContainerEditorPage getParentEditorPage() {
+ return parentEditorPage;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.internal.debug.ui.launch.TCFPathMapTab#updateLaunchConfigurationDialog()
+ */
+ @Override
+ protected void updateLaunchConfigurationDialog() {
+ super.updateLaunchConfigurationDialog();
+ performApply(parentEditorPage.getLaunchConfig(parentEditorPage.getPeerModel(parentEditorPage.getEditorInput())));
+ parentEditorPage.checkLaunchConfigDirty();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.internal.debug.ui.launch.TCFPathMapTab#createControl(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ public void createControl(Composite parent) {
+ super.createControl(parent);
+
+ TableViewer viewer = getViewer();
+ if (viewer != null) {
+ TableColumn[] columns = viewer.getTable().getColumns();
+ for (TableColumn column : columns) {
+ if (column.getWidth() == 300) column.setWidth(27);
+ else if (column.getWidth() == 100) column.setWidth(15);
+
+ String label = column.getText();
+ String key = "PathMapEditorPage_column_" + label.toLowerCase(); //$NON-NLS-1$
+ if (Messages.hasString(key)) column.setText(Messages.getString(key));
+ }
+
+ TableUtils.adjustTableColumnWidth(viewer);
+ }
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/editor/tabs/TableUtils.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/editor/tabs/TableUtils.java
new file mode 100644
index 000000000..b6389eca9
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/editor/tabs/TableUtils.java
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Wind River Systems, Inc. and others. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.launch.ui.editor.tabs;
+
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.events.ControlEvent;
+import org.eclipse.swt.events.ControlListener;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+
+/**
+ * Provides table utilities.
+ */
+public final class TableUtils {
+
+ /**
+ * Determines the current visible width of the table and
+ * adjust the column width according to there relative weight.
+ *
+ * @param viewer The viewer or <code>null</code>.
+ */
+ public static void adjustTableColumnWidth(Viewer viewer) {
+ if (!(viewer instanceof TableViewer)) return;
+
+ final TableViewer tableViewer = (TableViewer)viewer;
+ final Table table = tableViewer.getTable();
+ table.addControlListener(new ControlListener() {
+
+ @Override
+ public void controlResized(ControlEvent e) {
+ int sumColumnWidth = 0;
+ int tableWidth = table.getSize().x - table.getVerticalBar().getSize().x;
+
+ TableColumn[] columns = table.getColumns();
+
+ // Summarize the table column width
+ for (TableColumn column : columns) {
+ sumColumnWidth += column.getWidth();
+ }
+
+ // Calculate the new width for each column
+ int sumColumnWidth2 = 0;
+ TableColumn maxColumn = null;
+ for (TableColumn column : columns) {
+ int weight = (column.getWidth() * 100) / sumColumnWidth;
+ int newWidth = (weight * tableWidth) / 100;
+ sumColumnWidth2 += newWidth;
+ column.setWidth(newWidth);
+ if (maxColumn == null || maxColumn.getWidth() < column.getWidth()) {
+ maxColumn = column;
+ }
+ }
+
+ // If we end up with a slighter larger width of all columns than
+ // the table widget is, reduce the size of the largest column
+ if (sumColumnWidth2 > tableWidth && maxColumn != null) {
+ int delta = sumColumnWidth2 - tableWidth + 2;
+ maxColumn.setWidth(maxColumn.getWidth() - delta);
+ }
+
+ table.removeControlListener(this);
+ }
+
+ @Override
+ public void controlMoved(ControlEvent e) {
+ }
+ });
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/editor/pages/TreeViewerExplorerEditorPage.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/editor/pages/TreeViewerExplorerEditorPage.java
index 5db930228..ae0f5061f 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/editor/pages/TreeViewerExplorerEditorPage.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/editor/pages/TreeViewerExplorerEditorPage.java
@@ -183,15 +183,10 @@ public abstract class TreeViewerExplorerEditorPage extends AbstractCustomFormToo
final TreeViewer treeViewer = (TreeViewer)viewer;
final Tree tree = treeViewer.getTree();
- tree.setData("initialSizeAdjusted", Boolean.FALSE); //$NON-NLS-1$
tree.addControlListener(new ControlListener() {
@Override
public void controlResized(ControlEvent e) {
- Boolean initialSizeAdjusted = (Boolean)tree.getData("initialSizeAdjusted"); //$NON-NLS-1$
- if (initialSizeAdjusted.booleanValue()) return;
- tree.setData("initialSizeAdjusted", Boolean.TRUE); //$NON-NLS-1$
-
int sumColumnWidth = 0;
int treeWidth = tree.getSize().x - tree.getVerticalBar().getSize().x;
@@ -221,6 +216,8 @@ public abstract class TreeViewerExplorerEditorPage extends AbstractCustomFormToo
int delta = sumColumnWidth2 - treeWidth + 2;
maxColumn.setWidth(maxColumn.getWidth() - delta);
}
+
+ tree.removeControlListener(this);
}
@Override

Back to the top