本文整理汇总了Java中org.netbeans.modules.java.hints.spi.AbstractHint类的典型用法代码示例。如果您正苦于以下问题:Java AbstractHint类的具体用法?Java AbstractHint怎么用?Java AbstractHint使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AbstractHint类属于org.netbeans.modules.java.hints.spi包,在下文中一共展示了AbstractHint类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: selectHintNode
import org.netbeans.modules.java.hints.spi.AbstractHint; //导入依赖的package包/类
protected void selectHintNode(JTreeOperator jto, String category, String hintName) {
int i = 0;
for (i = 0; i < jto.getRowCount(); i++) {
jto.selectRow(i);
jto.collapseRow(i);
Object lastSelectedPathComponent = jto.getLastSelectedPathComponent();
Object userObject = ((DefaultMutableTreeNode) lastSelectedPathComponent).getUserObject();
String fileName = ((FileObject) userObject).getName();
if (fileName.equals(category)) {
break;
}
}
assertTrue("Category "+category+" not found", i < jto.getRowCount());
jto.expandRow(i);
Object root = jto.getLastSelectedPathComponent();
for(int j = 0;j<jto.getChildCount(root);j++) {
DefaultMutableTreeNode child = (DefaultMutableTreeNode)jto.getChild(root, j);
String displayName = ((AbstractHint) child.getUserObject()).getDisplayName();
if(displayName.equals(hintName)) {
jto.selectRow(i + j + 1);
return;
}
}
assertTrue("Hint "+hintName+" not found", false);
}
示例2: createErrors
import org.netbeans.modules.java.hints.spi.AbstractHint; //导入依赖的package包/类
public Collection<? extends ErrorDescription> createErrors(HintContext ctx) {
currentHintPreferences.set(new LegacyHintConfiguration(true, ctx.getSeverity(), ctx.getPreferences()));
Collection<? extends ErrorDescription> result = tr.run(ctx.getInfo(), ctx.getPath());
currentHintPreferences.set(null); //XXX: in finally
if (result == null) return result;
Collection<ErrorDescription> wrapped = new LinkedList<ErrorDescription>();
String id = tr instanceof AbstractHint ? ((AbstractHint) tr).getId() : "no-id";
String description = tr instanceof AbstractHint ? ((AbstractHint) tr).getDescription() : null;
for (ErrorDescription ed : result) {
if (ed == null || ed.getRange() == null) continue;
if (!ctx.getInfo().getFileObject().equals(ed.getFile())) {
LOG.log(Level.SEVERE, "Got an ErrorDescription for different file, current file: {0}, error's file: {1}", new Object[] {ctx.getInfo().getFileObject().toURI(), ed.getFile().toURI()});
continue;
}
List<Fix> fixesForED = JavaFixImpl.Accessor.INSTANCE.resolveDefaultFixes(ctx, ed.getFixes().getFixes().toArray(new Fix[0]));
ErrorDescription nue = createErrorDescription("text/x-java:" + id,
ed.getSeverity(),
ed.getDescription(),
description,
org.netbeans.spi.editor.hints.ErrorDescriptionFactory.lazyListForFixes(fixesForED),
ed.getFile(),
ed.getRange());
wrapped.add(nue);
}
return wrapped;
}
示例3: SuspiciousNamesCombination
import org.netbeans.modules.java.hints.spi.AbstractHint; //导入依赖的package包/类
/** Creates a new instance of SuspiciousNamesCombination */
public SuspiciousNamesCombination() {
super( false, true, AbstractHint.HintSeverity.WARNING, "SuspiciousNameCombination");
}
示例4: WrongPackageSuggestion
import org.netbeans.modules.java.hints.spi.AbstractHint; //导入依赖的package包/类
/** Creates a new instance of WrongPackageSuggestion */
public WrongPackageSuggestion() {
super( true, false, AbstractHint.HintSeverity.ERROR, "", "WrongPackageStatement");
}
示例5: HideField
import org.netbeans.modules.java.hints.spi.AbstractHint; //导入依赖的package包/类
public HideField(String... sw) {
super( true, false, AbstractHint.HintSeverity.WARNING, sw);
}
示例6: ExportNonAccessibleElement
import org.netbeans.modules.java.hints.spi.AbstractHint; //导入依赖的package包/类
/** Creates a new instance of AddOverrideAnnotation */
public ExportNonAccessibleElement() {
super( true, true, AbstractHint.HintSeverity.WARNING, "NonPublicExported" );
}
示例7: AssignResultToVariable
import org.netbeans.modules.java.hints.spi.AbstractHint; //导入依赖的package包/类
public AssignResultToVariable() {
super(true, false, AbstractHint.HintSeverity.CURRENT_LINE_WARNING);
}
示例8: categorizeTreeRules
import org.netbeans.modules.java.hints.spi.AbstractHint; //导入依赖的package包/类
private static void categorizeTreeRules( List<Pair<Rule,FileObject>> rules,
Kind kind,
Map<HintMetadata, Collection<? extends HintDescription>> metadata) {
for( Pair<Rule,FileObject> pair : rules ) {
Rule rule = pair.getA();
FileObject fo = pair.getB();
if ( rule instanceof TreeRule ) {
final TreeRule tr = (TreeRule) rule;
Object nonGuiObject = fo.getAttribute(NON_GUI);
boolean toGui = true;
if ( nonGuiObject != null &&
nonGuiObject instanceof Boolean &&
((Boolean)nonGuiObject).booleanValue() ) {
toGui = false;
}
FileObject parent = fo.getParent();
HintMetadata.Builder hmb = HintMetadata.Builder.create(tr.getId())
.setCategory(parent.getName())
.setKind(kind);
if (!toGui) hmb = hmb.addOptions(Options.NON_GUI);
if (rule instanceof AbstractHint) {
final AbstractHint h = (AbstractHint) rule;
hmb = hmb.setDescription(toGui ? h.getDisplayName() : "", toGui ? h.getDescription() : "");
hmb = hmb.setEnabled(ACCESSOR.isEnabledDefault(h));
hmb = hmb.setSeverity(ACCESSOR.severiryDefault(h).toOfficialSeverity());
hmb = hmb.setCustomizerProvider(new CustomizerProviderImpl(h));
hmb = hmb.addSuppressWarnings(ACCESSOR.getSuppressBy(h));
if (!ACCESSOR.isShowInTaskListDefault(h)) hmb = hmb.addOptions(Options.NO_BATCH);
else if (h.getClass().getClassLoader() != RulesManager.class.getClassLoader()) hmb = hmb.addOptions(Options.QUERY);
} else {
hmb = hmb.setDescription(toGui ? tr.getDisplayName() : "", toGui ? tr.getDisplayName() : "");
hmb = hmb.setSeverity(Severity.VERIFIER);
}
HintMetadata hm = hmb.build();
List<HintDescription> hd = new LinkedList<HintDescription>();
hd.add(HintDescriptionFactory.create()
.setTrigger(new Kinds(tr.getTreeKinds()))
.setMetadata(hm)
.setWorker(new WorkerImpl(tr))
.produce());
metadata.put(hm, hd);
}
else {
LOG.log( Level.WARNING, "The rule defined in " + fo.getPath() + "is not instance of TreeRule" );
}
}
}
示例9: CustomizerProviderImpl
import org.netbeans.modules.java.hints.spi.AbstractHint; //导入依赖的package包/类
public CustomizerProviderImpl(AbstractHint hint) {
this.hint = hint;
}
示例10: UpdateHint
import org.netbeans.modules.java.hints.spi.AbstractHint; //导入依赖的package包/类
public UpdateHint() {
super(true, true, AbstractHint.HintSeverity.WARNING);
}
示例11: InternalMethodHint
import org.netbeans.modules.java.hints.spi.AbstractHint; //导入依赖的package包/类
public InternalMethodHint() {
super(true, true, AbstractHint.HintSeverity.WARNING);
}
示例12: ReadOnlyPrimitiveHint
import org.netbeans.modules.java.hints.spi.AbstractHint; //导入依赖的package包/类
public ReadOnlyPrimitiveHint() {
super(true, true, AbstractHint.HintSeverity.WARNING);
}
示例13: TempVarsHint
import org.netbeans.modules.java.hints.spi.AbstractHint; //导入依赖的package包/类
public TempVarsHint() {
super(true, true, AbstractHint.HintSeverity.WARNING);
}
示例14: isEnabledDefault
import org.netbeans.modules.java.hints.spi.AbstractHint; //导入依赖的package包/类
public boolean isEnabledDefault( AbstractHint hint );
示例15: isShowInTaskListDefault
import org.netbeans.modules.java.hints.spi.AbstractHint; //导入依赖的package包/类
public boolean isShowInTaskListDefault( AbstractHint hint );