KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > izforge > izpack > panels > ShortcutPanel


1 /*
2  * IzPack - Copyright 2001-2007 Julien Ponge, All Rights Reserved.
3  *
4  * http://www.izforge.com/izpack/ http://developer.berlios.de/projects/izpack/
5  *
6  * Copyright 2002 Elmar Grom
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
9  * in compliance with the License. You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software distributed under the License
14  * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
15  * or implied. See the License for the specific language governing permissions and limitations under
16  * the License.
17  */

18 package com.izforge.izpack.panels;
19
20 import com.izforge.izpack.ExecutableFile;
21 import com.izforge.izpack.Pack;
22 import com.izforge.izpack.gui.ButtonFactory;
23 import com.izforge.izpack.gui.LabelFactory;
24 import com.izforge.izpack.installer.*;
25 import com.izforge.izpack.util.*;
26 import com.izforge.izpack.util.os.Shortcut;
27 import com.izforge.izpack.util.os.unix.UnixHelper;
28 import com.izforge.izpack.util.xml.XMLHelper;
29 import net.n3.nanoxml.*;
30
31 import javax.swing.*;
32 import javax.swing.border.Border JavaDoc;
33 import javax.swing.border.EmptyBorder JavaDoc;
34 import javax.swing.border.TitledBorder JavaDoc;
35 import javax.swing.event.ListSelectionEvent JavaDoc;
36 import javax.swing.event.ListSelectionListener JavaDoc;
37 import java.awt.*;
38 import java.awt.event.ActionEvent JavaDoc;
39 import java.awt.event.ActionListener JavaDoc;
40 import java.io.File JavaDoc;
41 import java.io.FileWriter JavaDoc;
42 import java.io.InputStream JavaDoc;
43 import java.util.ArrayList JavaDoc;
44 import java.util.Enumeration JavaDoc;
45 import java.util.Vector JavaDoc;
46
47 //
48
// import com.izforge.izpack.panels.ShortcutData;
49

50 /*---------------------------------------------------------------------------*/
51
52 /**
53  * This class implements a panel for the creation of shortcuts. The panel prompts the user to select
54  * a program group for shortcuts, accept the creation of desktop shortcuts and actually creates the
55  * shortcuts.
56  *
57  * Use LateShortcutInstallListener to create the Shortcuts after the Files have been installed.
58  *
59  * @version $Revision: 1708 $
60  */

61 public class ShortcutPanel extends IzPanel implements ActionListener JavaDoc, ListSelectionListener JavaDoc // ,//
62
// ShortcutConstants
63

64 {
65
66     // ~ Static fields/initializers *********************************************************
67
/** serialVersionUID = 3256722870838112311L */
68     private static final long serialVersionUID = 3256722870838112311L;
69
70     // ~ Static fields/initializers *********************************************************
71

72     /** SPEC_ATTRIBUTE_KDE_USERNAME ="KdeUsername" */
73     public final static String JavaDoc SPEC_ATTRIBUTE_KDE_USERNAME ="KdeUsername";
74     
75     /** SPEC_ATTRIBUTE_KDE_SUBST_UID = "KdeSubstUID" */
76     public final static String JavaDoc SPEC_ATTRIBUTE_KDE_SUBST_UID = "KdeSubstUID";
77
78     /** SPEC_ATTRIBUTE_URL = "url" */
79     public final static String JavaDoc SPEC_ATTRIBUTE_URL = "url";
80
81     /** SPEC_ATTRIBUTE_TYPE = "type" */
82     public final static String JavaDoc SPEC_ATTRIBUTE_TYPE = "type";
83
84     /** SPEC_ATTRIBUTE_TERMINAL_OPTIONS = "terminalOptions" */
85     public final static String JavaDoc SPEC_ATTRIBUTE_TERMINAL_OPTIONS = "terminalOptions";
86
87     /** SPEC_ATTRIBUTE_TERMINAL = "terminal" */
88     public final static String JavaDoc SPEC_ATTRIBUTE_TERMINAL = "terminal";
89
90     /** SPEC_ATTRIBUTE_MIMETYPE = "mimetype" */
91     public final static String JavaDoc SPEC_ATTRIBUTE_MIMETYPE = "mimetype";
92
93     /** SPEC_ATTRIBUTE_ENCODING = "encoding" */
94     public final static String JavaDoc SPEC_ATTRIBUTE_ENCODING = "encoding";
95
96     /** LOCATION_APPLICATIONS=applications */
97     private static final String JavaDoc LOCATION_APPLICATIONS = "applications";
98
99     /** LOCATION_START_MENU = "startMenu" */
100     private static final String JavaDoc LOCATION_START_MENU = "startMenu";
101     
102     /** SPEC_CATEGORIES = "categories" */
103     public static final String JavaDoc SPEC_CATEGORIES = "categories";
104     
105     /** SPEC_TRYEXEC = "tryexec" */
106     public static final String JavaDoc SPEC_TRYEXEC = "tryexec";
107     
108
109     /**
110      * SEPARATOR_LINE =
111      * "--------------------------------------------------------------------------------";
112      */

113     private static final String JavaDoc SEPARATOR_LINE = "--------------------------------------------------------------------------------";
114
115     /**
116      * The default file name for the text file in which the shortcut information should be stored,
117      * in case shortcuts can not be created on a particular target system. TEXT_FILE_NAME =
118      * "Shortcuts.txt"
119      */

120     private static final String JavaDoc TEXT_FILE_NAME = "Shortcuts.txt";
121
122     /**
123      * The name of the XML file that specifies the shortcuts SPEC_FILE_NAME = "shortcutSpec.xml";
124      */

125     private static final String JavaDoc SPEC_FILE_NAME = "shortcutSpec.xml";
126
127     // ------------------------------------------------------
128
// spec file section keys
129
// -----------------------------------------------------
130

131     /** SPEC_KEY_SKIP_IFNOT_SUPPORTED = "skipIfNotSupported" */
132     private static final String JavaDoc SPEC_KEY_SKIP_IFNOT_SUPPORTED = "skipIfNotSupported";
133
134     /** SPEC_KEY_NOT_SUPPORTED = "notSupported" */
135     private static final String JavaDoc SPEC_KEY_NOT_SUPPORTED = "notSupported";
136
137     /** SPEC_KEY_PROGRAM_GROUP = "programGroup" */
138     private static final String JavaDoc SPEC_KEY_PROGRAM_GROUP = "programGroup";
139
140     /** SPEC_KEY_SHORTCUT = "shortcut" */
141     private static final String JavaDoc SPEC_KEY_SHORTCUT = "shortcut";
142
143     /** SPEC_KEY_PACKS = "createForPack" */
144     private static final String JavaDoc SPEC_KEY_PACKS = "createForPack";
145
146     // ------------------------------------------------------
147
// spec file key attributes
148
// ------------------------------------------------------
149
/** SPEC_ATTRIBUTE_DEFAULT_GROUP = "defaultName" */
150     private static final String JavaDoc SPEC_ATTRIBUTE_DEFAULT_GROUP = "defaultName";
151     
152     /** Support the InstallGroups like in Packs.
153      * SPEC_ATTRIBUTE_INSTALLGROUP = "installGroup" */

154     private static final String JavaDoc SPEC_ATTRIBUTE_INSTALLGROUP = "installGroup";
155
156     /** SPEC_ATTRIBUTE_LOCATION = "location" */
157     private static final String JavaDoc SPEC_ATTRIBUTE_LOCATION = "location";
158
159     /** SPEC_ATTRIBUTE_NAME = "name" */
160     private static final String JavaDoc SPEC_ATTRIBUTE_NAME = "name";
161
162     /** SPEC_ATTRIBUTE_SUBGROUP = "subgroup" */
163     private static final String JavaDoc SPEC_ATTRIBUTE_SUBGROUP = "subgroup";
164
165     /** SPEC_ATTRIBUTE_DESCRIPTION = "description" */
166     private static final String JavaDoc SPEC_ATTRIBUTE_DESCRIPTION = "description";
167
168     /** SPEC_ATTRIBUTE_TARGET = "target" */
169     private static final String JavaDoc SPEC_ATTRIBUTE_TARGET = "target";
170
171     /** SPEC_ATTRIBUTE_COMMAND = "commandLine" */
172     private static final String JavaDoc SPEC_ATTRIBUTE_COMMAND = "commandLine";
173
174     /** SPEC_ATTRIBUTE_ICON "iconFile" */
175     private static final String JavaDoc SPEC_ATTRIBUTE_ICON = "iconFile";
176
177     /** SPEC_ATTRIBUTE_ICON_INDEX "iconIndex" */
178     private static final String JavaDoc SPEC_ATTRIBUTE_ICON_INDEX = "iconIndex";
179
180     /** SPEC_ATTRIBUTE_WORKING_DIR = "workingDirectory" */
181     private static final String JavaDoc SPEC_ATTRIBUTE_WORKING_DIR = "workingDirectory";
182
183     /** SPEC_ATTRIBUTE_INITIAL_STATE = "initialState" */
184     private static final String JavaDoc SPEC_ATTRIBUTE_INITIAL_STATE = "initialState";
185
186     /** SPEC_ATTRIBUTE_DESKTOP = "desktop" */
187     private static final String JavaDoc SPEC_ATTRIBUTE_DESKTOP = "desktop";
188
189     /** SPEC_ATTRIBUTE_APPLICATIONS = "applications" */
190     private static final String JavaDoc SPEC_ATTRIBUTE_APPLICATIONS = "applications";
191
192     /** SPEC_ATTRIBUTE_START_MENU = "startMenu" */
193     private static final String JavaDoc SPEC_ATTRIBUTE_START_MENU = "startMenu";
194
195     /** SPEC_ATTRIBUTE_STARTUP = "startup" */
196     private static final String JavaDoc SPEC_ATTRIBUTE_STARTUP = "startup";
197
198     /** SPEC_ATTRIBUTE_PROGRAM_GROUP = "programGroup" */
199     private static final String JavaDoc SPEC_ATTRIBUTE_PROGRAM_GROUP = "programGroup";
200
201     // ------------------------------------------------------
202
// spec file attribute values
203
// ------------------------------------------------------
204

205     /** SPEC_VALUE_APPLICATIONS = "applications" */
206     private static final String JavaDoc SPEC_VALUE_APPLICATIONS = "applications";
207
208     /** SPEC_VALUE_START_MENU = "startMenu" */
209     private static final String JavaDoc SPEC_VALUE_START_MENU = "startMenu";
210
211     /** SPEC_VALUE_NO_SHOW = "noShow" */
212     private static final String JavaDoc SPEC_VALUE_NO_SHOW = "noShow";
213
214     /** SPEC_VALUE_NORMAL = "normal" */
215     private static final String JavaDoc SPEC_VALUE_NORMAL = "normal";
216
217     /** SPEC_VALUE_MAXIMIZED = "maximized" */
218     private static final String JavaDoc SPEC_VALUE_MAXIMIZED = "maximized";
219
220     /** SPEC_VALUE_MINIMIZED = "minimized" */
221     private static final String JavaDoc SPEC_VALUE_MINIMIZED = "minimized";
222
223     // ------------------------------------------------------
224
// automatic script section keys
225
// ------------------------------------------------------
226

227     /** AUTO_KEY_PROGRAM_GROUP = SPEC_KEY_PROGRAM_GROUP = "programGroup" */
228     public static final String JavaDoc AUTO_KEY_PROGRAM_GROUP = SPEC_KEY_PROGRAM_GROUP;
229
230     /** AUTO_KEY_SHORTCUT = SPEC_KEY_SHORTCUT = "shortcut" */
231     public static final String JavaDoc AUTO_KEY_SHORTCUT = SPEC_KEY_SHORTCUT;
232
233     // ------------------------------------------------------
234
// automatic script keys attributes
235
// ------------------------------------------------------
236

237     /** AUTO_ATTRIBUTE_NAME = "name" */
238     public static final String JavaDoc AUTO_ATTRIBUTE_NAME = "name";
239
240     /** AUTO_ATTRIBUTE_GROUP = "group" */
241     public static final String JavaDoc AUTO_ATTRIBUTE_GROUP = "group";
242
243     /** AUTO_ATTRIBUTE_TYPE "type" */
244     public static final String JavaDoc AUTO_ATTRIBUTE_TYPE = "type";
245
246     /** AUTO_ATTRIBUTE_COMMAND = "commandLine" */
247     public static final String JavaDoc AUTO_ATTRIBUTE_COMMAND = "commandLine";
248
249     /** AUTO_ATTRIBUTE_DESCRIPTION = "description" */
250     public static final String JavaDoc AUTO_ATTRIBUTE_DESCRIPTION = "description";
251
252     /** AUTO_ATTRIBUTE_ICON = "icon" */
253     public static final String JavaDoc AUTO_ATTRIBUTE_ICON = "icon";
254
255     /** AUTO_ATTRIBUTE_ICON_INDEX = "iconIndex" */
256     public static final String JavaDoc AUTO_ATTRIBUTE_ICON_INDEX = "iconIndex";
257
258     /** AUTO_ATTRIBUTE_INITIAL_STATE = "initialState" */
259     public static final String JavaDoc AUTO_ATTRIBUTE_INITIAL_STATE = "initialState";
260
261     /** AUTO_ATTRIBUTE_TARGET = "target" */
262     public static final String JavaDoc AUTO_ATTRIBUTE_TARGET = "target";
263
264     /** AUTO_ATTRIBUTE_WORKING_DIR = "workingDirectory" */
265     public static final String JavaDoc AUTO_ATTRIBUTE_WORKING_DIR = "workingDirectory";
266
267     // permission flags
268

269     /** CREATE_FOR_ALL = "createForAll" */
270     public static final String JavaDoc CREATE_FOR_ALL = "createForAll";
271
272     private static ShortcutPanel self = null;
273
274     /** internal flag: create */
275     static boolean create;
276     
277     /**
278      * May be switched by an installerlistener to false.
279      * Installerlistener may then perform the creation of the shortcuts after the files have been installed...
280      * Default is true.
281      */

282     public static boolean createImmediately = true;
283
284     /** internal flag isRootUser */
285     private static boolean isRootUser;
286
287     // ~ Instance fields ********************************************************************
288

289     // ~ Instance fields ********************************************************************
290

291     /** a VectorList of Files wich should be make executable */
292     private Vector JavaDoc execFiles = new Vector JavaDoc();
293
294     // ------------------------------------------------------------------------
295
// Variable Declarations
296
// ------------------------------------------------------------------------
297

298     /** UI element to label the list of existing program groups */
299     private JLabel listLabel;
300
301     /** UI element to present the list of existing program groups for selection */
302     private JList groupList;
303
304     /** UI element for listing the intended shortcut targets */
305     private JList targetList;
306
307     /**
308      * UI element to present the default name for the program group and to support editing of this
309      * name.
310      */

311     private JTextField programGroup;
312
313     /** UI element to allow the user to revert to the default name of the program group */
314     private JButton defaultButton;
315
316     /** UI element to allow the user to save a text file with the shortcut information */
317     private JButton saveButton;
318
319     /**
320      * UI element to allow the user to decide if shortcuts should be placed on the desktop or not.
321      */

322     private JCheckBox allowDesktopShortcut;
323
324     /** Checkbox to enable/disable to chreate ShortCuts */
325     private JCheckBox createShortcuts;
326
327     /** UI element instruct this panel to create shortcuts for the current user only */
328     private JRadioButton currentUser;
329
330     /** UI element instruct this panel to create shortcuts for all users */
331     private JRadioButton allUsers;
332
333     /** The layout for this panel */
334     private GridBagLayout layout;
335
336     /** The contraints object to use whan creating the layout */
337     private GridBagConstraints constraints;
338
339     /**
340      * The default name to use for the program group. This comes from the XML specification.
341      */

342     private String JavaDoc suggestedProgramGroup;
343
344     /** The name chosen by the user for the program group, */
345     private String JavaDoc groupName;
346
347     /**
348      * The location for placign the program group. This is the same as the location (type) of a
349      * shortcut, only that it applies to the program group. Note that there are only two locations
350      * that make sense as location for a program group: <br>
351      * applications start menu
352      */

353     private int groupLocation;
354
355     /** The parsed result from reading the XML specification from the file */
356     private XMLElement spec;
357
358     /** Set to true by analyzeShortcutSpec() if there are any desktop shortcuts to create. */
359     private boolean hasDesktopShortcuts = false;
360
361     /** Tells wether to skip if the platform is not supported. */
362     private boolean skipIfNotSupported = false;
363
364     /** the one shortcut instance for reuse in many locations */
365     private Shortcut shortcut;
366
367     /**
368      * A list of ShortcutData> objects. Each object is the complete specification for one shortcut
369      * that must be created.
370      */

371     private Vector JavaDoc shortcuts = new Vector JavaDoc();
372
373     /**
374      * Holds a list of all the shortcut files that have been created. Note: this variable contains
375      * valid data only after createShortcuts() has been called. This list is created so that the
376      * files can be added to the uninstaller.
377      */

378     private Vector JavaDoc files = new Vector JavaDoc();
379
380     /**
381      * If true it indicates that there are shortcuts to create. The value is set by
382      * analyzeShortcutSpec()
383      */

384     private boolean shortcutsToCreate = false;
385
386     /** If true it indicates that the spec file is existing and could be read. */
387     private boolean haveShortcutSpec = false;
388
389     /**
390      * This is set to true if the shortcut spec instructs to simulate running on an operating system
391      * that is not supported.
392      */

393     private boolean simulteNotSupported = false;
394
395     /** Avoids bogus behaviour when the user goes back then returns to this panel. */
396
397     // private boolean firstTime = true;
398
private File itsProgramFolder;
399
400     /** itsUserType */
401     private int itsUserType;
402     
403     /** USER_TYPE = "usertype" to store this information in the automated.xml */
404     public final static String JavaDoc USER_TYPE = "usertype";
405
406     /** shortCuts */
407     private Vector JavaDoc shortCuts;
408
409     /** internal line counter */
410     int line;
411
412     /** internal column counter */
413     int col;
414
415     // ~ Constructors ***********************************************************************
416

417     // ~ Constructors ***********************************************************************
418

419     /*
420      * --------------------------------------------------------------------------
421      */

422
423     /**
424      * Constructor.
425      *
426      * @param parent reference to the application frame
427      * @param installData shared information about the installation
428      */

429
430     /*
431      * --------------------------------------------------------------------------
432      */

433     public ShortcutPanel(InstallerFrame parent, InstallData installData)
434     {
435         super(parent, installData, "link16x16");
436
437         layout = (GridBagLayout) super.getLayout();
438         Object JavaDoc con = getLayoutHelper().getDefaultConstraints();
439         if( con instanceof GridBagConstraints)
440             constraints = (GridBagConstraints) con;
441         else
442             con = new GridBagConstraints();
443         setLayout(super.getLayout());
444         
445         if( self != null )
446           throw new RuntimeException JavaDoc( this.getClass().getName() + " is not allowed to instantiate more than once!" );
447         
448         self = this;
449     }
450
451     // ~ Methods ****************************************************************************
452

453     // ~ Methods ****************************************************************************
454
// **************************************************************************************************************************************************
455

456     /*--------------------------------------------------------------------------*/
457
458     /**
459      * This method represents the ActionListener interface, invoked when an action occurs.
460      *
461      * @param event the action event.
462      */

463
464     /*--------------------------------------------------------------------------*/
465     public void actionPerformed(ActionEvent JavaDoc event)
466     {
467         Object JavaDoc eventSource = event.getSource();
468
469         /*
470          * if (eventSource != null) { System.out.println("Instance Of : " +
471          * eventSource.getClass().getName()); }
472          */

473
474         // ----------------------------------------------------
475
// create shortcut for the current user was selected
476
// refresh the list of program groups accordingly and
477
// reset the program group to the default setting.
478
// ----------------------------------------------------
479
if (eventSource.equals(currentUser))
480         {
481             groupList.setListData(shortcut.getProgramGroups(Shortcut.CURRENT_USER));
482             programGroup.setText(suggestedProgramGroup);
483             shortcut.setUserType(itsUserType = Shortcut.CURRENT_USER);
484
485             return;
486         }
487
488         // ----------------------------------------------------
489
// create shortcut for all users was selected
490
// refresh the list of program groups accordingly and
491
// reset the program group to the default setting.
492
// ----------------------------------------------------
493
else if (eventSource.equals(allUsers))
494         {
495             groupList.setListData(shortcut.getProgramGroups(Shortcut.ALL_USERS));
496             programGroup.setText(suggestedProgramGroup);
497             shortcut.setUserType(itsUserType = Shortcut.ALL_USERS);
498
499             return;
500         }
501
502         // ----------------------------------------------------
503
// The reset button was pressed.
504
// - clear the selection in the list box, because the
505
// selection is no longer valid
506
// - refill the program group edit control with the
507
// suggested program group name
508
// ----------------------------------------------------
509
else if (eventSource.equals(defaultButton))
510         {
511             groupList.getSelectionModel().clearSelection();
512             programGroup.setText(suggestedProgramGroup);
513
514             return;
515         }
516
517         // ----------------------------------------------------
518
// the save button was pressed. This is a request to
519
// save shortcut information to a text file.
520
// ----------------------------------------------------
521
else if (eventSource.equals(saveButton))
522         {
523             saveToFile();
524
525             // add the file to the uninstaller
526
addToUninstaller();
527
528             return;
529         }
530         else if (eventSource.equals(createShortcuts))
531         {
532             create = createShortcuts.isSelected();
533
534             if (groupList != null)
535             {
536                 groupList.setEnabled(create);
537             }
538
539             programGroup.setEnabled(create);
540             currentUser.setEnabled(create);
541             defaultButton.setEnabled(create);
542
543             // ** There where no Desktop Links or not allowed, this may be null: **//
544
if (allowDesktopShortcut != null)
545             {
546                 allowDesktopShortcut.setEnabled(create);
547             }
548
549             if (isRootUser)
550             {
551                 allUsers.setEnabled(create);
552             }
553         }
554     }
555
556     /*--------------------------------------------------------------------------*/
557
558     /**
559      * Returns true when all selections have valid settings. This indicates that it is legal to
560      * procede to the next panel.
561      *
562      * @return true if it is legal to procede to the next panel, otherwise false.
563      */

564
565     /*--------------------------------------------------------------------------*/
566     public boolean isValidated()
567     {
568         try
569         {
570             groupName = programGroup.getText();
571         }
572         catch (Throwable JavaDoc exception)
573         {
574             groupName = "";
575         }
576
577         create = createShortcuts.isSelected();
578
579         if (createImmediately){
580             createAndRegisterShortcuts();
581         }
582
583         return (true);
584     }
585
586     /*--------------------------------------------------------------------------*/
587
588     /**
589      * Called when the panel is shown to the user.
590      */

591
592     /*--------------------------------------------------------------------------*/
593     public void panelActivate()
594     {
595         try
596         {
597             readShortcutSpec();
598         }
599         catch (Throwable JavaDoc exception)
600         {
601             System.out.println("could not read shortcut spec!");
602             exception.printStackTrace();
603         }
604
605         // Create the UI elements
606
try
607         {
608             shortcut = (Shortcut) (TargetFactory.getInstance()
609                     .makeObject("com.izforge.izpack.util.os.Shortcut"));
610             shortcut.initialize(Shortcut.APPLICATIONS, "-");
611         }
612         catch (Throwable JavaDoc exception)
613         {
614             System.out.println("could not create shortcut instance");
615             exception.printStackTrace();
616         }
617
618         analyzeShortcutSpec();
619
620         if (shortcutsToCreate && !OsVersion.IS_OSX)
621         {
622             if (shortcut.supported() && !simulteNotSupported)
623             {
624                 File allUsersProgramsFolder = getProgramsFolder(Shortcut.ALL_USERS);
625
626                 Debug.log("All UsersProgramsFolder: '" + allUsersProgramsFolder + "'");
627
628                 File forceTest = new File(allUsersProgramsFolder + File.separator
629                         + System.getProperty("user.name") + System.currentTimeMillis());
630
631                 try
632                 {
633                     isRootUser = forceTest.createNewFile();
634                 }
635                 catch (Exception JavaDoc e)
636                 {
637                     isRootUser = false;
638                     Debug.log("IOException: " + "'" + e.getLocalizedMessage() + "'");
639                     Debug.log("You cannot create '" + forceTest + "'");
640
641                 }
642
643                 if (forceTest.exists())
644                 {
645                     Debug.log("Delete temporary File: '" + forceTest + "'");
646                     forceTest.delete();
647                 }
648
649                 String JavaDoc perm = isRootUser ? "can" : "cannot";
650
651                 Debug.log("You " + perm + " write into '" + allUsersProgramsFolder + "'");
652
653                 if (isRootUser)
654                 {
655                     itsUserType = Shortcut.ALL_USERS;
656                 }
657                 else
658                 {
659                     itsUserType = Shortcut.CURRENT_USER;
660                 }
661
662                 buildUI(getProgramsFolder(isRootUser ? Shortcut.ALL_USERS : Shortcut.CURRENT_USER));
663
664                 // addSelectionList();
665
// add( shortCutsArea );
666
// JList shortCutList = null;
667
// addList( shortCuts, ListSelectionModel.SINGLE_SELECTION, shortCutList, col,
668
// line+6, 1, 1, GridBagConstraints.BOTH );
669
}
670             else
671             {
672                 // TODO MEP: Test
673
buildAlternateUI();
674
675                 // parent.unlockNextButton();
676
// parent.lockPrevButton();
677
}
678         }
679         else
680         {
681             // Skip on OS X
682
parent.skipPanel();
683         }
684     }
685
686     /**
687      * Returns the ProgramsFolder for the current User
688      *
689      * @param userType DOCUMENT ME!
690      *
691      * @return The Basedir
692      */

693     private File getProgramsFolder(int userType)
694     {
695         String JavaDoc path = shortcut.getProgramsFolder(userType);
696
697         return (new File(path));
698
699         // }
700
// else
701
// {
702
// TODO
703
// 0ptional: Test if KDE is installed.
704
// boolean isKdeInstalled = UnixHelper.kdeIsInstalled();
705
// 1. Test if User can write into
706
// File kdeRootShareApplinkDir = getKDERootShareApplinkDir();
707
// if so: return getKDERootShareApplinkDir()
708
// else
709
// return getKDEUsersShareApplinkDir() +
710
// }
711
// return(result);
712
}
713
714     /**
715      * This method is called by the groupList when the user makes a selection. It updates the
716      * content of the programGroup with the result of the selection.
717      *
718      * @param event the list selection event
719      */

720
721     /*--------------------------------------------------------------------------*/
722     public void valueChanged(ListSelectionEvent JavaDoc event)
723     {
724         if (programGroup == null) { return; }
725
726         String JavaDoc value = "";
727
728         try
729         {
730             value = (String JavaDoc) groupList.getSelectedValue();
731         }
732         catch (ClassCastException JavaDoc exception)
733         {}
734
735         if (value == null)
736         {
737             value = "";
738         }
739
740         programGroup.setText(value + File.separator + suggestedProgramGroup);
741     }
742
743     /*--------------------------------------------------------------------------*/
744
745     /**
746      * Reads the XML specification for the shortcuts to create. The result is stored in spec.
747      *
748      * @exception Exception for any problems in reading the specification
749      */

750
751     /*--------------------------------------------------------------------------*/
752     private void readShortcutSpec() throws Exception JavaDoc
753     {
754         // open an input stream
755
InputStream JavaDoc input = null;
756
757         try
758         {
759             input = parent.getResource(TargetFactory.getCurrentOSPrefix() + SPEC_FILE_NAME);
760         }
761         catch (ResourceNotFoundException rnfE)
762         {
763             input = parent.getResource(SPEC_FILE_NAME);
764         }
765
766         if (input == null)
767         {
768             haveShortcutSpec = false;
769
770             return;
771         }
772
773         // if( input == null )
774
// {
775
// haveShortcutSpec = false;
776
// return;
777
// }
778
// initialize the parser
779
VariableSubstitutor substitutor = new VariableSubstitutor(idata.getVariables());
780
781         // input.
782
String JavaDoc substitutedSpec = substitutor.substitute(input, "xml");
783
784         /*
785          * TODO: internal flag mapped if( idata.isDebug() ) { System.out.println( "SUBSTITUDED
786          * SHORTCUT SPEC" ); System.out.println(
787          * "==================================================================" );
788          * System.out.println( "==================================================================" );
789          * System.out.println( substitutedSpec ); System.out.println(
790          * "==================================================================" );
791          * System.out.println( "==================================================================" ); }
792          */

793         StdXMLParser parser = new StdXMLParser();
794         parser.setBuilder(new StdXMLBuilder());
795         parser.setValidator(new NonValidator());
796         parser.setReader(StdXMLReader.stringReader(substitutedSpec));
797
798         // get the data
799
spec = (XMLElement) parser.parse();
800
801         // close the stream
802
input.close();
803         haveShortcutSpec = true;
804     }
805
806     /*--------------------------------------------------------------------------*/
807
808     /**
809      * This method analyzes the specifications for creating shortcuts and builds a list of all the
810      * Shortcuts that need to be created.
811      */

812
813     /*--------------------------------------------------------------------------*/
814     private void analyzeShortcutSpec()
815     {
816         if (!haveShortcutSpec)
817         {
818             shortcutsToCreate = false;
819
820             return;
821         }
822
823         XMLElement skipper = spec.getFirstChildNamed(SPEC_KEY_SKIP_IFNOT_SUPPORTED);
824         skipIfNotSupported = (skipper != null);
825
826         // ----------------------------------------------------
827
// find out if we should simulate a not supported
828
// scenario
829
// ----------------------------------------------------
830
XMLElement support = spec.getFirstChildNamed(SPEC_KEY_NOT_SUPPORTED);
831
832         if (support != null)
833         {
834             simulteNotSupported = true;
835         }
836
837         // ----------------------------------------------------
838
// find out in which program group the shortcuts should
839
// be placed and where this program group should be
840
// located
841
// ----------------------------------------------------
842

843         XMLElement group = null;
844         Vector JavaDoc groupSpecs = spec.getChildrenNamed(SPEC_KEY_PROGRAM_GROUP);
845         String JavaDoc selectedInstallGroup = idata.getVariable("INSTALL_GROUP");
846         if (selectedInstallGroup!=null){
847             //The user selected an InstallGroup before.
848
//We may have some restrictions on the Installationgroup
849
//search all defined ProgramGroups for the given InstallGroup
850
for (int i = 0; i < groupSpecs.size(); i++)
851             {
852                 XMLElement g = (XMLElement)groupSpecs.get(i);
853                 String JavaDoc instGrp = g.getAttribute(SPEC_ATTRIBUTE_INSTALLGROUP);
854                 if (instGrp!=null && selectedInstallGroup.equalsIgnoreCase(instGrp)){
855                     group = g;
856                     break;
857                 }
858             }
859         }
860         if (group==null){
861             //default (old) behavior
862
group = spec.getFirstChildNamed(SPEC_KEY_PROGRAM_GROUP);
863         }
864         
865         String JavaDoc location = null;
866         hasDesktopShortcuts = false;
867
868         if (group != null)
869         {
870             suggestedProgramGroup = group.getAttribute(SPEC_ATTRIBUTE_DEFAULT_GROUP, "");
871             location = group.getAttribute(SPEC_ATTRIBUTE_LOCATION, SPEC_VALUE_APPLICATIONS);
872         }
873         else
874         {
875             suggestedProgramGroup = "";
876             location = SPEC_VALUE_APPLICATIONS;
877         }
878
879         if (location.equals(SPEC_VALUE_APPLICATIONS))
880         {
881             groupLocation = Shortcut.APPLICATIONS;
882         }
883         else if (location.equals(SPEC_VALUE_START_MENU))
884         {
885             groupLocation = Shortcut.START_MENU;
886         }
887
888         // ----------------------------------------------------
889
// create a list of all shortcuts that need to be
890
// created, containing all details about each shortcut
891
// ----------------------------------------------------
892
// String temp;
893
Vector JavaDoc shortcutSpecs = spec.getChildrenNamed(SPEC_KEY_SHORTCUT);
894         XMLElement shortcutSpec;
895         ShortcutData data;
896
897         shortCuts = new Vector JavaDoc();
898
899         for (int i = 0; i < shortcutSpecs.size(); i++)
900         {
901             // System.out.println( "Processing shortcut: " + i );
902
shortcutSpec = (XMLElement) shortcutSpecs.elementAt(i);
903
904             if (!OsConstraint.oneMatchesCurrentSystem(shortcutSpec))
905             {
906                 continue;
907             }
908
909             // TODO: write log info INFO.info( "Checking Condition for " +
910
// shortcutSpec.getAttribute( SPEC_ATTRIBUTE_NAME ) );
911
if (!checkConditions(shortcutSpec))
912             {
913                 continue;
914             }
915
916             // TODO write log info INFO.info( "Checked Condition for " +
917
// shortcutSpec.getAttribute( SPEC_ATTRIBUTE_NAME ) );
918
data = new ShortcutData();
919
920             data.name = shortcutSpec.getAttribute(SPEC_ATTRIBUTE_NAME);
921             data.subgroup = shortcutSpec.getAttribute(SPEC_ATTRIBUTE_SUBGROUP, "");
922             data.description = shortcutSpec.getAttribute(SPEC_ATTRIBUTE_DESCRIPTION, "");
923
924             // ** Linux **//
925
data.deskTopEntryLinux_Encoding = shortcutSpec
926                     .getAttribute(SPEC_ATTRIBUTE_ENCODING, "");
927             data.deskTopEntryLinux_MimeType = shortcutSpec
928                     .getAttribute(SPEC_ATTRIBUTE_MIMETYPE, "");
929             data.deskTopEntryLinux_Terminal = shortcutSpec
930                     .getAttribute(SPEC_ATTRIBUTE_TERMINAL, "");
931             data.deskTopEntryLinux_TerminalOptions = shortcutSpec.getAttribute(
932                     SPEC_ATTRIBUTE_TERMINAL_OPTIONS, "");
933             data.deskTopEntryLinux_Type = shortcutSpec.getAttribute(SPEC_ATTRIBUTE_TYPE, "");
934
935             data.deskTopEntryLinux_URL = shortcutSpec.getAttribute(SPEC_ATTRIBUTE_URL, "");
936
937             data.deskTopEntryLinux_X_KDE_SubstituteUID = shortcutSpec.getAttribute(
938                     SPEC_ATTRIBUTE_KDE_SUBST_UID, "false");
939             
940             data.deskTopEntryLinux_X_KDE_UserName = shortcutSpec.getAttribute(
941                     SPEC_ATTRIBUTE_KDE_USERNAME, "root");
942             
943             data.Categories = shortcutSpec.getAttribute(
944                     SPEC_CATEGORIES, "Application;Development");
945             
946             data.TryExec = shortcutSpec.getAttribute(
947                     SPEC_TRYEXEC, "");
948
949             data.createForAll = new Boolean JavaDoc(shortcutSpec.getAttribute(CREATE_FOR_ALL, "false"));
950
951             // ** EndOf LINUX **//
952
// temp =
953
data.target = fixSeparatorChar(shortcutSpec.getAttribute(SPEC_ATTRIBUTE_TARGET, ""));
954
955             // temp =
956
data.commandLine = shortcutSpec.getAttribute(SPEC_ATTRIBUTE_COMMAND, "");
957
958             // temp =
959
data.iconFile = fixSeparatorChar(shortcutSpec.getAttribute(SPEC_ATTRIBUTE_ICON, ""));
960             data.iconIndex = Integer.parseInt(shortcutSpec.getAttribute(SPEC_ATTRIBUTE_ICON_INDEX,
961                     "0"));
962
963             // temp =
964
data.workingDirectory = fixSeparatorChar(shortcutSpec.getAttribute(
965                     SPEC_ATTRIBUTE_WORKING_DIR, ""));
966
967             String JavaDoc initialState = shortcutSpec.getAttribute(SPEC_ATTRIBUTE_INITIAL_STATE, "");
968
969             if (initialState.equals(SPEC_VALUE_NO_SHOW))
970             {
971                 data.initialState = Shortcut.HIDE;
972             }
973             else if (initialState.equals(SPEC_VALUE_NORMAL))
974             {
975                 data.initialState = Shortcut.NORMAL;
976             }
977             else if (initialState.equals(SPEC_VALUE_MAXIMIZED))
978             {
979                 data.initialState = Shortcut.MAXIMIZED;
980             }
981             else if (initialState.equals(SPEC_VALUE_MINIMIZED))
982             {
983                 data.initialState = Shortcut.MINIMIZED;
984             }
985             else
986             {
987                 data.initialState = Shortcut.NORMAL;
988             }
989
990             // LOG System.out.println("data.initialState: " + data.initialState);
991

992             // --------------------------------------------------
993
// if the minimal data requirements are met to create
994
// the shortcut, create one entry each for each of
995
// the requested types.
996
// Eventually this will cause the creation of one
997
// shortcut in each of the associated locations.
998
// --------------------------------------------------
999
// without a name we can not create a shortcut
1000
if (data.name == null)
1001            {
1002                continue;
1003            }
1004
1005            // 1. Elmar: "Without a target we can not create a shortcut."
1006
// 2. Marc: "No, Even on Linux a Link can be an URL and has no target."
1007
if (data.target == null)
1008            {
1009                // TODO: write log info INFO.warn( "Shortcut: " + data + " has no target" );
1010
data.target = "";
1011            }
1012            // the shortcut is not actually required for any of the selected packs
1013

1014            // the shortcut is not actually required for any of the selected packs // the shortcut
1015
// is not actually required for any of the selected packs
1016
Vector JavaDoc forPacks = shortcutSpec.getChildrenNamed(SPEC_KEY_PACKS);
1017
1018            if (!shortcutRequiredFor(forPacks))
1019            {
1020                continue;
1021            }
1022            // --------------------------------------------------
1023
// This section is executed if we don't skip.
1024
// --------------------------------------------------
1025
// For each of the categories set the type and if
1026
// the link should be placed in the program group,
1027
// then clone the data set to obtain an independent
1028
// instance and add this to the list of shortcuts
1029
// to be created. In this way, we will set up an
1030
// identical copy for each of the locations at which
1031
// a shortcut should be placed. Therefore you must
1032
// not use 'else if' statements!
1033
// --------------------------------------------------
1034
{
1035                if (XMLHelper.attributeIsTrue(shortcutSpec, SPEC_ATTRIBUTE_DESKTOP))
1036                {
1037                    hasDesktopShortcuts = true;
1038                    data.addToGroup = false;
1039                    data.type = Shortcut.DESKTOP;
1040                    shortcuts.add(data.clone());
1041                }
1042
1043                if (XMLHelper.attributeIsTrue(shortcutSpec, SPEC_ATTRIBUTE_APPLICATIONS))
1044                {
1045                    data.addToGroup = false;
1046                    data.type = Shortcut.APPLICATIONS;
1047                    shortcuts.add(data.clone());
1048                }
1049
1050                if (XMLHelper.attributeIsTrue(shortcutSpec, SPEC_ATTRIBUTE_START_MENU))
1051                {
1052                    data.addToGroup = false;
1053                    data.type = Shortcut.START_MENU;
1054                    shortcuts.add(data.clone());
1055                }
1056
1057                if (XMLHelper.attributeIsTrue(shortcutSpec, SPEC_ATTRIBUTE_STARTUP))
1058                {
1059                    data.addToGroup = false;
1060                    data.type = Shortcut.START_UP;
1061                    shortcuts.add(data.clone());
1062                }
1063
1064                if (XMLHelper.attributeIsTrue(shortcutSpec, SPEC_ATTRIBUTE_PROGRAM_GROUP))
1065                {
1066                    data.addToGroup = true;
1067                    data.type = Shortcut.APPLICATIONS;
1068                    shortcuts.add(data.clone());
1069                }
1070
1071                // / TODO: write log INFO.info( "data.name: " + data.name );
1072
shortCuts.add((data.name == null) ? "" : data.name); // + " -> " + data.target +
1073

1074                // " Type: " + data.type );
1075
}
1076        }
1077
1078        // ----------------------------------------------------
1079
// signal if there are any shortcuts to create
1080
// ----------------------------------------------------
1081
if (shortcuts.size() > 0)
1082        {
1083            shortcutsToCreate = true;
1084        }
1085    }
1086
1087    /**
1088     * This returns true if a Shortcut should or can be created. Returns false to suppress Creation
1089     *
1090     * @param shortcutSpec
1091     *
1092     * @return true if condtion is resolved positive - currently unimplemented: returns always true.
1093     */

1094    private boolean checkConditions(XMLElement shortcutSpec)
1095    {
1096        /*
1097         * Vector conditions = shortcutSpec.getChildrenNamed( Condition.CONDITION );
1098         *
1099         * for( int i = 0; i < conditions.size(); i++ ) { Condition condition = new Condition(
1100         * conditions.elementAt( i ) );
1101         *
1102         * //System.out.println( "Readed: " + condition.toString( true ) ); boolean result =
1103         * condition.eval();
1104         *
1105         * if( result == false ) { System.out.println( "Unresolved Condition: " + condition );
1106         *
1107         * return result; } }
1108         */

1109        return true; // If there is no Condition defined, just create the shortcut.
1110
}
1111
1112    /*--------------------------------------------------------------------------*/
1113
1114    /**
1115     * Enables Shortcutcreation from outside, e.g. from an InstallerListener.
1116     * The Installerlistener can switch the flag "createImmediately" to false on initialisation, and call this method when afterpacks is performed.
1117     * This makes only sense, if the ShorcutPanel is displayed before the files are copied onto the disk.
1118     */

1119    public void createAndRegisterShortcuts(){
1120      createShortcuts();
1121      addToUninstaller();
1122    }
1123    
1124    /**
1125     * Creates all shortcuts based on the information in shortcuts.
1126     */

1127
1128    /*--------------------------------------------------------------------------*/
1129    private void createShortcuts()
1130    {
1131        if (!create) { Debug.log( this.getClass().getName() + "::createShortcuts():create=" + create ); return; }
1132
1133        ShortcutData data;
1134        
1135        //fix: don't influence other shortcuts when altering group name...
1136
String JavaDoc gn = groupName;
1137
1138        for (int i = 0; i < shortcuts.size(); i++)
1139        {
1140            data = (ShortcutData) shortcuts.elementAt(i);
1141
1142            try
1143            {
1144                gn = groupName + data.subgroup;
1145                shortcut.setUserType(itsUserType);
1146                shortcut.setLinkName(data.name);
1147                shortcut.setLinkType(data.type);
1148                shortcut.setArguments(data.commandLine);
1149                shortcut.setDescription(data.description);
1150                shortcut.setIconLocation(data.iconFile, data.iconIndex);
1151
1152                shortcut.setShowCommand(data.initialState);
1153                shortcut.setTargetPath(data.target);
1154                shortcut.setWorkingDirectory(data.workingDirectory);
1155                shortcut.setEncoding(data.deskTopEntryLinux_Encoding);
1156                shortcut.setMimetype(data.deskTopEntryLinux_MimeType);
1157
1158                shortcut.setTerminal(data.deskTopEntryLinux_Terminal);
1159                shortcut.setTerminalOptions(data.deskTopEntryLinux_TerminalOptions);
1160                shortcut.setType(data.deskTopEntryLinux_Type);
1161                shortcut.setKdeSubstUID(data.deskTopEntryLinux_X_KDE_SubstituteUID);
1162                shortcut.setKdeUserName(data.deskTopEntryLinux_X_KDE_UserName);
1163                shortcut.setURL(data.deskTopEntryLinux_URL);
1164                shortcut.setTryExec(data.TryExec);
1165                shortcut.setCategories(data.Categories);
1166                shortcut.setCreateForAll(data.createForAll);
1167                
1168                shortcut.setUninstaller( UninstallData.getInstance() );
1169
1170                if (data.addToGroup)
1171                {
1172                    shortcut.setProgramGroup(gn);
1173                }
1174                else
1175                {
1176                    shortcut.setProgramGroup("");
1177                }
1178
1179                try
1180                {
1181                    // ----------------------------------------------
1182
// save the shortcut only if it is either not on
1183
// the desktop or if it is on the desktop and
1184
// the user has signalled that it is ok to place
1185
// shortcuts on the desktop.
1186
// ----------------------------------------------
1187
if ((data.type != Shortcut.DESKTOP)
1188                            || ((data.type == Shortcut.DESKTOP) && allowDesktopShortcut
1189                                    .isSelected()))
1190                    {
1191                        // save the shortcut
1192
shortcut.save();
1193
1194                        // add the file and directory name to the file list
1195
String JavaDoc fileName = shortcut.getFileName();
1196                        files.add(0, fileName);
1197
1198                        File file = new File(fileName);
1199                        File base = new File(shortcut.getBasePath());
1200                        Vector JavaDoc intermediates = new Vector JavaDoc();
1201
1202                        // String directoryName = shortcut.getDirectoryCreated ();
1203
execFiles.add(new ExecutableFile(fileName, ExecutableFile.UNINSTALL,
1204                                ExecutableFile.IGNORE, new ArrayList JavaDoc(), false));
1205
1206                        files.add(fileName);
1207
1208                        while ((file = file.getParentFile()) != null)
1209                        {
1210                            if (file.equals(base))
1211                            {
1212                                break;
1213                            }
1214
1215                            intermediates.add(file);
1216                        }
1217
1218                        if (file != null)
1219                        {
1220                            Enumeration JavaDoc filesEnum = intermediates.elements();
1221
1222                            while (filesEnum.hasMoreElements())
1223                            {
1224                                files.add(0, filesEnum.nextElement().toString());
1225                            }
1226                        }
1227                    }
1228                }
1229                catch (Exception JavaDoc exception)
1230                {}
1231            }
1232            catch (Throwable JavaDoc exception)
1233            {
1234                continue;
1235            }
1236        }
1237        
1238        shortcut.execPostAction();
1239
1240        try
1241        {
1242            if (execFiles != null)
1243            {
1244                FileExecutor executor = new FileExecutor(execFiles);
1245
1246                //
1247
// TODO: Hi Guys,
1248
// TODO The following commented-out line sometimes produces an uncatchable
1249
// nullpointer Exception!
1250
// TODO evaluate for what reason the files should exec.
1251
// TODO if there is a serious explanation, why to do that,
1252
// TODO the code must be more robust
1253
// evaluate executor.executeFiles( ExecutableFile.NEVER, null );
1254
}
1255        }
1256        catch (NullPointerException JavaDoc nep)
1257        {
1258            nep.printStackTrace();
1259        }
1260        catch (RuntimeException JavaDoc cannot)
1261        {
1262            cannot.printStackTrace();
1263        }
1264
1265        
1266        shortcut.cleanUp();
1267    }
1268
1269    /*--------------------------------------------------------------------------*/
1270
1271    /**
1272     * Verifies if the shortcut is required for any of the packs listed. The shortcut is required
1273     * for a pack in the list if that pack is actually selected for installation. Note: If the list
1274     * of selected packs is empty then true is always returnd. The same is true if the packs list is
1275     * empty.
1276     *
1277     * @param packs a Vector of Strings. Each of the strings denotes a pack for which the schortcut
1278     * should be created if the pack is actually installed.
1279     *
1280     * @return true if the shortcut is required for at least on pack in the list, otherwise returns
1281     * false.
1282     */

1283
1284    /*--------------------------------------------------------------------------*/
1285    /*
1286     * $ @design
1287     *
1288     * The information about the installed packs comes from InstallData.selectedPacks. This assumes
1289     * that this panel is presented to the user AFTER the PacksPanel.
1290     * --------------------------------------------------------------------------
1291     */

1292    private boolean shortcutRequiredFor(Vector JavaDoc packs)
1293    {
1294        String JavaDoc selected;
1295        String JavaDoc required;
1296
1297        if (packs.size() == 0) { return (true); }
1298
1299        for (int i = 0; i < idata.selectedPacks.size(); i++)
1300        {
1301            selected = ((Pack) idata.selectedPacks.get(i)).name;
1302
1303            for (int k = 0; k < packs.size(); k++)
1304            {
1305                required = (String JavaDoc) ((XMLElement) packs.elementAt(k)).getAttribute(
1306                        SPEC_ATTRIBUTE_NAME, "");
1307
1308                if (selected.equals(required)) { return (true); }
1309            }
1310        }
1311
1312        return (false);
1313    }
1314
1315    /*--------------------------------------------------------------------------*/
1316
1317    /**
1318     * Replaces any ocurrence of '/' or '\' in a path string with the correct version for the
1319     * operating system.
1320     *
1321     * @param path a system path
1322     *
1323     * @return a path string that uniformely uses the proper version of the separator character.
1324     */

1325
1326    /*--------------------------------------------------------------------------*/
1327    private String JavaDoc fixSeparatorChar(String JavaDoc path)
1328    {
1329        String JavaDoc newPath = path.replace('/', File.separatorChar);
1330        newPath = newPath.replace('\\', File.separatorChar);
1331
1332        return (newPath);
1333    }
1334
1335    /*--------------------------------------------------------------------------*/
1336
1337    /**
1338     * This method creates the UI for this panel.
1339     *
1340     * @param groups A Vector that contains Strings with all the names of the existing program
1341     * groups. These will be placed in the groupList.
1342     */

1343
1344    /*--------------------------------------------------------------------------*/
1345    private void buildUI(File groups)
1346    {
1347        constraints.insets = new Insets(10, 10, 0, 0);
1348
1349        // Add a CheckBox which enables the user to entirely supress shortcut creation.
1350
String JavaDoc menuKind = parent.langpack.getString("ShortcutPanel.regular.StartMenu:Start-Menu");
1351
1352        if (OsVersion.IS_UNIX && UnixHelper.kdeIsInstalled())
1353        {
1354            menuKind = parent.langpack.getString("ShortcutPanel.regular.StartMenu:K-Menu");
1355        }
1356
1357        createShortcuts = new JCheckBox(StringTool.replace(parent.langpack
1358                .getString("ShortcutPanel.regular.create"), "StartMenu", menuKind), true);
1359        createShortcuts.addActionListener(this);
1360        constraints.gridx = col;
1361        constraints.gridy = line + 1;
1362        constraints.gridwidth = 1;
1363        constraints.gridheight = 1;
1364
1365        // constraints.weightx = 0.1;
1366
// constraints.weighty = 0.2;
1367
constraints.fill = GridBagConstraints.HORIZONTAL;
1368        constraints.anchor = GridBagConstraints.NORTHWEST;
1369
1370        layout.addLayoutComponent(createShortcuts, constraints);
1371        add(createShortcuts);
1372
1373        constraints.insets = new Insets(0, 10, 0, 0);
1374
1375        // ----------------------------------------------------
1376
// check box to allow the user to decide if a desktop
1377
// shortcut should be created.
1378
// this should only be created if needed and requested
1379
// in the definition file.
1380
// ----------------------------------------------------
1381
if (hasDesktopShortcuts)
1382        {
1383            String JavaDoc initialAllowedValue = idata.getVariable("DesktopShortcutCheckboxEnabled");
1384            boolean initialAllowedFlag = false;
1385
1386            if (initialAllowedValue == null)
1387            {
1388                initialAllowedFlag = false;
1389            }
1390            else if (Boolean.TRUE.toString().equals(initialAllowedValue))
1391            {
1392                initialAllowedFlag = true;
1393            }
1394
1395            allowDesktopShortcut = new JCheckBox(parent.langpack
1396                    .getString("ShortcutPanel.regular.desktop"), initialAllowedFlag);
1397            constraints.gridx = col;
1398            constraints.gridy = line + 2;
1399            constraints.gridwidth = 1;
1400            constraints.gridheight = 1;
1401
1402            // constraints.weighty = 0.2;
1403
// constraints.weighty = 1.0;
1404
// constraints.weighty = 0.5;
1405
layout.addLayoutComponent(allowDesktopShortcut, constraints);
1406            add(allowDesktopShortcut);
1407        }
1408
1409        listLabel = LabelFactory.create(parent.langpack.getString("ShortcutPanel.regular.list"),
1410                JLabel.LEADING);
1411
1412        constraints.gridx = col;
1413        constraints.gridy = line + 3;
1414        constraints.gridwidth = 1;
1415        constraints.gridheight = 1;
1416
1417        constraints.insets = new Insets(10, 10, 0, 0);
1418
1419        constraints.fill = GridBagConstraints.HORIZONTAL;
1420        constraints.anchor = GridBagConstraints.NORTHWEST;
1421
1422        layout.addLayoutComponent(listLabel, constraints);
1423        add(listLabel);
1424
1425        // ----------------------------------------------------
1426
// list box to list all of already existing folders as program groups
1427
// at the intended destination
1428
// ----------------------------------------------------
1429
Vector JavaDoc dirEntries = new Vector JavaDoc();
1430
1431        File[] entries = groups.listFiles();
1432
1433        // Quickfix prevent NullPointer on non default compliant Linux - KDEs
1434
// i.e Mandrake 2005 LE stores from now also in "applnk" instead in prior "applnk-mdk":
1435
if (entries != null)
1436        {
1437            for (int idx = 0; idx < entries.length; idx++)
1438            {
1439                if (entries[idx].isDirectory())
1440                {
1441                    dirEntries.add(entries[idx].getName());
1442                }
1443            }
1444        }
1445
1446        if (groupList == null)
1447        {
1448            groupList = new JList();
1449        }
1450
1451        groupList = addList(dirEntries, ListSelectionModel.SINGLE_SELECTION, groupList, col,
1452                line + 4, 1, 1, GridBagConstraints.BOTH);
1453
1454        // ----------------------------------------------------
1455
// radio buttons to select current user or all users.
1456
// ----------------------------------------------------
1457
if (shortcut.multipleUsers())
1458        {
1459            JPanel usersPanel = new JPanel(new GridLayout(2, 1));
1460            ButtonGroup usersGroup = new ButtonGroup();
1461            currentUser = new JRadioButton(parent.langpack
1462                    .getString("ShortcutPanel.regular.currentUser"), !isRootUser);
1463            currentUser.addActionListener(this);
1464            usersGroup.add(currentUser);
1465            usersPanel.add(currentUser);
1466            allUsers = new JRadioButton(
1467                    parent.langpack.getString("ShortcutPanel.regular.allUsers"), isRootUser);
1468
1469            Debug.log("allUsers.setEnabled(), I'm Root: " + isRootUser);
1470
1471            allUsers.setEnabled(isRootUser);
1472
1473            allUsers.addActionListener(this);
1474            usersGroup.add(allUsers);
1475            usersPanel.add(allUsers);
1476
1477            TitledBorder JavaDoc border = new TitledBorder JavaDoc(new EmptyBorder JavaDoc(2, 2, 2, 2), parent.langpack
1478                    .getString("ShortcutPanel.regular.userIntro"));
1479            usersPanel.setBorder(border);
1480
1481            constraints.gridx = col + 1;
1482            constraints.gridy = line + 4;
1483            constraints.gridwidth = 1;
1484            constraints.gridheight = 1;
1485
1486            // constraints.weighty = 1.0;
1487
// constraints.weightx = 1.0;
1488
constraints.fill = GridBagConstraints.HORIZONTAL;
1489            layout.addLayoutComponent(usersPanel, constraints);
1490            add(usersPanel);
1491        }
1492
1493        // ----------------------------------------------------
1494
// edit box that contains the suggested program group
1495
// name, which can be modfied or substituted from the
1496
// list by the user
1497
// ----------------------------------------------------
1498
programGroup = new JTextField(suggestedProgramGroup, 40); // 40?
1499

1500        constraints.gridx = col;
1501        constraints.gridy = line + 5;
1502        constraints.gridwidth = 1;
1503        constraints.gridheight = 1;
1504
1505        // constraints.weighty = 1.0;
1506
// constraints.weightx = 1.0;
1507
constraints.fill = GridBagConstraints.HORIZONTAL;
1508        layout.addLayoutComponent(programGroup, constraints);
1509        add(programGroup);
1510
1511        // ----------------------------------------------------
1512
// reset button that allows the user to revert to the
1513
// original suggestion for the program group
1514
// ----------------------------------------------------
1515
defaultButton = ButtonFactory.createButton(parent.langpack
1516                .getString("ShortcutPanel.regular.default"), idata.buttonsHColor);
1517        defaultButton.addActionListener(this);
1518
1519        constraints.gridx = col + 1;
1520        constraints.gridy = line + 5;
1521        constraints.gridwidth = 1;
1522        constraints.gridheight = 1;
1523        constraints.fill = GridBagConstraints.HORIZONTAL;
1524        layout.addLayoutComponent(defaultButton, constraints);
1525        add(defaultButton);
1526    }
1527
1528    /**
1529     * Adds the grouplist to the panel
1530     *
1531     * @param Entries the entries to display
1532     * @param ListModel the model to use
1533     * @param aJList the JList to use
1534     * @param aGridx The X position in the gridbag layout.
1535     * @param aGridy The Y position in the gridbag layout.
1536     * @param aGridwidth the gridwith to use in the gridbag layout.
1537     * @param aGridheight the gridheight to use in the gridbag layout.
1538     * @param aFill the FILL to use in the gridbag layout.
1539     *
1540     * @return the filled JList
1541     */

1542    private JList addList(Vector JavaDoc Entries, int ListModel, JList aJList, int aGridx, int aGridy,
1543            int aGridwidth, int aGridheight, int aFill)
1544    {
1545        if (aJList == null)
1546        {
1547            aJList = new JList(Entries);
1548        }
1549        else
1550        {
1551            aJList.setListData(Entries);
1552        }
1553
1554        aJList.setSelectionMode(ListModel);
1555        aJList.getSelectionModel().addListSelectionListener(this);
1556
1557        JScrollPane scrollPane = new JScrollPane(aJList);
1558
1559        constraints.gridx = aGridx;
1560        constraints.gridy = aGridy;
1561        constraints.gridwidth = aGridwidth;
1562        constraints.gridheight = aGridheight;
1563        constraints.weightx = 2.0;
1564        constraints.weighty = 1.5;
1565        constraints.insets = new Insets(5, 5, 5, 5);
1566        constraints.fill = aFill;
1567        layout.addLayoutComponent(scrollPane, constraints);
1568        add(scrollPane);
1569
1570        return aJList;
1571    }
1572
1573    /**
1574     * This method creates an alternative UI for this panel. This UI can be used when the creation
1575     * of shortcuts is not supported on the target system. It displays an apology for the inability
1576     * to create shortcuts on this system, along with information about the intended targets. In
1577     * addition, there is a button that allows the user to save more complete information in a text
1578     * file. Based on this information the user might be able to create the necessary shortcut him
1579     * or herself. At least there will be information about how to launch the application.
1580     */

1581
1582    /*--------------------------------------------------------------------------*/
1583    private void buildAlternateUI()
1584    {
1585        layout = new GridBagLayout();
1586        constraints = new GridBagConstraints();
1587        setLayout(layout);
1588
1589        // ----------------------------------------------------
1590
// static text a the top of the panel, that apologizes
1591
// about the fact that we can not create shortcuts on
1592
// this particular target OS.
1593
// ----------------------------------------------------
1594
MultiLineLabel apologyLabel = new MultiLineLabel(parent.langpack
1595                .getString("ShortcutPanel.alternate.apology"), 0, 0);
1596
1597        constraints.gridx = 0;
1598        constraints.gridy = 0;
1599        constraints.gridwidth = 1;
1600        constraints.gridheight = 1;
1601        constraints.weightx = 1.0;
1602        constraints.weighty = 1.0;
1603        constraints.insets = new Insets(5, 5, 5, 5);
1604        constraints.fill = GridBagConstraints.HORIZONTAL;
1605        constraints.anchor = GridBagConstraints.WEST;
1606        layout.addLayoutComponent(apologyLabel, constraints);
1607        add(apologyLabel);
1608
1609        // ----------------------------------------------------
1610
// label that explains the significance ot the list box
1611
// ----------------------------------------------------
1612
MultiLineLabel listLabel = new MultiLineLabel(parent.langpack
1613                .getString("ShortcutPanel.alternate.targetsLabel"), 0, 0);
1614
1615        constraints.gridx = 0;
1616        constraints.gridy = 1;
1617        constraints.gridwidth = 1;
1618        constraints.gridheight = 1;
1619        constraints.weightx = 1.0;
1620        constraints.weighty = 1.0;
1621        layout.addLayoutComponent(listLabel, constraints);
1622        add(listLabel);
1623
1624        // ----------------------------------------------------
1625
// list box to list all of the intended shortcut targets
1626
// ----------------------------------------------------
1627
Vector JavaDoc targets = new Vector JavaDoc();
1628
1629        for (int i = 0; i < shortcuts.size(); i++)
1630        {
1631            targets.add(((ShortcutData) shortcuts.elementAt(i)).target);
1632        }
1633
1634        targetList = new JList(targets);
1635
1636        JScrollPane scrollPane = new JScrollPane(targetList);
1637
1638        constraints.gridx = 0;
1639        constraints.gridy = 2;
1640        constraints.fill = GridBagConstraints.BOTH;
1641        layout.addLayoutComponent(scrollPane, constraints);
1642        add(scrollPane);
1643
1644        // ----------------------------------------------------
1645
// static text that explains about the text file
1646
// ----------------------------------------------------
1647
MultiLineLabel fileExplanation = new MultiLineLabel(parent.langpack
1648                .getString("ShortcutPanel.alternate.textFileExplanation"), 0, 0);
1649
1650        constraints.gridx = 0;
1651        constraints.gridy = 3;
1652        constraints.weightx = 1.0;
1653        constraints.weighty = 1.0;
1654        constraints.fill = GridBagConstraints.HORIZONTAL;
1655        layout.addLayoutComponent(fileExplanation, constraints);
1656        add(fileExplanation);
1657
1658        // ----------------------------------------------------
1659
// button to save the text file
1660
// ----------------------------------------------------
1661
saveButton = ButtonFactory.createButton(parent.langpack
1662                .getString("ShortcutPanel.alternate.saveButton"), idata.buttonsHColor);
1663        saveButton.addActionListener(this);
1664
1665        constraints.gridx = 0;
1666        constraints.gridy = 4;
1667        constraints.gridwidth = 1;
1668        constraints.gridheight = 1;
1669        constraints.fill = GridBagConstraints.NONE;
1670        constraints.anchor = GridBagConstraints.CENTER;
1671        layout.addLayoutComponent(saveButton, constraints);
1672        add(saveButton);
1673    }
1674
1675    /*--------------------------------------------------------------------------*/
1676
1677    /**
1678     * Overriding the superclass implementation. This method returns the size of the container.
1679     *
1680     * @return the size of the container
1681     */

1682
1683    /*--------------------------------------------------------------------------*/
1684    public Dimension getSize()
1685    {
1686        Dimension size = getParent().getSize();
1687        Insets insets = getInsets();
1688        Border JavaDoc border = getBorder();
1689        Insets borderInsets = new Insets(0, 0, 0, 0);
1690
1691        if (border != null)
1692        {
1693            borderInsets = border.getBorderInsets(this);
1694        }
1695
1696        size.height = size.height - insets.top - insets.bottom - borderInsets.top
1697                - borderInsets.bottom - 50;
1698        size.width = size.width - insets.left - insets.right - borderInsets.left
1699                - borderInsets.right - 50;
1700
1701        return (size);
1702    }
1703
1704    /*--------------------------------------------------------------------------*/
1705
1706    /**
1707     * This method saves all shortcut information to a text file.
1708     */

1709
1710    /*--------------------------------------------------------------------------*/
1711    private void saveToFile()
1712    {
1713        File file = null;
1714
1715        // ----------------------------------------------------
1716
// open a file chooser dialog to get a path / file name
1717
// ----------------------------------------------------
1718
JFileChooser fileDialog = new JFileChooser(idata.getInstallPath());
1719        fileDialog.setSelectedFile(new File(TEXT_FILE_NAME));
1720
1721        if (fileDialog.showSaveDialog(this) == JFileChooser.APPROVE_OPTION)
1722        {
1723            file = fileDialog.getSelectedFile();
1724        }
1725        else
1726        {
1727            return;
1728        }
1729
1730        // ----------------------------------------------------
1731
// save to the file
1732
// ----------------------------------------------------
1733
FileWriter JavaDoc output = null;
1734        StringBuffer JavaDoc buffer = new StringBuffer JavaDoc();
1735        String JavaDoc header = parent.langpack.getString("ShortcutPanel.textFile.header");
1736
1737        String JavaDoc newline = System.getProperty("line.separator", "\n");
1738
1739        try
1740        {
1741            output = new FileWriter JavaDoc(file);
1742        }
1743        catch (Throwable JavaDoc exception)
1744        {
1745            // !!! show an error dialog
1746
return;
1747        }
1748
1749        // ----------------------------------------------------
1750
// break the header down into multiple lines based
1751
// on '\n' line breaks.
1752
// ----------------------------------------------------
1753
int nextIndex = 0;
1754        int currentIndex = 0;
1755
1756        do
1757        {
1758            nextIndex = header.indexOf("\\n", currentIndex);
1759
1760            if (nextIndex > -1)
1761            {
1762                buffer.append(header.substring(currentIndex, nextIndex));
1763                buffer.append(newline);
1764                currentIndex = nextIndex + 2;
1765            }
1766            else
1767            {
1768                buffer.append(header.substring(currentIndex, header.length()));
1769                buffer.append(newline);
1770            }
1771        }
1772        while (nextIndex > -1);
1773
1774        buffer.append(SEPARATOR_LINE);
1775        buffer.append(newline);
1776        buffer.append(newline);
1777
1778        for (int i = 0; i < shortcuts.size(); i++)
1779        {
1780            ShortcutData data = (ShortcutData) shortcuts.elementAt(i);
1781
1782            buffer.append(parent.langpack.getString("ShortcutPanel.textFile.name"));
1783            buffer.append(data.name);
1784            buffer.append(newline);
1785
1786            buffer.append(parent.langpack.getString("ShortcutPanel.textFile.location"));
1787
1788            switch (data.type)
1789            {
1790            case Shortcut.DESKTOP: {
1791                buffer.append(parent.langpack.getString("ShortcutPanel.location.desktop"));
1792
1793                break;
1794            }
1795
1796            case Shortcut.APPLICATIONS: {
1797                buffer.append(parent.langpack.getString("ShortcutPanel.location.applications"));
1798
1799                break;
1800            }
1801
1802            case Shortcut.START_MENU: {
1803                buffer.append(parent.langpack.getString("ShortcutPanel.location.startMenu"));
1804
1805                break;
1806            }
1807
1808            case Shortcut.START_UP: {
1809                buffer.append(parent.langpack.getString("ShortcutPanel.location.startup"));
1810
1811                break;
1812            }
1813            }
1814
1815            buffer.append(newline);
1816
1817            buffer.append(parent.langpack.getString("ShortcutPanel.textFile.description"));
1818            buffer.append(data.description);
1819            buffer.append(newline);
1820
1821            buffer.append(parent.langpack.getString("ShortcutPanel.textFile.target"));
1822            buffer.append(data.target);
1823            buffer.append(newline);
1824
1825            buffer.append(parent.langpack.getString("ShortcutPanel.textFile.command"));
1826            buffer.append(data.commandLine);
1827            buffer.append(newline);
1828
1829            buffer.append(parent.langpack.getString("ShortcutPanel.textFile.iconName"));
1830            buffer.append(data.iconFile);
1831            buffer.append(newline);
1832
1833            buffer.append(parent.langpack.getString("ShortcutPanel.textFile.iconIndex"));
1834            buffer.append(data.iconIndex);
1835            buffer.append(newline);
1836
1837            buffer.append(parent.langpack.getString("ShortcutPanel.textFile.work"));
1838            buffer.append(data.workingDirectory);
1839            buffer.append(newline);
1840
1841            buffer.append(newline);
1842            buffer.append(SEPARATOR_LINE);
1843            buffer.append(newline);
1844            buffer.append(newline);
1845        }
1846
1847        try
1848        {
1849            output.write(buffer.toString());
1850        }
1851        catch (Throwable JavaDoc exception)
1852        {}
1853        finally
1854        {
1855            try
1856            {
1857                output.flush();
1858                output.close();
1859                files.add(file.getPath());
1860            }
1861            catch (Throwable JavaDoc exception)
1862            {
1863                // not really anything I can do here, maybe should show a dialog that
1864
// tells the user that data might not have been saved completely!?
1865
}
1866        }
1867    }
1868
1869    /*--------------------------------------------------------------------------*/
1870
1871    /**
1872     * Adds all files and directories to the uninstaller.
1873     */

1874
1875    /*--------------------------------------------------------------------------*/
1876    private void addToUninstaller()
1877    {
1878        UninstallData uninstallData = UninstallData.getInstance();
1879
1880        for (int i = 0; i < files.size(); i++)
1881        {
1882            uninstallData.addFile((String JavaDoc) files.elementAt(i));
1883        }
1884    }
1885
1886    /*--------------------------------------------------------------------------*/
1887
1888    /**
1889     * Returns Instance of themself
1890     */

1891    public static ShortcutPanel getInstance( )
1892    {
1893       return self;
1894    }
1895
1896    /*--------------------------------------------------------------------------*/
1897    /*
1898     *
1899     *
1900     * The information needed to create shortcuts has been collected in the Vector 'shortcuts'. Take
1901     * the data from there and package it in XML form for storage by the installer. The group name
1902     * is only stored once in a separate XML element, since there is only one.
1903     * --------------------------------------------------------------------------
1904     */

1905    public void makeXMLData( XMLElement panelRoot )
1906    {
1907        // ----------------------------------------------------
1908
// if there are no shortcuts to create, shortcuts are
1909
// not supported, or we should simulate that they are
1910
// not supported, then we have nothing to add. Just
1911
// return
1912
// ----------------------------------------------------
1913
Debug.log( "entering makeXMLData" );
1914        
1915        
1916        if (!shortcutsToCreate || !shortcut.supported() || (groupName == null)
1917                || simulteNotSupported || ! create ) { Debug.log( "abort makeXMLData!" ); return; }
1918
1919        ShortcutData data;
1920        XMLElement dataElement;
1921
1922        // ----------------------------------------------------
1923
// add the item that defines the name of the program group
1924
// ----------------------------------------------------
1925
dataElement = new XMLElement(AUTO_KEY_PROGRAM_GROUP);
1926        dataElement.setAttribute(AUTO_ATTRIBUTE_NAME, groupName);
1927        panelRoot.addChild(dataElement);
1928
1929        // ----------------------------------------------------
1930
// add the details for each of the shortcuts
1931
// ----------------------------------------------------
1932
for (int i = 0; i < shortcuts.size(); i++)
1933        {
1934            Debug.log( "entering makeXMLData" );
1935            data = (ShortcutData) shortcuts.elementAt(i);
1936            dataElement = new XMLElement(AUTO_KEY_SHORTCUT);
1937
1938            dataElement.setAttribute(AUTO_ATTRIBUTE_NAME, data.name);
1939            dataElement.setAttribute(AUTO_ATTRIBUTE_GROUP, (data.addToGroup ? Boolean.TRUE
1940                    : Boolean.FALSE).toString());
1941
1942            // Boolean.valueOf(data.addToGroup)
1943
if(OsVersion.IS_WINDOWS)
1944            
1945              dataElement.setAttribute(AUTO_ATTRIBUTE_TYPE, Integer.toString(data.type));
1946            dataElement.setAttribute(AUTO_ATTRIBUTE_COMMAND, data.commandLine);
1947            dataElement.setAttribute(AUTO_ATTRIBUTE_DESCRIPTION, data.description);
1948            dataElement.setAttribute(AUTO_ATTRIBUTE_ICON, data.iconFile);
1949            dataElement.setAttribute(AUTO_ATTRIBUTE_ICON_INDEX, Integer.toString(data.iconIndex));
1950            dataElement.setAttribute(AUTO_ATTRIBUTE_INITIAL_STATE, Integer
1951                    .toString(data.initialState));
1952            dataElement.setAttribute(AUTO_ATTRIBUTE_TARGET, data.target);
1953            dataElement.setAttribute(AUTO_ATTRIBUTE_WORKING_DIR, data.workingDirectory);
1954            
1955            
1956            dataElement.setAttribute( SPEC_ATTRIBUTE_ENCODING, data.deskTopEntryLinux_Encoding );
1957            dataElement.setAttribute( SPEC_ATTRIBUTE_MIMETYPE, data.deskTopEntryLinux_MimeType );
1958            dataElement.setAttribute( SPEC_ATTRIBUTE_TERMINAL, data.deskTopEntryLinux_Terminal );
1959            dataElement.setAttribute( SPEC_ATTRIBUTE_TERMINAL_OPTIONS, data.deskTopEntryLinux_TerminalOptions );
1960            if(! OsVersion.IS_WINDOWS )
1961              dataElement.setAttribute( SPEC_ATTRIBUTE_TYPE, data.deskTopEntryLinux_Type );
1962
1963            dataElement.setAttribute( SPEC_ATTRIBUTE_URL, data.deskTopEntryLinux_URL );
1964
1965            dataElement.setAttribute( SPEC_ATTRIBUTE_KDE_SUBST_UID, data.deskTopEntryLinux_X_KDE_SubstituteUID );
1966            dataElement.setAttribute( SPEC_CATEGORIES, data.Categories );
1967            dataElement.setAttribute( SPEC_TRYEXEC, data.TryExec );
1968
1969            dataElement.setAttribute( CREATE_FOR_ALL, data.createForAll.toString() );// ? Boolean.TRUE : Boolean.FALSE).toString() );
1970
dataElement.setAttribute( USER_TYPE, Integer.toString( data.userType ) );
1971            
1972            
1973            
1974            //TODO: Add Linux.Attibutes
1975

1976            // ----------------------------------------------
1977
// add the shortcut only if it is either not on
1978
// the desktop or if it is on the desktop and
1979
// the user has signalled that it is ok to place
1980
// shortcuts on the desktop.
1981
// ----------------------------------------------
1982
if ((data.type != Shortcut.DESKTOP)
1983                    || ((data.type == Shortcut.DESKTOP) && allowDesktopShortcut.isSelected()))
1984            {
1985                panelRoot.addChild(dataElement);
1986            }
1987        }
1988    }
1989
1990    /*--------------------------------------------------------------------------*/
1991
1992    /**
1993     * Creates shortcuts based on teh information in panelRoot without UI.
1994     *
1995     * @param panelRoot the root of the XML tree
1996     */

1997
1998    /*--------------------------------------------------------------------------*/
1999    /*
2000     *
2001     *
2002     * Reconstitute the information needed to create shortcuts from XML data that was previously
2003     * stored by the installer through makeXMLData(). Create a new Vector containing this data and
2004     * stroe it in 'shortcuts' for use by createShortcuts(). Once this has been completed, call
2005     * createShortcuts() to complete the operation.
2006     * --------------------------------------------------------------------------
2007     */

2008
2009    
2010}
2011
2012/*---------------------------------------------------------------------------*/
2013
Popular Tags