mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-20 13:31:28 +07:00
reduce usage of ApplicationComponent.disposeComponent (to dispose in a correct order (as Disposer))
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* 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.
|
||||
@@ -19,7 +19,6 @@ import com.intellij.compiler.server.BuildManager;
|
||||
import com.intellij.openapi.application.Application;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.PathManager;
|
||||
import com.intellij.openapi.components.ApplicationComponent;
|
||||
import com.intellij.openapi.fileTypes.FileTypeManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.project.ProjectManager;
|
||||
@@ -55,7 +54,7 @@ import java.util.Set;
|
||||
* 1. corresponding source file has been scheduled for recompilation (see above)
|
||||
* 2. corresponding source file has been deleted
|
||||
*/
|
||||
public class TranslatingCompilerFilesMonitor implements ApplicationComponent {
|
||||
public class TranslatingCompilerFilesMonitor {
|
||||
public static boolean ourDebugMode = false;
|
||||
private static final SequentialTaskExecutor ourFSEventQueue = new SequentialTaskExecutor("_build_notify_queue_", PooledThreadExecutor.INSTANCE);
|
||||
|
||||
@@ -67,18 +66,6 @@ public class TranslatingCompilerFilesMonitor implements ApplicationComponent {
|
||||
return ApplicationManager.getApplication().getComponent(TranslatingCompilerFilesMonitor.class);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String getComponentName() {
|
||||
return "TranslatingCompilerFilesMonitor";
|
||||
}
|
||||
|
||||
public void initComponent() {
|
||||
}
|
||||
|
||||
|
||||
public void disposeComponent() {
|
||||
}
|
||||
|
||||
private interface FileProcessor {
|
||||
void execute(VirtualFile file);
|
||||
}
|
||||
@@ -130,6 +117,7 @@ public class TranslatingCompilerFilesMonitor implements ApplicationComponent {
|
||||
}
|
||||
|
||||
private static class MyVfsListener extends VirtualFileAdapter {
|
||||
@Override
|
||||
public void propertyChanged(@NotNull final VirtualFilePropertyEvent event) {
|
||||
if (VirtualFile.PROP_NAME.equals(event.getPropertyName())) {
|
||||
processEventFile(event.getFile(), (eventFile)->{
|
||||
@@ -179,26 +167,32 @@ public class TranslatingCompilerFilesMonitor implements ApplicationComponent {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void contentsChanged(@NotNull final VirtualFileEvent event) {
|
||||
processEventFile(event.getFile(), (eventFile)-> collectPathsAndNotify(eventFile, NOTIFY_CHANGED));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fileCreated(@NotNull final VirtualFileEvent event) {
|
||||
processEventFile(event.getFile(), (eventFile)-> collectPathsAndNotify(eventFile, NOTIFY_CHANGED));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fileCopied(@NotNull final VirtualFileCopyEvent event) {
|
||||
processEventFile(event.getFile(), (eventFile)-> collectPathsAndNotify(eventFile, NOTIFY_CHANGED));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fileMoved(@NotNull VirtualFileMoveEvent event) {
|
||||
processEventFile(event.getFile(), (eventFile)-> collectPathsAndNotify(eventFile, NOTIFY_CHANGED));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeFileDeletion(@NotNull final VirtualFileEvent event) {
|
||||
processEventFile(event.getFile(), (eventFile)-> collectPathsAndNotify(eventFile, NOTIFY_DELETED));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeFileMovement(@NotNull final VirtualFileMoveEvent event) {
|
||||
processEventFile(event.getFile(), (eventFile)-> collectPathsAndNotify(eventFile, NOTIFY_DELETED));
|
||||
}
|
||||
@@ -220,6 +214,7 @@ public class TranslatingCompilerFilesMonitor implements ApplicationComponent {
|
||||
if (!isIgnoredOrUnderIgnoredDirectory(file)) {
|
||||
final boolean inContent = isInContentOfOpenedProject(file);
|
||||
processRecursively(file, !inContent, new FileProcessor() {
|
||||
@Override
|
||||
public void execute(final VirtualFile file) {
|
||||
pathsToMark.add(new File(file.getPath()));
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* 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.
|
||||
@@ -15,8 +15,8 @@
|
||||
*/
|
||||
package com.intellij.psi.stubs;
|
||||
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.application.PathManager;
|
||||
import com.intellij.openapi.components.ApplicationComponent;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.ShutDownTracker;
|
||||
import com.intellij.util.io.AbstractStringEnumerator;
|
||||
@@ -33,7 +33,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
||||
/*
|
||||
* @author max
|
||||
*/
|
||||
public class SerializationManagerImpl extends SerializationManagerEx implements ApplicationComponent {
|
||||
public class SerializationManagerImpl extends SerializationManagerEx implements Disposable {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.psi.stubs.SerializationManagerImpl");
|
||||
|
||||
private final AtomicBoolean myNameStorageCrashed = new AtomicBoolean(false);
|
||||
@@ -113,17 +113,7 @@ public class SerializationManagerImpl extends SerializationManagerEx implements
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getComponentName() {
|
||||
return "PSI.SerializationManager";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initComponent() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disposeComponent() {
|
||||
public void dispose() {
|
||||
performShutdown();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
* 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.
|
||||
@@ -17,7 +17,6 @@ package com.intellij.ide;
|
||||
|
||||
import com.intellij.openapi.application.Application;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.components.ApplicationComponent;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.project.ProjectManager;
|
||||
import com.intellij.openapi.project.ProjectManagerAdapter;
|
||||
@@ -55,12 +54,13 @@ import java.util.EventListener;
|
||||
*
|
||||
* @author Vladimir Kondratyev
|
||||
*/
|
||||
public final class SwingCleanuper implements ApplicationComponent{
|
||||
public final class SwingCleanuper {
|
||||
private final Alarm myAlarm;
|
||||
|
||||
public SwingCleanuper(@NotNull Application application, ProjectManager projectManager) {
|
||||
myAlarm = new Alarm(application);
|
||||
projectManager.addProjectManagerListener(new ProjectManagerAdapter(){
|
||||
@Override
|
||||
public void projectOpened(final Project project) {
|
||||
myAlarm.cancelAllRequests();
|
||||
}
|
||||
@@ -68,6 +68,7 @@ public final class SwingCleanuper implements ApplicationComponent{
|
||||
// which is used to compose next focus event. Actually this component could be an editors or a tool window. To fix this
|
||||
// memory leak we (if the project was closed and a new one was not opened yet) request focus to the status bar and after
|
||||
// the focus events have passed the queue, we put 'null' to the DefaultKeyboardFocusManager.realOppositeComponent field.
|
||||
@Override
|
||||
public void projectClosed(final Project project){
|
||||
myAlarm.cancelAllRequests();
|
||||
myAlarm.addRequest(
|
||||
@@ -266,15 +267,6 @@ public final class SwingCleanuper implements ApplicationComponent{
|
||||
}
|
||||
}
|
||||
|
||||
public final void disposeComponent(){}
|
||||
|
||||
@NotNull
|
||||
public final String getComponentName(){
|
||||
return "SwingCleanuper";
|
||||
}
|
||||
|
||||
public final void initComponent() { }
|
||||
|
||||
private static void fixJTextComponentMemoryLeak() {
|
||||
final JTextComponent component = ReflectionUtil.getStaticFieldValue(JTextComponent.class, JTextComponent.class, "focusedComponent");
|
||||
if (component != null && !component.isDisplayable()){
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
* 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.
|
||||
@@ -29,6 +29,7 @@ import com.intellij.notification.Notification;
|
||||
import com.intellij.notification.NotificationListener;
|
||||
import com.intellij.notification.NotificationType;
|
||||
import com.intellij.notification.Notifications;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.components.*;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.project.Project;
|
||||
@@ -38,6 +39,7 @@ import com.intellij.openapi.ui.JBPopupMenu;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.openapi.ui.popup.util.PopupUtil;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.IconLoader;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
@@ -90,7 +92,7 @@ import java.util.List;
|
||||
@Storage(value = "options.xml", deprecated = true)
|
||||
}
|
||||
)
|
||||
public final class LafManagerImpl extends LafManager implements ApplicationComponent, PersistentStateComponent<Element> {
|
||||
public final class LafManagerImpl extends LafManager implements ApplicationComponentAdapter, PersistentStateComponent<Element>, Disposable {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.ide.ui.LafManager");
|
||||
|
||||
@NonNls private static final String ELEMENT_LAF = "laf";
|
||||
@@ -116,7 +118,6 @@ public final class LafManagerImpl extends LafManager implements ApplicationCompo
|
||||
private UIManager.LookAndFeelInfo myCurrentLaf;
|
||||
private final Map<UIManager.LookAndFeelInfo, HashMap<String, Object>> myStoredDefaults = ContainerUtil.newHashMap();
|
||||
private String myLastWarning = null;
|
||||
private PropertyChangeListener myThemeChangeListener = null;
|
||||
private static final Map<String, String> ourLafClassesAliases = ContainerUtil.newHashMap();
|
||||
|
||||
static {
|
||||
@@ -205,12 +206,6 @@ public final class LafManagerImpl extends LafManager implements ApplicationCompo
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getComponentName() {
|
||||
return "LafManager";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initComponent() {
|
||||
if (myCurrentLaf != null) {
|
||||
@@ -232,7 +227,7 @@ public final class LafManagerImpl extends LafManager implements ApplicationCompo
|
||||
updateUI();
|
||||
|
||||
if (SystemInfo.isXWindow) {
|
||||
myThemeChangeListener = new PropertyChangeListener() {
|
||||
PropertyChangeListener themeChangeListener = new PropertyChangeListener() {
|
||||
@Override
|
||||
public void propertyChange(final PropertyChangeEvent evt) {
|
||||
//noinspection SSBasedInspection
|
||||
@@ -242,16 +237,18 @@ public final class LafManagerImpl extends LafManager implements ApplicationCompo
|
||||
});
|
||||
}
|
||||
};
|
||||
Toolkit.getDefaultToolkit().addPropertyChangeListener(GNOME_THEME_PROPERTY_NAME, myThemeChangeListener);
|
||||
Toolkit.getDefaultToolkit().addPropertyChangeListener(GNOME_THEME_PROPERTY_NAME, themeChangeListener);
|
||||
Disposer.register(this, new Disposable() {
|
||||
@Override
|
||||
public void dispose() {
|
||||
Toolkit.getDefaultToolkit().removePropertyChangeListener(GNOME_THEME_PROPERTY_NAME, themeChangeListener);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disposeComponent() {
|
||||
if (myThemeChangeListener != null) {
|
||||
Toolkit.getDefaultToolkit().removePropertyChangeListener(GNOME_THEME_PROPERTY_NAME, myThemeChangeListener);
|
||||
myThemeChangeListener = null;
|
||||
}
|
||||
public void dispose() {
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* 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.
|
||||
@@ -25,7 +25,7 @@ import com.intellij.notification.NotificationDisplayType;
|
||||
import com.intellij.notification.NotificationsConfiguration;
|
||||
import com.intellij.notification.impl.NotificationsConfigurationImpl;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.components.ApplicationComponent;
|
||||
import com.intellij.openapi.components.ApplicationComponentAdapter;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.wm.WindowManager;
|
||||
import com.intellij.openapi.wm.ex.WindowManagerEx;
|
||||
@@ -38,7 +38,7 @@ import java.awt.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class SendStatisticsComponent implements ApplicationComponent {
|
||||
public class SendStatisticsComponent implements ApplicationComponentAdapter {
|
||||
|
||||
private static final Logger LOG = Logger.getInstance(SendStatisticsComponent.class);
|
||||
|
||||
@@ -107,14 +107,4 @@ public class SendStatisticsComponent implements ApplicationComponent {
|
||||
|
||||
runStatisticsService();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disposeComponent() {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getComponentName() {
|
||||
return SendStatisticsComponent.class.getName();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
* 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.
|
||||
@@ -18,7 +18,8 @@ package com.intellij.notification.impl;
|
||||
import com.intellij.notification.NotificationDisplayType;
|
||||
import com.intellij.notification.NotificationGroup;
|
||||
import com.intellij.notification.NotificationsConfiguration;
|
||||
import com.intellij.openapi.components.ApplicationComponent;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.components.ApplicationComponentAdapter;
|
||||
import com.intellij.openapi.components.PersistentStateComponent;
|
||||
import com.intellij.openapi.components.State;
|
||||
import com.intellij.openapi.components.Storage;
|
||||
@@ -42,9 +43,8 @@ import java.util.Map;
|
||||
name = "NotificationConfiguration",
|
||||
storages = @Storage("notifications.xml")
|
||||
)
|
||||
public class NotificationsConfigurationImpl
|
||||
extends NotificationsConfiguration
|
||||
implements ApplicationComponent, PersistentStateComponent<Element> {
|
||||
public class NotificationsConfigurationImpl extends NotificationsConfiguration implements ApplicationComponentAdapter, PersistentStateComponent<Element>,
|
||||
Disposable {
|
||||
|
||||
private static final Logger LOG = Logger.getInstance(NotificationsConfiguration.class);
|
||||
private static final String SHOW_BALLOONS_ATTRIBUTE = "showBalloons";
|
||||
@@ -119,24 +119,20 @@ public class NotificationsConfigurationImpl
|
||||
return new NotificationSettings(groupId, NotificationDisplayType.BALLOON, true, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getComponentName() {
|
||||
return "NotificationsConfiguration";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initComponent() {
|
||||
myMessageBus.connect().subscribe(TOPIC, this);
|
||||
myMessageBus.connect(this).subscribe(TOPIC, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void disposeComponent() {
|
||||
public synchronized void dispose() {
|
||||
myIdToSettingsMap.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void register(@NotNull final String groupDisplayName, @NotNull final NotificationDisplayType displayType) {
|
||||
public void register(@NotNull
|
||||
final String groupDisplayName, @NotNull
|
||||
final NotificationDisplayType displayType) {
|
||||
register(groupDisplayName, displayType, true);
|
||||
}
|
||||
|
||||
@@ -180,7 +176,8 @@ public class NotificationsConfigurationImpl
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized boolean isRegistered(@NotNull final String id) {
|
||||
public synchronized boolean isRegistered(@NotNull
|
||||
final String id) {
|
||||
return myIdToSettingsMap.containsKey(id) || NotificationGroup.findRegisteredGroup(id) != null;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
* 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.
|
||||
@@ -25,14 +25,14 @@ import com.intellij.openapi.actionSystem.DataContext
|
||||
import com.intellij.openapi.actionSystem.DefaultActionGroup
|
||||
import com.intellij.openapi.actionSystem.impl.BundledQuickListsProvider
|
||||
import com.intellij.openapi.application.ApplicationManager
|
||||
import com.intellij.openapi.components.ApplicationComponent
|
||||
import com.intellij.openapi.components.ApplicationComponentAdapter
|
||||
import com.intellij.openapi.options.SchemeManager
|
||||
import com.intellij.openapi.options.SchemeManagerFactory
|
||||
import com.intellij.openapi.project.Project
|
||||
import gnu.trove.THashSet
|
||||
import java.util.function.Function
|
||||
|
||||
class QuickListsManager(private val myActionManager: ActionManager, schemeManagerFactory: SchemeManagerFactory) : ApplicationComponent {
|
||||
class QuickListsManager(private val myActionManager: ActionManager, schemeManagerFactory: SchemeManagerFactory) : ApplicationComponentAdapter {
|
||||
private val mySchemeManager: SchemeManager<QuickList>
|
||||
|
||||
init {
|
||||
@@ -56,8 +56,6 @@ class QuickListsManager(private val myActionManager: ActionManager, schemeManage
|
||||
get() = ApplicationManager.getApplication().getComponent(QuickListsManager::class.java)
|
||||
}
|
||||
|
||||
override fun getComponentName() = "QuickListsManager"
|
||||
|
||||
override fun initComponent() {
|
||||
for (provider in BundledQuickListsProvider.EP_NAME.extensions) {
|
||||
for (path in provider.bundledListsRelativePaths) {
|
||||
@@ -68,9 +66,6 @@ class QuickListsManager(private val myActionManager: ActionManager, schemeManage
|
||||
registerActions()
|
||||
}
|
||||
|
||||
override fun disposeComponent() {
|
||||
}
|
||||
|
||||
val schemeManager: SchemeManager<QuickList>
|
||||
get() = mySchemeManager
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
* 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.
|
||||
@@ -15,7 +15,8 @@
|
||||
*/
|
||||
package com.intellij.openapi.application;
|
||||
|
||||
import com.intellij.openapi.components.ApplicationComponent;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.components.ApplicationComponentAdapter;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.progress.ProcessCanceledException;
|
||||
import com.intellij.openapi.progress.ProgressIndicator;
|
||||
@@ -25,14 +26,13 @@ import com.intellij.openapi.progress.util.ProgressIndicatorBase;
|
||||
import com.intellij.util.TimeoutUtil;
|
||||
import com.intellij.util.concurrency.SequentialTaskExecutor;
|
||||
import com.intellij.util.io.storage.HeavyProcessLatch;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.concurrent.Executor;
|
||||
|
||||
/**
|
||||
* @author peter
|
||||
*/
|
||||
public class Preloader implements ApplicationComponent {
|
||||
public class Preloader implements ApplicationComponentAdapter, Disposable {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.application.Preloader");
|
||||
private final Executor myExecutor = SequentialTaskExecutor.createSequentialApplicationPoolExecutor("com.intellij.openapi.application.Preloader pool");
|
||||
private final ProgressIndicator myIndicator = new ProgressIndicatorBase();
|
||||
@@ -82,13 +82,7 @@ public class Preloader implements ApplicationComponent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disposeComponent() {
|
||||
public void dispose() {
|
||||
myIndicator.cancel();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getComponentName() {
|
||||
return "Preloader";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* 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.
|
||||
@@ -24,8 +24,6 @@ import com.intellij.openapi.application.Application;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.command.*;
|
||||
import com.intellij.openapi.command.undo.*;
|
||||
import com.intellij.openapi.components.ApplicationComponent;
|
||||
import com.intellij.openapi.components.ProjectComponent;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
@@ -56,7 +54,7 @@ import java.awt.*;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
|
||||
public class UndoManagerImpl extends UndoManager implements ProjectComponent, ApplicationComponent, Disposable {
|
||||
public class UndoManagerImpl extends UndoManager implements Disposable {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.command.impl.UndoManagerImpl");
|
||||
|
||||
private static final int COMMANDS_TO_KEEP_LIVE_QUEUES = 100;
|
||||
@@ -114,33 +112,11 @@ public class UndoManagerImpl extends UndoManager implements ProjectComponent, Ap
|
||||
myMerger = new CommandMerger(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getComponentName() {
|
||||
return "UndoManager";
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Project getProject() {
|
||||
return myProject;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initComponent() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void projectOpened() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void projectClosed() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disposeComponent() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
* 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.
|
||||
@@ -22,7 +22,7 @@ import com.intellij.openapi.actionSystem.*;
|
||||
import com.intellij.openapi.actionSystem.ex.ActionManagerEx;
|
||||
import com.intellij.openapi.actionSystem.ex.AnActionListener;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.components.ApplicationComponent;
|
||||
import com.intellij.openapi.components.ApplicationComponentAdapter;
|
||||
import com.intellij.openapi.keymap.KeymapManager;
|
||||
import com.intellij.openapi.util.Clock;
|
||||
import com.intellij.openapi.util.Couple;
|
||||
@@ -48,7 +48,7 @@ import java.util.concurrent.atomic.AtomicLong;
|
||||
* functionality (invoked on double Shift), so if you need to change them, please make sure
|
||||
* SearchEverywhere behaviour remains intact.
|
||||
*/
|
||||
public class ModifierKeyDoubleClickHandler extends ApplicationComponent.Adapter {
|
||||
public class ModifierKeyDoubleClickHandler implements Disposable, ApplicationComponentAdapter {
|
||||
private static final TIntIntHashMap KEY_CODE_TO_MODIFIER_MAP = new TIntIntHashMap();
|
||||
static {
|
||||
KEY_CODE_TO_MODIFIER_MAP.put(KeyEvent.VK_ALT, InputEvent.ALT_MASK);
|
||||
@@ -77,7 +77,7 @@ public class ModifierKeyDoubleClickHandler extends ApplicationComponent.Adapter
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disposeComponent() {
|
||||
public void dispose() {
|
||||
for (MyDispatcher dispatcher : myDispatchers.values()) {
|
||||
Disposer.dispose(dispatcher);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
* 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.
|
||||
@@ -20,12 +20,13 @@ import com.intellij.ide.IdeBundle;
|
||||
import com.intellij.notification.Notification;
|
||||
import com.intellij.notification.NotificationListener;
|
||||
import com.intellij.notification.NotificationType;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.application.Application;
|
||||
import com.intellij.openapi.application.ApplicationInfo;
|
||||
import com.intellij.openapi.application.ConfigImportHelper;
|
||||
import com.intellij.openapi.application.ModalityState;
|
||||
import com.intellij.openapi.application.ex.ApplicationInfoEx;
|
||||
import com.intellij.openapi.components.ApplicationComponent;
|
||||
import com.intellij.openapi.components.ApplicationComponentAdapter;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.options.ShowSettingsUtil;
|
||||
import com.intellij.openapi.progress.ProgressIndicator;
|
||||
@@ -44,7 +45,7 @@ import javax.swing.event.HyperlinkEvent;
|
||||
/**
|
||||
* @author yole
|
||||
*/
|
||||
public class UpdateCheckerComponent implements ApplicationComponent {
|
||||
public class UpdateCheckerComponent implements ApplicationComponentAdapter, Disposable {
|
||||
private static final Logger LOG = Logger.getInstance(UpdateCheckerComponent.class);
|
||||
|
||||
private static final long CHECK_INTERVAL = DateFormatUtil.DAY;
|
||||
@@ -54,6 +55,8 @@ public class UpdateCheckerComponent implements ApplicationComponent {
|
||||
private final UpdateSettings mySettings;
|
||||
|
||||
public UpdateCheckerComponent(@NotNull Application app, @NotNull UpdateSettings settings) {
|
||||
Disposer.register(this, myCheckForUpdatesAlarm);
|
||||
|
||||
mySettings = settings;
|
||||
updateDefaultChannel();
|
||||
checkSecureConnection(app);
|
||||
@@ -139,14 +142,7 @@ public class UpdateCheckerComponent implements ApplicationComponent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disposeComponent() {
|
||||
Disposer.dispose(myCheckForUpdatesAlarm);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getComponentName() {
|
||||
return "UpdateCheckerComponent";
|
||||
public void dispose() {
|
||||
}
|
||||
|
||||
public void queueNextCheck() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* 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.
|
||||
@@ -21,15 +21,14 @@ package com.intellij.platform;
|
||||
|
||||
import com.intellij.ide.AppLifecycleListener;
|
||||
import com.intellij.idea.StartupUtil;
|
||||
import com.intellij.openapi.components.ApplicationComponent;
|
||||
import com.intellij.openapi.util.Ref;
|
||||
import com.intellij.util.messages.MessageBus;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class PlatformProjectStarter implements ApplicationComponent {
|
||||
public class PlatformProjectStarter {
|
||||
public PlatformProjectStarter(MessageBus bus) {
|
||||
bus.connect().subscribe(AppLifecycleListener.TOPIC, new AppLifecycleListener() {
|
||||
@Override
|
||||
public void appFrameCreated(final String[] commandLineArgs, @NotNull final Ref<Boolean> willOpenProject) {
|
||||
for (String arg : commandLineArgs) {
|
||||
if (!arg.equals(StartupUtil.NO_SPLASH)) {
|
||||
@@ -40,16 +39,4 @@ public class PlatformProjectStarter implements ApplicationComponent {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void disposeComponent() {
|
||||
}
|
||||
|
||||
@NonNls
|
||||
@NotNull
|
||||
public String getComponentName() {
|
||||
return "platform.ProjectStarter";
|
||||
}
|
||||
|
||||
public void initComponent() {
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* 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.
|
||||
@@ -24,7 +24,7 @@ package com.intellij.openapi.vcs.changes;
|
||||
|
||||
import com.intellij.AppTopics;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.components.ApplicationComponent;
|
||||
import com.intellij.openapi.components.ApplicationComponentAdapter;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.fileEditor.FileDocumentManager;
|
||||
import com.intellij.openapi.fileEditor.FileDocumentManagerAdapter;
|
||||
@@ -35,12 +35,10 @@ import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.vcs.changes.ui.CommitHelper;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class VetoSavingCommittingDocumentsAdapter implements ApplicationComponent {
|
||||
public class VetoSavingCommittingDocumentsAdapter implements ApplicationComponentAdapter {
|
||||
static final Object SAVE_DENIED = new Object();
|
||||
|
||||
private final FileDocumentManager myFileDocumentManager;
|
||||
@@ -49,11 +47,7 @@ public class VetoSavingCommittingDocumentsAdapter implements ApplicationComponen
|
||||
myFileDocumentManager = fileDocumentManager;
|
||||
}
|
||||
|
||||
@NonNls @NotNull
|
||||
public String getComponentName() {
|
||||
return "VetoSavingComittingDocumentsAdapter";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initComponent() {
|
||||
ApplicationManager.getApplication().getMessageBus().connect().subscribe(AppTopics.FILE_DOCUMENT_SYNC, new FileDocumentManagerAdapter() {
|
||||
@Override
|
||||
@@ -87,9 +81,6 @@ public class VetoSavingCommittingDocumentsAdapter implements ApplicationComponen
|
||||
}
|
||||
}
|
||||
|
||||
public void disposeComponent() {
|
||||
}
|
||||
|
||||
boolean showAllowSaveDialog(Map<Document, Project> documentsToWarn) {
|
||||
StringBuilder messageBuilder = new StringBuilder("The following " + (documentsToWarn.size() == 1 ? "file is" : "files are") +
|
||||
" currently being committed to the VCS. " +
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
* 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.
|
||||
@@ -15,32 +15,27 @@
|
||||
*/
|
||||
package com.intellij.openapi.vcs.changes.patch;
|
||||
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.application.ApplicationActivationListener;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.ClipboardAnalyzeListener;
|
||||
import com.intellij.openapi.application.ex.ApplicationManagerEx;
|
||||
import com.intellij.openapi.components.ApplicationComponent;
|
||||
import com.intellij.openapi.components.ApplicationComponentAdapter;
|
||||
import com.intellij.openapi.diff.impl.patch.PatchReader;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.vcs.VcsApplicationSettings;
|
||||
import com.intellij.openapi.wm.IdeFrame;
|
||||
import com.intellij.util.messages.MessageBusConnection;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
|
||||
public class PatchClipboardTracker extends ApplicationComponent.Adapter {
|
||||
public class PatchClipboardTracker implements ApplicationComponentAdapter, Disposable {
|
||||
private static final PatchClipboardListener LISTENER = new PatchClipboardListener();
|
||||
private MessageBusConnection myConnection;
|
||||
|
||||
@Override
|
||||
public void initComponent() {
|
||||
myConnection = ApplicationManagerEx.getApplicationEx().getMessageBus().connect();
|
||||
myConnection.subscribe(ApplicationActivationListener.TOPIC, LISTENER);
|
||||
ApplicationManager.getApplication().getMessageBus().connect(this).subscribe(ApplicationActivationListener.TOPIC, LISTENER);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disposeComponent() {
|
||||
myConnection.disconnect();
|
||||
myConnection = null;
|
||||
public void dispose() {
|
||||
}
|
||||
|
||||
private static class PatchClipboardListener extends ClipboardAnalyzeListener {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.intellij.promoter;
|
||||
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.actionSystem.ActionManager;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
@@ -9,7 +10,6 @@ import com.intellij.openapi.components.*;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import gnu.trove.THashMap;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.awt.event.InputEvent;
|
||||
@@ -24,7 +24,7 @@ import java.util.Map;
|
||||
name = "ShortcutPromoterManager",
|
||||
storages = @Storage(value = "promoter.xml", roamingType = RoamingType.PER_OS)
|
||||
)
|
||||
public class ShortcutPromoterManager implements ApplicationComponent, AnActionListener, PersistentStateComponent<Element> {
|
||||
public class ShortcutPromoterManager implements ApplicationComponentAdapter, Disposable, AnActionListener, PersistentStateComponent<Element> {
|
||||
private final Map<String, PromoterState> myState = new LinkedHashMap<>();
|
||||
private final Map<String, ShortcutPromoterEP> myExtensions = new THashMap<>();
|
||||
|
||||
@@ -40,16 +40,10 @@ public class ShortcutPromoterManager implements ApplicationComponent, AnActionLi
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disposeComponent() {
|
||||
public void dispose() {
|
||||
ActionManager.getInstance().removeAnActionListener(this);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getComponentName() {
|
||||
return getClass().getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeActionPerformed(AnAction action, DataContext dataContext, AnActionEvent event) {
|
||||
final InputEvent input = event.getInputEvent();
|
||||
|
||||
@@ -21,7 +21,7 @@ import com.intellij.codeInsight.hint.HintUtil;
|
||||
import com.intellij.codeInsight.template.impl.DefaultLiveTemplatesProvider;
|
||||
import com.intellij.openapi.actionSystem.*;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.components.ApplicationComponent;
|
||||
import com.intellij.openapi.components.ApplicationComponentAdapter;
|
||||
import com.intellij.openapi.components.PersistentStateComponent;
|
||||
import com.intellij.openapi.components.State;
|
||||
import com.intellij.openapi.components.Storage;
|
||||
@@ -56,7 +56,7 @@ import java.util.List;
|
||||
@Storage(value = "other.xml", deprecated = true)
|
||||
}
|
||||
)
|
||||
public class XPathAppComponent implements ApplicationComponent, PersistentStateComponent<Config>, DefaultLiveTemplatesProvider {
|
||||
public class XPathAppComponent implements ApplicationComponentAdapter, PersistentStateComponent<Config>, DefaultLiveTemplatesProvider {
|
||||
private static final String ACTION_FIND_NEXT = "FindNext";
|
||||
private static final String ACTION_FIND_PREVIOUS = "FindPrevious";
|
||||
|
||||
@@ -65,12 +65,6 @@ public class XPathAppComponent implements ApplicationComponent, PersistentStateC
|
||||
|
||||
private Config configuration = new Config();
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getComponentName() {
|
||||
return "XPathView.XPathViewPlugin";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initComponent() {
|
||||
ActionManager actionManager = ActionManager.getInstance();
|
||||
@@ -85,15 +79,15 @@ public class XPathAppComponent implements ApplicationComponent, PersistentStateC
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disposeComponent() {
|
||||
//@Override
|
||||
//public void dispose() {
|
||||
// IDEA-97697
|
||||
// final ActionManager actionManager = ActionManager.getInstance();
|
||||
// actionManager.unregisterAction(ACTION_FIND_NEXT);
|
||||
// actionManager.unregisterAction(ACTION_FIND_PREVIOUS);
|
||||
// actionManager.registerAction(ACTION_FIND_NEXT, nextAction);
|
||||
// actionManager.registerAction(ACTION_FIND_PREVIOUS, prevAction);
|
||||
}
|
||||
//}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* 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.
|
||||
@@ -15,9 +15,9 @@
|
||||
*/
|
||||
package com.jetbrains.python.facet;
|
||||
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.ModalityState;
|
||||
import com.intellij.openapi.components.ApplicationComponent;
|
||||
import com.intellij.openapi.projectRoots.ProjectJdkTable;
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.openapi.roots.ModifiableModelsProvider;
|
||||
@@ -26,14 +26,14 @@ import com.intellij.openapi.roots.libraries.Library;
|
||||
import com.intellij.openapi.roots.libraries.LibraryTable;
|
||||
import com.intellij.util.messages.MessageBus;
|
||||
import com.jetbrains.python.sdk.PythonSdkType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author yole
|
||||
*/
|
||||
public class PythonSdkTableListener implements ApplicationComponent {
|
||||
public class PythonSdkTableListener implements Disposable {
|
||||
public PythonSdkTableListener(MessageBus messageBus) {
|
||||
ProjectJdkTable.Listener jdkTableListener = new ProjectJdkTable.Listener() {
|
||||
@Override
|
||||
public void jdkAdded(final Sdk sdk) {
|
||||
if (sdk.getSdkType() instanceof PythonSdkType) {
|
||||
ApplicationManager.getApplication().invokeLater(() -> ApplicationManager.getApplication().runWriteAction(() -> {
|
||||
@@ -42,19 +42,21 @@ public class PythonSdkTableListener implements ApplicationComponent {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void jdkRemoved(final Sdk sdk) {
|
||||
if (sdk.getSdkType() instanceof PythonSdkType) {
|
||||
removeLibrary(sdk);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void jdkNameChanged(final Sdk sdk, final String previousName) {
|
||||
if (sdk.getSdkType() instanceof PythonSdkType) {
|
||||
renameLibrary(sdk, previousName);
|
||||
}
|
||||
}
|
||||
};
|
||||
messageBus.connect().subscribe(ProjectJdkTable.JDK_TABLE_TOPIC, jdkTableListener);
|
||||
messageBus.connect(this).subscribe(ProjectJdkTable.JDK_TABLE_TOPIC, jdkTableListener);
|
||||
}
|
||||
|
||||
static Library addLibrary(Sdk sdk) {
|
||||
@@ -96,14 +98,7 @@ public class PythonSdkTableListener implements ApplicationComponent {
|
||||
}), ModalityState.NON_MODAL);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String getComponentName() {
|
||||
return "PythonSdkTableListener";
|
||||
}
|
||||
|
||||
public void initComponent() {
|
||||
}
|
||||
|
||||
public void disposeComponent() {
|
||||
@Override
|
||||
public void dispose() {
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user