本文整理汇总了Java中com.intellij.openapi.ui.DialogBuilder.addOkAction方法的典型用法代码示例。如果您正苦于以下问题:Java DialogBuilder.addOkAction方法的具体用法?Java DialogBuilder.addOkAction怎么用?Java DialogBuilder.addOkAction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.ui.DialogBuilder
的用法示例。
在下文中一共展示了DialogBuilder.addOkAction方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doShowError
import com.intellij.openapi.ui.DialogBuilder; //导入方法依赖的package包/类
private static void doShowError(String title, String description, DialogBuilder builder) {
builder.setTitle(title);
final JTextArea textArea = new JTextArea();
textArea.setEditable(false);
textArea.setText(description);
textArea.setWrapStyleWord(false);
textArea.setLineWrap(true);
final JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(textArea);
scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
final JPanel panel = new JPanel(new BorderLayout(10, 0));
panel.setPreferredSize(new Dimension(600, 400));
panel.add(scrollPane, BorderLayout.CENTER);
panel.add(new JBLabel("Details:", Messages.getErrorIcon(), SwingConstants.LEFT), BorderLayout.NORTH);
builder.setCenterPanel(panel);
builder.setButtonsAlignment(SwingConstants.CENTER);
builder.addOkAction();
builder.show();
}
示例2: configureTask
import com.intellij.openapi.ui.DialogBuilder; //导入方法依赖的package包/类
public boolean configureTask(RunConfiguration runConfiguration, BuildArtifactsBeforeRunTask task) {
final Artifact[] artifacts = ArtifactManager.getInstance(myProject).getArtifacts();
Set<ArtifactPointer> pointers = new THashSet<ArtifactPointer>();
for (Artifact artifact : artifacts) {
pointers.add(ArtifactPointerManager.getInstance(myProject).createPointer(artifact));
}
pointers.addAll(task.getArtifactPointers());
ArtifactChooser chooser = new ArtifactChooser(new ArrayList<ArtifactPointer>(pointers));
chooser.markElements(task.getArtifactPointers());
chooser.setPreferredSize(JBUI.size(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);
if (builder.show() == DialogWrapper.OK_EXIT_CODE) {
task.setArtifactPointers(chooser.getMarkedElements());
return true;
}
return false;
}
示例3: actionPerformed
import com.intellij.openapi.ui.DialogBuilder; //导入方法依赖的package包/类
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
final DateFilterComponent dateComponent = new DateFilterComponent(false, DateFormatUtil.getDateFormat().getDelegate());
VcsLogDateFilter currentFilter = myFilterModel.getFilter();
if (currentFilter != null) {
if (currentFilter.getBefore() != null) {
dateComponent.setBefore(currentFilter.getBefore().getTime());
}
if (currentFilter.getAfter() != null) {
dateComponent.setAfter(currentFilter.getAfter().getTime());
}
}
DialogBuilder db = new DialogBuilder(DateFilterPopupComponent.this);
db.addOkAction();
db.setCenterPanel(dateComponent.getPanel());
db.setPreferredFocusComponent(dateComponent.getPanel());
db.setTitle("Select Period");
if (DialogWrapper.OK_EXIT_CODE == db.show()) {
long after = dateComponent.getAfter();
long before = dateComponent.getBefore();
VcsLogDateFilter filter = new VcsLogDateFilterImpl(after > 0 ? new Date(after) : null, before > 0 ? new Date(before) : null);
myFilterModel.setFilter(filter);
}
}
示例4: showDialog
import com.intellij.openapi.ui.DialogBuilder; //导入方法依赖的package包/类
private boolean showDialog() {
DialogBuilder builder = new DialogBuilder(myBuildFile.getProject());
builder.setCenterPanel(myForm.myWholePanel);
builder.setDimensionServiceKey(DIMENSION_SERVICE_KEY);
builder.setPreferredFocusComponent(myForm.getPreferedFocusComponent());
builder.setTitle(AntBundle.message("build.file.properties.dialog.title"));
builder.removeAllActions();
builder.addOkAction();
builder.addCancelAction();
builder.setHelpId("reference.dialogs.buildfileproperties");
boolean isOk = builder.show() == DialogWrapper.OK_EXIT_CODE;
if (isOk) {
apply();
}
beforeClose();
return isOk;
}
示例5: showFormSource
import com.intellij.openapi.ui.DialogBuilder; //导入方法依赖的package包/类
public void showFormSource() {
EditorFactory editorFactory = EditorFactory.getInstance();
Editor editor = editorFactory.createViewer(myDocument, myProject);
try {
((EditorEx)editor).setHighlighter(
new LexerEditorHighlighter(new XmlFileHighlighter(), EditorColorsManager.getInstance().getGlobalScheme()));
JComponent component = editor.getComponent();
component.setPreferredSize(new Dimension(640, 480));
DialogBuilder dialog = new DialogBuilder(myProject);
dialog.title("Form - " + myFile.getPresentableName()).dimensionKey("GuiDesigner.FormSource.Dialog");
dialog.centerPanel(component).setPreferredFocusComponent(editor.getContentComponent());
dialog.addOkAction();
dialog.show();
}
finally {
editorFactory.releaseEditor(editor);
}
}
示例6: showErrorDialog
import com.intellij.openapi.ui.DialogBuilder; //导入方法依赖的package包/类
private static void showErrorDialog(@NotNull Project project, @NotNull String operationName, @NotNull List<Change> changes,
@NotNull Collection<String> absolutePaths) {
String title = "Local Changes Prevent from " + StringUtil.capitalize(operationName);
String description = getErrorDialogDescription();
if (changes.isEmpty()) {
GitUtil.showPathsInDialog(project, absolutePaths, title, description);
}
else {
DialogBuilder builder = new DialogBuilder(project);
builder.setNorthPanel(new MultiLineLabel(description));
builder.setCenterPanel(new ChangesBrowserWithRollback(project, changes));
builder.addOkAction();
builder.setTitle(title);
builder.show();
}
}
示例7: showInjectionUI
import com.intellij.openapi.ui.DialogBuilder; //导入方法依赖的package包/类
private static BaseInjection showInjectionUI(final Project project, final MethodParameterInjection methodParameterInjection) {
final AbstractInjectionPanel panel = new MethodParameterPanel(methodParameterInjection, project);
panel.reset();
final DialogBuilder builder = new DialogBuilder(project);
builder.setHelpId("reference.settings.injection.language.injection.settings.java.parameter");
builder.addOkAction();
builder.addCancelAction();
builder.setCenterPanel(panel.getComponent());
builder.setTitle(EditInjectionSettingsAction.EDIT_INJECTION_TITLE);
builder.setOkOperation(new Runnable() {
public void run() {
panel.apply();
builder.getDialogWrapper().close(DialogWrapper.OK_EXIT_CODE);
}
});
if (builder.show() == DialogWrapper.OK_EXIT_CODE) {
return new BaseInjection(methodParameterInjection.getSupportId()).copyFrom(methodParameterInjection);
}
return null;
}
示例8: showDialog
import com.intellij.openapi.ui.DialogBuilder; //导入方法依赖的package包/类
public void showDialog(final Project project, final Runnable callback) {
final DialogBuilder builder = new DialogBuilder(project);
builder.setCenterPanel(createPanel(project, new Consumer<Boolean>() {
@Override
public void consume(Boolean aBoolean) {
builder.setOkActionEnabled(aBoolean);
}
}));
builder.addOkAction();
builder.addCancelAction();
builder.setDimensionServiceKey(getClass().getName());
builder.setTitle("Open Fossil Repository");
builder.setOkOperation(new Runnable() {
@Override
public void run() {
builder.getWindow().setVisible(false);
callback.run();
}
});
builder.setPreferredFocusComponent(myRepoField);
builder.show();
}
示例9: showDialog
import com.intellij.openapi.ui.DialogBuilder; //导入方法依赖的package包/类
public void showDialog(final Project project, final Runnable callback) {
final DialogBuilder builder = new DialogBuilder(project);
builder.setCenterPanel(createPanel(project, new Consumer<Boolean>() {
@Override
public void consume(Boolean aBoolean) {
builder.setOkActionEnabled(aBoolean);
}
}));
builder.addOkAction();
builder.addCancelAction();
builder.setDimensionServiceKey(getClass().getName());
builder.setTitle("Clone and Open Fossil Repository");
builder.setOkOperation(new Runnable() {
@Override
public void run() {
builder.getWindow().setVisible(false);
callback.run();
}
});
builder.setPreferredFocusComponent(myUrlField);
builder.show();
}
示例10: showDialog
import com.intellij.openapi.ui.DialogBuilder; //导入方法依赖的package包/类
public void showDialog(final Project project, final Runnable callback) {
final DialogBuilder builder = new DialogBuilder(project);
builder.setCenterPanel(createPanel(project, new Consumer<Boolean>() {
@Override
public void consume(Boolean aBoolean) {
builder.setOkActionEnabled(aBoolean);
}
}));
builder.addOkAction();
builder.addCancelAction();
builder.setDimensionServiceKey(getClass().getName());
builder.setTitle("Clone Fossil Repository");
builder.setOkOperation(new Runnable() {
@Override
public void run() {
builder.getWindow().setVisible(false);
callback.run();
}
});
builder.setPreferredFocusComponent(myUrlField);
builder.show();
}
示例11: configureTask
import com.intellij.openapi.ui.DialogBuilder; //导入方法依赖的package包/类
public boolean configureTask(RunConfiguration runConfiguration, BuildArtifactsBeforeRunTask task) {
final Artifact[] artifacts = ArtifactManager.getInstance(myProject).getArtifacts();
Set<ArtifactPointer> pointers = new THashSet<ArtifactPointer>();
for (Artifact artifact : artifacts) {
pointers.add(ArtifactPointerManager.getInstance(myProject).createPointer(artifact));
}
pointers.addAll(task.getArtifactPointers());
ArtifactChooser chooser = new ArtifactChooser(new ArrayList<ArtifactPointer>(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);
if (builder.show() == DialogWrapper.OK_EXIT_CODE) {
task.setArtifactPointers(chooser.getMarkedElements());
return true;
}
return false;
}
示例12: showDialog
import com.intellij.openapi.ui.DialogBuilder; //导入方法依赖的package包/类
private boolean showDialog()
{
DialogBuilder builder = new DialogBuilder(myBuildFile.getProject());
builder.setCenterPanel(myForm.myWholePanel);
builder.setDimensionServiceKey(DIMENSION_SERVICE_KEY);
builder.setPreferredFocusComponent(myForm.getPreferedFocusComponent());
builder.setTitle(AntBundle.message("build.file.properties.dialog.title"));
builder.removeAllActions();
builder.addOkAction();
builder.addCancelAction();
builder.setHelpId("reference.dialogs.buildfileproperties");
boolean isOk = builder.show() == DialogWrapper.OK_EXIT_CODE;
if(isOk)
{
apply();
}
beforeClose();
return isOk;
}
示例13: actionPerformed
import com.intellij.openapi.ui.DialogBuilder; //导入方法依赖的package包/类
@Override
public void actionPerformed(@Nonnull AnActionEvent e) {
final DateFilterComponent dateComponent = new DateFilterComponent(false, DateFormatUtil.getDateFormat().getDelegate());
VcsLogDateFilter currentFilter = myFilterModel.getFilter();
if (currentFilter != null) {
if (currentFilter.getBefore() != null) {
dateComponent.setBefore(currentFilter.getBefore().getTime());
}
if (currentFilter.getAfter() != null) {
dateComponent.setAfter(currentFilter.getAfter().getTime());
}
}
DialogBuilder db = new DialogBuilder(DateFilterPopupComponent.this);
db.addOkAction();
db.setCenterPanel(dateComponent.getPanel());
db.setPreferredFocusComponent(dateComponent.getPanel());
db.setTitle("Select Period");
if (DialogWrapper.OK_EXIT_CODE == db.show()) {
long after = dateComponent.getAfter();
long before = dateComponent.getBefore();
VcsLogDateFilter filter = new VcsLogDateFilterImpl(after > 0 ? new Date(after) : null, before > 0 ? new Date(before) : null);
myFilterModel.setFilter(filter);
}
}
示例14: configureTask
import com.intellij.openapi.ui.DialogBuilder; //导入方法依赖的package包/类
@Override
public boolean configureTask(RunConfiguration runConfiguration, T task) {
final Artifact[] artifacts = ArtifactManager.getInstance(myProject).getArtifacts();
Set<ArtifactPointer> pointers = new THashSet<ArtifactPointer>();
for (Artifact artifact : artifacts) {
pointers.add(ArtifactPointerUtil.getPointerManager(myProject).create(artifact));
}
pointers.addAll(task.getArtifactPointers());
ArtifactChooser chooser = new ArtifactChooser(new ArrayList<ArtifactPointer>(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);
if (builder.show() == DialogWrapper.OK_EXIT_CODE) {
task.setArtifactPointers(chooser.getMarkedElements());
return true;
}
return false;
}
示例15: createTemplateDialog
import com.intellij.openapi.ui.DialogBuilder; //导入方法依赖的package包/类
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();
}