Search in sources :

Example 21 with Control

use of org.eclipse.swt.widgets.Control in project translationstudio8 by heartsome.

the class TSWizardDialog method aboutToStart.

/**
	 * About to start a long running operation triggered through the wizard.
	 * Shows the progress monitor and disables the wizard's buttons and
	 * controls.
	 * 
	 * @param enableCancelButton
	 *            <code>true</code> if the Cancel button should be enabled,
	 *            and <code>false</code> if it should be disabled
	 * @return the saved UI state
	 */
private Object aboutToStart(boolean enableCancelButton) {
    Map savedState = null;
    if (getShell() != null) {
        // Save focus control
        Control focusControl = getShell().getDisplay().getFocusControl();
        if (focusControl != null && focusControl.getShell() != getShell()) {
            focusControl = null;
        }
        boolean needsProgressMonitor = wizard.needsProgressMonitor();
        // Set the busy cursor to all shells.
        Display d = getShell().getDisplay();
        waitCursor = new Cursor(d, SWT.CURSOR_WAIT);
        setDisplayCursor(waitCursor);
        if (useCustomProgressMonitorPart) {
            cancelButton.removeSelectionListener(cancelListener);
            // Set the arrow cursor to the cancel component.
            arrowCursor = new Cursor(d, SWT.CURSOR_ARROW);
            cancelButton.setCursor(arrowCursor);
        }
        // Deactivate shell
        savedState = saveUIState(useCustomProgressMonitorPart && needsProgressMonitor && enableCancelButton);
        if (focusControl != null) {
            savedState.put(FOCUS_CONTROL, focusControl);
        }
        // Activate cancel behavior.
        if (needsProgressMonitor) {
            if (enableCancelButton || useCustomProgressMonitorPart) {
                progressMonitorPart.attachToCancelComponent(cancelButton);
            }
            progressMonitorPart.setVisible(true);
        }
        // Install traverse listener once in order to implement 'Enter' and 'Space' key blocking
        if (timeWhenLastJobFinished == -1) {
            timeWhenLastJobFinished = 0;
            getShell().addTraverseListener(new TraverseListener() {

                public void keyTraversed(TraverseEvent e) {
                    if (e.detail == SWT.TRAVERSE_RETURN || (e.detail == SWT.TRAVERSE_MNEMONIC && e.keyCode == 32)) {
                        // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=287887
                        if (timeWhenLastJobFinished != 0 && System.currentTimeMillis() - timeWhenLastJobFinished < RESTORE_ENTER_DELAY) {
                            e.doit = false;
                            return;
                        }
                        timeWhenLastJobFinished = 0;
                    }
                }
            });
        }
    }
    return savedState;
}
Also used : Control(org.eclipse.swt.widgets.Control) TraverseEvent(org.eclipse.swt.events.TraverseEvent) TraverseListener(org.eclipse.swt.events.TraverseListener) Cursor(org.eclipse.swt.graphics.Cursor) Map(java.util.Map) HashMap(java.util.HashMap) Display(org.eclipse.swt.widgets.Display)

Example 22 with Control

use of org.eclipse.swt.widgets.Control in project translationstudio8 by heartsome.

the class TSWizardDialog method stopped.

/**
	 * A long running operation triggered through the wizard was stopped either
	 * by user input or by normal end. Hides the progress monitor and restores
	 * the enable state wizard's buttons and controls.
	 * 
	 * @param savedState
	 *            the saved UI state as returned by <code>aboutToStart</code>
	 * @see #aboutToStart
	 */
private void stopped(Object savedState) {
    if (getShell() != null && !getShell().isDisposed()) {
        if (wizard.needsProgressMonitor()) {
            progressMonitorPart.setVisible(false);
            progressMonitorPart.removeFromCancelComponent(cancelButton);
        }
        Map state = (Map) savedState;
        restoreUIState(state);
        setDisplayCursor(null);
        if (useCustomProgressMonitorPart) {
            cancelButton.addSelectionListener(cancelListener);
            cancelButton.setCursor(null);
            arrowCursor.dispose();
            arrowCursor = null;
        }
        waitCursor.dispose();
        waitCursor = null;
        Control focusControl = (Control) state.get(FOCUS_CONTROL);
        if (focusControl != null && !focusControl.isDisposed()) {
            focusControl.setFocus();
        }
    }
}
Also used : Control(org.eclipse.swt.widgets.Control) Map(java.util.Map) HashMap(java.util.HashMap)

Example 23 with Control

use of org.eclipse.swt.widgets.Control in project translationstudio8 by heartsome.

the class ExportFilterComposite method addComponent.

/**
	 * 增加一个组件
	 * @param parent
	 *            组件容器
	 * @param bean
	 *            {@link ExportFilterComponentBean};
	 */
public void addComponent(Composite parent, ExportFilterComponentBean bean) {
    Integer number = (Integer) parent.getData("currentNumber") + 1;
    parent.setData("currentNumber", number);
    if (number == 2) {
        Control c = parent.getChildren()[0];
        if (c instanceof ExportFilterComposite) {
            ExportFilterComposite temp = (ExportFilterComposite) c;
            temp.setDeleteButtonEnabled(true);
        }
    }
    ExportFilterComposite tempComponent = new ExportFilterComposite(parent, SWT.None, this.ruleType, bean);
    tempComponent.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
}
Also used : Control(org.eclipse.swt.widgets.Control) GridData(org.eclipse.swt.layout.GridData)

Example 24 with Control

use of org.eclipse.swt.widgets.Control in project translationstudio8 by heartsome.

the class ExportFilterSettingDialog method initData.

private void initData() {
    if (this.currentFilter != null) {
        Control[] c = dynaComposite.getChildren();
        for (int i = 0; i < c.length; i++) {
            c[i].dispose();
        }
        filterNameText.setText(currentFilter.getFilterName());
        String filterConnector = currentFilter.getFilterConnector();
        if (filterConnector.equals("AND")) {
            isAllCbtn.setSelection(true);
            isAnyCbtn.setSelection(false);
        } else {
            isAllCbtn.setSelection(false);
            isAnyCbtn.setSelection(true);
        }
        List<ExportFilterComponentBean> optionList = currentFilter.getFilterOption();
        if (optionList.size() > 0) {
            ExportFilterComponentBean bean = optionList.get(0);
            ExportFilterComposite exportFilterComponent = new ExportFilterComposite(dynaComposite, SWT.None, ruleType, bean);
            exportFilterComponent.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
            exportFilterComponent.setDeleteButtonEnabled(false);
            dynaComposite.setData("currentNumber", 1);
            for (int i = 1; i < optionList.size(); i++) {
                bean = optionList.get(i);
                exportFilterComponent.addComponent(dynaComposite, bean);
            }
        }
    }
}
Also used : ExportFilterComponentBean(net.heartsome.cat.database.bean.ExportFilterComponentBean) Control(org.eclipse.swt.widgets.Control) GridData(org.eclipse.swt.layout.GridData) Point(org.eclipse.swt.graphics.Point)

Example 25 with Control

use of org.eclipse.swt.widgets.Control in project translationstudio8 by heartsome.

the class LocationPageContentProvider method createContents.

@Override
protected Control createContents(Composite parent) {
    Control control = super.createContents(parent);
    setTitle(Messages.getString("dialog.WorkspaceDialog.title"));
    setMessage(Messages.getString("dialog.WorkspaceDialog.msg"));
    return control;
}
Also used : Control(org.eclipse.swt.widgets.Control)

Aggregations

Control (org.eclipse.swt.widgets.Control)307 Point (org.eclipse.swt.graphics.Point)96 Composite (org.eclipse.swt.widgets.Composite)88 FormAttachment (org.eclipse.swt.layout.FormAttachment)57 FormData (org.eclipse.swt.layout.FormData)57 Button (org.eclipse.swt.widgets.Button)57 GridData (org.eclipse.swt.layout.GridData)55 Node (org.talend.designer.core.ui.editor.nodes.Node)46 DecoratedField (org.eclipse.jface.fieldassist.DecoratedField)45 CLabel (org.eclipse.swt.custom.CLabel)37 GridLayout (org.eclipse.swt.layout.GridLayout)37 Text (org.eclipse.swt.widgets.Text)36 FieldDecoration (org.eclipse.jface.fieldassist.FieldDecoration)33 GC (org.eclipse.swt.graphics.GC)31 Label (org.eclipse.swt.widgets.Label)31 SelectionEvent (org.eclipse.swt.events.SelectionEvent)28 CCombo (org.eclipse.swt.custom.CCombo)27 IElementParameter (org.talend.core.model.process.IElementParameter)25 ScrolledComposite (org.eclipse.swt.custom.ScrolledComposite)24 StyledText (org.eclipse.swt.custom.StyledText)23