Package org.eclipse.ui.texteditor

Examples of org.eclipse.ui.texteditor.ContentAssistAction


  @Override
  protected void createActions() {
    super.createActions();
    // Add content assist propsal action
    ContentAssistAction action = new ContentAssistAction(Plugin
        .getDefault().getResourceBundle(),
        "FreemarkerEditor.ContentAssist", this); //$NON-NLS-1$
    action.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
    setAction("FreemarkerEditor.ContentAssist", action); //$NON-NLS-1$
    action.setEnabled(true);
  }
View Full Code Here


    {
        super.createActions();

        // add content assistant
        ResourceBundle bundle = LdifEditorActivator.getDefault().getResourceBundle();
        IAction action = new ContentAssistAction( bundle, "ldifeditor__contentassistproposal_", this ); //$NON-NLS-1$
        action.setActionDefinitionId( ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS );
        setAction( "ContentAssistProposal", action ); //$NON-NLS-1$

        // add execute action (for tool bar)
        ExecuteLdifAction executeLdifAction = new ExecuteLdifAction( this );
        actionToolBarManager.add( executeLdifAction );
View Full Code Here

            //Quick-Assist: it's added to the platform as of Eclipse 3.2, so, we do not have to put the binding here

            // -------------------------------------------------------------------------------------
            // This action will fire a CONTENTASSIST_PROPOSALS operation
            // when executed
            action = new ContentAssistAction(resources, "ContentAssistProposal.", this);
            action.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
            setAction("ContentAssistProposal", action);
            markAsStateDependentAction("ContentAssistProposal", true);

            // -------------------------------------------------------------------------------------
View Full Code Here

  = ResourceBundle.getBundle("jsx.messages");
 
  protected void createActions() {
    super.createActions();
   
    IAction action = new ContentAssistAction(RESOURCE_BUNDLE, "ContentAssistProposal", this);
    action.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
    setAction("ContentAssistProposal", action);
  }
View Full Code Here

    {
        super.createActions();

        // add content assistant
        ResourceBundle bundle = BrowserUIPlugin.getDefault().getResourceBundle();
        IAction action = new ContentAssistAction( bundle, "ldifeditor__contentassistproposal_", this ); //$NON-NLS-1$
        action.setActionDefinitionId( ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS );
        setAction( "ContentAssistProposal", action ); //$NON-NLS-1$

        // add execute action (for tool bar)
        ExecuteLdifAction executeLdifAction = new ExecuteLdifAction( this );
        this.actionToolBarManager.add( executeLdifAction );
View Full Code Here

        /*
         * Hook in content assist action.
         */
        {
            Action action = new ContentAssistAction(Platform.getResourceBundle(Activator.getContext().getBundle()),

            "ContentAssistProposal.", this);
            String id = ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS;
            action.setActionDefinitionId(id);
            setAction("ContentAssistProposal", action);
            markAsStateDependentAction("ContentAssistProposal", true);
        }

        /*
         * 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.ui.texteditor.ContentAssistAction

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.