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);
}
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"));
}
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;
}
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();
}
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*");
}
Aggregations