Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoug Schaefer2006-06-01 20:23:32 +0000
committerDoug Schaefer2006-06-01 20:23:32 +0000
commit8df1d9249d3b6733de8ba9415fa0381c384eca5e (patch)
tree96facc62dcc96b064387bab80864c54c0b65f160
parent263add60a92486ba3faec91aab0dccd3bb74b6f8 (diff)
downloadorg.eclipse.cdt-8df1d9249d3b6733de8ba9415fa0381c384eca5e.tar.gz
org.eclipse.cdt-8df1d9249d3b6733de8ba9415fa0381c384eca5e.tar.xz
org.eclipse.cdt-8df1d9249d3b6733de8ba9415fa0381c384eca5e.zip
Bug 144236 - Fixed the NPE cause by not registering a selection provider for the IndexView's site. Now that the object contributed rebuild index works, I have removed the hardcoded one from the Index View.
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/indexview/IndexView.java5
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/indexview/RebuildIndexAction.java64
2 files changed, 1 insertions, 68 deletions
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/indexview/IndexView.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/indexview/IndexView.java
index d4d4ba289d..3d65e22eec 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/indexview/IndexView.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/indexview/IndexView.java
@@ -66,7 +66,6 @@ public class IndexView extends ViewPart implements PDOM.IListener, IElementChang
private TreeViewer viewer;
// private DrillDownAdapter drillDownAdapter;
private ToggleLinkingAction toggleLinkingAction;
- private IndexAction rebuildAction;
private IndexAction countSymbolsAction;
private IndexAction discardExternalDefsAction;
private IndexAction openDefinitionAction;
@@ -310,6 +309,7 @@ public class IndexView extends ViewPart implements PDOM.IListener, IElementChang
viewer.getControl().setMenu(menu);
getSite().registerContextMenu(menuMgr, viewer);
+ getSite().setSelectionProvider(viewer);
viewer.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
handleSelectionChanged(event);
@@ -334,7 +334,6 @@ public class IndexView extends ViewPart implements PDOM.IListener, IElementChang
}
private void makeActions() {
- rebuildAction = new RebuildIndexAction(viewer);
countSymbolsAction = new CountNodeAction(viewer);
discardExternalDefsAction = new DiscardExternalDefsAction(viewer, this);
toggleLinkingAction = new ToggleLinkingAction(this);
@@ -357,8 +356,6 @@ public class IndexView extends ViewPart implements PDOM.IListener, IElementChang
}
private void fillContextMenu(IMenuManager manager) {
- if (rebuildAction.valid())
- manager.add(rebuildAction);
if (countSymbolsAction.valid())
manager.add(countSymbolsAction);
if (discardExternalDefsAction.valid())
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/indexview/RebuildIndexAction.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/indexview/RebuildIndexAction.java
deleted file mode 100644
index a20608f371..0000000000
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/indexview/RebuildIndexAction.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 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 - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.cdt.internal.ui.indexview;
-
-import org.eclipse.cdt.core.CCorePlugin;
-import org.eclipse.cdt.core.dom.IPDOMIndexer;
-import org.eclipse.cdt.core.model.ICProject;
-import org.eclipse.cdt.ui.CUIPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.TreeViewer;
-
-/**
- * @author Doug Schaefer
- *
- */
-public class RebuildIndexAction extends IndexAction {
-
- public RebuildIndexAction(TreeViewer viewer) {
- super(viewer, CUIPlugin.getResourceString("IndexView.rebuildIndex.name")); //$NON-NLS-1$
- }
-
- public void run() {
- ISelection selection = viewer.getSelection();
- if (!(selection instanceof IStructuredSelection))
- return;
-
- Object[] objs = ((IStructuredSelection)selection).toArray();
- for (int i = 0; i < objs.length; ++i) {
- if (!(objs[i] instanceof ICProject))
- continue;
-
- ICProject project = (ICProject)objs[i];
- IPDOMIndexer indexer = CCorePlugin.getPDOMManager().getIndexer(project);
- try {
- indexer.reindex();
- } catch (CoreException e) {
- CUIPlugin.getDefault().log(e);
- }
- }
- }
-
- public boolean valid() {
- ISelection selection = viewer.getSelection();
- if (!(selection instanceof IStructuredSelection))
- return false;
- Object[] objs = ((IStructuredSelection)selection).toArray();
- for (int i = 0; i < objs.length; ++i)
- if (objs[i] instanceof ICProject)
- return true;
- return false;
- }
-
-}

Back to the top