use of org.eclipse.swt.widgets.Control in project translationstudio8 by heartsome.
the class MultiCellEditDialog method createDialogArea.
@Override
protected Control createDialogArea(Composite parent) {
Composite panel = new Composite(parent, SWT.NONE);
GridDataFactory.fillDefaults().grab(true, true).applyTo(panel);
GridLayout panelLayout = new GridLayout(allowIncrementDecrement ? 2 : 1, false);
panel.setLayout(panelLayout);
if (allowIncrementDecrement) {
createUpdateCombo(panel);
}
ActiveCellEditor.close();
ActiveCellEditor.activate(cellEditor, panel, originalCanonicalValue, initialEditValue, dataTypeConverter, cellStyle, dataValidator, new MultiEditHandler(), 0, 0, 0, 0);
Control editorControl = ActiveCellEditor.getControl();
// propagate the ESC event from the editor to the dialog
editorControl.addKeyListener(getEscKeyListener());
final GridDataFactory layoutData = GridDataFactory.fillDefaults().grab(true, false).hint(100, 20);
if (allowIncrementDecrement) {
layoutData.indent(5, 0);
}
layoutData.applyTo(editorControl);
return panel;
}
use of org.eclipse.swt.widgets.Control in project cogtool by cogtool.
the class ActionSet method createKeyComposite.
protected Composite createKeyComposite() {
Composite keyComp = new Composite(actionSettings, SWT.NONE);
keyComp.setLayout(new FormLayout());
keyboardTextLabel = new DisplayLabel(keyComp, SWT.NONE);
keyboardTextLabel.setText(L10N.get("DE.KeyboardTextCaption", "Text") + ":");
keyboardText = createKeyboardText(keyComp);
keyboardText.setFont(FontUtils.SYMBOL_FONT);
keyboardIsCmd = new Button(keyComp, SWT.CHECK);
keyboardIsCmd.setText(L10N.get("DE.IsCommand", "Is Command"));
keyboardIsCmd.addSelectionListener(deviceActionChange);
// TODO Why is this here rather than in its natural home in the
// overridden method in ActionPropertySet?
transitionDestinationLabelKeyboard = createTransitionDestinationLabel(keyComp);
transitionDestinationNameKeyboard = createTransitionDestinationName(keyComp);
/* TODO: add back in when single character stuff is straightened out
this.keyboardActionLabel = new DisplayLabel(keyComp, SWT.NONE);
this.keyboardActionLabel.setText(L10N.get("DE.KeyActionCaption",
"Action")
+ ":");
this.keyboardActionCombo =
new ComboWithEnableFix(keyComp,
SWT.DROP_DOWN | SWT.READ_ONLY);
for (int i = 0; i < KeyPressType.DISPLAY.length; i++) {
this.keyboardActionCombo.add(KeyPressType.DISPLAY[i].toString());
}
this.keyboardActionCombo.select(0);
this.keyboardActionCombo.addSelectionListener(this.deviceActionChange);
*/
SelectionListener insertSpecial = new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
Control source = (Control) e.getSource();
keyboardText.insert((String) source.getData());
Point selection = keyboardText.getSelection();
keyboardText.setFocus();
keyboardText.setSelection(selection);
}
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
};
// TODO: replace alignTo with this.keyboardActionCombo when the above TODO is done!
// can't assign using ?: because Java is stupid
Control alignTo;
if (vertical) {
alignTo = transitionDestinationNameKeyboard;
} else {
alignTo = keyboardText.getOuter();
}
keyboardSpecials = new KeyboardSpecialChars(alignTo, insertSpecial, vertical);
return keyComp;
}
use of org.eclipse.swt.widgets.Control in project cogtool by cogtool.
the class ProjectUI method cleanupTaskEditor.
/**
* Removes stale Text control and selection listener.
*/
protected void cleanupTaskEditor() {
// Remove and dispose the text box
Control oldEditor = editor.getEditor();
if (oldEditor != null) {
// We defer this disposal until the main event loop as otherwise
// we crash mysteriously in Leopard (OS X 10.5). The oldEditor
// is actually a subclass (suspect for SWT controls!), and my
// conjecture is that some method in the superclass is still
// depending upon the object not having been disposed at it is
// unwinding the stack. Anyway, this appears to fix the problem,
// and certainly should make the patient no worse.
WindowUtil.deferDisposal(oldEditor);
editor.setEditor(null);
setViewEnabledState(selection, ListenerIdentifierMap.NORMAL);
}
}
use of org.eclipse.swt.widgets.Control in project cogtool by cogtool.
the class DefaultSEUIModel method updateDeviceDisplay.
public void updateDeviceDisplay() {
if ((currentFrame != null) && (devicesFooter != null)) {
Control[] deviceLabels = devicesFooter.getChildren();
double midIndex = 0.5 * (deviceLabels.length - 1);
for (int i = 0; i < deviceLabels.length; i++) {
DeviceType deviceType = (DeviceType) deviceLabels[i].getData(DEVICE_TYPE_KEY);
if (deviceType != null) {
Frame currentFrameModel = currentFrame.getFrame();
InputDevice inputDevice = currentFrameModel.getInputDevice(deviceType);
String text = AbstractGraphicalSource.buildToolTipText(inputDevice, deviceType.toString());
text = KeyDisplayUtil.convertActionToMenuText(text);
deviceLabels[i].setToolTipText(" " + text + " ");
deviceLabels[i].setData(inputDevice);
FormData formData = new FormData();
formData.top = new FormAttachment(0, 0);
formData.bottom = new FormAttachment(100, 0);
formData.width = DesignUtil.DEVICE_WIDTH;
double ii = i;
if (ii == (midIndex - 0.5)) {
formData.right = new FormAttachment(50, -(DEVICE_MARGIN / 2));
} else if (ii < midIndex) {
formData.right = new FormAttachment(deviceLabels[i + 1], -DEVICE_MARGIN, SWT.LEFT);
} else if (ii == midIndex) {
formData.left = new FormAttachment(50, -(DesignUtil.DEVICE_WIDTH / 2));
} else if (ii == (midIndex + 0.5)) {
formData.left = new FormAttachment(50, DEVICE_MARGIN / 2);
} else {
// ii > midIndex
formData.left = new FormAttachment(deviceLabels[i - 1], DEVICE_MARGIN, SWT.RIGHT);
}
deviceLabels[i].setLayoutData(formData);
}
}
devicesFooter.layout();
}
}
use of org.eclipse.swt.widgets.Control in project cogtool by cogtool.
the class DictionaryEditorUI method cleanupEditor.
/**
* Removes stale Text control and selection listener.
*/
protected void cleanupEditor() {
// Remove and dispose the text box
Control oldEditor = editor.getEditor();
if (oldEditor != null) {
oldEditor.dispose();
editor.setEditor(null);
}
}
Aggregations