• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ImportModuleAction类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.intellij.ide.actions.ImportModuleAction的典型用法代码示例。如果您正苦于以下问题:Java ImportModuleAction类的具体用法?Java ImportModuleAction怎么用?Java ImportModuleAction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ImportModuleAction类属于com.intellij.ide.actions包,在下文中一共展示了ImportModuleAction类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: processCheckedOutDirectory

import com.intellij.ide.actions.ImportModuleAction; //导入依赖的package包/类
@Override
public boolean processCheckedOutDirectory(Project project, File directory) {
  VirtualFile file = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(directory);
  LOG.assertTrue(file != null, "Can't find " + directory);
  int rc = Messages.showYesNoDialog(project, VcsBundle.message("checkout.create.project.prompt",
                                                               ProjectCheckoutListener.getProductNameWithArticle(),
                                                               directory.getAbsolutePath()),
                                    VcsBundle.message("checkout.title"), Messages.getQuestionIcon());
  if (rc == Messages.YES) {
    AddModuleWizard wizard = createImportWizard(file);
    if (wizard == null) return false;
    if (wizard.showAndGet()) {
      ImportModuleAction.createFromWizard(null, wizard);
    }
    return true;
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:NewProjectCheckoutListener.java


示例2: notifyCheckoutListeners

import com.intellij.ide.actions.ImportModuleAction; //导入依赖的package包/类
private void notifyCheckoutListeners(final File directory, final boolean checkoutCompleted) {
    final VirtualFile file = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(directory);

    final AddModuleWizard wizard = ImportModuleAction.createImportWizard(null, null, file,
            ProjectImportProvider.PROJECT_IMPORT_PROVIDER.getExtensions());
    if (wizard == null) return;
    ImportModuleAction.createFromWizard(null, wizard);


    if (!checkoutCompleted) {
        final VcsAwareCheckoutListener[] vcsAwareExtensions = Extensions.getExtensions(VcsAwareCheckoutListener.EP_NAME);
        for (VcsAwareCheckoutListener extension : vcsAwareExtensions) {
            boolean processingCompleted = extension.processCheckedOutDirectory(myProject, directory, myVcsKey);
            if (processingCompleted) break;
        }
    }

    newProject = findProjectByBaseDirLocation(directory);
}
 
开发者ID:Microsoft,项目名称:vso-intellij,代码行数:20,代码来源:L2GitUtil.java


示例3: importFrom

import com.intellij.ide.actions.ImportModuleAction; //导入依赖的package包/类
private Module importFrom(String path,
                          @Nullable Project project, Consumer<Step> adjuster,
                          final ProjectImportProvider... providers) {
  VirtualFile file = LocalFileSystem.getInstance().refreshAndFindFileByPath(path);
  assertNotNull("Can't find " + path, file);
  assertTrue(providers[0].canImport(file, project));

  //noinspection unchecked
  myWizard = (T)ImportModuleAction.createImportWizard(project, null, file, providers);
  assertNotNull(myWizard);
  if (myWizard.getStepCount() > 0) {
    runWizard(adjuster);
  }
  return ContainerUtil.getFirstItem(ImportModuleAction.createFromWizard(project, myWizard));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:ProjectWizardTestCase.java


示例4: actionPerformed

import com.intellij.ide.actions.ImportModuleAction; //导入依赖的package包/类
@Override
public void actionPerformed(AnActionEvent e) {
  ProjectSystemId externalSystemId = ExternalSystemDataKeys.EXTERNAL_SYSTEM_ID.getData(e.getDataContext());
  if (externalSystemId == null) {
    return;
  }

  ExternalSystemManager<?,?,?,?,?> manager = ExternalSystemApiUtil.getManager(externalSystemId);
  if (manager == null) {
    return;
  }

  Project project = CommonDataKeys.PROJECT.getData(e.getDataContext());
  if (project == null) {
    return;
  }
  
  ProjectImportProvider[] projectImportProviders = new ProjectImportProvider[1];
  for (ProjectImportProvider provider : ProjectImportProvider.PROJECT_IMPORT_PROVIDER.getExtensions()) {
    if (provider instanceof AbstractExternalProjectImportProvider
        && externalSystemId.equals(((AbstractExternalProjectImportProvider)provider).getExternalSystemId()))
    {
      projectImportProviders[0] = provider;
      break;
    }
  }
  if (projectImportProviders[0] == null) {
    return;
  }

  AddModuleWizard wizard = ImportModuleAction.selectFileAndCreateWizard(project,
                                                                        null,
                                                                        manager.getExternalProjectDescriptor(),
                                                                        projectImportProviders);
  if (wizard != null && (wizard.getStepCount() <= 0 || wizard.showAndGet())) {
    ImportModuleAction.createFromWizard(project, wizard);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:39,代码来源:AttachExternalProjectAction.java


示例5: showNotificationForUnlinkedGradleProject

import com.intellij.ide.actions.ImportModuleAction; //导入依赖的package包/类
private static void showNotificationForUnlinkedGradleProject(@NotNull final Project project) {
  if (!PropertiesComponent.getInstance(project).getBoolean(SHOW_UNLINKED_GRADLE_POPUP, true)
      || !GradleSettings.getInstance(project).getLinkedProjectsSettings().isEmpty()
      || project.getUserData(ExternalSystemDataKeys.NEWLY_IMPORTED_PROJECT) == Boolean.TRUE
      || project.getBaseDir() == null) {
    return;
  }

  File baseDir = VfsUtilCore.virtualToIoFile(project.getBaseDir());
  final File gradleFile = new File(baseDir, GradleConstants.DEFAULT_SCRIPT_NAME);
  if (gradleFile.exists()) {
    String message = String.format("%s<br>\n%s",
                                   GradleBundle.message("gradle.notifications.unlinked.project.found.msg", IMPORT_EVENT_DESCRIPTION),
                                   GradleBundle.message("gradle.notifications.do.not.show"));

    GradleNotification.getInstance(project).showBalloon(
      GradleBundle.message("gradle.notifications.unlinked.project.found.title"),
      message, NotificationType.INFORMATION, new NotificationListener.Adapter() {
        @Override
        protected void hyperlinkActivated(@NotNull Notification notification, @NotNull HyperlinkEvent e) {
          notification.expire();
          if (IMPORT_EVENT_DESCRIPTION.equals(e.getDescription())) {
            final ProjectDataManager projectDataManager = ServiceManager.getService(ProjectDataManager.class);
            GradleProjectImportBuilder gradleProjectImportBuilder = new GradleProjectImportBuilder(projectDataManager);
            final GradleProjectImportProvider gradleProjectImportProvider = new GradleProjectImportProvider(gradleProjectImportBuilder);
            AddModuleWizard wizard = new AddModuleWizard(null, gradleFile.getPath(), gradleProjectImportProvider);
            if ((wizard.getStepCount() <= 0 || wizard.showAndGet())) {
              ImportModuleAction.createFromWizard(project, wizard);
            }
          }
          else if (DO_NOT_SHOW_EVENT_DESCRIPTION.equals(e.getDescription())) {
            PropertiesComponent.getInstance(project).setValue(SHOW_UNLINKED_GRADLE_POPUP, false, true);
          }
        }
      }
    );
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:39,代码来源:GradleStartupActivity.java


示例6: importFrom

import com.intellij.ide.actions.ImportModuleAction; //导入依赖的package包/类
private Module importFrom(String path,
                          @Nullable Project project, Consumer<ModuleWizardStep> adjuster,
                          final ProjectImportProvider... providers) {
  VirtualFile file = LocalFileSystem.getInstance().refreshAndFindFileByPath(path);
  assertNotNull("Can't find " + path, file);
  assertTrue(providers[0].canImport(file, project));

  myWizard = ImportModuleAction.createImportWizard(project, null, file, providers);
  if (myWizard.getStepCount() > 0) {
    runWizard(adjuster);
  }
  List<Module> modules = ImportModuleAction.createFromWizard(project, myWizard);
  return modules == null || modules.isEmpty() ? null : modules.get(0);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:15,代码来源:ProjectWizardTestCase.java


示例7: processCheckedOutDirectory

import com.intellij.ide.actions.ImportModuleAction; //导入依赖的package包/类
@Override
public boolean processCheckedOutDirectory(Project project, File directory, VcsKey vcsKey) {
  int rc = Messages.showYesNoDialog(project, VcsBundle.message("checkout.create.project.prompt",
                                                               ProjectCheckoutListener.getProductNameWithArticle(),
                                                               directory.getAbsolutePath()),
                                    VcsBundle.message("checkout.title"), Messages.getQuestionIcon());
  if (rc == 0) {
    final ProjectManager pm = ProjectManager.getInstance();
    final Project[] projects = pm.getOpenProjects();
    final Set<VirtualFile> files = projectsLocationSet(projects);
    VirtualFile file = LocalFileSystem.getInstance().findFileByIoFile(directory);
    AddModuleWizard wizard = ImportModuleAction.createImportWizard(null, null, file, ProjectImportProvider.PROJECT_IMPORT_PROVIDER.getExtensions());
    if (wizard.showAndGet()) {
      ImportModuleAction.createFromWizard(null, wizard);
    }
    final Project[] projectsAfter = pm.getOpenProjects();

    for (Project project1 : projectsAfter) {
      if (project1.getBaseDir() != null && ! files.contains(project1.getBaseDir())) {
        final ProjectLevelVcsManager vcsManager = ProjectLevelVcsManager.getInstance(project1);
        vcsManager.setDirectoryMappings(Collections.singletonList(new VcsDirectoryMapping("", vcsKey.getName())));
        break;
      }
    }
    return true;
  }
  return false;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:29,代码来源:NewProjectCheckoutListener.java


示例8: actionPerformed

import com.intellij.ide.actions.ImportModuleAction; //导入依赖的package包/类
@Override
public void actionPerformed(AnActionEvent e) {
  ProjectSystemId externalSystemId = ExternalSystemDataKeys.EXTERNAL_SYSTEM_ID.getData(e.getDataContext());
  if (externalSystemId == null) {
    return;
  }

  ExternalSystemManager<?,?,?,?,?> manager = ExternalSystemApiUtil.getManager(externalSystemId);
  if (manager == null) {
    return;
  }

  Project project = PlatformDataKeys.PROJECT.getData(e.getDataContext());
  if (project == null) {
    return;
  }
  
  ProjectImportProvider[] projectImportProviders = new ProjectImportProvider[1];
  for (ProjectImportProvider provider : ProjectImportProvider.PROJECT_IMPORT_PROVIDER.getExtensions()) {
    if (provider instanceof AbstractExternalProjectImportProvider
        && externalSystemId.equals(((AbstractExternalProjectImportProvider)provider).getExternalSystemId()))
    {
      projectImportProviders[0] = provider;
      break;
    }
  }
  if (projectImportProviders[0] == null) {
    return;
  }

  AddModuleWizard wizard = ImportModuleAction.selectFileAndCreateWizard(project,
                                                                        null,
                                                                        manager.getExternalProjectDescriptor(),
                                                                        projectImportProviders);
  if (wizard != null && (wizard.getStepCount() <= 0 || wizard.showAndGet())) {
    ImportModuleAction.createFromWizard(project, wizard);
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:39,代码来源:AttachExternalProjectAction.java


示例9: processCheckedOutDirectory

import com.intellij.ide.actions.ImportModuleAction; //导入依赖的package包/类
@Override
public boolean processCheckedOutDirectory(Project project, File directory, VcsKey vcsKey) {
  int rc = Messages.showYesNoDialog(project, VcsBundle
    .message("checkout.create.project.prompt", ProjectDirCheckoutListener.getProductNameWithArticle(), directory.getAbsolutePath()),
                                    VcsBundle.message("checkout.title"), Messages.getQuestionIcon());
  if (rc == Messages.YES) {
    final ProjectManager pm = ProjectManager.getInstance();
    final Project[] projects = pm.getOpenProjects();
    final Set<VirtualFile> files = projectsLocationSet(projects);
    VirtualFile file = LocalFileSystem.getInstance().findFileByIoFile(directory);
    AddModuleWizard wizard = ImportModuleAction.createImportWizard(null, null, file, ModuleImportProviders.getExtensions(false));
    if(wizard == null) {
      return false;
    }
    if (wizard.showAndGet()) {
      ImportModuleAction.createFromWizard(null, wizard);
    }
    final Project[] projectsAfter = pm.getOpenProjects();

    for (Project project1 : projectsAfter) {
      if (project1.getBaseDir() != null && !files.contains(project1.getBaseDir())) {
        final ProjectLevelVcsManager vcsManager = ProjectLevelVcsManager.getInstance(project1);
        vcsManager.setDirectoryMappings(Collections.singletonList(new VcsDirectoryMapping("", vcsKey.getName())));
        break;
      }
    }
    return true;
  }
  return false;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:31,代码来源:NewProjectCheckoutListener.java


示例10: configure

import com.intellij.ide.actions.ImportModuleAction; //导入依赖的package包/类
@Override
public void configure(
    @NotNull final HybrisProjectDescriptor hybrisProjectDescriptor,
    @NotNull final Project project,
    @NotNull final List<GradleModuleDescriptor> gradleModules,
    @Nullable final String[] gradleRootGroup
) {
    if (gradleModules.isEmpty()) {
        return;
    }
    final ProjectDataManager projectDataManager = ServiceManager.getService(ProjectDataManager.class);
    final GradleProjectImportBuilder gradleProjectImportBuilder = new GradleProjectImportBuilder(projectDataManager);
    final GradleProjectImportProvider gradleProjectImportProvider = new GradleProjectImportProvider(
        gradleProjectImportBuilder);

    gradleModules.forEach(gradleModule -> {
        ApplicationManager.getApplication().invokeAndWait(() -> {
            final AddModuleWizard wizard = new AddModuleWizard(
                project,
                gradleModule.getGradleFile().getPath(),
                gradleProjectImportProvider
            );
            final GradleProjectSettings projectSettings = gradleProjectImportBuilder.getControl(project)
                                                                                    .getProjectSettings();
            projectSettings.setUseAutoImport(true);
            projectSettings.setCreateEmptyContentRootDirectories(false);
            if (wizard.getStepCount() > 0) {
                final ModuleWizardStep step = wizard.getCurrentStepObject();
                if (step.isStepVisible()) {
                    step.updateStep();
                    step.updateDataModel();
                }
            }
            wizard.doFinishAction();
            final List<Module> newModules = ImportModuleAction.createFromWizard(project, wizard);
            if (gradleRootGroup != null && gradleRootGroup.length > 0) {
                moveGradleModulesToGroup(project, newModules, gradleRootGroup);
            }
        });
    });

    project.putUserData(ExternalSystemDataKeys.NEWLY_CREATED_PROJECT, Boolean.TRUE);
}
 
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:44,代码来源:DefaultGradleConfigurator.java


示例11: createImportWizard

import com.intellij.ide.actions.ImportModuleAction; //导入依赖的package包/类
@Nullable
protected AddModuleWizard createImportWizard(@NotNull VirtualFile file) {
  return ImportModuleAction.createImportWizard(null, null, file, ProjectImportProvider.PROJECT_IMPORT_PROVIDER.getExtensions());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:NewProjectCheckoutListener.java


示例12: applyBuildSystem

import com.intellij.ide.actions.ImportModuleAction; //导入依赖的package包/类
private void applyBuildSystem(final Project project) {
    if (buildSystem == BuildSystem.Gradle) {
        File baseDir = VfsUtilCore.virtualToIoFile(project.getBaseDir());
        File[] files = baseDir.listFiles(new FilenameFilter() {
            public boolean accept(File dir, String name) {
                return FileUtil.namesEqual("build.gradle", name);
            }
        });
        if (files != null && files.length != 0) {
            project.putUserData(ExternalSystemDataKeys.NEWLY_CREATED_PROJECT, Boolean.TRUE);
            ProjectDataManager projectDataManager = (ProjectDataManager) ServiceManager
                    .getService(ProjectDataManager.class);
            GradleProjectImportBuilder gradleProjectImportBuilder = new GradleProjectImportBuilder(
                    projectDataManager);
            gradleProjectImportBuilder.getControl(project).getProjectSettings()
                    .setDistributionType(DistributionType.WRAPPED);
            GradleProjectImportProvider gradleProjectImportProvider = new GradleProjectImportProvider(
                    gradleProjectImportBuilder);
            AddModuleWizard wizard = new AddModuleWizard((Project) null, files[0].getPath(),
                    new ProjectImportProvider[] { gradleProjectImportProvider });
            if (wizard.getStepCount() <= 0 || wizard.showAndGet()) {
                ImportModuleAction.createFromWizard(project, wizard);

                ApplicationManager.getApplication().runWriteAction(new Runnable() {
                    @Override
                    public void run() {
                        ModifiableModuleModel modifiableModel = ModuleManager.getInstance(project).getModifiableModel();
                        for (Module module : modifiableModel.getModules()) {
                            try {
                                LanguageLevelModuleExtensionImpl langModel = (LanguageLevelModuleExtensionImpl) LanguageLevelModuleExtensionImpl.getInstance(module).getModifiableModel(true);
                                langModel.setLanguageLevel(LanguageLevel.JDK_1_8);
                                langModel.commit();
                            } catch(Throwable t) {
                                // could be a non-Java project
                                t.printStackTrace();
                            }
                        }
                        modifiableModel.commit();
                    }
                });
            }
        }
    } else {
        FileDocumentManager.getInstance().saveAllDocuments();
        MavenProjectsManager.getInstance(project).forceUpdateAllProjectsOrFindAllAvailablePomFiles();
    }
}
 
开发者ID:robovm,项目名称:robovm-idea,代码行数:48,代码来源:RoboVmModuleBuilder.java


示例13: actionPerformed

import com.intellij.ide.actions.ImportModuleAction; //导入依赖的package包/类
@RequiredDispatchThread
@Override
public void actionPerformed(@Nonnull AnActionEvent e) {
  ProjectSystemId externalSystemId = e.getDataContext().getData(ExternalSystemDataKeys.EXTERNAL_SYSTEM_ID);
  if (externalSystemId == null) {
    return;
  }

  ExternalSystemManager<?, ?, ?, ?, ?> manager = ExternalSystemApiUtil.getManager(externalSystemId);
  if (manager == null) {
    return;
  }

  Project project = e.getDataContext().getData(CommonDataKeys.PROJECT);
  if (project == null) {
    return;
  }

  Ref<ModuleImportProvider<?>> providerRef = Ref.create();
  for (ModuleImportProvider<?> provider : ModuleImportProviders.getExtensions(true)) {
    if (provider instanceof AbstractExternalModuleImportProvider &&
        externalSystemId.equals(((AbstractExternalModuleImportProvider)provider).getExternalSystemId())) {
      providerRef.set(provider);
      break;
    }
    else if (provider instanceof LegacyModuleImportProvider) {
      ProjectImportProvider projectImportProvider = ((LegacyModuleImportProvider)provider).getProvider();
      if (projectImportProvider instanceof AbstractExternalProjectImportProvider &&
          externalSystemId.equals(((AbstractExternalProjectImportProvider)projectImportProvider).getExternalSystemId())) {

        providerRef.set(provider);
        break;
      }
    }
  }
  if (providerRef.get() == null) {
    return;
  }

  AddModuleWizard wizard =
          ImportModuleAction.selectFileAndCreateWizard(project, null, manager.getExternalProjectDescriptor(), Arrays.asList(providerRef.get()));
  if (wizard != null && (wizard.getStepCount() <= 0 || wizard.showAndGet())) {
    ImportModuleAction.createFromWizard(project, wizard);
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:46,代码来源:AttachExternalProjectAction.java



注:本文中的com.intellij.ide.actions.ImportModuleAction类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java JsrInstruction类代码示例发布时间:2022-05-23
下一篇:
Java AClusterStatus类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap