public boolean validate() { if (myRbImportModule.isSelected()) { final String path = myModulePathFieldPanel.getText().trim(); if (path.length() == 0) { Messages.showErrorDialog( IdeBundle.message( "error.please.specify.path.to.module.file", ApplicationNamesInfo.getInstance().getProductName()), IdeBundle.message("title.module.file.path.not.specified")); myModulePathFieldPanel.getTextField().requestFocus(); return false; } final File file = new File(path); if (!file.exists()) { Messages.showErrorDialog( IdeBundle.message("error.module.file.does.not.exist"), IdeBundle.message("title.module.file.does.not.exist")); myModulePathFieldPanel.getTextField().requestFocus(); return false; } if (!StdFileTypes.IDEA_MODULE.equals( FileTypeManager.getInstance().getFileTypeByFileName(file.getName()))) { Messages.showErrorDialog( IdeBundle.message( "error.module.not.iml", path, ApplicationNamesInfo.getInstance().getProductName()), IdeBundle.message("title.incorrect.file.type")); myModulePathFieldPanel.getTextField().requestFocus(); return false; } } return true; }
public String getModuleFilePath() { return myModulePathFieldPanel.getText().trim().replace(File.separatorChar, '/'); }