Revision 76a8b44f
Added by Patrick Plitzner over 6 years ago
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/BulkEditorE4.java | ||
---|---|---|
13 | 13 |
import java.util.List; |
14 | 14 |
|
15 | 15 |
import javax.annotation.PostConstruct; |
16 |
import javax.annotation.PreDestroy; |
|
16 | 17 |
import javax.inject.Inject; |
17 | 18 |
|
18 | 19 |
import org.eclipse.core.runtime.IProgressMonitor; |
... | ... | |
91 | 92 |
|
92 | 93 |
public void init(AbstractBulkEditorInput<?> input){ |
93 | 94 |
this.input = input; |
94 |
AbstractBulkEditorInput<?> bulkEditorInput = input; |
|
95 |
this.conversation = input.getConversation(); |
|
96 |
|
|
95 | 97 |
BulkEditorSearchE4 searchBar = new BulkEditorSearchE4(this, topComposite, SWT.NONE); |
96 | 98 |
//layout needed because the search bar is added after @PostConstuct method |
97 | 99 |
topComposite.getParent().layout(); |
... | ... | |
149 | 151 |
} |
150 | 152 |
}); |
151 | 153 |
|
152 |
if(bulkEditorInput.getEntityUuid()!=null){
|
|
153 |
performSearch(new BulkEditorQuery(bulkEditorInput.getEntityUuid().toString(), null));
|
|
154 |
if(input.getEntityUuid()!=null){
|
|
155 |
performSearch(new BulkEditorQuery(input.getEntityUuid().toString(), null));
|
|
154 | 156 |
} |
155 | 157 |
} |
156 | 158 |
|
157 | 159 |
/** {@inheritDoc} */ |
158 | 160 |
@PostConstruct |
159 | 161 |
public void createPartControl(Composite parent, EMenuService menuService) { |
160 |
if (CdmStore.isActive()){ |
|
161 |
if(conversation == null){ |
|
162 |
conversation = CdmStore.createConversation(); |
|
163 |
} |
|
164 |
} |
|
165 |
else{ |
|
166 |
return; |
|
167 |
} |
|
168 |
|
|
169 | 162 |
parent.setLayout(new GridLayout()); |
170 | 163 |
|
171 | 164 |
topComposite = new Composite(parent, SWT.NONE); |
... | ... | |
197 | 190 |
save(monitor, true); |
198 | 191 |
} |
199 | 192 |
|
193 |
@PreDestroy |
|
194 |
public void dispose() { |
|
195 |
if(conversation!=null){ |
|
196 |
conversation.unregisterForDataStoreChanges(this); |
|
197 |
conversation.close(); |
|
198 |
} |
|
199 |
if(input!=null){ |
|
200 |
input.dispose(); |
|
201 |
} |
|
202 |
} |
|
203 |
|
|
200 | 204 |
public void save(IProgressMonitor monitor, boolean resetMerge) { |
201 | 205 |
input.saveModel(resetMerge); |
202 | 206 |
|
Also available in: Unified diff
ref #6925 Dispose conversation and entity session when closing editors