You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ma...@apache.org on 2010/09/29 23:38:04 UTC
svn commit: r1002856 - in /lucene/sandbox/luke: ./
src/org/apache/lucene/luke/ui/
Author: markrmiller
Date: Wed Sep 29 21:38:04 2010
New Revision: 1002856
URL: http://svn.apache.org/viewvc?rev=1002856&view=rev
Log:
port over the analyzer plugin - but make it a first class tab
Added:
lucene/sandbox/luke/src/org/apache/lucene/luke/ui/AnalyzersTab.bxml
lucene/sandbox/luke/src/org/apache/lucene/luke/ui/AnalyzersTab.java
Modified:
lucene/sandbox/luke/ (props changed)
lucene/sandbox/luke/src/org/apache/lucene/luke/ui/LukeApplication_en.json
lucene/sandbox/luke/src/org/apache/lucene/luke/ui/LukeWindow.bxml
lucene/sandbox/luke/src/org/apache/lucene/luke/ui/LukeWindow.java
lucene/sandbox/luke/src/org/apache/lucene/luke/ui/SearchTab.java
Propchange: lucene/sandbox/luke/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Sep 29 21:38:04 2010
@@ -0,0 +1,2 @@
+build
+dist
Added: lucene/sandbox/luke/src/org/apache/lucene/luke/ui/AnalyzersTab.bxml
URL: http://svn.apache.org/viewvc/lucene/sandbox/luke/src/org/apache/lucene/luke/ui/AnalyzersTab.bxml?rev=1002856&view=auto
==============================================================================
--- lucene/sandbox/luke/src/org/apache/lucene/luke/ui/AnalyzersTab.bxml (added)
+++ lucene/sandbox/luke/src/org/apache/lucene/luke/ui/AnalyzersTab.bxml Wed Sep 29 21:38:04 2010
@@ -0,0 +1,88 @@
+<luke:AnalyzersTab styles="{backgroundColor:11}"
+ xmlns:bxml="http://pivot.apache.org/bxml" xmlns:content="org.apache.pivot.wtk.content"
+ xmlns="org.apache.pivot.wtk" xmlns:luke="org.apache.lucene.luke.ui">
+
+ <columns>
+ <TablePane.Column width="1*" />
+ </columns>
+ <rows>
+ <TablePane.Row>
+ <BoxPane styles="{fill:true}" orientation="vertical">
+ <TablePane>
+ <columns>
+ <TablePane.Column />
+ <TablePane.Column />
+ </columns>
+ <rows>
+ <TablePane.Row>
+ <Label text="%analyzersTab_availableAnalyzers" />
+ <Label text="%analyzersTab_compatibility" />
+ </TablePane.Row>
+ <TablePane.Row>
+ <ListButton bxml:id="analyzersListButton" />
+ <ListButton bxml:id="luceneVersionListButton" />
+ </TablePane.Row>
+ </rows>
+ </TablePane>
+
+ <Label text="%analyzersTab_textToBeAnalyzed" />
+ <ScrollPane preferredHeight="200"
+ horizontalScrollBarPolicy="fill">
+ <view>
+ <TextArea bxml:id="inputText"
+ styles="{wrapText:true, backgroundColor:'#FFFFFF'}" text="%analyzersTab_welcome" />
+ </view>
+ </ScrollPane>
+
+ <PushButton buttonData="Analyze" action="analyze" />
+
+ </BoxPane>
+ </TablePane.Row>
+ <TablePane.Row height="1*">
+ <Border>
+ <content>
+ <SplitPane splitRatio="0.3">
+ <left>
+ <Border styles="{thickness:0}">
+ <content>
+ <ScrollPane preferredHeight="200"
+ horizontalScrollBarPolicy="fill">
+ <view>
+ <ListView bxml:id="resultsList" />
+ </view>
+ </ScrollPane>
+ </content>
+ </Border>
+ </left>
+ <right>
+ <Border styles="{thickness:0, verticalAlignment:'center'}">
+ <content>
+ <ScrollPane horizontalScrollBarPolicy="fill">
+ <view>
+ <TableView bxml:id="tokenAttsTable">
+ <columns>
+ <TableView.Column name="class"
+ headerData="%analyzersTab_tokenAttsTable_col1" />
+ <TableView.Column name="impl"
+ headerData="%analyzersTab_tokenAttsTable_col2" />
+ <TableView.Column name="value"
+ headerData="%analyzersTab_tokenAttsTable_col3" />
+ </columns>
+
+ </TableView>
+
+ </view>
+ <columnHeader>
+ <TableViewHeader tableView="$tokenAttsTable" />
+ </columnHeader>
+ </ScrollPane>
+ </content>
+ </Border>
+ </right>
+ </SplitPane>
+ </content>
+ </Border>
+ </TablePane.Row>
+ </rows>
+
+</luke:AnalyzersTab>
\ No newline at end of file
Added: lucene/sandbox/luke/src/org/apache/lucene/luke/ui/AnalyzersTab.java
URL: http://svn.apache.org/viewvc/lucene/sandbox/luke/src/org/apache/lucene/luke/ui/AnalyzersTab.java?rev=1002856&view=auto
==============================================================================
--- lucene/sandbox/luke/src/org/apache/lucene/luke/ui/AnalyzersTab.java (added)
+++ lucene/sandbox/luke/src/org/apache/lucene/luke/ui/AnalyzersTab.java Wed Sep 29 21:38:04 2010
@@ -0,0 +1,231 @@
+package org.apache.lucene.luke.ui;
+
+import java.io.StringReader;
+import java.lang.reflect.Constructor;
+import java.net.URL;
+import java.util.Iterator;
+
+import org.apache.lucene.analysis.Analyzer;
+import org.apache.lucene.analysis.TokenStream;
+import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
+import org.apache.lucene.analysis.tokenattributes.FlagsAttribute;
+import org.apache.lucene.analysis.tokenattributes.OffsetAttribute;
+import org.apache.lucene.analysis.tokenattributes.PayloadAttribute;
+import org.apache.lucene.analysis.tokenattributes.PositionIncrementAttribute;
+import org.apache.lucene.analysis.tokenattributes.TypeAttribute;
+import org.apache.lucene.index.Payload;
+import org.apache.lucene.luke.core.Util;
+import org.apache.lucene.luke.ui.LukeWindow.LukeMediator;
+import org.apache.lucene.util.Attribute;
+import org.apache.lucene.util.AttributeSource;
+import org.apache.lucene.util.Version;
+import org.apache.pivot.beans.BXML;
+import org.apache.pivot.beans.Bindable;
+import org.apache.pivot.collections.ArrayList;
+import org.apache.pivot.collections.HashMap;
+import org.apache.pivot.collections.List;
+import org.apache.pivot.collections.Map;
+import org.apache.pivot.collections.Sequence;
+import org.apache.pivot.util.Resources;
+import org.apache.pivot.wtk.Action;
+import org.apache.pivot.wtk.Component;
+import org.apache.pivot.wtk.ListButton;
+import org.apache.pivot.wtk.ListView;
+import org.apache.pivot.wtk.ListView.SelectMode;
+import org.apache.pivot.wtk.ListViewSelectionListener;
+import org.apache.pivot.wtk.Span;
+import org.apache.pivot.wtk.TablePane;
+import org.apache.pivot.wtk.TableView;
+import org.apache.pivot.wtk.TextArea;
+
+public class AnalyzersTab extends TablePane implements Bindable {
+
+ @BXML
+ private ListButton analyzersListButton;
+ @BXML
+ private ListButton luceneVersionListButton;
+ @BXML
+ private TextArea inputText;
+ @BXML
+ private TableView tokenAttsTable;
+ @BXML
+ private ListView resultsList;
+
+ private Map<Integer,AttributeSource> attribs;
+
+ public AnalyzersTab() {
+ Action.getNamedActions().put("analyze", new Action() {
+ @Override
+ public void perform(Component component) {
+ analyze();
+ }
+ });
+ }
+
+ public void initLukeMediator(LukeMediator lukeMediator) {
+
+ analyzersListButton.setListData(new ArrayList<String>(lukeMediator
+ .getAnalyzerNames()));
+ analyzersListButton.setSelectedIndex(0);
+ List<String> versions = new ArrayList<String>();
+ Version[] values = Version.values();
+ for (int i = 0; i < values.length; i++) {
+ Version v = values[i];
+ versions.add(v.toString());
+ }
+ luceneVersionListButton.setListData(versions);
+ luceneVersionListButton.setSelectedItem("LUCENE_CURRENT");
+ }
+
+ @Override
+ public void initialize(Map<String,Object> namespace, URL location,
+ Resources resources) {
+ resultsList.setSelectMode(SelectMode.SINGLE);
+ resultsList.getListViewSelectionListeners().add(
+ new ListViewSelectionListener() {
+
+ @Override
+ public void selectedRangesChanged(ListView listView,
+ Sequence<Span> previousSelectedRanges) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void selectedRangeRemoved(ListView listView, int rangeStart,
+ int rangeEnd) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void selectedRangeAdded(ListView listView, int rangeStart,
+ int rangeEnd) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void selectedItemChanged(ListView listView,
+ Object previousSelectedItem) {
+ tokenChange();
+
+ }
+ });
+ }
+
+ public void analyze() {
+ try {
+ Version v = Version.valueOf((String) luceneVersionListButton
+ .getSelectedItem());
+ Class clazz = Class.forName((String) analyzersListButton
+ .getSelectedItem());
+ Analyzer analyzer = null;
+ try {
+ Constructor<Analyzer> c = clazz.getConstructor(Version.class);
+ analyzer = c.newInstance(v);
+ } catch (Throwable t) {
+ try {
+ // no constructor with Version ?
+ analyzer = (Analyzer) clazz.newInstance();
+ } catch (Throwable t1) {
+ t1.printStackTrace();
+ // TODO:
+ // app
+ // .showStatus("Couldn't instantiate analyzer - public 0-arg or 1-arg constructor(Version) required");
+ return;
+ }
+ }
+ attribs = new HashMap<Integer,AttributeSource>();
+ TokenStream ts = analyzer.tokenStream("text",
+ new StringReader(inputText.getText()));
+ List<String> listData = new ArrayList<String>();
+ int cnt = 0;
+ while (ts.incrementToken()) {
+
+ listData.add(((CharTermAttribute) ts
+ .getAttribute(CharTermAttribute.class)).toString());
+
+ attribs.put(cnt, ts.cloneAttributes());
+ cnt++;
+ }
+
+ resultsList.setListData(listData);
+
+ } catch (Throwable t) {
+ t.printStackTrace();
+ // TODO:
+ // app.showStatus("Error analyzing:" + t.getMessage());
+ }
+ tokenChange();
+ }
+
+ public void tokenChange() {
+ int selectedIndex = resultsList.getSelectedIndex();
+ if (selectedIndex == -1) {
+ return;
+ }
+ AttributeSource attribSource = attribs.get(selectedIndex);
+ if (attribSource == null) {
+ return;
+ }
+ Iterator it = attribSource.getAttributeClassesIterator();
+ ArrayList<Map<String,String>> tableData = new ArrayList<Map<String,String>>();
+
+ tokenAttsTable.setTableData(tableData);
+ while (it.hasNext()) {
+ Class cl = (Class) it.next();
+ String attClass = cl.getName();
+ if (attClass.startsWith("org.apache.lucene.")) {
+ attClass = cl.getSimpleName();
+ }
+ Attribute att = attribSource.getAttribute(cl);
+ String implClass = att.getClass().getName();
+ if (implClass.startsWith("org.apache.lucene.")) {
+ implClass = att.getClass().getSimpleName();
+ }
+
+ Map<String,String> row = new HashMap<String,String>();
+
+ tableData.add(row);
+
+ row.put("class", attClass);
+ row.put("impl", implClass);
+
+ String val = null;
+ if (attClass.equals("CharTermAttribute")) {
+ val = ((CharTermAttribute) att).toString();
+ } else if (attClass.equals("FlagsAttribute")) {
+ val = Integer.toHexString(((FlagsAttribute) att).getFlags());
+ } else if (attClass.equals("OffsetAttribute")) {
+ OffsetAttribute off = (OffsetAttribute) att;
+ val = off.startOffset() + "," + off.endOffset();
+ } else if (attClass.equals("PayloadAttribute")) {
+ Payload payload = ((PayloadAttribute) att).getPayload();
+ if (payload != null) {
+ byte[] data = payload.getData();
+ val = Util.bytesToHex(data, 0, data.length, false);
+ } else {
+ val = "";
+ }
+ } else if (attClass.equals("PositionIncrementAttribute")) {
+ val = ((PositionIncrementAttribute) att).getPositionIncrement() + "";
+ } else if (attClass.equals("TypeAttribute")) {
+ val = ((TypeAttribute) att).type();
+ } else {
+ val = att.toString();
+ }
+ row.put("value", val);
+ }
+
+ if (attribSource.hasAttribute(OffsetAttribute.class)) {
+ OffsetAttribute off = (OffsetAttribute) attribSource
+ .getAttribute(OffsetAttribute.class);
+
+ inputText.setSelection(off.startOffset(),
+ off.endOffset() - off.startOffset());
+ inputText.requestFocus();
+ }
+ }
+
+}
Modified: lucene/sandbox/luke/src/org/apache/lucene/luke/ui/LukeApplication_en.json
URL: http://svn.apache.org/viewvc/lucene/sandbox/luke/src/org/apache/lucene/luke/ui/LukeApplication_en.json?rev=1002856&r1=1002855&r2=1002856&view=diff
==============================================================================
--- lucene/sandbox/luke/src/org/apache/lucene/luke/ui/LukeApplication_en.json (original)
+++ lucene/sandbox/luke/src/org/apache/lucene/luke/ui/LukeApplication_en.json Wed Sep 29 21:38:04 2010
@@ -11,6 +11,7 @@
lukeWindow_overviewTabText: "Overview",
lukeWindow_documentsTabText: "Documents",
lukeWindow_searchTabText: "Search",
+ lukeWindow_analyzersTabText: "Analyzers",
lukeWindow_filesTabText: "Files",
lukeWindow_pluginsTabText: "Plugins",
@@ -97,6 +98,16 @@
searchTab_searchTable_col2: "Score",
searchTab_searchTable_col3: "DocId",
+ analyzersTab_welcome: "Welcome to the analysis viewer. This tool is used to demonstrate how different analyzers process text into tokens. You can edit this text to try different input such as numbers like 23231.23 or characters. Once happy, select an Analyzer from the list of analyzers found on the current classpath and then hit the Analyze button. The tokens produced are shown below and when you select them the right panel shows their attributes, and the corresponding span in the original text is highlighted.",
+ analyzersTab_availableAnalyzers: "Available analyzers found on the current classpath:",
+ analyzersTab_compatibility: "Compatibility:",
+ analyzersTab_textToBeAnalyzed: "Text to be analyzed:",
+ analyzersTab_tokens: "Tokens created by the analyzer:",
+ analyzersTab_tokenAttribs: "Token attributes:",
+ analyzersTab_tokenAttsTable_col1: "Class",
+ analyzersTab_tokenAttsTable_col2: "Implementation",
+ analyzersTab_tokenAttsTable_col3: "Value",
+
filesTab_selectHint: "Hint: use Shift-Click to select ranges, or Ctrl-Click to select multiple fields (or unselect all).",
filesTab_commitsTable_col1: "Gen",
filesTab_commitsTable_col2: "Flags",
Modified: lucene/sandbox/luke/src/org/apache/lucene/luke/ui/LukeWindow.bxml
URL: http://svn.apache.org/viewvc/lucene/sandbox/luke/src/org/apache/lucene/luke/ui/LukeWindow.bxml?rev=1002856&r1=1002855&r2=1002856&view=diff
==============================================================================
--- lucene/sandbox/luke/src/org/apache/lucene/luke/ui/LukeWindow.bxml (original)
+++ lucene/sandbox/luke/src/org/apache/lucene/luke/ui/LukeWindow.bxml Wed Sep 29 21:38:04 2010
@@ -104,6 +104,16 @@
<bxml:include bxml:id="searchTab" src="SearchTab.bxml" />
</content>
</Border>
+
+ <Border styles="{backgroundColor:11}">
+ <TabPane.tabData>
+ <content:ButtonData icon="img/terms.gif" text="%lukeWindow_analyzersTabText" />
+ </TabPane.tabData>
+
+ <content>
+ <bxml:include bxml:id="analyzersTab" src="AnalyzersTab.bxml" />
+ </content>
+ </Border>
<Border>
<TabPane.tabData>
Modified: lucene/sandbox/luke/src/org/apache/lucene/luke/ui/LukeWindow.java
URL: http://svn.apache.org/viewvc/lucene/sandbox/luke/src/org/apache/lucene/luke/ui/LukeWindow.java?rev=1002856&r1=1002855&r2=1002856&view=diff
==============================================================================
--- lucene/sandbox/luke/src/org/apache/lucene/luke/ui/LukeWindow.java (original)
+++ lucene/sandbox/luke/src/org/apache/lucene/luke/ui/LukeWindow.java Wed Sep 29 21:38:04 2010
@@ -18,21 +18,30 @@ package org.apache.lucene.luke.ui;
*/
import java.io.File;
+import java.io.IOException;
import java.lang.reflect.Constructor;
import java.net.URL;
+import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
+import java.util.HashSet;
+import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.core.SimpleAnalyzer;
+import org.apache.lucene.analysis.core.StopAnalyzer;
+import org.apache.lucene.analysis.core.WhitespaceAnalyzer;
+import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.index.IndexCommit;
import org.apache.lucene.index.IndexDeletionPolicy;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.IndexWriterConfig;
import org.apache.lucene.index.MultiReader;
+import org.apache.lucene.luke.core.ClassFinder;
import org.apache.lucene.luke.core.IndexInfo;
import org.apache.lucene.luke.core.KeepAllIndexDeletionPolicy;
import org.apache.lucene.luke.core.KeepLastIndexDeletionPolicy;
+import org.apache.lucene.luke.core.Prefs;
import org.apache.lucene.luke.core.decoders.Decoder;
import org.apache.lucene.luke.core.decoders.StringDecoder;
import org.apache.lucene.store.Directory;
@@ -41,6 +50,7 @@ import org.apache.lucene.store.RAMDirect
import org.apache.lucene.util.Version;
import org.apache.pivot.beans.BXML;
import org.apache.pivot.beans.Bindable;
+import org.apache.pivot.collections.ArrayList;
import org.apache.pivot.collections.Map;
import org.apache.pivot.util.Resources;
import org.apache.pivot.wtk.Alert;
@@ -64,14 +74,21 @@ public class LukeWindow extends Frame im
private SearchTab searchTab;
@BXML
private OverviewTab overviewTab;
+ @BXML
+ private AnalyzersTab analyzersTab;
private LukeMediator lukeMediator = new LukeMediator();
+ private Class[] analyzers = null;
+ private Class[] defaultAnalyzers = { SimpleAnalyzer.class, StandardAnalyzer.class, StopAnalyzer.class,
+ WhitespaceAnalyzer.class };
+
private String baseDir;
+ private String[] analyzerNames;
- public LukeWindow() {
-
+ public LukeWindow() throws IOException, ClassNotFoundException {
+ populateAnalyzers();
}
public void openLukeWindow(Display display) {
@@ -84,6 +101,28 @@ public class LukeWindow extends Frame im
}
/**
+ * Populate a combobox with the current list of analyzers.
+ * @param combo
+ * @throws ClassNotFoundException
+ * @throws IOException
+ */
+ public void populateAnalyzers() throws IOException, ClassNotFoundException {
+ Class[] an = ClassFinder.getInstantiableSubclasses(Analyzer.class);
+ if (an == null || an.length == 0) {
+ System.err.println("No analyzers???");
+ analyzers = defaultAnalyzers;
+ } else {
+ HashSet<Class> uniq = new HashSet<Class>(Arrays.asList(an));
+ analyzers = (Class[])uniq.toArray(new Class[uniq.size()]);
+ }
+ analyzerNames = new String[analyzers.length];
+ for (int i = 0; i < analyzers.length; i++) {
+ analyzerNames[i] = analyzers[i].getName();
+ }
+ Arrays.sort(analyzerNames);
+ }
+
+ /**
* Open indicated index and re-initialize all GUI and plugins.
*
* @param pName
@@ -299,6 +338,7 @@ public class LukeWindow extends Frame im
overviewTab.initLukeMediator(lukeMediator);
filesTab.initLukeMediator(lukeMediator);
searchTab.initLukeMediator(lukeMediator);
+ analyzersTab.initLukeMediator(lukeMediator);
lukeInitWindow.initLukeMediator(lukeMediator);
}
@@ -338,6 +378,10 @@ public class LukeWindow extends Frame im
public LukeWindow getLukeWindow() {
return LukeWindow.this;
}
+
+ public String[] getAnalyzerNames() {
+ return analyzerNames;
+ }
}
}
\ No newline at end of file
Modified: lucene/sandbox/luke/src/org/apache/lucene/luke/ui/SearchTab.java
URL: http://svn.apache.org/viewvc/lucene/sandbox/luke/src/org/apache/lucene/luke/ui/SearchTab.java?rev=1002856&r1=1002855&r2=1002856&view=diff
==============================================================================
--- lucene/sandbox/luke/src/org/apache/lucene/luke/ui/SearchTab.java (original)
+++ lucene/sandbox/luke/src/org/apache/lucene/luke/ui/SearchTab.java Wed Sep 29 21:38:04 2010
@@ -21,20 +21,14 @@ import java.io.IOException;
import java.lang.reflect.Constructor;
import java.net.URL;
import java.text.DecimalFormat;
-import java.util.Arrays;
-import java.util.HashSet;
import java.util.List;
import org.apache.lucene.analysis.Analyzer;
-import org.apache.lucene.analysis.core.SimpleAnalyzer;
-import org.apache.lucene.analysis.core.StopAnalyzer;
-import org.apache.lucene.analysis.core.WhitespaceAnalyzer;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Fieldable;
import org.apache.lucene.luke.core.AccessibleHitCollector;
import org.apache.lucene.luke.core.AccessibleTopHitCollector;
-import org.apache.lucene.luke.core.ClassFinder;
import org.apache.lucene.luke.core.IndexInfo;
import org.apache.lucene.luke.core.LimitedException;
import org.apache.lucene.luke.core.Prefs;
@@ -74,10 +68,7 @@ public class SearchTab extends SplitPane
private LukeMediator lukeMediator;
private Analyzer stdAnalyzer = new StandardAnalyzer(Version.LUCENE_CURRENT);
-
- private Class[] analyzers = null;
- private Class[] defaultAnalyzers = { SimpleAnalyzer.class, StandardAnalyzer.class, StopAnalyzer.class,
- WhitespaceAnalyzer.class };
+
@BXML
private TextArea queryTextArea;
@@ -114,6 +105,7 @@ public class SearchTab extends SplitPane
}
});
+
}
@Override
@@ -124,7 +116,11 @@ public class SearchTab extends SplitPane
public void initLukeMediator(LukeMediator lukeMediator) {
this.lukeMediator = lukeMediator;
+ String lastAnalyzer = Prefs.getProperty(Prefs.P_ANALYZER);
+ if (lastAnalyzer != null) analyzerList.setSelectedItem(lastAnalyzer);
+ analyzerList.setListData(new ArrayList<String>(lukeMediator.getAnalyzerNames()));
+ analyzerList.setSelectedIndex(0);
}
/**
@@ -134,7 +130,6 @@ public class SearchTab extends SplitPane
*/
public void onOpenIndex() throws Exception {
this.indexInfo = lukeMediator.getIndexInfo();
- populateAnalyzers();
}
/**
@@ -599,34 +594,6 @@ public class SearchTab extends SplitPane
}
}
-
- /**
- * Populate a combobox with the current list of analyzers.
- * @param combo
- * @throws ClassNotFoundException
- * @throws IOException
- */
- public void populateAnalyzers() throws IOException, ClassNotFoundException {
- Class[] an = ClassFinder.getInstantiableSubclasses(Analyzer.class);
- if (an == null || an.length == 0) {
- System.err.println("No analyzers???");
- analyzers = defaultAnalyzers;
- } else {
- HashSet<Class> uniq = new HashSet<Class>(Arrays.asList(an));
- analyzers = (Class[])uniq.toArray(new Class[uniq.size()]);
- }
- String[] aNames = new String[analyzers.length];
- for (int i = 0; i < analyzers.length; i++) {
- aNames[i] = analyzers[i].getName();
- }
- Arrays.sort(aNames);
-
- String lastAnalyzer = Prefs.getProperty(Prefs.P_ANALYZER);
- if (lastAnalyzer != null) analyzerList.setSelectedItem(lastAnalyzer);
-
- analyzerList.setListData(new ArrayList(aNames));
- analyzerList.setSelectedIndex(0);
- }
private void errorMsg(String error) {