From 270cdcae5564e292fcd88103ad4b49f9cfccc142 Mon Sep 17 00:00:00 2001 From: Alain Magloire Date: Thu, 27 Mar 2003 16:16:46 +0000 Subject: [PATCH] Changes was doen int the Core Model: ICModel, ICProject, ICContainer, ICTranslationUnit IArchive and IBinary We now adjust the code --- .../cdt/core/model/tests/ArchiveTests.java | 2 +- .../cdt/core/model/tests/BinaryTests.java | 4 +- .../core/model/tests/ElementDeltaTests.java | 2 +- .../model/tests/TranslationUnitTests.java | 2 +- .../core/model/tests/WorkingCopyTests.java | 2 +- .../ui/BaseCElementContentProvider.java | 110 ++++++++++++------ .../cdt/internal/ui/BinaryPropertySource.java | 72 ++++++++---- .../internal/ui/CElementAdapterFactory.java | 24 ++-- .../internal/ui/CElementImageProvider.java | 64 +++++----- .../ui/ErrorTickAdornmentProvider.java | 11 +- .../ui/compare/CStructureCreator.java | 2 +- .../cdt/internal/ui/cview/CPatternFilter.java | 4 +- .../eclipse/cdt/internal/ui/cview/CView.java | 11 +- .../internal/ui/cview/CViewDragAdapter.java | 17 ++- .../cdt/internal/ui/cview/CViewSorter.java | 51 ++++---- .../internal/ui/editor/CDocumentProvider.java | 6 +- .../internal/ui/editor/DocumentAdapter.java | 18 +-- .../cdt/internal/ui/util/EditorUtility.java | 6 +- .../cdt/ui/CElementContentProvider.java | 84 ++++++------- .../eclipse/cdt/ui/CElementLabelProvider.java | 5 - .../src/org/eclipse/cdt/ui/CUIPlugin.java | 4 +- 21 files changed, 281 insertions(+), 220 deletions(-) diff --git a/core/org.eclipse.cdt.ui.tests/model/org/eclipse/cdt/core/model/tests/ArchiveTests.java b/core/org.eclipse.cdt.ui.tests/model/org/eclipse/cdt/core/model/tests/ArchiveTests.java index f581520f0d0..53520adb0ae 100644 --- a/core/org.eclipse.cdt.ui.tests/model/org/eclipse/cdt/core/model/tests/ArchiveTests.java +++ b/core/org.eclipse.cdt.ui.tests/model/org/eclipse/cdt/core/model/tests/ArchiveTests.java @@ -190,7 +190,7 @@ public class ArchiveTests extends TestCase { IArchive myArchive; myArchive=CProjectHelper.findArchive(testProject, "libtestlib_g.a"); - assertTrue("A archive", myArchive.isArchive()); + assertTrue("A archive", myArchive != null); myArchive=null; diff --git a/core/org.eclipse.cdt.ui.tests/model/org/eclipse/cdt/core/model/tests/BinaryTests.java b/core/org.eclipse.cdt.ui.tests/model/org/eclipse/cdt/core/model/tests/BinaryTests.java index c3cf998272d..b5f9af70b83 100644 --- a/core/org.eclipse.cdt.ui.tests/model/org/eclipse/cdt/core/model/tests/BinaryTests.java +++ b/core/org.eclipse.cdt.ui.tests/model/org/eclipse/cdt/core/model/tests/BinaryTests.java @@ -346,7 +346,7 @@ public class BinaryTests extends TestCase { public void testisBinRead() { IBinary myBinary; myBinary =CProjectHelper.findBinary(testProject, "test_g"); - assertTrue(myBinary.isBinary()); + assertTrue(myBinary != null); assertTrue(myBinary.isReadOnly()); } @@ -420,7 +420,7 @@ public class BinaryTests extends TestCase { IBinary myBinary; myBinary=CProjectHelper.findBinary(testProject, "exebig_g"); - assertTrue("A Binary", myBinary.isBinary()); + assertTrue("A Binary", myBinary != null); } diff --git a/core/org.eclipse.cdt.ui.tests/model/org/eclipse/cdt/core/model/tests/ElementDeltaTests.java b/core/org.eclipse.cdt.ui.tests/model/org/eclipse/cdt/core/model/tests/ElementDeltaTests.java index f76803a5db3..e05d2a066eb 100644 --- a/core/org.eclipse.cdt.ui.tests/model/org/eclipse/cdt/core/model/tests/ElementDeltaTests.java +++ b/core/org.eclipse.cdt.ui.tests/model/org/eclipse/cdt/core/model/tests/ElementDeltaTests.java @@ -23,13 +23,13 @@ import junit.framework.TestSuite; import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.model.CModelException; import org.eclipse.cdt.core.model.ElementChangedEvent; +import org.eclipse.cdt.core.model.IBuffer; import org.eclipse.cdt.core.model.ICElement; import org.eclipse.cdt.core.model.ICElementDelta; import org.eclipse.cdt.core.model.ICProject; import org.eclipse.cdt.core.model.IElementChangedListener; import org.eclipse.cdt.core.model.ITranslationUnit; import org.eclipse.cdt.internal.core.model.CModelManager; -import org.eclipse.cdt.internal.core.model.IBuffer; import org.eclipse.cdt.internal.core.model.IWorkingCopy; import org.eclipse.cdt.internal.core.model.TranslationUnit; import org.eclipse.cdt.testplugin.CProjectHelper; diff --git a/core/org.eclipse.cdt.ui.tests/model/org/eclipse/cdt/core/model/tests/TranslationUnitTests.java b/core/org.eclipse.cdt.ui.tests/model/org/eclipse/cdt/core/model/tests/TranslationUnitTests.java index 9f55a12f0d8..5cf0e56fd72 100644 --- a/core/org.eclipse.cdt.ui.tests/model/org/eclipse/cdt/core/model/tests/TranslationUnitTests.java +++ b/core/org.eclipse.cdt.ui.tests/model/org/eclipse/cdt/core/model/tests/TranslationUnitTests.java @@ -164,7 +164,7 @@ public class TranslationUnitTests extends TestCase { ITranslationUnit myTranslationUnit; myTranslationUnit=CProjectHelper.findTranslationUnit(testProject,"exetest.c"); - assertTrue("A TranslationUnit", myTranslationUnit.isTranslationUnit()); + assertTrue("A TranslationUnit", myTranslationUnit != null); } diff --git a/core/org.eclipse.cdt.ui.tests/model/org/eclipse/cdt/core/model/tests/WorkingCopyTests.java b/core/org.eclipse.cdt.ui.tests/model/org/eclipse/cdt/core/model/tests/WorkingCopyTests.java index f2725bcaf76..ca56cd87436 100644 --- a/core/org.eclipse.cdt.ui.tests/model/org/eclipse/cdt/core/model/tests/WorkingCopyTests.java +++ b/core/org.eclipse.cdt.ui.tests/model/org/eclipse/cdt/core/model/tests/WorkingCopyTests.java @@ -17,9 +17,9 @@ import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import org.eclipse.cdt.core.model.IBuffer; import org.eclipse.cdt.core.model.ICProject; import org.eclipse.cdt.core.model.ITranslationUnit; -import org.eclipse.cdt.internal.core.model.IBuffer; import org.eclipse.cdt.internal.core.model.IWorkingCopy; import org.eclipse.cdt.internal.core.model.TranslationUnit; import org.eclipse.cdt.testplugin.CProjectHelper; diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/BaseCElementContentProvider.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/BaseCElementContentProvider.java index b235f923acc..ab7dc3a3819 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/BaseCElementContentProvider.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/BaseCElementContentProvider.java @@ -8,19 +8,22 @@ package org.eclipse.cdt.internal.ui; import java.util.ArrayList; import java.util.List; +import org.eclipse.cdt.core.model.CModelException; +import org.eclipse.cdt.core.model.IArchive; +import org.eclipse.cdt.core.model.IArchiveContainer; +import org.eclipse.cdt.core.model.IBinary; +import org.eclipse.cdt.core.model.IBinaryContainer; +import org.eclipse.cdt.core.model.ICContainer; +import org.eclipse.cdt.core.model.ICElement; +import org.eclipse.cdt.core.model.ICModel; +import org.eclipse.cdt.core.model.ICProject; +import org.eclipse.cdt.core.model.IParent; +import org.eclipse.cdt.core.model.ITranslationUnit; import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.CoreException; import org.eclipse.jface.viewers.ITreeContentProvider; import org.eclipse.jface.viewers.Viewer; - -import org.eclipse.cdt.core.model.IArchiveContainer; -import org.eclipse.cdt.core.model.IBinaryContainer; -import org.eclipse.cdt.core.model.ICElement; -import org.eclipse.cdt.core.model.ICFile; -import org.eclipse.cdt.core.model.ICProject; -import org.eclipse.cdt.core.model.IParent; /** * A base content provider for C elements. It provides access to the @@ -33,11 +36,12 @@ import org.eclipse.cdt.core.model.IParent; *
 C model (ICModel)
    C project (ICProject)
-      C Folder (ICFolder)
-      C File (ICFile)
+      C Container(folders) (ICContainer)
       Translation unit (ITranslationUnit)
       Binary file (IBinary)
       Archive file (IArchive)
+      Non C Resource file (Object)
+
  * 
*/ public class BaseCElementContentProvider implements ITreeContentProvider { @@ -112,26 +116,18 @@ public class BaseCElementContentProvider implements ITreeContentProvider { public Object[] getChildren(Object element) { if (element instanceof ICElement) { ICElement celement = (ICElement)element; - if (celement.getElementType() == ICElement.C_FILE) { + if (celement instanceof ICModel) { + return getCProjects((ICModel)celement); + } else if (celement instanceof ICProject ) { + return getCProjectResources((ICProject)celement); + } else if (celement instanceof ICContainer) { + return getCResources((ICContainer)celement); + } else if (celement.getElementType() == ICElement.C_UNIT) { if (fProvideMembers) { return ((IParent)element).getChildren(); } } else if (celement instanceof IParent) { - if (celement instanceof ICProject ) { - ICElement[] children = ((IParent)celement).getChildren(); - ArrayList list = new ArrayList(children.length); - for( int i = 0; i < children.length; i++ ) { - // Note, here we are starting the Archive and binary containers thread upfront. - if (children[i] instanceof IArchiveContainer || children[i] instanceof IBinaryContainer) { - if ( ((IParent)children[i]).getChildren().length == 0 ) { - continue; - } - } - list.add(children[i]); - } - return list.toArray(); - } else - return (Object[])((IParent)celement).getChildren(); + return (Object[])((IParent)celement).getChildren(); } } return getResources(element); @@ -143,24 +139,26 @@ public class BaseCElementContentProvider implements ITreeContentProvider { */ public boolean hasChildren(Object element) { if (fProvideMembers) { - if (element instanceof ICFile) { - ICFile cfile = (ICFile)element; - // assume TUs and binary files are never empty - if (cfile.isBinary() || cfile.isTranslationUnit() || cfile.isArchive()) { - return true; - } + // assume TUs and binary files are never empty + if (element instanceof IBinary || element instanceof ITranslationUnit || element instanceof IArchive) { + return true; } } else { // don't allow to drill down into a compilation unit or class file - if (element instanceof ICFile || element instanceof IFile) + if (element instanceof ITranslationUnit || element instanceof IBinary || element instanceof IArchive) { return false; + } } if (element instanceof ICProject) { ICProject cp= (ICProject)element; if (!cp.getProject().isOpen()) { return false; - } + } else { + return true; + } + } else if (element instanceof ICContainer) { + return true; } if (element instanceof IParent) { @@ -186,6 +184,36 @@ public class BaseCElementContentProvider implements ITreeContentProvider { return null; } + protected Object[] getCProjects(ICModel cModel) { + return cModel.getCProjects(); + } + + protected Object[] getCProjectResources(ICProject cproject) { + Object[] objects = getCResources((ICContainer)cproject); + IArchiveContainer archives = cproject.getArchiveContainer(); + if (archives.hasChildren()) { + objects = concatenate(objects, new Object[] {archives}); + } + IBinaryContainer bins = cproject.getBinaryContainer(); + if (bins.hasChildren()) { + objects = concatenate(objects, new Object[] {bins}); + } + return objects; + } + + protected Object[] getCResources(ICContainer container) { + Object[] objects = null; + Object[] children = container.getChildren(); + try { + objects = container.getNonCResources(); + } catch (CModelException e) { + } + if (objects == null) { + return children; + } + return concatenate(children, objects); + } + private Object[] getResources(Object resource) { try { if (resource instanceof IContainer) { @@ -224,4 +252,18 @@ public class BaseCElementContentProvider implements ITreeContentProvider { } return true; } + + + /** + * Note: This method is for internal use only. Clients should not call this method. + */ + protected static Object[] concatenate(Object[] a1, Object[] a2) { + int a1Len = a1.length; + int a2Len = a2.length; + Object[] res = new Object[a1Len + a2Len]; + System.arraycopy(a1, 0, res, 0, a1Len); + System.arraycopy(a2, 0, res, a1Len, a2Len); + return res; + } + } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/BinaryPropertySource.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/BinaryPropertySource.java index 9076b2b2b99..770b9ad34ff 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/BinaryPropertySource.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/BinaryPropertySource.java @@ -5,14 +5,14 @@ package org.eclipse.cdt.internal.ui; * All Rights Reserved. */ +import org.eclipse.cdt.core.model.IBinary; +import org.eclipse.cdt.ui.CUIPlugin; +import org.eclipse.jface.viewers.IBasicPropertyConstants; import org.eclipse.ui.views.properties.IPropertyDescriptor; -import org.eclipse.ui.views.properties.FilePropertySource; +import org.eclipse.ui.views.properties.IPropertySource; import org.eclipse.ui.views.properties.PropertyDescriptor; -import org.eclipse.cdt.core.model.IBinary; -import org.eclipse.cdt.ui.*; - -public class BinaryPropertySource extends FilePropertySource { +public class BinaryPropertySource implements IPropertySource { private final static String ELF_CPU= "CElementProperties.elf_cpu"; private final static String ELF_TEXT= "CElementProperties.elf_text"; @@ -78,8 +78,7 @@ public class BinaryPropertySource extends FilePropertySource { } public BinaryPropertySource(IBinary bin) { - super(bin.getFile()); - this.binary= bin; + binary= bin; } /** @@ -95,14 +94,15 @@ public class BinaryPropertySource extends FilePropertySource { * @see IPropertySource#getPropertyValue */ public Object getPropertyValue(Object name) { - if (element != null) { - Object returnValue = super.getPropertyValue(name); - - if(returnValue != null) - return returnValue; - } - - if (name.equals(ICElementPropertyConstants.P_ELF_CPU)) { +// if (element != null) { +// Object returnValue = super.getPropertyValue(name); +// +// if(returnValue != null) +// return returnValue; +// } + if (name.equals(IBasicPropertyConstants.P_TEXT)) { + return binary.getElementName(); + } else if (name.equals(ICElementPropertyConstants.P_ELF_CPU)) { return binary.getCPU(); } else if (name.equals(ICElementPropertyConstants.P_ELF_TEXT)) { return Long.toString(binary.getText()); @@ -143,12 +143,40 @@ public class BinaryPropertySource extends FilePropertySource { * Return the Property Descriptors for the file type. */ private void initializeBinaryDescriptors() { - IPropertyDescriptor[] superDescriptors = super.getPropertyDescriptors(); - int superLength = superDescriptors.length; - IPropertyDescriptor[] binDescriptors = getInitialPropertyDescriptor(); - int binLength = binDescriptors.length; - fgPropertyDescriptors = new IPropertyDescriptor[superLength + binLength]; - System.arraycopy(superDescriptors, 0, fgPropertyDescriptors, 0, superLength); - System.arraycopy(binDescriptors, 0, fgPropertyDescriptors, superLength, binLength); +// IPropertyDescriptor[] superDescriptors = super.getPropertyDescriptors(); +// int superLength = superDescriptors.length; +// IPropertyDescriptor[] binDescriptors = getInitialPropertyDescriptor(); +// int binLength = binDescriptors.length; +// fgPropertyDescriptors = new IPropertyDescriptor[superLength + binLength]; +// System.arraycopy(superDescriptors, 0, fgPropertyDescriptors, 0, superLength); +// System.arraycopy(binDescriptors, 0, fgPropertyDescriptors, superLength, binLength); + fgPropertyDescriptors = getInitialPropertyDescriptor(); } + + /* (non-Javadoc) + * @see org.eclipse.ui.views.properties.IPropertySource#getEditableValue() + */ + public Object getEditableValue() { + return this; + } + + /* (non-Javadoc) + * @see org.eclipse.ui.views.properties.IPropertySource#isPropertySet(java.lang.Object) + */ + public boolean isPropertySet(Object id) { + return false; + } + + /* (non-Javadoc) + * @see org.eclipse.ui.views.properties.IPropertySource#resetPropertyValue(java.lang.Object) + */ + public void resetPropertyValue(Object id) { + } + + /* (non-Javadoc) + * @see org.eclipse.ui.views.properties.IPropertySource#setPropertyValue(java.lang.Object, java.lang.Object) + */ + public void setPropertyValue(Object id, Object value) { + } + } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CElementAdapterFactory.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CElementAdapterFactory.java index f53fcc59251..ed227f77979 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CElementAdapterFactory.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CElementAdapterFactory.java @@ -8,8 +8,6 @@ package org.eclipse.cdt.internal.ui; import org.eclipse.cdt.core.model.CModelException; import org.eclipse.cdt.core.model.IBinary; import org.eclipse.cdt.core.model.ICElement; -import org.eclipse.cdt.core.model.ICFile; -import org.eclipse.cdt.core.model.ICResource; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; @@ -51,21 +49,17 @@ public class CElementAdapterFactory implements IAdapterFactory { try { if (IPropertySource.class.equals(key)) { - if (celem.getElementType() == ICElement.C_FILE) { - if (celem instanceof IBinary) { - return new BinaryPropertySource((IBinary)celem); - } - IFile file = ((ICFile)celem).getFile(); - if (file != null) { - return new FilePropertySource(file); + if (celem instanceof IBinary) { + return new BinaryPropertySource((IBinary)celem); + } else if (celem.getElementType() == ICElement.C_UNIT) { + IResource file = celem.getResource(); + if (file != null && file instanceof IFile) { + return new FilePropertySource((IFile)file); } } else { - try { - if ( celem instanceof ICResource ) { - res = ((ICResource)celem).getResource(); - return new ResourcePropertySource(res); - } - } catch (CModelException e) { + res = celem.getResource(); + if (res != null) { + return new ResourcePropertySource(res); } } return new CElementPropertySource(celem); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CElementImageProvider.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CElementImageProvider.java index df0e836334d..a1bbcd805b8 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CElementImageProvider.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CElementImageProvider.java @@ -5,22 +5,19 @@ package org.eclipse.cdt.internal.ui; * All Rights Reserved. */ -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.graphics.Point; - -import org.eclipse.jface.resource.ImageDescriptor; - import org.eclipse.cdt.core.model.IBinary; import org.eclipse.cdt.core.model.ICElement; -import org.eclipse.cdt.core.model.ICFile; import org.eclipse.cdt.core.model.ICProject; import org.eclipse.cdt.core.model.IMember; import org.eclipse.cdt.core.model.IMethodDeclaration; import org.eclipse.cdt.internal.ui.util.ImageDescriptorRegistry; -import org.eclipse.cdt.ui.*; +import org.eclipse.cdt.ui.CElementImageDescriptor; +import org.eclipse.cdt.ui.CUIPlugin; import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.IAdaptable; - +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Point; import org.eclipse.ui.ISharedImages; import org.eclipse.ui.model.IWorkbenchAdapter; @@ -96,9 +93,9 @@ public class CElementImageProvider { if (element instanceof ICElement) { descriptor= getCImageDescriptor((ICElement) element, flags); } - if (descriptor == null && element instanceof ICFile) { - element = ((ICFile)element).getFile(); - } +// if (descriptor == null && element instanceof ICFile) { +// element = ((ICFile)element).getFile(); +// } if (descriptor == null && element instanceof IAdaptable) { descriptor= getWorkbenchImageDescriptor((IAdaptable) element, flags); } @@ -159,31 +156,30 @@ public class CElementImageProvider { public ImageDescriptor getBaseImageDescriptor(ICElement celement, int renderFlags) { int type = celement.getElementType(); switch (type) { - case ICElement.C_CONTAINER: + case ICElement.C_VCONTAINER: return CPluginImages.DESC_OBJS_CONTAINER; - case ICElement.C_FILE: - ICFile cfile = (ICFile)celement; - if (cfile.isArchive()) { - return CPluginImages.DESC_OBJS_ARCHIVE; - } else if (cfile.isBinary()) { - IBinary bin = (IBinary)cfile; - if (bin.isExecutable()) { - if (bin.hasDebug()) - return CPluginImages.DESC_OBJS_CEXEC_DEBUG; - return CPluginImages.DESC_OBJS_CEXEC; - } else if (bin.isSharedLib()) { - return CPluginImages.DESC_OBJS_SHLIB; - } else if (bin.isCore()) { - return CPluginImages.DESC_OBJS_CORE; - } - return CPluginImages.DESC_OBJS_BINARY; - } else if (cfile.isTranslationUnit()) { - return CPluginImages.DESC_OBJS_TUNIT; + case ICElement.C_BINARY: { + IBinary bin = (IBinary)celement; + if (bin.isExecutable()) { + if (bin.hasDebug()) + return CPluginImages.DESC_OBJS_CEXEC_DEBUG; + return CPluginImages.DESC_OBJS_CEXEC; + } else if (bin.isSharedLib()) { + return CPluginImages.DESC_OBJS_SHLIB; + } else if (bin.isCore()) { + return CPluginImages.DESC_OBJS_CORE; } - break; + return CPluginImages.DESC_OBJS_BINARY; + } + + case ICElement.C_ARCHIVE: + return CPluginImages.DESC_OBJS_ARCHIVE; + + case ICElement.C_UNIT: + return CPluginImages.DESC_OBJS_TUNIT; - case ICElement.C_FOLDER: + case ICElement.C_CCONTAINER: return DESC_OBJ_FOLDER; case ICElement.C_PROJECT: @@ -241,10 +237,10 @@ public class CElementImageProvider { public ImageDescriptor getCElementImageDescriptor(int type) { switch (type) { - case ICElement.C_CONTAINER: + case ICElement.C_VCONTAINER: return CPluginImages.DESC_OBJS_CONTAINER; - case ICElement.C_FILE: + case ICElement.C_UNIT: return CPluginImages.DESC_OBJS_TUNIT; case ICElement.C_STRUCT: diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/ErrorTickAdornmentProvider.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/ErrorTickAdornmentProvider.java index da9c29a6bd4..82245afa976 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/ErrorTickAdornmentProvider.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/ErrorTickAdornmentProvider.java @@ -7,11 +7,10 @@ package org.eclipse.cdt.internal.ui; import org.eclipse.cdt.core.model.ICElement; import org.eclipse.cdt.core.model.ICModelMarker; -import org.eclipse.cdt.core.model.ICResource; import org.eclipse.cdt.core.model.ISourceRange; import org.eclipse.cdt.core.model.ISourceReference; import org.eclipse.cdt.core.model.ITranslationUnit; -import org.eclipse.cdt.ui.*; +import org.eclipse.cdt.ui.CUIPlugin; import org.eclipse.core.resources.IMarker; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.CoreException; @@ -41,10 +40,10 @@ public class ErrorTickAdornmentProvider implements IAdornmentProvider { int type= element.getElementType(); switch (type) { case ICElement.C_PROJECT: - case ICElement.C_FOLDER: - return getErrorTicksFromMarkers(((ICResource)element).getResource(), IResource.DEPTH_INFINITE, null); - case ICElement.C_FILE: - return getErrorTicksFromMarkers(((ICResource)element).getResource(), IResource.DEPTH_ONE, null); + case ICElement.C_CCONTAINER: + return getErrorTicksFromMarkers(element.getResource(), IResource.DEPTH_INFINITE, null); + case ICElement.C_UNIT: + return getErrorTicksFromMarkers(element.getResource(), IResource.DEPTH_ONE, null); case ICElement.C_FUNCTION: case ICElement.C_CLASS: case ICElement.C_UNION: diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/compare/CStructureCreator.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/compare/CStructureCreator.java index eb8c5296971..a0822d701e0 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/compare/CStructureCreator.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/compare/CStructureCreator.java @@ -64,7 +64,7 @@ public class CStructureCreator implements IStructureCreator { Document doc= new Document(s != null ? s : ""); - CNode root= new CNode(null, ICElement.C_FILE, "root", doc, 0, 0); + CNode root= new CNode(null, ICElement.C_UNIT, "root", doc, 0, 0); DocumentInputStream is= new DocumentInputStream(doc); IStructurizerCallback callback= new CNodeTreeConstructor(root, doc); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/cview/CPatternFilter.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/cview/CPatternFilter.java index 9ad3804878a..019e2bfb1b0 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/cview/CPatternFilter.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/cview/CPatternFilter.java @@ -17,7 +17,7 @@ import org.eclipse.core.runtime.IAdaptable; import org.eclipse.cdt.internal.ui.util.StringMatcher; import org.eclipse.cdt.ui.CUIPlugin; -import org.eclipse.cdt.core.model.ICFolder; +import org.eclipse.cdt.core.model.ICContainer; import org.eclipse.cdt.core.model.ICProject; public class CPatternFilter extends ViewerFilter { @@ -108,7 +108,7 @@ public class CPatternFilter extends ViewerFilter { // Only apply the rule for Projects and folders. if (parentElement instanceof ICProject - || parentElement instanceof ICFolder) { + || parentElement instanceof ICContainer) { if (resource != null) { String name = resource.getName(); StringMatcher[] testMatchers = getMatchers(); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/cview/CView.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/cview/CView.java index 346376d422f..8decaca5dd5 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/cview/CView.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/cview/CView.java @@ -14,8 +14,7 @@ import org.eclipse.cdt.core.model.IArchiveContainer; import org.eclipse.cdt.core.model.IBinary; import org.eclipse.cdt.core.model.IBinaryContainer; import org.eclipse.cdt.core.model.ICElement; -import org.eclipse.cdt.core.model.ICFile; -import org.eclipse.cdt.core.model.ICRoot; +import org.eclipse.cdt.core.model.ICModel; import org.eclipse.cdt.core.model.IParent; import org.eclipse.cdt.core.resources.MakeUtil; import org.eclipse.cdt.internal.ui.StandardCElementLabelProvider; @@ -263,7 +262,7 @@ public class CView extends ViewPart implements IMenuListener, ISetSelectionTarge public void treeExpanded(TreeExpansionEvent event) { final Object element= event.getElement(); - if (element instanceof ICFile) { + if (element instanceof IParent) { //viewer.refresh (element); Control ctrl= viewer.getControl(); if (ctrl != null && !ctrl.isDisposed()) { @@ -447,7 +446,7 @@ public class CView extends ViewPart implements IMenuListener, ISetSelectionTarge else initFilterFromPreferences(); - viewer.setInput (CoreModel.getDefault().getCRoot()); + viewer.setInput (CoreModel.getDefault().getCModel()); MenuManager menuMgr= new MenuManager("#PopupMenu"); //$NON-NLS-1$ menuMgr.setRemoveAllWhenShown(true); @@ -967,7 +966,7 @@ public class CView extends ViewPart implements IMenuListener, ISetSelectionTarge ICElement celement = (ICElement)o; IResource res = (IResource)celement.getAdapter(IResource.class); if (res != null) { - if (celement.getElementType() == ICElement.C_CONTAINER) { + if (celement.getElementType() == ICElement.C_VCONTAINER) { ICElement parent = celement.getParent(); IResource proj = (IResource)parent.getAdapter(IResource.class); if (celement instanceof IArchiveContainer) @@ -993,7 +992,7 @@ public class CView extends ViewPart implements IMenuListener, ISetSelectionTarge void updateTitle () { Object input= getViewer().getInput(); String viewName= getConfigurationElement().getAttribute("name"); //$NON-NLS-1$ - if (input == null || (input instanceof ICRoot)) { + if (input == null || (input instanceof ICModel)) { setTitle(viewName); setTitleToolTip(""); //$NON-NLS-1$ } else { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/cview/CViewDragAdapter.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/cview/CViewDragAdapter.java index 57df989b4bd..494d5360b1a 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/cview/CViewDragAdapter.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/cview/CViewDragAdapter.java @@ -9,6 +9,8 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.List; +import org.eclipse.cdt.core.model.CModelException; +import org.eclipse.cdt.core.model.ICElement; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.CoreException; import org.eclipse.jface.viewers.ISelection; @@ -22,11 +24,6 @@ import org.eclipse.swt.dnd.FileTransfer; import org.eclipse.swt.widgets.Control; import org.eclipse.ui.part.ResourceTransfer; -import org.eclipse.cdt.core.model.CModelException; -import org.eclipse.cdt.core.model.ICElement; -import org.eclipse.cdt.core.model.ICFile; -import org.eclipse.cdt.core.model.ICFolder; - /** * Implements drag behaviour when items are dragged out of the * resource navigator. @@ -102,7 +99,15 @@ class CViewDragAdapter extends DragSourceAdapter { IStructuredSelection selection = (IStructuredSelection)selectionProvider.getSelection(); for (Iterator i = selection.iterator(); i.hasNext();) { Object next = i.next(); - if (!(next instanceof ICFile || next instanceof ICFolder)) { + IResource res = null; + if (next instanceof ICElement) { + ICElement celement = (ICElement)next; + try { + res = celement.getResource(); + } catch (CModelException e) { + } + } + if (res == null) { event.doit = false; return; } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/cview/CViewSorter.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/cview/CViewSorter.java index a56a2db9040..d0f19b3878a 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/cview/CViewSorter.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/cview/CViewSorter.java @@ -9,17 +9,20 @@ import org.eclipse.cdt.core.model.CModelException; import org.eclipse.cdt.core.model.CoreModel; import org.eclipse.cdt.core.model.IArchive; import org.eclipse.cdt.core.model.IArchiveContainer; +import org.eclipse.cdt.core.model.IBinary; import org.eclipse.cdt.core.model.IBinaryContainer; +import org.eclipse.cdt.core.model.ICContainer; import org.eclipse.cdt.core.model.ICElement; -import org.eclipse.cdt.core.model.ICFile; -import org.eclipse.cdt.core.model.ICFolder; +import org.eclipse.cdt.core.model.ICModel; import org.eclipse.cdt.core.model.ICProject; -import org.eclipse.cdt.core.model.ICRoot; 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.IMacro; +import org.eclipse.cdt.core.model.IMethod; +import org.eclipse.cdt.core.model.IMethodDeclaration; import org.eclipse.cdt.core.model.INamespace; +import org.eclipse.cdt.core.model.ITranslationUnit; import org.eclipse.cdt.core.model.IUsing; import org.eclipse.cdt.core.model.IVariable; import org.eclipse.cdt.core.model.IVariableDeclaration; @@ -38,7 +41,7 @@ import org.eclipse.jface.viewers.ViewerSorter; public class CViewSorter extends ViewerSorter { public int category (Object element) { - if (element instanceof ICRoot) { + if (element instanceof ICModel) { return 0; } else if (element instanceof ICProject) { return 10; @@ -46,12 +49,12 @@ public class CViewSorter extends ViewerSorter { return 20; } else if (element instanceof IArchiveContainer) { return 30; - } else if (element instanceof ICFolder) { + } else if (element instanceof ICContainer) { return 40; - } else if (element instanceof ICFile) { + } else if (element instanceof ITranslationUnit) { IResource res = null; try { - res = ((ICFile)element).getUnderlyingResource(); + res = ((ITranslationUnit)element).getUnderlyingResource(); } catch (CModelException e) { } if (res != null) { @@ -66,7 +69,7 @@ public class CViewSorter extends ViewerSorter { String[] sources = CoreModel.getDefault().getSourceExtensions(); for (int i = 0; i < sources.length; i++) { if (ext.equals(sources[i])) { - return 44; + return 47; } } return 48; @@ -82,20 +85,13 @@ public class CViewSorter extends ViewerSorter { return 80; } else if (element instanceof IUsing) { return 90; - } else if (element instanceof IFunctionDeclaration) { + } else if (element instanceof IFunctionDeclaration && ! (element instanceof IFunction)) { return 100; - } else if (element instanceof IVariableDeclaration) { + } else if (element instanceof IMethodDeclaration && !(element instanceof IMethod)) { return 110; - } else if (element instanceof IVariable) { - String name = ((ICElement)element).getElementName(); - if (name.startsWith("__")) { - return 112; - } - if (name.charAt(0) == '_') { - return 114; - } + } else if (element instanceof IVariableDeclaration) { return 120; - } else if (element instanceof IFunction) { + } else if (element instanceof IVariable) { String name = ((ICElement)element).getElementName(); if (name.startsWith("__")) { return 122; @@ -104,7 +100,7 @@ public class CViewSorter extends ViewerSorter { return 124; } return 130; - } else if (element instanceof ICElement) { + } else if (element instanceof IFunction) { String name = ((ICElement)element).getElementName(); if (name.startsWith("__")) { return 132; @@ -113,9 +109,20 @@ public class CViewSorter extends ViewerSorter { return 134; } return 140; - } else if (element instanceof IArchive) { + } else if (element instanceof ICElement) { + String name = ((ICElement)element).getElementName(); + if (name.startsWith("__")) { + return 142; + } + if (name.charAt(0) == '_') { + return 144; + } return 150; + } else if (element instanceof IArchive) { + return 160; + } else if (element instanceof IBinary) { + return 170; } - return 80; + return 200; } } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CDocumentProvider.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CDocumentProvider.java index 1efd5f263aa..d5073672194 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CDocumentProvider.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CDocumentProvider.java @@ -11,9 +11,9 @@ import java.io.InputStream; import org.eclipse.cdt.core.model.CModelException; import org.eclipse.cdt.core.model.CoreModel; -import org.eclipse.cdt.core.model.ICOpenable; +import org.eclipse.cdt.core.model.IBuffer; +import org.eclipse.cdt.core.model.IOpenable; import org.eclipse.cdt.core.model.ITranslationUnit; -import org.eclipse.cdt.internal.core.model.IBuffer; import org.eclipse.cdt.internal.core.model.IBufferFactory; import org.eclipse.cdt.internal.core.model.IWorkingCopy; import org.eclipse.cdt.internal.ui.CStatusConstants; @@ -111,7 +111,7 @@ public class CDocumentProvider extends FileDocumentProvider implements IWorkingC return CDocumentProvider.this.createDocument(input); } - public IBuffer createBuffer(ICOpenable owner) { + public IBuffer createBuffer(IOpenable owner) { try { if (owner instanceof IWorkingCopy) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/DocumentAdapter.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/DocumentAdapter.java index 3eb4584240e..3630d627db5 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/DocumentAdapter.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/DocumentAdapter.java @@ -16,11 +16,11 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.List; +import org.eclipse.cdt.core.model.BufferChangedEvent; import org.eclipse.cdt.core.model.CModelException; -import org.eclipse.cdt.core.model.ICOpenable; -import org.eclipse.cdt.internal.core.model.BufferChangedEvent; -import org.eclipse.cdt.internal.core.model.IBuffer; -import org.eclipse.cdt.internal.core.model.IBufferChangedListener; +import org.eclipse.cdt.core.model.IBuffer; +import org.eclipse.cdt.core.model.IBufferChangedListener; +import org.eclipse.cdt.core.model.IOpenable; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; @@ -74,7 +74,7 @@ public class DocumentAdapter implements IBuffer, IDocumentListener { return 0; } - public ICOpenable getOwner() { + public IOpenable getOwner() { return null; } @@ -163,7 +163,7 @@ public class DocumentAdapter implements IBuffer, IDocumentListener { } }; - private ICOpenable fOwner; + private IOpenable fOwner; private IDocument fDocument; private DocumentSetCommand fSetCmd= new DocumentSetCommand(); private DocumentReplaceCommand fReplaceCmd= new DocumentReplaceCommand(); @@ -178,7 +178,7 @@ public class DocumentAdapter implements IBuffer, IDocumentListener { private IStatus fStatus; - public DocumentAdapter(ICOpenable owner, IDocument document, ILineTracker lineTracker, CDocumentProvider provider, Object providerKey) { + public DocumentAdapter(IOpenable owner, IDocument document, ILineTracker lineTracker, CDocumentProvider provider, Object providerKey) { Assert.isNotNull(document); Assert.isNotNull(lineTracker); @@ -352,8 +352,8 @@ public class DocumentAdapter implements IBuffer, IDocumentListener { /** * @see org.eclipse.cdt.internal.core.model.IBuffer#getOwner() */ - public ICOpenable getOwner() { - return (ICOpenable) fOwner; + public IOpenable getOwner() { + return (IOpenable) fOwner; } /** diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/EditorUtility.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/EditorUtility.java index 46b32048fb5..5c07b4de80c 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/EditorUtility.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/EditorUtility.java @@ -124,7 +124,11 @@ public class EditorUtility { IStorage store = null; Process objdump = null; IPath path; - IFile file = bin.getFile(); + IResource file = null; + try { + file = bin.getResource(); + } catch (CModelException e1) { + } if (file == null) return store; path = file.getLocation(); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CElementContentProvider.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CElementContentProvider.java index f9a151acd7a..34aab34d245 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CElementContentProvider.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CElementContentProvider.java @@ -13,15 +13,13 @@ import org.eclipse.cdt.core.model.IArchive; import org.eclipse.cdt.core.model.IBinary; import org.eclipse.cdt.core.model.ICElement; import org.eclipse.cdt.core.model.ICElementDelta; -import org.eclipse.cdt.core.model.ICFile; +import org.eclipse.cdt.core.model.ICModel; import org.eclipse.cdt.core.model.ICProject; -import org.eclipse.cdt.core.model.ICRoot; import org.eclipse.cdt.core.model.IElementChangedListener; import org.eclipse.cdt.core.model.IParent; import org.eclipse.cdt.core.model.ITranslationUnit; import org.eclipse.cdt.internal.ui.BaseCElementContentProvider; import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.ITreeContentProvider; import org.eclipse.jface.viewers.StructuredViewer; import org.eclipse.jface.viewers.Viewer; @@ -50,7 +48,7 @@ public class CElementContentProvider extends BaseCElementContentProvider impleme fViewer = (StructuredViewer)viewer; if (oldInput == null && newInput != null) { - if (newInput instanceof ICRoot) + if (newInput instanceof ICModel) CoreModel.getDefault().addElementChangedListener(this); } else if (oldInput != null && newInput == null) { CoreModel.getDefault().removeElementChangedListener(this); @@ -103,22 +101,16 @@ public class CElementContentProvider extends BaseCElementContentProvider impleme if (kind == ICElementDelta.REMOVED) { Object parent = getParent(element); postRemove(element); - if (element instanceof ICFile) { - ICFile cfile = (ICFile)element; - if (updateContainer(cfile)) { - postRefresh(parent); - } + if (updateContainer(element)) { + postRefresh(parent); } } if (kind == ICElementDelta.ADDED) { Object parent= getParent(element); postAdd(parent, element); - if (element instanceof ICFile) { - ICFile cfile = (ICFile)element; - if (updateContainer(cfile)) { - postRefresh(parent); - } + if (updateContainer(element)) { + postRefresh(parent); } } @@ -141,50 +133,50 @@ public class CElementContentProvider extends BaseCElementContentProvider impleme } // Make sure that containers are updated. - //if (element instanceof ICRoot) { - // updateContainer((ICRoot)element); + //if (element instanceof ICModel) { + // updateContainer((ICModel)element); //} } - private void updateContainer(ICRoot root) { - postRunnable(new Runnable() { - public void run () { - Control ctrl= fViewer.getControl(); - if (ctrl != null && !ctrl.isDisposed()) { - IStructuredSelection s = (IStructuredSelection)fViewer.getSelection(); - if (s.isEmpty()) - return; - Object element = s.getFirstElement(); - if (element instanceof ICProject) { - updateContainer((ICProject)element); - } - } - } - }); - } +// private void updateContainer(ICModel root) { +// postRunnable(new Runnable() { +// public void run () { +// Control ctrl= fViewer.getControl(); +// if (ctrl != null && !ctrl.isDisposed()) { +// IStructuredSelection s = (IStructuredSelection)fViewer.getSelection(); +// if (s.isEmpty()) +// return; +// Object element = s.getFirstElement(); +// if (element instanceof ICProject) { +// updateContainer((ICProject)element); +// } +// } +// } +// }); +// } - protected boolean updateContainer(ICProject cproject) { - IParent binContainer = cproject.getBinaryContainer(); - IParent libContainer = cproject.getArchiveContainer(); - if (binContainer != null) { - postContainerRefresh(binContainer, cproject); - } - if (libContainer != null) { - postContainerRefresh(libContainer, cproject); - } - return false; - } +// protected boolean updateContainer(ICProject cproject) { +// IParent binContainer = cproject.getBinaryContainer(); +// IParent libContainer = cproject.getArchiveContainer(); +// if (binContainer != null) { +// postContainerRefresh(binContainer, cproject); +// } +// if (libContainer != null) { +// postContainerRefresh(libContainer, cproject); +// } +// return false; +// } - private boolean updateContainer(ICFile cfile) { + private boolean updateContainer(ICElement cfile) { IParent container = null; ICProject cproject = null; - if (cfile.isBinary()) { + if (cfile instanceof IBinary) { IBinary bin = (IBinary)cfile; if (bin.isExecutable() || bin.isSharedLib()) { cproject = bin.getCProject(); container = cproject.getBinaryContainer(); } - } else if (cfile.isArchive()) { + } else if (cfile instanceof IArchive) { cproject = cfile.getCProject(); container = cproject.getArchiveContainer(); } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CElementLabelProvider.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CElementLabelProvider.java index 5b5bcbd1327..4a3e832ce1f 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CElementLabelProvider.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CElementLabelProvider.java @@ -7,7 +7,6 @@ package org.eclipse.cdt.ui; import org.eclipse.cdt.core.model.IBinary; import org.eclipse.cdt.core.model.ICElement; -import org.eclipse.cdt.core.model.ICFile; import org.eclipse.cdt.core.model.IFunctionDeclaration; import org.eclipse.cdt.core.model.IVariable; import org.eclipse.cdt.core.model.IVariableDeclaration; @@ -109,11 +108,7 @@ public class CElementLabelProvider extends LabelProvider { return result; } } - if(element instanceof ICFile) { - //element = ((ICFile)element).getFile(); - } return fWorkbenchLabelProvider.getImage(element); - } /** diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CUIPlugin.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CUIPlugin.java index c81da24a110..4d2abbc4ddf 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CUIPlugin.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CUIPlugin.java @@ -145,7 +145,7 @@ public class CUIPlugin extends AbstractUIPlugin { /** * Returns the used document provider */ - public CDocumentProvider getDocumentProvider() { + public synchronized CDocumentProvider getDocumentProvider() { if (fDocumentProvider == null) { fDocumentProvider = new CDocumentProvider(); } @@ -156,7 +156,7 @@ public class CUIPlugin extends AbstractUIPlugin { * Returns the working copy manager * @return IWorkingCopyManager */ - public synchronized IWorkingCopyManager getWorkingCopyManager() { + public IWorkingCopyManager getWorkingCopyManager() { return getDocumentProvider(); }