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);
}
}
use of org.eclipse.swt.widgets.Control in project tdi-studio-se by Talend.
the class MapperManager method addOutput.
/**
* DOC amaumont Comment method "addOutput".
*/
public void addOutput() {
String tableName = uiManager.openNewOutputCreationDialog();
if (tableName == null) {
return;
}
IProcess process = mapperComponent.getProcess();
//$NON-NLS-1$
String uniqueName = process.generateUniqueConnectionName("table");
process.addUniqueConnectionName(uniqueName);
MetadataTable metadataTable = new MetadataTable();
metadataTable.setTableName(uniqueName);
// metadataTable.setId(uniqueName);
metadataTable.setLabel(tableName);
List<DataMapTableView> outputsTablesView = getUiManager().getOutputsTablesView();
int sizeOutputsView = outputsTablesView.size();
Control lastChild = null;
if (sizeOutputsView - 1 >= 0) {
lastChild = outputsTablesView.get(sizeOutputsView - 1);
}
IDataMapTable abstractDataMapTable = new OutputTable(this, metadataTable, uniqueName, tableName);
TablesZoneView tablesZoneViewOutputs = uiManager.getTablesZoneViewOutputs();
DataMapTableView dataMapTableView = uiManager.createNewOutputTableView(lastChild, abstractDataMapTable, tablesZoneViewOutputs);
tablesZoneViewOutputs.setSize(tablesZoneViewOutputs.computeSize(SWT.DEFAULT, SWT.DEFAULT));
tablesZoneViewOutputs.layout();
uiManager.moveOutputScrollBarZoneToMax();
uiManager.refreshBackground(true, false);
tablesZoneViewOutputs.layout();
uiManager.selectDataMapTableView(dataMapTableView, true, false);
}
Aggregations