Java Code Examples for org.openide.filesystems.FileUtil#getExtension()

The following examples show how to use org.openide.filesystems.FileUtil#getExtension() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LoadGeneratorCustomizer.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private boolean isScriptValid() {
    String fileName = scriptTextField.getText();
    File file = new File(fileName);

    if (file.exists() && file.isFile()) {
        LoadGenPlugin lg = Lookup.getDefault().lookup(LoadGenPlugin.class);

        if (lg == null) {
            return false;
        }

        String ext = FileUtil.getExtension(scriptTextField.getText());

        return lg.getSupportedExtensions().contains(ext);
    }

    return false;
}
 
Example 2
Source File: KeystorePanel.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void keystoreLocationButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_keystoreLocationButtonActionPerformed
    JFileChooser chooser = new JFileChooser();
    FileUtil.preventFileChooserSymlinkTraversal(chooser, null);
    chooser.setDialogTitle(NbBundle.getMessage(KeystorePanel.class, "LBL_KeystoreBrowse_Title")); //NOI18N
    chooser.setFileSelectionMode (JFileChooser.FILES_ONLY);
    chooser.setMultiSelectionEnabled(false);
    chooser.setFileFilter(new StoreFileFilter());
    File f = new File(keystoreLocationTextField.getText());
    if ((f != null) && (f.exists())) {
        if (f.isDirectory()) {
            chooser.setCurrentDirectory(f);
        } else {
            chooser.setCurrentDirectory(f.getParentFile());
        }
    }
    if (chooser.showOpenDialog(this)== JFileChooser.APPROVE_OPTION) {
        File file = chooser.getSelectedFile();
        if (file != null) {
            setKeystorePath(file.getPath());
            String extension = FileUtil.getExtension(file.getName());
            keystoreType = StoreFileFilter.JKS_EXT.equals(extension) ? JKS : PKCS12;
        }
    }
}
 
Example 3
Source File: TruststorePanel.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void storeLocationButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_storeLocationButtonActionPerformed
    JFileChooser chooser = new JFileChooser();
    FileUtil.preventFileChooserSymlinkTraversal(chooser, null);
    chooser.setDialogTitle(NbBundle.getMessage(TruststorePanel.class, "LBL_TruststoreBrowse_Title")); //NOI18N
    chooser.setFileSelectionMode (JFileChooser.FILES_ONLY);
    chooser.setMultiSelectionEnabled(false);
    chooser.setFileFilter(new StoreFileFilter());
    File f = new File(storeLocationTextField.getText());
    if ((f != null) && (f.exists())) {
        if (f.isDirectory()) {
            chooser.setCurrentDirectory(f);
        } else {
            chooser.setCurrentDirectory(f.getParentFile());
        }
    }
    if (chooser.showOpenDialog(this)== JFileChooser.APPROVE_OPTION) {
        File file = chooser.getSelectedFile();
        if (file != null) {
            setStoreLocation(file.getPath());
            String extension = FileUtil.getExtension(file.getName());
            storeType = StoreFileFilter.JKS_EXT.equals(extension) ? JKS : PKCS12;
        }
    }
}
 
Example 4
Source File: AddWebServiceDlg.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public boolean accept(File f) {
    if (f.isDirectory()) {
        return true;
    }
    
    String ext = FileUtil.getExtension(f.getName());
    for (int i = 0; i < Saas.SUPPORTED_EXTENSIONS.length; i++) {
        if (Saas.SUPPORTED_EXTENSIONS[i].equalsIgnoreCase(ext)) {
            return true;
        }
    }
     
    return false;
}
 
Example 5
Source File: DocSetupPanelVisual.java    From jeddict with Apache License 2.0 5 votes vote down vote up
@Override
public boolean accept(File f) {
    if (f.isDirectory()) {
        return true;
    }

    String ext = FileUtil.getExtension(f.getName());
    for (String SUPPORTED_EXTENSION : SUPPORTED_EXTENSIONS) {
        if (SUPPORTED_EXTENSION.equalsIgnoreCase(ext)) {
            return true;
        }
    }

    return false;
}
 
Example 6
Source File: WebServiceFromWSDLPanel.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public boolean accept(File f) {
    String ext = FileUtil.getExtension(f.getName());
    return f.isDirectory() || "wsdl".equalsIgnoreCase(ext) || "asmx".equalsIgnoreCase(ext); // NOI18N
}
 
Example 7
Source File: ClientInfo.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public boolean accept(File f) {
    String ext = FileUtil.getExtension(f.getName());
    return f.isDirectory() || "wsdl".equalsIgnoreCase(ext) || "asmx".equalsIgnoreCase(ext); // NOI18N
}