Package org.eclipse.jface.text.source

Examples of org.eclipse.jface.text.source.SourceViewerConfiguration


      }
    }
  }

  private void updateSourceViewerConfiguration() {
    SourceViewerConfiguration configuration = getSourceViewerConfiguration();
    // no need to update source viewer configuration if one does not exist
    // yet
    if (configuration == null) {
      return;
    }
View Full Code Here


  class JSPEditTemplateDialog extends EditTemplateDialog {
    public JSPEditTemplateDialog(Shell parent, Template template, boolean edit, boolean isNameModifiable, ContextTypeRegistry registry) {
      super(parent, template, edit, isNameModifiable, registry);
    }

    protected SourceViewer createViewer(Composite parent) {      SourceViewerConfiguration sourceViewerConfiguration = new StructuredTextViewerConfiguration() {
      StructuredTextViewerConfiguration baseConfiguration = new StructuredTextViewerConfigurationJSP();

      public String[] getConfiguredContentTypes(ISourceViewer sourceViewer) {
        return baseConfiguration.getConfiguredContentTypes(sourceViewer);
      }
View Full Code Here

   * @param parent
   *            the parent control
   * @return a configured source viewer
   */
  private SourceViewer createViewer(Composite parent) {
    SourceViewerConfiguration sourceViewerConfiguration = new StructuredTextViewerConfiguration() {
      StructuredTextViewerConfiguration baseConfiguration = new StructuredTextViewerConfigurationJSP();

      public String[] getConfiguredContentTypes(ISourceViewer sourceViewer) {
        return baseConfiguration.getConfiguredContentTypes(sourceViewer);
      }
View Full Code Here

  protected void handleElementContentReplaced() {
    super.handleElementContentReplaced();

    // queue a full revalidation of content
    IDocument document = getDocumentProvider().getDocument(getEditorInput());
    SourceViewerConfiguration sourceViewerConfiguration = getSourceViewerConfiguration();
    if (document != null && sourceViewerConfiguration != null && sourceViewerConfiguration.getReconciler(getSourceViewer()) instanceof DirtyRegionProcessor) {
      ((DirtyRegionProcessor) sourceViewerConfiguration.getReconciler(getSourceViewer())).processDirtyRegion(new DirtyRegion(0, document.getLength(), DirtyRegion.INSERT, document.get()));
    }

    /*
     * https://bugs.eclipse.org/bugs/show_bug.cgi?id=129906 - update
     * selection to listeners
View Full Code Here

    // update content assist preferences
    else if (EditorPreferenceNames.CODEASSIST_PROPOSALS_BACKGROUND.equals(property)) {
      ISourceViewer sourceViewer = getSourceViewer();
      if (sourceViewer != null) {
        SourceViewerConfiguration configuration = getSourceViewerConfiguration();
        if (configuration != null) {
          IContentAssistant contentAssistant = configuration.getContentAssistant(sourceViewer);
          if (contentAssistant instanceof ContentAssistant) {
            ContentAssistant assistant = (ContentAssistant) contentAssistant;
            RGB rgb = PreferenceConverter.getColor(getPreferenceStore(), EditorPreferenceNames.CODEASSIST_PROPOSALS_BACKGROUND);
            Color color = EditorUtility.getColor(rgb);
            assistant.setProposalSelectorBackground(color);
          }
        }
      }
    }

    // update content assist preferences
    else if (EditorPreferenceNames.CODEASSIST_PROPOSALS_FOREGROUND.equals(property)) {
      ISourceViewer sourceViewer = getSourceViewer();
      if (sourceViewer != null) {
        SourceViewerConfiguration configuration = getSourceViewerConfiguration();
        if (configuration != null) {
          IContentAssistant contentAssistant = configuration.getContentAssistant(sourceViewer);
          if (contentAssistant instanceof ContentAssistant) {
            ContentAssistant assistant = (ContentAssistant) contentAssistant;
            RGB rgb = PreferenceConverter.getColor(getPreferenceStore(), EditorPreferenceNames.CODEASSIST_PROPOSALS_FOREGROUND);
            Color color = EditorUtility.getColor(rgb);
            assistant.setProposalSelectorForeground(color);
          }
        }
      }
    }

    // update content assist preferences
    else if (EditorPreferenceNames.CODEASSIST_PARAMETERS_BACKGROUND.equals(property)) {
      ISourceViewer sourceViewer = getSourceViewer();
      if (sourceViewer != null) {
        SourceViewerConfiguration configuration = getSourceViewerConfiguration();
        if (configuration != null) {
          IContentAssistant contentAssistant = configuration.getContentAssistant(sourceViewer);
          if (contentAssistant instanceof ContentAssistant) {
            ContentAssistant assistant = (ContentAssistant) contentAssistant;
            RGB rgb = PreferenceConverter.getColor(getPreferenceStore(), EditorPreferenceNames.CODEASSIST_PARAMETERS_BACKGROUND);
            Color color = EditorUtility.getColor(rgb);
            assistant.setContextInformationPopupBackground(color);
            assistant.setContextSelectorBackground(color);
          }
        }
      }
    }

    // update content assist preferences
    else if (EditorPreferenceNames.CODEASSIST_PARAMETERS_FOREGROUND.equals(property)) {
      ISourceViewer sourceViewer = getSourceViewer();
      if (sourceViewer != null) {
        SourceViewerConfiguration configuration = getSourceViewerConfiguration();
        if (configuration != null) {
          IContentAssistant contentAssistant = configuration.getContentAssistant(sourceViewer);
          if (contentAssistant instanceof ContentAssistant) {
            ContentAssistant assistant = (ContentAssistant) contentAssistant;
            RGB rgb = PreferenceConverter.getColor(getPreferenceStore(), EditorPreferenceNames.CODEASSIST_PARAMETERS_FOREGROUND);
            Color color = EditorUtility.getColor(rgb);
            assistant.setContextInformationPopupForeground(color);
View Full Code Here

   * Sets the editor's source viewer configuration which it uses to
   * configure it's internal source viewer. This method was overwritten so
   * that viewer configuration could be set after editor part was created.
   */
  protected void setSourceViewerConfiguration(SourceViewerConfiguration config) {
    SourceViewerConfiguration oldSourceViewerConfiguration = getSourceViewerConfiguration();
    super.setSourceViewerConfiguration(config);
    StructuredTextViewer stv = getTextViewer();
    if (stv != null) {
      /*
       * There should be no need to unconfigure before configure because
View Full Code Here

  /*
   * Update the hovering behavior depending on the preferences.
   */
  private void updateHoverBehavior() {
    SourceViewerConfiguration configuration = getSourceViewerConfiguration();
    String[] types = configuration.getConfiguredContentTypes(getSourceViewer());

    for (int i = 0; i < types.length; i++) {

      String t = types[i];

      ISourceViewer sourceViewer = getSourceViewer();
      if (sourceViewer instanceof ITextViewerExtension2) {
        // Remove existing hovers
        ((ITextViewerExtension2) sourceViewer).removeTextHovers(t);

        int[] stateMasks = configuration.getConfiguredTextHoverStateMasks(getSourceViewer(), t);

        if (stateMasks != null) {
          for (int j = 0; j < stateMasks.length; j++) {
            int stateMask = stateMasks[j];
            ITextHover textHover = configuration.getTextHover(sourceViewer, t, stateMask);
            ((ITextViewerExtension2) sourceViewer).setTextHover(textHover, t, stateMask);
          }
        }
        else {
          ITextHover textHover = configuration.getTextHover(sourceViewer, t);
          ((ITextViewerExtension2) sourceViewer).setTextHover(textHover, t, ITextViewerExtension2.DEFAULT_HOVER_STATE_MASK);
        }
      }
      else
        sourceViewer.setTextHover(configuration.getTextHover(sourceViewer, t), t);
    }
  }
View Full Code Here

      }
    }
  }

  private void updateSourceViewerConfiguration() {
    SourceViewerConfiguration configuration = getSourceViewerConfiguration();
    // no need to update source viewer configuration if one does not exist
    // yet
    if (configuration == null) {
      return;
    }
View Full Code Here

  /**
   * Make sure indentation is correct before using.
   */
  private void updateIndentationPrefixes() {
    SourceViewerConfiguration configuration = fConfiguration;
    if (fConfiguration != null) {
      String[] types = configuration.getConfiguredContentTypes(this);
      for (int i = 0; i < types.length; i++) {
        String[] prefixes = configuration.getIndentPrefixes(this, types[i]);
        if (prefixes != null && prefixes.length > 0)
          setIndentPrefixes(prefixes, types[i]);
      }
    }
  }
View Full Code Here

    }

    public void modelReinitialized(IStructuredModel structuredModel) {
      try {
        if (getSourceViewer() != null) {
          SourceViewerConfiguration cfg = getSourceViewerConfiguration();
          getSourceViewer().configure(cfg);
        }
      }
      catch (Exception e) {
        // https://w3.opensource.ibm.com/bugzilla/show_bug.cgi?id=1166
View Full Code Here

TOP

Related Classes of org.eclipse.jface.text.source.SourceViewerConfiguration

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.