From: axelcl Date: Fri, 12 Nov 2004 20:17:10 +0000 (+0000) Subject: misc X-Git-Url: http://git.phpeclipse.com misc --- diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/text/rules/MultiViewPartitioner.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/text/rules/MultiViewPartitioner.java index d04d657..ea7cdda 100644 --- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/text/rules/MultiViewPartitioner.java +++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/text/rules/MultiViewPartitioner.java @@ -8,7 +8,7 @@ * Contributors: * Igor Malinin - initial contribution * - * $Id: MultiViewPartitioner.java,v 1.5 2004-11-10 20:39:32 axelcl Exp $ + * $Id: MultiViewPartitioner.java,v 1.6 2004-11-12 20:15:58 axelcl Exp $ */ package net.sourceforge.phpeclipse.ui.text.rules; @@ -649,6 +649,7 @@ public abstract class MultiViewPartitioner extends AbstractPartitioner { return new TypedRegion(start, end - start, type); } catch (BadLocationException x) { + x.printStackTrace(); throw new IllegalArgumentException(); } } diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/text/rules/OuterDocumentView.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/text/rules/OuterDocumentView.java index 74abf96..d68b599 100644 --- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/text/rules/OuterDocumentView.java +++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/text/rules/OuterDocumentView.java @@ -8,7 +8,7 @@ * Contributors: * Igor Malinin - initial contribution * - * $Id: OuterDocumentView.java,v 1.3 2004-09-25 22:42:52 jsurfer Exp $ + * $Id: OuterDocumentView.java,v 1.4 2004-11-12 20:15:58 axelcl Exp $ */ package net.sourceforge.phpeclipse.ui.text.rules; @@ -269,9 +269,11 @@ public class OuterDocumentView extends AbstractDocument implements localOffset -= range.length; } // TODO jsurfer change start - check this -// if (localOffset<0) { -// return 0; -// } + if (localOffset<0) { + return 0; + } else if (localOffset>getLength()) { + return getLength(); + } // jsurfer change end return localOffset; } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/DeltaProcessor.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/DeltaProcessor.java index c68939a..31261a9 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/DeltaProcessor.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/DeltaProcessor.java @@ -1812,7 +1812,7 @@ public class DeltaProcessor implements IResourceChangeListener { IResource res = delta.getResource(); // find out the element type - RootInfo rootInfo = null; +// RootInfo rootInfo = null; int elementType; IProject proj = (IProject)res; boolean wasJavaProject = this.manager.getJavaModel().findJavaProject(proj) != null; @@ -1820,12 +1820,12 @@ public class DeltaProcessor implements IResourceChangeListener { if (!wasJavaProject && !isJavaProject) { elementType = NON_JAVA_RESOURCE; } else { - rootInfo = this.enclosingRootInfo(res.getFullPath(), delta.getKind()); - if (rootInfo != null && rootInfo.isRootOfProject(res.getFullPath())) { - elementType = IJavaElement.PACKAGE_FRAGMENT_ROOT; - } else { +// rootInfo = this.enclosingRootInfo(res.getFullPath(), delta.getKind()); +// if (rootInfo != null && rootInfo.isRootOfProject(res.getFullPath())) { +// elementType = IJavaElement.PACKAGE_FRAGMENT_ROOT; +// } else { elementType = IJavaElement.JAVA_PROJECT; - } +// } } // traverse delta diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/php/PHPDocumentPartitioner.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/php/PHPDocumentPartitioner.java index c408f3b..107fa08 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/php/PHPDocumentPartitioner.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/php/PHPDocumentPartitioner.java @@ -1,15 +1,15 @@ /********************************************************************** -Copyright (c) 2002 Widespace, OU and others. -All rights reserved. This program and the accompanying materials -are made available under the terms of the Common Public License v1.0 -which accompanies this distribution, and is available at -http://solareclipse.sourceforge.net/legal/cpl-v10.html + Copyright (c) 2002 Widespace, OU and others. + All rights reserved. This program and the accompanying materials + are made available under the terms of the Common Public License v1.0 + which accompanies this distribution, and is available at + http://solareclipse.sourceforge.net/legal/cpl-v10.html -Contributors: - Igor Malinin - initial contribution + Contributors: + Igor Malinin - initial contribution -$Id: PHPDocumentPartitioner.java,v 1.1 2004-09-02 18:32:34 jsurfer Exp $ -**********************************************************************/ + $Id: PHPDocumentPartitioner.java,v 1.2 2004-11-12 20:17:10 axelcl Exp $ + **********************************************************************/ package net.sourceforge.phpeclipse.phpeditor.php; import net.sourceforge.phpeclipse.PHPeclipsePlugin; @@ -22,72 +22,67 @@ import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.IDocumentPartitioner; import org.eclipse.jface.text.rules.IPartitionTokenScanner; - /** * * * @author Igor Malinin */ public class PHPDocumentPartitioner extends MultiViewPartitioner { - public static final String PHP_TEMPLATE_DATA = "__php_template_data"; - public static final String PHP_SCRIPT_CODE = "__php_script_code"; + public static final String PHP_TEMPLATE_DATA = "__php_template_data"; + + public static final String PHP_SCRIPT_CODE = "__php_script_code"; + + private IPartitionTokenScanner scriptScanner; - private IPartitionTokenScanner scriptScanner; + public PHPDocumentPartitioner(IPartitionTokenScanner scanner, IPartitionTokenScanner scriptScanner) { + super(scanner); - public PHPDocumentPartitioner( - IPartitionTokenScanner scanner, IPartitionTokenScanner scriptScanner - ) { - super(scanner); + this.scriptScanner = scriptScanner; + } - this.scriptScanner = scriptScanner; - } + protected FlatNode createNode(String type, int offset, int length) { + if (type.equals(PHPPartitionScanner.PHP_SCRIPTING_AREA)) { + if (DEBUG) { + Assert.isTrue(offset >= 0); + } + ViewNode node = new ViewNode(type); + node.offset = offset; + node.length = length; + return node; + } - protected FlatNode createNode(String type, int offset, int length) { - if (type.equals(PHPPartitionScanner.PHP_SCRIPTING_AREA) - ) { - if (DEBUG) { - Assert.isTrue(offset>=0); - } - ViewNode node = new ViewNode(type); - node.offset = offset; - node.length = length; - return node; - } + return super.createNode(type, offset, length); + } - return super.createNode(type, offset, length); - } + /* + * @see net.sf.solareclipse.text.rules.DocumentViewPartitioner#createPartitioner(String) + */ + protected IDocumentPartitioner createPartitioner(String contentType) { + if (contentType == null) { + // return JavaTextTools.createHTMLPartitioner(); + return PHPeclipsePlugin.getDefault().getJavaTextTools().getXMLTextTools().createXMLPartitioner(); + } - /* - * @see net.sf.solareclipse.text.rules.DocumentViewPartitioner#createPartitioner(String) - */ - protected IDocumentPartitioner createPartitioner(String contentType) { - if (contentType == null) { -// return JavaTextTools.createHTMLPartitioner(); - return PHPeclipsePlugin.getDefault().getJavaTextTools() - .getXMLTextTools().createXMLPartitioner(); - } - - if (contentType.equals(PHPPartitionScanner.PHP_SCRIPTING_AREA) - ) { - return PHPeclipsePlugin.getDefault().getJavaTextTools().createPHPPartitioner(); - } - return null; - } + if (contentType.equals(PHPPartitionScanner.PHP_SCRIPTING_AREA)) { + return PHPeclipsePlugin.getDefault().getJavaTextTools().createPHPPartitioner(); + } + return null; + } - /* - * @see net.sf.solareclipse.text.rules.DocumentViewPartitioner#getContentType(String, String) - */ - protected String getContentType(String parent, String view) { - if (parent == null) { - if (view == IDocument.DEFAULT_CONTENT_TYPE) { - return PHP_TEMPLATE_DATA; - } - } else { - if (view == IDocument.DEFAULT_CONTENT_TYPE) { - return PHP_SCRIPT_CODE; - } - } + /* + * @see net.sf.solareclipse.text.rules.DocumentViewPartitioner#getContentType(String, String) + */ + protected String getContentType(String parent, String view) { + if (parent == null) { + if (view == IDocument.DEFAULT_CONTENT_TYPE) { + return PHP_TEMPLATE_DATA; + } + } else { + if (view == IDocument.DEFAULT_CONTENT_TYPE) { + return PHP_SCRIPT_CODE; + } + } - return super.getContentType(parent, view); - } -} + return super.getContentType(parent, view); + } +} \ No newline at end of file