use of org.eclipse.swt.events.SelectionAdapter in project translationstudio8 by heartsome.
the class BrowserViewPart method createSearchArea.
private Composite createSearchArea(Composite parent) {
GridLayout gridLayout = new GridLayout(3, false);
parent.setLayout(gridLayout);
GridData gd_seachArea = new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1);
parent.setLayoutData(gd_seachArea);
keyWordForSearch = new Text(parent, SWT.SEARCH);
GridData gd_keyWordForSearch = new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1);
gd_keyWordForSearch.heightHint = 20;
keyWordForSearch.setLayoutData(gd_keyWordForSearch);
keyWordForSearch.setText("");
font = keyWordForSearch.getFont();
FontData fontData = font.getFontData()[0];
fontData.setStyle(fontData.getStyle());
fontData.setHeight(12);
font = new Font(Display.getDefault(), fontData);
keyWordForSearch.setFont(font);
keyWordForSearch.addKeyListener(new KeyListener() {
@Override
public void keyReleased(KeyEvent e) {
// TODO Auto-generated method stub
}
@Override
public void keyPressed(KeyEvent e) {
// TODO Auto-generated method stub
if (e.keyCode == SWT.CR || e.keyCode == SWT.LF) {
refreshKeyWordSearch(true);
}
}
});
Button searchBtn = new Button(parent, SWT.NONE);
searchBtn.setText(Messages.getString("Websearch.browserViewPart.searchBtnLbl"));
searchBtn.setLayoutData(new GridData(GridData.FILL_VERTICAL));
searchBtn.addSelectionListener(new SelectionAdapter() {
/**
* (non-Javadoc)
* @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
*/
@Override
public void widgetSelected(SelectionEvent e) {
refreshKeyWordSearch(true);
}
});
Button settingBtn = new Button(parent, SWT.NONE);
settingBtn.setText(Messages.getString("Websearch.browserViewPart.settingBtnLbl"));
settingBtn.setLayoutData(new GridData(GridData.FILL_VERTICAL));
settingBtn.addSelectionListener(new SelectionAdapter() {
/**
* (non-Javadoc)
* @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
*/
@Override
public void widgetSelected(SelectionEvent e) {
PreferenceUtil.openPreferenceDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow(), WebSearchPreferencePage.ID);
}
});
return parent;
}
use of org.eclipse.swt.events.SelectionAdapter in project translationstudio8 by heartsome.
the class WebSearchPreferencePage method installListeners.
private void installListeners() {
checkboxTableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
updateState();
}
});
upItemBtn.addSelectionListener(new SelectionAdapter() {
/**
* (non-Javadoc)
* @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
*/
@Override
public void widgetSelected(SelectionEvent e) {
upSelectItem();
}
});
downItemBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
downSelectItem();
}
});
deleteItemBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
deleteSelectItem();
}
});
addItemBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
addItem();
}
});
editItemBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
editItem();
}
});
importItemsBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
importConfig();
}
});
exportItemsBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
exportConfig();
}
});
}
use of org.eclipse.swt.events.SelectionAdapter in project translationstudio8 by heartsome.
the class WorkingSetRootModeActionGroup method addActions.
/**
* Adds the actions to the given menu manager.
*/
protected void addActions(IMenuManager viewMenu) {
if (actions == null)
actions = createActions();
viewMenu.add(new Separator());
items = new MenuItem[actions.length];
for (int i = 0; i < actions.length; i++) {
final int j = i;
viewMenu.add(new ContributionItem() {
public void fill(Menu menu, int index) {
int style = SWT.CHECK;
if ((actions[j].getStyle() & IAction.AS_RADIO_BUTTON) != 0)
style = SWT.RADIO;
final MenuItem mi = new MenuItem(menu, style, index);
items[j] = mi;
mi.setText(actions[j].getText());
mi.setSelection(currentSelection == j);
mi.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
if (currentSelection == j) {
items[currentSelection].setSelection(true);
return;
}
actions[j].run();
// Update checked state
items[currentSelection].setSelection(false);
currentSelection = j;
items[currentSelection].setSelection(true);
}
});
}
public boolean isDynamic() {
return false;
}
});
}
}
use of org.eclipse.swt.events.SelectionAdapter in project translationstudio8 by heartsome.
the class LicenseAgreementDialog method createDialogArea.
@Override
protected Control createDialogArea(Composite parent) {
Composite tparent = (Composite) super.createDialogArea(parent);
GridLayout layout = new GridLayout();
layout.marginTop = 5;
layout.marginWidth = 10;
tparent.setLayout(layout);
GridData parentData = new GridData(SWT.FILL, SWT.FILL, true, true);
parentData.heightHint = 380;
tparent.setLayoutData(parentData);
Label lbl = new Label(tparent, SWT.NONE);
lbl.setText(Messages.getString("license.LicenseAgreementDialog.label"));
lbl.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
Text text = new Text(tparent, SWT.MULTI | SWT.WRAP | SWT.V_SCROLL);
text.setEditable(false);
text.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
text.setText(Messages.getString("license.LicenseAgreementDialog.agreement"));
GridData textData = new GridData(GridData.FILL_BOTH);
text.setLayoutData(textData);
agreeBtn = new Button(tparent, SWT.CHECK);
agreeBtn.setText(Messages.getString("license.LicenseAgreementDialog.agreeBtn"));
agreeBtn.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
agreeBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
getButton(IDialogConstants.OK_ID).setEnabled(agreeBtn.getSelection());
}
});
return super.createDialogArea(parent);
}
use of org.eclipse.swt.events.SelectionAdapter in project translationstudio8 by heartsome.
the class LicenseManageDialog method createStatusComp.
private void createStatusComp(Composite parent) {
Group statusGroup = new Group(parent, SWT.NONE);
statusGroup.setText(Messages.getString("license.LicenseManageDialog.statusGroup"));
GridData dataStatusGroup = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL);
dataStatusGroup.heightHint = 150;
statusGroup.setLayoutData(dataStatusGroup);
statusGroup.setLayout(new GridLayout());
GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL);
RowLayout layout = new RowLayout();
layout.center = true;
Composite comp0 = new Composite(statusGroup, SWT.NONE);
comp0.setLayoutData(data);
comp0.setLayout(layout);
Label statusLbl = new Label(comp0, SWT.NONE);
statusLbl.setText(Messages.getString("license.LicenseManageDialog.statusLabel"));
if (type == Constants.STATE_NOT_ACTIVATED) {
Label statusLbl1 = new Label(comp0, SWT.NONE);
statusLbl1.setText(Messages.getString("license.LicenseManageDialog.notActiveLabel"));
} else if (type == Constants.STATE_VALID) {
Label statusLbl1 = new Label(comp0, SWT.NONE);
statusLbl1.setText(Messages.getString("license.LicenseManageDialog.activeLabel"));
new Label(comp0, SWT.NONE).setLayoutData(new RowData(30, SWT.DEFAULT));
Button btnCancelActive = new Button(comp0, SWT.NONE);
btnCancelActive.setText(Messages.getString("license.LicenseManageDialog.cancelActiveButton"));
btnCancelActive.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
boolean result = MessageDialog.openConfirm(getShell(), Messages.getString("license.LicenseManageDialog.confirm"), Messages.getString("license.LicenseManageDialog.confirmMessage"));
if (result) {
try {
int re = ServiceUtil.cancel();
if (re == Constants.LOGOUT_SUCCESS) {
MessageDialog.openInformation(getShell(), Messages.getString("license.LicenseManageDialog.notice"), Messages.getString("license.LicenseManageDialog.unactiveSuccess"));
LicenseManageDialog.this.close();
PlatformUI.getWorkbench().restart();
} else {
MessageDialog.openInformation(getShell(), Messages.getString("license.LicenseManageDialog.notice"), Messages.getString("license.LicenseManageDialog.unactiveFail"));
}
} catch (Exception e1) {
e1.printStackTrace();
Throwable t = e1;
while (t.getCause() != null) {
t = t.getCause();
}
if (t instanceof java.security.cert.CertificateException) {
MessageDialog.openInformation(getShell(), Messages.getString("license.LicenseManageDialog.titleNet"), MessageFormat.format(Messages.getString("license.LicenseManageDialog.infoNet"), Constants.EXCEPTION_STRING16));
} else {
MessageDialog.openInformation(getShell(), Messages.getString("license.LicenseManageDialog.titleNet"), MessageFormat.format(Messages.getString("license.LicenseManageDialog.infoNet"), Constants.EXCEPTION_STRING17));
}
}
}
}
});
Composite comp1 = new Composite(statusGroup, SWT.NONE);
comp1.setLayoutData(data);
comp1.setLayout(layout);
Label typeLbl = new Label(comp1, SWT.NONE);
typeLbl.setText(Messages.getString("license.LicenseManageDialog.typeLabel"));
Label typeLbl1 = new Label(comp1, SWT.NONE);
typeLbl1.setText(Messages.getString(utilDate == null ? "license.LicenseManageDialog.typeBusiness" : "license.LicenseManageDialog.typeTemp"));
if (utilDate != null) {
Composite comp2 = new Composite(statusGroup, SWT.NONE);
comp2.setLayoutData(data);
comp2.setLayout(layout);
Label typeLbl2 = new Label(comp2, SWT.NONE);
typeLbl2.setText(Messages.getString("license.LicenseManageDialog.utilDate"));
Label dateLbl = new Label(comp2, SWT.NONE);
dateLbl.setText(utilDate);
}
} else if (type == Constants.STATE_INVALID) {
Label statusLbl1 = new Label(comp0, SWT.NONE);
statusLbl1.setText(Messages.getString("license.LicenseManageDialog.invalidLicense"));
} else if (type == Constants.STATE_EXPIRED) {
Label statusLbl1 = new Label(comp0, SWT.NONE);
statusLbl1.setText(Messages.getString("license.LicenseManageDialog.expired"));
Composite comp1 = new Composite(statusGroup, SWT.NONE);
comp1.setLayoutData(data);
comp1.setLayout(layout);
Label typeLbl = new Label(comp1, SWT.NONE);
typeLbl.setText(Messages.getString("license.LicenseManageDialog.typeLabel"));
Label typeLbl1 = new Label(comp1, SWT.NONE);
typeLbl1.setText(Messages.getString(utilDate == null ? "license.LicenseManageDialog.typeBusiness" : "license.LicenseManageDialog.typeTemp"));
if (utilDate != null) {
Composite comp2 = new Composite(statusGroup, SWT.NONE);
comp2.setLayoutData(data);
comp2.setLayout(layout);
Label typeLbl2 = new Label(comp2, SWT.NONE);
typeLbl2.setText(Messages.getString("license.LicenseManageDialog.utilDate"));
Label dateLbl = new Label(comp2, SWT.NONE);
dateLbl.setText(utilDate);
}
} else if (type == Constants.EXCEPTION_INT16 || type == Constants.EXCEPTION_INT17) {
Label statusLbl1 = new Label(comp0, SWT.NONE);
statusLbl1.setText(Messages.getString("license.LicenseManageDialog.unvalidate"));
Composite comp1 = new Composite(statusGroup, SWT.NONE);
GridData data1 = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_BOTH);
comp1.setLayoutData(data1);
GridLayout layout1 = new GridLayout();
comp1.setLayout(layout1);
Label noticeLbl = new Label(comp1, SWT.WRAP);
GridData dataLabel = new GridData(GridData.FILL_HORIZONTAL);
noticeLbl.setLayoutData(dataLabel);
noticeLbl.setText(MessageFormat.format(Messages.getString("license.LicenseManageDialog.noticeLbl"), StringUtils.getErrorCode(type)));
} else if (type == Constants.EXCEPTION_INT14) {
Label statusLbl1 = new Label(comp0, SWT.NONE);
statusLbl1.setText(Messages.getString("license.LicenseManageDialog.licenseException"));
Composite comp1 = new Composite(statusGroup, SWT.NONE);
GridData data1 = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_BOTH);
comp1.setLayoutData(data1);
GridLayout layout1 = new GridLayout();
comp1.setLayout(layout1);
Label noticeLbl = new Label(comp1, SWT.WRAP);
GridData dataLabel = new GridData(GridData.FILL_HORIZONTAL);
noticeLbl.setLayoutData(dataLabel);
noticeLbl.setText(MessageFormat.format(Messages.getString("license.LicenseManageDialog.noSameVersion"), getVersionContent(System.getProperty("TSEdition")), getVersionContent(new LicenseIdGenerator(licenseId).getVersion())));
} else if (type == Constants.EXCEPTION_INT15) {
Label statusLbl1 = new Label(comp0, SWT.NONE);
statusLbl1.setText(Messages.getString("license.LicenseManageDialog.licenseException"));
Composite comp1 = new Composite(statusGroup, SWT.NONE);
GridData data1 = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_BOTH);
comp1.setLayoutData(data1);
GridLayout layout1 = new GridLayout();
comp1.setLayout(layout1);
Label noticeLbl = new Label(comp1, SWT.WRAP);
GridData dataLabel = new GridData(GridData.FILL_HORIZONTAL);
noticeLbl.setLayoutData(dataLabel);
noticeLbl.setText(Messages.getString("license.LicenseManageDialog.maccodeError"));
} else if (type == Constants.EXCEPTION_INT1 || type == Constants.EXCEPTION_INT2 || type == Constants.EXCEPTION_INT3 || type == Constants.EXCEPTION_INT4) {
Label statusLbl1 = new Label(comp0, SWT.NONE);
statusLbl1.setText(Messages.getString("license.LicenseManageDialog.licenseException"));
Composite comp1 = new Composite(statusGroup, SWT.NONE);
GridData data1 = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_BOTH);
comp1.setLayoutData(data1);
GridLayout layout1 = new GridLayout();
comp1.setLayout(layout1);
Label noticeLbl = new Label(comp1, SWT.WRAP);
GridData dataLabel = new GridData(GridData.FILL_HORIZONTAL);
noticeLbl.setLayoutData(dataLabel);
noticeLbl.setText(MessageFormat.format(Messages.getString("license.LicenseManageDialog.licenseExceptionInfo1"), StringUtils.getErrorCode(type)));
} else {
Label statusLbl1 = new Label(comp0, SWT.NONE);
statusLbl1.setText(Messages.getString("license.LicenseManageDialog.licenseException"));
Composite comp1 = new Composite(statusGroup, SWT.NONE);
GridData data1 = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_BOTH);
comp1.setLayoutData(data1);
GridLayout layout1 = new GridLayout();
comp1.setLayout(layout1);
Label noticeLbl = new Label(comp1, SWT.WRAP);
GridData dataLabel = new GridData(GridData.FILL_HORIZONTAL);
noticeLbl.setLayoutData(dataLabel);
noticeLbl.setText(MessageFormat.format(Messages.getString("license.LicenseManageDialog.licenseExceptionInfo"), StringUtils.getErrorCode(type)));
}
}
Aggregations