|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.cdt.internal.ui.util.EditorUtility
public class EditorUtility
Field Summary | |
---|---|
static java.lang.String |
DEFAULT_TEXT_EDITOR_ID
The ID of the default text editor |
Method Summary | |
---|---|
static int |
findLocalizedModifier(java.lang.String token)
Maps the localized modifier name to a code in the same manner as #findModifier. |
static org.eclipse.cdt.core.model.ICElement |
getActiveEditorCInput()
If the current active editor edits a c element return it, else return null |
static java.lang.String |
getEditorID(org.eclipse.ui.IEditorInput input,
java.lang.Object inputObject)
Determine the editor id from the given editor input and optional input object. |
static java.lang.String |
getEditorID(java.lang.String name)
Determine the editor id from the given file name using the workspace-wide content-type definitions. |
static org.eclipse.ui.IEditorInput |
getEditorInput(java.lang.Object input)
|
static org.eclipse.ui.IEditorInput |
getEditorInputForLocation(org.eclipse.core.runtime.IPath location,
org.eclipse.cdt.core.model.ICElement context)
Utility method to get an editor input for the given file system location. |
static java.lang.String |
getModifierString(int stateMask)
Returns the modifier string for the given SWT modifier modifier bits. |
static org.eclipse.core.resources.IStorage |
getStorage(org.eclipse.cdt.core.model.IBinary bin)
|
static org.eclipse.core.resources.IStorage |
getStorage(org.eclipse.cdt.core.model.ITranslationUnit tu)
|
static org.eclipse.cdt.core.model.ITranslationUnit |
getWorkingCopy(org.eclipse.cdt.core.model.ITranslationUnit cu)
Gets the working copy of an compilation unit opened in an editor |
static boolean |
isLinked(org.eclipse.core.resources.IFile file)
|
static org.eclipse.ui.IEditorPart |
isOpenInEditor(java.lang.Object inputElement)
Tests if a cu is currently shown in an editor |
static org.eclipse.ui.IEditorPart |
openInEditor(org.eclipse.core.runtime.IPath location,
org.eclipse.cdt.core.model.ICElement element)
Utility method to open an editor for the given file system location using getEditorInputForLocation(IPath, ICElement) to create
the editor input. |
static org.eclipse.ui.IEditorPart |
openInEditor(java.lang.Object inputElement)
Opens an editor for an element such as ICElement ,
IFile , or IStorage . |
static org.eclipse.ui.IEditorPart |
openInEditor(java.lang.Object inputElement,
boolean activate)
Opens an editor for an element (ICElement, IFile, IStorage...) |
static void |
revealInEditor(org.eclipse.ui.IEditorPart part,
org.eclipse.cdt.core.model.ICElement element)
Selects a C Element in an editor |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String DEFAULT_TEXT_EDITOR_ID
Method Detail |
---|
public static org.eclipse.ui.IEditorPart isOpenInEditor(java.lang.Object inputElement)
public static org.eclipse.ui.IEditorPart openInEditor(java.lang.Object inputElement) throws org.eclipse.cdt.core.model.CModelException, org.eclipse.ui.PartInitException
ICElement
,
IFile
, or IStorage
.
The editor is activated by default.
org.eclipse.cdt.core.model.CModelException
org.eclipse.ui.PartInitException
public static org.eclipse.ui.IEditorPart openInEditor(java.lang.Object inputElement, boolean activate) throws org.eclipse.cdt.core.model.CModelException, org.eclipse.ui.PartInitException
org.eclipse.cdt.core.model.CModelException
org.eclipse.ui.PartInitException
public static void revealInEditor(org.eclipse.ui.IEditorPart part, org.eclipse.cdt.core.model.ICElement element)
public static boolean isLinked(org.eclipse.core.resources.IFile file)
public static org.eclipse.ui.IEditorInput getEditorInput(java.lang.Object input) throws org.eclipse.cdt.core.model.CModelException
org.eclipse.cdt.core.model.CModelException
public static org.eclipse.ui.IEditorPart openInEditor(org.eclipse.core.runtime.IPath location, org.eclipse.cdt.core.model.ICElement element) throws org.eclipse.ui.PartInitException
getEditorInputForLocation(IPath, ICElement)
to create
the editor input.
location
- a file system locationelement
- an element related to the target file, may be null
org.eclipse.ui.PartInitException
public static org.eclipse.ui.IEditorInput getEditorInputForLocation(org.eclipse.core.runtime.IPath location, org.eclipse.cdt.core.model.ICElement context)
FileEditorInput
is returned, otherwise, the input is an IStorageEditorInput
assuming the location points to an existing file in the file system.
The ICElement
is used to determine the associated project
in case the location can not be resolved to a workspace IFile
.
location
- a valid file system locationcontext
- an element related to the target file, may be null
public static org.eclipse.cdt.core.model.ICElement getActiveEditorCInput()
public static org.eclipse.cdt.core.model.ITranslationUnit getWorkingCopy(org.eclipse.cdt.core.model.ITranslationUnit cu)
cu
- the original compilation unit (or another working copy)
public static java.lang.String getEditorID(java.lang.String name)
name
- the file name
null
public static java.lang.String getEditorID(org.eclipse.ui.IEditorInput input, java.lang.Object inputObject)
input
- the editor inputinputObject
- the input object (used to create the editor input) or null
null
public static int findLocalizedModifier(java.lang.String token)
0
if no match was foundpublic static java.lang.String getModifierString(int stateMask)
stateMask
- the SWT modifier bits
public static org.eclipse.core.resources.IStorage getStorage(org.eclipse.cdt.core.model.IBinary bin)
public static org.eclipse.core.resources.IStorage getStorage(org.eclipse.cdt.core.model.ITranslationUnit tu)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |