Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-32 894254969 -> 4f96cd52c


# IGNITE-32 WIP: Ignite names renaming / reverting.


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/4f96cd52
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/4f96cd52
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/4f96cd52

Branch: refs/heads/ignite-32
Commit: 4f96cd52c46cf50d5fefa554345cacb941c0461f
Parents: 8942549
Author: AKuznetsov <akuznet...@gridgain.com>
Authored: Thu Jan 15 15:45:39 2015 +0700
Committer: AKuznetsov <akuznet...@gridgain.com>
Committed: Thu Jan 15 15:45:39 2015 +0700

----------------------------------------------------------------------
 .../apache/ignite/schema/ui/SchemaLoadApp.java  | 32 ++++++++------------
 1 file changed, 13 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4f96cd52/modules/schema-load/src/main/java/org/apache/ignite/schema/ui/SchemaLoadApp.java
----------------------------------------------------------------------
diff --git 
a/modules/schema-load/src/main/java/org/apache/ignite/schema/ui/SchemaLoadApp.java
 
b/modules/schema-load/src/main/java/org/apache/ignite/schema/ui/SchemaLoadApp.java
index 35dc859..bbdd68a 100644
--- 
a/modules/schema-load/src/main/java/org/apache/ignite/schema/ui/SchemaLoadApp.java
+++ 
b/modules/schema-load/src/main/java/org/apache/ignite/schema/ui/SchemaLoadApp.java
@@ -815,18 +815,6 @@ public class SchemaLoadApp extends Application {
         genPnl.add(buttonsPane(Pos.BOTTOM_RIGHT, false,
             button("Rename", "Replace Ignite names by provided regular 
expression for current table",
                 new EventHandler<ActionEvent>() {
-                    private String checkRegex(TextField tf, String msg) {
-                        String txt = tf.getText();
-
-                        if (txt.isEmpty()) {
-                            tf.requestFocus();
-
-                            throw new IllegalStateException(msg);
-                        }
-
-                        return txt;
-                    }
-
                     /** {@inheritDoc} */
                     @Override public void handle(ActionEvent evt) {
                         if (curPojo == null) {
@@ -835,7 +823,7 @@ public class SchemaLoadApp extends Application {
                             return;
                         }
 
-                        if (!checkInput(regexTf, false, "Regular expression 
should not be empty!"))
+                        if (checkInput(regexTf, false, "Regular expression 
should not be empty!"))
                             return;
 
                         String regex = regexTf.getText();
@@ -847,15 +835,18 @@ public class SchemaLoadApp extends Application {
                                 
field.javaName(field.javaName().replaceAll(regex, replace));
                         }
                         catch (Exception e) {
-                            MessageBox.errorDialog(owner, "Failed to rename 
Ignate names!", e);
+                            MessageBox.errorDialog(owner, "Failed to rename 
Ignite names!", e);
                         }
                     }
                 }),
-            button("Rename All", "Replace Ignite names by provided regular 
expression for current table",
+            button("Rename All", "Replace Ignite names by provided regular 
expression for all tables",
                 new EventHandler<ActionEvent>() {
                 /** {@inheritDoc} */
                 @Override public void handle(ActionEvent evt) {
-                    if (!checkInput(regexTf, false, "Regular expression should 
not be empty!"))
+                    if (checkInput(regexTf, false, "Regular expression should 
not be empty!"))
+                        return;
+
+                    if (!MessageBox.confirmDialog(owner, "Are you sure you 
want to rename Ignite names in all tables?"))
                         return;
 
                     String regex = regexTf.getText();
@@ -869,11 +860,11 @@ public class SchemaLoadApp extends Application {
                                     
field.javaName(field.javaName().replaceAll(regex, replace));
                     }
                     catch (Exception e) {
-                        MessageBox.errorDialog(owner, "Failed to rename Ignate 
names!", e);
+                        MessageBox.errorDialog(owner, "Failed to rename Ignite 
names!", e);
                     }
                 }
             }),
-            button("Revert", "Revert changes to Ignite names to default ones 
for current table", new EventHandler<ActionEvent>() {
+            button("Revert", "Revert changes to Ignite names for current 
table", new EventHandler<ActionEvent>() {
                 /** {@inheritDoc} */
                 @Override public void handle(ActionEvent evt) {
                     if (curPojo != null)
@@ -882,9 +873,12 @@ public class SchemaLoadApp extends Application {
                         MessageBox.warningDialog(owner, "Please select table 
to revert changes to Ignite names!");
                 }
             }),
-            button("Revert All", "Revert changes to Ignite names to default 
ones for all tables", new EventHandler<ActionEvent>() {
+            button("Revert All", "Revert changes to Ignite names for all 
tables", new EventHandler<ActionEvent>() {
                 /** {@inheritDoc} */
                 @Override public void handle(ActionEvent evt) {
+                    if (!MessageBox.confirmDialog(owner, "Are you sure you 
want to revert Ignite names for all tables?"))
+                        return;
+
                     for (Map<String, PojoDescriptor> descs : pojos.values())
                         for (PojoDescriptor pojo : descs.values())
                             pojo.revertJavaNames();

Reply via email to