How to fire a install jre changed event programmatically? [message #251051] |
Tue, 29 January 2008 03:02  |
Eclipse User |
|
|
|
Hi, all:
I notice that if project A use workspace default JRE, e.g. jdk1.6.0._03, if
I change the workspace default JRE setting to, e.g jdk1.5.0_09, from
"Perference... -> Installed JREs", the project A's decoration was refreshed
as well, in fact,
org.eclipse.jdt.internal.launching.JREContainer#getClasspath Entries() was
invoked.
and now, I have my own class that implement the interface
org.eclipse.jdt.core.IClasspathContainer, and a preference page similar with
"Intalled JREs", so how can I fire a event programmatically that will invoke
my
IClasspathContainer#getClasspathEntries() and refresh the project
decoration?
Any Clue?
Thanks in advance & Best Regards!
Nick
|
|
|
Re: How to fire a install jre changed event programmatically? (Resolved) [message #251066 is a reply to message #251051] |
Tue, 29 January 2008 05:20  |
Eclipse User |
|
|
|
Hi, I find a way out, follow is code snippet:
public class ProfileContainerUpdater implements IRunnableWithProgress {
public void run(IProgressMonitor monitor) throws
InvocationTargetException,
InterruptedException {
IPath oldContainerPath = StipletCore
.getSTIPletContainerPath(PreferenceManager.DEFAULT_PROFILE);
IPath newContainerPath = StipletCore
.getSTIPletContainerPath(PreferenceManager.getDefaultProfile ()
.getName());
try {
IJavaProject[] projects = JavaCore.create(
ResourcesPlugin.getWorkspace().getRoot()).getJavaProjects();
for (int i = 0; i < projects.length; i++) {
IJavaProject javaProject = projects[i];
if (javaProject.getProject().hasNature(
BlueToolsCoreConstants.STIPLET_NATURE_ID)) {
IClasspathContainer container = new StipetClasspathContainer(
javaProject, newContainerPath);
JavaCore.setClasspathContainer(oldContainerPath,
new IJavaProject[] {
javaProject
}, new IClasspathContainer[] {
container
}, monitor);
}
}
}
catch (CoreException e) {
throw new InvocationTargetException(e);
}
}
}
"Nick Tan" <missedone@gmail.com> 写入消息
news:fnmmi7$r7s$1@build.eclipse.org...
> Hi, all:
>
> I notice that if project A use workspace default JRE, e.g. jdk1.6.0._03,
> if
> I change the workspace default JRE setting to, e.g jdk1.5.0_09, from
> "Perference... -> Installed JREs", the project A's decoration was
> refreshed
> as well, in fact,
> org.eclipse.jdt.internal.launching.JREContainer#getClasspath Entries() was
> invoked.
>
> and now, I have my own class that implement the interface
> org.eclipse.jdt.core.IClasspathContainer, and a preference page similar
> with
> "Intalled JREs", so how can I fire a event programmatically that will
> invoke my
> IClasspathContainer#getClasspathEntries() and refresh the project
> decoration?
>
> Any Clue?
>
> Thanks in advance & Best Regards!
>
> Nick
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.04756 seconds