use of com.intellij.openapi.actionSystem.Presentation in project intellij-community by JetBrains.
the class DetachExternalProjectAction method update.
@Override
public void update(@NotNull AnActionEvent e) {
super.update(e);
if (this.getClass() != DetachExternalProjectAction.class)
return;
ProjectSystemId systemId = getSystemId(e);
final String systemIdName = systemId != null ? systemId.getReadableName() : "external";
Presentation presentation = e.getPresentation();
presentation.setText(ExternalSystemBundle.message("action.detach.external.project.text", systemIdName));
}
use of com.intellij.openapi.actionSystem.Presentation in project intellij-community by JetBrains.
the class MarkObjectAction method update.
@Override
public void update(AnActionEvent event) {
Project project = event.getData(CommonDataKeys.PROJECT);
boolean enabled = false;
Presentation presentation = event.getPresentation();
boolean hidden = true;
if (project != null) {
for (DebuggerSupport support : DebuggerSupport.getDebuggerSupports()) {
MarkObjectActionHandler handler = support.getMarkObjectHandler();
hidden &= handler.isHidden(project, event);
if (handler.isEnabled(project, event)) {
enabled = true;
String text;
if (handler.isMarked(project, event)) {
text = ActionsBundle.message("action.Debugger.MarkObject.unmark.text");
} else {
text = ActionsBundle.message("action.Debugger.MarkObject.text");
}
presentation.setText(text);
break;
}
}
}
presentation.setVisible(!hidden && (!ActionPlaces.isPopupPlace(event.getPlace()) || enabled));
presentation.setEnabled(enabled);
}
use of com.intellij.openapi.actionSystem.Presentation in project intellij-community by JetBrains.
the class ShowLibraryFramesAction method update.
@Override
public void update(@NotNull final AnActionEvent e) {
super.update(e);
Presentation presentation = e.getPresentation();
Object isSupported = presentation.getClientProperty(IS_LIBRARY_FRAME_FILTER_SUPPORTED);
XDebugSession session = e.getData(XDebugSession.DATA_KEY);
if (isSupported == null) {
if (session == null) {
// if session is null and isSupported is null - just return, it means that action created initially not in the xdebugger tab
presentation.setVisible(false);
return;
}
isSupported = session.getDebugProcess().isLibraryFrameFilterSupported();
presentation.putClientProperty(IS_LIBRARY_FRAME_FILTER_SUPPORTED, isSupported);
}
if (Boolean.TRUE.equals(isSupported)) {
presentation.setVisible(true);
final boolean shouldShow = !Boolean.TRUE.equals(presentation.getClientProperty(SELECTED_PROPERTY));
presentation.setText(shouldShow ? ourTextWhenShowIsOn : ourTextWhenShowIsOff);
} else {
presentation.setVisible(false);
}
}
use of com.intellij.openapi.actionSystem.Presentation 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.Presentation in project intellij-community by JetBrains.
the class ImportTree method createIncludeAction.
public AnAction createIncludeAction() {
return new AnAction(CvsBundle.message("import.wizard.include.to.import.action.name"), null, IconUtil.getAddIcon()) {
public void update(AnActionEvent e) {
final VirtualFile[] selectedFiles = myFileSystemTree.getSelectedFiles();
final Presentation presentation = e.getPresentation();
presentation.setEnabled(isAtLeastOneFileExcluded(selectedFiles));
}
public void actionPerformed(AnActionEvent e) {
final VirtualFile[] selectedFiles = myFileSystemTree.getSelectedFiles();
for (VirtualFile selectedFile : selectedFiles) {
include(selectedFile);
}
myWizard.updateStep();
myFileSystemTree.getTree().repaint();
}
};
}
Aggregations