Search in sources :

Example 41 with Composite

use of org.eclipse.swt.widgets.Composite in project translationstudio8 by heartsome.

the class WebSearchPreferencePage method createTableCmdArea.

private Composite createTableCmdArea(Composite parent) {
    Composite urlCmdArea = new Composite(parent, SWT.NONE);
    GridLayout urlCmdArea_layout = new GridLayout(1, true);
    urlCmdArea.setLayout(urlCmdArea_layout);
    urlCmdArea.setLayoutData(new GridData(GridData.FILL_VERTICAL));
    addItemBtn = new Button(urlCmdArea, SWT.NONE);
    addItemBtn.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    addItemBtn.setText(Messages.getString("Websearch.WebSearcPreferencePage.Add"));
    editItemBtn = new Button(urlCmdArea, SWT.NONE);
    editItemBtn.setText(Messages.getString("Websearch.WebSearcPreferencePage.edit"));
    editItemBtn.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    editItemBtn.setEnabled(false);
    deleteItemBtn = new Button(urlCmdArea, SWT.NONE);
    deleteItemBtn.setText(Messages.getString("Websearch.WebSearcPreferencePage.delete"));
    deleteItemBtn.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    deleteItemBtn.setEnabled(false);
    upItemBtn = new Button(urlCmdArea, SWT.NONE);
    upItemBtn.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    upItemBtn.setText(Messages.getString("Websearch.WebSearcPreferencePage.upitem"));
    upItemBtn.setEnabled(false);
    downItemBtn = new Button(urlCmdArea, SWT.NONE);
    downItemBtn.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    downItemBtn.setText(Messages.getString("Websearch.WebSearcPreferencePage.downitem"));
    downItemBtn.setEnabled(false);
    importItemsBtn = new Button(urlCmdArea, SWT.NONE);
    importItemsBtn.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    importItemsBtn.setText(Messages.getString("Websearch.WebSearcPreferencePage.import"));
    exportItemsBtn = new Button(urlCmdArea, SWT.NONE);
    exportItemsBtn.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    exportItemsBtn.setText(Messages.getString("Websearch.WebSearcPreferencePage.export"));
    return urlCmdArea;
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData)

Example 42 with Composite

use of org.eclipse.swt.widgets.Composite 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);
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) Button(org.eclipse.swt.widgets.Button) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) GridData(org.eclipse.swt.layout.GridData) Label(org.eclipse.swt.widgets.Label) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Text(org.eclipse.swt.widgets.Text)

Example 43 with Composite

use of org.eclipse.swt.widgets.Composite 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)));
    }
}
Also used : Group(org.eclipse.swt.widgets.Group) Composite(org.eclipse.swt.widgets.Composite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Label(org.eclipse.swt.widgets.Label) Point(org.eclipse.swt.graphics.Point) LicenseIdGenerator(net.heartsome.license.generator.LicenseIdGenerator) GridLayout(org.eclipse.swt.layout.GridLayout) RowData(org.eclipse.swt.layout.RowData) Button(org.eclipse.swt.widgets.Button) RowLayout(org.eclipse.swt.layout.RowLayout) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent)

Example 44 with Composite

use of org.eclipse.swt.widgets.Composite in project translationstudio8 by heartsome.

the class LicenseManageDialog method createBarComp.

private void createBarComp(Composite parent) {
    Composite barComp = new Composite(parent, SWT.NONE);
    GridLayout barLayout = new GridLayout();
    barLayout.marginTop = 10;
    barComp.setLayout(barLayout);
    barComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    label4 = new Label(barComp, SWT.NONE);
    label4.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    bar = new ProgressBar(barComp, SWT.NONE);
    bar.setMaximum(10);
    bar.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    setVisible(false);
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) GridData(org.eclipse.swt.layout.GridData) Label(org.eclipse.swt.widgets.Label) ProgressBar(org.eclipse.swt.widgets.ProgressBar)

Example 45 with Composite

use of org.eclipse.swt.widgets.Composite in project translationstudio8 by heartsome.

the class LicenseManageDialog method createActiveComp.

private void createActiveComp(Composite parent) {
    Group licenseIdGroup = new Group(parent, SWT.NONE);
    licenseIdGroup.setText(Messages.getString("license.LicenseManageDialog.licenseIdGroup"));
    GridData dataLicenseIdGroup = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL);
    dataLicenseIdGroup.heightHint = 110;
    licenseIdGroup.setLayoutData(dataLicenseIdGroup);
    GridLayout layoutGroup = new GridLayout(2, false);
    layoutGroup.marginLeft = 5;
    layoutGroup.marginHeight = 10;
    licenseIdGroup.setLayout(layoutGroup);
    Label label = new Label(licenseIdGroup, SWT.NONE);
    label.setText(Messages.getString("license.LicenseManageDialog.licenseIdLabel"));
    createIdInputComp(licenseIdGroup);
    Composite compLink = new Composite(licenseIdGroup, SWT.NONE);
    RowLayout layoutLink = new RowLayout();
    layoutLink.marginTop = 20;
    layoutLink.marginRight = 0;
    layoutLink.marginLeft = 0;
    layoutLink.marginBottom = 10;
    compLink.setLayout(layoutLink);
    GridData linkData = new GridData(GridData.FILL_HORIZONTAL);
    linkData.horizontalSpan = 2;
    compLink.setLayoutData(linkData);
    Label label1 = new Label(compLink, SWT.NONE);
    label1.setText(Messages.getString("license.LicenseManageDialog.label1"));
    if (!"L".equals(System.getProperty("TSEdition"))) {
        Label link1 = new Label(compLink, SWT.NONE);
        link1.setText(Messages.getString("license.LicenseManageDialog.link1"));
        link1.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLUE));
        link1.setCursor(cursor);
        link1.addMouseListener(new MouseListener() {

            public void mouseUp(MouseEvent e) {
            }

            public void mouseDown(MouseEvent e) {
                Program.launch(Messages.getString("license.LicenseManageDialog.urlr8buy") + "&PRODUCT=" + ProtectionFactory.getProduct() + "&PLATFORM=" + ProtectionFactory.getPlatform());
            }

            public void mouseDoubleClick(MouseEvent e) {
            }
        });
        Label label2 = new Label(compLink, SWT.NONE);
        label2.setText(Messages.getString("license.LicenseManageDialog.label2"));
    }
    Label link2 = new Label(compLink, SWT.NONE);
    link2.setText(Messages.getString("license.LicenseManageDialog.link2"));
    link2.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLUE));
    link2.setCursor(cursor);
    link2.addMouseListener(new MouseListener() {

        public void mouseUp(MouseEvent e) {
        }

        public void mouseDown(MouseEvent e) {
            Program.launch(Messages.getString("license.LicenseManageDialog.urlr8trial") + "&PRODUCT=" + ProtectionFactory.getProduct() + "&PLATFORM=" + ProtectionFactory.getPlatform());
        }

        public void mouseDoubleClick(MouseEvent e) {
        }
    });
    Label label3 = new Label(compLink, SWT.NONE);
    label3.setText(Messages.getString("license.LicenseManageDialog.label3"));
}
Also used : Group(org.eclipse.swt.widgets.Group) GridLayout(org.eclipse.swt.layout.GridLayout) MouseListener(org.eclipse.swt.events.MouseListener) MouseEvent(org.eclipse.swt.events.MouseEvent) Composite(org.eclipse.swt.widgets.Composite) RowLayout(org.eclipse.swt.layout.RowLayout) GridData(org.eclipse.swt.layout.GridData) Label(org.eclipse.swt.widgets.Label)

Aggregations

Composite (org.eclipse.swt.widgets.Composite)2054 GridData (org.eclipse.swt.layout.GridData)1441 GridLayout (org.eclipse.swt.layout.GridLayout)1419 Label (org.eclipse.swt.widgets.Label)853 Button (org.eclipse.swt.widgets.Button)694 SelectionEvent (org.eclipse.swt.events.SelectionEvent)577 Text (org.eclipse.swt.widgets.Text)519 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)463 Group (org.eclipse.swt.widgets.Group)305 Combo (org.eclipse.swt.widgets.Combo)210 Point (org.eclipse.swt.graphics.Point)198 FillLayout (org.eclipse.swt.layout.FillLayout)188 ModifyListener (org.eclipse.swt.events.ModifyListener)186 SelectionListener (org.eclipse.swt.events.SelectionListener)183 ScrolledComposite (org.eclipse.swt.custom.ScrolledComposite)182 ModifyEvent (org.eclipse.swt.events.ModifyEvent)168 Table (org.eclipse.swt.widgets.Table)159 TableViewer (org.eclipse.jface.viewers.TableViewer)153 Control (org.eclipse.swt.widgets.Control)149 ArrayList (java.util.ArrayList)107