use of org.eclipse.swt.events.SelectionAdapter in project translationstudio8 by heartsome.
the class LicenseManageDialog method createButtonsForButtonBar.
@Override
protected void createButtonsForButtonBar(Composite parent) {
if (isShowBack) {
Button backBtn = createButton(parent, IDialogConstants.BACK_ID, Messages.getString("license.OfflineActiveDialog.backBtn"), false);
backBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
setReturnCode(OK);
Point p = getShell().getLocation();
close();
ActiveMethodDialog dialog = new ActiveMethodDialog(getShell(), p);
int result = dialog.open();
if (result != IDialogConstants.OK_ID) {
System.exit(0);
}
}
});
}
Button button = createButton(parent, 11, Messages.getString("license.LicenseManageDialog.netconnection"), false);
button.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
PreferenceManager mgr = window.getWorkbench().getPreferenceManager();
IPreferenceNode node = null;
@SuppressWarnings("unchecked") List<IPreferenceNode> lstNodes = mgr.getElements(PreferenceManager.PRE_ORDER);
for (IPreferenceNode n : lstNodes) {
if (n.getId().equals("org.eclipse.ui.net.proxy_preference_page_context")) {
node = n;
}
}
if (node == null) {
return;
}
mgr = new PreferenceManager();
mgr.addToRoot(node);
HsPreferenceDialog dlg = new HsPreferenceDialog(window.getShell(), mgr);
dlg.create();
final List<Image> imageList = new ArrayList<Image>();
dlg.getTreeViewer().setLabelProvider(new PreferenceLabelProvider() {
Image image = null;
public Image getImage(Object element) {
String id = ((IPreferenceNode) element).getId();
if ("org.eclipse.ui.net.proxy_preference_page_context".equals(id)) {
// 网络连接
image = Activator.getImageDescriptor("icons/network.png").createImage();
imageList.add(image);
return image;
} else {
return null;
}
}
});
dlg.open();
for (Image img : imageList) {
if (img != null && !img.isDisposed()) {
img.dispose();
}
}
imageList.clear();
}
});
boolean isDefault = false;
if (type == Constants.STATE_NOT_ACTIVATED || type == Constants.STATE_INVALID || type == Constants.STATE_EXPIRED || type == Constants.EXCEPTION_INT14 || type == Constants.EXCEPTION_INT15 || type == Constants.EXCEPTION_INT1 || type == Constants.EXCEPTION_INT2 || type == Constants.EXCEPTION_INT3 || type == Constants.EXCEPTION_INT4) {
createButton(parent, IDialogConstants.OK_ID, Messages.getString("license.LicenseManageDialog.activeBtn"), true);
isDefault = true;
}
createButton(parent, IDialogConstants.CANCEL_ID, Messages.getString("license.LicenseManageDialog.exitBtn"), !isDefault).setFocus();
}
use of org.eclipse.swt.events.SelectionAdapter in project translationstudio8 by heartsome.
the class OfflineActiveDialog method createButtonsForButtonBar.
@Override
protected void createButtonsForButtonBar(Composite parent) {
Button backBtn = createButton(parent, IDialogConstants.BACK_ID, Messages.getString("license.OfflineActiveDialog.backBtn"), false);
backBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
setReturnCode(OK);
Point p = getShell().getLocation();
close();
ActiveMethodDialog dialog = new ActiveMethodDialog(getShell(), p);
int result = dialog.open();
if (result != IDialogConstants.OK_ID) {
System.exit(0);
}
}
});
super.createButtonsForButtonBar(parent);
Button nextBtn = getButton(IDialogConstants.OK_ID);
nextBtn.setText(Messages.getString("license.LicenseAgreementDialog.nextBtn"));
Button exitBtn = getButton(IDialogConstants.CANCEL_ID);
exitBtn.setText(Messages.getString("license.LicenseAgreementDialog.exitBtn"));
}
use of org.eclipse.swt.events.SelectionAdapter in project translationstudio8 by heartsome.
the class ActiveMethodDialog method createDialogArea.
@Override
protected Control createDialogArea(Composite parent) {
Composite tparent = (Composite) super.createDialogArea(parent);
GridLayout layout = new GridLayout();
layout.marginWidth = 10;
layout.marginTop = 5;
tparent.setLayout(layout);
GridDataFactory.fillDefaults().grab(true, true).applyTo(tparent);
Group groupActiveMethod = new Group(tparent, SWT.NONE);
groupActiveMethod.setText(Messages.getString("license.ActiveMethodDialog.activemethod"));
GridLayout groupLayout = new GridLayout();
groupLayout.marginWidth = 20;
groupLayout.marginHeight = 20;
groupLayout.verticalSpacing = 10;
groupLayout.numColumns = 2;
groupActiveMethod.setLayout(groupLayout);
GridDataFactory.fillDefaults().grab(true, true).applyTo(groupActiveMethod);
Button btnOnline = new Button(groupActiveMethod, SWT.NONE);
GridData btnData = new GridData();
btnData.widthHint = 200;
btnData.heightHint = 40;
btnOnline.setLayoutData(btnData);
btnOnline.setText(Messages.getString("license.ActiveMethodDialog.activeonline"));
btnOnline.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
setReturnCode(OK);
Point p = getShell().getLocation();
close();
LicenseManageDialog dialog = new LicenseManageDialog(getShell(), Constants.STATE_NOT_ACTIVATED, null, null, true, p);
int result = dialog.open();
if (result != IDialogConstants.OK_ID) {
System.exit(0);
}
}
});
Label labelRecommend = new Label(groupActiveMethod, SWT.NONE);
labelRecommend.setText(Messages.getString("license.ActiveMethodDialog.recommend"));
Label labelOnline = new Label(groupActiveMethod, SWT.WRAP);
labelOnline.setText(Messages.getString("license.ActiveMethodDialog.onlinemessage"));
GridData dataLabel = new GridData();
dataLabel.horizontalSpan = 2;
dataLabel.widthHint = 450;
labelOnline.setLayoutData(dataLabel);
Label labelSpace = new Label(groupActiveMethod, SWT.NONE);
GridData dataSpace = new GridData();
dataSpace.horizontalSpan = 2;
dataSpace.heightHint = 20;
labelSpace.setLayoutData(dataSpace);
Button btnOffline = new Button(groupActiveMethod, SWT.NONE);
GridData btnData1 = new GridData();
btnData1.widthHint = 200;
btnData1.heightHint = 40;
btnData1.horizontalSpan = 2;
btnOffline.setLayoutData(btnData1);
btnOffline.setText(Messages.getString("license.ActiveMethodDialog.activeoffline"));
btnOffline.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
setReturnCode(OK);
Point p = getShell().getLocation();
close();
OfflineActiveDialog dialog = new OfflineActiveDialog(getShell(), p);
int result = dialog.open();
if (result != IDialogConstants.OK_ID) {
System.exit(0);
}
}
});
Label labelOffline = new Label(groupActiveMethod, SWT.WRAP);
labelOffline.setText(Messages.getString("license.ActiveMethodDialog.offlinemessage"));
labelOffline.setLayoutData(dataLabel);
Label labelOffline1 = new Label(groupActiveMethod, SWT.WRAP);
labelOffline1.setText(Messages.getString("license.ActiveMethodDialog.offlinemessage1"));
GridData dataLabel1 = new GridData();
dataLabel1.horizontalSpan = 2;
dataLabel1.widthHint = 450;
labelOffline1.setLayoutData(dataLabel1);
return super.createDialogArea(parent);
}
use of org.eclipse.swt.events.SelectionAdapter in project translationstudio8 by heartsome.
the class CustomMessageDialog method createButtonsForButtonBar.
@Override
protected void createButtonsForButtonBar(Composite parent) {
Button btnDownload = createButton(parent, -1, Messages.getString("license.CustomMessageDialog.download"), false);
btnDownload.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
Program.launch(MessageFormat.format(Messages.getString("license.CustomMessageDialog.urlDownload"), ProtectionFactory.getProduct(editionInput), ProtectionFactory.getPlatform(), ProtectionFactory.getVersion()));
}
});
if (!"L".equals(System.getProperty("TSEdition"))) {
Button btnBuy = createButton(parent, -1, Messages.getString("license.LicenseManageDialog.link1"), false);
btnBuy.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
Program.launch(Messages.getString("license.LicenseManageDialog.urlr8buy") + "&PRODUCT=" + ProtectionFactory.getProduct() + "&PLATFORM=" + ProtectionFactory.getPlatform());
}
});
}
Button btnTrial = createButton(parent, -1, Messages.getString("license.LicenseManageDialog.link2"), false);
btnTrial.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
Program.launch(Messages.getString("license.LicenseManageDialog.urlr8trial") + "&PRODUCT=" + ProtectionFactory.getProduct() + "&PLATFORM=" + ProtectionFactory.getPlatform());
}
});
createButton(parent, IDialogConstants.OK_ID, Messages.getString("license.CustomMessageDialog.inputAgain"), true).setFocus();
}
use of org.eclipse.swt.events.SelectionAdapter in project translationstudio8 by heartsome.
the class GetActiveKeyDialog method createDialogArea.
@Override
protected Control createDialogArea(Composite parent) {
Composite tparent = (Composite) super.createDialogArea(parent);
GridLayout layout = new GridLayout();
layout.marginWidth = 10;
layout.marginTop = 10;
tparent.setLayout(layout);
GridDataFactory.fillDefaults().grab(true, true).applyTo(tparent);
Composite compNav = new Composite(tparent, SWT.NONE);
GridLayout navLayout = new GridLayout();
compNav.setLayout(navLayout);
createNavigation(compNav);
Group groupActivekey = new Group(tparent, SWT.NONE);
groupActivekey.setText(Messages.getString("license.GetActiveKeyDialog.activekey"));
GridDataFactory.fillDefaults().grab(true, true).applyTo(groupActivekey);
GridLayout layoutGroup = new GridLayout(2, false);
layoutGroup.marginWidth = 5;
layoutGroup.marginHeight = 20;
groupActivekey.setLayout(layoutGroup);
StyledText text = new StyledText(groupActivekey, SWT.WRAP | SWT.READ_ONLY);
text.setBackground(text.getParent().getBackground());
text.setText(Messages.getString("license.GetActiveKeyDialog.activemessage"));
GridData dataText = new GridData();
dataText.horizontalSpan = 2;
dataText.widthHint = 470;
text.setLayoutData(dataText);
int start = Messages.getString("license.GetActiveKeyDialog.activemessage").indexOf(Messages.getString("license.GetActiveKeyDialog.ts"));
int length = Messages.getString("license.GetActiveKeyDialog.ts").length();
StyleRange styleRange = new StyleRange();
styleRange.start = start;
styleRange.length = length;
styleRange.fontStyle = SWT.BOLD;
styleRange.foreground = Display.getDefault().getSystemColor(SWT.COLOR_BLUE);
text.setStyleRange(styleRange);
Label label = new Label(groupActivekey, SWT.WRAP | SWT.NONE);
label.setText(Messages.getString("license.GetActiveKeyDialog.activemessage1"));
GridDataFactory.fillDefaults().span(2, 1).applyTo(label);
textActivekey = new Text(groupActivekey, SWT.MULTI | SWT.WRAP);
textActivekey.setEditable(false);
textActivekey.setText(activekey);
textActivekey.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
GridDataFactory.fillDefaults().grab(true, false).hint(SWT.DEFAULT, 150).applyTo(textActivekey);
Button btnCopy = new Button(groupActivekey, SWT.NONE);
GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.END).applyTo(btnCopy);
btnCopy.setImage(Activator.getImageDescriptor("images/help/copy.png").createImage());
btnCopy.setToolTipText(Messages.getString("license.GetActiveKeyDialog.copytoclipboard"));
btnCopy.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
Clipboard cb = new Clipboard(Display.getCurrent());
String textData = textActivekey.getText();
TextTransfer textTransfer = TextTransfer.getInstance();
cb.setContents(new Object[] { textData }, new Transfer[] { textTransfer });
}
});
return tparent;
}
Aggregations