本文整理匯總了Java中com.intellij.openapi.ui.DialogWrapper類的典型用法代碼示例。如果您正苦於以下問題:Java DialogWrapper類的具體用法?Java DialogWrapper怎麽用?Java DialogWrapper使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
DialogWrapper類屬於com.intellij.openapi.ui包,在下文中一共展示了DialogWrapper類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: actionPerformed
import com.intellij.openapi.ui.DialogWrapper; //導入依賴的package包/類
@Override
public void actionPerformed(AnActionEvent actionEvent) {
final CommitMessageI commitPanel = getCommitPanel(actionEvent);
if (commitPanel == null)
return;
CommitDialog dialog = new CommitDialog(actionEvent.getProject());
dialog.show();
if (dialog.getExitCode() == DialogWrapper.OK_EXIT_CODE) {
commitPanel.setCommitMessage(dialog.getCommitMessage());
}
}
示例2: Panel
import com.intellij.openapi.ui.DialogWrapper; //導入依賴的package包/類
Panel(Project project) {
String branch = CommitMessage.extractBranchName(project);
if (branch != null) {
// Branch name matches Ticket Name
setTextFieldsBasedOnBranch(branch);
}
changeTemplateButton.addActionListener(e -> {
DialogWrapper dialog = createTemplateDialog(project);
if (dialog.getExitCode() != DialogWrapper.OK_EXIT_CODE) {
dialog.getExitCode();
}
});
}
示例3: actionPerformed
import com.intellij.openapi.ui.DialogWrapper; //導入依賴的package包/類
@Override
public void actionPerformed(AnActionEvent e) {
EduCoursesPanel panel = new EduCoursesPanel();
DialogBuilder dialogBuilder = new DialogBuilder().title("Select Course").centerPanel(panel);
dialogBuilder.addOkAction().setText("Join");
panel.addCourseValidationListener(new EduCoursesPanel.CourseValidationListener() {
@Override
public void validationStatusChanged(boolean canStartCourse) {
dialogBuilder.setOkActionEnabled(canStartCourse);
}
});
dialogBuilder.setOkOperation(() -> {
dialogBuilder.getDialogWrapper().close(DialogWrapper.OK_EXIT_CODE);
Course course = panel.getSelectedCourse();
String location = panel.getLocationString();
EduCreateNewProjectDialog.createProject(EduPluginConfigurator.INSTANCE.forLanguage(course.getLanguageById()).getEduCourseProjectGenerator(), course, location);
});
dialogBuilder.show();
}
示例4: selectFontButtonActionPerformed
import com.intellij.openapi.ui.DialogWrapper; //導入依賴的package包/類
private void selectFontButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_selectFontButtonActionPerformed
final TextFontPanel textFontPanel = new TextFontPanel();
DefaultControlPanel textFontControlPanel = new DefaultControlPanel();
textFontPanel.setStoredFont(deltaHexFont);
textFontPanel.setVisible(true);
JPanel dialogPanel = WindowUtils.createDialogPanel(textFontPanel, textFontControlPanel);
WindowUtils.assignGlobalKeyListener(dialogPanel, textFontControlPanel.createOkCancelListener());
final DialogWrapper dialog = DialogUtils.createDialog(dialogPanel, "Select Font");
textFontControlPanel.setHandler(new DefaultControlHandler() {
@Override
public void controlActionPerformed(DefaultControlHandler.ControlActionType actionType) {
if (actionType == DefaultControlHandler.ControlActionType.OK) {
deltaHexFont = textFontPanel.getStoredFont();
updateFontTextField();
useDefaultFontCheckBox.setSelected(false);
}
dialog.close(0);
}
});
dialog.showAndGet();
}
示例5: actionPerformed
import com.intellij.openapi.ui.DialogWrapper; //導入依賴的package包/類
@Override
public void actionPerformed(AnActionEvent e) {
final ActionExecuteHelper helper = new ActionExecuteHelper();
checkState(e, helper);
if (! helper.isOk()) return;
final DataContext dc = e.getDataContext();
final Project project = CommonDataKeys.PROJECT.getData(dc);
final VirtualFile vf = CommonDataKeys.VIRTUAL_FILE.getData(dc);
//1 select target
final SelectCreateExternalTargetDialog dialog = new SelectCreateExternalTargetDialog(project, vf);
dialog.show();
if (DialogWrapper.OK_EXIT_CODE != dialog.getExitCode()) return;
final String url = dialog.getSelectedURL();
final boolean checkout = dialog.isCheckout();
final String target = dialog.getLocalTarget().trim();
ProgressManager.getInstance().run(new Task.Backgroundable(project, "Creating External", true, null) {
@Override
public void run(@NotNull ProgressIndicator indicator) {
doInBackground(project, vf, url, checkout, target);
}
});
}
示例6: showSettingsDialog
import com.intellij.openapi.ui.DialogWrapper; //導入依賴的package包/類
public static void showSettingsDialog(@Nullable Project project, final String id2Select, final String filter) {
ConfigurableGroup[] group = getConfigurableGroups(project, true);
group = filterEmptyGroups(group);
final Configurable configurable2Select = id2Select == null ? null : new ConfigurableVisitor.ByID(id2Select).find(group);
if (Registry.is("ide.new.settings.view")) {
new SettingsDialog(getProject(project), group, configurable2Select, filter).show();
return;
}
final DialogWrapper dialog = getDialog(project, group, configurable2Select);
new UiNotifyConnector.Once(dialog.getContentPane(), new Activatable.Adapter() {
@Override
public void showNotify() {
final OptionsEditor editor = (OptionsEditor)((DataProvider)dialog).getData(OptionsEditor.KEY.getName());
LOG.assertTrue(editor != null);
editor.select(configurable2Select, filter);
}
});
dialog.show();
}
示例7: getDialogWrapperFrom
import com.intellij.openapi.ui.DialogWrapper; //導入依賴的package包/類
@Nullable
protected static <T extends DialogWrapper> T getDialogWrapperFrom(@NotNull JDialog dialog, Class<T> dialogWrapperType) {
try {
WeakReference<DialogWrapper> dialogWrapperRef = field("myDialogWrapper").ofType(new TypeRef<WeakReference<DialogWrapper>>() {})
.in(dialog)
.get();
assertNotNull(dialogWrapperRef);
DialogWrapper wrapper = dialogWrapperRef.get();
if (dialogWrapperType.isInstance(wrapper)) {
return dialogWrapperType.cast(wrapper);
}
}
catch (ReflectionError ignored) {
}
return null;
}
示例8: showYesNoDialog
import com.intellij.openapi.ui.DialogWrapper; //導入依賴的package包/類
@Override
public int showYesNoDialog(@NotNull String title,
String message,
@NotNull String yesButton,
@NotNull String noButton,
@Nullable Window window,
@Nullable DialogWrapper.DoNotAskOption doNotAskDialogOption) {
if (window == null) {
window = getForemostWindow(null);
}
SheetMessage sheetMessage = new SheetMessage(window, title, message, UIUtil.getQuestionIcon(),
new String [] {yesButton, noButton}, doNotAskDialogOption, yesButton, noButton);
int result = sheetMessage.getResult().equals(yesButton) ? Messages.YES : Messages.NO;
if (doNotAskDialogOption != null && (result == Messages.YES || doNotAskDialogOption.shouldSaveOptionsOnCancel())) {
doNotAskDialogOption.setToBeShown(sheetMessage.toBeShown(), result);
}
return result;
}
示例9: checkSuperMethod
import com.intellij.openapi.ui.DialogWrapper; //導入依賴的package包/類
public static PsiMethod checkSuperMethod(@NotNull PsiMethod method, @NotNull String actionString) {
PsiClass aClass = method.getContainingClass();
if (aClass == null) return method;
PsiMethod superMethod = method.findDeepestSuperMethod();
if (superMethod == null) return method;
if (ApplicationManager.getApplication().isUnitTestMode()) return superMethod;
PsiClass containingClass = superMethod.getContainingClass();
SuperMethodWarningDialog dialog =
new SuperMethodWarningDialog(
method.getProject(),
DescriptiveNameUtil.getDescriptiveName(method), actionString, containingClass.isInterface() || superMethod.hasModifierProperty(PsiModifier.ABSTRACT),
containingClass.isInterface(), aClass.isInterface(), containingClass.getQualifiedName()
);
dialog.show();
if (dialog.getExitCode() == DialogWrapper.OK_EXIT_CODE) return superMethod;
if (dialog.getExitCode() == SuperMethodWarningDialog.NO_EXIT_CODE) return method;
return null;
}
示例10: perform
import com.intellij.openapi.ui.DialogWrapper; //導入依賴的package包/類
@Override
protected void perform(final XValueNodeImpl node, @NotNull final String nodeName, final AnActionEvent e) {
XValue value = node.getValueContainer();
final XDebuggerEvaluationDialog dialog = e.getData(XDebuggerEvaluationDialog.KEY);
XNavigatable navigatable = new XNavigatable() {
@Override
public void setSourcePosition(@Nullable final XSourcePosition sourcePosition) {
if (sourcePosition != null) {
final Project project = node.getTree().getProject();
AppUIUtil.invokeOnEdt(new Runnable() {
@Override
public void run() {
sourcePosition.createNavigatable(project).navigate(true);
if (dialog != null && Registry.is("debugger.close.dialog.on.navigate")) {
dialog.close(DialogWrapper.CANCEL_EXIT_CODE);
}
}
}, project.getDisposed());
}
}
};
startComputingSourcePosition(value, navigatable);
}
示例11: chooseLibraryAndDownload
import com.intellij.openapi.ui.DialogWrapper; //導入依賴的package包/類
@Nullable
public static NewLibraryConfiguration chooseLibraryAndDownload(final @NotNull Project project,
final @Nullable String initialFilter,
JComponent parentComponent) {
RepositoryAttachDialog dialog = new RepositoryAttachDialog(project, initialFilter);
dialog.setTitle("Download Library From Maven Repository");
dialog.show();
if (dialog.getExitCode() != DialogWrapper.OK_EXIT_CODE) {
return null;
}
String copyTo = dialog.getDirectoryPath();
String coord = dialog.getCoordinateText();
boolean attachJavaDoc = dialog.getAttachJavaDoc();
boolean attachSources = dialog.getAttachSources();
List<MavenRepositoryInfo> repositories = dialog.getRepositories();
NewLibraryConfiguration configuration = resolveAndDownload(project, coord, attachJavaDoc, attachSources, copyTo, repositories);
if (configuration == null) {
Messages.showErrorDialog(parentComponent, ProjectBundle.message("maven.downloading.failed", coord), CommonBundle.getErrorTitle());
}
return configuration;
}
示例12: test_rejected_push_to_tracked_branch_proposes_to_update
import com.intellij.openapi.ui.DialogWrapper; //導入依賴的package包/類
public void test_rejected_push_to_tracked_branch_proposes_to_update() throws IOException {
pushCommitFromBro();
final Ref<Boolean> dialogShown = Ref.create(false);
myDialogManager.registerDialogHandler(GitRejectedPushUpdateDialog.class, new TestDialogHandler<GitRejectedPushUpdateDialog>() {
@Override
public int handleDialog(GitRejectedPushUpdateDialog dialog) {
dialogShown.set(true);
return DialogWrapper.CANCEL_EXIT_CODE;
}
});
GitPushResult result = push("master", "origin/master");
assertTrue("Rejected push dialog wasn't shown", dialogShown.get());
assertResult(REJECTED, -1, "master", "origin/master", result);
}
示例13: showInjectionUI
import com.intellij.openapi.ui.DialogWrapper; //導入依賴的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;
}
示例14: test_dont_propose_to_update_if_force_push_is_rejected
import com.intellij.openapi.ui.DialogWrapper; //導入依賴的package包/類
public void test_dont_propose_to_update_if_force_push_is_rejected() throws IOException {
final Ref<Boolean> dialogShown = Ref.create(false);
myDialogManager.registerDialogHandler(GitRejectedPushUpdateDialog.class, new TestDialogHandler<GitRejectedPushUpdateDialog>() {
@Override
public int handleDialog(GitRejectedPushUpdateDialog dialog) {
dialogShown.set(true);
return DialogWrapper.CANCEL_EXIT_CODE;
}
});
Pair<String, GitPushResult> remoteTipAndPushResult = forcePushWithReject();
assertResult(REJECTED, -1, "master", "origin/master", remoteTipAndPushResult.second);
assertFalse("Rejected push dialog should not be shown", dialogShown.get());
cd(myParentRepo.getPath());
assertEquals("The commit pushed from bro should be the last one", remoteTipAndPushResult.first, last());
}
示例15: showYesNoCancelDialog
import com.intellij.openapi.ui.DialogWrapper; //導入依賴的package包/類
@Override
public int showYesNoCancelDialog(@NotNull String title,
String message,
@NotNull String defaultButton,
String alternateButton,
String otherButton,
@Nullable Window window,
@Nullable DialogWrapper.DoNotAskOption doNotAskOption) {
if (window == null) {
window = getForemostWindow(null);
}
SheetMessage sheetMessage = new SheetMessage(window, title, message, UIUtil.getQuestionIcon(),
new String [] {defaultButton, otherButton, alternateButton},
doNotAskOption, defaultButton, alternateButton);
String resultString = sheetMessage.getResult();
int result = resultString.equals(defaultButton) ? Messages.YES : resultString.equals(alternateButton) ? Messages.NO : Messages.CANCEL;
if (doNotAskOption != null) {
doNotAskOption.setToBeShown(sheetMessage.toBeShown(), result);
}
return result;
}