本文整理汇总了Java中com.intellij.openapi.progress.ProgressIndicatorProvider.getGlobalProgressIndicator方法的典型用法代码示例。如果您正苦于以下问题:Java ProgressIndicatorProvider.getGlobalProgressIndicator方法的具体用法?Java ProgressIndicatorProvider.getGlobalProgressIndicator怎么用?Java ProgressIndicatorProvider.getGlobalProgressIndicator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.progress.ProgressIndicatorProvider
的用法示例。
在下文中一共展示了ProgressIndicatorProvider.getGlobalProgressIndicator方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import com.intellij.openapi.progress.ProgressIndicatorProvider; //导入方法依赖的package包/类
@Override
public void init() {
long start = System.currentTimeMillis();
final ProgressIndicator progressIndicator = isDefault() ? null : ProgressIndicatorProvider.getGlobalProgressIndicator();
if (progressIndicator != null) {
progressIndicator.pushState();
}
super.init(progressIndicator);
if (progressIndicator != null) {
progressIndicator.popState();
}
long time = System.currentTimeMillis() - start;
LOG.info(getComponentConfigCount() + " project components initialized in " + time + " ms");
getMessageBus().syncPublisher(ProjectLifecycleListener.TOPIC).projectComponentsInitialized(this);
//noinspection SynchronizeOnThis
synchronized (this) {
myProjectManagerListener = new MyProjectManagerListener();
myProjectManager.addProjectManagerListener(this, myProjectManagerListener);
}
}
示例2: processQuery
import com.intellij.openapi.progress.ProgressIndicatorProvider; //导入方法依赖的package包/类
@Override
public void processQuery(@NotNull SchemaTypeParentsSearch.SearchParameters parameters, @NotNull Processor<SchemaTypeDef> consumer) {
SchemaTypeDef baseType = parameters.schemaTypeDef;
ProgressIndicator progress = ProgressIndicatorProvider.getGlobalProgressIndicator();
if (progress != null) {
progress.pushState();
String typeName = ApplicationManager.getApplication().runReadAction((Computable<String>) baseType::getName);
progress.setText(typeName == null ?
"Searching for parents" : "Searching for parents of " + typeName
);
}
try {
processParents(consumer, baseType, parameters);
} finally {
if (progress != null) progress.popState();
}
}
示例3: processQuery
import com.intellij.openapi.progress.ProgressIndicatorProvider; //导入方法依赖的package包/类
@Override
public void processQuery(@NotNull SchemaTypeInheritorsSearch.SearchParameters parameters, @NotNull Processor<SchemaTypeDef> consumer) {
SchemaTypeDef baseType = parameters.schemaTypeDef;
ProgressIndicator progress = ProgressIndicatorProvider.getGlobalProgressIndicator();
if (progress != null) {
progress.pushState();
String typeName = ApplicationManager.getApplication().runReadAction((Computable<String>) baseType::getName);
progress.setText(typeName == null ?
"Searching for inheritors" : "Searching for inheritors of " + typeName
);
}
try {
processInheritors(consumer, baseType, parameters);
} finally {
if (progress != null) progress.popState();
}
}
示例4: commitTransaction
import com.intellij.openapi.progress.ProgressIndicatorProvider; //导入方法依赖的package包/类
private void commitTransaction(final PomTransaction transaction) {
final ProgressIndicator progressIndicator = ProgressIndicatorProvider.getGlobalProgressIndicator();
final PsiDocumentManagerBase manager = (PsiDocumentManagerBase)PsiDocumentManager.getInstance(myProject);
final PsiToDocumentSynchronizer synchronizer = manager.getSynchronizer();
final PsiFile containingFileByTree = getContainingFileByTree(transaction.getChangeScope());
Document document = containingFileByTree != null ? manager.getCachedDocument(containingFileByTree) : null;
if (document != null) {
final int oldLength = containingFileByTree.getTextLength();
boolean success = synchronizer.commitTransaction(document);
if (success) {
BlockSupportImpl.sendAfterChildrenChangedEvent((PsiManagerImpl)PsiManager.getInstance(myProject), (PsiFileImpl)containingFileByTree, oldLength, true);
}
}
if (containingFileByTree != null) {
boolean isFromCommit = ApplicationManager.getApplication().isDispatchThread() &&
ApplicationManager.getApplication().hasWriteAction(CommitToPsiFileAction.class);
if (!isFromCommit && !synchronizer.isIgnorePsiEvents()) {
reparseParallelTrees(containingFileByTree);
}
}
if (progressIndicator != null) progressIndicator.finishNonCancelableSection();
}
示例5: execute
import com.intellij.openapi.progress.ProgressIndicatorProvider; //导入方法依赖的package包/类
@Override
public boolean execute(@NotNull final SearchParameters parameters, @NotNull final Processor<DotNetTypeDeclaration> consumer)
{
final String baseVmQName = parameters.getVmQName();
final SearchScope searchScope = parameters.getScope();
TypeInheritorsSearch.LOGGER.assertTrue(searchScope != null);
ProgressIndicator progress = ProgressIndicatorProvider.getGlobalProgressIndicator();
if(progress != null)
{
progress.pushState();
progress.setText(PsiBundle.message("psi.search.inheritors.of.class.progress", baseVmQName));
}
boolean result = processInheritors(consumer, baseVmQName, searchScope, parameters);
if(progress != null)
{
progress.popState();
}
return result;
}
示例6: processQuery
import com.intellij.openapi.progress.ProgressIndicatorProvider; //导入方法依赖的package包/类
@Override
public void processQuery(@NotNull ClassInheritorsSearch.SearchParameters parameters, @NotNull Processor<PsiClass> consumer) {
final PsiClass baseClass = parameters.getClassToProcess();
final SearchScope searchScope = parameters.getScope();
LOG.assertTrue(searchScope != null);
ProgressIndicator progress = ProgressIndicatorProvider.getGlobalProgressIndicator();
if (progress != null) {
progress.pushState();
String className = ApplicationManager.getApplication().runReadAction(new Computable<String>() {
@Override
public String compute() {
return baseClass.getName();
}
});
progress.setText(className != null ?
PsiBundle.message("psi.search.inheritors.of.class.progress", className) :
PsiBundle.message("psi.search.inheritors.progress"));
}
processInheritors(consumer, baseClass, searchScope, parameters);
if (progress != null) {
progress.popState();
}
}
示例7: processClassNames
import com.intellij.openapi.progress.ProgressIndicatorProvider; //导入方法依赖的package包/类
public static Project processClassNames(final Project project, final GlobalSearchScope scope, final Consumer<String> consumer) {
final ProgressIndicator indicator = ProgressIndicatorProvider.getGlobalProgressIndicator();
MethodUsagesSearcher.resolveInReadAction(project, new Computable<Void>() {
@Override
public Void compute() {
PsiShortNamesCache.getInstance(project).processAllClassNames(new Processor<String>() {
int i = 0;
@Override
public boolean process(String s) {
if (indicator != null && i++ % 512 == 0) {
indicator.checkCanceled();
}
consumer.consume(s);
return true;
}
}, scope, IdFilter.getProjectIdFilter(project, true));
return null;
}
});
if (indicator != null) {
indicator.checkCanceled();
}
return project;
}
示例8: commitTransaction
import com.intellij.openapi.progress.ProgressIndicatorProvider; //导入方法依赖的package包/类
private void commitTransaction(final PomTransaction transaction) {
final ProgressIndicator progressIndicator = ProgressIndicatorProvider.getGlobalProgressIndicator();
final PsiDocumentManagerBase manager = (PsiDocumentManagerBase)PsiDocumentManager.getInstance(myProject);
final PsiToDocumentSynchronizer synchronizer = manager.getSynchronizer();
final PsiFile containingFileByTree = getContainingFileByTree(transaction.getChangeScope());
Document document = containingFileByTree != null ? manager.getCachedDocument(containingFileByTree) : null;
boolean docSynced = false;
if (document != null) {
final int oldLength = containingFileByTree.getTextLength();
docSynced = synchronizer.commitTransaction(document);
if (docSynced) {
BlockSupportImpl.sendAfterChildrenChangedEvent((PsiManagerImpl)PsiManager.getInstance(myProject), containingFileByTree, oldLength, true);
}
}
if (containingFileByTree != null) {
boolean isFromCommit = ApplicationManager.getApplication().isDispatchThread() &&
ApplicationManager.getApplication().hasWriteAction(CommitToPsiFileAction.class);
if (!isFromCommit && !synchronizer.isIgnorePsiEvents()) {
reparseParallelTrees(containingFileByTree);
if (docSynced) {
containingFileByTree.getViewProvider().contentsSynchronized();
}
}
}
if (progressIndicator != null) progressIndicator.finishNonCancelableSection();
}
示例9: startTransaction
import com.intellij.openapi.progress.ProgressIndicatorProvider; //导入方法依赖的package包/类
private void startTransaction(@NotNull PomTransaction transaction) {
final ProgressIndicator progressIndicator = ProgressIndicatorProvider.getGlobalProgressIndicator();
if(progressIndicator != null) progressIndicator.startNonCancelableSection();
final PsiDocumentManagerBase manager = (PsiDocumentManagerBase)PsiDocumentManager.getInstance(myProject);
final PsiToDocumentSynchronizer synchronizer = manager.getSynchronizer();
final PsiElement changeScope = transaction.getChangeScope();
LOG.assertTrue(changeScope != null);
final PsiFile containingFileByTree = getContainingFileByTree(changeScope);
boolean physical = changeScope.isPhysical();
if (physical && synchronizer.toProcessPsiEvent() && isDocumentUncommitted(containingFileByTree)) {
// fail-fast to prevent any psi modifications that would cause psi/document text mismatch
// PsiToDocumentSynchronizer assertions happen inside event processing and are logged by PsiManagerImpl.fireEvent instead of being rethrown
// so it's important to throw something outside event processing
throw new IllegalStateException("Attempt to modify PSI for non-committed Document!");
}
if (containingFileByTree != null) {
((SmartPointerManagerImpl) SmartPointerManager.getInstance(myProject)).fastenBelts(containingFileByTree.getViewProvider().getVirtualFile());
}
BlockSupportImpl.sendBeforeChildrenChangeEvent((PsiManagerImpl)PsiManager.getInstance(myProject), changeScope, true);
Document document = containingFileByTree == null ? null :
physical ? manager.getDocument(containingFileByTree) :
manager.getCachedDocument(containingFileByTree);
if(document != null) {
synchronizer.startTransaction(myProject, document, changeScope);
}
}
示例10: merge
import com.intellij.openapi.progress.ProgressIndicatorProvider; //导入方法依赖的package包/类
@NotNull
private DiffLog merge(@NotNull final ASTNode oldRoot, @NotNull StartMarker newRoot, @NotNull CharSequence lastCommittedText) {
DiffLog diffLog = new DiffLog();
DiffTreeChangeBuilder<ASTNode, LighterASTNode> builder = new ConvertFromTokensToASTBuilder(newRoot, diffLog);
MyTreeStructure treeStructure = new MyTreeStructure(newRoot, null);
ShallowNodeComparator<ASTNode, LighterASTNode> comparator = new MyComparator(getUserDataUnprotected(CUSTOM_COMPARATOR), treeStructure);
ProgressIndicator indicator = ProgressIndicatorProvider.getGlobalProgressIndicator();
BlockSupportImpl.diffTrees(oldRoot, builder, comparator, treeStructure, indicator == null ? new EmptyProgressIndicator() : indicator,
lastCommittedText);
return diffLog;
}
示例11: execute
import com.intellij.openapi.progress.ProgressIndicatorProvider; //导入方法依赖的package包/类
@Override
public boolean execute(@NotNull final SearchParameters parameters, @NotNull final Processor<PsiClass> consumer) {
final PsiClass baseClass = parameters.getClassToProcess();
final SearchScope searchScope = parameters.getScope();
LOG.assertTrue(searchScope != null);
ProgressIndicator progress = ProgressIndicatorProvider.getGlobalProgressIndicator();
if (progress != null) {
progress.pushState();
String className = ApplicationManager.getApplication().runReadAction(new Computable<String>() {
@Override
public String compute() {
return baseClass.getName();
}
});
progress.setText(className != null ?
PsiBundle.message("psi.search.inheritors.of.class.progress", className) :
PsiBundle.message("psi.search.inheritors.progress"));
}
boolean result = processInheritors(consumer, baseClass, searchScope, parameters);
if (progress != null) {
progress.popState();
}
return result;
}
示例12: processElementsWithWordAsync
import com.intellij.openapi.progress.ProgressIndicatorProvider; //导入方法依赖的package包/类
@NotNull
@Override
public AsyncFuture<Boolean> processElementsWithWordAsync(@NotNull final TextOccurenceProcessor processor,
@NotNull SearchScope searchScope,
@NotNull final String text,
final short searchContext,
final boolean caseSensitively) {
if (text.isEmpty()) {
return AsyncFutureFactory.wrapException(new IllegalArgumentException("Cannot search for elements with empty text"));
}
final ProgressIndicator progress = ProgressIndicatorProvider.getGlobalProgressIndicator();
if (searchScope instanceof GlobalSearchScope) {
StringSearcher searcher = new StringSearcher(text, caseSensitively, true, searchContext == UsageSearchContext.IN_STRINGS);
return processElementsWithTextInGlobalScopeAsync(processor,
(GlobalSearchScope)searchScope,
searcher,
searchContext, caseSensitively, progress);
}
else {
LocalSearchScope scope = (LocalSearchScope)searchScope;
PsiElement[] scopeElements = scope.getScope();
final boolean ignoreInjectedPsi = scope.isIgnoreInjectedPsi();
return JobLauncher.getInstance().invokeConcurrentlyUnderProgressAsync(Arrays.asList(scopeElements), progress, false,
new Processor<PsiElement>() {
@Override
public boolean process(PsiElement scopeElement) {
return processElementsWithWordInScopeElement(scopeElement,
processor,
text,
caseSensitively,
ignoreInjectedPsi,
searchContext == UsageSearchContext.IN_STRINGS,
progress);
}
});
}
}
示例13: startTransaction
import com.intellij.openapi.progress.ProgressIndicatorProvider; //导入方法依赖的package包/类
private void startTransaction(final PomTransaction transaction) {
final ProgressIndicator progressIndicator = ProgressIndicatorProvider.getGlobalProgressIndicator();
if(progressIndicator != null) progressIndicator.startNonCancelableSection();
final PsiDocumentManagerBase manager = (PsiDocumentManagerBase)PsiDocumentManager.getInstance(myProject);
final PsiToDocumentSynchronizer synchronizer = manager.getSynchronizer();
final PsiElement changeScope = transaction.getChangeScope();
BlockSupportImpl.sendBeforeChildrenChangeEvent((PsiManagerImpl)PsiManager.getInstance(myProject), transaction.getChangeScope(), true);
LOG.assertTrue(changeScope != null);
final PsiFile containingFileByTree = getContainingFileByTree(changeScope);
Document document = containingFileByTree == null ? null : manager.getCachedDocument(containingFileByTree);
if(document != null) {
synchronizer.startTransaction(myProject, document, transaction.getChangeScope());
}
}
示例14: merge
import com.intellij.openapi.progress.ProgressIndicatorProvider; //导入方法依赖的package包/类
@NotNull
private DiffLog merge(@NotNull final ASTNode oldRoot, @NotNull StartMarker newRoot) {
DiffLog diffLog = new DiffLog();
final ConvertFromTokensToASTBuilder builder = new ConvertFromTokensToASTBuilder(newRoot, diffLog);
final MyTreeStructure treeStructure = new MyTreeStructure(newRoot, null);
final MyComparator comparator = new MyComparator(getUserDataUnprotected(CUSTOM_COMPARATOR), treeStructure);
final ProgressIndicator indicator = ProgressIndicatorProvider.getGlobalProgressIndicator();
BlockSupportImpl.diffTrees(oldRoot, builder, comparator, treeStructure, indicator);
return diffLog;
}
示例15: commitTransaction
import com.intellij.openapi.progress.ProgressIndicatorProvider; //导入方法依赖的package包/类
private void commitTransaction(final PomTransaction transaction) {
final ProgressIndicator progressIndicator = ProgressIndicatorProvider.getGlobalProgressIndicator();
final PsiDocumentManagerBase manager = (PsiDocumentManagerBase)PsiDocumentManager.getInstance(myProject);
final PsiToDocumentSynchronizer synchronizer = manager.getSynchronizer();
final PsiFile containingFileByTree = getContainingFileByTree(transaction.getChangeScope());
Document document = containingFileByTree != null ? manager.getCachedDocument(containingFileByTree) : null;
boolean isFromCommit = ApplicationManager.getApplication().isDispatchThread() &&
((PsiDocumentManagerBase)PsiDocumentManager.getInstance(myProject)).isCommitInProgress();
boolean isPhysicalPsiChange = containingFileByTree != null && !isFromCommit && !synchronizer.isIgnorePsiEvents();
if (isPhysicalPsiChange) {
reparseParallelTrees(containingFileByTree, synchronizer);
}
boolean docSynced = false;
if (document != null) {
final int oldLength = containingFileByTree.getTextLength();
docSynced = synchronizer.commitTransaction(document);
if (docSynced) {
BlockSupportImpl.sendAfterChildrenChangedEvent((PsiManagerImpl)PsiManager.getInstance(myProject), containingFileByTree, oldLength, true);
}
}
if (isPhysicalPsiChange && docSynced) {
containingFileByTree.getViewProvider().contentsSynchronized();
}
if (progressIndicator != null) progressIndicator.finishNonCancelableSection();
}