Skip to content

Commit

Permalink
Introduce ITextViewerLifecycle API
Browse files Browse the repository at this point in the history
Signed-off-by: azerr <[email protected]>
  • Loading branch information
angelozerr committed Oct 27, 2022
1 parent 1900585 commit 0678e5e
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*******************************************************************************
* Copyright (c) 2022 Red Hat Inc. and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* - Angelo ZERR (Red Hat Inc.) - initial implementation
*******************************************************************************/
package org.eclipse.jface.text;

/**
* {@link ITextViewer} lifecycle API to track install / uninstall of a given {@link ITextViewer}.
*
*/
public interface ITextViewerLifecycle {

/**
* Installs a text viewer.
*
* @param textViewer the text viewer
*/
void install(ITextViewer textViewer);

/**
* Uninstalls the registered text viewer.
*/
void uninstall();
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
package org.eclipse.jface.text.contentassist;

import org.eclipse.jface.text.ITextViewer;
import org.eclipse.jface.text.ITextViewerLifecycle;


/**
Expand Down Expand Up @@ -76,7 +77,7 @@
* @see org.eclipse.jface.text.ITextViewer
* @see org.eclipse.jface.text.contentassist.IContentAssistProcessor
*/
public interface IContentAssistant {
public interface IContentAssistant extends ITextViewerLifecycle {

//------ proposal popup orientation styles ------------
/** The context info list will overlay the list of completion proposals. */
Expand All @@ -98,12 +99,14 @@ public interface IContentAssistant {
*
* @param textViewer the text viewer on which content assist will work
*/
@Override
void install(ITextViewer textViewer);

/**
* Uninstalls content assist support from the text viewer it has
* previously be installed on.
*/
@Override
void uninstall();

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
package org.eclipse.jface.text.hyperlink;

import org.eclipse.jface.text.ITextViewer;
import org.eclipse.jface.text.ITextViewerLifecycle;


/**
Expand All @@ -39,7 +40,7 @@
* @see IHyperlinkPresenterExtension2
* @since 3.1
*/
public interface IHyperlinkPresenter {
public interface IHyperlinkPresenter extends ITextViewerLifecycle {

/**
* Tells whether this presenter is able to handle
Expand Down Expand Up @@ -73,10 +74,12 @@ public interface IHyperlinkPresenter {
*
* @param textViewer the text viewer
*/
@Override
void install(ITextViewer textViewer);

/**
* Uninstalls this hyperlink presenter.
*/
@Override
void uninstall();
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
package org.eclipse.jface.text.information;

import org.eclipse.jface.text.ITextViewer;
import org.eclipse.jface.text.ITextViewerLifecycle;


/**
Expand Down Expand Up @@ -46,7 +47,7 @@
* @see org.eclipse.jface.text.information.IInformationProvider
* @since 2.0
*/
public interface IInformationPresenter {
public interface IInformationPresenter extends ITextViewerLifecycle {

/**
* Installs the information presenter on the given text viewer. After this method has been
Expand All @@ -55,12 +56,14 @@ public interface IInformationPresenter {
*
* @param textViewer the viewer on which the presenter is installed
*/
@Override
void install(ITextViewer textViewer);

/**
* Removes the information presenter from the text viewer it has previously been
* installed on.
*/
@Override
void uninstall();

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@


import org.eclipse.jface.text.ITextViewer;
import org.eclipse.jface.text.ITextViewerLifecycle;


/**
Expand Down Expand Up @@ -55,7 +56,7 @@
* @see org.eclipse.jface.text.presentation.IPresentationRepairer
* @see org.eclipse.jface.text.TextPresentation
*/
public interface IPresentationReconciler {
public interface IPresentationReconciler extends ITextViewerLifecycle {

/**
* Installs this presentation reconciler on the given text viewer. After
Expand All @@ -71,12 +72,14 @@ public interface IPresentationReconciler {
* @param viewer the viewer on which this presentation reconciler is
* installed
*/
@Override
void install(ITextViewer viewer);

/**
* Removes the reconciler from the text viewer it has previously been
* installed on.
*/
@Override
void uninstall();

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
package org.eclipse.jface.text.reconciler;

import org.eclipse.jface.text.ITextViewer;
import org.eclipse.jface.text.ITextViewerLifecycle;


/**
Expand Down Expand Up @@ -47,7 +48,7 @@
* @see ITextViewer
* @see IReconcilingStrategy
*/
public interface IReconciler {
public interface IReconciler extends ITextViewerLifecycle {

/**
* Installs the reconciler on the given text viewer. After this method has been
Expand All @@ -56,12 +57,14 @@ public interface IReconciler {
*
* @param textViewer the viewer on which the reconciler is installed
*/
@Override
void install(ITextViewer textViewer);

/**
* Removes the reconciler from the text viewer it has
* previously been installed on.
*/
@Override
void uninstall();

/**
Expand Down

0 comments on commit 0678e5e

Please sign in to comment.