Commit 9d29ba7a authored by Sabine Teufl's avatar Sabine Teufl
Browse files

Unnecessary sorting removed

refs 691
parent 29a2aa87
...@@ -19,7 +19,6 @@ package org.fortiss.af3.mira.ui.action; ...@@ -19,7 +19,6 @@ package org.fortiss.af3.mira.ui.action;
import static org.eclipse.emf.ecore.util.EcoreUtil.delete; import static org.eclipse.emf.ecore.util.EcoreUtil.delete;
import org.fortiss.af3.mira.command.SortRequirementCommand;
import org.fortiss.af3.mira.model.Requirement; import org.fortiss.af3.mira.model.Requirement;
import org.fortiss.af3.mira.model.usecase.UseCase; import org.fortiss.af3.mira.model.usecase.UseCase;
import org.fortiss.tooling.kernel.ui.service.IModelEditorBindingService; import org.fortiss.tooling.kernel.ui.service.IModelEditorBindingService;
...@@ -30,7 +29,7 @@ import org.fortiss.tooling.kernel.ui.service.IModelEditorBindingService; ...@@ -30,7 +29,7 @@ import org.fortiss.tooling.kernel.ui.service.IModelEditorBindingService;
* @author wenwenchen * @author wenwenchen
* @author $Author: hoelzl $ * @author $Author: hoelzl $
* @version $Rev: 18709 $ * @version $Rev: 18709 $
* @ConQAT.Rating GREEN Hash: 412DB193A57014EAA1BAA839F1A11B38 * @ConQAT.Rating YELLOW Hash: 78B1BDF55DDC14001C780E4BC3A5C0C1
*/ */
public class ConvertRequirementAction implements Runnable { public class ConvertRequirementAction implements Runnable {
...@@ -74,7 +73,6 @@ public class ConvertRequirementAction implements Runnable { ...@@ -74,7 +73,6 @@ public class ConvertRequirementAction implements Runnable {
newReq.getContainedElementsList().addAll(oldReq.getFormalSpecifications()); newReq.getContainedElementsList().addAll(oldReq.getFormalSpecifications());
oldReq.getAnalysis().getContainedElementsList().add(newReq); oldReq.getAnalysis().getContainedElementsList().add(newReq);
new SortRequirementCommand(oldReq.getAnalysis()).run();
delete(oldReq, true); delete(oldReq, true);
......
...@@ -48,7 +48,6 @@ import org.eclipse.core.databinding.UpdateListStrategy; ...@@ -48,7 +48,6 @@ import org.eclipse.core.databinding.UpdateListStrategy;
import org.eclipse.core.databinding.observable.ChangeEvent; import org.eclipse.core.databinding.observable.ChangeEvent;
import org.eclipse.core.databinding.observable.IChangeListener; import org.eclipse.core.databinding.observable.IChangeListener;
import org.eclipse.core.databinding.observable.map.IObservableMap; import org.eclipse.core.databinding.observable.map.IObservableMap;
import org.eclipse.core.databinding.observable.value.IObservableValue;
import org.eclipse.emf.databinding.EMFObservables; import org.eclipse.emf.databinding.EMFObservables;
import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider;
import org.eclipse.jface.fieldassist.ControlDecoration; import org.eclipse.jface.fieldassist.ControlDecoration;
...@@ -87,7 +86,6 @@ import org.eclipse.ui.PartInitException; ...@@ -87,7 +86,6 @@ import org.eclipse.ui.PartInitException;
import org.eclipse.ui.forms.widgets.ScrolledForm; import org.eclipse.ui.forms.widgets.ScrolledForm;
import org.fortiss.af3.mira.command.CreateRelationCommand; import org.fortiss.af3.mira.command.CreateRelationCommand;
import org.fortiss.af3.mira.command.DeleteRelationCommand; import org.fortiss.af3.mira.command.DeleteRelationCommand;
import org.fortiss.af3.mira.command.SortRequirementCommand;
import org.fortiss.af3.mira.model.Analysis; import org.fortiss.af3.mira.model.Analysis;
import org.fortiss.af3.mira.model.Requirement; import org.fortiss.af3.mira.model.Requirement;
import org.fortiss.af3.mira.model.RequirementPriority; import org.fortiss.af3.mira.model.RequirementPriority;
...@@ -116,7 +114,7 @@ import org.fortiss.tooling.base.ui.editor.FormsEditorBase; ...@@ -116,7 +114,7 @@ import org.fortiss.tooling.base.ui.editor.FormsEditorBase;
* @author mou * @author mou
* @author $Author$ * @author $Author$
* @version $Rev$ * @version $Rev$
* @ConQAT.Rating GREEN Hash: D60773A24DA9CE7BEF81DAD59905C982 * @ConQAT.Rating YELLOW Hash: 7BDF9D593584B95D03507376F91913E1
*/ */
public class RequirementEditor<T extends Requirement> extends FormsEditorBase<T> { public class RequirementEditor<T extends Requirement> extends FormsEditorBase<T> {
...@@ -140,9 +138,6 @@ public class RequirementEditor<T extends Requirement> extends FormsEditorBase<T> ...@@ -140,9 +138,6 @@ public class RequirementEditor<T extends Requirement> extends FormsEditorBase<T>
protected static GridDataFactory fillControlFactory = GridDataFactory.swtDefaults() protected static GridDataFactory fillControlFactory = GridDataFactory.swtDefaults()
.align(SWT.FILL, SWT.FILL).grab(true, true).hint(SWT.DEFAULT, 200); .align(SWT.FILL, SWT.FILL).grab(true, true).hint(SWT.DEFAULT, 200);
/** id observable */
protected IObservableValue idObservable;
/** /**
* Listener connected to the observable word rule of the scanner associated * Listener connected to the observable word rule of the scanner associated
* to the corresponding analysis * to the corresponding analysis
...@@ -160,14 +155,6 @@ public class RequirementEditor<T extends Requirement> extends FormsEditorBase<T> ...@@ -160,14 +155,6 @@ public class RequirementEditor<T extends Requirement> extends FormsEditorBase<T>
public void init(IEditorSite site, IEditorInput input) throws PartInitException { public void init(IEditorSite site, IEditorInput input) throws PartInitException {
super.init(site, input); super.init(site, input);
idObservable = observeValue(editedObject, REQUIREMENT__REQ_ID);
idObservable.addChangeListener(new IChangeListener() {
@Override
public void handleChange(ChangeEvent event) {
executeCommand(new SortRequirementCommand(editedObject.getAnalysis()));
}
});
registeredSourceViewers = new ArrayList<SourceViewer>(); registeredSourceViewers = new ArrayList<SourceViewer>();
createUpdateListener(); createUpdateListener();
...@@ -181,9 +168,6 @@ public class RequirementEditor<T extends Requirement> extends FormsEditorBase<T> ...@@ -181,9 +168,6 @@ public class RequirementEditor<T extends Requirement> extends FormsEditorBase<T>
wordRuleUpdateListener); wordRuleUpdateListener);
wordRuleUpdateListener = null; wordRuleUpdateListener = null;
idObservable.dispose();
idObservable = null;
super.dispose(); super.dispose();
} }
......
/*--------------------------------------------------------------------------+
$Id$
| |
| Copyright 2011 ForTISS GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package org.fortiss.af3.mira.command;
import static org.eclipse.emf.common.util.ECollections.sort;
import org.fortiss.af3.mira.model.Analysis;
import org.fortiss.af3.mira.utils.MiraUtils;
/**
* Sort the requirements according to their ID
*
* @author mou
* @author uden
* @author $Author$
* @version $Rev$
* @ConQAT.Rating GREEN Hash: BA1740CC20B34CFFE5AB11826CBA7B9A
*/
public class SortRequirementCommand implements Runnable {
/** The root container analysis */
private Analysis analysis;
/**
* Constructor.
*
* @param analysis
* the analysis, whose requirements will be sorted
*/
public SortRequirementCommand(Analysis analysis) {
super();
this.analysis = analysis;
}
/** {@inheritDoc} */
@Override
public void run() {
// getRequirement() can not be used here, because this list is read-only
// and not safe for writing back to the model
sort(analysis.getContainedElementsList(), MiraUtils.getComparator());
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment