Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnsgar Radermacher2013-10-28 14:28:06 +0000
committerAnsgar Radermacher2013-10-28 14:28:06 +0000
commit06b02382ee6693b794162d9877c9b7d84b8e010b (patch)
treebaa127e59549c5ed2387ff79f3c4eeae637b571a /extraplugins
parent813571cd2ac6bc4d29c7396e7d081355b10a47e4 (diff)
downloadorg.eclipse.papyrus-06b02382ee6693b794162d9877c9b7d84b8e010b.tar.gz
org.eclipse.papyrus-06b02382ee6693b794162d9877c9b7d84b8e010b.tar.xz
org.eclipse.papyrus-06b02382ee6693b794162d9877c9b7d84b8e010b.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/plugin.xml4
-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
4 files changed, 25 insertions, 25 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 07f6c42061d..dccf209eea5 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
@@ -9,7 +9,8 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.jface.text;bundle-version="3.8.0",
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.cdt.core;bundle-version="5.5.0",
+ 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/plugin.xml b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen.ui/plugin.xml
index 747849c260c..18ce85fd302 100644
--- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen.ui/plugin.xml
+++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen.ui/plugin.xml
@@ -5,7 +5,7 @@
point="org.eclipse.ui.menus">
<menuContribution
allPopups="false"
- locationURI="popup:org.eclipse.papyrus.views.modelexplorer.modelexplorer.popup">
+ locationURI="popup:org.eclipse.papyrus.views.modelexplorer.modelexplorer.popup.codegen">
<command
commandId="org.eclipse.papyrus.cpp.codegen.command"
icon="icons/codegen.gif"
@@ -19,7 +19,7 @@
</menuContribution>
<menuContribution
allPopups="false"
- locationURI="popup:org.eclipse.gmf.runtime.diagram.ui.DiagramEditorContextMenu">
+ locationURI="popup:org.eclipse.gmf.runtime.diagram.ui.DiagramEditorContextMenu.codegen">
<command
commandId="org.eclipse.papyrus.cpp.codegen.command"
icon="icons/codegen.gif"
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 1945de142b2..63c6ce97ac3 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
@@ -18,22 +18,20 @@ import org.eclipse.core.commands.AbstractHandler;
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.emf.ecore.EObject;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.papyrus.acceleo.AcceleoDriver;
-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.papyrus.infra.emf.utils.BusinessModelResolver;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.PlatformUI;
@@ -114,11 +112,7 @@ public class GenerateCodeHandler extends AbstractHandler {
}
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);
@@ -129,20 +123,20 @@ public class GenerateCodeHandler extends AbstractHandler {
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