Skip to main content
summaryrefslogtreecommitdiffstats
blob: 987d1223665b626fac07e3a56ce824b071bd5be1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/**
 *  Copyright (c) 2017 Angelo ZERR.
 *
 *  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 <angelo.zerr@gmail.com> - [CodeMining] Provide CodeMining support with CodeMiningManager - Bug 527720
 */
package org.eclipse.jface.text.codemining;

import java.util.List;
import java.util.concurrent.CompletableFuture;

import org.eclipse.core.runtime.IProgressMonitor;

import org.eclipse.jface.text.ITextViewer;

/**
 * A code mining provider adds minings {@link ICodeMining} to source text. The mining will be shown
 * as dedicated horizontal lines in between the source text.
 *
 * @since 3.13
 */
public interface ICodeMiningProvider {

	/**
	 * Compute a list of code minings {@link ICodeMining}. This call should return as fast as
	 * possible and if computing the content of {@link ICodeMining} is expensive implementors should
	 * only return code mining objects with the position and implement resolve
	 * {@link ICodeMining#resolve(ITextViewer, IProgressMonitor)}.
	 *
	 * @param viewer the viewer in which the command was invoked.
	 * @param monitor A progress monitor.
	 * @return An array of future of code minings that resolves to such. The lack of a result can be
	 *         signaled by returning null, or an empty array.
	 */
	CompletableFuture<List<? extends ICodeMining>> provideCodeMinings(ITextViewer viewer, IProgressMonitor monitor);

	/**
	 * Dispose code mining provider.
	 */
	void dispose();
}

Back to the top