當前位置: 首頁>>代碼示例>>Java>>正文


Java AbstractHint類代碼示例

本文整理匯總了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);     
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:26,代碼來源:HintsTestCase.java

示例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;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:32,代碼來源:RulesManager.java

示例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");
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:5,代碼來源:SuspiciousNamesCombination.java

示例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");
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:5,代碼來源:WrongPackageSuggestion.java

示例5: HideField

import org.netbeans.modules.java.hints.spi.AbstractHint; //導入依賴的package包/類
public HideField(String... sw) {
    super( true, false, AbstractHint.HintSeverity.WARNING, sw);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:4,代碼來源:HideField.java

示例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" );
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:5,代碼來源:ExportNonAccessibleElement.java

示例7: AssignResultToVariable

import org.netbeans.modules.java.hints.spi.AbstractHint; //導入依賴的package包/類
public AssignResultToVariable() {
    super(true, false, AbstractHint.HintSeverity.CURRENT_LINE_WARNING);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:4,代碼來源:AssignResultToVariable.java

示例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" );
        }

    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:57,代碼來源:RulesManager.java

示例9: CustomizerProviderImpl

import org.netbeans.modules.java.hints.spi.AbstractHint; //導入依賴的package包/類
public CustomizerProviderImpl(AbstractHint hint) {
    this.hint = hint;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:4,代碼來源:RulesManager.java

示例10: UpdateHint

import org.netbeans.modules.java.hints.spi.AbstractHint; //導入依賴的package包/類
public UpdateHint() {
    super(true, true, AbstractHint.HintSeverity.WARNING);
}
 
開發者ID:jMonkeyEngine,項目名稱:sdk,代碼行數:4,代碼來源:UpdateHint.java

示例11: InternalMethodHint

import org.netbeans.modules.java.hints.spi.AbstractHint; //導入依賴的package包/類
public InternalMethodHint() {
    super(true, true, AbstractHint.HintSeverity.WARNING);
}
 
開發者ID:jMonkeyEngine,項目名稱:sdk,代碼行數:4,代碼來源:InternalMethodHint.java

示例12: ReadOnlyPrimitiveHint

import org.netbeans.modules.java.hints.spi.AbstractHint; //導入依賴的package包/類
public ReadOnlyPrimitiveHint() {
    super(true, true, AbstractHint.HintSeverity.WARNING);
}
 
開發者ID:jMonkeyEngine,項目名稱:sdk,代碼行數:4,代碼來源:ReadOnlyPrimitiveHint.java

示例13: TempVarsHint

import org.netbeans.modules.java.hints.spi.AbstractHint; //導入依賴的package包/類
public TempVarsHint() {
    super(true, true, AbstractHint.HintSeverity.WARNING);
}
 
開發者ID:jMonkeyEngine,項目名稱:sdk,代碼行數:4,代碼來源:TempVarsHint.java

示例14: isEnabledDefault

import org.netbeans.modules.java.hints.spi.AbstractHint; //導入依賴的package包/類
public boolean isEnabledDefault( AbstractHint hint ); 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:2,代碼來源:RulesManager.java

示例15: isShowInTaskListDefault

import org.netbeans.modules.java.hints.spi.AbstractHint; //導入依賴的package包/類
public boolean isShowInTaskListDefault( AbstractHint hint ); 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:2,代碼來源:RulesManager.java


注:本文中的org.netbeans.modules.java.hints.spi.AbstractHint類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。