diff options
author | Camille Letavernier | 2013-11-18 14:19:15 +0000 |
---|---|---|
committer | Camille Letavernier | 2013-11-18 14:19:15 +0000 |
commit | ba4827633bf0d405aa719670a9a66afc070b26a6 (patch) | |
tree | 1c403dd4e9cf209bd5b6257682954f7d79defa2f /extraplugins/codegen | |
parent | b1016a6d67c1aa22532356683e3eb62942db3d4b (diff) | |
download | org.eclipse.papyrus-ba4827633bf0d405aa719670a9a66afc070b26a6.tar.gz org.eclipse.papyrus-ba4827633bf0d405aa719670a9a66afc070b26a6.tar.xz org.eclipse.papyrus-ba4827633bf0d405aa719670a9a66afc070b26a6.zip |
354845: [Model Explorer] really slow with a big model
https://bugs.eclipse.org/bugs/show_bug.cgi?id=354845
Integrate contribution from L. Wouters.
Clean up code & fix small mistakes
Diffstat (limited to 'extraplugins/codegen')
2 files changed, 15 insertions, 9 deletions
diff --git a/extraplugins/codegen/org.eclipse.papyrus.texteditor.modelexplorer/src/org/eclipse/papyrus/texteditor/modelexplorer/queries/GetContainedTextEditors.java b/extraplugins/codegen/org.eclipse.papyrus.texteditor.modelexplorer/src/org/eclipse/papyrus/texteditor/modelexplorer/queries/GetContainedTextEditors.java index 35221d2ab62..c7eb315ff2c 100644 --- a/extraplugins/codegen/org.eclipse.papyrus.texteditor.modelexplorer/src/org/eclipse/papyrus/texteditor/modelexplorer/queries/GetContainedTextEditors.java +++ b/extraplugins/codegen/org.eclipse.papyrus.texteditor.modelexplorer/src/org/eclipse/papyrus/texteditor/modelexplorer/queries/GetContainedTextEditors.java @@ -37,15 +37,18 @@ public class GetContainedTextEditors extends AbstractEditorContainerQuery implem * {@inheritDoc} */ public Collection<TextEditorModel> evaluate(final EObject context, final ParameterValueList parameterValues) throws ModelQueryExecutionException { - List<TextEditorModel> result = new ArrayList<TextEditorModel>(3); + List<TextEditorModel> result = new ArrayList<TextEditorModel>(); Iterator<EObject> roots = NavigatorUtils.getNotationRoots(context); - if (roots == null) + if(roots == null) { return result; - while (roots.hasNext()) { + } + + while(roots.hasNext()) { EObject root = roots.next(); - if (root instanceof TextEditorModel) { - if (EcoreUtil.equals(((TextEditorModel)root).getEditedObject(), context)) + if(root instanceof TextEditorModel) { + if(EcoreUtil.equals(((TextEditorModel)root).getEditedObject(), context)) { result.add((TextEditorModel)root); + } } } return result; diff --git a/extraplugins/codegen/org.eclipse.papyrus.texteditor.modelexplorer/src/org/eclipse/papyrus/texteditor/modelexplorer/queries/IsTextEditorContainer.java b/extraplugins/codegen/org.eclipse.papyrus.texteditor.modelexplorer/src/org/eclipse/papyrus/texteditor/modelexplorer/queries/IsTextEditorContainer.java index 07a423e048f..8aaf591760b 100644 --- a/extraplugins/codegen/org.eclipse.papyrus.texteditor.modelexplorer/src/org/eclipse/papyrus/texteditor/modelexplorer/queries/IsTextEditorContainer.java +++ b/extraplugins/codegen/org.eclipse.papyrus.texteditor.modelexplorer/src/org/eclipse/papyrus/texteditor/modelexplorer/queries/IsTextEditorContainer.java @@ -34,13 +34,16 @@ public class IsTextEditorContainer extends AbstractEditorContainerQuery implemen */ public Boolean evaluate(final EObject context, ParameterValueList parameterValues) throws ModelQueryExecutionException { Iterator<EObject> roots = NavigatorUtils.getNotationRoots(context); - if (roots == null) + if(roots == null) { return false; - while (roots.hasNext()) { + } + + while(roots.hasNext()) { EObject root = roots.next(); - if (root instanceof TextEditorModel) { - if (EcoreUtil.equals(((TextEditorModel)root).getEditedObject(), context)) + if(root instanceof TextEditorModel) { + if(EcoreUtil.equals(((TextEditorModel)root).getEditedObject(), context)) { return true; + } } } return false; |