本文整理汇总了Java中com.intellij.execution.actions.ConfigurationContext.getFromContext方法的典型用法代码示例。如果您正苦于以下问题:Java ConfigurationContext.getFromContext方法的具体用法?Java ConfigurationContext.getFromContext怎么用?Java ConfigurationContext.getFromContext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.execution.actions.ConfigurationContext
的用法示例。
在下文中一共展示了ConfigurationContext.getFromContext方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: perform
import com.intellij.execution.actions.ConfigurationContext; //导入方法依赖的package包/类
@Override
protected void perform(@NotNull Project project,
@NotNull ProjectSystemId projectSystemId,
@NotNull TaskData taskData,
@NotNull AnActionEvent e) {
final ExternalTaskExecutionInfo taskExecutionInfo = ExternalSystemActionUtil.buildTaskInfo(taskData);
ExternalSystemUtil.runTask(taskExecutionInfo.getSettings(), taskExecutionInfo.getExecutorId(), project, projectSystemId);
final DataContext dataContext = e.getDataContext();
final ConfigurationContext context = ConfigurationContext.getFromContext(dataContext);
RunnerAndConfigurationSettings configuration = context.findExisting();
RunManagerEx runManager = (RunManagerEx)context.getRunManager();
if (configuration == null) {
configuration = context.getConfiguration();
if (configuration == null) {
return;
}
runManager.setTemporaryConfiguration(configuration);
}
runManager.setSelectedConfiguration(configuration);
}
示例2: createContext
import com.intellij.execution.actions.ConfigurationContext; //导入方法依赖的package包/类
public ConfigurationContext createContext(@NotNull PsiElement psiClass, @NotNull MapDataContext dataContext) {
dataContext.put(CommonDataKeys.PROJECT, myProject);
if (LangDataKeys.MODULE.getData(dataContext) == null) {
dataContext.put(LangDataKeys.MODULE, ModuleUtilCore.findModuleForPsiElement(psiClass));
}
dataContext.put(Location.DATA_KEY, PsiLocation.fromPsiElement(psiClass));
return ConfigurationContext.getFromContext(dataContext);
}
示例3: update
import com.intellij.execution.actions.ConfigurationContext; //导入方法依赖的package包/类
@Override
public void update(@NotNull AnActionEvent e) {
final Presentation presentation = e.getPresentation();
if (!CCProjectService.setCCActionAvailable(e)) {
presentation.setEnabledAndVisible(false);
return;
}
presentation.setEnabledAndVisible(false);
final ConfigurationContext context = ConfigurationContext.getFromContext(e.getDataContext());
Location location = context.getLocation();
if (location == null) {
return;
}
PsiElement psiElement = location.getPsiElement();
PsiFile psiFile = psiElement.getContainingFile();
Project project = e.getProject();
if (project == null || psiFile == null) {
return;
}
TaskFile taskFile = CCProjectService.getInstance(project).getTaskFile(psiFile.getVirtualFile());
if (taskFile == null) {
return;
}
if (psiFile.getName().contains(".answer")) {
presentation.setEnabledAndVisible(true);
presentation.setText("Run tests from '" + FileUtil.getNameWithoutExtension(psiFile.getName()) + "'");
}
}
示例4: createContextFromPsi
import com.intellij.execution.actions.ConfigurationContext; //导入方法依赖的package包/类
protected ConfigurationContext createContextFromPsi(PsiElement element) {
final MapDataContext dataContext = new MapDataContext();
dataContext.put(CommonDataKeys.PROJECT, getProject());
dataContext.put(LangDataKeys.MODULE, ModuleUtil.findModuleForPsiElement(element));
dataContext.put(Location.DATA_KEY, PsiLocation.fromPsiElement(element));
return ConfigurationContext.getFromContext(dataContext);
}
示例5: createContextFromMultipleElements
import com.intellij.execution.actions.ConfigurationContext; //导入方法依赖的package包/类
protected ConfigurationContext createContextFromMultipleElements(PsiElement[] elements) {
final MapDataContext dataContext = new MapDataContext();
dataContext.put(CommonDataKeys.PROJECT, getProject());
dataContext.put(LangDataKeys.MODULE, ModuleUtil.findModuleForPsiElement(elements[0]));
dataContext.put(Location.DATA_KEY, PsiLocation.fromPsiElement(elements[0]));
dataContext.put(LangDataKeys.PSI_ELEMENT_ARRAY, elements);
return ConfigurationContext.getFromContext(dataContext);
}
示例6: actionPerformed
import com.intellij.execution.actions.ConfigurationContext; //导入方法依赖的package包/类
public void actionPerformed(@NotNull AnActionEvent e) {
final ConfigurationContext context = ConfigurationContext.getFromContext(e.getDataContext());
run(context);
}