public inbox for rhdb@sourceware.org
 help / color / mirror / Atom feed
From: "B.G. M.K." <binary_data@hotmail.com>
To: rhdb@sources.redhat.com
Subject: Patch for implementing rename language functionality in Java Administrator
Date: Thu, 01 Jan 2004 21:07:00 -0000	[thread overview]
Message-ID: <BAY8-F102vI2eS6yTEs00071c9e@hotmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 457 bytes --]

This patch implements functionality for renaming languages in the Java 
Administrator, when using a backend of version 7.4 or higher.

Regards,
Benjamin

_________________________________________________________________
The new MSN 8: smart spam protection and 2 months FREE*  
http://join.msn.com/?page=features/junkmail  
http://join.msn.com/?page=dept/bcomm&pgmarket=en-ca&RU=http%3a%2f%2fjoin.msn.com%2f%3fpage%3dmisc%2fspecialoffers%26pgmarket%3den-ca

[-- Attachment #2: RenameLanguage.diff --]
[-- Type: application/octet-stream, Size: 8417 bytes --]

? 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)));

                 reply	other threads:[~2004-01-01 21:07 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BAY8-F102vI2eS6yTEs00071c9e@hotmail.com \
    --to=binary_data@hotmail.com \
    --cc=rhdb@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).