本文整理汇总了Java中com.intellij.openapi.actionSystem.impl.SimpleDataContext.getProjectContext方法的典型用法代码示例。如果您正苦于以下问题:Java SimpleDataContext.getProjectContext方法的具体用法?Java SimpleDataContext.getProjectContext怎么用?Java SimpleDataContext.getProjectContext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.actionSystem.impl.SimpleDataContext
的用法示例。
在下文中一共展示了SimpleDataContext.getProjectContext方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createActionGroupPopup
import com.intellij.openapi.actionSystem.impl.SimpleDataContext; //导入方法依赖的package包/类
@Nullable
protected JBPopup createActionGroupPopup(PsiFile file, Project project, Editor editor) {
final DefaultActionGroup group = new DefaultActionGroup();
for (final IntentionAction action : IntentionManager.getInstance().getAvailableIntentionActions()) {
if (shouldShowInGutterPopup(action) && action.isAvailable(project, editor, file)) {
group.add(new ApplyIntentionAction(action, action.getText(), editor, file));
}
}
if (group.getChildrenCount() > 0) {
final DataContext context = SimpleDataContext.getProjectContext(null);
return JBPopupFactory.getInstance()
.createActionGroupPopup(null, group, context, JBPopupFactory.ActionSelectionAid.SPEEDSEARCH, true);
}
return null;
}
示例2: BranchActionGroupPopup
import com.intellij.openapi.actionSystem.impl.SimpleDataContext; //导入方法依赖的package包/类
public BranchActionGroupPopup(@Nonnull String title, @Nonnull Project project, @Nonnull Condition<AnAction> preselectActionCondition, @Nonnull ActionGroup actions, @Nullable String dimensionKey) {
super(title, new DefaultActionGroup(actions, createBranchSpeedSearchActionGroup(actions)), SimpleDataContext.getProjectContext(project), preselectActionCondition, true);
myProject = project;
DataManager.registerDataProvider(getList(), dataId -> POPUP_MODEL == dataId ? getListModel() : null);
myKey = dimensionKey;
if (myKey != null) {
Dimension storedSize = WindowStateService.getInstance(myProject).getSizeFor(myProject, myKey);
if (storedSize != null) {
//set forced size before component is shown
setSize(storedSize);
myUserSizeChanged = true;
}
createTitlePanelToolbar(myKey);
}
myMeanRowHeight = getList().getCellBounds(0, 0).height + UIUtil.getListCellVPadding() * 2;
}
示例3: createActionGroupPopup
import com.intellij.openapi.actionSystem.impl.SimpleDataContext; //导入方法依赖的package包/类
@Nullable
protected JBPopup createActionGroupPopup(PsiFile file, Project project, Editor editor)
{
final DefaultActionGroup group = new DefaultActionGroup();
for(final IntentionAction action : IntentionManager.getInstance().getAvailableIntentionActions())
{
if(shouldShowInGutterPopup(action) && action.isAvailable(project, editor, file))
{
group.add(new ApplyIntentionAction(action, action.getText(), editor, file));
}
}
if(group.getChildrenCount() > 0)
{
final DataContext context = SimpleDataContext.getProjectContext(null);
return JBPopupFactory.getInstance().createActionGroupPopup(null, group, context, JBPopupFactory.ActionSelectionAid.SPEEDSEARCH, true);
}
return null;
}
示例4: getExternalProperties
import com.intellij.openapi.actionSystem.impl.SimpleDataContext; //导入方法依赖的package包/类
@NotNull
public Map<String, String> getExternalProperties() {
Map<String, String> result = myCachedExternalProperties;
if (result == null) {
synchronized (myOptionsLock) {
result = myCachedExternalProperties;
if (result == null) {
result = new HashMap<String, String>();
final DataContext context = SimpleDataContext.getProjectContext(myProject);
final MacroManager macroManager = MacroManager.getInstance();
Iterator<BuildFileProperty> properties = ANT_PROPERTIES.getIterator(myAllOptions);
while (properties.hasNext()) {
BuildFileProperty property = properties.next();
try {
String value = property.getPropertyValue();
value = macroManager.expandSilentMarcos(value, true, context);
value = macroManager.expandSilentMarcos(value, false, context);
result.put(property.getPropertyName(), value);
}
catch (Macro.ExecutionCancelledException e) {
LOG.debug(e);
}
}
myCachedExternalProperties = result;
}
}
}
return result;
}
示例5: runAntTarget
import com.intellij.openapi.actionSystem.impl.SimpleDataContext; //导入方法依赖的package包/类
private void runAntTarget(CompileContext compileContext, final Artifact artifact) {
if (myExtensionProperties.myEnabled) {
final Project project = compileContext.getProject();
final AntBuildTarget target = findTarget(AntConfiguration.getInstance(project));
if (target != null) {
final DataContext dataContext = SimpleDataContext.getProjectContext(project);
List<BuildFileProperty> properties = getAllProperties(artifact);
final boolean success = AntConfigurationImpl.executeTargetSynchronously(dataContext, target, properties);
if (!success) {
compileContext.addMessage(CompilerMessageCategory.ERROR, "Cannot build artifact '" + artifact.getName() + "': ant target '" + target.getDisplayName() + "' failed with error", null, -1, -1);
}
}
}
}
示例6: showPopup
import com.intellij.openapi.actionSystem.impl.SimpleDataContext; //导入方法依赖的package包/类
private void showPopup(@NotNull AnActionEvent event, @NotNull GitFileRevision rev, @NotNull FilePath filePath,
@NotNull Collection<GitFileRevision> parents) {
ActionGroup parentActions = createActionGroup(rev, filePath, parents);
DataContext dataContext = SimpleDataContext.getProjectContext(myProject);
ListPopup popup = JBPopupFactory.getInstance().createActionGroupPopup("Choose parent to compare", parentActions, dataContext,
JBPopupFactory.ActionSelectionAid.NUMBERING, true);
showPopupInBestPosition(popup, event, dataContext);
}
示例7: execute
import com.intellij.openapi.actionSystem.impl.SimpleDataContext; //导入方法依赖的package包/类
@Override
public boolean execute(CompileContext compileContext)
{
final DataContext dataContext = SimpleDataContext.getProjectContext(compileContext.getProject());
final AntConfiguration config = AntConfiguration.getInstance(compileContext.getProject());
((AntConfigurationBase)config).ensureInitialized();
return config.executeTargetBeforeCompile(dataContext);
}
示例8: execute
import com.intellij.openapi.actionSystem.impl.SimpleDataContext; //导入方法依赖的package包/类
@Override
public boolean execute(CompileContext compileContext)
{
final DataContext dataContext = SimpleDataContext.getProjectContext(compileContext.getProject());
final AntConfiguration config = AntConfiguration.getInstance(compileContext.getProject());
((AntConfigurationBase)config).ensureInitialized();
return config.executeTargetAfterCompile(dataContext);
}
示例9: getExternalProperties
import com.intellij.openapi.actionSystem.impl.SimpleDataContext; //导入方法依赖的package包/类
@Override
@NotNull
public Map<String, String> getExternalProperties()
{
Map<String, String> result = myCachedExternalProperties;
if(result == null)
{
synchronized(myOptionsLock)
{
result = myCachedExternalProperties;
if(result == null)
{
result = new HashMap<String, String>();
final DataContext context = SimpleDataContext.getProjectContext(myProject);
final MacroManager macroManager = MacroManager.getInstance();
Iterator<BuildFileProperty> properties = ANT_PROPERTIES.getIterator(myAllOptions);
while(properties.hasNext())
{
BuildFileProperty property = properties.next();
try
{
String value = property.getPropertyValue();
value = macroManager.expandSilentMarcos(value, true, context);
value = macroManager.expandSilentMarcos(value, false, context);
result.put(property.getPropertyName(), value);
}
catch(Macro.ExecutionCancelledException e)
{
LOG.debug(e);
}
}
myCachedExternalProperties = result;
}
}
}
return result;
}
示例10: BranchActionGroupPopup
import com.intellij.openapi.actionSystem.impl.SimpleDataContext; //导入方法依赖的package包/类
public BranchActionGroupPopup(@NotNull String title, @NotNull Project project,
@NotNull Condition<AnAction> preselectActionCondition, @NotNull ActionGroup actions) {
super(title, actions, SimpleDataContext.getProjectContext(project), false, false, true, false, null, -1,
preselectActionCondition, null);
}
示例11: compileAndRun
import com.intellij.openapi.actionSystem.impl.SimpleDataContext; //导入方法依赖的package包/类
@Override
public void compileAndRun(@NotNull final Runnable startRunnable,
@NotNull final ExecutionEnvironment environment,
@Nullable final RunProfileState state,
@Nullable final Runnable onCancelRunnable) {
long id = environment.getExecutionId();
if (id == 0) {
id = environment.assignNewExecutionId();
}
RunProfile profile = environment.getRunProfile();
if (!(profile instanceof RunConfiguration)) {
startRunnable.run();
return;
}
final RunConfiguration runConfiguration = (RunConfiguration)profile;
final List<BeforeRunTask> beforeRunTasks = RunManagerEx.getInstanceEx(myProject).getBeforeRunTasks(runConfiguration);
if (beforeRunTasks.isEmpty()) {
startRunnable.run();
}
else {
DataContext context = environment.getDataContext();
final DataContext projectContext = context != null ? context : SimpleDataContext.getProjectContext(myProject);
final long finalId = id;
final Long executionSessionId = new Long(id);
ApplicationManager.getApplication().executeOnPooledThread(new Runnable() {
/**
* @noinspection SSBasedInspection
*/
@Override
public void run() {
for (BeforeRunTask task : beforeRunTasks) {
if (myProject.isDisposed()) {
return;
}
@SuppressWarnings("unchecked")
BeforeRunTaskProvider<BeforeRunTask> provider = BeforeRunTaskProvider.getProvider(myProject, task.getProviderId());
if (provider == null) {
LOG.warn("Cannot find BeforeRunTaskProvider for id='" + task.getProviderId() + "'");
continue;
}
ExecutionEnvironment taskEnvironment = new ExecutionEnvironmentBuilder(environment).contentToReuse(null).build();
taskEnvironment.setExecutionId(finalId);
EXECUTION_SESSION_ID_KEY.set(taskEnvironment, executionSessionId);
if (!provider.executeTask(projectContext, runConfiguration, taskEnvironment, task)) {
if (onCancelRunnable != null) {
SwingUtilities.invokeLater(onCancelRunnable);
}
return;
}
}
doRun(environment, startRunnable);
}
});
}
}
示例12: StatusActionGroupPopup
import com.intellij.openapi.actionSystem.impl.SimpleDataContext; //导入方法依赖的package包/类
public StatusActionGroupPopup(String title, @NotNull RootActions actionGroup, @NotNull Project project,
Condition<AnAction> preselectActionCondition) {
super(title, actionGroup, SimpleDataContext.getProjectContext(project),
false, false, true, false,
null, -1, preselectActionCondition, null);
}
示例13: BranchActionGroupPopup
import com.intellij.openapi.actionSystem.impl.SimpleDataContext; //导入方法依赖的package包/类
public BranchActionGroupPopup(@NotNull String title, @NotNull Project project,
@NotNull Condition<AnAction> preselectActionCondition, @NotNull ActionGroup actions) {
super(title, actions, SimpleDataContext.getProjectContext(project), false, false, false, true, null, -1,
preselectActionCondition, null);
}
示例14: compileAndRun
import com.intellij.openapi.actionSystem.impl.SimpleDataContext; //导入方法依赖的package包/类
@Override
public void compileAndRun(@NotNull final Runnable startRunnable,
@NotNull final ExecutionEnvironment env,
@Nullable final RunProfileState state,
@Nullable final Runnable onCancelRunnable) {
long id = env.getExecutionId();
if (id == 0) {
id = env.assignNewExecutionId();
}
RunProfile profile = env.getRunProfile();
if (profile instanceof RunConfiguration) {
final RunConfiguration runConfiguration = (RunConfiguration)profile;
final RunManagerImpl runManager = RunManagerImpl.getInstanceImpl(myProject);
final List<BeforeRunTask> activeTasks = new ArrayList<BeforeRunTask>();
activeTasks.addAll(runManager.getBeforeRunTasks(runConfiguration));
final DataContext projectContext = SimpleDataContext.getProjectContext(myProject);
if (!activeTasks.isEmpty()) {
final long finalId = id;
ApplicationManager.getApplication().executeOnPooledThread(new Runnable() {
/** @noinspection SSBasedInspection*/
@Override
public void run() {
for (BeforeRunTask task : activeTasks) {
if (myProject.isDisposed())
return;
BeforeRunTaskProvider<BeforeRunTask> provider = BeforeRunTaskProvider.getProvider(myProject, task.getProviderId());
if (provider == null) {
LOG.warn("Cannot find BeforeRunTaskProvider for id='" + task.getProviderId() + "'");
continue;
}
ExecutionEnvironment taskEnvironment = new ExecutionEnvironmentBuilder(env).setContentToReuse(null).build();
taskEnvironment.setExecutionId(finalId);
if (!provider.executeTask(projectContext, runConfiguration, taskEnvironment, task)) {
if (onCancelRunnable != null) {
SwingUtilities.invokeLater(onCancelRunnable);
}
return;
}
}
// important! Do not use DumbService.smartInvokelater here because it depends on modality state
// and execution of startRunnable could be skipped if modality state check fails
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
if (!myProject.isDisposed()) {
DumbService.getInstance(myProject).runWhenSmart(startRunnable);
}
}
});
}
});
}
else {
startRunnable.run();
}
}
else {
startRunnable.run();
}
}
示例15: getPopupStep
import com.intellij.openapi.actionSystem.impl.SimpleDataContext; //导入方法依赖的package包/类
@Nullable
@Override
public ListPopup getPopupStep() {
ActionGroup popupGroup = getActions();
return new PopupFactoryImpl.ActionGroupPopup("Symfony Profiler", popupGroup, SimpleDataContext.getProjectContext(getProject()), false, false, false, true, null, -1, null, null);
}