mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
split JarDirectoryWatcher into interface, implementation and factory; remove cyclic dependencies of projectModel-impl
This commit is contained in:
+28
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright 2000-2012 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.openapi.roots.impl.libraries;
|
||||
|
||||
import com.intellij.openapi.roots.impl.RootProviderBaseImpl;
|
||||
|
||||
/**
|
||||
* @author yole
|
||||
*/
|
||||
public class JarDirectoryWatcherFactoryImpl extends JarDirectoryWatcherFactory {
|
||||
@Override
|
||||
public JarDirectoryWatcher createWatcher(JarDirectories jarDirectories, RootProviderBaseImpl rootProvider) {
|
||||
return new JarDirectoryWatcherImpl(jarDirectories, rootProvider);
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -15,7 +15,6 @@
|
||||
*/
|
||||
package com.intellij.openapi.roots.impl.libraries;
|
||||
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.roots.OrderRootType;
|
||||
import com.intellij.openapi.roots.impl.RootProviderBaseImpl;
|
||||
@@ -33,17 +32,18 @@ import java.util.*;
|
||||
/**
|
||||
* @author ksafonov
|
||||
*/
|
||||
public class JarDirectoryWatcher implements Disposable {
|
||||
public class JarDirectoryWatcherImpl implements JarDirectoryWatcher {
|
||||
private final JarDirectories myJarDirectories;
|
||||
private final RootProviderBaseImpl myRootProvider;
|
||||
private MessageBusConnection myBusConnection = null;
|
||||
private Collection<LocalFileSystem.WatchRequest> myWatchRequests = Collections.emptySet();
|
||||
|
||||
public JarDirectoryWatcher(JarDirectories jarDirectories, RootProviderBaseImpl rootProvider) {
|
||||
public JarDirectoryWatcherImpl(JarDirectories jarDirectories, RootProviderBaseImpl rootProvider) {
|
||||
myJarDirectories = jarDirectories;
|
||||
myRootProvider = rootProvider;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateWatchedRoots() {
|
||||
final LocalFileSystem fs = LocalFileSystem.getInstance();
|
||||
if (!myJarDirectories.isEmpty()) {
|
||||
@@ -168,6 +168,9 @@
|
||||
<applicationService serviceInterface="com.intellij.openapi.fileEditor.UniqueVFilePathBuilder"
|
||||
serviceImplementation="com.intellij.openapi.fileEditor.impl.UniqueVFilePathBuilderImpl"/>
|
||||
|
||||
<applicationService serviceInterface="com.intellij.openapi.roots.impl.libraries.JarDirectoryWatcherFactory"
|
||||
serviceImplementation="com.intellij.openapi.roots.impl.libraries.JarDirectoryWatcherFactoryImpl"/>
|
||||
|
||||
<projectService serviceInterface="com.intellij.ui.EditorTextFieldProvider"
|
||||
serviceImplementation="com.intellij.ui.EditorTextFieldProviderImpl"/>
|
||||
|
||||
|
||||
@@ -8,8 +8,6 @@
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="module" module-name="projectModel-api" exported="" />
|
||||
<orderEntry type="module" module-name="lang-impl" exported="" />
|
||||
<orderEntry type="module" module-name="platform-api" exported="" />
|
||||
</component>
|
||||
</module>
|
||||
|
||||
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright 2000-2012 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.openapi.roots.impl.libraries;
|
||||
|
||||
import com.intellij.openapi.Disposable;
|
||||
|
||||
/**
|
||||
* @author yole
|
||||
*/
|
||||
public interface JarDirectoryWatcher extends Disposable {
|
||||
void updateWatchedRoots();
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright 2000-2012 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.openapi.roots.impl.libraries;
|
||||
|
||||
import com.intellij.openapi.components.ServiceManager;
|
||||
import com.intellij.openapi.roots.impl.RootProviderBaseImpl;
|
||||
|
||||
/**
|
||||
* @author yole
|
||||
*/
|
||||
public class JarDirectoryWatcherFactory {
|
||||
public static JarDirectoryWatcherFactory getInstance() {
|
||||
final JarDirectoryWatcherFactory factory = ServiceManager.getService(JarDirectoryWatcherFactory.class);
|
||||
return factory != null ? factory : new JarDirectoryWatcherFactory();
|
||||
}
|
||||
|
||||
public JarDirectoryWatcher createWatcher(JarDirectories jarDirectories, RootProviderBaseImpl rootProvider) {
|
||||
return new JarDirectoryWatcher() {
|
||||
@Override
|
||||
public void updateWatchedRoots() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
+2
-1
@@ -73,7 +73,8 @@ public class LibraryImpl implements LibraryEx.ModifiableModelEx, LibraryEx {
|
||||
private final ModifiableRootModel myRootModel;
|
||||
private boolean myDisposed;
|
||||
private final Disposable myPointersDisposable = Disposer.newDisposable();
|
||||
private final JarDirectoryWatcher myRootsWatcher = new JarDirectoryWatcher(myJarDirectories, myRootProvider);
|
||||
private final JarDirectoryWatcher myRootsWatcher = JarDirectoryWatcherFactory.getInstance().createWatcher(myJarDirectories,
|
||||
myRootProvider);
|
||||
|
||||
LibraryImpl(LibraryTable table, Element element, ModifiableRootModel rootModel) throws InvalidDataException {
|
||||
myLibraryTable = table;
|
||||
|
||||
Reference in New Issue
Block a user