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);
}
}
}
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;
}
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);
}
}
}
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;
}
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;
}
Aggregations