mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 14:23:28 +07:00
ConfigurableEP - do not use deprecated AbstractExtensionPointBean
GitOrigin-RevId: ef0b56bd6d01f3d20486fa213feb03be262e3370
This commit is contained in:
committed by
intellij-monorepo-bot
parent
ad286f53ee
commit
c78f60ac81
@@ -32,10 +32,7 @@ import java.util.*;
|
||||
|
||||
import static com.intellij.openapi.util.Pair.pair;
|
||||
|
||||
/**
|
||||
* @author Eugene Belyaev
|
||||
*/
|
||||
public class FileTypeConfigurable implements SearchableConfigurable, Configurable.NoScroll {
|
||||
public final class FileTypeConfigurable implements SearchableConfigurable, Configurable.NoScroll {
|
||||
private static final Insets TITLE_INSETS = JBUI.insetsTop(8);
|
||||
|
||||
private RecognizedFileTypes myRecognizedFileType;
|
||||
@@ -43,15 +40,10 @@ public class FileTypeConfigurable implements SearchableConfigurable, Configurabl
|
||||
private HashBangPanel myHashBangs;
|
||||
private FileTypePanel myFileTypePanel;
|
||||
private Set<FileType> myTempFileTypes;
|
||||
private final FileTypeManagerImpl myManager;
|
||||
private FileTypeAssocTable<FileType> myTempPatternsTable;
|
||||
private FileTypeAssocTable<Language> myTempTemplateDataLanguages;
|
||||
private final Map<UserFileType, UserFileType> myOriginalToEditedMap = new HashMap<>();
|
||||
|
||||
public FileTypeConfigurable(FileTypeManager fileTypeManager) {
|
||||
myManager = (FileTypeManagerImpl)fileTypeManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDisplayName() {
|
||||
return FileTypesBundle.message("filetype.settings.title");
|
||||
@@ -89,18 +81,20 @@ public class FileTypeConfigurable implements SearchableConfigurable, Configurabl
|
||||
}
|
||||
myOriginalToEditedMap.clear();
|
||||
|
||||
FileTypeManagerImpl fileTypeManager = (FileTypeManagerImpl)FileTypeManager.getInstance();
|
||||
ApplicationManager.getApplication().runWriteAction(() -> {
|
||||
if (!myManager.isIgnoredFilesListEqualToCurrent(myFileTypePanel.myIgnoreFilesField.getText())) {
|
||||
myManager.setIgnoredFilesList(myFileTypePanel.myIgnoreFilesField.getText());
|
||||
if (!fileTypeManager.isIgnoredFilesListEqualToCurrent(myFileTypePanel.myIgnoreFilesField.getText())) {
|
||||
fileTypeManager.setIgnoredFilesList(myFileTypePanel.myIgnoreFilesField.getText());
|
||||
}
|
||||
myManager.setPatternsTable(myTempFileTypes, myTempPatternsTable);
|
||||
fileTypeManager.setPatternsTable(myTempFileTypes, myTempPatternsTable);
|
||||
TemplateDataLanguagePatterns.getInstance().setAssocTable(myTempTemplateDataLanguages);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
myTempPatternsTable = myManager.getExtensionMap().copy();
|
||||
FileTypeManagerImpl fileTypeManager = (FileTypeManagerImpl)FileTypeManager.getInstance();
|
||||
myTempPatternsTable = fileTypeManager.getExtensionMap().copy();
|
||||
myTempTemplateDataLanguages = TemplateDataLanguagePatterns.getInstance().getAssocTable();
|
||||
|
||||
myTempFileTypes = getRegisteredFilesTypes();
|
||||
@@ -109,13 +103,16 @@ public class FileTypeConfigurable implements SearchableConfigurable, Configurabl
|
||||
updateFileTypeList();
|
||||
updateExtensionList();
|
||||
|
||||
myFileTypePanel.myIgnoreFilesField.setText(myManager.getIgnoredFilesList());
|
||||
myFileTypePanel.myIgnoreFilesField.setText(fileTypeManager.getIgnoredFilesList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isModified() {
|
||||
if (!myManager.isIgnoredFilesListEqualToCurrent(myFileTypePanel.myIgnoreFilesField.getText())) return true;
|
||||
return !myTempPatternsTable.equals(myManager.getExtensionMap()) ||
|
||||
FileTypeManagerImpl fileTypeManager = (FileTypeManagerImpl)FileTypeManager.getInstance();
|
||||
if (!fileTypeManager.isIgnoredFilesListEqualToCurrent(myFileTypePanel.myIgnoreFilesField.getText())) {
|
||||
return true;
|
||||
}
|
||||
return !myTempPatternsTable.equals(fileTypeManager.getExtensionMap()) ||
|
||||
!myTempFileTypes.equals(getRegisteredFilesTypes()) ||
|
||||
!myOriginalToEditedMap.isEmpty() ||
|
||||
!myTempTemplateDataLanguages.equals(TemplateDataLanguagePatterns.getInstance().getAssocTable());
|
||||
@@ -181,7 +178,7 @@ public class FileTypeConfigurable implements SearchableConfigurable, Configurabl
|
||||
|
||||
myTempFileTypes.remove(fileType);
|
||||
if (fileType instanceof UserFileType) {
|
||||
myOriginalToEditedMap.remove((UserFileType)fileType);
|
||||
myOriginalToEditedMap.remove(fileType);
|
||||
}
|
||||
myTempPatternsTable.removeAllAssociations(fileType);
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2019 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-2020 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.fileTypes;
|
||||
|
||||
import com.intellij.openapi.application.Application;
|
||||
@@ -20,7 +20,7 @@ import java.util.List;
|
||||
*/
|
||||
public abstract class FileTypeManager extends FileTypeRegistry {
|
||||
static {
|
||||
FileTypeRegistry.ourInstanceGetter = () -> getInstance();
|
||||
FileTypeRegistry.ourInstanceGetter = FileTypeManager::getInstance;
|
||||
}
|
||||
|
||||
private static FileTypeManager ourInstance = CachedSingletonsRegistry.markCachedField(FileTypeManager.class);
|
||||
|
||||
@@ -7,20 +7,18 @@ import com.intellij.diagnostic.PluginException;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.components.ComponentManager;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.extensions.AbstractExtensionPointBean;
|
||||
import com.intellij.openapi.extensions.ExtensionInstantiationException;
|
||||
import com.intellij.openapi.extensions.ExtensionNotApplicableException;
|
||||
import com.intellij.openapi.extensions.PluginAware;
|
||||
import com.intellij.openapi.extensions.PluginDescriptor;
|
||||
import com.intellij.openapi.progress.ProcessCanceledException;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.AtomicNotNullLazyValue;
|
||||
import com.intellij.serviceContainer.NonInjectable;
|
||||
import com.intellij.util.xmlb.annotations.Attribute;
|
||||
import com.intellij.util.xmlb.annotations.Property;
|
||||
import com.intellij.util.xmlb.annotations.Tag;
|
||||
import com.intellij.util.xmlb.annotations.XCollection;
|
||||
import com.intellij.util.xmlb.annotations.*;
|
||||
import org.jetbrains.annotations.Nls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.picocontainer.PicoContainer;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.ResourceBundle;
|
||||
@@ -31,9 +29,22 @@ import java.util.ResourceBundle;
|
||||
* @see Configurable
|
||||
*/
|
||||
@Tag("configurable")
|
||||
public class ConfigurableEP<T extends UnnamedConfigurable> extends AbstractExtensionPointBean {
|
||||
public class ConfigurableEP<T extends UnnamedConfigurable> implements PluginAware {
|
||||
private static final Logger LOG = Logger.getInstance(ConfigurableEP.class);
|
||||
|
||||
private PluginDescriptor pluginDescriptor;
|
||||
|
||||
@Transient
|
||||
@NotNull
|
||||
public final PluginDescriptor getPluginDescriptor() {
|
||||
return pluginDescriptor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void setPluginDescriptor(@NotNull PluginDescriptor value) {
|
||||
pluginDescriptor = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* This attribute specifies the setting name visible to users.
|
||||
* It has precedence over the pair of attributes {@link #key}-{@link #bundle}.
|
||||
@@ -93,16 +104,19 @@ public class ConfigurableEP<T extends UnnamedConfigurable> extends AbstractExten
|
||||
@Nullable
|
||||
public ResourceBundle findBundle() {
|
||||
String pathToBundle = findPathToBundle();
|
||||
if (pathToBundle == null) return null; // a path to bundle is not specified or cannot be found
|
||||
ClassLoader loader = myPluginDescriptor == null ? null : myPluginDescriptor.getPluginClassLoader();
|
||||
if (pathToBundle == null) {
|
||||
// a path to bundle is not specified or cannot be found
|
||||
return null;
|
||||
}
|
||||
ClassLoader loader = pluginDescriptor == null ? null : pluginDescriptor.getPluginClassLoader();
|
||||
return DynamicBundle.INSTANCE.getResourceBundle(pathToBundle, loader != null ? loader : getClass().getClassLoader());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private String findPathToBundle() {
|
||||
if (bundle == null && myPluginDescriptor != null) {
|
||||
if (bundle == null && pluginDescriptor != null) {
|
||||
// can be unspecified
|
||||
return myPluginDescriptor.getResourceBundleBaseName();
|
||||
return pluginDescriptor.getResourceBundleBaseName();
|
||||
}
|
||||
return bundle;
|
||||
}
|
||||
@@ -139,8 +153,8 @@ public class ConfigurableEP<T extends UnnamedConfigurable> extends AbstractExten
|
||||
@NotNull
|
||||
public List<ConfigurableEP<?>> getChildren() {
|
||||
for (ConfigurableEP<?> child : children) {
|
||||
child.myPicoContainer = myPicoContainer;
|
||||
child.myPluginDescriptor = myPluginDescriptor;
|
||||
child.componentManager = componentManager;
|
||||
child.pluginDescriptor = pluginDescriptor;
|
||||
child.myProject = myProject;
|
||||
}
|
||||
return children;
|
||||
@@ -249,7 +263,7 @@ public class ConfigurableEP<T extends UnnamedConfigurable> extends AbstractExten
|
||||
public String treeRendererClass;
|
||||
|
||||
private final AtomicNotNullLazyValue<ObjectProducer> myProducer = AtomicNotNullLazyValue.createValue(this::createProducer);
|
||||
private PicoContainer myPicoContainer;
|
||||
private ComponentManager componentManager;
|
||||
private Project myProject;
|
||||
|
||||
public ConfigurableEP() {
|
||||
@@ -258,17 +272,7 @@ public class ConfigurableEP<T extends UnnamedConfigurable> extends AbstractExten
|
||||
|
||||
protected ConfigurableEP(@NotNull ComponentManager componentManager) {
|
||||
myProject = componentManager instanceof Project ? (Project)componentManager : null;
|
||||
myPicoContainer = componentManager.getPicoContainer();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #ConfigurableEP(ComponentManager)}
|
||||
*/
|
||||
@Deprecated
|
||||
@NonInjectable
|
||||
protected ConfigurableEP(@NotNull PicoContainer picoContainer, @Nullable Project project) {
|
||||
myProject = project;
|
||||
myPicoContainer = picoContainer;
|
||||
this.componentManager = componentManager;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -278,29 +282,42 @@ public class ConfigurableEP<T extends UnnamedConfigurable> extends AbstractExten
|
||||
@NonInjectable
|
||||
public ConfigurableEP(@NotNull Project project) {
|
||||
myProject = project;
|
||||
myPicoContainer = project.getPicoContainer();
|
||||
componentManager = project;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected ObjectProducer createProducer() {
|
||||
try {
|
||||
if (providerClass != null) {
|
||||
return new ProviderProducer(instantiateClass(providerClass, myPicoContainer));
|
||||
return new ProviderProducer(componentManager.instantiateExtensionWithPicoContainerOnlyIfNeeded(providerClass, pluginDescriptor));
|
||||
}
|
||||
if (instanceClass != null) {
|
||||
return new ClassProducer(myPicoContainer, findExtensionClass(instanceClass));
|
||||
else if (instanceClass != null) {
|
||||
return new ClassProducer(componentManager, instanceClass, pluginDescriptor);
|
||||
}
|
||||
if (implementationClass != null) {
|
||||
return new ClassProducer(myPicoContainer, findExtensionClass(implementationClass));
|
||||
else if (implementationClass != null) {
|
||||
return new ClassProducer(componentManager, implementationClass, pluginDescriptor);
|
||||
}
|
||||
else {
|
||||
throw new PluginException("configurable class name is not set", pluginDescriptor == null ? null : pluginDescriptor.getPluginId());
|
||||
}
|
||||
throw new PluginException("configurable class name is not set", getPluginId());
|
||||
}
|
||||
catch (AssertionError | Exception | LinkageError error) {
|
||||
LOG.error(new PluginException(error, getPluginId()));
|
||||
LOG.error(new PluginException(error, pluginDescriptor == null ? null : pluginDescriptor.getPluginId()));
|
||||
}
|
||||
return new ObjectProducer();
|
||||
}
|
||||
|
||||
public final @Nullable Class<?> findClassOrNull(@NotNull String className) {
|
||||
try {
|
||||
ClassLoader classLoader = pluginDescriptor == null ? null : pluginDescriptor.getPluginClassLoader();
|
||||
return Class.forName(className, true, classLoader);
|
||||
}
|
||||
catch (Throwable t) {
|
||||
LOG.error(new ExtensionInstantiationException(t, pluginDescriptor));
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public T createConfigurable() {
|
||||
ObjectProducer producer = myProducer.getValue();
|
||||
@@ -318,13 +335,13 @@ public class ConfigurableEP<T extends UnnamedConfigurable> extends AbstractExten
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return instantiate(findExtensionClass(treeRendererClass), myPicoContainer);
|
||||
return componentManager.instantiateExtensionWithPicoContainerOnlyIfNeeded(treeRendererClass, pluginDescriptor);
|
||||
}
|
||||
catch (ProcessCanceledException exception) {
|
||||
throw exception;
|
||||
}
|
||||
catch (AssertionError | LinkageError | Exception e) {
|
||||
LOG.error(new PluginException(e, getPluginId()));
|
||||
LOG.error(new PluginException(e, pluginDescriptor == null ? null : pluginDescriptor.getPluginId()));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -386,18 +403,20 @@ public class ConfigurableEP<T extends UnnamedConfigurable> extends AbstractExten
|
||||
}
|
||||
|
||||
private static final class ClassProducer extends ObjectProducer {
|
||||
private final PicoContainer myContainer;
|
||||
private final Class<?> myType;
|
||||
private final ComponentManager componentManager;
|
||||
private final String className;
|
||||
private final PluginDescriptor pluginDescriptor;
|
||||
|
||||
private ClassProducer(PicoContainer container, Class<?> type) {
|
||||
myContainer = container;
|
||||
myType = type;
|
||||
private ClassProducer(@NotNull ComponentManager componentManager, @NotNull String className, @Nullable PluginDescriptor pluginDescriptor) {
|
||||
this.componentManager = componentManager;
|
||||
this.className = className;
|
||||
this.pluginDescriptor = pluginDescriptor;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object createElement() {
|
||||
try {
|
||||
return instantiate(myType, myContainer);
|
||||
return componentManager.instantiateExtensionWithPicoContainerOnlyIfNeeded(className, pluginDescriptor);
|
||||
}
|
||||
catch (ProcessCanceledException exception) {
|
||||
throw exception;
|
||||
@@ -413,12 +432,12 @@ public class ConfigurableEP<T extends UnnamedConfigurable> extends AbstractExten
|
||||
|
||||
@Override
|
||||
protected boolean canCreateElement() {
|
||||
return myType != null;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Class<?> getType() {
|
||||
return myType;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -101,12 +101,7 @@ public final class ConfigurableExtensionPointUtil {
|
||||
LOG.warn("Can't find parent for " + parentId + " (" + wrapper + ")");
|
||||
continue;
|
||||
}
|
||||
List<String> children = tree.get(parentId);
|
||||
if (children == null) {
|
||||
children = new ArrayList<>(5);
|
||||
tree.put(parentId, children);
|
||||
}
|
||||
children.add(id);
|
||||
tree.computeIfAbsent(parentId, k -> new ArrayList<>(5)).add(id);
|
||||
}
|
||||
}
|
||||
return tree;
|
||||
@@ -469,7 +464,7 @@ public final class ConfigurableExtensionPointUtil {
|
||||
private static Configurable createConfigurableForProvider(@NotNull List<? extends ConfigurableEP<Configurable>> extensions, Class<? extends ConfigurableProvider> providerClass) {
|
||||
for (ConfigurableEP<Configurable> extension : extensions) {
|
||||
if (extension.providerClass != null) {
|
||||
final Class<Object> aClass = extension.findClassNoExceptions(extension.providerClass);
|
||||
Class<?> aClass = extension.findClassOrNull(extension.providerClass);
|
||||
if (aClass != null && providerClass.isAssignableFrom(aClass)) {
|
||||
return extension.createConfigurable();
|
||||
}
|
||||
|
||||
@@ -9,8 +9,6 @@ import com.intellij.openapi.extensions.ExtensionsArea;
|
||||
import com.intellij.openapi.options.*;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.NullableFunction;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.Nls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -54,8 +52,20 @@ public class ConfigurableWrapper implements SearchableConfigurable, Weighted {
|
||||
return configurable;
|
||||
}
|
||||
|
||||
public static <T extends UnnamedConfigurable> List<T> createConfigurables(ExtensionPointName<? extends ConfigurableEP<T>> name) {
|
||||
return ContainerUtil.mapNotNull(name.getExtensionList(), (NullableFunction<ConfigurableEP<T>, T>)ep -> wrapConfigurable(ep));
|
||||
public static <T extends UnnamedConfigurable> List<T> createConfigurables(@NotNull ExtensionPointName<? extends ConfigurableEP<T>> name) {
|
||||
Collection<? extends ConfigurableEP<T>> collection = name.getExtensionList();
|
||||
if (collection.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
List<T> result = new ArrayList<>(collection.size());
|
||||
for (ConfigurableEP<T> item : collection) {
|
||||
T o = wrapConfigurable(item, false);
|
||||
if (o != null) {
|
||||
result.add(o);
|
||||
}
|
||||
}
|
||||
return result.isEmpty() ? Collections.emptyList() : result;
|
||||
}
|
||||
|
||||
public static boolean hasOwnContent(UnnamedConfigurable configurable) {
|
||||
|
||||
@@ -54,7 +54,10 @@ import javax.swing.tree.TreePath;
|
||||
import javax.swing.tree.TreeSelectionModel;
|
||||
import java.awt.*;
|
||||
import java.awt.datatransfer.Transferable;
|
||||
import java.awt.event.*;
|
||||
import java.awt.event.ComponentAdapter;
|
||||
import java.awt.event.ComponentEvent;
|
||||
import java.awt.event.InputEvent;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
|
||||
@@ -648,9 +651,13 @@ public class SettingsTreeView extends JComponent implements Accessible, Disposab
|
||||
String id = node.myConfigurable instanceof ConfigurableWrapper ? ((ConfigurableWrapper)node.myConfigurable).getId() :
|
||||
node.myConfigurable instanceof SearchableConfigurable ? ((SearchableConfigurable)node.myConfigurable).getId() :
|
||||
node.myConfigurable.getClass().getSimpleName();
|
||||
PluginDescriptor plugin =
|
||||
node.myConfigurable instanceof ConfigurableWrapper ? ((ConfigurableWrapper)node.myConfigurable).getExtensionPoint()
|
||||
.getPluginDescriptor() : null;
|
||||
PluginDescriptor plugin;
|
||||
if (node.myConfigurable instanceof ConfigurableWrapper) {
|
||||
plugin = ((ConfigurableWrapper)node.myConfigurable).getExtensionPoint().getPluginDescriptor();
|
||||
}
|
||||
else {
|
||||
plugin = null;
|
||||
}
|
||||
PluginId pluginId = plugin == null ? null : plugin.getPluginId();
|
||||
String pluginName;
|
||||
if (pluginId == null || PluginManagerCore.CORE_ID == pluginId) {
|
||||
@@ -996,11 +1003,11 @@ public class SettingsTreeView extends JComponent implements Accessible, Disposab
|
||||
myConfigurableToNodeMap.clear();
|
||||
AbstractTreeUi ui = myBuilder.getUi();
|
||||
if (ui == null) return;
|
||||
|
||||
|
||||
//remove expansion and selection (to avoid stuck old elements) before cleanup
|
||||
myTree.getSelectionModel().clearSelection();
|
||||
myTree.collapsePath(new TreePath(myTree.getModel().getRoot()));
|
||||
|
||||
|
||||
myBuilder.cleanUp();
|
||||
ui.getUpdater().reset();
|
||||
AbstractTreeStructure structure = ui.getTreeStructure();
|
||||
|
||||
@@ -670,7 +670,7 @@ abstract class ComponentManagerImpl @JvmOverloads constructor(internal val paren
|
||||
catch (e: Throwable) {
|
||||
when {
|
||||
e.cause is NoSuchMethodException || e.cause is IllegalArgumentException -> {
|
||||
val exception = PluginException("Bean extension class constructor must not have parameters: $className", pluginId)
|
||||
val exception = PluginException("Class constructor must not have parameters: $className", pluginId)
|
||||
if ((pluginDescriptor?.isBundled == true) || getApplication()?.isUnitTestMode == true) {
|
||||
LOG.error(exception)
|
||||
}
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
// Copyright 2000-2019 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-2020 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 org.jetbrains.plugins.github.ui
|
||||
|
||||
import com.intellij.ide.IdeBundle.message
|
||||
import com.intellij.openapi.application.ApplicationManager
|
||||
import com.intellij.openapi.components.service
|
||||
import com.intellij.openapi.options.BoundConfigurable
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.ui.DialogPanel
|
||||
@@ -19,20 +20,14 @@ import org.jetbrains.plugins.github.util.GithubImageResizer
|
||||
import org.jetbrains.plugins.github.util.GithubSettings
|
||||
import org.jetbrains.plugins.github.util.GithubUtil
|
||||
|
||||
class GithubSettingsConfigurable internal constructor(
|
||||
private val project: Project,
|
||||
private val settings: GithubSettings,
|
||||
private val accountManager: GithubAccountManager,
|
||||
private val defaultAccountHolder: GithubProjectDefaultAccountHolder,
|
||||
private val executorFactory: GithubApiRequestExecutor.Factory,
|
||||
private val avatarLoader: CachingGithubUserAvatarLoader,
|
||||
private val imageResizer: GithubImageResizer
|
||||
) : BoundConfigurable(GithubUtil.SERVICE_DISPLAY_NAME, "settings.github") {
|
||||
|
||||
internal class GithubSettingsConfigurable internal constructor(private val project: Project) : BoundConfigurable(GithubUtil.SERVICE_DISPLAY_NAME, "settings.github") {
|
||||
override fun createPanel(): DialogPanel {
|
||||
val defaultAccountHolder = project.service<GithubProjectDefaultAccountHolder>()
|
||||
val accountManager = service<GithubAccountManager>()
|
||||
val settings = GithubSettings.getInstance()
|
||||
return panel {
|
||||
row {
|
||||
val accountsPanel = GHAccountsPanel(project, executorFactory, avatarLoader, imageResizer).apply {
|
||||
val accountsPanel = GHAccountsPanel(project, GithubApiRequestExecutor.Factory.getInstance(), CachingGithubUserAvatarLoader.getInstance(), GithubImageResizer.getInstance()).apply {
|
||||
Disposer.register(disposable!!, this)
|
||||
}
|
||||
component(accountsPanel)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2019 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-2020 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.application.options.editor
|
||||
|
||||
import com.intellij.openapi.extensions.ExtensionPointName
|
||||
@@ -36,7 +36,7 @@ private val webEditorOptionDescriptors
|
||||
mySelectWholeCssIdentifierOnDoubleClick
|
||||
).map(CheckboxDescriptor::asOptionDescriptor)
|
||||
|
||||
internal class WebSmartKeysConfigurable(val model: WebEditorOptions) : BoundCompositeConfigurable<UnnamedConfigurable>("HTML/CSS"), ConfigurableWithOptionDescriptors {
|
||||
internal class WebSmartKeysConfigurable : BoundCompositeConfigurable<UnnamedConfigurable>("HTML/CSS"), ConfigurableWithOptionDescriptors {
|
||||
override fun createPanel(): DialogPanel {
|
||||
return panel {
|
||||
titledRow(XmlBundle.message("xml.editor.options.misc.title")) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// 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.
|
||||
// Copyright 2000-2020 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.application.options.editor;
|
||||
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
@@ -15,7 +15,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
storages = @Storage("editor.xml"),
|
||||
reportStatistic = true
|
||||
)
|
||||
public class WebEditorOptions implements PersistentStateComponent<WebEditorOptions> {
|
||||
public final class WebEditorOptions implements PersistentStateComponent<WebEditorOptions> {
|
||||
private static final boolean myShowCssColorPreviewInGutter = true;
|
||||
private boolean mySelectWholeCssIdentifierOnDoubleClick = true;
|
||||
private boolean myShowCssInlineColorPreview = false;
|
||||
|
||||
Reference in New Issue
Block a user