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