Revision db033747
Added by Patrick Plitzner over 6 years ago
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/search/SearchBar.java | ||
---|---|---|
13 | 13 |
import javax.inject.Inject; |
14 | 14 |
|
15 | 15 |
import org.eclipse.core.runtime.IProgressMonitor; |
16 |
import org.eclipse.e4.ui.model.application.MApplication; |
|
16 | 17 |
import org.eclipse.e4.ui.model.application.ui.basic.MPart; |
18 |
import org.eclipse.e4.ui.model.application.ui.basic.MPartStack; |
|
19 |
import org.eclipse.e4.ui.workbench.modeling.EModelService; |
|
17 | 20 |
import org.eclipse.e4.ui.workbench.modeling.EPartService; |
18 | 21 |
import org.eclipse.e4.ui.workbench.modeling.EPartService.PartState; |
19 | 22 |
import org.eclipse.swt.SWT; |
... | ... | |
47 | 50 |
import eu.etaxonomy.taxeditor.preference.PreferencesUtil; |
48 | 51 |
import eu.etaxonomy.taxeditor.preference.Resources; |
49 | 52 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
53 |
import eu.etaxonomy.taxeditor.workbench.WorkbenchUtility; |
|
50 | 54 |
|
51 | 55 |
/** |
52 | 56 |
* @author n.hoffmann |
... | ... | |
55 | 59 |
* @version 1.0 |
56 | 60 |
*/ |
57 | 61 |
public class SearchBar implements IContextListener{ |
58 |
private Text text_search; |
|
62 |
|
|
63 |
public static final String NAVIGATION_STACK_ID = "navigation"; |
|
64 |
|
|
65 |
private Text text_search; |
|
59 | 66 |
private ToolBar toolBar; |
60 | 67 |
|
61 | 68 |
private final String defaultText = Messages.SearchBar_0; |
... | ... | |
63 | 70 |
@Inject |
64 | 71 |
private EPartService partService; |
65 | 72 |
|
73 |
@Inject |
|
74 |
private MApplication application; |
|
75 |
|
|
76 |
@Inject |
|
77 |
private EModelService modelService; |
|
78 |
|
|
66 | 79 |
final private ConfigurationSelectionListener configurationListener = new ConfigurationSelectionListener(); |
67 | 80 |
|
68 | 81 |
/** {@inheritDoc} */ |
... | ... | |
213 | 226 |
*/ |
214 | 227 |
private void openSearchResultsView(IFindTaxaAndNamesConfigurator configurator) { |
215 | 228 |
boolean openResultInSeparateWindows = PreferencesUtil.getPreferenceStore().getBoolean((IPreferenceKeys.SEARCH_OPEN_RESULTS_IN_SEPARATE_WINDOWS)); |
216 |
|
|
217 |
MPart part = partService.createPart("eu.etaxonomy.taxeditor.navigation.search.e4.SearchResultViewE4"); |
|
229 |
String partId = "eu.etaxonomy.taxeditor.navigation.search.e4.SearchResultViewE4"; |
|
230 |
|
|
231 |
MPart part = partService.findPart(partId); |
|
232 |
if(openResultInSeparateWindows && part.getObject()!=null){ |
|
233 |
part = partService.createPart(partId); |
|
234 |
//FIXME E4 this part stack id has to re-used or a adapted after migration |
|
235 |
MPartStack editorAreaPartStack = WorkbenchUtility.getPartStack(NAVIGATION_STACK_ID, application, modelService); |
|
236 |
if(editorAreaPartStack!=null){ |
|
237 |
editorAreaPartStack.getChildren().add(part); |
|
238 |
} |
|
239 |
} |
|
218 | 240 |
part = partService.showPart(part, PartState.ACTIVATE); |
219 | 241 |
SearchResultViewE4 resultView = (SearchResultViewE4)part.getObject(); |
220 | 242 |
resultView.performSearch(configurator); |
243 |
|
|
221 | 244 |
} |
222 | 245 |
|
223 | 246 |
/** |
Also available in: Unified diff
ref #6990 Evaluate preferences for search results