本文整理汇总了Java中com.intellij.openapi.ui.DialogBuilder.showModal方法的典型用法代码示例。如果您正苦于以下问题:Java DialogBuilder.showModal方法的具体用法?Java DialogBuilder.showModal怎么用?Java DialogBuilder.showModal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.ui.DialogBuilder
的用法示例。
在下文中一共展示了DialogBuilder.showModal方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
示例2: showDiffDialog
import com.intellij.openapi.ui.DialogBuilder; //导入方法依赖的package包/类
static void showDiffDialog(DialogBuilder builder, Collection hints) {
builder.showModal(!hints.contains(DiffTool.HINT_SHOW_NOT_MODAL_DIALOG));
}
示例3: editPattern
import com.intellij.openapi.ui.DialogBuilder; //导入方法依赖的package包/类
private void editPattern(@Nullable final String item) {
final FileType type = myRecognizedFileType.getSelectedFileType();
if (type == null) return;
final String title =
item == null
? FileTypesBundle.message("filetype.edit.add.pattern.title")
: FileTypesBundle.message("filetype.edit.edit.pattern.title");
final Language oldLanguage = item == null ? null : myTempTemplateDataLanguages.findAssociatedFileType(item);
final FileTypePatternDialog dialog = new FileTypePatternDialog(item, type, oldLanguage);
final DialogBuilder builder = new DialogBuilder(myPatterns);
builder.setPreferredFocusComponent(dialog.getPatternField());
builder.setCenterPanel(dialog.getMainPanel());
builder.setTitle(title);
builder.showModal(true);
if (builder.getDialogWrapper().isOK()) {
final String pattern = dialog.getPatternField().getText();
if (StringUtil.isEmpty(pattern)) return;
final FileNameMatcher matcher = FileTypeManager.parseFromString(pattern);
FileType registeredFileType = findExistingFileType(matcher);
if (registeredFileType != null && registeredFileType != type) {
if (registeredFileType.isReadOnly()) {
Messages.showMessageDialog(myPatterns.myPatternsList,
FileTypesBundle.message("filetype.edit.add.pattern.exists.error", registeredFileType.getDescription()),
title, Messages.getErrorIcon());
return;
}
else {
if (Messages.OK == Messages.showOkCancelDialog(myPatterns.myPatternsList, FileTypesBundle.message("filetype.edit.add.pattern.exists.message",
registeredFileType.getDescription()),
FileTypesBundle.message("filetype.edit.add.pattern.exists.title"),
FileTypesBundle.message("filetype.edit.add.pattern.reassign.button"),
CommonBundle.getCancelButtonText(), Messages.getQuestionIcon())) {
myTempPatternsTable.removeAssociation(matcher, registeredFileType);
if (oldLanguage != null) {
myTempTemplateDataLanguages.removeAssociation(matcher, oldLanguage);
}
myReassigned.put(matcher, registeredFileType);
}
else {
return;
}
}
}
if (item != null) {
final FileNameMatcher oldMatcher = FileTypeManager.parseFromString(item);
myTempPatternsTable.removeAssociation(oldMatcher, type);
if (oldLanguage != null) {
myTempTemplateDataLanguages.removeAssociation(oldMatcher, oldLanguage);
}
}
myTempPatternsTable.addAssociation(matcher, type);
myTempTemplateDataLanguages.addAssociation(matcher, dialog.getTemplateDataLanguage());
updateExtensionList();
final int index = myPatterns.getListModel().indexOf(matcher.getPresentableString());
if (index >= 0) {
ScrollingUtil.selectItem(myPatterns.myPatternsList, index);
}
myPatterns.myPatternsList.requestFocus();
}
}
示例4: editPattern
import com.intellij.openapi.ui.DialogBuilder; //导入方法依赖的package包/类
private void editPattern(@Nullable final String item) {
final FileType type = myRecognizedFileType.getSelectedFileType();
if (type == null) return;
final String title =
item == null
? FileTypesBundle.message("filetype.edit.add.pattern.title")
: FileTypesBundle.message("filetype.edit.edit.pattern.title");
final Language oldLanguage = item == null ? null : myTempTemplateDataLanguages.findAssociatedFileType(item);
final FileTypePatternDialog dialog = new FileTypePatternDialog(item, type, oldLanguage);
final DialogBuilder builder = new DialogBuilder(myPatterns);
builder.setPreferredFocusComponent(dialog.getPatternField());
builder.setCenterPanel(dialog.getMainPanel());
builder.setTitle(title);
builder.showModal(true);
if (builder.getDialogWrapper().isOK()) {
final String pattern = dialog.getPatternField().getText();
if (StringUtil.isEmpty(pattern)) return;
final FileNameMatcher matcher = FileTypeManager.parseFromString(pattern);
FileType registeredFileType = findExistingFileType(matcher);
if (registeredFileType != null && registeredFileType != type) {
if (registeredFileType.isReadOnly()) {
Messages.showMessageDialog(myPatterns.myPatternsList,
FileTypesBundle.message("filetype.edit.add.pattern.exists.error", registeredFileType.getDescription()),
title, Messages.getErrorIcon());
return;
}
else {
if (Messages.OK == Messages.showOkCancelDialog(myPatterns.myPatternsList, FileTypesBundle.message("filetype.edit.add.pattern.exists.message",
registeredFileType.getDescription()),
FileTypesBundle.message("filetype.edit.add.pattern.exists.title"),
FileTypesBundle.message("filetype.edit.add.pattern.reassign.button"),
CommonBundle.getCancelButtonText(), Messages.getQuestionIcon())) {
myTempPatternsTable.removeAssociation(matcher, registeredFileType);
myTempTemplateDataLanguages.removeAssociation(matcher, oldLanguage);
myReassigned.put(matcher, registeredFileType);
}
else {
return;
}
}
}
if (item != null) {
final FileNameMatcher oldMatcher = FileTypeManager.parseFromString(item);
myTempPatternsTable.removeAssociation(oldMatcher, type);
myTempTemplateDataLanguages.removeAssociation(oldMatcher, oldLanguage);
}
myTempPatternsTable.addAssociation(matcher, type);
myTempTemplateDataLanguages.addAssociation(matcher, dialog.getTemplateDataLanguage());
updateExtensionList();
final int index = myPatterns.getListModel().indexOf(matcher.getPresentableString());
if (index >= 0) {
ListScrollingUtil.selectItem(myPatterns.myPatternsList, index);
}
myPatterns.myPatternsList.requestFocus();
}
}
示例5: editPattern
import com.intellij.openapi.ui.DialogBuilder; //导入方法依赖的package包/类
private void editPattern(@Nullable final String item) {
final FileType type = myRecognizedFileType.getSelectedFileType();
if (type == null) return;
final String title = item == null
? FileTypesBundle.message("filetype.edit.add.pattern.title")
: FileTypesBundle.message("filetype.edit.edit.pattern.title");
final Language oldLanguage = item == null ? null : myTempTemplateDataLanguages.findAssociatedFileType(item);
final FileTypePatternDialog dialog = new FileTypePatternDialog(item, type, oldLanguage);
final DialogBuilder builder = new DialogBuilder(myPatterns);
builder.setPreferredFocusComponent(dialog.getPatternField());
builder.setCenterPanel(dialog.getMainPanel());
builder.setTitle(title);
builder.showModal(true);
if (builder.getDialogWrapper().isOK()) {
final String pattern = dialog.getPatternField().getText();
if (StringUtil.isEmpty(pattern)) return;
final FileNameMatcher matcher = FileTypeManager.parseFromString(pattern);
FileType registeredFileType = findExistingFileType(matcher);
if (registeredFileType != null && registeredFileType != type) {
if (registeredFileType.isReadOnly()) {
Messages.showMessageDialog(myPatterns.myPatternsList, FileTypesBundle
.message("filetype.edit.add.pattern.exists.error", registeredFileType.getDescription()), title,
Messages.getErrorIcon());
return;
}
else {
if (Messages.OK ==
Messages.showOkCancelDialog(myPatterns.myPatternsList, FileTypesBundle
.message("filetype.edit.add.pattern.exists.message", registeredFileType.getDescription()),
FileTypesBundle.message("filetype.edit.add.pattern.exists.title"),
FileTypesBundle.message("filetype.edit.add.pattern.reassign.button"),
CommonBundle.getCancelButtonText(), Messages.getQuestionIcon())) {
myTempPatternsTable.removeAssociation(matcher, registeredFileType);
myTempTemplateDataLanguages.removeAssociation(matcher, oldLanguage);
myReassigned.put(matcher, registeredFileType);
}
else {
return;
}
}
}
if (item != null) {
final FileNameMatcher oldMatcher = FileTypeManager.parseFromString(item);
myTempPatternsTable.removeAssociation(oldMatcher, type);
myTempTemplateDataLanguages.removeAssociation(oldMatcher, oldLanguage);
}
myTempPatternsTable.addAssociation(matcher, type);
myTempTemplateDataLanguages.addAssociation(matcher, dialog.getTemplateDataLanguage());
updateExtensionList();
final int index = myPatterns.getListModel().indexOf(matcher.getPresentableString());
if (index >= 0) {
ScrollingUtil.selectItem(myPatterns.myPatternsList, index);
}
IdeFocusManager.getGlobalInstance().doForceFocusWhenFocusSettlesDown(myPatterns.myPatternsList);
}
}