Fix the DeviceChooserDialog table issues.

On Linux, the gtk table seems to resize itself automatically when the
layout is computed and forces the last column to resize itself at +18 pixels.
This has a problematic impact on this dialog as it is not resizable and is
made to match the size of the content. As the dialog is used time after time
the last column grows by 18 pixels at every use up to a point where it
doesn't fit the screen.
Since storing the columns size is not that useful and I couldn't find a
way to ignore this first resize, I'm just removing the width storage.
This commit is contained in:
Xavier Ducrohet
2009-08-03 14:23:16 -07:00
parent d08cf83aac
commit 2f39cedad3

View File

@@ -36,7 +36,6 @@ import com.android.sdkuilib.internal.widgets.AvdSelector.IAvdFilter;
import org.eclipse.jface.dialogs.Dialog; import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants; import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.viewers.ILabelProviderListener; import org.eclipse.jface.viewers.ILabelProviderListener;
import org.eclipse.jface.viewers.IStructuredContentProvider; import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.ITableLabelProvider; import org.eclipse.jface.viewers.ITableLabelProvider;
@@ -68,12 +67,6 @@ public class DeviceChooserDialog extends Dialog implements IDeviceChangeListener
private final static int ICON_WIDTH = 16; private final static int ICON_WIDTH = 16;
private final static String PREFS_COL_SERIAL = "deviceChooser.serial"; //$NON-NLS-1$
private final static String PREFS_COL_STATE = "deviceChooser.state"; //$NON-NLS-1$
private final static String PREFS_COL_AVD = "deviceChooser.avd"; //$NON-NLS-1$
private final static String PREFS_COL_TARGET = "deviceChooser.target"; //$NON-NLS-1$
private final static String PREFS_COL_DEBUG = "deviceChooser.debug"; //$NON-NLS-1$
private Table mDeviceTable; private Table mDeviceTable;
private TableViewer mViewer; private TableViewer mViewer;
private AvdSelector mPreferredAvdSelector; private AvdSelector mPreferredAvdSelector;
@@ -334,7 +327,6 @@ public class DeviceChooserDialog extends Dialog implements IDeviceChangeListener
layout.marginLeft = 30; layout.marginLeft = 30;
offsetComp.setLayout(layout); offsetComp.setLayout(layout);
IPreferenceStore store = AdtPlugin.getDefault().getPreferenceStore();
mDeviceTable = new Table(offsetComp, SWT.SINGLE | SWT.FULL_SELECTION | SWT.BORDER); mDeviceTable = new Table(offsetComp, SWT.SINGLE | SWT.FULL_SELECTION | SWT.BORDER);
GridData gd; GridData gd;
mDeviceTable.setLayoutData(gd = new GridData(GridData.FILL_BOTH)); mDeviceTable.setLayoutData(gd = new GridData(GridData.FILL_BOTH));
@@ -345,23 +337,23 @@ public class DeviceChooserDialog extends Dialog implements IDeviceChangeListener
TableHelper.createTableColumn(mDeviceTable, "Serial Number", TableHelper.createTableColumn(mDeviceTable, "Serial Number",
SWT.LEFT, "AAA+AAAAAAAAAAAAAAAAAAA", //$NON-NLS-1$ SWT.LEFT, "AAA+AAAAAAAAAAAAAAAAAAA", //$NON-NLS-1$
PREFS_COL_SERIAL, store); null /* prefs name */, null /* prefs store */);
TableHelper.createTableColumn(mDeviceTable, "AVD Name", TableHelper.createTableColumn(mDeviceTable, "AVD Name",
SWT.LEFT, "engineering", //$NON-NLS-1$ SWT.LEFT, "AAAAAAAAAAAAAAAAAAA", //$NON-NLS-1$
PREFS_COL_AVD, store); null /* prefs name */, null /* prefs store */);
TableHelper.createTableColumn(mDeviceTable, "Target", TableHelper.createTableColumn(mDeviceTable, "Target",
SWT.LEFT, "AAA+Android 9.9.9", //$NON-NLS-1$ SWT.LEFT, "AAA+Android 9.9.9", //$NON-NLS-1$
PREFS_COL_TARGET, store); null /* prefs name */, null /* prefs store */);
TableHelper.createTableColumn(mDeviceTable, "Debug", TableHelper.createTableColumn(mDeviceTable, "Debug",
SWT.LEFT, "Debug", //$NON-NLS-1$ SWT.LEFT, "Debug", //$NON-NLS-1$
PREFS_COL_DEBUG, store); null /* prefs name */, null /* prefs store */);
TableHelper.createTableColumn(mDeviceTable, "State", TableHelper.createTableColumn(mDeviceTable, "State",
SWT.LEFT, "bootloader", //$NON-NLS-1$ SWT.LEFT, "bootloader", //$NON-NLS-1$
PREFS_COL_STATE, store); null /* prefs name */, null /* prefs store */);
// create the viewer for it // create the viewer for it
mViewer = new TableViewer(mDeviceTable); mViewer = new TableViewer(mDeviceTable);