org.netbeans.modules.php.api.util.FileUtils Java Examples

The following examples show how to use org.netbeans.modules.php.api.util.FileUtils. 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: Utils.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public static String validateTestSources(PhpProject project, String testDirPath) {
    if (!StringUtils.hasText(testDirPath)) {
        return NbBundle.getMessage(Utils.class, "MSG_FolderEmpty");
    }

    File testSourcesFile = new File(testDirPath);
    if (!testSourcesFile.isAbsolute()) {
        return NbBundle.getMessage(Utils.class, "MSG_TestNotAbsolute");
    } else if (!testSourcesFile.isDirectory()) {
        return NbBundle.getMessage(Utils.class, "MSG_TestNotDirectory");
    }
    FileObject nbproject = project.getProjectDirectory().getFileObject("nbproject"); // NOI18N
    FileObject testSourcesFo = FileUtil.toFileObject(testSourcesFile);
    if (testSourcesFile.equals(FileUtil.toFile(ProjectPropertiesSupport.getSourcesDirectory(project)))) {
        return NbBundle.getMessage(Utils.class, "MSG_TestEqualsSources");
    } else if (FileUtil.isParentOf(nbproject, testSourcesFo)
            || nbproject.equals(testSourcesFo)) {
        return NbBundle.getMessage(Utils.class, "MSG_TestUnderneathNBMetadata");
    } else if (!FileUtils.isDirectoryWritable(testSourcesFile)) {
        return NbBundle.getMessage(Utils.class, "MSG_TestNotWritable");
    }
    return null;
}
 
Example #2
Source File: PHPTokenListProvider.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Override
public TokenList findTokenList(Document doc) {
    String mimeType = NbEditorUtilities.getMimeType(doc);
    if (FileUtils.PHP_MIME_TYPE.equals(mimeType)
            && doc instanceof BaseDocument) {
        for (TokenListProvider p : MimeLookup.getLookup(MimePath.get("text/html")).lookupAll(TokenListProvider.class)) { // NOI18N
            TokenList l = p.findTokenList(doc);
            if (l != null) {
                List<TokenList> tokens = new ArrayList<>(2);
                tokens.add(new PHPTokenList(doc));
                tokens.add(l);
                return MultiTokenList.create(tokens);
            }
        }
    }
    return null;
}
 
Example #3
Source File: PhpProjectConvertor.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private FileObject detectSourceRoot() {
    // first check if there is any *.php file right in project dir
    for (FileObject child : projectDirectory.getChildren()) {
        if (FileUtils.isPhpFile(child)) {
            return projectDirectory;
        }
    }
    // now, check well known sources
    for (String dir : KNOWN_SOURCE_ROOTS) {
        FileObject srcDir = projectDirectory.getFileObject(dir);
        if (srcDir != null)  {
            return srcDir;
        }
    }
    return projectDirectory;
}
 
Example #4
Source File: CakePHP3GoToStatus.java    From cakephp3-netbeans with Apache License 2.0 6 votes vote down vote up
public List<GoToItem> getTestCases() {
    if (fileObject == null || !FileUtils.isPhpFile(fileObject)) {
        return Collections.emptyList();
    }
    CakePHP3Module cakeModule = CakePHP3Module.forFileObject(fileObject);
    ModuleInfo info = cakeModule.createModuleInfo(fileObject);
    if (ModuleUtils.isTemplate(info.getCategory())) {
        return Collections.emptyList();
    }

    List<GoToItem> items = new ArrayList<>();
    List<FileObject> directories = cakeModule.getDirectories(info.getBase(), null, info.getPluginName());
    for (FileObject directory : directories) {
        Set<ClassElement> classElements = getClassElements(directory, fileObject.getName() + "Test"); // NOI18N
        for (ClassElement classElement : classElements) {
            FileObject testcase = classElement.getFileObject();
            items.add(GoToItemFactory.create(Category.TEST_CASE, testcase, DEFAULT_OFFSET));
        }
    }
    return items;
}
 
Example #5
Source File: RemoteClient.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private FileLock lockFile(FileObject fo) throws IOException, DownloadSkipException {
    try {
        return fo.lock();
    } catch (FileAlreadyLockedException lockedException) {
        if (warnChangedFile(fo)) {
            FileUtils.saveFile(fo);
            // XXX remove once #213141 is fixed
            try {
                Thread.sleep(1000);
            } catch (InterruptedException ex) {
            }
            return fo.lock();
        } else {
            throw new DownloadSkipException();
        }
    }
}
 
Example #6
Source File: WindowsPhpEnvironment.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Override
protected List<DocumentRoot> getDocumentRoots(String projectName) {
    File htDocs = null;
    for (File root : getFsRoots()) {
        // standard apache installation
        File programFiles = new File(root, "Program Files"); // NOI18N
        htDocs = findHtDocsDirectory(programFiles, APACHE_FILENAME_FILTER);
        if (htDocs != null) {
            // one htdocs is enough
            break;
        }
    }
    if (htDocs != null) {
        String documentRoot = getFolderName(htDocs, projectName);
        String url = getDefaultUrl(projectName);
        String hint = NbBundle.getMessage(WindowsPhpEnvironment.class, "TXT_HtDocs");
        return Collections.singletonList(new DocumentRoot(documentRoot, url, hint, FileUtils.isDirectoryWritable(htDocs)));
    }
    // xampp
    return XAMPP.getDocumentRoots(projectName);
}
 
Example #7
Source File: CodeSniffer.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private List<String> getParameters(String standard, FileObject file, boolean noRecursion) {
    Charset encoding = FileEncodingQuery.getEncoding(file);
    List<String> params = new ArrayList<>();
    // NETBEANS-3243 the path of Code Sniffer may have --standard parameter
    if (StringUtils.hasText(standard)
            && !codeSnifferPath.contains(STANDARD_PARAM + "=") // NOI18N
            && !codeSnifferPath.contains(STANDARD_PARAM + " ")) { // NOI18N
        // #270987 use --standard
        params.add(String.format(STANDARD_PARAM_FORMAT, standard));
    }
    params.add(REPORT_PARAM);
    params.add(String.format(EXTENSIONS_PARAM, StringUtils.implode(FileUtil.getMIMETypeExtensions(FileUtils.PHP_MIME_TYPE), ","))); // NOI18N
    params.add(String.format(ENCODING_PARAM, encoding.name()));
    addIgnoredFiles(params, file);
    if (noRecursion) {
        params.add(NO_RECURSION_PARAM);
    }
    params.add(FileUtil.toFile(file).getAbsolutePath());
    return params;
}
 
Example #8
Source File: GoToActionOrViewAction.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private int getOffset(Lookup context) {
    EditorCookie editorCookie = context.lookup(EditorCookie.class);
    if (editorCookie != null) {
        return getOffset(editorCookie);
    }
    FileObject fo = FileUtils.getFileObject(context);
    if (fo == null) {
        return DEFAULT_OFFSET;
    }
    try {
        editorCookie = DataObject.find(fo).getLookup().lookup(EditorCookie.class);
        return getOffset(editorCookie);
    } catch (DataObjectNotFoundException ex) {
        Exceptions.printStackTrace(ex);
    }
    return DEFAULT_OFFSET;
}
 
Example #9
Source File: ConfigurationFiles.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Override
public Collection<FileInfo> getFiles() {
    FileObject sourceDir = getSourceDirectory();
    if (sourceDir == null) {
        // broken project
        return Collections.emptyList();
    }
    List<FileInfo> files = new ArrayList<>();
    FileObject configDir = sourceDir.getFileObject(CONFIG_DIRECTORY);
    if (configDir != null
            && configDir.isFolder()
            && configDir.isValid()) {
        Enumeration<? extends FileObject> children = configDir.getChildren(true);
        while (children.hasMoreElements()) {
            FileObject child = children.nextElement();
            if (child.isData()
                    && child.isValid()
                    && FileUtils.isPhpFile(child)) {
                files.add(new FileInfo(child));
            }
        }
        Collections.sort(files, FileInfo.COMPARATOR);
    }
    return files;
}
 
Example #10
Source File: PHPSQLCompletionTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void checkPHPSQLStatement(String testString, String resultString) {
    int caretOffset = testString.indexOf('|');
    testString = testString.replace("|", "");

    Document document = getDocument(testString, FileUtils.PHP_MIME_TYPE, PHPTokenId.language());

    PHPSQLStatement stmt = PHPSQLStatement.computeSQLStatement(document, caretOffset);
    if (resultString == null) {
        assertNull(stmt);
        return;
    } else {
        assertNotNull(stmt);
    }

    assertEquals(resultString, stmt.getStatement());

    int virtualOffset = stmt.sourceToGeneratedPos(caretOffset);
    assertFalse(virtualOffset == -1);
    int sourceOffset = stmt.generatedToSourcePos(virtualOffset);
    assertEquals(caretOffset, sourceOffset);
}
 
Example #11
Source File: ConfigActionTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Override
public boolean isRunMethodEnabled(Lookup context) {
    SingleMethod singleMethod = CommandUtils.singleMethodForContext(context);
    if (singleMethod == null) {
        return false;
    }
    FileObject file = singleMethod.getFile();
    if (file == null) {
        return false;
    }
    if (!FileUtils.isPhpFile(file)) {
        return false;
    }
    PhpModule phpModule = project.getPhpModule();
    for (PhpTestingProvider testingProvider : project.getTestingProviders()) {
        if (testingProvider.isTestFile(phpModule, file)) {
            return true;
        }
    }
    return false;
}
 
Example #12
Source File: RunTestsCommand.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private FileObject findFolderWithTest(Lookup context) {
    FileObject[] files = CommandUtils.filesForContextOrSelectedNodes(context);
    if (files.length != 1) {
        return null;
    }
    FileObject file = files[0];
    if (!file.isFolder()) {
        return null;
    }
    Enumeration<? extends FileObject> children = file.getChildren(true);
    while (children.hasMoreElements()) {
        FileObject child = children.nextElement();
        if (child.isData()
                && isTestFile(child)
                && FileUtils.isPhpFile(child)) {
            return file;
        }
    }
    return null;
}
 
Example #13
Source File: CreateTestsSupport.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void sanitizeFiles(List<FileObject> sanitizedFiles, List<FileObject> files, PhpModule phpModule, PhpVisibilityQuery phpVisibilityQuery) {
    for (FileObject fo : files) {
        if (fo.isData()
                && FileUtils.isPhpFile(fo)
                && !isUnderTests(phpModule, fo)
                // XXX no way to test selenium here
                //&& !isUnderSelenium(phpModule, fo)
                && phpVisibilityQuery.isVisible(fo)) {
            sanitizedFiles.add(fo);
        }
        FileObject[] children = fo.getChildren();
        if (children.length > 0) {
            sanitizeFiles(sanitizedFiles, Arrays.asList(children), phpModule, phpVisibilityQuery);
        }
    }
}
 
Example #14
Source File: CakePHP3GoToStatus.java    From cakephp3-netbeans with Apache License 2.0 6 votes vote down vote up
protected List<GoToItem> createAllItems(Category category) {
    if (fileObject == null) {
        return Collections.emptyList();
    }
    List<GoToItem> items = new ArrayList<>();
    CakePHP3Module cakeModule = CakePHP3Module.forFileObject(fileObject);
    ModuleInfo info = cakeModule.createModuleInfo(fileObject);
    List<FileObject> directories = cakeModule.getDirectories(info.getBase(), category, info.getPluginName());
    for (FileObject directory : directories) {
        for (FileObject child : directory.getChildren()) {
            if (child.isFolder() || !FileUtils.PHP_MIME_TYPE.equals(child.getMIMEType(FileUtils.PHP_MIME_TYPE))) {
                continue;
            }
            items.add(GoToItemFactory.create(category, child, 0));
        }
    }
    return items;
}
 
Example #15
Source File: NewFileWizardIterator.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Override
public Set<FileObject> instantiate() throws IOException {
    FileObject dir = Templates.getTargetFolder(wizard);
    FileObject template = Templates.getTemplate(wizard);

    DataFolder dataFolder = DataFolder.findFolder(dir);
    DataObject dataTemplate = DataObject.find(template);
    DataObject createdFile = dataTemplate.createFromTemplate(dataFolder, Templates.getTargetName(wizard), getTemplateParams());

    // #187374
    try {
        FileUtils.reformatFile(createdFile);
    } catch (IOException exc) {
        LOGGER.log(Level.WARNING, exc.getMessage(), exc);
    }

    return Collections.singleton(createdFile.getPrimaryFile());
}
 
Example #16
Source File: SmartyPhpFrameworkProvider.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@NbBundle.Messages({
    "SmartyPhpFrameworkProvider.tit.smarty.template.autodetection=Smarty autodetection",
})
@Override
public void phpModuleOpened(final PhpModule phpModule) {
    if (getSmartyPropertyEnabled(phpModule) == null) {
        try {
            ParserManager.parseWhenScanFinished(FileUtils.PHP_MIME_TYPE, new UserTask() {
                @Override
                public void run(ResultIterator resultIterator) throws Exception {
                    RP.post(new SmartyAutodetectionJob(phpModule));
                }
            });
        } catch (ParseException ex) {
            Exceptions.printStackTrace(ex);
        }
    }
}
 
Example #17
Source File: Nette2OptionsPanelController.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@NbBundle.Messages({
    "Nette2ValidationDirectory=Nette2 Directory",
    "# {0} - File in a root of Nette sources directory",
    "Nette2DirectoryValidationWarning=Nette2 Directory does not contain {0} file."
})
public static String validateNetteDirectory(String netteDirectory) {
    String result = FileUtils.validateDirectory(Bundle.Nette2ValidationDirectory(), netteDirectory, false);
    if (result == null) {
        File loaderPhp = new File(netteDirectory, LOADER_FILE);
        if (!loaderPhp.exists() || loaderPhp.isDirectory()) {
            result = Bundle.Nette2DirectoryValidationWarning(LOADER_FILE);
        }
    }
    return result;
}
 
Example #18
Source File: Doctrine2Options.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public String getScript() {
    String script = getPreferences().get(SCRIPT, null);
    if (script == null && !scriptSearched) {
        scriptSearched = true;
        List<String> scripts = FileUtils.findFileOnUsersPath(Doctrine2Script.SCRIPT_NAME, Doctrine2Script.SCRIPT_NAME_LONG);
        if (!scripts.isEmpty()) {
            script = scripts.get(0);
            setScript(script);
        }
    }
    return script;
}
 
Example #19
Source File: AnalysisOptions.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@CheckForNull
public String getMessDetectorPath() {
    String messDetectorPath = getPreferences().get(MESS_DETECTOR_PATH, null);
    if (messDetectorPath == null && !messDetectorSearched) {
        messDetectorSearched = true;
        List<String> scripts = FileUtils.findFileOnUsersPath(MessDetector.NAME, MessDetector.LONG_NAME);
        if (!scripts.isEmpty()) {
            messDetectorPath = scripts.get(0);
            setMessDetectorPath(messDetectorPath);
        }
    }
    return messDetectorPath;
}
 
Example #20
Source File: PhingOptions.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@CheckForNull
public String getPhing() {
    String path = preferences.get(PHING_PATH, null);
    if (path == null
            && !phingSearched) {
        phingSearched = true;
        List<String> files = FileUtils.findFileOnUsersPath(PhingExecutable.PHING_NAMES);
        if (!files.isEmpty()) {
            path = files.get(0);
            setPhing(path);
        }
    }
    return path;
}
 
Example #21
Source File: AnalysisOptionsValidator.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private AnalysisOptionsValidator validatePHPStanConfiguration(String configuration) {
    if (!StringUtils.isEmpty(configuration)) {
        String warning = FileUtils.validateFile("Configuration file", configuration, false); // NOI18N
        if (warning != null) {
            result.addWarning(new ValidationResult.Message("phpStan.configuration", warning)); // NOI18N
        }
    }
    return this;
}
 
Example #22
Source File: TesterTestingProvider.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public boolean isTestFile(PhpModule phpModule, FileObject fileObj) {
    if (!FileUtils.isPhpFile(fileObj)) {
        return false;
    }
    for (FileObject testDirectory : phpModule.getTestDirectories()) {
        if (FileUtil.isParentOf(testDirectory, fileObj)) {
            return true;
        }
    }
    return false;
}
 
Example #23
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 #24
Source File: OptionsUtils.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private static void lazyInit() {
    if (INITED.compareAndSet(false, true)) {
        preferences = MimeLookup.getLookup(FileUtils.PHP_MIME_TYPE).lookup(Preferences.class);
        preferences.addPreferenceChangeListener(WeakListeners.create(PreferenceChangeListener.class, PREFERENCES_TRACKER, preferences));
        PREFERENCES_TRACKER.preferenceChange(null);
    }
}
 
Example #25
Source File: PHPFormatter.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public void reindent(final Context context) {
    String mimeType = getMimeTypeAtOffset(context.document(), context.startOffset());
    String mimePath = context.mimePath(); // avoid to call twice
    if (FileUtils.PHP_MIME_TYPE.equals(mimeType) && FileUtils.PHP_MIME_TYPE.equals(mimePath)) {
        Indentation indent = new IndentationCounter((BaseDocument) context.document()).count(context.caretOffset());
        indent.modify(context);
    }
}
 
Example #26
Source File: TesterOptions.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@CheckForNull
public String getTesterPath() {
    String path = getPreferences().get(TESTER_PATH, null);
    if (path == null && !testerSearched) {
        testerSearched = true;
        List<String> scripts = FileUtils.findFileOnUsersPath(Tester.TESTER_FILE_NAME);
        if (!scripts.isEmpty()) {
            path = scripts.get(0);
            setTesterPath(path);
        }
    }
    return path;
}
 
Example #27
Source File: PhpUnitOptionsPanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@NbBundle.Messages({
    "PhpUnitOptionsPanel.skelGen.search.title=Skeleton Generator scripts",
    "PhpUnitOptionsPanel.skelGen.search.scripts=&Skeleton Generator scripts:",
    "PhpUnitOptionsPanel.skelGen.search.pleaseWaitPart=Skeleton Generator scripts",
    "PhpUnitOptionsPanel.skelGen.search.notFound=No Skeleton Generator scripts found."
})
private void skelGenSearchButtonActionPerformed(ActionEvent evt) {//GEN-FIRST:event_skelGenSearchButtonActionPerformed
    String skelGen = UiUtils.SearchWindow.search(new UiUtils.SearchWindow.SearchWindowSupport() {
        @Override
        public List<String> detect() {
            return FileUtils.findFileOnUsersPath(SkeletonGenerator.SCRIPT_NAME, SkeletonGenerator.SCRIPT_NAME_LONG, SkeletonGenerator.SCRIPT_NAME_PHAR);
        }
        @Override
        public String getWindowTitle() {
            return Bundle.PhpUnitOptionsPanel_skelGen_search_title();
        }
        @Override
        public String getListTitle() {
            return Bundle.PhpUnitOptionsPanel_skelGen_search_scripts();
        }
        @Override
        public String getPleaseWaitPart() {
            return Bundle.PhpUnitOptionsPanel_skelGen_search_pleaseWaitPart();
        }
        @Override
        public String getNoItemsFound() {
            return Bundle.PhpUnitOptionsPanel_skelGen_search_notFound();
        }
    });
    if (skelGen != null) {
        skelGenTextField.setText(skelGen);
    }
}
 
Example #28
Source File: PhpUnitOptionsPanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@NbBundle.Messages({
    "PhpUnitOptionsPanel.phpUnit.search.title=PHPUnit scripts",
    "PhpUnitOptionsPanel.phpUnit.search.scripts=&PHPUnit scripts:",
    "PhpUnitOptionsPanel.phpUnit.search.pleaseWaitPart=PHPUnit scripts",
    "PhpUnitOptionsPanel.phpUnit.search.notFound=No PHPUnit scripts found."
})
private void phpUnitSearchButtonActionPerformed(ActionEvent evt) {//GEN-FIRST:event_phpUnitSearchButtonActionPerformed
    String phpUnit = UiUtils.SearchWindow.search(new UiUtils.SearchWindow.SearchWindowSupport() {

        @Override
        public List<String> detect() {
            return FileUtils.findFileOnUsersPath(PhpUnit.SCRIPT_NAME, PhpUnit.SCRIPT_NAME_LONG, PhpUnit.SCRIPT_NAME_PHAR);
        }

        @Override
        public String getWindowTitle() {
            return Bundle.PhpUnitOptionsPanel_phpUnit_search_title();
        }

        @Override
        public String getListTitle() {
            return Bundle.PhpUnitOptionsPanel_phpUnit_search_scripts();
        }

        @Override
        public String getPleaseWaitPart() {
            return Bundle.PhpUnitOptionsPanel_phpUnit_search_pleaseWaitPart();
        }

        @Override
        public String getNoItemsFound() {
            return Bundle.PhpUnitOptionsPanel_phpUnit_search_notFound();
        }
    });
    if (phpUnit != null) {
        phpUnitTextField.setText(phpUnit);
    }
}
 
Example #29
Source File: PhpUnitOptions.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public String getSkeletonGeneratorPath() {
    String skeletonGeneratorPath = getPreferences().get(SKELETON_GENERATOR_PATH, null);
    if (skeletonGeneratorPath == null && !skeletonGeneratorSearched) {
        skeletonGeneratorSearched = true;
        List<String> scripts = FileUtils.findFileOnUsersPath(
                SkeletonGenerator.SCRIPT_NAME, SkeletonGenerator.SCRIPT_NAME_LONG, SkeletonGenerator.SCRIPT_NAME_PHAR);
        if (!scripts.isEmpty()) {
            skeletonGeneratorPath = scripts.get(0);
            setSkeletonGeneratorPath(skeletonGeneratorPath);
        }
    }
    return skeletonGeneratorPath;
}
 
Example #30
Source File: ComposerOptionsPanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@NbBundle.Messages({
    "ComposerOptionsPanel.search.scripts.title=Composer scripts",
    "ComposerOptionsPanel.search.scripts=&Composer scripts:",
    "ComposerOptionsPanel.search.scripts.pleaseWaitPart=Composer scripts",
    "ComposerOptionsPanel.search.scripts.notFound=No Composer scripts found."
})
private void searchButtonActionPerformed(ActionEvent evt) {//GEN-FIRST:event_searchButtonActionPerformed
    String script = UiUtils.SearchWindow.search(new UiUtils.SearchWindow.SearchWindowSupport() {
        @Override
        public List<String> detect() {
            return FileUtils.findFileOnUsersPath(Composer.COMPOSER_FILENAMES.toArray(new String[0]));
        }
        @Override
        public String getWindowTitle() {
            return Bundle.ComposerOptionsPanel_search_scripts_title();
        }
        @Override
        public String getListTitle() {
            return Bundle.ComposerOptionsPanel_search_scripts();
        }
        @Override
        public String getPleaseWaitPart() {
            return Bundle.ComposerOptionsPanel_search_scripts_pleaseWaitPart();
        }
        @Override
        public String getNoItemsFound() {
            return Bundle.ComposerOptionsPanel_search_scripts_notFound();
        }
    });
    if (script != null) {
        composerTextField.setText(script);
    }
}