Permalink
Browse files

Scott Michel patches to ensure Helios compatibility and remove deprec…

…ation warnings
  • Loading branch information...
1 parent 3f40d0d commit 117ce68d1556e076fb2d9c08674a4b14cbdb324e @JPMoresmau committed Aug 4, 2010
Showing with 351 additions and 302 deletions.
  1. +21 −1 net.sf.eclipsefp.haskell.core.test/src/net/sf/eclipsefp/haskell/core/project/util/MockFile.java
  2. +16 −7 ...f.eclipsefp.haskell.core.test/src/net/sf/eclipsefp/haskell/core/test/TestCaseWithPreferences.java
  3. +12 −1 net.sf.eclipsefp.haskell.core/src/net/sf/eclipsefp/haskell/core/HaskellCorePlugin.java
  4. +7 −6 ...eclipsefp.haskell.core/src/net/sf/eclipsefp/haskell/core/cabalmodel/PackageDescriptionStanza.java
  5. +78 −79 net.sf.eclipsefp.haskell.core/src/net/sf/eclipsefp/haskell/core/halamo/WSSaveParticipant.java
  6. +1 −1 net.sf.eclipsefp.haskell.core/src/net/sf/eclipsefp/haskell/core/internal/project/CabalBuilder.java
  7. +141 −141 ...NTERNAL/java/src/net/sf/eclipsefp/haskell/debug/ui/internal/launch/ExecutableLaunchOperation.java
  8. +1 −1 ...debug.ui/INTERNAL/java/src/net/sf/eclipsefp/haskell/debug/ui/internal/launch/LaunchOperation.java
  9. +2 −2 net.sf.eclipsefp.haskell.scion.client/build.properties
  10. +13 −13 net.sf.eclipsefp.haskell.scion.client/lib/org/json/JSONArray.java
  11. +30 −29 net.sf.eclipsefp.haskell.scion.client/lib/org/json/JSONObject.java
  12. +12 −8 ...efp.haskell.ui.test/src/net/sf/eclipsefp/haskell/ui/console/ConsoleCompilingReporter_PDETest.java
  13. +6 −0 ...i.test/src/net/sf/eclipsefp/haskell/ui/internal/preferences/HaskellPreferenceManager_PDETest.java
  14. +4 −3 net.sf.eclipsefp.haskell.ui/src/net/sf/eclipsefp/haskell/ui/HaskellUIPlugin.java
  15. +5 −8 net.sf.eclipsefp.haskell.ui/src/net/sf/eclipsefp/haskell/ui/internal/preferences/BuildConsolePP.java
  16. +1 −1 org.antlr/build.properties
  17. +1 −1 org.easymock/build.properties
@@ -7,18 +7,19 @@
import java.util.List;
import java.util.Map;
import java.util.Vector;
-
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFileState;
import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IPathVariableManager;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IProjectDescription;
import org.eclipse.core.resources.IResourceProxy;
import org.eclipse.core.resources.IResourceProxyVisitor;
import org.eclipse.core.resources.IResourceVisitor;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourceAttributes;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -460,4 +461,23 @@ public int findMaxProblemSeverity(final String type, final boolean includeSubtyp
return 0;
}
+ public IPathVariableManager getPathVariableManager() {
+ IPathVariableManager result = null;
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ if (workspace != null) {
+ result = workspace.getPathVariableManager();
+ }
+ return result;
+ }
+
+ public boolean isVirtual() {
+ // By default, do not assume that MockFile's are virtual resources
+ return false;
+ }
+
+ public void setDerived( final boolean isDerived, final IProgressMonitor monitor )
+ throws CoreException {
+ // unused.
+ }
+
}
@@ -8,6 +8,7 @@
import org.eclipse.core.runtime.preferences.ConfigurationScope;
import org.eclipse.core.runtime.preferences.DefaultScope;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.IPreferencesService;
import org.eclipse.core.runtime.preferences.IScopeContext;
import org.eclipse.core.runtime.preferences.InstanceScope;
@@ -48,13 +49,21 @@ public IEclipsePreferences getCorePrefs() {
@Override
protected void setUp() throws Exception {
super.setUp();
- fPrefsScope = new TestScope();
- // add TestScope to the preferences lookup order
- String[] lookupOrder = new String[] {
- TestScope.SCOPE, ProjectScope.SCOPE, InstanceScope.SCOPE, ConfigurationScope.SCOPE, DefaultScope.SCOPE
- };
- for (String qualifier : fQualifiers) {
- Platform.getPreferencesService().setDefaultLookupOrder( qualifier, null, lookupOrder );
+ IPreferencesService prefSvc = Platform.getPreferencesService();
+ if (prefSvc != null) {
+ fPrefsScope = new TestScope();
+ // add TestScope to the preferences lookup order
+ String[] lookupOrder = new String[] {
+ TestScope.SCOPE,
+ ProjectScope.SCOPE,
+ InstanceScope.SCOPE,
+ ConfigurationScope.SCOPE,
+ DefaultScope.SCOPE
+ };
+
+ for (String qualifier : fQualifiers) {
+ prefSvc.setDefaultLookupOrder( qualifier, null, lookupOrder );
+ }
}
}
@@ -18,6 +18,7 @@
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Plugin;
import org.eclipse.core.runtime.Status;
+import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
/**
@@ -90,7 +91,17 @@ public static HaskellCorePlugin getDefault() {
}
public static String getPluginId() {
- return getDefault().getBundle().getSymbolicName();
+ HaskellCorePlugin thePlugin = getDefault();
+
+ if (thePlugin != null) {
+ Bundle theBundle = thePlugin.getBundle();
+ if (theBundle != null) {
+ return theBundle.getSymbolicName();
+ }
+ }
+
+ // Otherwise...
+ return "net.sf.eclipsefp.haskell.core.test"; //$NON-NLS-1$
}
@@ -118,18 +118,19 @@ public ValuePosition update(final String field,final String value){
return vp;
}*/
- public RealValuePosition update(final CabalSyntax field,String value){
+ public RealValuePosition update(final CabalSyntax field,final String value){
+ String realValue = value;
if (value!=null && value.trim().length()==0){
- value=null;
+ realValue=null;
}
Map.Entry<String,String> eLast=null;
- if (value!=null){
+ if (realValue!=null){
if (needNL){
for (Map.Entry<String,String> e:getProperties().entrySet()){
eLast=e;
}
}
- getProperties().put(field.getCabalName().toLowerCase(),value);
+ getProperties().put(field.getCabalName().toLowerCase(),realValue);
} else {
getProperties().remove(field.getCabalName().toLowerCase());
}
@@ -164,14 +165,14 @@ public RealValuePosition update(final CabalSyntax field,String value){
subIndent=oldVP.getSubsequentIndent();
indent=oldVP.getInitialIndent();
}
- if (value==null){
+ if (realValue==null){
getPositions().remove( field.getCabalName().toLowerCase() );
// remove field name to
oldVP.setInitialIndent( getIndent() );
return new RealValuePosition( oldVP,""); //$NON-NLS-1$
}
- BufferedReader br=new BufferedReader( new StringReader( value ) );
+ BufferedReader br=new BufferedReader( new StringReader( realValue ) );
try {
String line=br.readLine();
@@ -1,80 +1,79 @@
-// Copyright (c) 2003-2005 by Leif Frenzel - see http://leiffrenzel.de
-package net.sf.eclipsefp.haskell.core.halamo;
-
-import net.sf.eclipsefp.haskell.core.HaskellCorePlugin;
-import org.eclipse.core.resources.IResourceChangeListener;
-import org.eclipse.core.resources.ISaveContext;
-import org.eclipse.core.resources.ISaveParticipant;
-import org.eclipse.core.resources.ISavedState;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-
-
-/** <p>This is Halamos task force responsible for handling the workspace save
- * mechanism. It manages also to register at the workspace for notification
- * at startup.</p>
- *
- * <p>lazy Singleton</p>
- *
- * @author Leif Frenzel
- */
-class WSSaveParticipant implements ISaveParticipant {
-
- /** the singleton instance of WSSaveParticipant. */
-// private static WSSaveParticipant _instance;
-
- /** private constructor in order to prevent instantiation from outside. */
- private WSSaveParticipant() {
- // we're firing up, so let the resource monitor first be notified about
- // any changes that appeared while we were down
- ISavedState lastState = getLastState();
- if( lastState != null ) {
- IResourceChangeListener monitor = new WorkspaceChangeMonitor();
- lastState.processResourceChangeEvents( monitor );
- }
- }
-
- /** <p>returns a reference to the singleton instance of
- * WSSaveParticipant.</p> */
- static void initialize() {
-// _instance = new WSSaveParticipant();
- }
-
-
- // interface methods of ISaveParticipant
- ////////////////////////////////////////
-
- public void doneSaving( final ISaveContext context ) {
- // unused
- }
-
- public void prepareToSave( final ISaveContext context ) {
- // unused
- }
-
- public void rollback( final ISaveContext context ) {
- // unused
- }
-
- public void saving( final ISaveContext context ) {
- // request a resource delta to be used on next startup
- context.needDelta();
- }
-
-
- // helping methods
- //////////////////
-
- private ISavedState getLastState() {
- ISavedState result = null;
- try {
- IWorkspace ws = ResourcesPlugin.getWorkspace();
- HaskellCorePlugin plugin = HaskellCorePlugin.getDefault();
- result = ws.addSaveParticipant( plugin, this );
- } catch( CoreException ex ) {
- HaskellCorePlugin.log( "Could not add save participant.", ex ); //$NON-NLS-1$
- }
- return result;
- }
+// Copyright (c) 2003-2005 by Leif Frenzel - see http://leiffrenzel.de
+package net.sf.eclipsefp.haskell.core.halamo;
+
+import net.sf.eclipsefp.haskell.core.HaskellCorePlugin;
+import org.eclipse.core.resources.IResourceChangeListener;
+import org.eclipse.core.resources.ISaveContext;
+import org.eclipse.core.resources.ISaveParticipant;
+import org.eclipse.core.resources.ISavedState;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+
+
+/** <p>This is Halamos task force responsible for handling the workspace save
+ * mechanism. It manages also to register at the workspace for notification
+ * at startup.</p>
+ *
+ * <p>lazy Singleton</p>
+ *
+ * @author Leif Frenzel
+ */
+class WSSaveParticipant implements ISaveParticipant {
+
+ /** the singleton instance of WSSaveParticipant. */
+// private static WSSaveParticipant _instance;
+
+ /** private constructor in order to prevent instantiation from outside. */
+ private WSSaveParticipant() {
+ // we're firing up, so let the resource monitor first be notified about
+ // any changes that appeared while we were down
+ ISavedState lastState = getLastState();
+ if( lastState != null ) {
+ IResourceChangeListener monitor = new WorkspaceChangeMonitor();
+ lastState.processResourceChangeEvents( monitor );
+ }
+ }
+
+ /** <p>returns a reference to the singleton instance of
+ * WSSaveParticipant.</p> */
+ static void initialize() {
+// _instance = new WSSaveParticipant();
+ }
+
+
+ // interface methods of ISaveParticipant
+ ////////////////////////////////////////
+
+ public void doneSaving( final ISaveContext context ) {
+ // unused
+ }
+
+ public void prepareToSave( final ISaveContext context ) {
+ // unused
+ }
+
+ public void rollback( final ISaveContext context ) {
+ // unused
+ }
+
+ public void saving( final ISaveContext context ) {
+ // request a resource delta to be used on next startup
+ context.needDelta();
+ }
+
+
+ // helping methods
+ //////////////////
+
+ private ISavedState getLastState() {
+ ISavedState result = null;
+ try {
+ IWorkspace ws = ResourcesPlugin.getWorkspace();
+ result = ws.addSaveParticipant( HaskellCorePlugin.getDefault(), this );
+ } catch( CoreException ex ) {
+ HaskellCorePlugin.log( "Could not add save participant.", ex ); //$NON-NLS-1$
+ }
+ return result;
+ }
}
@@ -41,7 +41,7 @@
// helping functions
////////////////////
- private void checkCabalFile() throws CoreException {
+ private void checkCabalFile() /* (doesn't) throws CoreException */ {
// TODO TtC replace by something not Cohatoe-based
/*
if( getCabalFile().exists() ) {
Oops, something went wrong.

0 comments on commit 117ce68

Please sign in to comment.