@@ -0,0 +1,35 @@
/**
* Aptana Studio
* Copyright (c) 2005-2012 by Appcelerator, Inc. All Rights Reserved.
* Licensed under the terms of the GNU Public License (GPL) v3 (with exceptions).
* Please see the license.html included with this distribution for details.
* Any modifications to this file must keep this entire header intact.
*/
package com.aptana.git.ui.internal;

import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.graphics.ImageData;

/**
* Define a cached image descriptor which only creates the image data once
*/
public class CachedImageDescriptor extends ImageDescriptor
{
ImageDescriptor descriptor;

ImageData data;

public CachedImageDescriptor(ImageDescriptor descriptor)
{
this.descriptor = descriptor;
}

public ImageData getImageData()
{
if (data == null)
{
data = descriptor.getImageData();
}
return data;
}
}
@@ -1,6 +1,6 @@
/**
* Aptana Studio
* Copyright (c) 2005-2011 by Appcelerator, Inc. All Rights Reserved.
* Copyright (c) 2005-2012 by Appcelerator, Inc. All Rights Reserved.
* Licensed under the terms of the GNU Public License (GPL) v3 (with exceptions).
* Please see the license.html included with this distribution for details.
* Any modifications to this file must keep this entire header intact.
@@ -29,7 +29,6 @@
import org.eclipse.jface.viewers.IDecoration;
import org.eclipse.jface.viewers.ILightweightLabelDecorator;
import org.eclipse.jface.viewers.LabelProviderChangedEvent;
import org.eclipse.swt.graphics.ImageData;
import org.eclipse.swt.widgets.Display;
import org.eclipse.team.ui.ISharedImages;
import org.eclipse.team.ui.TeamImages;
@@ -59,50 +58,16 @@ public class GitLightweightDecorator extends BaseLabelProvider implements ILight
IGitRepositoryListener, IGitRepositoriesListener
{

public static final String UNTRACKED_IMAGE = "icons/ovr/untracked.gif"; //$NON-NLS-1$
public static final String STAGED_ADDED_IMAGE = "icons/ovr/staged_added.gif"; //$NON-NLS-1$
public static final String STAGED_REMOVED_IMAGE = "icons/ovr/staged_removed.gif"; //$NON-NLS-1$

private static final String DIRTY_PREFIX = "* "; //$NON-NLS-1$
private static final String DECORATOR_ID = "com.aptana.git.ui.internal.GitLightweightDecorator"; //$NON-NLS-1$

/**
* Define a cached image descriptor which only creates the image data once
*/
private static class CachedImageDescriptor extends ImageDescriptor
{
ImageDescriptor descriptor;

ImageData data;

CachedImageDescriptor(ImageDescriptor descriptor)
{
this.descriptor = descriptor;
}

public ImageData getImageData()
{
if (data == null)
{
data = descriptor.getImageData();
}
return data;
}
}

private static ImageDescriptor conflictImage;
private static ImageDescriptor untrackedImage;
private static ImageDescriptor stagedAddedImage;
private static ImageDescriptor stagedRemovedImage;
private static UIJob refreshJob;

static
{
conflictImage = new CachedImageDescriptor(TeamImages.getImageDescriptor(ISharedImages.IMG_CONFLICT_OVR));
untrackedImage = new CachedImageDescriptor(ImageDescriptor.createFromURL(GitUIPlugin.getDefault().getBundle()
.getEntry("icons/ovr/untracked.gif"))); //$NON-NLS-1$
stagedAddedImage = new CachedImageDescriptor(ImageDescriptor.createFromURL(GitUIPlugin.getDefault().getBundle()
.getEntry("icons/ovr/staged_added.gif"))); //$NON-NLS-1$
stagedRemovedImage = new CachedImageDescriptor(ImageDescriptor.createFromURL(GitUIPlugin.getDefault()
.getBundle().getEntry("icons/ovr/staged_removed.gif"))); //$NON-NLS-1$
}

private IPreferenceChangeListener fThemeChangeListener;
private Map<RepoBranch, TimestampedString> cache;

@@ -209,11 +174,11 @@ private void decorateFile(IDecoration decoration, final IResource resource)
decoration.setBackgroundColor(GitColors.redBG());
if (changed.getStatus() == ChangedFile.Status.NEW)
{
overlay = untrackedImage;
overlay = untrackedImage();
}
else if (changed.getStatus() == ChangedFile.Status.UNMERGED)
{
overlay = conflictImage;
overlay = conflictImage();
}
}
else if (changed.hasStagedChanges())
@@ -222,18 +187,42 @@ else if (changed.hasStagedChanges())
decoration.setBackgroundColor(GitColors.greenBG());
if (changed.getStatus() == ChangedFile.Status.DELETED)
{
overlay = stagedRemovedImage;
overlay = stagedRemovedImage();
}
else if (changed.getStatus() == ChangedFile.Status.NEW)
{
overlay = stagedAddedImage;
overlay = stagedAddedImage();
}
}
decoration.addPrefix(DIRTY_PREFIX);
if (overlay != null)
decoration.addOverlay(overlay);
}

private ImageDescriptor conflictImage()
{
if (conflictImage == null)
{
conflictImage = new CachedImageDescriptor(TeamImages.getImageDescriptor(ISharedImages.IMG_CONFLICT_OVR));
}
return conflictImage;
}

private ImageDescriptor stagedRemovedImage()
{
return GitUIPlugin.getDefault().getImageRegistry().getDescriptor(STAGED_REMOVED_IMAGE);
}

private ImageDescriptor stagedAddedImage()
{
return GitUIPlugin.getDefault().getImageRegistry().getDescriptor(STAGED_ADDED_IMAGE);
}

private ImageDescriptor untrackedImage()
{
return GitUIPlugin.getDefault().getImageRegistry().getDescriptor(UNTRACKED_IMAGE);
}

private void decorateProject(IDecoration decoration, final IResource resource)
{
GitRepository repo = getRepo(resource);
@@ -52,6 +52,7 @@
private List<String> _loadPaths;
private List<String> _frameworkFiles;
private RunType _runType;
private boolean initialized;

/**
* ScriptingEngine
@@ -93,12 +94,12 @@ private ScriptingContainer createScriptingContainer(LocalContextScope scope)

result.setHomeDirectory(jrubyHome.getAbsolutePath());

// TODO Generate two containers? A global one for loading bundles, a threadsafe one for executing commands/snippets/etc?
// TODO Generate two containers? A global one for loading bundles, a threadsafe one for executing
// commands/snippets/etc?
// Pre-load 'ruble' framework files!
List<String> loadPaths = result.getLoadPaths();
loadPaths.addAll(0, getContributedLoadPaths());
result.setLoadPaths(loadPaths);
result.runScriptlet("require 'ruble'"); //$NON-NLS-1$
}
catch (IOException e)
{
@@ -167,8 +168,7 @@ public Set<String> getSupportElementNames()
}

/**
* getFrameworkFiles
* Used by "ruble.rb" DO NOT REMOVE!
* getFrameworkFiles Used by "ruble.rb" DO NOT REMOVE!
*
* @return
*/
@@ -283,4 +283,15 @@ public Object runScript(String fullPath, List<String> loadPaths, RunType runType

return (async && this._runType != RunType.CURRENT_THREAD) ? null : job.getReturnValue();
}

public synchronized ScriptingContainer getInitializedScriptingContainer()
{
ScriptingContainer sc = getScriptingContainer();
if (!initialized)
{
sc.runScriptlet("require 'ruble'"); //$NON-NLS-1$
initialized = true;
}
return sc;
}
}
@@ -606,7 +606,8 @@ void populateEnvironment(Map<String, Object> contextMap, Map<String, String> env

if (rubyObject.respondsTo(TO_ENV_METHOD_NAME))
{
Ruby runtime = ScriptingEngine.getInstance().getScriptingContainer().getRuntime();
Ruby runtime = ScriptingEngine.getInstance().getInitializedScriptingContainer().getProvider()
.getRuntime();
ThreadContext threadContext = runtime.getCurrentContext();

try
@@ -73,7 +73,7 @@ public Object getReturnValue()
*/
protected IStatus run(IProgressMonitor monitor)
{
ScriptingContainer container = ScriptingEngine.getInstance().getScriptingContainer();
ScriptingContainer container = ScriptingEngine.getInstance().getInitializedScriptingContainer();
Ruby runtime = container.getProvider().getRuntime();
Object result = null;

@@ -1,6 +1,6 @@
/**
* Aptana Studio
* Copyright (c) 2005-2011 by Appcelerator, Inc. All Rights Reserved.
* Copyright (c) 2005-2012 by Appcelerator, Inc. All Rights Reserved.
* Licensed under the terms of the GNU Public License (GPL) v3 (with exceptions).
* Please see the license.html included with this distribution for details.
* Any modifications to this file must keep this entire header intact.
@@ -15,11 +15,17 @@
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Plugin;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.osgi.framework.BundleContext;

import com.aptana.core.CorePlugin;
import com.aptana.core.logging.IdeLog;
import com.aptana.core.util.EclipseUtil;

/**
* The activator class controls the plug-in life cycle
@@ -50,55 +56,79 @@ public void start(BundleContext context) throws Exception
super.start(context);
plugin = this;

ISavedState lastState = ResourcesPlugin.getWorkspace().addSaveParticipant(this, new WorkspaceSaveParticipant());
if (lastState != null)
Job job = new Job("Initializing Syncing plugin") //$NON-NLS-1$
{
IPath location = lastState.lookup(new Path(SiteConnectionManager.STATE_FILENAME));
if (location != null)
protected IStatus run(IProgressMonitor monitor)
{
SiteConnectionManager.getInstance().loadState(getStateLocation().append(location));
}
location = lastState.lookup(new Path(DefaultSiteConnection.STATE_FILENAME));
if (location != null)
{
DefaultSiteConnection.getInstance().loadState(getStateLocation().append(location));
}
}

// For 1.5 compatibility
lastState = ResourcesPlugin.getWorkspace().addSaveParticipant(CorePlugin.getDefault(), new ISaveParticipant()
{

public void doneSaving(ISaveContext context)
{
}

public void prepareToSave(ISaveContext context) throws CoreException
{
}

public void rollback(ISaveContext context)
{
}

public void saving(ISaveContext context) throws CoreException
{
}
});
if (lastState != null)
{
IPath location = lastState.lookup(new Path("save")); //$NON-NLS-1$
if (location != null)
{
IPath absoluteLocation = CorePlugin.getDefault().getStateLocation().append(location);
// only loads it once
SiteConnectionManager.getInstance().loadState(absoluteLocation);
File file = absoluteLocation.toFile();
if (!file.renameTo(new File(absoluteLocation.toOSString() + ".bak"))) { //$NON-NLS-1$
file.delete();
try
{
ISavedState lastState = ResourcesPlugin.getWorkspace().addSaveParticipant(getDefault(),
new WorkspaceSaveParticipant());
if (lastState != null)
{
IPath location = lastState.lookup(new Path(SiteConnectionManager.STATE_FILENAME));
if (location != null)
{
SiteConnectionManager.getInstance().loadState(getStateLocation().append(location));
}
location = lastState.lookup(new Path(DefaultSiteConnection.STATE_FILENAME));
if (location != null)
{
DefaultSiteConnection.getInstance().loadState(getStateLocation().append(location));
}
}

// For 1.5 compatibility
lastState = ResourcesPlugin.getWorkspace().addSaveParticipant(CorePlugin.getDefault(),
new ISaveParticipant()
{

public void doneSaving(ISaveContext context)
{
}

public void prepareToSave(ISaveContext context) throws CoreException
{
}

public void rollback(ISaveContext context)
{
}

public void saving(ISaveContext context) throws CoreException
{
}
});
if (lastState != null)
{
IPath location = lastState.lookup(new Path("save")); //$NON-NLS-1$
if (location != null)
{
IPath absoluteLocation = CorePlugin.getDefault().getStateLocation().append(location);
// only loads it once
SiteConnectionManager.getInstance().loadState(absoluteLocation);
File file = absoluteLocation.toFile();
if (!file.renameTo(new File(absoluteLocation.toOSString() + ".bak"))) { //$NON-NLS-1$
file.delete();
}
}
}
}
catch (IllegalStateException e)
{
IdeLog.logError(getDefault(), e);
}
catch (CoreException e)
{
IdeLog.logError(getDefault(), e);
}

return Status.OK_STATUS;
}
}
};
job.setSystem(!EclipseUtil.showSystemJobs());
job.schedule();
}

/*
@@ -1,6 +1,6 @@
/**
* Aptana Studio
* Copyright (c) 2005-2011 by Appcelerator, Inc. All Rights Reserved.
* Copyright (c) 2005-2012 by Appcelerator, Inc. All Rights Reserved.
* Licensed under the terms of the GNU Public License (GPL) v3 (with exceptions).
* Please see the license.html included with this distribution for details.
* Any modifications to this file must keep this entire header intact.
@@ -14,6 +14,7 @@

import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.SubMonitor;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
@@ -70,6 +71,7 @@
import org.eclipse.ui.views.contentoutline.ContentOutline;
import org.eclipse.ui.views.navigator.IResourceNavigator;
import org.eclipse.ui.views.properties.PropertySheet;
import org.osgi.framework.Bundle;
import org.osgi.framework.Version;
import org.osgi.service.prefs.BackingStoreException;

@@ -95,6 +97,14 @@ public class InvasiveThemeHijacker extends UIJob implements IPartListener2, IPre
IPageChangedListener
{

/**
* Constants of eclipse plugin/bundle ids and their root preference nodes.
*/
private static final String ORG_ECLIPSE_WST_JSDT_UI = "org.eclipse.wst.jsdt.ui"; //$NON-NLS-1$
private static final String ORG_ECLIPSE_JDT_UI = "org.eclipse.jdt.ui"; //$NON-NLS-1$
private static final String ORG_ECLIPSE_ANT_UI = "org.eclipse.ant.ui"; //$NON-NLS-1$
private static final String ORG_ECLIPSE_PDE_UI = "org.eclipse.pde.ui"; //$NON-NLS-1$

private ISelectionChangedListener pageListener;
private Map<IViewPart, IQueryListener> queryListeners = new HashMap<IViewPart, IQueryListener>(3);
private boolean fIsPartListener;
@@ -540,6 +550,7 @@ protected void applyThemeToEclipseEditors(Theme theme, boolean revertToDefaults,
setHyperlinkValues(theme, EclipseUtil.instanceScope().getNode("org.eclipse.ui.workbench"), revertToDefaults); //$NON-NLS-1$
setHyperlinkValues(theme, EclipseUtil.instanceScope().getNode(ThemePlugin.PLUGIN_ID), revertToDefaults);

// FIXME only set these if egit or mercurial are installed!
setGitAndMercurialValues(theme,
EclipseUtil.instanceScope().getNode("org.eclipse.ui.workbench"), revertToDefaults); //$NON-NLS-1$

@@ -553,30 +564,45 @@ protected void applyThemeToEclipseEditors(Theme theme, boolean revertToDefaults,
}

// PDE
IEclipsePreferences pdePrefs = EclipseUtil.instanceScope().getNode("org.eclipse.pde.ui"); //$NON-NLS-1$
setGeneralEditorValues(theme, pdePrefs, revertToDefaults);
setPDEEditorValues(theme, pdePrefs, revertToDefaults);
Bundle pde = Platform.getBundle(ORG_ECLIPSE_PDE_UI);
if (pde != null)
{
IEclipsePreferences pdePrefs = EclipseUtil.instanceScope().getNode(ORG_ECLIPSE_PDE_UI);
setGeneralEditorValues(theme, pdePrefs, revertToDefaults);
setPDEEditorValues(theme, pdePrefs, revertToDefaults);
}

if (monitor.isCanceled())
{
return;
}

// Ant
IEclipsePreferences antPrefs = EclipseUtil.instanceScope().getNode("org.eclipse.ant.ui"); //$NON-NLS-1$
setGeneralEditorValues(theme, antPrefs, revertToDefaults);
setAntEditorValues(theme, antPrefs, revertToDefaults);

Bundle ant = Platform.getBundle(ORG_ECLIPSE_ANT_UI);
if (ant != null)
{
IEclipsePreferences antPrefs = EclipseUtil.instanceScope().getNode(ORG_ECLIPSE_ANT_UI);
setGeneralEditorValues(theme, antPrefs, revertToDefaults);
setAntEditorValues(theme, antPrefs, revertToDefaults);
}
if (monitor.isCanceled())
{
return;
}

// JDT
applyThemetoJDT(theme, revertToDefaults);
Bundle jdt = Platform.getBundle(ORG_ECLIPSE_JDT_UI);
if (jdt != null)
{
applyThemetoJDT(theme, revertToDefaults);
}

// WST
applyThemetoWST(theme, revertToDefaults);
Bundle wstBundle = Platform.getBundle(ORG_ECLIPSE_WST_JSDT_UI);
if (wstBundle != null)
{
applyThemetoWST(theme, revertToDefaults);
}
}

protected void applyThemetoWST(Theme theme, boolean revertToDefaults)
@@ -621,7 +647,7 @@ private void applyToWST_HTMLEditor(Theme theme, boolean revertToDefaults)

protected void applyToWST_JSDTEditor(Theme theme, boolean revertToDefaults)
{
IEclipsePreferences prefs = EclipseUtil.instanceScope().getNode("org.eclipse.wst.jsdt.ui"); //$NON-NLS-1$
IEclipsePreferences prefs = EclipseUtil.instanceScope().getNode(ORG_ECLIPSE_WST_JSDT_UI);
setGeneralEditorValues(theme, prefs, revertToDefaults);

// TODO Add mapping for parameter variables, "functions" (which might be function calls)?
@@ -733,7 +759,7 @@ protected void applyToWST_XMLEditor(Theme theme, boolean revertToDefaults)
protected void applyThemetoJDT(Theme theme, boolean revertToDefaults)
{
// Now set for JDT...
IEclipsePreferences prefs = EclipseUtil.instanceScope().getNode("org.eclipse.jdt.ui"); //$NON-NLS-1$
IEclipsePreferences prefs = EclipseUtil.instanceScope().getNode(ORG_ECLIPSE_JDT_UI);
setGeneralEditorValues(theme, prefs, revertToDefaults);

// Set prefs for JDT so it's various tokens get colors that match up to our theme!
@@ -96,45 +96,9 @@ public class IOUIPlugin extends AbstractUIPlugin

private Map<IEditorInput, Job> saveRemoteJobs;

private IConnectionPointListener connectionListener = new IConnectionPointListener()
{

public void connectionPointChanged(ConnectionPointEvent event)
{
IConnectionPoint connection = event.getConnectionPoint();
IConnectionPointManager manager = CoreIOPlugin.getConnectionPointManager();
ConnectionPointType type = manager.getType(connection);
if (type == null)
{
return;
}

switch (event.getKind())
{
case ConnectionPointEvent.POST_ADD:
refreshNavigatorViewAndSelect(manager.getConnectionPointCategory(type.getCategory().getId()),
connection);
break;
case ConnectionPointEvent.POST_DELETE:
refreshNavigatorView(manager.getConnectionPointCategory(type.getCategory().getId()));
break;
case ConnectionPointEvent.POST_CHANGE:
refreshNavigatorView(connection);
}
}

};
private IConnectionPointListener connectionListener;

private IPreferenceChangeListener themeChangeListener = new IPreferenceChangeListener()
{
public void preferenceChange(PreferenceChangeEvent event)
{
if (event.getKey().equals(IThemeManager.THEME_CHANGED))
{
ImageUtils.themeChanged();
}
}
};
private IPreferenceChangeListener themeChangeListener;

private final IPartListener fPartListener = new IPartListener()
{
@@ -227,19 +191,82 @@ public void start(BundleContext context) throws Exception
{
super.start(context);
plugin = this;
saveRemoteJobs = new HashMap<IEditorInput, Job>();
CoreIOPlugin.getConnectionPointManager().addConnectionPointListener(connectionListener);
EclipseUtil.instanceScope().getNode(ThemePlugin.PLUGIN_ID).addPreferenceChangeListener(themeChangeListener);
addPartListener();
Job job = new Job("Initializing IOUI Plugion") //$NON-NLS-1$
{

@Override
protected IStatus run(IProgressMonitor monitor)
{
connectionListener = new IConnectionPointListener()
{

public void connectionPointChanged(ConnectionPointEvent event)
{
IConnectionPoint connection = event.getConnectionPoint();
IConnectionPointManager manager = CoreIOPlugin.getConnectionPointManager();
ConnectionPointType type = manager.getType(connection);
if (type == null)
{
return;
}

switch (event.getKind())
{
case ConnectionPointEvent.POST_ADD:
refreshNavigatorViewAndSelect(
manager.getConnectionPointCategory(type.getCategory().getId()), connection);
break;
case ConnectionPointEvent.POST_DELETE:
refreshNavigatorView(manager.getConnectionPointCategory(type.getCategory().getId()));
break;
case ConnectionPointEvent.POST_CHANGE:
refreshNavigatorView(connection);
}
}

};
CoreIOPlugin.getConnectionPointManager().addConnectionPointListener(connectionListener);

themeChangeListener = new IPreferenceChangeListener()
{
public void preferenceChange(PreferenceChangeEvent event)
{
if (event.getKey().equals(IThemeManager.THEME_CHANGED))
{
ImageUtils.themeChanged();
}
}
};
EclipseUtil.instanceScope().getNode(ThemePlugin.PLUGIN_ID)
.addPreferenceChangeListener(themeChangeListener);

saveRemoteJobs = new HashMap<IEditorInput, Job>();
addPartListener();

return Status.OK_STATUS;
}

};
job.setSystem(!EclipseUtil.showSystemJobs());
job.schedule();
}

/**
* @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
*/
public void stop(BundleContext context) throws Exception
{
CoreIOPlugin.getConnectionPointManager().removeConnectionPointListener(connectionListener);
EclipseUtil.instanceScope().getNode(ThemePlugin.PLUGIN_ID).removePreferenceChangeListener(themeChangeListener);
if (connectionListener != null)
{
CoreIOPlugin.getConnectionPointManager().removeConnectionPointListener(connectionListener);
connectionListener = null;
}
if (themeChangeListener != null)
{
EclipseUtil.instanceScope().getNode(ThemePlugin.PLUGIN_ID)
.removePreferenceChangeListener(themeChangeListener);
themeChangeListener = null;
}
removePartListener();
if (saveRemoteJobs != null)
{
@@ -1,14 +1,18 @@
/**
* Aptana Studio
* Copyright (c) 2005-2011 by Appcelerator, Inc. All Rights Reserved.
* Copyright (c) 2005-2012 by Appcelerator, Inc. All Rights Reserved.
* Licensed under the terms of the GNU Public License (GPL) v3 (with exceptions).
* Please see the license.html included with this distribution for details.
* Any modifications to this file must keep this entire header intact.
*/
package com.aptana.ui;

import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener;
import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent;
@@ -44,8 +48,8 @@ public class UIPlugin extends AbstractUIPlugin
private IPreferenceChangeListener autoBuildListener;

private final IPerspectiveListener perspectiveListener = new PerspectiveChangeResetListener(
WebPerspectiveFactory.ID, PLUGIN_ID,
IPreferenceConstants.PERSPECTIVE_VERSION, WebPerspectiveFactory.VERSION);
WebPerspectiveFactory.ID, PLUGIN_ID, IPreferenceConstants.PERSPECTIVE_VERSION,
WebPerspectiveFactory.VERSION);

private boolean hasMainWindowActivated = false;

@@ -95,9 +99,20 @@ public void start(BundleContext context) throws Exception
{
super.start(context);
plugin = this;
updateInitialPerspectiveVersion();
addPerspectiveListener();
addAutoBuildListener();

Job job = new Job("Initializing UI Plugin") //$NON-NLS-1$
{
@Override
protected IStatus run(IProgressMonitor monitor)
{
updateInitialPerspectiveVersion();
addPerspectiveListener();
addAutoBuildListener();
return Status.OK_STATUS;
}
};
job.setSystem(!EclipseUtil.showSystemJobs());
job.schedule();
}

/*
@@ -106,10 +121,16 @@ public void start(BundleContext context) throws Exception
*/
public void stop(BundleContext context) throws Exception
{
removePerspectiveListener();
removeAutoBuildListener();
plugin = null;
super.stop(context);
try
{
removePerspectiveListener();
removeAutoBuildListener();
}
finally
{
plugin = null;
super.stop(context);
}
}

/**
@@ -167,6 +188,7 @@ private void removeAutoBuildListener()
{
IEclipsePreferences node = EclipseUtil.instanceScope().getNode(ResourcesPlugin.PI_RESOURCES);
node.removePreferenceChangeListener(autoBuildListener);
autoBuildListener = null;
}
}