X-Git-Url: https://dev.e-taxonomy.eu/gitweb/taxeditor.git/blobdiff_plain/4db49a38a14c8574ea913c3494a802a07b7adee1..c3eaaf02e56dc13bb8a8d68ce3a78f41c9972ea3:/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/ChecklistEditor.java diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/ChecklistEditor.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/ChecklistEditor.java index b38fd5965..49cf0b77a 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/ChecklistEditor.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/ChecklistEditor.java @@ -1,4 +1,3 @@ -// $Id$ /** * Copyright (C) 2007 EDIT * European Distributed Institute of Taxonomy @@ -24,6 +23,9 @@ import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.jobs.Job; import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.SelectionChangedEvent; import org.eclipse.jface.viewers.StructuredViewer; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.jface.viewers.TableViewerColumn; @@ -31,12 +33,14 @@ import org.eclipse.swt.SWT; import org.eclipse.swt.events.ModifyListener; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Menu; +import org.eclipse.swt.widgets.MenuItem; import org.eclipse.swt.widgets.Table; import org.eclipse.swt.widgets.TableColumn; import org.eclipse.swt.widgets.Text; @@ -63,18 +67,20 @@ import eu.etaxonomy.cdm.model.taxon.TaxonNode; import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap; import eu.etaxonomy.taxeditor.editor.EditorUtil; import eu.etaxonomy.taxeditor.editor.SimpleSelectionProvider; +import eu.etaxonomy.taxeditor.editor.l10n.Messages; import eu.etaxonomy.taxeditor.editor.view.checklist.edit.DistributionEditingSupport; -import eu.etaxonomy.taxeditor.editor.view.checklist.edit.RankEditingSupport; import eu.etaxonomy.taxeditor.editor.view.checklist.filter.ChecklistEditorFilter; import eu.etaxonomy.taxeditor.editor.view.checklist.listener.ChecklistDropdownSelectionListener; import eu.etaxonomy.taxeditor.editor.view.checklist.listener.ChecklistFocusListener; import eu.etaxonomy.taxeditor.editor.view.checklist.listener.ChecklistModifyListener; import eu.etaxonomy.taxeditor.model.IContextListener; -import eu.etaxonomy.taxeditor.model.IDirtyMarkableSelectionProvider; +import eu.etaxonomy.taxeditor.model.IDirtyMarkable; import eu.etaxonomy.taxeditor.model.IPartContentHasDetails; import eu.etaxonomy.taxeditor.model.IPartContentHasFactualData; +import eu.etaxonomy.taxeditor.model.MessagingUtils; import eu.etaxonomy.taxeditor.preference.PreferencesUtil; import eu.etaxonomy.taxeditor.preference.Resources; +import eu.etaxonomy.taxeditor.session.ICdmEntitySession; import eu.etaxonomy.taxeditor.store.CdmStore; /** @@ -86,14 +92,16 @@ import eu.etaxonomy.taxeditor.store.CdmStore; * @created 30.04.2014 * @version 1.0 */ -public class ChecklistEditor extends EditorPart implements ISelectionListener, IPartContentHasFactualData, - IConversationEnabled, IContextListener, IPartContentHasDetails, IDirtyMarkableSelectionProvider { +public class ChecklistEditor extends EditorPart implements ISelectionListener, IPartContentHasFactualData, IConversationEnabled, + IContextListener, IDirtyMarkable, IPartContentHasDetails{ + + private static final String LOADING_TAXA = Messages.ChecklistEditor_LOAD_TAXA; + private static final String UNKNOWN = Messages.ChecklistEditor_UNKNOWN; + private static final String ELEMENT_COUNT = Messages.ChecklistEditor_ELEMENT_COUNT; + public static final String TYPE_FILTER_TEXT = "type filter text"; //$NON-NLS-1$ private static final Logger logger = Logger.getLogger(ChecklistEditor.class); - /** - * Key used for storing Checklist Editor View - */ - private static final String CHECKLIST_EDITOR_MEMENTO_KEY = "checklistEditor"; + private class ChecklistJob extends Job { @@ -106,6 +114,7 @@ public class ChecklistEditor extends EditorPart implements ISelectionListener, I super(title); this.taxonNodes = listTaxonNodes; + } /* @@ -117,8 +126,8 @@ public class ChecklistEditor extends EditorPart implements ISelectionListener, I @Override public IStatus run(final IProgressMonitor monitor) { try { - logger.debug("Begin of eclipse core runtime Job to Retrieve datasources"); - monitor.beginTask("Retrieving TaxonNodes", taxonNodes.size() + 1); + logger.debug("Begin of eclipse core runtime Job to Retrieve datasources"); //$NON-NLS-1$ + monitor.beginTask(Messages.ChecklistEditor_RETRIEVE_NODES, taxonNodes.size() + 1); final List taxonList = new ArrayList(); @@ -132,7 +141,7 @@ public class ChecklistEditor extends EditorPart implements ISelectionListener, I @Override public void run() { - viewer.setInput(taxonList); + viewer.setInput(taxonList); } }); monitor.worked(1); @@ -149,7 +158,7 @@ public class ChecklistEditor extends EditorPart implements ISelectionListener, I * Constant * ID="eu.etaxonomy.taxeditor.store.datasource"{trunked} */ - public static String ID = "eu.etaxonomy.taxeditor.editor.view.checklist.ChecklistEditor"; + public static String ID = "eu.etaxonomy.taxeditor.editor.view.checklist.ChecklistEditor"; //$NON-NLS-1$ private TableViewer viewer; @@ -181,7 +190,13 @@ public class ChecklistEditor extends EditorPart implements ISelectionListener, I private Label statusLabel; + private ICdmEntitySession cdmEntitySession; + + private ChecklistLabelProvider labelProvider; + private SortedSet terms = null; + private ToolItem toolItem; + private ChecklistDropdownSelectionListener dropListener; /** * @return the selectedTaxonNodes @@ -204,6 +219,8 @@ public class ChecklistEditor extends EditorPart implements ISelectionListener, I *

*/ public ChecklistEditor() { + //cdmEntitySession = CdmStore.getCurrentSessionManager().newSession(this, true); + } /** {@inheritDoc} */ @@ -213,10 +230,27 @@ public class ChecklistEditor extends EditorPart implements ISelectionListener, I taxonNodeService = CdmStore.getService(ITaxonNodeService.class); selectionService = getSite().getWorkbenchWindow().getSelectionService(); selectionService.addSelectionListener(this); + viewer = new TableViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION); + +// viewer.addSelectionChangedListener(new ISelectionChangedListener() { +// @Override +// public void selectionChanged(SelectionChangedEvent event) { +// IStructuredSelection selection = viewer.getStructuredSelection(); +// Object firstElement = selection.getFirstElement(); +// // do something with it +// } +// +// +// }); + labelProvider = new ChecklistLabelProvider(this.viewer); + + terms = labelProvider.getNamedAreas(); + if (terms == null){ + MessagingUtils.informationDialog(Messages.ChecklistEditor_NO_AREAS, Messages.ChecklistEditor_NO_AREAS_MESSAGE); + this.dispose(); + return; + } filter = new ChecklistEditorFilter(); - ChecklistLabelProvider labelProvider = new ChecklistLabelProvider(); - terms = (SortedSet) labelProvider.getTermsOrderedByLabels(labelProvider.getNamedAreas(), - CdmStore.getDefaultLanguage()); createTopComposite(parent); loadDataInput(); } @@ -231,49 +265,48 @@ public class ChecklistEditor extends EditorPart implements ISelectionListener, I parent.setLayout(gridLayout); final Text searchText = createSearchBar(parent); + createToolbar(parent); - if (terms != null && !terms.isEmpty()) { - createToolbar(parent); - } - viewer = new TableViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION); - getSite().setSelectionProvider(viewer); + // getSite().setSelectionProvider(viewer); final ModifyListener modifyListener = new ChecklistModifyListener(viewer, filter, searchText); searchText.addFocusListener(new ChecklistFocusListener(searchText, modifyListener)); searchText.addModifyListener(modifyListener); - - // Layout the viewer - GridData gridData = new GridData(); - gridData.verticalAlignment = GridData.FILL; - gridData.horizontalSpan = 3; - gridData.grabExcessHorizontalSpace = true; - gridData.grabExcessVerticalSpace = true; - gridData.horizontalAlignment = GridData.FILL; - viewer.getControl().setLayoutData(gridData); + createGridDataForViewerLayout(); viewer.addFilter(filter); - createColumns(viewer); + createTable(); viewer.setContentProvider(new ChecklistContentProvider()); - viewer.setLabelProvider(new ChecklistLabelProvider()); + viewer.setLabelProvider(this.labelProvider); comparator = new ChecklistEditorComparator(); viewer.setComparator(comparator); createStatusBar(parent); } + private void createGridDataForViewerLayout() { + GridData gridData = new GridData(); + gridData.verticalAlignment = GridData.FILL; + gridData.horizontalSpan = 3; + gridData.grabExcessHorizontalSpace = true; + gridData.grabExcessVerticalSpace = true; + gridData.horizontalAlignment = GridData.FILL; + viewer.getControl().setLayoutData(gridData); + } + /** * @param parent * @return */ private Text createSearchBar(Composite parent) { Label searchLabel = new Label(parent, SWT.NONE); - searchLabel.setText("Search: "); + searchLabel.setText(Messages.ChecklistEditor_SEARCH); final Text searchText = new Text(parent, SWT.BORDER | SWT.SEARCH | SWT.ICON_SEARCH | SWT.CANCEL); searchText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL)); searchText.setForeground(EditorUtil.getColor(Resources.SEARCH_VIEW_FOREGROUND)); - searchText.setText("type filter text"); + searchText.setText(TYPE_FILTER_TEXT); return searchText; } @@ -282,18 +315,23 @@ public class ChecklistEditor extends EditorPart implements ISelectionListener, I */ private void createToolbar(Composite parent) { ToolBar toolBar = new ToolBar(parent, SWT.NONE); - ToolItem toolItem = new ToolItem(toolBar, SWT.DROP_DOWN | SWT.BORDER); - toolItem.setText("Distribution Status"); - toolItem.setToolTipText("Show Distribution Status for selected Areas"); - ChecklistDropdownSelectionListener dropListener = new ChecklistDropdownSelectionListener(toolItem, this, terms); + toolItem = new ToolItem(toolBar, SWT.DROP_DOWN | SWT.BORDER); + toolItem.setText(Messages.ChecklistEditor_DIST_STATUS); + toolItem.setToolTipText(Messages.ChecklistEditor_DIST_STATUS_TOOLTIP); + createToolbarItems(); + toolItem.addSelectionListener(dropListener); + toolBar.pack(); + } + + private void createToolbarItems() { + dropListener = new ChecklistDropdownSelectionListener(toolItem, this, terms); + for (DefinedTermBase term : terms) { if(term!=null){ dropListener.add(term); } } - toolItem.addSelectionListener(dropListener); - toolBar.pack(); - } + } private void createStatusBar(Composite composite) { GridData gridData = new GridData(); @@ -302,57 +340,127 @@ public class ChecklistEditor extends EditorPart implements ISelectionListener, I gridData.horizontalAlignment = GridData.FILL; statusLabel = new Label(composite, SWT.LEFT); - statusLabel.setText("Anzahl der Elemente: " + (countNodes != null ? countNodes : "uknown")); + statusLabel.setText(ELEMENT_COUNT + (countNodes != null ? countNodes : UNKNOWN)); statusLabel.setLayoutData(gridData); } - // This will create the columns for the table - private void createColumns(TableViewer viewer) { - Table table = viewer.getTable(); + private void createTable() { + Table table = viewer.getTable();//new Table(parent, viewer.getTable().getStyle()); List titles = new ArrayList(); - Collections.addAll(titles, "Taxon", "Author", "Reference", "Rank"); List bounds = new ArrayList(); - Collections.addAll(bounds, 300, 200, 200, 200); - MaprestoreColumnWidth = new HashMap(); - if (terms != null) { - int i = 4; - for (DefinedTermBase term : terms) { - if(term != null){ - restoreColumnWidth.put(i, PreferencesUtil.getPreferenceStore().getBoolean(term.getUuid().toString())); - titles.add(term.getTitleCache()); - bounds.add(200); - i++; - } - } + if (PreferencesUtil.isShowRankInChecklistEditor()){ + Collections.addAll(titles, Messages.ChecklistEditor_TAXON, Messages.ChecklistEditor_RANK); + Collections.addAll(bounds, 300, 200); + } else{ + Collections.addAll(titles, Messages.ChecklistEditor_TAXON); + Collections.addAll(bounds, 300); } - for (int i = 0; i < titles.size(); i++) { + + Map restoreValuesForColumnWidth = restoreValuesForColumnWidth(titles, bounds); + createInitalDistributionColumns(table, titles, bounds, restoreValuesForColumnWidth); + table.setSortDirection(SWT.DOWN); + table.setHeaderVisible(true); + table.setLinesVisible(true); + } + /** + * This method creates initially the distribution columns for a table. It should only be called for creation.
+ *

+ * + *Notice: If you want to add additional columns later please use addTableViewerColumn() + * + * @param table + * @param titles + * @param bounds + * @param restoreValuesForColumnWidth + */ + private void createInitalDistributionColumns(Table table, + List titles, List bounds, Map restoreValuesForColumnWidth) { + for (int columnIndex = 0; columnIndex < titles.size(); columnIndex++) { TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText(titles.get(i)); - column.getColumn().setWidth(bounds.get(i)); + column.getColumn().setText(titles.get(columnIndex)); + column.getColumn().setWidth(bounds.get(columnIndex)); column.getColumn().setResizable(true); column.getColumn().setMoveable(true); - column.getColumn().addSelectionListener(getSelectionAdapter(column.getColumn(), i)); - if (i == 1) { + column.getColumn().addSelectionListener(getSelectionAdapter(column.getColumn(), columnIndex)); + if (columnIndex == 0) { table.setSortColumn(column.getColumn()); } - if (i == 3) { - column.setEditingSupport(new RankEditingSupport(viewer, this)); + if (columnIndex == 1 && PreferencesUtil.isShowRankInChecklistEditor()) { + /** uncommented it for now because no rank editing is wanted **/ +// column.setEditingSupport(new RankEditingSupport(viewer, this)); } - if (i >= 4) { + if ((columnIndex == 1 && !PreferencesUtil.isShowRankInChecklistEditor()) || columnIndex >= 2 ) { //read PrefrenceStore to setWidth according to last saved state - if(restoreColumnWidth.get(i)){ - column.getColumn().setWidth(100); + if(restoreValuesForColumnWidth.get(columnIndex)){ + column.getColumn().setWidth(50); }else{ - column.getColumn().setWidth(0); + column.getColumn().setWidth(50); } - column.setEditingSupport(new DistributionEditingSupport(viewer, this, i)); + column.setEditingSupport(new DistributionEditingSupport(viewer, this, columnIndex)); } } - table.setSortDirection(SWT.DOWN); - table.setHeaderVisible(true); - table.setLinesVisible(true); - } + } + + /** + * This methods loads the last opened distribution columns for the table viewer from the prefrence store.
+ *

+ * Notice: It adds also the TitleCache to the titles list for the header of each column.

+ * + * @param titles + * @param bounds + * @return Map + */ + private Map restoreValuesForColumnWidth(List titles, + List bounds) { + Map restoreColumnWidth = new HashMap(); + if (terms != null) { + int columnIndex; + if (PreferencesUtil.isShowRankInChecklistEditor()){ + columnIndex = 2; + } else{ + columnIndex = 1; + } + for (DefinedTermBase term : terms) { + if(term != null){ + restoreColumnWidth.put(columnIndex, PreferencesUtil.getPreferenceStore().getBoolean(term.getUuid().toString())); + if (PreferencesUtil.isShowIdInVocabularyInChecklistEditor()){ + if (term.getIdInVocabulary() != null){ + titles.add(term.getIdInVocabulary()); + } else{ + titles.add(term.getTitleCache()); + } + }else{ + titles.add(term.getTitleCache()); + } + bounds.add(200); + columnIndex++; + } + } + } + return restoreColumnWidth; + } + + /** + * This method adds new DistributionColumns to an existing table. + * + * @param title + * @param bound + * @param colNumber + * @return + */ + private TableViewerColumn addTableViewerColumn(String title, int bound, final int colNumber) { + final TableViewerColumn viewerColumn = new TableViewerColumn(viewer, SWT.NONE); + final TableColumn column = viewerColumn.getColumn(); + column.setText(title); + column.setWidth(200); + viewerColumn.setEditingSupport(new DistributionEditingSupport(viewer, this, colNumber)); + column.setResizable(true); + column.setMoveable(true); + return viewerColumn; + } + + /** * @@ -364,7 +472,7 @@ public class ChecklistEditor extends EditorPart implements ISelectionListener, I TaxonNode taxonNode = checklistEditorInput.getTaxonNode(); if (classification != null && taxonNode == null) { countNodes = taxonNodeService.countAllNodesForClassification(classification); - statusLabel.setText("Anzahl der Elemente: " + (countNodes != null ? countNodes : "uknown")); +// statusLabel.setText(ELEMENT_COUNT + (countNodes != null ? countNodes : UNKNOWN)); // This should not kill the view nor the editor if something goes // wrong // TODO: don't load the whole taxonNode Object but rather a small @@ -372,23 +480,35 @@ public class ChecklistEditor extends EditorPart implements ISelectionListener, I // FIXME: May be don't open classification which are greater than // 3000 Taxa selectedTaxonNodes = taxonNodeService.listAllNodesForClassification(classification, 0, countNodes); - getService().schedule(new ChecklistJob("loading Taxa", selectedTaxonNodes), Job.LONG); + countNodes = selectedTaxonNodes.size(); + statusLabel.setText(ELEMENT_COUNT + (countNodes != null ? countNodes : UNKNOWN)); + getService().schedule(new ChecklistJob(LOADING_TAXA, selectedTaxonNodes), Job.LONG); } if (taxonNode != null) { - selectedTaxonNodes = taxonNodeService.loadChildNodesOfTaxonNode(taxonNode, NODE_INIT_STRATEGY, true, false); - getService().schedule(new ChecklistJob("loading Taxa", selectedTaxonNodes), Job.LONG); + selectedTaxonNodes = taxonNodeService.loadChildNodesOfTaxonNode(taxonNode, NODE_INIT_STRATEGY, true, null); + getService().schedule(new ChecklistJob(LOADING_TAXA, selectedTaxonNodes), Job.LONG); + countNodes = selectedTaxonNodes.size(); + statusLabel.setText(ELEMENT_COUNT + (countNodes != null ? countNodes : UNKNOWN)); } } /** {@inheritDoc} */ @Override public void dispose() { - super.dispose(); +// this.checklistEditorInput.dispose(); + super.dispose(); + + conversation.unregisterForDataStoreChanges(this); + conversation.unbind(); + + //conversation.close(); + conversation = null; } /** {@inheritDoc} */ @Override public void setFocus() { + viewer.getControl().setFocus(); } @@ -404,7 +524,7 @@ public class ChecklistEditor extends EditorPart implements ISelectionListener, I // viewer.getTable().setEnabled(!busy); if (busy) { partNameCache = getPartName(); - setPartName("Loading " + countNodes + " Taxa..."); + setPartName(String.format(Messages.ChecklistEditor_LOAD_CNT_TAXA, countNodes)); } else { if (partNameCache != null) { setPartName(partNameCache); @@ -427,6 +547,69 @@ public class ChecklistEditor extends EditorPart implements ISelectionListener, I viewer.refresh(); } + /** + * This method should only be called for adding new Distribution columns and reloading the table.
+ * It will hide the old distribution column and load the newly added columns.
+ *

+ * Notice: for data update please use refresh() + * + */ + @SuppressWarnings({ "unchecked", "rawtypes" }) + public void reload(){ + //create new Items for Dropdown menue + Table table = viewer.getTable(); + table.setRedraw(false); + SortedSet oldTerms = terms; + +// if (PreferencesUtil.isShowIdInVocabularyInChecklistEditor()){ +// +// } else{ +// terms = (SortedSet) labelProvider.getTermsOrderedByLabels(labelProvider.getNamedAreas(), CdmStore.getDefaultLanguage()); +// } + SortedSet newTerms = labelProvider.getNamedAreas(); + toolItem.removeSelectionListener(dropListener); + hideDistributionColumns(oldTerms); + createToolbarItems(); + toolItem.addSelectionListener(dropListener); + for(DefinedTermBase term:newTerms){ + int count = viewer.getTable().getColumnCount(); + addTableViewerColumn(term.getTitleCache(), 200, count); + acitivateNewColumnInDropDownMenu(term); + } + viewer.setLabelProvider(labelProvider); + getService().schedule(new ChecklistJob(LOADING_TAXA, selectedTaxonNodes), Job.LONG); + table.setRedraw(true); + viewer.refresh(); + } + + private void acitivateNewColumnInDropDownMenu(DefinedTermBase term) { + Menu menu = dropListener.getMenu(); + MenuItem[] items = menu.getItems(); + for(MenuItem item: items){ + if(item.getText().equalsIgnoreCase(term.getTitleCache())){ + item.setSelection(true); + PreferencesUtil.getPreferenceStore().setValue(term.getUuid().toString(), true); + } + } + } + + private void hideDistributionColumns(SortedSet oldTerms) { + TableColumn[] columns = viewer.getTable().getColumns(); + for(int i=4; i * Getter for the field service. @@ -460,9 +643,13 @@ public class ChecklistEditor extends EditorPart implements ISelectionListener, I @Override public void doSave(IProgressMonitor monitor) { try { - monitor.beginTask("Saving Editor", 1); - getConversationHolder().bind(); - getConversationHolder().commit(true); + monitor.beginTask(Messages.ChecklistEditor_SAVE_EDITOR, 1); + if (!conversation.isBound()) { + conversation.bind(); + } + CdmStore.getService(ITaxonNodeService.class).merge(selectedTaxonNodes, true); + //this.checklistEditorInput.merge(); + conversation.commit(true); setDirty(false); monitor.worked(1); } finally { @@ -473,8 +660,6 @@ public class ChecklistEditor extends EditorPart implements ISelectionListener, I @Override public void doSaveAs() { - // TODO Auto-generated method stub - } @Override @@ -483,16 +668,17 @@ public class ChecklistEditor extends EditorPart implements ISelectionListener, I setInput(input); if (input instanceof ChecklistEditorInput) { checklistEditorInput = (ChecklistEditorInput) input; - setPartName(getPartName() + ": " + checklistEditorInput.getName()); - conversation = ((ChecklistEditorInput) input).getConversationHolder(); + setPartName(getPartName() + ": " + checklistEditorInput.getName()); //$NON-NLS-1$ + conversation = checklistEditorInput.getConversation(); + conversation.registerForDataStoreChanges(this); } simpleSelectionProvider = new SimpleSelectionProvider(); getSite().setSelectionProvider(simpleSelectionProvider); + } @Override public boolean isSaveAsAllowed() { - // TODO Auto-generated method stub return false; } @@ -504,33 +690,13 @@ public class ChecklistEditor extends EditorPart implements ISelectionListener, I */ @Override public void selectionChanged(IWorkbenchPart part, ISelection selection) { - // TODO Auto-generated method stub - +// System.out.println(selection.getClass().getSimpleName()); +// viewer.setSelection(selection, true); } - /* - * (non-Javadoc) - * - * @see - * eu.etaxonomy.cdm.persistence.hibernate.ICdmPostDataChangeObserver#update - * (eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap) - */ - @Override - public void update(CdmDataChangeMap changeEvents) { - } - /* - * (non-Javadoc) - * - * @see - * eu.etaxonomy.cdm.api.conversation.IConversationEnabled#getConversationHolder - * () - */ - @Override - public ConversationHolder getConversationHolder() { - return conversation; - } + /* * (non-Javadoc) @@ -554,7 +720,6 @@ public class ChecklistEditor extends EditorPart implements ISelectionListener, I */ @Override public void contextStop(IMemento memento, IProgressMonitor monitor) { - // TODO Auto-generated method stub // IStructuredSelection sel = (IStructuredSelection) this.viewer.getSelection(); // if (sel.isEmpty()) { // return; @@ -588,8 +753,6 @@ public class ChecklistEditor extends EditorPart implements ISelectionListener, I */ @Override public void contextRefresh(IProgressMonitor monitor) { - // TODO Auto-generated method stub - } /* @@ -606,11 +769,11 @@ public class ChecklistEditor extends EditorPart implements ISelectionListener, I conversation = null; } - private static final List NODE_INIT_STRATEGY = Arrays.asList(new String[] { "descriptions", - "descriptions.*", "description.state", "feature", "feature.*", "childNodes", "childNodes.taxon", - "childNodes.taxon.name", "taxonNodes", "taxonNodes.*", "taxonNodes.taxon.*", "taxon.*", - "taxon.descriptions", "taxon.sec", "taxon.name.*", "taxon.synonymRelations", "terms", "name.*", - "name.rank.representations", "name.status.type.representations", "sources.$", "stateData.$" }); + private static final List NODE_INIT_STRATEGY = Arrays.asList(new String[] { "descriptions", //$NON-NLS-1$ + "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$ + "childNodes.taxon.name", "taxonNodes", "taxonNodes.*", "taxonNodes.taxon.*", "taxon.*", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ + "taxon.descriptions", "taxon.sec", "taxon.name.*", "terms", "name.*", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ + "name.rank.representations", "name.status.type.representations", "stateData.$" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ /* * (non-Javadoc) @@ -628,6 +791,14 @@ public class ChecklistEditor extends EditorPart implements ISelectionListener, I } } + /* (non-Javadoc) + * @see eu.etaxonomy.taxeditor.model.IDirtyMarkableSelectionProvider#forceDirty() + */ + @Override + public void forceDirty() { + changed(null); + } + public void setDirty(boolean dirty) { this.dirty = dirty; firePropertyChange(PROP_DIRTY); @@ -642,4 +813,54 @@ public class ChecklistEditor extends EditorPart implements ISelectionListener, I public boolean isDirty() { return dirty; } + + /* (non-Javadoc) + * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled#getCdmEntitySession() + */ + + +// /* (non-Javadoc) +// * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled#getRootEntities() +// */ +// @Override +// public Collection getRootEntities() { +// // TODO Auto-generated method stub +// return null; +// } +// +// /* (non-Javadoc) +// * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled#getPropertyPathsMap() +// */ +// @Override +// public Map> getPropertyPathsMap() { +// // TODO Auto-generated method stub +// return null; +// } + + /** + * @return the labelProvider + */ + public ChecklistLabelProvider getLabelProvider() { + return labelProvider; + } + + /* (non-Javadoc) + * @see eu.etaxonomy.cdm.persistence.hibernate.ICdmPostDataChangeObserver#update(eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap) + */ + @Override + public void update(CdmDataChangeMap arg0) { + // TODO Auto-generated method stub + + } + + /* (non-Javadoc) + * @see eu.etaxonomy.cdm.api.conversation.IConversationEnabled#getConversationHolder() + */ + @Override + public ConversationHolder getConversationHolder() { + + return conversation; + } + + }