blob: b31eb249e0734f290651a20332e83c142811d98b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
/*******************************************************************************
* Copyright (c) 2000, 2005 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* QNX Software Systems - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.ui;
import org.eclipse.cdt.core.model.CModelException;
import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.core.model.ITranslationUnit;
/**
* IncludesGrouping
*/
public class IncludesGrouping extends CElementGrouping {
ITranslationUnit tu;
public IncludesGrouping(ITranslationUnit unit) {
super(CElementGrouping.INCLUDES_GROUPING);
tu = unit;
}
/* (non-Javadoc)
* @see org.eclipse.ui.model.IWorkbenchAdapter#getChildren(java.lang.Object)
*/
public Object[] getChildren(Object object) {
try {
return tu.getChildrenOfType(ICElement.C_INCLUDE).toArray();
} catch (CModelException e) {
}
return super.getChildren(object);
}
/* (non-Javadoc)
* @see org.eclipse.ui.model.IWorkbenchAdapter#getParent(java.lang.Object)
*/
public Object getParent(Object object) {
return tu;
}
/* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object)
*/
public boolean equals(Object obj) {
if (obj instanceof IncludesGrouping) {
return tu.equals(((IncludesGrouping)obj).getParent(obj)) ;
}
return super.equals(obj);
}
}
|