本文整理了Java中com.intellij.openapi.project.Project.getComponent()
方法的一些代码示例,展示了Project.getComponent()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Project.getComponent()
方法的具体详情如下:
包路径:com.intellij.openapi.project.Project
类名称:Project
方法名:getComponent
暂无
代码示例来源:origin: hsz/idea-gitignore
/**
* Returns {@link FilesIndexCacheProjectComponent} service instance.
*
* @param project current project
* @return {@link FilesIndexCacheProjectComponent instance}
*/
public static FilesIndexCacheProjectComponent getInstance(@NotNull final Project project) {
return project.getComponent(FilesIndexCacheProjectComponent.class);
}
代码示例来源:origin: hsz/idea-gitignore
/**
* Returns {@link OuterIgnoreLoaderComponent} service instance.
*
* @param project current project
* @return {@link OuterIgnoreLoaderComponent instance}
*/
@NotNull
public static OuterIgnoreLoaderComponent getInstance(@NotNull final Project project) {
return project.getComponent(OuterIgnoreLoaderComponent.class);
}
代码示例来源:origin: hsz/idea-gitignore
/**
* Returns {@link IgnoreManager} service instance.
*
* @param project current project
* @return {@link IgnoreManager instance}
*/
@NotNull
public static IgnoreManager getInstance(@NotNull final Project project) {
return project.getComponent(IgnoreManager.class);
}
代码示例来源:origin: jshiell/checkstyle-idea
private CheckStylePlugin plugin(final Project project) {
final CheckStylePlugin checkStylePlugin = project.getComponent(CheckStylePlugin.class);
if (checkStylePlugin == null) {
throw new IllegalStateException("Couldn't get checkstyle plugin");
}
return checkStylePlugin;
}
代码示例来源:origin: jshiell/checkstyle-idea
@NotNull
private CheckStylePlugin checkstylePlugin() {
final CheckStylePlugin checkStylePlugin = module.getProject().getComponent(CheckStylePlugin.class);
if (checkStylePlugin == null) {
throw new IllegalStateException("Couldn't get checkstyle plugin");
}
return checkStylePlugin;
}
代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin
@Nullable
protected File getCsvIndex(@NotNull Project project) {
Symfony2ProjectComponent symfony2ProjectComponent = project.getComponent(Symfony2ProjectComponent.class);
for(File file: symfony2ProjectComponent.getContainerFiles()) {
if(file.exists()) {
File csvFile = new File(file.getParentFile().getPath() + "/profiler/index.csv");
if (csvFile.exists()) {
return csvFile;
}
}
}
return null;
}
代码示例来源:origin: jshiell/checkstyle-idea
@Override
public void run() {
project.getComponent(CheckStylePlugin.class)
.asyncScanFiles(flattenFiles(sourceRoots), selectedOverride);
}
代码示例来源:origin: jshiell/checkstyle-idea
private Optional<PluginConfigurationManager> settings() {
final Project project = checkinPanel.getProject();
if (project == null) {
LOG.warn("Could not get project for check-in panel");
return empty();
}
final CheckStylePlugin plugin = project.getComponent(CheckStylePlugin.class);
if (plugin == null) {
LOG.warn("Could not get CheckStyle Plug-in, skipping");
return empty();
}
return ofNullable(plugin.configurationManager());
}
代码示例来源:origin: jshiell/checkstyle-idea
@Override
public void actionPerformed(final AnActionEvent event) {
final Project project = DataKeys.PROJECT.getData(event.getDataContext());
if (project == null) {
return;
}
final CheckStylePlugin checkStylePlugin
= project.getComponent(CheckStylePlugin.class);
if (checkStylePlugin == null) {
throw new IllegalStateException("Couldn't get checkstyle plugin");
}
final ToolWindow toolWindow = ToolWindowManager.getInstance(
project).getToolWindow(CheckStyleToolWindowPanel.ID_TOOLWINDOW);
toolWindow.hide(null);
}
代码示例来源:origin: jshiell/checkstyle-idea
@Override
public void run() {
List<VirtualFile> filesToScan = null;
if (module != null) {
// all non-excluded files of a module
final ModuleRootManager moduleRootManager = ModuleRootManager.getInstance(module);
filesToScan = flattenFiles(moduleRootManager.getContentRoots());
} else {
// all non-excluded files of the project
filesToScan = flattenFiles(new VirtualFile[]{project.getBaseDir()});
}
project.getComponent(CheckStylePlugin.class).asyncScanFiles(filesToScan, selectedOverride);
}
代码示例来源:origin: jshiell/checkstyle-idea
@Override
public void actionPerformed(final AnActionEvent event) {
final Project project = DataKeys.PROJECT.getData(event.getDataContext());
if (project == null) {
return;
}
final CheckStylePlugin checkStylePlugin
= project.getComponent(CheckStylePlugin.class);
if (checkStylePlugin == null) {
throw new IllegalStateException("Couldn't get checkstyle plugin");
}
final ToolWindow toolWindow = ToolWindowManager.getInstance(
project).getToolWindow(CheckStyleToolWindowPanel.ID_TOOLWINDOW);
final Content content = toolWindow.getContentManager().getContent(0);
if (content != null && content.getComponent() instanceof CheckStyleToolWindowPanel) {
((CheckStyleToolWindowPanel) content.getComponent()).collapseTree();
}
}
代码示例来源:origin: jshiell/checkstyle-idea
@Override
public boolean isSelected(final AnActionEvent event) {
final Project project = DataKeys.PROJECT.getData(event.getDataContext());
if (project == null) {
return false;
}
final CheckStylePlugin checkStylePlugin
= project.getComponent(CheckStylePlugin.class);
if (checkStylePlugin == null) {
throw new IllegalStateException("Couldn't get checkstyle plugin");
}
final ToolWindow toolWindow = ToolWindowManager.getInstance(
project).getToolWindow(CheckStyleToolWindowPanel.ID_TOOLWINDOW);
final Content content = toolWindow.getContentManager().getContent(0);
if (content != null && content.getComponent() instanceof CheckStyleToolWindowPanel) {
return ((CheckStyleToolWindowPanel) content.getComponent()).isDisplayingErrors();
}
return false;
}
代码示例来源:origin: jshiell/checkstyle-idea
@Override
public void actionPerformed(final AnActionEvent event) {
final Project project = DataKeys.PROJECT.getData(event.getDataContext());
if (project == null) {
return;
}
final CheckStylePlugin checkStylePlugin
= project.getComponent(CheckStylePlugin.class);
if (checkStylePlugin == null) {
throw new IllegalStateException("Couldn't get checkstyle plugin");
}
final ToolWindow toolWindow = ToolWindowManager.getInstance(
project).getToolWindow(CheckStyleToolWindowPanel.ID_TOOLWINDOW);
final Content content = toolWindow.getContentManager().getContent(0);
if (content != null && content.getComponent() instanceof CheckStyleToolWindowPanel) {
((CheckStyleToolWindowPanel) content.getComponent()).expandTree();
}
}
代码示例来源:origin: jshiell/checkstyle-idea
@Override
public void setSelected(final AnActionEvent event, final boolean selected) {
final Project project = DataKeys.PROJECT.getData(event.getDataContext());
if (project == null) {
return;
}
final CheckStylePlugin checkStylePlugin
= project.getComponent(CheckStylePlugin.class);
if (checkStylePlugin == null) {
throw new IllegalStateException("Couldn't get checkstyle plugin");
}
final ToolWindow toolWindow = ToolWindowManager.getInstance(
project).getToolWindow(CheckStyleToolWindowPanel.ID_TOOLWINDOW);
final Content content = toolWindow.getContentManager().getContent(0);
if (content != null && content.getComponent() instanceof CheckStyleToolWindowPanel) {
((CheckStyleToolWindowPanel) content.getComponent()).setScrollToSource(selected);
}
}
}
代码示例来源:origin: jshiell/checkstyle-idea
@Override
public boolean isSelected(final AnActionEvent event) {
final Project project = DataKeys.PROJECT.getData(event.getDataContext());
if (project == null) {
return false;
}
final CheckStylePlugin checkStylePlugin
= project.getComponent(CheckStylePlugin.class);
if (checkStylePlugin == null) {
throw new IllegalStateException("Couldn't get checkstyle plugin");
}
final ToolWindow toolWindow = ToolWindowManager.getInstance(
project).getToolWindow(CheckStyleToolWindowPanel.ID_TOOLWINDOW);
final Content content = toolWindow.getContentManager().getContent(0);
if (content != null && content.getComponent() instanceof CheckStyleToolWindowPanel) {
return ((CheckStyleToolWindowPanel) content.getComponent()).isDisplayingInfo();
}
return false;
}
代码示例来源:origin: jshiell/checkstyle-idea
@Override
public boolean isSelected(final AnActionEvent event) {
final Project project = DataKeys.PROJECT.getData(event.getDataContext());
if (project == null) {
return false;
}
final CheckStylePlugin checkStylePlugin
= project.getComponent(CheckStylePlugin.class);
if (checkStylePlugin == null) {
throw new IllegalStateException("Couldn't get checkstyle plugin");
}
final ToolWindow toolWindow = ToolWindowManager.getInstance(
project).getToolWindow(CheckStyleToolWindowPanel.ID_TOOLWINDOW);
final Content content = toolWindow.getContentManager().getContent(0);
if (content != null && content.getComponent() instanceof CheckStyleToolWindowPanel) {
return ((CheckStyleToolWindowPanel) content.getComponent()).isDisplayingWarnings();
}
return false;
}
代码示例来源:origin: jshiell/checkstyle-idea
@Override
public boolean isSelected(final AnActionEvent event) {
final Project project = DataKeys.PROJECT.getData(event.getDataContext());
if (project == null) {
return false;
}
final CheckStylePlugin checkStylePlugin
= project.getComponent(CheckStylePlugin.class);
if (checkStylePlugin == null) {
throw new IllegalStateException("Couldn't get checkstyle plugin");
}
final ToolWindow toolWindow = ToolWindowManager.getInstance(
project).getToolWindow(CheckStyleToolWindowPanel.ID_TOOLWINDOW);
final Content content = toolWindow.getContentManager().getContent(0);
if (content != null && content.getComponent() instanceof CheckStyleToolWindowPanel) {
return ((CheckStyleToolWindowPanel) content.getComponent()).isScrollToSource();
}
return false;
}
代码示例来源:origin: jshiell/checkstyle-idea
@Override
public void setSelected(final AnActionEvent event, final boolean selected) {
final Project project = DataKeys.PROJECT.getData(event.getDataContext());
if (project == null) {
return;
}
final CheckStylePlugin checkStylePlugin
= project.getComponent(CheckStylePlugin.class);
if (checkStylePlugin == null) {
throw new IllegalStateException("Couldn't get checkstyle plugin");
}
final ToolWindow toolWindow = ToolWindowManager.getInstance(
project).getToolWindow(CheckStyleToolWindowPanel.ID_TOOLWINDOW);
final Content content = toolWindow.getContentManager().getContent(0);
if (content != null && content.getComponent() instanceof CheckStyleToolWindowPanel) {
final CheckStyleToolWindowPanel panel = (CheckStyleToolWindowPanel) content.getComponent();
panel.setDisplayingErrors(selected);
panel.filterDisplayedResults();
}
}
}
代码示例来源:origin: jshiell/checkstyle-idea
@Override
public final void actionPerformed(final AnActionEvent event) {
Project project;
try {
project = DataKeys.PROJECT.getData(event.getDataContext());
if (project == null) {
return;
}
final ToolWindow toolWindow = ToolWindowManager.getInstance(project)
.getToolWindow(CheckStyleToolWindowPanel.ID_TOOLWINDOW);
final ChangeListManager changeListManager = ChangeListManager.getInstance(project);
project.getComponent(CheckStylePlugin.class).asyncScanFiles(changeListManager.getAffectedFiles(),
getSelectedOverride(toolWindow));
} catch (Throwable e) {
LOG.warn("Modified files scan failed", e);
}
}
代码示例来源:origin: jshiell/checkstyle-idea
@Override
public final void actionPerformed(final AnActionEvent event) {
Project project = null;
try {
project = DataKeys.PROJECT.getData(event.getDataContext());
if (project == null) {
return;
}
final ToolWindow toolWindow = ToolWindowManager.getInstance(project)
.getToolWindow(CheckStyleToolWindowPanel.ID_TOOLWINDOW);
final ChangeListManager changeListManager = ChangeListManager.getInstance(project);
project.getComponent(CheckStylePlugin.class).asyncScanFiles(filesFor(changeListManager
.getDefaultChangeList()), getSelectedOverride(toolWindow));
} catch (Throwable e) {
LOG.warn("Modified files scan failed", e);
}
}
内容来源于网络,如有侵权,请联系作者删除!