org.netbeans.modules.php.spi.phpmodule.ImportantFilesImplementation Java Examples

The following examples show how to use org.netbeans.modules.php.spi.phpmodule.ImportantFilesImplementation. 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: FrameworkConfigFilesNodeFactory.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void listenOnFrameworks() {
    List<PhpFrameworkProvider> frameworks = project.getFrameworks();
    List<ImportantFilesImplementation> newConfigFiles = new ArrayList<>(frameworks.size());
    PhpModule phpModule = project.getPhpModule();
    for (PhpFrameworkProvider framework : frameworks) {
        ImportantFilesImplementation configurationFiles = framework.getConfigurationFiles2(phpModule);
        if (configurationFiles != null) {
            newConfigFiles.add(configurationFiles);
            configurationFiles.addChangeListener(WeakListeners.change(this, configurationFiles));
        } else {
            File[] files = framework.getConfigurationFiles(phpModule);
            if (files.length > 0) {
                LOGGER.log(Level.INFO, "PHP framework {0} uses deprecated method, switch to PhpFrameworkProvider.getConfigurationFiles2()", framework.getIdentifier());
                ImportantFilesImplementation dummyConfigFiles = new ImportantFilesImplementationImpl(project, framework.getIdentifier(), files);
                newConfigFiles.add(dummyConfigFiles);
            }
        }
    }
    configFiles.clear();
    configFiles.addAll(newConfigFiles);
}
 
Example #2
Source File: ImportantFilesImpl.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public Collection<FileInfo> getFiles() {
    Collection<? extends ImportantFilesImplementation> allFiles = getAllInstances();
    if (allFiles.isEmpty()) {
        return Collections.emptyList();
    }
    Collection<FileInfo> files = new ArrayList<>();
    for (ImportantFilesImplementation instance : allFiles) {
        files.addAll(map(instance.getFiles()));
    }
    return files;
}
 
Example #3
Source File: ConfigurationFiles.java    From nb-ci-plugin with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Collection<ImportantFilesImplementation.FileInfo> getFiles() {
    List<FileObject> directories = getConfigDirectories();
    List<ImportantFilesImplementation.FileInfo> files = new ArrayList<ImportantFilesImplementation.FileInfo>();
    for (FileObject directory : directories) {
        FileObject[] children = directory.getChildren();
        for (FileObject child : children) {
            if (child.isFolder() || !FileUtils.isPhpFile(child)) {
                continue;
            }
            files.add(new ImportantFilesImplementation.FileInfo(child));
        }
    }
    return files;
}
 
Example #4
Source File: FrameworkConfigFilesNodeFactory.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private List<ImportantFilesImplementation.FileInfo> getConfigFiles() {
    Set<ImportantFilesImplementation.FileInfo> importantFiles = new LinkedHashSet<>();
    for (ImportantFilesImplementation provider : configFiles) {
        importantFiles.addAll(provider.getFiles());
    }
    return new ArrayList<>(importantFiles);
}
 
Example #5
Source File: FrameworkConfigFilesNodeFactory.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
protected Node[] createNodes(ImportantFilesImplementation.FileInfo key) {
    assert key != null;
    try {
        return new Node[] {new ImportantFileNode(project, key)};
    } catch (DataObjectNotFoundException ex) {
        LOGGER.log(Level.WARNING, null, ex);
    }
    return new Node[0];
}
 
Example #6
Source File: FrameworkConfigFilesNodeFactory.java    From netbeans with Apache License 2.0 5 votes vote down vote up
ConfigFilesChildren(PhpProject project, List<ImportantFilesImplementation> configFiles) {
    super(true);
    assert project != null;
    assert configFiles != null;
    this.project = project;
    this.configFiles = configFiles;
}
 
Example #7
Source File: ImportantFilesImpl.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private Collection<? extends FileInfo> map(Collection<ImportantFilesImplementation.FileInfo> originals) {
    List<FileInfo> converted = new ArrayList<>(originals.size());
    for (ImportantFilesImplementation.FileInfo original : originals) {
        converted.add(new FileInfo(original.getFile(), original.getDisplayName(), original.getDescription()));
    }
    return converted;
}
 
Example #8
Source File: ImportantFilesImpl.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private synchronized void removeImportantFilesListener() {
    if (allInstances == null) {
        return;
    }
    for (ImportantFilesImplementation files : allInstances) {
        files.removeChangeListener(this);
    }
}
 
Example #9
Source File: ImportantFilesImpl.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private synchronized void addImportantFilesListener() {
    if (allInstances == null) {
        return;
    }
    for (ImportantFilesImplementation files : allInstances) {
        files.addChangeListener(this);
    }
}
 
Example #10
Source File: ImportantFilesImpl.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private synchronized List<ImportantFilesImplementation> getAllInstances() {
    if (allInstances == null) {
        allInstances = new ArrayList<>(getLookupResult().allInstances());
        addImportantFilesListener();
    }
    return allInstances;
}
 
Example #11
Source File: ImportantFilesImpl.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private synchronized Lookup.Result<ImportantFilesImplementation> getLookupResult() {
    if (lookupResult == null) {
        lookupResult = phpProject.getLookup().lookupResult(ImportantFilesImplementation.class);
        lookupResult.addLookupListener(this);
    }
    return lookupResult;
}
 
Example #12
Source File: FrameworkConfigFilesNodeFactory.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
protected void removeNotify() {
    setKeys(Collections.<ImportantFilesImplementation.FileInfo>emptyList());
}
 
Example #13
Source File: FrameworkConfigFilesNodeFactory.java    From netbeans with Apache License 2.0 4 votes vote down vote up
ImportantFileNode(PhpProject project, ImportantFilesImplementation.FileInfo fileInfo) throws DataObjectNotFoundException {
    super(DataObject.find(fileInfo.getFile()).getNodeDelegate());
    assert project != null;
    this.project = project;
    this.fileInfo = fileInfo;
}
 
Example #14
Source File: ZendPhpFrameworkProvider.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public ImportantFilesImplementation getConfigurationFiles2(PhpModule phpModule) {
    return new ConfigurationFiles(phpModule);
}
 
Example #15
Source File: SymfonyPhpFrameworkProvider.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public ImportantFilesImplementation getConfigurationFiles2(PhpModule phpModule) {
    return new ConfigurationFiles(phpModule);
}
 
Example #16
Source File: ImportantFilesImpl.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public Collection<ImportantFilesImplementation.FileInfo> getFiles() {
    return support.getFiles(null);
}
 
Example #17
Source File: Zend2PhpFrameworkProvider.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public ImportantFilesImplementation getConfigurationFiles2(PhpModule phpModule) {
    return new ConfigurationFiles(phpModule);
}
 
Example #18
Source File: Nette2FrameworkProvider.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public ImportantFilesImplementation getConfigurationFiles2(PhpModule phpModule) {
    return new ConfigurationFiles(phpModule);
}
 
Example #19
Source File: CakePHP3FrameworkProvider.java    From cakephp3-netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public ImportantFilesImplementation getConfigurationFiles2(PhpModule phpModule) {
    return new ConfigurationFiles(phpModule);
}
 
Example #20
Source File: SymfonyPhpFrameworkProvider.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public ImportantFilesImplementation getConfigurationFiles2(PhpModule phpModule) {
    return new ConfigurationFiles(phpModule);
}
 
Example #21
Source File: CIPhpFrameworkProvider.java    From nb-ci-plugin with GNU General Public License v2.0 4 votes vote down vote up
@Override
public ImportantFilesImplementation getConfigurationFiles2(PhpModule phpModule) {
    return new ConfigurationFiles(phpModule);
}
 
Example #22
Source File: PhpFrameworkProvider.java    From netbeans with Apache License 2.0 2 votes vote down vote up
/**
 * Returns the configuration files (no directories allowed!) belonging to this framework.
 * These files are displayed under <tt>Configuration Files</tt> node in <tt>Projects</tt> view.
 * <p>
 * Please note that {@link ImportantFilesImplementation#getFiles() files} are not sorted so <b>sorted collection should be returned</b>.
 * Also, {@link ImportantFilesImplementation.FileInfo#getDescription()} is always ignored.
 *
 * @param  phpModule the PHP module for which the configuration files are returned; never <code>null</code>.
 * @return configuration files, can be <code>null</code> if no configuration files exist
 * @since 0.23
 */
@CheckForNull
public ImportantFilesImplementation getConfigurationFiles2(PhpModule phpModule) {
    return null;
}