Java Doc for ShellLink.java in  » Installer » IzPack » com » izforge » izpack » util » os » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Installer » IzPack » com.izforge.izpack.util.os 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.izforge.izpack.util.os.ShellLink

ShellLink
public class ShellLink implements NativeLibraryClient(Code)
This class represents a MS-Windows shell link, aka shortcut. It supports creation, modification and deletion as well as reporting on details of shell links. This class uses a number of native methods to access the MS-Windows registry and load save and manipulate link data. The native code is contained in the file ShellLink.cpp.

For more detailed information on Windows shortcuts read the win32 documentation from Microsoft on the IShellLink interface. There are also useful articles on this topic on the MIcrosoft website.

Using Shell Links in Windows 95
The IShellLink interface
IShellLink
version:
   0.0.1 / 1/21/02
author:
   Elmar Grom


Field Summary
final public static  intALL_USERS
     ALL_USERS = 1; the constant to use for selecting the all users.
final public static  intCURRENT_USER
     CURRENT_USER = 0; the constant to use for selecting the current user.
final public static  intDESKTOP
    
final public static  intHIDE
     Hide the window when starting.
final public static  intMAXIMIZED
     Show the window maximized when starting.
final public static  intMINIMIZED
     Show the window minimized when starting.
final public static  intMINNOACTIVE
     Show the window minimized when starting.
final public static  intNORMAL
     Show the window 'normal' when starting.
final public static  intPROGRAM_MENU
    
final public static  intSTARTUP
    
final public static  intSTART_MENU
    

Constructor Summary
public  ShellLink(int type, String name)
     Creates an instance of ShellLink of a specific type.
public  ShellLink(String name, int userType)
     Creates an instance of ShellLink from an existing shell link on disk.
public  ShellLink(int type, int userType, String group, String name)
     Creates an instance of ShellLink from an existing shell link on disk.
Parameters:
  type - The type of link, one of the following values:
  • ShellLink.DESKTOP
  • ShellLink.PROGRAM_MENU
  • ShellLink.START_MENU
  • ShellLink.STARTUP

Parameters:
  userType - the type of user for the link path.
Parameters:
  group - The program group (directory) of this link.

Method Summary
protected  voidfinalize()
     Destructor, releases COM and frees native resources.
public  voidfreeLibrary(String name)
     This method is used to free the library at the end of progam execution.
public  StringgetArguments()
     Returns the command line that the link passes to the target.
public  StringgetDescription()
     Returns the description for the link.
public  StringgetDirectoryCreated()
     Returns the path of the directory where the link file is stored, if it was necessary during the previous save operation to create the directory.
public  StringgetFileName()
     Returns the fully qualified file name under which the link is saved on disk.
public  intgetHotkey()
     Retruns the hotkey that can be used to activate the link.
public  intgetIconIndex()
    
public  StringgetIconLocation()
     Returns the path and file name of the file that contains the icon that is associated with the link.
public  StringgetLinkName()
     Returns the name shown in a menu or on the desktop for the link.
public  StringgetLinkPath(int userType)
     Returns the path where the links of the selected type are stroed.
public  intgetLinkType()
     Returns the user type for the link.
public  intgetShowCommand()
     Returns the initial condition of the target window (HIDE, NORMAL, MINIMIZED, MAXIMIZED).
public  StringgetTargetPath()
    
public  intgetUserType()
     Returns the (ShellLink) user type for the link.
public  StringgetWorkingDirectory()
     Retruns the working deirectory for the link target.
public  StringgetallUsersLinkPath()
    
public  StringgetcurrentUserLinkPath()
    
public  voidsave()
     Saves this link.
public  voidsave(String name)
     Saves this link to any desired location.
public  voidsetArguments(String arguments)
     Sets the command line arguments that will be passed to the target when the link is activated.
public  voidsetDescription(String description)
     Sets the description string that is used to identify the link in a menu or on the desktop.
public  voidsetHotkey(int hotkey)
     Sets the hotkey that can be used to activate the link.
Parameters:
  hotkey - a valid Windows virtual key code.
public  voidsetIconLocation(String path, int index)
     Sets the location of the icon that is shown for the shortcut on the desktop.
Parameters:
  path - a fully qualified file name of a file that contains the icon.
Parameters:
  index - the index of the specific icon to use in the file.
public  voidsetLinkName(String name)
     Sets the name shown in a menu or on the desktop for the link.
Parameters:
  name - The name that the link should display on a menu or on the desktop.
public  voidsetLinkType(int type)
     Sets the type of link
Parameters:
  type - The type of link desired.
public  voidsetProgramGroup(String groupName)
     Sets the name of the program group this ShellLinbk should be placed in.
public  voidsetShowCommand(int show)
     Sets the show command that is passed to the target application when the link is activated. The show command determines if the the window will be restored to the previous size, minimized, maximized or visible at all.
public  voidsetTargetPath(String path)
     Sets the absolute path to the shortcut target.
public  voidsetUserType(int type)
    
public  voidsetWorkingDirectory(String dir)
     Sets the working directory for the link target.

Field Detail
ALL_USERS
final public static int ALL_USERS(Code)
ALL_USERS = 1; the constant to use for selecting the all users.



CURRENT_USER
final public static int CURRENT_USER(Code)
CURRENT_USER = 0; the constant to use for selecting the current user.



DESKTOP
final public static int DESKTOP(Code)
This type of shortcut shows on the desktop



HIDE
final public static int HIDE(Code)
Hide the window when starting. This is particularly useful when launching from a *.bat file, because no DOS window and no button for the DOS window on the task bar will show!

Note: this option is not available through the Windows 98+ UI!



MAXIMIZED
final public static int MAXIMIZED(Code)
Show the window maximized when starting.



MINIMIZED
final public static int MINIMIZED(Code)
Show the window minimized when starting. The window will not show but a corresponding button in the task bar will.

Newer IShellLink only allows Normal, MinNoActive, Maximized.




MINNOACTIVE
final public static int MINNOACTIVE(Code)
Show the window minimized when starting. Note: for win98 and newer, use MINNOACTIVE instead of MINIMIZED.



NORMAL
final public static int NORMAL(Code)
Show the window 'normal' when starting. Restores the window properties at the last shut-down.



PROGRAM_MENU
final public static int PROGRAM_MENU(Code)
This type of shortcut shows in the program menu



STARTUP
final public static int STARTUP(Code)
This type of shortcut is executed at OS launch time



START_MENU
final public static int START_MENU(Code)
This type of shortcut shows in the start menu




Constructor Detail
ShellLink
public ShellLink(int type, String name) throws Exception, IllegalArgumentException(Code)
Creates an instance of ShellLink of a specific type. Initializes currentUserLinkPath and allUsersLinkPath.

A LinkPath is empty if the combination of linkType and userType, are not valid.

Note: If a linkPath is empty, the userType is reset to the other userType.

If both linkPaths are empty, an IllegalArgumentException is thrown.
Parameters:
  type - The type of link desired. The following values can be set:

  • ShellLink.DESKTOP
  • ShellLink.PROGRAM_MENU
  • ShellLink.START_MENU
  • ShellLink.STARTUP

Parameters:
  name - The name that the link should display on a menu or on the desktop. Do not includea file extension.
exception:
  IllegalArgumentException - if any of the call parameters are incorrect, or if nolinkPaths are returned.
exception:
  Exception - if problems are encountered in initializing the native interface



ShellLink
public ShellLink(String name, int userType) throws Exception, IllegalArgumentException(Code)
Creates an instance of ShellLink from an existing shell link on disk.
Parameters:
  name - the fully qualified file name of the link.
Parameters:
  userType - the type of user for the link path.
See Also:   ShellLink.CURRENT_USER
See Also:   ShellLink.ALL_USERS
exception:
  IllegalArgumentException - if the name was null
exception:
  Exception - if problems are encountered in reading the file



ShellLink
public ShellLink(int type, int userType, String group, String name) throws Exception, IllegalArgumentException(Code)
Creates an instance of ShellLink from an existing shell link on disk.
Parameters:
  type - The type of link, one of the following values:
  • ShellLink.DESKTOP
  • ShellLink.PROGRAM_MENU
  • ShellLink.START_MENU
  • ShellLink.STARTUP

Parameters:
  userType - the type of user for the link path.
Parameters:
  group - The program group (directory) of this link. If the link is not part of a programgroup, pass an empty string or null for this parameter. (...\\Desktop\\group).
Parameters:
  name - The file name of this link. Do not include a file extension.
See Also:   ShellLink.CURRENT_USER
See Also:   ShellLink.ALL_USERS
exception:
  IllegalArgumentException - if any of the call parameters are incorrect
exception:
  Exception - if problems are encountered in initializing the native interface




Method Detail
finalize
protected void finalize() throws Throwable(Code)
Destructor, releases COM and frees native resources.



freeLibrary
public void freeLibrary(String name)(Code)
This method is used to free the library at the end of progam execution. After this call, any instance of this calss will not be usable any more! Note that this method does NOT return!

DO NOT CALL THIS METHOD DIRECTLY!
It is used by the librarian to free the native library before physically deleting it from its temporary loaction. A call to this method will freeze the application irrecoverably!
Parameters:
  name - the name of the library to free. Use only the name and extension but not thepath.
See Also:   com.izforge.izpack.util.NativeLibraryClient.freeLibrary



getArguments
public String getArguments()(Code)
Returns the command line that the link passes to the target. the command line
See Also:   ShellLink.setArguments



getDescription
public String getDescription()(Code)
Returns the description for the link. the description
See Also:   ShellLink.setDescription



getDirectoryCreated
public String getDirectoryCreated()(Code)
Returns the path of the directory where the link file is stored, if it was necessary during the previous save operation to create the directory. This method returns null if no save operation was carried out or there was no need to create a directory during the previous save operation. the path of the directory where the link file is stored or null if nosave operation was carried out or there was no need to create a directory during the previoussave operation.



getFileName
public String getFileName()(Code)
Returns the fully qualified file name under which the link is saved on disk. Note: this method returns valid results only if the instance was created from a file on disk or after a successful save operation. the fully qualified file name for the shell link



getHotkey
public int getHotkey()(Code)
Retruns the hotkey that can be used to activate the link. the virtual keycode for the hotkey
See Also:   ShellLink.setHotkey



getIconIndex
public int getIconIndex()(Code)
Returns the index of the icon with the icon or resource file the index
See Also:   ShellLink.setIconLocation



getIconLocation
public String getIconLocation()(Code)
Returns the path and file name of the file that contains the icon that is associated with the link. the path to the icon
See Also:   ShellLink.setIconLocation



getLinkName
public String getLinkName()(Code)
Returns the name shown in a menu or on the desktop for the link. the name



getLinkPath
public String getLinkPath(int userType)(Code)
Returns the path where the links of the selected type are stroed. This method is useful for discovering which program groups already exist.
Parameters:
  userType - the type of user for the link path. One of ShellLink.CURRENT_USER orShellLink.ALL_USERS the path to the type of link set for this instance.



getLinkType
public int getLinkType()(Code)
Returns the user type for the link.


See Also:   ShellLink.setLinkType



getShowCommand
public int getShowCommand()(Code)
Returns the initial condition of the target window (HIDE, NORMAL, MINIMIZED, MAXIMIZED). the target show command
See Also:   ShellLink.setShowCommand



getTargetPath
public String getTargetPath()(Code)
Retruns the absolute path of the link target the path
See Also:   ShellLink.setTargetPath



getUserType
public int getUserType()(Code)
Returns the (ShellLink) user type for the link. Either ShellLink.CURRENT_USER or ShellLink.ALL_USERS
See Also:   ShellLink.setUserType



getWorkingDirectory
public String getWorkingDirectory()(Code)
Retruns the working deirectory for the link target. the working directory
See Also:   ShellLink.setWorkingDirectory



getallUsersLinkPath
public String getallUsersLinkPath()(Code)
Returns the path for allusersLink allusersLinkPath



getcurrentUserLinkPath
public String getcurrentUserLinkPath()(Code)
Returns the path for currentusersLink currentUsersLinkPath



save
public void save() throws Exception(Code)
Saves this link.
exception:
  Exception - if problems are encountered



save
public void save(String name) throws Exception(Code)
Saves this link to any desired location.
Parameters:
  name - the fully qualified file name for the link
exception:
  IllegalArgumentException - if the parameter was null
exception:
  Exception - if the save operation could not be carried out



setArguments
public void setArguments(String arguments)(Code)
Sets the command line arguments that will be passed to the target when the link is activated.
Parameters:
  arguments - the command line arguments
See Also:   ShellLink.getArguments



setDescription
public void setDescription(String description)(Code)
Sets the description string that is used to identify the link in a menu or on the desktop.
Parameters:
  description - the descriptiojn string
See Also:   ShellLink.getDescription



setHotkey
public void setHotkey(int hotkey)(Code)
Sets the hotkey that can be used to activate the link.
Parameters:
  hotkey - a valid Windows virtual key code. Modifiers (e.g. for alt or shift key) areadded in the upper byte. Note that only the lower 16 bits for tis parameter are used.
See Also:   ShellLink.getHotkey



setIconLocation
public void setIconLocation(String path, int index)(Code)
Sets the location of the icon that is shown for the shortcut on the desktop.
Parameters:
  path - a fully qualified file name of a file that contains the icon.
Parameters:
  index - the index of the specific icon to use in the file. If there is only one icon inthe file, use an index of 0.
See Also:   ShellLink.getIconLocation



setLinkName
public void setLinkName(String name)(Code)
Sets the name shown in a menu or on the desktop for the link.
Parameters:
  name - The name that the link should display on a menu or on the desktop. Do not includea file extension.



setLinkType
public void setLinkType(int type) throws IllegalArgumentException, UnsupportedEncodingException(Code)
Sets the type of link
Parameters:
  type - The type of link desired. The following values can be set:

exception:
  IllegalArgumentException - if an an invalid type is passed
throws:
  UnsupportedEncodingException -



setProgramGroup
public void setProgramGroup(String groupName)(Code)
Sets the name of the program group this ShellLinbk should be placed in.
Parameters:
  groupName - the name of the program group



setShowCommand
public void setShowCommand(int show)(Code)
Sets the show command that is passed to the target application when the link is activated. The show command determines if the the window will be restored to the previous size, minimized, maximized or visible at all.

Note:
Using HIDE will cause the target window not to show at all. There is not even a button on the taskbar. This is a very useful setting when batch files are used to launch a Java application as it will then appear to run just like any native Windows application.
Note1:
HIDE doesn't work in Win98 and newer systems.
use MINIMIZED (MINNOACTIVE), instead.

Parameters:
  show - the show command. Valid settings are:
  • ShellLink.HIDE (deprecated)
  • ShellLink.NORMAL
  • ShellLink.MINNOACTIVE
  • ShellLink.MAXIMIZED

See Also:   ShellLink.getShowCommand



setTargetPath
public void setTargetPath(String path)(Code)
Sets the absolute path to the shortcut target.
Parameters:
  path - the fully qualified file name of the target
See Also:   ShellLink.getTargetPath



setUserType
public void setUserType(int type) throws IllegalArgumentException(Code)
Sets the (ShellLink) user type for link
Parameters:
  type - the type of user for the link.
See Also:   ShellLink.CURRENT_USER
See Also:   ShellLink.ALL_USERS
exception:
  IllegalArgumentException - if an an invalid type is passed



setWorkingDirectory
public void setWorkingDirectory(String dir)(Code)
Sets the working directory for the link target.
Parameters:
  dir - the working directory
See Also:   ShellLink.getWorkingDirectory



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.