use of com.intellij.openapi.application.Application in project intellij-community by JetBrains.
the class PsiChangeHandler method updateChangesForDocument.
private void updateChangesForDocument(@NotNull final Document document) {
ApplicationManager.getApplication().assertIsDispatchThread();
if (myProject.isDisposed())
return;
List<Pair<PsiElement, Boolean>> toUpdate = changedElements.get(document);
if (toUpdate == null) {
// We may still need to rehighlight the file if there were changes inside highlighted ranges.
if (UpdateHighlightersUtil.isWhitespaceOptimizationAllowed(document))
return;
// don't create PSI for files in other projects
PsiElement file = PsiDocumentManager.getInstance(myProject).getCachedPsiFile(document);
if (file == null)
return;
toUpdate = Collections.singletonList(Pair.create(file, true));
}
Application application = ApplicationManager.getApplication();
final Editor editor = FileEditorManager.getInstance(myProject).getSelectedTextEditor();
if (editor != null && !application.isUnitTestMode()) {
application.invokeLater(() -> {
if (!editor.isDisposed()) {
EditorMarkupModel markupModel = (EditorMarkupModel) editor.getMarkupModel();
PsiFile file = PsiDocumentManager.getInstance(myProject).getPsiFile(editor.getDocument());
TrafficLightRenderer.setOrRefreshErrorStripeRenderer(markupModel, myProject, editor.getDocument(), file);
}
}, ModalityState.stateForComponent(editor.getComponent()), myProject.getDisposed());
}
for (Pair<PsiElement, Boolean> changedElement : toUpdate) {
PsiElement element = changedElement.getFirst();
Boolean whiteSpaceOptimizationAllowed = changedElement.getSecond();
updateByChange(element, document, whiteSpaceOptimizationAllowed);
}
changedElements.remove(document);
}
use of com.intellij.openapi.application.Application in project intellij-community by JetBrains.
the class Messages method setTestDialog.
@TestOnly
public static TestDialog setTestDialog(TestDialog newValue) {
Application application = ApplicationManager.getApplication();
if (application != null) {
LOG.assertTrue(application.isUnitTestMode(), "This method is available for tests only");
}
TestDialog oldValue = ourTestImplementation;
ourTestImplementation = newValue;
return oldValue;
}
use of com.intellij.openapi.application.Application in project intellij-community by JetBrains.
the class Messages method setTestInputDialog.
@TestOnly
public static TestInputDialog setTestInputDialog(TestInputDialog newValue) {
Application application = ApplicationManager.getApplication();
if (application != null) {
LOG.assertTrue(application.isUnitTestMode(), "This method is available for tests only");
}
TestInputDialog oldValue = ourTestInputImplementation;
ourTestInputImplementation = newValue;
return oldValue;
}
use of com.intellij.openapi.application.Application in project intellij-community by JetBrains.
the class FileInEditorProcessor method shouldNotify.
private boolean shouldNotify() {
Application application = ApplicationManager.getApplication();
if (application.isUnitTestMode() || application.isHeadlessEnvironment()) {
return false;
}
EditorSettingsExternalizable.OptionSet editorOptions = EditorSettingsExternalizable.getInstance().getOptions();
return editorOptions.SHOW_NOTIFICATION_AFTER_REFORMAT_CODE_ACTION && myEditor != null && !myProcessSelectedText;
}
use of com.intellij.openapi.application.Application in project intellij-community by JetBrains.
the class StatusBarUpdater method updateLater.
private void updateLater() {
final Application application = ApplicationManager.getApplication();
if (application.isUnitTestMode()) {
myUpdateStatusRunnable.run();
} else {
updateStatusAlarm.cancelAllRequests();
updateStatusAlarm.addRequest(myUpdateStatusRunnable, 100);
}
}
Aggregations