1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-11 02:05:39 +02:00

bug 289080: definedSymbols + string option with browseType messes up Properties->Tool Settings layout.

Patch from Wieant <wieant@tasking.com>
This commit is contained in:
Andrew Gvozdev 2009-09-14 15:54:58 +00:00
parent 2469ca73c6
commit eefe7f459b

View file

@ -43,8 +43,8 @@ public class FileListControlFieldEditor extends FieldEditor {
// file list control // file list control
private FileListControl list; private FileListControl list;
private int browseType; private int browseType;
private GridLayout layout; private Composite topLayout;
private static final String DEFAULT_SEPERATOR = ";"; //$NON-NLS-1$ private static final String DEFAULT_SEPARATOR = ";"; //$NON-NLS-1$
//values //values
// private String[] values = null; // private String[] values = null;
@ -92,7 +92,7 @@ public class FileListControlFieldEditor extends FieldEditor {
* Sets the field editor's tool tip text to the argument, which * Sets the field editor's tool tip text to the argument, which
* may be null indicating that no tool tip text should be shown. * may be null indicating that no tool tip text should be shown.
* *
* @param string the new tool tip text (or null) * @param tooltip the new tool tip text (or null)
* *
* @exception SWTException <ul> * @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the field editor has been disposed</li> * <li>ERROR_WIDGET_DISPOSED - if the field editor has been disposed</li>
@ -141,9 +141,10 @@ public class FileListControlFieldEditor extends FieldEditor {
/** /**
* Fills this field editor's basic controls into the given parent. * Fills this field editor's basic controls into the given parent.
*/ */
@Override
protected void doFillIntoGrid(Composite parent, int numColumns) { protected void doFillIntoGrid(Composite parent, int numColumns) {
Composite topLayout = new Composite(parent, SWT.NONE); topLayout = new Composite(parent, SWT.NONE);
layout = new GridLayout(); GridLayout layout = new GridLayout();
layout.numColumns = numColumns; layout.numColumns = numColumns;
layout.marginWidth = 7; layout.marginWidth = 7;
layout.marginHeight = 5; layout.marginHeight = 5;
@ -185,8 +186,7 @@ public class FileListControlFieldEditor extends FieldEditor {
} }
/** /**
* Returns the file list control * @return the file list control
* @return
*/ */
protected List getListControl() { protected List getListControl() {
return list.getListControl(); return list.getListControl();
@ -195,6 +195,7 @@ public class FileListControlFieldEditor extends FieldEditor {
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.jface.preference.FieldEditor#doLoad() * @see org.eclipse.jface.preference.FieldEditor#doLoad()
*/ */
@Override
protected void doLoad() { protected void doLoad() {
if (list != null) { if (list != null) {
IPreferenceStore store = getPreferenceStore(); IPreferenceStore store = getPreferenceStore();
@ -233,6 +234,7 @@ public class FileListControlFieldEditor extends FieldEditor {
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.jface.preference.FieldEditor#doLoadDefault() * @see org.eclipse.jface.preference.FieldEditor#doLoadDefault()
*/ */
@Override
protected void doLoadDefault() { protected void doLoadDefault() {
if (list != null) { if (list != null) {
list.removeAll(); list.removeAll();
@ -247,6 +249,7 @@ public class FileListControlFieldEditor extends FieldEditor {
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.jface.preference.FieldEditor#doStore() * @see org.eclipse.jface.preference.FieldEditor#doStore()
*/ */
@Override
protected void doStore() { protected void doStore() {
String s = createList(list.getItems()); String s = createList(list.getItems());
if (s != null) if (s != null)
@ -262,6 +265,7 @@ public class FileListControlFieldEditor extends FieldEditor {
* *
* @return the number of controls * @return the number of controls
*/ */
@Override
public int getNumberOfControls() { public int getNumberOfControls() {
return 1; return 1;
} }
@ -279,7 +283,7 @@ public class FileListControlFieldEditor extends FieldEditor {
for (int i = 0; i < items.length; i++) { for (int i = 0; i < items.length; i++) {
path.append(items[i]); path.append(items[i]);
if (i < (items.length - 1)) { if (i < (items.length - 1)) {
path.append(DEFAULT_SEPERATOR); path.append(DEFAULT_SEPARATOR);
} }
} }
return path.toString(); return path.toString();
@ -292,7 +296,7 @@ public class FileListControlFieldEditor extends FieldEditor {
*/ */
private String[] parseString(String stringList) { private String[] parseString(String stringList) {
StringTokenizer tokenizer = StringTokenizer tokenizer =
new StringTokenizer(stringList, DEFAULT_SEPERATOR); new StringTokenizer(stringList, DEFAULT_SEPARATOR);
ArrayList<String> list = new ArrayList<String>(); ArrayList<String> list = new ArrayList<String>();
while (tokenizer.hasMoreElements()) { while (tokenizer.hasMoreElements()) {
list.add((String)tokenizer.nextElement()); list.add((String)tokenizer.nextElement());
@ -304,21 +308,24 @@ public class FileListControlFieldEditor extends FieldEditor {
* Set style * Set style
*/ */
public void setStyle() { public void setStyle() {
layout.marginWidth = 0; ((GridLayout)topLayout.getLayout()).marginWidth = 0;
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.jface.preference.FieldEditor#adjustForNumColumns(int) * @see org.eclipse.jface.preference.FieldEditor#adjustForNumColumns(int)
*/ */
@Override
protected void adjustForNumColumns(int numColumns) { protected void adjustForNumColumns(int numColumns) {
((GridData)topLayout.getLayoutData()).horizontalSpan = numColumns;
} }
public Label getLabelControl(Composite parent) { @Override
public Label getLabelControl(Composite parent) {
return list.getLabelControl(); return list.getLabelControl();
} }
public void setEnabled(boolean enabled, Composite parent) { @Override
public void setEnabled(boolean enabled, Composite parent) {
list.setEnabled(enabled); list.setEnabled(enabled);
} }