Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 328245 - No selection at all anymore using default implementation of DoubleClickStrategy
Summary: No selection at all anymore using default implementation of DoubleClickStrategy
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: IMP (show other bugs)
Version: unspecified   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Robert M. Fuhrer CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-20 09:57 EDT by Jurgen Vinju CLA
Modified: 2014-01-09 15:05 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jurgen Vinju CLA 2010-10-20 09:57:25 EDT
I have the following implementation of LanguageSyntaxProperties, but double clicking has no effect anymore on the selection in my editor. This is just after updating my checkout of IMP to a version that has the new DoubleClick feature.

package org.rascalmpl.eclipse.editor;

import org.eclipse.imp.parser.IParseController;
import org.eclipse.imp.services.ILanguageSyntaxProperties;
import org.eclipse.jface.text.IRegion;

public class RascalSyntaxProperties implements ILanguageSyntaxProperties {

	public String getBlockCommentContinuation() {
		return " * ";
	}

	public String getBlockCommentEnd() {
		return "*/";
	}

	public String getBlockCommentStart() {
		return "/*";
	}

	public String[][] getFences() {
		return new String[][] {
				new String[] { "(", ")" },
				new String[] { "{", "}" },
				new String[] { "<", ">" },
				new String[] { "[", "]" }
		};
	}

	public int[] getIdentifierComponents(String ident) {
		return new int[0];
	}

	public String getIdentifierConstituentChars() {
		return null;
	}

	public String getSingleLineCommentPrefix() {
		return "//";
	}

	public IRegion getDoubleClickRegion(int offset, IParseController pc) {
		return null;
	}

	public boolean isIdentifierPart(char ch) {
		return Character.isJavaIdentifierPart(ch);
	}

	public boolean isIdentifierStart(char ch) {
		return Character.isJavaIdentifierStart(ch);
	}

	public boolean isWhitespace(char ch) {
		return ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r';
	}
}
Comment 1 Robert M. Fuhrer CLA 2010-11-09 09:11:25 EST
If I'm not mistaken, you're also getting an NPE in DoubleClickStrategy, because null was not a valid return value for ILanguageSyntaxProperties.getDoubleClickRegion().

I've changed DoubleClickStrategy.findExtendedDoubleClickSelection() so that it does something more sensible when getDoubleClickRegion() returns null. The fix has been committed to SVN trunk, and will be part of the next release.

Please test and let me know whether this fixes your problem.
Comment 2 Jurgen Vinju CLA 2010-11-09 10:18:12 EST
It works for me! thanks.