|
|||||||||
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. |
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 |
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: 2163 $" |
private static ShellScript |
rootScript
|
private static java.lang.String |
S
S = " " |
private int |
ShortcutType
|
private static java.lang.String |
template
template = "" |
private static ShellScript |
uninstallScript
|
private static java.util.ArrayList |
users
|
private static java.lang.String |
version
version = "$Id: Unix_Shortcut.java 2163 2008-05-18 13:48:36Z jponge $" |
private java.lang.String |
writtenFileName
|
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 | |
---|---|
static void |
copyTo(java.io.File inFile,
java.io.File outFile)
Copies the inFile file to outFile using cbuff as buffer. |
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). |
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 "". |
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 |
writeSafeShortcut(java.lang.String targetPath,
java.lang.String shortcutName,
java.lang.String shortcutDef)
|
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 static java.util.ArrayList 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
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 Shortcut
aType
- the type or classification of the program group in which the link should exist.aName
- the name of the shortcut.
java.lang.Exception
Shortcut.initialize(int, java.lang.String)
public boolean supported()
supported
in class Shortcut
true
if the creation of shortcuts is supported, false
if this is not supported.Shortcut.supported()
public java.lang.String getDirectoryCreated()
getDirectoryCreated
in class Shortcut
null
.Shortcut.getDirectoryCreated()
public java.lang.String getFileName()
getFileName
in class Shortcut
String
Shortcut.getFileName()
public java.util.Vector<java.lang.String> getProgramGroups(int userType)
getProgramGroups
in class Shortcut
userType
- 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 Shortcut
current_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 Shortcut
Shortcut.multipleUsers()
public void save() throws java.lang.Exception
save
in class Shortcut
java.lang.Exception
- if problems are encounteredShortcut.save()
public 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 writeSafeShortcut(java.lang.String targetPath, java.lang.String shortcutName, java.lang.String shortcutDef)
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 Shortcut
args
- the command line argumentsShortcut.setArguments(java.lang.String)
public void setDescription(java.lang.String description)
setDescription
in class Shortcut
description
- the descriptiojn stringShortcut.setDescription(java.lang.String)
public void setIconLocation(java.lang.String path, int index)
setIconLocation
in class Shortcut
path
- 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 Shortcut
aName
- 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 Shortcut
aType
- The type of link desired. The following values can be set:java.lang.IllegalArgumentException
- if an an invalid type is passed
java.io.UnsupportedEncodingException
Shortcut.setLinkType(int)
public void setProgramGroup(java.lang.String aGroupName)
setProgramGroup
in class Shortcut
aGroupName
- the name of the program groupShortcut.setProgramGroup(java.lang.String)
public void setShowCommand(int show)
setShowCommand
in class Shortcut
show
- the show command. Valid settings are: Shortcut.setShowCommand(int)
public void setTargetPath(java.lang.String aPath)
setTargetPath
in class Shortcut
aPath
- the fully qualified file name of the targetShortcut.setTargetPath(java.lang.String)
public void setUserType(int aUserType)
setUserType
in class Shortcut
aUserType
- the type of user for the link.Shortcut.setUserType(int)
public void setWorkingDirectory(java.lang.String aDirectory)
setWorkingDirectory
in class Shortcut
aDirectory
- the working directoryShortcut.setWorkingDirectory(java.lang.String)
public java.lang.String toString()
toString
in class java.lang.Object
Object.toString()
public java.lang.String replace()
public static void main(java.lang.String[] args)
args
- public void setEncoding(java.lang.String aEncoding)
setEncoding
in class Shortcut
Shortcut.setEncoding(java.lang.String)
public void setKdeSubstUID(java.lang.String trueFalseOrNothing)
setKdeSubstUID
in class Shortcut
trueFalseOrNothing
- exactly "true" or "false" or nothingShortcut.setKdeSubstUID(java.lang.String)
public void setKdeUserName(java.lang.String aUserName)
setKdeUserName
in class Shortcut
aUserName
- The UserNameShortcut.setKdeSubstUID(java.lang.String)
public void setMimetype(java.lang.String aMimetype)
setMimetype
in class Shortcut
Shortcut.setMimetype(java.lang.String)
public void setTerminal(java.lang.String trueFalseOrNothing)
setTerminal
in class Shortcut
Shortcut.setTerminal(java.lang.String)
public void setTerminalOptions(java.lang.String someTerminalOptions)
setTerminalOptions
in class Shortcut
Shortcut.setTerminalOptions(java.lang.String)
public void setType(java.lang.String aType)
setType
in class Shortcut
Shortcut.setType(java.lang.String)
public void setURL(java.lang.String anUrl)
setURL
in class Shortcut
Shortcut.setURL(java.lang.String)
public int getUserType()
getUserType
in class Shortcut
Shortcut.getUserType()
public void setCategories(java.lang.String theCategories)
setCategories
in class Shortcut
theCategories
- the categoriespublic void setTryExec(java.lang.String aTryExec)
setTryExec
in class Shortcut
aTryExec
- the try exec commandpublic int getLinkType()
Shortcut
getLinkType
in class Shortcut
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |