Changeset 17685 for release-kits
- Timestamp:
- 2008-11-05T14:03:24+13:00 (15 years ago)
- Location:
- release-kits/shared/uninstaller
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
release-kits/shared/uninstaller
- Property svn:ignore
-
old new 1 1 startmenu 2 2 gsdl 3 3 resources
-
- Property svn:ignore
-
release-kits/shared/uninstaller/Uninstaller.java
r17456 r17685 27 27 public static int SCREEN_HEIGHT = 450; 28 28 29 public static final ResourceBundle bundle = ResourceBundle.getBundle(" Uninstaller");29 public static final ResourceBundle bundle = ResourceBundle.getBundle("resources.LanguagePack"); 30 30 31 31 public static final File gs2InstallProps = new File("etc/installation.properties"); … … 39 39 JCheckBox keepCollectionsCheckbox; 40 40 //JCheckBox keepModifiedFilesCheckbox; 41 42 //panels 41 43 JPanel progressPanel; 42 44 JPanel introPanel; 45 46 //toolbars 47 JPanel initialToolbar; 48 JPanel finishToolbar; 49 50 43 51 JTextArea log; 44 52 JButton uninstallButton; 45 JPanel initialToolbar;46 JPanel finishToolbar;47 53 48 54 … … 57 63 Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); 58 64 frame.setLocation(screenSize.width/2 - frame.getWidth()/2, screenSize.height/2 - frame.getHeight()/2); 65 66 //The panel to introduce and ask for options 67 introPanel = new JPanel(new BorderLayout()); 68 JPanel innerPanel = new JPanel(); 69 innerPanel.setLayout( new BoxLayout(innerPanel,BoxLayout.Y_AXIS) ); 70 innerPanel.setBorder( new EmptyBorder(10, 10, 5, 10) ); 71 introPanel.add( BorderLayout.WEST, innerPanel ); 59 72 60 73 //The panel to be displayed while the uninstall is happening … … 67 80 progressPanel.add( BorderLayout.CENTER, logPane ); 68 81 69 //The panel to introduce and ask for options70 introPanel = new JPanel(new BorderLayout());71 frame.getContentPane().add( BorderLayout.NORTH, introPanel );72 73 JPanel innerPanel = new JPanel();74 innerPanel.setLayout( new BoxLayout(innerPanel,BoxLayout.Y_AXIS) );75 innerPanel.setBorder( new EmptyBorder(10, 10, 5, 10) );76 introPanel.add( BorderLayout.WEST, innerPanel );77 78 82 //initial toolbar 79 83 initialToolbar = new JPanel(); 80 JButton cancelButton = new JButton(bundle.getString("cancel")); 84 uninstallButton = new JButton(bundle.getString("uninstaller.uninstall")); 85 uninstallButton.addActionListener( new StartUninstallListener() ); 86 JButton cancelButton = new JButton(bundle.getString("uninstaller.cancel")); 81 87 cancelButton.addActionListener( new CancelListener() ); 82 83 uninstallButton = new JButton(bundle.getString("uninstall")); 84 uninstallButton.addActionListener( new StartUninstallListener() ); 85 88 initialToolbar.add(uninstallButton); 86 89 initialToolbar.add(cancelButton); 87 initialToolbar.add(uninstallButton);88 frame.getContentPane().add( BorderLayout.SOUTH, initialToolbar );89 90 90 91 //finish toolbar 91 92 finishToolbar = new JPanel(); 92 JButton finishButton = new JButton(bundle.getString(" finish"));93 JButton finishButton = new JButton(bundle.getString("uninstaller.finish")); 93 94 finishButton.addActionListener( new FinishListener() ); 94 95 finishToolbar.add( finishButton ); 96 95 97 96 98 String pwd = (new File(".")).getAbsolutePath(); … … 101 103 JLabel l; 102 104 103 l = new JLabel(bundle.getString(" will.uninstall.from"));105 l = new JLabel(bundle.getString("uninstaller.will.uninstall.from")); 104 106 innerPanel.add( l ); 105 107 innerPanel.add( Box.createRigidArea(new Dimension(5,5)) ); … … 110 112 innerPanel.add( Box.createRigidArea(new Dimension(5,20)) ); 111 113 112 l = new JLabel(bundle.getString("uninstall .options"));114 l = new JLabel(bundle.getString("uninstaller.uninstall.options")); 113 115 innerPanel.add( l ); 114 116 115 keepCollectionsCheckbox = new JCheckBox(bundle.getString(" keep.collections"));117 keepCollectionsCheckbox = new JCheckBox(bundle.getString("uninstaller.keep.collections")); 116 118 keepCollectionsCheckbox.setSelected(true); 117 119 innerPanel.add( keepCollectionsCheckbox ); … … 120 122 //innerPanel.add( keepModifiedFilesCheckbox ); 121 123 122 frame.setTitle( bundle.getString(" greenstone.uninstaller") );124 frame.setTitle( bundle.getString("uninstaller.greenstone.uninstaller") ); 123 125 frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 126 127 //the initial screen 128 frame.getContentPane().add( BorderLayout.NORTH, introPanel ); 129 frame.getContentPane().add( BorderLayout.SOUTH, initialToolbar ); 130 124 131 frame.setVisible(true); 125 132 … … 147 154 148 155 //The dialog to ask "are you sure" 149 Object[] options = { bundle.getString(" cancel"), bundle.getString("uninstall") };156 Object[] options = { bundle.getString("uninstaller.uninstall"), bundle.getString("uninstaller.cancel") }; 150 157 int n = JOptionPane.showOptionDialog( 151 158 frame, 152 bundle.getString(" are.you.sure"),153 bundle.getString(" confirmation"),159 bundle.getString("uninstaller.are.you.sure"), 160 bundle.getString("uninstaller.confirmation"), 154 161 JOptionPane.YES_NO_CANCEL_OPTION, 155 162 JOptionPane.QUESTION_MESSAGE, … … 158 165 options[0] 159 166 ); 160 if ( n == 0) {167 if ( n == 1 ) { 161 168 return; 162 169 } … … 167 174 //confirm delete of collections 168 175 if ( !keepCollections ) { 169 options[0] = bundle.getString(" cancel");170 options[1] = bundle.getString(" continue");176 options[0] = bundle.getString("uninstaller.continue"); 177 options[1] = bundle.getString("uninstaller.cancel"); 171 178 n = JOptionPane.showOptionDialog( 172 179 frame, 173 bundle.getString(" are.you.sure.collections"),174 bundle.getString(" confirmation"),180 bundle.getString("uninstaller.are.you.sure.collections"), 181 bundle.getString("uninstaller.confirmation"), 175 182 JOptionPane.YES_NO_CANCEL_OPTION, 176 183 JOptionPane.WARNING_MESSAGE, … … 179 186 options[0] 180 187 ); 181 if ( n == 0) {188 if ( n == 1 ) { 182 189 return; 183 190 } 184 191 } 185 192 186 //swap to the progress panel187 introPanel.setVisible( false);193 194 introPanel.setVisible( false ); 188 195 frame.getContentPane().remove(introPanel); 189 frame.getContentPane().add( BorderLayout.CENTER, progressPanel); 190 frame.setVisible(true); 196 frame.getContentPane().add( BorderLayout.CENTER, progressPanel ); 191 197 192 198 //disable the uninstall button 193 199 uninstallButton.setEnabled( false ); 200 options = new Object[1]; 201 options[0] = "OK"; 202 n = JOptionPane.showOptionDialog( 203 frame, 204 "repainting", 205 "repainting", 206 JOptionPane.OK_OPTION, 207 JOptionPane.INFORMATION_MESSAGE, 208 null, 209 options, 210 options[0] 211 ); 194 212 195 213 … … 205 223 206 224 if ( !gs2InstallProps.exists() && !gs3InstallProps.exists() ) { 207 log.append( bundle.getString(" error.couldnt.find.install.props") + "\n" );208 JOptionPane.showMessageDialog(frame, bundle.getString(" error.couldnt.find.install.props"), bundle.getString("error"), 0);225 log.append( bundle.getString("uninstaller.error.couldnt.find.install.props") + "\n" ); 226 JOptionPane.showMessageDialog(frame, bundle.getString("uninstaller.error.couldnt.find.install.props"), bundle.getString("uninstaller.error"), 0); 209 227 return false; 210 228 } … … 241 259 242 260 if ( startMenuPath == null ) { 243 log.append( bundle.getString(" info.no.startmenu") + "\n" );261 log.append( bundle.getString("uninstaller.info.no.startmenu") + "\n" ); 244 262 } else { 245 263 log.append( "StartMenu Path: " + startMenuPath.getAbsolutePath() + "\n" ); … … 247 265 recursiveDelete( startMenuPath, null ); 248 266 } catch ( CancelledException ce ) { 249 log.append( bundle.getString(" cancelled") + "\n" );267 log.append( bundle.getString("uninstaller.cancelled") + "\n" ); 250 268 changeToFinishToolbar(); 251 JOptionPane.showMessageDialog(frame, bundle.getString(" cancelled"), bundle.getString("complete"), 1);269 JOptionPane.showMessageDialog(frame, bundle.getString("uninstaller.cancelled"), bundle.getString("uninstaller.complete"), 1); 252 270 return; 253 271 } … … 276 294 cd = new File( new File(".").getCanonicalPath() ); 277 295 } catch ( Exception e ) { 278 JOptionPane.showMessageDialog(frame, bundle.getString(" failed.to.figure.cd"), bundle.getString("error") , 0);296 JOptionPane.showMessageDialog(frame, bundle.getString("uninstaller.failed.to.figure.cd"), bundle.getString("uninstaller.error") , 0); 279 297 System.exit(0); 280 298 } … … 287 305 recursiveDelete( cd , ex ); 288 306 } catch ( CancelledException ce ) { 289 log.append( bundle.getString(" cancelled") + "\n" );290 JOptionPane.showMessageDialog(frame, bundle.getString(" cancelled"), bundle.getString("complete"), 1);307 log.append( bundle.getString("uninstaller.cancelled") + "\n" ); 308 JOptionPane.showMessageDialog(frame, bundle.getString("uninstaller.cancelled"), bundle.getString("uninstaller.complete"), 1); 291 309 changeToFinishToolbar(); 292 310 return; … … 297 315 (new File("uninst.flag")).createNewFile(); 298 316 } catch (Exception e) { 299 log.append( bundle.getString(" couldnt-create-flagfile") + "\n" );317 log.append( bundle.getString("uninstaller.couldnt-create-flagfile") + "\n" ); 300 318 } 301 319 302 320 changeToFinishToolbar(); 303 JOptionPane.showMessageDialog(frame, bundle.getString(" finished"), bundle.getString("complete"), 1);321 JOptionPane.showMessageDialog(frame, bundle.getString("uninstaller.finished"), bundle.getString("uninstaller.complete"), 1); 304 322 } 305 323 … … 348 366 // Make sure the file or directory exists 349 367 if (!f.exists()) { 350 log.append( Strings.replaceAll( bundle.getString(" warning.nonexistent"), "{file}", f.getAbsolutePath() ) + "\n" );368 log.append( Strings.replaceAll( bundle.getString("uninstaller.warning.nonexistent"), "{file}", f.getAbsolutePath() ) + "\n" ); 351 369 return; 352 370 } … … 358 376 try { 359 377 if ( f.equals( exceptions[i] ) || f.getCanonicalPath().equals(exceptions[i].getCanonicalPath()) ) { 360 log.append( Strings.replaceAll( bundle.getString(" info.skipping"), "{file}", f.getAbsolutePath() ) + "\n" );378 log.append( Strings.replaceAll( bundle.getString("uninstaller.info.skipping"), "{file}", f.getAbsolutePath() ) + "\n" ); 361 379 return; 362 380 } … … 370 388 //check existance 371 389 if ( !f.exists() ) { 372 log.append( Strings.replaceAll( bundle.getString(" error.nonexistent"), "{file}", f.getAbsolutePath() ) + "\n" );390 log.append( Strings.replaceAll( bundle.getString("uninstaller.error.nonexistent"), "{file}", f.getAbsolutePath() ) + "\n" ); 373 391 return; 374 392 } … … 397 415 if ( doDelete ) { 398 416 399 log.append( Strings.replaceAll( bundle.getString(" deleting"), "{file}", f.getAbsolutePath() ) + "\n" );417 log.append( Strings.replaceAll( bundle.getString("uninstaller.deleting"), "{file}", f.getAbsolutePath() ) + "\n" ); 400 418 while ( !f.delete() ) { 401 log.append( Strings.replaceAll( bundle.getString(" warning.couldnt.delete"), "{file}", f.getAbsolutePath() ) + "\n" );419 log.append( Strings.replaceAll( bundle.getString("uninstaller.warning.couldnt.delete"), "{file}", f.getAbsolutePath() ) + "\n" ); 402 420 403 421 if ( ignoreReadOnlys ) { … … 405 423 } 406 424 407 Object[] options = { bundle.getString(" cancel"), bundle.getString("retry"), bundle.getString("skip"), bundle.getString("skip.all") };425 Object[] options = { bundle.getString("uninstaller.retry"), bundle.getString("uninstaller.skip"), bundle.getString("uninstaller.skip.all"), bundle.getString("uninstaller.cancel") }; 408 426 int n = JOptionPane.showOptionDialog( 409 427 frame, 410 Strings.replaceAll( bundle.getString(" warning.readonly"), "{file}", f.getAbsolutePath() ),411 bundle.getString(" readonly"),428 Strings.replaceAll( bundle.getString("uninstaller.warning.readonly"), "{file}", f.getAbsolutePath() ), 429 bundle.getString("uninstaller.readonly"), 412 430 JOptionPane.YES_NO_CANCEL_OPTION, 413 431 JOptionPane.QUESTION_MESSAGE, … … 417 435 ); 418 436 419 if ( n == 0) {437 if ( n == 3 ) { 420 438 throw new CancelledException(); 439 } else if ( n == 1 ) { 440 return; 421 441 } else if ( n == 2 ) { 422 return;423 } else if ( n == 3 ) {424 442 ignoreReadOnlys = true; 425 443 return; -
release-kits/shared/uninstaller/compile.sh
r17456 r17685 1 javac Uninstaller.java 2 jar -cmf manifest.mf gsdl-template/uninst.jar *.class *.properties 1 rk_home=$1 2 if [ "$rk_home" = "" ]; then 3 echo "usage: ./compile.sh <rk_home>" 4 exit 5 fi 6 7 #setup language string bundle 8 rm -rf resources 9 mkdir resources 10 cp $rk_home/language-strings/*.properties resources 11 12 #java compile 13 javac Uninstaller.java -Xlint:unchecked 14 jar -cmf manifest.mf gsdl-template/uninst.jar *.class resources 15 16 #setup a fake greenstone installation 3 17 cp Uninstall.bat gsdl-template 4 18 cp Uninstall.sh gsdl-template
Note:
See TracChangeset
for help on using the changeset viewer.