本文整理汇总了Java中com.intellij.openapi.roots.impl.libraries.LibraryEx.getProperties方法的典型用法代码示例。如果您正苦于以下问题:Java LibraryEx.getProperties方法的具体用法?Java LibraryEx.getProperties怎么用?Java LibraryEx.getProperties使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.roots.impl.libraries.LibraryEx
的用法示例。
在下文中一共展示了LibraryEx.getProperties方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createNewLibrary
import com.intellij.openapi.roots.impl.libraries.LibraryEx; //导入方法依赖的package包/类
private LibraryEx createNewLibrary(@NotNull final Module module, final LibraryTable.ModifiableModel modifiableModel) {
RepositoryLibraryProperties libraryProperties = new RepositoryLibraryProperties(
libraryDescription.getGroupId(),
libraryDescription.getArtifactId(),
model.getVersion());
final LibraryEx library = (LibraryEx)modifiableModel.createLibrary(
LibraryEditingUtil.suggestNewLibraryName(modifiableModel, RepositoryLibraryType.getInstance().getDescription(libraryProperties)),
RepositoryLibraryType.REPOSITORY_LIBRARY_KIND);
RepositoryLibraryProperties realLibraryProperties = (RepositoryLibraryProperties)library.getProperties();
realLibraryProperties.setMavenId(libraryProperties.getMavenId());
ApplicationManager.getApplication().runWriteAction(new Runnable() {
@Override
public void run() {
modifiableModel.commit();
}
});
RepositoryUtils.loadDependencies(
module.getProject(),
library,
model.isDownloadSources(),
model.isDownloadJavaDocs(),
null);
return library;
}
示例2: isLibraryEqualsToSelected
import com.intellij.openapi.roots.impl.libraries.LibraryEx; //导入方法依赖的package包/类
private boolean isLibraryEqualsToSelected(Library library) {
if (!(library instanceof LibraryEx)) {
return false;
}
LibraryEx libraryEx = (LibraryEx)library;
if (!RepositoryLibraryType.REPOSITORY_LIBRARY_KIND.equals(libraryEx.getKind())) {
return false;
}
LibraryProperties libraryProperties = libraryEx.getProperties();
if (libraryProperties == null || !(libraryProperties instanceof RepositoryLibraryProperties)) {
return false;
}
RepositoryLibraryProperties repositoryLibraryProperties = (RepositoryLibraryProperties)libraryProperties;
RepositoryLibraryDescription description = RepositoryLibraryDescription.findDescription(repositoryLibraryProperties);
if (!description.equals(libraryDescription)) {
return false;
}
return Comparing.equal(repositoryLibraryProperties.getVersion(), model.getVersion());
}
示例3: getDefaultDependencyScope
import com.intellij.openapi.roots.impl.libraries.LibraryEx; //导入方法依赖的package包/类
@Nullable
@Override
public DependencyScope getDefaultDependencyScope(@NotNull Library library) {
if (!(library instanceof LibraryEx)) {
return null;
}
LibraryEx libraryEx = (LibraryEx)library;
LibraryProperties libraryProperties = libraryEx.getProperties();
if (libraryProperties == null || !(libraryProperties instanceof RepositoryLibraryProperties)) {
return null;
}
RepositoryLibraryProperties repositoryLibraryProperties = (RepositoryLibraryProperties)libraryProperties;
RepositoryLibraryDescription libraryDescription = RepositoryLibraryDescription.findDescription(repositoryLibraryProperties);
return libraryDescription.getSuggestedScope();
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:RepositoryLibraryDependencyScopeSuggester.java
示例4: addSupport
import com.intellij.openapi.roots.impl.libraries.LibraryEx; //导入方法依赖的package包/类
@Override
public void addSupport(@NotNull Module module, @NotNull ModifiableRootModel modifiableRootModel, @NotNull ModifiableModelsProvider modifiableModelsProvider) {
String muleHome = null;
Library[] libs = modifiableModelsProvider.getLibraryTableModifiableModel().getLibraries();
for (Library nextLib : libs) {
LibraryEx libraryEx = (LibraryEx)nextLib;
if (muleHome == null && MuleLibraryKind.MULE_LIBRARY_KIND.equals(libraryEx.getKind())) {
MuleLibraryProperties properties = (MuleLibraryProperties)libraryEx.getProperties();
if (properties != null && properties.getState() != null) {
muleHome = properties.getState().getMuleHome();
break;
}
}
}
//Project myProject = module.getProject();
//if (!MuleConfigUtils.isMuleProject(myProject)) {
if (!hasFacet(module)) {
MuleFacetType type = (MuleFacetType) FacetTypeRegistry.getInstance().findFacetType(MuleFacet.ID);
MuleFacetConfiguration configuration = type.createDefaultConfiguration();
if (muleHome != null)
configuration.setPathToSdk(muleHome);
Facet facet = type.createFacet(module, type.getPresentableName(), configuration, null);
ModifiableFacetModel model = FacetManager.getInstance(module).createModifiableModel();
model.addFacet(facet);
model.commit();
}
}
示例5: loadDependencies
import com.intellij.openapi.roots.impl.libraries.LibraryEx; //导入方法依赖的package包/类
public static void loadDependencies(@NotNull final Project project,
@NotNull final LibraryEx library,
boolean downloadSources,
boolean downloadJavaDocs,
@Nullable String copyTo) {
if (library.getKind() != RepositoryLibraryType.REPOSITORY_LIBRARY_KIND) {
return;
}
final RepositoryLibraryProperties properties = (RepositoryLibraryProperties)library.getProperties();
MavenDependenciesRemoteManager.getInstance(project)
.downloadDependenciesAsync(
properties,
downloadSources,
downloadJavaDocs,
copyTo,
new MavenRemoteTask.ResultProcessor<List<OrderRoot>>() {
@Override
public void process(final List<OrderRoot> roots) {
if (roots == null || roots.isEmpty()) {
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
public void run() {
Messages.showErrorDialog(project, ProjectBundle.message("maven.downloading.failed", properties.getMavenId()),
CommonBundle.getErrorTitle());
}
});
return;
}
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
public void run() {
if (library.isDisposed()) {
return;
}
AccessToken token = WriteAction.start();
try {
final NewLibraryEditor editor = new NewLibraryEditor(null, properties);
editor.removeAllRoots();
editor.addRoots(roots);
final Library.ModifiableModel model = library.getModifiableModel();
editor.applyTo((LibraryEx.ModifiableModelEx)model);
model.commit();
}
finally {
token.finish();
}
}
});
}
}
);
}