View Javadoc
1   package org.argeo.connect.e4.handlers;
2   
3   import javax.inject.Inject;
4   import javax.inject.Named;
5   
6   import org.apache.commons.logging.Log;
7   import org.apache.commons.logging.LogFactory;
8   import org.argeo.connect.ui.SystemWorkbenchService;
9   import org.eclipse.e4.core.di.annotations.Execute;
10  
11  /** Open an editor to display a filtered table for a given JCR Node type */
12  public class OpenSearchEntityEditor {
13  	private final static Log log = LogFactory.getLog(OpenSearchEntityEditor.class);
14  
15  	// public final static String ID = ConnectUiPlugin.PLUGIN_ID +
16  	// ".openSearchEntityEditor";
17  
18  	public final static String PARAM_NODE_TYPE = "nodeType";
19  	public final static String PARAM_LABEL = "label";
20  	// public final static String PARAM_BASE_PATH = "basePath";
21  
22  	@Inject
23  	private SystemWorkbenchService systemWorkbenchService;
24  
25  	@Execute
26  	public void execute(@Named(PARAM_NODE_TYPE) String entityType, @Named(PARAM_LABEL) String label) {
27  		// String entityType = event.getParameter(PARAM_NODE_TYPE);
28  		// String basePath = event.getParameter(PARAM_BASE_PATH);
29  		// String name = event.getParameter(PARAM_EDITOR_NAME);
30  
31  		String editorId = systemWorkbenchService.getSearchEntityEditorId(entityType);
32  		if (editorId == null) {
33  			log.warn("No editor ID found for " + entityType);
34  			return;
35  		}
36  		systemWorkbenchService.openSearchEntityView(entityType, label);
37  		// try {
38  		// SearchNodeEditorInput eei = new SearchNodeEditorInput(entityType, basePath,
39  		// name);
40  		// HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().openEditor(eei,
41  		// editorId);
42  		// } catch (PartInitException pie) {
43  		// throw new ConnectException("Cannot open search editor for " + entityType,
44  		// pie);
45  		// }
46  		// return null;
47  	}
48  
49  	// public void setSystemWorkbenchService(SystemWorkbenchService
50  	// systemWorkbenchService) {
51  	// this.systemWorkbenchService = systemWorkbenchService;
52  	// }
53  }