source: rtems-eclipse-plug-in/org.rtems.cdt.toolchain2/org/rtems/cdt/Storage.java @ 840ee8f

Last change on this file since 840ee8f was 840ee8f, checked in by Sebastian Huber <sebastian.huber@…>, on 11/26/08 at 09:08:17

Fixed property storage issues.
Preferences and properties now sufficient for further development steps.

  • Property mode set to 100644
File size: 1.2 KB
Line 
1/*
2 * Copyright (c) 2008
3 * Embedded Brains GmbH
4 * Obere Lagerstr. 30
5 * D-82178 Puchheim
6 * Germany
7 * rtems@embedded-brains.de
8 *
9 * The license and distribution terms for this file may be found in the file
10 * LICENSE in this distribution or at http://www.rtems.com/license/LICENSE.
11 */
12
13package org.rtems.cdt;
14
15import org.eclipse.core.resources.IProject;
16import org.eclipse.core.runtime.CoreException;
17import org.eclipse.core.runtime.QualifiedName;
18import org.rtems.cdt.Activator;
19
20public class Storage {
21        public static String getProperty( IProject project, String key) {
22                String value = null;
23                try {
24                        value = project.getPersistentProperty( new QualifiedName( "", key));
25                } catch (CoreException e) {
26                        e.printStackTrace();
27                }
28                if (value == null) {
29                        value = Activator.getDefault().getPreferenceStore().getString( key);
30                        try {
31                                project.setPersistentProperty( new QualifiedName( "", key), value);
32                        } catch (CoreException e) {
33                                e.printStackTrace();
34                        }
35                }
36                return value;
37        }
38       
39        public static void setProperty( IProject project, String key, String value) {
40                try {
41                        project.setPersistentProperty( new QualifiedName( "", key), value);
42                } catch (CoreException e) {
43                        e.printStackTrace();
44                }
45        }
46       
47        private Storage() {
48                // Do nothing
49        }
50}
Note: See TracBrowser for help on using the repository browser.