@Override public Set<FileObject> extend(PhpModule phpModule) throws ExtendingException { // init project SymfonyScript symfonyScript = null; try { symfonyScript = SymfonyScript.getDefault(); } catch (InvalidPhpExecutableException ex) { // should not happen, must be handled in the wizard Exceptions.printStackTrace(ex); } if (!symfonyScript.initProject(phpModule, getPanel().getProjectParams())) { // can happen if symfony script was not chosen Logger.getLogger(SymfonyPhpModuleExtender.class.getName()) .log( Level.INFO, "Framework Symfony not found in newly created project {0}", phpModule.getDisplayName()); throw new ExtendingException( NbBundle.getMessage(SymfonyPhpModuleExtender.class, "MSG_NotExtended")); } // generate apps for (Pair<String, String[]> app : getPanel().getApps()) { symfonyScript.initApp(phpModule, app.first, app.second); } // prefetch commands SymfonyPhpFrameworkProvider.getInstance() .getFrameworkCommandSupport(phpModule) .refreshFrameworkCommandsLater(null); // return files Set<FileObject> files = new HashSet<FileObject>(); FileObject databases = SymfonyPhpFrameworkProvider.locate(phpModule, "config/databases.yml", true); // NOI18N if (databases != null) { // likely --orm=none files.add(databases); } FileObject config = SymfonyPhpFrameworkProvider.locate( phpModule, "config/ProjectConfiguration.class.php", true); // NOI18N if (config != null) { // #176041 files.add(config); } if (files.isEmpty()) { // open at least index.php FileObject index = SymfonyPhpFrameworkProvider.locate(phpModule, "web/index.php", true); // NOI18N if (index != null) { files.add(index); } } return files; }
@Override public String getErrorMessage() { try { PhpInterpreter.getDefault(); } catch (InvalidPhpExecutableException ex) { return ex.getLocalizedMessage(); } try { SymfonyScript.getDefault(); } catch (InvalidPhpExecutableException ex) { return NbBundle.getMessage( SymfonyPhpModuleExtender.class, "MSG_CannotExtend", ex.getMessage()); } return getPanel().getErrorMessage(); }