Commit db6b33ef authored by Kristof Szabados's avatar Kristof Szabados
Browse files

static fields should be written through static functions and in similar way in every plug-in.


Signed-off-by: Kristof Szabados's avatarkristof <Kristof.Szabados@ericsson.com>
parent 0c3e586a
......@@ -29,7 +29,7 @@ public final class Activator extends AbstractUIPlugin {
private WorkspaceJob usageStatSenderJob;
public Activator() {
plugin = this;
setDefault(this);
}
@Override
......@@ -42,13 +42,25 @@ public final class Activator extends AbstractUIPlugin {
@Override
public void stop(final BundleContext context) throws Exception {
plugin = null;
setDefault(null);
if (usageStatSenderJob != null) {
usageStatSenderJob.cancel();
}
super.stop(context);
}
/**
* Sets the default singleton instance of this plug-in,
* that later can be used to access plug-in specific preference settings.
*
* @param activator the single instance of this plug-in class.
* */
private static void setDefault(final Activator activator) {
if (plugin == null) {
plugin = activator;
}
}
/**
* Returns the shared instance.
*
......
......@@ -241,7 +241,7 @@ public final class Activator extends AbstractUIPlugin {
* The constructor.
*/
public Activator() {
plugin = this;
setDefault(this);
}
/**
......@@ -503,11 +503,23 @@ public final class Activator extends AbstractUIPlugin {
final IWorkspace workspace = ResourcesPlugin.getWorkspace();
workspace.removeResourceChangeListener(listener);
workspace.removeResourceChangeListener(decoratorUpdater);
plugin = null;
setDefault(null);
super.stop(context);
}
/**
* Sets the default singleton instance of this plug-in,
* that later can be used to access plug-in specific preference settings.
*
* @param activator the single instance of this plug-in class.
* */
private static void setDefault(final Activator activator) {
if (plugin == null) {
plugin = activator;
}
}
/**
* Returns the shared instance.
*
......
......@@ -25,16 +25,28 @@ public final class Activator extends AbstractUIPlugin {
private static ExecutorMonitorView mainView = null;
public Activator() {
plugin = this;
setDefault(this);
}
@Override
public void stop(final BundleContext context) throws Exception {
plugin = null;
setDefault(null);
super.stop(context);
}
/**
* Sets the default singleton instance of this plug-in,
* that later can be used to access plug-in specific preference settings.
*
* @param activator the single instance of this plug-in class.
* */
private static void setDefault(final Activator activator) {
if (plugin == null) {
plugin = activator;
}
}
/**
* Returns the shared instance.
*
......
......@@ -53,7 +53,7 @@ public class Activator extends AbstractUIPlugin {
* The constructor
*/
public Activator() {
plugin = this;
setDefault(this);
this.imageCache = new HashMap<String, Image>();
this.guiResourceCache = new HashMap<String, Resource>();
}
......@@ -82,7 +82,7 @@ public class Activator extends AbstractUIPlugin {
PreferencesHandler prefHandler = PreferencesHandler.getInstance();
prefHandler.removeListener();
prefHandler.dispose();
plugin = null;
setDefault(null);
disposeImages();
disposeGUIResources();
......@@ -93,6 +93,18 @@ public class Activator extends AbstractUIPlugin {
super.stop(context);
}
/**
* Sets the default singleton instance of this plug-in,
* that later can be used to access plug-in specific preference settings.
*
* @param activator the single instance of this plug-in class.
* */
private static void setDefault(final Activator activator) {
if (plugin == null) {
plugin = activator;
}
}
/**
* Returns the shared instance
*
......
......@@ -24,20 +24,32 @@ public class Activator extends AbstractUIPlugin {
private static Activator plugin;
public Activator() {
setDefault(this);
}
@Override
public void start(final BundleContext context) throws Exception {
plugin = this;
super.start(context);
}
@Override
public void stop(final BundleContext context) throws Exception {
plugin = null;
setDefault(null);
super.stop(context);
}
/**
* Sets the default singleton instance of this plug-in,
* that later can be used to access plug-in specific preference settings.
*
* @param activator the single instance of this plug-in class.
* */
private static void setDefault(final Activator activator) {
if (plugin == null) {
plugin = activator;
}
}
/**
* Returns the shared instance
*
......
......@@ -27,7 +27,7 @@ public class Activator extends AbstractUIPlugin {
* The constructor
*/
public Activator() {
plugin = this;
setDefault(this);
}
@Override
......@@ -43,10 +43,22 @@ public class Activator extends AbstractUIPlugin {
* )
*/
@Override
public void stop(final BundleContext context) throws Exception {
plugin = null;
public void stop(final BundleContext context) throws Exception {
setDefault(null);
super.stop(context);
}
/**
* Sets the default singleton instance of this plug-in,
* that later can be used to access plug-in specific preference settings.
*
* @param activator the single instance of this plug-in class.
* */
private static void setDefault(final Activator activator) {
if (plugin == null) {
plugin = activator;
}
}
/**
* Returns the shared instance
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment