diff --git a/core/org.eclipse.cdt.core/ChangeLog b/core/org.eclipse.cdt.core/ChangeLog
index 46a8dc2a0b4..48ac2ca4bb8 100644
--- a/core/org.eclipse.cdt.core/ChangeLog
+++ b/core/org.eclipse.cdt.core/ChangeLog
@@ -1,3 +1,6 @@
+2004-03-03 Hoda Amer
+ A fix for getChildren() to check if the getElementInfo() is null
+
2004-03-03 Alain Magloire
Note from Brent Nicolle PR 53520.
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Parent.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Parent.java
index 40581c621f9..375a97925a9 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Parent.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Parent.java
@@ -44,7 +44,11 @@ public abstract class Parent extends CElement implements IParent {
* Implementations override this method to support children
*/
public ICElement[] getChildren() {
- return getElementInfo().getChildren();
+ CElementInfo info = getElementInfo();
+ if (info != null)
+ return getElementInfo().getChildren();
+ else
+ return new ICElement[]{};
}
/**
diff --git a/core/org.eclipse.cdt.ui/ChangeLog b/core/org.eclipse.cdt.ui/ChangeLog
index c4e8c69ecf0..8fab3456a44 100644
--- a/core/org.eclipse.cdt.ui/ChangeLog
+++ b/core/org.eclipse.cdt.ui/ChangeLog
@@ -1,3 +1,6 @@
+2004-03-03 Hoda Amer
+ Added a couple of APIs to CUIPlugin + some cleanup
+
2004-03-03 John Camelon
Cleaned up usage of Enum.getValue() wrt encapsulation of enumerator value.
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/template/c/CFunctionContextType.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/template/c/CFunctionContextType.java
index 0fa6d755ff6..190c7291877 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/template/c/CFunctionContextType.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/template/c/CFunctionContextType.java
@@ -9,12 +9,6 @@ package org.eclipse.cdt.internal.corext.template.c;
import org.eclipse.cdt.internal.corext.template.ITemplateEditor;
import org.eclipse.cdt.internal.corext.template.TemplateContext;
-/**
- * @author hamer
- *
- * To change the template for this generated type comment go to
- * Window - Preferences - Java - Code Generation - Code and Comments
- */
public class CFunctionContextType extends CompilationUnitContextType {
/**
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/template/c/CStructureContextType.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/template/c/CStructureContextType.java
index 539e9eb2581..264983cac0a 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/template/c/CStructureContextType.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/template/c/CStructureContextType.java
@@ -9,12 +9,6 @@ package org.eclipse.cdt.internal.corext.template.c;
import org.eclipse.cdt.internal.corext.template.ITemplateEditor;
import org.eclipse.cdt.internal.corext.template.TemplateContext;
-/**
- * @author hamer
- *
- * To change the template for this generated type comment go to
- * Window - Preferences - Java - Code Generation - Code and Comments
- */
public class CStructureContextType extends CompilationUnitContextType {
/**
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/template/c/CppFunctionContextType.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/template/c/CppFunctionContextType.java
index 2a717dc0c5f..ae5b4b7ec26 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/template/c/CppFunctionContextType.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/template/c/CppFunctionContextType.java
@@ -9,12 +9,6 @@ package org.eclipse.cdt.internal.corext.template.c;
import org.eclipse.cdt.internal.corext.template.ITemplateEditor;
import org.eclipse.cdt.internal.corext.template.TemplateContext;
-/**
- * @author hamer
- *
- * To change the template for this generated type comment go to
- * Window - Preferences - Java - Code Generation - Code and Comments
- */
public class CppFunctionContextType extends CompilationUnitContextType {
public CppFunctionContextType() {
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/template/c/CppStructureContextType.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/template/c/CppStructureContextType.java
index 61e3c5d18b7..8d4faaf85aa 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/template/c/CppStructureContextType.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/template/c/CppStructureContextType.java
@@ -9,12 +9,6 @@ package org.eclipse.cdt.internal.corext.template.c;
import org.eclipse.cdt.internal.corext.template.ITemplateEditor;
import org.eclipse.cdt.internal.corext.template.TemplateContext;
-/**
- * @author hamer
- *
- * To change the template for this generated type comment go to
- * Window - Preferences - Java - Code Generation - Code and Comments
- */
public class CppStructureContextType extends CompilationUnitContextType {
public CppStructureContextType() {
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/textmanipulation/TextBuffer.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/textmanipulation/TextBuffer.java
index ac4e0a60f64..5b239ad3da5 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/textmanipulation/TextBuffer.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/textmanipulation/TextBuffer.java
@@ -43,6 +43,10 @@ public class TextBuffer {
private IDocument fDocument;
+ public IDocument getDocument() {
+ return fDocument;
+ }
+
private static final TextBufferFactory fgFactory= new TextBufferFactory();
TextBuffer(IDocument document) {
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/textmanipulation/TextBufferFactory.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/textmanipulation/TextBufferFactory.java
index 1236362e47d..63a3a913871 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/textmanipulation/TextBufferFactory.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/textmanipulation/TextBufferFactory.java
@@ -5,20 +5,14 @@ package org.eclipse.cdt.internal.corext.textmanipulation;
* All Rights Reserved.
*/
-import org.eclipse.cdt.internal.ui.CStatusConstants;
-import org.eclipse.cdt.ui.CUIPlugin;
-
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;
-import org.eclipse.jface.text.Document;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.source.IAnnotationModel;
-import org.eclipse.jface.util.Assert;
-
+import org.eclipse.cdt.internal.ui.CStatusConstants;
+import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.resources.ResourcesPlugin;
@@ -26,7 +20,10 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
-
+import org.eclipse.jface.text.Document;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.source.IAnnotationModel;
+import org.eclipse.jface.util.Assert;
import org.eclipse.ui.part.FileEditorInput;
import org.eclipse.ui.texteditor.IDocumentProvider;
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CUIStatus.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CUIStatus.java
index 925ba70b115..79c66b75d93 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CUIStatus.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CUIStatus.java
@@ -17,7 +17,23 @@ public class CUIStatus extends Status {
public CUIStatus(int code, String message, Throwable throwable) {
super(IStatus.ERROR, CUIPlugin.getPluginId(), code, message, throwable);
}
+
+ private CUIStatus(int severity, int code, String message, Throwable throwable) {
+ super(severity, CUIPlugin.getPluginId(), code, message, throwable);
+ }
+
+ public static IStatus createError(int code, String message, Throwable throwable) {
+ return new CUIStatus(IStatus.ERROR, code, message, throwable);
+ }
+
+ public static IStatus createWarning(int code, String message, Throwable throwable) {
+ return new CUIStatus(IStatus.WARNING, code, message, throwable);
+ }
+ public static IStatus createInfo(int code, String message, Throwable throwable) {
+ return new CUIStatus(IStatus.INFO, code, message, throwable);
+ }
+
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CContentOutlinePage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CContentOutlinePage.java
index be8cd4f5a71..9083232d6c6 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CContentOutlinePage.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CContentOutlinePage.java
@@ -8,16 +8,12 @@ package org.eclipse.cdt.internal.ui.editor;
import java.util.ArrayList;
import java.util.Iterator;
-import org.eclipse.cdt.core.model.CoreModel;
-import org.eclipse.cdt.core.model.ElementChangedEvent;
import org.eclipse.cdt.core.model.ICElement;
-import org.eclipse.cdt.core.model.ICElementDelta;
-import org.eclipse.cdt.core.model.IElementChangedListener;
-import org.eclipse.cdt.core.model.ITranslationUnit;
import org.eclipse.cdt.core.model.IWorkingCopy;
import org.eclipse.cdt.internal.core.model.WorkingCopy;
import org.eclipse.cdt.internal.ui.CFileElementWorkingCopy;
import org.eclipse.cdt.internal.ui.StandardCElementLabelProvider;
+import org.eclipse.cdt.internal.ui.search.actions.SelectionSearchGroup;
import org.eclipse.cdt.internal.ui.util.ProblemTreeViewer;
import org.eclipse.cdt.ui.CElementContentProvider;
import org.eclipse.cdt.ui.CUIPlugin;
@@ -42,24 +38,20 @@ import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.IStorageEditorInput;
import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.part.IPage;
+import org.eclipse.ui.actions.ActionGroup;
import org.eclipse.ui.part.IPageSite;
import org.eclipse.ui.part.Page;
import org.eclipse.ui.texteditor.IDocumentProvider;
import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
-import org.eclipse.ui.actions.ActionGroup;
-import org.eclipse.cdt.internal.ui.search.actions.SelectionSearchGroup;
public class CContentOutlinePage extends Page implements IContentOutlinePage, ISelectionChangedListener {
private CEditor fEditor;
- //private WorkingCopy fInput;
private IWorkingCopy fInput;
private ProblemTreeViewer treeViewer;
private ListenerList selectionChangedListeners = new ListenerList();
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/WorkingCopyManager.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/WorkingCopyManager.java
index 3674e350f71..96864145f50 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/WorkingCopyManager.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/WorkingCopyManager.java
@@ -12,13 +12,9 @@
package org.eclipse.cdt.internal.ui.editor;
-import java.util.ArrayList;
import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
import java.util.Map;
-import org.eclipse.cdt.core.model.ITranslationUnit;
import org.eclipse.cdt.core.model.IWorkingCopy;
import org.eclipse.cdt.ui.IWorkingCopyManager;
import org.eclipse.cdt.ui.IWorkingCopyManagerExtension;
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CompletionEngine.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CompletionEngine.java
index 49fb9fb5520..25af5e2883c 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CompletionEngine.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CompletionEngine.java
@@ -66,7 +66,6 @@ import org.eclipse.core.runtime.IPath;
import org.eclipse.jface.preference.IPreferenceStore;
/**
- * @author hamer
*
* This class is the entry point for code completions.
* It contains a public API used to call ContentAssist on a given working copy
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CompletionRequestorAdaptor.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CompletionRequestorAdaptor.java
index 61c8f94be8d..209df0bfa4e 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CompletionRequestorAdaptor.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CompletionRequestorAdaptor.java
@@ -13,12 +13,6 @@ package org.eclipse.cdt.internal.ui.text.contentassist;
import org.eclipse.cdt.core.parser.IProblem;
import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility;
-/**
- * @author hamer
- *
- * To change the template for this generated type comment go to
- * Window>Preferences>Java>Code Generation>Code and Comments
- */
public class CompletionRequestorAdaptor implements ICompletionRequestor {
/* (non-Javadoc)
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/ContentAssistElementRequestor.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/ContentAssistElementRequestor.java
index 6196bbb6220..d88b8f9b9c1 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/ContentAssistElementRequestor.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/ContentAssistElementRequestor.java
@@ -9,7 +9,6 @@ package org.eclipse.cdt.internal.ui.text.contentassist;
import org.eclipse.cdt.core.parser.NullSourceElementRequestor;
/**
- * @author hamer
*
* This class is the source element requestor used by the completion engine.
*/
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/ICompletionRequestor.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/ICompletionRequestor.java
index 7d71ed94f4e..d144e5a2f7e 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/ICompletionRequestor.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/ICompletionRequestor.java
@@ -13,12 +13,6 @@ package org.eclipse.cdt.internal.ui.text.contentassist;
import org.eclipse.cdt.core.parser.IProblem;
import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility;
-/**
- * @author hamer
- *
- * To change the template for this generated type comment go to
- * Window>Preferences>Java>Code Generation>Code and Comments
- */
public interface ICompletionRequestor {
void acceptField(String name, String returnType, ASTAccessVisibility visibility, int completionStart, int completionLength, int relevance);
void acceptVariable(String name, String returnType, int completionStart, int completionLength, int relevance);
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/RelevanceConstants.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/RelevanceConstants.java
index 48058d3e089..a9bb7368774 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/RelevanceConstants.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/RelevanceConstants.java
@@ -10,10 +10,6 @@
***********************************************************************/
package org.eclipse.cdt.internal.ui.text.contentassist;
-/**
- * @author hamer
- *
- */
public interface RelevanceConstants {
final int CASE_MATCH_RELEVANCE = 150;
final int EXACT_NAME_MATCH_RELEVANCE = 40;
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/ResultCollector.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/ResultCollector.java
index 642fcfd7bf0..b5f0f559a75 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/ResultCollector.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/ResultCollector.java
@@ -26,7 +26,6 @@ import org.eclipse.jface.text.contentassist.ICompletionProposal;
import org.eclipse.swt.graphics.Image;
/**
- * @author hamer
*
* The Result Collector class receives information from the completion engine
* as a completion requestor. It might also receive information from others
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 1de3962a22b..e3ef2baf445 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
@@ -211,14 +211,14 @@ public class EditorUtility {
* @param cu the original compilation unit (or another working copy)
* @return the working copy of the compilation unit, or null if not found
*/
-// public static ITranslationUnit getWorkingCopy(ITranslationUnit cu) {
-// if (cu == null)
-// return null;
-// if (cu.isWorkingCopy())
-// return cu;
-//
-// return (ITranslationUnit)cu.findSharedWorkingCopy(CUIPlugin.getBufferFactory());
-// }
+ public static ITranslationUnit getWorkingCopy(ITranslationUnit cu) {
+ if (cu == null)
+ return null;
+ if (cu.isWorkingCopy())
+ return cu;
+
+ return (ITranslationUnit)cu.findSharedWorkingCopy(CUIPlugin.getBufferFactory());
+ }
/**
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/IDebugLogConstants.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/IDebugLogConstants.java
index 1e7dfc06b9b..f05aeebe9ce 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/IDebugLogConstants.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/IDebugLogConstants.java
@@ -10,12 +10,6 @@
***********************************************************************/
package org.eclipse.cdt.internal.ui.util;
-/**
- * @author hamer
- *
- * To change the template for this generated type comment go to
- * Window - Preferences - Java - Code Generation - Code and Comments
- */
public interface IDebugLogConstants {
public class DebugLogConstant {
private DebugLogConstant( int value )
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/Util.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/Util.java
index 6aa96219a83..f565131b7ac 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/Util.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/Util.java
@@ -12,10 +12,6 @@ package org.eclipse.cdt.internal.ui.util;
import org.eclipse.cdt.ui.CUIPlugin;
-/**
- * @author hamer
- *
- */
public class Util implements IDebugLogConstants{
public static boolean VERBOSE_CONTENTASSIST = false;
private Util() {
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 cf1ab730136..9f834f00f72 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
@@ -54,10 +54,31 @@ public class CElementLabelProvider extends LabelProvider {
public final static int SHOW_OVERLAY_ICONS = 0x010;
/**
- * Constant indicating the default label rendering.
- * Currently the default is equivalent to
- * SHOW_PARAMETERS | SHOW_OVERLAY_ICONS
.
+ * Flag (bit mask) indicating that Complation Units, Class Files, Types, Declarations and Members
+ * should be rendered qualified.
+ * Examples: java.lang.String, java.util.Vector.size()
+ *
+ * @since 2.0
*/
+ public final static int SHOW_QUALIFIED= 0x400;
+
+ /**
+ * Flag (bit mask) indicating that Complation Units, Class Files, Types, Declarations and Members
+ * should be rendered qualified. The qualifcation is appended
+ * Examples: String - java.lang, size() - java.util.Vector
+ *
+ * @since 2.0
+ */
+ public final static int SHOW_POST_QUALIFIED= 0x800;
+
+
+ /**
+ * Constant (value 0
) indicating that the label should show
+ * the basic images only.
+ */
+ public final static int SHOW_BASICS= 0x000;
+
+
public final static int SHOW_DEFAULT= new Integer(SHOW_PARAMETERS | SHOW_OVERLAY_ICONS).intValue();
private ImageRegistry fImageRegistry;
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 8591ca7418d..92d01d2c118 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
@@ -13,8 +13,12 @@ package org.eclipse.cdt.ui;
***********************************************************************/
import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
+import java.util.Set;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.model.CoreModel;
@@ -51,6 +55,10 @@ import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.text.source.ISharedTextColors;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IEditorReference;
+import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.plugin.AbstractUIPlugin;
@@ -394,5 +402,53 @@ public class CUIPlugin extends AbstractUIPlugin {
if(option != null) Util.VERBOSE_CONTENTASSIST = option.equalsIgnoreCase("true") ; //$NON-NLS-1$
}
}
-
+ /**
+ * Returns an array of all editors that have an unsaved content. If the identical content is
+ * presented in more than one editor, only one of those editor parts is part of the result.
+ *
+ * @return an array of all dirty editor parts.
+ */
+
+ public static IEditorPart[] getDirtyEditors() {
+ Set inputs= new HashSet();
+ List result= new ArrayList(0);
+ IWorkbench workbench= getDefault().getWorkbench();
+ IWorkbenchWindow[] windows= workbench.getWorkbenchWindows();
+ for (int i= 0; i < windows.length; i++) {
+ IWorkbenchPage[] pages= windows[i].getPages();
+ for (int x= 0; x < pages.length; x++) {
+ IEditorPart[] editors= pages[x].getDirtyEditors();
+ for (int z= 0; z < editors.length; z++) {
+ IEditorPart ep= editors[z];
+ IEditorInput input= ep.getEditorInput();
+ if (!inputs.contains(input)) {
+ inputs.add(input);
+ result.add(ep);
+ }
+ }
+ }
+ }
+ return (IEditorPart[])result.toArray(new IEditorPart[result.size()]);
+ }
+ /**
+ * Returns an array of all instanciated editors.
+ */
+ public static IEditorPart[] getInstanciatedEditors() {
+ List result= new ArrayList(0);
+ IWorkbench workbench= getDefault().getWorkbench();
+ IWorkbenchWindow[] windows= workbench.getWorkbenchWindows();
+ for (int windowIndex= 0; windowIndex < windows.length; windowIndex++) {
+ IWorkbenchPage[] pages= windows[windowIndex].getPages();
+ for (int pageIndex= 0; pageIndex < pages.length; pageIndex++) {
+ IEditorReference[] references= pages[pageIndex].getEditorReferences();
+ for (int refIndex= 0; refIndex < references.length; refIndex++) {
+ IEditorPart editor= references[refIndex].getEditor(false);
+ if (editor != null)
+ result.add(editor);
+ }
+ }
+ }
+ return (IEditorPart[])result.toArray(new IEditorPart[result.size()]);
+ }
+
}