use of com.intellij.openapi.actionSystem.Presentation in project android by JetBrains.
the class AndroidInlineStyleTest method performAction.
private Pair<Presentation, AndroidInlineTestConfig> performAction(boolean inlineThisOnly, String dirToCopy) {
final String testName = getTestName(true);
final VirtualFile f = myFixture.copyFileToProject(BASE_PATH + testName + ".xml", dirToCopy + "/test" + testName + "_" + Boolean.toString(inlineThisOnly) + ".xml");
myFixture.configureFromExistingVirtualFile(f);
final AndroidInlineTestConfig config = new AndroidInlineTestConfig(inlineThisOnly);
final Presentation presentation = myFixture.testAction(new AndroidInlineStyleReferenceAction(config));
return Pair.create(presentation, config);
}
use of com.intellij.openapi.actionSystem.Presentation in project android by JetBrains.
the class ConvertToConstraintLayoutAction method update.
@Override
public void update(AnActionEvent e) {
Presentation presentation = e.getPresentation();
ScreenView screenView = mySurface.getCurrentScreenView();
NlComponent target = findTarget(screenView);
if (target != null) {
String tagName = target.getTagName();
// Don't show action if it's already a ConstraintLayout
if (target.isOrHasSuperclass(CONSTRAINT_LAYOUT)) {
presentation.setVisible(false);
return;
}
presentation.setVisible(true);
tagName = tagName.substring(tagName.lastIndexOf('.') + 1);
presentation.setText("Convert " + tagName + " to ConstraintLayout");
presentation.setEnabled(true);
} else {
presentation.setText(TITLE);
presentation.setEnabled(false);
presentation.setVisible(true);
}
}
use of com.intellij.openapi.actionSystem.Presentation in project android by JetBrains.
the class RunSdkConfigAction method update.
@Override
public void update(AnActionEvent e) {
if (e == null || ActionPlaces.WELCOME_SCREEN.equals(e.getPlace()) || IdeInfo.getInstance().isAndroidStudio()) {
Presentation presentation = e == null ? getTemplatePresentation() : e.getPresentation();
presentation.setEnabledAndVisible(isAndroidSdkManagerEnabled());
} else {
Project project = e.getProject();
e.getPresentation().setEnabled(project != null && !ProjectFacetManager.getInstance(project).getFacets(AndroidFacet.ID).isEmpty());
}
}
use of com.intellij.openapi.actionSystem.Presentation in project android by JetBrains.
the class CreateLibraryFromFilesAction method update.
@Override
public void update(@NotNull AnActionEvent e) {
final Project project = getEventProject(e);
boolean visible = false;
if (project != null && ModuleManager.getInstance(project).getModules().length > 0) {
final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex();
for (VirtualFile root : getRoots(e)) {
if (!root.isInLocalFileSystem() && FileUtilRt.extensionEquals(root.getName(), "jar") && !fileIndex.isInLibraryClasses(root)) {
visible = true;
break;
}
}
}
Presentation presentation = e.getPresentation();
presentation.setVisible(visible);
presentation.setEnabled(visible);
}
use of com.intellij.openapi.actionSystem.Presentation in project android by JetBrains.
the class AndroidStudioGradleActionTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
initMocks(this);
myPresentation = new Presentation();
when(myEvent.getPresentation()).thenReturn(myPresentation);
when(myEvent.getProject()).thenReturn(myProject);
myProjectInfo = IdeComponents.replaceServiceWithMock(getProject(), GradleProjectInfo.class);
}
Aggregations