Project

General

Profile

« Previous | Next » 

Revision 0001092a

Added by Katja Luther about 6 years ago

some leftovers from last commit (refresh of navigator after delete or new)

View differences:

eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/Root.java
122 122

  
123 123
	public void addRootNode(Classification newClassification){
124 124
	    newClassification = CdmStore.getService(IClassificationService.class).load(newClassification.getUuid());
125
	    rootNodes.add(new TaxonNodeDto(newClassification.getRootNode()));
125
	    boolean exist = false;
126
	    for (TaxonNodeDto rootNode: rootNodes){
127
	        if (rootNode.getUuid().equals(newClassification.getRootNode().getUuid())){
128
	            exist = true;
129
	            break;
130
	        }
131
	    }
132
	    if (!exist){
133
	        rootNodes.add(new TaxonNodeDto(newClassification.getRootNode()));
134
	    }
126 135

  
127 136
	}
128 137

  
......
130 139
     * @param cb
131 140
     */
132 141
    public void removeRootNode(Classification cb) {
133
        Integer index = null;
142
        int index = -1;
134 143
        for (TaxonNodeDto dto: rootNodes){
135 144
            if (dto.getClassificationUUID().equals(cb.getUuid())){
136 145
                index = rootNodes.indexOf(dto);
146
                break;
137 147
            }
138 148
        }
139

  
140
        rootNodes.remove(index);
149
        if (index > 0){
150
            rootNodes.remove(index);
151
        }
141 152

  
142 153
    }
143 154
}
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/handler/NewTaxonNodeHandlerE4.java
24 24
import org.eclipse.swt.widgets.Shell;
25 25

  
26 26
import eu.etaxonomy.taxeditor.editor.EditorUtil;
27
import eu.etaxonomy.taxeditor.event.EventUtility;
28
import eu.etaxonomy.taxeditor.event.WorkbenchEventConstants;
27 29
import eu.etaxonomy.taxeditor.newWizard.IWizardPageListener;
28 30
import eu.etaxonomy.taxeditor.newWizard.NewTaxonNodeWizard;
29 31

  
......
53 55
		int status = dialog.open();
54 56

  
55 57
		if(status == IStatus.OK && wizard.openInEditor()){
58
		    EventUtility.postEvent(WorkbenchEventConstants.REFRESH_NAVIGATOR, true);
56 59
			if(wizard.openEmpty()){
57 60
                EditorUtil.openEmptyE4(wizard.getParentTreeNode().getUuid());
58 61
			}else if(wizard.getTaxonNode() != null){

Also available in: Unified diff