mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-05 07:15:39 +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.ICommand;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.resources.IncrementalProjectBuilder;
|
import org.eclipse.core.resources.IncrementalProjectBuilder;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IAdaptable;
|
import org.eclipse.core.runtime.IAdaptable;
|
||||||
|
@ -78,7 +79,10 @@ public class BuildGroup extends CViewActionGroup {
|
||||||
if (next instanceof IProject) {
|
if (next instanceof IProject) {
|
||||||
project = (IProject) next;
|
project = (IProject) next;
|
||||||
} else if (next instanceof IAdaptable) {
|
} 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) {
|
if (project == null) {
|
||||||
|
|
|
@ -86,6 +86,7 @@ import org.eclipse.ui.PartInitException;
|
||||||
import org.eclipse.ui.ResourceWorkingSetFilter;
|
import org.eclipse.ui.ResourceWorkingSetFilter;
|
||||||
import org.eclipse.ui.actions.ActionContext;
|
import org.eclipse.ui.actions.ActionContext;
|
||||||
import org.eclipse.ui.part.ISetSelectionTarget;
|
import org.eclipse.ui.part.ISetSelectionTarget;
|
||||||
|
import org.eclipse.ui.part.IShowInSource;
|
||||||
import org.eclipse.ui.part.IShowInTarget;
|
import org.eclipse.ui.part.IShowInTarget;
|
||||||
import org.eclipse.ui.part.PluginTransfer;
|
import org.eclipse.ui.part.PluginTransfer;
|
||||||
import org.eclipse.ui.part.ResourceTransfer;
|
import org.eclipse.ui.part.ResourceTransfer;
|
||||||
|
@ -330,7 +331,13 @@ public class CView extends ViewPart implements ISetSelectionTarget, IPropertyCha
|
||||||
* Answer the property defined by key.
|
* Answer the property defined by key.
|
||||||
*/
|
*/
|
||||||
public Object getAdapter(Class 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);
|
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)
|
* @see org.eclipse.ui.part.IShowInTarget#show(org.eclipse.ui.part.ShowInContext)
|
||||||
*/
|
*/
|
||||||
public boolean show(ShowInContext context) {
|
public boolean show(ShowInContext context) {
|
||||||
//@@@ Do something with the selection later?
|
IEditorInput input = (IEditorInput) context.getInput();
|
||||||
//ISelection selection = context.getSelection();
|
if (input != null) {
|
||||||
try {
|
IResource res = (IResource) input.getAdapter(IResource.class);
|
||||||
IEditorInput input = (IEditorInput) context.getInput();
|
if (res != null) {
|
||||||
if (input != null) {
|
selectReveal(new StructuredSelection(res));
|
||||||
IResource res = (IResource) input.getAdapter(IResource.class);
|
return true;
|
||||||
if (res != null) {
|
|
||||||
selectReveal(new StructuredSelection(res));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
}
|
||||||
/* Ignore */
|
ISelection selection= context.getSelection();
|
||||||
|
if (selection != null) {
|
||||||
|
selectReveal(selection);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
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.
|
// Actions for Menu context.
|
||||||
AddBookmarkAction addBookmarkAction;
|
AddBookmarkAction addBookmarkAction;
|
||||||
AddTaskAction addTaskAction;
|
AddTaskAction addTaskAction;
|
||||||
|
|
||||||
PropertyDialogAction propertyDialogAction;
|
PropertyDialogAction propertyDialogAction;
|
||||||
|
|
||||||
ImportResourcesAction importAction;
|
ImportResourcesAction importAction;
|
||||||
|
@ -65,13 +64,10 @@ public class MainActionGroup extends CViewActionGroup {
|
||||||
|
|
||||||
// CElement action
|
// CElement action
|
||||||
OpenIncludeAction openIncludeAction;
|
OpenIncludeAction openIncludeAction;
|
||||||
|
ShowLibrariesAction clibFilterAction;
|
||||||
// Collapsing
|
// Collapsing
|
||||||
CollapseAllAction collapseAllAction;
|
CollapseAllAction collapseAllAction;
|
||||||
|
|
||||||
//ToggleLinkingAction toggleLinkingAction;
|
|
||||||
|
|
||||||
ShowLibrariesAction clibFilterAction;
|
|
||||||
|
|
||||||
//Search
|
//Search
|
||||||
FileSearchAction fFileSearchAction;
|
FileSearchAction fFileSearchAction;
|
||||||
FileSearchActionInWorkingSet fFileSearchActionInWorkingSet;
|
FileSearchActionInWorkingSet fFileSearchActionInWorkingSet;
|
||||||
|
@ -193,7 +189,6 @@ public class MainActionGroup extends CViewActionGroup {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//updateActions(resources);
|
|
||||||
addNewMenu(menu, resources);
|
addNewMenu(menu, resources);
|
||||||
menu.add(new Separator());
|
menu.add(new Separator());
|
||||||
gotoGroup.fillContextMenu(menu);
|
gotoGroup.fillContextMenu(menu);
|
||||||
|
@ -327,11 +322,8 @@ public class MainActionGroup extends CViewActionGroup {
|
||||||
IToolBarManager toolBar = actionBars.getToolBarManager();
|
IToolBarManager toolBar = actionBars.getToolBarManager();
|
||||||
toolBar.add(new Separator());
|
toolBar.add(new Separator());
|
||||||
toolBar.add(collapseAllAction);
|
toolBar.add(collapseAllAction);
|
||||||
//toolBar.add(toggleLinkingAction);
|
|
||||||
//actionBars.updateActionBars();
|
|
||||||
|
|
||||||
IMenuManager menu = actionBars.getMenuManager();
|
IMenuManager menu = actionBars.getMenuManager();
|
||||||
//menu.add(toggleLinkingAction);
|
|
||||||
//menu.add (clibFilterAction);
|
//menu.add (clibFilterAction);
|
||||||
menu.add(patternFilterAction);
|
menu.add(patternFilterAction);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue