本文整理汇总了Java中com.intellij.openapi.roots.ModifiableModelsProvider类的典型用法代码示例。如果您正苦于以下问题:Java ModifiableModelsProvider类的具体用法?Java ModifiableModelsProvider怎么用?Java ModifiableModelsProvider使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ModifiableModelsProvider类属于com.intellij.openapi.roots包,在下文中一共展示了ModifiableModelsProvider类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createConfigurable
import com.intellij.openapi.roots.ModifiableModelsProvider; //导入依赖的package包/类
@Override
@NotNull
public FrameworkSupportInModuleConfigurable createConfigurable( @NotNull final FrameworkSupportModel model )
{
return new RepositoryLibrarySupportInModuleConfigurable( model.getProject(), RepositoryLibraryDescription.findDescription( "systems.manifold", "manifold-all" ) )
{
@Override
public void addSupport( @NotNull Module module, @NotNull ModifiableRootModel rootModel, @NotNull ModifiableModelsProvider modifiableModelsProvider )
{
super.addSupport( module, rootModel, modifiableModelsProvider );
// also add tools.jar to the SDK if not already present
ApplicationManager.getApplication().invokeLater( () -> ApplicationManager.getApplication().runWriteAction( () -> {
ModifiableRootModel rootModel2 = ModuleRootManager.getInstance( module ).getModifiableModel();
ManSupportProvider.addToolsJar( rootModel2 );
rootModel2.commit();
} ) );
}
};
}
示例2: generateProject
import com.intellij.openapi.roots.ModifiableModelsProvider; //导入依赖的package包/类
@Override
public void generateProject(@NotNull final Project project, @NotNull final VirtualFile baseDir,
@NotNull final CatberryProjectSettings data, @NotNull final Module module) {
ApplicationManager.getApplication().runWriteAction(
new Runnable() {
public void run() {
final ModifiableRootModel modifiableModel =
ModifiableModelsProvider.SERVICE.getInstance().getModuleModifiableModel(module);
URL url = CatberryProjectGenerator.class.getClassLoader().getResource(
"templates/new_project/" + data.templateEngine);
if (!FileUtils.copyResourcesRecursively(url, new File(baseDir.getPath()), false))
LOG.error("Unable to copy resources for project generation");
ModifiableModelsProvider.SERVICE.getInstance().commitModuleModifiableModel(modifiableModel);
}
}
);
}
示例3: doSetup
import com.intellij.openapi.roots.ModifiableModelsProvider; //导入依赖的package包/类
protected void doSetup(ModifiableModelsProvider modifiableModelsProvider, final Module module) {
final ModifiableFacetModel model = modifiableModelsProvider.getFacetModifiableModel(module);
final String name = UniqueNameGenerator.generateUniqueName(myFacetType.getDefaultFacetName(), new Condition<String>() {
@Override
public boolean value(String s) {
return FacetManager.getInstance(module).findFacet(myFacetType.getId(), s) == null;
}
});
final F facet = FacetManager.getInstance(module).createFacet(myFacetType, name, myConfiguration,
findUnderlyingFacet(module));
model.addFacet(facet);
modifiableModelsProvider.commitFacetModifiableModel(module, model);
final ModifiableRootModel rootModel = modifiableModelsProvider.getModuleModifiableModel(module);
myDetector.setupFacet(facet, rootModel);
modifiableModelsProvider.commitModuleModifiableModel(rootModel);
}
示例4: removeLibrary
import com.intellij.openapi.roots.ModifiableModelsProvider; //导入依赖的package包/类
private static void removeLibrary(final Sdk sdk) {
ApplicationManager.getApplication().invokeLater(new Runnable() {
public void run() {
ApplicationManager.getApplication().runWriteAction(new Runnable() {
public void run() {
final LibraryTable.ModifiableModel libraryTableModel =
ModifiableModelsProvider.SERVICE.getInstance().getLibraryTableModifiableModel();
final Library library = libraryTableModel.getLibraryByName(PythonFacet.getFacetLibraryName(sdk.getName()));
if (library != null) {
libraryTableModel.removeLibrary(library);
}
libraryTableModel.commit();
}
});
}
}, ModalityState.NON_MODAL);
}
示例5: renameLibrary
import com.intellij.openapi.roots.ModifiableModelsProvider; //导入依赖的package包/类
private static void renameLibrary(final Sdk sdk, final String previousName) {
ApplicationManager.getApplication().invokeLater(new Runnable() {
public void run() {
ApplicationManager.getApplication().runWriteAction(new Runnable() {
public void run() {
final LibraryTable.ModifiableModel libraryTableModel =
ModifiableModelsProvider.SERVICE.getInstance().getLibraryTableModifiableModel();
final Library library = libraryTableModel.getLibraryByName(PythonFacet.getFacetLibraryName(previousName));
if (library != null) {
final Library.ModifiableModel model = library.getModifiableModel();
model.setName(PythonFacet.getFacetLibraryName(sdk.getName()));
model.commit();
}
libraryTableModel.commit();
}
});
}
}, ModalityState.NON_MODAL);
}
示例6: createConfigurable
import com.intellij.openapi.roots.ModifiableModelsProvider; //导入依赖的package包/类
@NotNull
@Override
public FrameworkSupportInModuleConfigurable createConfigurable(@NotNull FrameworkSupportModel model) {
return new FrameworkSupportInModuleConfigurable() {
@Nullable
@Override
public JComponent createComponent() {
return null;
}
@Override
public void addSupport(@NotNull Module module,
@NotNull ModifiableRootModel rootModel,
@NotNull ModifiableModelsProvider modifiableModelsProvider) {
final BuildScriptDataBuilder buildScriptData = getBuildScriptData(module);
if (buildScriptData != null) {
GradleFrameworkSupportProvider.this.addSupport(module, rootModel, modifiableModelsProvider, buildScriptData);
}
}
};
}
示例7: addSupport
import com.intellij.openapi.roots.ModifiableModelsProvider; //导入依赖的package包/类
@Override
public void addSupport(
@NotNull Module module,
@NotNull ModifiableRootModel rootModel,
@NotNull ModifiableModelsProvider modifiableModelsProvider) {
FacetType<AppEngineFlexibleFacet, AppEngineFlexibleFacetConfiguration> facetType =
AppEngineFlexibleFacet.getFacetType();
AppEngineFlexibleFacet facet =
FacetManager.getInstance(module)
.addFacet(facetType, facetType.getPresentableName(), null /* underlyingFacet */);
StartupManagerEx startupManger = StartupManagerEx.getInstanceEx(module.getProject());
if (!startupManger.postStartupActivityPassed()) {
startupManger.registerPostStartupActivity(
() -> addAppEngineFlexibleSupport(rootModel, facet));
} else {
addAppEngineFlexibleSupport(rootModel, facet);
}
CloudSdkService sdkService = CloudSdkService.getInstance();
if (!sdkService
.validateCloudSdk(cloudSdkPanel.getCloudSdkDirectoryText())
.contains(CloudSdkValidationResult.MALFORMED_PATH)) {
sdkService.setSdkHomePath(cloudSdkPanel.getCloudSdkDirectoryText());
}
}
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-intellij,代码行数:27,代码来源:AppEngineFlexibleSupportProvider.java
示例8: testAddSupportPostStartup
import com.intellij.openapi.roots.ModifiableModelsProvider; //导入依赖的package包/类
public void testAddSupportPostStartup() {
Module module = createModule("testModule");
doNothing()
.when(supportConfigurable)
.addAppEngineFlexibleSupport(
any(ModifiableRootModel.class), any(AppEngineFlexibleFacet.class));
new WriteAction() {
@Override
protected void run(@NotNull Result result) throws Throwable {
supportConfigurable.addSupport(
module, mock(ModifiableRootModel.class), mock(ModifiableModelsProvider.class));
}
}.execute();
assertNotNull(FacetManager.getInstance(module).getFacetByType(AppEngineFlexibleFacetType.ID));
}
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-intellij,代码行数:19,代码来源:AppEngineFlexibleSupportConfigurableTest.java
示例9: generateLibrary
import com.intellij.openapi.roots.ModifiableModelsProvider; //导入依赖的package包/类
private static void generateLibrary(final String name, final String path, @NotNull final Project project) {
final ModifiableModelsProvider modelsProvider = ModifiableModelsProvider.SERVICE.getInstance();
final LibraryTable.ModifiableModel model = modelsProvider.getLibraryTableModifiableModel(project);
Library library = model.getLibraryByName(name);
if (library == null) {
library = model.createLibrary(name);
}
fillLibrary(library, Lists.newArrayList(path));
model.commit();
final Library.ModifiableModel libModel = library.getModifiableModel();
libModel.commit();
final Module[] modules = ModuleManager.getInstance(project).getModules();
for (Module module : modules) {
final ModifiableRootModel modifiableModel = modelsProvider.getModuleModifiableModel(module);
modifiableModel.addLibraryEntry(library);
modelsProvider.commitModuleModifiableModel(modifiableModel);
}
}
示例10: attachLibrary
import com.intellij.openapi.roots.ModifiableModelsProvider; //导入依赖的package包/类
public void attachLibrary(@NotNull final List<String> paths) {
final ModifiableModelsProvider modelsProvider = ModifiableModelsProvider.SERVICE.getInstance();
ApplicationManager.getApplication().runWriteAction(new Runnable() {
@Override
public void run() {
// add all paths to library
final LibraryTable.ModifiableModel model = modelsProvider.getLibraryTableModifiableModel(myProject);
Library library = model.getLibraryByName(THE_R_LIBRARY);
if (library == null) {
library = model.createLibrary(THE_R_LIBRARY);
}
TheRSkeletonGenerator.fillLibrary(library, paths);
model.commit();
final Library.ModifiableModel libModel = library.getModifiableModel();
libModel.commit();
final Module[] modules = ModuleManager.getInstance(myProject).getModules();
for (Module module : modules) {
final ModifiableRootModel modifiableModel = modelsProvider.getModuleModifiableModel(module);
modifiableModel.addLibraryEntry(library);
modelsProvider.commitModuleModifiableModel(modifiableModel);
}
}
});
}
示例11: setupFramework
import com.intellij.openapi.roots.ModifiableModelsProvider; //导入依赖的package包/类
@Override
public void setupFramework(@NotNull ModifiableModelsProvider modifiableModelsProvider, @NotNull ModulesProvider modulesProvider)
{
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
public void run() {
final Module moduleForFile = ProjectRootManager.getInstance(context.getProject()).getFileIndex().getModuleForFile(collection.iterator().next());
final AddSupportForSingleFrameworkDialog dialog = AddSupportForSingleFrameworkDialog.createDialog(moduleForFile, new MuleFrameworkSupportProvider());
dialog.setTitle(dialog.getTitle() + " - " + moduleForFile.getName());
dialog.showAndGet();
}
});
}
示例12: addSupport
import com.intellij.openapi.roots.ModifiableModelsProvider; //导入依赖的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();
}
}
示例13: addLibrary
import com.intellij.openapi.roots.ModifiableModelsProvider; //导入依赖的package包/类
static Library addLibrary(Sdk sdk) {
final LibraryTable.ModifiableModel libraryTableModel = ModifiableModelsProvider.SERVICE.getInstance().getLibraryTableModifiableModel();
final Library library = libraryTableModel.createLibrary(PythonFacet.getFacetLibraryName(sdk.getName()));
final Library.ModifiableModel model = library.getModifiableModel();
for (String url : sdk.getRootProvider().getUrls(OrderRootType.CLASSES)) {
model.addRoot(url, OrderRootType.CLASSES);
model.addRoot(url, OrderRootType.SOURCES);
}
model.commit();
libraryTableModel.commit();
return library;
}
示例14: addSupport
import com.intellij.openapi.roots.ModifiableModelsProvider; //导入依赖的package包/类
@Override
public void addSupport(@NotNull Module module,
@NotNull ModifiableRootModel rootModel,
@NotNull ModifiableModelsProvider modifiableModelsProvider,
@NotNull BuildScriptDataBuilder buildScriptData) {
buildScriptData
.addPluginDefinition("apply plugin: 'java'")
.addPropertyDefinition("sourceCompatibility = 1.5")
.addRepositoriesDefinition("mavenCentral()")
.addDependencyNotation("testCompile group: 'junit', name: 'junit', version: '4.11'");
}
示例15: addSupport
import com.intellij.openapi.roots.ModifiableModelsProvider; //导入依赖的package包/类
@Override
public void addSupport(@NotNull Module module,
@NotNull ModifiableRootModel rootModel,
@NotNull ModifiableModelsProvider modifiableModelsProvider,
@NotNull BuildScriptDataBuilder buildScriptData) {
buildScriptData
.addPluginDefinition("apply plugin: 'groovy'")
.addRepositoriesDefinition("mavenCentral()")
.addDependencyNotation("compile 'org.codehaus.groovy:groovy-all:2.3.11'")
.addDependencyNotation("testCompile group: 'junit', name: 'junit', version: '4.11'");
}