Search in sources :

Example 16 with Control

use of org.eclipse.swt.widgets.Control in project dbeaver by serge-rider.

the class TreeLoadVisualizer method completeLoading.

@Override
public void completeLoading(Object[] children) {
    final Control viewerControl = viewer.getControl();
    if (viewerControl.isDisposed()) {
        return;
    }
    try {
        viewerControl.setRedraw(false);
        Widget widget = viewer.testFindItem(parent);
        if (widget != null && !widget.isDisposed()) {
            TreeItem item = (TreeItem) viewer.testFindItem(placeHolder);
            if (children == null) {
                // Some error occurred. In good case children must be at least an empty array
                viewer.collapseToLevel(parent, -1);
            } else if (children.length != 0) {
                viewer.add(parent, children);
            }
            if (item != null && !item.isDisposed()) {
                if (item.getParentItem() != null && !item.getParentItem().isDisposed() || this.parent instanceof IWorkspaceRoot) {
                    viewer.remove(placeHolder);
                }
            }
        }
    } finally {
        placeHolder.dispose(parent);
        if (!viewerControl.isDisposed()) {
            viewerControl.setRedraw(true);
        }
    }
}
Also used : Control(org.eclipse.swt.widgets.Control) IWorkspaceRoot(org.eclipse.core.resources.IWorkspaceRoot) TreeItem(org.eclipse.swt.widgets.TreeItem) Widget(org.eclipse.swt.widgets.Widget)

Example 17 with Control

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

the class TermDbManagerDialog method createDialogArea.

/**
	 * Create contents of the dialog.
	 * @param parent
	 */
@Override
protected Control createDialogArea(Composite parent) {
    final Composite composite = (Composite) super.createDialogArea(parent);
    GridLayout parentLayout = ((GridLayout) composite.getLayout());
    parentLayout.numColumns = 4;
    parentLayout.marginHeight = 0;
    parentLayout.marginWidth = 0;
    parentLayout.marginTop = 0;
    parentLayout.verticalSpacing = 0;
    parentLayout.horizontalSpacing = 0;
    Control treeControl = createTreeAreaContents(composite);
    createSash(composite, treeControl);
    Label versep = new Label(composite, SWT.SEPARATOR | SWT.VERTICAL);
    GridData verGd = new GridData(GridData.FILL_VERTICAL | GridData.GRAB_VERTICAL);
    versep.setLayoutData(verGd);
    versep.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, false, true));
    Composite pageAreaComposite = new Composite(composite, SWT.NONE);
    pageAreaComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
    GridLayout layout = new GridLayout(1, true);
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.verticalSpacing = 0;
    pageAreaComposite.setLayout(layout);
    // Build the Page container
    Composite pageContainer = createPageContainer(pageAreaComposite);
    GridData pageContainerData = new GridData(GridData.FILL_BOTH);
    pageContainerData.horizontalIndent = IDialogConstants.HORIZONTAL_MARGIN;
    pageContainer.setLayoutData(pageContainerData);
    // Build the separator line
    Label bottomSeparator = new Label(parent, SWT.HORIZONTAL | SWT.SEPARATOR);
    bottomSeparator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
    return composite;
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Control(org.eclipse.swt.widgets.Control) Composite(org.eclipse.swt.widgets.Composite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) Label(org.eclipse.swt.widgets.Label) GridData(org.eclipse.swt.layout.GridData)

Example 18 with Control

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

the class TermDbManagerDialog method initUI.

/**
	 * 根据当前操作不同的数据库类型,初始化界面 ;
	 */
private void initUI(boolean isAdd) {
    MetaData curDbMetaData = dbMetaDataMap.get(getCurrDbType());
    if (!isAdd) {
        Control[] childrens = locationText.getParent().getChildren();
        for (Control c : childrens) {
            if (!(c instanceof Composite)) {
                if (c instanceof Text || c instanceof Button) {
                    c.setEnabled(false);
                }
            } else {
                Composite com = (Composite) c;
                Control[] ch = com.getChildren();
                for (Control chl : ch) {
                    if (c instanceof Text || c instanceof Button) {
                        chl.setEnabled(false);
                    }
                }
            }
        }
    } else {
        if (curDbMetaData.dataPathSupported()) {
            locationText.setEnabled(true);
            borwserBtn.setEnabled(true);
        } else {
            locationText.setEnabled(false);
            borwserBtn.setEnabled(false);
        }
        if (curDbMetaData.serverNameSupported()) {
            hostText.setEnabled(true);
        } else {
            hostText.setEnabled(false);
        }
        if (curDbMetaData.instanceSupported()) {
            instanceText.setEnabled(true);
        } else {
            instanceText.setEnabled(false);
        }
        if (curDbMetaData.portSupported()) {
            portText.setEnabled(true);
        } else {
            portText.setEnabled(false);
        }
        if (curDbMetaData.userNameSupported()) {
            usernameText.setEnabled(true);
        } else {
            usernameText.setEnabled(false);
        }
        if (curDbMetaData.passwordSupported()) {
            passwordText.setEnabled(true);
        } else {
            passwordText.setEnabled(false);
        }
    }
}
Also used : Control(org.eclipse.swt.widgets.Control) Composite(org.eclipse.swt.widgets.Composite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) Button(org.eclipse.swt.widgets.Button) MetaData(net.heartsome.cat.common.bean.MetaData) Text(org.eclipse.swt.widgets.Text)

Example 19 with Control

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

the class TermDbManagerDialog method createContents.

@Override
protected Control createContents(final Composite parent) {
    Control control = super.createContents(parent);
    selectSaveItem();
    return control;
}
Also used : Control(org.eclipse.swt.widgets.Control)

Example 20 with Control

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

the class HsPreferenceDialog method createTreeAreaContents.

@Override
protected Control createTreeAreaContents(Composite parent) {
    // 创建左侧树
    Control result = super.createTreeAreaContents(parent);
    TreeViewer treeViewer = getTreeViewer();
    // 设置排序器
    IContributionService cs = (IContributionService) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getService(IContributionService.class);
    treeViewer.setComparator(cs.getComparatorFor(IContributionService.TYPE_PREFERENCE));
    // 展开所有
    treeViewer.expandAll();
    return result;
}
Also used : Control(org.eclipse.swt.widgets.Control) TreeViewer(org.eclipse.jface.viewers.TreeViewer) IContributionService(org.eclipse.ui.model.IContributionService)

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