@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;
  }
  @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;
  }
Exemplo n.º 3
0
 private void browseTargetFolderButtonActionPerformed(
     ActionEvent evt) { // GEN-FIRST:event_browseTargetFolderButtonActionPerformed
   File phpDocTarget =
       new FileChooserBuilder(
               PhpDocumentorProvider.class.getName()
                   + PhpDocumentorProvider.PHPDOC_LAST_FOLDER_SUFFIX
                   + phpModule.getName())
           .setTitle(info)
           .setDirectoriesOnly(true)
           .setFileHiding(true)
           .setDefaultWorkingDirectory(FileUtil.toFile(phpModule.getSourceDirectory()))
           .showOpenDialog();
   if (phpDocTarget != null) {
     phpDocTarget = FileUtil.normalizeFile(phpDocTarget);
     targetFolderTextField.setText(phpDocTarget.getAbsolutePath());
   }
 } // GEN-LAST:event_browseTargetFolderButtonActionPerformed
 public FuelPhpIgnoredFilesExtender(PhpModule pm) {
   assert pm != null;
   docs = new File(FileUtil.toFile(pm.getProjectDirectory()), "docs"); // NOI18N
   // add settings whether MVC direcotries is ignored
   if (FuelPhpPreferences.ignoreMVCNode(pm)) {
     controller = FileUtil.toFile(FuelUtils.getControllerDirectory(pm));
     model = FileUtil.toFile(FuelUtils.getModelDirectory(pm));
     views = FileUtil.toFile(FuelUtils.getViewsDirectory(pm));
     modules = FileUtil.toFile(FuelUtils.getModulesDirectory(pm));
   }
 }
Exemplo n.º 5
0
 private void browseTargetFolderButtonActionPerformed(
     ActionEvent evt) { // GEN-FIRST:event_browseTargetFolderButtonActionPerformed
   File target =
       new FileChooserBuilder(ApiGenProvider.lastDirFor(phpModule))
           .setTitle(info)
           .setDirectoriesOnly(true)
           .setFileHiding(true)
           .setDefaultWorkingDirectory(FileUtil.toFile(phpModule.getSourceDirectory()))
           .showOpenDialog();
   if (target != null) {
     target = FileUtil.normalizeFile(target);
     targetFolderTextField.setText(target.getAbsolutePath());
   }
 } // GEN-LAST:event_browseTargetFolderButtonActionPerformed
  @Override
  public CompletionTask createTask(int queryType, JTextComponent component) {
    if (queryType != CompletionProvider.COMPLETION_QUERY_TYPE) {
      return null;
    }

    Document doc = component.getDocument();
    FileObject fileObject = NbEditorUtilities.getFileObject(doc);
    if (fileObject == null) {
      return null;
    }

    PhpModule phpModule = PhpModule.forFileObject(fileObject);
    if (!YiiUtils.isYii(phpModule)) {
      return null;
    }
    return createTask(queryType, component, phpModule);
  }
Exemplo n.º 7
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;
 }
Exemplo n.º 8
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;
 }