當前位置: 首頁>>代碼示例>>Java>>正文


Java Application.isDisposed方法代碼示例

本文整理匯總了Java中com.intellij.openapi.application.Application.isDisposed方法的典型用法代碼示例。如果您正苦於以下問題:Java Application.isDisposed方法的具體用法?Java Application.isDisposed怎麽用?Java Application.isDisposed使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.intellij.openapi.application.Application的用法示例。


在下文中一共展示了Application.isDisposed方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: LocalFileSystemImpl

import com.intellij.openapi.application.Application; //導入方法依賴的package包/類
public LocalFileSystemImpl(@NotNull ManagingFS managingFS) {
  myManagingFS = managingFS;
  myWatcher = new FileWatcher(myManagingFS);
  if (myWatcher.isOperational()) {
    final int PERIOD = 1000;
    Runnable runnable = new Runnable() {
      public void run() {
        final Application application = ApplicationManager.getApplication();
        if (application == null || application.isDisposed()) return;
        storeRefreshStatusToFiles();
        JobScheduler.getScheduler().schedule(this, PERIOD, TimeUnit.MILLISECONDS);
      }
    };
    JobScheduler.getScheduler().schedule(runnable, PERIOD, TimeUnit.MILLISECONDS);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:17,代碼來源:LocalFileSystemImpl.java

示例2: notifyPropertyChanged

import com.intellij.openapi.application.Application; //導入方法依賴的package包/類
@Override
public void notifyPropertyChanged(@NotNull final VirtualFile virtualFile, @NotNull final String property, final Object oldValue, final Object newValue) {
  final Application application = ApplicationManager.getApplication();
  final Runnable runnable = new Runnable() {
    @Override
    public void run() {
      if (virtualFile.isValid() && !application.isDisposed()) {
        application.runWriteAction(new Runnable() {
          @Override
          public void run() {
            List<VFilePropertyChangeEvent> events = Collections
              .singletonList(new VFilePropertyChangeEvent(this, virtualFile, property, oldValue, newValue, false));
            BulkFileListener listener = application.getMessageBus().syncPublisher(VirtualFileManager.VFS_CHANGES);
            listener.before(events);
            listener.after(events);
          }
        });
      }
    }
  };
  application.invokeLater(runnable, ModalityState.NON_MODAL);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:23,代碼來源:VirtualFileManagerImpl.java

示例3: getPasswordAuthentication

import com.intellij.openapi.application.Application; //導入方法依賴的package包/類
@Override
public PasswordAuthentication getPasswordAuthentication() {
  final String host = CommonProxy.getHostNameReliably(getRequestingHost(), getRequestingSite(), getRequestingURL());
  final boolean isProxy = Authenticator.RequestorType.PROXY.equals(getRequestorType());
  final String prefix = isProxy ? "Proxy authentication: " : "Server authentication: ";
  Application application = ApplicationManager.getApplication();
  if (isProxy) {
    // according to idea-wide settings
    if (myHttpConfigurable.USE_HTTP_PROXY) {
      LOG.debug("CommonAuthenticator.getPasswordAuthentication will return common defined proxy");
      return myHttpConfigurable.getPromptedAuthentication(host + ":" + getRequestingPort(), getRequestingPrompt());
    }
    else if (myHttpConfigurable.USE_PROXY_PAC) {
      LOG.debug("CommonAuthenticator.getPasswordAuthentication will return autodetected proxy");
      if (myHttpConfigurable.isGenericPasswordCanceled(host, getRequestingPort())) return null;
      // same but without remembering the results..
      final PasswordAuthentication password = myHttpConfigurable.getGenericPassword(host, getRequestingPort());
      if (password != null) {
        return password;
      }
      // do not try to show any dialogs if application is exiting
      if (application == null || application.isDisposeInProgress() ||
          application.isDisposed()) {
        return null;
      }

      return myHttpConfigurable.getGenericPromptedAuthentication(prefix, host, getRequestingPrompt(), getRequestingPort(), true);
    }
  }

  // do not try to show any dialogs if application is exiting
  if (application == null || application.isDisposeInProgress() || application.isDisposed()) {
    return null;
  }

  LOG.debug("CommonAuthenticator.getPasswordAuthentication generic authentication will be asked");
  //return myHttpConfigurable.getGenericPromptedAuthentication(prefix, host, getRequestingPrompt(), getRequestingPort(), false);
  return null;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:40,代碼來源:IdeaWideAuthenticator.java

示例4: productNameAsUserAgent

import com.intellij.openapi.application.Application; //導入方法依賴的package包/類
@NotNull
public RequestBuilder productNameAsUserAgent() {
  Application app = ApplicationManager.getApplication();
  if (app != null && !app.isDisposed()) {
    return userAgent(ApplicationInfo.getInstance().getVersionName());
  }
  else {
    return userAgent("IntelliJ");
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:11,代碼來源:RequestBuilder.java

示例5: doNotify

import com.intellij.openapi.application.Application; //導入方法依賴的package包/類
private static void doNotify(Notification notification, @Nullable Project project) {
  if (project != null && !project.isDisposed() && !project.isDefault()) {
    project.getMessageBus().syncPublisher(TOPIC).notify(notification);
  }
  else {
    Application app = ApplicationManager.getApplication();
    if (!app.isDisposed()) {
      app.getMessageBus().syncPublisher(TOPIC).notify(notification);
    }
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:12,代碼來源:Notifications.java

示例6: getServerHeaderValue

import com.intellij.openapi.application.Application; //導入方法依賴的package包/類
@Nullable
public static String getServerHeaderValue() {
  if (SERVER_HEADER_VALUE == null) {
    Application app = ApplicationManager.getApplication();
    if (app != null && !app.isDisposed()) {
      SERVER_HEADER_VALUE = ApplicationInfoEx.getInstanceEx().getFullApplicationName();
    }
  }
  return SERVER_HEADER_VALUE;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:11,代碼來源:Responses.java

示例7: append

import com.intellij.openapi.application.Application; //導入方法依賴的package包/類
@Override
protected synchronized void append(@NotNull final LoggingEvent event) {
  if (!event.getLevel().isGreaterOrEqual(Level.ERROR) ||
      Main.isCommandLine() ||
      !IdeaApplication.isLoaded()) {
    return;
  }

  Runnable action = new Runnable() {
    @Override
    public void run() {
      try {
        List<ErrorLogger> loggers = new ArrayList<ErrorLogger>();
        loggers.add(DEFAULT_LOGGER);

        Application application = ApplicationManager.getApplication();
        if (application != null) {
          if (application.isHeadlessEnvironment() || application.isDisposed()) return;
          ContainerUtil.addAll(loggers, ServiceKt.getComponents(application, ErrorLogger.class));
        }

        appendToLoggers(event, loggers.toArray(new ErrorLogger[loggers.size()]));
      }
      finally {
        myPendingAppendCounts.decrementAndGet();
      }
    }
  };

  if (myPendingAppendCounts.addAndGet(1) > MAX_ASYNC_LOGGING_EVENTS) {
    // Stop adding requests to the queue or we can get OOME on pending logging requests (IDEA-95327)
    myPendingAppendCounts.decrementAndGet(); // number of pending logging events should not increase
  }
  else {
    // Note, we MUST avoid SYNCHRONOUS invokeAndWait to prevent deadlocks
    //noinspection SSBasedInspection
    SwingUtilities.invokeLater(action);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:40,代碼來源:DialogAppender.java


注:本文中的com.intellij.openapi.application.Application.isDisposed方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。