本文整理匯總了Java中com.intellij.openapi.project.DumbService.isDumbAware方法的典型用法代碼示例。如果您正苦於以下問題:Java DumbService.isDumbAware方法的具體用法?Java DumbService.isDumbAware怎麽用?Java DumbService.isDumbAware使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.intellij.openapi.project.DumbService
的用法示例。
在下文中一共展示了DumbService.isDumbAware方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: appendUsage
import com.intellij.openapi.project.DumbService; //導入方法依賴的package包/類
@Nullable
UsageNode appendUsage(@NotNull Usage usage, @NotNull Consumer<Runnable> edtQueue) {
if (!isVisible(usage)) return null;
final boolean dumb = DumbService.isDumb(myProject);
GroupNode lastGroupNode = myRoot;
for (int i = 0; i < myGroupingRules.length; i++) {
final UsageGroupingRule rule = myGroupingRules[i];
if (dumb && !DumbService.isDumbAware(rule)) continue;
final UsageGroup group;
if (rule instanceof UsageGroupingRuleEx) {
group = ((UsageGroupingRuleEx) rule).groupUsage(usage, myTargets);
}
else {
group = rule.groupUsage(usage);
}
if (group != null) {
lastGroupNode = lastGroupNode.addGroup(group, i, edtQueue);
}
}
return lastGroupNode.addUsage(usage, edtQueue);
}
示例2: runAnnotators
import com.intellij.openapi.project.DumbService; //導入方法依賴的package包/類
private void runAnnotators(PsiElement element) {
List<Annotator> annotators = cachedAnnotators.get(element.getLanguage().getID());
if (annotators.isEmpty()) return;
final boolean dumb = myDumbService.isDumb();
//noinspection ForLoopReplaceableByForEach
for (int i = 0; i < annotators.size(); i++) {
Annotator annotator = annotators.get(i);
if (dumb && !DumbService.isDumbAware(annotator)) {
continue;
}
ProgressManager.checkCanceled();
annotator.annotate(element, myAnnotationHolder);
}
}
示例3: getUrlsToOpen
import com.intellij.openapi.project.DumbService; //導入方法依賴的package包/類
@NotNull
@Override
public Collection<Url> getUrlsToOpen(@NotNull OpenInBrowserRequest request, boolean preferLocalUrl) throws WebBrowserUrlProvider.BrowserException {
boolean isHtmlOrXml = isHtmlOrXmlFile(request.getFile().getViewProvider().getBaseLanguage());
if (!preferLocalUrl || !isHtmlOrXml) {
DumbService dumbService = DumbService.getInstance(request.getProject());
for (WebBrowserUrlProvider urlProvider : WebBrowserUrlProvider.EP_NAME.getExtensions()) {
if ((!dumbService.isDumb() || DumbService.isDumbAware(urlProvider)) && urlProvider.canHandleElement(request)) {
Collection<Url> urls = getUrls(urlProvider, request);
if (!urls.isEmpty()) {
return urls;
}
}
}
if (!isHtmlOrXml) {
return Collections.emptyList();
}
}
VirtualFile file = request.getVirtualFile();
return file instanceof LightVirtualFile || !request.getFile().getViewProvider().isPhysical()
? Collections.<Url>emptyList()
: Collections.singletonList(Urls.newFromVirtualFile(file));
}
示例4: buildFoldingDescriptors
import com.intellij.openapi.project.DumbService; //導入方法依賴的package包/類
@NotNull
public static FoldingDescriptor[] buildFoldingDescriptors(@Nullable FoldingBuilder builder, @NotNull PsiElement root, @NotNull Document document, boolean quick) {
if (!DumbService.isDumbAware(builder) && DumbService.getInstance(root.getProject()).isDumb()) {
return FoldingDescriptor.EMPTY;
}
if (builder instanceof FoldingBuilderEx) {
return ((FoldingBuilderEx)builder).buildFoldRegions(root, document, quick);
}
final ASTNode astNode = root.getNode();
if (astNode == null || builder == null) {
return FoldingDescriptor.EMPTY;
}
return builder.buildFoldRegions(astNode, document);
}
示例5: setLocator
import com.intellij.openapi.project.DumbService; //導入方法依賴的package包/類
/** @deprecated use {@link #setLocator(SMTestLocator)} (to be removed in IDEA 16) */
@SuppressWarnings("deprecation")
public void setLocator(@NotNull final TestLocationProvider locator) {
class Adapter implements SMTestLocator, PossiblyDumbAware {
@NotNull
@Override
public List<Location> getLocation(@NotNull String protocol, @NotNull String path, @NotNull Project project, @NotNull GlobalSearchScope scope) {
return locator.getLocation(protocol, path, project);
}
@Override
public boolean isDumbAware() {
return DumbService.isDumbAware(locator);
}
}
myLocator = new Adapter();
}
示例6: getLocation
import com.intellij.openapi.project.DumbService; //導入方法依賴的package包/類
protected Location getLocation(@NotNull Project project, @NotNull GlobalSearchScope searchScope, String locationUrl) {
if (locationUrl != null && myLocator != null) {
String protocolId = VirtualFileManager.extractProtocol(locationUrl);
if (protocolId != null) {
String path = VirtualFileManager.extractPath(locationUrl);
if (!DumbService.isDumb(project) || DumbService.isDumbAware(myLocator)) {
List<Location> locations = myLocator.getLocation(protocolId, path, project, searchScope);
if (!locations.isEmpty()) {
return locations.get(0);
}
}
}
}
return null;
}
示例7: getUpdateMessage
import com.intellij.openapi.project.DumbService; //導入方法依賴的package包/類
@Override
public String getUpdateMessage() {
final boolean dumb = myDumbService.isDumb();
List<Filter> filters = myFilters;
final List<String> updateMessage = new ArrayList<String>();
int count = filters.size();
for (int i = 0; i < count; i++) {
Filter filter = filters.get(i);
if (!(filter instanceof FilterMixin) || !((FilterMixin)filter).shouldRunHeavy()) continue;
if (!dumb || DumbService.isDumbAware(filter)) {
updateMessage.add(((FilterMixin)filter).getUpdateMessage());
}
}
return updateMessage.size() == 1 ? updateMessage.get(0) : "Updating...";
}
示例8: runDumbAware
import com.intellij.openapi.project.DumbService; //導入方法依賴的package包/類
public static void runDumbAware(final Project project, final Runnable r) {
if (DumbService.isDumbAware(r)) {
r.run();
} else {
DumbService.getInstance(project).runWhenSmart(DisposeAwareRunnable.create(r, project));
}
}
示例9: runDumbAware
import com.intellij.openapi.project.DumbService; //導入方法依賴的package包/類
public static void runDumbAware(final Project project, final Runnable r) {
if (DumbService.isDumbAware(r)) {
r.run();
}
else {
DumbService.getInstance(project).runWhenSmart(DisposeAwareRunnable.create(r, project));
}
}
示例10: isValid
import com.intellij.openapi.project.DumbService; //導入方法依賴的package包/類
protected boolean isValid() {
if (isDumbMode() && !DumbService.isDumbAware(this)) {
return false;
}
if (myDocument != null && myDocument.getModificationStamp() != myInitialStamp) return false;
if (myDocument != null) {
PsiFile file = PsiDocumentManager.getInstance(myProject).getPsiFile(myDocument);
if (file == null || !file.isValid()) return false;
}
return true;
}
示例11: getProvidersIcon
import com.intellij.openapi.project.DumbService; //導入方法依賴的package包/類
@Nullable
public static Icon getProvidersIcon(@NotNull PsiElement element, @Iconable.IconFlags int flags) {
final boolean dumb = DumbService.getInstance(element.getProject()).isDumb();
for (final IconProvider iconProvider : getIconProviders()) {
if (dumb && !DumbService.isDumbAware(iconProvider)) {
continue;
}
final Icon icon = iconProvider.getIcon(element, flags);
if (icon != null) return icon;
}
return null;
}
示例12: runBackgroundProcess
import com.intellij.openapi.project.DumbService; //導入方法依賴的package包/類
@Override
public void runBackgroundProcess(@NotNull final ProgressIndicator indicator) {
Runnable r = new Runnable() {
@Override
public void run() {
computeInReadAction(indicator);
}
};
if (DumbService.isDumbAware(myModel)) {
ApplicationManager.getApplication().runReadAction(r);
} else {
DumbService.getInstance(myProject).runReadActionInSmartMode(r);
}
}
示例13: runDumbAware
import com.intellij.openapi.project.DumbService; //導入方法依賴的package包/類
public static void runDumbAware(final Project project, final Runnable r) {
if (DumbService.isDumbAware(r)) {
r.run();
}
else {
DumbService.getInstance(project).runWhenSmart(DisposeAwareRunnable.create(r, project));
}
}
示例14: applyFilter
import com.intellij.openapi.project.DumbService; //導入方法依賴的package包/類
@Override
@Nullable
public Result applyFilter(final String line, final int entireLength) {
final boolean dumb = myDumbService.isDumb();
List<Filter> filters = myFilters;
int count = filters.size();
List<ResultItem> resultItems = null;
for (int i = 0; i < count; i++) {
Filter filter = filters.get(i);
if (!dumb || DumbService.isDumbAware(filter)) {
long t0 = System.currentTimeMillis();
Result result;
try {
result = filter.applyFilter(line, entireLength);
}
catch (Throwable t) {
throw new RuntimeException("Error while applying " + filter + " to '" + line + "'", t);
}
resultItems = merge(resultItems, result);
t0 = System.currentTimeMillis() - t0;
if (t0 > 1000) {
LOG.warn(filter.getClass().getSimpleName() + ".applyFilter() took " + t0 + " ms on '''" + line + "'''");
}
if (shouldStopFiltering(result)) {
break;
}
}
}
return createFinalResult(resultItems);
}
示例15: applyHeavyFilter
import com.intellij.openapi.project.DumbService; //導入方法依賴的package包/類
@Override
public void applyHeavyFilter(Document copiedFragment, int startOffset, int startLineNumber, Consumer<AdditionalHighlight> consumer) {
final boolean dumb = myDumbService.isDumb();
List<Filter> filters = myFilters;
int count = filters.size();
for (int i = 0; i < count; i++) {
Filter filter = filters.get(i);
if (!(filter instanceof FilterMixin) || !((FilterMixin)filter).shouldRunHeavy()) continue;
if (!dumb || DumbService.isDumbAware(filter)) {
((FilterMixin)filter).applyHeavyFilter(copiedFragment, startOffset, startLineNumber, consumer);
}
}
}