Skip to content

Commit

Permalink
Stop using deprecated actions constructors
Browse files Browse the repository at this point in the history
New versions take IShellProvider instead of Shell
  • Loading branch information
akurtakov committed Sep 21, 2023
1 parent f080bef commit 3b64a07
Showing 1 changed file with 7 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2017 IBM Corporation and others.
* Copyright (c) 2000, 2023 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand All @@ -23,7 +23,7 @@
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.jface.window.IShellProvider;
import org.eclipse.team.internal.ui.Utils;
import org.eclipse.team.internal.ui.synchronize.SynchronizeView;
import org.eclipse.team.ui.synchronize.ISynchronizePageSite;
Expand Down Expand Up @@ -94,26 +94,25 @@ public void updateActionBars() {
}

protected void makeActions() {
final Shell shell = site.getShell();
final IShellProvider shellProvider = site.getWorkbenchSite();
final ISharedImages images = PlatformUI.getWorkbench()
.getSharedImages();

copyAction = new CopyToClipboardAction(shell, navigatorContentService);
copyAction = new CopyToClipboardAction(site.getShell(), navigatorContentService);
copyAction.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_COPY);
copyAction.setImageDescriptor(images
.getImageDescriptor(ISharedImages.IMG_TOOL_COPY));
copyAction.setDisabledImageDescriptor(images
.getImageDescriptor(ISharedImages.IMG_TOOL_COPY_DISABLED));

deleteAction = new DeleteResourceAction(shell) {
deleteAction = new DeleteResourceAction(shellProvider) {
@Override
protected List getSelectedResources() {
return getSelection().toList();// Arrays.asList(Utils.getResources(getSelection().toArray()));
}

@Override
protected boolean updateSelection(IStructuredSelection selection) {
// TODO Auto-generated method stub
return super.updateSelection(selection)
&& allResourcesAreOfType(selection, IResource.PROJECT
| IResource.FOLDER | IResource.FILE);
Expand All @@ -126,21 +125,19 @@ && allResourcesAreOfType(selection, IResource.PROJECT
deleteAction.setDisabledImageDescriptor(images
.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE_DISABLED));

moveAction = new MoveResourceAction(shell) {
moveAction = new MoveResourceAction(shellProvider) {
@Override
protected boolean updateSelection(IStructuredSelection selection) {
// TODO Auto-generated method stub
return super.updateSelection(selection)
&& allResourcesAreOfType(selection, IResource.PROJECT
| IResource.FOLDER | IResource.FILE);
}
};
moveAction.setActionDefinitionId(IWorkbenchCommandConstants.FILE_MOVE);

renameAction = new RenameResourceAction(shell) {
renameAction = new RenameResourceAction(shellProvider) {
@Override
protected boolean updateSelection(IStructuredSelection selection) {
// TODO Auto-generated method stub
return super.updateSelection(selection)
&& allResourcesAreOfType(selection, IResource.PROJECT
| IResource.FOLDER | IResource.FILE);
Expand Down

0 comments on commit 3b64a07

Please sign in to comment.