From a6dc67e9fe55aa83376633dd5fd8b4b41beecd86 Mon Sep 17 00:00:00 2001 From: Alexander Kurtakov Date: Fri, 25 Oct 2019 17:51:29 +0300 Subject: Move away of deprecated AbstractUIPlugin.getWorkbench. Call PlatformUI.getWorkbench directly. Change-Id: I88e4078a7ffa5d962e174d6326318b0f2c6f548a Signed-off-by: Alexander Kurtakov --- .../m2e/core/ui/internal/actions/EnableNatureAction.java | 5 +++-- .../m2e/core/ui/internal/actions/MavenActionSupport.java | 6 +++--- .../src/org/eclipse/m2e/actions/ExecutePomAction.java | 6 +++--- .../m2e/scm/internal/actions/CheckoutAsMavenAction.java | 12 +++--------- 4 files changed, 12 insertions(+), 17 deletions(-) diff --git a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/actions/EnableNatureAction.java b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/actions/EnableNatureAction.java index 3a097b6f..9797cbaa 100644 --- a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/actions/EnableNatureAction.java +++ b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/actions/EnableNatureAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008-2018 Sonatype, Inc. and others. + * Copyright (c) 2008, 2019 Sonatype, 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 @@ -36,6 +36,7 @@ import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.IObjectActionDelegate; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.PlatformUI; import org.eclipse.m2e.core.MavenPlugin; import org.eclipse.m2e.core.internal.IMavenConstants; @@ -103,7 +104,7 @@ public class EnableNatureAction implements IObjectActionDelegate, IExecutableExt if(!pom.exists()) { if(isSingle) { // XXX move into AbstractProjectConfigurator and use Eclipse project settings - IWorkbench workbench = plugin.getWorkbench(); + IWorkbench workbench = PlatformUI.getWorkbench(); MavenPomWizard wizard = new MavenPomWizard(); wizard.init(workbench, (IStructuredSelection) selection); diff --git a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/actions/MavenActionSupport.java b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/actions/MavenActionSupport.java index a2217a0c..6d631fe5 100644 --- a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/actions/MavenActionSupport.java +++ b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/actions/MavenActionSupport.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008-2010 Sonatype, Inc. + * Copyright (c) 2008, 2019 Sonatype, Inc. * 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 @@ -27,12 +27,12 @@ import org.eclipse.ui.IObjectActionDelegate; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.IWorkbenchPart; import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PlatformUI; import org.eclipse.m2e.core.MavenPlugin; import org.eclipse.m2e.core.embedder.ArtifactKey; import org.eclipse.m2e.core.embedder.ArtifactRef; import org.eclipse.m2e.core.project.IMavenProjectFacade; -import org.eclipse.m2e.core.ui.internal.M2EUIPluginActivator; /** @@ -83,7 +83,7 @@ public abstract class MavenActionSupport implements IObjectActionDelegate { return shell; } - IWorkbench workbench = M2EUIPluginActivator.getDefault().getWorkbench(); + IWorkbench workbench = PlatformUI.getWorkbench(); if(workbench == null) { return null; } diff --git a/org.eclipse.m2e.launching/src/org/eclipse/m2e/actions/ExecutePomAction.java b/org.eclipse.m2e.launching/src/org/eclipse/m2e/actions/ExecutePomAction.java index d935ea21..80d7b257 100644 --- a/org.eclipse.m2e.launching/src/org/eclipse/m2e/actions/ExecutePomAction.java +++ b/org.eclipse.m2e.launching/src/org/eclipse/m2e/actions/ExecutePomAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008-2018 Sonatype, Inc. and others. + * Copyright (c) 2008, 2019 Sonatype, 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 @@ -55,6 +55,7 @@ import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.IEditorInput; import org.eclipse.ui.IEditorPart; import org.eclipse.ui.IFileEditorInput; +import org.eclipse.ui.PlatformUI; import org.eclipse.ui.dialogs.ElementListSelectionDialog; import org.eclipse.m2e.core.MavenPlugin; @@ -62,7 +63,6 @@ import org.eclipse.m2e.core.internal.IMavenConstants; import org.eclipse.m2e.core.project.IMavenProjectFacade; import org.eclipse.m2e.core.project.IMavenProjectRegistry; import org.eclipse.m2e.core.project.ResolverConfiguration; -import org.eclipse.m2e.core.ui.internal.M2EUIPluginActivator; import org.eclipse.m2e.internal.launch.LaunchingUtils; import org.eclipse.m2e.internal.launch.Messages; import org.eclipse.m2e.ui.internal.launch.MavenLaunchMainTab; @@ -161,7 +161,7 @@ public class ExecutePomAction implements ILaunchShortcut, IExecutableExtension { } private Shell getShell() { - return M2EUIPluginActivator.getDefault().getWorkbench().getActiveWorkbenchWindow().getShell(); + return PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); } private IContainer findPomXmlBasedir(IContainer dir) { diff --git a/org.eclipse.m2e.scm/src/org/eclipse/m2e/scm/internal/actions/CheckoutAsMavenAction.java b/org.eclipse.m2e.scm/src/org/eclipse/m2e/scm/internal/actions/CheckoutAsMavenAction.java index d5c70b58..c1d4146f 100644 --- a/org.eclipse.m2e.scm/src/org/eclipse/m2e/scm/internal/actions/CheckoutAsMavenAction.java +++ b/org.eclipse.m2e.scm/src/org/eclipse/m2e/scm/internal/actions/CheckoutAsMavenAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008-2010 Sonatype, Inc. + * Copyright (c) 2008, 2019 Sonatype, Inc. * 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 @@ -22,8 +22,8 @@ import org.eclipse.ui.IObjectActionDelegate; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.IWorkbenchPart; import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PlatformUI; -import org.eclipse.m2e.core.ui.internal.M2EUIPluginActivator; import org.eclipse.m2e.scm.ScmUrl; import org.eclipse.m2e.scm.internal.wizards.MavenCheckoutWizard; @@ -39,9 +39,6 @@ public class CheckoutAsMavenAction implements IObjectActionDelegate { private IWorkbenchPart targetPart; - /* (non-Javadoc) - * @see org.eclipse.ui.actions.ActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection) - */ public void selectionChanged(IAction action, ISelection selection) { if(selection instanceof IStructuredSelection) { this.selection = (IStructuredSelection) selection; @@ -52,9 +49,6 @@ public class CheckoutAsMavenAction implements IObjectActionDelegate { this.targetPart = targetPart; } - /* (non-Javadoc) - * @see org.eclipse.ui.actions.ActionDelegate#run(org.eclipse.jface.action.IAction) - */ public void run(IAction action) { ScmUrl[] urls = null; if(selection != null) { @@ -79,7 +73,7 @@ public class CheckoutAsMavenAction implements IObjectActionDelegate { return shell; } - IWorkbench workbench = M2EUIPluginActivator.getDefault().getWorkbench(); + IWorkbench workbench = PlatformUI.getWorkbench(); if(workbench == null) { return null; } -- cgit v1.2.3