Ejemplo n.º 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);
  }
Ejemplo n.º 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());
  }
Ejemplo n.º 3
0
 @Override
 public void dispose() {
   if (fProjectionFileUpdater != null) {
     fProjectionFileUpdater.uninstall();
     fProjectionFileUpdater = null;
   }
   if (fProject != null) {
     AutotoolsPropertyManager.getDefault().removeProjectPropertyListener(fProject, this);
   }
   super.dispose();
 }
Ejemplo n.º 4
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);
    }
  }