1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-09-09 19:43:27 +02:00

Patch for Devin Steffler.

Further UI indicator infrastructure for testing DOM AST.
This commit is contained in:
John Camelon 2005-01-26 18:56:09 +00:00
parent 1466819ee6
commit 4d00261705

View file

@ -91,15 +91,17 @@ import org.eclipse.core.runtime.CoreException;
*/ */
public class DOMAST extends ViewPart { public class DOMAST extends ViewPart {
private static final String REFRESH_DOM_AST = "Refresh DOM AST"; //$NON-NLS-1$
private static final String VIEW_NAME = "DOM View"; //$NON-NLS-1$ private static final String VIEW_NAME = "DOM View"; //$NON-NLS-1$
private static final String POPUPMENU = "#PopupMenu"; //$NON-NLS-1$ private static final String POPUPMENU = "#PopupMenu"; //$NON-NLS-1$
private static final String OPEN_DEFINITIONS = "Open Definitions"; //$NON-NLS-1$ private static final String OPEN_DECLARATIONS = "Open Declarations"; //$NON-NLS-1$
private static final String OPEN_REFERENCES = "Open References"; //$NON-NLS-1$ private static final String OPEN_REFERENCES = "Open References"; //$NON-NLS-1$
private TreeViewer viewer; private TreeViewer viewer;
private DrillDownAdapter drillDownAdapter; private DrillDownAdapter drillDownAdapter;
private Action action1; private Action action1;
private Action action2; private Action action2;
private Action singleClickAction; private Action singleClickAction;
private Action refreshAction;
private IFile file = null; private IFile file = null;
private IEditorPart part = null; private IEditorPart part = null;
private ParserLanguage lang = null; private ParserLanguage lang = null;
@ -185,7 +187,7 @@ public class DOMAST extends ViewPart {
// if( workingCopy == null ) // if( workingCopy == null )
reader = new CodeReader(aFile.getLocation().toOSString(), aFile.getCharset() ); reader = new CodeReader(aFile.getLocation().toOSString(), aFile.getCharset() );
// else // else
// reader = new CodeReader(file.getLocation().toOSString(), workingCopy.getContents()); // reader = new CodeReader(aFile.getLocation().toOSString(), workingCopy.getContents());
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} catch ( CoreException e ) { } catch ( CoreException e ) {
@ -366,10 +368,9 @@ public class DOMAST extends ViewPart {
DOMAST.this.fillContextMenu(manager); DOMAST.this.fillContextMenu(manager);
IContributionItem[] items = manager.getItems(); IContributionItem[] items = manager.getItems();
for (int i=0; i<items.length; i++) { for (int i=0; i<items.length; i++) {
// TODO Devin put in the check here if IASTName or not... if it isn't, and item is open declaration (make constant) then hide it
if (items[i] instanceof ActionContributionItem && if (items[i] instanceof ActionContributionItem &&
(((ActionContributionItem)items[i]).getAction().getText().equals(OPEN_REFERENCES) || (((ActionContributionItem)items[i]).getAction().getText().equals(OPEN_REFERENCES) ||
((ActionContributionItem)items[i]).getAction().getText().equals(OPEN_DEFINITIONS) )) { ((ActionContributionItem)items[i]).getAction().getText().equals(OPEN_DECLARATIONS) )) {
if (viewer.getSelection() instanceof StructuredSelection && if (viewer.getSelection() instanceof StructuredSelection &&
((StructuredSelection)viewer.getSelection()).getFirstElement() instanceof TreeObject && ((StructuredSelection)viewer.getSelection()).getFirstElement() instanceof TreeObject &&
((TreeObject)((StructuredSelection)viewer.getSelection()).getFirstElement()).getNode() instanceof IASTName) { ((TreeObject)((StructuredSelection)viewer.getSelection()).getFirstElement()).getNode() instanceof IASTName) {
@ -408,28 +409,36 @@ public class DOMAST extends ViewPart {
} }
private void fillLocalToolBar(IToolBarManager manager) { private void fillLocalToolBar(IToolBarManager manager) {
// manager.add(action1); // TODO determine the groups/filters to use manager.add(refreshAction);
// manager.add(action2); manager.add(new Separator());
// manager.add(new Separator()); drillDownAdapter.addNavigationActions(manager);
// drillDownAdapter.addNavigationActions(manager);
} }
private void makeActions() { private void makeActions() {
action1 = new Action() { refreshAction = new Action() {
public void run() { public void run() {
showMessage("Action 1 executed"); // TODO Devin open declarations action ... john probably wants all of them highlighted... wouldn't I have to use annotations then??? setContentProvider(new ViewContentProvider(file));
} }
}; };
action1.setText(OPEN_REFERENCES); refreshAction.setText(REFRESH_DOM_AST);
refreshAction.setToolTipText(REFRESH_DOM_AST);
refreshAction.setImageDescriptor(DOMASTPluginImages.DESC_IASTInitializer);
action1 = new Action() {
public void run() {
showMessage("Action 1 executed"); // TODO open declarations action ... use annotations
}
};
action1.setText(OPEN_DECLARATIONS);
action1.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages(). action1.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().
getImageDescriptor(ISharedImages.IMG_OBJS_INFO_TSK)); getImageDescriptor(ISharedImages.IMG_OBJS_INFO_TSK));
action2 = new Action() { action2 = new Action() {
public void run() { public void run() {
showMessage("Action 2 executed"); // TODO Devin open definitions action ... use annotations to highlight definitions? showMessage("Action 2 executed"); // TODO open references action ... use annotations
} }
}; };
action2.setText(OPEN_DEFINITIONS); action2.setText(OPEN_REFERENCES);
action2.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages(). action2.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().
getImageDescriptor(ISharedImages.IMG_OBJS_INFO_TSK)); getImageDescriptor(ISharedImages.IMG_OBJS_INFO_TSK));