org.eclipse.jdt.ui.actions.OpenAction Java Examples

The following examples show how to use org.eclipse.jdt.ui.actions.OpenAction. 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: CustomOpenActionProvider.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void fillActionBars(IActionBars theActionBars) {
    if (!contribute) {
        return;
    }
    openFileAction.setContext(getContext());

    OpenAction customOpenAction = createCustomOpenAction();
    if (openFileAction.getOpenAction().isEnabled()) {
        theActionBars.setGlobalActionHandler(ICommonActionConstants.OPEN,
                customOpenAction);
    } else if (UIDArtifactFilters
            .isUIDArtifact(((IStructuredSelection) getContext().getSelection()).getFirstElement())) {
        theActionBars.setGlobalActionHandler(ICommonActionConstants.OPEN,
                customOpenAction);
    }
}
 
Example #2
Source File: GotoInputAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void run() {
	IJavaElement inputElement= fInfoView.getOrignalInput();
	new OpenAction(fInfoView.getViewSite()).run(new Object[] { inputElement });
}
 
Example #3
Source File: SourceView.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
@Override
protected void createActions() {
	super.createActions();
	fSelectAllAction= new SelectAllAction(fViewer);

	// Setup OpenAction
	fOpen= new OpenAction(getViewSite()) {

		/*
		 * @see org.eclipse.jdt.ui.actions.SelectionDispatchAction#getSelection()
		 */
		@Override
		public ISelection getSelection() {
			return convertToJavaElementSelection(fViewer.getSelection());
		}

		/*
		 * @see org.eclipse.jdt.ui.actions.OpenAction#run(IStructuredSelection)
		 */
		@Override
		public void run(IStructuredSelection selection) {
			if (selection.isEmpty()) {
				getShell().getDisplay().beep();
				return;
			}
			super.run(selection);
		}

		/*
		 * @see org.eclipse.jdt.ui.actions.OpenAction#getElementToOpen(Object)
		 */
		@Override
		public Object getElementToOpen(Object object) throws JavaModelException {
			if (object instanceof IJavaElement)
				fLastOpenedElement= (IJavaElement)object;
			else
				fLastOpenedElement= null;
			return super.getElementToOpen(object);
		}

		/*
		 * @see org.eclipse.jdt.ui.actions.OpenAction#run(Object[])
		 */
		@Override
		public void run(Object[] elements) {
			stopListeningForSelectionChanges();
			super.run(elements);
			startListeningForSelectionChanges();
		}
	};
}
 
Example #4
Source File: OpenAndExpand.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
public OpenAndExpand(IWorkbenchSite site, OpenAction openAction, TreeViewer viewer) {
	super(site);
	fOpenAction = openAction;
	fViewer = viewer;
}