Search in sources :

Example 1 with ScaleFieldEditor

use of org.eclipse.jface.preference.ScaleFieldEditor in project tdq-studio-se by Talend.

the class AnalysisTuningPreferencePage method createContents.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
     */
@Override
protected Control createContents(Composite parent) {
    Composite mainComposite = new Composite(parent, SWT.NONE);
    mainComposite.setLayout(new GridLayout());
    mainComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
    Group group2 = new Group(mainComposite, SWT.SHADOW_ETCHED_IN);
    // $NON-NLS-1$
    group2.setText(DefaultMessagesImpl.getString("AnalysisTuningPreferencePage.MemoryGroup"));
    GridLayout gridLayout1 = new GridLayout(2, false);
    group2.setLayout(gridLayout1);
    GridData gridData1 = new GridData(GridData.FILL_HORIZONTAL);
    group2.setLayoutData(gridData1);
    Composite composite2 = new Composite(group2, SWT.NONE);
    autoComboField = new CheckBoxFieldEditor(AnalysisThreadMemoryChangeNotifier.ANALYSIS_AUTOMATIC_MEMORY_CONTROL, DefaultMessagesImpl.getString("AnalysisTuningPreferencePage.EnableThreadControl"), // $NON-NLS-1$
    composite2);
    final Composite composite4 = new Composite(composite2, SWT.NONE);
    composite4.setLayout(new GridLayout(4, false));
    composite4.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    autoComboField.setPropertyChangeListener(new IPropertyChangeListener() {

        public void propertyChange(PropertyChangeEvent event) {
            memoryScaleField.getScaleControl().setEnabled(Boolean.valueOf(event.getNewValue().toString()));
        }
    });
    autoComboField.setPreferenceStore(PlatformUI.getPreferenceStore());
    autoComboField.setPage(this);
    autoComboField.load();
    Label labelScale1 = new Label(composite4, SWT.NONE);
    // $NON-NLS-1$
    labelScale1.setText(DefaultMessagesImpl.getString("AnalysisTuningPreferencePage.ForceToStop"));
    final Label labelScale2 = new Label(composite4, SWT.RIGHT);
    Label labelScale3 = new Label(composite4, SWT.NONE);
    // $NON-NLS-1$
    labelScale3.setText(DefaultMessagesImpl.getString("AnalysisTuningPreferencePage.Mb"));
    Composite compositeScale = new Composite(composite4, SWT.NONE);
    compositeScale.setLayout(new GridLayout());
    // MOD yyi 2012-04-18 TDQ-4916 scale layout fixed.
    compositeScale.setLayoutData(gridData1);
    // MOD yyi 2012-06-19 TDQ-4916 if the value is set to zero the threshold function would be disabled.
    memoryScaleField = new ScaleFieldEditor(AnalysisThreadMemoryChangeNotifier.ANALYSIS_MEMORY_THRESHOLD, "", compositeScale, 0, memMax, 1, // $NON-NLS-1$
    8);
    memoryScaleField.setPropertyChangeListener(new IPropertyChangeListener() {

        public void propertyChange(PropertyChangeEvent event) {
            labelScale2.setText(event.getNewValue().toString());
            composite4.pack();
        }
    });
    memoryScaleField.setPreferenceStore(PlatformUI.getPreferenceStore());
    memoryScaleField.setPage(this);
    memoryScaleField.load();
    labelScale2.setText(String.valueOf(memoryScaleField.getMaximum()));
    labelScale2.setText(String.valueOf(memoryScaleField.getScaleControl().getSelection()));
    if (!autoComboField.getBooleanValue()) {
        memoryScaleField.getScaleControl().setEnabled(false);
    }
    Composite composite3 = new Composite(composite2, SWT.NONE);
    composite3.setLayout(new GridLayout(4, false));
    composite3.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    Label label3 = new Label(composite3, SWT.NONE);
    // $NON-NLS-1$
    label3.setText(DefaultMessagesImpl.getString("AnalysisTuningPreferencePage.HeapStatus"));
    HeapStatus heap = new HeapStatus(composite3, PlatformUI.getPreferenceStore());
    heap.setEnabled(false);
    heap.setMenu(null);
    CLabel label2 = new CLabel(composite2, SWT.WRAP);
    // $NON-NLS-1$
    label2.setText(DefaultMessagesImpl.getString("AnalysisTuningPreferencePage.JvmWarning"));
    label2.setImage(ImageLib.getImage(ImageLib.RED_WARNING_PNG));
    return mainComposite;
}
Also used : IPropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener) CLabel(org.eclipse.swt.custom.CLabel) Group(org.eclipse.swt.widgets.Group) GridLayout(org.eclipse.swt.layout.GridLayout) PropertyChangeEvent(org.eclipse.jface.util.PropertyChangeEvent) Composite(org.eclipse.swt.widgets.Composite) GridData(org.eclipse.swt.layout.GridData) CLabel(org.eclipse.swt.custom.CLabel) Label(org.eclipse.swt.widgets.Label) HeapStatus(org.eclipse.ui.internal.HeapStatus) CheckBoxFieldEditor(org.talend.commons.ui.swt.preferences.CheckBoxFieldEditor) ScaleFieldEditor(org.eclipse.jface.preference.ScaleFieldEditor)

Example 2 with ScaleFieldEditor

use of org.eclipse.jface.preference.ScaleFieldEditor in project titan.EclipsePlug-ins by eclipse.

the class DebugPreferencePage method createLoadBalancingSection.

private void createLoadBalancingSection(final Composite parent) {
    ExpandableComposite expandable = createExtendableComposite(parent, "Load balancing");
    Composite comp = new Composite(expandable, SWT.NONE);
    comp.setLayout(new GridLayout(2, false));
    comp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    expandable.setClient(comp);
    expandable.setExpanded(false);
    IntegerFieldEditor tokens = new IntegerFieldEditor(PreferenceConstants.DEBUG_LOAD_TOKENS_TO_PROCESS_IN_A_ROW, "Tokens to process between thread switches", comp);
    tokens.setValidRange(0, Integer.MAX_VALUE);
    addField(tokens);
    ScaleFieldEditor threadPriority = new ScaleFieldEditor(PreferenceConstants.DEBUG_LOAD_THREAD_PRIORITY, "Thread priority", comp);
    threadPriority.setMinimum(Thread.MIN_PRIORITY);
    threadPriority.setMaximum(Thread.MAX_PRIORITY);
    threadPriority.setIncrement(1);
    threadPriority.getScaleControl().setToolTipText("Sets the priority of the threads created by the syntax analyzer.");
    addField(threadPriority);
    IntegerFieldEditor sleepBetweenFiles = new IntegerFieldEditor(PreferenceConstants.DEBUG_LOAD_SLEEP_BETWEEN_FILES, "Sleep the syntax analyzer thread after processing a single file(-1 to do not sleep at all)", comp);
    sleepBetweenFiles.setValidRange(-1, Integer.MAX_VALUE);
    addField(sleepBetweenFiles);
    BooleanFieldEditor yieldBetweenChecks = new BooleanFieldEditor(PreferenceConstants.DEBUG_LOAD_YIELD_BETWEEN_CHECKS, "Switch thread after semantically checking modules or definitions.", comp);
    addField(yieldBetweenChecks);
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) GridData(org.eclipse.swt.layout.GridData) IntegerFieldEditor(org.eclipse.jface.preference.IntegerFieldEditor) BooleanFieldEditor(org.eclipse.jface.preference.BooleanFieldEditor) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) ScaleFieldEditor(org.eclipse.jface.preference.ScaleFieldEditor)

Aggregations

ScaleFieldEditor (org.eclipse.jface.preference.ScaleFieldEditor)2 GridData (org.eclipse.swt.layout.GridData)2 GridLayout (org.eclipse.swt.layout.GridLayout)2 Composite (org.eclipse.swt.widgets.Composite)2 BooleanFieldEditor (org.eclipse.jface.preference.BooleanFieldEditor)1 IntegerFieldEditor (org.eclipse.jface.preference.IntegerFieldEditor)1 IPropertyChangeListener (org.eclipse.jface.util.IPropertyChangeListener)1 PropertyChangeEvent (org.eclipse.jface.util.PropertyChangeEvent)1 CLabel (org.eclipse.swt.custom.CLabel)1 ScrolledComposite (org.eclipse.swt.custom.ScrolledComposite)1 Group (org.eclipse.swt.widgets.Group)1 Label (org.eclipse.swt.widgets.Label)1 ExpandableComposite (org.eclipse.ui.forms.widgets.ExpandableComposite)1 HeapStatus (org.eclipse.ui.internal.HeapStatus)1 CheckBoxFieldEditor (org.talend.commons.ui.swt.preferences.CheckBoxFieldEditor)1