Пример #1
0
  @Override
  protected void handlePreferenceStoreChanged(PropertyChangeEvent event) {
    ISourceViewer sourceViewer = getSourceViewer();
    if (sourceViewer == null) return;

    String property = event.getProperty();

    AutoconfCodeScanner scanner = (AutoconfCodeScanner) getAutoconfCodeScanner();
    if (scanner != null) {
      if (scanner.affectsBehavior(event)) {
        scanner.adaptToPreferenceChange(event);
        sourceViewer.invalidateTextPresentation();
      }
    }

    if (AutotoolsEditorPreferenceConstants.AUTOCONF_VERSION.equals(property)
        || AutotoolsEditorPreferenceConstants.AUTOMAKE_VERSION.equals(property)) {
      handleVersionChange(sourceViewer);
    } else if (AutotoolsEditorPreferenceConstants.EDITOR_FOLDING_ENABLED.equals(property)) {
      if (sourceViewer instanceof ProjectionViewer) {
        ProjectionViewer projectionViewer = (ProjectionViewer) sourceViewer;
        if (fProjectionFileUpdater != null) fProjectionFileUpdater.uninstall();
        // either freshly enabled or provider changed
        fProjectionFileUpdater = new ProjectionFileUpdater();
        if (fProjectionFileUpdater != null) {
          fProjectionFileUpdater.install(this, projectionViewer);
        }
      }
      return;
    }

    super.handlePreferenceStoreChanged(event);
  }
Пример #2
0
  /**
   * The <code>AbstractTextEditor</code> implementation of this <code>IWorkbenchPart</code> method
   * creates the vertical ruler and source viewer. Subclasses may extend.
   *
   * <p>We attach our own mouseDown listener on the menu bar, and our own listener for
   * cursor/key/selection events to update cursor position in status bar.
   *
   * @param parent Parent composite of the control.
   */
  @Override
  public void createPartControl(Composite parent) {
    super.createPartControl(parent);

    // Sticky hover support
    IInformationControlCreator informationControlCreator =
        new IInformationControlCreator() {
          @Override
          public IInformationControl createInformationControl(Shell shell) {
            return new DefaultInformationControl(shell, true);
          }
        };

    fInformationPresenter = new InformationPresenter(informationControlCreator);
    fInformationPresenter.setSizeConstraints(60, 10, true, true);
    fInformationPresenter.install(getSourceViewer());
    fInformationPresenter.setDocumentPartitioning(AutoconfPartitionScanner.AUTOCONF_MACRO);

    ProjectionViewer projectionViewer = (ProjectionViewer) getSourceViewer();

    fProjectionSupport =
        new ProjectionSupport(projectionViewer, getAnnotationAccess(), getSharedColors());
    fProjectionSupport.addSummarizableAnnotationType(
        "org.eclipse.ui.workbench.texteditor.error"); //$NON-NLS-1$
    fProjectionSupport.addSummarizableAnnotationType(
        "org.eclipse.ui.workbench.texteditor.warning"); //$NON-NLS-1$
    fProjectionSupport.install();

    if (isFoldingEnabled()) projectionViewer.doOperation(ProjectionViewer.TOGGLE);

    fProjectionFileUpdater = new ProjectionFileUpdater();
    if (fProjectionFileUpdater != null) {
      fProjectionFileUpdater.install(this, projectionViewer);
      fProjectionFileUpdater.initialize();
    }

    PlatformUI.getWorkbench()
        .getHelpSystem()
        .setHelp(parent, IAutotoolHelpContextIds.AC_EDITOR_VIEW);

    // TODO: Do we need the following two lines?
    //  	fEditorSelectionChangedListener= new EditorSelectionChangedListener();
    //  	fEditorSelectionChangedListener.install(getSelectionProvider());
  }
Пример #3
0
  @Override
  protected void performRevert() {
    ProjectionViewer projectionViewer = (ProjectionViewer) getSourceViewer();
    projectionViewer.setRedraw(false);
    try {

      boolean projectionMode = projectionViewer.isProjectionMode();
      if (projectionMode) {
        projectionViewer.disableProjection();
        if (fProjectionFileUpdater != null) fProjectionFileUpdater.uninstall();
      }

      super.performRevert();

      if (projectionMode) {
        if (fProjectionFileUpdater != null) fProjectionFileUpdater.install(this, projectionViewer);
        projectionViewer.enableProjection();
      }

    } finally {
      projectionViewer.setRedraw(true);
    }
  }