Package org.eclipse.jface.text.source

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


    }

    protected void configureDetailsViewer() {
        LazyModelPresentation mp = (LazyModelPresentation) fModelPresentation
                .getPresentation(getDebugModel());
        SourceViewerConfiguration svc = null;
        if (mp != null) {
            try {
                svc = mp.newDetailsViewerConfiguration();
            } catch (CoreException e) {
                DebugUIPlugin.errorDialog(getSite().getShell(),
                    "Drools Debug View Error", "Unable to configure drools debug view", e);
            }
        }
        if (svc == null) {
            svc = new SourceViewerConfiguration();
            getDetailViewer().setEditable(false);
        }
        getDetailViewer().configure(svc);
        updateAction("ContentAssist");
        setDetailViewerConfiguration(svc);
View Full Code Here


   * @param parent the parent control
   * @return a configured source viewer
   */
  protected SourceViewer createViewer(Composite parent) {
    SourceViewer viewer= new SourceViewer(parent, null, null, false, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
    SourceViewerConfiguration configuration= new SourceViewerConfiguration();
    viewer.configure(configuration);
    IDocument document= new Document();
    viewer.setDocument(document);
    return viewer;
  }
View Full Code Here

     * @param parent the parent composite of the viewer
     * @return a configured <code>SourceViewer</code>
     */
    protected SourceViewer createViewer(Composite parent) {
      SourceViewer viewer= new SourceViewer(parent, null, null, false, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
      SourceViewerConfiguration configuration= new SourceViewerConfiguration() {
        public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {

          ContentAssistant assistant= new ContentAssistant();
          assistant.enableAutoActivation(true);
          assistant.enableAutoInsert(true);
View Full Code Here

    int styles= SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION;
    fSourceViewer= createSourceViewer(parent, fVerticalRuler, styles);

    if (fConfiguration == null)
      fConfiguration= new SourceViewerConfiguration();
    fSourceViewer.configure(fConfiguration);

    if (fRangeIndicator != null)
      fSourceViewer.setRangeIndicator(fRangeIndicator);
View Full Code Here

   * <p>Subclasses may extend or override this method.</p>
   *
   * @since 3.3
   */
  protected void installTabsToSpacesConverter() {
    SourceViewerConfiguration config= getSourceViewerConfiguration();
    if (config != null && fSourceViewer instanceof ITextViewerExtension7) {
      int tabWidth= config.getTabWidth(fSourceViewer);
      TabsToSpacesConverter tabToSpacesConverter= new TabsToSpacesConverter();
      tabToSpacesConverter.setLineTracker(new DefaultLineTracker());
      tabToSpacesConverter.setNumberOfSpacesPerTab(tabWidth);
      ((ITextViewerExtension7)fSourceViewer).setTabsToSpacesConverter(tabToSpacesConverter);
      updateIndentPrefixes();
View Full Code Here

   * the values provided by the source viewer configuration.
   *
   * @since 3.3
   */
  protected final void updateIndentPrefixes() {
    SourceViewerConfiguration configuration= getSourceViewerConfiguration();
    String[] types= configuration.getConfiguredContentTypes(fSourceViewer);
    for (int i= 0; i < types.length; i++) {
      String[] prefixes= configuration.getIndentPrefixes(fSourceViewer, types[i]);
      if (prefixes != null && prefixes.length > 0)
        fSourceViewer.setIndentPrefixes(prefixes, types[i]);
    }
  }
View Full Code Here

  private void configureToggleCommentAction() {
    IAction action = getAction("ToggleComment"); //$NON-NLS-1$
    if (action instanceof ToggleCommentAction) {
      ISourceViewer sourceViewer = getSourceViewer();
      SourceViewerConfiguration configuration = getSourceViewerConfiguration();
      ((ToggleCommentAction) action).configure(sourceViewer, configuration);
    }
  }
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

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.