org.eclipse.core.runtime.Platform.isRunning()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(10.1k)|赞(0)|评价(0)|浏览(111)

本文整理了Java中org.eclipse.core.runtime.Platform.isRunning()方法的一些代码示例,展示了Platform.isRunning()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Platform.isRunning()方法的具体详情如下:
包路径:org.eclipse.core.runtime.Platform
类名称:Platform
方法名:isRunning

Platform.isRunning介绍

[英]Returns whether the platform is running.
[中]返回平台是否正在运行。

代码示例

代码示例来源:origin: org.eclipse.tycho/org.eclipse.jdt.core

private ExternalFoldersManager() {
  // Prevent instantiation
  // https://bugs.eclipse.org/bugs/show_bug.cgi?id=377806
  if (Platform.isRunning()) {
    getFolders();
  }
}

代码示例来源:origin: com.google.code.maven-play-plugin.org.eclipse.jdt/org.eclipse.jdt.core

private ExternalFoldersManager() {
  // Prevent instantiation
  // https://bugs.eclipse.org/bugs/show_bug.cgi?id=377806
  if (Platform.isRunning()) {
    getFolders();
  }
}

代码示例来源:origin: liferay/liferay-ide

public static boolean canCreateExecutableExtension(IConfigurationElement element) {
  if (Platform.isRunning() && (getSystemBundle().getState() != Bundle.STOPPING)) {
    return true;
  }
  return false;
}

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.core

private ExternalFoldersManager() {
  // Prevent instantiation
  // https://bugs.eclipse.org/bugs/show_bug.cgi?id=377806
  if (Platform.isRunning()) {
    getFolders();
  }
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.core

private ExternalFoldersManager() {
  // Prevent instantiation
  // https://bugs.eclipse.org/bugs/show_bug.cgi?id=377806
  if (Platform.isRunning()) {
    getFolders();
  }
}

代码示例来源:origin: org.eclipse/org.eclipse.jem.util

/**
 * Tests to see if it is valid at this point in time to create an executable extension. A valid reason not to would be that the workspace is
 * shutting donw.
 * 
 * @param element
 * @return <code>true</code> if it is valid point to create an executable extension.
 * 
 * @since 1.0.0
 */
public static boolean canCreateExecutableExtension(IConfigurationElement element) {
  if (Platform.isRunning() && getSystemBundle().getState() != Bundle.STOPPING)
    return true;
  return false;
}

代码示例来源:origin: trylimits/Eclipse-Postfix-Code-Completion

private ExternalFoldersManager() {
  // Prevent instantiation
  // https://bugs.eclipse.org/bugs/show_bug.cgi?id=377806
  if (Platform.isRunning()) {
    getFolders();
  }
}

代码示例来源:origin: org.eclipse/org.eclipse.jst.jsp.core

/**
 * A check to see if the OSGI framework is shutting down.
 * 
 * @return true if the System Bundle is stopped (ie. the framework is
 *         shutting down)
 */
boolean frameworkIsShuttingDown() {
  // in the Framework class there's a note:
  // set the state of the System Bundle to STOPPING.
  // this must be done first according to section 4.19.2 from the OSGi
  // R3 spec.
  boolean shuttingDown = !Platform.isRunning() || Platform.getBundle(OSGI_FRAMEWORK_ID).getState() == Bundle.STOPPING;
  return shuttingDown;
}

代码示例来源:origin: org.eclipse.mylyn.tasks.index/core

/**
 * call to wait until index maintenance has completed
 * 
 * @throws InterruptedException
 */
public void waitUntilIdle() throws InterruptedException {
  if (!Platform.isRunning() && reindexDelay != 0L) {
    // job join() behaviour is not the same when platform is not running
    Logger.getLogger(TaskListIndex.class.getName()).warning(
        "Index job joining may not work properly when Eclipse platform is not running"); //$NON-NLS-1$
  }
  maintainIndexJob.join();
}

代码示例来源:origin: com.reprezen.genflow/swagger-nswag

public static boolean isPlatformSupported() {
  if (Platform.isRunning()) {
    switch (Platform.getOS()) {
    case Platform.OS_WIN32:
      return true;
    default:
      return false;
    }
  } else {
    // this will happen during actual gentarget execution.
    // If we're on an unsupported platform the execution will fail some other way,
    // but since we don't know,
    // we'll give it a shot.
    return true;
  }
}

代码示例来源:origin: org.eclipse.viatra/org.eclipse.viatra.query.runtime

private Map<String, QueryGroupProvider> getRegisteredQueryGroups() {
  if(contributedQueryGroups != null) {
    return contributedQueryGroups;
  }
  contributedQueryGroups = new HashMap<>();
  if (Platform.isRunning()) {
    for (IConfigurationElement e : Platform.getExtensionRegistry().getConfigurationElementsFor(IExtensions.QUERY_SPECIFICATION_EXTENSION_POINT_ID)) {
      if (e.isValid()) {
        processExtension(e);
      }
    }
  }
  return contributedQueryGroups;
}

代码示例来源:origin: org.eclipse.viatra/org.eclipse.viatra.query.runtime

private Map<EStructuralFeature, PQueryProvider> getSurrogateQueryProviders() {
  if(contributedSurrogateQueries != null) {
    return contributedSurrogateQueries;
  }
  contributedSurrogateQueries = new HashMap<>();
  if (Platform.isRunning()) {
    for (IConfigurationElement e : Platform.getExtensionRegistry().getConfigurationElementsFor(ViatraQueryRuntimeConstants.SURROGATE_QUERY_EXTENSIONID)) {
      if (e.isValid()) {
        processExtension(e);
      }
    }
  }
  return contributedSurrogateQueries;
}

代码示例来源:origin: org.eclipse.mylyn.hudson/core

protected static File getCacheFile() {
  if (Platform.isRunning()) {
    Bundle bundle = Platform.getBundle(HudsonCorePlugin.ID_PLUGIN);
    if (bundle != null) {
      IPath stateLocation = Platform.getStateLocation(bundle);
      IPath cacheFile = stateLocation.append("configuration.obj"); //$NON-NLS-1$
      return cacheFile.toFile();
    }
  }
  return null;
}

代码示例来源:origin: org.jibx.config.3rdparty.org.eclipse/org.eclipse.jdt.core

/**
 * Constructs a new JavaModelManager
 */
private JavaModelManager() {
  // singleton: prevent others from creating a new instance
  /*
   * It is required to initialize all fields that depends on a headless environment
   * only if the platform is running. Otherwise this breaks the ability to use
   * ASTParser in a non-headless environment.
   */
  if (Platform.isRunning()) {
    this.indexManager = new IndexManager();
    this.nonChainingJars = loadClasspathListCache(NON_CHAINING_JARS_CACHE);
    this.invalidArchives = loadClasspathListCache(INVALID_ARCHIVES_CACHE);
    String includeContainerReferencedLib = System.getProperty(RESOLVE_REFERENCED_LIBRARIES_FOR_CONTAINERS);
    this.resolveReferencedLibrariesForContainers = TRUE.equalsIgnoreCase(includeContainerReferencedLib);
  }
}

代码示例来源:origin: org.eclipse/org.eclipse.jst.jsp.core

/**
 * Instructs the index to begin listening for resource and classpath
 * changes.
 */
public static void startup() {
  boolean shuttingDown = !Platform.isRunning() || Platform.getBundle(OSGI_FRAMEWORK_ID).getState() == Bundle.STOPPING;
  if (!shuttingDown) {
    try {
      LOCK.acquire();
      ENABLED = !"false".equalsIgnoreCase(System.getProperty(TaglibIndex.class.getName())); //$NON-NLS-1$
      getInstance().initializeInstance();
    }
    finally {
      LOCK.release();
    }
  }
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.core

/**
 * Constructs a new JavaModelManager
 */
private JavaModelManager() {
  // singleton: prevent others from creating a new instance
  /*
   * It is required to initialize all fields that depends on a headless environment
   * only if the platform is running. Otherwise this breaks the ability to use
   * ASTParser in a non-headless environment.
   */
  if (Platform.isRunning()) {
    this.indexManager = new IndexManager();
    this.nonChainingJars = loadClasspathListCache(NON_CHAINING_JARS_CACHE);
    this.externalFiles = loadClasspathListCache(EXTERNAL_FILES_CACHE);
    this.assumedExternalFiles = loadClasspathListCache(ASSUMED_EXTERNAL_FILES_CACHE);
    String includeContainerReferencedLib = System.getProperty(RESOLVE_REFERENCED_LIBRARIES_FOR_CONTAINERS);
    this.resolveReferencedLibrariesForContainers = TRUE.equalsIgnoreCase(includeContainerReferencedLib);
  }
}

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.core

/**
 * Constructs a new JavaModelManager
 */
private JavaModelManager() {
  // singleton: prevent others from creating a new instance
  /*
   * It is required to initialize all fields that depends on a headless environment
   * only if the platform is running. Otherwise this breaks the ability to use
   * ASTParser in a non-headless environment.
   */
  if (Platform.isRunning()) {
    this.indexManager = new IndexManager();
    this.nonChainingJars = loadClasspathListCache(NON_CHAINING_JARS_CACHE);
    this.externalFiles = loadClasspathListCache(EXTERNAL_FILES_CACHE);
    this.assumedExternalFiles = loadClasspathListCache(ASSUMED_EXTERNAL_FILES_CACHE);
    String includeContainerReferencedLib = System.getProperty(RESOLVE_REFERENCED_LIBRARIES_FOR_CONTAINERS);
    this.resolveReferencedLibrariesForContainers = TRUE.equalsIgnoreCase(includeContainerReferencedLib);
  }
}

代码示例来源:origin: org.eclipse.tycho/org.eclipse.jdt.core

/**
 * Constructs a new JavaModelManager
 */
private JavaModelManager() {
  // singleton: prevent others from creating a new instance
  /*
   * It is required to initialize all fields that depends on a headless environment
   * only if the platform is running. Otherwise this breaks the ability to use
   * ASTParser in a non-headless environment.
   */
  if (Platform.isRunning()) {
    this.indexManager = new IndexManager();
    this.nonChainingJars = loadClasspathListCache(NON_CHAINING_JARS_CACHE);
    this.externalFiles = loadClasspathListCache(EXTERNAL_FILES_CACHE);
    this.assumedExternalFiles = loadClasspathListCache(ASSUMED_EXTERNAL_FILES_CACHE);
    String includeContainerReferencedLib = System.getProperty(RESOLVE_REFERENCED_LIBRARIES_FOR_CONTAINERS);
    this.resolveReferencedLibrariesForContainers = TRUE.equalsIgnoreCase(includeContainerReferencedLib);
  }
}

代码示例来源:origin: trylimits/Eclipse-Postfix-Code-Completion

/**
 * Constructs a new JavaModelManager
 */
private JavaModelManager() {
  // singleton: prevent others from creating a new instance
  /*
   * It is required to initialize all fields that depends on a headless environment
   * only if the platform is running. Otherwise this breaks the ability to use
   * ASTParser in a non-headless environment.
   */
  if (Platform.isRunning()) {
    this.indexManager = new IndexManager();
    this.nonChainingJars = loadClasspathListCache(NON_CHAINING_JARS_CACHE);
    this.invalidArchives = loadClasspathListCache(INVALID_ARCHIVES_CACHE);
    this.externalFiles = loadClasspathListCache(EXTERNAL_FILES_CACHE);
    this.assumedExternalFiles = loadClasspathListCache(ASSUMED_EXTERNAL_FILES_CACHE);
    String includeContainerReferencedLib = System.getProperty(RESOLVE_REFERENCED_LIBRARIES_FOR_CONTAINERS);
    this.resolveReferencedLibrariesForContainers = TRUE.equalsIgnoreCase(includeContainerReferencedLib);
  }
}

代码示例来源:origin: com.google.code.maven-play-plugin.org.eclipse.jdt/org.eclipse.jdt.core

/**
 * Constructs a new JavaModelManager
 */
private JavaModelManager() {
  // singleton: prevent others from creating a new instance
  /*
   * It is required to initialize all fields that depends on a headless environment
   * only if the platform is running. Otherwise this breaks the ability to use
   * ASTParser in a non-headless environment.
   */
  if (Platform.isRunning()) {
    this.indexManager = new IndexManager();
    this.nonChainingJars = loadClasspathListCache(NON_CHAINING_JARS_CACHE);
    this.invalidArchives = loadClasspathListCache(INVALID_ARCHIVES_CACHE);
    this.externalFiles = loadClasspathListCache(EXTERNAL_FILES_CACHE);
    this.assumedExternalFiles = loadClasspathListCache(ASSUMED_EXTERNAL_FILES_CACHE);
    String includeContainerReferencedLib = System.getProperty(RESOLVE_REFERENCED_LIBRARIES_FOR_CONTAINERS);
    this.resolveReferencedLibrariesForContainers = TRUE.equalsIgnoreCase(includeContainerReferencedLib);
  }
}

相关文章