Skip to content

Commit

Permalink
Drop legacy HelpBuilder
Browse files Browse the repository at this point in the history
  • Loading branch information
viatsko committed Jul 26, 2011
1 parent c00f4eb commit 7aca7cc
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 47 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ru.artlebedev.idea.plugins.parser.helpBuilder;
package ru.artlebedev.idea.plugins.parser.documentation;

import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.document.Document;
Expand Down Expand Up @@ -36,8 +36,16 @@
*/
public class ParserDocumentationFileIndexer {
private IndexWriter _writer;
private ArrayList<File> _queue = new ArrayList<File>();
private ArrayList<File> _queue
= new ArrayList<File>();

/**
* Left from original TextFileIndexer,
* shouldn't be used in idea-parser3 bundle
*
* @param args
* @throws IOException
*/
public static void main(String[] args) throws IOException {
System.out.println("Enter the path where the index will be created: ");

Expand All @@ -53,9 +61,9 @@ public static void main(String[] args) throws IOException {
System.exit(-1);
}

//===================================================
//read input from user until he enters q for quit
//===================================================
// ===================================================
// read input from user until he enters q for quit
// ===================================================
while (!s.equalsIgnoreCase("q")) {
try {
System.out.println("Enter the file or folder name to add into the index (q=quit):");
Expand All @@ -72,10 +80,10 @@ public static void main(String[] args) throws IOException {
}
}

//===================================================
//after adding, we always have to call the
//closeIndex, otherwise the index is not created
//===================================================
// ===================================================
// after adding, we always have to call the
// closeIndex, otherwise the index is not created
// ===================================================
indexer.closeIndex();
}

Expand All @@ -97,11 +105,11 @@ public static void main(String[] args) throws IOException {
* @throws java.io.IOException
*/
public void indexFileOrDirectory(String fileName) throws IOException {
//===================================================
//gets the list of files in a folder (if user has submitted
//the name of a folder) or gets a single file name (is user
//has submitted only the file name)
//===================================================
// ===================================================
// gets the list of files in a folder (if user has submitted
// the name of a folder) or gets a single file name (is user
// has submitted only the file name)
// ===================================================
listFiles(new File(fileName));

int originalNumDocs = _writer.numDocs();
Expand All @@ -110,15 +118,15 @@ public void indexFileOrDirectory(String fileName) throws IOException {
try {
Document doc = new Document();

//===================================================
// ===================================================
// add contents of file
//===================================================
// ===================================================
fr = new FileReader(f);
doc.add(new Field("contents", fr));

//===================================================
//adding second field which contains the path of the file
//===================================================
// ===================================================
// adding second field which contains the path of the file
// ===================================================
doc.add(new Field("path", fileName,
Field.Store.YES,
Field.Index.NOT_ANALYZED));
Expand Down Expand Up @@ -151,9 +159,9 @@ private void listFiles(File file) {
}
} else {
String filename = file.getName().toLowerCase();
//===================================================
// ===================================================
// Only index text files
//===================================================
// ===================================================
if (filename.endsWith(".htm") || filename.endsWith(".html") ||
filename.endsWith(".xml") || filename.endsWith(".txt")) {
_queue.add(file);
Expand Down

This file was deleted.

0 comments on commit 7aca7cc

Please sign in to comment.