mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-05 07:15:39 +02:00
Cosmetics.
This commit is contained in:
parent
7e77be0d90
commit
6052044cdc
6 changed files with 150 additions and 180 deletions
|
@ -6,8 +6,8 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Andrew Niefer (IBM) - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
* Andrew Niefer (IBM) - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast.cpp;
|
||||
|
||||
|
@ -26,10 +26,10 @@ import org.eclipse.cdt.core.dom.ast.IType;
|
|||
* @noimplement This interface is not intended to be implemented by clients.
|
||||
*/
|
||||
public interface ICPPClassTemplatePartialSpecialization extends ICPPClassTemplate {
|
||||
public static final ICPPClassTemplatePartialSpecialization[] EMPTY_PARTIAL_SPECIALIZATION_ARRAY = new ICPPClassTemplatePartialSpecialization[0];
|
||||
public static final ICPPClassTemplatePartialSpecialization[] EMPTY_PARTIAL_SPECIALIZATION_ARRAY = {};
|
||||
|
||||
/**
|
||||
* get the ICPPTemplateDefinition which this is a specialization of
|
||||
* Returns the ICPPTemplateDefinition which this is a specialization of
|
||||
*/
|
||||
public ICPPClassTemplate getPrimaryClassTemplate();
|
||||
|
||||
|
|
|
@ -154,7 +154,7 @@ public class PDOMCPPClassTemplate extends PDOMCPPClassType
|
|||
int prop= getProperty(newPar);
|
||||
for (int j = 0; j < props.length; j++) {
|
||||
if (props[j] == prop) {
|
||||
// reuse param
|
||||
// Reuse param
|
||||
result[i]= j;
|
||||
props[j]= -1;
|
||||
allParams[j].update(linkage, newPar);
|
||||
|
@ -226,7 +226,7 @@ public class PDOMCPPClassTemplate extends PDOMCPPClassType
|
|||
return partials.toArray(new ICPPClassTemplatePartialSpecialization[partials.size()]);
|
||||
} catch (CoreException e) {
|
||||
CCorePlugin.log(e);
|
||||
return new ICPPClassTemplatePartialSpecialization[0];
|
||||
return ICPPClassTemplatePartialSpecialization.EMPTY_PARTIAL_SPECIALIZATION_ARRAY;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -243,11 +243,11 @@ public class PDOMCPPClassTemplate extends PDOMCPPClassType
|
|||
}
|
||||
}
|
||||
|
||||
// need a class template
|
||||
// Need a class template.
|
||||
if (type instanceof ICPPClassTemplate == false || type instanceof ProblemBinding)
|
||||
return false;
|
||||
|
||||
// exclude other kinds of class templates
|
||||
// Exclude other kinds of class templates.
|
||||
if (type instanceof ICPPClassTemplatePartialSpecialization ||
|
||||
type instanceof ICPPTemplateTemplateParameter ||
|
||||
type instanceof ICPPClassSpecialization) {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Markus Schorn - initial API and implementation
|
||||
* Markus Schorn - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.ui.tests.typehierarchy;
|
||||
|
||||
|
@ -18,7 +18,6 @@ import org.eclipse.swt.widgets.TreeItem;
|
|||
|
||||
import org.eclipse.cdt.internal.ui.editor.CEditor;
|
||||
|
||||
|
||||
public class CppTypeHierarchyTest extends TypeHierarchyBaseTest {
|
||||
|
||||
public CppTypeHierarchyTest(String name) {
|
||||
|
@ -76,7 +75,6 @@ public class CppTypeHierarchyTest extends TypeHierarchyBaseTest {
|
|||
assertEquals(0, item4.getItemCount());
|
||||
checkMethodTable(new String[] {"field1 : int", "method1() : int"});
|
||||
|
||||
|
||||
editor.selectAndReveal(content.indexOf("Simple2"), 1);
|
||||
openTypeHierarchy(editor);
|
||||
tree= getHierarchyViewer().getTree();
|
||||
|
@ -92,7 +90,6 @@ public class CppTypeHierarchyTest extends TypeHierarchyBaseTest {
|
|||
assertEquals(0, item3.getItemCount());
|
||||
checkMethodTable(new String[] {"field2 : int", "method2() : int"});
|
||||
|
||||
|
||||
editor.selectAndReveal(content.indexOf("Simple3"), 1);
|
||||
openTypeHierarchy(editor);
|
||||
tree= getHierarchyViewer().getTree();
|
||||
|
@ -108,7 +105,6 @@ public class CppTypeHierarchyTest extends TypeHierarchyBaseTest {
|
|||
assertEquals(0, item3.getItemCount());
|
||||
checkMethodTable(new String[] {"field3 : int", "method3() : int"});
|
||||
|
||||
|
||||
editor.selectAndReveal(content.indexOf("Simple4"), 1);
|
||||
openTypeHierarchy(editor);
|
||||
tree= getHierarchyViewer().getTree();
|
||||
|
@ -169,7 +165,6 @@ public class CppTypeHierarchyTest extends TypeHierarchyBaseTest {
|
|||
assertEquals(0, item4.getItemCount());
|
||||
checkMethodTable(new String[] {"field1 : int", "method1() : int"});
|
||||
|
||||
|
||||
editor.selectAndReveal(content.indexOf("method2"), 1);
|
||||
openTypeHierarchy(editor);
|
||||
tree= getHierarchyViewer().getTree();
|
||||
|
@ -185,7 +180,6 @@ public class CppTypeHierarchyTest extends TypeHierarchyBaseTest {
|
|||
assertEquals(0, item3.getItemCount());
|
||||
checkMethodTable(new String[] {"field2 : int", "method2() : int"});
|
||||
|
||||
|
||||
editor.selectAndReveal(content.indexOf("field3"), 1);
|
||||
openTypeHierarchy(editor);
|
||||
tree= getHierarchyViewer().getTree();
|
||||
|
@ -201,7 +195,6 @@ public class CppTypeHierarchyTest extends TypeHierarchyBaseTest {
|
|||
assertEquals(0, item3.getItemCount());
|
||||
checkMethodTable(new String[] {"field3 : int", "method3() : int"});
|
||||
|
||||
|
||||
editor.selectAndReveal(content.indexOf("method4"), 1);
|
||||
openTypeHierarchy(editor);
|
||||
tree= getHierarchyViewer().getTree();
|
||||
|
@ -261,7 +254,6 @@ public class CppTypeHierarchyTest extends TypeHierarchyBaseTest {
|
|||
assertEquals(0, item4.getItemCount());
|
||||
checkMethodTable(new String[] {"field1 : int", "method1() : int"});
|
||||
|
||||
|
||||
editor.selectAndReveal(content.indexOf("Multi2"), 1);
|
||||
openTypeHierarchy(editor);
|
||||
tree= getHierarchyViewer().getTree();
|
||||
|
@ -279,7 +271,6 @@ public class CppTypeHierarchyTest extends TypeHierarchyBaseTest {
|
|||
assertEquals(0, item4.getItemCount());
|
||||
checkMethodTable(new String[] {"field2 : int", "method2() : int"});
|
||||
|
||||
|
||||
editor.selectAndReveal(content.indexOf("Multi3"), 1);
|
||||
openTypeHierarchy(editor);
|
||||
tree= getHierarchyViewer().getTree();
|
||||
|
@ -302,7 +293,6 @@ public class CppTypeHierarchyTest extends TypeHierarchyBaseTest {
|
|||
|
||||
checkMethodTable(new String[] {"field3 : int", "method3() : int"});
|
||||
|
||||
|
||||
editor.selectAndReveal(content.indexOf("Multi4"), 1);
|
||||
openTypeHierarchy(editor);
|
||||
tree= getHierarchyViewer().getTree();
|
||||
|
@ -372,7 +362,6 @@ public class CppTypeHierarchyTest extends TypeHierarchyBaseTest {
|
|||
assertEquals(0, item4.getItemCount());
|
||||
checkMethodTable(new String[] {"field1 : int", "method1() : int"});
|
||||
|
||||
|
||||
editor.selectAndReveal(content.indexOf("method2"), 1);
|
||||
openTypeHierarchy(editor);
|
||||
tree= getHierarchyViewer().getTree();
|
||||
|
@ -390,7 +379,6 @@ public class CppTypeHierarchyTest extends TypeHierarchyBaseTest {
|
|||
assertEquals(0, item4.getItemCount());
|
||||
checkMethodTable(new String[] {"field2 : int", "method2() : int"});
|
||||
|
||||
|
||||
editor.selectAndReveal(content.indexOf("field3"), 1);
|
||||
openTypeHierarchy(editor);
|
||||
tree= getHierarchyViewer().getTree();
|
||||
|
@ -413,7 +401,6 @@ public class CppTypeHierarchyTest extends TypeHierarchyBaseTest {
|
|||
|
||||
checkMethodTable(new String[] {"field3 : int", "method3() : int"});
|
||||
|
||||
|
||||
editor.selectAndReveal(content.indexOf("method4"), 1);
|
||||
openTypeHierarchy(editor);
|
||||
tree= getHierarchyViewer().getTree();
|
||||
|
@ -488,7 +475,6 @@ public class CppTypeHierarchyTest extends TypeHierarchyBaseTest {
|
|||
|
||||
checkMethodTable(new String[] {"field1 : int", "method1() : int"});
|
||||
|
||||
|
||||
editor.selectAndReveal(content.indexOf("Diamond2"), 1);
|
||||
openTypeHierarchy(editor);
|
||||
tree= getHierarchyViewer().getTree();
|
||||
|
@ -506,7 +492,6 @@ public class CppTypeHierarchyTest extends TypeHierarchyBaseTest {
|
|||
|
||||
checkMethodTable(new String[] {"field2 : int", "method2() : int"});
|
||||
|
||||
|
||||
editor.selectAndReveal(content.indexOf("Diamond3"), 1);
|
||||
openTypeHierarchy(editor);
|
||||
tree= getHierarchyViewer().getTree();
|
||||
|
@ -524,7 +509,6 @@ public class CppTypeHierarchyTest extends TypeHierarchyBaseTest {
|
|||
|
||||
checkMethodTable(new String[] {"field3 : int", "method3() : int"});
|
||||
|
||||
|
||||
editor.selectAndReveal(content.indexOf("Diamond4"), 1);
|
||||
openTypeHierarchy(editor);
|
||||
tree= getHierarchyViewer().getTree();
|
||||
|
@ -599,7 +583,6 @@ public class CppTypeHierarchyTest extends TypeHierarchyBaseTest {
|
|||
|
||||
checkMethodTable(new String[] {"field1 : int", "method1() : int"});
|
||||
|
||||
|
||||
editor.selectAndReveal(content.indexOf("method2"), 1);
|
||||
openTypeHierarchy(editor);
|
||||
tree= getHierarchyViewer().getTree();
|
||||
|
@ -617,7 +600,6 @@ public class CppTypeHierarchyTest extends TypeHierarchyBaseTest {
|
|||
|
||||
checkMethodTable(new String[] {"field2 : int", "method2() : int"});
|
||||
|
||||
|
||||
editor.selectAndReveal(content.indexOf("field3"), 1);
|
||||
openTypeHierarchy(editor);
|
||||
tree= getHierarchyViewer().getTree();
|
||||
|
@ -635,7 +617,6 @@ public class CppTypeHierarchyTest extends TypeHierarchyBaseTest {
|
|||
|
||||
checkMethodTable(new String[] {"field3 : int", "method3() : int"});
|
||||
|
||||
|
||||
editor.selectAndReveal(content.indexOf("method4"), 1);
|
||||
openTypeHierarchy(editor);
|
||||
tree= getHierarchyViewer().getTree();
|
||||
|
@ -704,7 +685,6 @@ public class CppTypeHierarchyTest extends TypeHierarchyBaseTest {
|
|||
assertEquals(0, item4.getItemCount());
|
||||
checkMethodTable(new String[] {"field1 : int", "method1() : int"});
|
||||
|
||||
|
||||
editor.selectAndReveal(content.indexOf("ViaTypedef2"), 1);
|
||||
openTypeHierarchy(editor);
|
||||
tree= getHierarchyViewer().getTree();
|
||||
|
@ -720,7 +700,6 @@ public class CppTypeHierarchyTest extends TypeHierarchyBaseTest {
|
|||
assertEquals(0, item3.getItemCount());
|
||||
checkMethodTable(new String[] {});
|
||||
|
||||
|
||||
editor.selectAndReveal(content.indexOf("ViaTypedef3"), 1);
|
||||
openTypeHierarchy(editor);
|
||||
tree= getHierarchyViewer().getTree();
|
||||
|
@ -736,7 +715,6 @@ public class CppTypeHierarchyTest extends TypeHierarchyBaseTest {
|
|||
assertEquals(0, item3.getItemCount());
|
||||
checkMethodTable(new String[] {"field3 : int", "method3() : int"});
|
||||
|
||||
|
||||
editor.selectAndReveal(content.indexOf("ViaTypedef4"), 1);
|
||||
openTypeHierarchy(editor);
|
||||
tree= getHierarchyViewer().getTree();
|
||||
|
@ -795,7 +773,6 @@ public class CppTypeHierarchyTest extends TypeHierarchyBaseTest {
|
|||
assertEquals(0, item4.getItemCount());
|
||||
checkMethodTable(new String[] {"field1 : int", "method1() : int"});
|
||||
|
||||
|
||||
editor.selectAndReveal(content.indexOf("ViaTypedef2"), 1);
|
||||
openTypeHierarchy(editor);
|
||||
tree= getHierarchyViewer().getTree();
|
||||
|
@ -811,7 +788,6 @@ public class CppTypeHierarchyTest extends TypeHierarchyBaseTest {
|
|||
assertEquals(0, item3.getItemCount());
|
||||
checkMethodTable(new String[] {});
|
||||
|
||||
|
||||
editor.selectAndReveal(content.indexOf("field3"), 1);
|
||||
openTypeHierarchy(editor);
|
||||
tree= getHierarchyViewer().getTree();
|
||||
|
@ -827,7 +803,6 @@ public class CppTypeHierarchyTest extends TypeHierarchyBaseTest {
|
|||
assertEquals(0, item3.getItemCount());
|
||||
checkMethodTable(new String[] {"field3 : int", "method3() : int"});
|
||||
|
||||
|
||||
editor.selectAndReveal(content.indexOf("method4"), 1);
|
||||
openTypeHierarchy(editor);
|
||||
tree= getHierarchyViewer().getTree();
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Markus Schorn - initial API and implementation
|
||||
* Markus Schorn - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.ui.tests.typehierarchy;
|
||||
|
||||
|
@ -43,8 +43,6 @@ import org.eclipse.cdt.internal.ui.typehierarchy.THViewPart;
|
|||
import org.eclipse.cdt.internal.ui.typehierarchy.TypeHierarchyUI;
|
||||
|
||||
public class TypeHierarchyBaseTest extends BaseUITestCase {
|
||||
protected static final int INDEXER_WAIT_TIME = 8000;
|
||||
|
||||
protected ICProject fCProject;
|
||||
protected IIndex fIndex;
|
||||
|
||||
|
@ -110,7 +108,7 @@ public class TypeHierarchyBaseTest extends BaseUITestCase {
|
|||
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
|
||||
runEventQueue(0);
|
||||
THViewPart th= null;
|
||||
for (int i=0; i<50; i++) {
|
||||
for (int i= 0; i < 50; i++) {
|
||||
th= (THViewPart)page.findView(CUIPlugin.ID_TYPE_HIERARCHY);
|
||||
if (th != null)
|
||||
break;
|
||||
|
@ -123,7 +121,7 @@ public class TypeHierarchyBaseTest extends BaseUITestCase {
|
|||
protected Tree getQuickTypeHierarchyViewer(CEditor editor) {
|
||||
runEventQueue(0);
|
||||
THViewPart th= null;
|
||||
for (int i=0; i<50; i++) {
|
||||
for (int i= 0; i < 50; i++) {
|
||||
Control focus= editor.getSite().getShell().getDisplay().getFocusControl();
|
||||
if (focus instanceof Text) {
|
||||
Composite parent= focus.getParent();
|
||||
|
@ -143,7 +141,7 @@ public class TypeHierarchyBaseTest extends BaseUITestCase {
|
|||
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
|
||||
runEventQueue(0);
|
||||
THViewPart th= null;
|
||||
for (int i=0; i<50; i++) {
|
||||
for (int i= 0; i < 50; i++) {
|
||||
th= (THViewPart)page.findView(CUIPlugin.ID_TYPE_HIERARCHY);
|
||||
if (th != null)
|
||||
break;
|
||||
|
@ -156,16 +154,15 @@ public class TypeHierarchyBaseTest extends BaseUITestCase {
|
|||
protected TreeItem checkTreeNode(TreeItem root, int i1, String label) {
|
||||
TreeItem item= null;
|
||||
try {
|
||||
for (int i=0; i<200; i++) {
|
||||
for (int i= 0; i < 200; i++) {
|
||||
item= root.getItem(i1);
|
||||
try {
|
||||
if ("".equals(item.getText())) {
|
||||
if (item.getText().isEmpty()) {
|
||||
TreeItem parent= item.getParentItem();
|
||||
if (!parent.getExpanded()) {
|
||||
expandTreeItem(parent);
|
||||
}
|
||||
}
|
||||
else if (!"...".equals(item.getText())) {
|
||||
} else if (!"...".equals(item.getText())) {
|
||||
break;
|
||||
}
|
||||
} catch (SWTException e) {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Markus Schorn - initial API and implementation
|
||||
* Markus Schorn - initial API and implementation
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.ui.tests.typehierarchy;
|
||||
|
|
|
@ -93,7 +93,7 @@ import org.eclipse.cdt.internal.core.pdom.indexer.IndexerPreferences;
|
|||
import org.eclipse.cdt.internal.ui.editor.ASTProvider;
|
||||
|
||||
public class IndexUI {
|
||||
private static final ICElementHandle[] EMPTY_ELEMENTS = new ICElementHandle[0];
|
||||
private static final ICElementHandle[] EMPTY_ELEMENT_ARRAY = {};
|
||||
|
||||
public static IIndexBinding elementToBinding(IIndex index, ICElement element) throws CoreException {
|
||||
return elementToBinding(index, element, -1);
|
||||
|
@ -110,7 +110,7 @@ public class IndexUI {
|
|||
}
|
||||
} else {
|
||||
String name= element.getElementName();
|
||||
name= name.substring(name.lastIndexOf(':')+1);
|
||||
name= name.substring(name.lastIndexOf(':') + 1);
|
||||
IIndexBinding[] bindings= index.findBindings(name.toCharArray(), IndexFilter.ALL, new NullProgressMonitor());
|
||||
for (IIndexBinding binding : bindings) {
|
||||
if (checkBinding(binding, element)) {
|
||||
|
@ -267,11 +267,10 @@ public class IndexUI {
|
|||
return null;
|
||||
}
|
||||
|
||||
|
||||
public static ICElementHandle[] findRepresentative(IIndex index, IBinding binding) throws CoreException {
|
||||
ICElementHandle[] defs = IndexUI.findAllDefinitions(index, binding);
|
||||
ICElementHandle[] defs = findAllDefinitions(index, binding);
|
||||
if (defs.length == 0) {
|
||||
ICElementHandle elem = IndexUI.findAnyDeclaration(index, null, binding);
|
||||
ICElementHandle elem = findAnyDeclaration(index, null, binding);
|
||||
if (elem != null) {
|
||||
defs = new ICElementHandle[] { elem };
|
||||
}
|
||||
|
@ -292,7 +291,7 @@ public class IndexUI {
|
|||
}
|
||||
return result.toArray(new ICElementHandle[result.size()]);
|
||||
}
|
||||
return EMPTY_ELEMENTS;
|
||||
return EMPTY_ELEMENT_ARRAY;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -478,7 +477,7 @@ public class IndexUI {
|
|||
if (input instanceof ICElementHandle) {
|
||||
return input;
|
||||
}
|
||||
IIndexName name= IndexUI.elementToName(index, input);
|
||||
IIndexName name= elementToName(index, input);
|
||||
if (name != null) {
|
||||
ICElement handle= getCElementForName(input.getCProject(), index, name);
|
||||
if (handle != null) {
|
||||
|
@ -537,7 +536,6 @@ public class IndexUI {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
if (result != null) {
|
||||
return result;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue