Search in sources :

Example 91 with SelectionEvent

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

the class PluginConfigManageDialog method createSwitchCmp.

private void createSwitchCmp(Composite tparent) {
    Composite cmp = new Composite(tparent, SWT.NONE);
    GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(cmp);
    GridLayoutFactory.swtDefaults().numColumns(3).applyTo(cmp);
    Label switchLbl = new Label(cmp, SWT.NONE);
    switchLbl.setText(Messages.getString("dialog.PluginConfigManageDialog.switchLbl"));
    switchTxt = new Text(cmp, SWT.BORDER);
    GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(switchTxt);
    switchBrowseBtn = new Button(cmp, SWT.NONE);
    switchBrowseBtn.setText(Messages.getString("dialog.PluginConfigManageDialog.switchBrowseBtn"));
    switchBrowseBtn.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            String fileLocation = browseFile(Messages.getString("dialog.PluginConfigManageDialog.dialogTitle2"), null, null);
            switchTxt.setText(fileLocation == null ? "" : fileLocation);
        }
    });
}
Also used : Composite(org.eclipse.swt.widgets.Composite) Button(org.eclipse.swt.widgets.Button) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Label(org.eclipse.swt.widgets.Label) SelectionEvent(org.eclipse.swt.events.SelectionEvent) KeySequenceText(org.eclipse.jface.bindings.keys.KeySequenceText) Text(org.eclipse.swt.widgets.Text)

Example 92 with SelectionEvent

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

the class JavaPropertiesViewerDialog method createMenu.

private void createMenu(Composite tparent) {
    Menu menuBar = new Menu(getShell(), SWT.BAR);
    getShell().setMenuBar(menuBar);
    getShell().pack();
    Rectangle screenSize = Display.getDefault().getClientArea();
    Rectangle frameSize = getShell().getBounds();
    getShell().setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2);
    // 文件菜单
    Menu fileMenu = new Menu(menuBar);
    MenuItem fileItem = new MenuItem(menuBar, SWT.CASCADE);
    fileItem.setText(Messages.getString("dialog.JavaPropertiesViewerDialog.fileMenu"));
    fileItem.setMenu(fileMenu);
    MenuItem openFileItem = new MenuItem(fileMenu, SWT.PUSH);
    openFileItem.setText(Messages.getString("dialog.JavaPropertiesViewerDialog.openFileItem"));
    openFileItem.setImage(new Image(Display.getDefault(), openFilePath));
    openFileItem.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            openFile();
        }
    });
    new MenuItem(fileMenu, SWT.SEPARATOR);
    MenuItem quitItem = new MenuItem(fileMenu, SWT.PUSH);
    quitItem.setText(Messages.getString("dialog.JavaPropertiesViewerDialog.quitItem"));
    quitItem.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            close();
        }
    });
    // 帮助菜单
    Menu helpMenu = new Menu(menuBar);
    MenuItem helpItem = new MenuItem(menuBar, SWT.CASCADE);
    helpItem.setText(Messages.getString("dialog.JavaPropertiesViewerDialog.helpMenu"));
    helpItem.setMenu(helpMenu);
    MenuItem aboutItem = new MenuItem(helpMenu, SWT.PUSH);
    aboutItem.setText(Messages.getString("dialog.JavaPropertiesViewerDialog.aboutItem"));
    String aboutPath = PluginUtil.getAbsolutePath(PluginConstants.LOGO_PROERTIESVIEWER_MENU_PATH);
    aboutItem.setImage(new Image(Display.getDefault(), aboutPath));
    aboutItem.addSelectionListener(new SelectionListener() {

        public void widgetSelected(SelectionEvent e) {
            AboutDialog dialog = new AboutDialog(getShell(), Messages.getString("dialog.JavaPropertiesViewerDialog.aboutItemName"), imagePath, Messages.getString("dialog.JavaPropertiesViewerDialog.version"));
            dialog.open();
        }

        public void widgetDefaultSelected(SelectionEvent e) {
        }
    });
}
Also used : SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Rectangle(org.eclipse.swt.graphics.Rectangle) SelectionEvent(org.eclipse.swt.events.SelectionEvent) MenuItem(org.eclipse.swt.widgets.MenuItem) Menu(org.eclipse.swt.widgets.Menu) Image(org.eclipse.swt.graphics.Image) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 93 with SelectionEvent

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

the class JavaPropertiesViewerDialog method createToolBar.

private void createToolBar(Composite tparent) {
    Composite toolBarCmp = new Composite(tparent, SWT.NONE);
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).applyTo(toolBarCmp);
    GridLayoutFactory.fillDefaults().numColumns(1).applyTo(toolBarCmp);
    ToolBar toolBar = new ToolBar(toolBarCmp, SWT.NO_FOCUS | SWT.FLAT);
    ToolItem openItem = new ToolItem(toolBar, SWT.PUSH);
    openItem.setToolTipText(Messages.getString("dialog.JavaPropertiesViewerDialog.toolBar"));
    openItem.setImage(new Image(Display.getDefault(), openFilePath));
    openItem.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            openFile();
        }
    });
}
Also used : Composite(org.eclipse.swt.widgets.Composite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) ToolBar(org.eclipse.swt.widgets.ToolBar) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Image(org.eclipse.swt.graphics.Image) ToolItem(org.eclipse.swt.widgets.ToolItem)

Example 94 with SelectionEvent

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

the class Martif2TBXConverterDialog method createMenu.

/**
	 * 创建菜单 ;
	 */
private void createMenu() {
    Menu menu = new Menu(getShell(), SWT.BAR);
    getShell().setMenuBar(menu);
    getShell().pack();
    Rectangle screenSize = Display.getDefault().getClientArea();
    Rectangle frameSize = getShell().getBounds();
    getShell().setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2);
    Menu fileMenu = new Menu(menu);
    MenuItem fileItem = new MenuItem(menu, SWT.CASCADE);
    fileItem.setText(Messages.getString("dialog.Martif2TBXConverterDialog.fileMenu"));
    fileItem.setMenu(fileMenu);
    MenuItem exitItem = new MenuItem(fileMenu, SWT.PUSH);
    exitItem.setText(Messages.getString("dialog.Martif2TBXConverterDialog.exitItem"));
    exitItem.addSelectionListener(new SelectionListener() {

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

        public void widgetDefaultSelected(SelectionEvent e) {
        }
    });
    Menu helpMenu = new Menu(menu);
    MenuItem helpItem = new MenuItem(menu, SWT.CASCADE);
    helpItem.setText(Messages.getString("dialog.Martif2TBXConverterDialog.helpMenu"));
    helpItem.setMenu(helpMenu);
    MenuItem aboutItem = new MenuItem(helpMenu, SWT.PUSH);
    aboutItem.setText(Messages.getString("dialog.Martif2TBXConverterDialog.aboutItem"));
    String imgPath = PluginUtil.getAbsolutePath(PluginConstants.LOGO_MARTIF2TBX_MENU_PATH);
    aboutItem.setImage(new Image(Display.getDefault(), imgPath));
    aboutItem.addSelectionListener(new SelectionListener() {

        public void widgetSelected(SelectionEvent e) {
            AboutDialog dialog = new AboutDialog(getShell(), Messages.getString("dialog.Martif2TBXConverterDialog.dialogName"), imagePath, Messages.getString("dialog.Martif2TBXConverterDialog.dialogVersion"));
            dialog.open();
        }

        public void widgetDefaultSelected(SelectionEvent e) {
        }
    });
}
Also used : Rectangle(org.eclipse.swt.graphics.Rectangle) SelectionEvent(org.eclipse.swt.events.SelectionEvent) MenuItem(org.eclipse.swt.widgets.MenuItem) Menu(org.eclipse.swt.widgets.Menu) Image(org.eclipse.swt.graphics.Image) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 95 with SelectionEvent

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

the class CSV2TMXConverterDialog method createToolBar.

/**
	 * 创建工具栏
	 * @param parent
	 *            ;
	 */
private void createToolBar(Composite parent) {
    Composite cmpToolBar = new Composite(parent, SWT.None);
    GridLayoutFactory.fillDefaults().spacing(0, 0).numColumns(3).equalWidth(false).applyTo(cmpToolBar);
    cmpToolBar.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    ToolBar toolBar = new ToolBar(cmpToolBar, SWT.NO_FOCUS | SWT.FLAT);
    ToolItem openToolItem = new ToolItem(toolBar, SWT.PUSH);
    openToolItem.setToolTipText(Messages.getString("dialog.CSV2TMXConverterDialog.openToolItem"));
    String openCSVPath = PluginUtil.getAbsolutePath(PluginConstants.PIC_OPEN_CSV_PATH);
    openToolItem.setImage(new Image(Display.getDefault(), openCSVPath));
    openToolItem.addSelectionListener(new SelectionListener() {

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

        public void widgetDefaultSelected(SelectionEvent e) {
        }
    });
    ToolItem exporToolItem = new ToolItem(toolBar, SWT.PUSH);
    exporToolItem.setToolTipText(Messages.getString("dialog.CSV2TMXConverterDialog.exporToolItem"));
    String exportPath = PluginUtil.getAbsolutePath(PluginConstants.PIC_EXPORT_TBX_PATH);
    exporToolItem.setImage(new Image(Display.getDefault(), exportPath));
    exporToolItem.addSelectionListener(new SelectionListener() {

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

        public void widgetDefaultSelected(SelectionEvent e) {
        }
    });
    ToolItem deleteColToolItem = new ToolItem(toolBar, SWT.PUSH);
    deleteColToolItem.setToolTipText(Messages.getString("dialog.CSV2TMXConverterDialog.deleteColToolItem"));
    String deleteColPath = PluginUtil.getAbsolutePath(PluginConstants.PIC_DELETE_COLUMN_PATH);
    deleteColToolItem.setImage(new Image(Display.getDefault(), deleteColPath));
    deleteColToolItem.addSelectionListener(new SelectionListener() {

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

        public void widgetDefaultSelected(SelectionEvent e) {
        }
    });
    ToolItem setColToolItem = new ToolItem(toolBar, SWT.PUSH);
    setColToolItem.setToolTipText(Messages.getString("dialog.CSV2TMXConverterDialog.setColToolItem"));
    String setColPath = PluginUtil.getAbsolutePath(PluginConstants.PIC_SET_COLUMN_PATH);
    setColToolItem.setImage(new Image(Display.getDefault(), setColPath));
    setColToolItem.addSelectionListener(new SelectionListener() {

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

        public void widgetDefaultSelected(SelectionEvent e) {
        }
    });
    new Label(cmpToolBar, SWT.None).setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
    ToolBar helpToolBar = new ToolBar(cmpToolBar, SWT.NO_FOCUS | SWT.FLAT);
    ToolItem helpToolItem = new ToolItem(helpToolBar, SWT.RIGHT);
    helpToolItem.setToolTipText(Messages.getString("dialog.CSV2TMXConverterDialog.helpToolBar"));
    String helpPath = PluginUtil.getAbsolutePath(PluginConstants.PIC_HELP_PATH);
    helpToolItem.setImage(new Image(Display.getDefault(), helpPath));
    helpToolItem.addSelectionListener(new SelectionListener() {

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

        public void widgetDefaultSelected(SelectionEvent e) {
        }
    });
}
Also used : Composite(org.eclipse.swt.widgets.Composite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) GridData(org.eclipse.swt.layout.GridData) ToolBar(org.eclipse.swt.widgets.ToolBar) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Label(org.eclipse.swt.widgets.Label) Image(org.eclipse.swt.graphics.Image) ToolItem(org.eclipse.swt.widgets.ToolItem) SelectionListener(org.eclipse.swt.events.SelectionListener)

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