Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Using Problems View for files outside the workspace
Using Problems View for files outside the workspace [message #297533] Mon, 16 January 2006 20:33 Go to next message
Eclipse UserFriend
Hi,

I'm looking for the best approach to use the Problems View for files
that are not in the current workspace.

I've tried these 2 approaches so far:

1. Since the only way to add markers to the Problems View is through an
IResource, I just used the workspace root to create the markers. I don't
particularly like this approach in that: (1) the resource information in
the problems view refers to the workspace root, and (2) double-clicking
the item in the problems view will not bring me to where the problem is.
Apparently, this only works for IFile and not just any resource, which
brings me to my 2nd approach.

2. I created linked files and used them (IFile) to create the markers.
This would've been a perfect solution except I don't want the linked
files to show up on the Navigator. So i created a resource filter that
filters out a temp project created solely for the linked files. However,
the user can always disable the filter which isn't what I wanted.

Any ideas?

Thanks in advance,
Jon
Re: Using Problems View for files outside the workspace [message #297538 is a reply to message #297533] Tue, 17 January 2006 00:46 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: sunil_kamath.nohotspammail.com

Jon H <jonhatol@yahoo.ca> wrote:
> Hi,
>
> I'm looking for the best approach to use the Problems View for files
> that are not in the current workspace.
>

Create a hashmap which maps files to problems.
Cache the file in your plugin's state location.
You can load/save the file in your plugin's start() and stop() methods.

The problem with trying to track markers for external files is that you
cannot control changes to the external files. These may cause your markers
to go out of sync.
Especially in the case of changes made when Eclipse is not running.
What I do is cache problems for external files which are detected during the
current Eclipse session. When my plugin is shutdown, I throw away the
problems.
Next time the plugin starts, it starts from scratch again.

--
Sunil
Re: Using Problems View for files outside the workspace [message #297619 is a reply to message #297538] Tue, 17 January 2006 12:59 Go to previous messageGo to next message
Eclipse UserFriend
Sunil Kamath wrote:

> Create a hashmap which maps files to problems.
> Cache the file in your plugin's state location.
> You can load/save the file in your plugin's start() and stop() methods.
>
> The problem with trying to track markers for external files is that you
> cannot control changes to the external files. These may cause your markers
> to go out of sync.
> Especially in the case of changes made when Eclipse is not running.
> What I do is cache problems for external files which are detected during the
> current Eclipse session. When my plugin is shutdown, I throw away the
> problems.
> Next time the plugin starts, it starts from scratch again.

Thanks for the response, Sunil. However, I'm still not clear on how you
are able to grab an IFile from an external file. I'm curious to know how
you were able to add markers to the problems view in the first place.
Re: Using Problems View for files outside the workspace [message #297621 is a reply to message #297619] Tue, 17 January 2006 13:15 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: sunil_kamath.nohotspammail.com

Jon H <jonhatol@yahoo.ca> wrote:
> Sunil Kamath wrote:
>
>> Create a hashmap which maps files to problems.
>> Cache the file in your plugin's state location.
>> You can load/save the file in your plugin's start() and stop()
>> methods. The problem with trying to track markers for external files is
>> that
>> you cannot control changes to the external files. These may cause
>> your markers to go out of sync.
>> Especially in the case of changes made when Eclipse is not running.
>> What I do is cache problems for external files which are detected
>> during the current Eclipse session. When my plugin is shutdown, I
>> throw away the problems.
>> Next time the plugin starts, it starts from scratch again.
>
> Thanks for the response, Sunil. However, I'm still not clear on how
> you are able to grab an IFile from an external file. I'm curious to
> know how you were able to add markers to the problems view in the
> first place.

I don't actually create resource markers.
I store marker-type information in my HashMap and add annotations to the
editor view.

--
Sunil
Re: Using Problems View for files outside the workspace [message #297627 is a reply to message #297621] Tue, 17 January 2006 13:56 Go to previous messageGo to next message
Eclipse UserFriend
Sunil Kamath wrote:
> Jon H <jonhatol@yahoo.ca> wrote:
>
>>Sunil Kamath wrote:
>>
>>
>>>Create a hashmap which maps files to problems.
>>>Cache the file in your plugin's state location.
>>>You can load/save the file in your plugin's start() and stop()
>>>methods. The problem with trying to track markers for external files is
>>>that
>>>you cannot control changes to the external files. These may cause
>>>your markers to go out of sync.
>>>Especially in the case of changes made when Eclipse is not running.
>>>What I do is cache problems for external files which are detected
>>>during the current Eclipse session. When my plugin is shutdown, I
>>>throw away the problems.
>>>Next time the plugin starts, it starts from scratch again.
>>
>>Thanks for the response, Sunil. However, I'm still not clear on how
>>you are able to grab an IFile from an external file. I'm curious to
>>know how you were able to add markers to the problems view in the
>>first place.
>
>
> I don't actually create resource markers.
> I store marker-type information in my HashMap and add annotations to the
> editor view.
>

Do you show your problems in the Problems View?
Re: Using Problems View for files outside the workspace [message #297629 is a reply to message #297627] Tue, 17 January 2006 16:10 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: sunil_kamath.nohotspammail.com

Jon H <jonhatol@yahoo.ca> wrote:
[snip]
>>
>> I don't actually create resource markers.
>> I store marker-type information in my HashMap and add annotations to
>> the editor view.
>>
>
> Do you show your problems in the Problems View?

Nope. Problem View is only for resource markers on workspace files.
It is meaningless for external files.

--
Sunil
Creating or getting an IFile from external files (Was: Using Problems View for files outside the wor [message #297634 is a reply to message #297629] Tue, 17 January 2006 17:24 Go to previous messageGo to next message
Eclipse UserFriend
Sunil Kamath wrote:
> Nope. Problem View is only for resource markers on workspace files.
> It is meaningless for external files.

Thanks, Sunil.

I'd like to rephrase my questions:
1. Is there a way to get an IFile from an external file aside from
creating a linked file?
2. If the answer is "No" can we hide the linked files in the Navigator
without using resource filters?
3. Was creating temporary IFiles for external files ever considered in
the design of the Eclipse IDE?

Thanks,
Jon
Re: Creating or getting an IFile from external files (Was: Using Problems [message #297679 is a reply to message #297634] Wed, 18 January 2006 08:05 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: automatic.javalobby.org

1. No.

2. You can apply a filter to the Navigator. However, the user can disable that filter if they want. Click on the view menu for the navigator and you'll see 'Filters' -- there should be some there for '*.class' and '.*' already. If those are selected, those files will be hidden from the Navigator view. See http://help.eclipse.org/help31/index.jsp?topic=/org.eclipse. platform.doc.isv/guide/workbench_advext_resourceFilters.htm for more.

3. IFiles (and IResources in general) have been a key part in Eclipse since it was created, yes. That's because it started out with a very IDE-specific viewpoint of life. It's been getting better, but currently, an IFile and IResource is required for many things. Linked files were one addition to try and solve that problem; in the future, it may be the case that the runtime is refactored further to avoid dependencies on a specific filing system. Some of that is underway for 3.2, but don't expect the concept of a Workspace to go away any time soon.

Alex.
RCP and workspaces (Was: Creating or getting an IFile from external files) [message #297732 is a reply to message #297679] Wed, 18 January 2006 19:57 Go to previous messageGo to next message
Eclipse UserFriend
Alex Blewitt wrote:
> 1. No.
>
> 2. You can apply a filter to the Navigator. However, the user can disable that filter if they want. Click on the view menu for the navigator and you'll see 'Filters' -- there should be some there for '*.class' and '.*' already. If those are selected, those files will be hidden from the Navigator view. See http://help.eclipse.org/help31/index.jsp?topic=/org.eclipse. platform.doc.isv/guide/workbench_advext_resourceFilters.htm for more.
>
> 3. IFiles (and IResources in general) have been a key part in Eclipse since it was created, yes. That's because it started out with a very IDE-specific viewpoint of life. It's been getting better, but currently, an IFile and IResource is required for many things. Linked files were one addition to try and solve that problem; in the future, it may be the case that the runtime is refactored further to avoid dependencies on a specific filing system. Some of that is underway for 3.2, but don't expect the concept of a Workspace to go away any time soon.
>
> Alex.

Thanks, Alex. By the way, would you know if there are any plans to
incorporate workspaces into the RCP?
Re: RCP and workspaces (Was: Creating or getting an IFile from external [message #297745 is a reply to message #297732] Thu, 19 January 2006 06:02 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: automatic.javalobby.org

I don't understand the question. IWorkspace is in org.eclipse.core.resources, which in 3.1 is part of the RCP (from what I recall). There's movement afoot to move stuff into the org.equinox packages so that IWorkspace is no longer needed in a default install of RCP, but there's nothing to stop you using IWorkspace simply by using the org.eclipse.core.resources plugin in any app, RCP or otherwise.

Alex.
Re: RCP and workspaces (Was: Creating or getting an IFile from external [message #297783 is a reply to message #297745] Thu, 19 January 2006 12:01 Go to previous messageGo to next message
Eclipse UserFriend
Alex Blewitt wrote:
> I don't understand the question. IWorkspace is in org.eclipse.core.resources, which in 3.1 is part of the RCP (from what I recall). There's movement afoot to move stuff into the org.equinox packages so that IWorkspace is no longer needed in a default install of RCP, but there's nothing to stop you using IWorkspace simply by using the org.eclipse.core.resources plugin in any app, RCP or otherwise.
>
> Alex.

According to the RCP FAQ (http://wiki.eclipse.org/index.php/RCP_FAQ),
the workspace model is not included in the RCP. Are you saying we can
use the Navigator, the Problems View, and all the other views associated
with the workspace in an RCP app?
Re: RCP and workspaces (Was: Creating or getting an IFile from external [message #297788 is a reply to message #297783] Thu, 19 January 2006 13:10 Go to previous messageGo to next message
Eclipse UserFriend
Jon H wrote:
>
>
> According to the RCP FAQ (http://wiki.eclipse.org/index.php/RCP_FAQ),
> the workspace model is not included in the RCP. Are you saying we can
> use the Navigator, the Problems View, and all the other views associated
> with the workspace in an RCP app?

You can if you include their plugins in your RCP app and your
product/application has enough information to set them up (some you can
just include, some take their information from ide, some from the sdk).

Later,
PW
Re: RCP and workspaces (Was: Creating or getting an IFile from external [message #297804 is a reply to message #297788] Thu, 19 January 2006 17:56 Go to previous messageGo to next message
Eclipse UserFriend
Paul Webster wrote:
> You can if you include their plugins in your RCP app and your
> product/application has enough information to set them up (some you can
> just include, some take their information from ide, some from the sdk).

Thanks, Paul. I picked up this bug about showing annotations for
external build files in one of the threads here:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=74113
Would you know if there are plans to show not just problem annotations
but problem markers in the problems view as well for external build
files? My problem is quite similar to this.
Re: Creating or getting an IFile from external files (Was: Using Problems [message #297805 is a reply to message #297679] Thu, 19 January 2006 18:06 Go to previous messageGo to next message
Eclipse UserFriend
Alex Blewitt wrote:
> 3. IFiles (and IResources in general) have been a key part in Eclipse since it was created, yes. That's because it started out with a very IDE-specific viewpoint of life. It's been getting better, but currently, an IFile and IResource is required for many things. Linked files were one addition to try and solve that problem; in the future, it may be the case that the runtime is refactored further to avoid dependencies on a specific filing system. Some of that is underway for 3.2, but don't expect the concept of a Workspace to go away any time soon.
I was wondering if instead of moving away from IResources, was creating
transient resources ever considered as a solution for external files?
Are there any problems associated with creating transient resources
(e.g. problems with project builders or natures)?
Re: RCP and workspaces (Was: Creating or getting an IFile from external [message #297827 is a reply to message #297804] Fri, 20 January 2006 07:06 Go to previous messageGo to next message
Eclipse UserFriend
Jon H wrote:
>
>
> Thanks, Paul. I picked up this bug about showing annotations for
> external build files in one of the threads here:
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=74113
> Would you know if there are plans to show not just problem annotations
> but problem markers in the problems view as well for external build
> files? My problem is quite similar to this.

I don't know off hand ... I think that markers are tied to the
IResources, which makes them tied to internal files. I'd search for
bugs related to problem markers in non-workspace (external) files.

Later,
PW
Re: Creating or getting an IFile from external files (Was: Using [message #297830 is a reply to message #297805] Fri, 20 January 2006 08:31 Go to previous message
Eclipse UserFriend
Originally posted by: automatic.javalobby.org

You can create linked files if you want. That way, Eclipse thinks it's in the workspace, but the contents are stored outside.

However, linked files are specific to the project; look in the .project file. If you're going to do everything with linked files, the .project essentially will become a listing of every file in your project.

In other words, it depends on what solution you're wanting to do. Personally, I'd figure out a way to make a project out of it and give up on the external files; so much functionality doesn't work with them that it's almost not worth bothering at this stage.

Alex.
Previous Topic:Avoid error diolog when an exception occurs
Next Topic:tricky (?) Job/thread issue
Goto Forum:
  


Current Time: Wed Jul 16 17:45:42 EDT 2025

Powered by FUDForum. Page generated in 0.31082 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top