本文整理汇总了Java中com.intellij.openapi.application.ex.ApplicationManagerEx类的典型用法代码示例。如果您正苦于以下问题:Java ApplicationManagerEx类的具体用法?Java ApplicationManagerEx怎么用?Java ApplicationManagerEx使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ApplicationManagerEx类属于com.intellij.openapi.application.ex包,在下文中一共展示了ApplicationManagerEx类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTemporaryBuffer
import com.intellij.openapi.application.ex.ApplicationManagerEx; //导入依赖的package包/类
private String getTemporaryBuffer( IjFile file )
{
final VirtualFile virtualFile = file.getVirtualFile();
// we're getting the cached documents since getDocument() forces PSI creating which will cause deadlock !!!
if( virtualFile != null && !virtualFile.getFileType().isBinary() )
{
final Document document = FileDocumentManager.getInstance().getCachedDocument( virtualFile );
final String[] result = new String[1];
if( document != null )
{
if( ApplicationManagerEx.getApplicationEx().tryRunReadAction( () -> result[0] = document.getText() ) )
{
return result[0];
}
else
{
return document.getCharsSequence().toString();
}
}
}
return null;
}
示例2: startup
import com.intellij.openapi.application.ex.ApplicationManagerEx; //导入依赖的package包/类
public void startup() {
if (myProjectPath == null || myOutPath == null) {
GenerateAntMain.printHelp();
}
SwingUtilities.invokeLater(new Runnable() {
public void run() {
ApplicationEx application = ApplicationManagerEx.getApplicationEx();
try {
logMessage(0, "Starting app... ");
application.doNotSave();
application.load();
logMessageLn(0, "done");
GenerateAntApplication.this.run();
}
catch (Exception e) {
GenerateAntApplication.LOG.error(e);
}
finally {
application.exit(true, true);
}
}
});
}
示例3: wrapInReadActionAndIndicator
import com.intellij.openapi.application.ex.ApplicationManagerEx; //导入依赖的package包/类
private void wrapInReadActionAndIndicator(@NotNull final Runnable process) {
Runnable toRun = runInReadAction ? new Runnable() {
@Override
public void run() {
if (!ApplicationManagerEx.getApplicationEx().tryRunReadAction(process)) {
failedSubTasks = new ArrayList<ApplierCompleter<T>>();
failedSubTasks.add(ApplierCompleter.this);
doComplete(throwable);
}
}
} : process;
ProgressIndicator existing = ProgressManager.getInstance().getProgressIndicator();
if (existing == progressIndicator) {
toRun.run();
}
else {
ProgressManager.getInstance().executeProcessUnderProgress(toRun, progressIndicator);
}
}
示例4: setupCloseAction
import com.intellij.openapi.application.ex.ApplicationManagerEx; //导入依赖的package包/类
static void setupCloseAction(final JFrame frame) {
frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
frame.addWindowListener(
new WindowAdapter() {
public void windowClosing(final WindowEvent e) {
frame.dispose();
final Application app = ApplicationManager.getApplication();
app.invokeLater(new DumbAwareRunnable() {
public void run() {
if (app.isDisposed()) {
ApplicationManagerEx.getApplicationEx().exit();
return;
}
final Project[] openProjects = ProjectManager.getInstance().getOpenProjects();
if (openProjects.length == 0) {
ApplicationManagerEx.getApplicationEx().exit();
}
}
}, ModalityState.NON_MODAL);
}
}
);
}
示例5: actionPerformed
import com.intellij.openapi.application.ex.ApplicationManagerEx; //导入依赖的package包/类
public void actionPerformed(@NotNull AnActionEvent e) {
Project project = CommonDataKeys.PROJECT.getData(e.getDataContext());
if (project == null) {
project = ProjectManager.getInstance().getDefaultProject();
}
final long startTime = System.nanoTime();
SwingUtilities.invokeLater(new Runnable() {
public void run() {
final long endTime = System.nanoTime();
if (ApplicationManagerEx.getApplicationEx().isInternal()) {
System.out.println("Displaying settings dialog took " + ((endTime - startTime) / 1000000) + " ms");
}
}
});
ShowSettingsUtil.getInstance().showSettingsDialog(project, ShowSettingsUtilImpl.getConfigurableGroups(project, true));
}
示例6: apply
import com.intellij.openapi.application.ex.ApplicationManagerEx; //导入依赖的package包/类
@Override
public void apply() throws ConfigurationException {
final String applyMessage = myPluginManagerMain.apply();
if (applyMessage != null) {
throw new ConfigurationException(applyMessage);
}
if (myPluginManagerMain.isRequireShutdown()) {
if (showRestartDialog() == Messages.YES) {
ApplicationManagerEx.getApplicationEx().restart(true);
}
else {
myPluginManagerMain.ignoreChanges();
}
}
}
示例7: canHandle
import com.intellij.openapi.application.ex.ApplicationManagerEx; //导入依赖的package包/类
public boolean canHandle(IdeaLoggingEvent event) {
if (ourLoggerBroken) return false;
try {
UpdateChecker.checkForUpdate(event);
boolean notificationEnabled = !DISABLED_VALUE.equals(System.getProperty(FATAL_ERROR_NOTIFICATION_PROPERTY, ENABLED_VALUE));
ErrorReportSubmitter submitter = IdeErrorsDialog.getSubmitter(event.getThrowable());
boolean showPluginError = !(submitter instanceof ITNReporter) || ((ITNReporter)submitter).showErrorInRelease(event);
//noinspection ThrowableResultOfMethodCallIgnored
return notificationEnabled ||
showPluginError ||
ApplicationManagerEx.getApplicationEx().isInternal() ||
isOOMError(event.getThrowable()) ||
event.getThrowable() instanceof MappingFailedException;
}
catch (LinkageError e) {
if (e.getMessage().contains("Could not initialize class com.intellij.diagnostic.IdeErrorsDialog")) {
//noinspection AssignmentToStaticFieldFromInstanceMethod
ourLoggerBroken = true;
}
throw e;
}
}
示例8: IdeErrorsDialog
import com.intellij.openapi.application.ex.ApplicationManagerEx; //导入依赖的package包/类
public IdeErrorsDialog(MessagePool messagePool, @Nullable LogMessage defaultMessage) {
super(JOptionPane.getRootFrame(), false);
myMessagePool = messagePool;
ApplicationEx app = ApplicationManagerEx.getApplicationEx();
myInternalMode = app != null && app.isInternal();
setTitle(DiagnosticBundle.message("error.list.title"));
init();
rebuildHeaders();
if (defaultMessage == null || !moveSelectionToMessage(defaultMessage)) {
moveSelectionToEarliestMessage();
}
setCancelButtonText(CommonBundle.message("close.action.name"));
setModal(false);
if (myInternalMode) {
if (ourDevelopersList.isEmpty()) {
loadDevelopersAsynchronously();
} else {
myDetailsTabForm.setDevelopers(ourDevelopersList);
}
}
}
示例9: releaseFoldings
import com.intellij.openapi.application.ex.ApplicationManagerEx; //导入依赖的package包/类
@Override
public void releaseFoldings(@NotNull Editor editor) {
ApplicationManagerEx.getApplicationEx().assertIsDispatchThread();
final Project project = editor.getProject();
if (project != null && (!project.equals(myProject) || !project.isOpen())) return;
Document document = editor.getDocument();
PsiFile file = PsiDocumentManager.getInstance(myProject).getPsiFile(document);
if (file == null || !file.getViewProvider().isPhysical() || !file.isValid()) return;
PsiDocumentManager.getInstance(myProject).commitDocument(document);
Editor[] otherEditors = EditorFactory.getInstance().getEditors(document, myProject);
if (otherEditors.length == 0 && !editor.isDisposed()) {
getDocumentFoldingInfo(document).loadFromEditor(editor);
}
EditorFoldingInfo.get(editor).dispose();
}
示例10: invokeDslErrorPopup
import com.intellij.openapi.application.ex.ApplicationManagerEx; //导入依赖的package包/类
@Override
public void invokeDslErrorPopup(Throwable e, final Project project, @NotNull VirtualFile vfile) {
if (!GroovyDslFileIndex.isActivated(vfile)) {
return;
}
final String exceptionText = ExceptionUtil.getThrowableText(e);
LOG.info(exceptionText);
GroovyDslFileIndex.disableFile(vfile, DslActivationStatus.Status.ERROR, exceptionText);
if (!ApplicationManagerEx.getApplicationEx().isInternal() && !ProjectRootManager.getInstance(project).getFileIndex().isInContent(vfile)) {
return;
}
String content = "<p>" + e.getMessage() + "</p><p><a href=\"\">Click here to investigate.</a></p>";
NOTIFICATION_GROUP.createNotification("DSL script execution error", content, NotificationType.ERROR,
new NotificationListener() {
@Override
public void hyperlinkUpdate(@NotNull Notification notification,
@NotNull HyperlinkEvent event) {
InvestigateFix.analyzeStackTrace(project, exceptionText);
notification.expire();
}
}).notify(project);
}
示例11: startup
import com.intellij.openapi.application.ex.ApplicationManagerEx; //导入依赖的package包/类
public void startup() {
if (myProjectPath == null || myOutPath == null) {
GenerateAntMain.printHelp();
}
SwingUtilities.invokeLater(new Runnable() {
public void run() {
ApplicationEx application = ApplicationManagerEx.getApplicationEx();
try {
logMessage(0, "Starting app... ");
application.doNotSave();
application.load(PathManager.getOptionsPath());
logMessageLn(0, "done");
GenerateAntApplication.this.run();
}
catch (Exception e) {
GenerateAntApplication.LOG.error(e);
}
finally {
application.exit(true);
}
}
});
}
示例12: setupCloseAction
import com.intellij.openapi.application.ex.ApplicationManagerEx; //导入依赖的package包/类
private void setupCloseAction() {
setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
addWindowListener(
new WindowAdapter() {
public void windowClosing(final WindowEvent e) {
dispose();
final Application app = ApplicationManager.getApplication();
app.invokeLater(new DumbAwareRunnable() {
public void run() {
if (app.isDisposed()) {
ApplicationManagerEx.getApplicationEx().exit();
return;
}
final Project[] openProjects = ProjectManager.getInstance().getOpenProjects();
if (openProjects.length == 0) {
ApplicationManagerEx.getApplicationEx().exit();
}
}
}, ModalityState.NON_MODAL);
}
}
);
}
示例13: saveProjectsAndDocuments
import com.intellij.openapi.application.ex.ApplicationManagerEx; //导入依赖的package包/类
public void saveProjectsAndDocuments() {
if (LOG.isDebugEnabled()) {
LOG.debug("enter: save()");
}
if (ApplicationManager.getApplication().isDisposed()) return;
if (myBlockSaveOnFrameDeactivationCount.get() == 0 && GeneralSettings.getInstance().isSaveOnFrameDeactivation()) {
FileDocumentManager.getInstance().saveAllDocuments();
Project[] openProjects = ProjectManagerEx.getInstanceEx().getOpenProjects();
for (Project project : openProjects) {
if (LOG.isDebugEnabled()) {
LOG.debug("save project: " + project);
}
project.save();
}
if (LOG.isDebugEnabled()) {
LOG.debug("save application settings");
}
ApplicationManagerEx.getApplicationEx().saveSettings();
if (LOG.isDebugEnabled()) {
LOG.debug("exit: save()");
}
}
}
示例14: actionPerformed
import com.intellij.openapi.application.ex.ApplicationManagerEx; //导入依赖的package包/类
public void actionPerformed(AnActionEvent e) {
Project project = PlatformDataKeys.PROJECT.getData(e.getDataContext());
if (project == null) {
project = ProjectManager.getInstance().getDefaultProject();
}
final long startTime = System.nanoTime();
SwingUtilities.invokeLater(new Runnable() {
public void run() {
final long endTime = System.nanoTime();
if (ApplicationManagerEx.getApplicationEx().isInternal()) {
System.out.println("Displaying settings dialog took " + ((endTime - startTime) / 1000000) + " ms");
}
}
});
ShowSettingsUtil.getInstance().showSettingsDialog(project, new ProjectConfigurablesGroup(project),
new IdeConfigurablesGroup());
}
示例15: apply
import com.intellij.openapi.application.ex.ApplicationManagerEx; //导入依赖的package包/类
public void apply() throws ConfigurationException {
final String applyMessage = myPluginManagerMain.apply();
if (applyMessage != null) {
throw new ConfigurationException(applyMessage);
}
if (myPluginManagerMain.isRequireShutdown()) {
final ApplicationEx app = ApplicationManagerEx.getApplicationEx();
int response = app.isRestartCapable() ? showRestartIDEADialog() : showShutDownIDEADialog();
if (response == 0) {
app.restart(true);
}
else {
myPluginManagerMain.ignoreChanges();
}
}
}