diff options
author | Tom Schindl | 2013-04-13 10:37:37 +0000 |
---|---|---|
committer | Tom Schindl | 2013-04-13 10:37:37 +0000 |
commit | 3051aa0eea6588eece1ce972e9fad859bd0fa71d (patch) | |
tree | 4ef8ee272505122c765b3ca8aba990eced07165f /bundles | |
parent | 75e60bdc1211bbc0abe6416345734744cada190e (diff) | |
download | org.eclipse.efxclipse-3051aa0eea6588eece1ce972e9fad859bd0fa71d.tar.gz org.eclipse.efxclipse-3051aa0eea6588eece1ce972e9fad859bd0fa71d.tar.xz org.eclipse.efxclipse-3051aa0eea6588eece1ce972e9fad859bd0fa71d.zip |
initial checkin
Diffstat (limited to 'bundles')
8 files changed, 211 insertions, 0 deletions
diff --git a/bundles/runtime/org.eclipse.fx.e4.controls.fx2/.classpath b/bundles/runtime/org.eclipse.fx.e4.controls.fx2/.classpath new file mode 100755 index 000000000..1e603d7d2 --- /dev/null +++ b/bundles/runtime/org.eclipse.fx.e4.controls.fx2/.classpath @@ -0,0 +1,8 @@ +<?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.debug.ui.launcher.StandardVMType/JavaSE-1.7"/> + <classpathentry kind="con" path="at.bestsolution.efxclipse.tooling.jdt.core.JAVAFX_CONTAINER"/> + <classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.fx.e4.controls"/> + <classpathentry kind="output" path="bin"/> +</classpath> diff --git a/bundles/runtime/org.eclipse.fx.e4.controls.fx2/.gitignore b/bundles/runtime/org.eclipse.fx.e4.controls.fx2/.gitignore new file mode 100644 index 000000000..5e56e040e --- /dev/null +++ b/bundles/runtime/org.eclipse.fx.e4.controls.fx2/.gitignore @@ -0,0 +1 @@ +/bin diff --git a/bundles/runtime/org.eclipse.fx.e4.controls.fx2/.project b/bundles/runtime/org.eclipse.fx.e4.controls.fx2/.project new file mode 100755 index 000000000..401d48a4d --- /dev/null +++ b/bundles/runtime/org.eclipse.fx.e4.controls.fx2/.project @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>org.eclipse.fx.e4.controls.fx2</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.xtext.ui.shared.xtextBuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.xtext.ui.shared.xtextNature</nature> + <nature>org.eclipse.jdt.core.javanature</nature> + </natures> +</projectDescription> diff --git a/bundles/runtime/org.eclipse.fx.e4.controls.fx2/.settings/org.eclipse.jdt.core.prefs b/bundles/runtime/org.eclipse.fx.e4.controls.fx2/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000..7341ab168 --- /dev/null +++ b/bundles/runtime/org.eclipse.fx.e4.controls.fx2/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,11 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.7 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.7 diff --git a/bundles/runtime/org.eclipse.fx.e4.controls.fx2/buid.jardesc b/bundles/runtime/org.eclipse.fx.e4.controls.fx2/buid.jardesc new file mode 100755 index 000000000..d999c8d26 --- /dev/null +++ b/bundles/runtime/org.eclipse.fx.e4.controls.fx2/buid.jardesc @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<jardesc> + <jar path="/Users/tomschindl/Desktop/fx2.jar"/> + <options buildIfNeeded="true" compress="true" descriptionLocation="/org.eclipse.fx.e4.controls.fx2/buid.jardesc" exportErrors="true" exportWarnings="true" includeDirectoryEntries="false" overwrite="false" saveDescription="true" storeRefactorings="false" useSourceFolders="false"/> + <storedRefactorings deprecationInfo="true" structuralOnly="false"/> + <selectedProjects/> + <manifest generateManifest="true" manifestLocation="" manifestVersion="1.0" reuseManifest="false" saveManifest="false" usesManifest="true"> + <sealing sealJar="false"> + <packagesToSeal/> + <packagesToUnSeal/> + </sealing> + </manifest> + <selectedElements exportClassFiles="true" exportJavaFiles="false" exportOutputFolder="false"> + <file path="/org.eclipse.fx.e4.controls.fx2/.classpath"/> + <javaElement handleIdentifier="=org.eclipse.fx.e4.controls.fx2/src"/> + <file path="/org.eclipse.fx.e4.controls.fx2/.project"/> + </selectedElements> +</jardesc> diff --git a/bundles/runtime/org.eclipse.fx.e4.controls.fx2/src/org/eclipse/fx/e4/controls/fx2/FX2Tab.java b/bundles/runtime/org.eclipse.fx.e4.controls.fx2/src/org/eclipse/fx/e4/controls/fx2/FX2Tab.java new file mode 100755 index 000000000..77d977cd4 --- /dev/null +++ b/bundles/runtime/org.eclipse.fx.e4.controls.fx2/src/org/eclipse/fx/e4/controls/fx2/FX2Tab.java @@ -0,0 +1,40 @@ +/******************************************************************************* + * Copyright (c) 2012 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl<tom.schindl@bestsolution.at> - initial API and implementation + *******************************************************************************/ +package org.eclipse.fx.e4.controls.fx2; + +import org.eclipse.fx.e4.controls.FXTab; + +import javafx.beans.DefaultProperty; +import javafx.scene.Node; +import javafx.scene.control.Tab; +import javafx.util.Callback; + +/** + * <p>Tabs are placed within a {@link FX2TabPane}, where each tab represents a single + * 'page'.</p> + * <p>Tabs can contain any {@link Node} such as UI controls or groups + * of nodes added to a layout container.</p> + * <p>When the user clicks + * on a Tab in the TabPane the Tab content becomes visible to the user.</p> + */ +@DefaultProperty("content") +public class FX2Tab extends Tab implements FXTab { + private Callback<Tab, Boolean> closeVetoHandler; + + public Callback<Tab, Boolean> getCloseVetoHandler() { + return closeVetoHandler; + } + + @Override + public void setCloseVetoHandler(Callback<Tab, Boolean> closeVetoHandler) { + this.closeVetoHandler = closeVetoHandler; + } +}
\ No newline at end of file diff --git a/bundles/runtime/org.eclipse.fx.e4.controls.fx2/src/org/eclipse/fx/e4/controls/fx2/FX2TabPane.java b/bundles/runtime/org.eclipse.fx.e4.controls.fx2/src/org/eclipse/fx/e4/controls/fx2/FX2TabPane.java new file mode 100755 index 000000000..3f2519dba --- /dev/null +++ b/bundles/runtime/org.eclipse.fx.e4.controls.fx2/src/org/eclipse/fx/e4/controls/fx2/FX2TabPane.java @@ -0,0 +1,21 @@ +/******************************************************************************* + * Copyright (c) 2012 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl<tom.schindl@bestsolution.at> - initial API and implementation + *******************************************************************************/ +package org.eclipse.fx.e4.controls.fx2; + +import org.eclipse.fx.e4.controls.FXTabPane; + +import javafx.beans.DefaultProperty; +import javafx.scene.control.TabPane; + +@DefaultProperty("tabs") +public class FX2TabPane extends TabPane implements FXTabPane { + +} diff --git a/bundles/runtime/org.eclipse.fx.e4.controls.fx2/src/org/eclipse/fx/e4/controls/fx2/FX2TabPaneSkin.java b/bundles/runtime/org.eclipse.fx.e4.controls.fx2/src/org/eclipse/fx/e4/controls/fx2/FX2TabPaneSkin.java new file mode 100755 index 000000000..6aba1316f --- /dev/null +++ b/bundles/runtime/org.eclipse.fx.e4.controls.fx2/src/org/eclipse/fx/e4/controls/fx2/FX2TabPaneSkin.java @@ -0,0 +1,89 @@ +/******************************************************************************* + * Copyright (c) 2012 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl<tom.schindl@bestsolution.at> - initial API and implementation + *******************************************************************************/ +package org.eclipse.fx.e4.controls.fx2; + + +import java.lang.reflect.Field; + +import javafx.collections.ListChangeListener; +import javafx.event.EventHandler; +import javafx.scene.Node; +import javafx.scene.control.TabPane; +import javafx.scene.input.MouseButton; +import javafx.scene.input.MouseEvent; +import javafx.scene.layout.StackPane; + +import com.sun.javafx.scene.control.skin.TabPaneSkin; + +public class FX2TabPaneSkin extends TabPaneSkin { + + public FX2TabPaneSkin(TabPane arg0) { + super(arg0); + try { + Field f = TabPaneSkin.class.getDeclaredField("tabHeaderArea"); + f.setAccessible(true); + Object tabHeaderArea = f.get(this); + f = tabHeaderArea.getClass().getDeclaredField("headersRegion"); + f.setAccessible(true); + StackPane headersRegion = (StackPane) f.get(tabHeaderArea); + headersRegion.getChildren().addListener(new ListChangeListener<Node>() { + + @Override + public void onChanged(javafx.collections.ListChangeListener.Change<? extends Node> c) { + while( c.next() ) { + for( Node n : c.getAddedSubList() ) { + try { + Field tabField = n.getClass().getDeclaredField("tab"); + tabField.setAccessible(true); + final FX2Tab tab = (FX2Tab) tabField.get(n); + Field btnField = n.getClass().getDeclaredField("closeBtn"); + btnField.setAccessible(true); + StackPane b = (StackPane) btnField.get(n); + final EventHandler<? super MouseEvent> originalHandler = b.onMousePressedProperty().get(); + b.setOnMousePressed(new EventHandler<MouseEvent>() { + + @Override + public void handle(MouseEvent event) { + if( tab.getCloseVetoHandler() == null || ! tab.getCloseVetoHandler().call(tab) ) { + originalHandler.handle(event); + } + } + }); + + final EventHandler<? super MouseEvent> originalHandler2 = n.onMousePressedProperty().get(); + n.setOnMousePressed(new EventHandler<MouseEvent>() { + + @Override + public void handle(MouseEvent event) { + if (event.getButton().equals(MouseButton.MIDDLE)) { + if( tab.getCloseVetoHandler() == null || ! tab.getCloseVetoHandler().call(tab) ) { + originalHandler2.handle(event); + } + } else { + originalHandler2.handle(event); + } + } + }); + } catch(Exception e) { + e.printStackTrace(); + } + } + } + } + + }); + + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } +} |