Skip to main content
summaryrefslogtreecommitdiffstats
path: root/demos
diff options
context:
space:
mode:
authorTom Schindl2015-01-14 11:17:56 -0500
committerTom Schindl2015-01-14 11:19:39 -0500
commit79f5e3c6c785ac67eb2cea082192e09575e3ca8e (patch)
treec569ecd68bb3d61c80848a9973a1c622a4d5a644 /demos
parent20d3349c31d851836a5c1e8f249032ee5559bc3b (diff)
downloadorg.eclipse.efxclipse-79f5e3c6c785ac67eb2cea082192e09575e3ca8e.tar.gz
org.eclipse.efxclipse-79f5e3c6c785ac67eb2cea082192e09575e3ca8e.tar.xz
org.eclipse.efxclipse-79f5e3c6c785ac67eb2cea082192e09575e3ca8e.zip
initial version with jdt server
Diffstat (limited to 'demos')
-rw-r--r--demos/org.eclipse.fx.ui.controls.sample/.classpath3
-rw-r--r--demos/org.eclipse.fx.ui.controls.sample/src/org/eclipse/fx/ui/controls/sample/DirectoryViewSample.java64
2 files changed, 66 insertions, 1 deletions
diff --git a/demos/org.eclipse.fx.ui.controls.sample/.classpath b/demos/org.eclipse.fx.ui.controls.sample/.classpath
index 17cd0ee70..348d252e9 100644
--- a/demos/org.eclipse.fx.ui.controls.sample/.classpath
+++ b/demos/org.eclipse.fx.ui.controls.sample/.classpath
@@ -1,8 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.launching.macosx.MacOSXType/Java SE 8 [1.8.0]"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.fx.ui.controls"/>
<classpathentry kind="con" path="org.eclipse.fx.ide.jdt.core.JAVAFX_CONTAINER"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.fx.core"/>
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/demos/org.eclipse.fx.ui.controls.sample/src/org/eclipse/fx/ui/controls/sample/DirectoryViewSample.java b/demos/org.eclipse.fx.ui.controls.sample/src/org/eclipse/fx/ui/controls/sample/DirectoryViewSample.java
new file mode 100644
index 000000000..c49dd6047
--- /dev/null
+++ b/demos/org.eclipse.fx.ui.controls.sample/src/org/eclipse/fx/ui/controls/sample/DirectoryViewSample.java
@@ -0,0 +1,64 @@
+package org.eclipse.fx.ui.controls.sample;
+
+import java.nio.file.Paths;
+
+import javafx.application.Application;
+import javafx.beans.Observable;
+import javafx.collections.FXCollections;
+import javafx.scene.Scene;
+import javafx.scene.control.SplitPane;
+import javafx.stage.Stage;
+
+import org.eclipse.fx.ui.controls.filesystem.DirectoryTreeView;
+import org.eclipse.fx.ui.controls.filesystem.DirectoryView;
+import org.eclipse.fx.ui.controls.filesystem.IconSize;
+import org.eclipse.fx.ui.controls.filesystem.ResourceItem;
+import org.eclipse.fx.ui.controls.filesystem.ResourcePreview;
+import org.eclipse.fx.ui.controls.filesystem.RootDirItem;
+
+public class DirectoryViewSample extends Application {
+
+ private static RootDirItem rootDirItem;
+
+ @Override
+ public void start(Stage primaryStage) throws Exception {
+ rootDirItem = ResourceItem.createObservedPath(Paths.get("/Users/tomschindl/Desktop"));
+
+ DirectoryTreeView tv = new DirectoryTreeView();
+ tv.setIconSize(IconSize.MEDIUM);
+ tv.setRootDirectories(FXCollections.observableArrayList(rootDirItem));
+
+
+ DirectoryView v = new DirectoryView();
+ v.setIconSize(IconSize.MEDIUM);
+ v.setOnOpenResource(e -> System.err.println(e.getResourceItems()));
+
+ tv.getSelectedItems().addListener( (Observable o) -> {
+ if( ! tv.getSelectedItems().isEmpty() ) {
+ v.setDir(tv.getSelectedItems().get(0));
+ } else {
+ v.setDir(null);
+ }
+ });
+
+ ResourcePreview prev = new ResourcePreview();
+ v.getSelectedItems().addListener((Observable o) -> {
+ if( v.getSelectedItems().size() == 1 ) {
+ prev.setItem(v.getSelectedItems().get(0));
+ } else {
+ prev.setItem(null);
+ }
+ });
+
+ SplitPane p = new SplitPane(tv,v, prev);
+ p.setDividerPositions(0.3,0.8);
+ Scene s = new Scene(p,500,500);
+ primaryStage.setScene(s);
+ primaryStage.show();
+ }
+
+ public static void main(String[] args) {
+ Application.launch(args);
+ rootDirItem.dispose();
+ }
+} \ No newline at end of file

Back to the top