From e80c61444c0446dcb052bd26d2eef207b97cea4e Mon Sep 17 00:00:00 2001 From: stuconnolly Date: Sun, 17 May 2009 23:35:25 +0000 Subject: Add the ability to rename tables. This could potentially be enhanced to allowing renaming views, which is supported as of MySQL version 5.0.14, but requires some version detection to take place. --- Interfaces/English.lproj/DBView.xib | 876 ++++++++++++++++++--------- Interfaces/English.lproj/Localizable.strings | Bin 21574 -> 46506 bytes Source/TablesList.h | 8 +- Source/TablesList.m | 78 ++- 4 files changed, 672 insertions(+), 290 deletions(-) diff --git a/Interfaces/English.lproj/DBView.xib b/Interfaces/English.lproj/DBView.xib index bc1f27b1..ca3a6dfa 100644 --- a/Interfaces/English.lproj/DBView.xib +++ b/Interfaces/English.lproj/DBView.xib @@ -8,7 +8,7 @@ 353.00 YES - + YES @@ -176,7 +176,6 @@ {{1, 1}, {212, 393}} - 6 @@ -208,7 +207,6 @@ {214, 395} - 530 @@ -293,7 +291,6 @@ {{1, 1}, {212, 123}} - 4 @@ -320,7 +317,6 @@ {{0, 404}, {214, 125}} - 530 @@ -387,7 +383,10 @@ 1048576 2147483647 - + + NSImage + button_action + _popUpItemAction: @@ -397,22 +396,32 @@ YES - + - Duplicate Table + Rename Table 2147483647 - + NSImage NSMenuCheckmark - + NSImage NSMenuMixedState _popUpItemAction: + + + Duplicate Table + + 2147483647 + + + _popUpItemAction: + + YES @@ -420,8 +429,8 @@ 2147483647 - - + + _popUpItemAction: @@ -431,8 +440,8 @@ 1048576 2147483647 - - + + _popUpItemAction: @@ -619,8 +628,8 @@ 1048576 2147483647 1 - - + + _popUpItemAction: @@ -638,8 +647,8 @@ 1048576 2147483647 - - + + _popUpItemAction: @@ -649,8 +658,8 @@ 1048576 2147483647 - - + + _popUpItemAction: @@ -660,8 +669,8 @@ 1048576 2147483647 - - + + _popUpItemAction: @@ -671,8 +680,8 @@ 1048576 2147483647 - - + + _popUpItemAction: @@ -2070,8 +2079,8 @@ 1048576 2147483647 1 - - + + _popUpItemAction: @@ -2117,8 +2126,8 @@ 1048576 2147483647 1 - - + + _popUpItemAction: @@ -2877,8 +2886,8 @@ 1048576 2147483647 - - + + _popUpItemAction: @@ -2888,8 +2897,8 @@ 1048576 2147483647 - - + + _popUpItemAction: @@ -2901,8 +2910,8 @@ 1048576 2147483647 - - + + _popUpItemAction: @@ -2928,10 +2937,7 @@ -2042609409 35 - - NSImage - button_action - + 400 @@ -2943,7 +2949,7 @@ 1048576 2147483647 - + _popUpItemAction: @@ -2959,8 +2965,8 @@ r 1048576 2147483647 - - + + _popUpItemAction: 1 @@ -2972,8 +2978,8 @@ r 1572864 2147483647 - - + + _popUpItemAction: 2 @@ -2985,8 +2991,8 @@ 2147483647 - - + + _popUpItemAction: @@ -2997,8 +3003,8 @@ 75yAA 262144 2147483647 - - + + _popUpItemAction: 3 @@ -3010,8 +3016,8 @@ 75yBA 262144 2147483647 - - + + _popUpItemAction: 4 @@ -3021,8 +3027,8 @@ Clear History 2147483647 - - + + _popUpItemAction: 5 @@ -3034,8 +3040,8 @@ 2147483647 - - + + _popUpItemAction: @@ -3045,8 +3051,8 @@ ] 1048576 2147483647 - - + + _popUpItemAction: 6 @@ -3057,8 +3063,8 @@ [ 1048576 2147483647 - - + + _popUpItemAction: 7 @@ -3068,8 +3074,8 @@ Completion List Gw 2147483647 - - + + _popUpItemAction: 8 @@ -3081,8 +3087,8 @@ 2147483647 - - + + _popUpItemAction: @@ -3091,8 +3097,8 @@ Editor Font... 2147483647 - - + + _popUpItemAction: @@ -3102,8 +3108,8 @@ 2147483647 1 - - + + _popUpItemAction: 9 @@ -3114,8 +3120,8 @@ 2147483647 1 - - + + _popUpItemAction: 10 @@ -3125,8 +3131,8 @@ Auto-uppercase Keywords 2147483647 - - + + _popUpItemAction: @@ -3135,8 +3141,8 @@ Update Help while typing 2147483647 - - + + _popUpItemAction: @@ -3909,7 +3915,6 @@ {{1, 17}, {688, 454}} - 2 @@ -3942,7 +3947,6 @@ {{1, 0}, {688, 17}} - 4 @@ -3951,7 +3955,6 @@ {{6, 32}, {690, 472}} - 562 @@ -5402,8 +5405,8 @@ 1048576 2147483647 1 - - + + _popUpItemAction: @@ -5421,8 +5424,8 @@ 1048576 2147483647 - - + + _popUpItemAction: @@ -5432,8 +5435,8 @@ 1048576 2147483647 - - + + _popUpItemAction: @@ -5443,8 +5446,8 @@ 1048576 2147483647 - - + + _popUpItemAction: @@ -5456,8 +5459,8 @@ 1048576 2147483647 - - + + _popUpItemAction: @@ -5467,8 +5470,8 @@ 1048576 2147483647 - - + + _popUpItemAction: @@ -5478,8 +5481,8 @@ 1048576 2147483647 - - + + _popUpItemAction: @@ -5489,8 +5492,8 @@ 1048576 2147483647 - - + + _popUpItemAction: @@ -5502,8 +5505,8 @@ 1048576 2147483647 - - + + _popUpItemAction: @@ -5513,8 +5516,8 @@ 1048576 2147483647 - - + + _popUpItemAction: @@ -5524,8 +5527,8 @@ 1048576 2147483647 - - + + _popUpItemAction: @@ -5537,8 +5540,8 @@ 1048576 2147483647 - - + + _popUpItemAction: @@ -5548,8 +5551,8 @@ 1048576 2147483647 - - + + _popUpItemAction: @@ -5559,8 +5562,8 @@ 1048576 2147483647 - - + + _popUpItemAction: @@ -5570,8 +5573,8 @@ 1048576 2147483647 - - + + _popUpItemAction: @@ -5581,8 +5584,8 @@ 1048576 2147483647 - - + + _popUpItemAction: @@ -5594,8 +5597,8 @@ 1048576 2147483647 - - + + _popUpItemAction: @@ -5605,8 +5608,8 @@ 1048576 2147483647 - - + + _popUpItemAction: @@ -5618,8 +5621,8 @@ 1048576 2147483647 - - + + _popUpItemAction: @@ -5629,8 +5632,8 @@ 1048576 2147483647 - - + + _popUpItemAction: @@ -5642,8 +5645,8 @@ 1048576 2147483647 - - + + _popUpItemAction: @@ -5653,8 +5656,8 @@ 1048576 2147483647 - - + + _popUpItemAction: @@ -5664,8 +5667,8 @@ 1048576 2147483647 - - + + _popUpItemAction: @@ -5675,8 +5678,8 @@ 1048576 2147483647 - - + + _popUpItemAction: @@ -5685,8 +5688,8 @@ EUC-KR Korean (euckr) 2147483647 - - + + _popUpItemAction: @@ -7144,8 +7147,8 @@ 1048576 2147483647 1 - - + + _popUpItemAction: @@ -7163,8 +7166,8 @@ 1048576 2147483647 - - + + _popUpItemAction: @@ -7174,8 +7177,8 @@ 1048576 2147483647 - - + + _popUpItemAction: @@ -7185,8 +7188,8 @@ 1048576 2147483647 - - + + _popUpItemAction: @@ -7447,8 +7450,8 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 1048576 2147483647 1 - - + + _popUpItemAction: @@ -7466,8 +7469,8 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 1048576 2147483647 - - + + _popUpItemAction: @@ -7477,8 +7480,8 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 1048576 2147483647 - - + + _popUpItemAction: @@ -7488,8 +7491,8 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 1048576 2147483647 - - + + _popUpItemAction: @@ -8047,7 +8050,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 {3.40282e+38, 3.40282e+38} {300, 200} - + 256 YES @@ -8247,7 +8250,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 {411, 341} - {{0, 0}, {1440, 878}} {300, 222} @@ -8349,7 +8351,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 YES - 67239424 + -2080244224 138018816 Cancel @@ -8390,8 +8392,8 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 1048576 2147483647 1 - - + + _popUpItemAction: @@ -8409,8 +8411,8 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 1048576 2147483647 - - + + _popUpItemAction: @@ -8420,8 +8422,8 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 1048576 2147483647 - - + + _popUpItemAction: @@ -8431,8 +8433,8 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 1048576 2147483647 - - + + _popUpItemAction: @@ -8444,8 +8446,8 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 1048576 2147483647 - - + + _popUpItemAction: @@ -8455,8 +8457,8 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 1048576 2147483647 - - + + _popUpItemAction: @@ -8466,8 +8468,8 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 1048576 2147483647 - - + + _popUpItemAction: @@ -8477,8 +8479,8 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 1048576 2147483647 - - + + _popUpItemAction: @@ -8490,8 +8492,8 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 1048576 2147483647 - - + + _popUpItemAction: @@ -8501,8 +8503,8 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 1048576 2147483647 - - + + _popUpItemAction: @@ -8512,8 +8514,8 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 1048576 2147483647 - - + + _popUpItemAction: @@ -8525,8 +8527,8 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 1048576 2147483647 - - + + _popUpItemAction: @@ -8536,8 +8538,8 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 1048576 2147483647 - - + + _popUpItemAction: @@ -8547,8 +8549,8 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 1048576 2147483647 - - + + _popUpItemAction: @@ -8558,8 +8560,8 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 1048576 2147483647 - - + + _popUpItemAction: @@ -8569,8 +8571,8 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 1048576 2147483647 - - + + _popUpItemAction: @@ -8582,8 +8584,8 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 1048576 2147483647 - - + + _popUpItemAction: @@ -8593,8 +8595,8 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 1048576 2147483647 - - + + _popUpItemAction: @@ -8606,8 +8608,8 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 1048576 2147483647 - - + + _popUpItemAction: @@ -8617,8 +8619,8 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 1048576 2147483647 - - + + _popUpItemAction: @@ -8630,8 +8632,8 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 1048576 2147483647 - - + + _popUpItemAction: @@ -8641,8 +8643,8 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 1048576 2147483647 - - + + _popUpItemAction: @@ -8652,8 +8654,8 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 1048576 2147483647 - - + + _popUpItemAction: @@ -8663,8 +8665,8 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 1048576 2147483647 - - + + _popUpItemAction: @@ -8673,8 +8675,8 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 EUC-KR Korean (euckr) 2147483647 - - + + _popUpItemAction: @@ -8741,8 +8743,8 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 1048576 2147483647 1 - - + + _popUpItemAction: @@ -8758,8 +8760,8 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 1048576 2147483647 - - + + _popUpItemAction: @@ -8769,8 +8771,8 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 1048576 2147483647 - - + + _popUpItemAction: @@ -8857,8 +8859,8 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 1048576 2147483647 1 - - + + _popUpItemAction: @@ -8874,8 +8876,8 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 1048576 2147483647 - - + + _popUpItemAction: @@ -8885,8 +8887,8 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 1048576 2147483647 - - + + _popUpItemAction: @@ -8895,8 +8897,8 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 Cascade 2147483647 - - + + _popUpItemAction: @@ -8905,8 +8907,8 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 Delete 2147483647 - - + + _popUpItemAction: @@ -8942,8 +8944,8 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 1048576 2147483647 1 - - + + _popUpItemAction: @@ -8959,8 +8961,8 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 1048576 2147483647 - - + + _popUpItemAction: @@ -8970,8 +8972,8 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 1048576 2147483647 - - + + _popUpItemAction: @@ -8980,8 +8982,8 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 Cascade 2147483647 - - + + _popUpItemAction: @@ -8990,8 +8992,8 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 Delete 2147483647 - - + + _popUpItemAction: @@ -9094,8 +9096,8 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 1048576 2147483647 1 - - + + _popUpItemAction: @@ -9111,8 +9113,8 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 1048576 2147483647 - - + + _popUpItemAction: @@ -9122,8 +9124,8 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 1048576 2147483647 - - + + _popUpItemAction: @@ -9159,8 +9161,8 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 1048576 2147483647 1 - - + + _popUpItemAction: @@ -9176,8 +9178,8 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 1048576 2147483647 - - + + _popUpItemAction: @@ -9187,8 +9189,8 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 1048576 2147483647 - - + + _popUpItemAction: @@ -9224,8 +9226,8 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 1048576 2147483647 1 - - + + _popUpItemAction: @@ -9241,8 +9243,8 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 1048576 2147483647 - - + + _popUpItemAction: @@ -9252,8 +9254,8 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 1048576 2147483647 - - + + _popUpItemAction: @@ -9368,6 +9370,108 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 {{0, 0}, {1440, 878}} {3.40282e+38, 3.40282e+38} + + 1 + 2 + {{343, 483}, {269, 112}} + 1886912512 + tableSheet + NSWindow + + View + + {269, 112} + {269, 112} + + + 256 + + YES + + + 256 + {{17, 78}, {235, 14}} + + YES + + 67239424 + 4194304 + Rename table %@ to: + + + + + + + + + 258 + {{20, 52}, {229, 18}} + + YES + + -1804468671 + 4326400 + + + + YES + + + + + + + 259 + {{172, 13}, {82, 28}} + + 1 + YES + + 604110336 + 138018816 + Rename + + 1 + + -2038284033 + 1 + + + DQ + 200 + 25 + + + + + 259 + {{92, 13}, {82, 28}} + + YES + + 67239424 + 138018816 + Cancel + + + -2038284033 + 1 + + + Gw + 200 + 25 + + + + {269, 112} + + + {{0, 0}, {1680, 1028}} + {269, 134} + {269, 134} + 256 @@ -11377,8 +11481,8 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 1048576 2147483647 1 - - + + _popUpItemAction: @@ -11394,8 +11498,8 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 1048576 2147483647 - - + + _popUpItemAction: @@ -11459,8 +11563,8 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 1048576 2147483647 1 - - + + _popUpItemAction: @@ -11477,8 +11581,8 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 2147483647 - - + + _popUpItemAction: @@ -11487,8 +11591,8 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 QWRkIERhdGFiYXNl4oCmA 2147483647 - - + + _popUpItemAction: @@ -11500,8 +11604,8 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 2147483647 1 - - + + _popUpItemAction: @@ -13967,22 +14071,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 5319 - - - closeTableSheet: - - - - 5362 - - - - closeTableSheet: - - - - 5363 - delegate @@ -13991,14 +14079,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 5364 - - - tableNameField - - - - 5365 - tableEncodingButton @@ -14767,6 +14847,102 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 5672 + + + renameTable: + + + + 5674 + + + + tableRenameSheet + + + + 5685 + + + + tableRenameText + + + + 5686 + + + + closeSheet: + + + + 5690 + + + + closeSheet: + + + + 5691 + + + + closeSheet: + + + + 5692 + + + + closeSheet: + + + + 5693 + + + + delegate + + + + 5694 + + + + renameTableButton + + + + 5695 + + + + renameTableMenuItem + + + + 5696 + + + + tableRenameField + + + + 5697 + + + + tableNameField + + + + 5698 + @@ -17817,6 +17993,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 + @@ -20942,6 +21119,89 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 + + 5673 + + + + + 5675 + + + YES + + + + renameTableSheet + + + 5676 + + + YES + + + + + + + + + 5677 + + + YES + + + + + + 5678 + + + YES + + + + + + 5679 + + + YES + + + + + + 5680 + + + YES + + + + + + 5681 + + + + + 5682 + + + + + 5683 + + + + + 5684 + + + @@ -22220,6 +22480,28 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 5660.IBPluginDependency 5670.IBPluginDependency 5671.IBPluginDependency + 5673.IBPluginDependency + 5675.IBEditorWindowLastContentRect + 5675.IBWindowTemplateEditedContentRect + 5675.ImportedFromIB2 + 5675.windowTemplate.hasMaxSize + 5675.windowTemplate.hasMinSize + 5675.windowTemplate.maxSize + 5675.windowTemplate.minSize + 5676.IBPluginDependency + 5676.ImportedFromIB2 + 5677.IBPluginDependency + 5677.ImportedFromIB2 + 5678.IBPluginDependency + 5678.ImportedFromIB2 + 5679.IBPluginDependency + 5679.ImportedFromIB2 + 5680.IBPluginDependency + 5680.ImportedFromIB2 + 5681.IBPluginDependency + 5682.IBPluginDependency + 5683.IBPluginDependency + 5684.IBPluginDependency 579.IBPluginDependency 579.ImportedFromIB2 580.IBPluginDependency @@ -23532,7 +23814,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - {{323, 258}, {175, 73}} + {{72, 240}, {175, 93}} com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -23554,8 +23836,8 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - {{143, 101}, {944, 550}} - {{143, 101}, {944, 550}} + {{63, 308}, {944, 550}} + {{63, 308}, {944, 550}} {{62, 352}, {845, 504}} @@ -23756,8 +24038,8 @@ aGUgYWN0aXZlIHNlbGVjdGlvbiAo4oyl4oyYUik com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - {{463, 307}, {269, 112}} - {{463, 307}, {269, 112}} + {{749, 456}, {269, 112}} + {{749, 456}, {269, 112}} @@ -24025,6 +24307,28 @@ aGUgYWN0aXZlIHNlbGVjdGlvbiAo4oyl4oyYUik com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + {{612, 378}, {269, 112}} + {{612, 378}, {269, 112}} + + + + {269, 112} + {269, 112} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -24286,7 +24590,7 @@ Y2hhbmdlIHRoZSBvcmRlcg - 5672 + 5698 @@ -25434,9 +25738,10 @@ Y2hhbmdlIHRoZSBvcmRlcg YES addTable: closeCopyTableSheet: - closeTableSheet: + closeSheet: copyTable: removeTable: + renameTable: updateTables: @@ -25447,6 +25752,7 @@ Y2hhbmdlIHRoZSBvcmRlcg id id id + id @@ -25461,6 +25767,8 @@ Y2hhbmdlIHRoZSBvcmRlcg customQueryInstance duplicateTableMenuItem removeTableMenuItem + renameTableButton + renameTableMenuItem tabView tableContentInstance tableDataInstance @@ -25468,6 +25776,9 @@ Y2hhbmdlIHRoZSBvcmRlcg tableDumpInstance tableEncodingButton tableNameField + tableRenameField + tableRenameSheet + tableRenameText tableSheet tableSourceInstance tableStatusInstance @@ -25485,6 +25796,11 @@ Y2hhbmdlIHRoZSBvcmRlcg NSMenuItem NSMenuItem id + NSMenuItem + id + id + id + id id id id diff --git a/Interfaces/English.lproj/Localizable.strings b/Interfaces/English.lproj/Localizable.strings index 3a273b00..73af67a7 100644 Binary files a/Interfaces/English.lproj/Localizable.strings and b/Interfaces/English.lproj/Localizable.strings differ diff --git a/Source/TablesList.h b/Source/TablesList.h index 9eb632ab..a1268ee7 100644 --- a/Source/TablesList.h +++ b/Source/TablesList.h @@ -57,9 +57,14 @@ enum sp_table_types IBOutlet id tableNameField; IBOutlet id tableEncodingButton; IBOutlet id addTableButton; + IBOutlet id tableRenameSheet; + IBOutlet id tableRenameField; + IBOutlet id tableRenameText; + IBOutlet id renameTableButton; IBOutlet NSMenuItem *removeTableMenuItem; IBOutlet NSMenuItem *duplicateTableMenuItem; + IBOutlet NSMenuItem *renameTableMenuItem; CMMCPConnection *mySQLConnection; @@ -72,9 +77,10 @@ enum sp_table_types // IBAction methods - (IBAction)updateTables:(id)sender; - (IBAction)addTable:(id)sender; -- (IBAction)closeTableSheet:(id)sender; +- (IBAction)closeSheet:(id)sender; - (IBAction)removeTable:(id)sender; - (IBAction)copyTable:(id)sender; +- (IBAction)renameTable:(id)sender; // copyTableSheet methods - (IBAction)closeCopyTableSheet:(id)sender; diff --git a/Source/TablesList.m b/Source/TablesList.m index ce635c9b..18fd1d9c 100644 --- a/Source/TablesList.m +++ b/Source/TablesList.m @@ -287,9 +287,9 @@ } /** - * Closes the add table sheet and stops the modal session + * Closes the current sheet and stops the modal session */ -- (IBAction)closeTableSheet:(id)sender +- (IBAction)closeSheet:(id)sender { [NSApp stopModalWithCode:[sender tag]]; } @@ -500,6 +500,52 @@ } } +/** + * Renames the currently selected table. + */ +- (IBAction)renameTable:(id)sender +{ + if ((![tableSourceInstance saveRowOnDeselect]) || (![tableContentInstance saveRowOnDeselect]) || (![tableDocumentInstance database])) { + return; + } + + [tableWindow endEditingFor:nil]; + + [tableRenameText setStringValue:[NSString stringWithFormat:@"Rename table %@ to:", [self tableName]]]; + + [NSApp beginSheet:tableRenameSheet + modalForWindow:tableWindow + modalDelegate:self + didEndSelector:nil + contextInfo:nil]; + + NSInteger returnCode = [NSApp runModalForWindow:tableRenameSheet]; + + [NSApp endSheet:tableRenameSheet]; + [tableRenameSheet orderOut:nil]; + + if (!returnCode) { + // Clear table name + [tableRenameField setStringValue:@""]; + + return; + } + + [mySQLConnection queryString:[NSString stringWithFormat:@"RENAME TABLE %@ TO %@", [[self tableName] backtickQuotedString], [[tableRenameField stringValue] backtickQuotedString]]]; + + if (![[mySQLConnection getLastErrorMessage] isEqualToString:@""]) { + NSBeginAlertSheet(NSLocalizedString(@"Unable to rename table", @"rename table error message"), + NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil, + [NSString stringWithFormat:NSLocalizedString(@"The table '%@' was unable to be renamed because an error occurred.\n\nMySQL said: %@", @"rename table error informative message"), [self tableName], [mySQLConnection getLastErrorMessage]]); + } + else { + // If there was no error, rename the table in our list and reload the table view's data + [tables replaceObjectAtIndex:[tablesListView selectedRow] withObject:[tableRenameField stringValue]]; + + [tablesListView reloadData]; + } +} + #pragma mark Alert sheet methods /** @@ -622,9 +668,15 @@ */ - (void)controlTextDidChange:(NSNotification *)notification { - if ([notification object] == tableNameField) { + id object = [notification object]; + + if (object == tableNameField) { [addTableButton setEnabled:([[tableNameField stringValue] length] > 0)]; } + + if (object == tableRenameField) { + [renameTableButton setEnabled:([[tableRenameField stringValue] length] > 0)]; + } } #pragma mark Getter methods @@ -1108,17 +1160,25 @@ - (BOOL)validateMenuItem:(NSMenuItem *)menuItem { // popup button below table list - if ([menuItem action] == @selector(copyTable:)) - { - if( [self tableType] == SP_TABLETYPE_FUNC || [self tableType] == SP_TABLETYPE_PROC ) + if ([menuItem action] == @selector(copyTable:)) { + if ([self tableType] == SP_TABLETYPE_FUNC || [self tableType] == SP_TABLETYPE_PROC) return NO; - return [tablesListView numberOfSelectedRows] == 1 && [[self tableName] length] && [tablesListView numberOfSelectedRows] > 0; + + return ([tablesListView numberOfSelectedRows] == 1) && [[self tableName] length] && [tablesListView numberOfSelectedRows] > 0; } - if ([menuItem action] == @selector(removeTable:)) - { + + if ([menuItem action] == @selector(removeTable:) ) { return [tablesListView numberOfSelectedRows] > 0; } + if ([menuItem action] == @selector(renameTable:)) { + if ([self tableType] == SP_TABLETYPE_VIEW) { + return NO; + } + + return ([tablesListView numberOfSelectedRows] == 1) && [[self tableName] length]; + } + return [super validateMenuItem:menuItem]; } -- cgit v1.2.3