Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Schindl2014-06-18 03:47:12 -0400
committerTom Schindl2014-06-18 03:47:12 -0400
commit5dba7067c9450d373edde11bd1f18f65357a03c2 (patch)
treeaa7f0d22f7fb88c0fd66cb03c74ff41a39ff24f4 /testcases
parent177dc8334c65a76539045bc8826950dd9a47a5d3 (diff)
downloadorg.eclipse.efxclipse-5dba7067c9450d373edde11bd1f18f65357a03c2.tar.gz
org.eclipse.efxclipse-5dba7067c9450d373edde11bd1f18f65357a03c2.tar.xz
org.eclipse.efxclipse-5dba7067c9450d373edde11bd1f18f65357a03c2.zip
Bug 437642 - Add UISynchronize#block(BlockCondition<T>) to halt the
programm execution
Diffstat (limited to 'testcases')
-rw-r--r--testcases/org.eclipse.fx.testcases.e4/src/org/eclipse/fx/testcases/e4/lifecycle/ApplicationLifecycle.java43
1 files changed, 29 insertions, 14 deletions
diff --git a/testcases/org.eclipse.fx.testcases.e4/src/org/eclipse/fx/testcases/e4/lifecycle/ApplicationLifecycle.java b/testcases/org.eclipse.fx.testcases.e4/src/org/eclipse/fx/testcases/e4/lifecycle/ApplicationLifecycle.java
index b7eebdf70..b679ae0af 100644
--- a/testcases/org.eclipse.fx.testcases.e4/src/org/eclipse/fx/testcases/e4/lifecycle/ApplicationLifecycle.java
+++ b/testcases/org.eclipse.fx.testcases.e4/src/org/eclipse/fx/testcases/e4/lifecycle/ApplicationLifecycle.java
@@ -1,23 +1,38 @@
package org.eclipse.fx.testcases.e4.lifecycle;
-import java.net.URL;
-
-import javafx.scene.Node;
-import javafx.scene.control.Label;
+import javafx.scene.Scene;
+import javafx.scene.control.Button;
+import javafx.scene.layout.HBox;
+import javafx.stage.Stage;
import org.eclipse.e4.ui.workbench.lifecycle.PostContextCreate;
-import org.eclipse.fx.ui.dialogs.TitleAreaDialog;
+import org.eclipse.fx.ui.services.sync.UISynchronize;
+import org.eclipse.fx.ui.services.sync.UISynchronize.BlockCondition;
+@SuppressWarnings("restriction")
public class ApplicationLifecycle {
@PostContextCreate
- boolean showStartUp() {
- TitleAreaDialog d = new TitleAreaDialog(null,"Application Lifecycle","Application Lifecycle","Sample for @PostContextCreate",(URL)null) {
-
- @Override
- protected Node createDialogContent() {
- return new Label("Proceed?");
- }
- };
- return d.open() == TitleAreaDialog.OK_BUTTON;
+ boolean showStartUp(UISynchronize sync) {
+ BlockCondition<Boolean> c = new BlockCondition<Boolean>();
+ Stage s = new Stage();
+ HBox hBox = new HBox();
+ {
+ Button b = new Button("Proceed");
+ b.setOnAction((e) -> c.release(Boolean.TRUE));
+ hBox.getChildren().add(b);
+ }
+
+ {
+ Button b = new Button("Cancel");
+ b.setOnAction((e) -> c.release(Boolean.FALSE));
+ hBox.getChildren().add(b);
+ }
+
+ s.setScene(new Scene(hBox,200,200));
+ s.show();
+ Boolean rv = sync.block(c);
+ s.close();
+
+ return rv;
}
}

Back to the top