mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-29 11:55:40 +02:00
Small fixes + cleanup
This commit is contained in:
parent
9ec8dc475a
commit
8404420b80
23 changed files with 128 additions and 89 deletions
|
@ -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
|
2004-03-03 Alain Magloire
|
||||||
|
|
||||||
Note from Brent Nicolle PR 53520.
|
Note from Brent Nicolle PR 53520.
|
||||||
|
|
|
@ -44,7 +44,11 @@ public abstract class Parent extends CElement implements IParent {
|
||||||
* Implementations override this method to support children
|
* Implementations override this method to support children
|
||||||
*/
|
*/
|
||||||
public ICElement[] getChildren() {
|
public ICElement[] getChildren() {
|
||||||
return getElementInfo().getChildren();
|
CElementInfo info = getElementInfo();
|
||||||
|
if (info != null)
|
||||||
|
return getElementInfo().getChildren();
|
||||||
|
else
|
||||||
|
return new ICElement[]{};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
2004-03-03 Hoda Amer
|
||||||
|
Added a couple of APIs to CUIPlugin + some cleanup
|
||||||
|
|
||||||
2004-03-03 John Camelon
|
2004-03-03 John Camelon
|
||||||
Cleaned up usage of Enum.getValue() wrt encapsulation of enumerator value.
|
Cleaned up usage of Enum.getValue() wrt encapsulation of enumerator value.
|
||||||
|
|
||||||
|
|
|
@ -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.ITemplateEditor;
|
||||||
import org.eclipse.cdt.internal.corext.template.TemplateContext;
|
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 {
|
public class CFunctionContextType extends CompilationUnitContextType {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -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.ITemplateEditor;
|
||||||
import org.eclipse.cdt.internal.corext.template.TemplateContext;
|
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 {
|
public class CStructureContextType extends CompilationUnitContextType {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -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.ITemplateEditor;
|
||||||
import org.eclipse.cdt.internal.corext.template.TemplateContext;
|
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 class CppFunctionContextType extends CompilationUnitContextType {
|
||||||
|
|
||||||
public CppFunctionContextType() {
|
public CppFunctionContextType() {
|
||||||
|
|
|
@ -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.ITemplateEditor;
|
||||||
import org.eclipse.cdt.internal.corext.template.TemplateContext;
|
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 class CppStructureContextType extends CompilationUnitContextType {
|
||||||
|
|
||||||
public CppStructureContextType() {
|
public CppStructureContextType() {
|
||||||
|
|
|
@ -43,6 +43,10 @@ public class TextBuffer {
|
||||||
|
|
||||||
private IDocument fDocument;
|
private IDocument fDocument;
|
||||||
|
|
||||||
|
public IDocument getDocument() {
|
||||||
|
return fDocument;
|
||||||
|
}
|
||||||
|
|
||||||
private static final TextBufferFactory fgFactory= new TextBufferFactory();
|
private static final TextBufferFactory fgFactory= new TextBufferFactory();
|
||||||
|
|
||||||
TextBuffer(IDocument document) {
|
TextBuffer(IDocument document) {
|
||||||
|
|
|
@ -5,20 +5,14 @@ package org.eclipse.cdt.internal.corext.textmanipulation;
|
||||||
* All Rights Reserved.
|
* All Rights Reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import org.eclipse.cdt.internal.ui.CStatusConstants;
|
|
||||||
import org.eclipse.cdt.ui.CUIPlugin;
|
|
||||||
|
|
||||||
import java.io.BufferedInputStream;
|
import java.io.BufferedInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.eclipse.jface.text.Document;
|
import org.eclipse.cdt.internal.ui.CStatusConstants;
|
||||||
import org.eclipse.jface.text.IDocument;
|
import org.eclipse.cdt.ui.CUIPlugin;
|
||||||
import org.eclipse.jface.text.source.IAnnotationModel;
|
|
||||||
import org.eclipse.jface.util.Assert;
|
|
||||||
|
|
||||||
import org.eclipse.core.resources.IFile;
|
import org.eclipse.core.resources.IFile;
|
||||||
import org.eclipse.core.resources.IWorkspaceRunnable;
|
import org.eclipse.core.resources.IWorkspaceRunnable;
|
||||||
import org.eclipse.core.resources.ResourcesPlugin;
|
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.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
import org.eclipse.core.runtime.Status;
|
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.part.FileEditorInput;
|
||||||
import org.eclipse.ui.texteditor.IDocumentProvider;
|
import org.eclipse.ui.texteditor.IDocumentProvider;
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,23 @@ public class CUIStatus extends Status {
|
||||||
public CUIStatus(int code, String message, Throwable throwable) {
|
public CUIStatus(int code, String message, Throwable throwable) {
|
||||||
super(IStatus.ERROR, CUIPlugin.getPluginId(), code, message, 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);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -8,16 +8,12 @@ package org.eclipse.cdt.internal.ui.editor;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
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.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.core.model.IWorkingCopy;
|
||||||
import org.eclipse.cdt.internal.core.model.WorkingCopy;
|
import org.eclipse.cdt.internal.core.model.WorkingCopy;
|
||||||
import org.eclipse.cdt.internal.ui.CFileElementWorkingCopy;
|
import org.eclipse.cdt.internal.ui.CFileElementWorkingCopy;
|
||||||
import org.eclipse.cdt.internal.ui.StandardCElementLabelProvider;
|
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.internal.ui.util.ProblemTreeViewer;
|
||||||
import org.eclipse.cdt.ui.CElementContentProvider;
|
import org.eclipse.cdt.ui.CElementContentProvider;
|
||||||
import org.eclipse.cdt.ui.CUIPlugin;
|
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.SWT;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
import org.eclipse.swt.widgets.Control;
|
import org.eclipse.swt.widgets.Control;
|
||||||
import org.eclipse.swt.widgets.Display;
|
|
||||||
import org.eclipse.swt.widgets.Menu;
|
import org.eclipse.swt.widgets.Menu;
|
||||||
import org.eclipse.ui.IActionBars;
|
import org.eclipse.ui.IActionBars;
|
||||||
import org.eclipse.ui.IEditorInput;
|
import org.eclipse.ui.IEditorInput;
|
||||||
import org.eclipse.ui.IFileEditorInput;
|
import org.eclipse.ui.IFileEditorInput;
|
||||||
import org.eclipse.ui.IStorageEditorInput;
|
import org.eclipse.ui.IStorageEditorInput;
|
||||||
import org.eclipse.ui.IWorkbenchActionConstants;
|
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.IPageSite;
|
||||||
import org.eclipse.ui.part.Page;
|
import org.eclipse.ui.part.Page;
|
||||||
import org.eclipse.ui.texteditor.IDocumentProvider;
|
import org.eclipse.ui.texteditor.IDocumentProvider;
|
||||||
import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
|
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 {
|
public class CContentOutlinePage extends Page implements IContentOutlinePage, ISelectionChangedListener {
|
||||||
private CEditor fEditor;
|
private CEditor fEditor;
|
||||||
//private WorkingCopy fInput;
|
|
||||||
private IWorkingCopy fInput;
|
private IWorkingCopy fInput;
|
||||||
private ProblemTreeViewer treeViewer;
|
private ProblemTreeViewer treeViewer;
|
||||||
private ListenerList selectionChangedListeners = new ListenerList();
|
private ListenerList selectionChangedListeners = new ListenerList();
|
||||||
|
|
|
@ -12,13 +12,9 @@
|
||||||
package org.eclipse.cdt.internal.ui.editor;
|
package org.eclipse.cdt.internal.ui.editor;
|
||||||
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.model.ITranslationUnit;
|
|
||||||
import org.eclipse.cdt.core.model.IWorkingCopy;
|
import org.eclipse.cdt.core.model.IWorkingCopy;
|
||||||
import org.eclipse.cdt.ui.IWorkingCopyManager;
|
import org.eclipse.cdt.ui.IWorkingCopyManager;
|
||||||
import org.eclipse.cdt.ui.IWorkingCopyManagerExtension;
|
import org.eclipse.cdt.ui.IWorkingCopyManagerExtension;
|
||||||
|
|
|
@ -66,7 +66,6 @@ import org.eclipse.core.runtime.IPath;
|
||||||
import org.eclipse.jface.preference.IPreferenceStore;
|
import org.eclipse.jface.preference.IPreferenceStore;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author hamer
|
|
||||||
*
|
*
|
||||||
* This class is the entry point for code completions.
|
* This class is the entry point for code completions.
|
||||||
* It contains a public API used to call ContentAssist on a given working copy
|
* It contains a public API used to call ContentAssist on a given working copy
|
||||||
|
|
|
@ -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.IProblem;
|
||||||
import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility;
|
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 {
|
public class CompletionRequestorAdaptor implements ICompletionRequestor {
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
|
|
@ -9,7 +9,6 @@ package org.eclipse.cdt.internal.ui.text.contentassist;
|
||||||
import org.eclipse.cdt.core.parser.NullSourceElementRequestor;
|
import org.eclipse.cdt.core.parser.NullSourceElementRequestor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author hamer
|
|
||||||
*
|
*
|
||||||
* This class is the source element requestor used by the completion engine.
|
* This class is the source element requestor used by the completion engine.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -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.IProblem;
|
||||||
import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility;
|
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 {
|
public interface ICompletionRequestor {
|
||||||
void acceptField(String name, String returnType, ASTAccessVisibility visibility, int completionStart, int completionLength, int relevance);
|
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);
|
void acceptVariable(String name, String returnType, int completionStart, int completionLength, int relevance);
|
||||||
|
|
|
@ -10,10 +10,6 @@
|
||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
package org.eclipse.cdt.internal.ui.text.contentassist;
|
package org.eclipse.cdt.internal.ui.text.contentassist;
|
||||||
|
|
||||||
/**
|
|
||||||
* @author hamer
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public interface RelevanceConstants {
|
public interface RelevanceConstants {
|
||||||
final int CASE_MATCH_RELEVANCE = 150;
|
final int CASE_MATCH_RELEVANCE = 150;
|
||||||
final int EXACT_NAME_MATCH_RELEVANCE = 40;
|
final int EXACT_NAME_MATCH_RELEVANCE = 40;
|
||||||
|
|
|
@ -26,7 +26,6 @@ import org.eclipse.jface.text.contentassist.ICompletionProposal;
|
||||||
import org.eclipse.swt.graphics.Image;
|
import org.eclipse.swt.graphics.Image;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author hamer
|
|
||||||
*
|
*
|
||||||
* The Result Collector class receives information from the completion engine
|
* The Result Collector class receives information from the completion engine
|
||||||
* as a completion requestor. It might also receive information from others
|
* as a completion requestor. It might also receive information from others
|
||||||
|
|
|
@ -211,14 +211,14 @@ public class EditorUtility {
|
||||||
* @param cu the original compilation unit (or another working copy)
|
* @param cu the original compilation unit (or another working copy)
|
||||||
* @return the working copy of the compilation unit, or null if not found
|
* @return the working copy of the compilation unit, or null if not found
|
||||||
*/
|
*/
|
||||||
// public static ITranslationUnit getWorkingCopy(ITranslationUnit cu) {
|
public static ITranslationUnit getWorkingCopy(ITranslationUnit cu) {
|
||||||
// if (cu == null)
|
if (cu == null)
|
||||||
// return null;
|
return null;
|
||||||
// if (cu.isWorkingCopy())
|
if (cu.isWorkingCopy())
|
||||||
// return cu;
|
return cu;
|
||||||
//
|
|
||||||
// return (ITranslationUnit)cu.findSharedWorkingCopy(CUIPlugin.getBufferFactory());
|
return (ITranslationUnit)cu.findSharedWorkingCopy(CUIPlugin.getBufferFactory());
|
||||||
// }
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -10,12 +10,6 @@
|
||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
package org.eclipse.cdt.internal.ui.util;
|
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 interface IDebugLogConstants {
|
||||||
public class DebugLogConstant {
|
public class DebugLogConstant {
|
||||||
private DebugLogConstant( int value )
|
private DebugLogConstant( int value )
|
||||||
|
|
|
@ -12,10 +12,6 @@ package org.eclipse.cdt.internal.ui.util;
|
||||||
|
|
||||||
import org.eclipse.cdt.ui.CUIPlugin;
|
import org.eclipse.cdt.ui.CUIPlugin;
|
||||||
|
|
||||||
/**
|
|
||||||
* @author hamer
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class Util implements IDebugLogConstants{
|
public class Util implements IDebugLogConstants{
|
||||||
public static boolean VERBOSE_CONTENTASSIST = false;
|
public static boolean VERBOSE_CONTENTASSIST = false;
|
||||||
private Util() {
|
private Util() {
|
||||||
|
|
|
@ -54,10 +54,31 @@ public class CElementLabelProvider extends LabelProvider {
|
||||||
public final static int SHOW_OVERLAY_ICONS = 0x010;
|
public final static int SHOW_OVERLAY_ICONS = 0x010;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constant indicating the default label rendering.
|
* Flag (bit mask) indicating that Complation Units, Class Files, Types, Declarations and Members
|
||||||
* Currently the default is equivalent to
|
* should be rendered qualified.
|
||||||
* <code>SHOW_PARAMETERS | SHOW_OVERLAY_ICONS</code>.
|
* 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 <code>0</code>) 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();
|
public final static int SHOW_DEFAULT= new Integer(SHOW_PARAMETERS | SHOW_OVERLAY_ICONS).intValue();
|
||||||
|
|
||||||
private ImageRegistry fImageRegistry;
|
private ImageRegistry fImageRegistry;
|
||||||
|
|
|
@ -13,8 +13,12 @@ package org.eclipse.cdt.ui;
|
||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
|
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
import java.util.MissingResourceException;
|
import java.util.MissingResourceException;
|
||||||
import java.util.ResourceBundle;
|
import java.util.ResourceBundle;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.model.CoreModel;
|
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.jface.text.source.ISharedTextColors;
|
||||||
import org.eclipse.swt.widgets.Display;
|
import org.eclipse.swt.widgets.Display;
|
||||||
import org.eclipse.swt.widgets.Shell;
|
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.IWorkbenchPage;
|
||||||
import org.eclipse.ui.IWorkbenchWindow;
|
import org.eclipse.ui.IWorkbenchWindow;
|
||||||
import org.eclipse.ui.plugin.AbstractUIPlugin;
|
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$
|
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()]);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue