01: /*******************************************************************************
02: * Copyright (c) 2000, 2004 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.jdt.internal.ui.examples.jspeditor;
11:
12: import java.util.ArrayList;
13:
14: import org.eclipse.jface.text.source.translation.ITranslatorResultCollector;
15:
16: /**
17: * Collects the result for the JspTranslator.
18: *
19: * @since 3.0
20: */
21: public class JspTranslatorResultCollector implements
22: ITranslatorResultCollector {
23:
24: private StringBuffer fDeclarations = new StringBuffer();
25: private StringBuffer fContent = new StringBuffer();
26: private StringBuffer fLocalDeclarations = new StringBuffer();
27:
28: private ArrayList fContentLines = new ArrayList();
29: private ArrayList fDeclarationLines = new ArrayList();
30: private ArrayList fLocalDeclarationLines = new ArrayList();
31:
32: /**
33: * @param declarations
34: * @param localDeclarations
35: * @param content
36: * @param declarationLines
37: * @param localDeclarationLines
38: * @param contentLines
39: */
40: public JspTranslatorResultCollector(StringBuffer declarations,
41: StringBuffer localDeclarations, StringBuffer content,
42: ArrayList declarationLines,
43: ArrayList localDeclarationLines, ArrayList contentLines) {
44: fDeclarations = declarations;
45: fLocalDeclarations = localDeclarations;
46: fContent = content;
47: fDeclarationLines = declarationLines;
48: fLocalDeclarationLines = localDeclarationLines;
49: fContentLines = contentLines;
50: }
51:
52: // XXX: In the real world we would need to pass a list of line numbers
53: public void appendDeclaration(String string, int lineNumber) {
54: fDeclarations.append(string);
55: fDeclarationLines.add(new Integer(lineNumber));
56: }
57:
58: // XXX: In the real world we would need to pass a list of line numbers
59: public void appendLocalDeclaration(String string, int lineNumber) {
60: fLocalDeclarations.append(string);
61: fLocalDeclarationLines.add(new Integer(lineNumber));
62: }
63:
64: // XXX: In the real world we would need to pass a list of line numbers
65: public void appendContent(String string, int lineNumber) {
66: fContent.append(string);
67: fContentLines.add(new Integer(lineNumber));
68: }
69: }
|