1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 22:52:11 +02:00

Fix warnings

This commit is contained in:
Anton Leherbauer 2008-03-28 14:37:59 +00:00
parent df675c8a18
commit ae2edb62e6
4 changed files with 24 additions and 27 deletions

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2007 IBM Corporation and others.
* Copyright (c) 2000, 2008 IBM Corporation 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
@ -23,7 +23,6 @@ import org.eclipse.jface.action.GroupMarker;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.Separator;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.actions.BuildAction;
@ -140,9 +139,7 @@ public class CNavigatorBuildActionGroup extends AbstractCNavigatorActionGroup {
}
protected void makeActions() {
Shell shell= getViewPart().getSite().getShell();
fCleanAction= new BuildAction(shell, IncrementalProjectBuilder.CLEAN_BUILD);
fCleanAction= new BuildAction(getViewPart().getSite(), IncrementalProjectBuilder.CLEAN_BUILD);
fCleanAction.setText(CViewMessages.getString("CleanAction.label")); //$NON-NLS-1$
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2006, 2007 Wind River Systems, Inc. and others.
* Copyright (c) 2006, 2008 Wind River Systems, Inc. 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
@ -360,7 +360,7 @@ public class CNavigatorDropAdapterAssistant extends CommonDropAdapterAssistant {
return null;
}
List elements = ((IStructuredSelection)selection).toList();
List resources= new ArrayList(elements.size());
List<Object> resources= new ArrayList<Object>(elements.size());
for (Iterator iter= elements.iterator(); iter.hasNext();) {
Object element= iter.next();
if (element instanceof ITranslationUnit) {
@ -369,7 +369,7 @@ public class CNavigatorDropAdapterAssistant extends CommonDropAdapterAssistant {
if (element instanceof ICElement)
resources.add(element);
}
return (ICElement[]) resources.toArray(new ICElement[resources.size()]);
return resources.toArray(new ICElement[resources.size()]);
}
private static boolean canCopyElements(ICElement[] cElements) {
@ -433,7 +433,7 @@ public class CNavigatorDropAdapterAssistant extends CommonDropAdapterAssistant {
* @return the resource selection from the LocalSelectionTransfer
*/
private IResource[] getSelectedResources(IStructuredSelection selection) {
ArrayList selectedResources = new ArrayList();
ArrayList<Object> selectedResources = new ArrayList<Object>();
for (Iterator i = selection.iterator(); i.hasNext();) {
Object o = i.next();
@ -447,7 +447,7 @@ public class CNavigatorDropAdapterAssistant extends CommonDropAdapterAssistant {
}
}
}
return (IResource[]) selectedResources
return selectedResources
.toArray(new IResource[selectedResources.size()]);
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2007 IBM Corporation and others.
* Copyright (c) 2000, 2008 IBM Corporation 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
@ -14,7 +14,7 @@ package org.eclipse.cdt.internal.ui.navigator;
import org.eclipse.core.resources.IResource;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.jface.window.IShellProvider;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.actions.ActionFactory;
@ -36,7 +36,7 @@ public class CNavigatorRefactorActionGroup extends ActionGroup {
private MoveResourceAction moveAction;
private Shell shell;
private IShellProvider shellProvider;
private Tree tree;
@ -45,8 +45,8 @@ public class CNavigatorRefactorActionGroup extends ActionGroup {
* @param aShell
* @param aTree
*/
public CNavigatorRefactorActionGroup(Shell aShell, Tree aTree) {
shell = aShell;
public CNavigatorRefactorActionGroup(IShellProvider aShell, Tree aTree) {
shellProvider = aShell;
tree = aTree;
makeActions();
}
@ -74,10 +74,10 @@ public class CNavigatorRefactorActionGroup extends ActionGroup {
}
protected void makeActions() {
moveAction = new MoveResourceAction(shell);
moveAction = new MoveResourceAction(shellProvider);
moveAction.setActionDefinitionId(IWorkbenchActionDefinitionIds.MOVE);
renameAction = new RenameResourceAction(shell, tree);
renameAction = new RenameResourceAction(shellProvider, tree);
renameAction.setActionDefinitionId(IWorkbenchActionDefinitionIds.RENAME);
}

View file

@ -17,6 +17,7 @@ import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.IWorkbenchPartSite;
import org.eclipse.ui.actions.ActionContext;
import org.eclipse.ui.navigator.CommonActionProvider;
import org.eclipse.ui.navigator.ICommonActionExtensionSite;
@ -36,25 +37,24 @@ public class CNavigatorRefactorActionProvider extends CommonActionProvider {
private CNavigatorRefactorActionGroup resourceRefactorGroup;
private CRefactoringActionGroup cElementRefactorGroup;
private ICommonActionExtensionSite site;
/*
* @see org.eclipse.ui.navigator.CommonActionProvider#init(org.eclipse.ui.navigator.ICommonActionExtensionSite)
*/
@Override
public void init(ICommonActionExtensionSite actionSite) {
site = actionSite;
resourceRefactorGroup= new CNavigatorRefactorActionGroup(site.getViewSite().getShell(), (Tree)site.getStructuredViewer().getControl());
IUndoContext workspaceContext= (IUndoContext) ResourcesPlugin.getWorkspace().getAdapter(IUndoContext.class);
ICommonViewerWorkbenchSite workbenchSite = null;
if (site.getViewSite() instanceof ICommonViewerWorkbenchSite) {
workbenchSite = (ICommonViewerWorkbenchSite) site.getViewSite();
super.init(actionSite);
ICommonViewerWorkbenchSite workbenchSite= null;
if (actionSite.getViewSite() instanceof ICommonViewerWorkbenchSite) {
workbenchSite = (ICommonViewerWorkbenchSite) actionSite.getViewSite();
}
if (workbenchSite != null) {
undoRedoGroup = new UndoRedoActionGroup(workbenchSite.getSite(), workspaceContext, true);
final IWorkbenchPartSite partSite= workbenchSite.getSite();
resourceRefactorGroup= new CNavigatorRefactorActionGroup(partSite, (Tree)actionSite.getStructuredViewer().getControl());
IUndoContext workspaceContext= (IUndoContext) ResourcesPlugin.getWorkspace().getAdapter(IUndoContext.class);
undoRedoGroup = new UndoRedoActionGroup(partSite, workspaceContext, true);
cElementRefactorGroup= new CRefactoringActionGroup(workbenchSite.getPart());
}
}
}
@Override
public void dispose() {