当前位置: 首页>>代码示例>>Java>>正文


Java DialogBuilder.setOkOperation方法代码示例

本文整理汇总了Java中com.intellij.openapi.ui.DialogBuilder.setOkOperation方法的典型用法代码示例。如果您正苦于以下问题:Java DialogBuilder.setOkOperation方法的具体用法?Java DialogBuilder.setOkOperation怎么用?Java DialogBuilder.setOkOperation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.openapi.ui.DialogBuilder的用法示例。


在下文中一共展示了DialogBuilder.setOkOperation方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: actionPerformed

import com.intellij.openapi.ui.DialogBuilder; //导入方法依赖的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();
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:20,代码来源:EduBrowseCoursesAction.java

示例2: 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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:JavaLanguageInjectionSupport.java

示例3: showSettingsDialog

import com.intellij.openapi.ui.DialogBuilder; //导入方法依赖的package包/类
public void showSettingsDialog() {
    final OCamlToolWindowSettingsForm settingsForm = new OCamlToolWindowSettingsForm(myProject);
    settingsForm.setSelectedSdk(OCamlSettings.getInstance().getTopLevelSdk());
    settingsForm.setCmdParams(OCamlSettings.getInstance().getTopLevelCmdOptions());
    settingsForm.setWorkingDirectory(OCamlSettings.getInstance().getTopLevelCmdWorkingDir());

    final DialogBuilder dialogBuilder = new DialogBuilder(myProject);
    dialogBuilder.setCenterPanel(settingsForm.getRootPanel());
    dialogBuilder.addOkAction().setText("Ok");
    dialogBuilder.addCancelAction().setText("Cancel");
    dialogBuilder.setPreferedFocusComponent(settingsForm.getSdkComboBox());
    dialogBuilder.setTitle("OCaml Top Level Console Settings");
    dialogBuilder.setOkOperation(new Runnable() {
        public void run() {
            OCamlSettings.getInstance().setTopLevelSdk(settingsForm.getSelectedSdk());
            OCamlSettings.getInstance().setTopLevelCmdOptions(settingsForm.getCmdParams());
            OCamlSettings.getInstance().setTopLevelCmdWorkingDir(settingsForm.getWorkingDirectory());
            dialogBuilder.getWindow().setVisible(false);
            if (myAction != null) {
                myAction.run();
            }
        }
    });
    dialogBuilder.show();
}
 
开发者ID:traff,项目名称:intellij-ocaml,代码行数:26,代码来源:OCamlToolWindowSettingsAction.java

示例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();
}
 
开发者ID:irengrig,项目名称:fossil4idea,代码行数:23,代码来源:OpenAction.java

示例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();
}
 
开发者ID:irengrig,项目名称:fossil4idea,代码行数:23,代码来源:CloneAndOpenAction.java

示例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();
}
 
开发者ID:irengrig,项目名称:fossil4idea,代码行数:23,代码来源:CloneAction.java

示例7: 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());
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:37,代码来源:MergeRequestImpl.java

示例8: 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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:33,代码来源:AbstractLanguageInjectionSupport.java

示例9: 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());
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:34,代码来源:MergeRequestImpl.java

示例10: 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;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:33,代码来源:AbstractLanguageInjectionSupport.java


注:本文中的com.intellij.openapi.ui.DialogBuilder.setOkOperation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。