org.eclipse.jface.viewers.IDoubleClickListener Java Examples
The following examples show how to use
org.eclipse.jface.viewers.IDoubleClickListener.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CodeSelectorFactory.java From elexis-3-core with Eclipse Public License 1.0 | 6 votes |
/** * Returns the {@link IDoubleClickListener} used on the Viewer of this * {@link CodeSelectorFactory}. Default implementation passes the selected {@link Object} * directly to the code selector target (manage via {@link CodeSelectorHandler}). If a * {@link Leistungsblock} is selected it will pass its contained elements to the code selector * target. </br> * </br> * Should be overridden by subclasses for special behaviour. * * @return */ public IDoubleClickListener getDoubleClickListener(){ return new IDoubleClickListener() { @Override public void doubleClick(DoubleClickEvent event){ ISelection selection = event.getSelection(); if (selection instanceof IStructuredSelection) { IStructuredSelection structuredSelection = (IStructuredSelection) selection; if (!structuredSelection.isEmpty()) { ICodeSelectorTarget target = CodeSelectorHandler.getInstance().getCodeSelectorTarget(); if (target != null) { Object obj = structuredSelection.getFirstElement(); // TODO implement for block target.codeSelected(obj); } } } } }; }
Example #2
Source File: ValidateableConstantSectionPart.java From tlaplus with MIT License | 6 votes |
/** * create the viewer */ @Override protected TableViewer createTableViewer(Table table) { // create TableViewer tableViewer = new TableViewer(table); // represent formulas in the view tableViewer.setContentProvider(new AssignmentContentProvider()); // on changed selection change button enablement tableViewer.addSelectionChangedListener(fSelectionChangedListener); // edit on double-click tableViewer.addDoubleClickListener(new IDoubleClickListener() { public void doubleClick(DoubleClickEvent event) { doEdit(); } }); return tableViewer; }
Example #3
Source File: RealTimeGroupTab.java From neoscada with Eclipse Public License 1.0 | 6 votes |
@Override public void init ( final VisibilityProviderFactory factory, final Composite parent, final Map<String, String> properties ) { this.shell = parent.getShell (); this.viewer = new RealTimeListViewer (); this.viewer.createControl ( parent ); this.viewer.addDoubleClickListener ( new IDoubleClickListener () { @Override public void doubleClick ( final DoubleClickEvent event ) { RealTimeGroupTab.this.handleDoubleClick ( event ); } } ); if ( this.input != null ) { attachInput (); } }
Example #4
Source File: ColumnMappingWizardPage.java From birt with Eclipse Public License 1.0 | 6 votes |
private void addDoubleClickListeners( ) { columnMappingsTable.addDoubleClickListener( new IDoubleClickListener( ) { public void doubleClick( DoubleClickEvent event ) { editColumnMapping( ); } }); classStructureTree.addDoubleClickListener( new IDoubleClickListener( ) { public void doubleClick( DoubleClickEvent arg0 ) { addColumnMappingsFromTree( ); } }); }
Example #5
Source File: TaskOverview.java From codeexamples-eclipse with Eclipse Public License 1.0 | 5 votes |
private void hookDoubleClickCommand() { viewer.addDoubleClickListener(new IDoubleClickListener() { @Override public void doubleClick(DoubleClickEvent event) { IHandlerService handlerService = getSite().getService(IHandlerService.class); try { handlerService.executeCommand("com.vogella.rcp.editor.example.openEditor", null); } catch (Exception ex) { throw new RuntimeException(ex.getMessage()); } } }); }
Example #6
Source File: JavaEditor.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
@Override protected IVerticalRulerColumn createAnnotationRulerColumn(CompositeRuler ruler) { if (!getPreferenceStore().getBoolean(PreferenceConstants.EDITOR_ANNOTATION_ROLL_OVER)) return super.createAnnotationRulerColumn(ruler); AnnotationRulerColumn column= new AnnotationRulerColumn(VERTICAL_RULER_WIDTH, getAnnotationAccess()); column.setHover(new JavaExpandHover(ruler, getAnnotationAccess(), new IDoubleClickListener() { public void doubleClick(DoubleClickEvent event) { // for now: just invoke ruler double click action triggerAction(ITextEditorActionConstants.RULER_DOUBLE_CLICK); } private void triggerAction(String actionID) { IAction action= getAction(actionID); if (action != null) { if (action instanceof IUpdate) ((IUpdate) action).update(); // hack to propagate line change if (action instanceof ISelectionListener) { ((ISelectionListener)action).selectionChanged(null, null); } if (action.isEnabled()) action.run(); } } })); return column; }
Example #7
Source File: JavaEditorColoringConfigurationBlock.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
/** * Installs a double-click listener which allows * to expand and collapse tree items. * * @since 3.4 */ private void installDoubleClickListener() { fTreeViewer.addDoubleClickListener(new IDoubleClickListener() { /* * @see org.eclipse.jface.viewers.IDoubleClickListener#doubleClick(org.eclipse.jface.viewers.DoubleClickEvent) */ public void doubleClick(DoubleClickEvent event) { IStructuredSelection s= (IStructuredSelection) event.getSelection(); Object element= s.getFirstElement(); if (fTreeViewer.isExpandable(element)) fTreeViewer.setExpandedState(element, !fTreeViewer.getExpandedState(element)); } }); }
Example #8
Source File: DialogPackageExplorer.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
public Control createControl(Composite parent) { fPackageViewer= new TreeViewer(parent, SWT.MULTI); fPackageViewer.setComparer(WorkingSetModel.COMPARER); fPackageViewer.addFilter(new PackageFilter()); fPackageViewer.setComparator(new ExtendedJavaElementSorter()); fPackageViewer.addDoubleClickListener(new IDoubleClickListener() { public void doubleClick(DoubleClickEvent event) { Object element= ((IStructuredSelection)event.getSelection()).getFirstElement(); if (fPackageViewer.isExpandable(element)) { fPackageViewer.setExpandedState(element, !fPackageViewer.getExpandedState(element)); } else { if (element instanceof CPListElementAttribute) { CPListElementAttribute attribute= (CPListElementAttribute)element; if (attribute.getKey().equals(CPListElement.OUTPUT)) { fActionGroup.getEditOutputFolderAction().run(); } } } } }); MenuManager menuMgr= new MenuManager("#PopupMenu"); //$NON-NLS-1$ menuMgr.setRemoveAllWhenShown(true); menuMgr.addMenuListener(this); fContextMenu= menuMgr.createContextMenu(fPackageViewer.getTree()); fPackageViewer.getTree().setMenu(fContextMenu); parent.addDisposeListener(new DisposeListener() { public void widgetDisposed(DisposeEvent e) { fContextMenu.dispose(); } }); return fPackageViewer.getControl(); }
Example #9
Source File: ProjectsView.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
/** * Adds additional listeners to this view. */ @Override protected void hookViewerListeners() { super.hookViewerListeners(); getViewer().addDoubleClickListener(new IDoubleClickListener() { public void doubleClick(DoubleClickEvent event) { TreeViewer viewer= (TreeViewer)getViewer(); Object element= ((IStructuredSelection)event.getSelection()).getFirstElement(); if (viewer.isExpandable(element)) viewer.setExpandedState(element, !viewer.getExpandedState(element)); } }); }
Example #10
Source File: MembersView.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
@Override protected void hookViewerListeners() { super.hookViewerListeners(); getViewer().addDoubleClickListener(new IDoubleClickListener() { public void doubleClick(DoubleClickEvent event) { TreeViewer viewer= (TreeViewer)getViewer(); Object element= ((IStructuredSelection)event.getSelection()).getFirstElement(); if (viewer.isExpandable(element)) viewer.setExpandedState(element, !viewer.getExpandedState(element)); } }); }
Example #11
Source File: LongMethod.java From JDeodorant with MIT License | 5 votes |
private void hookDoubleClickAction() { treeViewer.addDoubleClickListener(new IDoubleClickListener() { public void doubleClick(DoubleClickEvent event) { doubleClickAction.run(); } }); }
Example #12
Source File: DuplicatedCode.java From JDeodorant with MIT License | 5 votes |
private void hookDoubleClickAction() { treeViewer.addDoubleClickListener(new IDoubleClickListener() { public void doubleClick(DoubleClickEvent event) { doubleClickAction.run(); } }); }
Example #13
Source File: GraphStatsView.java From eclipse-cs with GNU Lesser General Public License v2.1 | 5 votes |
/** * Specifies which action will be run when double clicking on the viewer. * * @param action * the IAction to add */ private void hookDoubleClickAction(final IAction action, StructuredViewer viewer) { viewer.addDoubleClickListener(new IDoubleClickListener() { @Override public void doubleClick(DoubleClickEvent event) { action.run(); } }); }
Example #14
Source File: CurrentExceptionView.java From Pydev with Eclipse Public License 1.0 | 5 votes |
@Override public void createPartControl(Composite parent) { super.createPartControl(parent); viewer.addDoubleClickListener(new IDoubleClickListener() { /** * When double-clicking show the location that has thrown the exception (or the stack frame clicked). */ @Override public void doubleClick(DoubleClickEvent event) { ISelection selection = event.getSelection(); if (selection instanceof IStructuredSelection) { IStructuredSelection structuredSelection = (IStructuredSelection) selection; Object context = structuredSelection.getFirstElement(); if (context instanceof IAdaptable) { IAdaptable adaptable = (IAdaptable) context; IStackFrame frame = (IStackFrame) adaptable.getAdapter(IStackFrame.class); if (frame != null) { ISourceDisplay adapter = (ISourceDisplay) frame.getAdapter(ISourceDisplay.class); if (adapter != null) { IWorkbenchPage activePage = UIUtils.getActivePage(); if (activePage != null) { adapter.displaySource(frame, activePage, false); } } } } } } }); }
Example #15
Source File: ConceptualNodesTreeViewer.java From jbt with Apache License 2.0 | 5 votes |
/** * Constructor. */ public ConceptualNodesTreeViewer(Composite parent, int style) { super(parent, style); this.trees = new Vector<ConceptualNodesTree>(); this.setLayout(new FillLayout()); this.treeViewer = new TreeViewer(this, SWT.SINGLE); Tree treeWidget = (Tree) this.treeViewer.getControl(); // treeWidget.setLinesVisible(true); this.treeViewer.setContentProvider(new BTContentProvider()); this.treeViewer.setLabelProvider(new BTLabelProvider()); this.treeViewer.setInput(this.trees); /* Drag and drop support. */ Transfer[] transfers = new Transfer[] { ConceptualBTNodeTransfer.getInstance() }; this.treeViewer.addDragSupport(DND.DROP_MOVE, transfers, new NodesTreeViewerDragListener()); /* Double click listener for expanding and collapsing categories. */ this.treeViewer.addDoubleClickListener(new IDoubleClickListener() { public void doubleClick(DoubleClickEvent event) { Object node = ((StructuredSelection) event.getSelection()).getFirstElement(); if (node instanceof CategoryItem) { if (treeViewer.getExpandedState(node)) { treeViewer.collapseToLevel(node, 1); } else { treeViewer.expandToLevel(node, 1); } } } }); }
Example #16
Source File: AbstractManageDiagramWizardPage.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
protected Composite doCreateControl(final Composite parent, final DataBindingContext context) { final Composite mainComposite = new Composite(parent, SWT.NONE); mainComposite.setLayout(fillDefaults().numColumns(2).equalWidth(true).create()); diagramTree = new FilteredTree(mainComposite, SWT.MULTI | SWT.BORDER, new PatternFilter(), false); final TreeViewer treeViewer = diagramTree.getViewer(); treeViewer.getTree().setData(SWTBOT_WIDGET_ID_KEY, SWTBOT_ID_OPEN_DIAGRAM_TREE_ID); diagramTree .setLayoutData(GridDataFactory.fillDefaults().grab(true, true).span(2, 1).hint(SWT.DEFAULT, 250).create()); treeViewer.setContentProvider( new ObservableListTreeContentProvider(diagramListObservableFactory(), diagramTreeStructure())); treeViewer.setLabelProvider(new DiagramLabelProvider(new FileStoreLabelProvider())); final IObservableList selectionObservable = PojoObservables.observeList(this, "selectedDiagrams"); context.bindList(ViewersObservables.observeMultiSelection(diagramTree.getViewer()), selectionObservable); context.addValidationStatusProvider(new MultiValidator() { @Override protected IStatus validate() { return selectionObservable.isEmpty() ? ValidationStatus.error(Messages.noDiagramSelected) : ValidationStatus.ok(); } }); treeViewer.addDoubleClickListener(new IDoubleClickListener() { @Override public void doubleClick(final DoubleClickEvent arg0) { final IWizard wizard = getWizard(); if (wizard.canFinish() && wizard.performFinish() && wizard.getContainer() instanceof WizardDialog) { ((WizardDialog) wizard.getContainer()).close(); } } }); treeViewer.setInput(diagramRepositoryStore); treeViewer.getTree().setFocus(); defaultSelection(selectionObservable); return mainComposite; }
Example #17
Source File: DocumentsView.java From elexis-3-core with Eclipse Public License 1.0 | 5 votes |
private void hookDoubleClickAction(){ viewer.addDoubleClickListener(new IDoubleClickListener() { public void doubleClick(DoubleClickEvent event){ doubleClickAction.run(); } }); }
Example #18
Source File: SelectBestellungDialog.java From elexis-3-core with Eclipse Public License 1.0 | 5 votes |
protected Control createDialogArea(Composite container){ Composite parent = (Composite) super.createDialogArea(container); createMessageArea(parent); fTableViewer = new TableViewer(parent, getTableStyle()); fTableViewer.setContentProvider(ArrayContentProvider.getInstance()); addColumns(); setComparator(); fTableViewer.setInput(this); fTableViewer.addDoubleClickListener(new IDoubleClickListener() { public void doubleClick(DoubleClickEvent event){ if (fAddCancelButton) { okPressed(); } } }); List initialSelection = getInitialElementSelections(); if (initialSelection != null) { fTableViewer.setSelection(new StructuredSelection(initialSelection)); } GridData gd = new GridData(GridData.FILL_BOTH); gd.heightHint = convertHeightInCharsToPixels(heightInChars); gd.widthHint = convertWidthInCharsToPixels(widthInChars); Table table = fTableViewer.getTable(); table.setLayoutData(gd); table.setFont(container.getFont()); table.setHeaderVisible(true); IQuery<IOrder> query = CoreModelServiceHolder.get().getQuery(IOrder.class); fTableViewer.setInput(query.execute()); return parent; }
Example #19
Source File: LaunchConfigurationContent.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 5 votes |
private void createViewer(Label launchUrlsCaptionLabel) { viewer = new TreeViewer(this, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); viewer.getTree().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); viewer.setLabelProvider(new LabelProvider()); viewer.setContentProvider(new ContentProvider(launchUrlsCaptionLabel)); viewer.setInput(launchConfiguration); viewer.addDoubleClickListener(new IDoubleClickListener() { @Override public void doubleClick(DoubleClickEvent event) { browserMenuPopulator.openDefaultBrowser(getProject(launchConfiguration), getSelectedUrl()); } }); }
Example #20
Source File: SourceView.java From lapse-plus with GNU General Public License v3.0 | 5 votes |
private void hookDoubleClickAction() { viewer.addDoubleClickListener(new IDoubleClickListener() { public void doubleClick(DoubleClickEvent event) { doubleClickAction.run(); } }); }
Example #21
Source File: TsfTraceAnalysisView.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
private void hookDoubleClickAction() { viewer.addDoubleClickListener(new IDoubleClickListener() { @Override public void doubleClick(DoubleClickEvent event) { doubleClickAction.run(); } }); }
Example #22
Source File: ReportListView.java From CodeCheckerEclipsePlugin with Eclipse Public License 1.0 | 5 votes |
private void hookDoubleClickAction() { viewer.addDoubleClickListener(new IDoubleClickListener() { public void doubleClick(DoubleClickEvent event) { final IStructuredSelection selection = (IStructuredSelection) event.getSelection(); if (selection == null || selection.isEmpty()) { return; } final Object sel = selection.getFirstElement(); if(sel instanceof BugPathItem) { BugPathItem bpi = (BugPathItem) sel; jumpToBugPosition(bpi); return; } final ITreeContentProvider provider = (ITreeContentProvider) viewer.getContentProvider(); if (!provider.hasChildren(sel)) { return; } if (viewer.getExpandedState(sel)) { viewer.collapseToLevel(sel, AbstractTreeViewer.ALL_LEVELS); } else { viewer.expandToLevel(sel, 1); } } }); }
Example #23
Source File: DriverSelectionDialog.java From neoscada with Eclipse Public License 1.0 | 5 votes |
@Override protected Control createDialogArea ( final Composite parent ) { setTitle ( "Select driver" ); setMessage ( "Choose a driver from the world model" ); final Composite composite = (Composite)super.createDialogArea ( parent ); final ObservablesManager mgr = new ObservablesManager (); final TreeViewer viewer = new TreeViewer ( composite ); viewer.setAutoExpandLevel ( 2 ); viewer.getControl ().setLayoutData ( new GridData ( SWT.FILL, SWT.FILL, true, true ) ); viewer.addDoubleClickListener ( new IDoubleClickListener () { @Override public void doubleClick ( final DoubleClickEvent event ) { handleDoubleClick (); } } ); mgr.runAndCollect ( new Runnable () { @Override public void run () { createDataModel ( viewer ); } } ); return composite; }
Example #24
Source File: SyntaxColoringPreferencePage.java From xds-ide with Eclipse Public License 1.0 | 5 votes |
private void installDoubleClickListener() { fTreeViewer.addDoubleClickListener(new IDoubleClickListener() { public void doubleClick(DoubleClickEvent event) { IStructuredSelection s = (IStructuredSelection) event.getSelection(); Object element = s.getFirstElement(); if (fTreeViewer.isExpandable(element)) { fTreeViewer.setExpandedState(element,!fTreeViewer.getExpandedState(element)); } } }); }
Example #25
Source File: MarkerStatsView.java From eclipse-cs with GNU Lesser General Public License v2.1 | 5 votes |
/** * Specifies which action will be run when double clicking on the viewer. * * @param action * the IAction to add */ private void hookDoubleClickAction(final IAction action, StructuredViewer viewer) { viewer.addDoubleClickListener(new IDoubleClickListener() { @Override public void doubleClick(DoubleClickEvent event) { action.run(); } }); }
Example #26
Source File: TestResultsView.java From n4js with Eclipse Public License 1.0 | 5 votes |
private void hookDoubleClickAction() { testTreeViewer.addDoubleClickListener(new IDoubleClickListener() { @Override public void doubleClick(DoubleClickEvent event) { doubleClickAction.run(); } }); }
Example #27
Source File: ApiCompareView.java From n4js with Eclipse Public License 1.0 | 5 votes |
private void hookDoubleClickListener() { viewer.addDoubleClickListener(new IDoubleClickListener() { @Override public void doubleClick(DoubleClickEvent event) { actionOpenInEditor.run(); } }); }
Example #28
Source File: RealTimeListViewer.java From neoscada with Eclipse Public License 1.0 | 4 votes |
public void removeDoubleClickListener ( final IDoubleClickListener listener ) { this.viewer.removeDoubleClickListener ( listener ); }
Example #29
Source File: AddOrEditSrxConfigDialog.java From tmxeditor8 with GNU General Public License v2.0 | 4 votes |
/** * 创建语言规则配置 * @param tparent * ; */ private void createLanguageGroup(Composite tparent, GridData groupData, GridLayout groupLayout) { Group group = new Group(tparent, SWT.BORDER); group.setLayoutData(groupData); group.setLayout(groupLayout); group.setText(Messages.getString("srx.AddOrEditSrxConfigDialog.groupLang")); langTableViewer = new TableViewer(group, SWT.FULL_SELECTION | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI); langTable = langTableViewer.getTable(); langTable.setLinesVisible(true); langTable.setHeaderVisible(true); GridDataFactory.fillDefaults().span(4, SWT.DEFAULT).grab(true, true).applyTo(langTable); langTableViewer.setLabelProvider(new TableViewerLabelProvider()); langTableViewer.setContentProvider(new ArrayContentProvider()); String[] columnNames = new String[] { Messages.getString("srx.AddOrEditSrxConfigDialog.langColumnNames1"), Messages.getString("srx.AddOrEditSrxConfigDialog.langColumnNames2") }; int[] columnAlignments = new int[] { SWT.LEFT, SWT.LEFT }; for (int i = 0; i < columnNames.length; i++) { TableColumn tableColumn = new TableColumn(langTable, columnAlignments[i]); tableColumn.setText(columnNames[i]); tableColumn.setWidth(50); } refreshTableWidth(langTable); langAddBtn = new Button(group, SWT.NONE); langAddBtn.setText(Messages.getString("srx.AddOrEditSrxConfigDialog.langAddBtn")); setButtonLayoutData(langAddBtn); langEditBtn = new Button(group, SWT.NONE); langEditBtn.setText(Messages.getString("srx.AddOrEditSrxConfigDialog.langEditBtn")); setButtonLayoutData(langEditBtn); langDeleteBtn = new Button(group, SWT.NONE); langDeleteBtn.setText(Messages.getString("srx.AddOrEditSrxConfigDialog.langDeleteBtn")); setButtonLayoutData(langDeleteBtn); new Label(group, SWT.NONE); langTableViewer.addDoubleClickListener(new IDoubleClickListener() { public void doubleClick(DoubleClickEvent event) { editLangRules(); } }); }
Example #30
Source File: RealTimeListViewer.java From neoscada with Eclipse Public License 1.0 | 4 votes |
public void addDoubleClickListener ( final IDoubleClickListener listener ) { this.viewer.addDoubleClickListener ( listener ); }