use of org.eclipse.swt.events.SelectionAdapter in project cogtool by cogtool.
the class ThreadProgressBar method addBelowBar.
@Override
protected void addBelowBar() {
FormData data = new FormData();
// at the top of the dialog box otherwise
if (statusLabel != null) {
data.top = new FormAttachment(statusLabel, 10, SWT.BOTTOM);
data.bottom = new FormAttachment(statusLabel, 25, SWT.BOTTOM);
} else {
data.top = new FormAttachment(0, 10);
data.bottom = new FormAttachment(0, 25);
}
data.left = new FormAttachment(0, 20);
data.right = new FormAttachment(100, -20);
bar.setLayoutData(data);
// box, tying it to the given cancelable "process" object.
if (cancelListener != null) {
cancelButton = new Button(shell, SWT.PUSH);
cancelButton.setText(L10N.get("B.Cancel", "Cancel"));
cancelButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent evt) {
// Called from the main UI thread
cancelListener.cancel();
cancelButton.setEnabled(false);
}
});
data = new FormData();
data.left = new FormAttachment(bar, 0, SWT.CENTER);
data.top = new FormAttachment(bar, 5, SWT.BOTTOM);
cancelButton.setLayoutData(data);
}
}
use of org.eclipse.swt.events.SelectionAdapter in project cogtool by cogtool.
the class ActionPropertySet method createEmptyComposite.
protected Composite createEmptyComposite() {
Composite c = new Composite(actionSettings, SWT.NONE);
c.setLayout(new FormLayout());
ListenerIdentifierMap lidMap = view.getLIDMap();
designNameLabel = new DisplayLabel(c, SWT.NONE);
designNameLabel.setText(nameLabel);
designName = new View.PerformActionText(c, SWT.SINGLE | SWT.BORDER) {
@Override
protected void onFocus() {
super.onFocus();
view.getTransmuter().setLIDEnabledState();
}
@Override
protected boolean doChangeAction() {
Design design = (Design) designName.getData();
DesignEditorUI.DesignRenameParameters parms = new DesignEditorUI.DesignRenameParameters(design, designName.getText());
boolean changed = view.performAction(ProjectLID.RenameDesign, parms, true);
if (!changed) {
designName.setText(design.getName());
}
return changed;
}
};
inputDevicesLabel = new DisplayLabel(c, SWT.NONE);
inputDevicesLabel.setText(L10N.get("APS.InputDevices", "Input Devices") + ":");
outputDevicesLabel = new DisplayLabel(c, SWT.NONE);
outputDevicesLabel.setText(L10N.get("APS.OutputDevices", "Output Devices") + ":");
for (int i = 0; i < DeviceType.DISPLAY_ORDER.length; i++) {
deviceButtons[i] = new Button(c, SWT.CHECK);
deviceButtons[i].setText(DeviceType.DISPLAY_ORDER[i].getName());
deviceButtons[i].setEnabled(false);
deviceButtons[i].setSelection(false);
}
addDevices = new Button(c, SWT.PUSH);
addDevices.setText(addDevicesLabel);
addDevices.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent evt) {
view.performAction(DesignEditorLID.AddDesignDevices);
}
});
lidMap.addWidget(DesignEditorLID.AddDesignDevices, addDevices, ListenerIdentifierMap.NORMAL);
skinLabel = new DisplayLabel(c, SWT.NONE);
skinLabel.setText(DESIGN_SKIN);
skinCombo = new ComboWithEnableFix(c, SWT.DROP_DOWN | SWT.READ_ONLY);
for (int i = 1; i < SkinType.DISPLAY.length - 1; i++) {
// Don't allow None or Palm
skinCombo.add(SkinType.DISPLAY[i].getName());
}
skinCombo.select(0);
skinCombo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent evt) {
switch(skinCombo.getSelectionIndex()) {
case 0:
default:
{
view.performAction(DesignEditorLID.SkinWireFrame);
break;
}
case 1:
{
view.performAction(DesignEditorLID.SkinMacOSX);
break;
}
case 2:
{
view.performAction(DesignEditorLID.SkinWinXP);
break;
}
}
}
});
frameTreeLabel = new DisplayLabel(c, SWT.NONE);
frameTreeLabel.setText(FRAMES);
frameTree = new Tree(c, SWT.SINGLE | SWT.FULL_SELECTION | SWT.BORDER);
frameTree.setLinesVisible(true);
updater = new TreeItemUpdater.FrameItemUpdater(frameTree);
return c;
}
use of org.eclipse.swt.events.SelectionAdapter in project cogtool by cogtool.
the class ActionPropertySet method layoutHelper.
@Override
public void layoutHelper() {
actionSettings = new Composite(parent, SWT.BORDER);
actionSettings.setLayout(actionSettingsLayout);
propLabel = new Label(parent, SWT.CENTER);
propLabel.setText(designPropertiesLabel);
Font labelFont = FontUtils.getAdjustedFont(propLabel.getFont(), SWT.BOLD);
propLabel.setFont(labelFont);
actionType = new DisplayLabel(parent, SWT.NONE);
actionType.setText(actionTypeLabel);
actionChoices = new ComboWithEnableFix(parent, SWT.DROP_DOWN | SWT.READ_ONLY);
actionChoices.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent evt) {
int currentSelection = actionChoices.getSelectionIndex();
if (currentSelection != chosenActionType) {
editTransitionParms.useWhichParts = choiceUseIndexes[currentSelection];
chosenActionType = currentSelection;
view.performAction(DesignEditorLID.EditTransition, editTransitionParms, true);
}
}
});
delayLabelLabel = new DisplayLabel(parent, SWT.NONE);
delayLabelLabel.setText(DELAY_LABEL_LABEL);
delayLabel = new View.PerformActionText(parent, SWT.SINGLE | SWT.BORDER) {
@Override
protected void onFocus() {
super.onFocus();
view.getTransmuter().setLIDEnabledState();
}
@Override
protected boolean doChangeAction() {
Point labelSelection = getSelection();
if ("".equals(getText())) {
setText(TransitionDelay.DEFAULT_DELAY_LABEL);
labelSelection = null;
}
if (view.performAction(DesignEditorLID.ChangeDelay)) {
if (labelSelection != null) {
setSelection(labelSelection);
}
return true;
}
return false;
}
};
delayInSecsLabel = new DisplayLabel(parent, SWT.NONE);
delayInSecsLabel.setText(DELAY_DURATION_LABEL + ":");
secondsUnit = new Label(parent, SWT.NONE);
secondsUnit.setText(SECONDS);
delayInSecs = new View.PerformActionDouble(parent, SWT.SINGLE | SWT.BORDER) {
@Override
protected void onFocus() {
super.onFocus();
view.getTransmuter().setLIDEnabledState();
}
@Override
protected void onModify() {
super.onModify();
delayLabel.setEnabled(getDoubleValue() > 0.0);
}
@Override
protected boolean doChangeAction() {
Point delaySelection = getSelection();
if (getDoubleValue() == 0.0) {
setText("");
delaySelection = null;
}
if (view.performAction(DesignEditorLID.ChangeDelay)) {
if (delaySelection != null) {
setSelection(delaySelection);
}
return true;
}
return false;
}
};
delayInSecs.setAllowNegative(false);
delayInSecs.setDecimalPlaces(3);
delayInSecs.moveAbove(delayLabel.getOuter());
FormData data = new FormData();
data.left = leftAttachment;
data.right = new FormAttachment(100, -5);
propLabel.setLayoutData(data);
data = new FormData();
data.left = leftAttachment;
data.top = new FormAttachment(actionChoices, 0, SWT.CENTER);
actionType.setLayoutData(data);
data = new FormData();
data.left = new FormAttachment(actionType, 5, SWT.RIGHT);
data.right = new FormAttachment(100, -5);
data.top = new FormAttachment(propLabel, 5, SWT.BOTTOM);
actionChoices.setLayoutData(data);
data = new FormData();
data.left = leftAttachment;
data.top = new FormAttachment(actionChoices, 5, SWT.BOTTOM);
data.right = new FormAttachment(100, -5);
actionSettings.setLayoutData(data);
data = new FormData();
data.left = leftAttachment;
data.top = new FormAttachment(actionSettings, 5, SWT.BOTTOM);
delayInSecsLabel.setLayoutData(data);
data = new FormData();
data.left = leftAttachment;
data.top = new FormAttachment(delayInSecsLabel, 5, SWT.BOTTOM);
data.width = 100;
delayInSecs.setLayoutData(data);
data = new FormData();
data.left = new FormAttachment(delayInSecs.getOuter(), 5, SWT.RIGHT);
data.top = new FormAttachment(delayInSecs.getOuter(), 0, SWT.CENTER);
secondsUnit.setLayoutData(data);
data = new FormData();
data.left = leftAttachment;
data.top = new FormAttachment(delayInSecs.getOuter(), 5, SWT.BOTTOM);
delayLabelLabel.setLayoutData(data);
data = new FormData();
data.left = leftAttachment;
data.top = new FormAttachment(delayLabelLabel, 5, SWT.BOTTOM);
data.right = new FormAttachment(100, -5);
delayLabel.setLayoutData(data);
emptyParms = createEmptyComposite();
layOutEmptyComposite();
multTransParms = new Composite(actionSettings, SWT.NONE);
multTransParms.setLayout(new FormLayout());
Label multTransLabel = new Label(multTransParms, SWT.WRAP);
multTransLabel.setText(noActionAvailableText);
data = new FormData();
data.left = leftAttachment;
data.top = new FormAttachment(0, 5);
data.right = new FormAttachment(100, -5);
multTransLabel.setLayoutData(data);
frameParms = createFrameComposite();
}
use of org.eclipse.swt.events.SelectionAdapter in project cogtool by cogtool.
the class StoppableProgressBar method addBelowBar.
@Override
protected void addBelowBar() {
super.addBelowBar();
// box, tying it to the given pausable "process" object.
if (stopListener != null) {
stopButton = new Button(shell, SWT.PUSH);
stopButton.setText(STOP_LABEL);
stopButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent evt) {
stopListener.stop();
stopButton.setEnabled(false);
}
});
FormData data = new FormData();
// Replace positioning for cancelButton if present
if (cancelButton != null) {
data.left = new FormAttachment(50, 3);
data.top = new FormAttachment(bar, 5, SWT.BOTTOM);
cancelButton.setLayoutData(data);
data = new FormData();
data.right = new FormAttachment(50, -3);
data.top = new FormAttachment(bar, 5, SWT.BOTTOM);
} else {
data.left = new FormAttachment(bar, 0, SWT.CENTER);
data.top = new FormAttachment(bar, 5, SWT.BOTTOM);
}
stopButton.setLayoutData(data);
}
}
use of org.eclipse.swt.events.SelectionAdapter in project otertool by wuntee.
the class LoadApkFromDeviceDialog method createContents.
/**
* Create contents of the dialog.
*/
private void createContents() {
shlSelectApk = new Shell(getParent(), SWT.DIALOG_TRIM | SWT.RESIZE);
shlSelectApk.setSize(592, 486);
shlSelectApk.setText("Select APK");
shlSelectApk.setLayout(new GridLayout(1, false));
table = new Table(shlSelectApk, SWT.BORDER | SWT.FULL_SELECTION);
table.addMouseListener(new MouseAdapter() {
@Override
public void mouseDoubleClick(MouseEvent arg0) {
result = (PackageBean) table.getSelection()[0].getData(PACKAGE_BEAN);
shlSelectApk.close();
}
});
table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
table.setBounds(0, 0, 3, 19);
table.setHeaderVisible(true);
table.setLinesVisible(true);
final TableColumn tblclmnApk = new TableColumn(table, SWT.NONE);
tblclmnApk.setWidth(240);
tblclmnApk.setText("APK");
final TableColumn tblclmnPackage = new TableColumn(table, SWT.NONE);
tblclmnPackage.setWidth(338);
tblclmnPackage.setText("Package");
final String[] keys = { PACKAGE_BEAN };
GuiWorkshop.addColumnSorter(table, tblclmnApk, 0, keys);
GuiWorkshop.addColumnSorter(table, tblclmnPackage, 1, keys);
Composite composite = new Composite(shlSelectApk, SWT.NONE);
composite.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
composite.setBounds(0, 0, 64, 64);
GridLayout gl_composite = new GridLayout(2, false);
gl_composite.verticalSpacing = 0;
gl_composite.marginWidth = 0;
gl_composite.marginHeight = 0;
gl_composite.horizontalSpacing = 0;
composite.setLayout(gl_composite);
Button btnLoad = new Button(composite, SWT.NONE);
btnLoad.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent arg0) {
if (table.getSelection().length == 0) {
GuiWorkshop.messageError(shlSelectApk, "Please Select an APK to load.");
} else {
result = (PackageBean) table.getSelection()[0].getData(PACKAGE_BEAN);
shlSelectApk.close();
}
}
});
btnLoad.setText("Load");
Button btnCancel = new Button(composite, SWT.NONE);
btnCancel.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent arg0) {
result = null;
shlSelectApk.close();
}
});
btnCancel.setText("Cancel");
}
Aggregations