下面列出了怎么用org.eclipse.jface.text.codemining.ICodeMiningProvider的API类实例代码及写法,或者点击链接到github查看源代码。
public RevisionRecentChangeCodeMining(int beforeLineNumber, ILineRange lineRange, IDocument document,
boolean showAvatar, boolean showDate, ICodeMiningProvider provider, IRevisionRangeProvider rangeProvider)
throws JavaModelException, BadLocationException {
super(beforeLineNumber, document, provider);
this.rangeProvider = rangeProvider;
this.lineRange = lineRange;
this.showAvatar = showAvatar;
this.showDate = showDate;
if (rangeProvider.isInitialized()) {
updateLabel();
}
}
public RevisionAuthorsCodeMining(int beforeLineNumber, ILineRange lineRange, IDocument document,
ICodeMiningProvider provider, IRevisionRangeProvider rangeProvider)
throws JavaModelException, BadLocationException {
super(beforeLineNumber, document, provider);
this.lineRange = lineRange;
this.rangeProvider = rangeProvider;
if (rangeProvider.isInitialized()) {
updateLabel();
}
}
public JavaLaunchCodeMining(IJavaElement element, String label, String mode, IDocument document,
ICodeMiningProvider provider) throws JavaModelException, BadLocationException {
super(element, document, provider, e -> {
JavaApplicationLaunchShortcut shortcut = new JavaApplicationLaunchShortcut();
shortcut.launch(new StructuredSelection(element), mode);
});
super.setLabel(label);
}
public JUnitLaunchCodeMining(IJavaElement element, String label, String mode, IDocument document,
ICodeMiningProvider provider) throws JavaModelException, BadLocationException {
super(element, document, provider, e -> {
JUnitLaunchShortcut shortcut = new JUnitLaunchShortcut();
shortcut.launch(new StructuredSelection(element), mode);
});
super.setLabel(label);
}
private JavaMethodParameterCodeMining(ASTNode node, Expression parameter, int parameterIndex, CompilationUnit cu,
ICodeMiningProvider provider, boolean showName, boolean showType, boolean showParameterByUsingFilters) {
super(new Position(parameter.getStartPosition(), 1), provider, null);
this.cu = cu;
this.node = node;
this.parameter = parameter;
this.parameterIndex = parameterIndex;
this.showName = showName;
this.showType = showType;
this.showParameterByUsingFilters = showParameterByUsingFilters;
}
public EndStatementCodeMining(Statement node, ITextEditor textEditor, ITextViewer viewer, int minLineNumber,
ICodeMiningProvider provider) {
super(new Position(node.getStartPosition() + node.getLength(), 1), provider, e -> {
textEditor.selectAndReveal(node.getStartPosition(), 0);
});
String label = getLabel(node, viewer.getDocument(), minLineNumber);
super.setLabel(label);
}
public JavaCodeMiningASTVisitor(CompilationUnit cu, ITextEditor textEditor, ITextViewer viewer,
List<ICodeMining> minings, ICodeMiningProvider provider) {
this.cu = cu;
this.minings = minings;
this.provider = provider;
this.textEditor = textEditor;
this.viewer = viewer;
}
public void configureCodeMinding(Binder binder) {
try {
Class.forName("org.eclipse.jface.text.codemining.ICodeMiningProvider");
binder.bind(ICodeMiningProvider.class)
.to(DomainmodelCodeMiningProvider.class);
binder.bind(IReconcileStrategyFactory.class).annotatedWith(Names.named("codeMinding"))
.to(XtextCodeMiningReconcileStrategy.Factory.class);
} catch(ClassNotFoundException ignore) {
// no bindings if code mining is not available at runtime
}
}
public void configureCodeMinding(Binder binder) {
try {
Class.forName("org.eclipse.jface.text.codemining.ICodeMiningProvider");
binder.bind(ICodeMiningProvider.class)
.to(ArithmeticsCodeMiningProvider.class);
binder.bind(IReconcileStrategyFactory.class).annotatedWith(Names.named("codeMinding"))
.to(XtextCodeMiningReconcileStrategy.Factory.class);
} catch(ClassNotFoundException ignore) {
// no bindings if code mining is not available at runtime
}
}
public void configureCodeMinding(Binder binder) {
try {
Class.forName("org.eclipse.jface.text.codemining.ICodeMiningProvider");
binder.bind(ICodeMiningProvider.class)
.to(SARLCodeMiningProvider.class);
binder.bind(IReconcileStrategyFactory.class).annotatedWith(Names.named("codeMinding"))
.to(XtextCodeMiningReconcileStrategy.Factory.class);
} catch(ClassNotFoundException ignore) {
// no bindings if code mining is not available at runtime
}
}
public JUnitStatusCodeMining(IJavaElement element, JUnitStatusRegistry testRegistry, IDocument document,
ICodeMiningProvider provider) throws JavaModelException, BadLocationException {
super(element, document, provider, null);
this.testRegistry = testRegistry;
}
public AbstractJavaCodeMining(IJavaElement element, IDocument document, ICodeMiningProvider provider,
Consumer<MouseEvent> action) throws JavaModelException, BadLocationException {
super(getLineNumber(element, document), document, provider, action);
this.element = element;
}
public JavaMethodParameterCodeMining(MethodInvocation method, Expression parameter, int parameterIndex,
CompilationUnit cu, ICodeMiningProvider provider, boolean showName, boolean showType,
boolean showParameterByUsingFilters) {
this((ASTNode) method, parameter, parameterIndex, cu, provider, showName, showType,
showParameterByUsingFilters);
}
public JavaMethodParameterCodeMining(ClassInstanceCreation constructor, Expression parameter, int parameterIndex,
CompilationUnit cu, ICodeMiningProvider provider, boolean showName, boolean showType,
boolean showParameterByUsingFilters) {
this((ASTNode) constructor, parameter, parameterIndex, cu, provider, showName, showType,
showParameterByUsingFilters);
}
public JavaVarTypeCodeMining(SimpleType node, ITextViewer viewer, ICodeMiningProvider provider) {
super(new Position(node.getStartPosition() + node.getLength(), 1), provider, null);
this.node = node;
}
public JavaReferenceCodeMining(IJavaElement element, JavaEditor editor, IDocument document,
ICodeMiningProvider provider, boolean referencesCodeMiningsAtLeastOne)
throws JavaModelException, BadLocationException {
super(element, document, provider, e -> new FindReferencesAction(editor).run(element));
this.referencesCodeMiningsAtLeastOne = referencesCodeMiningsAtLeastOne;
}
public JavaImplementationCodeMining(IType element, IDocument document, ICodeMiningProvider provider,
boolean implementationsCodeMiningsAtLeastOne) throws JavaModelException, BadLocationException {
super(element, document, provider, null);
this.implementationsCodeMiningsAtLeastOne = implementationsCodeMiningsAtLeastOne;
}