Example usage for com.intellij.openapi.actionSystem ActionPlaces WELCOME_SCREEN

List of usage examples for com.intellij.openapi.actionSystem ActionPlaces WELCOME_SCREEN

Introduction

In this page you can find the example usage for com.intellij.openapi.actionSystem ActionPlaces WELCOME_SCREEN.

Prototype

String WELCOME_SCREEN

To view the source code for com.intellij.openapi.actionSystem ActionPlaces WELCOME_SCREEN.

Click Source Link

Usage

From source file:automation.ScriptProcessor.java

License:Apache License

public static void process() throws Exception {
    final String SMOKE_TEST_CONFIG_PROJ = "plugin.smoke-test.project";
    String projName = System.getProperty(SMOKE_TEST_CONFIG_PROJ);
    System.out.println(SMOKE_TEST_CONFIG_PROJ + "=" + projName);
    projName = "smoke-test-" + (new SimpleDateFormat("dd-MMM-yy-HH-mm")).format(new Date());

    Map<String, String> mapping = new HashMap<>();
    mapping.put("$PROJECT_NAME", projName);

    //    Queue<Command> script = new Queue<>(8);
    //    script.addLast(new StartCommand());
    //    script.addLast(new NavigateAndClickCommand(new Parameters("Create New Project")));
    //    script.addLast(new WaitDialogCommand(new Parameters("New Project")));
    //    script.addLast(new SelectInListCommand(new Parameters("Java")));
    //    script.addLast(new NavigateAndClickCommand(new Parameters("New...")));
    //    script.addLast(new SelectInJdkListCommand(new Parameters("JDK")));
    //    script.addLast(new WaitDialogCommand(new Parameters("Select Home Directory for JDK")));
    //    script.addLast(new TypeInTextFieldCommand(new Parameters("", null, "/Library/Java/JavaVirtualMachines/jdk1.8.0_71.jdk/Contents/Home")));
    //    //the tree is sticking here
    //    script.addLast(new WaitCommand(new Parameters(1000)));
    //    script.addLast(new NavigateAndClickCommand(new Parameters("OK")));
    //    script.addLast(new WaitCommand(new Parameters(500)));
    //    script.addLast(new NavigateAndClickCommand(new Parameters("Next")));
    //    script.addLast(new WaitUiCommand(new Parameters("Create project from template")));
    //    script.addLast(new NavigateAndClickCommand(new Parameters("Next")));
    //    script.addLast(new WaitUiCommand(new Parameters("Project name:")));
    //    script.addLast(new TypeInTextFieldCommand(new Parameters("Project name:", null, projName)));
    //    script.addLast(new WaitCommand(new Parameters(1000)));
    //    script.addLast(new NavigateAndClickCommand(new Parameters("Finish")));
    //    script.addLast(new WaitProjectOpeningCommand(new Parameters()));
    //    script.addLast(new RunnableCommand(() -> {
    //      System.out.println("Idea is ready");
    //    }));//from  w w  w  .  j a  va2  s . com
    //    script.pullFirst().process(script);

    //    Component target = IdeFocusManager.getGlobalInstance().getFocusOwner();
    //    JRootPane rootPane = target == null ? null : SwingUtilities.getRootPane(target);
    //    JComponent glassPane = rootPane == null ? null : (JComponent)rootPane.getGlassPane();
    //    rootPane.addMouseListener(new MouseAdapter() {
    //      @Override
    //      public void mouseClicked(MouseEvent e) {
    //        System.out.println("mouseClicked();");
    //        RobotControlManager.getInstance().getRobotControl().mouseClick();
    //        e.consume();
    //      }
    //    });

    final DataContext dataContext = DataManager.getInstance()
            .getDataContext(IdeFocusManager.getGlobalInstance().getFocusOwner());
    AnActionEvent e = AnActionEvent.createFromDataContext(ActionPlaces.WELCOME_SCREEN, null, dataContext);

    //    (new UpdateScripts()).actionPerformed(e);
    Script start2 = new Script("start2", mapping);
    start2.actionPerformed(e);

}

From source file:com.android.tools.idea.structure.AndroidHomeConfigurable.java

License:Apache License

private void updateSdkManagerActionInWelcomePage() {
    if (!ApplicationManager.getApplication().isUnitTestMode()
            && ProjectManager.getInstance().getOpenProjects().length == 0) {
        // If there are no open projects, the "SDK Manager" configurable was invoked from the "Welcome Page". We need to update the
        // "SDK Manager" action to enable it.
        ActionManager actionManager = ActionManager.getInstance();
        AnAction sdkManagerAction = actionManager.getAction("WelcomeScreen.RunAndroidSdkManager");
        if (sdkManagerAction instanceof RunAndroidSdkManagerAction) {
            Presentation presentation = sdkManagerAction.getTemplatePresentation();
            //noinspection ConstantConditions
            AnActionEvent event = new AnActionEvent(null,
                    DataManager.getInstance().getDataContext(myDetailsComponent.getComponent()),
                    ActionPlaces.WELCOME_SCREEN, presentation, actionManager, 0);
            sdkManagerAction.update(event);
        }//from  w  ww  .  j a  v a  2 s .c o  m
    }
}

From source file:com.android.tools.idea.updater.configure.RunSdkConfigAction.java

License:Apache License

@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 {//from   w w w  .j av  a 2 s  .c  o  m
        Project project = e.getProject();
        e.getPresentation().setEnabled(project != null
                && !ProjectFacetManager.getInstance(project).getFacets(AndroidFacet.ID).isEmpty());
    }
}

From source file:com.android.tools.idea.updater.configure.RunSdkConfigAction.java

License:Apache License

@Override
public void actionPerformed(@Nullable AnActionEvent e) {
    UsageTracker.getInstance().log(AndroidStudioEvent.newBuilder().setCategory(EventCategory.SDK_MANAGER)
            .setKind(AndroidStudioEvent.EventKind.SDK_MANAGER_TOOLBAR_CLICKED));
    if (e != null && ActionPlaces.WELCOME_SCREEN.equals(e.getPlace())) {
        // Invoked from Welcome Screen, might not have an SDK setup yet
        AndroidSdkData sdkData = AndroidSdks.getInstance().tryToChooseAndroidSdk();
        if (sdkData == null) {
            // This probably shouldn't happen, but the check was there in the standalone launcher case...
            return;
        }//from ww  w .  j ava2 s. co m
    }
    Configurable configurable = ConfigurableExtensionPointUtil
            .createApplicationConfigurableForProvider(SdkUpdaterConfigurableProvider.class);
    ShowSettingsUtil.getInstance().showSettingsDialog(null, configurable.getClass());
}

From source file:com.intellij.ide.actions.OpenProjectAction.java

License:Apache License

@Override
public void update(AnActionEvent e) {
    super.update(e);
    e.getPresentation().setVisible(ActionPlaces.WELCOME_SCREEN.equals(e.getPlace()));
}

From source file:com.intellij.ide.actions.RefCardAction.java

License:Apache License

public void update(AnActionEvent e) {
    super.update(e);
    boolean atWelcome = ActionPlaces.WELCOME_SCREEN.equals(e.getPlace());
    e.getPresentation().setIcon(atWelcome ? AllIcons.General.DefaultKeymap : null);
}

From source file:com.intellij.ide.actions.ShowSettingsAction.java

License:Apache License

@Override
public void update(AnActionEvent e) {
    if (SystemInfo.isMac && e.getPlace().equals(ActionPlaces.MAIN_MENU)) {
        // It's called from Preferences in App menu.
        e.getPresentation().setVisible(false);
    }//from  w  ww .j  a va  2 s .co m
    if (e.getPlace().equals(ActionPlaces.WELCOME_SCREEN)) {
        e.getPresentation().setText(CommonBundle.settingsTitle());
    }
}

From source file:io.flutter.actions.OpenAndroidModule.java

License:Open Source License

@Override
public void actionPerformed(AnActionEvent e) {
    final VirtualFile projectFile = findProjectFile(e);
    if (projectFile == null) {
        FlutterMessages.showError("Error Opening Android Studio", "Project not found.");
        return;/*from  w  w w .j a  v a 2s .  c  o  m*/
    }
    final int modifiers = e.getModifiers();
    // From ReopenProjectAction.
    final boolean forceOpenInNewFrame = BitUtil.isSet(modifiers, InputEvent.CTRL_MASK)
            || BitUtil.isSet(modifiers, InputEvent.SHIFT_MASK) || e.getPlace() == ActionPlaces.WELCOME_SCREEN;

    VirtualFile sourceFile = e.getData(CommonDataKeys.VIRTUAL_FILE);
    // Using:
    //ProjectUtil.openOrImport(projectFile.getPath(), e.getProject(), forceOpenInNewFrame);
    // presents the user with a really imposing Gradle project import dialog.
    openOrImportProject(projectFile, e.getProject(), sourceFile, forceOpenInNewFrame);
}