|
Lines 1-5
Link Here
|
| 1 |
/******************************************************************************* |
1 |
/******************************************************************************* |
| 2 |
* Copyright (c) 2002, 2006 IBM Corporation and others. |
2 |
* Copyright (c) 2002, 2008 IBM Corporation and others. |
| 3 |
* All rights reserved. This program and the accompanying materials |
3 |
* All rights reserved. This program and the accompanying materials |
| 4 |
* are made available under the terms of the Eclipse Public License v1.0 |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
| 5 |
* which accompanies this distribution, and is available at |
5 |
* which accompanies this distribution, and is available at |
|
Lines 12-17
Link Here
|
| 12 |
*******************************************************************************/ |
12 |
*******************************************************************************/ |
| 13 |
package org.eclipse.wst.xml.core.internal.contentmodel.util; |
13 |
package org.eclipse.wst.xml.core.internal.contentmodel.util; |
| 14 |
|
14 |
|
|
|
15 |
import java.util.Stack; |
| 16 |
|
| 15 |
import org.eclipse.wst.xml.core.internal.contentmodel.CMAnyElement; |
17 |
import org.eclipse.wst.xml.core.internal.contentmodel.CMAnyElement; |
| 16 |
import org.eclipse.wst.xml.core.internal.contentmodel.CMContent; |
18 |
import org.eclipse.wst.xml.core.internal.contentmodel.CMContent; |
| 17 |
import org.eclipse.wst.xml.core.internal.contentmodel.CMDataType; |
19 |
import org.eclipse.wst.xml.core.internal.contentmodel.CMDataType; |
|
Lines 27-32
Link Here
|
| 27 |
protected StringBuffer sb; |
29 |
protected StringBuffer sb; |
| 28 |
protected CMNode root; |
30 |
protected CMNode root; |
| 29 |
protected boolean isRootVisited; |
31 |
protected boolean isRootVisited; |
|
|
32 |
protected Stack visitedCMGroupStack = new Stack(); |
| 30 |
|
33 |
|
| 31 |
public String buildDescription(CMNode node) |
34 |
public String buildDescription(CMNode node) |
| 32 |
{ |
35 |
{ |
|
Lines 59-64
Link Here
|
| 59 |
|
62 |
|
| 60 |
public void visitCMGroup(CMGroup group) |
63 |
public void visitCMGroup(CMGroup group) |
| 61 |
{ |
64 |
{ |
|
|
65 |
// This is to prevent recursion. |
| 66 |
if (visitedCMGroupStack.contains(group)) |
| 67 |
{ |
| 68 |
return; |
| 69 |
} |
| 62 |
int op = group.getOperator(); |
70 |
int op = group.getOperator(); |
| 63 |
if (op == CMGroup.ALL) |
71 |
if (op == CMGroup.ALL) |
| 64 |
{ |
72 |
{ |
|
Lines 73-79
Link Here
|
| 73 |
{ |
81 |
{ |
| 74 |
separator = " | "; //$NON-NLS-1$ |
82 |
separator = " | "; //$NON-NLS-1$ |
| 75 |
} |
83 |
} |
| 76 |
|
84 |
|
|
|
85 |
// Push the current group to check later to avoid potential recursion |
| 86 |
visitedCMGroupStack.push(group); |
| 87 |
|
| 77 |
CMNodeList nodeList = group.getChildNodes(); |
88 |
CMNodeList nodeList = group.getChildNodes(); |
| 78 |
int size = nodeList.getLength(); |
89 |
int size = nodeList.getLength(); |
| 79 |
for (int i = 0; i < size; i++) |
90 |
for (int i = 0; i < size; i++) |
|
Lines 84-89
Link Here
|
| 84 |
sb.append(separator); |
95 |
sb.append(separator); |
| 85 |
} |
96 |
} |
| 86 |
} |
97 |
} |
|
|
98 |
|
| 99 |
// Pop the current group |
| 100 |
visitedCMGroupStack.pop(); |
| 101 |
|
| 87 |
sb.append(")"); //$NON-NLS-1$ |
102 |
sb.append(")"); //$NON-NLS-1$ |
| 88 |
addOccurenceSymbol(group); |
103 |
addOccurenceSymbol(group); |
| 89 |
} |
104 |
} |