Search in sources :

Example 21 with DialogWrapper

use of com.intellij.openapi.ui.DialogWrapper in project intellij-community by JetBrains.

the class SmoothProgressAdapter method showDialog.

private void showDialog() {
    if (myDialog == null) {
        //System.out.println("showDialog()");
        myDialog = new DialogWrapper(myProject, false) {

            {
                getWindow().setBounds(0, 0, 1, 1);
                setResizable(false);
            }

            @Override
            protected boolean isProgressDialog() {
                return true;
            }

            @Override
            protected JComponent createCenterPanel() {
                return null;
            }
        };
        myDialog.setModal(true);
        myDialog.setUndecorated(true);
        myDialog.show();
    }
}
Also used : DialogWrapper(com.intellij.openapi.ui.DialogWrapper)

Example 22 with DialogWrapper

use of com.intellij.openapi.ui.DialogWrapper in project intellij-community by JetBrains.

the class ShowNonRetinaImagesActions method actionPerformed.

@Override
public void actionPerformed(AnActionEvent e) {
    final Project project = e.getProject();
    if (project == null)
        return;
    class ImageInfo {

        boolean retina;

        boolean normal;

        boolean dark;

        boolean retina_dark;
    }
    HashMap<String, ImageInfo> info = new HashMap<>();
    final Collection<VirtualFile> images = FilenameIndex.getAllFilesByExt(project, "png", GlobalSearchScope.projectScope(project));
    for (VirtualFile image : images) {
        final String path = image.getPath();
        final String key = toKey(path);
        ImageInfo imageInfo = info.get(key);
        if (imageInfo == null) {
            imageInfo = new ImageInfo();
            info.put(key, imageInfo);
        }
        if (path.endsWith("@2x_dark.png")) {
            imageInfo.retina_dark = true;
        } else if (path.endsWith("_dark.png")) {
            imageInfo.dark = true;
        } else if (path.endsWith("@2x.png")) {
            imageInfo.retina = true;
        } else {
            imageInfo.normal = true;
        }
    }
    final ArrayList<String> retinaMissed = new ArrayList<>();
    for (String key : info.keySet()) {
        if (!info.get(key).retina && info.get(key).normal) {
            retinaMissed.add(key);
        }
    }
    Collections.sort(retinaMissed, String.CASE_INSENSITIVE_ORDER);
    new DialogWrapper(project) {

        {
            init();
        }

        @Nullable
        @Override
        protected JComponent createCenterPanel() {
            return new JBScrollPane(new JTextArea(StringUtil.join(retinaMissed, "\n")));
        }
    }.show();
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) DialogWrapper(com.intellij.openapi.ui.DialogWrapper) Project(com.intellij.openapi.project.Project) Nullable(org.jetbrains.annotations.Nullable) JBScrollPane(com.intellij.ui.components.JBScrollPane)

Example 23 with DialogWrapper

use of com.intellij.openapi.ui.DialogWrapper in project intellij-community by JetBrains.

the class RegistryUi method show.

public boolean show() {
    DialogWrapper dialog = new DialogWrapper(true) {

        {
            setTitle("Registry");
            setModal(true);
            init();
            revaliateActions();
        }

        private AbstractAction myCloseAction;

        @Nullable
        @Override
        protected JComponent createNorthPanel() {
            if (!ApplicationManager.getApplication().isInternal()) {
                JLabel warningLabel = new JLabel(XmlStringUtil.wrapInHtml("<b>Changing these values may cause unwanted behavior of " + ApplicationNamesInfo.getInstance().getFullProductName() + ". Please do not change these unless you have been asked.</b>"));
                warningLabel.setIcon(UIUtil.getWarningIcon());
                warningLabel.setForeground(JBColor.RED);
                return warningLabel;
            }
            return null;
        }

        @Override
        protected JComponent createCenterPanel() {
            return myContent;
        }

        @Override
        protected void dispose() {
            super.dispose();
            RegistryUi.this.dispose();
        }

        @Override
        protected String getDimensionServiceKey() {
            return "Registry";
        }

        @Override
        public JComponent getPreferredFocusedComponent() {
            return myTable;
        }

        @NotNull
        @Override
        protected Action[] createActions() {
            return new Action[] { myRestoreDefaultsAction, myCloseAction };
        }

        @Override
        protected void createDefaultActions() {
            super.createDefaultActions();
            myCloseAction = new AbstractAction("Close") {

                @Override
                public void actionPerformed(@NotNull ActionEvent e) {
                    processClose();
                    doOKAction();
                }
            };
            myCloseAction.putValue(DialogWrapper.DEFAULT_ACTION, true);
        }

        @Override
        public void doCancelAction() {
            final TableCellEditor cellEditor = myTable.getCellEditor();
            if (cellEditor != null) {
                cellEditor.stopCellEditing();
            }
            processClose();
            super.doCancelAction();
        }
    };
    return dialog.showAndGet();
}
Also used : ShadowAction(com.intellij.openapi.ui.ShadowAction) ActionEvent(java.awt.event.ActionEvent) TableCellEditor(javax.swing.table.TableCellEditor) DialogWrapper(com.intellij.openapi.ui.DialogWrapper)

Example 24 with DialogWrapper

use of com.intellij.openapi.ui.DialogWrapper in project intellij-community by JetBrains.

the class AntSetPanel method showDialog.

@Nullable
public AntInstallation showDialog(JComponent parent) {
    final DialogWrapper dialog = new MyDialog(parent);
    if (!dialog.showAndGet()) {
        return null;
    }
    apply();
    return myForm.getSelectedAnt();
}
Also used : DialogWrapper(com.intellij.openapi.ui.DialogWrapper) Nullable(org.jetbrains.annotations.Nullable)

Example 25 with DialogWrapper

use of com.intellij.openapi.ui.DialogWrapper in project intellij-community by JetBrains.

the class MergePanel2 method setDiffRequest.

public void setDiffRequest(DiffRequest data) {
    setTitle(data.getWindowTitle());
    disposeMergeList();
    for (int i = 0; i < EDITORS_COUNT; i++) {
        getEditorPlace(i).setDocument(null);
    }
    LOG.assertTrue(!myDuringCreation);
    myDuringCreation = true;
    myProvider.putData(data.getGenericData());
    try {
        myData = data;
        String[] titles = myData.getContentTitles();
        for (int i = 0; i < myEditorsPanels.length; i++) {
            LabeledComponent editorsPanel = myEditorsPanels[i];
            editorsPanel.getLabel().setText(titles[i].isEmpty() ? " " : titles[i]);
        }
        createMergeList();
        data.customizeToolbar(myPanel.resetToolbar());
        myPanel.registerToolbarActions();
        if (data instanceof MergeRequestImpl && myBuilder != null) {
            Convertor<DialogWrapper, Boolean> preOkHook = new Convertor<DialogWrapper, Boolean>() {

                @Override
                public Boolean convert(DialogWrapper dialog) {
                    ChangeCounter counter = ChangeCounter.getOrCreate(myMergeList);
                    int changes = counter.getChangeCounter();
                    int conflicts = counter.getConflictCounter();
                    if (changes == 0 && conflicts == 0)
                        return true;
                    return Messages.showYesNoDialog(dialog.getRootPane(), DiffBundle.message("merge.dialog.apply.partially.resolved.changes.confirmation.message", changes, conflicts), DiffBundle.message("apply.partially.resolved.merge.dialog.title"), Messages.getQuestionIcon()) == Messages.YES;
                }
            };
            ((MergeRequestImpl) data).setActions(myBuilder, this, preOkHook);
        }
    } finally {
        myDuringCreation = false;
    }
}
Also used : MergeRequestImpl(com.intellij.openapi.diff.impl.mergeTool.MergeRequestImpl) ChangeCounter(com.intellij.openapi.diff.impl.incrementalMerge.ChangeCounter) LabeledComponent(com.intellij.openapi.ui.LabeledComponent) DiffDividerPaint(com.intellij.openapi.diff.impl.splitter.DiffDividerPaint) DialogWrapper(com.intellij.openapi.ui.DialogWrapper) Convertor(com.intellij.util.containers.Convertor)

Aggregations

DialogWrapper (com.intellij.openapi.ui.DialogWrapper)37 Project (com.intellij.openapi.project.Project)7 VirtualFile (com.intellij.openapi.vfs.VirtualFile)7 ActionEvent (java.awt.event.ActionEvent)6 Nullable (org.jetbrains.annotations.Nullable)6 JBScrollPane (com.intellij.ui.components.JBScrollPane)5 ActionListener (java.awt.event.ActionListener)4 AnAction (com.intellij.openapi.actionSystem.AnAction)3 AnActionEvent (com.intellij.openapi.actionSystem.AnActionEvent)3 Document (com.intellij.openapi.editor.Document)3 IOException (java.io.IOException)3 ArrayList (java.util.ArrayList)3 MockDocument (com.intellij.mock.MockDocument)2 MockPsiFile (com.intellij.mock.MockPsiFile)2 javax.swing (javax.swing)2 HyperlinkEvent (javax.swing.event.HyperlinkEvent)2 NotNull (org.jetbrains.annotations.NotNull)2 AnnotationTargetUtil (com.intellij.codeInsight.AnnotationTargetUtil)1 DaemonCodeAnalyzer (com.intellij.codeInsight.daemon.DaemonCodeAnalyzer)1 HighlightDisplayKey (com.intellij.codeInsight.daemon.HighlightDisplayKey)1