Skip to content

Commit

Permalink
support filestoreeditorinput (fixes #215)
Browse files Browse the repository at this point in the history
  • Loading branch information
JPMoresmau committed Jul 22, 2014
1 parent 2000866 commit 24fa9b8
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 17 deletions.
1 change: 1 addition & 0 deletions docs/releasenotes/net.sf.eclipsefp.haskell_2.6.1.txt
Expand Up @@ -17,6 +17,7 @@ Fixes:
- Better capture of GHCI history (supports moving caret left and right) (https://github.com/JPMoresmau/eclipsefp/issues/189) - Better capture of GHCI history (supports moving caret left and right) (https://github.com/JPMoresmau/eclipsefp/issues/189)
- Support case-insensitive PATH environment variable name (https://github.com/JPMoresmau/eclipsefp/issues/202) - Support case-insensitive PATH environment variable name (https://github.com/JPMoresmau/eclipsefp/issues/202)
- Support one location breakpoints (https://github.com/JPMoresmau/eclipsefp/issues/211) - Support one location breakpoints (https://github.com/JPMoresmau/eclipsefp/issues/211)
- Support opening a cabal file outside of the workspace (shows only source) (https://github.com/JPMoresmau/eclipsefp/issues/215)


Features: Features:
- Pass GHC implementation chosen in preference to cabal via --with-ghc - Pass GHC implementation chosen in preference to cabal via --with-ghc
Expand Down
Expand Up @@ -25,6 +25,7 @@
import org.eclipse.ui.IFileEditorInput; import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.PartInitException; import org.eclipse.ui.PartInitException;
import org.eclipse.ui.forms.editor.FormEditor; import org.eclipse.ui.forms.editor.FormEditor;
import org.eclipse.ui.ide.FileStoreEditorInput;
import org.eclipse.ui.texteditor.IStatusField; import org.eclipse.ui.texteditor.IStatusField;
import org.eclipse.ui.texteditor.ITextEditorExtension; import org.eclipse.ui.texteditor.ITextEditorExtension;


Expand Down Expand Up @@ -53,11 +54,13 @@ public PackageDescription getPackageDescription() {
public void setPackageDescription( final PackageDescription packageDescription ) { public void setPackageDescription( final PackageDescription packageDescription ) {
this.packageDescription = packageDescription; this.packageDescription = packageDescription;
cabalSourceEditor.setPackageDescription( packageDescription ); cabalSourceEditor.setPackageDescription( packageDescription );
overview.setPackageDescription( packageDescription ); if (overview!=null){
library.setPackageDescription( packageDescription ); overview.setPackageDescription( packageDescription );
executables.setPackageDescription( packageDescription ); library.setPackageDescription( packageDescription );
testSuites.setPackageDescription( packageDescription ); executables.setPackageDescription( packageDescription );
benchmarks.setPackageDescription( packageDescription ); testSuites.setPackageDescription( packageDescription );
benchmarks.setPackageDescription( packageDescription );
}
} }


public IDocument getModel() { public IDocument getModel() {
Expand Down Expand Up @@ -100,18 +103,21 @@ public BenchmarksPage getBenchmarks() {
@Override @Override
protected void addPages() { protected void addPages() {
try { try {
IProject project = fileInput.getFile().getProject(); IProject project = null;
if (project!=null){ if (fileInput!=null){
overview = new OverviewPage( this, project ); project = fileInput.getFile().getProject();
addPage(overview); if (project!=null){
library = new LibraryPage( this, project ); overview = new OverviewPage( this, project );
addPage(library); addPage(overview);
executables = new ExecutablesPage( this, project ); library = new LibraryPage( this, project );
addPage(executables); addPage(library);
testSuites = new TestSuitesPage( this, project ); executables = new ExecutablesPage( this, project );
addPage(testSuites); addPage(executables);
benchmarks = new BenchmarksPage( this, project ); testSuites = new TestSuitesPage( this, project );
addPage(benchmarks); addPage(testSuites);
benchmarks = new BenchmarksPage( this, project );
addPage(benchmarks);
}
} }
cabalSourceEditor = new CabalEditor(this); cabalSourceEditor = new CabalEditor(this);
addPage( cabalSourceEditor, getEditorInput() ); addPage( cabalSourceEditor, getEditorInput() );
Expand Down Expand Up @@ -152,6 +158,9 @@ public void init( final IEditorSite site,
if( input instanceof IFileEditorInput ) { if( input instanceof IFileEditorInput ) {
fileInput = ( IFileEditorInput )input; fileInput = ( IFileEditorInput )input;
setPartName( fileInput.getFile().getName() ); setPartName( fileInput.getFile().getName() );
} else if (input instanceof FileStoreEditorInput){
// minimal support
setPartName( input.getName() );
} else { } else {
HaskellUIPlugin.log( NLS.bind( UITexts.unsupported_input, this.getClass().getName(),input.getClass().getName() ), IStatus.WARNING ); HaskellUIPlugin.log( NLS.bind( UITexts.unsupported_input, this.getClass().getName(),input.getClass().getName() ), IStatus.WARNING );
} }
Expand Down

0 comments on commit 24fa9b8

Please sign in to comment.