Revision f6b03570
Added by Patrick Plitzner over 10 years ago
- fixed selection of DerivateSearch result table
- double-click now opens DerivateView
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/DerivateView.java | ||
---|---|---|
13 | 13 |
import org.eclipse.ui.PartInitException; |
14 | 14 |
import org.eclipse.ui.part.EditorPart; |
15 | 15 |
|
16 |
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacadeCacheStrategy; |
|
17 |
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase; |
|
16 | 18 |
import eu.etaxonomy.taxeditor.model.IPartContentHasDetails; |
17 | 19 |
import eu.etaxonomy.taxeditor.model.IPartContentHasSupplementalData; |
18 | 20 |
|
... | ... | |
27 | 29 |
|
28 | 30 |
protected TreeViewer viewer; |
29 | 31 |
|
32 |
private SpecimenOrObservationBase<DerivedUnitFacadeCacheStrategy> derivate; |
|
33 |
|
|
30 | 34 |
/* (non-Javadoc) |
31 | 35 |
* @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite) |
32 | 36 |
*/ |
... | ... | |
49 | 53 |
|
50 | 54 |
control.setMenu(menu); |
51 | 55 |
|
56 |
|
|
57 |
viewer.setInput(derivate); |
|
52 | 58 |
} |
53 | 59 |
|
54 | 60 |
/* (non-Javadoc) |
... | ... | |
69 | 75 |
|
70 | 76 |
} |
71 | 77 |
|
78 |
/* (non-Javadoc) |
|
79 |
* @see org.eclipse.ui.part.EditorPart#getTitleToolTip() |
|
80 |
*/ |
|
81 |
@Override |
|
82 |
public String getTitleToolTip() { |
|
83 |
// TODO Auto-generated method stub |
|
84 |
return "Derivate View"; |
|
85 |
} |
|
86 |
|
|
72 | 87 |
/* (non-Javadoc) |
73 | 88 |
* @see org.eclipse.ui.part.EditorPart#init(org.eclipse.ui.IEditorSite, org.eclipse.ui.IEditorInput) |
74 | 89 |
*/ |
75 | 90 |
@Override |
76 | 91 |
public void init(IEditorSite site, IEditorInput input) throws PartInitException { |
77 |
viewer.setInput(input); |
|
92 |
setSite(site); |
|
93 |
setInput(input); |
|
94 |
if(input instanceof DerivateViewEditorInput){ |
|
95 |
derivate = ((DerivateViewEditorInput) input).getDerivate(); |
|
96 |
} |
|
97 |
else{ |
|
98 |
throw new PartInitException("Invalid Input: Must be DerivateViewEditorInput"); |
|
99 |
} |
|
78 | 100 |
} |
79 | 101 |
|
80 | 102 |
/* (non-Javadoc) |
... | ... | |
105 | 127 |
|
106 | 128 |
} |
107 | 129 |
|
108 |
// @Override |
|
109 |
// public void createViewer(Composite parent) { |
|
110 |
// viewer = new TreeViewer(new Tree(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION)); |
|
111 |
// viewer.setContentProvider(new DerivateContentProvider()); |
|
112 |
// viewer.setLabelProvider(new DerivateLabelProvider()); |
|
113 |
// viewer.setAutoExpandLevel(2); |
|
114 |
// // Propagate selection from viewer |
|
115 |
// getSite().setSelectionProvider(viewer); |
|
116 |
// |
|
117 |
// //create context menu |
|
118 |
// MenuManager menuManager = new MenuManager(); |
|
119 |
// |
|
120 |
// getSite().registerContextMenu(menuManager, viewer); |
|
121 |
// |
|
122 |
// Control control = viewer.getControl(); |
|
123 |
// Menu menu = menuManager.createContextMenu(control); |
|
124 |
// |
|
125 |
// control.setMenu(menu); |
|
126 |
// } |
|
127 |
// |
|
128 |
// @Override |
|
129 |
// public void selectionChanged(IWorkbenchPart part, ISelection selection) { |
|
130 |
// if(AbstractUtility.getActiveEditor()==null || !(AbstractUtility.getActiveEditor() instanceof BulkEditor)){ |
|
131 |
// showEmptyPage(); |
|
132 |
// return; |
|
133 |
// } |
|
134 |
// else if(part instanceof BulkEditor){ |
|
135 |
// this.part = part; |
|
136 |
// |
|
137 |
// getViewer().setInput(selection); |
|
138 |
// |
|
139 |
// showViewer(); |
|
140 |
// return; |
|
141 |
// } |
|
142 |
// } |
|
143 |
// |
|
144 |
// @Override |
|
145 |
// public boolean onComplete() { |
|
146 |
// // TODO Auto-generated method stub |
|
147 |
// return false; |
|
148 |
// } |
|
149 |
// |
|
150 |
// @Override |
|
151 |
// public Viewer getViewer() { |
|
152 |
// return viewer; |
|
153 |
// } |
|
154 |
// |
|
155 |
// |
|
156 |
// @Override |
|
157 |
// public boolean postOperation(CdmBase objectAffectedByOperation) { |
|
158 |
// return super.postOperation(objectAffectedByOperation); |
|
159 |
// } |
|
160 |
|
|
161 |
|
|
162 | 130 |
} |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/DerivateViewEditorInput.java | ||
---|---|---|
15 | 15 |
import org.eclipse.ui.IEditorInput; |
16 | 16 |
import org.eclipse.ui.IPersistableElement; |
17 | 17 |
|
18 |
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacadeCacheStrategy; |
|
19 |
import eu.etaxonomy.cdm.api.service.IOccurrenceService; |
|
20 |
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase; |
|
21 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
|
22 |
|
|
18 | 23 |
/** |
19 | 24 |
* @author pplitzner |
20 | 25 |
* @date 25.11.2013 |
... | ... | |
46 | 51 |
*/ |
47 | 52 |
@Override |
48 | 53 |
public boolean exists() { |
49 |
// TODO Auto-generated method stub |
|
50 | 54 |
return false; |
51 | 55 |
} |
52 | 56 |
|
... | ... | |
64 | 68 |
*/ |
65 | 69 |
@Override |
66 | 70 |
public String getName() { |
67 |
// TODO Auto-generated method stub |
|
68 |
return null; |
|
71 |
return uuid.toString(); |
|
69 | 72 |
} |
70 | 73 |
|
71 | 74 |
/* (non-Javadoc) |
... | ... | |
81 | 84 |
*/ |
82 | 85 |
@Override |
83 | 86 |
public String getToolTipText() { |
84 |
// TODO Auto-generated method stub |
|
85 |
return null; |
|
87 |
return uuid.toString(); |
|
88 |
} |
|
89 |
|
|
90 |
public SpecimenOrObservationBase<DerivedUnitFacadeCacheStrategy> getDerivate(){ |
|
91 |
IOccurrenceService service = CdmStore.getService(IOccurrenceService.class); |
|
92 |
return service.find(uuid); |
|
86 | 93 |
} |
87 | 94 |
|
88 | 95 |
|
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/campanula/derivatesearch/DerivateSearchCompositeController.java | ||
---|---|---|
22 | 22 |
import org.eclipse.swt.SWT; |
23 | 23 |
import org.eclipse.swt.events.KeyAdapter; |
24 | 24 |
import org.eclipse.swt.events.KeyEvent; |
25 |
import org.eclipse.swt.widgets.Composite; |
|
25 | 26 |
import org.eclipse.ui.handlers.IHandlerService; |
26 | 27 |
|
27 | 28 |
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacadeCacheStrategy; |
... | ... | |
42 | 43 |
private IIdentifiableEntityServiceConfigurator<SpecimenOrObservationBase<DerivedUnitFacadeCacheStrategy>> configurator; |
43 | 44 |
|
44 | 45 |
/** |
45 |
* @param derivateSearchComposite
|
|
46 |
* @param parent
|
|
46 | 47 |
*/ |
47 |
public DerivateSearchCompositeController(DerivateSearchComposite derivateSearchComposite) {
|
|
48 |
this.derivateSearchComposite = derivateSearchComposite;
|
|
48 |
public DerivateSearchCompositeController(Composite parent) {
|
|
49 |
this.derivateSearchComposite = new DerivateSearchComposite(parent, SWT.NONE);
|
|
49 | 50 |
init(); |
50 | 51 |
} |
51 | 52 |
|
... | ... | |
97 | 98 |
derivateSearchComposite.getResultViewer().setInput(results); |
98 | 99 |
} |
99 | 100 |
|
101 |
|
|
102 |
/** |
|
103 |
* @return the derivateSearchComposite |
|
104 |
*/ |
|
105 |
public DerivateSearchComposite getDerivateSearchComposite() { |
|
106 |
return derivateSearchComposite; |
|
107 |
} |
|
108 |
|
|
100 | 109 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/campanula/derivatesearch/DerivateSearchView.java | ||
---|---|---|
9 | 9 |
*/ |
10 | 10 |
package eu.etaxonomy.taxeditor.ui.campanula.derivatesearch; |
11 | 11 |
|
12 |
import org.eclipse.swt.SWT; |
|
13 | 12 |
import org.eclipse.swt.widgets.Composite; |
14 | 13 |
import org.eclipse.ui.part.ViewPart; |
15 | 14 |
|
... | ... | |
27 | 26 |
*/ |
28 | 27 |
@Override |
29 | 28 |
public void createPartControl(Composite parent) { |
30 |
new DerivateSearchCompositeController(new DerivateSearchComposite(parent, SWT.NONE)); |
|
29 |
DerivateSearchCompositeController derivateSearchCompositeController = new DerivateSearchCompositeController(parent); |
|
30 |
getSite().setSelectionProvider(derivateSearchCompositeController.getDerivateSearchComposite().getResultViewer()); |
|
31 | 31 |
} |
32 | 32 |
|
33 | 33 |
/* (non-Javadoc) |
Also available in: Unified diff