? RenameLanguage.diff
? build
? diffFile
? dist
? docs
? src/com/redhat/rhdb/admin/.nbattrs
? src/com/redhat/rhdb/admin/resources/.nbattrs
? src/com/redhat/rhdb/admin/resources/Resources.java
? src/com/redhat/rhdb/admin/resources/Resources_ja_JP.java
? src/com/redhat/rhdb/admin/resources/Resources_ru_RU.java
Index: ChangeLog
===================================================================
RCS file: /cvs/rhdb/src/rhdb/guitools/rhdb-admin/ChangeLog,v
retrieving revision 1.5
diff -c -r1.5 ChangeLog
*** ChangeLog	31 Dec 2003 13:55:48 -0000	1.5
--- ChangeLog	1 Jan 2004 14:41:38 -0000
***************
*** 1,3 ****
--- 1,17 ----
+ 2004-01-01  Benjamin Mar Kuck  <binary_data@hotmail.com>
+ 
+ 	* src/com/redhat/rhdb/admin/LanguageUpdate.java (renameLanguage):
+ 	Add new function to rename languages.
+ 	* src/com/redhat/rhdb/admin/RenameDialog.java (doOKAction): Add
+ 	handling for renaming languages.
+ 	* src/com/redhat/rhdb/admin/resources/AdminResources.java: Add new
+ 	Strings.
+ 	* src/com/redhat/rhdb/admin/resources/Resources.java.in: Add new
+ 	language menu string.
+ 	* src/com/redhat/rhdb/admin/tree/LanguageNode.java (doMenuAction):
+ 	Add handling for renaming of languages.
+ 	(getNodeMenu): Add new menu option for renaming languages.
+ 
  2003-12-31  Benjamin Mar Kuck  <binary_data@hotmail.com>
  
  	* src/com/redhat/rhdb/admin/AggregateUpdate.java (renameAggregate):
Index: src/com/redhat/rhdb/admin/LanguageUpdate.java
===================================================================
RCS file: /cvs/rhdb/src/rhdb/guitools/rhdb-admin/src/com/redhat/rhdb/admin/LanguageUpdate.java,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 LanguageUpdate.java
*** src/com/redhat/rhdb/admin/LanguageUpdate.java	21 Nov 2003 18:30:23 -0000	1.1.1.1
--- src/com/redhat/rhdb/admin/LanguageUpdate.java	1 Jan 2004 14:41:44 -0000
***************
*** 360,365 ****
--- 360,391 ----
  
  	}
  
+ 	/**
+ 	 * Renames a language
+ 	 *
+ 	 * @param client The backend client.
+ 	 * @param node the invoking language node.
+ 	 * @param name the new name of the language.
+ 	 * @throws ObjectUpdateException if the language cannot be renamed.
+ 	 */
+ 
+ 	public static void renameLanguage(AdminBackendClient client, LanguageNode node, String name) throws ObjectUpdateException {
+ 
+ 		String updateString = "ALTER LANGUAGE ";
+ 		
+ 		updateString += AdminMiscFunctions.getDoubleQuotedIdentifier(node.toString());
+ 		
+ 		updateString += " RENAME TO " + name;
+ 		
+ 		// perform the update. Any errors are passed to the parent
+ 
+ 		try {
+ 			client.performUpdate(node.getParentClusterName(), node.getParentDatabaseName(), updateString);
+ 		} catch (Exception e) {
+ 			throw new ObjectUpdateException(e.getMessage());
+ 		}	
+ 	
+ 	}
  			
  }
  
Index: src/com/redhat/rhdb/admin/RenameDialog.java
===================================================================
RCS file: /cvs/rhdb/src/rhdb/guitools/rhdb-admin/src/com/redhat/rhdb/admin/RenameDialog.java,v
retrieving revision 1.5
diff -c -r1.5 RenameDialog.java
*** src/com/redhat/rhdb/admin/RenameDialog.java	31 Dec 2003 13:54:48 -0000	1.5
--- src/com/redhat/rhdb/admin/RenameDialog.java	1 Jan 2004 14:41:48 -0000
***************
*** 237,242 ****
--- 237,244 ----
  			GroupUpdate.renameGroup(backendClient, (GroupNode) invocationNode, quotedName);
  		else if (invocationNode instanceof UserNode)
  			UserUpdate.renameUser(backendClient, (UserNode) invocationNode, quotedName);
+ 		else if (invocationNode instanceof LanguageNode)
+ 			LanguageUpdate.renameLanguage(backendClient, (LanguageNode) invocationNode, quotedName);
  		else if (invocationNode instanceof AggregateNode)
  			AggregateUpdate.renameAggregate(backendClient, (AggregateNode) invocationNode, quotedName);
  		else if (invocationNode instanceof FunctionNode)
Index: src/com/redhat/rhdb/admin/resources/AdminResources.java
===================================================================
RCS file: /cvs/rhdb/src/rhdb/guitools/rhdb-admin/src/com/redhat/rhdb/admin/resources/AdminResources.java,v
retrieving revision 1.5
diff -c -r1.5 AdminResources.java
*** src/com/redhat/rhdb/admin/resources/AdminResources.java	31 Dec 2003 13:54:48 -0000	1.5
--- src/com/redhat/rhdb/admin/resources/AdminResources.java	1 Jan 2004 14:42:34 -0000
***************
*** 296,301 ****
--- 296,302 ----
  	public static final String MENU_RENAME_VIEW			= "rename.view";
  	public static final String MENU_RENAME_TRIGGER			= "rename.trigger";
  	public static final String MENU_RENAME_USER = "menu.rename.user";
+ 	public static final String MENU_RENAME_LANGUAGE		= "menu.rename.language";
  	public static final String MENU_RENAME_FUNCTION		= "menu.rename.function";
  	public static final String MENU_RENAME_CONVERSION			= "menu.rename.conversion";
  	public static final String MENU_REPLACE_FUNCTION			= "replace.function";
Index: src/com/redhat/rhdb/admin/resources/Resources.java.in
===================================================================
RCS file: /cvs/rhdb/src/rhdb/guitools/rhdb-admin/src/com/redhat/rhdb/admin/resources/Resources.java.in,v
retrieving revision 1.5
diff -c -r1.5 Resources.java.in
*** src/com/redhat/rhdb/admin/resources/Resources.java.in	31 Dec 2003 13:54:48 -0000	1.5
--- src/com/redhat/rhdb/admin/resources/Resources.java.in	1 Jan 2004 14:43:10 -0000
***************
*** 295,300 ****
--- 295,301 ----
  		{ AdminResources.MENU_RENAME_TABLE, "RENAME TABLE..."},
  		{ AdminResources.MENU_RENAME_USER, "RENAME USER..." },
  		{ AdminResources.MENU_RENAME_VIEW,      "RENAME VIEW..." },
+ 		{ AdminResources.MENU_RENAME_LANGUAGE, "RENAME LANGUAGE..."},
  		{ AdminResources.MENU_RENAME_FUNCTION, "RENAME FUNCTION..."},
  		{ AdminResources.MENU_RENAME_CONVERSION,      "RENAME CONVERSION..." },
  		{ AdminResources.MENU_REPLACE_FUNCTION,     "REPLACE FUNCTION..." },
Index: src/com/redhat/rhdb/admin/tree/LanguageNode.java
===================================================================
RCS file: /cvs/rhdb/src/rhdb/guitools/rhdb-admin/src/com/redhat/rhdb/admin/tree/LanguageNode.java,v
retrieving revision 1.2
diff -c -r1.2 LanguageNode.java
*** src/com/redhat/rhdb/admin/tree/LanguageNode.java	23 Dec 2003 16:50:04 -0000	1.2
--- src/com/redhat/rhdb/admin/tree/LanguageNode.java	1 Jan 2004 14:43:15 -0000
***************
*** 118,124 ****
  	public void doMenuAction(String selectedMenuCaption, AdminBackendClient client, JFrame dockWindow) 
  				throws TreeNodePopulationException, ObjectDropException, DialogRaiseException {		
  		
! 		if (selectedMenuCaption == AdminResources.getString(AdminResources.MENU_DROP_RESTRICT)) {
  		
  			if (getDropResponse(dockWindow, DROP_TYPE_RESTRICT)) {
  				LanguageUpdate.dropLanguage(client, this, ObjectUpdate.DROP_TYPE_RESTRICT);
--- 118,127 ----
  	public void doMenuAction(String selectedMenuCaption, AdminBackendClient client, JFrame dockWindow) 
  				throws TreeNodePopulationException, ObjectDropException, DialogRaiseException {		
  		
! 		if (selectedMenuCaption == AdminResources.getString(AdminResources.MENU_RENAME_LANGUAGE)) {
! 			RenameDialog rd = new RenameDialog(dockWindow, this, client, this.getNodeType());
! 			rd.show();
!                 } else if (selectedMenuCaption == AdminResources.getString(AdminResources.MENU_DROP_RESTRICT)) {
  		
  			if (getDropResponse(dockWindow, DROP_TYPE_RESTRICT)) {
  				LanguageUpdate.dropLanguage(client, this, ObjectUpdate.DROP_TYPE_RESTRICT);
***************
*** 153,158 ****
--- 156,181 ----
  	public JPopupMenu getNodeMenu(AdminBackendClient client) {
  		JPopupMenu menu = new JPopupMenu();
  
+ 		// Menu items that vary according to backend
+ 		
+ 		JMenuItem jmiRename = new JMenuItem();
+ 		jmiRename.setText(AdminResources.getString(AdminResources.MENU_RENAME_LANGUAGE));
+ 		jmiRename.setEnabled(false);
+ 		
+ 		try {
+ 			
+ 			// For a consistent look, if item is not available on this version, 
+ 			// we will disable it, but still show it
+ 
+ 			if (client.getBackendVersion(this.getParentClusterName()) > 7.3) {
+ 				 jmiRename.setEnabled(true);
+ 			}
+ 
+ 		} catch (Exception e) {
+ 			// Nothing.. element will remain disabled
+ 		}
+ 		
+ 		menu.add(jmiRename);
  		menu.add(new JMenuItem(AdminResources.getString(AdminResources.MENU_DROP_RESTRICT)));
  		menu.add(new JMenuItem(AdminResources.getString(AdminResources.MENU_DROP_CASCADE)));
  		menu.add(new JMenuItem(AdminResources.getString(AdminResources.MENU_EDIT_PRIVILEGES)));
