Changeset 7 for trunk/src/org/expeditee/actions/Misc.java
- Timestamp:
- 05/01/08 12:26:53 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/actions/Misc.java
r4 r7 6 6 import java.awt.image.BufferedImage; 7 7 import java.io.File; 8 import java.io.FileInputStream;9 8 import java.io.FileNotFoundException; 10 import java.io.FileOutputStream;11 9 import java.io.IOException; 12 10 import java.util.List; … … 113 111 Frame toDelete = DisplayIO.getCurrentFrame(); 114 112 DisplayIO.Back(); 113 String deletedFrame = toDelete.getFrameName(); 114 String deletedFrameNameLowercase = deletedFrame.toLowerCase(); 115 115 try { 116 String deletedFrame = toDelete.getFrameName();117 116 boolean del = FrameIO.DeleteFrame(toDelete); 118 117 if (!del) { … … 123 122 for (Item i : current.getItems()) 124 123 if (i.getLink() != null 125 && i.get Link().toLowerCase().equals(126 toDelete.getFrameName().toLowerCase())) {124 && i.getAbsoluteLink().toLowerCase().equals( 125 deletedFrameNameLowercase)) { 127 126 i.setLink(null); 128 127 } 129 128 130 129 FrameGraphics.Repaint(); 131 FrameGraphics.DisplayMessage(deletedFrame 132 + " Deleted."); 130 FrameGraphics.DisplayMessage(deletedFrame + " Deleted."); 133 131 } 134 132 } catch (IOException ioe) { 135 FrameGraphics.ErrorMessage("Error trying to delete " 136 + toDelete.getFrameName() +":\n" + ioe.getMessage());133 FrameGraphics.ErrorMessage("Error trying to delete " + deletedFrame 134 + ":\n" + ioe.getMessage()); 137 135 } 138 136 } … … 240 238 FrameGraphics.Repaint(); 241 239 } 242 240 243 241 /** 244 242 * Creates a new Text Object containing the available fonts. … … 246 244 public static void GetAvailableFontFamilyNames() { 247 245 248 String[] availableFonts = GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames(); 246 String[] availableFonts = GraphicsEnvironment 247 .getLocalGraphicsEnvironment().getAvailableFontFamilyNames(); 249 248 StringBuilder fontsList = new StringBuilder(); 250 for (String s : availableFonts) {249 for (String s : availableFonts) { 251 250 fontsList.append(s).append('\n'); 252 251 } 253 252 254 253 Text text = DisplayIO.getCurrentFrame().createNewText(); 255 254 // We dont want the stats to wrap at all … … 364 363 public static void CopyFile(String existingFile, String newFileName) { 365 364 try { 366 //TODO is there a built in method which will do this faster? 367 368 FrameGraphics.DisplayMessage("Copying file " + existingFile + " to " + newFileName + "..."); 369 FileInputStream is = new FileInputStream(existingFile); 370 FileOutputStream os = new FileOutputStream( 371 newFileName, false); 372 int data; 373 while ( (data = is.read()) != -1 ) { 374 os.write(data); 375 } 376 os.flush(); 377 os.close(); 378 is.close(); 365 // TODO is there a built in method which will do this faster? 366 367 FrameGraphics.DisplayMessage("Copying file " + existingFile 368 + " to " + newFileName + "..."); 369 FrameIO.copyFile(existingFile, newFileName); 379 370 FrameGraphics.DisplayMessage("File copied successfully"); 380 371 } catch (FileNotFoundException e) { 381 372 FrameGraphics.DisplayMessage("Error opening file: " + existingFile); 382 } catch (Exception e) {373 } catch (Exception e) { 383 374 FrameGraphics.DisplayMessage("File could not be copied"); 384 375 } … … 446 437 447 438 for (Item i : body) 448 if (i != child.getTitle() && i != child.get Name()439 if (i != child.getTitle() && i != child.getFrameNameItem() 449 440 && !i.isAnnotation()) { 450 441 item = i;
Note:
See TracChangeset
for help on using the changeset viewer.