Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnsgar Radermacher2015-12-15 14:05:25 +0000
committerGerrit Code Review @ Eclipse.org2015-12-15 14:08:38 +0000
commit341c125117b480200a6317a43b32c86143549e4d (patch)
treed533846b517f3c2c82baba9c3d9d44cd7818524a /extraplugins
parentc4140ef3db709a21e1d13d20912f5f5f194a72f0 (diff)
downloadorg.eclipse.papyrus-341c125117b480200a6317a43b32c86143549e4d.tar.gz
org.eclipse.papyrus-341c125117b480200a6317a43b32c86143549e4d.tar.xz
org.eclipse.papyrus-341c125117b480200a6317a43b32c86143549e4d.zip
Bug 484389 - [CDT integration] Deleting a package in the model explorer throws an exception
Diffstat (limited to 'extraplugins')
-rw-r--r--extraplugins/codegen/org.eclipse.papyrus.texteditor.cdt/src/org/eclipse/papyrus/texteditor/cdt/listener/OperationHistoryListener.java29
1 files changed, 15 insertions, 14 deletions
diff --git a/extraplugins/codegen/org.eclipse.papyrus.texteditor.cdt/src/org/eclipse/papyrus/texteditor/cdt/listener/OperationHistoryListener.java b/extraplugins/codegen/org.eclipse.papyrus.texteditor.cdt/src/org/eclipse/papyrus/texteditor/cdt/listener/OperationHistoryListener.java
index 4ab67123438..ca34d6ab0ba 100644
--- a/extraplugins/codegen/org.eclipse.papyrus.texteditor.cdt/src/org/eclipse/papyrus/texteditor/cdt/listener/OperationHistoryListener.java
+++ b/extraplugins/codegen/org.eclipse.papyrus.texteditor.cdt/src/org/eclipse/papyrus/texteditor/cdt/listener/OperationHistoryListener.java
@@ -50,24 +50,25 @@ public class OperationHistoryListener implements IOperationHistoryListener {
EList<Classifier> regenListCopy = new BasicEList<Classifier>(ModelListener.regenList);
ModelListener.regenList.clear();
- // regen ...
+ // re-generate files from list - if they are still in a resource
for (Classifier cl : regenListCopy) {
- // System.err.println("regenerate: " + cl.getQualifiedName());
- try {
- ServicesRegistry serviceRegistry = ServiceUtilsForEObject.getInstance().getServiceRegistry(cl);
- TextEditorModelSharedResource model = (TextEditorModelSharedResource) ServiceUtils.getInstance()
- .getModelSet(serviceRegistry).getModelChecked(TextEditorModelSharedResource.MODEL_ID);
+ if (cl.eResource() != null) {
+ try {
+ ServicesRegistry serviceRegistry = ServiceUtilsForEObject.getInstance().getServiceRegistry(cl);
+ TextEditorModelSharedResource model = (TextEditorModelSharedResource) ServiceUtils.getInstance()
+ .getModelSet(serviceRegistry).getModelChecked(TextEditorModelSharedResource.MODEL_ID);
- if (model != null) {
- TextEditorModel tem = model.getTextEditorModel(cl);
- if (tem != null) {
- SyncModelToCDT.syncModelToCDT(cl, tem.getGeneratorID());
+ if (model != null) {
+ TextEditorModel tem = model.getTextEditorModel(cl);
+ if (tem != null) {
+ SyncModelToCDT.syncModelToCDT(cl, tem.getGeneratorID());
+ }
}
+ } catch (ServiceException e) {
+ Activator.log.error(e);
+ } catch (NotFoundException e) {
+ Activator.log.error(e);
}
- } catch (ServiceException e) {
- Activator.log.error(e);
- } catch (NotFoundException e) {
- Activator.log.error(e);
}
}
}

Back to the top