Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » EFS – FILESTORE – EDITORS …
EFS – FILESTORE – EDITORS … [message #327700] Tue, 29 April 2008 12:05 Go to next message
Carmelo  is currently offline Carmelo Friend
Messages: 224
Registered: July 2009
Senior Member
Hi all one more question on efs and opening editors …

I have my XXXFileStore that links to objects in a db (returns a FileSystem
reppresentation)

I manage (thanks to Ed) to create an EditorInput on the file store so now I’m
able to open xml and txt file easily.

MyFileEditorInput implements IEditorInput, ILocationProvider,
IStorageEditorInput, IURIEditorInput

Question 1:
When I do press the save button the XXXFileStore.setContents is correctly
called
But why the editor still displays a * on the title like the editor is still
dirty (i do update the fetch info with the new time but still doesn’t
change)

Question 2:
Save as: how to deal with this button … clearly the file is in my db but the
save button will pop up the save as dialog on the file system ... any way I
can trap this and display my own dialog
I could probably do something overriding the default editors (xml/txt/html)
but I would love to use the already existing one otherwise I will just end
up creating a new one for each type :-(

Question 3:
Is there a way of distinguish between the normal save operation and when the
editor is closed.
Guess my editorInput is missing of something ...

Thanks
Kar
Re: EFS – FILESTORE – EDITORS … [message #327702 is a reply to message #327700] Tue, 29 April 2008 12:56 Go to previous messageGo to next message
Dani Megert is currently offline Dani MegertFriend
Messages: 3802
Registered: July 2009
Senior Member
KarSc wrote:
> Hi all one more question on efs and opening editors …
>
> I have my XXXFileStore that links to objects in a db (returns a
> FileSystem reppresentation)
>
> I manage (thanks to Ed) to create an EditorInput on the file store so
> now I’m able to open xml and txt file easily.
>
> MyFileEditorInput implements IEditorInput, ILocationProvider,
> IStorageEditorInput, IURIEditorInput
>
> Question 1:
> When I do press the save button the XXXFileStore.setContents is
> correctly called
> But why the editor still displays a * on the title like the editor is
> still dirty (i do update the fetch info with the new time but still
> doesn’t change)
Is this with the normal text editor? If so, how do you open your file store?

Dani
>
> Question 2:
> Save as: how to deal with this button … clearly the file is in my db
> but the save button will pop up the save as dialog on the file system
> ... any way I can trap this and display my own dialog
> I could probably do something overriding the default editors
> (xml/txt/html) but I would love to use the already existing one
> otherwise I will just end up creating a new one for each type :-(
>
> Question 3:
> Is there a way of distinguish between the normal save operation and
> when the editor is closed.
> Guess my editorInput is missing of something ...
>
> Thanks
> Kar
>
>
Re: EFS – FILESTORE – EDITORS … [message #327706 is a reply to message #327702] Tue, 29 April 2008 13:13 Go to previous messageGo to next message
Carmelo  is currently offline Carmelo Friend
Messages: 224
Registered: July 2009
Senior Member
Messaggio multiparte in formato MIME.

------=_NextPart_000_00D8_01C8AA0B.8E798570
Content-Type: text/plain;
format=flowed;
charset="utf-8";
reply-type=response
Content-Transfer-Encoding: 8bit

Hi Daniel

IEditorPart editorPart = page.openEditor(editorInput,
getEditorId(fileStore));

the editor depends on the file ext ...

my previous version of code was using just plain editorInput and I was
extending all the well known editor (default text editor and Structured text
editor from the swt project) ...
now I would love just use the EFS and use plain editor but I'm not sure that
what I'm doing is possible or correct.


-----------------------

private String getEditorId(IFileStore fileStore)
{
IWorkbench workbench = Activator.getDefault().getWorkbench();

IEditorRegistry editorRegistry = workbench.getEditorRegistry();
IEditorDescriptor descriptor =
editorRegistry.getDefaultEditor(fileStore.getName());
if (descriptor != null)
return descriptor.getId();
return EditorsUI.DEFAULT_TEXT_EDITOR_ID;
}


-----------------



"Daniel Megert" <daniel_megert@ch.ibm.com> ha scritto nel messaggio
news:fv75tt$qjp$3@build.eclipse.org...
> KarSc wrote:
>> Hi all one more question on efs and opening editors …
>>
>> I have my XXXFileStore that links to objects in a db (returns a
>> FileSystem reppresentation)
>>
>> I manage (thanks to Ed) to create an EditorInput on the file store so now
>> I’m able to open xml and txt file easily.
>>
>> MyFileEditorInput implements IEditorInput, ILocationProvider,
>> IStorageEditorInput, IURIEditorInput
>>
>> Question 1:
>> When I do press the save button the XXXFileStore.setContents is correctly
>> called
>> But why the editor still displays a * on the title like the editor is
>> still dirty (i do update the fetch info with the new time but still doesn’t
>> change)
> Is this with the normal text editor? If so, how do you open your file
> store?
>
> Dani
>>
>> Question 2:
>> Save as: how to deal with this button … clearly the file is in my db but
>> the save button will pop up the save as dialog on the file system ... any
>> way I can trap this and display my own dialog
>> I could probably do something overriding the default editors
>> (xml/txt/html) but I would love to use the already existing one otherwise
>> I will just end up creating a new one for each type :-(
>>
>> Question 3:
>> Is there a way of distinguish between the normal save operation and when
>> the editor is closed.
>> Guess my editorInput is missing of something ...
>>
>> Thanks
>> Kar
>>
>>
------=_NextPart_000_00D8_01C8AA0B.8E798570
Content-Type: text/java;
name="MyNonExistingFileEditorInput.java"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
filename="MyNonExistingFileEditorInput.java"

/*********************************************************** *************=
***
****
* Copyright (c) 2000, 2006 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
=
************************************************************ *************=
**
****/
package testefs.views;

import java.io.InputStream;
import java.net.URI;

import org.eclipse.core.filesystem.EFS;
import org.eclipse.core.filesystem.IFileStore;
import org.eclipse.core.filesystem.URIUtil;
import org.eclipse.core.resources.IStorage;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IPersistableElement;
import org.eclipse.ui.IStorageEditorInput;
import org.eclipse.ui.IURIEditorInput;
import org.eclipse.ui.editors.text.ILocationProvider;

/**
* @since 3.1
*/
public class MyNonExistingFileEditorInput implements IEditorInput,
ILocationProvider,
IStorageEditorInput, IURIEditorInput
{

private IFileStore fFileStore;
private String fName;

public MyNonExistingFileEditorInput(IFileStore fileStore, String =
name)
{
Assert.isNotNull(fileStore);

fFileStore =3D fileStore;
fName =3D name;
}

/*
* @see org.eclipse.ui.IEditorInput#exists()
*/
public boolean exists()
{
return true;
}



/*
* @see org.eclipse.ui.IEditorInput#getImageDescriptor()
*/
public ImageDescriptor getImageDescriptor()
{
return null;
}

/*
* @see org.eclipse.ui.IEditorInput#getName()
*/
public String getName()
{
return fName;
}

/*
* @see org.eclipse.ui.IEditorInput#getPersistable()
*/
public IPersistableElement getPersistable()
{
return null;
}

/*
* @see org.eclipse.ui.IEditorInput#getToolTipText()
*/
public String getToolTipText()
{
return fName;
}

/*
* @see =
org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Cla ss)
*/
public Object getAdapter(Class adapter)
{
//System.err.println("asking adapter: " + adapter);
if (ILocationProvider.class.equals(adapter))
return this;
return null;
// return Platform.getAdapterManager().getAdapter(this, =
adapter);
}

/*
* @see
org.eclipse.ui.editors.text.ILocationProvider#getPath(java.l ang.Object)
*/
public IPath getPath(Object element)
{
if (element instanceof MyNonExistingFileEditorInput)
{
MyNonExistingFileEditorInput input =3D
(MyNonExistingFileEditorInput) element;
return URIUtil.toPath(input.fFileStore.toURI());
//return new Path(input.fFileStore.toURI().getPath());
}
return null;
}

/*
* @see java.lang.Object#equals(java.lang.Object)
*/
public boolean equals(Object o)
{
if (o =3D=3D this)
return true;

if (o instanceof MyNonExistingFileEditorInput)
{
MyNonExistingFileEditorInput input =3D
(MyNonExistingFileEditorInput) o;
return fFileStore.equals(input.fFileStore);
}

return false;
}

/*
* @see java.lang.Object#hashCode()
*/
public int hashCode()
{
return fFileStore.hashCode();
}

@Override
public IStorage getStorage() throws CoreException
{
return new IStorage()
{

@Override
public InputStream getContents() throws CoreException
{
InputStream is =3D fFileStore.openInputStream(EFS.NONE, =
null);
System.out.println(" asked content: " + is);
return is;
}

@Override
public IPath getFullPath()
{
// TODO Auto-generated method stub
System.err.println(">>>>> to path: " +
URIUtil.toPath(fFileStore.toURI()));
return URIUtil.toPath(fFileStore.toURI());
}

@Override
public String getName()
{
return fFileStore.getName();
}

@Override
public boolean isReadOnly()
{
// TODO Auto-generated method stub
return false;
}

@Override
public Object getAdapter(Class adapter)
{
// TODO Auto-generated method stub
return null;
}
};
}

@Override
public URI getURI()
{
System.out.println(" asked uri: " + fFileStore.toURI());
return fFileStore.toURI();
}
}

------=_NextPart_000_00D8_01C8AA0B.8E798570--
Re: EFS – FILESTORE – EDITORS … [message #327710 is a reply to message #327706] Tue, 29 April 2008 13:43 Go to previous messageGo to next message
Dani Megert is currently offline Dani MegertFriend
Messages: 3802
Registered: July 2009
Senior Member
KarSc wrote:
> Hi Daniel
>
> IEditorPart editorPart = page.openEditor(editorInput,
> getEditorId(fileStore));
>
> the editor depends on the file ext ...
>
> my previous version of code was using just plain editorInput and I was
> extending all the well known editor (default text editor and
> Structured text editor from the swt project) ...
> now I would love just use the EFS and use plain editor but I'm not
> sure that what I'm doing is possible or correct.
This should work. If not, please file a bug report with steps to reproduce.
>
>
> -----------------------
>
> private String getEditorId(IFileStore fileStore)
> {
> IWorkbench workbench = Activator.getDefault().getWorkbench();
>
> IEditorRegistry editorRegistry = workbench.getEditorRegistry();
> IEditorDescriptor descriptor =
> editorRegistry.getDefaultEditor(fileStore.getName());
> if (descriptor != null)
> return descriptor.getId();
> return EditorsUI.DEFAULT_TEXT_EDITOR_ID;
> }
>
>
> -----------------
>
>
>
> "Daniel Megert" <daniel_megert@ch.ibm.com> ha scritto nel messaggio
> news:fv75tt$qjp$3@build.eclipse.org...
>> KarSc wrote:
>>> Hi all one more question on efs and opening editors …
>>>
>>> I have my XXXFileStore that links to objects in a db (returns a
>>> FileSystem reppresentation)
>>>
>>> I manage (thanks to Ed) to create an EditorInput on the file store
>>> so now I’m able to open xml and txt file easily.
>>>
>>> MyFileEditorInput implements IEditorInput, ILocationProvider,
>>> IStorageEditorInput, IURIEditorInput
>>>
>>> Question 1:
>>> When I do press the save button the XXXFileStore.setContents is
>>> correctly called
>>> But why the editor still displays a * on the title like the editor
>>> is still dirty (i do update the fetch info with the new time but
>>> still doesn’t change)
>> Is this with the normal text editor? If so, how do you open your file
>> store?
>>
>> Dani
>>>
>>> Question 2:
>>> Save as: how to deal with this button … clearly the file is in my db
>>> but the save button will pop up the save as dialog on the file
>>> system ... any way I can trap this and display my own dialog
>>> I could probably do something overriding the default editors
>>> (xml/txt/html) but I would love to use the already existing one
>>> otherwise I will just end up creating a new one for each type :-(
This is currently not possible (see
https://bugs.eclipse.org/bugs/show_bug.cgi?id=87863) unless you have an
RCP and build your main menu yourself.

Dani
>>>
>>> Question 3:
>>> Is there a way of distinguish between the normal save operation and
>>> when the editor is closed.
>>> Guess my editorInput is missing of something ...
Why do you need to tell the diff?

Dani
>>>
>>> Thanks
>>> Kar
>>>
>>>
Re: EFS – FILESTORE – EDITORS … [message #327716 is a reply to message #327710] Tue, 29 April 2008 14:14 Go to previous messageGo to next message
Carmelo  is currently offline Carmelo Friend
Messages: 224
Registered: July 2009
Senior Member
ok ... I shall fill a bug report for the the dirty status ...

about point 3:

the FileStore is a mapping on a file inside an object db ...
I would love to lock the file the just first time I save the document (and I
can do that using a simple flag on the setContents) but I have no control on
when the editor is really closed so I could actually do the check in on the
file ...

right now I can do check out/in on the setContent (creating lots of
versions)

I could previously taking care of this extending the editor ... but this is
to hard to manage every time a new editor is requested or assigned :-(

thanks for ur help
Kar


"Daniel Megert" <daniel_megert@ch.ibm.com> ha scritto nel messaggio
news:fv78lq$ho4$1@build.eclipse.org...
> KarSc wrote:
>> Hi Daniel
>>
>> IEditorPart editorPart = page.openEditor(editorInput,
>> getEditorId(fileStore));
>>
>> the editor depends on the file ext ...
>>
>> my previous version of code was using just plain editorInput and I was
>> extending all the well known editor (default text editor and Structured
>> text editor from the swt project) ...
>> now I would love just use the EFS and use plain editor but I'm not sure
>> that what I'm doing is possible or correct.
> This should work. If not, please file a bug report with steps to
> reproduce.
>>
>>
>> -----------------------
>>
>> private String getEditorId(IFileStore fileStore)
>> {
>> IWorkbench workbench = Activator.getDefault().getWorkbench();
>>
>> IEditorRegistry editorRegistry = workbench.getEditorRegistry();
>> IEditorDescriptor descriptor =
>> editorRegistry.getDefaultEditor(fileStore.getName());
>> if (descriptor != null)
>> return descriptor.getId();
>> return EditorsUI.DEFAULT_TEXT_EDITOR_ID;
>> }
>>
>>
>> -----------------
>>
>>
>>
>> "Daniel Megert" <daniel_megert@ch.ibm.com> ha scritto nel messaggio
>> news:fv75tt$qjp$3@build.eclipse.org...
>>> KarSc wrote:
>>>> Hi all one more question on efs and opening editors …
>>>>
>>>> I have my XXXFileStore that links to objects in a db (returns a
>>>> FileSystem reppresentation)
>>>>
>>>> I manage (thanks to Ed) to create an EditorInput on the file store so
>>>> now I’m able to open xml and txt file easily.
>>>>
>>>> MyFileEditorInput implements IEditorInput, ILocationProvider,
>>>> IStorageEditorInput, IURIEditorInput
>>>>
>>>> Question 1:
>>>> When I do press the save button the XXXFileStore.setContents is
>>>> correctly called
>>>> But why the editor still displays a * on the title like the editor is
>>>> still dirty (i do update the fetch info with the new time but still
>>>> doesn’t change)
>>> Is this with the normal text editor? If so, how do you open your file
>>> store?
>>>
>>> Dani
>>>>
>>>> Question 2:
>>>> Save as: how to deal with this button … clearly the file is in my db
>>>> but the save button will pop up the save as dialog on the file system
>>>> ... any way I can trap this and display my own dialog
>>>> I could probably do something overriding the default editors
>>>> (xml/txt/html) but I would love to use the already existing one
>>>> otherwise I will just end up creating a new one for each type :-(
> This is currently not possible (see
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=87863) unless you have an
> RCP and build your main menu yourself.
>
> Dani
>>>>
>>>> Question 3:
>>>> Is there a way of distinguish between the normal save operation and
>>>> when the editor is closed.
>>>> Guess my editorInput is missing of something ...
> Why do you need to tell the diff?
>
> Dani
>>>>
>>>> Thanks
>>>> Kar
>>>>
>>>>
Re: EFS – FILESTORE – EDITORS … [message #327718 is a reply to message #327710] Tue, 29 April 2008 14:19 Go to previous messageGo to next message
Carmelo  is currently offline Carmelo Friend
Messages: 224
Registered: July 2009
Senior Member
not sure this is the right place where to say that ...
but I would say that one more step to perform in EFS is the ability to
extract from IFileStore a real resource (IFile/...) and I believe that
already a lot of this job has been done under the NavigationTree

Kar


"Daniel Megert" <daniel_megert@ch.ibm.com> ha scritto nel messaggio
news:fv78lq$ho4$1@build.eclipse.org...
> KarSc wrote:
>> Hi Daniel
>>
>> IEditorPart editorPart = page.openEditor(editorInput,
>> getEditorId(fileStore));
>>
>> the editor depends on the file ext ...
>>
>> my previous version of code was using just plain editorInput and I was
>> extending all the well known editor (default text editor and Structured
>> text editor from the swt project) ...
>> now I would love just use the EFS and use plain editor but I'm not sure
>> that what I'm doing is possible or correct.
> This should work. If not, please file a bug report with steps to
> reproduce.
>>
>>
>> -----------------------
>>
>> private String getEditorId(IFileStore fileStore)
>> {
>> IWorkbench workbench = Activator.getDefault().getWorkbench();
>>
>> IEditorRegistry editorRegistry = workbench.getEditorRegistry();
>> IEditorDescriptor descriptor =
>> editorRegistry.getDefaultEditor(fileStore.getName());
>> if (descriptor != null)
>> return descriptor.getId();
>> return EditorsUI.DEFAULT_TEXT_EDITOR_ID;
>> }
>>
>>
>> -----------------
>>
>>
>>
>> "Daniel Megert" <daniel_megert@ch.ibm.com> ha scritto nel messaggio
>> news:fv75tt$qjp$3@build.eclipse.org...
>>> KarSc wrote:
>>>> Hi all one more question on efs and opening editors …
>>>>
>>>> I have my XXXFileStore that links to objects in a db (returns a
>>>> FileSystem reppresentation)
>>>>
>>>> I manage (thanks to Ed) to create an EditorInput on the file store so
>>>> now I’m able to open xml and txt file easily.
>>>>
>>>> MyFileEditorInput implements IEditorInput, ILocationProvider,
>>>> IStorageEditorInput, IURIEditorInput
>>>>
>>>> Question 1:
>>>> When I do press the save button the XXXFileStore.setContents is
>>>> correctly called
>>>> But why the editor still displays a * on the title like the editor is
>>>> still dirty (i do update the fetch info with the new time but still
>>>> doesn’t change)
>>> Is this with the normal text editor? If so, how do you open your file
>>> store?
>>>
>>> Dani
>>>>
>>>> Question 2:
>>>> Save as: how to deal with this button … clearly the file is in my db
>>>> but the save button will pop up the save as dialog on the file system
>>>> ... any way I can trap this and display my own dialog
>>>> I could probably do something overriding the default editors
>>>> (xml/txt/html) but I would love to use the already existing one
>>>> otherwise I will just end up creating a new one for each type :-(
> This is currently not possible (see
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=87863) unless you have an
> RCP and build your main menu yourself.
>
> Dani
>>>>
>>>> Question 3:
>>>> Is there a way of distinguish between the normal save operation and
>>>> when the editor is closed.
>>>> Guess my editorInput is missing of something ...
> Why do you need to tell the diff?
>
> Dani
>>>>
>>>> Thanks
>>>> Kar
>>>>
>>>>
Re: EFS – FILESTORE – EDITORS … [message #327720 is a reply to message #327718] Tue, 29 April 2008 14:40 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Kar,

I wonder if http://wiki.eclipse.org/index.php/EFS answers some of this?
The section "The relationship between EFS and IResource" describes the
steps you'd need to have the workspace refer to your EFS-backed resources...


KarSc wrote:
> not sure this is the right place where to say that ...
> but I would say that one more step to perform in EFS is the ability to
> extract from IFileStore a real resource (IFile/...) and I believe that
> already a lot of this job has been done under the NavigationTree
>
> Kar
>
>
> "Daniel Megert" <daniel_megert@ch.ibm.com> ha scritto nel messaggio
> news:fv78lq$ho4$1@build.eclipse.org...
>> KarSc wrote:
>>> Hi Daniel
>>>
>>> IEditorPart editorPart = page.openEditor(editorInput,
>>> getEditorId(fileStore));
>>>
>>> the editor depends on the file ext ...
>>>
>>> my previous version of code was using just plain editorInput and I
>>> was extending all the well known editor (default text editor and
>>> Structured text editor from the swt project) ...
>>> now I would love just use the EFS and use plain editor but I'm not
>>> sure that what I'm doing is possible or correct.
>> This should work. If not, please file a bug report with steps to
>> reproduce.
>>>
>>>
>>> -----------------------
>>>
>>> private String getEditorId(IFileStore fileStore)
>>> {
>>> IWorkbench workbench = Activator.getDefault().getWorkbench();
>>>
>>> IEditorRegistry editorRegistry = workbench.getEditorRegistry();
>>> IEditorDescriptor descriptor =
>>> editorRegistry.getDefaultEditor(fileStore.getName());
>>> if (descriptor != null)
>>> return descriptor.getId();
>>> return EditorsUI.DEFAULT_TEXT_EDITOR_ID;
>>> }
>>>
>>>
>>> -----------------
>>>
>>>
>>>
>>> "Daniel Megert" <daniel_megert@ch.ibm.com> ha scritto nel messaggio
>>> news:fv75tt$qjp$3@build.eclipse.org...
>>>> KarSc wrote:
>>>>> Hi all one more question on efs and opening editors …
>>>>>
>>>>> I have my XXXFileStore that links to objects in a db (returns a
>>>>> FileSystem reppresentation)
>>>>>
>>>>> I manage (thanks to Ed) to create an EditorInput on the file store
>>>>> so now I’m able to open xml and txt file easily.
>>>>>
>>>>> MyFileEditorInput implements IEditorInput, ILocationProvider,
>>>>> IStorageEditorInput, IURIEditorInput
>>>>>
>>>>> Question 1:
>>>>> When I do press the save button the XXXFileStore.setContents is
>>>>> correctly called
>>>>> But why the editor still displays a * on the title like the editor
>>>>> is still dirty (i do update the fetch info with the new time but
>>>>> still doesn’t change)
>>>> Is this with the normal text editor? If so, how do you open your
>>>> file store?
>>>>
>>>> Dani
>>>>>
>>>>> Question 2:
>>>>> Save as: how to deal with this button … clearly the file is in my
>>>>> db but the save button will pop up the save as dialog on the file
>>>>> system ... any way I can trap this and display my own dialog
>>>>> I could probably do something overriding the default editors
>>>>> (xml/txt/html) but I would love to use the already existing one
>>>>> otherwise I will just end up creating a new one for each type :-(
>> This is currently not possible (see
>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=87863) unless you have
>> an RCP and build your main menu yourself.
>>
>> Dani
>>>>>
>>>>> Question 3:
>>>>> Is there a way of distinguish between the normal save operation
>>>>> and when the editor is closed.
>>>>> Guess my editorInput is missing of something ...
>> Why do you need to tell the diff?
>>
>> Dani
>>>>>
>>>>> Thanks
>>>>> Kar
>>>>>
>>>>>
Re: EFS – FILESTORE – EDITORS … [message #327747 is a reply to message #327720] Wed, 30 April 2008 09:18 Go to previous messageGo to next message
Carmelo  is currently offline Carmelo Friend
Messages: 224
Registered: July 2009
Senior Member
I did check few examples ...

some of them plays with creating each time a local file
other actually will link the filestore to the resource view (and for me this
is not possible - the db could be really big and the navigation view will
inspect all the db each time a refresh is pressed or a new user will log for
the first caching operation ...)

"Ed Merks" <merks@ca.ibm.com> ha scritto nel messaggio
news:fv7bto$gru$1@build.eclipse.org...
> Kar,
>
> I wonder if http://wiki.eclipse.org/index.php/EFS answers some of this?
> The section "The relationship between EFS and IResource" describes the
> steps you'd need to have the workspace refer to your EFS-backed
> resources...
>
>
> KarSc wrote:
>> not sure this is the right place where to say that ...
>> but I would say that one more step to perform in EFS is the ability to
>> extract from IFileStore a real resource (IFile/...) and I believe that
>> already a lot of this job has been done under the NavigationTree
>>
>> Kar
>>
>>
>> "Daniel Megert" <daniel_megert@ch.ibm.com> ha scritto nel messaggio
>> news:fv78lq$ho4$1@build.eclipse.org...
>>> KarSc wrote:
>>>> Hi Daniel
>>>>
>>>> IEditorPart editorPart = page.openEditor(editorInput,
>>>> getEditorId(fileStore));
>>>>
>>>> the editor depends on the file ext ...
>>>>
>>>> my previous version of code was using just plain editorInput and I was
>>>> extending all the well known editor (default text editor and Structured
>>>> text editor from the swt project) ...
>>>> now I would love just use the EFS and use plain editor but I'm not sure
>>>> that what I'm doing is possible or correct.
>>> This should work. If not, please file a bug report with steps to
>>> reproduce.
>>>>
>>>>
>>>> -----------------------
>>>>
>>>> private String getEditorId(IFileStore fileStore)
>>>> {
>>>> IWorkbench workbench = Activator.getDefault().getWorkbench();
>>>>
>>>> IEditorRegistry editorRegistry = workbench.getEditorRegistry();
>>>> IEditorDescriptor descriptor =
>>>> editorRegistry.getDefaultEditor(fileStore.getName());
>>>> if (descriptor != null)
>>>> return descriptor.getId();
>>>> return EditorsUI.DEFAULT_TEXT_EDITOR_ID;
>>>> }
>>>>
>>>>
>>>> -----------------
>>>>
>>>>
>>>>
>>>> "Daniel Megert" <daniel_megert@ch.ibm.com> ha scritto nel messaggio
>>>> news:fv75tt$qjp$3@build.eclipse.org...
>>>>> KarSc wrote:
>>>>>> Hi all one more question on efs and opening editors …
>>>>>>
>>>>>> I have my XXXFileStore that links to objects in a db (returns a
>>>>>> FileSystem reppresentation)
>>>>>>
>>>>>> I manage (thanks to Ed) to create an EditorInput on the file store so
>>>>>> now I’m able to open xml and txt file easily.
>>>>>>
>>>>>> MyFileEditorInput implements IEditorInput, ILocationProvider,
>>>>>> IStorageEditorInput, IURIEditorInput
>>>>>>
>>>>>> Question 1:
>>>>>> When I do press the save button the XXXFileStore.setContents is
>>>>>> correctly called
>>>>>> But why the editor still displays a * on the title like the editor is
>>>>>> still dirty (i do update the fetch info with the new time but still
>>>>>> doesn’t change)
>>>>> Is this with the normal text editor? If so, how do you open your file
>>>>> store?
>>>>>
>>>>> Dani
>>>>>>
>>>>>> Question 2:
>>>>>> Save as: how to deal with this button … clearly the file is in my db
>>>>>> but the save button will pop up the save as dialog on the file system
>>>>>> ... any way I can trap this and display my own dialog
>>>>>> I could probably do something overriding the default editors
>>>>>> (xml/txt/html) but I would love to use the already existing one
>>>>>> otherwise I will just end up creating a new one for each type :-(
>>> This is currently not possible (see
>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=87863) unless you have an
>>> RCP and build your main menu yourself.
>>>
>>> Dani
>>>>>>
>>>>>> Question 3:
>>>>>> Is there a way of distinguish between the normal save operation and
>>>>>> when the editor is closed.
>>>>>> Guess my editorInput is missing of something ...
>>> Why do you need to tell the diff?
>>>
>>> Dani
>>>>>>
>>>>>> Thanks
>>>>>> Kar
>>>>>>
>>>>>>
Re: EFS – FILESTORE – EDITORS … [message #327750 is a reply to message #327747] Wed, 30 April 2008 12:06 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Kar,

Unfortunately, if you want an IFile, it has to live in the workspace
somewhere... Is your directory tree really so big that extracting it is
very expensive? I don't imagine it should be necessary to actually
construct the contents of all the leaf files in the tree...


KarSc wrote:
> I did check few examples ...
>
> some of them plays with creating each time a local file
> other actually will link the filestore to the resource view (and for
> me this is not possible - the db could be really big and the
> navigation view will inspect all the db each time a refresh is pressed
> or a new user will log for the first caching operation ...)
>
> "Ed Merks" <merks@ca.ibm.com> ha scritto nel messaggio
> news:fv7bto$gru$1@build.eclipse.org...
>> Kar,
>>
>> I wonder if http://wiki.eclipse.org/index.php/EFS answers some of
>> this? The section "The relationship between EFS and IResource"
>> describes the steps you'd need to have the workspace refer to your
>> EFS-backed resources...
>>
>>
>> KarSc wrote:
>>> not sure this is the right place where to say that ...
>>> but I would say that one more step to perform in EFS is the ability
>>> to extract from IFileStore a real resource (IFile/...) and I believe
>>> that already a lot of this job has been done under the NavigationTree
>>>
>>> Kar
>>>
>>>
>>> "Daniel Megert" <daniel_megert@ch.ibm.com> ha scritto nel messaggio
>>> news:fv78lq$ho4$1@build.eclipse.org...
>>>> KarSc wrote:
>>>>> Hi Daniel
>>>>>
>>>>> IEditorPart editorPart = page.openEditor(editorInput,
>>>>> getEditorId(fileStore));
>>>>>
>>>>> the editor depends on the file ext ...
>>>>>
>>>>> my previous version of code was using just plain editorInput and I
>>>>> was extending all the well known editor (default text editor and
>>>>> Structured text editor from the swt project) ...
>>>>> now I would love just use the EFS and use plain editor but I'm not
>>>>> sure that what I'm doing is possible or correct.
>>>> This should work. If not, please file a bug report with steps to
>>>> reproduce.
>>>>>
>>>>>
>>>>> -----------------------
>>>>>
>>>>> private String getEditorId(IFileStore fileStore)
>>>>> {
>>>>> IWorkbench workbench = Activator.getDefault().getWorkbench();
>>>>>
>>>>> IEditorRegistry editorRegistry =
>>>>> workbench.getEditorRegistry();
>>>>> IEditorDescriptor descriptor =
>>>>> editorRegistry.getDefaultEditor(fileStore.getName());
>>>>> if (descriptor != null)
>>>>> return descriptor.getId();
>>>>> return EditorsUI.DEFAULT_TEXT_EDITOR_ID;
>>>>> }
>>>>>
>>>>>
>>>>> -----------------
>>>>>
>>>>>
>>>>>
>>>>> "Daniel Megert" <daniel_megert@ch.ibm.com> ha scritto nel
>>>>> messaggio news:fv75tt$qjp$3@build.eclipse.org...
>>>>>> KarSc wrote:
>>>>>>> Hi all one more question on efs and opening editors …
>>>>>>>
>>>>>>> I have my XXXFileStore that links to objects in a db (returns a
>>>>>>> FileSystem reppresentation)
>>>>>>>
>>>>>>> I manage (thanks to Ed) to create an EditorInput on the file
>>>>>>> store so now I’m able to open xml and txt file easily.
>>>>>>>
>>>>>>> MyFileEditorInput implements IEditorInput, ILocationProvider,
>>>>>>> IStorageEditorInput, IURIEditorInput
>>>>>>>
>>>>>>> Question 1:
>>>>>>> When I do press the save button the XXXFileStore.setContents is
>>>>>>> correctly called
>>>>>>> But why the editor still displays a * on the title like the
>>>>>>> editor is still dirty (i do update the fetch info with the new
>>>>>>> time but still doesn’t change)
>>>>>> Is this with the normal text editor? If so, how do you open your
>>>>>> file store?
>>>>>>
>>>>>> Dani
>>>>>>>
>>>>>>> Question 2:
>>>>>>> Save as: how to deal with this button … clearly the file is in
>>>>>>> my db but the save button will pop up the save as dialog on the
>>>>>>> file system ... any way I can trap this and display my own dialog
>>>>>>> I could probably do something overriding the default editors
>>>>>>> (xml/txt/html) but I would love to use the already existing one
>>>>>>> otherwise I will just end up creating a new one for each type :-(
>>>> This is currently not possible (see
>>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=87863) unless you
>>>> have an RCP and build your main menu yourself.
>>>>
>>>> Dani
>>>>>>>
>>>>>>> Question 3:
>>>>>>> Is there a way of distinguish between the normal save operation
>>>>>>> and when the editor is closed.
>>>>>>> Guess my editorInput is missing of something ...
>>>> Why do you need to tell the diff?
>>>>
>>>> Dani
>>>>>>>
>>>>>>> Thanks
>>>>>>> Kar
>>>>>>>
>>>>>>>
Re: EFS – FILESTORE – EDITORS … [message #327753 is a reply to message #327750] Wed, 30 April 2008 13:24 Go to previous messageGo to next message
Carmelo  is currently offline Carmelo Friend
Messages: 224
Registered: July 2009
Senior Member
Hi Ed ...

honestly what I did try was just creating a fake project in the resource
view (using as a root the XXXFileStore).

the resource view was doing all the job for me and editor where just fine
....

but cashing all the name and object information (fetchInfo) ... was tacking
up to 10 or more min ... impossible for me ...

that's why I'm creating my own view

what I have seen is that the navigation/resource view is able to create
ifile starting from filestore ...
editor will deal easily with ifile ... plus all the operation like delete
copy and so on will be automatically inherited ... (and the logic is still
inside the filestore ... not in the ifile)

clearly this ifile doesn’t realy exist in the filesystem ... so why not make
it a bit more general?

Kar


"Ed Merks" <merks@ca.ibm.com> ha scritto nel messaggio
news:fv9n9n$sc6$1@build.eclipse.org...
> Kar,
>
> Unfortunately, if you want an IFile, it has to live in the workspace
> somewhere... Is your directory tree really so big that extracting it is
> very expensive? I don't imagine it should be necessary to actually
> construct the contents of all the leaf files in the tree...
>
>
> KarSc wrote:
>> I did check few examples ...
>>
>> some of them plays with creating each time a local file
>> other actually will link the filestore to the resource view (and for me
>> this is not possible - the db could be really big and the navigation view
>> will inspect all the db each time a refresh is pressed or a new user will
>> log for the first caching operation ...)
>>
>> "Ed Merks" <merks@ca.ibm.com> ha scritto nel messaggio
>> news:fv7bto$gru$1@build.eclipse.org...
>>> Kar,
>>>
>>> I wonder if http://wiki.eclipse.org/index.php/EFS answers some of this?
>>> The section "The relationship between EFS and IResource" describes the
>>> steps you'd need to have the workspace refer to your EFS-backed
>>> resources...
>>>
>>>
>>> KarSc wrote:
>>>> not sure this is the right place where to say that ...
>>>> but I would say that one more step to perform in EFS is the ability to
>>>> extract from IFileStore a real resource (IFile/...) and I believe that
>>>> already a lot of this job has been done under the NavigationTree
>>>>
>>>> Kar
>>>>
>>>>
>>>> "Daniel Megert" <daniel_megert@ch.ibm.com> ha scritto nel messaggio
>>>> news:fv78lq$ho4$1@build.eclipse.org...
>>>>> KarSc wrote:
>>>>>> Hi Daniel
>>>>>>
>>>>>> IEditorPart editorPart = page.openEditor(editorInput,
>>>>>> getEditorId(fileStore));
>>>>>>
>>>>>> the editor depends on the file ext ...
>>>>>>
>>>>>> my previous version of code was using just plain editorInput and I
>>>>>> was extending all the well known editor (default text editor and
>>>>>> Structured text editor from the swt project) ...
>>>>>> now I would love just use the EFS and use plain editor but I'm not
>>>>>> sure that what I'm doing is possible or correct.
>>>>> This should work. If not, please file a bug report with steps to
>>>>> reproduce.
>>>>>>
>>>>>>
>>>>>> -----------------------
>>>>>>
>>>>>> private String getEditorId(IFileStore fileStore)
>>>>>> {
>>>>>> IWorkbench workbench = Activator.getDefault().getWorkbench();
>>>>>>
>>>>>> IEditorRegistry editorRegistry =
>>>>>> workbench.getEditorRegistry();
>>>>>> IEditorDescriptor descriptor =
>>>>>> editorRegistry.getDefaultEditor(fileStore.getName());
>>>>>> if (descriptor != null)
>>>>>> return descriptor.getId();
>>>>>> return EditorsUI.DEFAULT_TEXT_EDITOR_ID;
>>>>>> }
>>>>>>
>>>>>>
>>>>>> -----------------
>>>>>>
>>>>>>
>>>>>>
>>>>>> "Daniel Megert" <daniel_megert@ch.ibm.com> ha scritto nel messaggio
>>>>>> news:fv75tt$qjp$3@build.eclipse.org...
>>>>>>> KarSc wrote:
>>>>>>>> Hi all one more question on efs and opening editors …
>>>>>>>>
>>>>>>>> I have my XXXFileStore that links to objects in a db (returns a
>>>>>>>> FileSystem reppresentation)
>>>>>>>>
>>>>>>>> I manage (thanks to Ed) to create an EditorInput on the file store
>>>>>>>> so now I’m able to open xml and txt file easily.
>>>>>>>>
>>>>>>>> MyFileEditorInput implements IEditorInput, ILocationProvider,
>>>>>>>> IStorageEditorInput, IURIEditorInput
>>>>>>>>
>>>>>>>> Question 1:
>>>>>>>> When I do press the save button the XXXFileStore.setContents is
>>>>>>>> correctly called
>>>>>>>> But why the editor still displays a * on the title like the editor
>>>>>>>> is still dirty (i do update the fetch info with the new time but
>>>>>>>> still doesn’t change)
>>>>>>> Is this with the normal text editor? If so, how do you open your
>>>>>>> file store?
>>>>>>>
>>>>>>> Dani
>>>>>>>>
>>>>>>>> Question 2:
>>>>>>>> Save as: how to deal with this button … clearly the file is in my
>>>>>>>> db but the save button will pop up the save as dialog on the file
>>>>>>>> system ... any way I can trap this and display my own dialog
>>>>>>>> I could probably do something overriding the default editors
>>>>>>>> (xml/txt/html) but I would love to use the already existing one
>>>>>>>> otherwise I will just end up creating a new one for each type :-(
>>>>> This is currently not possible (see
>>>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=87863) unless you have
>>>>> an RCP and build your main menu yourself.
>>>>>
>>>>> Dani
>>>>>>>>
>>>>>>>> Question 3:
>>>>>>>> Is there a way of distinguish between the normal save operation and
>>>>>>>> when the editor is closed.
>>>>>>>> Guess my editorInput is missing of something ...
>>>>> Why do you need to tell the diff?
>>>>>
>>>>> Dani
>>>>>>>>
>>>>>>>> Thanks
>>>>>>>> Kar
>>>>>>>>
>>>>>>>>
Re: EFS – FILESTORE – EDITORS … [message #327757 is a reply to message #327753] Wed, 30 April 2008 14:43 Go to previous message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Kar,

Comments below.

KarSc wrote:
> Hi Ed ...
>
> honestly what I did try was just creating a fake project in the
> resource view (using as a root the XXXFileStore).
Yes, but it sounds like the project has a monstrously big tree of
resources...
>
> the resource view was doing all the job for me and editor where just
> fine ...
>
> but cashing all the name and object information (fetchInfo) ... was
> tacking up to 10 or more min ... impossible for me ...
Approximately how big was your tree?
>
> that's why I'm creating my own view
And you have a different set of problems. :-P
>
> what I have seen is that the navigation/resource view is able to
> create ifile starting from filestore ...
Indeed.
> editor will deal easily with ifile ... plus all the operation like
> delete copy and so on will be automatically inherited ... (and the
> logic is still inside the filestore ... not in the ifile)
>
> clearly this ifile doesn’t realy exist in the filesystem ... so why
> not make it a bit more general?
It's important to realize that an IFile like any IResource has a
getParent, and if you walk up, you eventually get to an IProject and the
IWorkspaceRoot. The implication of this is that while an IFile doesn't
have to live in the file system, it does have to exist in the
workspace. So if you decide you don't want your stuff in the workspace,
you've also made the decision not to have an IFile.
>
> Kar
>
>
> "Ed Merks" <merks@ca.ibm.com> ha scritto nel messaggio
> news:fv9n9n$sc6$1@build.eclipse.org...
>> Kar,
>>
>> Unfortunately, if you want an IFile, it has to live in the workspace
>> somewhere... Is your directory tree really so big that extracting it
>> is very expensive? I don't imagine it should be necessary to
>> actually construct the contents of all the leaf files in the tree...
>>
>>
>> KarSc wrote:
>>> I did check few examples ...
>>>
>>> some of them plays with creating each time a local file
>>> other actually will link the filestore to the resource view (and for
>>> me this is not possible - the db could be really big and the
>>> navigation view will inspect all the db each time a refresh is
>>> pressed or a new user will log for the first caching operation ...)
>>>
>>> "Ed Merks" <merks@ca.ibm.com> ha scritto nel messaggio
>>> news:fv7bto$gru$1@build.eclipse.org...
>>>> Kar,
>>>>
>>>> I wonder if http://wiki.eclipse.org/index.php/EFS answers some of
>>>> this? The section "The relationship between EFS and IResource"
>>>> describes the steps you'd need to have the workspace refer to your
>>>> EFS-backed resources...
>>>>
>>>>
>>>> KarSc wrote:
>>>>> not sure this is the right place where to say that ...
>>>>> but I would say that one more step to perform in EFS is the
>>>>> ability to extract from IFileStore a real resource (IFile/...) and
>>>>> I believe that already a lot of this job has been done under the
>>>>> NavigationTree
>>>>>
>>>>> Kar
>>>>>
>>>>>
>>>>> "Daniel Megert" <daniel_megert@ch.ibm.com> ha scritto nel
>>>>> messaggio news:fv78lq$ho4$1@build.eclipse.org...
>>>>>> KarSc wrote:
>>>>>>> Hi Daniel
>>>>>>>
>>>>>>> IEditorPart editorPart = page.openEditor(editorInput,
>>>>>>> getEditorId(fileStore));
>>>>>>>
>>>>>>> the editor depends on the file ext ...
>>>>>>>
>>>>>>> my previous version of code was using just plain editorInput and
>>>>>>> I was extending all the well known editor (default text editor
>>>>>>> and Structured text editor from the swt project) ...
>>>>>>> now I would love just use the EFS and use plain editor but I'm
>>>>>>> not sure that what I'm doing is possible or correct.
>>>>>> This should work. If not, please file a bug report with steps to
>>>>>> reproduce.
>>>>>>>
>>>>>>>
>>>>>>> -----------------------
>>>>>>>
>>>>>>> private String getEditorId(IFileStore fileStore)
>>>>>>> {
>>>>>>> IWorkbench workbench =
>>>>>>> Activator.getDefault().getWorkbench();
>>>>>>>
>>>>>>> IEditorRegistry editorRegistry =
>>>>>>> workbench.getEditorRegistry();
>>>>>>> IEditorDescriptor descriptor =
>>>>>>> editorRegistry.getDefaultEditor(fileStore.getName());
>>>>>>> if (descriptor != null)
>>>>>>> return descriptor.getId();
>>>>>>> return EditorsUI.DEFAULT_TEXT_EDITOR_ID;
>>>>>>> }
>>>>>>>
>>>>>>>
>>>>>>> -----------------
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> "Daniel Megert" <daniel_megert@ch.ibm.com> ha scritto nel
>>>>>>> messaggio news:fv75tt$qjp$3@build.eclipse.org...
>>>>>>>> KarSc wrote:
>>>>>>>>> Hi all one more question on efs and opening editors …
>>>>>>>>>
>>>>>>>>> I have my XXXFileStore that links to objects in a db (returns
>>>>>>>>> a FileSystem reppresentation)
>>>>>>>>>
>>>>>>>>> I manage (thanks to Ed) to create an EditorInput on the file
>>>>>>>>> store so now I’m able to open xml and txt file easily.
>>>>>>>>>
>>>>>>>>> MyFileEditorInput implements IEditorInput, ILocationProvider,
>>>>>>>>> IStorageEditorInput, IURIEditorInput
>>>>>>>>>
>>>>>>>>> Question 1:
>>>>>>>>> When I do press the save button the XXXFileStore.setContents
>>>>>>>>> is correctly called
>>>>>>>>> But why the editor still displays a * on the title like the
>>>>>>>>> editor is still dirty (i do update the fetch info with the new
>>>>>>>>> time but still doesn’t change)
>>>>>>>> Is this with the normal text editor? If so, how do you open
>>>>>>>> your file store?
>>>>>>>>
>>>>>>>> Dani
>>>>>>>>>
>>>>>>>>> Question 2:
>>>>>>>>> Save as: how to deal with this button … clearly the file is in
>>>>>>>>> my db but the save button will pop up the save as dialog on
>>>>>>>>> the file system ... any way I can trap this and display my own
>>>>>>>>> dialog
>>>>>>>>> I could probably do something overriding the default editors
>>>>>>>>> (xml/txt/html) but I would love to use the already existing
>>>>>>>>> one otherwise I will just end up creating a new one for each
>>>>>>>>> type :-(
>>>>>> This is currently not possible (see
>>>>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=87863) unless you
>>>>>> have an RCP and build your main menu yourself.
>>>>>>
>>>>>> Dani
>>>>>>>>>
>>>>>>>>> Question 3:
>>>>>>>>> Is there a way of distinguish between the normal save
>>>>>>>>> operation and when the editor is closed.
>>>>>>>>> Guess my editorInput is missing of something ...
>>>>>> Why do you need to tell the diff?
>>>>>>
>>>>>> Dani
>>>>>>>>>
>>>>>>>>> Thanks
>>>>>>>>> Kar
>>>>>>>>>
>>>>>>>>>
Previous Topic:Problem with xxxFileStore AND editor
Next Topic:Marker, update view
Goto Forum:
  


Current Time: Sat Jul 27 16:38:58 GMT 2024

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

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

Back to the top