org.netbeans.spi.project.ui.templates.support.Templates.setTargetFolder()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(8.7k)|赞(0)|评价(0)|浏览(106)

本文整理了Java中org.netbeans.spi.project.ui.templates.support.Templates.setTargetFolder()方法的一些代码示例,展示了Templates.setTargetFolder()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Templates.setTargetFolder()方法的具体详情如下:
包路径:org.netbeans.spi.project.ui.templates.support.Templates
类名称:Templates
方法名:setTargetFolder

Templates.setTargetFolder介绍

暂无

代码示例

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-spring-beans

public void initialize(WizardDescriptor wizard) {
  this.wizard = wizard;
  if (Templates.getTargetFolder(wizard) == null) {
    Project project = Templates.getProject(wizard);
    SpringConfigFileLocationProvider provider = project != null ? project.getLookup().lookup(SpringConfigFileLocationProvider.class) : null;
    FileObject location = provider != null ? provider.getLocation() : null;
    if (location != null) {
      Templates.setTargetFolder(wizard, location);
    }
  }
}

代码示例来源:origin: AlexFalappa/nb-springboot

boolean valid(WizardDescriptor wizardDescriptor) {
  if (txBaseName.getText().isEmpty()) {
    // Base name not specified
    wizardDescriptor.putProperty(WizardDescriptor.PROP_ERROR_MESSAGE, "Base name cannot be empty!");
    return false;
  }
  File f = getCreatedFile();
  if (f.exists()) {
    // Existing file
    wizardDescriptor.putProperty(WizardDescriptor.PROP_ERROR_MESSAGE, "Application properties file exists!");
    return false;
  }
  wizardDescriptor.putProperty(WizardDescriptor.PROP_ERROR_MESSAGE, "");
  final FileObject targetFolder = FileUtil.toFileObject(f.getParentFile());
  Templates.setTargetFolder(wizardDescriptor, targetFolder);
  Templates.setTargetName(wizardDescriptor, f.getName());
  return true;
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-css-prep

private void ensureProperTargetFolder(Project project) {
  if (!project.getProjectDirectory().equals(Templates.getTargetFolder(wizard))) {
    // some folder set
    return;
  }
  FileObject webRoot = findWebRoot(project);
  if (webRoot == null) {
    // nothing we can do here
    return;
  }
  // prefer mappings if folder exists
  List<Pair<String, String>> mappings = type.getPreferences().getMappings(project);
  if (!mappings.isEmpty()) {
    File inputFolder = CssPreprocessorUtils.resolveInput(webRoot, mappings.get(0));
    if (inputFolder.isDirectory()) {
      FileObject fo = FileUtil.toFileObject(inputFolder);
      assert fo != null : "FileObject not found for existing directory: " + inputFolder;
      Templates.setTargetFolder(wizard, fo);
      return;
    }
  }
  // use web root
  Templates.setTargetFolder(wizard, webRoot);
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-php-project

private void setTargetFolder() {
  if (Templates.getTargetFolder(wizard) != null) {
    // already set
    return;
  }
  if (phpProject == null) {
    // not php project
    return;
  }
  FileObject srcDir = ProjectPropertiesSupport.getSourcesDirectory(phpProject);
  if (srcDir != null && srcDir.isValid()) {
    Templates.setTargetFolder(wizard, srcDir);
  }
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-visualweb-project-jsf

public void storeSettings(Object settings) { 
  if ( WizardDescriptor.PREVIOUS_OPTION.equals( ((WizardDescriptor)settings).getValue() ) ) {
    return;
  }
  if( isValid() ) {
    if ( bottomPanel != null ) {
      bottomPanel.storeSettings( settings );
    }
    
    FileObject template = Templates.getTemplate( wizard );
    
    String name = gui.getTargetName ();
    if (name.indexOf ('/') > 0) { // NOI18N
      name = name.substring (name.lastIndexOf ('/') + 1);
    }
    
    Templates.setTargetFolder( (WizardDescriptor)settings, getTargetFolderFromGUI () );
    Templates.setTargetName( (WizardDescriptor)settings, name );
  }
  ((WizardDescriptor)settings).putProperty ("NewFileWizard_Title", null); // NOI18N
}

代码示例来源:origin: org.netbeans.api/org-netbeans-modules-java-project-ui

@Override
public void storeSettings(WizardDescriptor wizard) { 
  Object value = wizard.getValue();
  if (WizardDescriptor.PREVIOUS_OPTION.equals(value) || WizardDescriptor.CANCEL_OPTION.equals(value) ||
      WizardDescriptor.CLOSED_OPTION.equals(value)) {
    return;
  }
  if( isValid() ) {
    if ( bottomPanel != null ) {
      bottomPanel.storeSettings( wizard );
    }
    Templates.setTargetFolder(wizard, getTargetFolderFromGUI(wizard));
    Templates.setTargetName(wizard, gui.getTargetName());
  }
  wizard.putProperty("NewFileWizard_Title", null); // NOI18N
  
  if (WizardDescriptor.FINISH_OPTION.equals(value)) {
    wizard.putProperty(FOLDER_TO_DELETE, null);
  }
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-groovy-grailsproject

@Override
public void storeSettings(WizardDescriptor wizard) {
  Object value = wizard.getValue();
  if (WizardDescriptor.PREVIOUS_OPTION.equals(value) || WizardDescriptor.CANCEL_OPTION.equals(value)
      || WizardDescriptor.CLOSED_OPTION.equals(value)) {
    return;
  }
  if (isValid()) {
    if (bottomPanel != null) {
      bottomPanel.storeSettings(wizard);
    }
    Templates.setTargetFolder(wizard, getTargetFolderFromGUI(wizard));
    Templates.setTargetName(wizard, gui.getTargetName());
  }
  wizard.putProperty("NewFileWizard_Title", null); // NOI18N
  if (WizardDescriptor.FINISH_OPTION.equals(value)) {
    wizard.putProperty(FOLDER_TO_DELETE, null);
  }
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-web-jsf

@Override
public void storeSettings(Object settings) {
  if (settings instanceof TemplateWizard) {
    TemplateWizard wiz = (TemplateWizard) settings;
    if (WizardDescriptor.PREVIOUS_OPTION.equals(wiz.getValue())) {
      return;
    }
    if (!wiz.getValue().equals(WizardDescriptor.CANCEL_OPTION) && isValid()) {
      FileObject template = Templates.getTemplate(wiz);
      String name = component.getTargetName();
      if (name.indexOf('/') > 0) { // NOI18N
        name = name.substring(name.lastIndexOf('/') + 1);
      }
      Templates.setTargetFolder(wiz, getTargetFolderFromGUI());
      Templates.setTargetName(wiz, name);
    }
    wiz.putProperty("NewFileWizard_Title", null); // NOI18N
    wiz.putProperty("selectedPrefix", component.getPrefix()); //NOI18N
  }
}

代码示例来源:origin: AlexFalappa/nb-springboot

Templates.setTargetFolder(wizard, foDir);

代码示例来源:origin: AlexFalappa/nb-springboot

@Override
public Set<?> instantiate() throws IOException {
  File fDir = panel.getComponent().getCreatedFile().getParentFile();
  // ensure target folder exists and set it into Templates
  fDir.mkdirs();
  FileObject foDir = FileUtil.toFileObject(fDir);
  Templates.setTargetFolder(wizard, foDir);
  // Create file from template
  FileObject foTemplate = Templates.getTemplate(wizard);
  DataObject doTemplate = DataObject.find(foTemplate);
  DataFolder df = DataFolder.findFolder(foDir);
  DataObject doCreated = doTemplate.createFromTemplate(df, Templates.getTargetName(wizard));
  FileObject foCreated = doCreated.getPrimaryFile();
  return Collections.singleton(foCreated);
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-web-clientproject

private void setTargetFolder() {
  if (Templates.getTargetFolder(descriptor) != null) {
    // already set
    return;
  }
  Project project = Templates.getProject(descriptor);
  if (project == null) {
    // no project => ignore
    return;
  }
  ClientSideProject clientSideProject = getClientSideProject(project);
  if (clientSideProject == null) {
    // no client side project
    return;
  }
  FileObject siteRoot = clientSideProject.getSiteRootFolder();
  if (siteRoot != null) {
    Templates.setTargetFolder(descriptor, siteRoot);
  }
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd

@Override
public void storeSettings(WizardDescriptor settings) {
  if (WizardDescriptor.PREVIOUS_OPTION.equals(settings.getValue())) {
    return;
  }
  if(!settings.getValue().equals(WizardDescriptor.CANCEL_OPTION) && isValid()) {
    if ( bottomPanel != null ) {
      bottomPanel.storeSettings( settings );
    }
    
    String name = gui.getTargetName ();
    if (name.indexOf ('/') > 0) { // NOI18N
      name = name.substring (name.lastIndexOf ('/') + 1);
    }
    
    FileObject fo = getTargetFolderFromGUI();
    try {
      Templates.setTargetFolder(settings, fo);
    } catch (IllegalArgumentException iae) {
      ErrorManager.getDefault().annotate(iae, ErrorManager.EXCEPTION, null, 
          NbBundle.getMessage(NewCndFileChooserPanel.class, "MSG_Cannot_Create_Folder", 
          gui.getTargetFolder()), null, null);
      throw iae;
    }
    Templates.setTargetName(settings, name);
    doStoreSettings(settings);
  }
  settings.putProperty("NewFileWizard_Title", null); // NOI18N
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-web-jsf

Templates.setTargetFolder(wizard, targetFolder);

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-ruby-project

bottomPanel.storeSettings( settings );
Templates.setTargetFolder(settings, getTargetFolderFromGUI(settings));
Templates.setTargetName(settings, gui.getTargetName());

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-visualweb-project-jsf

String relativePath = (jspDir == null) ? null : FileUtil.getRelativePath(docRoot, jspDir);
if ((relativePath == null) || (relativePath.indexOf("WEB-INF") != -1)) {
  Templates.setTargetFolder(wizard, docRoot);
  jspDir = docRoot;
} else if (relativePath.length() > 0) {
String relativePath = (beanDir == null) ? null : FileUtil.getRelativePath(javaDir, beanDir);
if (relativePath == null) {
  Templates.setTargetFolder(wizard, javaDir);
  beanDir = javaDir;

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-web-jsf

String relativePath = (targetFolder == null) ? null : FileUtil.getRelativePath(webInf, targetFolder);
if (relativePath == null) {
  Templates.setTargetFolder(wizard, webInf);

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-web-beans

Templates.setTargetFolder(wizard, targetFolder );

相关文章