[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.platform] Re: Workspace save participation
|
Hi Rahul,
thank you. I didn't know what the implementation for saving matters expect
that I read that the method should never thrown an exception. In
implementing the method I followed closely the example (please see below for
the code). The method is never called.
The called method plugin.writeImportantState(f); in the class Activator
currently only contains: System.out.println("Writing");
My assumption is that my Activtator Plugin needs to tell the workbench that
is has changed / information to save.
Best regards, Lars
public void saving(ISaveContext context) throws CoreException {
System.out.println("I'm not called");
switch (context.getKind()) {
case ISaveContext.FULL_SAVE:
// save the plug-in state
int saveNumber = context.getSaveNumber();
String saveFileName = "save-" + Integer.toString(saveNumber);
File f = plugin.getStateLocation().append(saveFileName).toFile();
// if we fail to write, an exception is thrown and we do not update
// the path
plugin.writeImportantState(f);
context.map(new Path("save"), new Path(saveFileName));
context.needSaveNumber();
break;
case ISaveContext.PROJECT_SAVE:
// get the project related to this save operation
IProject project = context.getProject();
// save its information, if necessary
break;
case ISaveContext.SNAPSHOT:
// This operation needs to be really fast because
// snapshots can be requested frequently by the
// workspace.
break;
}
}
"Rahul Kamdar" <rtkamdar@xxxxxxxxxxxxxxxxx> wrote in message
news:g1f1h1$e0o$1@xxxxxxxxxxxxxxxxxxxx
>I also use Workspace save participation and referred to the same article.
>Why your saveParticipant is not getting called inspite of registering it
>with the workspace initially probably might depend on your implementation
>of the "saving" method of the class ISavedParticipant. Maybe you could post
>that part here and someone could help you better.
>
> Rahul
>
> "Lars Vogel" <Lars.Vogel@xxxxxxxxx> wrote in message
> news:g1c1uc$9bv$1@xxxxxxxxxxxxxxxxxxxx
>> Hi,
>>
>> I tried to follow the Eclipse Help for participating with a RCP
>> application in the workbench saving.
>>
>> http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse.platform.doc.isv/guide/resAdv_saving.htmIn
>> my RCP application I adjusted the start method in the class Activator
>> (please see below for the coding). Here I register the
>> classMyWorkspaceSaveParticipant. I checked the class SaveManager and can
>> see thatit is registered.But during shutdown the saving method in
>> MyWorkspaceSaveParticipant is notcalled.Do I have to do do something
>> else, e.g. set the changed status of my pluginsomewhere?Best regards,
>> Larspublic void start(BundleContext context) throws Exception
>> {super.start(context);plugin = this;saveParticipant = new
>> MyWorkspaceSaveParticipant(plugin);ISavedState lastState =
>> ResourcesPlugin.getWorkspace().addSaveParticipant(plugin,
>> saveParticipant);if (lastState == null)return;IPath location =
>> lastState.lookup(new Path("save"));if (location == null)return;// the
>> plugin instance should read any important state from the file.File f =
>> getStateLocation().append(location).toFile();readStateFrom(f);}
>>
>
>