Project

General

Profile

« Previous | Next » 

Revision db033747

Added by Patrick Plitzner over 6 years ago

ref #6990 Evaluate preferences for search results

  • open in navigation part stack

View differences:

eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/perspective/Taxonomic.java
12 12
import org.eclipse.ui.IFolderLayout;
13 13
import org.eclipse.ui.IPageLayout;
14 14

  
15
import eu.etaxonomy.taxeditor.navigation.search.SearchBar;
16

  
15 17
/**
16 18
 * @author n.hoffmann
17 19
 * @created Jan 17, 2011
......
19 21
 */
20 22
public class Taxonomic extends Default {
21 23

  
22
	@Override
24
    @Override
23 25
	public void createInitialLayout(IPageLayout layout) {
24
		IFolderLayout navigationFolder = layout.createFolder("navigation", IPageLayout.LEFT, 0.25f, layout.getEditorArea());
26
		IFolderLayout navigationFolder = layout.createFolder(SearchBar.NAVIGATION_STACK_ID, IPageLayout.LEFT, 0.25f, layout.getEditorArea());
25 27

  
26 28
		navigationFolder.addView(NAVIGATOR);
27 29
		navigationFolder.addPlaceholder(SEARCH_RESULTS);
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
	/**
eu.etaxonomy.taxeditor.workbench/src/main/java/eu/etaxonomy/taxeditor/workbench/WorkbenchUtility.java
56 56
        return null;
57 57
    }
58 58

  
59

  
60
    public static MPartStack getPartStack(String stackId, MApplication application, EModelService modelService){
61
        if(application!=null){
62
            List<MPartStack> stacks = modelService.findElements(application, stackId, MPartStack.class, null);
63
            if(!stacks.isEmpty()){
64
                return stacks.iterator().next();
65
            }
66
        }
67
        return null;
68
    }
69

  
59 70
    public static MPartStack getEditorAreaPartStack(MApplication application, EModelService modelService){
60 71
        //FIXME E4 hack for opening in e3 editor area
61 72
        if(application!=null){

Also available in: Unified diff