Package org.eclipse.jdt.ui.actions

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


  protected void createActions() {
    final IKeyBindingService kb = getSite().getKeyBindingService();
    final IActionBars ab = getViewSite().getActionBars();

    openAction = new OpenAction(getSite());
    openAction
        .setActionDefinitionId(IJavaEditorActionDefinitionIds.OPEN_EDITOR);
    ab.setGlobalActionHandler(JdtActionConstants.OPEN, openAction);
    openAction.setEnabled(false);
View Full Code Here


    CoverageTools.getSessionManager().addSessionListener(listener);
    CoverageTools.addJavaCoverageListener(coverageListener);
  }
 
  protected void createActions() {
    openaction = new OpenAction(getSite());
    relaunchSessionAction = new RelaunchSessionAction();
    removeActiveSessionAction = new RemoveActiveSessionAction();
    removeAllSessionsAction = new RemoveAllSessionsAction();
    selectSessionAction = new SelectSessionAction();
  }
View Full Code Here

  private void createActions() {
    // For the following commands we use actions, as they are already available

    final IActionBars ab = getViewSite().getActionBars();

    openAction = new OpenAction(getSite());
    openAction
        .setActionDefinitionId(IJavaEditorActionDefinitionIds.OPEN_EDITOR);
    ab.setGlobalActionHandler(JdtActionConstants.OPEN, openAction);
    openAction.setEnabled(false);
    viewer.addSelectionChangedListener(openAction);
View Full Code Here

            openAction.run(itemPointer);
        } else if (itemPointer.definition instanceof JavaDefinition) {
            //note that it will only be able to find a java definition if JDT is actually available
            //so, we don't have to care about JDTNotAvailableExceptions here.
            JavaDefinition javaDefinition = (JavaDefinition) itemPointer.definition;
            OpenAction openAction = new OpenAction(pyEdit.getSite());
            StructuredSelection selection = new StructuredSelection(new Object[] { javaDefinition.javaElement });
            openAction.run(selection);
        } else {
            String message;
            if (itemPointer.definition != null && itemPointer.definition.module instanceof AbstractJavaClassModule) {
                AbstractJavaClassModule module = (AbstractJavaClassModule) itemPointer.definition.module;
                message = "The definition was found at: " + f.toString() + "\n" + "as the java module: "
View Full Code Here

  private void createActions() {
    // For the following commands we use actions, as they are already available

    final IActionBars ab = getViewSite().getActionBars();

    openAction = new OpenAction(getSite());
    openAction
        .setActionDefinitionId(IJavaEditorActionDefinitionIds.OPEN_EDITOR);
    ab.setGlobalActionHandler(JdtActionConstants.OPEN, openAction);
    openAction.setEnabled(false);
    viewer.addSelectionChangedListener(openAction);
View Full Code Here

        /*
         * Add action to support "F3" jump to definition
         */
        {
            Action action = new OpenAction(getEditorSite()) {
                public void run(org.eclipse.jface.text.ITextSelection selection) {
                    try {
                        IDocument doc = getSourceViewer().getDocument();

                        int line = doc.getLineOfOffset(selection.getOffset());
                        List<IAnnotation> matches = scenarioAnnotationSearch.search(getSourceViewer(), line);

                        if (matches.size() > 0) {

                            IRegion lineRegion = doc.getLineInformation(line);

                            String currentLine = getSourceViewer().getDocument().get(lineRegion.getOffset(),
                                lineRegion.getLength());

                            String trimmedLine = currentLine.trim();
                            int firstSpaceIndex = trimmedLine.indexOf(" ");

                            String stepText = "";
                            if (firstSpaceIndex != -1) {
                                stepText = trimmedLine.substring(firstSpaceIndex).trim();
                            } else {
                                return;
                            }

                            for (IAnnotation annotation : matches) {
                                IMemberValuePair[] pair = annotation.getMemberValuePairs();
                                Pattern stepPattern = Pattern.compile((String) pair[0].getValue());

                                if (stepPattern.matcher(stepText).matches()) {
                                    super.run(new Object[] {annotation});
                                    break;
                                }
                            }
                        }
                    } catch (BadLocationException e) {
                        Activator.getLogservice().log(LogService.LOG_ERROR, e.getMessage());
                    } catch (JavaModelException e) {
                        Activator.getLogservice().log(LogService.LOG_ERROR, e.getMessage());
                    }
                };
            };
            action.setActionDefinitionId("org.eclipse.jdt.ui.edit.text.java.open.editor");
            setAction("OpenJavaElement", action);
            markAsStateDependentAction("OpenJavaElement", true);
        }
    }
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.ui.actions.OpenAction

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.