mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Attempt to beatify New project dialog for specific IDEs:
- dialog frame is now same size as FlatWelcomeScreen - reduced size of the back button IDEA-CR-18881
This commit is contained in:
+14
-4
@@ -21,19 +21,20 @@ import com.intellij.openapi.actionSystem.DefaultActionGroup;
|
||||
import com.intellij.openapi.extensions.Extensions;
|
||||
import com.intellij.openapi.project.ProjectManager;
|
||||
import com.intellij.openapi.ui.DialogWrapper;
|
||||
import com.intellij.openapi.ui.DialogWrapperPeer;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.wm.impl.welcomeScreen.FlatWelcomeFrame;
|
||||
import com.intellij.platform.DirectoryProjectGenerator;
|
||||
import com.intellij.ui.ScrollingUtil;
|
||||
import com.intellij.ui.components.JBList;
|
||||
import com.intellij.util.ui.JBDimension;
|
||||
import com.intellij.util.ui.JBUI;
|
||||
import com.intellij.util.ui.update.UiNotifyConnector;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.KeyEvent;
|
||||
|
||||
/**
|
||||
@@ -47,6 +48,18 @@ public abstract class AbstractNewProjectDialog extends DialogWrapper {
|
||||
init();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void init() {
|
||||
super.init();
|
||||
DialogWrapperPeer peer = getPeer();
|
||||
JRootPane pane = peer.getRootPane();
|
||||
if (pane != null) {
|
||||
JBDimension size = JBUI.size(FlatWelcomeFrame.MAX_DEFAUL_WIDTH, FlatWelcomeFrame.DEFAULT_HEIGHT);
|
||||
pane.setMinimumSize(size);
|
||||
pane.setPreferredSize(size);
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
protected JComponent createCenterPanel() {
|
||||
@@ -56,10 +69,7 @@ public abstract class AbstractNewProjectDialog extends DialogWrapper {
|
||||
Disposer.register(getDisposable(), () -> root.removeAll());
|
||||
|
||||
Pair<JPanel, JBList> pair = FlatWelcomeFrame.createActionGroupPanel(root, getRootPane(), null, getDisposable());
|
||||
Dimension size = JBUI.size(666, 385);
|
||||
JPanel component = pair.first;
|
||||
component.setMinimumSize(size);
|
||||
component.setPreferredSize(size);
|
||||
new AnAction() {
|
||||
@Override
|
||||
public void actionPerformed(@NotNull AnActionEvent e) {
|
||||
|
||||
+14
-10
@@ -110,17 +110,21 @@ public class FlatWelcomeFrame extends JFrame implements IdeFrame, Disposable, Ac
|
||||
setTitle(getWelcomeFrameTitle());
|
||||
AppUIUtil.updateWindowIcon(this);
|
||||
final int width = RecentProjectsManager.getInstance().getRecentProjectsActions(false).length == 0 ? 666 : MAX_DEFAUL_WIDTH;
|
||||
setSize(JBUI.size(width, DEFAULT_HEIGHT));
|
||||
getRootPane().setPreferredSize(JBUI.size(width, DEFAULT_HEIGHT));
|
||||
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
|
||||
));
|
||||
|
||||
addComponentListener(new ComponentAdapter() {
|
||||
@Override
|
||||
public void componentShown(ComponentEvent e) {
|
||||
pack();
|
||||
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
|
||||
@@ -947,7 +951,7 @@ public class FlatWelcomeFrame extends JFrame implements IdeFrame, Disposable, Ac
|
||||
return button;
|
||||
}
|
||||
JLabel back = new JLabel(AllIcons.Actions.Back);
|
||||
back.setBorder(JBUI.Borders.empty(3, 7, 10, 7));
|
||||
back.setBorder(JBUI.Borders.empty(3, 7, 3, 7));
|
||||
back.setHorizontalAlignment(SwingConstants.LEFT);
|
||||
new ClickListener() {
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user