mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
notnull
This commit is contained in:
+10
-7
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 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.
|
||||
@@ -19,6 +19,7 @@ import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.containers.ContainerUtilRt;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@@ -30,19 +31,20 @@ public class ExpandMacroToPathMap extends PathMacroMap {
|
||||
private final Map<String, String> myPlainMap = ContainerUtilRt.newLinkedHashMap();
|
||||
private final Map<String, String> myMacroExpands = ContainerUtil.newHashMap();
|
||||
|
||||
public void addMacroExpand(String macroName, String path) {
|
||||
public void addMacroExpand(@NotNull String macroName, @NotNull String path) {
|
||||
myMacroExpands.put(macroName, PathMacroMap.quotePath(path));
|
||||
}
|
||||
|
||||
public void put(String fromText, String toText) {
|
||||
public void put(@NotNull String fromText, @NotNull String toText) {
|
||||
myPlainMap.put(fromText, toText);
|
||||
}
|
||||
|
||||
public void putAll(ExpandMacroToPathMap another) {
|
||||
public void putAll(@NotNull ExpandMacroToPathMap another) {
|
||||
myPlainMap.putAll(another.myPlainMap);
|
||||
myMacroExpands.putAll(another.myMacroExpands);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String substitute(String text, boolean caseSensitive) {
|
||||
if (text == null) {
|
||||
//noinspection ConstantConditions
|
||||
@@ -66,7 +68,8 @@ public class ExpandMacroToPathMap extends PathMacroMap {
|
||||
return text;
|
||||
}
|
||||
|
||||
private static String replaceMacro(String text, String macroName, String replacement) {
|
||||
@NotNull
|
||||
private static String replaceMacro(@NotNull String text, @NotNull String macroName, @NotNull String replacement) {
|
||||
while (true) {
|
||||
int start = findMacroIndex(text, macroName);
|
||||
if (start < 0) {
|
||||
@@ -81,11 +84,11 @@ public class ExpandMacroToPathMap extends PathMacroMap {
|
||||
return text;
|
||||
}
|
||||
|
||||
private static int getSlashCount(String text, int pos) {
|
||||
private static int getSlashCount(@NotNull String text, int pos) {
|
||||
return StringUtil.isChar(text, pos, '/') ? StringUtil.isChar(text, pos + 1, '/') ? 2 : 1 : 0;
|
||||
}
|
||||
|
||||
private static int findMacroIndex(String text, String macroName) {
|
||||
private static int findMacroIndex(@NotNull String text, @NotNull String macroName) {
|
||||
int i = -1;
|
||||
while (true) {
|
||||
i = text.indexOf('$', i + 1);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 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.
|
||||
@@ -80,7 +80,7 @@ public class LightVirtualFile extends LightVirtualFileBase {
|
||||
return myLanguage;
|
||||
}
|
||||
|
||||
public void setLanguage(final Language language) {
|
||||
public void setLanguage(@NotNull Language language) {
|
||||
myLanguage = language;
|
||||
FileType type = language.getAssociatedFileType();
|
||||
if (type == null) {
|
||||
|
||||
+2
-2
@@ -228,10 +228,10 @@ public class ClasspathStorage extends StateStorageBase<ClasspathStorage.MyStorag
|
||||
}
|
||||
}
|
||||
|
||||
public static void modulePathChanged(Module module, String path) {
|
||||
public static void modulePathChanged(Module module, String newPath) {
|
||||
ClasspathStorageProvider provider = getProvider(ClassPathStorageUtil.getStorageType(module));
|
||||
if (provider != null) {
|
||||
provider.modulePathChanged(module, path);
|
||||
provider.modulePathChanged(module, newPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 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.
|
||||
@@ -17,6 +17,7 @@
|
||||
package com.intellij.openapi.roots;
|
||||
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* The table below specifies which order entries are used during compilation and runtime.
|
||||
@@ -64,7 +65,8 @@ public enum DependencyScope {
|
||||
myForTestRuntime = forTestRuntime;
|
||||
}
|
||||
|
||||
public static DependencyScope readExternal(Element element) {
|
||||
@NotNull
|
||||
public static DependencyScope readExternal(@NotNull Element element) {
|
||||
String scope = element.getAttributeValue(SCOPE_ATTR);
|
||||
if (scope != null) {
|
||||
try {
|
||||
|
||||
+4
-3
@@ -49,13 +49,14 @@ public interface LibraryTable {
|
||||
|
||||
boolean isEditable();
|
||||
|
||||
@NotNull
|
||||
ModifiableModel getModifiableModel();
|
||||
|
||||
void addListener(Listener listener);
|
||||
void addListener(@NotNull Listener listener);
|
||||
|
||||
void addListener(Listener listener, Disposable parentDisposable);
|
||||
void addListener(@NotNull Listener listener, @NotNull Disposable parentDisposable);
|
||||
|
||||
void removeListener(Listener listener);
|
||||
void removeListener(@NotNull Listener listener);
|
||||
|
||||
interface ModifiableModel {
|
||||
Library createLibrary(String name);
|
||||
|
||||
+7
-6
@@ -56,13 +56,13 @@ public class BasePathMacroManager extends PathMacroManager {
|
||||
myPathMacros = (PathMacrosImpl)pathMacros;
|
||||
}
|
||||
|
||||
protected static void addFileHierarchyReplacements(ExpandMacroToPathMap result, String macroName, @Nullable String path) {
|
||||
protected static void addFileHierarchyReplacements(@NotNull ExpandMacroToPathMap result, @NotNull String macroName, @Nullable String path) {
|
||||
if (path != null) {
|
||||
addFileHierarchyReplacements(result, getLocalFileSystem().findFileByPath(path), '$' + macroName + '$');
|
||||
}
|
||||
}
|
||||
|
||||
private static void addFileHierarchyReplacements(ExpandMacroToPathMap result, @Nullable VirtualFile f, String macro) {
|
||||
private static void addFileHierarchyReplacements(@NotNull ExpandMacroToPathMap result, @Nullable VirtualFile f, @NotNull String macro) {
|
||||
if (f == null) {
|
||||
return;
|
||||
}
|
||||
@@ -92,11 +92,13 @@ public class BasePathMacroManager extends PathMacroManager {
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static VirtualFileSystem getLocalFileSystem() {
|
||||
// Use VFM directly because of mocks in tests.
|
||||
return VirtualFileManager.getInstance().getFileSystem(StandardFileSystems.FILE_PROTOCOL);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public ExpandMacroToPathMap getExpandMacroMap() {
|
||||
ExpandMacroToPathMap result = new ExpandMacroToPathMap();
|
||||
for (Map.Entry<String, String> entry : PathMacroUtil.getGlobalSystemMacros().entrySet()) {
|
||||
@@ -106,6 +108,7 @@ public class BasePathMacroManager extends PathMacroManager {
|
||||
return result;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected ReplacePathToMacroMap getReplacePathMap() {
|
||||
ReplacePathToMacroMap result = new ReplacePathToMacroMap();
|
||||
for (Map.Entry<String, String> entry : PathMacroUtil.getGlobalSystemMacros().entrySet()) {
|
||||
@@ -151,7 +154,8 @@ public class BasePathMacroManager extends PathMacroManager {
|
||||
getReplacePathMap().substitute(element, SystemInfo.isFileSystemCaseSensitive);
|
||||
}
|
||||
|
||||
public PathMacrosImpl getPathMacros() {
|
||||
@NotNull
|
||||
private PathMacrosImpl getPathMacros() {
|
||||
if (myPathMacros == null) {
|
||||
myPathMacros = PathMacrosImpl.getInstanceEx();
|
||||
}
|
||||
@@ -164,9 +168,6 @@ public class BasePathMacroManager extends PathMacroManager {
|
||||
private final MultiMap<String, String> myMacroToComponentNames = MultiMap.createSet();
|
||||
private final MultiMap<String, String> myComponentNameToMacros = MultiMap.createSet();
|
||||
|
||||
public MyTrackingPathMacroSubstitutor() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
synchronized (myLock) {
|
||||
|
||||
+4
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 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,6 +20,7 @@ import com.intellij.application.options.ReplacePathToMacroMap;
|
||||
import com.intellij.openapi.application.PathMacros;
|
||||
import com.intellij.openapi.components.ExpandMacroToPathMap;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jps.model.serialization.PathMacroUtil;
|
||||
|
||||
public class ModulePathMacroManager extends BasePathMacroManager {
|
||||
@@ -30,6 +31,7 @@ public class ModulePathMacroManager extends BasePathMacroManager {
|
||||
myModule = module;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public ExpandMacroToPathMap getExpandMacroMap() {
|
||||
final ExpandMacroToPathMap result = new ExpandMacroToPathMap();
|
||||
@@ -41,6 +43,7 @@ public class ModulePathMacroManager extends BasePathMacroManager {
|
||||
return result;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public ReplacePathToMacroMap getReplacePathMap() {
|
||||
final ReplacePathToMacroMap result = super.getReplacePathMap();
|
||||
|
||||
+4
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 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.
|
||||
@@ -21,6 +21,7 @@ import com.intellij.openapi.application.PathMacros;
|
||||
import com.intellij.openapi.components.ExpandMacroToPathMap;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class ProjectPathMacroManager extends BasePathMacroManager {
|
||||
@@ -31,6 +32,7 @@ public class ProjectPathMacroManager extends BasePathMacroManager {
|
||||
myProject = project;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public ExpandMacroToPathMap getExpandMacroMap() {
|
||||
final ExpandMacroToPathMap result = super.getExpandMacroMap();
|
||||
@@ -38,6 +40,7 @@ public class ProjectPathMacroManager extends BasePathMacroManager {
|
||||
return result;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public ReplacePathToMacroMap getReplacePathMap() {
|
||||
final ReplacePathToMacroMap result = super.getReplacePathMap();
|
||||
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 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.
|
||||
@@ -36,9 +36,9 @@ abstract class LibraryOrderEntryBaseImpl extends OrderEntryBaseImpl implements L
|
||||
@NotNull protected DependencyScope myScope = DependencyScope.COMPILE;
|
||||
@Nullable private RootProvider myCurrentlySubscribedRootProvider = null;
|
||||
|
||||
LibraryOrderEntryBaseImpl(@NotNull RootModelImpl rootModel, @NotNull ProjectRootManagerImpl instanceImpl) {
|
||||
LibraryOrderEntryBaseImpl(@NotNull RootModelImpl rootModel, @NotNull ProjectRootManagerImpl projectRootManager) {
|
||||
super(rootModel);
|
||||
myProjectRootManagerImpl = instanceImpl;
|
||||
myProjectRootManagerImpl = projectRootManager;
|
||||
}
|
||||
|
||||
protected final void init() {
|
||||
|
||||
+3
-3
@@ -47,7 +47,7 @@ public class ModuleLibraryOrderEntryImpl extends LibraryOrderEntryBaseImpl imple
|
||||
@NonNls public static final String EXPORTED_ATTR = JpsJavaModelSerializerExtension.EXPORTED_ATTRIBUTE;
|
||||
|
||||
//cloning
|
||||
private ModuleLibraryOrderEntryImpl(Library library, RootModelImpl rootModel, boolean isExported, DependencyScope scope) {
|
||||
private ModuleLibraryOrderEntryImpl(@NotNull Library library, @NotNull RootModelImpl rootModel, boolean isExported, @NotNull DependencyScope scope) {
|
||||
super(rootModel, ProjectRootManagerImpl.getInstanceImpl(rootModel.getProject()));
|
||||
myLibrary = ((LibraryImpl)library).cloneLibrary(getRootModel());
|
||||
doinit();
|
||||
@@ -55,13 +55,13 @@ public class ModuleLibraryOrderEntryImpl extends LibraryOrderEntryBaseImpl imple
|
||||
myScope = scope;
|
||||
}
|
||||
|
||||
ModuleLibraryOrderEntryImpl(String name, final PersistentLibraryKind kind, RootModelImpl rootModel, ProjectRootManagerImpl projectRootManager) {
|
||||
ModuleLibraryOrderEntryImpl(String name, final PersistentLibraryKind kind, @NotNull RootModelImpl rootModel, @NotNull ProjectRootManagerImpl projectRootManager) {
|
||||
super(rootModel, projectRootManager);
|
||||
myLibrary = LibraryTableImplUtil.createModuleLevelLibrary(name, kind, getRootModel());
|
||||
doinit();
|
||||
}
|
||||
|
||||
ModuleLibraryOrderEntryImpl(Element element, RootModelImpl rootModel, ProjectRootManagerImpl projectRootManager) throws InvalidDataException {
|
||||
ModuleLibraryOrderEntryImpl(@NotNull Element element, @NotNull RootModelImpl rootModel, @NotNull ProjectRootManagerImpl projectRootManager) throws InvalidDataException {
|
||||
super(rootModel, projectRootManager);
|
||||
LOG.assertTrue(ENTRY_TYPE.equals(element.getAttributeValue(OrderEntryFactory.ORDER_ENTRY_TYPE_ATTR)));
|
||||
myExported = element.getAttributeValue(EXPORTED_ATTR) != null;
|
||||
|
||||
+14
-8
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 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.
|
||||
@@ -23,7 +23,10 @@ import com.intellij.openapi.roots.LibraryOrderEntry;
|
||||
import com.intellij.openapi.roots.OrderEntry;
|
||||
import com.intellij.openapi.roots.impl.libraries.LibraryTableBase;
|
||||
import com.intellij.openapi.roots.impl.libraries.LibraryTableImplUtil;
|
||||
import com.intellij.openapi.roots.libraries.*;
|
||||
import com.intellij.openapi.roots.libraries.Library;
|
||||
import com.intellij.openapi.roots.libraries.LibraryTable;
|
||||
import com.intellij.openapi.roots.libraries.LibraryTablePresentation;
|
||||
import com.intellij.openapi.roots.libraries.PersistentLibraryKind;
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.containers.ConvertingIterator;
|
||||
@@ -41,7 +44,9 @@ import java.util.Iterator;
|
||||
public class ModuleLibraryTable implements LibraryTable, LibraryTableBase.ModifiableModelEx {
|
||||
private static final ModuleLibraryOrderEntryCondition MODULE_LIBRARY_ORDER_ENTRY_FILTER = new ModuleLibraryOrderEntryCondition();
|
||||
private static final OrderEntryToLibraryConvertor ORDER_ENTRY_TO_LIBRARY_CONVERTOR = new OrderEntryToLibraryConvertor();
|
||||
@NotNull
|
||||
private final RootModelImpl myRootModel;
|
||||
@NotNull
|
||||
private final ProjectRootManagerImpl myProjectRootManager;
|
||||
public static final LibraryTablePresentation MODULE_LIBRARY_TABLE_PRESENTATION = new LibraryTablePresentation() {
|
||||
@Override
|
||||
@@ -60,7 +65,7 @@ public class ModuleLibraryTable implements LibraryTable, LibraryTableBase.Modifi
|
||||
}
|
||||
};
|
||||
|
||||
ModuleLibraryTable(RootModelImpl rootModel, ProjectRootManagerImpl projectRootManager) {
|
||||
ModuleLibraryTable(@NotNull RootModelImpl rootModel, @NotNull ProjectRootManagerImpl projectRootManager) {
|
||||
myRootModel = rootModel;
|
||||
myProjectRootManager = projectRootManager;
|
||||
}
|
||||
@@ -86,7 +91,7 @@ public class ModuleLibraryTable implements LibraryTable, LibraryTableBase.Modifi
|
||||
|
||||
@Override
|
||||
public Library createLibrary(String name, @Nullable PersistentLibraryKind kind) {
|
||||
final ModuleLibraryOrderEntryImpl orderEntry = new ModuleLibraryOrderEntryImpl(name, kind, myRootModel, myProjectRootManager);
|
||||
LibraryOrderEntry orderEntry = new ModuleLibraryOrderEntryImpl(name, kind, myRootModel, myProjectRootManager);
|
||||
myRootModel.addOrderEntry(orderEntry);
|
||||
return orderEntry.getLibrary();
|
||||
}
|
||||
@@ -144,25 +149,25 @@ public class ModuleLibraryTable implements LibraryTable, LibraryTableBase.Modifi
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addListener(Listener listener) {
|
||||
public void addListener(@NotNull Listener listener) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addListener(Listener listener, Disposable parentDisposable) {
|
||||
public void addListener(@NotNull Listener listener, @NotNull Disposable parentDisposable) {
|
||||
throw new UnsupportedOperationException("Method addListener is not yet implemented in " + getClass().getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeListener(Listener listener) {
|
||||
public void removeListener(@NotNull Listener listener) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public Module getModule() {
|
||||
return myRootModel.getModule();
|
||||
}
|
||||
|
||||
|
||||
private static class ModuleLibraryOrderEntryCondition implements Condition<OrderEntry> {
|
||||
@Override
|
||||
public boolean value(OrderEntry entry) {
|
||||
@@ -186,6 +191,7 @@ public class ModuleLibraryTable implements LibraryTable, LibraryTableBase.Modifi
|
||||
return myRootModel.isChanged();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public ModifiableModel getModifiableModel() {
|
||||
return this;
|
||||
|
||||
+14
-9
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 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.
|
||||
@@ -21,6 +21,7 @@ import com.intellij.openapi.roots.OrderEntry;
|
||||
import com.intellij.openapi.util.InvalidDataException;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jps.model.serialization.module.JpsModuleRootModelSerializer;
|
||||
|
||||
/**
|
||||
@@ -31,7 +32,10 @@ public class OrderEntryFactory {
|
||||
@NonNls public static final String ORDER_ENTRY_ELEMENT_NAME = JpsModuleRootModelSerializer.ORDER_ENTRY_TAG;
|
||||
@NonNls public static final String ORDER_ENTRY_TYPE_ATTR = JpsModuleRootModelSerializer.TYPE_ATTRIBUTE;
|
||||
|
||||
static OrderEntry createOrderEntryByElement(Element element, RootModelImpl rootModel, ProjectRootManagerImpl projectRootManager) throws InvalidDataException {
|
||||
@NotNull
|
||||
static OrderEntry createOrderEntryByElement(@NotNull Element element,
|
||||
@NotNull RootModelImpl rootModel,
|
||||
@NotNull ProjectRootManagerImpl projectRootManager) throws InvalidDataException {
|
||||
LOG.assertTrue(ORDER_ENTRY_ELEMENT_NAME.equals(element.getName()));
|
||||
final String type = element.getAttributeValue(ORDER_ENTRY_TYPE_ATTR);
|
||||
if (type == null) {
|
||||
@@ -40,25 +44,26 @@ public class OrderEntryFactory {
|
||||
if (ModuleSourceOrderEntryImpl.ENTRY_TYPE.equals(type)) {
|
||||
return new ModuleSourceOrderEntryImpl(element, rootModel);
|
||||
}
|
||||
else if (ModuleJdkOrderEntryImpl.ENTRY_TYPE.equals(type)) {
|
||||
if (ModuleJdkOrderEntryImpl.ENTRY_TYPE.equals(type)) {
|
||||
return new ModuleJdkOrderEntryImpl(element, rootModel, projectRootManager);
|
||||
}
|
||||
else if (InheritedJdkOrderEntryImpl.ENTRY_TYPE.equals(type)) {
|
||||
if (InheritedJdkOrderEntryImpl.ENTRY_TYPE.equals(type)) {
|
||||
return new InheritedJdkOrderEntryImpl(element, rootModel, projectRootManager);
|
||||
}
|
||||
else if (LibraryOrderEntryImpl.ENTRY_TYPE.equals(type)) {
|
||||
if (LibraryOrderEntryImpl.ENTRY_TYPE.equals(type)) {
|
||||
return new LibraryOrderEntryImpl(element, rootModel, projectRootManager);
|
||||
}
|
||||
else if (ModuleLibraryOrderEntryImpl.ENTRY_TYPE.equals(type)) {
|
||||
if (ModuleLibraryOrderEntryImpl.ENTRY_TYPE.equals(type)) {
|
||||
return new ModuleLibraryOrderEntryImpl(element, rootModel, projectRootManager);
|
||||
}
|
||||
else if (ModuleOrderEntryImpl.ENTRY_TYPE.equals(type)) {
|
||||
if (ModuleOrderEntryImpl.ENTRY_TYPE.equals(type)) {
|
||||
return new ModuleOrderEntryImpl(element, rootModel);
|
||||
}
|
||||
else throw new InvalidDataException("Unknown order entry type:" + type);
|
||||
throw new InvalidDataException("Unknown order entry type:" + type);
|
||||
}
|
||||
|
||||
static Element createOrderEntryElement(String type) {
|
||||
@NotNull
|
||||
static Element createOrderEntryElement(@NotNull String type) {
|
||||
final Element element = new Element(ORDER_ENTRY_ELEMENT_NAME);
|
||||
element.setAttribute(ORDER_ENTRY_TYPE_ATTR, type);
|
||||
return element;
|
||||
|
||||
+3
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 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.
|
||||
@@ -24,6 +24,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
* @author dsl
|
||||
*/
|
||||
public abstract class RootModelComponentBase implements Disposable {
|
||||
@NotNull
|
||||
private final RootModelImpl myRootModel;
|
||||
private boolean myDisposed;
|
||||
|
||||
@@ -33,6 +34,7 @@ public abstract class RootModelComponentBase implements Disposable {
|
||||
}
|
||||
|
||||
|
||||
@NotNull
|
||||
public RootModelImpl getRootModel() {
|
||||
return myRootModel;
|
||||
}
|
||||
|
||||
+1
-1
@@ -79,7 +79,7 @@ public class LibraryImpl extends TraceableDisposable implements LibraryEx.Modifi
|
||||
private final Disposable myPointersDisposable = Disposer.newDisposable();
|
||||
private final JarDirectoryWatcher myRootsWatcher = JarDirectoryWatcherFactory.getInstance().createWatcher(myJarDirectories, myRootProvider);
|
||||
|
||||
LibraryImpl(LibraryTable table, Element element, ModifiableRootModel rootModel) throws InvalidDataException {
|
||||
LibraryImpl(LibraryTable table, @NotNull Element element, ModifiableRootModel rootModel) throws InvalidDataException {
|
||||
this(table, rootModel, null, element.getAttributeValue(LIBRARY_NAME_ATTR),
|
||||
(PersistentLibraryKind<?>)LibraryKind.findById(element.getAttributeValue(LIBRARY_TYPE_ATTR)));
|
||||
readProperties(element);
|
||||
|
||||
+4
-3
@@ -41,6 +41,7 @@ public abstract class LibraryTableBase implements PersistentStateComponent<Eleme
|
||||
private LibraryModel myModel = new LibraryModel();
|
||||
private boolean myFirstLoad = true;
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public ModifiableModel getModifiableModel() {
|
||||
return new LibraryModel(myModel);
|
||||
@@ -95,17 +96,17 @@ public abstract class LibraryTableBase implements PersistentStateComponent<Eleme
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addListener(Listener listener) {
|
||||
public void addListener(@NotNull Listener listener) {
|
||||
myDispatcher.addListener(listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addListener(Listener listener, Disposable parentDisposable) {
|
||||
public void addListener(@NotNull Listener listener, @NotNull Disposable parentDisposable) {
|
||||
myDispatcher.addListener(listener, parentDisposable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeListener(Listener listener) {
|
||||
public void removeListener(@NotNull Listener listener) {
|
||||
myDispatcher.removeListener(listener);
|
||||
}
|
||||
|
||||
|
||||
+5
-4
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 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.
|
||||
@@ -22,6 +22,7 @@ import com.intellij.openapi.roots.libraries.PersistentLibraryKind;
|
||||
import com.intellij.openapi.util.InvalidDataException;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
@@ -35,7 +36,7 @@ public class LibraryTableImplUtil {
|
||||
private LibraryTableImplUtil() {
|
||||
}
|
||||
|
||||
public static Library loadLibrary(Element rootElement, RootModelImpl rootModel) throws InvalidDataException {
|
||||
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();
|
||||
Element element = (Element)children.get(0);
|
||||
@@ -43,8 +44,8 @@ public class LibraryTableImplUtil {
|
||||
}
|
||||
|
||||
public static Library createModuleLevelLibrary(@Nullable String name,
|
||||
final PersistentLibraryKind kind,
|
||||
RootModelImpl rootModel) {
|
||||
PersistentLibraryKind kind,
|
||||
@NotNull RootModelImpl rootModel) {
|
||||
return new LibraryImpl(name, kind, null, rootModel);
|
||||
}
|
||||
}
|
||||
|
||||
+5
-4
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 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,17 +66,17 @@ public class JpsLibraryTableImpl implements LibraryTable, Disposable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addListener(Listener listener) {
|
||||
public void addListener(@NotNull Listener listener) {
|
||||
myDispatcher.addListener(listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addListener(Listener listener, Disposable parentDisposable) {
|
||||
public void addListener(@NotNull Listener listener, @NotNull Disposable parentDisposable) {
|
||||
myDispatcher.addListener(listener, parentDisposable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeListener(Listener listener) {
|
||||
public void removeListener(@NotNull Listener listener) {
|
||||
myDispatcher.removeListener(listener);
|
||||
}
|
||||
|
||||
@@ -107,6 +107,7 @@ public class JpsLibraryTableImpl implements LibraryTable, Disposable {
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public ModifiableModel getModifiableModel() {
|
||||
return new JpsLibrariesModel(myModel.myJpsLibraries);
|
||||
|
||||
Reference in New Issue
Block a user