mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-04 14:55:41 +02:00
update.
This commit is contained in:
parent
5bebbf5367
commit
5fe505bacb
3 changed files with 36 additions and 22 deletions
|
@ -14,6 +14,7 @@ import java.util.Iterator;
|
|||
|
||||
import org.eclipse.core.resources.ICommand;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.resources.IncrementalProjectBuilder;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IAdaptable;
|
||||
|
@ -78,7 +79,10 @@ public class BuildGroup extends CViewActionGroup {
|
|||
if (next instanceof IProject) {
|
||||
project = (IProject) next;
|
||||
} else if (next instanceof IAdaptable) {
|
||||
project = (IProject) ((IAdaptable) next).getAdapter(IProject.class);
|
||||
IResource res = (IResource)((IAdaptable)next).getAdapter(IResource.class);
|
||||
if (res instanceof IProject) {
|
||||
project = (IProject) res;
|
||||
}
|
||||
}
|
||||
|
||||
if (project == null) {
|
||||
|
|
|
@ -86,6 +86,7 @@ import org.eclipse.ui.PartInitException;
|
|||
import org.eclipse.ui.ResourceWorkingSetFilter;
|
||||
import org.eclipse.ui.actions.ActionContext;
|
||||
import org.eclipse.ui.part.ISetSelectionTarget;
|
||||
import org.eclipse.ui.part.IShowInSource;
|
||||
import org.eclipse.ui.part.IShowInTarget;
|
||||
import org.eclipse.ui.part.PluginTransfer;
|
||||
import org.eclipse.ui.part.ResourceTransfer;
|
||||
|
@ -330,7 +331,13 @@ public class CView extends ViewPart implements ISetSelectionTarget, IPropertyCha
|
|||
* Answer the property defined by key.
|
||||
*/
|
||||
public Object getAdapter(Class key) {
|
||||
if (key.equals(ISelectionProvider.class)) return viewer;
|
||||
if (key.equals(ISelectionProvider.class)) {
|
||||
return viewer;
|
||||
} else if (key == IShowInSource.class) {
|
||||
return getShowInSource();
|
||||
} else if (key == IShowInTarget.class) {
|
||||
return this;
|
||||
}
|
||||
return super.getAdapter(key);
|
||||
}
|
||||
|
||||
|
@ -1064,20 +1071,31 @@ public class CView extends ViewPart implements ISetSelectionTarget, IPropertyCha
|
|||
* @see org.eclipse.ui.part.IShowInTarget#show(org.eclipse.ui.part.ShowInContext)
|
||||
*/
|
||||
public boolean show(ShowInContext context) {
|
||||
//@@@ Do something with the selection later?
|
||||
//ISelection selection = context.getSelection();
|
||||
try {
|
||||
IEditorInput input = (IEditorInput) context.getInput();
|
||||
if (input != null) {
|
||||
IResource res = (IResource) input.getAdapter(IResource.class);
|
||||
if (res != null) {
|
||||
selectReveal(new StructuredSelection(res));
|
||||
}
|
||||
IEditorInput input = (IEditorInput) context.getInput();
|
||||
if (input != null) {
|
||||
IResource res = (IResource) input.getAdapter(IResource.class);
|
||||
if (res != null) {
|
||||
selectReveal(new StructuredSelection(res));
|
||||
return true;
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
/* Ignore */
|
||||
}
|
||||
ISelection selection= context.getSelection();
|
||||
if (selection != null) {
|
||||
selectReveal(selection);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the <code>IShowInSource</code> for this view.
|
||||
*/
|
||||
protected IShowInSource getShowInSource() {
|
||||
return new IShowInSource() {
|
||||
public ShowInContext getShowInContext() {
|
||||
return new ShowInContext(getViewer().getInput(), getViewer().getSelection());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -57,7 +57,6 @@ public class MainActionGroup extends CViewActionGroup {
|
|||
// Actions for Menu context.
|
||||
AddBookmarkAction addBookmarkAction;
|
||||
AddTaskAction addTaskAction;
|
||||
|
||||
PropertyDialogAction propertyDialogAction;
|
||||
|
||||
ImportResourcesAction importAction;
|
||||
|
@ -65,13 +64,10 @@ public class MainActionGroup extends CViewActionGroup {
|
|||
|
||||
// CElement action
|
||||
OpenIncludeAction openIncludeAction;
|
||||
ShowLibrariesAction clibFilterAction;
|
||||
// Collapsing
|
||||
CollapseAllAction collapseAllAction;
|
||||
|
||||
//ToggleLinkingAction toggleLinkingAction;
|
||||
|
||||
ShowLibrariesAction clibFilterAction;
|
||||
|
||||
//Search
|
||||
FileSearchAction fFileSearchAction;
|
||||
FileSearchActionInWorkingSet fFileSearchActionInWorkingSet;
|
||||
|
@ -193,7 +189,6 @@ public class MainActionGroup extends CViewActionGroup {
|
|||
return;
|
||||
}
|
||||
|
||||
//updateActions(resources);
|
||||
addNewMenu(menu, resources);
|
||||
menu.add(new Separator());
|
||||
gotoGroup.fillContextMenu(menu);
|
||||
|
@ -327,11 +322,8 @@ public class MainActionGroup extends CViewActionGroup {
|
|||
IToolBarManager toolBar = actionBars.getToolBarManager();
|
||||
toolBar.add(new Separator());
|
||||
toolBar.add(collapseAllAction);
|
||||
//toolBar.add(toggleLinkingAction);
|
||||
//actionBars.updateActionBars();
|
||||
|
||||
IMenuManager menu = actionBars.getMenuManager();
|
||||
//menu.add(toggleLinkingAction);
|
||||
//menu.add (clibFilterAction);
|
||||
menu.add(patternFilterAction);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue