@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 Set<FileObject> extend(PhpModule phpModule) throws ExtendingException {
    // init project
    ZendScript zendScript = null;
    try {
      zendScript = ZendScript.getDefault();
    } catch (InvalidPhpExecutableException ex) {
      // should not happen, must be handled in the wizard
      Exceptions.printStackTrace(ex);
    }

    if (!zendScript.initProject(phpModule)) {
      // can happen if zend script was not chosen
      Logger.getLogger(ZendPhpModuleExtender.class.getName())
          .log(
              Level.INFO,
              "Framework Zend not found in newly created project {0}",
              phpModule.getDisplayName());
      throw new ExtendingException(
          NbBundle.getMessage(ZendPhpModuleExtender.class, "MSG_NotExtended"));
    }

    // prefetch commands
    ZendPhpFrameworkProvider.getInstance()
        .getFrameworkCommandSupport(phpModule)
        .refreshFrameworkCommandsLater(null);

    // return files
    Set<FileObject> files = new HashSet<FileObject>();
    FileObject appConfig =
        phpModule
            .getSourceDirectory()
            .getFileObject("application/configs/application.ini"); // NOI18N
    if (appConfig != null) {
      files.add(appConfig);
    }
    FileObject indexController =
        phpModule
            .getSourceDirectory()
            .getFileObject("application/controllers/IndexController.php"); // NOI18N
    if (indexController != null) {
      files.add(indexController);
    }
    FileObject bootstrap =
        phpModule.getSourceDirectory().getFileObject("application/Bootstrap.php"); // NOI18N
    if (bootstrap != null) {
      files.add(bootstrap);
    }

    return files;
  }
Ejemplo n.º 3
0
 public static String open(PhpModule phpModule) {
   String info =
       NbBundle.getMessage(
           BrowseFolderPanel.class, "LBL_SelectDocFolder", phpModule.getDisplayName());
   BrowseFolderPanel panel = new BrowseFolderPanel(info, phpModule);
   panel.dialogDescriptor =
       new DialogDescriptor(
           panel,
           NbBundle.getMessage(BrowseFolderPanel.class, "LBL_SelectDir"),
           true,
           DialogDescriptor.OK_CANCEL_OPTION,
           DialogDescriptor.OK_OPTION,
           null);
   panel.notificationLineSupport = panel.dialogDescriptor.createNotificationLineSupport();
   panel.notificationLineSupport.setInformationMessage(info);
   panel.dialogDescriptor.setValid(false);
   if (DialogDisplayer.getDefault().notify(panel.dialogDescriptor) == DialogDescriptor.OK_OPTION) {
     return panel.getDocFolder();
   }
   return null;
 }
Ejemplo n.º 4
0
 @NbBundle.Messages({
   "# {0} - project name",
   "BrowseFolderPanel.docFolder.select=Select a directory for documentation for {0}",
   "BrowseFolderPanel.dir.select=Select a directory"
 })
 public static String open(PhpModule phpModule) {
   String info = Bundle.BrowseFolderPanel_docFolder_select(phpModule.getDisplayName());
   BrowseFolderPanel panel = new BrowseFolderPanel(info, phpModule);
   panel.dialogDescriptor =
       new DialogDescriptor(
           panel,
           Bundle.BrowseFolderPanel_dir_select(),
           true,
           DialogDescriptor.OK_CANCEL_OPTION,
           DialogDescriptor.OK_OPTION,
           null);
   panel.notificationLineSupport = panel.dialogDescriptor.createNotificationLineSupport();
   panel.notificationLineSupport.setInformationMessage(info);
   panel.dialogDescriptor.setValid(false);
   if (DialogDisplayer.getDefault().notify(panel.dialogDescriptor) == DialogDescriptor.OK_OPTION) {
     return panel.getDocFolder();
   }
   return null;
 }