本文整理汇总了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;
}
示例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;
}
示例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;
}
};
}
示例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);
}
}
}
示例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;
}
示例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);
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
}
});
}
示例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);
}
}
}
示例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()));
}
示例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;
}
示例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);
}