View | Details | Raw Unified | Return to bug 54968
Collapse All | Expand All

(-)codeassist/org/eclipse/jdt/internal/codeassist/SelectionEngine.java (-12 / +23 lines)
Lines 367-373 Link Here
367
			int nextCharacterPosition = selectionStart;
367
			int nextCharacterPosition = selectionStart;
368
			char currentCharacter = ' ';
368
			char currentCharacter = ' ';
369
			try {
369
			try {
370
				while(currentPosition > 0){
370
				lineLoop: while(currentPosition > 0){
371
					
371
					
372
					if(source[currentPosition] == '\\' && source[currentPosition+1] == 'u') {
372
					if(source[currentPosition] == '\\' && source[currentPosition+1] == 'u') {
373
						int pos = currentPosition + 2;
373
						int pos = currentPosition + 2;
Lines 393-400 Link Here
393
						nextCharacterPosition = currentPosition+1;
393
						nextCharacterPosition = currentPosition+1;
394
					}
394
					}
395
					
395
					
396
					if(currentCharacter == '\r' || currentCharacter == '\n') {
396
					switch(currentCharacter) {
397
						break;
397
						case '\r':
398
						case '\n':
399
						case '/':
400
							break lineLoop;
398
					}
401
					}
399
					currentPosition--;
402
					currentPosition--;
400
				}
403
				}
Lines 410-423 Link Here
410
				} catch (InvalidInputException e) {
413
				} catch (InvalidInputException e) {
411
					return false;
414
					return false;
412
				}
415
				}
413
				if((token == TerminalTokens.TokenNamethis ||
416
				switch (token) {
414
					token == TerminalTokens.TokenNamesuper ||
417
					case TerminalTokens.TokenNamethis:
415
					token == TerminalTokens.TokenNameIdentifier) &&
418
					case TerminalTokens.TokenNamesuper:
416
					scanner.startPosition <= selectionStart &&
419
					case TerminalTokens.TokenNameIdentifier:
417
					selectionStart <= scanner.currentPosition) {
420
						if (scanner.startPosition <= selectionStart && selectionStart <= scanner.currentPosition) {
418
					lastIdentifierStart = scanner.startPosition;
421
							lastIdentifierStart = scanner.startPosition;
419
					lastIdentifierEnd = scanner.currentPosition - 1;
422
							lastIdentifierEnd = scanner.currentPosition - 1;
420
					lastIdentifier = scanner.getCurrentTokenSource();
423
							lastIdentifier = scanner.getCurrentTokenSource();
424
						}
425
						break;
421
				}
426
				}
422
			} while (token != TerminalTokens.TokenNameEOF);
427
			} while (token != TerminalTokens.TokenNameEOF);
423
		} else {
428
		} else {
Lines 642-649 Link Here
642
			System.out.println("SELECTION - Source :"); //$NON-NLS-1$
647
			System.out.println("SELECTION - Source :"); //$NON-NLS-1$
643
			System.out.println(source);
648
			System.out.println(source);
644
		}
649
		}
645
		if (!checkSelection(source, selectionSourceStart, selectionSourceEnd))
650
		if (!checkSelection(source, selectionSourceStart, selectionSourceEnd)) {
646
			return;
651
			return;
652
		}
653
		if (DEBUG) {
654
			System.out.print("SELECTION - Checked : \""); //$NON-NLS-1$
655
			System.out.print(new String(source, actualSelectionStart, actualSelectionEnd-actualSelectionStart+1));
656
			System.out.println('"');
657
		}
647
		try {
658
		try {
648
			this.acceptedAnswer = false;
659
			this.acceptedAnswer = false;
649
			CompilationResult result = new CompilationResult(sourceUnit, 1, 1, this.compilerOptions.maxProblemsPerUnit);
660
			CompilationResult result = new CompilationResult(sourceUnit, 1, 1, this.compilerOptions.maxProblemsPerUnit);
(-)codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionParser.java (+2 lines)
Lines 42-47 Link Here
42
	
42
	
43
public SelectionParser(ProblemReporter problemReporter) {
43
public SelectionParser(ProblemReporter problemReporter) {
44
	super(problemReporter);
44
	super(problemReporter);
45
	this.javadocParser = new SelectionJavadocParser(this);
46
	this.javadocParser.checkDocComment = true;
45
}
47
}
46
public char[] assistIdentifier(){
48
public char[] assistIdentifier(){
47
	return ((SelectionScanner)scanner).selectionIdentifier;
49
	return ((SelectionScanner)scanner).selectionIdentifier;
(-)compiler/org/eclipse/jdt/internal/compiler/ast/AbstractMethodDeclaration.java (+3 lines)
Lines 318-323 Link Here
318
318
319
	public StringBuffer print(int tab, StringBuffer output) {
319
	public StringBuffer print(int tab, StringBuffer output) {
320
320
321
		if (this.javadoc != null) {
322
			this.javadoc.print(tab, output);
323
		}
321
		printIndent(tab, output);
324
		printIndent(tab, output);
322
		printModifiers(this.modifiers, output);
325
		printModifiers(this.modifiers, output);
323
		if (this.annotations != null) printAnnotations(this.annotations, output);
326
		if (this.annotations != null) printAnnotations(this.annotations, output);
(-)compiler/org/eclipse/jdt/internal/compiler/ast/FieldDeclaration.java (-1 / +8 lines)
Lines 141-147 Link Here
141
			return this.binding.isStatic();
141
			return this.binding.isStatic();
142
		return (this.modifiers & AccStatic) != 0;
142
		return (this.modifiers & AccStatic) != 0;
143
	}
143
	}
144
	
144
145
	public StringBuffer printStatement(int indent, StringBuffer output) {
146
		if (this.javadoc != null) {
147
			this.javadoc.print(indent, output);
148
		}
149
		return super.printStatement(indent, output);
150
	}
151
145
	public void resolve(MethodScope initializationScope) {
152
	public void resolve(MethodScope initializationScope) {
146
153
147
		// the two <constant = Constant.NotAConstant> could be regrouped into
154
		// the two <constant = Constant.NotAConstant> could be regrouped into
(-)compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java (+3 lines)
Lines 848-853 Link Here
848
848
849
	public StringBuffer print(int indent, StringBuffer output) {
849
	public StringBuffer print(int indent, StringBuffer output) {
850
850
851
		if (this.javadoc != null) {
852
			this.javadoc.print(indent, output);
853
		}
851
		if ((this.bits & IsAnonymousTypeMASK) == 0) {
854
		if ((this.bits & IsAnonymousTypeMASK) == 0) {
852
			printIndent(indent, output);
855
			printIndent(indent, output);
853
			printHeader(0, output);
856
			printHeader(0, output);
(-)compiler/org/eclipse/jdt/internal/compiler/parser/AbstractCommentParser.java (-2 / +11 lines)
Lines 58-63 Link Here
58
	// Kind of comment parser
58
	// Kind of comment parser
59
	public final static int COMPIL_PARSER = 0x00000001;
59
	public final static int COMPIL_PARSER = 0x00000001;
60
	public final static int DOM_PARSER = 0x00000002;
60
	public final static int DOM_PARSER = 0x00000002;
61
	public final static int SELECTION_PARSER = 0x00000003;
61
	
62
	
62
	// Parse infos
63
	// Parse infos
63
	public Scanner scanner;
64
	public Scanner scanner;
Lines 83-89 Link Here
83
	protected int[] lineEnds;
84
	protected int[] lineEnds;
84
	
85
	
85
	// Flags
86
	// Flags
86
	protected boolean lineStarted = false, inlineTagStarted = false;
87
	protected boolean lineStarted = false;
88
	protected boolean inlineTagStarted = false;
89
	protected boolean abort = false;
87
	protected int kind;
90
	protected int kind;
88
	
91
	
89
	// Line pointers
92
	// Line pointers
Lines 95-100 Link Here
95
	protected int identifierLengthPtr;
98
	protected int identifierLengthPtr;
96
	protected int[] identifierLengthStack;
99
	protected int[] identifierLengthStack;
97
	protected long[] identifierPositionStack;
100
	protected long[] identifierPositionStack;
101
98
	// Ast stack
102
	// Ast stack
99
	protected static int AstStackIncrement = 10;
103
	protected static int AstStackIncrement = 10;
100
	protected int astPtr;
104
	protected int astPtr;
Lines 151-157 Link Here
151
			int invalidInlineTagLineEnd = -1;
155
			int invalidInlineTagLineEnd = -1;
152
			
156
			
153
			// Loop on each comment character
157
			// Loop on each comment character
154
			while (this.index < this.endComment) {
158
			while (!abort && this.index < this.endComment) {
155
				previousPosition = this.index;
159
				previousPosition = this.index;
156
				previousChar = nextCharacter;
160
				previousChar = nextCharacter;
157
				
161
				
Lines 394-399 Link Here
394
			Object typeRef;
398
			Object typeRef;
395
			try {
399
			try {
396
				typeRef = parseQualifiedName(false);
400
				typeRef = parseQualifiedName(false);
401
				if (this.abort) return null; // May be aborted by specialized parser
397
			} catch (InvalidInputException e) {
402
			} catch (InvalidInputException e) {
398
				break nextArg;
403
				break nextArg;
399
			}
404
			}
Lines 480-485 Link Here
480
			if (token == TerminalTokens.TokenNameCOMMA) {
485
			if (token == TerminalTokens.TokenNameCOMMA) {
481
				// Create new argument
486
				// Create new argument
482
				Object argument = createArgumentReference(name, dim, isVarargs, typeRef, dimPositions, argNamePos);
487
				Object argument = createArgumentReference(name, dim, isVarargs, typeRef, dimPositions, argNamePos);
488
				if (this.abort) return null; // May be aborted by specialized parser
483
				arguments.add(argument);
489
				arguments.add(argument);
484
				consumeToken();
490
				consumeToken();
485
				iToken++;
491
				iToken++;
Lines 493-498 Link Here
493
				}
499
				}
494
				// Create new argument
500
				// Create new argument
495
				Object argument = createArgumentReference(name, dim, isVarargs, typeRef, dimPositions, argNamePos);
501
				Object argument = createArgumentReference(name, dim, isVarargs, typeRef, dimPositions, argNamePos);
502
				if (this.abort) return null; // May be aborted by specialized parser
496
				arguments.add(argument);
503
				arguments.add(argument);
497
				consumeToken();
504
				consumeToken();
498
				return createMethodReference(receiver, arguments);
505
				return createMethodReference(receiver, arguments);
Lines 988-993 Link Here
988
						if (typeRef == null) {
995
						if (typeRef == null) {
989
							typeRefStartPosition = this.scanner.getCurrentTokenStartPosition();
996
							typeRefStartPosition = this.scanner.getCurrentTokenStartPosition();
990
							typeRef = parseQualifiedName(true);
997
							typeRef = parseQualifiedName(true);
998
							if (this.abort) return false; // May be aborted by specialized parser
991
							break;
999
							break;
992
						}
1000
						}
993
					default :
1001
					default :
Lines 1066-1071 Link Here
1066
		int start = this.scanner.currentPosition;
1074
		int start = this.scanner.currentPosition;
1067
		try {
1075
		try {
1068
			Object typeRef = parseQualifiedName(true);
1076
			Object typeRef = parseQualifiedName(true);
1077
			if (this.abort) return false; // May be aborted by specialized parser
1069
			if (typeRef == null) {
1078
			if (typeRef == null) {
1070
				if (this.reportProblems)
1079
				if (this.reportProblems)
1071
					this.sourceParser.problemReporter().javadocMissingThrowsClassName(this.tagSourceStart, this.tagSourceEnd, this.sourceParser.modifiers);
1080
					this.sourceParser.problemReporter().javadocMissingThrowsClassName(this.tagSourceStart, this.tagSourceEnd, this.sourceParser.modifiers);
(-)compiler/org/eclipse/jdt/internal/compiler/parser/JavadocParser.java (-1 / +1 lines)
Lines 250-256 Link Here
250
			}
250
			}
251
		}
251
		}
252
		catch (ClassCastException ex) {
252
		catch (ClassCastException ex) {
253
				throw new InvalidInputException();
253
			throw new InvalidInputException();
254
		}
254
		}
255
	}
255
	}
256
	/* (non-Javadoc)
256
	/* (non-Javadoc)
(-)codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionJavadoc.java (+144 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2005 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.jdt.internal.codeassist.select;
12
13
import org.eclipse.jdt.internal.compiler.ast.*;
14
import org.eclipse.jdt.internal.compiler.lookup.*;
15
16
/**
17
 * Node representing a Javadoc comment including code selection.
18
 */
19
public class SelectionJavadoc extends Javadoc {
20
21
	Expression selectedNode;
22
23
	public SelectionJavadoc(int sourceStart, int sourceEnd) {
24
		super(sourceStart, sourceEnd);
25
	}
26
27
	/* (non-Javadoc)
28
	 * @see org.eclipse.jdt.internal.compiler.ast.Javadoc#print(int, java.lang.StringBuffer)
29
	 */
30
	public StringBuffer print(int indent, StringBuffer output) {
31
		super.print(indent, output);
32
		if (this.selectedNode != null) {
33
			String selectedString = null;
34
			if (this.selectedNode instanceof JavadocFieldReference) {
35
				JavadocFieldReference fieldRef = (JavadocFieldReference) this.selectedNode;
36
				if (fieldRef.methodBinding != null) {
37
					selectedString = "<SelectOnMethod:"; //$NON-NLS-1$
38
				} else {
39
					selectedString = "<SelectOnField:"; //$NON-NLS-1$
40
				}
41
			} else if (this.selectedNode instanceof JavadocMessageSend) {
42
				selectedString = "<SelectOnMethod:"; //$NON-NLS-1$
43
			} else if (this.selectedNode instanceof JavadocAllocationExpression) {
44
				selectedString = "<SelectOnConstructor:"; //$NON-NLS-1$
45
			} else if (this.selectedNode instanceof JavadocSingleNameReference) {
46
				selectedString = "<SelectOnLocalVariable:"; //$NON-NLS-1$
47
			} else if (this.selectedNode instanceof JavadocSingleTypeReference) {
48
				JavadocSingleTypeReference typeRef = (JavadocSingleTypeReference) this.selectedNode;
49
				if (typeRef.packageBinding == null) {
50
					selectedString = "<SelectOnType:"; //$NON-NLS-1$
51
				}
52
			} else if (this.selectedNode instanceof JavadocQualifiedTypeReference) {
53
				JavadocQualifiedTypeReference typeRef = (JavadocQualifiedTypeReference) this.selectedNode;
54
				if (typeRef.packageBinding == null) {
55
					selectedString = "<SelectOnType:"; //$NON-NLS-1$
56
				}
57
			} else {
58
				selectedString = "<SelectOnType:"; //$NON-NLS-1$
59
			}
60
			int pos = output.length()-3;
61
			output.replace(pos-2,pos, selectedString+selectedNode+'>');
62
		}
63
		return output;
64
	}
65
66
	/**
67
	 * Resolve selected node if not null and throw exception to let clients know
68
	 * that it has been found.
69
	 * 
70
	 * @throws SelectionNodeFound
71
	 */
72
	public void resolve(ClassScope scope) {
73
		if (this.selectedNode != null) {
74
			this.selectedNode.resolveType(scope);
75
			Binding binding = null;
76
			if (this.selectedNode instanceof JavadocFieldReference) {
77
				JavadocFieldReference fieldRef = (JavadocFieldReference) this.selectedNode;
78
				binding = fieldRef.binding;
79
				if (binding == null && fieldRef.methodBinding != null) {
80
					binding = fieldRef.methodBinding;
81
				}
82
			} else if (this.selectedNode instanceof JavadocMessageSend) {
83
				binding = ((JavadocMessageSend) this.selectedNode).binding;
84
			} else if (this.selectedNode instanceof JavadocAllocationExpression) {
85
				binding = ((JavadocAllocationExpression) this.selectedNode).binding;
86
			} else if (this.selectedNode instanceof JavadocSingleNameReference) {
87
				binding = ((JavadocSingleNameReference) this.selectedNode).binding;
88
			} else if (this.selectedNode instanceof JavadocSingleTypeReference) {
89
				JavadocSingleTypeReference typeRef = (JavadocSingleTypeReference) this.selectedNode;
90
				if (typeRef.packageBinding == null) {
91
					binding = typeRef.resolvedType;
92
				}
93
			} else if (this.selectedNode instanceof JavadocQualifiedTypeReference) {
94
				JavadocQualifiedTypeReference typeRef = (JavadocQualifiedTypeReference) this.selectedNode;
95
				if (typeRef.packageBinding == null) {
96
					binding = typeRef.resolvedType;
97
				}
98
			} else {
99
				binding = this.selectedNode.resolvedType;
100
			}
101
			throw new SelectionNodeFound(binding);
102
		}
103
	}
104
105
	/**
106
	 * Resolve selected node if not null and throw exception to let clients know
107
	 * that it has been found.
108
	 * 
109
	 * @throws SelectionNodeFound
110
	 */
111
	public void resolve(MethodScope scope) {
112
		if (this.selectedNode != null) {
113
			this.selectedNode.resolveType(scope);
114
			Binding binding = null;
115
			if (this.selectedNode instanceof JavadocFieldReference) {
116
				JavadocFieldReference fieldRef = (JavadocFieldReference) this.selectedNode;
117
				binding = fieldRef.binding;
118
				if (binding == null && fieldRef.methodBinding != null) {
119
					binding = fieldRef.methodBinding;
120
				}
121
			} else if (this.selectedNode instanceof JavadocMessageSend) {
122
				binding = ((JavadocMessageSend) this.selectedNode).binding;
123
			} else if (this.selectedNode instanceof JavadocAllocationExpression) {
124
				binding = ((JavadocAllocationExpression) this.selectedNode).binding;
125
			} else if (this.selectedNode instanceof JavadocSingleNameReference) {
126
				binding = ((JavadocSingleNameReference) this.selectedNode).binding;
127
			} else if (this.selectedNode instanceof JavadocSingleTypeReference) {
128
				JavadocSingleTypeReference typeRef = (JavadocSingleTypeReference) this.selectedNode;
129
				if (typeRef.packageBinding == null) {
130
					binding = typeRef.resolvedType;
131
				}
132
			} else if (this.selectedNode instanceof JavadocQualifiedTypeReference) {
133
				JavadocQualifiedTypeReference typeRef = (JavadocQualifiedTypeReference) this.selectedNode;
134
				if (typeRef.packageBinding == null) {
135
					binding = typeRef.resolvedType;
136
				}
137
			} else {
138
				binding = this.selectedNode.resolvedType;
139
			}
140
			throw new SelectionNodeFound(binding);
141
		}
142
	}
143
144
}
(-)codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionJavadocParser.java (+185 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2005 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.jdt.internal.codeassist.select;
12
13
import java.util.List;
14
15
import org.eclipse.jdt.core.compiler.InvalidInputException;
16
import org.eclipse.jdt.internal.codeassist.SelectionEngine;
17
import org.eclipse.jdt.internal.compiler.ast.*;
18
import org.eclipse.jdt.internal.compiler.parser.JavadocParser;
19
20
/**
21
 * Parser specialized for decoding javadoc comments which includes code selection.
22
 */
23
public class SelectionJavadocParser extends JavadocParser {
24
	
25
	int selectionStart;
26
	int selectionEnd;
27
	ASTNode selectedNode;
28
29
	public SelectionJavadocParser(SelectionParser sourceParser) {
30
		super(sourceParser);
31
		this.kind = SELECTION_PARSER;
32
	}
33
34
	/*
35
	 * Do not parse comment if selection is not included.
36
	 */
37
	public boolean checkDeprecation(int javadocStart, int javadocEnd) {
38
		this.selectionStart = ((SelectionParser)sourceParser).selectionStart;
39
		this.selectionEnd = ((SelectionParser)sourceParser).selectionEnd;
40
		if (javadocStart <= this.selectionStart && this.selectionEnd <= javadocEnd) {
41
			if (SelectionEngine.DEBUG) {
42
				System.out.println("SELECTION in Javadoc:"); //$NON-NLS-1$
43
			}
44
			super.checkDeprecation(javadocStart, javadocEnd);
45
		} else {
46
			this.docComment = null;
47
		}
48
		return false;
49
	}
50
51
	/*
52
	 * Replace stored Javadoc node with specific selection one.
53
	 */
54
	protected boolean commentParse(int javadocStart, int javadocEnd) {
55
		this.docComment = new SelectionJavadoc(javadocStart, javadocEnd);
56
		return super.commentParse(javadocStart, javadocEnd);
57
	}
58
59
	/*
60
	 * Create argument expression and store it if it includes selection.
61
	 */
62
	protected Object createArgumentReference(char[] name, int dim, boolean isVarargs, Object typeRef, long[] dimPositions, long argNamePos) throws InvalidInputException {
63
		// Create argument as we may need it after
64
		Expression expression = (Expression) super.createArgumentReference(name, dim, isVarargs, typeRef, dimPositions, argNamePos);
65
		// See if selection is in argument
66
		int start = ((TypeReference)typeRef).sourceStart;
67
		int end = ((TypeReference)typeRef).sourceEnd;
68
		if (start <= this.selectionStart && this.selectionEnd <= end) {
69
			selectedNode = expression;
70
			this.abort = true;
71
			if (SelectionEngine.DEBUG) {
72
				System.out.println("	selected argument="+selectedNode); //$NON-NLS-1$
73
			}
74
		}
75
		return expression;
76
	}
77
78
	/*
79
	 * Verify if field identifier positions include selection.
80
	 * If so, create field reference, store it and abort comment parse.
81
	 * Otherwise return null as we do not need this reference.
82
	 */
83
	protected Object createFieldReference(Object receiver) throws InvalidInputException {
84
		int start = (int) (this.identifierPositionStack[0] >>> 32);
85
		int end = (int) this.identifierPositionStack[0];
86
		if (start <= this.selectionStart && this.selectionEnd <= end) {
87
			selectedNode = (ASTNode) super.createFieldReference(receiver);
88
			this.abort = true;
89
			if (SelectionEngine.DEBUG) {
90
				System.out.println("	selected field="+selectedNode); //$NON-NLS-1$
91
			}
92
		}
93
		return null;
94
	}
95
96
	/*
97
	 * Verify if method identifier positions include selection.
98
	 * If so, create field reference, store it and abort comment parse.
99
	 * Otherwise return null as we do not need this reference.
100
	 */
101
	protected Object createMethodReference(Object receiver, List arguments) throws InvalidInputException {
102
		int start = (int) (this.identifierPositionStack[0] >>> 32);
103
		int end = (int) this.identifierPositionStack[0];
104
		if (start <= this.selectionStart && this.selectionEnd <= end) {
105
			selectedNode = (ASTNode) super.createMethodReference(receiver, arguments);
106
			this.abort = true;
107
			if (SelectionEngine.DEBUG) {
108
				System.out.println("	selected method="+selectedNode); //$NON-NLS-1$
109
			}
110
		}
111
		return null;
112
	}
113
114
	/*
115
	 * Create type reference and verify if it includes selection.
116
	 * If so, store it and abort comment parse.
117
	 * Otherwise return null as we do not need this reference.
118
	 */
119
	protected Object createTypeReference(int primitiveToken) {
120
		// Need to create type ref in case it was needed by members
121
		TypeReference typeRef = (TypeReference) super.createTypeReference(primitiveToken);
122
	
123
		// See if node is concerned by selection
124
		if (typeRef.sourceStart <= this.selectionStart && this.selectionEnd <= typeRef.sourceEnd) {
125
			// See if selection is in one of tokens of qualification
126
			if (typeRef instanceof JavadocQualifiedTypeReference) {
127
				JavadocQualifiedTypeReference qualifiedTypeRef = (JavadocQualifiedTypeReference) typeRef;
128
				int size = qualifiedTypeRef.tokens.length - 1;
129
				for (int i=0; i<size; i++) {
130
					int start = (int) (qualifiedTypeRef.sourcePositions[i] >>> 32);
131
					int end = (int) qualifiedTypeRef.sourcePositions[i];
132
					if (start <= this.selectionStart && this.selectionEnd <= end) {
133
						int pos = i + 1;
134
						char[][] tokens = new char[pos][];
135
						System.arraycopy(this.identifierStack, this.identifierPtr+1, tokens, 0, pos);
136
						long[] positions = new long[pos];
137
						System.arraycopy(this.identifierPositionStack, this.identifierPtr + 1, positions, 0, pos);
138
						selectedNode = new JavadocQualifiedTypeReference(tokens, positions, this.tagSourceStart, this.tagSourceEnd);
139
						this.abort = true; // we got selected node => cancel parse
140
						if (SelectionEngine.DEBUG) {
141
							System.out.println("	selected partial qualified type="+selectedNode); //$NON-NLS-1$
142
						}
143
						return typeRef;
144
					}
145
				}
146
				// Selection is in last token => we'll store type ref as this
147
			}
148
			// Store type ref as selected node
149
			selectedNode = typeRef;
150
			this.abort = true; // we got selected node => cancel parse
151
			if (SelectionEngine.DEBUG) {
152
				System.out.println("	selected type="+selectedNode); //$NON-NLS-1$
153
			}
154
		}
155
		return typeRef;
156
	}
157
158
	/*
159
	 * Push param reference and verify if it includes selection.
160
	 * If so, store it and abort comment parse.
161
	 */
162
	protected boolean pushParamName(boolean isTypeParam) {
163
		if (super.pushParamName(isTypeParam)) {
164
			Expression expression = (Expression) astStack[astPtr--];
165
			// See if expression is concerned by selection
166
			if (expression.sourceStart <= this.selectionStart && this.selectionEnd <= expression.sourceEnd) {
167
				selectedNode = expression;
168
				this.abort = true; // we got selected node => cancel parse
169
				if (SelectionEngine.DEBUG) {
170
					System.out.println("	selected param="+selectedNode); //$NON-NLS-1$
171
				}
172
			}
173
		}
174
		return false;
175
	}
176
177
	/*
178
	 * Store selected node into doc comment.
179
	 */
180
	protected void updateDocComment() {
181
		if (selectedNode instanceof Expression) {
182
			((SelectionJavadoc) this.docComment).selectedNode = (Expression) selectedNode;
183
		}
184
	}
185
}

Return to bug 54968