diff --git a/platform/projectModel-impl/src/com/intellij/project/model/JpsLibraryManager.java b/platform/projectModel-impl/src/com/intellij/project/model/JpsLibraryManager.java deleted file mode 100644 index 59bdc722d7a0..000000000000 --- a/platform/projectModel-impl/src/com/intellij/project/model/JpsLibraryManager.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * 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.project.model; - -import com.intellij.openapi.roots.libraries.Library; -import org.jetbrains.jps.model.library.JpsLibrary; - -/** - * @author nik - */ -public interface JpsLibraryManager { - Library getLibrary(JpsLibrary library); -} diff --git a/platform/projectModel-impl/src/com/intellij/project/model/JpsModelManager.java b/platform/projectModel-impl/src/com/intellij/project/model/JpsModelManager.java deleted file mode 100644 index db71750268a4..000000000000 --- a/platform/projectModel-impl/src/com/intellij/project/model/JpsModelManager.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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.project.model; - -import com.intellij.openapi.components.ServiceManager; -import com.intellij.openapi.project.Project; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.jps.model.JpsEventDispatcher; - -/** - * @author nik - */ -public abstract class JpsModelManager { - @NotNull - public abstract JpsModuleManager getModuleManager(); - - public abstract void startModification(JpsEventDispatcher eventDispatcher); - - public abstract void commitChanges(); - - @NotNull - public abstract JpsLibraryManager getLibraryManager(); - - public static JpsModelManager getInstance(@NotNull Project project) { - return ServiceManager.getService(project, JpsModelManager.class); - } -} diff --git a/platform/projectModel-impl/src/com/intellij/project/model/JpsModuleManager.java b/platform/projectModel-impl/src/com/intellij/project/model/JpsModuleManager.java deleted file mode 100644 index 05784102b053..000000000000 --- a/platform/projectModel-impl/src/com/intellij/project/model/JpsModuleManager.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * 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.project.model; - -import com.intellij.openapi.module.Module; -import org.jetbrains.jps.model.module.JpsModule; - -/** - * @author nik - */ -public interface JpsModuleManager { - Module getModule(JpsModule jpsModule); -} diff --git a/platform/projectModel-impl/src/com/intellij/project/model/impl/JpsModelManagerImpl.java b/platform/projectModel-impl/src/com/intellij/project/model/impl/JpsModelManagerImpl.java deleted file mode 100644 index 8491b88cb5b1..000000000000 --- a/platform/projectModel-impl/src/com/intellij/project/model/impl/JpsModelManagerImpl.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * 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.project.model.impl; - -import com.intellij.project.model.JpsLibraryManager; -import com.intellij.project.model.JpsModelManager; -import com.intellij.project.model.JpsModuleManager; -import com.intellij.project.model.impl.library.JpsLibraryManagerImpl; -import com.intellij.project.model.impl.module.JpsModuleManagerImpl; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.jps.model.JpsElement; -import org.jetbrains.jps.model.JpsEventDispatcher; -import org.jetbrains.jps.model.JpsModel; -import org.jetbrains.jps.model.JpsNamedElement; -import org.jetbrains.jps.model.impl.JpsEventDispatcherBase; -import org.jetbrains.jps.model.impl.JpsModelImpl; - -/** - * @author nik - */ -public class JpsModelManagerImpl extends JpsModelManager { - private final JpsModel myModel; - private JpsModel myModifiableModel; - private final JpsModuleManagerImpl myModuleManager; - private final JpsLibraryManagerImpl myLibraryManager; - - public JpsModelManagerImpl() { - myModel = new JpsModelImpl(new MyJpsEventDispatcher()); - myModuleManager = new JpsModuleManagerImpl(); - myLibraryManager = new JpsLibraryManagerImpl(); - } - - @NotNull - @Override - public JpsModuleManager getModuleManager() { - return myModuleManager; - } - - @Override - @NotNull - public JpsLibraryManager getLibraryManager() { - return myLibraryManager; - } - - @Override - public void startModification(JpsEventDispatcher eventDispatcher) { - myModifiableModel = myModel.createModifiableModel(eventDispatcher); - } - - @Override - public void commitChanges() { - myModifiableModel.commit(); - } - - private static class MyJpsEventDispatcher extends JpsEventDispatcherBase implements JpsEventDispatcher { - @Override - public void fireElementChanged(@NotNull JpsElement element) { - } - - @Override - public void fireElementRenamed(@NotNull JpsNamedElement element, @NotNull String oldName, @NotNull String newName) { - } - } -} diff --git a/platform/projectModel-impl/src/com/intellij/project/model/impl/library/JpsLibraryDelegate.java b/platform/projectModel-impl/src/com/intellij/project/model/impl/library/JpsLibraryDelegate.java deleted file mode 100644 index 00ff851c4122..000000000000 --- a/platform/projectModel-impl/src/com/intellij/project/model/impl/library/JpsLibraryDelegate.java +++ /dev/null @@ -1,183 +0,0 @@ -/* - * 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. - * 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.project.model.impl.library; - -import com.intellij.openapi.roots.OrderRootType; -import com.intellij.openapi.roots.ProjectModelExternalSource; -import com.intellij.openapi.roots.RootProvider; -import com.intellij.openapi.roots.impl.RootProviderBaseImpl; -import com.intellij.openapi.roots.impl.libraries.LibraryEx; -import com.intellij.openapi.roots.libraries.LibraryProperties; -import com.intellij.openapi.roots.libraries.LibraryTable; -import com.intellij.openapi.roots.libraries.PersistentLibraryKind; -import com.intellij.openapi.util.InvalidDataException; -import com.intellij.openapi.util.WriteExternalException; -import com.intellij.openapi.vfs.VirtualFile; -import com.intellij.util.ArrayUtil; -import org.jdom.Element; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; -import org.jetbrains.jps.model.library.JpsLibrary; -import org.jetbrains.jps.model.library.JpsLibraryRoot; -import org.jetbrains.jps.model.library.JpsOrderRootType; - -import java.util.*; - -/** - * @author nik - */ -public class JpsLibraryDelegate implements LibraryEx { - private final JpsLibrary myJpsLibrary; - private final JpsLibraryTableImpl myLibraryTable; - private final RootProviderBaseImpl myRootProvider = new MyRootProvider(); - - public JpsLibraryDelegate(JpsLibrary library, JpsLibraryTableImpl table) { - myJpsLibrary = library; - myLibraryTable = table; - } - - @Override - public String getName() { - return myJpsLibrary.getName(); - } - - @Override - public PersistentLibraryKind getKind() { - return null; - } - - @Override - public LibraryProperties getProperties() { - return null; - } - - @NotNull - @Override - public String[] getUrls(@NotNull OrderRootType rootType) { - return ArrayUtil.EMPTY_STRING_ARRAY; - } - - @NotNull - @Override - public VirtualFile[] getFiles(@NotNull OrderRootType rootType) { - return VirtualFile.EMPTY_ARRAY; - } - - @NotNull - @Override - public List getInvalidRootUrls(@NotNull OrderRootType type) { - return Collections.emptyList(); - } - - @Override - public boolean isDisposed() { - return false; - } - - @Override - public LibraryTable getTable() { - return myLibraryTable; - } - - @NotNull - @Override - public RootProvider getRootProvider() { - return myRootProvider; - } - - @Nullable - @Override - public ProjectModelExternalSource getExternalSource() { - return null; - } - - @Override - public void dispose() { - } - - @NotNull - @Override - public ModifiableModelEx getModifiableModel() { - throw new UnsupportedOperationException("'getModifiableModel' not implemented in " + getClass().getName()); - } - - @NotNull - @Override - public String[] getExcludedRootUrls() { - return ArrayUtil.EMPTY_STRING_ARRAY; - } - - @NotNull - @Override - public VirtualFile[] getExcludedRoots() { - return VirtualFile.EMPTY_ARRAY; - } - - @Override - public void readExternal(Element element) throws InvalidDataException { - throw new UnsupportedOperationException(); - } - - @Override - public void writeExternal(Element element) throws WriteExternalException { - throw new UnsupportedOperationException(); - } - - @Override - public boolean isJarDirectory(@NotNull String url) { - return isJarDirectory(url, OrderRootType.CLASSES); - } - - @Override - public boolean isJarDirectory(@NotNull String url, @NotNull OrderRootType rootType) { - for (JpsLibraryRoot root : myJpsLibrary.getRoots(getJpsRootType(rootType))) { - if (url.equals(root.getUrl()) && root.getInclusionOptions() != JpsLibraryRoot.InclusionOptions.ROOT_ITSELF) { - return true; - } - } - return false; - } - - @Override - public boolean isValid(@NotNull String url, @NotNull OrderRootType rootType) { - return false; - } - - private static JpsOrderRootType getJpsRootType(OrderRootType type) { - if (type == OrderRootType.CLASSES) return JpsOrderRootType.COMPILED; - if (type == OrderRootType.SOURCES) return JpsOrderRootType.SOURCES; - if (type == OrderRootType.DOCUMENTATION) return JpsOrderRootType.DOCUMENTATION; - return JpsOrderRootType.COMPILED; - } - - private class MyRootProvider extends RootProviderBaseImpl { - @NotNull - @Override - public String[] getUrls(@NotNull OrderRootType rootType) { - Set originalUrls = new LinkedHashSet<>(Arrays.asList(JpsLibraryDelegate.this.getUrls(rootType))); - for (VirtualFile file : getFiles(rootType)) { // Add those expanded with jar directories. - originalUrls.add(file.getUrl()); - } - return ArrayUtil.toStringArray(originalUrls); - } - - @NotNull - @Override - public VirtualFile[] getFiles(@NotNull OrderRootType rootType) { - return JpsLibraryDelegate.this.getFiles(rootType); - } - } -} diff --git a/platform/projectModel-impl/src/com/intellij/project/model/impl/library/JpsLibraryManagerImpl.java b/platform/projectModel-impl/src/com/intellij/project/model/impl/library/JpsLibraryManagerImpl.java deleted file mode 100644 index 65b1f3d30c5c..000000000000 --- a/platform/projectModel-impl/src/com/intellij/project/model/impl/library/JpsLibraryManagerImpl.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 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.project.model.impl.library; - -import com.intellij.openapi.roots.libraries.Library; -import com.intellij.project.model.JpsLibraryManager; -import org.jetbrains.jps.model.library.JpsLibrary; - -/** - * @author nik - */ -public class JpsLibraryManagerImpl implements JpsLibraryManager { - @Override - public Library getLibrary(JpsLibrary library) { - return null; - } -} diff --git a/platform/projectModel-impl/src/com/intellij/project/model/impl/library/JpsLibraryTableImpl.java b/platform/projectModel-impl/src/com/intellij/project/model/impl/library/JpsLibraryTableImpl.java deleted file mode 100644 index 20ad2f67d667..000000000000 --- a/platform/projectModel-impl/src/com/intellij/project/model/impl/library/JpsLibraryTableImpl.java +++ /dev/null @@ -1,202 +0,0 @@ -/* - * Copyright 2000-2017 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.project.model.impl.library; - -import com.intellij.openapi.Disposable; -import com.intellij.openapi.roots.ProjectModelExternalSource; -import com.intellij.openapi.roots.impl.libraries.LibraryTableBase; -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.Disposer; -import com.intellij.util.EventDispatcher; -import org.jetbrains.annotations.NonNls; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; -import org.jetbrains.jps.model.library.JpsLibrary; -import org.jetbrains.jps.model.library.JpsLibraryCollection; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; - -/** - * @author nik - */ -public class JpsLibraryTableImpl implements LibraryTable, Disposable { - private final JpsLibrariesModel myModel; - private final EventDispatcher myDispatcher = EventDispatcher.create(Listener.class); - private final String myTableLevel; - private LibraryTablePresentation myPresentation; - - public JpsLibraryTableImpl(JpsLibraryCollection libraryCollection, String level) { - myTableLevel = level; - myModel = new JpsLibrariesModel(libraryCollection); - } - - @NotNull - @Override - public Library[] getLibraries() { - return myModel.getLibraries(); - } - - @NotNull - @Override - public Iterator getLibraryIterator() { - return myModel.getLibraryIterator(); - } - - @Override - public Library getLibraryByName(@NotNull String name) { - return myModel.getLibraryByName(name); - } - - @Override - public void addListener(@NotNull Listener listener) { - myDispatcher.addListener(listener); - } - - @Override - public void addListener(@NotNull Listener listener, @NotNull Disposable parentDisposable) { - myDispatcher.addListener(listener, parentDisposable); - } - - @Override - public void removeListener(@NotNull Listener listener) { - myDispatcher.removeListener(listener); - } - - @NotNull - @Override - public Library createLibrary() { - return createLibrary(null); - } - - @NotNull - @Override - public Library createLibrary(@NonNls String name) { - final ModifiableModel model = getModifiableModel(); - final Library library = model.createLibrary(name); - model.commit(); - return library; - } - - @Override - public void removeLibrary(@NotNull Library library) { - final ModifiableModel model = getModifiableModel(); - model.removeLibrary(library); - model.commit(); - } - - @Override - public void dispose() { - for (Library library : getLibraries()) { - Disposer.dispose(library); - } - } - - @NotNull - @Override - public ModifiableModel getModifiableModel() { - return new JpsLibrariesModel(myModel.myJpsLibraries); - } - - @NotNull - @Override - public String getTableLevel() { - return myTableLevel; - } - - @NotNull - @Override - public LibraryTablePresentation getPresentation() { - return myPresentation; - } - - private class JpsLibrariesModel implements LibraryTableBase.ModifiableModel { - private final JpsLibraryCollection myJpsLibraries; - private final List myLibraries; - - private JpsLibrariesModel(JpsLibraryCollection libraryCollection) { - myLibraries = new ArrayList<>(); - myJpsLibraries = libraryCollection; - for (JpsLibrary library : libraryCollection.getLibraries()) { - myLibraries.add(new JpsLibraryDelegate(library, JpsLibraryTableImpl.this)); - } - } - - @NotNull - @Override - public Library createLibrary(String name) { - return createLibrary(name, null); - } - - @NotNull - @Override - public Library createLibrary(String name, @Nullable PersistentLibraryKind type) { - return createLibrary(name, type, null); - } - - @NotNull - @Override - public Library createLibrary(String name, @Nullable PersistentLibraryKind type, @Nullable ProjectModelExternalSource externalSource) { - throw new UnsupportedOperationException("'createLibrary' not implemented in " + getClass().getName()); - } - - @NotNull - @Override - public Iterator getLibraryIterator() { - return Collections.unmodifiableList(myLibraries).iterator(); - } - - @Override - public void removeLibrary(@NotNull Library library) { - throw new UnsupportedOperationException(); - } - - @NotNull - @Override - public Library[] getLibraries() { - return myLibraries.toArray(Library.EMPTY_ARRAY); - } - - @Override - public Library getLibraryByName(@NotNull String name) { - for (JpsLibraryDelegate library : myLibraries) { - if (name.equals(library.getName())) { - return library; - } - } - return null; - } - - @Override - public void commit() { - throw new UnsupportedOperationException(); - } - - @Override - public void dispose() { - } - - @Override - public boolean isChanged() { - return false; - } - } -} diff --git a/platform/projectModel-impl/src/com/intellij/project/model/impl/module/JpsModuleManagerImpl.java b/platform/projectModel-impl/src/com/intellij/project/model/impl/module/JpsModuleManagerImpl.java deleted file mode 100644 index 1f669e99e753..000000000000 --- a/platform/projectModel-impl/src/com/intellij/project/model/impl/module/JpsModuleManagerImpl.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 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.project.model.impl.module; - -import com.intellij.openapi.module.Module; -import com.intellij.project.model.JpsModuleManager; -import org.jetbrains.jps.model.module.JpsModule; - -/** - * @author nik - */ -public class JpsModuleManagerImpl implements JpsModuleManager { - @Override - public Module getModule(JpsModule jpsModule) { - return null; - } -} diff --git a/platform/projectModel-impl/src/com/intellij/project/model/impl/sdk/JpsSdkManagerImpl.java b/platform/projectModel-impl/src/com/intellij/project/model/impl/sdk/JpsSdkManagerImpl.java deleted file mode 100644 index 43b3a3f1d3e2..000000000000 --- a/platform/projectModel-impl/src/com/intellij/project/model/impl/sdk/JpsSdkManagerImpl.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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.project.model.impl.sdk; - -import com.intellij.openapi.projectRoots.Sdk; -import com.intellij.project.model.JpsSdkManager; -import org.jetbrains.jps.model.library.JpsLibrary; - -import java.util.HashMap; -import java.util.Map; - -/** - * @author nik - */ -public class JpsSdkManagerImpl extends JpsSdkManager { - private final Map mySdks = new HashMap<>(); - - @Override - public Sdk getSdk(JpsLibrary library) { - return mySdks.get(library); - } -}