Search in sources :

Example 1 with Hyperlink

use of com.novocode.naf.swt.custom.Hyperlink in project cubrid-manager by CUBRID.

the class JdbcOptionComposite method createButtonComp.

/**
	 *
	 * Create button composite
	 *
	 * @param composite the composite
	 */
private void createButtonComp(Composite composite) {
    Composite buttonComposite = new Composite(composite, SWT.NONE);
    {
        GridLayout layout = new GridLayout();
        layout.numColumns = 3;
        buttonComposite.setLayout(layout);
        buttonComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    }
    Hyperlink link = new Hyperlink(buttonComposite, SWT.None);
    link.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    link.setText(Messages.titleJdbcAdvancedOptionView);
    link.addMouseListener(new MouseListener() {

        public void mouseUp(MouseEvent e) {
            IWorkbenchBrowserSupport browserSupport = PlatformUI.getWorkbench().getBrowserSupport();
            try {
                IWebBrowser br = browserSupport.createBrowser(null);
                br.openURL(new URL(Messages.msgCubridJdbcInfoUrl));
            } catch (Exception ignored) {
            }
        }

        public void mouseDown(MouseEvent e) {
        }

        public void mouseDoubleClick(MouseEvent e) {
        }
    });
    addButton = new Button(buttonComposite, SWT.PUSH);
    addButton.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
    addButton.setText(Messages.btnAdd);
    addButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            TableItem itemNew = new TableItem(jdbcInfoTv.getTable(), SWT.SINGLE);
            int newIndex = jdbcInfoTv.getTable().getItemCount() - 1;
            focusCell(itemNew, newIndex, 0);
        }
    });
    Button delButton = new Button(buttonComposite, SWT.PUSH);
    delButton.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
    delButton.setText(Messages.btnDelete);
    delButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            TableItem[] selection = jdbcInfoTv.getTable().getSelection();
            if (selection == null || selection.length == 0) {
                return;
            }
            jdbcInfoTv.getTable().setSelection(-1);
            for (TableItem item : selection) {
                item.dispose();
            }
        }
    });
}
Also used : MouseEvent(org.eclipse.swt.events.MouseEvent) Composite(org.eclipse.swt.widgets.Composite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) TableItem(org.eclipse.swt.widgets.TableItem) IWebBrowser(org.eclipse.ui.browser.IWebBrowser) URL(java.net.URL) GridLayout(org.eclipse.swt.layout.GridLayout) MouseListener(org.eclipse.swt.events.MouseListener) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) IWorkbenchBrowserSupport(org.eclipse.ui.browser.IWorkbenchBrowserSupport) Hyperlink(com.novocode.naf.swt.custom.Hyperlink)

Example 2 with Hyperlink

use of com.novocode.naf.swt.custom.Hyperlink in project cubrid-manager by CUBRID.

the class GeneralInfoPage method createChartsetGroup.

/**
	 * Create chartset information group
	 *
	 * @param parent the parent composite
	 */
private void createChartsetGroup(Composite parent) {
    Group charsetGroup = new Group(parent, SWT.NONE);
    charsetGroup.setText(Messages.grpCharsetInfo);
    GridData gdCharsetGroup = new GridData(GridData.FILL_HORIZONTAL);
    charsetGroup.setLayoutData(gdCharsetGroup);
    GridLayout layoutCharsetGroup = new GridLayout();
    layoutCharsetGroup.numColumns = 3;
    charsetGroup.setLayout(layoutCharsetGroup);
    enIsoRadio = new Button(charsetGroup, SWT.RADIO);
    final GridData gdEnIsoRadio = new GridData(SWT.FILL, SWT.CENTER, true, false);
    enIsoRadio.setLayoutData(gdEnIsoRadio);
    enIsoRadio.setText(CHARSET_EN_US_ISO88591);
    enIsoRadio.setSelection(true);
    enUtfRadio = new Button(charsetGroup, SWT.RADIO);
    final GridData gdEnUtfRadio = new GridData(SWT.FILL, SWT.CENTER, true, false);
    enUtfRadio.setLayoutData(gdEnUtfRadio);
    enUtfRadio.setText(CHARSET_EN_US_UTF8);
    koEuckrRadio = new Button(charsetGroup, SWT.RADIO);
    final GridData gdKoEuckrRadio = new GridData(SWT.FILL, SWT.CENTER, true, false);
    koEuckrRadio.setLayoutData(gdKoEuckrRadio);
    koEuckrRadio.setText(CHARSET_KO_KR_EUCKR);
    koUtfRadio = new Button(charsetGroup, SWT.RADIO);
    final GridData gdKoUtfRadio = new GridData(SWT.FILL, SWT.CENTER, true, false);
    koUtfRadio.setLayoutData(gdKoUtfRadio);
    koUtfRadio.setText(CHARSET_KO_KR_UTF8);
    userDefinedRadio = new Button(charsetGroup, SWT.RADIO);
    final GridData gdUserDefinedRadio = new GridData(SWT.FILL, SWT.CENTER, true, false);
    koUtfRadio.setLayoutData(gdUserDefinedRadio);
    userDefinedRadio.setText(Messages.lblUserDefinedCharset);
    userDefinedRadio.addSelectionListener(new SelectionListener() {

        public void widgetSelected(SelectionEvent e) {
            Button btn = (Button) e.widget;
            userDefinedCharsetText.setEnabled(btn.getSelection());
        }

        public void widgetDefaultSelected(SelectionEvent e) {
        }
    });
    userDefinedCharsetText = new Text(charsetGroup, SWT.BORDER);
    final GridData gdDetailCombo = new GridData(SWT.FILL, SWT.CENTER, true, false);
    userDefinedCharsetText.setLayoutData(gdDetailCombo);
    userDefinedCharsetText.setEnabled(false);
    userDefinedCharsetText.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            //TODO whether need check the input style?
            valid();
        }
    });
    Hyperlink link = new Hyperlink(charsetGroup, SWT.None);
    GridData gdLink = new GridData(SWT.FILL, SWT.CENTER, true, false);
    gdLink.horizontalSpan = 3;
    link.setLayoutData(gdLink);
    link.setText(Messages.msgLocaleManual);
    link.addMouseListener(new MouseAdapter() {

        public void mouseUp(MouseEvent e) {
            IWorkbenchBrowserSupport browserSupport = PlatformUI.getWorkbench().getBrowserSupport();
            try {
                IWebBrowser br = browserSupport.createBrowser(null);
                String url = Messages.msgLocaleManualUrl91;
                if (CompatibleUtil.isAfter930(server.getServerInfo())) {
                    url = Messages.msgLocaleManualUrl93;
                } else if (CompatibleUtil.isAfter920(server.getServerInfo())) {
                    url = Messages.msgLocaleManualUrl92;
                }
                br.openURL(new URL(url));
            } catch (Exception ignored) {
            }
        }
    });
}
Also used : Group(org.eclipse.swt.widgets.Group) MouseEvent(org.eclipse.swt.events.MouseEvent) ModifyListener(org.eclipse.swt.events.ModifyListener) MouseAdapter(org.eclipse.swt.events.MouseAdapter) Text(org.eclipse.swt.widgets.Text) IWebBrowser(org.eclipse.ui.browser.IWebBrowser) URL(java.net.URL) GridLayout(org.eclipse.swt.layout.GridLayout) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) IWorkbenchBrowserSupport(org.eclipse.ui.browser.IWorkbenchBrowserSupport) SelectionListener(org.eclipse.swt.events.SelectionListener) Hyperlink(com.novocode.naf.swt.custom.Hyperlink)

Aggregations

Hyperlink (com.novocode.naf.swt.custom.Hyperlink)2 URL (java.net.URL)2 MouseEvent (org.eclipse.swt.events.MouseEvent)2 SelectionEvent (org.eclipse.swt.events.SelectionEvent)2 GridData (org.eclipse.swt.layout.GridData)2 GridLayout (org.eclipse.swt.layout.GridLayout)2 Button (org.eclipse.swt.widgets.Button)2 IWebBrowser (org.eclipse.ui.browser.IWebBrowser)2 IWorkbenchBrowserSupport (org.eclipse.ui.browser.IWorkbenchBrowserSupport)2 ModifyEvent (org.eclipse.swt.events.ModifyEvent)1 ModifyListener (org.eclipse.swt.events.ModifyListener)1 MouseAdapter (org.eclipse.swt.events.MouseAdapter)1 MouseListener (org.eclipse.swt.events.MouseListener)1 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)1 SelectionListener (org.eclipse.swt.events.SelectionListener)1 Composite (org.eclipse.swt.widgets.Composite)1 Group (org.eclipse.swt.widgets.Group)1 TableItem (org.eclipse.swt.widgets.TableItem)1 Text (org.eclipse.swt.widgets.Text)1