2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
10 package eu
.etaxonomy
.taxeditor
.editor
.view
.checklist
;
12 import java
.util
.ArrayList
;
13 import java
.util
.Arrays
;
14 import java
.util
.Collections
;
15 import java
.util
.HashMap
;
16 import java
.util
.List
;
18 import java
.util
.SortedSet
;
20 import org
.apache
.log4j
.Logger
;
21 import org
.eclipse
.core
.runtime
.IProgressMonitor
;
22 import org
.eclipse
.core
.runtime
.IStatus
;
23 import org
.eclipse
.core
.runtime
.Status
;
24 import org
.eclipse
.core
.runtime
.jobs
.Job
;
25 import org
.eclipse
.jface
.viewers
.ISelection
;
26 import org
.eclipse
.jface
.viewers
.StructuredViewer
;
27 import org
.eclipse
.jface
.viewers
.TableViewer
;
28 import org
.eclipse
.jface
.viewers
.TableViewerColumn
;
29 import org
.eclipse
.swt
.SWT
;
30 import org
.eclipse
.swt
.events
.ModifyListener
;
31 import org
.eclipse
.swt
.events
.SelectionAdapter
;
32 import org
.eclipse
.swt
.events
.SelectionEvent
;
33 import org
.eclipse
.swt
.layout
.GridData
;
34 import org
.eclipse
.swt
.layout
.GridLayout
;
35 import org
.eclipse
.swt
.widgets
.Composite
;
36 import org
.eclipse
.swt
.widgets
.Display
;
37 import org
.eclipse
.swt
.widgets
.Label
;
38 import org
.eclipse
.swt
.widgets
.Menu
;
39 import org
.eclipse
.swt
.widgets
.MenuItem
;
40 import org
.eclipse
.swt
.widgets
.Table
;
41 import org
.eclipse
.swt
.widgets
.TableColumn
;
42 import org
.eclipse
.swt
.widgets
.Text
;
43 import org
.eclipse
.swt
.widgets
.ToolBar
;
44 import org
.eclipse
.swt
.widgets
.ToolItem
;
45 import org
.eclipse
.ui
.IEditorInput
;
46 import org
.eclipse
.ui
.IEditorSite
;
47 import org
.eclipse
.ui
.IMemento
;
48 import org
.eclipse
.ui
.ISelectionListener
;
49 import org
.eclipse
.ui
.ISelectionService
;
50 import org
.eclipse
.ui
.IWorkbenchPart
;
51 import org
.eclipse
.ui
.PartInitException
;
52 import org
.eclipse
.ui
.part
.EditorPart
;
53 import org
.eclipse
.ui
.progress
.IWorkbenchSiteProgressService
;
55 import eu
.etaxonomy
.cdm
.api
.conversation
.ConversationHolder
;
56 import eu
.etaxonomy
.cdm
.api
.conversation
.IConversationEnabled
;
57 import eu
.etaxonomy
.cdm
.api
.service
.ITaxonNodeService
;
58 import eu
.etaxonomy
.cdm
.hibernate
.HibernateProxyHelper
;
59 import eu
.etaxonomy
.cdm
.model
.common
.DefinedTermBase
;
60 import eu
.etaxonomy
.cdm
.model
.taxon
.Classification
;
61 import eu
.etaxonomy
.cdm
.model
.taxon
.Taxon
;
62 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonNode
;
63 import eu
.etaxonomy
.cdm
.persistence
.hibernate
.CdmDataChangeMap
;
64 import eu
.etaxonomy
.taxeditor
.editor
.EditorUtil
;
65 import eu
.etaxonomy
.taxeditor
.editor
.SimpleSelectionProvider
;
66 import eu
.etaxonomy
.taxeditor
.editor
.l10n
.Messages
;
67 import eu
.etaxonomy
.taxeditor
.editor
.view
.checklist
.edit
.DistributionEditingSupport
;
68 import eu
.etaxonomy
.taxeditor
.editor
.view
.checklist
.filter
.ChecklistEditorFilter
;
69 import eu
.etaxonomy
.taxeditor
.editor
.view
.checklist
.listener
.ChecklistDropdownSelectionListener
;
70 import eu
.etaxonomy
.taxeditor
.editor
.view
.checklist
.listener
.ChecklistFocusListener
;
71 import eu
.etaxonomy
.taxeditor
.editor
.view
.checklist
.listener
.ChecklistModifyListener
;
72 import eu
.etaxonomy
.taxeditor
.model
.IContextListener
;
73 import eu
.etaxonomy
.taxeditor
.model
.IDirtyMarkable
;
74 import eu
.etaxonomy
.taxeditor
.model
.IPartContentHasDetails
;
75 import eu
.etaxonomy
.taxeditor
.model
.IPartContentHasFactualData
;
76 import eu
.etaxonomy
.taxeditor
.model
.MessagingUtils
;
77 import eu
.etaxonomy
.taxeditor
.preference
.PreferencesUtil
;
78 import eu
.etaxonomy
.taxeditor
.preference
.Resources
;
79 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
83 * ChecklistViewPart class.
90 public class ChecklistEditor
extends EditorPart
implements ISelectionListener
, IPartContentHasFactualData
, IConversationEnabled
,
91 IContextListener
, IPartContentHasDetails
, IDirtyMarkable
{
93 private static final String LOADING_TAXA
= Messages
.ChecklistEditor_LOAD_TAXA
;
94 private static final String UNKNOWN
= Messages
.ChecklistEditor_UNKNOWN
;
95 private static final String ELEMENT_COUNT
= Messages
.ChecklistEditor_ELEMENT_COUNT
;
96 public static final String TYPE_FILTER_TEXT
= "type filter text"; //$NON-NLS-1$
98 private static final Logger logger
= Logger
.getLogger(ChecklistEditor
.class);
101 private class ChecklistJob
extends Job
{
103 private List
<TaxonNode
> taxonNodes
;
108 public ChecklistJob(String title
, List
<TaxonNode
> listTaxonNodes
) {
110 this.taxonNodes
= listTaxonNodes
;
118 * @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.
122 public IStatus
run(final IProgressMonitor monitor
) {
124 logger
.debug("Begin of eclipse core runtime Job to Retrieve datasources"); //$NON-NLS-1$
125 monitor
.beginTask(Messages
.ChecklistEditor_RETRIEVE_NODES
, taxonNodes
.size() + 1);
127 final List
<Taxon
> taxonList
= new ArrayList
<Taxon
>();
129 for (TaxonNode taxonNode
: taxonNodes
) {
130 HibernateProxyHelper hh
= new HibernateProxyHelper();
131 Taxon taxon
= hh
.deproxy(taxonNode
.getTaxon(), Taxon
.class);
132 taxonList
.add(taxon
);
135 Display
.getDefault().asyncExec(new Runnable() {
139 viewer
.setInput(taxonList
);
148 return Status
.OK_STATUS
;
154 * <code>ID="eu.etaxonomy.taxeditor.store.datasource"{trunked}</code>
156 public static String ID
= "eu.etaxonomy.taxeditor.editor.view.checklist.ChecklistEditor"; //$NON-NLS-1$
158 private TableViewer viewer
;
160 private String partNameCache
;
162 private IWorkbenchSiteProgressService service
;
164 private ITaxonNodeService taxonNodeService
;
166 private ChecklistEditorComparator comparator
;
168 private ChecklistEditorInput checklistEditorInput
;
170 private SimpleSelectionProvider simpleSelectionProvider
;
172 private ISelectionService selectionService
;
174 private ConversationHolder conversation
;
176 private Integer countNodes
;
178 private List
<TaxonNode
> selectedTaxonNodes
;
180 private boolean dirty
;
182 private ChecklistEditorFilter filter
;
184 private Menu headerMenu
;
186 private Label statusLabel
;
188 // private final ICdmEntitySession cdmEntitySession;
190 private ChecklistLabelProvider labelProvider
;
192 private SortedSet
<DefinedTermBase
> terms
= null;
193 private ToolItem toolItem
;
194 private ChecklistDropdownSelectionListener dropListener
;
197 * @return the selectedTaxonNodes
199 public List
<TaxonNode
> getSelectedTaxonNodes() {
200 return selectedTaxonNodes
;
204 * @param selectedTaxonNodes
205 * the selectedTaxonNodes to set
207 public void setSelectedTaxonNodes(List
<TaxonNode
> selectedTaxonNodes
) {
208 this.selectedTaxonNodes
= selectedTaxonNodes
;
213 * Constructor for CdmDataSourceViewPart.
216 public ChecklistEditor() {
217 //cdmEntitySession = CdmStore.getCurrentSessionManager().newSession(this, true);
223 public void createPartControl(Composite parent
) {
224 service
= (IWorkbenchSiteProgressService
) getSite().getAdapter(IWorkbenchSiteProgressService
.class);
225 taxonNodeService
= CdmStore
.getService(ITaxonNodeService
.class);
226 selectionService
= getSite().getWorkbenchWindow().getSelectionService();
227 selectionService
.addSelectionListener(this);
228 viewer
= new TableViewer(parent
, SWT
.MULTI
| SWT
.H_SCROLL
| SWT
.V_SCROLL
| SWT
.FULL_SELECTION
);
229 labelProvider
= new ChecklistLabelProvider(this.viewer
);
231 terms
= labelProvider
.getNamedAreas();
233 MessagingUtils
.informationDialog(Messages
.ChecklistEditor_NO_AREAS
, Messages
.ChecklistEditor_NO_AREAS_MESSAGE
);
237 filter
= new ChecklistEditorFilter();
238 createTopComposite(parent
);
245 private void createTopComposite(Composite parent
) {
246 GridLayout gridLayout
= new GridLayout(3, false);
247 gridLayout
.marginWidth
= 0;
248 gridLayout
.marginHeight
= 0;
249 parent
.setLayout(gridLayout
);
251 final Text searchText
= createSearchBar(parent
);
252 createToolbar(parent
);
254 getSite().setSelectionProvider(viewer
);
256 final ModifyListener modifyListener
= new ChecklistModifyListener(viewer
, filter
, searchText
);
258 searchText
.addFocusListener(new ChecklistFocusListener(searchText
, modifyListener
));
259 searchText
.addModifyListener(modifyListener
);
260 createGridDataForViewerLayout();
262 viewer
.addFilter(filter
);
265 viewer
.setContentProvider(new ChecklistContentProvider());
266 viewer
.setLabelProvider(this.labelProvider
);
267 comparator
= new ChecklistEditorComparator();
268 viewer
.setComparator(comparator
);
270 createStatusBar(parent
);
273 private void createGridDataForViewerLayout() {
274 GridData gridData
= new GridData();
275 gridData
.verticalAlignment
= GridData
.FILL
;
276 gridData
.horizontalSpan
= 3;
277 gridData
.grabExcessHorizontalSpace
= true;
278 gridData
.grabExcessVerticalSpace
= true;
279 gridData
.horizontalAlignment
= GridData
.FILL
;
280 viewer
.getControl().setLayoutData(gridData
);
287 private Text
createSearchBar(Composite parent
) {
288 Label searchLabel
= new Label(parent
, SWT
.NONE
);
289 searchLabel
.setText(Messages
.ChecklistEditor_SEARCH
);
290 final Text searchText
= new Text(parent
, SWT
.BORDER
| SWT
.SEARCH
| SWT
.ICON_SEARCH
| SWT
.CANCEL
);
291 searchText
.setLayoutData(new GridData(GridData
.GRAB_HORIZONTAL
| GridData
.HORIZONTAL_ALIGN_FILL
));
292 searchText
.setForeground(EditorUtil
.getColor(Resources
.SEARCH_VIEW_FOREGROUND
));
293 searchText
.setText(TYPE_FILTER_TEXT
);
300 private void createToolbar(Composite parent
) {
301 ToolBar toolBar
= new ToolBar(parent
, SWT
.NONE
);
302 toolItem
= new ToolItem(toolBar
, SWT
.DROP_DOWN
| SWT
.BORDER
);
303 toolItem
.setText(Messages
.ChecklistEditor_DIST_STATUS
);
304 toolItem
.setToolTipText(Messages
.ChecklistEditor_DIST_STATUS_TOOLTIP
);
305 createToolbarItems();
306 toolItem
.addSelectionListener(dropListener
);
310 private void createToolbarItems() {
311 dropListener
= new ChecklistDropdownSelectionListener(toolItem
, this, terms
);
313 for (DefinedTermBase
<DefinedTermBase
> term
: terms
) {
315 dropListener
.add(term
);
320 private void createStatusBar(Composite composite
) {
321 GridData gridData
= new GridData();
322 gridData
.horizontalSpan
= 3;
323 gridData
.grabExcessHorizontalSpace
= true;
324 gridData
.horizontalAlignment
= GridData
.FILL
;
326 statusLabel
= new Label(composite
, SWT
.LEFT
);
327 statusLabel
.setText(ELEMENT_COUNT
+ (countNodes
!= null ? countNodes
: UNKNOWN
));
328 statusLabel
.setLayoutData(gridData
);
331 private void createTable() {
332 Table table
= viewer
.getTable();//new Table(parent, viewer.getTable().getStyle());
333 List
<String
> titles
= new ArrayList
<String
>();
334 List
<Integer
> bounds
= new ArrayList
<Integer
>();
335 if (PreferencesUtil
.isShowRankInChecklistEditor()){
336 Collections
.addAll(titles
, Messages
.ChecklistEditor_TAXON
, Messages
.ChecklistEditor_RANK
);
337 Collections
.addAll(bounds
, 300, 200);
339 Collections
.addAll(titles
, Messages
.ChecklistEditor_TAXON
);
340 Collections
.addAll(bounds
, 300);
344 Map
<Integer
, Boolean
> restoreValuesForColumnWidth
= restoreValuesForColumnWidth(titles
, bounds
);
345 createInitalDistributionColumns(table
, titles
, bounds
, restoreValuesForColumnWidth
);
346 table
.setSortDirection(SWT
.DOWN
);
347 table
.setHeaderVisible(true);
348 table
.setLinesVisible(true);
351 * This method creates initially the distribution columns for a table. It should only be called for creation.<br>
354 *<b>Notice:</b> If you want to add additional columns later please use <b>addTableViewerColumn()</b>
359 * @param restoreValuesForColumnWidth
361 private void createInitalDistributionColumns(Table table
,
362 List
<String
> titles
, List
<Integer
> bounds
, Map
<Integer
, Boolean
> restoreValuesForColumnWidth
) {
363 for (int columnIndex
= 0; columnIndex
< titles
.size(); columnIndex
++) {
364 TableViewerColumn column
= new TableViewerColumn(viewer
, SWT
.NONE
);
365 column
.getColumn().setText(titles
.get(columnIndex
));
366 column
.getColumn().setWidth(bounds
.get(columnIndex
));
367 column
.getColumn().setResizable(true);
368 column
.getColumn().setMoveable(true);
369 column
.getColumn().addSelectionListener(getSelectionAdapter(column
.getColumn(), columnIndex
));
370 if (columnIndex
== 0) {
371 table
.setSortColumn(column
.getColumn());
373 if (columnIndex
== 1 && PreferencesUtil
.isShowRankInChecklistEditor()) {
374 /** uncommented it for now because no rank editing is wanted **/
375 // column.setEditingSupport(new RankEditingSupport(viewer, this));
377 if ((columnIndex
== 1 && !PreferencesUtil
.isShowRankInChecklistEditor()) || columnIndex
>= 2 ) {
378 //read PrefrenceStore to setWidth according to last saved state
379 if(restoreValuesForColumnWidth
.get(columnIndex
)){
380 column
.getColumn().setWidth(50);
382 column
.getColumn().setWidth(50);
384 column
.setEditingSupport(new DistributionEditingSupport(viewer
, this, columnIndex
));
390 * This methods loads the last opened distribution columns for the table viewer from the prefrence store.<br>
392 * <b>Notice:</b> It adds also the TitleCache to the titles list for the header of each column.<p>
396 * @return Map<Integer, Boolean>
398 private Map
<Integer
, Boolean
> restoreValuesForColumnWidth(List
<String
> titles
,
399 List
<Integer
> bounds
) {
400 Map
<Integer
, Boolean
> restoreColumnWidth
= new HashMap
<Integer
, Boolean
>();
403 if (PreferencesUtil
.isShowRankInChecklistEditor()){
408 for (DefinedTermBase
<DefinedTermBase
> term
: terms
) {
410 restoreColumnWidth
.put(columnIndex
, PreferencesUtil
.getPreferenceStore().getBoolean(term
.getUuid().toString()));
411 if (PreferencesUtil
.isShowIdInVocabularyInChecklistEditor()){
412 if (term
.getIdInVocabulary() != null){
413 titles
.add(term
.getIdInVocabulary());
415 titles
.add(term
.getTitleCache());
418 titles
.add(term
.getTitleCache());
425 return restoreColumnWidth
;
429 * This method adds new DistributionColumns to an existing table.
436 private TableViewerColumn
addTableViewerColumn(String title
, int bound
, final int colNumber
) {
437 final TableViewerColumn viewerColumn
= new TableViewerColumn(viewer
, SWT
.NONE
);
438 final TableColumn column
= viewerColumn
.getColumn();
439 column
.setText(title
);
440 column
.setWidth(200);
441 viewerColumn
.setEditingSupport(new DistributionEditingSupport(viewer
, this, colNumber
));
442 column
.setResizable(true);
443 column
.setMoveable(true);
451 * pull data from database and set input for view
454 private void loadDataInput() {
455 Classification classification
= checklistEditorInput
.getClassification();
456 TaxonNode taxonNode
= checklistEditorInput
.getTaxonNode();
457 if (classification
!= null && taxonNode
== null) {
458 countNodes
= taxonNodeService
.countAllNodesForClassification(classification
);
459 statusLabel
.setText(ELEMENT_COUNT
+ (countNodes
!= null ? countNodes
: UNKNOWN
));
460 // This should not kill the view nor the editor if something goes
462 // TODO: don't load the whole taxonNode Object but rather a small
463 // and simple Solution
464 // FIXME: May be don't open classification which are greater than
466 selectedTaxonNodes
= taxonNodeService
.listAllNodesForClassification(classification
, 0, countNodes
);
467 getService().schedule(new ChecklistJob(LOADING_TAXA
, selectedTaxonNodes
), Job
.LONG
);
469 if (taxonNode
!= null) {
470 selectedTaxonNodes
= taxonNodeService
.loadChildNodesOfTaxonNode(taxonNode
, NODE_INIT_STRATEGY
, true, null);
471 getService().schedule(new ChecklistJob(LOADING_TAXA
, selectedTaxonNodes
), Job
.LONG
);
477 public void dispose() {
478 this.checklistEditorInput
.dispose();
481 conversation
.unregisterForDataStoreChanges(this);
482 conversation
.unbind();
484 //conversation.close();
490 public void setFocus() {
492 viewer
.getControl().setFocus();
498 * @see org.eclipse.ui.part.WorkbenchPart#showBusy(boolean)
502 public void showBusy(boolean busy
) {
503 super.showBusy(busy
);
504 // viewer.getTable().setEnabled(!busy);
506 partNameCache
= getPartName();
507 setPartName(String
.format(Messages
.ChecklistEditor_LOAD_CNT_TAXA
, countNodes
));
509 if (partNameCache
!= null) {
510 setPartName(partNameCache
);
517 * Getter for the field <code>viewer</code>.
520 * @return a {@link org.eclipse.jface.viewers.StructuredViewer} object.
522 public StructuredViewer
getViewer() {
526 public void refresh() {
531 * This method should only be called for adding new Distribution columns and reloading the table.<br>
532 * It will hide the old distribution column and load the newly added columns.<br>
534 * <b>Notice:</b> for data update please use <b>refresh()</b>
537 @SuppressWarnings({ "unchecked", "rawtypes" })
538 public void reload(){
539 //create new Items for Dropdown menue
540 Table table
= viewer
.getTable();
541 table
.setRedraw(false);
542 SortedSet
<DefinedTermBase
> oldTerms
= terms
;
544 // if (PreferencesUtil.isShowIdInVocabularyInChecklistEditor()){
547 // terms = (SortedSet<DefinedTermBase>) labelProvider.getTermsOrderedByLabels(labelProvider.getNamedAreas(), CdmStore.getDefaultLanguage());
549 SortedSet
<DefinedTermBase
> newTerms
= labelProvider
.getNamedAreas();
550 toolItem
.removeSelectionListener(dropListener
);
551 hideDistributionColumns(oldTerms
);
552 createToolbarItems();
553 toolItem
.addSelectionListener(dropListener
);
554 for(DefinedTermBase term
:newTerms
){
555 int count
= viewer
.getTable().getColumnCount();
556 addTableViewerColumn(term
.getTitleCache(), 200, count
);
557 acitivateNewColumnInDropDownMenu(term
);
559 viewer
.setLabelProvider(labelProvider
);
560 getService().schedule(new ChecklistJob(LOADING_TAXA
, selectedTaxonNodes
), Job
.LONG
);
561 table
.setRedraw(true);
565 private void acitivateNewColumnInDropDownMenu(DefinedTermBase term
) {
566 Menu menu
= dropListener
.getMenu();
567 MenuItem
[] items
= menu
.getItems();
568 for(MenuItem item
: items
){
569 if(item
.getText().equalsIgnoreCase(term
.getTitleCache())){
570 item
.setSelection(true);
571 PreferencesUtil
.getPreferenceStore().setValue(term
.getUuid().toString(), true);
576 private void hideDistributionColumns(SortedSet
<DefinedTermBase
> oldTerms
) {
577 TableColumn
[] columns
= viewer
.getTable().getColumns();
578 for(int i
=4; i
<columns
.length
; i
++){
580 columns
[i
].dispose();
581 Menu menu
= dropListener
.getMenu();
582 int itemCount
= menu
.getItemCount();
583 MenuItem item
= menu
.getItem(i
-3);
584 item
.setSelection(false);
586 if(oldTerms
!= null){
587 for(DefinedTermBase term
: oldTerms
){
588 PreferencesUtil
.getPreferenceStore().setValue(term
.getUuid().toString(), false);
595 * Getter for the field <code>service</code>.
598 * @return the service
600 public IWorkbenchSiteProgressService
getService() {
604 private SelectionAdapter
getSelectionAdapter(final TableColumn column
, final int index
) {
605 SelectionAdapter selectionAdapter
= new SelectionAdapter() {
607 public void widgetSelected(SelectionEvent e
) {
608 comparator
.setColumn(index
);
609 int dir
= viewer
.getTable().getSortDirection();
610 if (viewer
.getTable().getSortColumn() == column
) {
611 dir
= dir
== SWT
.UP ? SWT
.DOWN
: SWT
.UP
;
615 viewer
.getTable().setSortDirection(dir
);
616 viewer
.getTable().setSortColumn(column
);
620 return selectionAdapter
;
624 public void doSave(IProgressMonitor monitor
) {
626 monitor
.beginTask(Messages
.ChecklistEditor_SAVE_EDITOR
, 1);
627 if (!conversation
.isBound()) {
630 CdmStore
.getService(ITaxonNodeService
.class).merge(selectedTaxonNodes
, true);
631 //this.checklistEditorInput.merge();
632 conversation
.commit(true);
642 public void doSaveAs() {
646 public void init(IEditorSite site
, IEditorInput input
) throws PartInitException
{
649 if (input
instanceof ChecklistEditorInput
) {
650 checklistEditorInput
= (ChecklistEditorInput
) input
;
651 setPartName(getPartName() + ": " + checklistEditorInput
.getName()); //$NON-NLS-1$
652 conversation
= checklistEditorInput
.getConversation();
653 conversation
.registerForDataStoreChanges(this);
655 simpleSelectionProvider
= new SimpleSelectionProvider();
656 getSite().setSelectionProvider(simpleSelectionProvider
);
661 public boolean isSaveAsAllowed() {
668 * @see org.eclipse.ui.ISelectionListener#selectionChanged(org.eclipse.ui.
669 * IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
672 public void selectionChanged(IWorkbenchPart part
, ISelection selection
) {
683 * eu.etaxonomy.taxeditor.model.IContextListener#contextAboutToStop(org.
684 * eclipse.ui.IMemento, org.eclipse.core.runtime.IProgressMonitor)
688 public void contextAboutToStop(IMemento memento
, IProgressMonitor monitor
) {
696 * eu.etaxonomy.taxeditor.model.IContextListener#contextStop(org.eclipse
697 * .ui.IMemento, org.eclipse.core.runtime.IProgressMonitor)
700 public void contextStop(IMemento memento
, IProgressMonitor monitor
) {
701 // IStructuredSelection sel = (IStructuredSelection) this.viewer.getSelection();
702 // if (sel.isEmpty()) {
705 // memento = memento.createChild("tree-selections");
706 // Iterator iter = sel.iterator();
707 // while (iter.hasNext()) {
708 // String nodeName = (String) iter.next();
709 // memento.createChild("selected-nodes", nodeName);
717 * eu.etaxonomy.taxeditor.model.IContextListener#contextStart(org.eclipse
718 * .ui.IMemento, org.eclipse.core.runtime.IProgressMonitor)
721 public void contextStart(IMemento memento
, IProgressMonitor monitor
) {
729 * eu.etaxonomy.taxeditor.model.IContextListener#contextRefresh(org.eclipse
730 * .core.runtime.IProgressMonitor)
733 public void contextRefresh(IProgressMonitor monitor
) {
740 * eu.etaxonomy.taxeditor.model.IContextListener#workbenchShutdown(org.eclipse
741 * .ui.IMemento, org.eclipse.core.runtime.IProgressMonitor)
744 public void workbenchShutdown(IMemento memento
, IProgressMonitor monitor
) {
745 conversation
.clear();
746 conversation
.close();
750 private static final List
<String
> NODE_INIT_STRATEGY
= Arrays
.asList(new String
[] { "descriptions", //$NON-NLS-1$
751 "descriptions.*", "description.state", "feature", "feature.*", "childNodes", "childNodes.taxon", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
752 "childNodes.taxon.name", "taxonNodes", "taxonNodes.*", "taxonNodes.taxon.*", "taxon.*", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
753 "taxon.descriptions", "taxon.sec", "taxon.name.*", "terms", "name.*", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
754 "name.rank.representations", "name.status.type.representations", "stateData.$" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
760 * eu.etaxonomy.taxeditor.model.IDirtyMarkableSelectionProvider#changed(
764 public void changed(Object element
) {
765 if (element
!= null) {
766 viewer
.update(element
, null);
768 firePropertyChange(PROP_DIRTY
);
773 * @see eu.etaxonomy.taxeditor.model.IDirtyMarkableSelectionProvider#forceDirty()
776 public void forceDirty() {
780 public void setDirty(boolean dirty
) {
782 firePropertyChange(PROP_DIRTY
);
788 * @see org.eclipse.ui.forms.editor.FormEditor#isDirty()
791 public boolean isDirty() {
796 * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled#getCdmEntitySession()
801 // * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled#getRootEntities()
804 // public <T extends CdmBase> Collection<T> getRootEntities() {
805 // // TODO Auto-generated method stub
810 // * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled#getPropertyPathsMap()
813 // public Map<Object, List<String>> getPropertyPathsMap() {
814 // // TODO Auto-generated method stub
819 * @return the labelProvider
821 public ChecklistLabelProvider
getLabelProvider() {
822 return labelProvider
;
826 * @see eu.etaxonomy.cdm.persistence.hibernate.ICdmPostDataChangeObserver#update(eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap)
829 public void update(CdmDataChangeMap arg0
) {
830 // TODO Auto-generated method stub
835 * @see eu.etaxonomy.cdm.api.conversation.IConversationEnabled#getConversationHolder()
838 public ConversationHolder
getConversationHolder() {