private void addSelectionListenerToExpressionRadioButton(Button expressionRadioButton) { expressionRadioButton.addMouseListener(new MouseAdapter() { @Override public void mouseUp(MouseEvent e) { outputRecordCoundText.setEnabled(true); editButton.setEnabled(true); transformMapping.setExpression(true); propertyDialogButtonBar.enableApplyButton(true); if(!transformMapping.getExpressionEditorData().isValid()) { expressionValidateDecorator.show(); } OutputRecordCountUtility.INSTANCE.removeOperationFieldFromOutputList(transformMapping); OutputRecordCountUtility.INSTANCE.addExpressionOutputFieldToOuterListOfMappingWindow(transformMapping); setSchemaUpdated(false); outputList.clear(); SchemaSyncUtility.INSTANCE.unionFilter(transformMapping.getOutputFieldList(), outputList); OutputRecordCountUtility.INSTANCE.propagateOuputFieldsToSchemaTabFromTransformWidget( transformMapping,getSchemaForInternalPropagation(),getComponent(),outputList ); } }); }
private void addSelectionListenerToOperationRadioButton(Button operationRadioButton) { operationRadioButton.addMouseListener(new MouseAdapter() { @Override public void mouseUp(MouseEvent e) { outputRecordCoundText.setEnabled(false); editButton.setEnabled(false); transformMapping.setExpression(false); propertyDialogButtonBar.enableApplyButton(true); expressionValidateDecorator.hide(); OutputRecordCountUtility.INSTANCE.removeExpressionFieldFromOutputList(transformMapping); OutputRecordCountUtility.INSTANCE.addOperationOutputFieldToOuterListOfMappingWindow(transformMapping); setSchemaUpdated(false); outputList.clear(); SchemaSyncUtility.INSTANCE.unionFilter(transformMapping.getOutputFieldList(), outputList); OutputRecordCountUtility.INSTANCE.propagateOuputFieldsToSchemaTabFromTransformWidget( transformMapping,getSchemaForInternalPropagation(),getComponent(),outputList ); } }); }
private void addImportSchemaButton(ELTSchemaSubgroupComposite buttonSubGroup) { importSchemaButton = new ELTDefaultButton(""); SchemaButtonsSyncUtility.INSTANCE.buttonSize(importSchemaButton, macButtonWidth, macButtonHeight, windowButtonWidth, windowButtonHeight); buttonSubGroup.attachWidget(importSchemaButton); importSchemaButton.setImage(ImagePathConstant.IMPORT_SCHEMA_BUTTON); importSchemaButton.setToolTipText(Messages.IMPORT_SCHEMA_KEY_SHORTCUT_TOOLTIP); Button importButton = (Button) importSchemaButton.getSWTWidgetControl(); importButton.addMouseListener(new MouseAdapter() { @Override public void mouseDown(MouseEvent e) { importSchema(importButton); } }); }
private void addExportSchemaButton(ELTSchemaSubgroupComposite buttonSubGroup) { exportSchemaButton = new ELTDefaultButton(""); SchemaButtonsSyncUtility.INSTANCE.buttonSize(exportSchemaButton, macButtonWidth, macButtonHeight, windowButtonWidth, windowButtonHeight); buttonSubGroup.attachWidget(exportSchemaButton); exportSchemaButton.setImage(ImagePathConstant.EXPORT_SCHEMA_BUTTON); exportSchemaButton.setToolTipText(Messages.EXPORT_SCHEMA_KEY_SHORTCUT_TOOLTIP); Button exportButton = (Button) exportSchemaButton.getSWTWidgetControl(); exportButton.addMouseListener(new MouseAdapter() { @Override public void mouseDown(MouseEvent e) { exportSchemaIntoFile(exportButton); } }); }
private void addUpButton(ELTSchemaSubgroupComposite buttonSubGroup) { upButton = new ELTDefaultButton(""); SchemaButtonsSyncUtility.INSTANCE.buttonSize(upButton, macButtonWidth, macButtonHeight, windowButtonWidth, windowButtonHeight); buttonSubGroup.attachWidget(upButton); upButton.setImage(ImagePathConstant.MOVEUP_BUTTON); upButton.setToolTipText(Messages.MOVE_UP_KEY_SHORTCUT_TOOLTIP); ((Button)upButton.getSWTWidgetControl()).addMouseListener(new MouseAdapter() { @Override public void mouseDown(MouseEvent e) { moveRowUp(); } }); }
private void addDownButton(ELTSchemaSubgroupComposite buttonSubGroup) { downButton = new ELTDefaultButton(""); SchemaButtonsSyncUtility.INSTANCE.buttonSize(downButton, macButtonWidth, macButtonHeight, windowButtonWidth, windowButtonHeight); buttonSubGroup.attachWidget(downButton); downButton.setImage(ImagePathConstant.MOVEDOWN_BUTTON); downButton.setToolTipText(Messages.MOVE_DOWN_KEY_SHORTCUT_TOOLTIP); ((Button)downButton.getSWTWidgetControl()).addMouseListener(new MouseAdapter() { @Override public void mouseDown(MouseEvent e) { moveRowDown(); } }); }
/** * Create an instance of the receiver in the supplied region. * * @param region * The ProgressRegion that contains the receiver. * @param flags * flags to use for creation of the progress bar */ ProgressAnimationItem(ProgressRegion region, int flags, AnimationManager animationManager, FinishedJobs finishedJobs) { super(animationManager); this.flags = flags; this.finishedJobs = finishedJobs; finishedJobs.addListener(this); progressRegion = region; mouseListener = new MouseAdapter() { @Override public void mouseDoubleClick(MouseEvent e) { doAction(); } }; }
@Override protected void createButtonsForButtonBar(final Composite parent) { GridLayout parentLayout = (GridLayout) parent.getLayout(); parentLayout.makeColumnsEqualWidth = false; openWithButton = createDropdownButton(parent, OPEN_WITH_ID, "Open with", new MouseAdapter() { @Override public void mouseDown(MouseEvent e) { showOpenWithMenu(); } }); setButtonLayoutData(openWithButton); new Label(parent, SWT.NONE).setLayoutData(new GridData(5, 0)); parentLayout.numColumns++; Button okButton = createButton(parent, IDialogConstants.OK_ID, "Open", true); Button cancelButton = createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); GridData cancelLayoutData = (GridData) cancelButton.getLayoutData(); GridData okLayoutData = (GridData) okButton.getLayoutData(); int buttonWidth = Math.max(cancelLayoutData.widthHint, okLayoutData.widthHint); cancelLayoutData.widthHint = buttonWidth; okLayoutData.widthHint = buttonWidth; }
private void addTable(){ MouseListener listener = mouseFocusListener(); this.table = new TGTable(this.context, getComposite()); this.table.getColumnNumber().getControl().addMouseListener(listener); this.table.getColumnSoloMute().getControl().addMouseListener(listener); this.table.getColumnName().getControl().addMouseListener(listener); this.table.getColumnInstrument().getControl().addMouseListener(listener); this.table.getColumnCanvas().getControl().addMouseListener(listener); this.table.getColumnCanvas().getControl().addMouseListener(new MouseAdapter() { public void mouseDoubleClick(MouseEvent e) { new TGActionProcessor(TuxGuitar.getInstance().getContext(), TGOpenSongInfoDialogAction.NAME).process(); } }); this.fireUpdate(true); this.loadProperties(); }
private void addMouseListenerToTabFolder() { final CTabFolder tabFolder = (CTabFolder) getContainer(); tabFolder.addMouseListener(new MouseAdapter() { @Override public void mouseDoubleClick(final MouseEvent mouseevent) { final Category category = getPageCategory(getActivePage()); if (category != null) { final CategoryNameChangeDialog dialog = new CategoryNameChangeDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), category); if (dialog.open() == IDialogConstants.OK_ID) { final ChangeCategoryNameCommand command = new ChangeCategoryNameCommand(diagram, category, dialog.getCategoryName()); execute(command); } } super.mouseDoubleClick(mouseevent); } }); }
@Override protected void createContents() { TableWrapper<ItemBean> table = this.addTable(this.shell) .setContentSupplier(CreateReportLogic::getItemTablecontent) .reload() .update(); table.getTable().addMouseListener(new MouseAdapter() { @Override public void mouseDoubleClick(MouseEvent e) { ItemBean[] selection = table.getSelection(ItemBean[]::new); for (ItemBean item : selection) { ShipFilterDto filter = new ShipFilterDto(); filter.itemname = item.getName(); new ShipTable(ItemTable.this.getParent(), filter).open(); } } }); }
@Override protected void createContents() { TableWrapper<DropReportBean> table = this.addTable(this.shell) .setContentSupplier(CreateReportLogic::getBattleResultContent) .reload() .update(); table.getTable().addMouseListener(new MouseAdapter() { @Override public void mouseDoubleClick(MouseEvent e) { DropReportBean[] selection = table.getSelection(DropReportBean[]::new); for (DropReportBean item : selection) { new BattleDialog(DropReportTable.this.shell, item.getResult()).open(); } } }); }
public CellEditor createPropertyEditor(Composite parent) { if (!this.editable){ return null; } final ComboBoxCellEditor cellEditor = new ComboBoxCellEditor(parent, new String[]{DEFAULT, Boolean.TRUE.toString(),Boolean.FALSE.toString()}, SWT.READ_ONLY); Control control = cellEditor.getControl(); control.addMouseListener(new MouseAdapter() { private final Integer ONE = new Integer(1); private final Integer TWO = new Integer(2); @Override public void mouseDoubleClick(MouseEvent e) { if (ONE.equals(cellEditor.getValue())){//true cellEditor.setValue(2);//false } else if (TWO.equals(cellEditor.getValue())){//false cellEditor.setValue(1);//true } super.mouseDoubleClick(e); } }); if (getValidator() != null) { cellEditor.setValidator(getValidator()); } return cellEditor; }
protected void createHelpWidget(final Composite parent, final Control control, String helpId) { final ImageHyperlink helpWidget = toolkit.createImageHyperlink(parent, SWT.CENTER); Image defaultImage = PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_LCL_LINKTO_HELP); helpWidget.setImage(defaultImage); GridDataFactory.fillDefaults().align(SWT.FILL, SWT.TOP).applyTo(helpWidget); helpWidget.setToolTipText(JFaceResources.getString(IDialogLabelKeys.HELP_LABEL_KEY)); helpWidget.addMouseListener(new MouseAdapter() { public void mouseDown(MouseEvent e) { control.setFocus(); PlatformUI.getWorkbench().getHelpSystem().displayDynamicHelp(); } }); GridDataFactory.fillDefaults().applyTo(helpWidget); helpWidget.setEnabled(true); setHelpContext(control, helpId); }
private void registerListener() { getTable().addMouseListener(new MouseAdapter() { @Override public void mouseDoubleClick(final MouseEvent event) { if (getSelection() instanceof IStructuredSelection) { final IStructuredSelection selection = (IStructuredSelection) getSelection(); if (selection.getFirstElement() instanceof DiffViewModel) { final DiffViewModel selectedDiff = (DiffViewModel) selection.getFirstElement(); final GitFileDiffEditorInput editorInput = new GitFileDiffEditorInput(selectedDiff.getDiff()); if ((event.stateMask & SWT.CTRL) != 0) { CompareUtil.openNewCompareEditor(editorInput); } else { CompareUtil.openExistingCompareEditor(editorInput); } } } getSelection(); } }); }
/** Initialize * @param parent Parent widget */ public ColorBlob(final Composite parent, final RGB rgb) { super(parent, SWT.BORDER); color = new Color(getDisplay(), rgb); addDisposeListener(this); addPaintListener(this); addMouseListener(new MouseAdapter() { @Override public void mouseDown(MouseEvent e) { if (selected != null) selected.widgetSelected(null); } }); }
/** {@inheritDoc} */ @Override final public Composite createComponents(final Composite parent) throws Exception { control = createSWTControl(parent); control.addMouseListener(new MouseAdapter() { @Override public void mouseDown(final MouseEvent e) { toolkit.fireClick(model_widget, (e.stateMask & SWT.CONTROL) != 0); } }); registerListeners(); updateChanges(); return getChildParent(parent); }
public ShowTabListButton(Composite parent, int style, TabArea tabArea) { super(parent, style, true); this.tabArea = tabArea; tabArea.addLayoutListener(this); menu = new PartListMenu(tabArea, false, false); setToolTipText("Show tab list"); addMouseListener(new MouseAdapter() { public void mouseUp(MouseEvent e) { if(menu != null){ Point toDisplay = toDisplay(getLocation()); toDisplay.y += getSize().y; menu.show(ShowTabListButton.this, toDisplay, true); } } }); }
/** * Contributes double-click support, expanding/collapsing nodes. * * @param treeViewer * tree viewer */ private void contributeDoubleClick(final TreeViewer treeViewer) { treeViewer.getTree().addMouseListener(new MouseAdapter() { public void mouseDoubleClick(MouseEvent event) { IStructuredSelection selection = (IStructuredSelection) treeViewer .getSelection(); Object element = selection.getFirstElement(); if (treeViewer.isExpandable(element)) { if (treeViewer.getExpandedState(element)) { treeViewer.collapseToLevel(element, 1); } else { treeViewer.expandToLevel(element, 1); } } } }); }
public GenericInfoPopupDialog(Shell parentShell, String title, String message, final Runnable runnable) { super(parentShell, PopupDialog.INFOPOPUPRESIZE_SHELLSTYLE | SWT.MODELESS, false, true, true, false, false, title, null); this.message = message; clickListener = new MouseAdapter() { @Override public void mouseDown(MouseEvent e) { if (runnable != null) { runnable.run(); } close(); } }; }
private void addMouseListenerToTabFolder() { final CTabFolder tabFolder = (CTabFolder) getContainer(); tabFolder.addMouseListener(new MouseAdapter() { @Override public void mouseDoubleClick(MouseEvent mouseevent) { final Category category = getCurrentPageCategory(); if (category != null) { final CategoryNameChangeDialog dialog = new CategoryNameChangeDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), category); if (dialog.open() == IDialogConstants.OK_ID) { final ChangeCategoryNameCommand command = new ChangeCategoryNameCommand(diagram, category, dialog.getCategoryName()); execute(command); } } super.mouseDoubleClick(mouseevent); } }); }
/** * Contributes double-click support, expanding/collapsing nodes. * @param treeViewer tree viewer */ private void contributeDoubleClick(final TreeViewer treeViewer) { treeViewer.getTree().addMouseListener(new MouseAdapter() { public void mouseDoubleClick(MouseEvent event) { IStructuredSelection selection = (IStructuredSelection) treeViewer.getSelection(); Object element = selection.getFirstElement(); if (treeViewer.isExpandable(element)) { if (treeViewer.getExpandedState(element)) { treeViewer.collapseToLevel(element, 1); } else { treeViewer.expandToLevel(element, 1); } } } }); }
/** * Contributes double-click support, expanding/collapsing nodes. * @param treeViewer tree viewer */ private void contributeDoubleClick(final TreeViewer treeViewer) { treeViewer.getTree().addMouseListener(new MouseAdapter() { @Override public void mouseDoubleClick(final MouseEvent event) { final IStructuredSelection selection = (IStructuredSelection) treeViewer.getSelection(); final Object element = selection.getFirstElement(); if (treeViewer.isExpandable(element)) { if (treeViewer.getExpandedState(element)) { treeViewer.collapseToLevel(element, 1); } else { treeViewer.expandToLevel(element, 1); } } } }); }
public TypableCombo(Composite parent, int style) { super(parent, style); new FilteringAdapter(this); // MAE-4628 addMouseListener(new MouseAdapter() { @Override public void mouseDown(MouseEvent e) { setFocus(); } }); addListener(SWT.Selection, new Listener() { @Override public void handleEvent(Event arg0) { resetIndexes(); } }); }
public LevelIndicator(Composite parent, int style, int minLevel, int maxLevel) { super(parent, style); max = maxLevel; min = minLevel; addPaintListener(this); addDisposeListener(this); red = new Color(parent.getDisplay(), 255, 100 ,0); green = new Color(parent.getDisplay(), 0, 255 ,100); size = new Point(LEVEL_WIDTH+2, LEVEL_HEIGHT); addMouseListener(new MouseAdapter() { @Override public void mouseUp(MouseEvent e) { reset(); } }); }
public DisappearText(Composite parent, String text, int style) { super(parent, style); setText(text); setRedraw(true); setTextLimit(1000); addMouseListener(new MouseAdapter() { @Override public void mouseUp(MouseEvent e) { if(!isBeenClicked()){ setText(""); setBeenClicked(true); } } }); }
@Override public void createPartControl(Composite parent) { Composite composite = new Composite(parent, SWT.None); FillLayout layout = new FillLayout(); layout.type = SWT.VERTICAL; composite.setLayout(layout); { label = new Label(composite, SWT.None); setCurrentUser(username); logout = new Button(composite, SWT.None); logout.setText("Logout"); logout.addMouseListener(new MouseAdapter() { @Override public void mouseUp(MouseEvent e) { super.mouseUp(e); logout(); } }); logout.setVisible(false); } callback = new SetCurrentUser(); UINotifierManager.register(ModelExplorer.EVENT_USER_LOGGED_IN, RWT.getUISession(), callback); }
/** * 初始化自定义过滤器列表 * @param comp * 父容器 */ private void initCustomFilterList(Composite comp) { customFilterList = new List(comp, SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER); GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1); gridData.widthHint = 110; gridData.heightHint = 250; customFilterList.setLayoutData(gridData); setListData(customFilterList, customFilters); customFilterList.addMouseListener(new MouseAdapter() { @Override public void mouseDoubleClick(MouseEvent e) { edit(); } }); }
@Override public void createPartControl(Composite parent) { GridLayoutFactory.fillDefaults().numColumns(1).applyTo(parent); parent.setLayoutData(new GridData(GridData.FILL_BOTH)); cmp = new Composite(parent, SWT.BORDER); GridLayoutFactory.fillDefaults().numColumns(1).applyTo(cmp); GridDataFactory.fillDefaults().grab(true, true).applyTo(cmp); browser = new Browser(cmp, SWT.NONE); browser.setLayoutData(new GridData(GridData.FILL_BOTH)); browser.setUrl(htmlUrl); browser.addMouseListener(new MouseAdapter() { @Override public void mouseDown(MouseEvent e) { getSite().getPart().setFocus(); super.mouseDown(e); } }); }
public ColorPicker(Composite parent, final Color originalColor) { super(parent, SWT.SHADOW_OUT); if (originalColor == null) throw new IllegalArgumentException("null"); this.selectedColor = originalColor; setImage(getColorImage(originalColor)); addMouseListener( new MouseAdapter() { @Override public void mouseDown(MouseEvent e) { ColorDialog dialog = new ColorDialog(new Shell(Display.getDefault(), SWT.SHELL_TRIM)); dialog.setRGB(selectedColor.getRGB()); RGB selected = dialog.open(); if (selected != null) { update(selected); } } }); }
Hover(Shell parent) { final Display display = parent.getDisplay(); hoverShell = new Shell(parent, SWT.NO_TRIM | SWT.ON_TOP | SWT.NO_FOCUS | SWT.TOOL); hoverShell.setBackground(display .getSystemColor(SWT.COLOR_INFO_BACKGROUND)); hoverShell.setForeground(display .getSystemColor(SWT.COLOR_INFO_FOREGROUND)); hoverShell.addPaintListener(new PaintListener() { public void paintControl(PaintEvent pe) { pe.gc.drawText(text, hm, hm); if (!MAC) { pe.gc.drawPolygon(getPolygon(true)); } } }); hoverShell.addMouseListener(new MouseAdapter() { public void mouseDown(MouseEvent e) { hideHover(); } }); }
Hover(Shell parent) { final Display display = parent.getDisplay(); hoverShell = new Shell(parent, SWT.NO_TRIM | SWT.ON_TOP | SWT.NO_FOCUS | SWT.TOOL); hoverShell.setBackground(display .getSystemColor(SWT.COLOR_INFO_BACKGROUND)); hoverShell.setForeground(display .getSystemColor(SWT.COLOR_INFO_FOREGROUND)); hoverShell.addPaintListener(new PaintListener() { public void paintControl(PaintEvent pe) { pe.gc.drawString(text, hm, hm); if (!MAC) { pe.gc.drawPolygon(getPolygon(true)); } } }); hoverShell.addMouseListener(new MouseAdapter() { public void mouseDown(MouseEvent e) { hideHover(); } }); }
protected void hookControl(Control control) { super.hookControl(control); tableTree.getTable().addMouseListener(new MouseAdapter() { public void mouseDown(MouseEvent e) { /* * If user clicked on the [+] or [-], do not activate * CellEditor. */ // XXX: This code should not be here. SWT should either have // support to see // if the user clicked on the [+]/[-] or manage the table editor // activation org.eclipse.swt.widgets.TableItem[] items = tableTree .getTable().getItems(); for (int i = 0; i < items.length; i++) { Rectangle rect = items[i].getImageBounds(0); if (rect.contains(e.x, e.y)) { return; } } tableEditorImpl.handleMouseDown(e); } }); }
private static void makeLink(Label control, final String url) { control.setCursor(control.getDisplay().getSystemCursor(SWT.CURSOR_HAND)); control.addMouseListener(new MouseAdapter() { /** * */ private static final long serialVersionUID = 1L; @Override public void mouseDown(MouseEvent e) { final JavaScriptExecutor executor = RWT.getClient().getService( JavaScriptExecutor.class); if (executor != null) { executor.execute("window.location.href = '" + url + "'"); } } }); }
private void createTableListener() { final Table tblConfiguredElements = checkConfElemsTblViewer.getTable(); tblConfiguredElements.addMouseListener(new MouseAdapter() { @Override public void mouseDown(MouseEvent e) { if (tblConfiguredElements.getSelectionCount() > 0) { TableItem item = tblConfiguredElements.getSelection()[0]; if (item.getBounds(0).contains(new Point(e.x, e.y))) { Object data = item.getData(); boolean oldState = checkConfElemsTblViewer.getChecked(data); checkConfElemsTblViewer.setChecked(data, !oldState); } } } }); }