From a0c153442cdc1106c82b61c6e8e6e19e465fe629 Mon Sep 17 00:00:00 2001 From: John Camelon Date: Tue, 1 Feb 2005 04:34:52 +0000 Subject: [PATCH] Patch for Devin Steffler. Further UI indicator infrastructure for testing DOM AST. --- .../eclipse/cdt/ui/tests/DOMAST/DOMAST.java | 74 ++++++++++++++++++- 1 file changed, 72 insertions(+), 2 deletions(-) diff --git a/core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/DOMAST/DOMAST.java b/core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/DOMAST/DOMAST.java index 065307994f3..0d4e42a80ac 100644 --- a/core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/DOMAST/DOMAST.java +++ b/core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/DOMAST/DOMAST.java @@ -10,6 +10,7 @@ **********************************************************************/ package org.eclipse.cdt.ui.tests.DOMAST; +import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.dom.CDOM; import org.eclipse.cdt.core.dom.IASTServiceProvider; import org.eclipse.cdt.core.dom.ast.IASTArrayModifier; @@ -32,6 +33,8 @@ import org.eclipse.cdt.core.dom.ast.IASTTypeId; import org.eclipse.cdt.core.dom.ast.c.ICASTDesignator; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTConstructorChainInitializer; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateParameter; +import org.eclipse.cdt.core.filetype.ICFileType; +import org.eclipse.cdt.core.filetype.ICFileTypeConstants; import org.eclipse.cdt.core.model.CModelException; import org.eclipse.cdt.core.parser.ParserLanguage; import org.eclipse.cdt.core.parser.ParserUtil; @@ -44,6 +47,7 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPVisitor.CPPBaseVisitorAct import org.eclipse.cdt.internal.ui.editor.CEditor; import org.eclipse.cdt.internal.ui.util.EditorUtility; import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.IPath; @@ -77,6 +81,7 @@ import org.eclipse.ui.IActionBars; import org.eclipse.ui.IEditorPart; import org.eclipse.ui.IEditorReference; import org.eclipse.ui.ISharedImages; +import org.eclipse.ui.IViewPart; import org.eclipse.ui.IWorkbenchActionConstants; import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.PartInitException; @@ -100,7 +105,13 @@ import org.eclipse.ui.part.ViewPart; */ public class DOMAST extends ViewPart { - private static final String COLLAPSE_ALL = "Collapse ALL"; //$NON-NLS-1$ + private static final String EXTENSION_CXX = "CXX"; //$NON-NLS-1$ +private static final String EXTENSION_CPP = "CPP"; //$NON-NLS-1$ +private static final String EXTENSION_CC = "CC"; //$NON-NLS-1$ +private static final String EXTENSION_C = "C"; //$NON-NLS-1$ +private static final String NOT_VALID_COMPILATION_UNIT = "The active editor does not contain a valid compilation unit."; //$NON-NLS-1$ +private static final String LOAD_ACTIVE_EDITOR = "Load Active Editor"; //$NON-NLS-1$ +private static final String COLLAPSE_ALL = "Collapse ALL"; //$NON-NLS-1$ private static final String EXPAND_ALL = "Expand All"; //$NON-NLS-1$ private static final String REFRESH_DOM_AST = "Refresh DOM AST"; //$NON-NLS-1$ private static final String VIEW_NAME = "DOM View"; //$NON-NLS-1$ @@ -112,6 +123,7 @@ private static final String REFRESH_DOM_AST = "Refresh DOM AST"; //$NON-NLS-1 private Action openDeclarationsAction; private Action openReferencesAction; private Action singleClickAction; + private Action loadActiveEditorAction; private Action refreshAction; private Action expandAllAction; private Action collapseAllAction; @@ -384,12 +396,70 @@ private static final String REFRESH_DOM_AST = "Refresh DOM AST"; //$NON-NLS-1 manager.add(expandAllAction); manager.add(collapseAllAction); manager.add(refreshAction); + manager.add(loadActiveEditorAction); manager.add(new Separator()); drillDownAdapter.addNavigationActions(manager); } private void makeActions() { - refreshAction = new Action() { + loadActiveEditorAction = new Action() { + public void run() { + // get the active editor + IEditorPart editor = null; + if (PlatformUI.getWorkbench().getActiveWorkbenchWindow() != null && + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getPages() != null) { + IWorkbenchPage[] pages = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getPages(); + + outerLoop: for(int i=0; i