Examples of IQuickAssistAssistant


Examples of org.eclipse.jface.text.quickassist.IQuickAssistAssistant

    return null;//new TMLTextHover();
  }

  @Override
  public IQuickAssistAssistant getQuickAssistAssistant(ISourceViewer sourceViewer) {
    IQuickAssistAssistant assistant = new QuickAssistAssistant();
   
    assistant.setQuickAssistProcessor(new IQuickAssistProcessor() {

      public boolean canAssist(IQuickAssistInvocationContext invocationContext) {
        return false;
      }

      public boolean canFix(Annotation annotation) {
        boolean canFix = false;
        if (annotation instanceof MarkerAnnotation) {
          MarkerAnnotation markerAnnotation = (MarkerAnnotation) annotation;
          try {
            if (markerAnnotation.getMarker().getType().equals(ResourceIDs.MARKER_TML_REFERENCES)) {
              String refType = markerAnnotation.getMarker().getAttribute(ReferenceValidator.ATTRIBUTE_REFERENCE_TYPE, "");
              canFix = refType.equals(ReferenceValidator.REFERENCE_TYPE_TML) || refType.equals(ReferenceValidator.REFERENCE_TYPE_SCRIPT);
            } else if (markerAnnotation.getMarker().getType().equals(ResourceIDs.MARKER_TML_LABEL)) {
              return true;
            } else if (markerAnnotation.getMarker().getType().equals(ResourceIDs.MARKER_INVALID_CHARACTER)) {
              return InvalidCharacterCompletionProposal.canCorrect(markerAnnotation);
            }
          } catch (CoreException e) {;
          }
        }       
        return canFix;
      }

      public ICompletionProposal[] computeQuickAssistProposals(IQuickAssistInvocationContext invocationContext) {

        List<ICompletionProposal> proposals = new ArrayList<ICompletionProposal>();

        MarkerAnnotation markerAnnotation = MarkerFactory.findMarkerAnnotationByTypeAndOffset(ResourceIDs.MARKER_TML_REFERENCES, invocationContext.getOffset(), invocationContext.getSourceViewer());
        if (markerAnnotation != null && markerAnnotation.isQuickFixable()) {
          String refType = markerAnnotation.getMarker().getAttribute(ReferenceValidator.ATTRIBUTE_REFERENCE_TYPE, "");
          boolean isPortletReference = markerAnnotation.getMarker().getAttribute(ReferenceValidator.ATTRIBUTE_IS_PORTLET_REFERENCE, false);
          if (refType.equals(ReferenceValidator.REFERENCE_TYPE_TML)) {
            proposals.add(new CreateTMLFileReferenceCompletionProposal(markerAnnotation));
            if (isPortletReference) {
              // check if we can handle this missing portlet reference with our wizzard
              String ref = markerAnnotation.getMarker().getAttribute(ReferenceValidator.ATTRIBUTE_MISSING_REFERENCE_PATH, null);
              if (ref != null && ref.endsWith("/portlet.tml")) {
                String[] parts = ref.split("/");
                if (parts.length > 1) {
                  String portletNameToCreate = parts[parts.length - 2];
                  proposals.add(new CreateTMLPortletReferenceCompletionProposal(markerAnnotation, portletNameToCreate));                 
                }
              }
               
            }
          } else if (refType.equals(ReferenceValidator.REFERENCE_TYPE_SCRIPT)) {
            proposals.add(new CreateScriptFileReferenceCompletionProposal(markerAnnotation));
          }
        }
       
        markerAnnotation = MarkerFactory.findMarkerAnnotationByTypeAndOffset(ResourceIDs.MARKER_TML_LABEL, invocationContext.getOffset(), invocationContext.getSourceViewer());
        if (markerAnnotation != null && markerAnnotation.isQuickFixable()) {               
          proposals.add(new CreateTMLLabelCompletionProposal(markerAnnotation));         
        }
       
        markerAnnotation = MarkerFactory.findMarkerAnnotationByTypeAndOffset(ResourceIDs.MARKER_INVALID_CHARACTER, invocationContext.getOffset(), invocationContext.getSourceViewer());
        if (markerAnnotation != null && markerAnnotation.isQuickFixable()) {
          InvalidCharacterCompletionProposal proposal = new InvalidCharacterCompletionProposal(markerAnnotation);         
          proposals.add(proposal);                   
        }
       
        return proposals.toArray(new ICompletionProposal[0]);
      }

      public String getErrorMessage() {
        return null;
      }
     
    });
    assistant.install(sourceViewer);   
    return assistant;
  }
View Full Code Here

Examples of org.eclipse.jface.text.quickassist.IQuickAssistAssistant

    return reconciler;
  }
 
  @Override
  public IQuickAssistAssistant getQuickAssistAssistant(ISourceViewer sourceViewer) {
    IQuickAssistAssistant assistant = new QuickAssistAssistant();
   
    assistant.setQuickAssistProcessor(new IQuickAssistProcessor() {

      public boolean canAssist(IQuickAssistInvocationContext invocationContext) {
        return true;
      }

      public boolean canFix(Annotation annotation) {
        boolean canFix = false;
        if (annotation instanceof MarkerAnnotation) {
          MarkerAnnotation markerAnnotation = (MarkerAnnotation) annotation;
          try {
            if (markerAnnotation.getMarker().getType().equals(ResourceIDs.MARKER_INVALID_CHARACTER)) {
              canFix =  InvalidCharacterCompletionProposal.canCorrect(markerAnnotation);
            }
          } catch (CoreException e) {;
          }
        }       
        return canFix;
      }

      public ICompletionProposal[] computeQuickAssistProposals(IQuickAssistInvocationContext invocationContext) {

        List<ICompletionProposal> proposals = new ArrayList<ICompletionProposal>();

        MarkerAnnotation markerAnnotation = MarkerFactory.findMarkerAnnotationByTypeAndOffset(ResourceIDs.MARKER_INVALID_CHARACTER, invocationContext.getOffset(), invocationContext.getSourceViewer());
        if (markerAnnotation != null && markerAnnotation.isQuickFixable()) {
          InvalidCharacterCompletionProposal proposal = new InvalidCharacterCompletionProposal(markerAnnotation);         
          proposals.add(proposal);                   
        }
       
        return proposals.toArray(new ICompletionProposal[0]);
      }

      public String getErrorMessage() {
        return null;
      }
     
    });
    assistant.install(sourceViewer);   
    return assistant;
  }
View Full Code Here

Examples of org.eclipse.jface.text.quickassist.IQuickAssistAssistant

        };
    }

    @Override
    public IQuickAssistAssistant getQuickAssistAssistant(final ISourceViewer sourceViewer) {
        final IQuickAssistAssistant assistant = new QuickAssistAssistant();
        assistant.setQuickAssistProcessor(new ErlangQuickAssistProcessor());
        assistant
                .setInformationControlCreator(getQuickAssistAssistantInformationControlCreator());
        return assistant;
    }
View Full Code Here

Examples of org.eclipse.jface.text.quickassist.IQuickAssistAssistant

   */
  public IQuickAssistAssistant getQuickAssistAssistant(ISourceViewer sourceViewer) {
    if (fPreferenceStore == null || !fPreferenceStore.getBoolean(SpellingService.PREFERENCE_SPELLING_ENABLED))
      return null;

    IQuickAssistAssistant assistant= new QuickAssistAssistant();
    assistant.setQuickAssistProcessor(new SpellingCorrectionProcessor());
    assistant.setInformationControlCreator(getQuickAssistAssistantInformationControlCreator());
   
    // Waiting for color preferences, see: https://bugs.eclipse.org/bugs/show_bug.cgi?id=133731
    assistant.setProposalSelectorBackground(sourceViewer.getTextWidget().getDisplay().getSystemColor(SWT.COLOR_WHITE));
    assistant.setProposalSelectorForeground(sourceViewer.getTextWidget().getDisplay().getSystemColor(SWT.COLOR_BLACK));
   
    return assistant;
  }
View Full Code Here

Examples of org.eclipse.jface.text.quickassist.IQuickAssistAssistant

  /*
   * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getQuickAssistAssistant(org.eclipse.jface.text.source.ISourceViewer)
   */
  public IQuickAssistAssistant getQuickAssistAssistant(ISourceViewer sourceViewer) {
    if (fQuickAssistant == null) {
      IQuickAssistAssistant assistant = new QuickAssistAssistant();
      assistant.setQuickAssistProcessor(new CompoundQuickAssistProcessor());
      assistant.setInformationControlCreator(getQuickAssistAssistantInformationControlCreator());

      // Waiting for color preferences, see:
      // https://bugs.eclipse.org/bugs/show_bug.cgi?id=133731
      // set content assist preferences
      if (fPreferenceStore != null) {
        Color color = getColor(EditorPreferenceNames.CODEASSIST_PROPOSALS_BACKGROUND);
        assistant.setProposalSelectorBackground(color);

        color = getColor(EditorPreferenceNames.CODEASSIST_PROPOSALS_FOREGROUND);
        assistant.setProposalSelectorForeground(color);
      }
      fQuickAssistant = assistant;
    }
    return fQuickAssistant;
  }
View Full Code Here

Examples of org.eclipse.jface.text.quickassist.IQuickAssistAssistant

  /*
   * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getQuickAssistAssistant(org.eclipse.jface.text.source.ISourceViewer)
   */
  public IQuickAssistAssistant getQuickAssistAssistant(ISourceViewer sourceViewer) {
    if (fQuickAssistant == null) {
      IQuickAssistAssistant assistant = new QuickAssistAssistant();
      assistant.setQuickAssistProcessor(new CompoundQuickAssistProcessor());
      assistant.setInformationControlCreator(getQuickAssistAssistantInformationControlCreator());

      // Waiting for color preferences, see:
      // https://bugs.eclipse.org/bugs/show_bug.cgi?id=133731
      // set content assist preferences
      if (fPreferenceStore != null) {
        Color color = getColor(EditorPreferenceNames.CODEASSIST_PROPOSALS_BACKGROUND);
        assistant.setProposalSelectorBackground(color);

        color = getColor(EditorPreferenceNames.CODEASSIST_PROPOSALS_FOREGROUND);
        assistant.setProposalSelectorForeground(color);
      }
      fQuickAssistant = assistant;
    }
    return fQuickAssistant;
  }
View Full Code Here

Examples of org.eclipse.jface.text.quickassist.IQuickAssistAssistant

        enableOperation(CONTENTASSIST_PROPOSALS, false);
        fContentAssistantInstalled = false;
      }
    }

    IQuickAssistAssistant quickAssistant = configuration.getQuickAssistAssistant(this);
    if (quickAssistant != fQuickAssistAssistant || quickAssistant == null || fQuickAssistAssistant == null) {
      if (fQuickAssistAssistant != null)
        fQuickAssistAssistant.uninstall();

      fQuickAssistAssistant = quickAssistant;
View Full Code Here

Examples of org.eclipse.jface.text.quickassist.IQuickAssistAssistant

        // assistant
        enableOperation(CONTENTASSIST_PROPOSALS, false);
      }
    }

    IQuickAssistAssistant quickAssistant = configuration.getQuickAssistAssistant(this);
    if (quickAssistant != fQuickAssistAssistant || quickAssistant == null || fQuickAssistAssistant == null) {
      if (fQuickAssistAssistant != null)
        fQuickAssistAssistant.uninstall();

      fQuickAssistAssistant = quickAssistant;
View Full Code Here

Examples of org.eclipse.jface.text.quickassist.IQuickAssistAssistant

    if (fSourceViewer instanceof ISourceViewerExtension4)
      fKeyBindingSupportForContentAssistant= new KeyBindingSupportForAssistant(((ISourceViewerExtension4)fSourceViewer));

    if (fSourceViewer instanceof ISourceViewerExtension3) {
      IQuickAssistAssistant assistant= ((ISourceViewerExtension3)fSourceViewer).getQuickAssistAssistant();
      if (assistant != null)
        fKeyBindingSupportForQuickAssistant= new KeyBindingSupportForAssistant(assistant);
    }

    if (fRangeIndicator != null)
View Full Code Here

Examples of org.eclipse.jface.text.quickassist.IQuickAssistAssistant

   * getQuickAssistAssistant(org.eclipse.jface.text.source.ISourceViewer)
   */
  public IQuickAssistAssistant getQuickAssistAssistant(
      ISourceViewer sourceViewer) {
    if (fQuickAssistant == null) {
      IQuickAssistAssistant assistant = new PHPCorrectionAssistant();
      assistant
          .setQuickAssistProcessor(new CompoundQuickAssistProcessor());
      fQuickAssistant = assistant;
    }
    return fQuickAssistant;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.