Convert ShelveChangesManager and ShelvedChangesViewManager components into services

GitOrigin-RevId: ceffc2c46fbb2afcd5f8a4bc6679d5a7e4b17483
This commit is contained in:
Daniil Tsaryov
2020-03-26 14:32:21 +00:00
committed by intellij-monorepo-bot
parent 3d59865c73
commit b9f49d2a3f
4 changed files with 21 additions and 14 deletions
@@ -53,6 +53,12 @@
serviceImplementation="com.intellij.openapi.vcs.impl.FileStatusManagerImpl"/>
<projectService serviceInterface="com.intellij.openapi.vcs.changes.ui.ChangesViewToolWindowManager"
serviceImplementation="com.intellij.openapi.vcs.changes.ui.ChangesViewToolWindowManagerImpl"/>
<projectService serviceImplementation="com.intellij.openapi.vcs.changes.shelf.ShelveChangesManager"/>
<postStartupActivity implementation="com.intellij.openapi.vcs.changes.shelf.ShelveChangesManager$PostStartupActivity"/>
<projectService serviceImplementation="com.intellij.openapi.vcs.changes.shelf.ShelvedChangesViewManager"
headlessImplementation=""/>
<fileDocumentManagerListener implementation="com.intellij.openapi.vcs.impl.FileStatusManagerImpl$FileStatusManagerDocumentListener"/>
<editorFactoryDocumentListener implementation="com.intellij.openapi.vcs.impl.FileStatusManagerImpl$FileStatusManagerDocumentListener"/>
@@ -22,15 +22,6 @@
<implementation-class>com.intellij.openapi.vcs.changes.patch.CreatePatchCommitExecutor</implementation-class>
<option name="workspace" value="true"/>
</component>
<component>
<implementation-class>com.intellij.openapi.vcs.changes.shelf.ShelveChangesManager</implementation-class>
<option name="workspace" value="true"/>
</component>
<component>
<implementation-class>com.intellij.openapi.vcs.changes.shelf.ShelvedChangesViewManager</implementation-class>
<headless-implementation-class/>
<option name="workspace" value="true"/>
</component>
<component>
<implementation-class>com.intellij.openapi.vcs.changes.VcsIgnoreFilesChecker</implementation-class>
</component>
@@ -21,6 +21,7 @@ import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.openapi.progress.ProgressManager;
import com.intellij.openapi.progress.Task;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.startup.StartupActivity;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.util.*;
import com.intellij.openapi.util.io.FileUtil;
@@ -79,8 +80,11 @@ import static com.intellij.openapi.vcs.changes.ui.ChangesViewContentManager.getT
import static com.intellij.util.containers.ContainerUtil.*;
import static java.util.Objects.requireNonNull;
@State(name = "ShelveChangesManager", storages = {@Storage(StoragePathMacros.WORKSPACE_FILE)})
public final class ShelveChangesManager implements PersistentStateComponent<Element>, ProjectComponent {
@State(
name = "ShelveChangesManager",
storages = @Storage(StoragePathMacros.WORKSPACE_FILE)
)
public final class ShelveChangesManager implements PersistentStateComponent<Element> {
private static final Logger LOG = Logger.getInstance(ShelveChangesManager.class);
@NonNls private static final String ELEMENT_CHANGELIST = "changelist";
@NonNls private static final String ELEMENT_RECYCLED_CHANGELIST = "recycled_changelist";
@@ -101,7 +105,7 @@ public final class ShelveChangesManager implements PersistentStateComponent<Elem
@Nullable private Set<VirtualFile> myShelvingFiles;
public static ShelveChangesManager getInstance(@NotNull Project project) {
return project.getComponent(ShelveChangesManager.class);
return project.getService(ShelveChangesManager.class);
}
public static final class State {
@@ -210,7 +214,6 @@ public final class ShelveChangesManager implements PersistentStateComponent<Elem
}, null, customPath != null ? Paths.get(customPath) : null);
}
@Override
public void projectOpened() {
try {
mySchemeManager.loadSchemes();
@@ -1380,4 +1383,11 @@ public final class ShelveChangesManager implements PersistentStateComponent<Elem
public void setGrouping(@NotNull Set<String> grouping) {
myState.groupingKeys = grouping;
}
public static class PostStartupActivity implements StartupActivity.DumbAware {
@Override
public void runActivity(@NotNull Project project) {
getInstance(project).projectOpened();
}
}
}
@@ -115,7 +115,7 @@ public class ShelvedChangesViewManager implements Disposable {
public static final DataKey<List<ShelvedBinaryFile>> SHELVED_BINARY_FILE_KEY = DataKey.create("ShelveChangesManager.ShelvedBinaryFile");
public static ShelvedChangesViewManager getInstance(Project project) {
return project.getComponent(ShelvedChangesViewManager.class);
return project.getService(ShelvedChangesViewManager.class);
}
public ShelvedChangesViewManager(Project project) {