* The contents of this file are subject to the Mozilla Public License Version 1.1
* See LICENSE.TXT at the top of this package for the full license terms.
*/
* The contents of this file are subject to the Mozilla Public License Version 1.1
* See LICENSE.TXT at the top of this package for the full license terms.
*/
/** Constant <code>ID="eu.etaxonomy.taxeditor.editor.view.desc"{trunked}</code> */
public static final String ID = "eu.etaxonomy.taxeditor.editor.view.descriptive";
/** Constant <code>ID="eu.etaxonomy.taxeditor.editor.view.desc"{trunked}</code> */
public static final String ID = "eu.etaxonomy.taxeditor.editor.view.descriptive";
protected Map<TaxonDescription, FeatureNodeContainerTree> featureNodeContainerCache = new HashMap<TaxonDescription, FeatureNodeContainerTree>();
protected ToggleDescriptionAction showAllElementsAction;
protected Map<TaxonDescription, FeatureNodeContainerTree> featureNodeContainerCache = new HashMap<TaxonDescription, FeatureNodeContainerTree>();
protected ToggleDescriptionAction showAllElementsAction;
protected ToggleDescriptionAction hideAllElementsAction;
protected int dndOperations = DND.DROP_COPY | DND.DROP_MOVE;
protected ToggleDescriptionAction hideAllElementsAction;
protected int dndOperations = DND.DROP_COPY | DND.DROP_MOVE;
/** {@inheritDoc} */
@Override
public void createViewer(Composite parent) {
viewer = new TreeViewer(new Tree(parent, SWT.MULTI | SWT.H_SCROLL
| SWT.V_SCROLL | SWT.FULL_SELECTION));
/** {@inheritDoc} */
@Override
public void createViewer(Composite parent) {
viewer = new TreeViewer(new Tree(parent, SWT.MULTI | SWT.H_SCROLL
| SWT.V_SCROLL | SWT.FULL_SELECTION));
viewer.setLabelProvider(new DescriptiveLabelProvider());
viewer.setSorter(new DescriptiveViewerSorter());
viewer.setAutoExpandLevel(2);
viewer.setLabelProvider(new DescriptiveLabelProvider());
viewer.setSorter(new DescriptiveViewerSorter());
viewer.setAutoExpandLevel(2);
this));
viewer.addDropSupport(dndOperations, transfers,
new DescriptionElementDropAdapter(viewer));
this));
viewer.addDropSupport(dndOperations, transfers,
new DescriptionElementDropAdapter(viewer));
protected ISelection getInitialSelection() {
if(getEditor() != null){
return new StructuredSelection(getEditor().getEditorInput());
protected ISelection getInitialSelection() {
if(getEditor() != null){
return new StructuredSelection(getEditor().getEditorInput());
/*
* TODO add to the views menu
*/
protected void createMenu(){
MenuManager menuManager = new MenuManager();
menuManager.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
/*
* TODO add to the views menu
*/
protected void createMenu(){
MenuManager menuManager = new MenuManager();
menuManager.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
getSite().registerContextMenu(menuManager, viewer);
// FIXME for some reason this is not working
menuManager.add(showAllElementsAction);
menuManager.add(hideAllElementsAction);
getSite().registerContextMenu(menuManager, viewer);
// FIXME for some reason this is not working
menuManager.add(showAllElementsAction);
menuManager.add(hideAllElementsAction);
if(part instanceof MultiPageTaxonEditor){
if(! part.equals(this.part)){
IEditorInput input = ((IEditorPart) part).getEditorInput();
if(part instanceof MultiPageTaxonEditor){
if(! part.equals(this.part)){
IEditorInput input = ((IEditorPart) part).getEditorInput();
public ToggleDescriptionAction(boolean expand){
super(null, Action.AS_PUSH_BUTTON);
expanded = expand;
setImageAndTooltip();
}
public ToggleDescriptionAction(boolean expand){
super(null, Action.AS_PUSH_BUTTON);
expanded = expand;
setImageAndTooltip();
}
if(object instanceof DescriptionElementBase){
DescriptionElementBase descriptionElement = (DescriptionElementBase) object;
DescriptionBase description = descriptionElement.getInDescription();
FeatureNodeContainerTree containerTree = featureNodeContainerCache.get(description);
if(object instanceof DescriptionElementBase){
DescriptionElementBase descriptionElement = (DescriptionElementBase) object;
DescriptionBase description = descriptionElement.getInDescription();
FeatureNodeContainerTree containerTree = featureNodeContainerCache.get(description);
FeatureNodeContainer featureNodeContainer = containerTree.getFeatureNodeContainerForDescriptionElement(descriptionElement);
viewer.expandToLevel(featureNodeContainer, 1);
FeatureNodeContainer featureNodeContainer = containerTree.getFeatureNodeContainerForDescriptionElement(descriptionElement);
viewer.expandToLevel(featureNodeContainer, 1);