mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-09-04 06:03:18 +02:00
Fix warnings.
This commit is contained in:
parent
7520c8821b
commit
3529051832
8 changed files with 88 additions and 41 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2001, 2006 IBM Corporation and others.
|
* Copyright (c) 2001, 2008 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -7,6 +7,7 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Rational Software - initial implementation
|
* Rational Software - initial implementation
|
||||||
|
* Markus Schorn (Wind River Systems)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.ui;
|
package org.eclipse.cdt.internal.ui;
|
||||||
|
|
||||||
|
@ -45,8 +46,6 @@ public class CUIMessages {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getFormattedString(String key, String[] args) {
|
public static String getFormattedString(String key, String[] args) {
|
||||||
return MessageFormat.format(getString(key), args);
|
return MessageFormat.format(getString(key), (Object[]) args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2000, 2006 IBM Corporation and others.
|
* Copyright (c) 2000, 2008 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -22,9 +22,10 @@ import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.jface.action.GroupMarker;
|
import org.eclipse.jface.action.GroupMarker;
|
||||||
import org.eclipse.jface.action.IMenuManager;
|
import org.eclipse.jface.action.IMenuManager;
|
||||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||||
|
import org.eclipse.jface.window.IShellProvider;
|
||||||
import org.eclipse.swt.events.KeyEvent;
|
import org.eclipse.swt.events.KeyEvent;
|
||||||
import org.eclipse.swt.widgets.Shell;
|
|
||||||
import org.eclipse.ui.IActionBars;
|
import org.eclipse.ui.IActionBars;
|
||||||
|
import org.eclipse.ui.IWorkbenchPartSite;
|
||||||
import org.eclipse.ui.actions.BuildAction;
|
import org.eclipse.ui.actions.BuildAction;
|
||||||
import org.eclipse.ui.ide.IDEActionFactory;
|
import org.eclipse.ui.ide.IDEActionFactory;
|
||||||
|
|
||||||
|
@ -34,10 +35,11 @@ import org.eclipse.ui.ide.IDEActionFactory;
|
||||||
public class BuildGroup extends CViewActionGroup {
|
public class BuildGroup extends CViewActionGroup {
|
||||||
|
|
||||||
private class RebuildAction extends BuildAction {
|
private class RebuildAction extends BuildAction {
|
||||||
public RebuildAction(Shell shell) {
|
public RebuildAction(IShellProvider shell) {
|
||||||
super(shell, IncrementalProjectBuilder.FULL_BUILD);
|
super(shell, IncrementalProjectBuilder.FULL_BUILD);
|
||||||
}
|
}
|
||||||
protected void invokeOperation(IResource resource, IProgressMonitor monitor)
|
@Override
|
||||||
|
protected void invokeOperation(IResource resource, IProgressMonitor monitor)
|
||||||
throws CoreException {
|
throws CoreException {
|
||||||
// these are both async. NOT what I want.
|
// these are both async. NOT what I want.
|
||||||
((IProject) resource).build(IncrementalProjectBuilder.CLEAN_BUILD, monitor);
|
((IProject) resource).build(IncrementalProjectBuilder.CLEAN_BUILD, monitor);
|
||||||
|
@ -58,6 +60,7 @@ public class BuildGroup extends CViewActionGroup {
|
||||||
super(cview);
|
super(cview);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void fillActionBars(IActionBars actionBars) {
|
public void fillActionBars(IActionBars actionBars) {
|
||||||
actionBars.setGlobalActionHandler(IDEActionFactory.BUILD_PROJECT.getId(), buildAction);
|
actionBars.setGlobalActionHandler(IDEActionFactory.BUILD_PROJECT.getId(), buildAction);
|
||||||
}
|
}
|
||||||
|
@ -75,6 +78,7 @@ public class BuildGroup extends CViewActionGroup {
|
||||||
* @param menu
|
* @param menu
|
||||||
* context menu to add actions to
|
* context menu to add actions to
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void fillContextMenu(IMenuManager menu) {
|
public void fillContextMenu(IMenuManager menu) {
|
||||||
IStructuredSelection selection = (IStructuredSelection) getContext().getSelection();
|
IStructuredSelection selection = (IStructuredSelection) getContext().getSelection();
|
||||||
boolean isProjectSelection = true;
|
boolean isProjectSelection = true;
|
||||||
|
@ -128,6 +132,7 @@ public class BuildGroup extends CViewActionGroup {
|
||||||
/**
|
/**
|
||||||
* Handles a key pressed event by invoking the appropriate action.
|
* Handles a key pressed event by invoking the appropriate action.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void handleKeyPressed(KeyEvent event) {
|
public void handleKeyPressed(KeyEvent event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -148,19 +153,21 @@ public class BuildGroup extends CViewActionGroup {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void makeActions() {
|
protected void makeActions() {
|
||||||
Shell shell = getCView().getSite().getShell();
|
final IWorkbenchPartSite site = getCView().getSite();
|
||||||
|
|
||||||
buildAction = new BuildAction(shell, IncrementalProjectBuilder.FULL_BUILD);
|
buildAction = new BuildAction(site, IncrementalProjectBuilder.FULL_BUILD);
|
||||||
buildAction.setText(CViewMessages.getString("BuildAction.label")); //$NON-NLS-1$
|
buildAction.setText(CViewMessages.getString("BuildAction.label")); //$NON-NLS-1$
|
||||||
|
|
||||||
cleanAction = new BuildAction(shell, IncrementalProjectBuilder.CLEAN_BUILD);
|
cleanAction = new BuildAction(site, IncrementalProjectBuilder.CLEAN_BUILD);
|
||||||
cleanAction.setText(CViewMessages.getString("CleanAction.label")); //$NON-NLS-1$
|
cleanAction.setText(CViewMessages.getString("CleanAction.label")); //$NON-NLS-1$
|
||||||
|
|
||||||
rebuildAction = new RebuildAction(shell);
|
rebuildAction = new RebuildAction(site);
|
||||||
rebuildAction.setText(CViewMessages.getString("RebuildAction.label")); //$NON-NLS-1$
|
rebuildAction.setText(CViewMessages.getString("RebuildAction.label")); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void updateActionBars() {
|
public void updateActionBars() {
|
||||||
IStructuredSelection selection = (IStructuredSelection) getContext().getSelection();
|
IStructuredSelection selection = (IStructuredSelection) getContext().getSelection();
|
||||||
buildAction.selectionChanged(selection);
|
buildAction.selectionChanged(selection);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2000, 2006 IBM Corporation and others.
|
* Copyright (c) 2000, 2008 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -7,6 +7,7 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM Corporation - initial API and implementation
|
* IBM Corporation - initial API and implementation
|
||||||
|
* Markus Schorn (Wind River Systems)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.ui.cview;
|
package org.eclipse.cdt.internal.ui.cview;
|
||||||
|
|
||||||
|
@ -61,7 +62,7 @@ public class CViewMessages {
|
||||||
* Gets a string from the resource bundle and formats it with arguments
|
* Gets a string from the resource bundle and formats it with arguments
|
||||||
*/
|
*/
|
||||||
public static String getFormattedString(String key, String[] args) {
|
public static String getFormattedString(String key, String[] args) {
|
||||||
return MessageFormat.format(fgResourceBundle.getString(key), args);
|
return MessageFormat.format(fgResourceBundle.getString(key), (Object[]) args);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2000, 2005 IBM Corporation and others.
|
* Copyright (c) 2000, 2008 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -7,6 +7,7 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM Corporation - initial API and implementation
|
* IBM Corporation - initial API and implementation
|
||||||
|
* Markus Schorn (Wind River Systems)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.ui.cview;
|
package org.eclipse.cdt.internal.ui.cview;
|
||||||
|
|
||||||
|
@ -14,7 +15,6 @@ import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.cdt.internal.ui.ICHelpContextIds;
|
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.resources.IWorkspaceRoot;
|
import org.eclipse.core.resources.IWorkspaceRoot;
|
||||||
import org.eclipse.core.resources.ResourcesPlugin;
|
import org.eclipse.core.resources.ResourcesPlugin;
|
||||||
|
@ -22,11 +22,13 @@ import org.eclipse.core.runtime.IPath;
|
||||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||||
import org.eclipse.jface.viewers.StructuredSelection;
|
import org.eclipse.jface.viewers.StructuredSelection;
|
||||||
import org.eclipse.jface.viewers.StructuredViewer;
|
import org.eclipse.jface.viewers.StructuredViewer;
|
||||||
import org.eclipse.swt.widgets.Shell;
|
import org.eclipse.jface.window.IShellProvider;
|
||||||
import org.eclipse.ui.PlatformUI;
|
import org.eclipse.ui.PlatformUI;
|
||||||
import org.eclipse.ui.actions.MoveProjectAction;
|
import org.eclipse.ui.actions.MoveProjectAction;
|
||||||
import org.eclipse.ui.actions.MoveResourceAction;
|
import org.eclipse.ui.actions.MoveResourceAction;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.internal.ui.ICHelpContextIds;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The ResourceNavigatorMoveAction is a resource move that aso updates the navigator
|
* The ResourceNavigatorMoveAction is a resource move that aso updates the navigator
|
||||||
* to show the result of the move.
|
* to show the result of the move.
|
||||||
|
@ -40,18 +42,19 @@ public class CViewMoveAction extends MoveResourceAction {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a ResourceNavigatorMoveAction and use the supplied viewer to update the UI.
|
* Create a ResourceNavigatorMoveAction and use the supplied viewer to update the UI.
|
||||||
* @param shell Shell
|
* @param shellProvider provider for the shell
|
||||||
* @param structureViewer StructuredViewer
|
* @param structureViewer StructuredViewer
|
||||||
*/
|
*/
|
||||||
public CViewMoveAction(Shell shell, StructuredViewer structureViewer) {
|
public CViewMoveAction(IShellProvider shellProvider, StructuredViewer structureViewer) {
|
||||||
super(shell);
|
super(shellProvider);
|
||||||
PlatformUI.getWorkbench().getHelpSystem().setHelp(this, ICHelpContextIds.MOVE_ACTION);
|
PlatformUI.getWorkbench().getHelpSystem().setHelp(this, ICHelpContextIds.MOVE_ACTION);
|
||||||
this.viewer = structureViewer;
|
this.viewer = structureViewer;
|
||||||
this.moveProjectAction = new MoveProjectAction(shell);
|
this.moveProjectAction = new MoveProjectAction(shellProvider);
|
||||||
}
|
}
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* Method declared on IAction.
|
* Method declared on IAction.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (moveProjectAction.isEnabled()) {
|
if (moveProjectAction.isEnabled()) {
|
||||||
moveProjectAction.run();
|
moveProjectAction.run();
|
||||||
|
@ -62,7 +65,7 @@ public void run() {
|
||||||
List destinations = getDestinations();
|
List destinations = getDestinations();
|
||||||
if (destinations != null && destinations.isEmpty() == false) {
|
if (destinations != null && destinations.isEmpty() == false) {
|
||||||
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
|
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
|
||||||
List resources = new ArrayList();
|
List<IResource> resources = new ArrayList<IResource>();
|
||||||
Iterator iterator = destinations.iterator();
|
Iterator iterator = destinations.iterator();
|
||||||
|
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
|
@ -76,6 +79,7 @@ public void run() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected boolean updateSelection(IStructuredSelection selection) {
|
protected boolean updateSelection(IStructuredSelection selection) {
|
||||||
moveProjectAction.selectionChanged(selection);
|
moveProjectAction.selectionChanged(selection);
|
||||||
return super.updateSelection(selection) || moveProjectAction.isEnabled();
|
return super.updateSelection(selection) || moveProjectAction.isEnabled();
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2000, 2005 IBM Corporation and others.
|
* Copyright (c) 2000, 2008 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -7,21 +7,24 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM Corporation - initial API and implementation
|
* IBM Corporation - initial API and implementation
|
||||||
|
* Markus Schorn (Wind River Systems)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.ui.cview;
|
package org.eclipse.cdt.internal.ui.cview;
|
||||||
|
|
||||||
import org.eclipse.cdt.internal.ui.ICHelpContextIds;
|
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.resources.IWorkspaceRoot;
|
import org.eclipse.core.resources.IWorkspaceRoot;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
import org.eclipse.jface.viewers.StructuredSelection;
|
import org.eclipse.jface.viewers.StructuredSelection;
|
||||||
import org.eclipse.jface.viewers.TreeViewer;
|
import org.eclipse.jface.viewers.TreeViewer;
|
||||||
|
import org.eclipse.jface.window.IShellProvider;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.events.KeyEvent;
|
import org.eclipse.swt.events.KeyEvent;
|
||||||
import org.eclipse.swt.widgets.Shell;
|
import org.eclipse.swt.widgets.Shell;
|
||||||
import org.eclipse.ui.PlatformUI;
|
import org.eclipse.ui.PlatformUI;
|
||||||
import org.eclipse.ui.actions.RenameResourceAction;
|
import org.eclipse.ui.actions.RenameResourceAction;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.internal.ui.ICHelpContextIds;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The ResourceNavigatorRenameAction is the rename action used by the
|
* The ResourceNavigatorRenameAction is the rename action used by the
|
||||||
|
@ -35,7 +38,9 @@ public class CViewRenameAction extends RenameResourceAction {
|
||||||
* for editing.
|
* for editing.
|
||||||
* @param shell Shell
|
* @param shell Shell
|
||||||
* @param treeViewer TreeViewer
|
* @param treeViewer TreeViewer
|
||||||
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public CViewRenameAction(Shell shell, TreeViewer treeViewer) {
|
public CViewRenameAction(Shell shell, TreeViewer treeViewer) {
|
||||||
super(shell, treeViewer.getTree());
|
super(shell, treeViewer.getTree());
|
||||||
PlatformUI.getWorkbench().getHelpSystem().setHelp(
|
PlatformUI.getWorkbench().getHelpSystem().setHelp(
|
||||||
|
@ -43,9 +48,24 @@ public class CViewRenameAction extends RenameResourceAction {
|
||||||
ICHelpContextIds.RENAME_ACTION);
|
ICHelpContextIds.RENAME_ACTION);
|
||||||
this.viewer = treeViewer;
|
this.viewer = treeViewer;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Create a ResourceNavigatorRenameAction and use the tree of the supplied viewer
|
||||||
|
* for editing.
|
||||||
|
* @param shellProvider a provider for a shell
|
||||||
|
* @param treeViewer TreeViewer
|
||||||
|
*/
|
||||||
|
public CViewRenameAction(IShellProvider shellProvider, TreeViewer treeViewer) {
|
||||||
|
super(shellProvider, treeViewer.getTree());
|
||||||
|
PlatformUI.getWorkbench().getHelpSystem().setHelp(
|
||||||
|
this,
|
||||||
|
ICHelpContextIds.RENAME_ACTION);
|
||||||
|
this.viewer = treeViewer;
|
||||||
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* Run the action to completion using the supplied path.
|
* Run the action to completion using the supplied path.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
protected void runWithNewPath(IPath path, IResource resource) {
|
protected void runWithNewPath(IPath path, IResource resource) {
|
||||||
IWorkspaceRoot root = resource.getProject().getWorkspace().getRoot();
|
IWorkspaceRoot root = resource.getProject().getWorkspace().getRoot();
|
||||||
super.runWithNewPath(path, resource);
|
super.runWithNewPath(path, resource);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2000, 2005 IBM Corporation and others.
|
* Copyright (c) 2000, 2008 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -7,12 +7,12 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM Corporation - initial API and implementation
|
* IBM Corporation - initial API and implementation
|
||||||
|
* Markus Schorn (Wind River Systems)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.ui.cview;
|
package org.eclipse.cdt.internal.ui.cview;
|
||||||
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
import org.eclipse.cdt.ui.CUIPlugin;
|
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.resources.IResourceChangeEvent;
|
import org.eclipse.core.resources.IResourceChangeEvent;
|
||||||
|
@ -22,14 +22,16 @@ import org.eclipse.jface.action.IMenuManager;
|
||||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.events.KeyEvent;
|
import org.eclipse.swt.events.KeyEvent;
|
||||||
import org.eclipse.swt.widgets.Shell;
|
|
||||||
import org.eclipse.ui.IActionBars;
|
import org.eclipse.ui.IActionBars;
|
||||||
|
import org.eclipse.ui.IWorkbenchPartSite;
|
||||||
import org.eclipse.ui.actions.ActionFactory;
|
import org.eclipse.ui.actions.ActionFactory;
|
||||||
import org.eclipse.ui.actions.CloseResourceAction;
|
import org.eclipse.ui.actions.CloseResourceAction;
|
||||||
import org.eclipse.ui.actions.OpenResourceAction;
|
import org.eclipse.ui.actions.OpenResourceAction;
|
||||||
import org.eclipse.ui.actions.RefreshAction;
|
import org.eclipse.ui.actions.RefreshAction;
|
||||||
import org.eclipse.ui.ide.IDEActionFactory;
|
import org.eclipse.ui.ide.IDEActionFactory;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.ui.CUIPlugin;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the action group for actions such as Refresh Local, and Open/Close
|
* This is the action group for actions such as Refresh Local, and Open/Close
|
||||||
* Project.
|
* Project.
|
||||||
|
@ -44,6 +46,7 @@ public class OpenProjectGroup extends CViewActionGroup {
|
||||||
super(cview);
|
super(cview);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void fillActionBars(IActionBars actionBars) {
|
public void fillActionBars(IActionBars actionBars) {
|
||||||
actionBars.setGlobalActionHandler(ActionFactory.REFRESH.getId(), refreshAction);
|
actionBars.setGlobalActionHandler(ActionFactory.REFRESH.getId(), refreshAction);
|
||||||
actionBars.setGlobalActionHandler(IDEActionFactory.OPEN_PROJECT.getId(), openProjectAction);
|
actionBars.setGlobalActionHandler(IDEActionFactory.OPEN_PROJECT.getId(), openProjectAction);
|
||||||
|
@ -67,6 +70,7 @@ public class OpenProjectGroup extends CViewActionGroup {
|
||||||
* @param menu
|
* @param menu
|
||||||
* context menu to add actions to
|
* context menu to add actions to
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void fillContextMenu(IMenuManager menu) {
|
public void fillContextMenu(IMenuManager menu) {
|
||||||
IStructuredSelection selection = (IStructuredSelection) getContext().getSelection();
|
IStructuredSelection selection = (IStructuredSelection) getContext().getSelection();
|
||||||
boolean isProjectSelection = true;
|
boolean isProjectSelection = true;
|
||||||
|
@ -116,6 +120,7 @@ public class OpenProjectGroup extends CViewActionGroup {
|
||||||
/**
|
/**
|
||||||
* Handles a key pressed event by invoking the appropriate action.
|
* Handles a key pressed event by invoking the appropriate action.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void handleKeyPressed(KeyEvent event) {
|
public void handleKeyPressed(KeyEvent event) {
|
||||||
if (event.keyCode == SWT.F5 && event.stateMask == 0) {
|
if (event.keyCode == SWT.F5 && event.stateMask == 0) {
|
||||||
if (refreshAction.isEnabled()) {
|
if (refreshAction.isEnabled()) {
|
||||||
|
@ -126,20 +131,22 @@ public class OpenProjectGroup extends CViewActionGroup {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void makeActions() {
|
protected void makeActions() {
|
||||||
Shell shell = getCView().getSite().getShell();
|
final IWorkbenchPartSite site= getCView().getSite();
|
||||||
IWorkspace workspace = CUIPlugin.getWorkspace();
|
IWorkspace workspace = CUIPlugin.getWorkspace();
|
||||||
|
|
||||||
openProjectAction = new OpenResourceAction(shell);
|
openProjectAction = new OpenResourceAction(site);
|
||||||
workspace.addResourceChangeListener(openProjectAction, IResourceChangeEvent.POST_CHANGE);
|
workspace.addResourceChangeListener(openProjectAction, IResourceChangeEvent.POST_CHANGE);
|
||||||
closeProjectAction = new CloseResourceAction(shell);
|
closeProjectAction = new CloseResourceAction(site);
|
||||||
workspace.addResourceChangeListener(closeProjectAction, IResourceChangeEvent.POST_CHANGE);
|
workspace.addResourceChangeListener(closeProjectAction, IResourceChangeEvent.POST_CHANGE);
|
||||||
refreshAction = new RefreshAction(shell);
|
refreshAction = new RefreshAction(site);
|
||||||
refreshAction.setDisabledImageDescriptor(getImageDescriptor("dlcl16/refresh_nav.gif"));//$NON-NLS-1$
|
refreshAction.setDisabledImageDescriptor(getImageDescriptor("dlcl16/refresh_nav.gif"));//$NON-NLS-1$
|
||||||
refreshAction.setImageDescriptor(getImageDescriptor("elcl16/refresh_nav.gif"));//$NON-NLS-1$
|
refreshAction.setImageDescriptor(getImageDescriptor("elcl16/refresh_nav.gif"));//$NON-NLS-1$
|
||||||
// refreshAction.setHoverImageDescriptor(getImageDescriptor("clcl16/refresh_nav.gif"));//$NON-NLS-1$
|
// refreshAction.setHoverImageDescriptor(getImageDescriptor("clcl16/refresh_nav.gif"));//$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void updateActionBars() {
|
public void updateActionBars() {
|
||||||
IStructuredSelection selection = (IStructuredSelection) getContext().getSelection();
|
IStructuredSelection selection = (IStructuredSelection) getContext().getSelection();
|
||||||
refreshAction.selectionChanged(selection);
|
refreshAction.selectionChanged(selection);
|
||||||
|
@ -147,6 +154,7 @@ public class OpenProjectGroup extends CViewActionGroup {
|
||||||
closeProjectAction.selectionChanged(selection);
|
closeProjectAction.selectionChanged(selection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
IWorkspace workspace = CUIPlugin.getWorkspace();
|
IWorkspace workspace = CUIPlugin.getWorkspace();
|
||||||
workspace.removeResourceChangeListener(closeProjectAction);
|
workspace.removeResourceChangeListener(closeProjectAction);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2000, 2005 IBM Corporation and others.
|
* Copyright (c) 2000, 2008 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -7,10 +7,10 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM Corporation - initial API and implementation
|
* IBM Corporation - initial API and implementation
|
||||||
|
* Markus Schorn (Wind River Systems)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.ui.cview;
|
package org.eclipse.cdt.internal.ui.cview;
|
||||||
|
|
||||||
import org.eclipse.cdt.internal.ui.actions.SelectionConverter;
|
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.jface.action.IMenuManager;
|
import org.eclipse.jface.action.IMenuManager;
|
||||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||||
|
@ -21,11 +21,14 @@ import org.eclipse.swt.events.KeyEvent;
|
||||||
import org.eclipse.swt.widgets.Shell;
|
import org.eclipse.swt.widgets.Shell;
|
||||||
import org.eclipse.ui.IActionBars;
|
import org.eclipse.ui.IActionBars;
|
||||||
import org.eclipse.ui.ISharedImages;
|
import org.eclipse.ui.ISharedImages;
|
||||||
|
import org.eclipse.ui.IWorkbenchPartSite;
|
||||||
import org.eclipse.ui.PlatformUI;
|
import org.eclipse.ui.PlatformUI;
|
||||||
import org.eclipse.ui.actions.ActionFactory;
|
import org.eclipse.ui.actions.ActionFactory;
|
||||||
import org.eclipse.ui.actions.DeleteResourceAction;
|
import org.eclipse.ui.actions.DeleteResourceAction;
|
||||||
import org.eclipse.ui.actions.TextActionHandler;
|
import org.eclipse.ui.actions.TextActionHandler;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.internal.ui.actions.SelectionConverter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the action group for refactor actions,
|
* This is the action group for refactor actions,
|
||||||
* including global action handlers for copy, paste and delete.
|
* including global action handlers for copy, paste and delete.
|
||||||
|
@ -46,6 +49,7 @@ public class RefactorActionGroup extends CViewActionGroup {
|
||||||
super(cview);
|
super(cview);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
if (clipboard != null) {
|
if (clipboard != null) {
|
||||||
clipboard.dispose();
|
clipboard.dispose();
|
||||||
|
@ -54,6 +58,7 @@ public class RefactorActionGroup extends CViewActionGroup {
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void fillContextMenu(IMenuManager menu) {
|
public void fillContextMenu(IMenuManager menu) {
|
||||||
IStructuredSelection celements = (IStructuredSelection) getContext().getSelection();
|
IStructuredSelection celements = (IStructuredSelection) getContext().getSelection();
|
||||||
IStructuredSelection selection = SelectionConverter.convertSelectionToResources(celements);
|
IStructuredSelection selection = SelectionConverter.convertSelectionToResources(celements);
|
||||||
|
@ -76,6 +81,7 @@ public class RefactorActionGroup extends CViewActionGroup {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void fillActionBars(IActionBars actionBars) {
|
public void fillActionBars(IActionBars actionBars) {
|
||||||
textActionHandler = new TextActionHandler(actionBars); // hooks handlers
|
textActionHandler = new TextActionHandler(actionBars); // hooks handlers
|
||||||
textActionHandler.setCopyAction(copyAction);
|
textActionHandler.setCopyAction(copyAction);
|
||||||
|
@ -90,6 +96,7 @@ public class RefactorActionGroup extends CViewActionGroup {
|
||||||
/**
|
/**
|
||||||
* Handles a key pressed event by invoking the appropriate action.
|
* Handles a key pressed event by invoking the appropriate action.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void handleKeyPressed(KeyEvent event) {
|
public void handleKeyPressed(KeyEvent event) {
|
||||||
if (event.character == SWT.DEL && event.stateMask == 0) {
|
if (event.character == SWT.DEL && event.stateMask == 0) {
|
||||||
if (deleteAction.isEnabled()) {
|
if (deleteAction.isEnabled()) {
|
||||||
|
@ -106,9 +113,11 @@ public class RefactorActionGroup extends CViewActionGroup {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void makeActions() {
|
protected void makeActions() {
|
||||||
TreeViewer treeViewer = getCView().getViewer();
|
TreeViewer treeViewer = getCView().getViewer();
|
||||||
Shell shell = getCView().getSite().getShell();
|
final IWorkbenchPartSite site = getCView().getSite();
|
||||||
|
Shell shell = site.getShell();
|
||||||
clipboard = new Clipboard(shell.getDisplay());
|
clipboard = new Clipboard(shell.getDisplay());
|
||||||
|
|
||||||
pasteAction = new PasteAction(shell, clipboard);
|
pasteAction = new PasteAction(shell, clipboard);
|
||||||
|
@ -122,15 +131,16 @@ public class RefactorActionGroup extends CViewActionGroup {
|
||||||
copyAction.setImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_COPY));
|
copyAction.setImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_COPY));
|
||||||
copyAction.setHoverImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_COPY));
|
copyAction.setHoverImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_COPY));
|
||||||
|
|
||||||
moveAction = new CViewMoveAction(shell, treeViewer);
|
moveAction = new CViewMoveAction(site, treeViewer);
|
||||||
renameAction = new CViewRenameAction(shell, treeViewer);
|
renameAction = new CViewRenameAction(site, treeViewer);
|
||||||
|
|
||||||
deleteAction = new DeleteResourceAction(shell);
|
deleteAction = new DeleteResourceAction(site);
|
||||||
deleteAction.setDisabledImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE_DISABLED));
|
deleteAction.setDisabledImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE_DISABLED));
|
||||||
deleteAction.setImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE));
|
deleteAction.setImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE));
|
||||||
deleteAction.setHoverImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE));
|
deleteAction.setHoverImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void updateActionBars() {
|
public void updateActionBars() {
|
||||||
IStructuredSelection celements = (IStructuredSelection) getContext().getSelection();
|
IStructuredSelection celements = (IStructuredSelection) getContext().getSelection();
|
||||||
IStructuredSelection selection = SelectionConverter.convertSelectionToResources(celements);
|
IStructuredSelection selection = SelectionConverter.convertSelectionToResources(celements);
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.ui.util;
|
package org.eclipse.cdt.internal.ui.util;
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
@ -33,7 +32,6 @@ import org.eclipse.core.resources.IWorkspaceRoot;
|
||||||
import org.eclipse.core.resources.ResourcesPlugin;
|
import org.eclipse.core.resources.ResourcesPlugin;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
|
||||||
import org.eclipse.core.runtime.Path;
|
import org.eclipse.core.runtime.Path;
|
||||||
import org.eclipse.core.runtime.Platform;
|
import org.eclipse.core.runtime.Platform;
|
||||||
import org.eclipse.core.runtime.content.IContentType;
|
import org.eclipse.core.runtime.content.IContentType;
|
||||||
|
@ -308,7 +306,7 @@ public class EditorUtility {
|
||||||
* The <code>ICElement</code> is used to determine the associated project
|
* The <code>ICElement</code> is used to determine the associated project
|
||||||
* in case the location can not be resolved to a workspace <code>IFile</code>.
|
* in case the location can not be resolved to a workspace <code>IFile</code>.
|
||||||
*
|
*
|
||||||
* @param location a valid file system location
|
* @param locationURI a valid file system location
|
||||||
* @param context an element related to the target file, may be <code>null</code>
|
* @param context an element related to the target file, may be <code>null</code>
|
||||||
* @return an editor input
|
* @return an editor input
|
||||||
*/
|
*/
|
||||||
|
@ -476,7 +474,7 @@ public class EditorUtility {
|
||||||
* If a context element is given and there are multiple matches in the workspace,
|
* If a context element is given and there are multiple matches in the workspace,
|
||||||
* a resource with the same project of the context element are preferred.
|
* a resource with the same project of the context element are preferred.
|
||||||
*
|
*
|
||||||
* @param location a valid file system location
|
* @param locationURI a valid file system location
|
||||||
* @param context an element related to the target file, may be <code>null</code>
|
* @param context an element related to the target file, may be <code>null</code>
|
||||||
* @return an <code>IFile</code> or <code>null</code>
|
* @return an <code>IFile</code> or <code>null</code>
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Reference in a new issue