oracle.ide.cmd
Class RenameCommand
java.lang.Object
oracle.ide.addin.AbstractCommand
oracle.ide.cmd.SaveAsCommand
oracle.ide.cmd.RenameCommand
- All Implemented Interfaces:
- Command
- public class RenameCommand
- extends SaveAsCommand
The RenameCommand
class implements the Rename command.
- See Also:
oracle.ide.Command
Method Summary |
int |
doit()
Rename the selected element |
protected int |
handleDocumentOwnership(Document doc, Node node, java.net.URL oldURL)
This method handles adding/removing/replacing the document from it's owner Subclasses of the command may need to handle ownership differently (eg, RenameCommand should do something different from SaveAsCommand). |
protected boolean |
isSameFile(java.net.URL newURL, java.net.URL elementURL)
Used to determine if the new URL we're going to rename the elementURL to is the same file. |
protected int |
saveAsNewNode(Document doc)
The specified doc is being renamed. |
protected int |
saveDocument(Document doc)
|
protected java.net.URL |
validateNewURL(Recognizer recognizer, java.net.URL newURL, java.net.URL oldURL)
Validates whether the given recognizer can support rename from the oldURL to the newURL . |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
RenameCommand
public RenameCommand()
- Constructor.
doit
public int doit()
throws java.lang.Exception
- Rename the selected element
-
- Specified by:
doit
in interface Command
- Overrides:
doit
in class SaveAsCommand
-
- Throws:
java.lang.Exception
saveDocument
protected int saveDocument(Document doc)
-
- Overrides:
saveDocument
in class SaveAsCommand
saveAsNewNode
protected int saveAsNewNode(Document doc)
- The specified
doc
is being renamed. The doc
class has not changed (that is an html document has not been renamed as a jsp document).
-
- Overrides:
saveAsNewNode
in class SaveAsCommand
handleDocumentOwnership
protected int handleDocumentOwnership(Document doc,
Node node,
java.net.URL oldURL)
throws java.lang.Exception
- Description copied from class:
SaveAsCommand
- This method handles adding/removing/replacing the document from it's owner Subclasses of the command may need to handle ownership differently (eg, RenameCommand should do something different from SaveAsCommand).
-
- Overrides:
handleDocumentOwnership
in class SaveAsCommand
-
- Parameters:
doc
-
node
-
oldURL
-
- Returns:
- Throws:
java.lang.Exception
isSameFile
protected boolean isSameFile(java.net.URL newURL,
java.net.URL elementURL)
- Used to determine if the new URL we're going to rename the elementURL to is the same file. For purposes of a rename, we only need to test if the names are the same irrespective of case. This allows us to let a user rename Untitled.jsp to untitled.jsp, even on Windows. That's ok because at the end of the process there's only 1 file on disk.
-
- Overrides:
isSameFile
in class SaveAsCommand
-
- Parameters:
newURL
-
elementURL
-
- Returns:
- true if the files are the same; false otherwise
validateNewURL
protected java.net.URL validateNewURL(Recognizer recognizer,
java.net.URL newURL,
java.net.URL oldURL)
- Validates whether the given recognizer can support rename from the
oldURL
to the newURL
. If the oldURL
has an extension and the newURL
does not, a URL
with the old extension will be returned. If the oldURL
has a .jws or .jpr extension and the newURL
does not, the URL
returned will contain the .jws or .jpr extension.
-
- Overrides:
validateNewURL
in class SaveAsCommand
-
- Parameters:
recognizer
-
newURL
-
oldURL
-
- Returns:
Copyright © 1997, 2004, Oracle. All rights reserved.