Skip to content
This repository
Browse code

work with fileinput too

  • Loading branch information...
commit 026d98048736c26c90d3e54e32b830c705f5c00b 1 parent 2a8efc4
JP Moresmau authored December 12, 2012
13  net.sf.eclipsefp.haskell.ui/src/net/sf/eclipsefp/haskell/ui/properties/ModuleInclusionPP.java
@@ -13,6 +13,7 @@
13 13
 import org.eclipse.swt.SWT;
14 14
 import org.eclipse.swt.widgets.Composite;
15 15
 import org.eclipse.swt.widgets.Control;
  16
+import org.eclipse.ui.IFileEditorInput;
16 17
 import org.eclipse.ui.dialogs.PropertyPage;
17 18
 
18 19
 /**
@@ -27,10 +28,18 @@ public ModuleInclusionPP() {
27 28
     // NOOP
28 29
   }
29 30
 
  31
+  protected IFile getFile(){
  32
+    Object o=getElement();
  33
+    if (o instanceof IFileEditorInput){
  34
+      return ((IFileEditorInput)o).getFile();
  35
+    }
  36
+    return (IFile)o;
  37
+  }
  38
+
30 39
   @Override
31 40
   protected Control createContents( final Composite parent ) {
32 41
     mic=new ModuleInclusionComposite( parent, SWT.NONE );
33  
-    IFile f=(IFile)getElement();
  42
+    IFile f=getFile();
34 43
 
35 44
     IContainer src=ResourceUtil.getSourceContainer( f );
36 45
     if (src!=null){
@@ -53,7 +62,7 @@ public boolean performOk() {
53 62
     if (info!=null){
54 63
       mic.populateInfo( info );
55 64
       ModuleCreationOperation mco=new ModuleCreationOperation( info );
56  
-      mco.setGeneratedFile( (IFile)getElement() );
  65
+      mco.setGeneratedFile( getFile() );
57 66
 
58 67
       try {
59 68
         mco.run( new NullProgressMonitor() );

0 notes on commit 026d980

Please sign in to comment.
Something went wrong with that request. Please try again.