mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
use getExtensionList() (avoid array.clone)
This commit is contained in:
@@ -43,6 +43,10 @@ public final class ExtensionPointName<T> {
|
||||
return getExtensionList(null);
|
||||
}
|
||||
|
||||
public boolean hasAnyExtensions() {
|
||||
return getPoint(null).hasAnyExtensions();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public List<T> getExtensionList(@Nullable AreaInstance areaInstance) {
|
||||
return getPoint(areaInstance).getExtensionList();
|
||||
|
||||
+4
-18
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
|
||||
package com.intellij.psi.impl.source.tree.injected;
|
||||
|
||||
@@ -169,7 +155,7 @@ public class InjectedLanguageManagerImpl extends InjectedLanguageManager impleme
|
||||
List<MultiHostInjector> allInjectors = ContainerUtil.newArrayList();
|
||||
allInjectors.addAll(myManualInjectors);
|
||||
Collections.addAll(allInjectors, MultiHostInjector.MULTIHOST_INJECTOR_EP_NAME.getExtensions(myProject));
|
||||
if (LanguageInjector.EXTENSION_POINT_NAME.getExtensions().length > 0) {
|
||||
if (LanguageInjector.EXTENSION_POINT_NAME.hasAnyExtensions()) {
|
||||
allInjectors.add(PsiManagerRegisteredInjectorsAdapter.INSTANCE);
|
||||
}
|
||||
|
||||
@@ -451,14 +437,14 @@ public class InjectedLanguageManagerImpl extends InjectedLanguageManager impleme
|
||||
.startInjecting(language)
|
||||
.addPlace(prefix, suffix, host, rangeInsideHost)
|
||||
.doneInjecting();
|
||||
for (LanguageInjector injector : Extensions.getExtensions(LanguageInjector.EXTENSION_POINT_NAME)) {
|
||||
for (LanguageInjector injector : LanguageInjector.EXTENSION_POINT_NAME.getExtensionList()) {
|
||||
injector.getLanguagesToInject(host, placesRegistrar);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public List<? extends Class<? extends PsiElement>> elementsToInjectIn() {
|
||||
public List<Class<? extends PsiElement>> elementsToInjectIn() {
|
||||
return Collections.singletonList(PsiLanguageInjectionHost.class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.ide.startup.impl;
|
||||
|
||||
import com.intellij.diagnostic.PerformanceWatcher;
|
||||
@@ -23,11 +9,13 @@ import com.intellij.notification.NotificationType;
|
||||
import com.intellij.notification.Notifications;
|
||||
import com.intellij.openapi.application.*;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.extensions.Extensions;
|
||||
import com.intellij.openapi.progress.ProcessCanceledException;
|
||||
import com.intellij.openapi.progress.ProgressIndicator;
|
||||
import com.intellij.openapi.progress.ProgressManager;
|
||||
import com.intellij.openapi.project.*;
|
||||
import com.intellij.openapi.project.DumbModeTask;
|
||||
import com.intellij.openapi.project.DumbService;
|
||||
import com.intellij.openapi.project.DumbServiceImpl;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.project.impl.ProjectLifecycleListener;
|
||||
import com.intellij.openapi.roots.ProjectRootManager;
|
||||
import com.intellij.openapi.roots.impl.ProjectRootManagerImpl;
|
||||
@@ -146,7 +134,7 @@ public class StartupManagerImpl extends StartupManagerEx {
|
||||
public void runPostStartupActivitiesFromExtensions() {
|
||||
PerformanceWatcher.Snapshot snapshot = PerformanceWatcher.takeSnapshot();
|
||||
AtomicBoolean uiFreezeWarned = new AtomicBoolean();
|
||||
for (StartupActivity extension : Extensions.getExtensions(StartupActivity.POST_STARTUP_ACTIVITY)) {
|
||||
for (StartupActivity extension : StartupActivity.POST_STARTUP_ACTIVITY.getExtensionList()) {
|
||||
Runnable runnable = () -> logActivityDuration(uiFreezeWarned, extension);
|
||||
if (DumbService.isDumbAware(extension)) {
|
||||
runActivity(runnable);
|
||||
@@ -160,7 +148,7 @@ public class StartupManagerImpl extends StartupManagerEx {
|
||||
|
||||
private void logActivityDuration(AtomicBoolean uiFreezeWarned, StartupActivity extension) {
|
||||
long duration = runAndMeasure(extension);
|
||||
|
||||
|
||||
Application app = ApplicationManager.getApplication();
|
||||
if (duration > 100 && !app.isUnitTestMode()) {
|
||||
boolean edt = app.isDispatchThread();
|
||||
@@ -382,7 +370,7 @@ public class StartupManagerImpl extends StartupManagerEx {
|
||||
|
||||
Runnable runnable = () -> {
|
||||
if (myProject.isDisposed()) return;
|
||||
|
||||
|
||||
//noinspection SynchronizeOnThis
|
||||
synchronized (this) {
|
||||
// in tests which simulate project opening, post-startup activities could have been run already.
|
||||
|
||||
+1
-1
@@ -408,7 +408,7 @@ public class ApplicationImpl extends PlatformComponentManagerImpl implements App
|
||||
getPicoContainer().getComponentInstance(ServiceManagerImpl.class);
|
||||
|
||||
String effectiveConfigPath = FileUtilRt.toSystemIndependentName(configPath == null ? PathManager.getConfigPath() : configPath);
|
||||
ApplicationLoadListener[] applicationLoadListeners = ApplicationLoadListener.EP_NAME.getExtensions();
|
||||
List<ApplicationLoadListener> applicationLoadListeners = ApplicationLoadListener.EP_NAME.getExtensionList();
|
||||
for (ApplicationLoadListener listener : applicationLoadListeners) {
|
||||
try {
|
||||
listener.beforeApplicationLoaded(this, effectiveConfigPath);
|
||||
|
||||
@@ -259,7 +259,7 @@ class IcsApplicationLoadListener : ApplicationLoadListener {
|
||||
val removeOtherXml = repositoryManager.delete("other.xml")
|
||||
if (migrateSchemes || migrateKeyMaps || removeOtherXml) {
|
||||
// schedule push to avoid merge conflicts
|
||||
application.invokeLater({ icsManager.autoSyncManager.autoSync(force = true) })
|
||||
application.invokeLater { icsManager.autoSyncManager.autoSync(force = true) }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user