use of com.intellij.openapi.application.ex.ApplicationEx in project android by JetBrains.
the class IdeTestApplication method disposeInstance.
public static synchronized void disposeInstance() {
if (!isLoaded()) {
return;
}
Application application = ApplicationManager.getApplication();
if (application != null) {
if (application instanceof ApplicationEx) {
((ApplicationEx) application).exit(true, true);
} else {
application.exit();
}
}
ourInstance = null;
}
use of com.intellij.openapi.application.ex.ApplicationEx in project intellij-community by JetBrains.
the class GenerateAntApplication method startup.
public void startup() {
if (myProjectPath == null || myOutPath == null) {
GenerateAntMain.printHelp();
}
SwingUtilities.invokeLater(() -> {
ApplicationEx application = ApplicationManagerEx.getApplicationEx();
try {
logMessage(0, "Starting app... ");
application.doNotSave();
application.load();
logMessageLn(0, "done");
this.run();
} catch (Exception e) {
GenerateAntApplication.LOG.error(e);
} finally {
application.exit(true, true);
}
});
}
use of com.intellij.openapi.application.ex.ApplicationEx in project intellij-community by JetBrains.
the class CoreProgressManager method runProcessWithProgressSynchronously.
public boolean runProcessWithProgressSynchronously(@NotNull final Task task, @Nullable final JComponent parentComponent) {
final Ref<Throwable> exceptionRef = new Ref<>();
TaskContainer taskContainer = new TaskContainer(task) {
@Override
public void run() {
try {
new TaskRunnable(task, getProgressIndicator()).run();
} catch (ProcessCanceledException e) {
throw e;
} catch (Throwable e) {
exceptionRef.set(e);
}
}
};
ApplicationEx application = (ApplicationEx) ApplicationManager.getApplication();
boolean result = application.runProcessWithProgressSynchronously(taskContainer, task.getTitle(), task.isCancellable(), task.getProject(), parentComponent, task.getCancelText());
finishTask(task, !result, exceptionRef.get());
return result;
}
use of com.intellij.openapi.application.ex.ApplicationEx in project intellij-community by JetBrains.
the class FormatterStarter method main.
@Override
public void main(String[] args) {
@SuppressWarnings("UseOfSystemOutOrSystemErr") MessageOutput messageOutput = new MessageOutput(new PrintWriter(System.out), new PrintWriter(System.err));
messageOutput.info(getAppInfo() + " Formatter\n");
FileSetFormatter fileSetFormatter = new FileSetFormatter(messageOutput);
logArgs(args);
if (args.length < 2) {
showUsageInfo(messageOutput);
}
for (int i = 1; i < args.length; i++) {
if (args[i].startsWith("-")) {
if (checkOption(args[i], "-h", "-help")) {
showUsageInfo(messageOutput);
}
if (checkOption(args[i], "-s", "-settings")) {
//noinspection AssignmentToForLoopParameter
i++;
if (i >= args.length) {
fatalError(messageOutput, "Missing settings file path.");
}
try {
CodeStyleSettings settings = readSettings(args[i]);
fileSetFormatter.setCodeStyleSettings(settings);
} catch (SchemeImportException e) {
fatalError(messageOutput, e.getLocalizedMessage() + "\n");
}
} else if (checkOption(args[i], "-r", "-R")) {
fileSetFormatter.setRecursive();
} else if (checkOption(args[i], "-m", "-mask")) {
//noinspection AssignmentToForLoopParameter
i++;
if (i >= args.length) {
fatalError(messageOutput, "Missing file mask(s).");
}
for (String mask : args[i].split(",")) {
if (!mask.isEmpty()) {
fileSetFormatter.addFileMask(mask);
}
}
} else {
fatalError(messageOutput, "Unknown option " + args[i]);
}
} else {
try {
fileSetFormatter.addEntry(args[i]);
} catch (IOException e) {
fatalError(messageOutput, e.getLocalizedMessage());
}
}
}
try {
fileSetFormatter.processFiles();
messageOutput.info("\n" + fileSetFormatter.getProcessedFiles() + " file(s) formatted.\n");
} catch (IOException e) {
fatalError(messageOutput, e.getLocalizedMessage());
}
((ApplicationEx) ApplicationManager.getApplication()).exit(true, true);
}
use of com.intellij.openapi.application.ex.ApplicationEx in project intellij-community by JetBrains.
the class DaemonRespondToChangesTest method testDaemonIgnoresFrameDeactivation.
public void testDaemonIgnoresFrameDeactivation() throws Throwable {
// return default value to avoid unnecessary save
DaemonCodeAnalyzerSettings.getInstance().setImportHintEnabled(true);
String text = "class S { ArrayList<caret>XXX x;}";
configureByText(StdFileTypes.JAVA, text);
highlightErrors();
GeneralSettings settings = GeneralSettings.getInstance();
ApplicationEx application = ApplicationManagerEx.getApplicationEx();
boolean frameSave = settings.isSaveOnFrameDeactivation();
boolean appSave = application.isDoNotSave();
settings.setSaveOnFrameDeactivation(true);
application.doNotSave(false);
try {
SaveAndSyncHandlerImpl.doSaveDocumentsAndProjectsAndApp();
checkDaemonReaction(false, SaveAndSyncHandlerImpl::doSaveDocumentsAndProjectsAndApp);
} finally {
application.doNotSave(appSave);
settings.setSaveOnFrameDeactivation(frameSave);
}
}
Aggregations