use of com.intellij.openapi.actionSystem.Presentation in project android by JetBrains.
the class SyncProjectActionTest method setUp.
@Override
public void setUp() throws Exception {
super.setUp();
initMocks(this);
myPresentation = new Presentation();
when(myEvent.getPresentation()).thenReturn(myPresentation);
myAction = new SyncProjectAction("Test", mySyncInvoker);
}
use of com.intellij.openapi.actionSystem.Presentation in project android by JetBrains.
the class MakeGradleModuleAction method updatePresentation.
public static void updatePresentation(@NotNull AnActionEvent e, @NotNull Project project) {
DataContext dataContext = e.getDataContext();
Module[] modules = getModulesToBuildFromSelection(project, dataContext);
int moduleCount = modules.length;
Presentation presentation = e.getPresentation();
presentation.setEnabled(moduleCount > 0);
String presentationText;
if (moduleCount > 0) {
String text = "Make Module";
if (moduleCount > 1) {
text += "s";
}
for (int i = 0; i < moduleCount; i++) {
if (text.length() > 30) {
text = "Make Selected Modules";
break;
}
Module toMake = modules[i];
if (i != 0) {
text += ",";
}
text += " '" + toMake.getName() + "'";
}
presentationText = text;
} else {
presentationText = "Make";
}
presentation.setText(presentationText);
presentation.setVisible(moduleCount > 0 || !PROJECT_VIEW_POPUP.equals(e.getPlace()));
}
use of com.intellij.openapi.actionSystem.Presentation in project android by JetBrains.
the class SyncProjectAction method doPerform.
@Override
protected void doPerform(@NotNull AnActionEvent e, @NotNull Project project) {
BuildVariantView.getInstance(project).projectImportStarted();
Presentation presentation = e.getPresentation();
presentation.setEnabled(false);
try {
mySyncInvoker.requestProjectSyncAndSourceGeneration(project, null);
} finally {
presentation.setEnabled(true);
}
}
use of com.intellij.openapi.actionSystem.Presentation in project android by JetBrains.
the class LinkExternalCppProjectAction method doUpdate.
@Override
protected void doUpdate(@NotNull AnActionEvent e, @NotNull Project project) {
DataContext dataContext = e.getDataContext();
boolean enable = isValidAndroidGradleModuleSelected(dataContext);
Presentation presentation = e.getPresentation();
presentation.setEnabled(enable);
presentation.setVisible(enable);
}
use of com.intellij.openapi.actionSystem.Presentation in project android by JetBrains.
the class IncludeModuleForFileAction method update.
@Override
public void update(AnActionEvent e) {
boolean show = false;
VirtualFile file = null;
Project project = e.getProject();
if (project != null) {
file = findTarget(e, project);
if (file != null) {
show = !isInSource(file, project);
}
}
Presentation presentation = e.getPresentation();
presentation.setVisible(show);
if (file != null) {
String type = file.isDirectory() ? "Directory" : "File";
presentation.setText(String.format("Find and Add Module Containing Selected %1$s as Source", type));
}
}
Aggregations