Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Labeled all my own TODOs with TtC for future reference.

Implemented some small things for Windows (untested).
  • Loading branch information...
commit f82680a8dd2dfef7e65ccd75aab75c1a72ec3a8b 1 parent 85f170d
@ttencate authored
Showing with 81 additions and 52 deletions.
  1. +1 −1  net.sf.eclipsefp.haskell.core/src/net/sf/eclipsefp/haskell/core/internal/project/CabalBuilder.java
  2. +1 −1  net.sf.eclipsefp.haskell.core/src/net/sf/eclipsefp/haskell/core/util/QueryUtil.java
  3. +1 −1  net.sf.eclipsefp.haskell.ghccompiler/src/net/sf/eclipsefp/haskell/ghccompiler/core/GhcOutputParser.java
  4. +1 −1  net.sf.eclipsefp.haskell.scion.client/src/net/sf/eclipsefp/haskell/scion/client/ScionInstance.java
  5. +0 −1  net.sf.eclipsefp.haskell.scion.client/src/net/sf/eclipsefp/haskell/scion/client/ScionPlugin.java
  6. +1 −1  ...clipsefp.haskell.scion.client/src/net/sf/eclipsefp/haskell/scion/internal/commands/DefinedNamesCommand.java
  7. +1 −1  net.sf.eclipsefp.haskell.scion.client/src/net/sf/eclipsefp/haskell/scion/types/Location.java
  8. +1 −1  net.sf.eclipsefp.haskell.ui/src/net/sf/eclipsefp/haskell/ui/dialog/dialogfields/DialogField.java
  9. +1 −1  net.sf.eclipsefp.haskell.ui/src/net/sf/eclipsefp/haskell/ui/handlers/OpenDefinitionHandler.java
  10. +1 −3 net.sf.eclipsefp.haskell.ui/src/net/sf/eclipsefp/haskell/ui/internal/editors/cabal/forms/CabalFormSection.java
  11. +1 −1  net.sf.eclipsefp.haskell.ui/src/net/sf/eclipsefp/haskell/ui/internal/editors/haskell/HaskellEditor.java
  12. +1 −1  net.sf.eclipsefp.haskell.ui/src/net/sf/eclipsefp/haskell/ui/internal/editors/haskell/HaskellTextHover.java
  13. +1 −3 net.sf.eclipsefp.haskell.ui/src/net/sf/eclipsefp/haskell/ui/internal/editors/haskell/text/CodeFolding.java
  14. +1 −3 ...skell.ui/src/net/sf/eclipsefp/haskell/ui/internal/editors/haskell/text/HaskellFoldingStructureProvider.java
  15. +4 −5 net.sf.eclipsefp.haskell.ui/src/net/sf/eclipsefp/haskell/ui/internal/preferences/scion/ScionPP.java
  16. +1 −2  net.sf.eclipsefp.haskell.ui/src/net/sf/eclipsefp/haskell/ui/internal/refactoring/MakePointFreeDelegate.java
  17. +1 −2  net.sf.eclipsefp.haskell.ui/src/net/sf/eclipsefp/haskell/ui/internal/refactoring/RenameDelegate.java
  18. +61 −21 net.sf.eclipsefp.haskell.ui/src/net/sf/eclipsefp/haskell/ui/internal/util/FileUtil.java
  19. +1 −2  net.sf.eclipsefp.haskell.ui/src/net/sf/eclipsefp/haskell/ui/internal/views/outline/HaskellOutlinePage.java
View
2  ...lipsefp.haskell.core/src/net/sf/eclipsefp/haskell/core/internal/project/CabalBuilder.java
@@ -39,7 +39,7 @@
////////////////////
private void checkCabalFile() throws CoreException {
- // TODO replace by something not Cohatoe-based
+ // TODO TtC replace by something not Cohatoe-based
/*
if( getCabalFile().exists() ) {
CohatoeServer server = CohatoeServer.getInstance();
View
2  net.sf.eclipsefp.haskell.core/src/net/sf/eclipsefp/haskell/core/util/QueryUtil.java
@@ -13,7 +13,7 @@
* <p>A typical use would be to call a command line tool and ask for its
* version number, like 'java -version'.</p>
*
- * TODO: refactor this to use ProcessRunner (and probably refactor ProcessRunner as well)
+ * TODO TtC refactor this to use ProcessRunner (and probably refactor ProcessRunner as well)
*
* @author Leif Frenzel
*/
View
2  ...fp.haskell.ghccompiler/src/net/sf/eclipsefp/haskell/ghccompiler/core/GhcOutputParser.java
@@ -15,7 +15,7 @@
*
* For parsing, the Parsec "grammar" from GHCOutputParser.hs is used.
*
- * TODO this should be an {@link ICompilerListener}, I think.
+ * TODO TtC this should be an {@link ICompilerListener}, I think.
*
* @author Thomas ten Cate
*/
View
2  ...lipsefp.haskell.scion.client/src/net/sf/eclipsefp/haskell/scion/client/ScionInstance.java
@@ -141,7 +141,7 @@ public void reloadFile(String fileName) {
}
public void unloadFile(String fileName) {
- // TODO Scion has no command for unloading yet!
+ // TODO TtC Scion has no command for unloading yet!
loadedFiles.remove(fileName);
}
View
1  ...eclipsefp.haskell.scion.client/src/net/sf/eclipsefp/haskell/scion/client/ScionPlugin.java
@@ -70,7 +70,6 @@ public static String getStringResource(String key) {
/**
* Returns whether tracing is enabled for the specified option.
- * TODO this is executed for every trace call, even when tracing is off... optimize?
*/
public static boolean isTracing(String optionId) {
String option = getPluginId() + "/" + optionId;
View
2  ...cion.client/src/net/sf/eclipsefp/haskell/scion/internal/commands/DefinedNamesCommand.java
@@ -18,7 +18,7 @@ protected String getMethod() {
@Override
protected void doProcessResult(Object result) throws JSONException {
- // TODO
+ // TODO TtC
}
}
View
2  net.sf.eclipsefp.haskell.scion.client/src/net/sf/eclipsefp/haskell/scion/types/Location.java
@@ -20,7 +20,7 @@
private int startLine, startColumn, endLine, endColumn;
public Location(JSONObject json) throws JSONException {
- // TODO this is not the complete syntax
+ // TODO TtC this is not the complete syntax
this.fileName = json.getString("file");
JSONArray region = json.getJSONArray("region");
startLine = region.getInt(0) - 1;
View
2  ...eclipsefp.haskell.ui/src/net/sf/eclipsefp/haskell/ui/dialog/dialogfields/DialogField.java
@@ -146,7 +146,7 @@ public Label getLabelControl(final Composite parent) {
if (fLabelText != null && !"".equals(fLabelText)) { //$NON-NLS-1$
fLabel.setText(fLabelText);
} else {
- // XXX: to avoid a 16 pixel wide empty label - revisit
+ // TODO to avoid a 16 pixel wide empty label - revisit
fLabel.setText("."); //$NON-NLS-1$
fLabel.setVisible(false);
}
View
2  ....eclipsefp.haskell.ui/src/net/sf/eclipsefp/haskell/ui/handlers/OpenDefinitionHandler.java
@@ -42,7 +42,7 @@ public Object execute(final ExecutionEvent event) {
ISelection selection = haskellEditor.getSelectionProvider().getSelection();
if (selection instanceof TextSelection) {
TextSelection textSel = (TextSelection)selection;
- String name = textSel.getText().trim(); // TODO make work on 0-length selections too
+ String name = textSel.getText().trim(); // TODO TtC make work on 0-length selections too
Location location = HaskellUIPlugin.getDefault().getScionInstanceManager( file ).firstDefinitionLocation(name);
if (location != null) {
try {
View
4 ...ell.ui/src/net/sf/eclipsefp/haskell/ui/internal/editors/cabal/forms/CabalFormSection.java
@@ -5,14 +5,12 @@
import java.util.HashMap;
import java.util.Map;
-
import net.sf.eclipsefp.haskell.core.internal.project.IManipulateCabalFile;
import net.sf.eclipsefp.haskell.core.internal.project.InvalidCabalFileException;
import net.sf.eclipsefp.haskell.core.internal.project.IManipulateCabalFile.Accessor;
import net.sf.eclipsefp.haskell.core.internal.project.IManipulateCabalFile.Mutator;
import net.sf.eclipsefp.haskell.ui.HaskellUIPlugin;
import net.sf.eclipsefp.haskell.ui.internal.editors.cabal.CabalFormEditor;
-
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.action.IStatusLineManager;
import org.eclipse.jface.text.DocumentEvent;
@@ -73,7 +71,7 @@ IStatusLineManager getStatusLineManager() {
}
IManipulateCabalFile getManipulator() {
- // TODO replace by something not Cohatoe-based
+ // TODO TtC replace by something not Cohatoe-based
/*
CohatoeServer server = CohatoeServer.getInstance();
return server.createFunction( IManipulateCabalFile.class );
View
2  ...fp.haskell.ui/src/net/sf/eclipsefp/haskell/ui/internal/editors/haskell/HaskellEditor.java
@@ -316,7 +316,7 @@ private void createTextOpAction( final String name, final int targetId,
}
private void initMarkOccurrences() {
- // TODO replace by something not Cohatoe-based
+ // TODO TtC replace by something not Cohatoe-based
/*
* CohatoeServer server = CohatoeServer.getInstance(); IMarkOccurrences mo =
* server.createFunction( IMarkOccurrences.class ); if( mo != null ) {
View
2  ...haskell.ui/src/net/sf/eclipsefp/haskell/ui/internal/editors/haskell/HaskellTextHover.java
@@ -38,7 +38,7 @@
@Override
public String getHoverInfo( final ITextViewer textViewer,
final IRegion hoverRegion ) {
- // XXX: this method does not get called when hovering over a string literal
+ // TODO TtC this method does not get called when hovering over a string literal
// which leads to potential problem annotation hovers not appearing
String hoverInfo = computeProblemInfo( textViewer, hoverRegion );
if (hoverInfo != null) {
View
4 ...haskell.ui/src/net/sf/eclipsefp/haskell/ui/internal/editors/haskell/text/CodeFolding.java
@@ -5,11 +5,9 @@
import java.util.ArrayList;
import java.util.List;
-
import net.sf.eclipsefp.haskell.core.compiler.CompilerManager;
import net.sf.eclipsefp.haskell.core.compiler.ICompilerManager;
import net.sf.eclipsefp.haskell.core.internal.hsimpl.IHsImplementation;
-
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
@@ -18,7 +16,7 @@
public List<ICodeFoldingRegion> performCodeFolding(
final IContainer srcRoot, final IFile file ) {
List<ICodeFoldingRegion> result = new ArrayList<ICodeFoldingRegion>();
- // TODO replace by something not Cohatoe-based
+ // TODO TtC replace by something not Cohatoe-based
/*
String libDir = getGHCLibDir();
if( libDir != null && new File( libDir ).exists() ) {
View
4 ...f/eclipsefp/haskell/ui/internal/editors/haskell/text/HaskellFoldingStructureProvider.java
@@ -9,11 +9,9 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
-
import net.sf.eclipsefp.haskell.core.project.HaskellProjectManager;
import net.sf.eclipsefp.haskell.core.project.IHaskellProject;
import net.sf.eclipsefp.haskell.ui.internal.editors.haskell.HaskellEditor;
-
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
@@ -50,7 +48,7 @@ void setDocument( final IDocument document ) {
}
void updateFoldingRegions() {
- // TODO replace by something not Cohatoe-based
+ // TODO TtC replace by something not Cohatoe-based
/*
ProjectionAnnotationModel model = getAnnModel();
if( model != null ) {
View
9 ...ipsefp.haskell.ui/src/net/sf/eclipsefp/haskell/ui/internal/preferences/scion/ScionPP.java
@@ -88,7 +88,7 @@ private String detectScionServer() {
List<File> candidates = new ArrayList<File>(32);
// add all directories from the $PATH variable
- // TODO this is Unix-only; Windows splits on semicolons I believe, and might do quoting/escaping?
+ // TODO TtC this is Unix-only; Windows splits on semicolons I believe, and might do quoting/escaping?
String path = System.getenv("PATH");
for (String dir : path.split(":")) {
candidates.add(new File(dir));
@@ -127,8 +127,7 @@ private String detectScionServer() {
}
public static String getServerExecutableName() {
- // TODO Windows
- return "scion_server";
+ return FileUtil.makeExecutableName("scion_server");
}
/* (non-Javadoc)
@@ -139,8 +138,8 @@ public void init(final IWorkbench workbench) {
}
public static void initializeDefaults(final IPreferenceStore store) {
- // TODO invoke autodetection?
- store.setDefault(SCION_SERVER_EXECUTABLE, "");
+ // scion might be on the path...
+ store.setDefault(SCION_SERVER_EXECUTABLE, getServerExecutableName());
}
}
View
3  ...askell.ui/src/net/sf/eclipsefp/haskell/ui/internal/refactoring/MakePointFreeDelegate.java
@@ -4,7 +4,6 @@
package net.sf.eclipsefp.haskell.ui.internal.refactoring;
import net.sf.eclipsefp.haskell.ui.internal.util.UITexts;
-
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.ltk.core.refactoring.Change;
import org.eclipse.ltk.core.refactoring.CompositeChange;
@@ -68,7 +67,7 @@ void createChange( final IProgressMonitor pm,
private Change createRenameChange() {
TextFileChange result = null;
- // TODO replace by something not Cohatoe-based
+ // TODO TtC replace by something not Cohatoe-based
/*
CohatoeServer server = CohatoeServer.getInstance();
Object fun = server.createFunction( IMakePointFree.class );
View
3  ...psefp.haskell.ui/src/net/sf/eclipsefp/haskell/ui/internal/refactoring/RenameDelegate.java
@@ -4,7 +4,6 @@
package net.sf.eclipsefp.haskell.ui.internal.refactoring;
import net.sf.eclipsefp.haskell.ui.internal.util.UITexts;
-
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.ltk.core.refactoring.Change;
import org.eclipse.ltk.core.refactoring.CompositeChange;
@@ -68,7 +67,7 @@ void createChange( final IProgressMonitor pm,
private Change createRenameChange() {
TextFileChange result = null;
- // TODO replace by something not Cohatoe-based
+ // TODO TtC replace by something not Cohatoe-based
/*
CohatoeServer server = CohatoeServer.getInstance();
IRename fun = server.createFunction( IRename.class );
View
82 net.sf.eclipsefp.haskell.ui/src/net/sf/eclipsefp/haskell/ui/internal/util/FileUtil.java
@@ -2,42 +2,82 @@
import java.io.File;
import java.io.IOException;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
/**
* A class with some static helper methods to work with files.
- *
+ *
* @author Thomas ten Cate
*/
public class FileUtil {
-
+
+ /**
+ * List of extensions of files that can be executed under Windows.
+ * The first is the default in case we need to construct a valid executable file name.
+ */
+ public static final String[] WINDOWS_EXECUTABLE_EXTENSIONS = new String[] { "exe", "bat" };
+
private FileUtil() {
// do not instantiate
}
-
+
+ /**
+ * Makes the given base name into a valid executable file name.
+ * On Unix, this returns the base name itself.
+ * On Windows, it appends ".exe".
+ */
+ public static String makeExecutableName(final String baseName) {
+ if (runningOnWindows()) {
+ return baseName + "." + WINDOWS_EXECUTABLE_EXTENSIONS[0];
+ } else {
+ return baseName;
+ }
+ }
+
/**
* Returns true if the given file is executable.
* On Unix, this checks the file permission bits.
* On Windows, it checks whether the file extension is that of an executable file.
*/
- public static boolean isExecutable(File file) {
- // if (we are on Unix) {
- // Until Java 7, there is no way to check the executable bit of a file.
- // Apart from writing a JNI function (hassle), this is the best we can do...
- try {
- Process process = Runtime.getRuntime().exec(new String[] {"test", "-x", file.getAbsolutePath()});
- int exitValue = process.waitFor();
- if (exitValue != 0) {
- return false;
- }
- } catch (IOException ex) {
- // pretend it succeeded
- } catch (InterruptedException ex) {
- // pretend it succeeded
+ public static boolean isExecutable(final File file) {
+ if (runningOnWindows()) {
+ return isExecutableWindows( file );
+ } else {
+ // Assume a UNIX flavour.
+ return isExecutableUnix( file );
}
- return true;
- // } else if (we are on Windows) {
- // TODO implement this for Windows
- // }
}
+ private static boolean isExecutableUnix( final File file ) {
+ // Until Java 7, there is no way to check the executable bit of a file.
+ // Apart from writing a JNI function (hassle), this is the best we can do...
+ try {
+ Process process = Runtime.getRuntime().exec(new String[] {"test", "-x", file.getAbsolutePath()});
+ int exitValue = process.waitFor();
+ if (exitValue != 0) {
+ return false;
+ }
+ } catch (IOException ex) {
+ // pretend it succeeded
+ } catch (InterruptedException ex) {
+ // pretend it succeeded
+ }
+ return true;
+ }
+
+ private static boolean isExecutableWindows( final File file ) {
+ String fileExt = new Path(file.getPath()).getFileExtension();
+ for (String ext : WINDOWS_EXECUTABLE_EXTENSIONS) {
+ if (fileExt.equals( ext )) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private static boolean runningOnWindows() {
+ return Platform.getOS().equals( Platform.OS_WIN32 );
+ }
+
}
View
3  ...haskell.ui/src/net/sf/eclipsefp/haskell/ui/internal/views/outline/HaskellOutlinePage.java
@@ -6,7 +6,6 @@
import net.sf.eclipsefp.haskell.ui.internal.editors.haskell.HaskellEditor;
import net.sf.eclipsefp.haskell.ui.internal.views.common.TreeElementCP;
import net.sf.eclipsefp.haskell.ui.internal.views.common.TreeElementLP;
-
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.viewers.ISelection;
@@ -81,7 +80,7 @@ public void selectionChanged( final SelectionChangedEvent event ) {
/** <p>sets the input of the outline page.</p> */
public void setInput( final Object input ) {
- // TODO replace by something not Cohatoe-based
+ // TODO TtC replace by something not Cohatoe-based
/*
if( input != null && input instanceof IFileEditorInput ) {
IFileEditorInput fei = ( IFileEditorInput )input;
Please sign in to comment.
Something went wrong with that request. Please try again.