本文整理汇总了Java中com.intellij.ide.StartupProgress类的典型用法代码示例。如果您正苦于以下问题:Java StartupProgress类的具体用法?Java StartupProgress怎么用?Java StartupProgress使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
StartupProgress类属于com.intellij.ide包,在下文中一共展示了StartupProgress类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadDescriptors
import com.intellij.ide.StartupProgress; //导入依赖的package包/类
public static void loadDescriptors(@NotNull File pluginsHome,
@NotNull List<IdeaPluginDescriptorImpl> result,
@Nullable StartupProgress progress,
int pluginsCount) {
final File[] files = pluginsHome.listFiles();
if (files != null) {
int i = result.size();
for (File file : files) {
final IdeaPluginDescriptorImpl descriptor = loadDescriptor(file, PLUGIN_XML);
if (descriptor == null) continue;
if (progress != null) {
progress.showProgress(descriptor.getName(), PLUGINS_PROGRESS_MAX_VALUE * ((float)++i / pluginsCount));
}
int oldIndex = result.indexOf(descriptor);
if (oldIndex >= 0) {
final IdeaPluginDescriptorImpl oldDescriptor = result.get(oldIndex);
if (StringUtil.compareVersionNumbers(oldDescriptor.getVersion(), descriptor.getVersion()) < 0) {
result.set(oldIndex, descriptor);
}
}
else {
result.add(descriptor);
}
}
}
}
示例2: loadDescriptorsFromClassPath
import com.intellij.ide.StartupProgress; //导入依赖的package包/类
public static void loadDescriptorsFromClassPath(@NotNull List<IdeaPluginDescriptorImpl> result,
@NotNull Collection<URL> urls,
@Nullable StartupProgress progress) {
String platformPrefix = System.getProperty(PlatformUtils.PLATFORM_PREFIX_KEY);
int i = 0;
for (URL url : urls) {
i++;
if ("file".equals(url.getProtocol())) {
File file = new File(decodeUrl(url.getFile()));
final IdeaPluginDescriptorImpl pluginDescriptor = loadDescriptorFromClassPath(file, result, platformPrefix);
if (pluginDescriptor != null) {
if (progress != null && !pluginDescriptor.getName().equals(SPECIAL_IDEA_PLUGIN)) {
progress.showProgress("Plugin loaded: " + pluginDescriptor.getName(), PLUGINS_PROGRESS_MAX_VALUE * (float)i / urls.size());
}
}
}
}
}
示例3: main
import com.intellij.ide.StartupProgress; //导入依赖的package包/类
@Override
public void main(boolean newConfigFolder, @Nonnull CommandLineArgs args) {
StartupProgress startupProgress = mySplashRef.get();
if (startupProgress != null) {
startupProgress.dispose();
mySplashRef.set(null);
}
AppExecutorUtil.getAppScheduledExecutorService().scheduleWithFixedDelay(() -> {
System.out.println("Save All");
Application application = ApplicationManager.getApplication();
if(application == null || application.isDisposed()) {
return;
}
SwingUtilities.invokeLater(() -> application.saveSettings());
}, 1, 5, TimeUnit.MINUTES);
}
示例4: loadDescriptors
import com.intellij.ide.StartupProgress; //导入依赖的package包/类
public static void loadDescriptors(@Nonnull File pluginsHome, List<IdeaPluginDescriptorImpl> result, @Nullable StartupProgress progress, int pluginsCount) {
final File[] files = pluginsHome.listFiles();
if (files != null) {
int i = result.size();
for (File file : files) {
final IdeaPluginDescriptorImpl descriptor = loadDescriptor(file, PLUGIN_XML);
if (descriptor == null) continue;
if (progress != null) {
progress.showProgress(descriptor.getName(), PLUGINS_PROGRESS_MAX_VALUE * ((float)++i / pluginsCount));
}
int oldIndex = result.indexOf(descriptor);
if (oldIndex >= 0) {
final IdeaPluginDescriptorImpl oldDescriptor = result.get(oldIndex);
if (StringUtil.compareVersionNumbers(oldDescriptor.getVersion(), descriptor.getVersion()) < 0) {
result.set(oldIndex, descriptor);
}
}
else {
result.add(descriptor);
}
}
}
}
示例5: getPlugins
import com.intellij.ide.StartupProgress; //导入依赖的package包/类
@NotNull
public static synchronized IdeaPluginDescriptor[] getPlugins(StartupProgress progress) {
if (ourPlugins == null) {
initPlugins(progress);
}
return ourPlugins;
}
示例6: initPlugins
import com.intellij.ide.StartupProgress; //导入依赖的package包/类
private static void initPlugins(@Nullable StartupProgress progress) {
long start = System.currentTimeMillis();
try {
initializePlugins(progress);
}
catch (RuntimeException e) {
getLogger().error(e);
throw e;
}
getLogger().info(ourPlugins.length + " plugins initialized in " + (System.currentTimeMillis() - start) + " ms");
logPlugins();
ClassUtilCore.clearJarURLCache();
}
示例7: loadDescriptors
import com.intellij.ide.StartupProgress; //导入依赖的package包/类
public static void loadDescriptors(String pluginsPath,
List<IdeaPluginDescriptorImpl> result,
@Nullable StartupProgress progress,
int pluginsCount) {
final File pluginsHome = new File(pluginsPath);
final File[] files = pluginsHome.listFiles();
if (files != null) {
int i = result.size();
for (File file : files) {
final IdeaPluginDescriptorImpl descriptor = loadDescriptor(file, PLUGIN_XML);
if (descriptor == null) continue;
if (progress != null) {
progress.showProgress(descriptor.getName(), PLUGINS_PROGRESS_MAX_VALUE * ((float)++i / pluginsCount));
}
int oldIndex = result.indexOf(descriptor);
if (oldIndex >= 0) {
final IdeaPluginDescriptorImpl oldDescriptor = result.get(oldIndex);
if (StringUtil.compareVersionNumbers(oldDescriptor.getVersion(), descriptor.getVersion()) < 0) {
result.set(oldIndex, descriptor);
}
}
else {
result.add(descriptor);
}
}
}
}
示例8: loadDescriptorsFromClassPath
import com.intellij.ide.StartupProgress; //导入依赖的package包/类
static void loadDescriptorsFromClassPath(@NotNull List<IdeaPluginDescriptorImpl> result, @Nullable StartupProgress progress) {
Collection<URL> urls = getClassLoaderUrls();
String platformPrefix = System.getProperty(PlatformUtilsCore.PLATFORM_PREFIX_KEY);
int i = 0;
for (URL url : urls) {
i++;
if ("file".equals(url.getProtocol())) {
File file = new File(decodeUrl(url.getFile()));
IdeaPluginDescriptorImpl platformPluginDescriptor = null;
if (platformPrefix != null) {
platformPluginDescriptor = loadDescriptor(file, platformPrefix + "Plugin.xml");
if (platformPluginDescriptor != null && !result.contains(platformPluginDescriptor)) {
platformPluginDescriptor.setUseCoreClassLoader(true);
result.add(platformPluginDescriptor);
}
}
IdeaPluginDescriptorImpl pluginDescriptor = loadDescriptor(file, PLUGIN_XML);
if (platformPrefix != null && pluginDescriptor != null && pluginDescriptor.getName().equals(SPECIAL_IDEA_PLUGIN)) {
continue;
}
if (pluginDescriptor != null && !result.contains(pluginDescriptor)) {
if (platformPluginDescriptor != null) {
// if we found a regular plugin.xml in the same .jar/root as a platform-prefixed descriptor, use the core loader for it too
pluginDescriptor.setUseCoreClassLoader(true);
}
result.add(pluginDescriptor);
if (progress != null) {
progress.showProgress("Plugin loaded: " + pluginDescriptor.getName(), PLUGINS_PROGRESS_MAX_VALUE * ((float)i / urls.size()));
}
}
}
}
}
示例9: initPlugins
import com.intellij.ide.StartupProgress; //导入依赖的package包/类
public static void initPlugins(@Nullable StartupProgress progress) {
long start = System.currentTimeMillis();
try {
initializePlugins(progress);
}
catch (RuntimeException e) {
getLogger().error(e);
throw e;
}
getLogger().info(ourPlugins.length + " plugins initialized in " + (System.currentTimeMillis() - start) + " ms");
logPlugins();
ClassUtilCore.clearJarURLCache();
}
示例10: initializePlugins
import com.intellij.ide.StartupProgress; //导入依赖的package包/类
private static void initializePlugins(@Nullable StartupProgress progress) {
configureExtensions();
final List<String> errors = ContainerUtil.newArrayList();
final IdeaPluginDescriptorImpl[] pluginDescriptors = loadDescriptors(progress, errors);
final Class callerClass = ReflectionUtil.findCallerClass(1);
assert callerClass != null;
final ClassLoader parentLoader = callerClass.getClassLoader();
final List<IdeaPluginDescriptorImpl> result = new ArrayList<IdeaPluginDescriptorImpl>();
final Map<PluginId, IdeaPluginDescriptorImpl> idToDescriptorMap = new THashMap<PluginId, IdeaPluginDescriptorImpl>();
final Map<String, String> disabledPluginNames = new THashMap<String, String>();
List<String> brokenPluginsList = new SmartList<String>();
fixDescriptors(pluginDescriptors, parentLoader, idToDescriptorMap, disabledPluginNames, brokenPluginsList, result, errors);
final Graph<PluginId> graph = createPluginIdGraph(idToDescriptorMap);
final DFSTBuilder<PluginId> builder = new DFSTBuilder<PluginId>(graph);
prepareLoadingPluginsErrorMessage(errors);
final Comparator<PluginId> idComparator = builder.comparator();
// sort descriptors according to plugin dependencies
Collections.sort(result, new Comparator<IdeaPluginDescriptor>() {
@Override
public int compare(@NotNull IdeaPluginDescriptor o1, @NotNull IdeaPluginDescriptor o2) {
return idComparator.compare(o1.getPluginId(), o2.getPluginId());
}
});
for (int i = 0; i < result.size(); i++) {
ourId2Index.put(result.get(i).getPluginId(), i);
}
int i = 0;
for (final IdeaPluginDescriptorImpl pluginDescriptor : result) {
if (pluginDescriptor.getPluginId().getIdString().equals(CORE_PLUGIN_ID) || pluginDescriptor.isUseCoreClassLoader()) {
pluginDescriptor.setLoader(parentLoader);
}
else {
final List<File> classPath = pluginDescriptor.getClassPath();
final PluginId[] dependentPluginIds = pluginDescriptor.getDependentPluginIds();
final ClassLoader[] parentLoaders = getParentLoaders(idToDescriptorMap, dependentPluginIds);
ClassLoader pluginClassLoader = createPluginClassLoader(classPath.toArray(new File[classPath.size()]),
parentLoaders.length > 0 ? parentLoaders : new ClassLoader[] {parentLoader},
pluginDescriptor);
pluginDescriptor.setLoader(pluginClassLoader);
}
if (progress != null) {
progress.showProgress("", PLUGINS_PROGRESS_MAX_VALUE + (i++ / (float)result.size()) * 0.35f);
}
}
registerExtensionPointsAndExtensions(Extensions.getRootArea(), result);
Extensions.getRootArea().getExtensionPoint(Extensions.AREA_LISTENER_EXTENSION_POINT).registerExtension(new AreaListener() {
@Override
public void areaCreated(@NotNull String areaClass, @NotNull AreaInstance areaInstance) {
registerExtensionPointsAndExtensions(Extensions.getArea(areaInstance), result);
}
@Override
public void areaDisposing(@NotNull String areaClass, @NotNull AreaInstance areaInstance) {
}
});
ourPlugins = pluginDescriptors;
}
示例11: initializePlugins
import com.intellij.ide.StartupProgress; //导入依赖的package包/类
static void initializePlugins(@Nullable StartupProgress progress) {
configureExtensions();
final IdeaPluginDescriptorImpl[] pluginDescriptors = loadDescriptors(progress);
final Class callerClass = ReflectionUtil.findCallerClass(1);
assert callerClass != null;
final ClassLoader parentLoader = callerClass.getClassLoader();
final List<IdeaPluginDescriptorImpl> result = new ArrayList<IdeaPluginDescriptorImpl>();
final HashMap<String, String> disabledPluginNames = new HashMap<String, String>();
for (IdeaPluginDescriptorImpl descriptor : pluginDescriptors) {
if (descriptor.getPluginId().getIdString().equals(CORE_PLUGIN_ID)) {
final List<String> modules = descriptor.getModules();
if (modules != null) {
ourAvailableModules.addAll(modules);
}
}
if (!shouldSkipPlugin(descriptor, pluginDescriptors)) {
result.add(descriptor);
}
else {
descriptor.setEnabled(false);
disabledPluginNames.put(descriptor.getPluginId().getIdString(), descriptor.getName());
initClassLoader(parentLoader, descriptor);
}
}
prepareLoadingPluginsErrorMessage(filterBadPlugins(result, disabledPluginNames));
final Map<PluginId, IdeaPluginDescriptorImpl> idToDescriptorMap = new HashMap<PluginId, IdeaPluginDescriptorImpl>();
for (final IdeaPluginDescriptorImpl descriptor : result) {
idToDescriptorMap.put(descriptor.getPluginId(), descriptor);
}
final IdeaPluginDescriptor corePluginDescriptor = idToDescriptorMap.get(PluginId.getId(CORE_PLUGIN_ID));
assert corePluginDescriptor != null : CORE_PLUGIN_ID + " not found; platform prefix is " + System.getProperty(PlatformUtilsCore.PLATFORM_PREFIX_KEY);
for (IdeaPluginDescriptorImpl descriptor : result) {
if (descriptor != corePluginDescriptor) {
descriptor.insertDependency(corePluginDescriptor);
}
}
mergeOptionalConfigs(idToDescriptorMap);
// sort descriptors according to plugin dependencies
Collections.sort(result, getPluginDescriptorComparator(idToDescriptorMap));
for (int i = 0; i < result.size(); i++) {
ourId2Index.put(result.get(i).getPluginId(), i);
}
int i = 0;
for (final IdeaPluginDescriptorImpl pluginDescriptor : result) {
if (pluginDescriptor.getPluginId().getIdString().equals(CORE_PLUGIN_ID) || pluginDescriptor.isUseCoreClassLoader()) {
pluginDescriptor.setLoader(parentLoader, true);
}
else {
final List<File> classPath = pluginDescriptor.getClassPath();
final PluginId[] dependentPluginIds = pluginDescriptor.getDependentPluginIds();
final ClassLoader[] parentLoaders = getParentLoaders(idToDescriptorMap, dependentPluginIds);
final ClassLoader pluginClassLoader = createPluginClassLoader(classPath.toArray(new File[classPath.size()]),
parentLoaders.length > 0 ? parentLoaders : new ClassLoader[] {parentLoader},
pluginDescriptor);
pluginDescriptor.setLoader(pluginClassLoader, true);
}
pluginDescriptor.registerExtensions();
if (progress != null) {
progress.showProgress("", PLUGINS_PROGRESS_MAX_VALUE + (i++ / (float)result.size()) * 0.35f);
}
}
ourPlugins = pluginDescriptors;
}
示例12: WebApplicationImpl
import com.intellij.ide.StartupProgress; //导入依赖的package包/类
public WebApplicationImpl(boolean isHeadless, @Nonnull Ref<? extends StartupProgress> splash) {
super(isHeadless, splash);
}