本文整理汇总了Java中com.intellij.openapi.ui.DialogBuilder.addCancelAction方法的典型用法代码示例。如果您正苦于以下问题:Java DialogBuilder.addCancelAction方法的具体用法?Java DialogBuilder.addCancelAction怎么用?Java DialogBuilder.addCancelAction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.ui.DialogBuilder
的用法示例。
在下文中一共展示了DialogBuilder.addCancelAction方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: 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;
}
示例4: 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();
}
示例5: 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();
}
示例6: 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();
}
示例7: show
import com.intellij.openapi.ui.DialogBuilder; //导入方法依赖的package包/类
/**
* Show the search dialog
* @param searchTerm
*/
public void show(@Nullable final String searchTerm) {
final JTextField searchTextField = new JTextField(searchTerm);
JPanel panel = new JPanel(new BorderLayout());
panel.add(new JLabel(UI5Bundle.getString("api.searchterm")), BorderLayout.WEST);
panel.add(searchTextField, BorderLayout.CENTER);
final DialogBuilder dialogBuilder = new DialogBuilder(project);
dialogBuilder.setTitle(UI5Bundle.getString("api.search"));
dialogBuilder.setCenterPanel(panel);
dialogBuilder.addAction(getSearchAction(dialogBuilder, searchTextField.getText()));
dialogBuilder.addCancelAction();
dialogBuilder.showModal(true);
}
示例8: 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;
}
示例9: 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;
}
示例10: 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;
}
示例11: 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();
}
示例12: setActions
import com.intellij.openapi.ui.DialogBuilder; //导入方法依赖的package包/类
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());
}
}
示例13: showDefaultInjectionUI
import com.intellij.openapi.ui.DialogBuilder; //导入方法依赖的package包/类
@Nullable
protected static BaseInjection showDefaultInjectionUI(final Project project, BaseInjection injection) {
final BaseInjectionPanel panel = new BaseInjectionPanel(injection, project);
panel.reset();
final DialogBuilder builder = new DialogBuilder(project);
LanguageInjectionSupport support = InjectorUtils.findInjectionSupport(injection.getSupportId());
if (support instanceof AbstractLanguageInjectionSupport) {
builder.setHelpId(((AbstractLanguageInjectionSupport)support).getHelpId());
}
builder.addOkAction();
builder.addCancelAction();
builder.setDimensionServiceKey("#org.intellij.plugins.intelliLang.inject.config.ui.BaseInjectionDialog");
builder.setCenterPanel(panel.getComponent());
builder.setTitle(EditInjectionSettingsAction.EDIT_INJECTION_TITLE);
builder.setOkOperation(new Runnable() {
public void run() {
try {
panel.apply();
builder.getDialogWrapper().close(DialogWrapper.OK_EXIT_CODE);
}
catch (Exception e) {
final Throwable cause = e.getCause();
final String message = e.getMessage() + (cause != null? "\n "+cause.getMessage():"");
Messages.showErrorDialog(project, message, "Unable to Save");
}
}
});
if (builder.show() == DialogWrapper.OK_EXIT_CODE) {
return injection;
}
return null;
}
示例14: setActions
import com.intellij.openapi.ui.DialogBuilder; //导入方法依赖的package包/类
public void setActions(final DialogBuilder builder, MergePanel2 mergePanel) {
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() {
public void run() {
myOkButtonPresentation.run(builder.getDialogWrapper());
}
});
}
if (myCancelButtonPresentation != null) {
if (builder.getCancelAction() == null) {
builder.addCancelAction();
}
configureAction(builder, builder.getCancelAction(), myCancelButtonPresentation);
builder.setCancelOperation(new Runnable() {
public void run() {
myCancelButtonPresentation.run(builder.getDialogWrapper());
}
});
}
if (getMergeContent() != null && mergePanel.getMergeList() != null) {
new AllResolvedListener(mergePanel, builder.getDialogWrapper());
}
}
示例15: showDefaultInjectionUI
import com.intellij.openapi.ui.DialogBuilder; //导入方法依赖的package包/类
@Nullable
protected static BaseInjection showDefaultInjectionUI(final Project project, BaseInjection injection) {
final BaseInjectionPanel panel = new BaseInjectionPanel(injection, project);
panel.reset();
final DialogBuilder builder = new DialogBuilder(project);
LanguageInjectionSupport support = InjectorUtils.findInjectionSupport(injection.getSupportId());
if (support != null && support instanceof AbstractLanguageInjectionSupport) {
builder.setHelpId(((AbstractLanguageInjectionSupport)support).getHelpId());
}
builder.addOkAction();
builder.addCancelAction();
builder.setDimensionServiceKey("#org.intellij.plugins.intelliLang.inject.config.ui.BaseInjectionDialog");
builder.setCenterPanel(panel.getComponent());
builder.setTitle(EditInjectionSettingsAction.EDIT_INJECTION_TITLE);
builder.setOkOperation(new Runnable() {
public void run() {
try {
panel.apply();
builder.getDialogWrapper().close(DialogWrapper.OK_EXIT_CODE);
}
catch (Exception e) {
final Throwable cause = e.getCause();
final String message = e.getMessage() + (cause != null? "\n "+cause.getMessage():"");
Messages.showErrorDialog(project, message, "Unable to Save");
}
}
});
if (builder.show() == DialogWrapper.OK_EXIT_CODE) {
return injection;
}
return null;
}