/* * Copyright 2013-2016 consulo.io * * 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 consulo.sandboxPlugin.ide.library; import com.intellij.icons.AllIcons; import com.intellij.openapi.project.Project; import com.intellij.openapi.roots.ModuleRootModel; import com.intellij.openapi.roots.libraries.DummyLibraryProperties; import com.intellij.openapi.roots.libraries.LibraryType; import com.intellij.openapi.roots.libraries.NewLibraryConfiguration; import com.intellij.openapi.roots.libraries.PersistentLibraryKind; import com.intellij.openapi.roots.libraries.ui.LibraryEditorComponent; import com.intellij.openapi.roots.libraries.ui.LibraryPropertiesEditor; import com.intellij.openapi.vfs.VirtualFile; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import consulo.sandboxPlugin.ide.module.extension.SandModuleExtension; import javax.swing.*; /** * @author VISTALL * @since 20.03.14 */ public class SandLibraryType extends LibraryType<DummyLibraryProperties> { protected SandLibraryType() { super(new PersistentLibraryKind<DummyLibraryProperties>("sand") { @NotNull @Override public DummyLibraryProperties createDefaultProperties() { return new DummyLibraryProperties(); } }); } @Override public boolean isAvailable(@NotNull ModuleRootModel moduleRootModel) { return moduleRootModel.getExtension(SandModuleExtension.class) != null; } @Nullable @Override public String getCreateActionName() { return "test"; } @Nullable @Override public NewLibraryConfiguration createNewLibrary(@NotNull JComponent parentComponent, @Nullable VirtualFile contextDirectory, @NotNull Project project) { return null; } @Nullable @Override public LibraryPropertiesEditor createPropertiesEditor(@NotNull LibraryEditorComponent<DummyLibraryProperties> editorComponent) { return null; } @Nullable @Override public Icon getIcon() { return AllIcons.Nodes.Static; } }