supported spring-related framework configurations: webflow, ws, integration, security

This commit is contained in:
Serega Vasiliev
2011-07-21 18:25:13 +02:00
parent c0a6e6ba6f
commit 1a38dadd2f
2 changed files with 108 additions and 0 deletions
@@ -0,0 +1,50 @@
package com.intellij.framework.library;
import com.intellij.openapi.roots.libraries.JarVersionDetectionUtil;
import com.intellij.openapi.roots.libraries.LibraryKind;
import com.intellij.openapi.roots.libraries.LibraryUtil;
import com.intellij.openapi.vfs.VirtualFile;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.net.URL;
import java.util.List;
public abstract class DownloadableLibraryTypeBase extends DownloadableLibraryType {
private Icon myIcon;
public DownloadableLibraryTypeBase(@NotNull String libraryCategoryName,
@NotNull String groupId,
@NotNull Icon icon,
@NotNull URL... localUrls) {
super(new LibraryKind<LibraryVersionProperties>(libraryCategoryName), libraryCategoryName,
DownloadableLibraryService.getInstance().createLibraryDescription(groupId, localUrls));
myIcon = icon;
}
public Icon getIcon() {
return myIcon;
}
public abstract String[] getDetectionClassNames();
@Override
public LibraryVersionProperties detect(@NotNull List<VirtualFile> classesRoots) {
for (String className : getDetectionClassNames()) {
final LibraryVersionProperties versionProperties = detectJsfVersion(classesRoots, className);
if (versionProperties != null) return versionProperties;
}
return null;
}
@Nullable
private LibraryVersionProperties detectJsfVersion(List<VirtualFile> classesRoots, String detectionClass) {
if (!LibraryUtil.isClassAvailableInLibrary(classesRoots, detectionClass)) {
return null;
}
final String version = JarVersionDetectionUtil.detectJarVersion(detectionClass, classesRoots);
return new LibraryVersionProperties(version);
}
}
@@ -0,0 +1,58 @@
package com.intellij.framework.library;
import com.intellij.ide.util.frameworkSupport.FrameworkSupportConfigurableBase;
import com.intellij.ide.util.frameworkSupport.FrameworkSupportModel;
import com.intellij.ide.util.frameworkSupport.FrameworkSupportProviderBase;
import com.intellij.ide.util.frameworkSupport.FrameworkVersion;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleType;
import com.intellij.openapi.roots.ModifiableRootModel;
import com.intellij.openapi.roots.libraries.Library;
import com.intellij.openapi.roots.ui.configuration.libraries.CustomLibraryDescription;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public abstract class UnderlyingFrameworkSupportProviderBase extends FrameworkSupportProviderBase {
public UnderlyingFrameworkSupportProviderBase(final @NonNls @NotNull String id, final @NotNull String title) {
super(id, title);
}
@Override
protected void addSupport(@NotNull Module module,
@NotNull ModifiableRootModel rootModel,
FrameworkVersion version,
@Nullable Library library) {
}
@NotNull
@Override
public FrameworkSupportConfigurableBase createConfigurable(@NotNull final FrameworkSupportModel model) {
return new LibrarySupportConfigurable(this, model);
}
public boolean isEnabledForModuleType(@NotNull ModuleType moduleType) {
return true;
}
protected abstract Class<? extends DownloadableLibraryType> getLibraryClass() ;
private class LibrarySupportConfigurable extends FrameworkSupportConfigurableBase implements FrameworkSupportWithLibrary {
private LibrarySupportConfigurable(UnderlyingFrameworkSupportProviderBase provider,
FrameworkSupportModel model) {
super(provider, model);
}
@NotNull
@Override
public CustomLibraryDescription createLibraryDescription() {
return DownloadableLibraryService.getInstance().createDescriptionForType(getLibraryClass());
}
@Override
public boolean isLibraryOnly() {
return false;
}
}
}