cleanup: disposeComponent — remove empty dummy impl

This commit is contained in:
Vladimir Krivosheev
2017-04-05 17:40:40 +02:00
parent 9498a9f85d
commit 26b528ecb8
6 changed files with 48 additions and 114 deletions
@@ -37,7 +37,10 @@ import com.intellij.openapi.roots.WatchedRootsProvider;
import com.intellij.openapi.startup.StartupManager;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.vfs.*;
import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.StandardFileSystems;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.VirtualFileManager;
import com.intellij.openapi.vfs.ex.VirtualFileManagerAdapter;
import com.intellij.openapi.vfs.newvfs.NewVirtualFile;
import com.intellij.openapi.vfs.pointers.VirtualFilePointer;
@@ -115,16 +118,6 @@ public class ProjectRootManagerComponent extends ProjectRootManagerImpl implemen
myDoLogCachesUpdate = ApplicationManager.getApplication().isInternal() && !ApplicationManager.getApplication().isUnitTestMode();
}
@Override
public void disposeComponent() {
}
@NotNull
@Override
public String getComponentName() {
return "ProjectRootManager";
}
@Override
public void initComponent() {
myConnection.subscribe(BatchUpdateListener.TOPIC, myHandler);
@@ -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.
@@ -28,7 +28,6 @@ import com.intellij.openapi.vcs.impl.DefaultVcsRootPolicy;
import com.intellij.openapi.vcs.impl.ProjectLevelVcsManagerImpl;
import com.intellij.openapi.vcs.impl.VcsInitObject;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.Function;
import com.intellij.util.ReflectionUtil;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.containers.MultiMap;
@@ -69,23 +68,21 @@ public class VcsDirtyScopeManagerImpl extends VcsDirtyScopeManager implements Pr
@Override
public void projectOpened() {
myVcsManager.addInitializationRequest(VcsInitObject.DIRTY_SCOPE_MANAGER, new Runnable() {
@Override
public void run() {
boolean ready = false;
synchronized (LOCK) {
if (!myProject.isDisposed() && myProject.isOpen()) {
myReady = ready = true;
}
}
if (ready) {
VcsDirtyScopeVfsListener.install(myProject);
markEverythingDirty();
myVcsManager.addInitializationRequest(VcsInitObject.DIRTY_SCOPE_MANAGER, () -> {
boolean ready = false;
synchronized (LOCK) {
if (!myProject.isDisposed() && myProject.isOpen()) {
myReady = ready = true;
}
}
if (ready) {
VcsDirtyScopeVfsListener.install(myProject);
markEverythingDirty();
}
});
}
@Override
public void markEverythingDirty() {
if ((! myProject.isOpen()) || myProject.isDisposed() || myVcsManager.getAllActiveVcss().length == 0) return;
@@ -102,10 +99,6 @@ public class VcsDirtyScopeManagerImpl extends VcsDirtyScopeManager implements Pr
myChangeListManager.scheduleUpdate();
}
@Override
public void projectClosed() {
}
@Override
@NotNull @NonNls
public String getComponentName() {
@@ -113,8 +106,6 @@ public class VcsDirtyScopeManagerImpl extends VcsDirtyScopeManager implements Pr
}
@Override
public void initComponent() {}
public void disposeComponent() {
synchronized (LOCK) {
myReady = false;
@@ -178,6 +169,7 @@ public class VcsDirtyScopeManagerImpl extends VcsDirtyScopeManager implements Pr
}
}
@Override
public void filesDirty(@Nullable final Collection<VirtualFile> filesDirty, @Nullable final Collection<VirtualFile> dirsRecursivelyDirty) {
filePathsDirty(toFilePaths(filesDirty), toFilePaths(dirsRecursivelyDirty));
}
@@ -185,12 +177,7 @@ public class VcsDirtyScopeManagerImpl extends VcsDirtyScopeManager implements Pr
@NotNull
private static Collection<FilePath> toFilePaths(@Nullable Collection<VirtualFile> files) {
if (files == null) return Collections.emptyList();
return ContainerUtil.map(files, new Function<VirtualFile, FilePath>() {
@Override
public FilePath fun(VirtualFile virtualFile) {
return VcsUtil.getFilePath(virtualFile);
}
});
return ContainerUtil.map(files, virtualFile -> VcsUtil.getFilePath(virtualFile));
}
@Override
@@ -298,17 +285,7 @@ public class VcsDirtyScopeManagerImpl extends VcsDirtyScopeManager implements Pr
@NotNull
private static String toString(@NotNull final MultiMap<AbstractVcs, FilePath> filesByVcs) {
return StringUtil.join(filesByVcs.keySet(), new Function<AbstractVcs, String>() {
@Override
public String fun(@NotNull AbstractVcs vcs) {
return vcs.getName() + ": " + StringUtil.join(filesByVcs.get(vcs), new Function<FilePath, String>() {
@Override
public String fun(@NotNull FilePath path) {
return path.getPath();
}
}, "\n");
}
}, "\n");
return StringUtil.join(filesByVcs.keySet(), vcs -> vcs.getName() + ": " + StringUtil.join(filesByVcs.get(vcs), path -> path.getPath(), "\n"), "\n");
}
@Nullable
@@ -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.
@@ -121,6 +121,7 @@ public class ShelvedChangesViewManager implements ProjectComponent {
myContentManager = contentManager;
myShelveChangesManager = shelveChangesManager;
bus.connect().subscribe(ShelveChangesManager.SHELF_TOPIC, new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
myUpdatePending = true;
ApplicationManager.getApplication().invokeLater(() -> updateChangesContent(), ModalityState.NON_MODAL);
@@ -154,6 +155,7 @@ public class ShelvedChangesViewManager implements ProjectComponent {
}.installOn(myTree);
new TreeSpeedSearch(myTree, new Convertor<TreePath, String>() {
@Override
public String convert(TreePath o) {
final Object lc = o.getLastPathComponent();
final Object lastComponent = lc == null ? null : ((DefaultMutableTreeNode) lc).getUserObject();
@@ -174,6 +176,7 @@ public class ShelvedChangesViewManager implements ProjectComponent {
}, true);
}
@Override
public void projectOpened() {
StartupManager startupManager = StartupManager.getInstance(myProject);
if (startupManager == null) {
@@ -183,20 +186,12 @@ public class ShelvedChangesViewManager implements ProjectComponent {
startupManager.registerPostStartupActivity((DumbAwareRunnable)() -> updateChangesContent());
}
public void projectClosed() {
}
@Override
@NonNls @NotNull
public String getComponentName() {
return "ShelvedChangesViewManager";
}
public void initComponent() {
}
public void disposeComponent() {
}
private void updateChangesContent() {
myUpdatePending = false;
final List<ShelvedChangeList> changeLists = new ArrayList<>(myShelveChangesManager.getShelvedChangeLists());
@@ -457,6 +452,7 @@ public class ShelvedChangesViewManager implements ProjectComponent {
return ourInstance;
}
@Override
public int compare(final Object o1, final Object o2) {
final String path1 = getPath(o1);
final String path2 = getPath(o2);
@@ -503,6 +499,7 @@ public class ShelvedChangesViewManager implements ProjectComponent {
myIssueLinkRenderer = new IssueLinkRenderer(project, this);
}
@Override
public void customizeCellRenderer(@NotNull JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {
DefaultMutableTreeNode node = (DefaultMutableTreeNode) value;
Object nodeValue = node.getUserObject();
@@ -563,6 +560,7 @@ public class ShelvedChangesViewManager implements ProjectComponent {
private class MyShelveDeleteProvider implements DeleteProvider {
@Override
public void deleteElement(@NotNull DataContext dataContext) {
final Project project = CommonDataKeys.PROJECT.getData(dataContext);
if (project == null) return;
@@ -662,6 +660,7 @@ public class ShelvedChangesViewManager implements ProjectComponent {
}
}
@Override
public boolean canDeleteElement(@NotNull DataContext dataContext) {
return !getShelvedLists(dataContext).isEmpty();
}
@@ -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.
@@ -66,23 +66,12 @@ public class RestoreUpdateTree implements ProjectComponent, PersistentStateCompo
});
}
@Override
public void projectClosed() {
}
@Override
@NotNull
public String getComponentName() {
return "RestoreUpdateTree";
}
@Override
public void initComponent() { }
@Override
public void disposeComponent() {
}
@Nullable
@Override
public Element getState() {
@@ -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.
@@ -20,13 +20,10 @@ import com.intellij.openapi.components.ProjectComponent;
import com.intellij.openapi.project.DumbAwareRunnable;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.startup.StartupManager;
import com.intellij.openapi.util.Condition;
import com.intellij.openapi.vcs.AbstractVcs;
import com.intellij.openapi.vcs.VcsDirectoryMapping;
import com.intellij.openapi.vcs.impl.ProjectLevelVcsManagerImpl;
import com.intellij.openapi.vfs.VirtualFile;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
/**
* @author yole
@@ -40,8 +37,10 @@ public class PlatformVcsDetector implements ProjectComponent {
myVcsManager = vcsManager;
}
@Override
public void projectOpened() {
StartupManager.getInstance(myProject).runWhenProjectIsInitialized(new DumbAwareRunnable() {
@Override
public void run() {
final DumbAwareRunnable runnable = new DumbAwareRunnable() {
@Override
@@ -58,28 +57,8 @@ public class PlatformVcsDetector implements ProjectComponent {
}
}
};
ApplicationManager.getApplication().invokeLater(runnable, new Condition() {
@Override
public boolean value(Object o) {
return (! myProject.isOpen()) || myProject.isDisposed();
}
});
ApplicationManager.getApplication().invokeLater(runnable, o -> (! myProject.isOpen()) || myProject.isDisposed());
}
});
}
public void projectClosed() {
}
@NonNls
@NotNull
public String getComponentName() {
return "PlatformVcsDetector";
}
public void initComponent() {
}
public void disposeComponent() {
}
}
@@ -17,7 +17,10 @@ package org.jetbrains.idea.svn;
import com.intellij.lifecycle.PeriodicalTasksCloser;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.components.*;
import com.intellij.openapi.components.PersistentStateComponent;
import com.intellij.openapi.components.State;
import com.intellij.openapi.components.Storage;
import com.intellij.openapi.components.StoragePathMacros;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.progress.ProcessCanceledException;
import com.intellij.openapi.project.DumbAwareRunnable;
@@ -42,7 +45,7 @@ import java.util.List;
import java.util.Set;
@State(name = "SvnFileUrlMappingImpl", storages = @Storage(StoragePathMacros.WORKSPACE_FILE))
public class SvnFileUrlMappingImpl implements SvnFileUrlMapping, PersistentStateComponent<SvnMappingSavedPart>, ProjectComponent {
public class SvnFileUrlMappingImpl implements SvnFileUrlMapping, PersistentStateComponent<SvnMappingSavedPart> {
private static final Logger LOG = Logger.getInstance("#org.jetbrains.idea.svn.SvnFileUrlMappingImpl");
private final SvnCompatibilityChecker myChecker;
@@ -99,6 +102,7 @@ public class SvnFileUrlMappingImpl implements SvnFileUrlMapping, PersistentState
myNestedCopiesHolder = new NestedCopiesHolder();
}
@Override
@Nullable
public SVNURL getUrlForFile(final File file) {
final RootUrlInfo rootUrlInfo = getWcRootForFilePath(file);
@@ -125,6 +129,7 @@ public class SvnFileUrlMappingImpl implements SvnFileUrlMapping, PersistentState
}
}
@Override
@Nullable
public File getLocalPath(@NotNull String url) {
synchronized (myMonitor) {
@@ -141,6 +146,7 @@ public class SvnFileUrlMappingImpl implements SvnFileUrlMapping, PersistentState
}
}
@Override
@Nullable
public RootUrlInfo getWcRootForFilePath(final File file) {
synchronized (myMonitor) {
@@ -153,12 +159,14 @@ public class SvnFileUrlMappingImpl implements SvnFileUrlMapping, PersistentState
}
}
@Override
public boolean rootsDiffer() {
synchronized (myMonitor) {
return myMapping.isRootsDifferFromSettings();
}
}
@Override
@Nullable
public RootUrlInfo getWcRootForUrl(final String url) {
synchronized (myMonitor) {
@@ -180,6 +188,7 @@ public class SvnFileUrlMappingImpl implements SvnFileUrlMapping, PersistentState
* Returns real working copies roots - if there is <Project Root> -> Subversion setting,
* and there is one working copy, will return one root
*/
@Override
public List<RootUrlInfo> getAllWcInfos() {
synchronized (myMonitor) {
// a copy is created inside
@@ -194,6 +203,7 @@ public class SvnFileUrlMappingImpl implements SvnFileUrlMapping, PersistentState
}
}
@Override
@NotNull
public List<VirtualFile> convertRoots(@NotNull List<VirtualFile> result) {
if (MyRootsHelper.isInProgress()) return ContainerUtil.newArrayList(result);
@@ -316,17 +326,20 @@ public class SvnFileUrlMappingImpl implements SvnFileUrlMapping, PersistentState
}
}
@Override
@NotNull
public VirtualFile[] getNotFilteredRoots() {
return myRootsHelper.execute();
}
@Override
public boolean isEmpty() {
synchronized (myMonitor) {
return myMapping.isEmpty();
}
}
@Override
public SvnMappingSavedPart getState() {
final SvnMappingSavedPart result = new SvnMappingSavedPart();
@@ -353,6 +366,7 @@ public class SvnFileUrlMappingImpl implements SvnFileUrlMapping, PersistentState
return copy;
}
@Override
public void loadState(final SvnMappingSavedPart state) {
((ProjectLevelVcsManagerImpl) ProjectLevelVcsManager.getInstance(myProject)).addInitializationRequest(
VcsInitObject.AFTER_COMMON, (DumbAwareRunnable)() -> ApplicationManager.getApplication().executeOnPooledThread(() -> {
@@ -394,21 +408,4 @@ public class SvnFileUrlMappingImpl implements SvnFileUrlMapping, PersistentState
mapping.add(info);
}
}
public void projectOpened() {
}
public void projectClosed() {
}
@NotNull
public String getComponentName() {
return "SvnFileUrlMappingImpl";
}
public void initComponent() {
}
public void disposeComponent() {
}
}