Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] CDT UI Warning Clean-up (low hanging fruit)

Folks,

  This patch provides the first step in a warning and 2.0/3.0 deprecated 
function clean-up in the CDT UI plugin.  It catches most of the easy and
low risk changes.  Once these are done, then I can go and make the updates
required for the left over pieces.

Thanks
 Thomas

For the Changelog
- Warning and Deprecated calls clean-up.

Index: plugin.xml
===================================================================
RCS file: /home/tools/org.eclipse.cdt-core/org.eclipse.cdt.ui/plugin.xml,v
retrieving revision 1.97
diff -u -r1.97 plugin.xml
--- plugin.xml	1 Jun 2004 05:13:07 -0000	1.97
+++ plugin.xml	4 Jun 2004 19:51:51 -0000
@@ -790,5 +790,9 @@
          markerType="org.eclipse.cdt.core.indexermarker"
          name="org.eclipse.cdt.ui.indexmarker">
       </type>
+   </extension>
+   <extension
+         point="org.eclipse.core.runtime.preferences">
+      <initializer class="org.eclipse.cdt.ui.CUIPreferenceInitializer"/>
    </extension>
 </plugin>
Index: browser/org/eclipse/cdt/internal/ui/browser/cbrowsing/AppearanceAwareLabelProvider.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt-core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/cbrowsing/AppearanceAwareLabelProvider.java,v
retrieving revision 1.2
diff -u -r1.2 AppearanceAwareLabelProvider.java
--- browser/org/eclipse/cdt/internal/ui/browser/cbrowsing/AppearanceAwareLabelProvider.java	28 May 2004 15:41:35 -0000	1.2
+++ browser/org/eclipse/cdt/internal/ui/browser/cbrowsing/AppearanceAwareLabelProvider.java	4 Jun 2004 19:51:51 -0000
@@ -16,7 +16,6 @@
 import org.eclipse.jface.preference.IPreferenceStore;
 import org.eclipse.jface.util.IPropertyChangeListener;
 import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.jface.viewers.LabelProviderChangedEvent;
 
 /**
  * JavaUILabelProvider that respects settings from the Appearance preference page.
Index: browser/org/eclipse/cdt/internal/ui/browser/cbrowsing/ProblemsLabelDecorator.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt-core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/cbrowsing/ProblemsLabelDecorator.java,v
retrieving revision 1.1
diff -u -r1.1 ProblemsLabelDecorator.java
--- browser/org/eclipse/cdt/internal/ui/browser/cbrowsing/ProblemsLabelDecorator.java	26 May 2004 14:49:48 -0000	1.1
+++ browser/org/eclipse/cdt/internal/ui/browser/cbrowsing/ProblemsLabelDecorator.java	4 Jun 2004 19:51:51 -0000
@@ -10,9 +10,6 @@
  *******************************************************************************/
 package org.eclipse.cdt.internal.ui.browser.cbrowsing;
 
-import java.util.Iterator;
-import java.util.Set;
-
 import org.eclipse.cdt.core.model.CModelException;
 import org.eclipse.cdt.core.model.ICElement;
 import org.eclipse.cdt.core.model.ISourceRange;
@@ -30,12 +27,6 @@
 import org.eclipse.core.resources.IResource;
 import org.eclipse.core.resources.IResourceStatus;
 import org.eclipse.core.runtime.CoreException;
-
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Control;
-
 import org.eclipse.jface.resource.ImageDescriptor;
 import org.eclipse.jface.text.Position;
 import org.eclipse.jface.text.source.Annotation;
@@ -43,11 +34,12 @@
 import org.eclipse.jface.viewers.IBaseLabelProvider;
 import org.eclipse.jface.viewers.IDecoration;
 import org.eclipse.jface.viewers.ILabelDecorator;
-import org.eclipse.jface.viewers.ILabelProvider;
 import org.eclipse.jface.viewers.ILabelProviderListener;
 import org.eclipse.jface.viewers.ILightweightLabelDecorator;
 import org.eclipse.jface.viewers.LabelProviderChangedEvent;
-
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
 import org.eclipse.ui.part.FileEditorInput;
 import org.eclipse.ui.texteditor.MarkerAnnotation;
 
Index: refactor/org/eclipse/cdt/internal/ui/refactoring/RefactoringSaveHelper.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt-core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/ui/refactoring/RefactoringSaveHelper.java,v
retrieving revision 1.2
diff -u -r1.2 RefactoringSaveHelper.java
--- refactor/org/eclipse/cdt/internal/ui/refactoring/RefactoringSaveHelper.java	15 Apr 2004 19:53:04 -0000	1.2
+++ refactor/org/eclipse/cdt/internal/ui/refactoring/RefactoringSaveHelper.java	4 Jun 2004 19:51:51 -0000
@@ -61,7 +61,7 @@
 			description.setAutoBuilding(false);
 			workspace.setDescription(description);
 			try {
-				CUIPlugin.getDefault().getActiveWorkbenchWindow().getWorkbench().saveAllEditors(false);
+				CUIPlugin.getActiveWorkbenchWindow().getWorkbench().saveAllEditors(false);
 				fFilesSaved= true;
 			} finally {
 				description.setAutoBuilding(autoBuild);
@@ -77,7 +77,7 @@
 
 	public void triggerBuild() {
 		if (fFilesSaved && ResourcesPlugin.getWorkspace().getDescription().isAutoBuilding()) {
-			new GlobalBuildAction(CUIPlugin.getDefault().getActiveWorkbenchWindow(), IncrementalProjectBuilder.INCREMENTAL_BUILD).run();
+			new GlobalBuildAction(CUIPlugin.getActiveWorkbenchWindow(), IncrementalProjectBuilder.INCREMENTAL_BUILD).run();
 		}
 	}
 	
Index: refactor/org/eclipse/cdt/internal/ui/refactoring/RefactoringWizardDialog2.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt-core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/ui/refactoring/RefactoringWizardDialog2.java,v
retrieving revision 1.2
diff -u -r1.2 RefactoringWizardDialog2.java
--- refactor/org/eclipse/cdt/internal/ui/refactoring/RefactoringWizardDialog2.java	4 May 2004 15:58:18 -0000	1.2
+++ refactor/org/eclipse/cdt/internal/ui/refactoring/RefactoringWizardDialog2.java	4 Jun 2004 19:51:51 -0000
@@ -25,7 +25,6 @@
 import org.eclipse.jface.dialogs.IMessageProvider;
 import org.eclipse.jface.operation.IRunnableWithProgress;
 import org.eclipse.jface.operation.ModalContext;
-import org.eclipse.jface.resource.ImageDescriptor;
 import org.eclipse.jface.util.Assert;
 import org.eclipse.jface.wizard.IWizardContainer;
 import org.eclipse.jface.wizard.IWizardPage;
Index: src/org/eclipse/cdt/internal/ui/CCompletionContributorManager.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt-core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CCompletionContributorManager.java,v
retrieving revision 1.5
diff -u -r1.5 CCompletionContributorManager.java
--- src/org/eclipse/cdt/internal/ui/CCompletionContributorManager.java	26 Feb 2004 19:30:35 -0000	1.5
+++ src/org/eclipse/cdt/internal/ui/CCompletionContributorManager.java	4 Jun 2004 19:51:52 -0000
@@ -89,14 +89,14 @@
 		fCompletionContributors = new ArrayList(2);
 
 		// populate list
-		IExtensionPoint extensionPoint = Platform.getPluginRegistry().getExtensionPoint(CUIPlugin.PLUGIN_ID, "CCompletionContributor"); //$NON-NLS-1$
+		IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(CUIPlugin.PLUGIN_ID, "CCompletionContributor"); //$NON-NLS-1$
 		if (extensionPoint != null) {
 			IConfigurationElement[] elements = extensionPoint.getConfigurationElements();
 			for (int i = 0; i < elements.length; i++) {
 				if (elements[i].getName().equals("provider")) { //$NON-NLS-1$
 					try {
 						final ICCompletionContributor c;
-						// Instantiate the classe
+						// Instantiate the class
 						c = (ICCompletionContributor) elements[i].createExecutableExtension("class"); //$NON-NLS-1$
 						ISafeRunnable runnable = new ISafeRunnable() {
 							public void run() throws Exception {
Index: src/org/eclipse/cdt/internal/ui/CPluginImages.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt-core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CPluginImages.java,v
retrieving revision 1.46
diff -u -r1.46 CPluginImages.java
--- src/org/eclipse/cdt/internal/ui/CPluginImages.java	28 May 2004 17:10:18 -0000	1.46
+++ src/org/eclipse/cdt/internal/ui/CPluginImages.java	4 Jun 2004 19:51:52 -0000
@@ -27,7 +27,7 @@
 
 	static {
 		try {
-			fgIconBaseURL= new URL(CUIPlugin.getDefault().getDescriptor().getInstallURL(), "icons/" ); //$NON-NLS-1$
+			fgIconBaseURL= new URL(CUIPlugin.getDefault().getBundle().getEntry("/"), "icons/" ); //$NON-NLS-1$
 		} catch (MalformedURLException e) {
 			CUIPlugin.getDefault().log(e);
 		}
Index: src/org/eclipse/cdt/internal/ui/cview/CViewActionGroup.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt-core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/cview/CViewActionGroup.java,v
retrieving revision 1.5
diff -u -r1.5 CViewActionGroup.java
--- src/org/eclipse/cdt/internal/ui/cview/CViewActionGroup.java	5 Apr 2004 04:37:00 -0000	1.5
+++ src/org/eclipse/cdt/internal/ui/cview/CViewActionGroup.java	4 Jun 2004 19:51:52 -0000
@@ -56,9 +56,7 @@
 	protected ImageDescriptor getImageDescriptor(String relativePath) {
 		String iconPath = "icons/full/"; //$NON-NLS-1$
 		try {
-			//AbstractUIPlugin plugin = (AbstractUIPlugin) Platform.getPlugin(PlatformUI.PLUGIN_ID);
-			//URL installURL = plugin.getDescriptor().getInstallURL();
-			URL installURL = CUIPlugin.getDefault().getDescriptor().getInstallURL();
+			URL installURL = CUIPlugin.getDefault().getBundle().getEntry("/");
 			URL url = new URL(installURL, iconPath + relativePath);
 			return ImageDescriptor.createFromURL(url);
 		} catch (MalformedURLException e) {
Index: src/org/eclipse/cdt/internal/ui/cview/RefactorActionGroup.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt-core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/cview/RefactorActionGroup.java,v
retrieving revision 1.3
diff -u -r1.3 RefactorActionGroup.java
--- src/org/eclipse/cdt/internal/ui/cview/RefactorActionGroup.java	2 May 2004 03:33:21 -0000	1.3
+++ src/org/eclipse/cdt/internal/ui/cview/RefactorActionGroup.java	4 Jun 2004 19:51:52 -0000
@@ -110,12 +110,12 @@
 		ISharedImages images = PlatformUI.getWorkbench().getSharedImages();
 		pasteAction.setDisabledImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_PASTE_DISABLED));
 		pasteAction.setImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_PASTE));
-		pasteAction.setHoverImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_PASTE_HOVER));
+		pasteAction.setHoverImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_PASTE));
 
 		copyAction = new CopyAction(shell, clipboard, pasteAction);
 		copyAction.setDisabledImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_COPY_DISABLED));
 		copyAction.setImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_COPY));
-		copyAction.setHoverImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_COPY_HOVER));
+		copyAction.setHoverImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_COPY));
 		
 		moveAction = new CViewMoveAction(shell, treeViewer);
 		renameAction = new CViewRenameAction(shell, treeViewer);
@@ -123,7 +123,7 @@
 		deleteAction = new DeleteResourceAction(shell);
 		deleteAction.setDisabledImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE_DISABLED));
 		deleteAction.setImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE));		
-		deleteAction.setHoverImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE_HOVER));
+		deleteAction.setHoverImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE));
 	}
 
 	public void updateActionBars() {
Index: src/org/eclipse/cdt/internal/ui/editor/OpenIncludeAction.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt-core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/OpenIncludeAction.java,v
retrieving revision 1.10
diff -u -r1.10 OpenIncludeAction.java
--- src/org/eclipse/cdt/internal/ui/editor/OpenIncludeAction.java	19 Apr 2004 05:50:10 -0000	1.10
+++ src/org/eclipse/cdt/internal/ui/editor/OpenIncludeAction.java	4 Jun 2004 19:51:52 -0000
@@ -209,7 +209,7 @@
 			if (descriptor != null) {
 				return descriptor.getId();
 			} else {
-				return registry.getDefaultEditor().getId();
+				return IEditorRegistry.SYSTEM_EXTERNAL_EDITOR_ID;
 			}
 		}
 		return null;
Index: src/org/eclipse/cdt/internal/ui/filters/FilterDescriptor.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt-core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/filters/FilterDescriptor.java,v
retrieving revision 1.1
diff -u -r1.1 FilterDescriptor.java
--- src/org/eclipse/cdt/internal/ui/filters/FilterDescriptor.java	30 Mar 2004 05:35:52 -0000	1.1
+++ src/org/eclipse/cdt/internal/ui/filters/FilterDescriptor.java	4 Jun 2004 19:51:52 -0000
@@ -19,10 +19,9 @@
 
 import org.eclipse.cdt.ui.CUIPlugin;
 import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IPluginRegistry;
+import org.eclipse.core.runtime.IExtensionRegistry;
 import org.eclipse.core.runtime.ISafeRunnable;
 import org.eclipse.core.runtime.Platform;
-
 import org.eclipse.jface.util.Assert;
 import org.eclipse.jface.util.SafeRunnable;
 import org.eclipse.jface.viewers.ViewerFilter;
@@ -69,8 +68,8 @@
 	 */
 	public static FilterDescriptor[] getFilterDescriptors() {
 		if (fgFilterDescriptors == null) {
-			IPluginRegistry registry= Platform.getPluginRegistry();
-			IConfigurationElement[] elements= registry.getConfigurationElementsFor(CUIPlugin.PLUGIN_ID, EXTENSION_POINT_NAME);
+			IExtensionRegistry registory= Platform.getExtensionRegistry();
+			IConfigurationElement[] elements= registory.getConfigurationElementsFor(CUIPlugin.PLUGIN_ID, EXTENSION_POINT_NAME);
 			fgFilterDescriptors= createFilterDescriptors(elements);
 		}	
 		return fgFilterDescriptors;
Index: src/org/eclipse/cdt/internal/ui/search/CSearchScopeFactory.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt-core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchScopeFactory.java,v
retrieving revision 1.4
diff -u -r1.4 CSearchScopeFactory.java
--- src/org/eclipse/cdt/internal/ui/search/CSearchScopeFactory.java	11 Sep 2003 17:13:00 -0000	1.4
+++ src/org/eclipse/cdt/internal/ui/search/CSearchScopeFactory.java	4 Jun 2004 19:51:52 -0000
@@ -123,7 +123,7 @@
 	
 
 	public IWorkingSet[] queryWorkingSets() {
-		Shell shell= CUIPlugin.getDefault().getActiveWorkbenchShell();
+		Shell shell= CUIPlugin.getActiveWorkbenchShell();
 		if (shell == null)
 			return null;
 		IWorkingSetSelectionDialog dialog= PlatformUI.getWorkbench().getWorkingSetManager().createWorkingSetSelectionDialog(shell, true);
Index: src/org/eclipse/cdt/internal/ui/search/OpenCSearchPageAction.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt-core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/OpenCSearchPageAction.java,v
retrieving revision 1.2
diff -u -r1.2 OpenCSearchPageAction.java
--- src/org/eclipse/cdt/internal/ui/search/OpenCSearchPageAction.java	26 Feb 2004 19:30:35 -0000	1.2
+++ src/org/eclipse/cdt/internal/ui/search/OpenCSearchPageAction.java	4 Jun 2004 19:51:52 -0000
@@ -46,7 +46,7 @@
 	}
 
 	protected void beep() {
-		Shell shell= CUIPlugin.getDefault().getActiveWorkbenchShell();
+		Shell shell= CUIPlugin.getActiveWorkbenchShell();
 		if (shell != null && shell.getDisplay() != null)
 			shell.getDisplay().beep();
 	}	
Index: src/org/eclipse/cdt/internal/ui/util/CoreUtility.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt-core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/CoreUtility.java,v
retrieving revision 1.3
diff -u -r1.3 CoreUtility.java
--- src/org/eclipse/cdt/internal/ui/util/CoreUtility.java	15 Apr 2004 19:56:41 -0000	1.3
+++ src/org/eclipse/cdt/internal/ui/util/CoreUtility.java	4 Jun 2004 19:51:53 -0000
@@ -13,9 +13,10 @@
 import org.eclipse.core.resources.IFolder;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IPluginDescriptor;
 import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Platform;
 import org.eclipse.swt.custom.BusyIndicator;
+import org.osgi.framework.Bundle;
 
 public class CoreUtility {
 	
@@ -47,8 +48,14 @@
 	public static Object createExtension(final IConfigurationElement element, final String classAttribute) throws CoreException {
 		// If plugin has been loaded create extension.
 		// Otherwise, show busy cursor then create extension.
-		IPluginDescriptor plugin = element.getDeclaringExtension().getDeclaringPluginDescriptor();
-		if (plugin.isPluginActivated()) {
+		
+//TF NOTE: OLD CODE	
+//		IPluginDescriptor plugin = element.getDeclaringExtension().getDeclaringPluginDescriptor();
+//		if (plugin.isPluginActivated()) {
+
+		String id = element.getDeclaringExtension().getUniqueIdentifier();
+		Bundle bundle = Platform.getBundle(id);
+		if(bundle.getState() == org.osgi.framework.Bundle.ACTIVE) {
 			return element.createExecutableExtension(classAttribute);
 		} else {
 			final Object[] ret = new Object[1];
Index: src/org/eclipse/cdt/internal/ui/util/ProblemTreeViewer.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt-core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/ProblemTreeViewer.java,v
retrieving revision 1.3
diff -u -r1.3 ProblemTreeViewer.java
--- src/org/eclipse/cdt/internal/ui/util/ProblemTreeViewer.java	31 May 2004 16:18:00 -0000	1.3
+++ src/org/eclipse/cdt/internal/ui/util/ProblemTreeViewer.java	4 Jun 2004 19:51:53 -0000
@@ -7,7 +7,6 @@
 
 import java.util.Set;
 
-import org.eclipse.cdt.core.model.ICProject;
 import org.eclipse.jface.viewers.ILabelProvider;
 import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.jface.viewers.ITreeContentProvider;
Index: src/org/eclipse/cdt/internal/ui/util/Resources.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt-core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/Resources.java,v
retrieving revision 1.1
diff -u -r1.1 Resources.java
--- src/org/eclipse/cdt/internal/ui/util/Resources.java	9 Mar 2004 19:50:00 -0000	1.1
+++ src/org/eclipse/cdt/internal/ui/util/Resources.java	4 Jun 2004 19:51:53 -0000
@@ -155,7 +155,7 @@
 	private static IStatus addOutOfSync(IStatus status, IResource resource) {
 		IStatus entry= new Status(
 			IStatus.ERROR,
-			ResourcesPlugin.getPlugin().getDescriptor().getUniqueIdentifier(),
+			ResourcesPlugin.getPlugin().getBundle().getSymbolicName(),
 			IResourceStatus.OUT_OF_SYNC_LOCAL,
 			CorextMessages.getFormattedString("Resources.outOfSync", resource.getFullPath().toString()), //$NON-NLS-1$ 
 			null);
@@ -166,7 +166,7 @@
 			return status;
 		} else {
 			MultiStatus result= new MultiStatus(
-				ResourcesPlugin.getPlugin().getDescriptor().getUniqueIdentifier(),
+				ResourcesPlugin.getPlugin().getBundle().getSymbolicName(),
 				IResourceStatus.OUT_OF_SYNC_LOCAL,
 				CorextMessages.getString("Resources.outOfSyncResources"), null); //$NON-NLS-1$ 
 			result.add(status);
Index: src/org/eclipse/cdt/internal/ui/viewsupport/CElementLabels.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt-core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/CElementLabels.java,v
retrieving revision 1.1
diff -u -r1.1 CElementLabels.java
--- src/org/eclipse/cdt/internal/ui/viewsupport/CElementLabels.java	28 May 2004 15:41:37 -0000	1.1
+++ src/org/eclipse/cdt/internal/ui/viewsupport/CElementLabels.java	4 Jun 2004 19:51:53 -0000
@@ -18,10 +18,8 @@
 import org.eclipse.cdt.core.model.ICElement;
 import org.eclipse.cdt.core.model.IMethod;
 import org.eclipse.cdt.core.model.ISourceRoot;
-import org.eclipse.cdt.core.model.IStructure;
 import org.eclipse.cdt.core.model.ITranslationUnit;
 import org.eclipse.cdt.internal.corext.util.CModelUtil;
-import org.eclipse.cdt.internal.ui.CUIMessages;
 import org.eclipse.cdt.internal.ui.search.CSearchMessages;
 import org.eclipse.cdt.ui.CUIPlugin;
 import org.eclipse.core.resources.IResource;
Index: src/org/eclipse/cdt/internal/ui/wizards/dialogfields/LinkToFileGroup.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt-core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/dialogfields/LinkToFileGroup.java,v
retrieving revision 1.5
diff -u -r1.5 LinkToFileGroup.java
--- src/org/eclipse/cdt/internal/ui/wizards/dialogfields/LinkToFileGroup.java	26 May 2004 15:30:31 -0000	1.5
+++ src/org/eclipse/cdt/internal/ui/wizards/dialogfields/LinkToFileGroup.java	4 Jun 2004 19:51:53 -0000
@@ -214,7 +214,7 @@
 	private IStatus createStatus(int severity, String message) {
 		return new Status(
 			severity,
-			WorkbenchPlugin.getDefault().getDescriptor().getUniqueIdentifier(),
+			WorkbenchPlugin.getDefault().getBundle().getSymbolicName(),
 			severity,
 			message,	
 			null);
Index: src/org/eclipse/cdt/ui/CElementSorter.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt-core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CElementSorter.java,v
retrieving revision 1.7
diff -u -r1.7 CElementSorter.java
--- src/org/eclipse/cdt/ui/CElementSorter.java	26 May 2004 02:59:50 -0000	1.7
+++ src/org/eclipse/cdt/ui/CElementSorter.java	4 Jun 2004 19:51:53 -0000
@@ -18,8 +18,8 @@
 import org.eclipse.cdt.core.model.IFunction;
 import org.eclipse.cdt.core.model.IFunctionDeclaration;
 import org.eclipse.cdt.core.model.IInclude;
-import org.eclipse.cdt.core.model.ILibraryReference;
 import org.eclipse.cdt.core.model.IIncludeReference;
+import org.eclipse.cdt.core.model.ILibraryReference;
 import org.eclipse.cdt.core.model.IMacro;
 import org.eclipse.cdt.core.model.IMethod;
 import org.eclipse.cdt.core.model.IMethodDeclaration;
@@ -34,7 +34,6 @@
 import org.eclipse.core.resources.IContainer;
 import org.eclipse.core.resources.IFile;
 import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
 import org.eclipse.core.resources.IStorage;
 import org.eclipse.core.runtime.IAdaptable;
 import org.eclipse.core.runtime.IPath;
Index: src/org/eclipse/cdt/ui/CUIPlugin.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt-core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CUIPlugin.java,v
retrieving revision 1.40
diff -u -r1.40 CUIPlugin.java
--- src/org/eclipse/cdt/ui/CUIPlugin.java	1 Jun 2004 05:13:07 -0000	1.40
+++ src/org/eclipse/cdt/ui/CUIPlugin.java	4 Jun 2004 19:51:54 -0000
@@ -33,16 +33,11 @@
 import org.eclipse.cdt.internal.ui.IContextMenuConstants;
 import org.eclipse.cdt.internal.ui.ResourceAdapterFactory;
 import org.eclipse.cdt.internal.ui.buildconsole.BuildConsoleManager;
-import org.eclipse.cdt.internal.ui.cview.CView;
 import org.eclipse.cdt.internal.ui.editor.CDocumentProvider;
 import org.eclipse.cdt.internal.ui.editor.CustomBufferFactory;
 import org.eclipse.cdt.internal.ui.editor.SharedTextColors;
 import org.eclipse.cdt.internal.ui.editor.WorkingCopyManager;
 import org.eclipse.cdt.internal.ui.editor.asm.AsmTextTools;
-import org.eclipse.cdt.internal.ui.preferences.BuildConsolePreferencePage;
-import org.eclipse.cdt.internal.ui.preferences.CEditorPreferencePage;
-import org.eclipse.cdt.internal.ui.preferences.CPluginPreferencePage;
-import org.eclipse.cdt.internal.ui.preferences.WorkInProgressPreferencePage;
 import org.eclipse.cdt.internal.ui.text.CTextTools;
 import org.eclipse.cdt.internal.ui.text.PreferencesAdapter;
 import org.eclipse.cdt.internal.ui.text.c.hover.CEditorTextHoverDescriptor;
@@ -77,7 +72,7 @@
 import org.eclipse.ui.plugin.AbstractUIPlugin;
 import org.eclipse.ui.texteditor.ChainedPreferenceStore;
 import org.eclipse.ui.texteditor.ConfigurationElementSorter;
-import org.eclipse.ui.texteditor.MarkerAnnotationPreferences;
+import org.osgi.framework.BundleContext;
 
 public class CUIPlugin extends AbstractUIPlugin {
 
@@ -300,12 +295,15 @@
 	private ResourceAdapterFactory fResourceAdapterFactory;
 	private CElementAdapterFactory fCElementAdapterFactory;
 
-
+	//CONVERSION NOTE:  For some reason, the migration of this part is harder than it looks.
+	//In theory we should be loaded on the first reference, but in many cases getDefault()
+	//is called before this plugin is instantiated.   Does this mean that we should load
+	//it ourselves at that time?
 	public CUIPlugin(IPluginDescriptor descriptor) {
 		super(descriptor);
 		fgCPlugin = this;
 		fDocumentProvider = null;
-		fTextTools = null;
+		fTextTools = null;		
 	}
 		
 	/**
@@ -356,11 +354,27 @@
 		return fBuildConsoleManager;
 	}
 
-	/**
-	 * @see Plugin#shutdown
+	/* (non-Javadoc)
+	 * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
 	 */
-	public void shutdown() throws CoreException {
+	public void start(BundleContext context) throws Exception {
+		super.start(context);
+
+		//Set debug tracing options
+		configurePluginDebugOptions();
+		
+		registerAdapters();
+		AllTypesCache.initialize(new IWorkingCopyProvider() {
+			public IWorkingCopy[] getWorkingCopies() {
+				return CUIPlugin.getSharedWorkingCopies();
+			}
+		});
+	}
 
+	/* (non-Javadoc)
+	 * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
+	 */
+	public void stop(BundleContext context) throws Exception {
 		AllTypesCache.terminate();
 		
 		if (fTextTools != null) {
@@ -387,54 +401,7 @@
 		Refactoring.getUndoManager().shutdown();		
 
 		// Do this last.
-		super.shutdown();
-	}
-
-	private void runUI(Runnable run) {
-		Display display;
-		display = Display.getCurrent();
-		if (display == null) {
-			display = Display.getDefault();
-			display.asyncExec(run);
-		}
-		else {
-			run.run();
-		}
-	}
-
-	/**
-	 * @see Plugin#startup
-	 */
-	public void startup() throws CoreException {
-		super.startup();
-		//Set debug tracing options
-		CUIPlugin.getDefault().configurePluginDebugOptions();
-		
-		registerAdapters();
-		AllTypesCache.initialize(new IWorkingCopyProvider() {
-			public IWorkingCopy[] getWorkingCopies() {
-				return CUIPlugin.getSharedWorkingCopies();
-			}
-		});
-	}
-
-	/**
-	 * @see AbstractUIPlugin#initializeDefaultPreferences
-	 */
-	protected void initializeDefaultPreferences(final IPreferenceStore store) {
-		super.initializeDefaultPreferences(store);
-		MarkerAnnotationPreferences.initializeDefaultValues(store);	
-        PreferenceConstants.initializeDefaultValues(store);
-        EditorsUI.useAnnotationsPreferencePage(store);
-		runUI(new Runnable() {
-			public void run() {
-				CPluginPreferencePage.initDefaults(store);
-				CEditorPreferencePage.initDefaults(store);
-				CView.initDefaults(store);
-				BuildConsolePreferencePage.initDefaults(store);
-				WorkInProgressPreferencePage.initDefaults(store);
-			}
-		});
+		super.stop(context);
 	}
 
 	public CoreModel getCoreModel() {
@@ -486,8 +453,7 @@
 	}
 	
 	public void configurePluginDebugOptions(){
-		
-		if(CUIPlugin.getDefault().isDebugging()){
+		if(isDebugging()){
 			String option = Platform.getDebugOption(CONTENTASSIST);
 			if(option != null) Util.VERBOSE_CONTENTASSIST = option.equalsIgnoreCase("true") ; //$NON-NLS-1$
 		}
Index: src/org/eclipse/cdt/ui/dialogs/AbstractBinaryParserPage.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt-core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/AbstractBinaryParserPage.java,v
retrieving revision 1.4
diff -u -r1.4 AbstractBinaryParserPage.java
--- src/org/eclipse/cdt/ui/dialogs/AbstractBinaryParserPage.java	2 Apr 2004 19:07:41 -0000	1.4
+++ src/org/eclipse/cdt/ui/dialogs/AbstractBinaryParserPage.java	4 Jun 2004 19:51:54 -0000
@@ -19,8 +19,8 @@
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IConfigurationElement;
 import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.IPluginDescriptor;
 import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Platform;
 import org.eclipse.jface.resource.ImageDescriptor;
 import org.eclipse.swt.widgets.Composite;
 
@@ -64,8 +64,7 @@
 	private void initializeParserPageMap() {
 		fParserPageMap = new HashMap(5);
 
-		IPluginDescriptor descriptor = CUIPlugin.getDefault().getDescriptor();
-		IExtensionPoint extensionPoint = descriptor.getExtensionPoint("BinaryParserPage"); //$NON-NLS-1$
+		IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(CUIPlugin.PLUGIN_ID, "BinaryParserPage"); //$NON-NLS-1$
 		IConfigurationElement[] infos = extensionPoint.getConfigurationElements();
 		for (int i = 0; i < infos.length; i++) {
 			if (infos[i].getName().equals("parserPage")) { //$NON-NLS-1$
Index: src/org/eclipse/cdt/ui/dialogs/AbstractErrorParserBlock.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt-core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/AbstractErrorParserBlock.java,v
retrieving revision 1.6
diff -u -r1.6 AbstractErrorParserBlock.java
--- src/org/eclipse/cdt/ui/dialogs/AbstractErrorParserBlock.java	22 Apr 2004 18:08:26 -0000	1.6
+++ src/org/eclipse/cdt/ui/dialogs/AbstractErrorParserBlock.java	4 Jun 2004 19:51:54 -0000
@@ -32,6 +32,7 @@
 import org.eclipse.core.runtime.IExtensionPoint;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Platform;
 import org.eclipse.core.runtime.Preferences;
 import org.eclipse.jface.viewers.ILabelProvider;
 import org.eclipse.jface.viewers.LabelProvider;
@@ -146,7 +147,7 @@
 
 	protected void initMapParsers() {
 		mapParsers.clear();
-		IExtensionPoint point = CCorePlugin.getDefault().getDescriptor().getExtensionPoint(CCorePlugin.ERROR_PARSER_SIMPLE_ID);
+		IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(CCorePlugin.PLUGIN_ID, CCorePlugin.ERROR_PARSER_SIMPLE_ID);
 		if (point != null) {
 			IExtension[] exts = point.getExtensions();
 			for (int i = 0; i < exts.length; i++) {
Index: src/org/eclipse/cdt/ui/dialogs/BinaryParserBlock.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt-core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/BinaryParserBlock.java,v
retrieving revision 1.15
diff -u -r1.15 BinaryParserBlock.java
--- src/org/eclipse/cdt/ui/dialogs/BinaryParserBlock.java	4 Jun 2004 02:27:14 -0000	1.15
+++ src/org/eclipse/cdt/ui/dialogs/BinaryParserBlock.java	4 Jun 2004 19:51:54 -0000
@@ -39,6 +39,7 @@
 import org.eclipse.core.runtime.IExtensionPoint;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Platform;
 import org.eclipse.core.runtime.Preferences;
 import org.eclipse.core.runtime.SubProgressMonitor;
 import org.eclipse.jface.viewers.LabelProvider;
@@ -142,7 +143,7 @@
 	}
 
 	private void initializeParserList() {
-		IExtensionPoint point = CCorePlugin.getDefault().getDescriptor().getExtensionPoint(CCorePlugin.BINARY_PARSER_SIMPLE_ID);
+		IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(CCorePlugin.PLUGIN_ID, CCorePlugin.BINARY_PARSER_SIMPLE_ID);
 		if (point != null) {
 			IExtension[] exts = point.getExtensions();
 			configMap = new HashMap(exts.length);
Index: src/org/eclipse/cdt/ui/dialogs/CygwinPEBinaryParserPage.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt-core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/CygwinPEBinaryParserPage.java,v
retrieving revision 1.5
diff -u -r1.5 CygwinPEBinaryParserPage.java
--- src/org/eclipse/cdt/ui/dialogs/CygwinPEBinaryParserPage.java	2 Apr 2004 19:07:41 -0000	1.5
+++ src/org/eclipse/cdt/ui/dialogs/CygwinPEBinaryParserPage.java	4 Jun 2004 19:51:54 -0000
@@ -23,9 +23,9 @@
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IConfigurationElement;
 import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.IPluginDescriptor;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Platform;
 import org.eclipse.core.runtime.Preferences;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.ModifyEvent;
@@ -73,8 +73,7 @@
 			ICDescriptor cdesc = CCorePlugin.getDefault().getCProjectDescription(proj);
 			ICExtensionReference[] cext = cdesc.get(CCorePlugin.BINARY_PARSER_UNIQ_ID);
 			if (cext.length > 0) {
-				IPluginDescriptor descriptor = CUIPlugin.getDefault().getDescriptor();
-				IExtensionPoint point = descriptor.getExtensionPoint("BinaryParserPage"); //$NON-NLS-1$
+				IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(CUIPlugin.PLUGIN_ID, "BinaryParserPage"); //$NON-NLS-1$
 				IConfigurationElement[] infos = point.getConfigurationElements();
 				for (int i = 0; i < infos.length; i++) {
 					String id = infos[i].getAttribute("parserID"); //$NON-NLS-1$
Index: src/org/eclipse/cdt/ui/dialogs/GNUElfBinaryParserPage.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt-core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/GNUElfBinaryParserPage.java,v
retrieving revision 1.5
diff -u -r1.5 GNUElfBinaryParserPage.java
--- src/org/eclipse/cdt/ui/dialogs/GNUElfBinaryParserPage.java	2 Apr 2004 19:07:41 -0000	1.5
+++ src/org/eclipse/cdt/ui/dialogs/GNUElfBinaryParserPage.java	4 Jun 2004 19:51:54 -0000
@@ -23,9 +23,9 @@
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IConfigurationElement;
 import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.IPluginDescriptor;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Platform;
 import org.eclipse.core.runtime.Preferences;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.ModifyEvent;
@@ -70,8 +70,7 @@
 			ICDescriptor cdesc = CCorePlugin.getDefault().getCProjectDescription(proj);
 			ICExtensionReference[] cext = cdesc.get(CCorePlugin.BINARY_PARSER_UNIQ_ID);
 			if (cext.length > 0) {
-				IPluginDescriptor descriptor = CUIPlugin.getDefault().getDescriptor();
-				IExtensionPoint point = descriptor.getExtensionPoint("BinaryParserPage"); //$NON-NLS-1$
+				IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(CUIPlugin.PLUGIN_ID, "BinaryParserPage"); //$NON-NLS-1$
 				IConfigurationElement[] infos = point.getConfigurationElements();
 				for (int i = 0; i < infos.length; i++) {
 					String id = infos[i].getAttribute("parserID"); //$NON-NLS-1$
Index: src/org/eclipse/cdt/ui/wizards/conversion/ConvertProjectWizardPage.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt-core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/conversion/ConvertProjectWizardPage.java,v
retrieving revision 1.15
diff -u -r1.15 ConvertProjectWizardPage.java
--- src/org/eclipse/cdt/ui/wizards/conversion/ConvertProjectWizardPage.java	2 May 2004 03:33:21 -0000	1.15
+++ src/org/eclipse/cdt/ui/wizards/conversion/ConvertProjectWizardPage.java	4 Jun 2004 19:51:55 -0000
@@ -44,7 +44,6 @@
 import org.eclipse.swt.widgets.Label;
 import org.eclipse.swt.widgets.Listener;
 import org.eclipse.swt.widgets.Table;
-import org.eclipse.ui.ISharedImages;
 import org.eclipse.ui.PlatformUI;
 
 
@@ -364,9 +363,7 @@
         }
 
         public Image getColumnImage(Object obj, int index) {
-
-            return PlatformUI.getWorkbench().getSharedImages().getImage(
-                           ISharedImages.IMG_OBJ_PROJECT);
+            return PlatformUI.getWorkbench().getSharedImages().getImage(org.eclipse.ui.ide.IDE.SharedImages.IMG_OBJ_PROJECT);
         }
     }
 
Index: src/org/eclipse/cdt/ui/CUIPreferenceInitializer.java
===================================================================
RCS file: src/org/eclipse/cdt/ui/CUIPreferenceInitializer.java
diff -N src/org/eclipse/cdt/ui/CUIPreferenceInitializer.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/cdt/ui/CUIPreferenceInitializer.java	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,65 @@
+/***********************************************************************
+ * Copyright (c) 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials 
+ * are made available under the terms of the Common Public License v0.5 
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ * 
+ * Contributors:
+ * QNX Software Systems - Initial implementation
+ **********************************************************************/
+package org.eclipse.cdt.ui;
+
+import org.eclipse.cdt.internal.ui.cview.CView;
+import org.eclipse.cdt.internal.ui.preferences.BuildConsolePreferencePage;
+import org.eclipse.cdt.internal.ui.preferences.CEditorPreferencePage;
+import org.eclipse.cdt.internal.ui.preferences.CPluginPreferencePage;
+import org.eclipse.cdt.internal.ui.preferences.WorkInProgressPreferencePage;
+import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.editors.text.EditorsUI;
+import org.eclipse.ui.texteditor.MarkerAnnotationPreferences;
+
+/**
+ * This class implements the setting of the CUI initial preference store settings.
+ */
+public class CUIPreferenceInitializer extends AbstractPreferenceInitializer {
+
+	/*
+	 * Run this task in the UI thread in a safe manner. 
+	 */
+	private void runUI(Runnable run) {
+		Display display;
+		display = Display.getCurrent();
+		if (display == null) {
+			display = Display.getDefault();
+			if (display == null) {
+				display.asyncExec(run);
+			}
+		} else {
+			run.run();
+		}
+	}
+	
+	/* (non-Javadoc)
+	 * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
+	 */
+	public void initializeDefaultPreferences() {
+		final IPreferenceStore store = CUIPlugin.getDefault().getPreferenceStore();
+
+		MarkerAnnotationPreferences.initializeDefaultValues(store);	
+        PreferenceConstants.initializeDefaultValues(store);
+        EditorsUI.useAnnotationsPreferencePage(store);
+		runUI(new Runnable() {
+			public void run() {
+				CPluginPreferencePage.initDefaults(store);
+				CEditorPreferencePage.initDefaults(store);
+				CView.initDefaults(store);
+				BuildConsolePreferencePage.initDefaults(store);
+				WorkInProgressPreferencePage.initDefaults(store);
+			}
+		});
+	}
+
+}

Back to the top