Project

General

Profile

Revision 17502849

ID17502849a24b87a607b565515dea41a00f3c3e53
Parent 0343d833
Child 21fbfba9

Added by Patrick Plitzner about 3 years ago

ref #6694 Use service methods to add and remove features

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/e4/FeatureTreeEditor.java
164 164
        // commit the conversation and start a new transaction immediately
165 165
        conversation.commit(true);
166 166

  
167
        CdmStore.getService(IFeatureTreeService.class).merge(featureTree);
167
        CdmStore.getService(IFeatureTreeService.class).saveOrUpdate(featureTree);
168 168

  
169 169
        this.setDirty(false);
170 170
	}
......
215 215
			WizardDialog dialog = new WizardDialog(shell, wizard);
216 216

  
217 217
			if (dialog.open() == IStatus.OK) {
218
				IStructuredSelection selection = (IStructuredSelection) composite.getViewer()
219
						.getSelection();
220
				FeatureNode parent = (FeatureNode) (selection.getFirstElement() != null ? selection
221
						.getFirstElement() : ((FeatureTree) composite.getViewer().getInput())
222
						.getRoot());
223
				Collection<Feature> additionalFeatures = wizard
224
						.getAdditionalFeatures();
225
				for (Feature feature : additionalFeatures) {
226
					FeatureNode child = FeatureNode.NewInstance(feature);
227
					parent.addChild(child);
228
					CdmStore.getService(IFeatureNodeService.class).save(child);
218
                IStructuredSelection selection = (IStructuredSelection) composite.getViewer().getSelection();
219
                FeatureNode parent = (FeatureNode) (selection.getFirstElement() != null ? selection.getFirstElement()
220
                        : ((FeatureTree) composite.getViewer().getInput()).getRoot());
221
                Collection<Feature> additionalFeatures = wizard.getAdditionalFeatures();
222
                for (Feature feature : additionalFeatures) {
223
				    CdmStore.getService(IFeatureNodeService.class).addChildFeaturNode(parent, feature);
229 224
				}
230 225
				setDirty(true);
231 226
				composite.getViewer().refresh();
......
243 238

  
244 239
			for (Object selectedObject : selection.toArray()) {
245 240
				FeatureNode featureNode = (FeatureNode) selectedObject;
246
				FeatureNode parent = featureNode.getParent();
247
				parent.removeChild(featureNode);
248

  
249 241
				CdmStore.getService(IFeatureNodeService.class).deleteFeatureNode(featureNode.getUuid(), new FeatureNodeDeletionConfigurator());
250 242

  
251 243
			}

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)