Java 类com.intellij.openapi.ui.ex.MessagesEx 实例源码

项目:intellij-ce-playground    文件:ClassBrowser.java   
@Nullable
protected String showDialog() {
  final ClassFilter.ClassFilterWithScope classFilter;
  try {
    classFilter = getFilter();
  }
  catch (NoFilterException e) {
    final MessagesEx.MessageInfo info = e.getMessageInfo();
    info.showNow();
    return null;
  }
  final TreeClassChooser dialog = createClassChooser(classFilter);
  configureDialog(dialog);
  dialog.showDialog();
  final PsiClass psiClass = dialog.getSelected();
  if (psiClass == null) return null;
  onClassChoosen(psiClass);
  return psiClass.getQualifiedName();
}
项目:intellij-ce-playground    文件:FrameDiffTool.java   
private static boolean askForceOpenDiff(DiffRequest data) {
  byte[] bytes1;
  byte[] bytes2;
  try {
    bytes1 = data.getContents()[0].getBytes();
    bytes2 = data.getContents()[1].getBytes();
  }
  catch (IOException e) {
    MessagesEx.error(data.getProject(), e.getMessage()).showNow();
    return false;
  }
  String message = Arrays.equals(bytes1, bytes2)
                   ? DiffBundle.message("diff.contents.are.identical.message.text")
                   : DiffBundle.message("diff.contents.have.differences.only.in.line.separators.message.text");
  return Messages.showYesNoDialog(data.getProject(), message + "\n" + DiffBundle.message("show.diff.anyway.dialog.message"),
                                  DiffBundle.message("no.differences.dialog.title"), Messages.getQuestionIcon()) == Messages.YES;
}
项目:intellij-ce-playground    文件:TestClassBrowser.java   
@Override
protected String showDialog() {
  ClassFilter.ClassFilterWithScope filter;
  try {
    filter = getFilter();
  }
  catch (MessageInfoException e) {
    MessagesEx.MessageInfo message = e.getMessageInfo();
    message.showNow();
    return null;
  }
  TreeClassChooser chooser = TreeClassChooserFactory.getInstance(getProject()).createWithInnerClassesScopeChooser("Choose Test Class", filter.getScope(), filter, null);
  init(chooser);
  chooser.showDialog();
  PsiClass psiclass = chooser.getSelected();
  if (psiclass == null) {
    return null;
  } else {
    onClassChoosen(psiclass);
    return psiclass.getQualifiedName();
  }
}
项目:intellij-ce-playground    文件:InputRequestHandler.java   
private static String askUser(SegmentReader reader, Project project) {
  String prompt = reader.readLimitedString();
  String defaultValue = reader.readLimitedString();
  String[] choices = reader.readStringArray();
  MessagesEx.BaseInputInfo question;
  if (choices.length == 0) {
    MessagesEx.InputInfo inputInfo = new MessagesEx.InputInfo(project);
    inputInfo.setDefaultValue(defaultValue);
    question = inputInfo;
  }
  else {
    MessagesEx.ChoiceInfo choiceInfo = new MessagesEx.ChoiceInfo(project);
    choiceInfo.setChoices(choices, defaultValue);
    question = choiceInfo;
  }
  question.setIcon(Messages.getQuestionIcon());
  question.setTitle(AntBundle.message("user.inout.request.ant.build.input.dialog.title"));
  question.setMessage(prompt);
  question.setIcon(Messages.getQuestionIcon());
  return question.forceUserInput();
}
项目:tools-idea    文件:ClassBrowser.java   
@Nullable
protected String showDialog() {
  final ClassFilter.ClassFilterWithScope classFilter;
  try {
    classFilter = getFilter();
  }
  catch (NoFilterException e) {
    final MessagesEx.MessageInfo info = e.getMessageInfo();
    info.showNow();
    return null;
  }
  final TreeClassChooser dialog = createClassChooser(classFilter);
  configureDialog(dialog);
  dialog.showDialog();
  final PsiClass psiClass = dialog.getSelected();
  if (psiClass == null) return null;
  onClassChoosen(psiClass);
  return JavaExecutionUtil.getRuntimeQualifiedName(psiClass);
}
项目:tools-idea    文件:FrameDiffTool.java   
private static boolean askForceOpenDiff(DiffRequest data) {
  byte[] bytes1;
  byte[] bytes2;
  try {
    bytes1 = data.getContents()[0].getBytes();
    bytes2 = data.getContents()[1].getBytes();
  }
  catch (IOException e) {
    MessagesEx.error(data.getProject(), e.getMessage()).showNow();
    return false;
  }
  String message = Arrays.equals(bytes1, bytes2)
                   ? DiffBundle.message("diff.contents.are.identical.message.text")
                   : DiffBundle.message("diff.contents.have.differences.only.in.line.separators.message.text");
  Messages.showInfoMessage(data.getProject(), message, DiffBundle.message("no.differences.dialog.title"));
  return false;
  //return Messages.showDialog(data.getProject(), message + "\nShow diff anyway?", "No Differences", new String[]{"Yes", "No"}, 1,
  //                    Messages.getQuestionIcon()) == 0;
}
项目:tools-idea    文件:TestClassBrowser.java   
@Override
protected String showDialog() {
  ClassFilter.ClassFilterWithScope filter;
  try {
    filter = getFilter();
  }
  catch (MessageInfoException e) {
    MessagesEx.MessageInfo message = e.getMessageInfo();
    message.showNow();
    return null;
  }
  TreeClassChooser chooser = TreeClassChooserFactory.getInstance(getProject()).createWithInnerClassesScopeChooser("Choose Test Class", filter.getScope(), filter, null);
  init(chooser);
  chooser.showDialog();
  PsiClass psiclass = chooser.getSelected();
  if (psiclass == null) {
    return null;
  } else {
    onClassChoosen(psiclass);
    return JavaExecutionUtil.getRuntimeQualifiedName(psiclass);
  }
}
项目:tools-idea    文件:InputRequestHandler.java   
private static String askUser(SegmentReader reader, Project project) {
  String prompt = reader.readLimitedString();
  String defaultValue = reader.readLimitedString();
  String[] choices = reader.readStringArray();
  MessagesEx.BaseInputInfo question;
  if (choices.length == 0) {
    MessagesEx.InputInfo inputInfo = new MessagesEx.InputInfo(project);
    inputInfo.setDefaultValue(defaultValue);
    question = inputInfo;
  }
  else {
    MessagesEx.ChoiceInfo choiceInfo = new MessagesEx.ChoiceInfo(project);
    choiceInfo.setChoices(choices, defaultValue);
    question = choiceInfo;
  }
  question.setIcon(Messages.getQuestionIcon());
  question.setTitle(AntBundle.message("user.inout.request.ant.build.input.dialog.title"));
  question.setMessage(prompt);
  question.setIcon(Messages.getQuestionIcon());
  return question.forceUserInput();
}
项目:consulo-apache-ant    文件:InputRequestHandler.java   
private static String askUser(SegmentReader reader, Project project) {
  String prompt = reader.readLimitedString();
  String defaultValue = reader.readLimitedString();
  String[] choices = reader.readStringArray();
  MessagesEx.BaseInputInfo question;
  if (choices.length == 0) {
    MessagesEx.InputInfo inputInfo = new MessagesEx.InputInfo(project);
    inputInfo.setDefaultValue(defaultValue);
    question = inputInfo;
  }
  else {
    MessagesEx.ChoiceInfo choiceInfo = new MessagesEx.ChoiceInfo(project);
    choiceInfo.setChoices(choices, defaultValue);
    question = choiceInfo;
  }
  question.setIcon(Messages.getQuestionIcon());
  question.setTitle(AntBundle.message("user.inout.request.ant.build.input.dialog.title"));
  question.setMessage(prompt);
  question.setIcon(Messages.getQuestionIcon());
  return question.forceUserInput();
}
项目:consulo    文件:FrameDiffTool.java   
private static boolean askForceOpenDiff(DiffRequest data) {
  byte[] bytes1;
  byte[] bytes2;
  try {
    bytes1 = data.getContents()[0].getBytes();
    bytes2 = data.getContents()[1].getBytes();
  }
  catch (IOException e) {
    MessagesEx.error(data.getProject(), e.getMessage()).showNow();
    return false;
  }
  String message = Arrays.equals(bytes1, bytes2)
                   ? DiffBundle.message("diff.contents.are.identical.message.text")
                   : DiffBundle.message("diff.contents.have.differences.only.in.line.separators.message.text");
  Messages.showInfoMessage(data.getProject(), message, DiffBundle.message("no.differences.dialog.title"));
  return false;
  //return Messages.showDialog(data.getProject(), message + "\nShow diff anyway?", "No Differences", new String[]{"Yes", "No"}, 1,
  //                    Messages.getQuestionIcon()) == 0;
}
项目:consulo-java    文件:ClassBrowser.java   
@Nullable
protected String showDialog() {
  final ClassFilter.ClassFilterWithScope classFilter;
  try {
    classFilter = getFilter();
  }
  catch (NoFilterException e) {
    final MessagesEx.MessageInfo info = e.getMessageInfo();
    info.showNow();
    return null;
  }
  final TreeClassChooser dialog = createClassChooser(classFilter);
  configureDialog(dialog);
  dialog.showDialog();
  final PsiClass psiClass = dialog.getSelected();
  if (psiClass == null) return null;
  onClassChoosen(psiClass);
  return JavaExecutionUtil.getRuntimeQualifiedName(psiClass);
}
项目:intellij-ce-playground    文件:ClassBrowser.java   
public static NoFilterException moduleDoesntExist(final ConfigurationModuleSelector moduleSelector) {
  final Project project = moduleSelector.getProject();
  final String moduleName = moduleSelector.getModuleName();
  return new NoFilterException(new MessagesEx.MessageInfo(
    project,
    moduleName.isEmpty() ? "No module selected" : ExecutionBundle.message("module.does.not.exists", moduleName, project.getName()),
    ExecutionBundle.message("cannot.browse.test.inheritors.dialog.title")));
}
项目:intellij-ce-playground    文件:RenameFileFix.java   
@Override
public void invoke(@NotNull Project project, Editor editor, PsiFile file) {
  VirtualFile vFile = file.getVirtualFile();
  Document document = PsiDocumentManager.getInstance(project).getDocument(file);
  FileDocumentManager.getInstance().saveDocument(document);
  try {
    vFile.rename(file.getManager(), myNewFileName);
  }
  catch (IOException e) {
    MessagesEx.error(project, e.getMessage()).showLater();
  }
}
项目:intellij-ce-playground    文件:AbstractLayoutCodeProcessor.java   
private boolean checkFileWritable(final PsiFile file){
  if (!file.isWritable()){
    MessagesEx.fileIsReadOnly(myProject, file.getVirtualFile())
        .setTitle(CodeInsightBundle.message("error.dialog.readonly.file.title"))
        .showLater();
    return false;
  }
  else{
    return true;
  }
}
项目:intellij-ce-playground    文件:JUnitConfigurable.java   
@Override
protected ClassFilter.ClassFilterWithScope getFilter() throws NoFilterException {
  try {
    return TestClassFilter.create(SourceScope.wholeProject(getProject()), null);
  }
  catch (JUnitUtil.NoJUnitException ignore) {
    throw new NoFilterException(new MessagesEx.MessageInfo(getProject(),
                                                           ignore.getMessage(),
                                                           ExecutionBundle.message("cannot.browse.test.inheritors.dialog.title")));
  }
}
项目:intellij-ce-playground    文件:OutputParser2.java   
public void processPacket(String packet) {
  SegmentReader reader = new SegmentReader(packet);
  int index = reader.readInt();
  if (myLastPacketIndex + 1 < index) {
    LOG.error("last: " + myLastPacketIndex + " current: " + index);
  }
  if (myLastPacketIndex + 1 > index) return;
  myLastPacketIndex++;
  char id = reader.readChar();
  if (id == IdeaAntLogger2.INPUT_REQUEST) {
    try {
      InputRequestHandler.processInput(getProject(), reader, getProcessHandler());
    }
    catch (IOException e) {
      MessagesEx.error(getProject(), e.getMessage()).showLater();
    }
  }
  else {
    int priority = reader.readInt();
    char contentType = reader.readChar();
    String message = reader.readLimitedString();
    switch (id) {
      case IdeaAntLogger2.BUILD_END:
        if (contentType == IdeaAntLogger2.EXCEPTION_CONTENT) {
          processTag(IdeaAntLogger2.EXCEPTION, message, priority);
        }
        break;
      default:
        processTag(id, message, priority);
    }
  }
}
项目:intellij-haskforce    文件:HaskellModuleFilenameFix.java   
/**
 * Called when user invokes intention.
 */
@Override
public void invoke(@NotNull Project project, Editor editor, PsiFile file) throws IncorrectOperationException {
    VirtualFile vFile = file.getVirtualFile();
    Document document = PsiDocumentManager.getInstance(project).getDocument(file);
    if (document == null) return;

    FileDocumentManager.getInstance().saveDocument(document);
    try {
        vFile.rename(file.getManager(), myTargetName);
    } catch (IOException e) {
        MessagesEx.error(project, e.getMessage()).showLater();
    }
}
项目:tools-idea    文件:ClassBrowser.java   
public static NoFilterException moduleDoesntExist(final ConfigurationModuleSelector moduleSelector) {
  final Project project = moduleSelector.getProject();
  final String moduleName = moduleSelector.getModuleName();
  return new NoFilterException(new MessagesEx.MessageInfo(
    project,
    moduleName.isEmpty() ? "No module selected" : ExecutionBundle.message("module.does.not.exists", moduleName, project.getName()),
    ExecutionBundle.message("cannot.browse.test.inheritors.dialog.title")));
}
项目:tools-idea    文件:RenameFileFix.java   
@Override
public void invoke(@NotNull Project project, Editor editor, PsiFile file) {
  VirtualFile vFile = file.getVirtualFile();
  Document document = PsiDocumentManager.getInstance(project).getDocument(file);
  FileDocumentManager.getInstance().saveDocument(document);
  try {
    vFile.rename(file.getManager(), myNewFileName);
  }
  catch(IOException e){
    MessagesEx.error(project, e.getMessage()).showLater();
  }
  if (editor != null) {
    DaemonCodeAnalyzer.getInstance(project).updateVisibleHighlighters(editor);
  }
}
项目:tools-idea    文件:AbstractLayoutCodeProcessor.java   
private boolean checkFileWritable(final PsiFile file){
  if (!file.isWritable()){
    MessagesEx.fileIsReadOnly(myProject, file.getVirtualFile())
        .setTitle(CodeInsightBundle.message("error.dialog.readonly.file.title"))
        .showLater();
    return false;
  }
  else{
    return true;
  }
}
项目:tools-idea    文件:TestClassBrowser.java   
public ClassFilter.ClassFilterWithScope getFilter() throws MessageInfoException {
  TestNGConfiguration config = new TestNGConfiguration("<no-name>", getProject(), TestNGConfigurationType.getInstance().getConfigurationFactories()[0]);
  editor.applyEditorTo(config);
  GlobalSearchScope scope = getSearchScope(config.getModules());
  if (scope == null) {
    throw new MessageInfoException(new MessagesEx.MessageInfo(getProject(), "No classes found in project", "Can't Browse Tests"));
  }
  return new TestClassFilter(scope, getProject(), false);
}
项目:tools-idea    文件:JUnitConfigurable.java   
@Override
protected ClassFilter.ClassFilterWithScope getFilter() throws NoFilterException {
  try {
    return TestClassFilter.create(SourceScope.wholeProject(getProject()), null);
  }
  catch (JUnitUtil.NoJUnitException ignore) {
    throw new NoFilterException(new MessagesEx.MessageInfo(getProject(),
                                                           ignore.getMessage(),
                                                           ExecutionBundle.message("cannot.browse.test.inheritors.dialog.title")));
  }
}
项目:tools-idea    文件:OutputParser2.java   
public void processPacket(String packet) {
  SegmentReader reader = new SegmentReader(packet);
  int index = reader.readInt();
  if (myLastPacketIndex + 1 < index) {
    LOG.error("last: " + myLastPacketIndex + " current: " + index);
  }
  if (myLastPacketIndex + 1 > index) return;
  myLastPacketIndex++;
  char id = reader.readChar();
  if (id == IdeaAntLogger2.INPUT_REQUEST) {
    try {
      InputRequestHandler.processInput(getProject(), reader, getProcessHandler());
    }
    catch (IOException e) {
      MessagesEx.error(getProject(), e.getMessage()).showLater();
    }
  }
  else {
    int priority = reader.readInt();
    char contentType = reader.readChar();
    String message = reader.readLimitedString();
    switch (id) {
      case IdeaAntLogger2.BUILD_END:
        if (contentType == IdeaAntLogger2.EXCEPTION_CONTENT) {
          processTag(IdeaAntLogger2.EXCEPTION, message, priority);
        }
        break;
      default:
        processTag(id, message, priority);
    }
  }
}
项目:consulo-apache-ant    文件:OutputParser2.java   
public void processPacket(String packet) {
  SegmentReader reader = new SegmentReader(packet);
  int index = reader.readInt();
  if (myLastPacketIndex + 1 < index) {
    LOG.error("last: " + myLastPacketIndex + " current: " + index);
  }
  if (myLastPacketIndex + 1 > index) return;
  myLastPacketIndex++;
  char id = reader.readChar();
  if (id == AntLoggerConstants.INPUT_REQUEST) {
    try {
      InputRequestHandler.processInput(getProject(), reader, getProcessHandler());
    }
    catch (IOException e) {
      MessagesEx.error(getProject(), e.getMessage()).showLater();
    }
  }
  else {
    int priority = reader.readInt();
    char contentType = reader.readChar();
    String message = reader.readLimitedString();
    switch (id) {
      case AntLoggerConstants.BUILD_END:
        if (contentType == AntLoggerConstants.EXCEPTION_CONTENT) {
          processTag(AntLoggerConstants.EXCEPTION, message, priority);
        }
        break;
      default:
        processTag(id, message, priority);
    }
  }
}
项目:consulo    文件:RenameFileFix.java   
@Override
public void invoke(@Nonnull Project project, Editor editor, PsiFile file) {
  VirtualFile vFile = file.getVirtualFile();
  Document document = PsiDocumentManager.getInstance(project).getDocument(file);
  FileDocumentManager.getInstance().saveDocument(document);
  try {
    vFile.rename(file.getManager(), myNewFileName);
  }
  catch(IOException e){
    MessagesEx.error(project, e.getMessage()).showLater();
  }
  if (editor != null) {
    DaemonCodeAnalyzer.getInstance(project).updateVisibleHighlighters(editor);
  }
}
项目:consulo    文件:AbstractLayoutCodeProcessor.java   
private boolean checkFileWritable(final PsiFile file){
  if (!file.isWritable()){
    MessagesEx.fileIsReadOnly(myProject, file.getVirtualFile())
            .setTitle(CodeInsightBundle.message("error.dialog.readonly.file.title"))
            .showLater();
    return false;
  }
  else{
    return true;
  }
}
项目:consulo-java    文件:ClassBrowser.java   
public static NoFilterException moduleDoesntExist(final ConfigurationModuleSelector moduleSelector) {
  final Project project = moduleSelector.getProject();
  final String moduleName = moduleSelector.getModuleName();
  return new NoFilterException(new MessagesEx.MessageInfo(
    project,
    moduleName.isEmpty() ? "No module selected" : ExecutionBundle.message("module.does.not.exists", moduleName, project.getName()),
    ExecutionBundle.message("cannot.browse.test.inheritors.dialog.title")));
}
项目:intellij-ce-playground    文件:ClassBrowser.java   
public NoFilterException(final MessagesEx.MessageInfo messageInfo) {
  super(messageInfo.getMessage());
  myMessageInfo = messageInfo;
}
项目:intellij-ce-playground    文件:ClassBrowser.java   
public MessagesEx.MessageInfo getMessageInfo() {
  return myMessageInfo;
}
项目:intellij-ce-playground    文件:ClassBrowser.java   
public static NoFilterException noJUnitInModule(final Module module) {
  return new NoFilterException(new MessagesEx.MessageInfo(
    module.getProject(),
    ExecutionBundle.message("junit.not.found.in.module.error.message", module.getName()),
    ExecutionBundle.message("cannot.browse.test.inheritors.dialog.title")));
}
项目:intellij-ce-playground    文件:MessageInfoException.java   
public MessageInfoException(MessagesEx.MessageInfo info) {
    this.info = info;
}
项目:intellij-ce-playground    文件:MessageInfoException.java   
public MessagesEx.MessageInfo getMessageInfo() {
    return info;
}
项目:tools-idea    文件:ClassBrowser.java   
public NoFilterException(final MessagesEx.MessageInfo messageInfo) {
  super(messageInfo.getMessage());
  myMessageInfo = messageInfo;
}
项目:tools-idea    文件:ClassBrowser.java   
public MessagesEx.MessageInfo getMessageInfo() {
  return myMessageInfo;
}
项目:tools-idea    文件:ClassBrowser.java   
public static NoFilterException noJUnitInModule(final Module module) {
  return new NoFilterException(new MessagesEx.MessageInfo(
    module.getProject(),
    ExecutionBundle.message("junit.not.found.in.module.error.message", module.getName()),
    ExecutionBundle.message("cannot.browse.test.inheritors.dialog.title")));
}
项目:tools-idea    文件:MessageInfoException.java   
public MessageInfoException(MessagesEx.MessageInfo info) {
    this.info = info;
}
项目:tools-idea    文件:MessageInfoException.java   
public MessagesEx.MessageInfo getMessageInfo() {
    return info;
}
项目:consulo-java    文件:ClassBrowser.java   
public NoFilterException(final MessagesEx.MessageInfo messageInfo) {
  super(messageInfo.getMessage());
  myMessageInfo = messageInfo;
}
项目:consulo-java    文件:ClassBrowser.java   
public MessagesEx.MessageInfo getMessageInfo() {
  return myMessageInfo;
}
项目:consulo-java    文件:ClassBrowser.java   
public static NoFilterException noJUnitInModule(final Module module) {
  return new NoFilterException(new MessagesEx.MessageInfo(
    module.getProject(),
    ExecutionBundle.message("junit.not.found.in.module.error.message", module.getName()),
    ExecutionBundle.message("cannot.browse.test.inheritors.dialog.title")));
}