mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
moving stuff to projectModel, reducing dependencies
This commit is contained in:
+1
-4
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* 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.
|
||||
@@ -16,13 +16,10 @@
|
||||
package com.intellij.packaging.impl.elements;
|
||||
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.roots.LibraryOrderEntry;
|
||||
import com.intellij.openapi.roots.OrderEntry;
|
||||
import com.intellij.openapi.roots.OrderRootType;
|
||||
import com.intellij.openapi.roots.libraries.Library;
|
||||
import com.intellij.openapi.roots.libraries.LibraryTable;
|
||||
import com.intellij.openapi.roots.libraries.LibraryTablesRegistrar;
|
||||
import com.intellij.openapi.roots.ui.configuration.ModulesProvider;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
|
||||
+1
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
* 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.
|
||||
@@ -21,7 +21,6 @@ import com.intellij.conversion.ProjectLibrariesSettings;
|
||||
import com.intellij.openapi.roots.impl.libraries.LibraryImpl;
|
||||
import com.intellij.openapi.util.JDOMUtil;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
|
||||
-10
@@ -39,16 +39,6 @@ import java.util.List;
|
||||
public class LibraryTypeServiceImpl extends LibraryTypeService {
|
||||
private static final String DEFAULT_LIBRARY_NAME = "Unnamed";
|
||||
|
||||
@Nullable
|
||||
public PersistentLibraryKind<?> findKindById(@NotNull String typeId) {
|
||||
for (LibraryType type : LibraryType.EP_NAME.getExtensions()) {
|
||||
if (type.getKind().getKindId().equals(typeId)) {
|
||||
return (PersistentLibraryKind<?>)type.getKind();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NewLibraryConfiguration createLibraryFromFiles(@NotNull LibraryRootsComponentDescriptor descriptor,
|
||||
@NotNull JComponent parentComponent,
|
||||
|
||||
@@ -32,8 +32,6 @@ public abstract class LibraryTypeService {
|
||||
return ServiceManager.getService(LibraryTypeService.class);
|
||||
}
|
||||
|
||||
public abstract PersistentLibraryKind<?> findKindById(@NotNull String typeId);
|
||||
|
||||
@Nullable
|
||||
public abstract NewLibraryConfiguration createLibraryFromFiles(@NotNull LibraryRootsComponentDescriptor descriptor,
|
||||
@NotNull JComponent parentComponent,
|
||||
|
||||
+2
-2
@@ -174,7 +174,7 @@ public class LibraryImpl implements LibraryEx.ModifiableModelEx, LibraryEx {
|
||||
|
||||
public static void collectJarFiles(final VirtualFile dir, final List<VirtualFile> container, final boolean recursively) {
|
||||
for (VirtualFile child : dir.getChildren()) {
|
||||
final VirtualFile jarRoot = JarFileSystem.getInstance().getJarRootForLocalFile(child);
|
||||
final VirtualFile jarRoot = StandardFileSystems.getJarRootForLocalFile(child);
|
||||
if (jarRoot != null) {
|
||||
container.add(jarRoot);
|
||||
}
|
||||
@@ -257,7 +257,7 @@ public class LibraryImpl implements LibraryEx.ModifiableModelEx, LibraryEx {
|
||||
final String typeId = element.getAttributeValue(LIBRARY_TYPE_ATTR);
|
||||
if (typeId == null) return;
|
||||
|
||||
myKind = LibraryTypeService.getInstance().findKindById(typeId);
|
||||
myKind = (PersistentLibraryKind<?>) LibraryKind.findById(typeId);
|
||||
if (myKind == null) return;
|
||||
|
||||
myProperties = myKind.createDefaultProperties();
|
||||
@@ -18,17 +18,25 @@ package com.intellij.openapi.roots.libraries;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author nik
|
||||
*/
|
||||
public class LibraryKind {
|
||||
private final String myKindId;
|
||||
private static final Map<String, LibraryKind> ourAllKinds = new HashMap<String, LibraryKind>();
|
||||
|
||||
/**
|
||||
* @param kindId must be unique among all {@link com.intellij.openapi.roots.libraries.LibraryType} and {@link com.intellij.openapi.roots.libraries.LibraryPresentationProvider} implementations
|
||||
*/
|
||||
public LibraryKind(@NotNull @NonNls String kindId) {
|
||||
myKindId = kindId;
|
||||
if (ourAllKinds.containsKey(kindId)) {
|
||||
throw new IllegalArgumentException("Kind " + kindId + " is not unique");
|
||||
}
|
||||
ourAllKinds.put(kindId, this);
|
||||
}
|
||||
|
||||
public final String getKindId() {
|
||||
@@ -47,4 +55,8 @@ public class LibraryKind {
|
||||
public static LibraryKind create(@NotNull @NonNls String kindId) {
|
||||
return new LibraryKind(kindId);
|
||||
}
|
||||
|
||||
public static LibraryKind findById(String kindId) {
|
||||
return ourAllKinds.get(kindId);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* 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.
|
||||
@@ -24,7 +24,6 @@ import com.intellij.openapi.roots.impl.libraries.ProjectLibraryTable;
|
||||
import com.intellij.openapi.roots.libraries.Library;
|
||||
import com.intellij.openapi.roots.libraries.LibraryTable;
|
||||
import com.intellij.openapi.roots.libraries.LibraryTablesRegistrar;
|
||||
import com.intellij.openapi.util.Computable;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import org.jetbrains.idea.maven.MavenCustomRepositoryHelper;
|
||||
|
||||
Reference in New Issue
Block a user