Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [cdt-dev] problems saving into .project

Hi Derek.

Strange, I cannot reproduce your situation.
I've copied your code (with minimal changes) and invoked it several
times.
The only difference in putting "getStorage" call into "try" block.

	ICProjectDescriptionManager manager =
CoreModel.getDefault().getProjectDescriptionManager();
	IProject project = getProject();
	ICProjectDescription des =
manager.getProjectDescription(project, true); 
	try {
		ICStorageElement storage =
des.getStorage(CUIPlugin.PLUGIN_ID, true); 
		ICStorageElement settings =
storage.createChild("CHILD"); 
		settings.setValue("VALUE");
		manager.setProjectDescription(project, des, true, null);
	} catch (CoreException e) {}


The following text appeared in .cproject file in my project directory: 

	<?xml version="1.0" encoding="UTF-8"?>
	<?fileVersion 4.0.0?>

	<cproject>
	.......
	<storageModule moduleId="org.eclipse.cdt.ui">
	<CHILD>VALUE</CHILD>
	<CHILD>VALUE</CHILD>
	<CHILD>VALUE</CHILD>
	<CHILD>VALUE</CHILD>
	</storageModule>
	</cproject> 

Even if plugin ID is null, everything works.
Have you checked .log file for possible errors ?
-----------------------------------
With best regards, Oleg Krasilnikov

 

-----Original Message-----
From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx]
On Behalf Of subs
Sent: Friday, February 15, 2008 5:27 PM
To: CDT General developers list.
Subject: Re: [cdt-dev] problems saving into .project

Oleg,

Sorry, it was a typo - I should have said "not written to .cproject".

To confirm my problem, using the code below, my data is not written
anywhere.



Krasilnikov, Oleg wrote:
> Hi Derek.
> 
> Your changes are written to .cproject file. Not to .project  It is 
> documented (see javadoc for ICStorageElement, for example)
> 
> 
> -----------------------------------
> With best regards, Oleg Krasilnikov
> 
>  
> 
> -----Original Message-----
> From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx]
> On Behalf Of subs
> Sent: Thursday, February 14, 2008 8:18 PM
> To: CDT General developers list.
> Subject: [cdt-dev] problems saving into .project
> 
> Hi,
> 
> I am trying to save some additonal information into .cproject  using 
> the following code:
> 
> ICProjectDescriptionManager manager = CoreModel.getDefault() 
> .getProjectDescriptionManager();
> 
> ICProjectDescription des = manager.getProjectDescription(project, 
> true); ICStorageElement storage = des.getStorage(getPluginID(), true);

> ICStorageElement settings = storage.createChild(PROJECT_STORAGE);
> settings.setValue(value);
> try {
>      // save modifications
>      manager.setProjectDescription(project, des, true, null);
> 
> } catch (Exception e) {
>      ...
> }
> 
> But my additional information is never saved. Can anybody point out 
> what I am doing wrong?
> 
> Thanks,
> 
> --
> Derek
> _______________________________________________
> cdt-dev mailing list
> cdt-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/cdt-dev
> --------------------------------------------------------------------
> Closed Joint Stock Company Intel A/O
> Registered legal address: 125252, Moscow, Russian Federation, 
> Chapayevsky Per, 14.
> 
> This e-mail and any attachments may contain confidential material for 
> the sole use of the intended recipient(s). Any review or distribution 
> by others is strictly prohibited. If you are not the intended 
> recipient, please contact the sender and delete all copies.
> 
> _______________________________________________
> cdt-dev mailing list
> cdt-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/cdt-dev
> 

--
Derek
_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev
--------------------------------------------------------------------
Closed Joint Stock Company Intel A/O
Registered legal address: 125252, Moscow, Russian Federation, 
Chapayevsky Per, 14.

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.



Back to the top