mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 09:46:02 +02:00
Layout adjustments.
This commit is contained in:
parent
3d797fd57c
commit
0f3bd7d90f
1 changed files with 25 additions and 16 deletions
|
@ -8,12 +8,14 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Markus Schorn - initial API and implementation
|
* Markus Schorn - initial API and implementation
|
||||||
* IBM Corporation
|
* IBM Corporation
|
||||||
|
* Sergey Prigogin (Google)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.ui.dialogs;
|
package org.eclipse.cdt.ui.dialogs;
|
||||||
|
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.preferences.InstanceScope;
|
import org.eclipse.core.runtime.preferences.InstanceScope;
|
||||||
|
import org.eclipse.jface.layout.PixelConverter;
|
||||||
import org.eclipse.jface.preference.FieldEditor;
|
import org.eclipse.jface.preference.FieldEditor;
|
||||||
import org.eclipse.jface.preference.IntegerFieldEditor;
|
import org.eclipse.jface.preference.IntegerFieldEditor;
|
||||||
import org.eclipse.jface.util.IPropertyChangeListener;
|
import org.eclipse.jface.util.IPropertyChangeListener;
|
||||||
|
@ -23,6 +25,7 @@ import org.eclipse.swt.layout.GridLayout;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
import org.eclipse.swt.widgets.Group;
|
import org.eclipse.swt.widgets.Group;
|
||||||
import org.eclipse.swt.widgets.Label;
|
import org.eclipse.swt.widgets.Label;
|
||||||
|
import org.eclipse.swt.widgets.Text;
|
||||||
import org.eclipse.ui.preferences.ScopedPreferenceStore;
|
import org.eclipse.ui.preferences.ScopedPreferenceStore;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
|
@ -32,6 +35,8 @@ import org.eclipse.cdt.core.parser.CodeReaderCache;
|
||||||
import org.eclipse.cdt.core.parser.ICodeReaderCache;
|
import org.eclipse.cdt.core.parser.ICodeReaderCache;
|
||||||
import org.eclipse.cdt.utils.ui.controls.ControlFactory;
|
import org.eclipse.cdt.utils.ui.controls.ControlFactory;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.internal.ui.wizards.dialogfields.LayoutUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This OptionPage is used in the IndexerPreference page to allow for adjusting
|
* This OptionPage is used in the IndexerPreference page to allow for adjusting
|
||||||
* various parsing related caches.
|
* various parsing related caches.
|
||||||
|
@ -57,12 +62,11 @@ public class CacheSizeBlock extends AbstractCOptionPage {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void createControl(Composite parent) {
|
public void createControl(Composite parent) {
|
||||||
|
PixelConverter pixelConverter = new PixelConverter(parent);
|
||||||
GridData gd;
|
GridData gd;
|
||||||
GridLayout gl;
|
GridLayout gl;
|
||||||
Composite composite = ControlFactory.createComposite(parent, 1);
|
Composite composite = ControlFactory.createComposite(parent, 1);
|
||||||
gl= (GridLayout)composite.getLayout();
|
gl= (GridLayout)composite.getLayout();
|
||||||
int hindent= gl.marginWidth + gl.marginLeft;
|
|
||||||
int vindent= gl.marginHeight + gl.marginTop;
|
|
||||||
gl.marginWidth= 0;
|
gl.marginWidth= 0;
|
||||||
|
|
||||||
gd= (GridData) composite.getLayoutData();
|
gd= (GridData) composite.getLayoutData();
|
||||||
|
@ -81,15 +85,24 @@ public class CacheSizeBlock extends AbstractCOptionPage {
|
||||||
Label dbCacheLabel= ControlFactory.createLabel(cacheComp, DialogsMessages.CacheSizeBlock_indexDatabaseCache);
|
Label dbCacheLabel= ControlFactory.createLabel(cacheComp, DialogsMessages.CacheSizeBlock_indexDatabaseCache);
|
||||||
fDBLimitPct= new IntegerFieldEditor(CCorePreferenceConstants.INDEX_DB_CACHE_SIZE_PCT, DialogsMessages.CacheSizeBlock_limitRelativeToMaxHeapSize, cacheComp, 3);
|
fDBLimitPct= new IntegerFieldEditor(CCorePreferenceConstants.INDEX_DB_CACHE_SIZE_PCT, DialogsMessages.CacheSizeBlock_limitRelativeToMaxHeapSize, cacheComp, 3);
|
||||||
fDBLimitPct.setValidRange(1, 75);
|
fDBLimitPct.setValidRange(1, 75);
|
||||||
|
Text control = fDBLimitPct.getTextControl(cacheComp);
|
||||||
|
LayoutUtil.setWidthHint(control, pixelConverter.convertWidthInCharsToPixels(10));
|
||||||
|
LayoutUtil.setHorizontalGrabbing(control, false);
|
||||||
ControlFactory.createLabel(cacheComp, "%"); //$NON-NLS-1$
|
ControlFactory.createLabel(cacheComp, "%"); //$NON-NLS-1$
|
||||||
|
|
||||||
fDBAbsoluteLimit= new IntegerFieldEditor(CCorePreferenceConstants.MAX_INDEX_DB_CACHE_SIZE_MB, DialogsMessages.CacheSizeBlock_absoluteLimit, cacheComp, 4);
|
fDBAbsoluteLimit= new IntegerFieldEditor(CCorePreferenceConstants.MAX_INDEX_DB_CACHE_SIZE_MB, DialogsMessages.CacheSizeBlock_absoluteLimit, cacheComp, 4);
|
||||||
fDBAbsoluteLimit.setValidRange(1, 10000);
|
fDBAbsoluteLimit.setValidRange(1, 10000);
|
||||||
|
control = fDBAbsoluteLimit.getTextControl(cacheComp);
|
||||||
|
LayoutUtil.setWidthHint(control, pixelConverter.convertWidthInCharsToPixels(10));
|
||||||
|
LayoutUtil.setHorizontalGrabbing(control, false);
|
||||||
ControlFactory.createLabel(cacheComp, DialogsMessages.CacheSizeBlock_MB);
|
ControlFactory.createLabel(cacheComp, DialogsMessages.CacheSizeBlock_MB);
|
||||||
|
|
||||||
Label codeReaderLabel= ControlFactory.createLabel(cacheComp, DialogsMessages.CacheSizeBlock_headerFileCache);
|
Label codeReaderLabel= ControlFactory.createLabel(cacheComp, DialogsMessages.CacheSizeBlock_headerFileCache);
|
||||||
fCodeReaderLimit= new IntegerFieldEditor(CodeReaderCache.CODE_READER_BUFFER, DialogsMessages.CacheSizeBlock_absoluteLimit, cacheComp, 4);
|
fCodeReaderLimit= new IntegerFieldEditor(CodeReaderCache.CODE_READER_BUFFER, DialogsMessages.CacheSizeBlock_absoluteLimit, cacheComp, 4);
|
||||||
fCodeReaderLimit.setValidRange(1, 10000);
|
fCodeReaderLimit.setValidRange(1, 10000);
|
||||||
|
control = fCodeReaderLimit.getTextControl(cacheComp);
|
||||||
|
LayoutUtil.setWidthHint(control, pixelConverter.convertWidthInCharsToPixels(10));
|
||||||
|
LayoutUtil.setHorizontalGrabbing(control, false);
|
||||||
ControlFactory.createLabel(cacheComp, DialogsMessages.CacheSizeBlock_MB);
|
ControlFactory.createLabel(cacheComp, DialogsMessages.CacheSizeBlock_MB);
|
||||||
|
|
||||||
gl= (GridLayout) cacheComp.getLayout();
|
gl= (GridLayout) cacheComp.getLayout();
|
||||||
|
@ -101,24 +114,23 @@ public class CacheSizeBlock extends AbstractCOptionPage {
|
||||||
gd= (GridData) dbCacheLabel.getLayoutData();
|
gd= (GridData) dbCacheLabel.getLayoutData();
|
||||||
gd.horizontalSpan= 3;
|
gd.horizontalSpan= 3;
|
||||||
|
|
||||||
|
int vindent= pixelConverter.convertHeightInCharsToPixels(1) / 2;
|
||||||
gd= (GridData) codeReaderLabel.getLayoutData();
|
gd= (GridData) codeReaderLabel.getLayoutData();
|
||||||
gd.verticalIndent= vindent;
|
gd.verticalIndent= vindent;
|
||||||
gd.horizontalSpan= 3;
|
gd.horizontalSpan= 3;
|
||||||
|
|
||||||
|
int hindent= pixelConverter.convertWidthInCharsToPixels(2);
|
||||||
gd= new GridData();
|
gd= new GridData();
|
||||||
gd.grabExcessHorizontalSpace= true;
|
|
||||||
gd.horizontalAlignment= GridData.FILL;
|
gd.horizontalAlignment= GridData.FILL;
|
||||||
gd.horizontalIndent= hindent;
|
gd.horizontalIndent= hindent;
|
||||||
fDBLimitPct.getLabelControl(cacheComp).setLayoutData(gd);
|
fDBLimitPct.getLabelControl(cacheComp).setLayoutData(gd);
|
||||||
|
|
||||||
gd= new GridData();
|
gd= new GridData();
|
||||||
gd.grabExcessHorizontalSpace= true;
|
|
||||||
gd.horizontalAlignment= GridData.FILL;
|
gd.horizontalAlignment= GridData.FILL;
|
||||||
gd.horizontalIndent= hindent;
|
gd.horizontalIndent= hindent;
|
||||||
fDBAbsoluteLimit.getLabelControl(cacheComp).setLayoutData(gd);
|
fDBAbsoluteLimit.getLabelControl(cacheComp).setLayoutData(gd);
|
||||||
|
|
||||||
gd= new GridData();
|
gd= new GridData();
|
||||||
gd.grabExcessHorizontalSpace= true;
|
|
||||||
gd.horizontalAlignment= GridData.FILL;
|
gd.horizontalAlignment= GridData.FILL;
|
||||||
gd.horizontalIndent= hindent;
|
gd.horizontalIndent= hindent;
|
||||||
fCodeReaderLimit.getLabelControl(cacheComp).setLayoutData(gd);
|
fCodeReaderLimit.getLabelControl(cacheComp).setLayoutData(gd);
|
||||||
|
@ -165,16 +177,13 @@ public class CacheSizeBlock extends AbstractCOptionPage {
|
||||||
if (!fDBLimitPct.isValid()) {
|
if (!fDBLimitPct.isValid()) {
|
||||||
setErrorMessage(fDBLimitPct.getErrorMessage());
|
setErrorMessage(fDBLimitPct.getErrorMessage());
|
||||||
setValid(false);
|
setValid(false);
|
||||||
}
|
} else if (!fDBAbsoluteLimit.isValid()) {
|
||||||
else if (!fDBAbsoluteLimit.isValid()) {
|
|
||||||
setErrorMessage(fDBAbsoluteLimit.getErrorMessage());
|
setErrorMessage(fDBAbsoluteLimit.getErrorMessage());
|
||||||
setValid(false);
|
setValid(false);
|
||||||
}
|
} else if (!fCodeReaderLimit.isValid()) {
|
||||||
else if (!fCodeReaderLimit.isValid()) {
|
|
||||||
setErrorMessage(fCodeReaderLimit.getErrorMessage());
|
setErrorMessage(fCodeReaderLimit.getErrorMessage());
|
||||||
setValid(false);
|
setValid(false);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
setValid(true);
|
setValid(true);
|
||||||
}
|
}
|
||||||
getContainer().updateContainer();
|
getContainer().updateContainer();
|
||||||
|
|
Loading…
Add table
Reference in a new issue