当前位置: 首页>>代码示例>>Java>>正文


Java ProjectSettingsService类代码示例

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


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

示例1: checkSourceRootsConfigured

import com.intellij.openapi.roots.ui.configuration.ProjectSettingsService; //导入依赖的package包/类
public static boolean checkSourceRootsConfigured(final Module module, final boolean askUserToSetupSourceRoots) {
  List<VirtualFile> sourceRoots = ModuleRootManager.getInstance(module).getSourceRoots(JavaModuleSourceRootTypes.SOURCES);
  if (sourceRoots.isEmpty()) {
    if (!askUserToSetupSourceRoots) {
      return false;
    }

    Project project = module.getProject();
    Messages.showErrorDialog(project,
                             ProjectBundle.message("module.source.roots.not.configured.error", module.getName()),
                             ProjectBundle.message("module.source.roots.not.configured.title"));

    ProjectSettingsService.getInstance(project).showModuleConfigurationDialog(module.getName(), CommonContentEntriesEditor.NAME);

    sourceRoots = ModuleRootManager.getInstance(module).getSourceRoots(JavaModuleSourceRootTypes.SOURCES);
    if (sourceRoots.isEmpty()) {
      return false;
    }
  }
  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:PackageUtil.java

示例2: createPanel

import com.intellij.openapi.roots.ui.configuration.ProjectSettingsService; //导入依赖的package包/类
@NotNull
private static EditorNotificationPanel createPanel(@NotNull final Project project, @NotNull final PsiFile file) {
  final EditorNotificationPanel panel = new EditorNotificationPanel();
  panel.setText(ProjectBundle.message("project.sdk.not.defined"));
  panel.createActionLabel(ProjectBundle.message("project.sdk.setup"), new Runnable() {
    @Override
    public void run() {
      final Sdk projectSdk = ProjectSettingsService.getInstance(project).chooseAndSetSdk();
      if (projectSdk == null) return;
      ApplicationManager.getApplication().runWriteAction(new Runnable() {
        @Override
        public void run() {
          final Module module = ModuleUtilCore.findModuleForPsiElement(file);
          if (module != null) {
            ModuleRootModificationUtil.setSdkInherited(module);
          }
        }
      });
    }
  });
  return panel;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:SetupSDKNotificationProvider.java

示例3: getNavigatable

import com.intellij.openapi.roots.ui.configuration.ProjectSettingsService; //导入依赖的package包/类
@Nullable
@Override
public Navigatable getNavigatable() {
  return new Navigatable() {
    @Nullable
    private OrderEntry myOrderEntry;

    @Override
    public void navigate(boolean requestFocus) {
      if (myOrderEntry != null) {
        ProjectSettingsService.getInstance(myProject).openLibraryOrSdkSettings(myOrderEntry);
      }
    }

    @Override
    public boolean canNavigate() {
      myOrderEntry = getOrderEntry();
      return myOrderEntry != null;
    }

    @Override
    public boolean canNavigateToSource() {
      return true;
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:ExternalSystemViewDefaultContributor.java

示例4: navigate

import com.intellij.openapi.roots.ui.configuration.ProjectSettingsService; //导入依赖的package包/类
@Override
public void navigate(final boolean requestFocus) {
  Module module = ModuleUtil.findModuleForPsiElement(getValue());
  if (module != null) {
    final VirtualFile file = getVirtualFile();
    final Project project = getProject();
    ProjectSettingsService service = ProjectSettingsService.getInstance(myProject);
    if (ProjectRootsUtil.isModuleContentRoot(file, project)) {
      service.openModuleSettings(module);
    }
    else if (ProjectRootsUtil.isLibraryRoot(file, project)) {
      final OrderEntry orderEntry = LibraryUtil.findLibraryEntry(file, module.getProject());
      if (orderEntry != null) {
        service.openLibraryOrSdkSettings(orderEntry);
      }
    }
    else {
      service.openContentEntriesSettings(module);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:PsiDirectoryNode.java

示例5: checkSourceRootsConfigured

import com.intellij.openapi.roots.ui.configuration.ProjectSettingsService; //导入依赖的package包/类
private static boolean checkSourceRootsConfigured(final Module module) {
  VirtualFile[] sourceRoots = ModuleRootManager.getInstance(module).getSourceRoots();
  if (sourceRoots.length == 0) {
    Messages.showErrorDialog(
      module.getProject(),
      ProjectBundle.message("module.source.roots.not.configured.error", module.getName()),
      ProjectBundle.message("module.source.roots.not.configured.title")
    );

    ProjectSettingsService
      .getInstance(module.getProject()).showModuleConfigurationDialog(module.getName(), CommonContentEntriesEditor.NAME);

    sourceRoots = ModuleRootManager.getInstance(module).getSourceRoots();
    if (sourceRoots.length == 0) {
      return false;
    }
  }
  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:PlatformPackageUtil.java

示例6: chooseAndSetSdk

import com.intellij.openapi.roots.ui.configuration.ProjectSettingsService; //导入依赖的package包/类
@Override
public void chooseAndSetSdk(@Nullable final Module module) {
    if (isSquirrelModule(module)) {
        Sdk projectSdk = ProjectSettingsService.getInstance(myProject).chooseAndSetSdk();
        if (projectSdk == null && module != null) {
            ApplicationManager.getApplication().runWriteAction(new Runnable() {
                @Override
                public void run() {
                    if (!module.isDisposed()) {
                        ModuleRootModificationUtil.setSdkInherited(module);
                    }
                }
            });
        }
    }
    else {
        super.chooseAndSetSdk(module);
    }
}
 
开发者ID:shvetsgroup,项目名称:squirrel-lang-idea-plugin,代码行数:20,代码来源:SquirrelIdeaSdkService.java

示例7: checkSourceRootsConfigured

import com.intellij.openapi.roots.ui.configuration.ProjectSettingsService; //导入依赖的package包/类
public static boolean checkSourceRootsConfigured(final Module module, final boolean askUserToSetupSourceRoots) {
  VirtualFile[] sourceRoots = ModuleRootManager.getInstance(module).getSourceRoots();
  if (sourceRoots.length == 0) {
    if (!askUserToSetupSourceRoots) {
      return false;
    }

    Project project = module.getProject();
    Messages.showErrorDialog(project,
                             ProjectBundle.message("module.source.roots.not.configured.error", module.getName()),
                             ProjectBundle.message("module.source.roots.not.configured.title"));

    ProjectSettingsService.getInstance(project).showModuleConfigurationDialog(module.getName(), CommonContentEntriesEditor.NAME);

    sourceRoots = ModuleRootManager.getInstance(module).getSourceRoots();
    if (sourceRoots.length == 0) {
      return false;
    }
  }
  return true;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:22,代码来源:PackageUtil.java

示例8: createPanel

import com.intellij.openapi.roots.ui.configuration.ProjectSettingsService; //导入依赖的package包/类
@NotNull
private static EditorNotificationPanel createPanel(final @NotNull Project project, final @NotNull PsiFile file) {
  final EditorNotificationPanel panel = new EditorNotificationPanel();
  panel.setText(ProjectBundle.message("project.sdk.not.defined"));
  panel.createActionLabel(ProjectBundle.message("project.sdk.setup"), new Runnable() {
    @Override
    public void run() {
      final Sdk projectSdk = ProjectSettingsService.getInstance(project).chooseAndSetSdk();
      if (projectSdk == null) return;
      ApplicationManager.getApplication().runWriteAction(new Runnable() {
        @Override
        public void run() {
          final Module module = ModuleUtilCore.findModuleForPsiElement(file);
          if (module != null) {
            ModuleRootModificationUtil.setSdkInherited(module);
          }
        }
      });
    }
  });
  return panel;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:23,代码来源:SetupSDKNotificationProvider.java

示例9: checkSourceRootsConfigured

import com.intellij.openapi.roots.ui.configuration.ProjectSettingsService; //导入依赖的package包/类
public static boolean checkSourceRootsConfigured(final Module module, final boolean askUserToSetupSourceRoots)
{
	VirtualFile[] sourceRoots = ModuleRootManager.getInstance(module).getSourceRoots();
	if(sourceRoots.length == 0)
	{
		if(!askUserToSetupSourceRoots)
		{
			return false;
		}

		Project project = module.getProject();
		Messages.showErrorDialog(project, ProjectBundle.message("module.source.roots.not.configured.error", module.getName()),
				ProjectBundle.message("module.source.roots.not.configured.title"));

		ProjectSettingsService.getInstance(project).showModuleConfigurationDialog(module.getName(), ContentEntriesEditor.NAME);

		sourceRoots = ModuleRootManager.getInstance(module).getSourceRoots();
		if(sourceRoots.length == 0)
		{
			return false;
		}
	}
	return true;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:25,代码来源:PackageUtil.java

示例10: createPanel

import com.intellij.openapi.roots.ui.configuration.ProjectSettingsService; //导入依赖的package包/类
@NotNull
private static EditorNotificationPanel createPanel(final @NotNull Project project, final @NotNull PsiFile file)
{
	EditorNotificationPanel panel = new EditorNotificationPanel();
	panel.setText(JavaCoreBundle.message("module.jdk.not.defined"));
	panel.createActionLabel(JavaCoreBundle.message("module.jdk.setup"), () ->
	{
		final Module moduleForPsiElement = ModuleUtilCore.findModuleForPsiElement(file);
		if(moduleForPsiElement == null)
		{
			return;
		}

		ProjectSettingsService.getInstance(project).openModuleSettings(moduleForPsiElement);
	});
	return panel;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:18,代码来源:SetupJDKNotificationProvider.java

示例11: invoke

import com.intellij.openapi.roots.ui.configuration.ProjectSettingsService; //导入依赖的package包/类
@Override
public void invoke(@NotNull Project project, Editor editor, final PsiFile file) {
  Sdk projectJdk = ProjectSettingsService.getInstance(project).chooseAndSetSdk();
  if (projectJdk == null) return;
  ApplicationManager.getApplication().runWriteAction(new Runnable() {
    @Override
    public void run() {
      Module module = ModuleUtilCore.findModuleForPsiElement(file);
      if (module != null) {
        ModuleRootModificationUtil.setSdkInherited(module);
      }
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:SetupJDKFix.java

示例12: doMove

import com.intellij.openapi.roots.ui.configuration.ProjectSettingsService; //导入依赖的package包/类
public static void doMove(final Module[] modules, final ModuleGroup group, @Nullable final DataContext dataContext) {
  Project project = modules[0].getProject();
  for (final Module module : modules) {
    ModifiableModuleModel model = dataContext != null
                                  ? LangDataKeys.MODIFIABLE_MODULE_MODEL.getData(dataContext)
                                  : null;
    if (model != null){
      model.setModuleGroupPath(module, group == null ? null : group.getGroupPath());
    } else {
      ModuleManagerImpl.getInstanceImpl(project).setModuleGroupPath(module, group == null ? null : group.getGroupPath());
    }
  }

  AbstractProjectViewPane pane = ProjectView.getInstance(project).getCurrentProjectViewPane();
  if (pane != null) {
    pane.updateFromRoot(true);
  }

  if (!ProjectSettingsService.getInstance(project).processModulesMoved(modules, group) && pane != null) {
    if (group != null) {
      pane.selectModuleGroup(group, true);
    }
    else {
      pane.selectModule(modules[0], true);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:28,代码来源:MoveModulesToGroupAction.java

示例13: canNavigate

import com.intellij.openapi.roots.ui.configuration.ProjectSettingsService; //导入依赖的package包/类
@Override
public boolean canNavigate() {
  VirtualFile file = getVirtualFile();
  Project project = getProject();

  ProjectSettingsService service = ProjectSettingsService.getInstance(myProject);
  return file != null && ((ProjectRootsUtil.isModuleContentRoot(file, project) && service.canOpenModuleSettings()) ||
                          (ProjectRootsUtil.isModuleSourceRoot(file, project)  && service.canOpenContentEntriesSettings()) ||
                          (ProjectRootsUtil.isLibraryRoot(file, project) && service.canOpenModuleLibrarySettings()));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:PsiDirectoryNode.java

示例14: isNavigatableLibraryRoot

import com.intellij.openapi.roots.ui.configuration.ProjectSettingsService; //导入依赖的package包/类
private boolean isNavigatableLibraryRoot() {
  VirtualFile jarRoot = getJarRoot();
  final Project project = getProject();
  if (jarRoot != null && ProjectRootsUtil.isLibraryRoot(jarRoot, project)) {
    final OrderEntry orderEntry = LibraryUtil.findLibraryEntry(jarRoot, project);
    return orderEntry != null && ProjectSettingsService.getInstance(project).canOpenLibraryOrSdkSettings(orderEntry);
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:PsiFileNode.java

示例15: navigate

import com.intellij.openapi.roots.ui.configuration.ProjectSettingsService; //导入依赖的package包/类
@Override
public void navigate(boolean requestFocus) {
  final VirtualFile jarRoot = getJarRoot();
  final Project project = getProject();
  if (requestFocus && jarRoot != null && ProjectRootsUtil.isLibraryRoot(jarRoot, project)) {
    final OrderEntry orderEntry = LibraryUtil.findLibraryEntry(jarRoot, project);
    if (orderEntry != null) {
      ProjectSettingsService.getInstance(project).openLibraryOrSdkSettings(orderEntry);
      return;
    }
  }

  super.navigate(requestFocus);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:PsiFileNode.java


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