1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-04 06:45:43 +02:00

Added a constructor (was silently inheriting from super class)

This commit is contained in:
Sean Evoy 2004-05-20 14:57:43 +00:00
parent 9dec664073
commit 729d4c2fcb

View file

@ -31,6 +31,18 @@ public class ManagedBuilderUIPlugin extends AbstractUIPlugin {
// Unique ID of the plugin // Unique ID of the plugin
private static final String PLUGIN_ID = "org.eclipse.cdt.managedbuilder.ui"; //$NON-NLS-1$ private static final String PLUGIN_ID = "org.eclipse.cdt.managedbuilder.ui"; //$NON-NLS-1$
/**
* The constructor
*/
public ManagedBuilderUIPlugin() {
super();
plugin = this;
}
/**
* @return
*/
public static Shell getActiveWorkbenchShell() { public static Shell getActiveWorkbenchShell() {
IWorkbenchWindow window = getActiveWorkbenchWindow(); IWorkbenchWindow window = getActiveWorkbenchWindow();
if (window != null) { if (window != null) {
@ -47,26 +59,12 @@ public class ManagedBuilderUIPlugin extends AbstractUIPlugin {
} }
/** /**
* Returns the shared instance. * Returns the singleton instance of the plugin
*/ */
public static ManagedBuilderUIPlugin getDefault() { public static ManagedBuilderUIPlugin getDefault() {
return plugin; return plugin;
} }
/**
* Answers the <code>Shell</code> associated with the active workbench, or
* one of the windows associated with the workbench.
* @return
*/
public Shell getShell() {
if (getActiveWorkbenchShell() != null) {
return getActiveWorkbenchShell();
} else {
IWorkbenchWindow[] windows = getDefault().getWorkbench().getWorkbenchWindows();
return windows[0].getShell();
}
}
/** /**
* Convenience method which returns the unique identifier of this plugin. * Convenience method which returns the unique identifier of this plugin.
*/ */
@ -108,6 +106,14 @@ public class ManagedBuilderUIPlugin extends AbstractUIPlugin {
ErrorDialog.openError(shell, title, message, status); ErrorDialog.openError(shell, title, message, status);
} }
/**
* @return
*/
public static IWorkspace getWorkspace() {
return ResourcesPlugin.getWorkspace();
}
/** /**
* Convenience method to log an exception without displaying a * Convenience method to log an exception without displaying a
* message dialog * message dialog
@ -150,10 +156,18 @@ public class ManagedBuilderUIPlugin extends AbstractUIPlugin {
} }
/** /**
* Answers the <code>Shell</code> associated with the active workbench, or
* one of the windows associated with the workbench.
* @return * @return
*/ */
public static IWorkspace getWorkspace() { public Shell getShell() {
return ResourcesPlugin.getWorkspace(); if (getActiveWorkbenchShell() != null) {
return getActiveWorkbenchShell();
} else {
IWorkbenchWindow[] windows = getDefault().getWorkbench().getWorkbenchWindows();
return windows[0].getShell();
}
} }
} }