use of com.intellij.openapi.actionSystem.DataContext in project intellij-community by JetBrains.
the class AntBuildFileImpl method getExternalProperties.
@NotNull
public Map<String, String> getExternalProperties() {
Map<String, String> result = myCachedExternalProperties;
if (result == null) {
synchronized (myOptionsLock) {
result = myCachedExternalProperties;
if (result == null) {
result = new HashMap<>();
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;
}
use of com.intellij.openapi.actionSystem.DataContext in project intellij-community by JetBrains.
the class GenerateCoverageReportAction method actionPerformed.
public void actionPerformed(final AnActionEvent e) {
final DataContext dataContext = e.getDataContext();
final Project project = e.getProject();
assert project != null;
final CoverageDataManager coverageDataManager = CoverageDataManager.getInstance(project);
final CoverageSuitesBundle currentSuite = coverageDataManager.getCurrentSuitesBundle();
final CoverageEngine coverageEngine = currentSuite.getCoverageEngine();
final ExportToHTMLDialog dialog = coverageEngine.createGenerateReportDialog(project, dataContext, currentSuite);
dialog.reset();
if (!dialog.showAndGet()) {
return;
}
dialog.apply();
coverageEngine.generateReport(project, dataContext, currentSuite);
}
use of com.intellij.openapi.actionSystem.DataContext in project intellij-community by JetBrains.
the class GenerateCoverageReportAction method update.
public void update(final AnActionEvent e) {
final DataContext dataContext = e.getDataContext();
final Presentation presentation = e.getPresentation();
presentation.setEnabled(false);
presentation.setVisible(false);
final Project project = e.getProject();
if (project != null) {
final CoverageSuitesBundle currentSuite = CoverageDataManager.getInstance(project).getCurrentSuitesBundle();
if (currentSuite != null) {
final CoverageEngine coverageEngine = currentSuite.getCoverageEngine();
if (coverageEngine.isReportGenerationAvailable(project, dataContext, currentSuite)) {
presentation.setEnabled(true);
presentation.setVisible(true);
}
}
}
}
use of com.intellij.openapi.actionSystem.DataContext in project intellij-community by JetBrains.
the class XDebuggerEditorBase method createLanguagePopup.
private ListPopup createLanguagePopup() {
DefaultActionGroup actions = new DefaultActionGroup();
for (Language language : getSupportedLanguages()) {
//noinspection ConstantConditions
actions.add(new AnAction(language.getDisplayName(), null, language.getAssociatedFileType().getIcon()) {
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
XExpression currentExpression = getExpression();
setExpression(new XExpressionImpl(currentExpression.getExpression(), language, currentExpression.getCustomInfo()));
requestFocusInEditor();
}
});
}
DataContext dataContext = DataManager.getInstance().getDataContext(getComponent());
return JBPopupFactory.getInstance().createActionGroupPopup("Choose Language", actions, dataContext, JBPopupFactory.ActionSelectionAid.SPEEDSEARCH, false);
}
use of com.intellij.openapi.actionSystem.DataContext in project intellij-community by JetBrains.
the class RecentTestRunnerImpl method run.
private void run(@NotNull String url) {
Location location = myTestLocator.getLocation(url);
if (location == null) {
return;
}
DataContext data = new DataContext() {
@Nullable
@Override
public Object getData(@NonNls String dataId) {
if (Location.DATA_KEY.is(dataId)) {
return location;
}
return null;
}
};
myCurrentAction.actionPerformed(AnActionEvent.createFromAnAction(myCurrentAction, null, "", data));
}
Aggregations