Java Code Examples for com.intellij.openapi.ui.DialogBuilder#addCancelAction()
The following examples show how to use
com.intellij.openapi.ui.DialogBuilder#addCancelAction() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractArtifactsBeforeRunTaskProvider.java From consulo with Apache License 2.0 | 6 votes |
@RequiredUIAccess @Nonnull @Override public AsyncResult<Void> configureTask(RunConfiguration runConfiguration, T task) { final Artifact[] artifacts = ArtifactManager.getInstance(myProject).getArtifacts(); Set<ArtifactPointer> pointers = new THashSet<>(); for (Artifact artifact : artifacts) { pointers.add(ArtifactPointerManager.getInstance(myProject).create(artifact)); } pointers.addAll(task.getArtifactPointers()); ArtifactChooser chooser = new ArtifactChooser(new ArrayList<>(pointers)); chooser.markElements(task.getArtifactPointers()); chooser.setPreferredSize(new Dimension(400, 300)); DialogBuilder builder = new DialogBuilder(myProject); builder.setTitle(CompilerBundle.message("build.artifacts.before.run.selector.title")); builder.setDimensionServiceKey("#BuildArtifactsBeforeRunChooser"); builder.addOkAction(); builder.addCancelAction(); builder.setCenterPanel(chooser); builder.setPreferredFocusComponent(chooser); AsyncResult<Void> result = builder.showAsync(); result.doWhenDone(() -> task.setArtifactPointers(chooser.getMarkedElements())); return result; }
Example 2
Source File: Panel.java From GitCommitMessage with Apache License 2.0 | 5 votes |
public DialogWrapper createTemplateDialog(Project project) { Template template = new Template(project); DialogBuilder builder = new DialogBuilder(project); builder.setTitle("Git / Hg Mercurial Commit Message Template."); builder.setCenterPanel(template.getMainPanel()); builder.removeAllActions(); builder.addOkAction(); builder.addCancelAction(); boolean isOk = builder.show() == DialogWrapper.OK_EXIT_CODE; if (isOk) { TemplateFileHandler.storeFile(project, template.getTemplateContent()); } return builder.getDialogWrapper(); }
Example 3
Source File: MergeRequestImpl.java From consulo with Apache License 2.0 | 5 votes |
public void setActions(final DialogBuilder builder, MergePanel2 mergePanel, final Convertor<DialogWrapper, Boolean> preOkHook) { builder.removeAllActions(); // otherwise dialog will get default actions (OK, Cancel) if (myOkButtonPresentation != null) { if (builder.getOkAction() == null) { builder.addOkAction(); } configureAction(builder, builder.getOkAction(), myOkButtonPresentation); builder.setOkOperation(new Runnable() { @Override public void run() { if (preOkHook != null && !preOkHook.convert(builder.getDialogWrapper())) return; myOkButtonPresentation.run(builder.getDialogWrapper()); } }); } if (myCancelButtonPresentation != null) { if (builder.getCancelAction() == null) { builder.addCancelAction(); } configureAction(builder, builder.getCancelAction(), myCancelButtonPresentation); builder.setCancelOperation(new Runnable() { @Override public void run() { myCancelButtonPresentation.run(builder.getDialogWrapper()); } }); } if (getMergeContent() != null && mergePanel.getMergeList() != null) { new AllResolvedListener(mergePanel, builder.getDialogWrapper()); } }
Example 4
Source File: RenderingOptionsForm.java From markdown-doclet with GNU General Public License v3.0 | 5 votes |
@Override public void actionPerformed(ActionEvent e) { DialogBuilder dialogBuilder = new DialogBuilder((Component)e.getSource()); dialogBuilder.setTitle("Markdown Javadoc Rendering Options"); dialogBuilder.addOkAction(); dialogBuilder.addCancelAction(); RenderingOptionsForm form = new RenderingOptionsForm(options.renderingOptions); dialogBuilder.setCenterPanel(form.getComponent()); int exitCode = dialogBuilder.show(); if (exitCode == DialogWrapper.OK_EXIT_CODE) { options.renderingOptions = form.get(); } }