rpms/eclipse-pydev/devel eclipse-pydev-1.3.18-compileerrors.patch, NONE, 1.1 eclipse-pydev.spec, 1.10, 1.11

Andrew Overholt (overholt) fedora-extras-commits at redhat.com
Thu Aug 7 15:50:55 UTC 2008


Author: overholt

Update of /cvs/pkgs/rpms/eclipse-pydev/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv13856

Modified Files:
	eclipse-pydev.spec 
Added Files:
	eclipse-pydev-1.3.18-compileerrors.patch 
Log Message:
* Wed Jul 30 2008 Andrew Overholt <overholt at redhat.com> 1:1.3.18-1
- 1.3.18
- Update for building with Eclipse SDK 3.4
- Back-port patch from HEAD for building against Eclipse SDK 3.4

eclipse-pydev-1.3.18-compileerrors.patch:

--- NEW FILE eclipse-pydev-1.3.18-compileerrors.patch ---
diff -up ./plugins/org.python.pydev/src/org/python/copiedfromeclipsesrc/CopiedWorkbenchLabelProvider.java.compileerrors ./plugins/org.python.pydev/src/org/python/copiedfromeclipsesrc/CopiedWorkbenchLabelProvider.java
--- ./plugins/org.python.pydev/src/org/python/copiedfromeclipsesrc/CopiedWorkbenchLabelProvider.java.compileerrors	2008-07-30 12:50:12.000000000 -0400
+++ ./plugins/org.python.pydev/src/org/python/copiedfromeclipsesrc/CopiedWorkbenchLabelProvider.java	2008-07-30 12:50:16.000000000 -0400
@@ -1,245 +1,229 @@
-package org.python.copiedfromeclipsesrc;
-
-/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *     IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.DecoratingLabelProvider;
-import org.eclipse.jface.viewers.IColorProvider;
-import org.eclipse.jface.viewers.IFontProvider;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.LabelProviderChangedEvent;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.RGB;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.IEditorRegistry;
-import org.eclipse.ui.IPropertyListener;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.internal.util.SWTResourceUtil;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-import org.eclipse.ui.model.IWorkbenchAdapter2;
-
-/**
- * Provides basic labels for adaptable objects that have the
- * <code>IWorkbenchAdapter</code> adapter associated with them.  All dispensed
- * images are cached until the label provider is explicitly disposed.
- * This class provides a facility for subclasses to define annotations
- * on the labels and icons of adaptable objects.
- * 
- * NOTE: I JUST HATE WHEN THE SINGLE METHOD I WANT TO OVERRIDE IS DECLARED AS FINAL!!! (getText in this case)
- */
-public class CopiedWorkbenchLabelProvider extends LabelProvider implements
-        IColorProvider, IFontProvider {
-
-    /**
-     * Returns a workbench label provider that is hooked up to the decorator
-     * mechanism.
-     * 
-     * @return a new <code>DecoratingLabelProvider</code> which wraps a <code>
-     *   new <code>WorkbenchLabelProvider</code>
-     */
-    public static ILabelProvider getDecoratingWorkbenchLabelProvider() {
-        return new DecoratingLabelProvider(new CopiedWorkbenchLabelProvider(),
-                PlatformUI.getWorkbench().getDecoratorManager()
-                        .getLabelDecorator());
-    }
-    
-    /**
-     * Listener that tracks changes to the editor registry and does a full update
-     * when it changes, since many workbench adapters derive their icon from the file
-     * associations in the registry.
-     */
-    private IPropertyListener editorRegistryListener = new IPropertyListener() {
-        public void propertyChanged(Object source, int propId) {
-            if (propId == IEditorRegistry.PROP_CONTENTS) {
-                fireLabelProviderChanged(new LabelProviderChangedEvent(CopiedWorkbenchLabelProvider.this));
-            }
-        }
-    };
-
-    /**
-     * Creates a new workbench label provider.
-     */
-    public CopiedWorkbenchLabelProvider() {
-        PlatformUI.getWorkbench().getEditorRegistry().addPropertyListener(editorRegistryListener);
-    }
-
-    /**
-     * Returns an image descriptor that is based on the given descriptor,
-     * but decorated with additional information relating to the state
-     * of the provided object.
-     *
-     * Subclasses may reimplement this method to decorate an object's
-     * image.
-     * 
-     * @param input The base image to decorate.
-     * @param element The element used to look up decorations.
-     * @return the resuling ImageDescriptor.
-     * @see org.eclipse.jface.resource.CompositeImageDescriptor
-     */
-    protected ImageDescriptor decorateImage(ImageDescriptor input,
-            Object element) {
-        return input;
-    }
-
-    /**
-     * Returns a label that is based on the given label,
-     * but decorated with additional information relating to the state
-     * of the provided object.
-     *
-     * Subclasses may implement this method to decorate an object's
-     * label.
-     * @param input The base text to decorate.
-     * @param element The element used to look up decorations.
-     * @return the resulting text
-     */
-    protected String decorateText(String input, Object element) {
-        return input;
-    }
-
-    /* (non-Javadoc)
-     * Method declared on ILabelProvider
-     */
-    public void dispose() {
-        PlatformUI.getWorkbench().getEditorRegistry().removePropertyListener(editorRegistryListener);
-        super.dispose();
-    }
-    
-    /**
-     * Returns the implementation of IWorkbenchAdapter for the given
-     * object.  
-     * @param o the object to look up.
-     * @return IWorkbenchAdapter or<code>null</code> if the adapter is not defined or the
-     * object is not adaptable. 
-     */
-    protected final IWorkbenchAdapter getAdapter(Object o) {
-        if (!(o instanceof IAdaptable)) {
-            return null;
-        }
-        return (IWorkbenchAdapter) ((IAdaptable) o)
-                .getAdapter(IWorkbenchAdapter.class);
-    }
-
-    /**
-     * Returns the implementation of IWorkbenchAdapter2 for the given
-     * object.  
-     * @param o the object to look up.
-     * @return IWorkbenchAdapter2 or<code>null</code> if the adapter is not defined or the
-     * object is not adaptable. 
-     */
-    protected final IWorkbenchAdapter2 getAdapter2(Object o) {
-        if (!(o instanceof IAdaptable)) {
-            return null;
-        }
-        return (IWorkbenchAdapter2) ((IAdaptable) o)
-                .getAdapter(IWorkbenchAdapter2.class);
-    }
-
-    /* (non-Javadoc)
-     * Method declared on ILabelProvider
-     */
-    public Image getImage(Object element) {
-        //obtain the base image by querying the element
-        IWorkbenchAdapter adapter = getAdapter(element);
-        if (adapter == null) {
-            return null;
-        }
-        ImageDescriptor descriptor = adapter.getImageDescriptor(element);
-        if (descriptor == null) {
-            return null;
-        }
-
-        //add any annotations to the image descriptor
-        descriptor = decorateImage(descriptor, element);
-
-        Image image = (Image) SWTResourceUtil.getImageTable().get(descriptor);
-        if (image == null) {
-            image = descriptor.createImage();
-            SWTResourceUtil.getImageTable().put(descriptor, image);
-        }
-        return image;
-    }
-
-    /* (non-Javadoc)
-     * Method declared on ILabelProvider
-     */
-    public String getText(Object element) {
-        //query the element for its label
-        IWorkbenchAdapter adapter = getAdapter(element);
-        if (adapter == null) {
-            return ""; //$NON-NLS-1$
-        }
-        String label = adapter.getLabel(element);
-
-        //return the decorated label
-        return decorateText(label, element);
-    }
-
-    /* (non-Javadoc)
-     * @see org.eclipse.jface.viewers.IColorProvider#getForeground(java.lang.Object)
-     */
-    public Color getForeground(Object element) {
-        return getColor(element, true);
[...2489 lines suppressed...]
+        }finally{
+            try {
+                errorDescription = errDesc;
+                fireParseErrorChanged(errorDescription);
+            } catch (Exception e) {
+                PydevPlugin.log(e);
+            }
+        }
+    }
+
+    public static ErrorDescription createErrorDesc(Throwable error, IDocument doc) throws BadLocationException {
+        int errorStart = -1;
+        int errorEnd = -1;
+        int errorLine = -1;
+        String message = null;
+        if (error instanceof ParseException) {
+            ParseException parseErr = (ParseException) error;
+            
+            // Figure out where the error is in the document, and create a
+            // marker for it
+            if(parseErr.currentToken == null){
+            	IRegion endLine = doc.getLineInformationOfOffset(doc.getLength());
+            	errorStart = endLine.getOffset();
+            	errorEnd = endLine.getOffset() + endLine.getLength();
+
+            }else{
+            	Token errorToken = parseErr.currentToken.next != null ? parseErr.currentToken.next : parseErr.currentToken;
+                IRegion startLine = doc.getLineInformation(errorToken.beginLine - 1);
+                IRegion endLine;
+                if (errorToken.endLine == 0){
+                    endLine = startLine;
+                }else{
+                    endLine = doc.getLineInformation(errorToken.endLine - 1);
+                }
+                errorStart = startLine.getOffset() + errorToken.beginColumn - 1;
+                errorEnd = endLine.getOffset() + errorToken.endColumn;
+            }
+            message = parseErr.getMessage();
+
+        } else if(error instanceof TokenMgrError){
+            TokenMgrError tokenErr = (TokenMgrError) error;
+            IRegion startLine = doc.getLineInformation(tokenErr.errorLine - 1);
+            errorStart = startLine.getOffset();
+            errorEnd = startLine.getOffset() + tokenErr.errorColumn;
+            message = tokenErr.getMessage();
+        } else{
+            PydevPlugin.log("Error, expecting ParseException or TokenMgrError. Received: "+error);
+            return new ErrorDescription(null, 0, 0, 0);
+        }
+        errorLine = doc.getLineOfOffset(errorStart); 
+
+        // map.put(IMarker.LOCATION, "Whassup?"); this is the location field
+        // in task manager
+        if (message != null) { // prettyprint
+            message = message.replaceAll("\\r\\n", " ");
+            message = message.replaceAll("\\r", " ");
+            message = message.replaceAll("\\n", " ");
+        }
+        
+        
+        return new ErrorDescription(message, errorLine, errorStart, errorEnd);
+    }
+
+
+    /** stock listener implementation */
+    public void addModelListener(IModelListener listener) {
+        Assert.isNotNull(listener);
+        if (!modelListeners.contains(listener)){
+            modelListeners.add(listener);
+        }
+    }
+
+    /** stock listener implementation */
+    public void removeModelListener(IModelListener listener) {
+        Assert.isNotNull(listener);
+        modelListeners.remove(listener);
+    }
+
+    /**
+     * stock listener implementation event is fired whenever we get a new root
+     */
+    protected void fireModelChanged(SimpleNode root) {
+    	//create a copy, to avoid concurrent modifications
+        for (IModelListener listener : new ArrayList<IModelListener>(modelListeners)) {
+        	listener.modelChanged(root);
+		}
+    }
+    
+
+    /**
+     * @return the last ast generated in this editor (even if we had some other error after that)
+     */
+    public SimpleNode getAST() {
+        return ast;
+    }
+    
+    /**
+     * @return the last error description found (may be null)
+     */
+    public ErrorDescription getErrorDescription(){
+        return errorDescription;
+    }
+
+
+    /**
+     * stock listener implementation event is fired whenever the errors change in the editor
+     */
+    private void fireParseErrorChanged(ErrorDescription errorDesc) {
+        for (IModelListener listener : new ArrayList<IModelListener>(modelListeners)) {
+            listener.errorChanged(errorDesc);
+        }
+    }
+
+    /**
+     * @return the python nature associated with this editor.
+     */
+    public IPythonNature getPythonNature() {
+        IProject project = getProject();
+        if(project == null || !project.isOpen()){
+            return null;
+        }
+        IPythonNature pythonNature = PythonNature.getPythonNature(project);
+        if(pythonNature == null){
+            Tuple<SystemPythonNature, String> infoForFile = PydevPlugin.getInfoForFile(getEditorFile());
+            if(infoForFile == null){
+                NotConfiguredInterpreterException e = new NotConfiguredInterpreterException();
+                ErrorDialog.openError(PyAction.getShell(), 
+                        "Error: no interpreter configured", "Interpreter not configured\n(Please, Configure it under window->preferences->PyDev)", 
+                        PydevPlugin.makeStatus(IStatus.ERROR, e.getMessage(), e));
+                throw e;
+                
+            }
+            pythonNature = infoForFile.o1;
+        }
+        return pythonNature;
+    }
+
+    protected void initializeEditor() {
+        super.initializeEditor();
+        try{
+	        IPreferenceStore prefStore = PydevPlugin.getChainedPrefStore();
+	        this.setPreferenceStore(prefStore);
+	        setEditorContextMenuId(PY_EDIT_CONTEXT);
+        }catch (Throwable e) {
+			PydevPlugin.log(e);
+		}
+    }
+
+    
+    //------------------------------------------------------------------- START: actions that are activated after Ctrl+2
+    OfflineActionsManager offlineActionsManager = new OfflineActionsManager();
+    
+    public Collection<ActionInfo> getOfflineActionDescriptions(){
+        return offlineActionsManager.getOfflineActionDescriptions();
+    }
+    public void addOfflineActionListener(String key, IAction action) {
+        offlineActionsManager.addOfflineActionListener(key, action);
+    }
+    public void addOfflineActionListener(String key, IAction action, String description, boolean needsEnter) {
+        offlineActionsManager.addOfflineActionListener(key, action, description, needsEnter);
+	}
+    public boolean activatesAutomaticallyOn(String key){
+        return offlineActionsManager.activatesAutomaticallyOn(key);
+    }
+    /**
+     * @return if an action was binded and was successfully executed
+     */
+	public boolean onOfflineAction(String requestedStr, OfflineActionTarget target) {
+	    return offlineActionsManager.onOfflineAction(requestedStr, target);
+	}
+    
+	private LocalResourceManager resourceManager;
+	
+	public LocalResourceManager getResourceManager() {
+		if(resourceManager == null){
+			resourceManager = new LocalResourceManager(JFaceResources.getResources());
+		}
+		return resourceManager;
+	}
+	
+	/**
+     * Used in the script pyedit_list_bindings.py
+     */
+	public Font getFont(FontData descriptor) {
+		Font font = getResourceManager().createFont(FontDescriptor.createFrom(descriptor));
+		
+//		Old implementation (for Eclipse 3.3)
+//        Font font = (Font) SWTResourceUtil.getFontTable().get(descriptor);
+//        if (font == null) {
+//            font = new Font(Display.getCurrent(), descriptor);
+//            SWTResourceUtil.getFontTable().put(descriptor, font);
+//        }
+        return font;
+    }
+	//--------------------------------------------------------------------- END: actions that are activated after Ctrl+2
+
+
+
+}
+


Index: eclipse-pydev.spec
===================================================================
RCS file: /cvs/pkgs/rpms/eclipse-pydev/devel/eclipse-pydev.spec,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- eclipse-pydev.spec	17 Jul 2008 19:05:07 -0000	1.10
+++ eclipse-pydev.spec	7 Aug 2008 15:50:25 -0000	1.11
@@ -1,26 +1,24 @@
 Epoch: 1
 
+%define eclipse_base        %{_libdir}/eclipse
 %define gcj_support         1
 
-# All arches line up except i386 -> x86
-%ifarch %{ix86}
-%define eclipse_arch    x86
-%else
-%define eclipse_arch   %{_arch}
-%endif
-
 Summary:          Eclipse Python development plug-in
 Name:             eclipse-pydev
-Version:          1.3.14
-Release:          2%{?dist}
+Version:          1.3.18
+Release:          1%{?dist}
 License:          EPL
 URL:              http://pydev.sourceforge.net/
 Group:            Development/Tools
 
-Source0:          http://downloads.sourceforge.net/pydev/org.python.pydev.feature-src-1_3_14.zip
+Source0:          http://downloads.sourceforge.net/pydev/org.python.pydev.feature-src-1_3_18.zip
 Source1:          org.python.pydev.mylyn.feature-fetched-src-pydev_1_3_7.tar.bz2
 Source2:          fetch-pydev-mylyn.sh
 
+# Back-port from HEAD
+# http://pydev.cvs.sourceforge.net/pydev/org.python.pydev/src/org/python/copiedfromeclipsesrc/CopiedWorkbenchLabelProvider.java?revision=1.3&view=markup
+Patch0:           %{name}-%{version}-compileerrors.patch
+
 %if %{gcj_support}
 BuildRequires:    gcc-java >= 4.1.2
 BuildRequires:    java-1.5.0-gcj-devel >= 1.5.0
@@ -59,6 +57,7 @@
 
 %prep
 %setup -q -c 
+%patch0
 
 tar jxf %{SOURCE1}
 
@@ -108,66 +107,37 @@
 rm -f plugins/org.python.pydev.refactoring/contrib/ch/hsr/ukistler/astgraph/jgraph.jar
 
 %build
-# Copy the SDK for build
-/bin/sh -x %{_datadir}/eclipse/buildscripts/copy-platform SDK %{_datadir}/eclipse mylyn
-SDK=$(cd SDK > /dev/null && pwd)
-
-# Eclipse may try to write to the home directory.
-mkdir home
-homedir=$(cd home > /dev/null && pwd)
-
-# build the main pydev feature
-java -cp $SDK/startup.jar                              \
-     -Dosgi.sharedConfiguration.area=%{_libdir}/eclipse/configuration  \
-     org.eclipse.core.launcher.Main                    \
-     -application org.eclipse.ant.core.antRunner       \
-     -Dtype=feature                                    \
-     -Did=org.python.pydev.feature                     \
-     -DbaseLocation=$SDK                               \
-     -DsourceDirectory=$(pwd)                          \
-     -DjavacSource=1.5  -DjavacTarget=1.5              \
-     -DbuildDirectory=$(pwd)/build                     \
-     -Dbuilder=%{_datadir}/eclipse/plugins/org.eclipse.pde.build/templates/package-build \
-     -f %{_datadir}/eclipse/plugins/org.eclipse.pde.build/scripts/build.xml \
-     -vmargs -Duser.home=$homedir
+%{eclipse_base}/buildscripts/pdebuild \
+  -a "-DjavacSource=1.5  -DjavacTarget=1.5" \
+  -f org.python.pydev.feature
 
 # no xmlrpc3 -> no mylyn on ppc64 due to:
 # https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=239123
 %ifnarch ppc64
-# build the pydev mylyn feature
-java -cp $SDK/startup.jar                              \
-     -Dosgi.sharedConfiguration.area=%{_libdir}/eclipse/configuration  \
-     org.eclipse.core.launcher.Main                    \
-     -application org.eclipse.ant.core.antRunner       \
-     -Dtype=feature                                    \
-     -Did=org.python.pydev.mylyn.feature               \
-     -DbaseLocation=$SDK                               \
-     -DsourceDirectory=$(pwd)                          \
-     -DjavacSource=1.5  -DjavacTarget=1.5              \
-     -DbuildDirectory=$(pwd)/build                     \
-     -Dbuilder=%{_datadir}/eclipse/plugins/org.eclipse.pde.build/templates/package-build \
-     -f %{_datadir}/eclipse/plugins/org.eclipse.pde.build/scripts/build.xml \
-     -vmargs -Duser.home=$homedir
+%{eclipse_base}/buildscripts/pdebuild \
+  -a "-DjavacSource=1.5  -DjavacTarget=1.5" \
+  -d mylyn \
+  -f org.python.pydev.mylyn.feature
 %endif
 
 %install
 rm -rf $RPM_BUILD_ROOT
-install -d -m755 ${RPM_BUILD_ROOT}/%{_datadir}/eclipse
+installDir=${RPM_BUILD_ROOT}/%{_datadir}/eclipse/dropins/pydev
+install -d -m755 $installDir
+install -d -m755 ${installDir}-mylyn
 
 # pydev main feature
-unzip -q -d $RPM_BUILD_ROOT%{_datadir}/eclipse/.. \
-            build/rpmBuild/org.python.pydev.feature.zip
+unzip -q -d $installDir build/rpmBuild/org.python.pydev.feature.zip
 
 # no xmlrpc3 -> no mylyn on ppc64 due to:
 # https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=239123
 %ifnarch ppc64
 # pydev mylyn feature
-unzip -q -d $RPM_BUILD_ROOT%{_datadir}/eclipse/.. \
-            build/rpmBuild/org.python.pydev.mylyn.feature.zip
+unzip -q -d ${installDir}-mylyn build/rpmBuild/org.python.pydev.mylyn.feature.zip
 %endif
 
 # deal with linked deps
-pushd $RPM_BUILD_ROOT%{_datadir}/eclipse/plugins
+pushd $installDir/eclipse/plugins
 rm -rf org.python.pydev.core_%{version}/commons-codec.jar
 ln -sf %{_datadir}/java/jakarta-commons-codec.jar \
        org.python.pydev.core_%{version}/commons-codec.jar
@@ -196,20 +166,11 @@
 
 %files
 %defattr(-,root,root,-)
-%{_datadir}/eclipse/features/org.python.pydev*
-%{_datadir}/eclipse/plugins/org.python.pydev_*
-%{_datadir}/eclipse/plugins/org.python.pydev.ast*
-%{_datadir}/eclipse/plugins/org.python.pydev.core*
-%{_datadir}/eclipse/plugins/org.python.pydev.debug*
-%{_datadir}/eclipse/plugins/org.python.pydev.help*
-%{_datadir}/eclipse/plugins/org.python.pydev.parser*
-%{_datadir}/eclipse/plugins/org.python.pydev.templates*
-%{_datadir}/eclipse/plugins/org.python.pydev.jython*
-%{_datadir}/eclipse/plugins/org.python.pydev.refactoring*
+%{_datadir}/eclipse/dropins/pydev
 # no xmlrpc3 -> no mylyn on ppc64 due to:
 # https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=239123
 %ifnarch ppc64
-%{_datadir}/eclipse/plugins/org.python.pydev.mylyn*
+%{_datadir}/eclipse/dropins/pydev-mylyn
 %endif 
 
 %if %{gcj_support}
@@ -217,6 +178,11 @@
 %endif
 
 %changelog
+* Wed Jul 30 2008 Andrew Overholt <overholt at redhat.com> 1:1.3.18-1
+- 1.3.18
+- Update for building with Eclipse SDK 3.4
+- Back-port patch from HEAD for building against Eclipse SDK 3.4
+
 * Thu Jul 17 2008 Tom "spot" Callaway <tcallawa at redhat.com> 1:1.3.14-2
 - fix license tag
 




More information about the fedora-extras-commits mailing list