use of org.jboss.tools.hibernate.search.toolkit.analyzers.AnalyzersCombo in project jbosstools-hibernate by jbosstools.
the class SearchTabBuilder method buildTab.
protected Composite buildTab(CTabFolder folder, ConsoleConfiguration consoleConfig) {
final String consoleConfigName = consoleConfig.getName();
Composite container = new Composite(folder, SWT.VERTICAL);
container.setLayout(new GridLayout());
Composite entitiesContainer = new Composite(container, SWT.TOP);
GridData entitiesGridData = new GridData(SWT.FILL, SWT.BEGINNING, true, false);
entitiesContainer.setLayoutData(entitiesGridData);
createEntityCombo(entitiesContainer, consoleConfig);
entitiesContainer.pack();
Composite searchDataComposite = new Composite(container, SWT.TOP);
searchDataComposite.setLayout(new GridLayout(2, true));
final Text query = new Text(searchDataComposite, SWT.MULTI | SWT.BORDER);
GridData queryGridData = new GridData(GridData.FILL, GridData.BEGINNING, true, false);
queryGridData.heightHint = 5 * query.getLineHeight();
queryGridData.verticalSpan = 2;
query.setLayoutData(queryGridData);
analyzersCombo = new AnalyzersCombo(searchDataComposite, new GridData(), consoleConfigName);
Button searchButton = new Button(searchDataComposite, SWT.PUSH);
searchButton.setText("Search");
searchButton.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event event) {
ClassLoader classloader = ConsoleConfigurationUtils.getClassLoader(consoleConfig);
Class<?> entity = null;
try {
entity = Class.forName(entityCombo.getText(), true, classloader);
} catch (ClassNotFoundException e) {
entity = null;
}
IHSearchService service = HSearchServiceLookup.findService(HSearchConsoleConfigurationPreferences.getHSearchVersion(consoleConfigName));
resultTable.showResults(service.search(consoleConfig.getSessionFactory(), entity, fieldsCombo.getText(), analyzersCombo.getAnalyzer(), query.getText()), consoleConfig.getSessionFactory().getAllClassMetadata().get(entityCombo.getText()));
}
});
searchDataComposite.pack();
this.resultTable = new SearchResultTable(container, consoleConfig);
// container.pack();
container.update();
return container;
}
Aggregations