List of usage examples for com.intellij.openapi.ui DialogWrapper show
public void show()
From source file:com.android.tools.idea.profiling.view.RenameCaptureFileAction.java
License:Apache License
@Override public void actionPerformed(AnActionEvent e) { Project project = e.getProject();//from w ww . ja va 2 s .c o m VirtualFile virtualFile = e.getData(CommonDataKeys.VIRTUAL_FILE); DialogWrapper dialog = new RenameDialog(project, virtualFile); dialog.show(); }
From source file:com.intellij.debugger.actions.EvaluateActionHandler.java
License:Apache License
public static void showEvaluationDialog(Project project, TextWithImports defaultExpression, String dialogType) { if (defaultExpression == null) { defaultExpression = new TextWithImportsImpl(CodeFragmentKind.EXPRESSION, ""); }// w w w .j ava 2 s .com CodeFragmentKind kind = DebuggerSettings.EVALUATE_FRAGMENT.equals(dialogType) ? CodeFragmentKind.CODE_BLOCK : CodeFragmentKind.EXPRESSION; DebuggerSettings.getInstance().EVALUATION_DIALOG_TYPE = dialogType; TextWithImportsImpl text = new TextWithImportsImpl(kind, defaultExpression.getText(), defaultExpression.getImports(), defaultExpression.getFileType()); final DialogWrapper dialog; if (DebuggerSettings.EVALUATE_FRAGMENT.equals(dialogType)) { dialog = new StatementEvaluationDialog(project, text); } else { dialog = new ExpressionEvaluationDialog(project, text); } dialog.show(); }
From source file:com.intellij.dvcs.DvcsPlatformFacadeImpl.java
License:Apache License
@Override public void showDialog(@NotNull DialogWrapper dialog) { dialog.show(); }
From source file:com.intellij.ide.actions.ViewStructureAction.java
License:Apache License
@Override public void actionPerformed(AnActionEvent e) { Project project = e.getData(CommonDataKeys.PROJECT); if (project == null) return;//from ww w . j av a 2 s.c o m final FileEditor fileEditor = e.getData(PlatformDataKeys.FILE_EDITOR); if (fileEditor == null) return; final VirtualFile virtualFile; final Editor editor = e.getData(CommonDataKeys.EDITOR); if (editor != null) { PsiDocumentManager.getInstance(project).commitDocument(editor.getDocument()); PsiFile psiFile = PsiDocumentManager.getInstance(project).getPsiFile(editor.getDocument()); if (psiFile == null) return; virtualFile = psiFile.getVirtualFile(); } else { virtualFile = e.getData(CommonDataKeys.VIRTUAL_FILE); } String title = virtualFile == null ? fileEditor.getName() : virtualFile.getName(); FeatureUsageTracker.getInstance().triggerFeatureUsed("navigation.popup.file.structure"); Navigatable navigatable = e.getData(CommonDataKeys.NAVIGATABLE); if (Registry.is("file.structure.tree.mode")) { FileStructurePopup popup = createPopup(project, fileEditor); if (popup == null) return; popup.setTitle(title); popup.show(); } else { DialogWrapper dialog = createDialog(editor, project, navigatable, fileEditor); if (dialog == null) return; dialog.setTitle(title); dialog.show(); } }
From source file:com.intellij.refactoring.changeSignature.JavaChangeSignatureHandler.java
License:Apache License
private static void invoke(final PsiMethod method, final Project project, @Nullable final Editor editor) { PsiMethod newMethod = SuperMethodWarningUtil.checkSuperMethod(method, RefactoringBundle.message("to.refactor")); if (newMethod == null) return;//from w ww . ja va2 s .c o m if (!newMethod.equals(method)) { ChangeSignatureUtil.invokeChangeSignatureOn(newMethod, project); return; } if (!CommonRefactoringUtil.checkReadOnlyStatus(project, method)) return; final PsiClass containingClass = method.getContainingClass(); final PsiReferenceExpression refExpr = editor != null ? TargetElementUtil.findReferenceExpression(editor) : null; final boolean allowDelegation = containingClass != null && !containingClass.isInterface(); final DialogWrapper dialog = new JavaChangeSignatureDialog(project, method, allowDelegation, refExpr); dialog.show(); }
From source file:com.intellij.refactoring.extractMethodObject.ExtractMethodObjectProcessor.java
License:Apache License
void moveUsedMethodsToInner() { if (!myUsages.isEmpty()) { if (ApplicationManager.getApplication().isUnitTestMode()) { for (MethodToMoveUsageInfo usage : myUsages) { final PsiMember member = (PsiMember) usage.getElement(); LOG.assertTrue(member != null); myInnerClass.add(member.copy()); member.delete();/*from w w w . jav a 2 s . co m*/ } return; } final List<MemberInfo> memberInfos = new ArrayList<MemberInfo>(); for (MethodToMoveUsageInfo usage : myUsages) { memberInfos.add(new MemberInfo((PsiMethod) usage.getElement())); } final MemberSelectionPanel panel = new MemberSelectionPanel("&Methods to move to the extracted class", memberInfos, null); DialogWrapper dlg = new DialogWrapper(myProject, false) { { init(); setTitle("Move Methods Used in Extracted Block Only"); } @Override protected JComponent createCenterPanel() { return panel; } }; dlg.show(); if (dlg.isOK()) { ApplicationManager.getApplication().runWriteAction(new Runnable() { public void run() { for (MemberInfoBase<PsiMember> memberInfo : panel.getTable().getSelectedMemberInfos()) { if (memberInfo.isChecked()) { myInnerClass.add(memberInfo.getMember().copy()); memberInfo.getMember().delete(); } } } }); } } }
From source file:com.intellij.uiDesigner.actions.CreateDialogAction.java
License:Apache License
@NotNull protected PsiElement[] invokeDialog(final Project project, final PsiDirectory directory) { final MyInputValidator validator = new MyInputValidator(project, directory); final MyContentPane contentPane = new MyContentPane(); final DialogWrapper dialog = new DialogWrapper(project, true) { {/*from ww w . java2 s .c o m*/ init(); setTitle(UIDesignerBundle.message("title.new.dialog")); } protected JComponent createCenterPanel() { return contentPane.getPanel(); } protected void doOKAction() { myRecentGenerateOK = contentPane.myChkGenerateOK.isSelected(); myRecentGenerateCancel = contentPane.myChkGenerateCancel.isSelected(); myRecentGenerateMain = contentPane.myChkGenerateMain.isSelected(); final String inputString = contentPane.myTfClassName.getText().trim(); if (validator.checkInput(inputString) && validator.canClose(inputString)) { close(OK_EXIT_CODE); } } public JComponent getPreferredFocusedComponent() { return contentPane.myTfClassName; } }; dialog.show(); return validator.getCreatedElements(); }
From source file:com.intellij.uiDesigner.actions.CreateFormAction.java
License:Apache License
@NotNull protected PsiElement[] invokeDialog(Project project, PsiDirectory directory) { final MyInputValidator validator = new MyInputValidator(project, directory); final DialogWrapper dialog = new MyDialog(project, validator); dialog.show(); return validator.getCreatedElements(); }
From source file:com.kiwisoft.utils.idea.PluginUtils.java
License:Open Source License
public static void showDialog(final DialogWrapper dialog, boolean wait, final boolean modal) { Runnable runnable = new Runnable() { public void run() { dialog.setModal(modal);//from ww w . j a va2s .com dialog.show(); } }; if (SwingUtilities.isEventDispatchThread()) runnable.run(); else if (wait) { try { SwingUtilities.invokeAndWait(runnable); } catch (Exception e) { e.printStackTrace(); } } else SwingUtilities.invokeLater(runnable); }
From source file:org.cordovastudio.utils.CordovaStudioUtils.java
License:Apache License
public static void showStackStace(@NotNull final Project project, @NotNull Throwable[] throwables) { final StringBuilder messageBuilder = new StringBuilder(); for (Throwable t : throwables) { if (messageBuilder.length() > 0) { messageBuilder.append("\n\n"); }/*from w w w . j a v a2 s .c o m*/ messageBuilder.append(getStackTrace(t)); } final DialogWrapper wrapper = new DialogWrapper(project, false) { { init(); } @Override protected JComponent createCenterPanel() { final JPanel panel = new JPanel(new BorderLayout()); final JTextArea textArea = new JTextArea(messageBuilder.toString()); textArea.setEditable(false); textArea.setRows(40); textArea.setColumns(70); panel.add(ScrollPaneFactory.createScrollPane(textArea)); return panel; } }; wrapper.setTitle("Stack trace"); wrapper.show(); }