mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-08 06:39:38 +07:00
notnull
This commit is contained in:
@@ -29,8 +29,9 @@ public interface RootProvider {
|
||||
@NotNull String[] getUrls(@NotNull OrderRootType rootType);
|
||||
@NotNull VirtualFile[] getFiles(@NotNull OrderRootType rootType);
|
||||
|
||||
@FunctionalInterface
|
||||
interface RootSetChangedListener extends EventListener {
|
||||
void rootSetChanged(RootProvider wrapper);
|
||||
void rootSetChanged(@NotNull RootProvider wrapper);
|
||||
}
|
||||
|
||||
void addRootSetChangedListener(@NotNull RootSetChangedListener listener);
|
||||
|
||||
@@ -24,7 +24,7 @@ import java.util.EventListener;
|
||||
import java.util.Iterator;
|
||||
|
||||
/**
|
||||
* @see com.intellij.openapi.roots.libraries.LibraryTablesRegistrar#getLibraryTable(com.intellij.openapi.project.Project)
|
||||
* @see LibraryTablesRegistrar#getLibraryTable(com.intellij.openapi.project.Project)
|
||||
* @author dsl
|
||||
*/
|
||||
public interface LibraryTable {
|
||||
@@ -73,27 +73,29 @@ public interface LibraryTable {
|
||||
|
||||
void commit();
|
||||
|
||||
@NotNull Iterator<Library> getLibraryIterator();
|
||||
@NotNull
|
||||
Iterator<Library> getLibraryIterator();
|
||||
|
||||
@Nullable
|
||||
Library getLibraryByName(@NotNull String name);
|
||||
|
||||
@NotNull Library[] getLibraries();
|
||||
@NotNull
|
||||
Library[] getLibraries();
|
||||
|
||||
boolean isChanged();
|
||||
}
|
||||
|
||||
interface Listener extends EventListener {
|
||||
default void afterLibraryAdded(Library newLibrary) {
|
||||
default void afterLibraryAdded(@NotNull Library newLibrary) {
|
||||
}
|
||||
|
||||
default void afterLibraryRenamed(Library library) {
|
||||
default void afterLibraryRenamed(@NotNull Library library) {
|
||||
}
|
||||
|
||||
default void beforeLibraryRemoved(Library library) {
|
||||
default void beforeLibraryRemoved(@NotNull Library library) {
|
||||
}
|
||||
|
||||
default void afterLibraryRemoved(Library library) {
|
||||
default void afterLibraryRemoved(@NotNull Library library) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -275,7 +275,7 @@ class LibraryOrderEntryImpl extends LibraryOrderEntryBaseImpl implements Library
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeLibraryRemoved(Library library) {
|
||||
public void beforeLibraryRemoved(@NotNull Library library) {
|
||||
LibraryOrderEntryImpl.this.beforeLibraryRemoved(library);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ public class ProjectRootManagerImpl extends ProjectRootManagerEx implements Pers
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.projectRoots.impl.ProjectRootManagerImpl");
|
||||
|
||||
@NonNls public static final String PROJECT_JDK_NAME_ATTR = "project-jdk-name";
|
||||
@NonNls public static final String PROJECT_JDK_TYPE_ATTR = "project-jdk-type";
|
||||
@NonNls private static final String PROJECT_JDK_TYPE_ATTR = "project-jdk-type";
|
||||
|
||||
protected final Project myProject;
|
||||
|
||||
@@ -93,7 +93,7 @@ public class ProjectRootManagerImpl extends ProjectRootManagerEx implements Pers
|
||||
myBatchLevel -= 1;
|
||||
if (myChanged && myBatchLevel == 0) {
|
||||
try {
|
||||
WriteAction.run(() -> fireChange());
|
||||
WriteAction.run(this::fireChange);
|
||||
}
|
||||
finally {
|
||||
myChanged = false;
|
||||
@@ -442,7 +442,7 @@ public class ProjectRootManagerImpl extends ProjectRootManagerEx implements Pers
|
||||
return ModuleManager.getInstance(myProject);
|
||||
}
|
||||
|
||||
void subscribeToRootProvider(OrderEntry owner, final RootProvider provider) {
|
||||
void subscribeToRootProvider(@NotNull OrderEntry owner, @NotNull RootProvider provider) {
|
||||
Set<OrderEntry> owners = myRegisteredRootProviders.get(provider);
|
||||
if (owners == null) {
|
||||
owners = new HashSet<>();
|
||||
@@ -452,7 +452,7 @@ public class ProjectRootManagerImpl extends ProjectRootManagerEx implements Pers
|
||||
owners.add(owner);
|
||||
}
|
||||
|
||||
void unsubscribeFromRootProvider(OrderEntry owner, final RootProvider provider) {
|
||||
void unsubscribeFromRootProvider(@NotNull OrderEntry owner, @NotNull RootProvider provider) {
|
||||
Set<OrderEntry> owners = myRegisteredRootProviders.get(provider);
|
||||
if (owners != null) {
|
||||
owners.remove(owner);
|
||||
@@ -463,8 +463,7 @@ public class ProjectRootManagerImpl extends ProjectRootManagerEx implements Pers
|
||||
}
|
||||
}
|
||||
|
||||
void addListenerForTable(LibraryTable.Listener libraryListener,
|
||||
final LibraryTable libraryTable) {
|
||||
void addListenerForTable(@NotNull LibraryTable.Listener libraryListener, @NotNull LibraryTable libraryTable) {
|
||||
synchronized (myLibraryTableListenersLock) {
|
||||
LibraryTableMultiListener multiListener = myLibraryTableMultiListeners.get(libraryTable);
|
||||
if (multiListener == null) {
|
||||
@@ -476,8 +475,7 @@ public class ProjectRootManagerImpl extends ProjectRootManagerEx implements Pers
|
||||
}
|
||||
}
|
||||
|
||||
void removeListenerForTable(LibraryTable.Listener libraryListener,
|
||||
final LibraryTable libraryTable) {
|
||||
void removeListenerForTable(@NotNull LibraryTable.Listener libraryListener, @NotNull LibraryTable libraryTable) {
|
||||
synchronized (myLibraryTableListenersLock) {
|
||||
LibraryTableMultiListener multiListener = myLibraryTableMultiListeners.get(libraryTable);
|
||||
if (multiListener != null) {
|
||||
@@ -497,19 +495,19 @@ public class ProjectRootManagerImpl extends ProjectRootManagerEx implements Pers
|
||||
private final Set<LibraryTable.Listener> myListeners = new LinkedHashSet<>();
|
||||
private LibraryTable.Listener[] myListenersArray;
|
||||
|
||||
private synchronized void addListener(LibraryTable.Listener listener) {
|
||||
private synchronized void addListener(@NotNull LibraryTable.Listener listener) {
|
||||
myListeners.add(listener);
|
||||
myListenersArray = null;
|
||||
}
|
||||
|
||||
private synchronized boolean removeListener(LibraryTable.Listener listener) {
|
||||
private synchronized boolean removeListener(@NotNull LibraryTable.Listener listener) {
|
||||
myListeners.remove(listener);
|
||||
myListenersArray = null;
|
||||
return myListeners.isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterLibraryAdded(final Library newLibrary) {
|
||||
public void afterLibraryAdded(@NotNull final Library newLibrary) {
|
||||
incModificationCount();
|
||||
mergeRootsChangesDuring(() -> {
|
||||
for (LibraryTable.Listener listener : getListeners()) {
|
||||
@@ -526,7 +524,7 @@ public class ProjectRootManagerImpl extends ProjectRootManagerEx implements Pers
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterLibraryRenamed(final Library library) {
|
||||
public void afterLibraryRenamed(@NotNull final Library library) {
|
||||
incModificationCount();
|
||||
mergeRootsChangesDuring(() -> {
|
||||
for (LibraryTable.Listener listener : getListeners()) {
|
||||
@@ -536,7 +534,7 @@ public class ProjectRootManagerImpl extends ProjectRootManagerEx implements Pers
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeLibraryRemoved(final Library library) {
|
||||
public void beforeLibraryRemoved(@NotNull final Library library) {
|
||||
incModificationCount();
|
||||
mergeRootsChangesDuring(() -> {
|
||||
for (LibraryTable.Listener listener : getListeners()) {
|
||||
@@ -546,7 +544,7 @@ public class ProjectRootManagerImpl extends ProjectRootManagerEx implements Pers
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterLibraryRemoved(final Library library) {
|
||||
public void afterLibraryRemoved(@NotNull final Library library) {
|
||||
incModificationCount();
|
||||
mergeRootsChangesDuring(() -> {
|
||||
for (LibraryTable.Listener listener : getListeners()) {
|
||||
@@ -629,7 +627,7 @@ public class ProjectRootManagerImpl extends ProjectRootManagerEx implements Pers
|
||||
myJdkTableMultiListener.removeListener(jdkTableListener);
|
||||
}
|
||||
|
||||
protected void assertListenersAreDisposed() {
|
||||
void assertListenersAreDisposed() {
|
||||
if (!myRegisteredRootProviders.isEmpty()) {
|
||||
StringBuilder details = new StringBuilder();
|
||||
for (Map.Entry<RootProvider, Set<OrderEntry>> entry : myRegisteredRootProviders.entrySet()) {
|
||||
@@ -649,7 +647,7 @@ public class ProjectRootManagerImpl extends ProjectRootManagerEx implements Pers
|
||||
private boolean myInsideRootsChange;
|
||||
|
||||
@Override
|
||||
public void rootSetChanged(final RootProvider wrapper) {
|
||||
public void rootSetChanged(@NotNull final RootProvider wrapper) {
|
||||
if (myInsideRootsChange) return;
|
||||
myInsideRootsChange = true;
|
||||
try {
|
||||
|
||||
@@ -124,14 +124,14 @@ public abstract class LibraryTableBase implements PersistentStateComponent<Eleme
|
||||
myDispatcher.removeListener(listener);
|
||||
}
|
||||
|
||||
private void fireLibraryAdded(Library library) {
|
||||
private void fireLibraryAdded(@NotNull Library library) {
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("fireLibraryAdded: " + library);
|
||||
}
|
||||
myDispatcher.getMulticaster().afterLibraryAdded(library);
|
||||
}
|
||||
|
||||
private void fireBeforeLibraryRemoved (Library library) {
|
||||
private void fireBeforeLibraryRemoved(@NotNull Library library) {
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("fireBeforeLibraryRemoved: " + library);
|
||||
}
|
||||
@@ -151,7 +151,7 @@ public abstract class LibraryTableBase implements PersistentStateComponent<Eleme
|
||||
return createLibrary(null);
|
||||
}
|
||||
|
||||
public void fireLibraryRenamed(@NotNull LibraryImpl library) {
|
||||
void fireLibraryRenamed(@NotNull LibraryImpl library) {
|
||||
incrementModificationCount();
|
||||
myDispatcher.getMulticaster().afterLibraryRenamed(library);
|
||||
}
|
||||
@@ -341,7 +341,7 @@ public abstract class LibraryTableBase implements PersistentStateComponent<Eleme
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterLibraryRenamed(Library library) {
|
||||
public void afterLibraryRenamed(@NotNull Library library) {
|
||||
myLibraryByNameCache = null;
|
||||
}
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@ public class LibraryTableImplUtil {
|
||||
private LibraryTableImplUtil() {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Library loadLibrary(@NotNull Element rootElement, @NotNull RootModelImpl rootModel) throws InvalidDataException {
|
||||
final List children = rootElement.getChildren(LibraryImpl.ELEMENT);
|
||||
if (children.size() != 1) throw new InvalidDataException();
|
||||
@@ -43,6 +44,7 @@ public class LibraryTableImplUtil {
|
||||
return new LibraryImpl(null, element, rootModel);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Library createModuleLevelLibrary(@Nullable String name,
|
||||
PersistentLibraryKind kind,
|
||||
@NotNull RootModelImpl rootModel) {
|
||||
|
||||
@@ -83,7 +83,7 @@ public class PythonSdkPathCache extends PythonPathCache implements Disposable {
|
||||
});
|
||||
sdk.getRootProvider().addRootSetChangedListener(new RootProvider.RootSetChangedListener() {
|
||||
@Override
|
||||
public void rootSetChanged(RootProvider wrapper) {
|
||||
public void rootSetChanged(@NotNull RootProvider wrapper) {
|
||||
clearCache();
|
||||
if (!project.isDisposed()) {
|
||||
final Module[] modules = ModuleManager.getInstance(project).getModules();
|
||||
|
||||
Reference in New Issue
Block a user