public static void importConfigsTo(@NotNull String newConfigPath) {
    ConfigImportSettings settings = getConfigImportSettings();

    File newConfigDir = new File(newConfigPath);
    File oldConfigDir = findOldConfigDir(newConfigDir, settings.getCustomPathsSelector());
    do {
      ImportOldConfigsPanel dialog = new ImportOldConfigsPanel(oldConfigDir, settings);
      dialog.setModalityType(Dialog.ModalityType.TOOLKIT_MODAL);
      AppUIUtil.updateWindowIcon(dialog);
      dialog.setVisible(true);
      if (dialog.isImportEnabled()) {
        File installationHome = dialog.getSelectedFile();
        oldConfigDir = getOldConfigDir(installationHome, settings);
        if (!validateOldConfigDir(installationHome, oldConfigDir, settings)) {
          continue;
        }

        assert oldConfigDir != null;
        doImport(newConfigDir, oldConfigDir, settings, installationHome);
        settings.importFinished(newConfigPath);
        System.setProperty(CONFIG_IMPORTED_IN_CURRENT_SESSION_KEY, Boolean.TRUE.toString());
      }

      break;
    } while (true);
  }
Ejemplo n.º 2
0
  public WelcomeFrame() {
    JRootPane rootPane = getRootPane();
    final WelcomeScreen screen = createScreen(rootPane);

    final IdeGlassPaneImpl glassPane = new IdeGlassPaneImpl(rootPane);
    setGlassPane(glassPane);
    glassPane.setVisible(false);
    setContentPane(screen.getWelcomePanel());
    setTitle(ApplicationNamesInfo.getInstance().getFullProductName());
    AppUIUtil.updateWindowIcon(this);

    ProjectManager.getInstance()
        .addProjectManagerListener(
            new ProjectManagerAdapter() {
              @Override
              public void projectOpened(Project project) {
                dispose();
              }
            });

    myBalloonLayout = new BalloonLayoutImpl(rootPane.getLayeredPane(), new Insets(8, 8, 8, 8));

    myScreen = screen;
    setupCloseAction();
    new MnemonicHelper().register(this);
    myScreen.setupFrame(this);
  }
Ejemplo n.º 3
0
 public void stackChanged(@Nullable final XStackFrame xStackFrame) {
   AppUIUtil.invokeOnEdt(
       new Runnable() {
         @Override
         public void run() {
           myXTree.stackChanged(xStackFrame);
           ((CardLayout) (myCards.getLayout())).show(myCards, xStackFrame == null ? TREE : X_TREE);
         }
       });
 }
 @Override
 protected void showError(
     @Nullable final String error,
     @Nullable final WebBrowser browser,
     @Nullable final Project project,
     final String title,
     @Nullable final Runnable launchTask) {
   AppUIUtil.invokeOnEdt(
       new Runnable() {
         @Override
         public void run() {
           if (Messages.showYesNoDialog(
                   project,
                   StringUtil.notNullize(error, "Unknown error"),
                   title == null ? IdeBundle.message("browser.error") : title,
                   Messages.OK_BUTTON,
                   IdeBundle.message("button.fix"),
                   null)
               == Messages.NO) {
             final BrowserSettings browserSettings = new BrowserSettings();
             if (ShowSettingsUtil.getInstance()
                 .editConfigurable(
                     project,
                     browserSettings,
                     browser == null
                         ? null
                         : new Runnable() {
                           @Override
                           public void run() {
                             browserSettings.selectBrowser(browser);
                           }
                         })) {
               if (launchTask != null) {
                 launchTask.run();
               }
             }
           }
         }
       },
       project == null ? null : project.getDisposed());
 }
  public FlatWelcomeFrame() {
    final JRootPane rootPane = getRootPane();
    myScreen = new FlatWelcomeScreen();

    final IdeGlassPaneImpl glassPane =
        new IdeGlassPaneImpl(rootPane) {
          @Override
          public void addNotify() {
            super.addNotify();
            rootPane.remove(getProxyComponent());
            //noinspection SSBasedInspection
            SwingUtilities.invokeLater(
                new Runnable() {
                  public void run() {
                    JBProtocolCommand.handleCurrentCommand();
                  }
                });
          }
        };

    setGlassPane(glassPane);
    glassPane.setVisible(false);
    // setUndecorated(true);
    setContentPane(myScreen.getWelcomePanel());
    setTitle("Welcome to " + ApplicationNamesInfo.getInstance().getFullProductName());
    AppUIUtil.updateWindowIcon(this);
    final int width =
        RecentProjectsManager.getInstance().getRecentProjectsActions(false).length == 0 ? 666 : 777;
    setSize(JBUI.size(width, 460));
    setResizable(false);
    // int x = bounds.x + (bounds.width - getWidth()) / 2;
    // int y = bounds.y + (bounds.height - getHeight()) / 2;
    Point location = DimensionService.getInstance().getLocation(WelcomeFrame.DIMENSION_KEY, null);
    Rectangle screenBounds =
        ScreenUtil.getScreenRectangle(location != null ? location : new Point(0, 0));
    setLocation(
        new Point(
            screenBounds.x + (screenBounds.width - getWidth()) / 2,
            screenBounds.y + (screenBounds.height - getHeight()) / 3));

    // setLocation(x, y);
    ProjectManager.getInstance()
        .addProjectManagerListener(
            new ProjectManagerAdapter() {
              @Override
              public void projectOpened(Project project) {
                dispose();
              }
            });

    myBalloonLayout = new BalloonLayoutImpl(rootPane, JBUI.insets(8));

    WelcomeFrame.setupCloseAction(this);
    MnemonicHelper.init(this);
    Disposer.register(
        ApplicationManager.getApplication(),
        new Disposable() {
          @Override
          public void dispose() {
            FlatWelcomeFrame.this.dispose();
          }
        });
  }
Ejemplo n.º 6
0
 @Override
 public void setAppIcons() {
   AppUIUtil.updateWindowIcon(getWindow());
 }