mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[rev by D. Avdeed] ArtifactManager: service -> component
This commit is contained in:
+4
-2
@@ -65,11 +65,11 @@ public class ArtifactManagerImpl extends ArtifactManager implements ProjectCompo
|
||||
};
|
||||
private Map<String, LocalFileSystem.WatchRequest> myWatchedOutputs = new HashMap<String, LocalFileSystem.WatchRequest>();
|
||||
|
||||
public ArtifactManagerImpl(Project project, VirtualFileManager virtualFileManager) {
|
||||
public ArtifactManagerImpl(Project project) {
|
||||
myProject = project;
|
||||
myModel = new ArtifactManagerModel();
|
||||
myResolvingContext = new DefaultPackagingElementResolvingContext(myProject);
|
||||
virtualFileManager.addVirtualFileListener(new ArtifactVirtualFileListener(myProject, this), myProject);
|
||||
((ArtifactPointerManagerImpl)ArtifactPointerManager.getInstance(project)).setArtifactManager(this);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -225,6 +225,7 @@ public class ArtifactManagerImpl extends ArtifactManager implements ProjectCompo
|
||||
}
|
||||
|
||||
public void initComponent() {
|
||||
VirtualFileManager.getInstance().addVirtualFileListener(new ArtifactVirtualFileListener(myProject, this), myProject);
|
||||
updateWatchedRoots();
|
||||
}
|
||||
|
||||
@@ -326,6 +327,7 @@ public class ArtifactManagerImpl extends ArtifactManager implements ProjectCompo
|
||||
finally {
|
||||
myInsideCommit = false;
|
||||
}
|
||||
updateWatchedRoots();
|
||||
}
|
||||
|
||||
public Project getProject() {
|
||||
|
||||
+10
-5
@@ -29,10 +29,9 @@ import java.util.Map;
|
||||
public class ArtifactPointerManagerImpl extends ArtifactPointerManager {
|
||||
private final Map<String, ArtifactPointerImpl> myUnresolvedPointers = new HashMap<String, ArtifactPointerImpl>();
|
||||
private final Map<Artifact, ArtifactPointerImpl> myPointers = new HashMap<Artifact, ArtifactPointerImpl>();
|
||||
private final Project myProject;
|
||||
private ArtifactManager myArtifactManager;
|
||||
|
||||
public ArtifactPointerManagerImpl(Project project) {
|
||||
myProject = project;
|
||||
project.getMessageBus().connect().subscribe(ArtifactManager.TOPIC, new ArtifactAdapter() {
|
||||
@Override
|
||||
public void artifactRemoved(@NotNull Artifact artifact) {
|
||||
@@ -73,6 +72,10 @@ public class ArtifactPointerManagerImpl extends ArtifactPointerManager {
|
||||
});
|
||||
}
|
||||
|
||||
public void setArtifactManager(ArtifactManager artifactManager) {
|
||||
myArtifactManager = artifactManager;
|
||||
}
|
||||
|
||||
private void disposePointer(Artifact artifact) {
|
||||
final ArtifactPointerImpl pointer = myPointers.remove(artifact);
|
||||
if (pointer != null) {
|
||||
@@ -82,9 +85,11 @@ public class ArtifactPointerManagerImpl extends ArtifactPointerManager {
|
||||
}
|
||||
|
||||
public ArtifactPointer createPointer(@NotNull String name) {
|
||||
final Artifact artifact = ArtifactManager.getInstance(myProject).findArtifact(name);
|
||||
if (artifact != null) {
|
||||
return createPointer(artifact);
|
||||
if (myArtifactManager != null) {
|
||||
final Artifact artifact = myArtifactManager.findArtifact(name);
|
||||
if (artifact != null) {
|
||||
return createPointer(artifact);
|
||||
}
|
||||
}
|
||||
|
||||
ArtifactPointerImpl pointer = myUnresolvedPointers.get(name);
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
*/
|
||||
package com.intellij.packaging.artifacts;
|
||||
|
||||
import com.intellij.openapi.components.ServiceManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.ModificationTracker;
|
||||
import com.intellij.packaging.elements.CompositePackagingElement;
|
||||
@@ -41,7 +40,7 @@ public abstract class ArtifactManager implements ArtifactModel {
|
||||
};
|
||||
|
||||
public static ArtifactManager getInstance(@NotNull Project project) {
|
||||
return ServiceManager.getService(project, ArtifactManager.class);
|
||||
return project.getComponent(ArtifactManager.class);
|
||||
}
|
||||
|
||||
public abstract Artifact[] getSortedArtifacts();
|
||||
|
||||
@@ -344,8 +344,6 @@
|
||||
<applicationService serviceInterface="com.intellij.packaging.elements.PackagingElementFactory"
|
||||
serviceImplementation="com.intellij.packaging.impl.elements.PackagingElementFactoryImpl"/>
|
||||
|
||||
<projectService serviceInterface="com.intellij.packaging.artifacts.ArtifactManager"
|
||||
serviceImplementation="com.intellij.packaging.impl.artifacts.ArtifactManagerImpl"/>
|
||||
<projectService serviceInterface="com.intellij.packaging.artifacts.ArtifactPointerManager"
|
||||
serviceImplementation="com.intellij.packaging.impl.artifacts.ArtifactPointerManagerImpl"/>
|
||||
<projectService serviceInterface="com.intellij.packaging.impl.artifacts.ArtifactBySourceFileFinder"
|
||||
|
||||
@@ -6,6 +6,10 @@
|
||||
</application-components>
|
||||
|
||||
<project-components>
|
||||
<component>
|
||||
<interface-class>com.intellij.packaging.artifacts.ArtifactManager</interface-class>
|
||||
<implementation-class>com.intellij.packaging.impl.artifacts.ArtifactManagerImpl</implementation-class>
|
||||
</component>
|
||||
<component>
|
||||
<interface-class>com.intellij.compiler.CompilerConfiguration</interface-class>
|
||||
<implementation-class>com.intellij.compiler.CompilerConfigurationImpl</implementation-class>
|
||||
|
||||
Reference in New Issue
Block a user