Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnsgar Radermacher2013-10-28 14:28:06 +0000
committerAnsgar Radermacher2013-11-04 13:16:28 +0000
commit6abbd79ff43bf91bb7683983df91a8bd054d3840 (patch)
tree6faa84328723fd4a3b06179fde8bab6ed3989fdf /extraplugins
parent61b70f20dcd46e22e93831d517625c61f863301c (diff)
downloadorg.eclipse.papyrus-6abbd79ff43bf91bb7683983df91a8bd054d3840.tar.gz
org.eclipse.papyrus-6abbd79ff43bf91bb7683983df91a8bd054d3840.tar.xz
org.eclipse.papyrus-6abbd79ff43bf91bb7683983df91a8bd054d3840.zip
- [Bug 420375] Generating code does not refresh the Project Explorer, when there are errors
Diffstat (limited to 'extraplugins')
-rw-r--r--extraplugins/codegen/org.eclipse.papyrus.cpp.codegen.ui/META-INF/MANIFEST.MF3
-rw-r--r--extraplugins/codegen/org.eclipse.papyrus.cpp.codegen.ui/src/org/eclipse/papyrus/cpp/codegen/ui/Activator.java9
-rw-r--r--extraplugins/codegen/org.eclipse.papyrus.cpp.codegen.ui/src/org/eclipse/papyrus/cpp/codegen/ui/handler/GenerateCodeHandler.java34
3 files changed, 23 insertions, 23 deletions
diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen.ui/META-INF/MANIFEST.MF b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen.ui/META-INF/MANIFEST.MF
index e49b86b7bea..106d45464be 100644
--- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen.ui/META-INF/MANIFEST.MF
+++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen.ui/META-INF/MANIFEST.MF
@@ -10,7 +10,8 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.papyrus.infra.emf;bundle-version="0.10.1",
org.eclipse.papyrus.acceleo;bundle-version="0.10.1",
org.eclipse.cdt.core;bundle-version="5.5.0",
- org.eclipse.papyrus.acceleo.ui;bundle-version="0.10.1"
+ org.eclipse.papyrus.acceleo.ui;bundle-version="0.10.1",
+ org.eclipse.papyrus.infra.core.log;bundle-version="0.10.1"
Bundle-Vendor: %providerName
Bundle-ActivationPolicy: lazy
Bundle-Version: 0.10.1.qualifier
diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen.ui/src/org/eclipse/papyrus/cpp/codegen/ui/Activator.java b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen.ui/src/org/eclipse/papyrus/cpp/codegen/ui/Activator.java
index a8f74c72d82..bf99d5aeea7 100644
--- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen.ui/src/org/eclipse/papyrus/cpp/codegen/ui/Activator.java
+++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen.ui/src/org/eclipse/papyrus/cpp/codegen/ui/Activator.java
@@ -1,5 +1,6 @@
package org.eclipse.papyrus.cpp.codegen.ui;
+import org.eclipse.papyrus.infra.core.log.LogHelper;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
@@ -13,7 +14,9 @@ public class Activator extends AbstractUIPlugin {
// The shared instance
private static Activator plugin;
-
+
+ public static LogHelper log;
+
/**
* The constructor
*/
@@ -27,6 +30,9 @@ public class Activator extends AbstractUIPlugin {
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
+
+ // register the login helper
+ log = new LogHelper(plugin);
}
/*
@@ -46,5 +52,4 @@ public class Activator extends AbstractUIPlugin {
public static Activator getDefault() {
return plugin;
}
-
}
diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen.ui/src/org/eclipse/papyrus/cpp/codegen/ui/handler/GenerateCodeHandler.java b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen.ui/src/org/eclipse/papyrus/cpp/codegen/ui/handler/GenerateCodeHandler.java
index a9fdd8453e7..6430bba1980 100644
--- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen.ui/src/org/eclipse/papyrus/cpp/codegen/ui/handler/GenerateCodeHandler.java
+++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen.ui/src/org/eclipse/papyrus/cpp/codegen/ui/handler/GenerateCodeHandler.java
@@ -17,21 +17,19 @@ import org.eclipse.cdt.core.CProjectNature;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
import org.eclipse.emf.common.util.URI;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.papyrus.acceleo.AcceleoDriver;
import org.eclipse.papyrus.acceleo.ui.handlers.CmdHandler;
-import org.eclipse.papyrus.cpp.codegen.preferences.CppCodeGenUtils;
import org.eclipse.papyrus.cpp.codegen.transformation.CppModelElementsCreator;
-import org.eclipse.papyrus.infra.core.Activator;
+import org.eclipse.papyrus.cpp.codegen.ui.Activator;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.uml2.uml.PackageableElement;
@@ -89,11 +87,7 @@ public class GenerateCodeHandler extends CmdHandler {
}
IProject modelProject = root.getProject(uri.segment(1));
if(modelProject.exists()) {
- String name = pe.getName();
-
// get the container for the current element
- String headerSuffix = CppCodeGenUtils.getHeaderSuffix();
- String bodySuffix = CppCodeGenUtils.getBodySuffix();
AcceleoDriver.clearErrors();
CppModelElementsCreator mec = new CppModelElementsCreator(modelProject);
IContainer srcPkg = mec.getContainer(pe);
@@ -104,20 +98,20 @@ public class GenerateCodeHandler extends CmdHandler {
MessageDialog.openInformation(new Shell(), "Errors during code generation", //$NON-NLS-1$
"Errors occured during code generation. Please check the error log"); //$NON-NLS-1$
}
- IFile cppFile = srcPkg.getFile(new Path(name + "." + bodySuffix)); //$NON-NLS-1$
- IFile hFile = srcPkg.getFile(new Path(name + "." + headerSuffix)); //$NON-NLS-1$
- if(!cppFile.exists()) {
- return null;
- }
- if(cppFile != null) {
- cppFile.refreshLocal(0, null);
- }
- if(hFile != null) {
- hFile.refreshLocal(0, null);
- }
- } catch (CoreException coreException) {
+ }
+ catch (CoreException coreException) {
+ Activator.log.error(coreException);
return null;
}
+ finally {
+ // Refresh the container for the newly created files. This needs to be done even
+ // during error because of the possibility for partial results.
+ try {
+ srcPkg.refreshLocal(IResource.DEPTH_INFINITE, null);
+ } catch(CoreException e) {
+ Activator.log.error(e);
+ }
+ }
}
}
return null;

Back to the top