Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Eidsness2014-05-26 11:13:20 +0000
committerAndrew Eidsness2014-05-26 11:14:07 +0000
commit955ddbdd756d2e4d621c42437c27e82be8db293c (patch)
treefa97641c116876d2e4c34803bb6cd0008b65e5a9 /extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src
parent5636682d02fec36b226e043dc22b92a94140196f (diff)
downloadorg.eclipse.papyrus-955ddbdd756d2e4d621c42437c27e82be8db293c.tar.gz
org.eclipse.papyrus-955ddbdd756d2e4d621c42437c27e82be8db293c.tar.xz
org.eclipse.papyrus-955ddbdd756d2e4d621c42437c27e82be8db293c.zip
Remove use of new SWT.Shell()
SWT uses the Shell for internal management of windows. Among other things, this means that modal dialogs are only modal within a single Shell. This patch changes a few locations where new shell's were being created on the fly. I've modified these locations to use the dialog's currently active shell instead. Change-Id: Id88312a0b6da4d638f017727b734d75ffcd2df87 Signed-off-by: Andrew Eidsness <eclipse@jfront.com>
Diffstat (limited to 'extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src')
-rw-r--r--extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/utils/LocateCppProject.java18
1 files changed, 15 insertions, 3 deletions
diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/utils/LocateCppProject.java b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/utils/LocateCppProject.java
index fa0b92c3409..c172369fd9b 100644
--- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/utils/LocateCppProject.java
+++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/utils/LocateCppProject.java
@@ -23,7 +23,7 @@ import org.eclipse.papyrus.codegen.extensionpoints.LanguageSupport;
import org.eclipse.papyrus.cpp.codegen.Activator;
import org.eclipse.papyrus.cpp.codegen.preferences.CppCodeGenConstants;
import org.eclipse.papyrus.uml.tools.utils.PackageUtil;
-import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Display;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.PackageableElement;
@@ -72,7 +72,7 @@ public class LocateCppProject {
}
else
{
- boolean create = createIfMissing && MessageDialog.openQuestion(new Shell(),
+ boolean create = createIfMissing && openQuestion(
Messages.LocateCppProject_CreateTargetProjectTitle,
String.format(Messages.LocateCppProject_CreateTargetProjectDesc, projectName));
if (create) {
@@ -106,7 +106,7 @@ public class LocateCppProject {
// Make sure the target project has the C and C++ build natures.
try {
if(!modelProject.hasNature(CCProjectNature.CC_NATURE_ID)) {
- boolean apply = createIfMissing && (Headless || MessageDialog.openQuestion(new Shell(),
+ boolean apply = createIfMissing && (Headless || openQuestion(
Messages.LocateCppProject_ApplyCNatureTitle,
Messages.LocateCppProject_ApplyCNatureDesc));
if (!apply) {
@@ -121,4 +121,16 @@ public class LocateCppProject {
}
return modelProject;
}
+
+ private static boolean openQuestion( final String title, final String message )
+ {
+ final boolean[] ret = new boolean[]{ false };
+ Display.getDefault().syncExec(new Runnable() {
+ @Override
+ public void run() {
+ ret[0] = MessageDialog.openQuestion(Display.getCurrent().getActiveShell(), title, message );
+ }
+ });
+ return ret[0];
+ }
}

Back to the top