mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
API for unregistering extension without creating its instance
This commit is contained in:
@@ -1,6 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2017 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.
|
||||
*/
|
||||
// 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.openapi.extensions;
|
||||
|
||||
import com.intellij.openapi.Disposable;
|
||||
@@ -29,6 +27,11 @@ public interface ExtensionPoint<T> {
|
||||
|
||||
void unregisterExtension(@NotNull T extension);
|
||||
|
||||
/**
|
||||
* Unregisters an extension of the specified type.
|
||||
*/
|
||||
void unregisterExtension(@NotNull Class<? extends T> extensionClass);
|
||||
|
||||
void addExtensionPointListener(@NotNull ExtensionPointListener<T> listener, @NotNull Disposable parentDisposable);
|
||||
|
||||
void addExtensionPointListener(@NotNull ExtensionPointListener<T> listener);
|
||||
|
||||
+12
-15
@@ -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.openapi.extensions.impl;
|
||||
|
||||
import com.intellij.openapi.Disposable;
|
||||
@@ -320,6 +306,17 @@ public class ExtensionPointImpl<T> implements ExtensionPoint<T> {
|
||||
unregisterExtension(extension, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterExtension(@NotNull Class<? extends T> extensionClass) {
|
||||
for (ExtensionComponentAdapter adapter : ContainerUtil.concat(myExtensionAdapters, myLoadedAdapters)) {
|
||||
if (adapter.getAssignableToClassName().equals(extensionClass.getCanonicalName())) {
|
||||
unregisterExtensionAdapter(adapter);
|
||||
return;
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException("Extension to be removed not found: " + extensionClass);
|
||||
}
|
||||
|
||||
private int getExtensionIndex(@NotNull T extension) {
|
||||
for (int i = 0; i < myLoadedAdapters.size(); i++) {
|
||||
ExtensionComponentAdapter adapter = myLoadedAdapters.get(i);
|
||||
|
||||
+2
-20
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2013 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.jetbrains.python.edu;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
@@ -329,11 +315,7 @@ public class PyCharmEduInitialConfigurator {
|
||||
}
|
||||
}
|
||||
|
||||
for (DirectoryProjectConfigurator ep : Extensions.getExtensions(DirectoryProjectConfigurator.EP_NAME)) {
|
||||
if (ep instanceof PlatformProjectViewOpener) {
|
||||
rootArea.getExtensionPoint(DirectoryProjectConfigurator.EP_NAME).unregisterExtension(ep);
|
||||
}
|
||||
}
|
||||
rootArea.getExtensionPoint(DirectoryProjectConfigurator.EP_NAME).unregisterExtension(PlatformProjectViewOpener.class);
|
||||
|
||||
// unregister unrelated tips
|
||||
for (TipAndTrickBean tip : Extensions.getExtensions(TipAndTrickBean.EP_NAME)) {
|
||||
|
||||
Reference in New Issue
Block a user