Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2015-12-02 04:57:07 -0500
committerAlexander Kurtakov2015-12-02 04:59:32 -0500
commite061d9788178d2d7648165cf8d10d4570f32f606 (patch)
treeef6868cea6b0cb863dadc31aed805c0e1ec4cfe1 /build/org.eclipse.cdt.autotools.core/src
parent77c74a26caa0b9f21298575c432182e8f6af8dd1 (diff)
downloadorg.eclipse.cdt-e061d9788178d2d7648165cf8d10d4570f32f606.tar.gz
org.eclipse.cdt-e061d9788178d2d7648165cf8d10d4570f32f606.tar.xz
org.eclipse.cdt-e061d9788178d2d7648165cf8d10d4570f32f606.zip
autotools: Sanitize activators.
Reduce coupling by changing UI bundle to use UI activator and drop UI getters (e.g. workbench, window, shell) from the core bundle. Also remove other unused methods. Change-Id: Ida510d5a0e991c08332a998aefaba5843743172a Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
Diffstat (limited to 'build/org.eclipse.cdt.autotools.core/src')
-rw-r--r--build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/autotools/core/AutotoolsPlugin.java113
-rw-r--r--build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/configure/AutotoolsConfigurationManager.java2
2 files changed, 1 insertions, 114 deletions
diff --git a/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/autotools/core/AutotoolsPlugin.java b/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/autotools/core/AutotoolsPlugin.java
index f488382058..29ef764490 100644
--- a/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/autotools/core/AutotoolsPlugin.java
+++ b/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/autotools/core/AutotoolsPlugin.java
@@ -22,19 +22,12 @@ import org.eclipse.cdt.managedbuilder.core.IManagedProject;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.cdt.managedbuilder.core.ManagedCProjectNature;
import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
@@ -110,17 +103,6 @@ public class AutotoolsPlugin extends AbstractUIPlugin {
}
/**
- * Returns active shell.
- */
- public static Shell getActiveWorkbenchShell() {
- IWorkbenchWindow window = getDefault().getWorkbench().getActiveWorkbenchWindow();
- if (window != null) {
- return window.getShell();
- }
- return null;
- }
-
- /**
* Returns the string from the plugin's resource bundle,
* or 'key' if not found.
*
@@ -181,17 +163,6 @@ public class AutotoolsPlugin extends AbstractUIPlugin {
return false;
}
- /**
- * Returns an image descriptor for the image file at the given
- * plug-in relative path.
- *
- * @param path the path
- * @return the image descriptor
- */
- public static ImageDescriptor getImageDescriptor(String path) {
- return AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, path);
- }
-
public static void log(IStatus status) {
ResourcesPlugin.getPlugin().getLog().log(status);
}
@@ -200,33 +171,6 @@ public class AutotoolsPlugin extends AbstractUIPlugin {
log(new Status(IStatus.ERROR, getUniqueIdentifier(), IStatus.ERROR, message, null));
}
- public static void logException(Throwable e, final String title, String message) {
- if (e instanceof InvocationTargetException) {
- e = ((InvocationTargetException) e).getTargetException();
- }
- IStatus status = null;
- if (e instanceof CoreException)
- status = ((CoreException) e).getStatus();
- else {
- if (message == null)
- message = e.getMessage();
- if (message == null)
- message = e.toString();
- status = new Status(IStatus.ERROR, getUniqueIdentifier(), IStatus.OK, message, e);
- }
- ResourcesPlugin.getPlugin().getLog().log(status);
- Display display;
- display = Display.getCurrent();
- if (display == null)
- display = Display.getDefault();
- final IStatus fstatus = status;
- display.asyncExec(() -> ErrorDialog.openError(null, title, null, fstatus));
- }
-
- public static void logException(Throwable e) {
- logException(e, null, null);
- }
-
public static void log(Throwable e) {
if (e instanceof InvocationTargetException)
e = ((InvocationTargetException) e).getTargetException();
@@ -239,63 +183,6 @@ public class AutotoolsPlugin extends AbstractUIPlugin {
}
/**
- * Utility method with conventions
- */
- public static void errorDialog(Shell shell, String title, String message, IStatus s) {
- log(s);
- // if the 'message' resource string and the IStatus' message are the same,
- // don't show both in the dialog
- if (s != null && message.equals(s.getMessage())) {
- message = null;
- }
- ErrorDialog.openError(shell, title, message, s);
- }
-
- /**
- * Utility method with conventions
- */
- public static void errorDialog(Shell shell, String title, String message, Throwable t) {
- log(t);
- IStatus status;
- if (t instanceof CoreException) {
- status = ((CoreException) t).getStatus();
- // if the 'message' resource string and the IStatus' message are the same,
- // don't show both in the dialog
- if (status != null && message.equals(status.getMessage())) {
- message = null;
- }
- } else {
- status = new Status(IStatus.ERROR, AutotoolsPlugin.getUniqueIdentifier(), -1, "Internal Error: ", t); //$NON-NLS-1$
- }
- ErrorDialog.openError(shell, title, message, status);
- }
-
- /**
- * Returns the workspace instance.
- */
- public static IWorkspace getWorkspace() {
- return ResourcesPlugin.getWorkspace();
- }
-
- /**
- * Returns the active workbench window or <code>null</code> if none
- */
- public static IWorkbenchWindow getActiveWorkbenchWindow() {
- return getDefault().getWorkbench().getActiveWorkbenchWindow();
- }
-
- /**
- * Returns the active workbench page or <code>null</code> if none.
- */
- public static IWorkbenchPage getActivePage() {
- IWorkbenchWindow window= getActiveWorkbenchWindow();
- if (window != null) {
- return window.getActivePage();
- }
- return null;
- }
-
- /**
* Return set of Autotool configuration options for a given build configuration id.
*
* @param project existing autotools project
diff --git a/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/configure/AutotoolsConfigurationManager.java b/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/configure/AutotoolsConfigurationManager.java
index e82d0ebfea..d52afd0468 100644
--- a/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/configure/AutotoolsConfigurationManager.java
+++ b/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/configure/AutotoolsConfigurationManager.java
@@ -86,7 +86,7 @@ public class AutotoolsConfigurationManager implements IResourceChangeListener {
private AutotoolsConfigurationManager() {
configs = new HashMap<>();
tmpConfigs = new HashMap<>();
- AutotoolsPlugin.getWorkspace().addResourceChangeListener(this);
+ ResourcesPlugin.getWorkspace().addResourceChangeListener(this);
}
public static AutotoolsConfigurationManager getInstance() {

Back to the top