Search in sources :

Example 1 with MouseListener

use of org.eclipse.swt.events.MouseListener in project GT by Tencent.

the class DevicesView method createTargetPkgTableView.

/**
	 * 创建被测进程列表
	* @Title: createTargetPkgTableView  
	* @Description:   
	* @param parent 
	* void 
	* @throws
	 */
private void createTargetPkgTableView(Composite parent) {
    targetPkgTableViewer = new TableViewer(parent, SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL | SWT.CHECK);
    ctv = new CheckboxTableViewer(targetPkgTableViewer.getTable());
    ctv.addCheckStateListener(new ICheckStateListener() {

        @Override
        public void checkStateChanged(CheckStateChangedEvent event) {
            if (isSupportCheckChangePer) {
                GetCurCheckedStateUtil.update();
            } else {
                APTConsoleFactory.getInstance().APTPrint("Operation forbid");
            }
        }
    });
    // 设置表头内容 
    for (int i = 0; i < TARGET_COLUMN_NAME.length; i++) {
        new TableColumn(targetPkgTableViewer.getTable(), SWT.LEFT).setText(TARGET_COLUMN_NAME[i]);
    }
    targetPkgTableViewer.getTable().getColumn(0).setWidth(200);
    targetPkgTableViewer.getTable().getColumn(1).setWidth(50);
    // 设置表头和表格线可见
    targetPkgTableViewer.getTable().setHeaderVisible(true);
    targetPkgTableViewer.getTable().setLinesVisible(true);
    targetPkgTableViewer.setContentProvider(new ViewContentProvider());
    targetPkgTableViewer.setLabelProvider(new ViewLabelProvider());
    targetPkgTableViewer.getTable().addMouseListener(new MouseListener() {

        @Override
        public void mouseUp(MouseEvent e) {
        }

        @Override
        public void mouseDown(MouseEvent e) {
        }

        @Override
        public void mouseDoubleClick(MouseEvent e) {
            if (isSupportAddOrDeleteOper) {
                APTState.getInstance().DealWithEventBefore(APTEventEnum.CONFIGRURE_OPER);
                TableItem[] selectData = targetPkgTableViewer.getTable().getSelection();
                if (selectData == null || selectData.length == 0) {
                    return;
                }
                PkgInfo itemData = (PkgInfo) selectData[0].getData();
                targetPkgTableViewer.remove(itemData);
                APTState.getInstance().DealWithEventAfter(APTEventEnum.CONFIGRURE_OPER);
            } else {
                APTConsoleFactory.getInstance().APTPrint("Operation forbid");
            }
        }
    });
    targetPkgTableViewer.getTable().setToolTipText("双击或者右键菜单可删除被测进程");
    FormData tableViewFormData = new FormData();
    tableViewFormData.left = new FormAttachment(0, 5);
    tableViewFormData.right = new FormAttachment(100, -5);
    tableViewFormData.top = new FormAttachment(pkgNameText, 10);
    tableViewFormData.height = 125;
    Table table = targetPkgTableViewer.getTable();
    table.setLayoutData(tableViewFormData);
}
Also used : FormData(org.eclipse.swt.layout.FormData) MouseEvent(org.eclipse.swt.events.MouseEvent) Table(org.eclipse.swt.widgets.Table) CheckboxTableViewer(org.eclipse.jface.viewers.CheckboxTableViewer) ICheckStateListener(org.eclipse.jface.viewers.ICheckStateListener) TableColumn(org.eclipse.swt.widgets.TableColumn) PkgInfo(com.tencent.wstt.apt.data.PkgInfo) MouseListener(org.eclipse.swt.events.MouseListener) CheckStateChangedEvent(org.eclipse.jface.viewers.CheckStateChangedEvent) TableViewer(org.eclipse.jface.viewers.TableViewer) CheckboxTableViewer(org.eclipse.jface.viewers.CheckboxTableViewer) FormAttachment(org.eclipse.swt.layout.FormAttachment)

Example 2 with MouseListener

use of org.eclipse.swt.events.MouseListener 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)

Example 3 with MouseListener

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

the class OfflineActiveDialog 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 groupLicenseId = new Group(tparent, SWT.NONE);
    groupLicenseId.setText(Messages.getString("license.OfflineActiveDialog.licenseIdGroup"));
    GridDataFactory.fillDefaults().grab(true, true).applyTo(groupLicenseId);
    GridLayout layoutGroup = new GridLayout(2, false);
    layoutGroup.marginLeft = 5;
    layoutGroup.marginHeight = 100;
    groupLicenseId.setLayout(layoutGroup);
    Label label = new Label(groupLicenseId, SWT.NONE);
    label.setText(Messages.getString("license.LicenseManageDialog.licenseIdLabel"));
    createIdInputComp(groupLicenseId);
    Composite compLink = new Composite(groupLicenseId, 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) {
            }
        });
    } else {
        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"));
    return tparent;
}
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) Label(org.eclipse.swt.widgets.Label) GridData(org.eclipse.swt.layout.GridData)

Example 4 with MouseListener

use of org.eclipse.swt.events.MouseListener in project yyl_example by Relucent.

the class HelloCanvasArrow method open.

public void open() {
    final Display display = Display.getDefault();
    final Shell shell = new Shell();
    shell.setLayout(new FillLayout());
    final Canvas canvas = new Canvas(shell, SWT.NONE);
    canvas.setCursor(SWTResourceManager.getCursor(SWT.CURSOR_ARROW));
    canvas.addMouseListener(new MouseListener() {

        public void mouseDoubleClick(MouseEvent arg0) {
        }

        public void mouseDown(MouseEvent e) {
            p[0] = e.x;
            p[1] = e.y;
            b = true;
        }

        public void mouseUp(MouseEvent arg0) {
            if (b) {
                int[] tp = new int[4];
                tp[0] = p[0];
                tp[1] = p[0];
                tp[2] = p[0];
                tp[3] = p[3];
            }
            b = false;
        }
    });
    canvas.addMouseMoveListener(new MouseMoveListener() {

        public void mouseMove(MouseEvent e) {
            p[2] = e.x;
            p[3] = e.y;
            canvas.redraw();
        }
    });
    canvas.addPaintListener(new PaintListener() {

        public void paintControl(PaintEvent paintevent) {
            if (b) {
                paintArrow(paintevent.gc, new Point(p[0], p[1]), new Point(p[2], p[3]));
            }
        }
    });
    shell.setText("test");
    shell.setSize(300, 300);
    shell.layout();
    shell.open();
    while (!shell.isDisposed()) if (!display.readAndDispatch())
        display.sleep();
}
Also used : MouseMoveListener(org.eclipse.swt.events.MouseMoveListener) Shell(org.eclipse.swt.widgets.Shell) MouseListener(org.eclipse.swt.events.MouseListener) MouseEvent(org.eclipse.swt.events.MouseEvent) PaintEvent(org.eclipse.swt.events.PaintEvent) PaintListener(org.eclipse.swt.events.PaintListener) Canvas(org.eclipse.swt.widgets.Canvas) FillLayout(org.eclipse.swt.layout.FillLayout) Point(org.eclipse.swt.graphics.Point) Display(org.eclipse.swt.widgets.Display)

Example 5 with MouseListener

use of org.eclipse.swt.events.MouseListener in project tdi-studio-se by Talend.

the class ReviewComponentDialog method createRatingComp.

private void createRatingComp(Composite parent) {
    initImages();
    final Composite rateBtnComp = new Composite(parent, SWT.NONE);
    final GridLayout rateLayout = new GridLayout();
    rateLayout.numColumns = 5;
    rateBtnComp.setLayout(rateLayout);
    rateBtnComp.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    for (int i = 0; i < 5; i++) {
        final Button rateButton = new Button(rateBtnComp, SWT.NONE);
        rateButton.setLayoutData(new GridData(30, SWT.DEFAULT));
        rateButton.setImage(imageMap.get(1));
        rateButton.setData(0);
        rateBtnMap.put(i, rateButton);
        rateButton.addMouseTrackListener(new MouseTrackListener() {

            public void mouseHover(MouseEvent e) {
                handleMouseHover(rateButton);
            }

            public void mouseExit(MouseEvent e) {
                handleMouseExit(rateButton);
            }

            public void mouseEnter(MouseEvent e) {
            }
        });
        rateButton.addMouseListener(new MouseListener() {

            public void mouseUp(MouseEvent e) {
            }

            public void mouseDown(MouseEvent e) {
                handleMouseDown(rateButton);
                checkInput();
            }

            public void mouseDoubleClick(MouseEvent e) {
            }
        });
    }
    rateLabel = new Label(parent, SWT.NONE);
    rateLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    rateLabel.setText("Please select your rating*");
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) MouseEvent(org.eclipse.swt.events.MouseEvent) MouseListener(org.eclipse.swt.events.MouseListener) Composite(org.eclipse.swt.widgets.Composite) Button(org.eclipse.swt.widgets.Button) MouseTrackListener(org.eclipse.swt.events.MouseTrackListener) GridData(org.eclipse.swt.layout.GridData) Label(org.eclipse.swt.widgets.Label) Point(org.eclipse.swt.graphics.Point)

Aggregations

MouseEvent (org.eclipse.swt.events.MouseEvent)24 MouseListener (org.eclipse.swt.events.MouseListener)24 KeyEvent (org.eclipse.swt.events.KeyEvent)8 KeyListener (org.eclipse.swt.events.KeyListener)8 Point (org.eclipse.swt.graphics.Point)8 GridData (org.eclipse.swt.layout.GridData)8 GridLayout (org.eclipse.swt.layout.GridLayout)7 ModifyEvent (org.eclipse.swt.events.ModifyEvent)6 ModifyListener (org.eclipse.swt.events.ModifyListener)6 SelectionEvent (org.eclipse.swt.events.SelectionEvent)6 Composite (org.eclipse.swt.widgets.Composite)6 FocusEvent (org.eclipse.swt.events.FocusEvent)4 FocusListener (org.eclipse.swt.events.FocusListener)4 Label (org.eclipse.swt.widgets.Label)4 ExtendedModifyEvent (org.eclipse.swt.custom.ExtendedModifyEvent)3 ExtendedModifyListener (org.eclipse.swt.custom.ExtendedModifyListener)3 StyledText (org.eclipse.swt.custom.StyledText)3 TextChangeListener (org.eclipse.swt.custom.TextChangeListener)3 TextChangedEvent (org.eclipse.swt.custom.TextChangedEvent)3 TextChangingEvent (org.eclipse.swt.custom.TextChangingEvent)3