You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by mg...@apache.org on 2017/01/05 22:09:34 UTC
[26/50] cayenne-modeler git commit: Added New Window menu option and
stopped opening two main windows on startup.
Added New Window menu option and stopped opening two main windows on startup.
Project: http://git-wip-us.apache.org/repos/asf/cayenne-modeler/repo
Commit: http://git-wip-us.apache.org/repos/asf/cayenne-modeler/commit/fdfaeb85
Tree: http://git-wip-us.apache.org/repos/asf/cayenne-modeler/tree/fdfaeb85
Diff: http://git-wip-us.apache.org/repos/asf/cayenne-modeler/diff/fdfaeb85
Branch: refs/heads/master
Commit: fdfaeb8548b7ea948eb35167867de4da4553c2fb
Parents: be0eace
Author: mrg <bl...@gmail.com>
Authored: Thu Oct 6 08:19:22 2016 -0400
Committer: mrg <bl...@gmail.com>
Committed: Thu Oct 6 08:19:22 2016 -0400
----------------------------------------------------------------------
.../apache/cayenne/modeler/CayenneModeler.java | 18 ++++++++++++------
.../cayenne/modeler/layout/MainWindowLayout.java | 5 +++++
src/main/resources/layouts/MainWindowLayout.fxml | 3 ++-
3 files changed, 19 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cayenne-modeler/blob/fdfaeb85/src/main/java/org/apache/cayenne/modeler/CayenneModeler.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/cayenne/modeler/CayenneModeler.java b/src/main/java/org/apache/cayenne/modeler/CayenneModeler.java
index 2c25f26..31c2bed 100644
--- a/src/main/java/org/apache/cayenne/modeler/CayenneModeler.java
+++ b/src/main/java/org/apache/cayenne/modeler/CayenneModeler.java
@@ -84,17 +84,23 @@ public class CayenneModeler extends Application
// CayenneProjectManager.addProject(cayenneProject);
+ if (cayenneProject != null)
+ {
+ openProject(cayenneProject);
+ }
+ else
+ {
+ LOGGER.error("Couldn't open Cayenne Model Project.");
+ }
+ }
+
+ public static void openProject(final CayenneProject cayenneProject) throws Exception
+ {
// TODO: Probably need to save this value off somewhere...
final MainWindowLayout mainWindow = new MainWindowLayout();
mainWindow.show();
mainWindow.displayCayenneProject(cayenneProject);
-
- // For testing data sync across windows, this creates a second editor window:
- final MainWindowLayout mainWindow2 = new MainWindowLayout();
-
- mainWindow2.show();
- mainWindow2.displayCayenneProject(cayenneProject);
}
private static PreferencesLayout preferencesLayout;
http://git-wip-us.apache.org/repos/asf/cayenne-modeler/blob/fdfaeb85/src/main/java/org/apache/cayenne/modeler/layout/MainWindowLayout.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/cayenne/modeler/layout/MainWindowLayout.java b/src/main/java/org/apache/cayenne/modeler/layout/MainWindowLayout.java
index be4f5bd..2dea597 100644
--- a/src/main/java/org/apache/cayenne/modeler/layout/MainWindowLayout.java
+++ b/src/main/java/org/apache/cayenne/modeler/layout/MainWindowLayout.java
@@ -325,6 +325,11 @@ public class MainWindowLayout
}
}
+ public void newWindow() throws Exception
+ {
+ CayenneModeler.openProject(getCayenneProject());
+ }
+
public void openPreferences() throws Exception
{
CayenneModeler.openPreferences();
http://git-wip-us.apache.org/repos/asf/cayenne-modeler/blob/fdfaeb85/src/main/resources/layouts/MainWindowLayout.fxml
----------------------------------------------------------------------
diff --git a/src/main/resources/layouts/MainWindowLayout.fxml b/src/main/resources/layouts/MainWindowLayout.fxml
index 4d0710a..28a1f92 100644
--- a/src/main/resources/layouts/MainWindowLayout.fxml
+++ b/src/main/resources/layouts/MainWindowLayout.fxml
@@ -37,8 +37,9 @@
<menus>
<Menu mnemonicParsing="false" text="File">
<items>
- <MenuItem mnemonicParsing="false" text="Unspecified Action" />
+ <MenuItem mnemonicParsing="false" text="Unspecified Action" />
<MenuItem mnemonicParsing="false" text="New" />
+ <MenuItem mnemonicParsing="false" onAction="#newWindow" text="New Window" />
<MenuItem mnemonicParsing="false" text="Open\u2026" />
<Menu mnemonicParsing="false" text="Open Recent" />
<SeparatorMenuItem mnemonicParsing="false" />