Changeset 8
- Timestamp:
- 10/19/09 14:04:05 (15 years ago)
- Location:
- trunk/de.ugoe.cs.swe.exercises
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/de.ugoe.cs.swe.exercises/META-INF/MANIFEST.MF
r7 r8 10 10 net.sourceforge.texlipse;bundle-version="1.3.0", 11 11 org.eclipse.core.filesystem;bundle-version="1.2.0", 12 org.eclipse.ui.ide;bundle-version="3.5.1" 12 org.eclipse.ui.ide;bundle-version="3.5.1", 13 org.eclipse.core.resources;bundle-version="3.5.1" 13 14 Bundle-ActivationPolicy: lazy 14 15 Bundle-RequiredExecutionEnvironment: JavaSE-1.6 -
trunk/de.ugoe.cs.swe.exercises/src/de/ugoe/cs/swe/exercises/exercisesheet/ExerciseSheetComposite.java
r3 r8 1 1 package de.ugoe.cs.swe.exercises.exercisesheet; 2 2 3 import java.awt.Desktop;4 3 import java.io.File; 5 import java.io.IOException;6 4 import java.util.ArrayList; 7 import org.eclipse.swt.widgets.Composite; 8 import org.eclipse.swt.widgets.FileDialog; 9 import org.eclipse.swt.widgets.Shell; 10 import org.eclipse.swt.widgets.TableItem; 11 import org.eclipse.swt.widgets.Text; 12 import org.eclipse.swt.layout.GridData; 13 import org.eclipse.swt.layout.GridLayout; 14 import org.eclipse.swt.widgets.Button; 5 6 import org.eclipse.core.filesystem.EFS; 7 import org.eclipse.core.filesystem.IFileStore; 15 8 import org.eclipse.swt.SWT; 16 import org.eclipse.swt.widgets.Label; 17 import de.ugoe.cs.swe.exercises.exercise.Exercise; 18 import de.ugoe.cs.swe.exercises.exercise.ExerciseSVN; 19 import de.ugoe.cs.swe.exercises.lecture.GUITreeView; 20 import de.ugoe.cs.swe.exercises.misc.CKeyword; 21 import de.ugoe.cs.swe.exercises.misc.KeywordsCompositeExtender; 22 23 import org.eclipse.swt.widgets.Table; 24 import org.eclipse.swt.widgets.TableColumn; 9 import org.eclipse.swt.custom.SashForm; 25 10 import org.eclipse.swt.dnd.DND; 26 11 import org.eclipse.swt.dnd.DragSource; … … 32 17 import org.eclipse.swt.dnd.TextTransfer; 33 18 import org.eclipse.swt.dnd.Transfer; 19 import org.eclipse.swt.events.ModifyEvent; 34 20 import org.eclipse.swt.events.ModifyListener; 35 import org.eclipse.swt.events.ModifyEvent;36 21 import org.eclipse.swt.events.SelectionAdapter; 37 22 import org.eclipse.swt.events.SelectionEvent; 23 import org.eclipse.swt.layout.GridData; 24 import org.eclipse.swt.layout.GridLayout; 25 import org.eclipse.swt.widgets.Button; 26 import org.eclipse.swt.widgets.Composite; 27 import org.eclipse.swt.widgets.FileDialog; 38 28 import org.eclipse.swt.widgets.Group; 39 import org.eclipse.swt.custom.SashForm; 29 import org.eclipse.swt.widgets.Label; 30 import org.eclipse.swt.widgets.Shell; 31 import org.eclipse.swt.widgets.Table; 32 import org.eclipse.swt.widgets.TableColumn; 33 import org.eclipse.swt.widgets.TableItem; 34 import org.eclipse.swt.widgets.Text; 35 import org.eclipse.ui.IEditorInput; 36 import org.eclipse.ui.IEditorRegistry; 37 import org.eclipse.ui.IWorkbenchPage; 38 import org.eclipse.ui.PartInitException; 39 import org.eclipse.ui.PlatformUI; 40 import org.eclipse.ui.ide.FileStoreEditorInput; 41 42 import de.ugoe.cs.swe.exercises.exercise.Exercise; 43 import de.ugoe.cs.swe.exercises.exercise.ExerciseSVN; 44 import de.ugoe.cs.swe.exercises.lecture.GUITreeView; 45 import de.ugoe.cs.swe.exercises.misc.CKeyword; 46 import de.ugoe.cs.swe.exercises.misc.KeywordsCompositeExtender; 40 47 41 48 public class ExerciseSheetComposite extends Composite { … … 311 318 .getProperty("java.io.tmpdir") 312 319 + "/tempPDFfileForPreview.pdf", false, true); 320 File f = new File(System.getProperty("java.io.tmpdir") 321 + "/tempPDFfileForPreview.pdf"); 322 323 IWorkbenchPage activePage = PlatformUI.getWorkbench() 324 .getActiveWorkbenchWindow().getActivePage(); 325 326 final IFileStore fileStore = EFS.getLocalFileSystem().getStore( 327 f.toURI()); 328 329 IEditorInput editorInput = new FileStoreEditorInput(fileStore); 313 330 try { 314 Desktop d = Desktop.getDesktop(); 315 d.open(new File(System.getProperty("java.io.tmpdir") 316 + "/tempPDFfileForPreview.pdf")); 317 318 } catch (IOException e1) { 319 System.err.println(e1); 331 activePage.openEditor(editorInput, 332 IEditorRegistry.SYSTEM_EXTERNAL_EDITOR_ID); 333 } catch (PartInitException e1) { 334 e1.printStackTrace(); 320 335 } 321 322 336 } 323 337 }); -
trunk/de.ugoe.cs.swe.exercises/src/de/ugoe/cs/swe/exercises/exercisesheet/ExerciseSheetPDFDialog.java
r3 r8 1 1 package de.ugoe.cs.swe.exercises.exercisesheet; 2 3 2 4 3 import java.awt.Desktop; … … 6 5 import java.io.IOException; 7 6 8 7 import org.eclipse.core.filesystem.EFS; 8 import org.eclipse.core.filesystem.IFileStore; 9 9 import org.eclipse.jface.dialogs.IMessageProvider; 10 10 import org.eclipse.jface.dialogs.TitleAreaDialog; … … 21 21 import org.eclipse.swt.widgets.Label; 22 22 import org.eclipse.swt.widgets.Shell; 23 23 import org.eclipse.ui.IEditorInput; 24 import org.eclipse.ui.IEditorRegistry; 25 import org.eclipse.ui.IWorkbenchPage; 26 import org.eclipse.ui.PartInitException; 27 import org.eclipse.ui.PlatformUI; 28 import org.eclipse.ui.ide.FileStoreEditorInput; 24 29 25 30 public class ExerciseSheetPDFDialog extends TitleAreaDialog { … … 36 41 super(parentShell); 37 42 super.setShellStyle(0); 38 if (!file.endsWith(".pdf"))43 if (!file.endsWith(".pdf")) 39 44 file += ".pdf"; 40 45 ExerciseSheetPDFDialog.fileName = file; … … 87 92 button.setLayoutData(buttonlayout); 88 93 button.addSelectionListener(new SelectionAdapter() { 89 90 94 91 95 @Override 92 96 public void widgetSelected(SelectionEvent e) { 97 IWorkbenchPage activePage = PlatformUI.getWorkbench() 98 .getActiveWorkbenchWindow().getActivePage(); 93 99 100 File f = new File(ExerciseSheetPDFDialog.fileName); 101 102 final IFileStore fileStore = EFS.getLocalFileSystem().getStore( 103 f.toURI()); 104 105 IEditorInput editorInput = new FileStoreEditorInput(fileStore); 94 106 try { 95 Desktop d = Desktop.getDesktop(); 96 d.open(new File(ExerciseSheetPDFDialog.fileName)); 97 } catch (IOException e1) { 98 // TODO Auto-generated catch block 99 System.err.println(e1); 107 activePage.openEditor(editorInput, 108 IEditorRegistry.SYSTEM_EXTERNAL_EDITOR_ID); 109 } catch (PartInitException e1) { 110 e1.printStackTrace(); 100 111 } 112 101 113 shell.setEnabled(true); 102 114 close();
Note: See TracChangeset
for help on using the changeset viewer.