Note that there are some explanatory texts on larger screens.

plurals
  1. POImplemention Class proposal mechanism in SWT field
    text
    copied!<p>i know how to implement it,using field assist and search pattern, but the mechanism each time triggers a new search. I am not sure, how the mechanism is implemented in Open Type for example ( i think with indexes). How to use this cache to make in time classpath search</p> <p>This almost my entire solution. Each time a call createProposalData </p> <pre><code>private TreeSet&lt;String&gt; data; private SearchParticipant[] participants = new SearchParticipant[] { SearchEngine .getDefaultSearchParticipant() }; private SearchPattern pattern; private IJavaProject prj; private JavaSearchScope scope; private SearchEngine searchEngine = new SearchEngine(); private SearchRequestor requestor = new SearchRequestor() { @Override public void acceptSearchMatch(SearchMatch match) throws CoreException { String text = getText(match.getElement()); if (text != null) { data.add(text); } } public String getText(Object element) { ... } }; public ProposalEngine(IJavaProject prj) { super(); this.prj = prj; scope = new JavaSearchScope(); try { scope.add(prj); } catch (JavaModelException e) { // } } public Collection&lt;String&gt; createProposalData(final String patternText) { data = new TreeSet&lt;String&gt;(); try { pattern = getPatternForSeach(patternText); searchEngine.search(pattern, participants, scope, requestor, null); } catch (Exception e) { // skip } return data; } protected SearchPattern getPatternForSeach(String patternText) { return SearchPattern.createPattern(patternText, IJavaSearchConstants.CLASS_AND_INTERFACE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH); } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload