Search in sources :

Example 51 with SelectionEvent

use of org.eclipse.swt.events.SelectionEvent in project translationstudio8 by heartsome.

the class TmDbManagerDialog method createHelpControl.

/**
	 * 添加帮助按钮 robert 2012-09-06
	 */
@Override
protected Control createHelpControl(Composite parent) {
    // ROBERTHELP 记忆库管理
    String language = CommonFunction.getSystemLanguage();
    final String helpUrl = MessageFormat.format("/net.heartsome.cat.ts.ui.help/html/{0}/ch06s02.html#tm-management", language);
    Image helpImage = JFaceResources.getImage(DLG_IMG_HELP);
    ToolBar toolBar = new ToolBar(parent, SWT.FLAT | SWT.NO_FOCUS);
    ((GridLayout) parent.getLayout()).numColumns++;
    toolBar.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER));
    final Cursor cursor = new Cursor(parent.getDisplay(), SWT.CURSOR_HAND);
    toolBar.setCursor(cursor);
    toolBar.addDisposeListener(new DisposeListener() {

        public void widgetDisposed(DisposeEvent e) {
            cursor.dispose();
        }
    });
    ToolItem helpItem = new ToolItem(toolBar, SWT.NONE);
    helpItem.setImage(helpImage);
    //$NON-NLS-1$
    helpItem.setToolTipText(JFaceResources.getString("helpToolTip"));
    helpItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            PlatformUI.getWorkbench().getHelpSystem().displayHelpResource(helpUrl);
        }
    });
    return toolBar;
}
Also used : DisposeListener(org.eclipse.swt.events.DisposeListener) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) ToolBar(org.eclipse.swt.widgets.ToolBar) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Image(org.eclipse.swt.graphics.Image) Cursor(org.eclipse.swt.graphics.Cursor) DisposeEvent(org.eclipse.swt.events.DisposeEvent) ToolItem(org.eclipse.swt.widgets.ToolItem)

Example 52 with SelectionEvent

use of org.eclipse.swt.events.SelectionEvent in project translationstudio8 by heartsome.

the class ConcordanceSearchDialog method initListener.

/**
	 * 初始化各控件的监听 ;
	 */
private void initListener() {
    btnSearch.addSelectionListener(new SelectionListener() {

        public void widgetSelected(SelectionEvent e) {
            initGroupIdAndSearch();
        }

        public void widgetDefaultSelected(SelectionEvent e) {
        }
    });
    cmbSearch.addKeyListener(new KeyListener() {

        public void keyPressed(KeyEvent e) {
            if (e.character == SWT.CR) {
                initGroupIdAndSearch();
            }
        }

        public void keyReleased(KeyEvent e) {
        }
    });
    btnFirst.addSelectionListener(new SelectionListener() {

        public void widgetSelected(SelectionEvent e) {
            if (curPageNum > 0 && amountPage > 0) {
                curPageNum = 1;
                if (search()) {
                    refreshPageNumText();
                }
            }
        }

        public void widgetDefaultSelected(SelectionEvent e) {
        }
    });
    btnPre.addSelectionListener(new SelectionListener() {

        public void widgetDefaultSelected(SelectionEvent e) {
        }

        public void widgetSelected(SelectionEvent e) {
            if (curPageNum > 0) {
                curPageNum--;
                if (search()) {
                    refreshPageNumText();
                }
            }
        }
    });
    btnNext.addSelectionListener(new SelectionListener() {

        public void widgetDefaultSelected(SelectionEvent e) {
        }

        public void widgetSelected(SelectionEvent e) {
            if (curPageNum < amountPage) {
                curPageNum++;
                if (search()) {
                    refreshPageNumText();
                }
            }
        }
    });
    btnLast.addSelectionListener(new SelectionListener() {

        public void widgetDefaultSelected(SelectionEvent e) {
        }

        public void widgetSelected(SelectionEvent e) {
            if (curPageNum > 0 && amountPage > 0) {
                curPageNum = amountPage;
                if (search()) {
                    refreshPageNumText();
                }
            }
        }
    });
    txtPage.addKeyListener(new KeyListener() {

        public void keyReleased(KeyEvent e) {
        }

        public void keyPressed(KeyEvent e) {
            if (e.character == SWT.CR) {
                String pageNum = txtPage.getText();
                try {
                    curPageNum = Integer.parseInt(pageNum);
                } catch (NumberFormatException e1) {
                    // LOGGER.error("NumberFormatException", e1);
                    txtPage.setText(String.valueOf(curPageNum) + splitPageSeparator + amountPage);
                    return;
                }
                if (curPageNum > amountPage) {
                    curPageNum = amountPage;
                }
                if (curPageNum < 1) {
                    curPageNum = 1;
                }
                search();
                txtPage.setText(String.valueOf(curPageNum));
            }
        }
    });
    txtPage.addFocusListener(new FocusAdapter() {

        @Override
        public void focusLost(FocusEvent e) {
            refreshPageNumText();
        }

        @Override
        public void focusGained(FocusEvent e) {
            txtPage.setText("");
        }
    });
}
Also used : KeyEvent(org.eclipse.swt.events.KeyEvent) FocusAdapter(org.eclipse.swt.events.FocusAdapter) SelectionEvent(org.eclipse.swt.events.SelectionEvent) KeyListener(org.eclipse.swt.events.KeyListener) FocusEvent(org.eclipse.swt.events.FocusEvent) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 53 with SelectionEvent

use of org.eclipse.swt.events.SelectionEvent in project translationstudio8 by heartsome.

the class ExportTmxDialog method createHelpControl.

/**
	 * 添加帮助按钮 robert 2012-09-06
	 */
@Override
protected Control createHelpControl(Composite parent) {
    // ROBERTHELP 导出tmx
    String language = CommonFunction.getSystemLanguage();
    final String helpUrl = MessageFormat.format("/net.heartsome.cat.ts.ui.help/html/{0}/ch06s03.html#export-tmx", language);
    Image helpImage = JFaceResources.getImage(DLG_IMG_HELP);
    ToolBar toolBar = new ToolBar(parent, SWT.FLAT | SWT.NO_FOCUS);
    ((GridLayout) parent.getLayout()).numColumns++;
    toolBar.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER));
    final Cursor cursor = new Cursor(parent.getDisplay(), SWT.CURSOR_HAND);
    toolBar.setCursor(cursor);
    toolBar.addDisposeListener(new DisposeListener() {

        public void widgetDisposed(DisposeEvent e) {
            cursor.dispose();
        }
    });
    ToolItem helpItem = new ToolItem(toolBar, SWT.NONE);
    helpItem.setImage(helpImage);
    //$NON-NLS-1$
    helpItem.setToolTipText(JFaceResources.getString("helpToolTip"));
    helpItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            PlatformUI.getWorkbench().getHelpSystem().displayHelpResource(helpUrl);
        }
    });
    return toolBar;
}
Also used : DisposeListener(org.eclipse.swt.events.DisposeListener) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) ToolBar(org.eclipse.swt.widgets.ToolBar) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Image(org.eclipse.swt.graphics.Image) Cursor(org.eclipse.swt.graphics.Cursor) DisposeEvent(org.eclipse.swt.events.DisposeEvent) ToolItem(org.eclipse.swt.widgets.ToolItem)

Example 54 with SelectionEvent

use of org.eclipse.swt.events.SelectionEvent in project translationstudio8 by heartsome.

the class NewTmDbImportPage method createControl.

/**
	 * Create contents of the wizard.
	 * @param parent
	 */
public void createControl(Composite parent) {
    Composite container = new Composite(parent, SWT.NULL);
    setControl(container);
    container.setLayout(new GridLayout(3, false));
    Label lblTmx = new Label(container, SWT.NONE);
    lblTmx.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    lblTmx.setText(Messages.getString("wizard.NewTmDbImportPage.lblTmx"));
    tmxFileText = new Text(container, SWT.BORDER);
    tmxFileText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    tmxFileText.setEditable(false);
    Button tmxFileBorwserBtn = new Button(container, SWT.NONE);
    tmxFileBorwserBtn.setText(Messages.getString("wizard.NewTmDbImportPage.tmxFileBorwserBtn"));
    tmxFileBorwserBtn.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            FileDialog dlg = new FileDialog(getShell());
            String[] filterExt = { "*.tmx;*.xlsx;*.txt" };
            dlg.setFilterExtensions(filterExt);
            String path = dlg.open();
            if (path != null) {
                tmxFileText.setText(path);
            }
        }
    });
}
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) Label(org.eclipse.swt.widgets.Label) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Text(org.eclipse.swt.widgets.Text) FileDialog(org.eclipse.swt.widgets.FileDialog)

Example 55 with SelectionEvent

use of org.eclipse.swt.events.SelectionEvent in project translationstudio8 by heartsome.

the class UpdateTMWizardDialog method createHelpControl.

/**
	 * 添加帮助按钮
	 * robert	2012-09-06
	 */
@Override
protected Control createHelpControl(Composite parent) {
    // ROBERTHELP 更新记忆库
    String language = CommonFunction.getSystemLanguage();
    final String helpUrl = MessageFormat.format("/net.heartsome.cat.ts.ui.help/html/{0}/ch06.html#update-tm", language);
    Image helpImage = JFaceResources.getImage(DLG_IMG_HELP);
    ToolBar toolBar = new ToolBar(parent, SWT.FLAT | SWT.NO_FOCUS);
    ((GridLayout) parent.getLayout()).numColumns++;
    toolBar.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER));
    final Cursor cursor = new Cursor(parent.getDisplay(), SWT.CURSOR_HAND);
    toolBar.setCursor(cursor);
    toolBar.addDisposeListener(new DisposeListener() {

        public void widgetDisposed(DisposeEvent e) {
            cursor.dispose();
        }
    });
    ToolItem helpItem = new ToolItem(toolBar, SWT.NONE);
    helpItem.setImage(helpImage);
    //$NON-NLS-1$
    helpItem.setToolTipText(JFaceResources.getString("helpToolTip"));
    helpItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            PlatformUI.getWorkbench().getHelpSystem().displayHelpResource(helpUrl);
        }
    });
    return toolBar;
}
Also used : DisposeListener(org.eclipse.swt.events.DisposeListener) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) ToolBar(org.eclipse.swt.widgets.ToolBar) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Image(org.eclipse.swt.graphics.Image) Cursor(org.eclipse.swt.graphics.Cursor) DisposeEvent(org.eclipse.swt.events.DisposeEvent) ToolItem(org.eclipse.swt.widgets.ToolItem)

Aggregations

SelectionEvent (org.eclipse.swt.events.SelectionEvent)1136 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)923 GridData (org.eclipse.swt.layout.GridData)670 GridLayout (org.eclipse.swt.layout.GridLayout)566 Button (org.eclipse.swt.widgets.Button)558 Composite (org.eclipse.swt.widgets.Composite)553 Label (org.eclipse.swt.widgets.Label)370 SelectionListener (org.eclipse.swt.events.SelectionListener)262 Text (org.eclipse.swt.widgets.Text)253 Group (org.eclipse.swt.widgets.Group)193 ModifyEvent (org.eclipse.swt.events.ModifyEvent)160 ModifyListener (org.eclipse.swt.events.ModifyListener)159 Combo (org.eclipse.swt.widgets.Combo)140 Point (org.eclipse.swt.graphics.Point)98 MenuItem (org.eclipse.swt.widgets.MenuItem)95 Menu (org.eclipse.swt.widgets.Menu)94 TableViewer (org.eclipse.jface.viewers.TableViewer)91 Table (org.eclipse.swt.widgets.Table)91 ToolItem (org.eclipse.swt.widgets.ToolItem)90 ArrayList (java.util.ArrayList)88