Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
eclipse-plugin
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
5
Issues
5
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
asm
eclipse-plugin
Commits
657a9998
Commit
657a9998
authored
Jan 09, 2006
by
andrei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Code cleanup: removed references to internal Eclipse classes etc.
parent
bd76421e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
77 deletions
+15
-77
src/de/loskutov/bco/ui/JdtUtils.java
src/de/loskutov/bco/ui/JdtUtils.java
+15
-77
No files found.
src/de/loskutov/bco/ui/JdtUtils.java
View file @
657a9998
...
...
@@ -49,9 +49,6 @@ import org.eclipse.jdt.core.ITypeParameter;
import
org.eclipse.jdt.core.JavaCore
;
import
org.eclipse.jdt.core.JavaModelException
;
import
org.eclipse.jdt.core.Signature
;
import
org.eclipse.jdt.internal.core.PackageFragmentRoot
;
import
org.eclipse.jdt.internal.core.SourceMapper
;
import
org.eclipse.jdt.internal.corext.util.JavaModelUtil
;
import
org.eclipse.jface.text.ITextSelection
;
import
de.loskutov.bco.BytecodeOutlinePlugin
;
...
...
@@ -266,22 +263,27 @@ public class JdtUtils {
ICompilationUnit
workingCopy
=
null
;
if
(
input
instanceof
ICompilationUnit
)
{
workingCopy
=
(
ICompilationUnit
)
input
;
// be in-sync with model
// instead of using internal JavaModelUtil.reconcile(workingCopy);
synchronized
(
workingCopy
)
{
workingCopy
.
reconcile
(
ICompilationUnit
.
NO_AST
,
false
/* don't force problem detection */
,
null
/* use primary owner */
,
null
/* no progress monitor */
);
}
IJavaElement
ref
=
workingCopy
.
getElementAt
(
selection
.
getOffset
());
if
(
ref
!=
null
)
{
return
ref
;
}
}
else
if
(
input
instanceof
IClassFile
)
{
IClassFile
iClass
=
(
IClassFile
)
input
;
IJavaElement
ref
=
getElementAt
(
selection
.
getOffset
(),
iClass
);
IJavaElement
ref
=
iClass
.
getElementAt
(
selection
.
getOffset
()
);
if
(
ref
!=
null
)
{
return
ref
;
}
// ???
return
input
;
}
// be in-sync with model
JavaModelUtil
.
reconcile
(
workingCopy
);
IJavaElement
ref
=
workingCopy
.
getElementAt
(
selection
.
getOffset
());
if
(
ref
==
null
)
{
return
input
;
}
return
ref
;
return
input
;
}
/**
...
...
@@ -322,70 +324,6 @@ public class JdtUtils {
return
true
;
}
/**
* Copied from ClassFile - for usage only with external class files
* @param position
* @param iClass
* @return
* @throws JavaModelException
*/
protected
static
IJavaElement
getElementAt
(
int
position
,
IClassFile
iClass
)
throws
JavaModelException
{
SourceMapper
mapper
=
getSourceMapper
(
iClass
);
if
(
mapper
==
null
)
{
return
null
;
}
// ensure this class file's buffer is open so that source ranges are computed
iClass
.
getBuffer
();
IType
type
=
iClass
.
getType
();
IJavaElement
javaElt
=
findElement
(
type
,
position
,
mapper
);
if
(
javaElt
==
null
)
{
javaElt
=
type
;
}
return
javaElt
;
}
private
static
SourceMapper
getSourceMapper
(
IClassFile
iClass
)
{
IJavaElement
parentElement
=
iClass
.
getParent
();
while
(
parentElement
.
getElementType
()
!=
IJavaElement
.
PACKAGE_FRAGMENT_ROOT
)
{
parentElement
=
parentElement
.
getParent
();
}
PackageFragmentRoot
root
=
(
PackageFragmentRoot
)
parentElement
;
return
root
.
getSourceMapper
();
}
/**
* Copied from ClassFile - for usage only with external class files
* @param elt
* @param position
* @param mapper
* @return element
*/
protected
static
IJavaElement
findElement
(
IJavaElement
elt
,
int
position
,
SourceMapper
mapper
)
{
ISourceRange
range
=
mapper
.
getSourceRange
(
elt
);
if
(
range
==
null
||
position
<
range
.
getOffset
()
||
range
.
getOffset
()
+
range
.
getLength
()
-
1
<
position
)
{
return
null
;
}
if
(
elt
instanceof
IParent
)
{
try
{
IJavaElement
[]
children
=
((
IParent
)
elt
).
getChildren
();
for
(
int
i
=
0
;
i
<
children
.
length
;
i
++)
{
IJavaElement
match
=
findElement
(
children
[
i
],
position
,
mapper
);
if
(
match
!=
null
)
{
return
match
;
}
}
}
catch
(
JavaModelException
npe
)
{
// elt doesn't exist: return the element
}
}
return
elt
;
}
/**
* Cite: jdk1.1.8/docs/guide/innerclasses/spec/innerclasses.doc10.html: For the sake
* of tools, there are some additional requirements on the naming of an inaccessible
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment