本文整理匯總了Java中com.intellij.openapi.project.DumbService.isDumb方法的典型用法代碼示例。如果您正苦於以下問題:Java DumbService.isDumb方法的具體用法?Java DumbService.isDumb怎麽用?Java DumbService.isDumb使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.intellij.openapi.project.DumbService
的用法示例。
在下文中一共展示了DumbService.isDumb方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: applyFix
import com.intellij.openapi.project.DumbService; //導入方法依賴的package包/類
@Override
public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
PsiElement psiElement = descriptor.getPsiElement();
if (DumbService.isDumb(project)) {
showIsInDumpModeMessage(project, psiElement);
return;
}
if (psiElement instanceof ClassReference) {
ClassReference classReference = (ClassReference) psiElement;
String fqn = classReference.getFQN();
if (fqn != null) {
String replacementFQN = LegacyClassesForIDEIndex.findReplacementClass(project, fqn);
if (replacementFQN != null) {
try {
classReference.replace(PhpPsiElementFactory.createClassReference(project, replacementFQN));
} catch (IncorrectOperationException e) {
showErrorMessage(project, "Could not replace class reference", psiElement);
}
}
}
}
}
示例2: actionPerformed
import com.intellij.openapi.project.DumbService; //導入方法依賴的package包/類
@Override
public void actionPerformed(AnActionEvent anActionEvent) {
Project project = PsiUtil.getProject(anActionEvent);
DumbService dumbService = DumbService.getInstance(project);
if (dumbService.isDumb()) {
dumbService.showDumbModeNotification(CodeGenBundle.message("codegen.plugin.is.not.available.during.indexing"));
return;
}
JFrame frame = new JFrame();
frame.setTitle("CodeGen-SQL");
frame.setContentPane(new SqlEditorPanel(new IdeaContext(project)).getRootComponent());
frame.setSize(600, 400);
frame.setResizable(false);
frame.setAlwaysOnTop(true);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
示例3: after
import com.intellij.openapi.project.DumbService; //導入方法依賴的package包/類
public void after( final List<? extends VFileEvent> events )
{
if( _project.isDisposed() )
{
return;
}
DumbService dumb = DumbService.getInstance( _project );
if( dumb.isDumb() )
{
dumb.smartInvokeLater( () -> _after( events ) );
}
else
{
ApplicationManager.getApplication().invokeLater( () ->_after( events ) );
}
}
示例4: getCatberryVersion
import com.intellij.openapi.project.DumbService; //導入方法依賴的package包/類
@Nullable
private String getCatberryVersion() {
if (DumbService.isDumb(project))
return null;
final NotNullLazyValue<ModificationTracker> tracker = getCatberryTracker();
return CachedValuesManager.getManager(project).getCachedValue(project, new CachedValueProvider<String>() {
@Nullable
@Override
public Result<String> compute() {
VirtualFile vf = project.getBaseDir().findChild("package.json");
if (vf == null)
return Result.create(null, tracker.getValue());
final JsonFile file = (JsonFile) PsiManager.getInstance(project).findFile(vf);
if (file == null || file.getTopLevelValue()==null)
return Result.create(null, tracker.getValue());
JsonValue value = JsonPsiUtil.findPropertyValue(file.getTopLevelValue(), "dependencies/catberry");
if (value != null)
return Result.create(value.getText(), file);
return Result.create(null, tracker.getValue());
}
});
}
示例5: getComponentsDirectories
import com.intellij.openapi.project.DumbService; //導入方法依賴的package包/類
@NotNull
public PsiDirectory[] getComponentsDirectories() {
if (DumbService.isDumb(project))
return new PsiDirectory[0];
final NotNullLazyValue<ModificationTracker> tracker = getCatberryTracker();
ComponentsDirectoriesProvider provider = new ComponentsDirectoriesProvider(project, tracker);
String[] res = CachedValuesManager.getManager(project).getCachedValue(project, provider);
List<PsiDirectory> result = new ArrayList<PsiDirectory>(res.length);
for(String path : res) {
VirtualFile virtualFile = project.getBaseDir().findFileByRelativePath(path);
if(virtualFile == null)
continue;
PsiManager manager = PsiManager.getInstance(project);
PsiDirectory dir = manager.findDirectory(virtualFile);
if(dir != null)
result.add(dir);
}
return result.toArray(new PsiDirectory[result.size()]);
}
示例6: 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));
}
示例7: getDependences
import com.intellij.openapi.project.DumbService; //導入方法依賴的package包/類
@Override
public Object[] getDependences() {
if (myPattern != null) {
if (DumbService.isDumb(myElement.getProject())) {
return new Object[] { ModificationTracker.EVER_CHANGED, ExternalResourceManager.getInstance()};
}
final Object[] a = { myElement, ExternalResourceManager.getInstance() };
final PsiElementProcessor.CollectElements<XmlFile> processor = new PsiElementProcessor.CollectElements<XmlFile>();
RelaxIncludeIndex.processForwardDependencies(myFile, processor);
if (processor.getCollection().size() > 0) {
return ArrayUtil.mergeArrays(a, processor.toArray());
} else {
return a;
}
}
return new Object[]{ ModificationTracker.EVER_CHANGED };
}
示例8: runCheckinHandlers
import com.intellij.openapi.project.DumbService; //導入方法依賴的package包/類
@Override
public void runCheckinHandlers(@NotNull final Runnable finishAction) {
final VcsConfiguration configuration = VcsConfiguration.getInstance(myProject);
final Collection<VirtualFile> files = myPanel.getVirtualFiles();
final Runnable performCheckoutAction = new Runnable() {
@Override
public void run() {
FileDocumentManager.getInstance().saveAllDocuments();
finishAction.run();
}
};
if (configuration.OPTIMIZE_IMPORTS_BEFORE_PROJECT_COMMIT && !DumbService.isDumb(myProject)) {
new OptimizeImportsProcessor(myProject, CheckinHandlerUtil.getPsiFiles(myProject, files), COMMAND_NAME, performCheckoutAction).run();
} else {
finishAction.run();
}
}
示例9: doGetInnerClasses
import com.intellij.openapi.project.DumbService; //導入方法依賴的package包/類
private PsiClass[] doGetInnerClasses() {
if (DumbService.isDumb(getProject())) {
LOG.debug("R_CLASS_AUGMENT: empty because of dumb mode");
return new PsiClass[0];
}
final AndroidFacet facet = AndroidFacet.getInstance(myModule);
if (facet == null) {
LOG.debug("R_CLASS_AUGMENT: empty because no facet");
return new PsiClass[0];
}
final Set<ResourceType> types =
ResourceReferenceConverter.getResourceTypesInCurrentModule(facet);
final List<PsiClass> result = new ArrayList<>();
for (ResourceType type : types) {
result.add(new ResourceTypeClass(facet, type.getName(), this));
}
LOG.debug("R_CLASS_AUGMENT: " + result.size() + " classes added");
return result.toArray(new PsiClass[result.size()]);
}
示例10: getInnerClasses
import com.intellij.openapi.project.DumbService; //導入方法依賴的package包/類
@NotNull
@Override
public PsiClass[] getInnerClasses() {
if (DumbService.isDumb(getProject())) {
return new PsiClass[0];
}
final AndroidFacet facet = AndroidFacet.getInstance(myModule);
if (facet == null) {
return new PsiClass[0];
}
final Set<String> types = ResourceReferenceConverter.getResourceTypesInCurrentModule(facet);
final List<PsiClass> result = new ArrayList<PsiClass>();
for (String resType : types) {
result.add(new ResourceTypeClass(facet, resType, this));
}
return result.toArray(new PsiClass[result.size()]);
}
示例11: update
import com.intellij.openapi.project.DumbService; //導入方法依賴的package包/類
public void update(AnActionEvent event) {
Project project = getEventProject(event);
if (project == null) {
this.setStatus(event, false);
return;
}
if (DumbService.isDumb(project)) {
this.setStatus(event, false);
return;
}
DataContext dataContext = event.getDataContext();
final Editor editor = CommonDataKeys.EDITOR.getData(dataContext);
final PsiFile file = CommonDataKeys.PSI_FILE.getData(dataContext);
final PhpClass targetClass = editor == null || file == null ? null : PhpCodeEditUtil.findClassAtCaret(editor, file);
if (targetClass == null) {
setStatus(event, false);
return;
}
if (ExtensionUtility.getExtensionDirectory(event) == null) {
this.setStatus(event, false);
return;
}
this.setStatus(event, PhpElementsUtil.hasSuperClass(targetClass, "\\TYPO3\\CMS\\Extbase\\Mvc\\Controller\\AbstractController"));
}
示例12: update
import com.intellij.openapi.project.DumbService; //導入方法依賴的package包/類
public void update(AnActionEvent event) {
Project project = getEventProject(event);
if (project == null) {
this.setStatus(event, false);
return;
}
if (DumbService.isDumb(project)) {
this.setStatus(event, false);
return;
}
this.setStatus(event, ExtensionUtility.getExtensionDirectory(event) != null);
}
示例13: actionPerformed
import com.intellij.openapi.project.DumbService; //導入方法依賴的package包/類
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
EduUsagesCollector.taskChecked();
Project project = e.getProject();
if (project == null) {
return;
}
if (DumbService.isDumb(project)) {
StudyCheckUtils
.showTestResultPopUp("Checking is not available while indexing is in progress", MessageType.WARNING.getPopupBackground(), project);
return;
}
StudyCheckUtils.hideTestResultsToolWindow(project);
FileDocumentManager.getInstance().saveAllDocuments();
Editor editor = FileEditorManager.getInstance(project).getSelectedTextEditor();
if (editor == null) {
return;
}
VirtualFile virtualFile = FileDocumentManager.getInstance().getFile(editor.getDocument());
if (virtualFile == null) {
return;
}
Task task = StudyUtils.getTaskForFile(project, virtualFile);
if (task == null) {
return;
}
for (StudyCheckListener listener : Extensions.getExtensions(StudyCheckListener.EP_NAME)) {
listener.beforeCheck(project, task);
}
ProgressManager.getInstance().run(new StudyCheckTask(project, task));
}
示例14: actionPerformed
import com.intellij.openapi.project.DumbService; //導入方法依賴的package包/類
@Override
public void actionPerformed(AnActionEvent e) {
Project project = PsiUtil.getProject(e);
DumbService dumbService = DumbService.getInstance(project);
if (dumbService.isDumb()) {
dumbService.showDumbModeNotification(CodeGenBundle.message("codegen.plugin.is.not.available.during.indexing"));
return;
}
Iterator<DbElement> iterator = DatabaseView.getSelectedElements(e.getDataContext(), DbElement.class).iterator();
List<DbTable> tables = new ArrayList<>();
while (iterator.hasNext()) {
DbElement table = iterator.next();
if (table instanceof DbTable) {
tables.add((DbTable) table);
}
}
ColumnEditorFrame frame = new ColumnEditorFrame();
frame.newColumnEditorByDb(new IdeaContext(project), tables);
frame.setSize(800, 550);
frame.setLocationRelativeTo(null);
frame.setAlwaysOnTop(true);
frame.setResizable(false);
frame.setVisible(true);
}
示例15: before
import com.intellij.openapi.project.DumbService; //導入方法依賴的package包/類
public void before( final List<? extends VFileEvent> events )
{
if( _project.isDisposed() )
{
return;
}
DumbService dumb = DumbService.getInstance( _project );
if( !dumb.isDumb() )
{
_before( events );
}
}