01: package net.sourceforge.squirrel_sql.plugins.refactoring.actions;
02:
03: /*
04: * Copyright (C) 2006 Rob Manning
05: * manningr@users.sourceforge.net
06: *
07: * This program is free software; you can redistribute it and/or
08: * modify it under the terms of the GNU General Public License
09: * as published by the Free Software Foundation; either version 2
10: * of the License, or any later version.
11: *
12: * This program is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15: * GNU General Public License for more details.
16: *
17: * You should have received a copy of the GNU General Public License
18: * along with this program; if not, write to the Free Software
19: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20: */
21: import net.sourceforge.squirrel_sql.client.IApplication;
22: import net.sourceforge.squirrel_sql.client.session.action.ISessionAction;
23: import net.sourceforge.squirrel_sql.fw.sql.IDatabaseObjectInfo;
24: import net.sourceforge.squirrel_sql.fw.util.ICommand;
25: import net.sourceforge.squirrel_sql.fw.util.Resources;
26: import net.sourceforge.squirrel_sql.fw.util.StringManager;
27: import net.sourceforge.squirrel_sql.fw.util.StringManagerFactory;
28: import net.sourceforge.squirrel_sql.plugins.refactoring.commands.ModifyColumnCommand;
29:
30: public class ModifyColumnAction extends AbstractRefactoringAction
31: implements ISessionAction {
32:
33: private static final long serialVersionUID = 1L;
34:
35: /** Internationalized strings for this class. */
36: private static final StringManager s_stringMgr = StringManagerFactory
37: .getStringManager(ModifyColumnAction.class);
38:
39: private static interface i18n {
40: ///i18n[AddColumnAction.addColumnPart=add a column]
41: String columnPart = s_stringMgr
42: .getString("AddColumnAction.addColumnPart");
43: //i18n[Shared.singleObjectMessage=You must have a single table selected
44: //in order to {0}]
45: String singleObjectMessage = s_stringMgr.getString(
46: "Shared.singleObjectMessage", columnPart);
47: }
48:
49: public ModifyColumnAction(IApplication app, Resources rsrc) {
50: super (app, rsrc);
51: }
52:
53: protected ICommand getCommand(IDatabaseObjectInfo[] info) {
54: return new ModifyColumnCommand(_session, info);
55: }
56:
57: protected String getErrorMessage() {
58: return i18n.singleObjectMessage;
59: }
60:
61: @Override
62: protected boolean isMultipleObjectAction() {
63: // Can only modify a column in one table at a time
64: return false;
65: }
66:
67: }
|