|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.izforge.izpack.util.os.Shortcut
com.izforge.izpack.util.os.Unix_Shortcut
public class Unix_Shortcut
This is the Implementation of the RFC-Based Desktop-Link. Used in KDE and GNOME.
| Field Summary | |
|---|---|
private static java.lang.String |
C
C = Comment = H+S = "# " |
private java.lang.String |
createdDirectory
internal String createdDirectory |
private static java.lang.String |
DESKTOP_EXT
DESKTOP_EXT = ".desktop" |
private java.lang.Boolean |
forAll
forAll = new Boolean(false): A flag to indicate that this should created for all users. |
java.lang.String |
FS
Internal Constant: FS = File.separator // |
private static java.lang.String |
H
H = "#" |
java.lang.StringBuffer |
hlp
Internal Help Buffer |
private java.lang.String |
itsApplnkFolder
internal String itsApplnkFolder = "applnk" |
private java.lang.String |
itsFileName
internal String itsFileName |
private java.lang.String |
itsGroupName
internal String itsGroupName |
private java.lang.String |
itsName
internal String itsName |
private int |
itsUserType
internal int itsUserType |
java.lang.String |
myHome
Internal Constant: myHome = System.getProperty("user.home") |
ShellScript |
myInstallScript
my Install ShellScript |
java.lang.String |
myXdgDesktopIconCmd
|
java.lang.String |
myXdgDesktopIconScript
|
private static java.lang.String |
N
N = "\n" |
private java.util.Properties |
props
internal Properties Set |
private static java.lang.String |
QM
QM = "\"" : QuotationMark |
private static java.lang.String |
rev
rev = "$Revision$" |
private static ShellScript |
rootScript
|
private static java.lang.String |
S
S = " " |
private int |
ShortcutType
|
java.lang.String |
su
Internal Constant: su = UnixHelper.getSuCommand() |
private static java.lang.String |
template
template = "" |
private static ShellScript |
uninstallScript
|
private java.util.List |
users
|
private static java.lang.String |
version
version = "$Id$" |
private java.lang.String |
writtenFileName
|
java.lang.String |
xdgDesktopIconCmd
Internal Constant: xdgDesktopIconCmd = UnixHelper.getCustomCommand("xdg-desktop-icon") |
| Fields inherited from class com.izforge.izpack.util.os.Shortcut |
|---|
ALL_USERS, APPLICATIONS, CURRENT_USER, DESKTOP, HIDE, MAXIMIZED, MINIMIZED, NORMAL, START_MENU, START_UP, uninstaller |
| Fields inherited from interface com.izforge.izpack.util.os.Unix_ShortcutConstants |
|---|
$$LANG_Comment, $$LANG_GenericName, $$LANG_Name, $Arguments, $Categories, $Comment, $E_QUOT, $Encoding, $Exec, $GenericName, $Icon, $MimeType, $Name, $Options_For_Terminal, $P_QUOT, $Path, $ServiceTypes, $SwallowExec, $SwallowTitle, $Terminal, $TryExec, $Type, $URL, $X_KDE_SubstituteUID, $X_KDE_Username |
| Constructor Summary | |
|---|---|
Unix_Shortcut()
Creates a new Unix_Shortcut object. |
|
| Method Summary | |
|---|---|
private void |
copyDesktopFileToAllUsersDesktop(java.io.File writtenDesktopFile)
|
static void |
copyTo(java.io.File inFile,
java.io.File outFile)
Copies the inFile file to outFile using cbuff as buffer. |
void |
createExtXdgDesktopIconCmd(java.io.File shortCutLocation)
Ceates Extended Locale Enabled XdgDesktopIcon Command script. |
void |
execPostAction()
Post Exec Action especially for the Unix Root User. |
java.lang.String |
getDirectoryCreated()
Dummy |
java.lang.String |
getFileName()
Dummy |
private java.lang.String |
getKdeApplinkFolderName()
Gets the name of the applink folder for the currently used distribution. |
private java.io.File |
getKdeBase(int userType)
Gets the KDEBasedir for the given User. |
private java.io.File |
getKdeShareApplnkFolder(int userType)
Gets the XDG path to place the menu shortcuts |
int |
getLinkType()
Gets the type of link types are: Shortcut.DESKTOP
Shortcut.APPLICATIONS
Shortcut.START_MENU
Shortcut.START_UP
|
java.util.Vector<java.lang.String> |
getProgramGroups(int userType)
Overridden compatibility method. |
java.lang.String |
getProgramsFolder(int current_user)
Gets the Programsfolder for the given User (non-Javadoc). |
private java.util.List |
getUsers()
|
int |
getUserType()
Gets the Usertype of the Shortcut. |
java.lang.String |
getWrittenFileName()
|
void |
initialize(int aType,
java.lang.String aName)
Overridden Method |
private void |
initProps()
This initialisizes all Properties Values with "". |
private void |
installDesktopFileToAllUsersDesktop(java.io.File writtenDesktopFile)
Calls and creates the Install/Unistall Script which installs Desktop Icons using xdgDesktopIconCmd un-/install |
static void |
main(java.lang.String[] args)
Test Method |
boolean |
multipleUsers()
overridden method |
java.lang.String |
replace()
Creates the Shortcut String which will be stored as File. |
void |
save()
Creates and stores the shortcut-files. |
void |
setArguments(java.lang.String args)
Set the Commandline Arguments |
void |
setCategories(java.lang.String theCategories)
Sets the Categories Field |
void |
setDescription(java.lang.String description)
Sets the Description |
void |
setEncoding(java.lang.String aEncoding)
Sets The Encoding |
void |
setIconLocation(java.lang.String path,
int index)
Sets The Icon Path |
void |
setKdeSubstUID(java.lang.String trueFalseOrNothing)
Sets The KDE Specific subst UID property |
void |
setKdeUserName(java.lang.String aUserName)
Sets The KDE Specific subst UID property |
void |
setLinkName(java.lang.String aName)
Sets the Name of this Shortcut |
void |
setLinkType(int aType)
Sets the type of this Shortcut |
void |
setMimetype(java.lang.String aMimetype)
Sets the MimeType |
void |
setProgramGroup(java.lang.String aGroupName)
Sets the ProgramGroup |
void |
setShowCommand(int show)
Sets the ShowMode |
void |
setTargetPath(java.lang.String aPath)
Sets The TargetPath |
void |
setTerminal(java.lang.String trueFalseOrNothing)
Sets the terminal |
void |
setTerminalOptions(java.lang.String someTerminalOptions)
Sets the terminal options |
void |
setTryExec(java.lang.String aTryExec)
Sets the TryExecField. |
void |
setType(java.lang.String aType)
Sets the Shortcut type (one of Application, Link or Device) |
void |
setURL(java.lang.String anUrl)
Sets the Url for type Link. |
void |
setUserType(int aUserType)
Sets the usertype. |
void |
setWorkingDirectory(java.lang.String aDirectory)
Sets the working-directory |
protected void |
setWrittenFileName(java.lang.String s)
|
boolean |
supported()
This indicates that Unix will be supported. |
java.lang.String |
toString()
Dumps the Name to console. |
private java.io.File |
writeAppShortcut(java.lang.String targetPath,
java.lang.String shortcutName,
java.lang.String shortcutDef)
Write the given ShortDefinition in a File $ShortcutName-$timestamp.desktop in the given TargetPath. |
private java.io.File |
writeAppShortcutWithOutSpace(java.lang.String targetPath,
java.lang.String shortcutName,
java.lang.String shortcutDef)
Write the given ShortDefinition in a File $ShortcutName-$timestamp.desktop in the given TargetPath. |
private java.io.File |
writeAppShortcutWithSimpleSpacehandling(java.lang.String targetPath,
java.lang.String shortcutName,
java.lang.String shortcutDef,
boolean replaceSpacesWithMinus)
Write the given ShortDefinition in a File $ShortcutName-$timestamp.desktop in the given TargetPath. |
private java.io.File |
writeShortCut(java.lang.String target,
java.lang.String shortCutDef)
Writes the given Shortcutdefinition to the given Target. |
| Methods inherited from class com.izforge.izpack.util.os.Shortcut |
|---|
cleanUp, getBasePath, getCreateForAll, getHotkey, getIconLocation, getShowCommand, getWorkingDirectory, setCreateForAll, setHotkey, setUninstaller |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private static java.lang.String version
private static java.lang.String rev
private static java.lang.String DESKTOP_EXT
private static java.lang.String template
private static final java.lang.String N
private static final java.lang.String H
private static final java.lang.String S
private static final java.lang.String C
private static final java.lang.String QM
private int ShortcutType
private static ShellScript rootScript
private static ShellScript uninstallScript
private java.util.List users
private java.lang.String createdDirectory
private int itsUserType
private java.lang.String itsGroupName
private java.lang.String itsName
private java.lang.String itsFileName
private java.lang.String itsApplnkFolder
private java.util.Properties props
private java.lang.Boolean forAll
public java.lang.StringBuffer hlp
public ShellScript myInstallScript
public final java.lang.String FS
public final java.lang.String myHome
public final java.lang.String su
public final java.lang.String xdgDesktopIconCmd
public java.lang.String myXdgDesktopIconScript
public java.lang.String myXdgDesktopIconCmd
private java.lang.String writtenFileName
| Constructor Detail |
|---|
public Unix_Shortcut()
| Method Detail |
|---|
private void initProps()
public void initialize(int aType,
java.lang.String aName)
throws java.lang.Exception
initialize in class ShortcutaType - the type or classification of the program group in which the link should exist.aName - the name of the shortcut.
java.lang.ExceptionShortcut.initialize(int, java.lang.String)public boolean supported()
supported in class Shortcuttrue if the creation of shortcuts is supported, false
if this is not supported.Shortcut.supported()public java.lang.String getDirectoryCreated()
getDirectoryCreated in class Shortcutnull.Shortcut.getDirectoryCreated()public java.lang.String getFileName()
getFileName in class ShortcutStringShortcut.getFileName()public java.util.Vector<java.lang.String> getProgramGroups(int userType)
getProgramGroups in class ShortcutuserType - the type of user for the program group set.
Vector of String objects that represent the names of
the existing program groups. It is theoretically possible that this list is empty.Shortcut.getProgramGroups(int)public java.lang.String getProgramsFolder(int current_user)
getProgramsFolder in class Shortcutcurrent_user - one of current or all
Shortcut.getProgramsFolder(int)private java.io.File getKdeShareApplnkFolder(int userType)
userType - to get for.
private java.lang.String getKdeApplinkFolderName()
private java.io.File getKdeBase(int userType)
userType - one of root or regular user
public boolean multipleUsers()
multipleUsers in class ShortcutShortcut.multipleUsers()
public void save()
throws java.lang.Exception
save in class Shortcutjava.lang.Exception - if problems are encounteredShortcut.save()
public void createExtXdgDesktopIconCmd(java.io.File shortCutLocation)
throws java.io.IOException,
ResourceNotFoundException
shortCutLocation - in which folder should this stored.
java.io.IOException
ResourceNotFoundExceptionprivate void installDesktopFileToAllUsersDesktop(java.io.File writtenDesktopFile)
writtenDesktopFile - An applications desktop file, which should be installed.
private void copyDesktopFileToAllUsersDesktop(java.io.File writtenDesktopFile)
throws java.io.IOException
writtenDesktopFile -
java.io.IOExceptionpublic void execPostAction()
execPostAction in class Shortcut
public static void copyTo(java.io.File inFile,
java.io.File outFile)
throws java.io.IOException
inFile - The File to read from.outFile - The targetFile to write to.
java.io.IOException - If an IO Error occurspublic java.lang.String getWrittenFileName()
protected void setWrittenFileName(java.lang.String s)
private java.io.File writeAppShortcut(java.lang.String targetPath,
java.lang.String shortcutName,
java.lang.String shortcutDef)
targetPath - The Path in which the files should be written.shortcutName - The Name for the FileshortcutDef - The Shortcut FileContent
private java.io.File writeAppShortcutWithOutSpace(java.lang.String targetPath,
java.lang.String shortcutName,
java.lang.String shortcutDef)
targetPath - The Path in which the files should be written.shortcutName - The Name for the FileshortcutDef - The Shortcut FileContent
private java.io.File writeAppShortcutWithSimpleSpacehandling(java.lang.String targetPath,
java.lang.String shortcutName,
java.lang.String shortcutDef,
boolean replaceSpacesWithMinus)
targetPath - The Path in which the files should be written.shortcutName - The Name for the FileshortcutDef - The Shortcut FileContent
private java.io.File writeShortCut(java.lang.String target,
java.lang.String shortCutDef)
target - shortCutDef -
public void setArguments(java.lang.String args)
setArguments in class Shortcutargs - the command line argumentsShortcut.setArguments(java.lang.String)public void setDescription(java.lang.String description)
setDescription in class Shortcutdescription - the descriptiojn stringShortcut.setDescription(java.lang.String)
public void setIconLocation(java.lang.String path,
int index)
setIconLocation in class Shortcutpath - a fully qualified file name of a file that contains the icon.index - the index of the specific icon to use in the file. If there is only one icon in
the file, use an index of 0.Shortcut.setIconLocation(java.lang.String, int)public void setLinkName(java.lang.String aName)
setLinkName in class ShortcutaName - The name that the link should display on a menu or on the desktop. Do not include
a file extension.Shortcut.setLinkName(java.lang.String)
public void setLinkType(int aType)
throws java.lang.IllegalArgumentException,
java.io.UnsupportedEncodingException
setLinkType in class ShortcutaType - The type of link desired. The following values can be set:java.lang.IllegalArgumentException - if an an invalid type is passed
java.io.UnsupportedEncodingExceptionShortcut.setLinkType(int)public void setProgramGroup(java.lang.String aGroupName)
setProgramGroup in class ShortcutaGroupName - the name of the program groupShortcut.setProgramGroup(java.lang.String)public void setShowCommand(int show)
setShowCommand in class Shortcutshow - the show command. Valid settings are: Shortcut.setShowCommand(int)public void setTargetPath(java.lang.String aPath)
setTargetPath in class ShortcutaPath - the fully qualified file name of the targetShortcut.setTargetPath(java.lang.String)public void setUserType(int aUserType)
setUserType in class ShortcutaUserType - the type of user for the link.Shortcut.setUserType(int)public void setWorkingDirectory(java.lang.String aDirectory)
setWorkingDirectory in class ShortcutaDirectory - the working directoryShortcut.setWorkingDirectory(java.lang.String)public java.lang.String toString()
toString in class java.lang.ObjectObject.toString()public java.lang.String replace()
public static void main(java.lang.String[] args)
throws java.io.IOException,
ResourceNotFoundException
args -
java.io.IOException
ResourceNotFoundExceptionpublic void setEncoding(java.lang.String aEncoding)
setEncoding in class ShortcutShortcut.setEncoding(java.lang.String)public void setKdeSubstUID(java.lang.String trueFalseOrNothing)
setKdeSubstUID in class ShortcuttrueFalseOrNothing - exactly "true" or "false" or nothingShortcut.setKdeSubstUID(java.lang.String)public void setKdeUserName(java.lang.String aUserName)
setKdeUserName in class ShortcutaUserName - The UserNameShortcut.setKdeSubstUID(java.lang.String)public void setMimetype(java.lang.String aMimetype)
setMimetype in class ShortcutShortcut.setMimetype(java.lang.String)public void setTerminal(java.lang.String trueFalseOrNothing)
setTerminal in class ShortcutShortcut.setTerminal(java.lang.String)public void setTerminalOptions(java.lang.String someTerminalOptions)
setTerminalOptions in class ShortcutShortcut.setTerminalOptions(java.lang.String)public void setType(java.lang.String aType)
setType in class ShortcutShortcut.setType(java.lang.String)public void setURL(java.lang.String anUrl)
setURL in class ShortcutShortcut.setURL(java.lang.String)public int getUserType()
getUserType in class ShortcutShortcut.getUserType()public void setCategories(java.lang.String theCategories)
setCategories in class ShortcuttheCategories - the categoriespublic void setTryExec(java.lang.String aTryExec)
setTryExec in class ShortcutaTryExec - the try exec commandpublic int getLinkType()
Shortcut
getLinkType in class Shortcutprivate java.util.List getUsers()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||