org.eclipse.jface.viewers.DoubleClickEvent Java Examples
The following examples show how to use
org.eclipse.jface.viewers.DoubleClickEvent.
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: WizardDoubleClickListenerTest.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
@Test public void should_perform_finish_on_double_click() { IWizard wizard = mock(IWizard.class); when(wizard.canFinish()).thenReturn(true); when(wizard.performFinish()).thenReturn(true); IWizardPage currentPage = mock(IWizardPage.class); when(currentPage.getWizard()).thenReturn(wizard); WizardDialog wizardContainer = mock(WizardDialog.class); when(wizardContainer.getCurrentPage()).thenReturn(currentPage); WizardDoubleClickListener listener = new WizardDoubleClickListener(wizardContainer); DoubleClickEvent event = mock(DoubleClickEvent.class); listener.doubleClick(event); verify(wizard).performFinish(); verify(wizardContainer).close(); }
Example #2
Source File: TreeExpandingDoubleClickListener.java From statecharts with Eclipse Public License 1.0 | 6 votes |
public void doubleClick(DoubleClickEvent event) { IStructuredSelection selection = (IStructuredSelection) event .getSelection(); Object firstElement = selection.getFirstElement(); if (treeViewer.isExpandable(firstElement)) { boolean expanded = treeViewer.getExpandedState(firstElement); treeViewer.setExpandedState(firstElement, !expanded); } else { // FIXME :: does not trigger validation boolean newState = !treeViewer.getChecked(firstElement); treeViewer.setChecked(firstElement, newState); if (checkStateListener != null) { checkStateListener .checkStateChanged(new CheckStateChangedEvent( treeViewer, firstElement, newState)); } } }
Example #3
Source File: GamaNavigator.java From gama with GNU General Public License v3.0 | 6 votes |
@Override protected void handleDoubleClick(final DoubleClickEvent anEvent) { final IStructuredSelection selection = (IStructuredSelection) anEvent.getSelection(); final Object element = selection.getFirstElement(); if (element instanceof VirtualContent && ((VirtualContent<?>) element).handleDoubleClick()) { if (element instanceof Tag) { Tag t = (Tag) element; findControl.searchFor(t.getName()); return; } } else { super.handleDoubleClick(anEvent); } if (element instanceof WrappedContainer || element instanceof TopLevelFolder) { final CommonViewer tree = getCommonViewer(); if (tree.getExpandedState(element)) { final Object[] contents = ((VirtualContent<?>) element).getNavigatorChildren(); if (contents.length > 0) { tree.reveal(contents[contents.length - 1]); } } } }
Example #4
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 #5
Source File: ToolboxExplorer.java From tlaplus with MIT License | 6 votes |
/** * Open on double-click */ protected void handleDoubleClick(DoubleClickEvent anEvent) { super.handleDoubleClick(anEvent); // open the model if (anEvent.getSelection() instanceof IStructuredSelection) { IStructuredSelection iss = (IStructuredSelection) anEvent.getSelection(); Object firstElement = iss.getFirstElement(); if (firstElement instanceof Module) { final Map<String, String> parameters = new HashMap<String, String>(); parameters.put(OpenModuleHandler.PARAM_MODULE, ((Module) firstElement).getModuleName()); UIHelper.runCommand(OpenModuleHandler.COMMAND_ID, parameters); } else if (firstElement instanceof IGroup) { // No-Op } else if (firstElement instanceof Spec && ((Spec) firstElement).isCurrentSpec()) { // No-op, do not re-open an open spec again. } else { UIHelper.runCommand(ToolboxExplorer.COMMAND_ID, new HashMap<String, String>()); } } }
Example #6
Source File: CheckConfigurationConfigureDialog.java From eclipse-cs with GNU Lesser General Public License v2.1 | 6 votes |
/** * @see IDoubleClickListener#doubleClick(org.eclipse.jface.viewers.DoubleClickEvent) */ @Override public void doubleClick(DoubleClickEvent event) { if (event.getViewer() == mTableViewer) { openModule(event.getSelection()); } else if (event.getViewer() == mTreeViewer) { IStructuredSelection selection = (IStructuredSelection) event.getSelection(); Object element = selection.getFirstElement(); if (element instanceof RuleGroupMetadata) { mTreeViewer.setExpandedState(element, !mTreeViewer.getExpandedState(element)); } else { newModule(event.getSelection()); } } }
Example #7
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 #8
Source File: LibraryExplorerTreeViewPage.java From birt with Eclipse Public License 1.0 | 6 votes |
/** * Handles a double-click event from the viewer. * * @param event * the double-click event */ protected void handleDoubleClick( DoubleClickEvent event ) { IStructuredSelection selection = (IStructuredSelection) event.getSelection( ); Object element = selection.getFirstElement( ); TreeViewer viewer = getTreeViewer( ); if ( element instanceof ResourceEntryWrapper ) { switch ( ( (ResourceEntryWrapper) element ).getType( ) ) { case ResourceEntryWrapper.LIBRARY : return; case ResourceEntryWrapper.CSS_STYLE_SHEET : default : break; } } if ( viewer.isExpandable( element ) ) { viewer.setExpandedState( element, !viewer.getExpandedState( element ) ); } }
Example #9
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 #10
Source File: ICEResourceView.java From ice with Eclipse Public License 1.0 | 6 votes |
/** * This method listens for a double click event on a resource. If the * selected resource is valid, then it will be displayed on the view's * associated {@link ICEResourceView#resourcePage}. */ @Override public void doubleClick(DoubleClickEvent event) { // Get the associated resource ISelection selection = event.getSelection(); ICEResource selectedResource = getResourceFromSelection(selection); // If it's valid, try to display it on the ResourcePage if (selectedResource != null) { try { resourcePage.getEditor().setActivePage(resourcePage.getId()); resourcePage.showResource(selectedResource); } catch (PartInitException e) { logger.error(getClass().getName() + " Exception!", e); } } return; }
Example #11
Source File: WizardDoubleClickListenerTest.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
@Test public void should_not_go_to_next_page_or_exit_on_double_click() { IWizard wizard = mock(IWizard.class); when(wizard.canFinish()).thenReturn(false); IWizardPage currentPage = mock(IWizardPage.class); IWizardPage nextPage = mock(IWizardPage.class); when(currentPage.getWizard()).thenReturn(wizard); when(currentPage.getNextPage()).thenReturn(nextPage); when(currentPage.canFlipToNextPage()).thenReturn(false); WizardDialog wizardContainer = mock(WizardDialog.class); when(wizardContainer.getCurrentPage()).thenReturn(currentPage); WizardDoubleClickListener listener = new WizardDoubleClickListener(wizardContainer); DoubleClickEvent event = mock(DoubleClickEvent.class); listener.doubleClick(event); verify(wizardContainer, times(0)).close(); }
Example #12
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 #13
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 #14
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 #15
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 #16
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 #17
Source File: WhiteSpaceTabPage.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
public void doubleClick(DoubleClickEvent event) { final ISelection selection= event.getSelection(); if (selection instanceof IStructuredSelection) { final Node node= (Node)((IStructuredSelection)selection).getFirstElement(); fTreeViewer.setExpandedState(node, !fTreeViewer.getExpandedState(node)); } }
Example #18
Source File: LineWrappingTabPage.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
public void doubleClick(DoubleClickEvent event) { final ISelection selection= event.getSelection(); if (selection instanceof IStructuredSelection) { final Category node= (Category)((IStructuredSelection)selection).getFirstElement(); fCategoriesViewer.setExpandedState(node, !fCategoriesViewer.getExpandedState(node)); } }
Example #19
Source File: ResourceTree.java From tmxeditor8 with GNU General Public License v2.0 | 5 votes |
/** * 双击事件,若双击,自动展开该文件夹 */ public void doubleClick(final DoubleClickEvent event) { BusyIndicator.showWhile(getControl().getDisplay(), new Runnable() { public void run() { ISelection selection = event.getSelection(); IStructuredSelection struSelection = (IStructuredSelection) selection; Object obj = struSelection.getFirstElement(); if (getExpandedState(obj)) { collapseToLevel(obj, 1); }else { expandToLevel(obj, 1); } } }); }
Example #20
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 #21
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 #22
Source File: HybridProfileDialog.java From XPagesExtensionLibrary with Apache License 2.0 | 5 votes |
@Override public void doubleClick(DoubleClickEvent event) { if (_profile != null) { setReturnCode(OK); close(); } }
Example #23
Source File: BlockSelector.java From elexis-3-core with Eclipse Public License 1.0 | 5 votes |
@Override public void doubleClick(DoubleClickEvent event){ IStructuredSelection selection = cv.getViewerWidget().getStructuredSelection(); if (!selection.isEmpty()) { List<Object> ret = collectSelections(selection); ICodeSelectorTarget target = CodeSelectorHandler.getInstance().getCodeSelectorTarget(); for (Object o : ret) { target.codeSelected(o); } } }
Example #24
Source File: ResourceTree.java From translationstudio8 with GNU General Public License v2.0 | 5 votes |
/** * 双击事件,若双击,自动展开该文件夹 */ public void doubleClick(final DoubleClickEvent event) { BusyIndicator.showWhile(getControl().getDisplay(), new Runnable() { public void run() { ISelection selection = event.getSelection(); IStructuredSelection struSelection = (IStructuredSelection) selection; Object obj = struSelection.getFirstElement(); if (getExpandedState(obj)) { collapseToLevel(obj, 1); }else { expandToLevel(obj, 1); } } }); }
Example #25
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 #26
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 #27
Source File: PackageExplorerActionGroup.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
void handleDoubleClick(DoubleClickEvent event) { TreeViewer viewer= fPart.getTreeViewer(); IStructuredSelection selection= (IStructuredSelection)event.getSelection(); Object element= selection.getFirstElement(); if (viewer.isExpandable(element)) { if (doubleClickGoesInto()) { // don't zoom into compilation units and class files if (element instanceof ICompilationUnit || element instanceof IClassFile) return; if (element instanceof IOpenable || element instanceof IContainer || element instanceof IWorkingSet) { fZoomInAction.run(); } } else { IAction openAction= fNavigateActionGroup.getOpenAction(); if (openAction != null && openAction.isEnabled() && OpenStrategy.getOpenMethod() == OpenStrategy.DOUBLE_CLICK) return; if (selection instanceof ITreeSelection) { TreePath[] paths= ((ITreeSelection)selection).getPathsFor(element); for (int i= 0; i < paths.length; i++) { viewer.setExpandedState(paths[i], !viewer.getExpandedState(paths[i])); } } else { viewer.setExpandedState(element, !viewer.getExpandedState(element)); } } } else if (element instanceof IProject && !((IProject) element).isOpen()) { OpenProjectAction openProjectAction= fProjectActionGroup.getOpenProjectAction(); if (openProjectAction.isEnabled()) { openProjectAction.run(); } } }
Example #28
Source File: DisplayDoubleClickListener.java From elexis-3-core with Eclipse Public License 1.0 | 5 votes |
@Override public void doubleClick(DoubleClickEvent event){ List<LabResult> results = composite.getSelectedResults(); if (results != null) { for (LabResult labResult : results) { openDisplayDialog(labResult); } } }
Example #29
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 #30
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(); } }); }