Package org.eclipse.ui.texteditor

Examples of org.eclipse.ui.texteditor.SourceViewerDecorationSupport


    fProjectionSupport.install();

    // ensure source viewer decoration support has been created and
    // configured
    SourceViewerDecorationSupport support = getSourceViewerDecorationSupport(viewer);
    if (support != null) {
      support.setCharacterPairMatcher(new DefaultCharacterPairMatcher(
          BRACKETS, IDocumentExtension3.DEFAULT_PARTITIONING));
      support.setMatchingCharacterPainterPreferenceKeys(
          PreferenceConstants.EDITOR_MATCHING_BRACKETS,
          PreferenceConstants.EDITOR_MATCHING_BRACKETS_COLOR);
    }
    return viewer;
  }
View Full Code Here


  @Override
  protected ISourceViewer createSourceViewer(Composite parent, IVerticalRuler ruler, int styles) {
    ISourceViewer viewer = new ProjectionViewer(parent, ruler, getOverviewRuler(), isOverviewRulerVisible(), styles);

    // ensure source viewer decoration support has been created and configured
    SourceViewerDecorationSupport support = getSourceViewerDecorationSupport(viewer);
    if (support != null) {
      support.setCharacterPairMatcher(new DefaultCharacterPairMatcher(
          BRACKETS, IDocumentExtension3.DEFAULT_PARTITIONING));
      support.setMatchingCharacterPainterPreferenceKeys(
          PreferenceConstants.EDITOR_MATCHING_BRACKETS,
          PreferenceConstants.EDITOR_MATCHING_BRACKETS_COLOR);
    }

    return viewer;
View Full Code Here

    //turn projection mode on
    viewer.doOperation(ProjectionViewer.TOGGLE);
   
    annotationModel = viewer.getProjectionAnnotationModel();
   
    SourceViewerDecorationSupport support = getSourceViewerDecorationSupport(viewer);
    support.install(JsonEditorPlugin.getJsonPreferenceStore());
  }
View Full Code Here

   * @return the source viewer decoration support
   */
    // From ClojureEditor + AbstractDecoratedTextEditor ...
  protected SourceViewerDecorationSupport getSourceViewerDecorationSupport(ISourceViewer viewer) {
    if (fSourceViewerDecorationSupport == null) {
      fSourceViewerDecorationSupport= new SourceViewerDecorationSupport(
          viewer,
          null/*getOverviewRuler()*/,
          null/*getAnnotationAccess()*/,
          EditorsPlugin.getDefault().getSharedTextColors()/*getSharedColors()*/
          );
 
View Full Code Here

        }
      }
    };
    Activator.getDefault().getPreferenceStore().addPropertyChangeListener(propertyChangeListener);

    final SourceViewerDecorationSupport support = configureAnnotationPreferences();
    if (isEditable(sourceViewer)) {
      quickFixActionHandler = createQuickFixActionHandler(sourceViewer);
    }

    Document document = new Document(initialText);

    configuration = new TextSourceViewerConfiguration(
        EditorsUI
        .getPreferenceStore()) {

      public int getHyperlinkStateMask(ISourceViewer targetViewer) {
        return SWT.NONE;
      }

      protected Map getHyperlinkDetectorTargets(ISourceViewer targetViewer) {
        return getHyperlinkTargets();
      }

      @Override
      public IHyperlinkPresenter getHyperlinkPresenter(
          ISourceViewer targetViewer) {
        return new MultipleHyperlinkPresenter(PlatformUI.getWorkbench()
            .getDisplay().getSystemColor(SWT.COLOR_BLUE).getRGB()) {

          @Override
          public void hideHyperlinks() {
            // We want links to always show.
          }

        };
      }

      public IHyperlinkDetector[] getHyperlinkDetectors(
          ISourceViewer targetViewer) {
        return getRegisteredHyperlinkDetectors(sourceViewer);
      }

      @Override
      public IReconciler getReconciler(ISourceViewer viewer) {
        if (!isEditable(viewer))
          return null;
        return super.getReconciler(sourceViewer);
      }

      public IContentAssistant getContentAssistant(ISourceViewer viewer) {
        if (!viewer.isEditable())
          return null;
        IContentAssistant assistant = createContentAssistant(viewer);
        // Add content assist proposal handler if assistant exists
        if (assistant != null)
          contentAssistActionHandler = createContentAssistActionHandler(sourceViewer);
        return assistant;
      }

    };

    sourceViewer.configure(configuration);
    sourceViewer.setDocument(document, annotationModel);

    StyleRange[] styleRanges = UIUtils
        .getHyperlinkDetectorStyleRanges(sourceViewer,
            configuration.getHyperlinkDetectors(sourceViewer));
    sourceViewer.getTextWidget().setStyleRanges(styleRanges);

    configureContextMenu();

    getTextWidget().addDisposeListener(new DisposeListener() {
      public void widgetDisposed(DisposeEvent disposeEvent) {
        support.uninstall();
        Activator.getDefault().getPreferenceStore().removePropertyChangeListener(propertyChangeListener);
      }
    });
  }
View Full Code Here

  }

  private SourceViewerDecorationSupport configureAnnotationPreferences() {
    ISharedTextColors textColors = EditorsUI.getSharedTextColors();
    IAnnotationAccess annotationAccess = new DefaultMarkerAnnotationAccess();
    final SourceViewerDecorationSupport support = new SourceViewerDecorationSupport(
        sourceViewer, null, annotationAccess, textColors);

    List annotationPreferences = new MarkerAnnotationPreferences()
    .getAnnotationPreferences();
    Iterator e = annotationPreferences.iterator();
    while (e.hasNext())
      support.setAnnotationPreference((AnnotationPreference) e.next());

    support.install(EditorsUI.getPreferenceStore());
    return support;
  }
View Full Code Here

   */
  public DiffViewer(Composite parent, IVerticalRuler ruler, int styles,
      boolean showCursorLine) {
    super(parent, ruler, styles);
    setDocument(new Document());
    SourceViewerDecorationSupport support = new SourceViewerDecorationSupport(
        this, null, null, EditorsUI.getSharedTextColors());
    if (showCursorLine) {
      support.setCursorLinePainterPreferenceKeys(
          AbstractDecoratedTextEditorPreferenceConstants.EDITOR_CURRENT_LINE,
          AbstractDecoratedTextEditorPreferenceConstants.EDITOR_CURRENT_LINE_COLOR);
    }
    support.install(EditorsUI.getPreferenceStore());
    if (ruler instanceof CompositeRuler) {
      lineNumberRuler = new LineNumberRulerColumn();
      ((CompositeRuler) ruler).addDecorator(0, lineNumberRuler);
    }
    getTextWidget().setAlwaysShowScrollBars(false);
View Full Code Here

//    if (true) return super.createSourceViewer(parent, ruler, styles);
    // Create with code-folding
    ISourceViewer viewer = new ProjectionViewer(parent, ruler,
        getOverviewRuler(), isOverviewRulerVisible(), styles);
    // ensure decoration support has been created and configured.
    SourceViewerDecorationSupport decSupport = getSourceViewerDecorationSupport(viewer);
//    SourceViewer viewer = (SourceViewer) super.createSourceViewer(parent, ruler, styles);
    // Setup word-wrapping   
    final StyledText widget = viewer.getTextWidget();
    // Listen to pref changes
    prefChangeListener = new IPropertyChangeListener() {
View Full Code Here

TOP

Related Classes of org.eclipse.ui.texteditor.SourceViewerDecorationSupport

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.