Changeset f81e6d5 in rtems-eclipse-plug-in


Ignore:
Timestamp:
11/25/08 16:40:35 (15 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
2cf2db2
Parents:
3a85b45
Message:

Added properties (not working).

Location:
org.rtems.cdt.toolchain2
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • org.rtems.cdt.toolchain2/META-INF/MANIFEST.MF

    r3a85b45 rf81e6d5  
    1010 org.eclipse.core.resources;bundle-version="3.4.1",
    1111 org.eclipse.cdt.ui;bundle-version="5.1.0",
    12  org.eclipse.core.runtime;bundle-version="3.4.0"
     12 org.eclipse.core.runtime;bundle-version="3.4.0",
     13 org.eclipse.cdt.managedbuilder.ui
    1314Bundle-Vendor: Embedded Brains GmbH
    1415Import-Package: org.eclipse.cdt.managedbuilder.ui.wizards,
  • org.rtems.cdt.toolchain2/org/rtems/cdt/properties/PropertyPage.java

    r3a85b45 rf81e6d5  
    1313package org.rtems.cdt.properties;
    1414
    15 import org.eclipse.swt.widgets.Composite;
    16 import org.eclipse.swt.widgets.Control;
     15import org.eclipse.core.resources.IProject;
     16import org.eclipse.core.resources.IResource;
     17import org.eclipse.core.runtime.CoreException;
     18import org.eclipse.core.runtime.IAdaptable;
     19import org.eclipse.core.runtime.QualifiedName;
     20import org.eclipse.jface.preference.DirectoryFieldEditor;
     21import org.eclipse.jface.preference.ComboFieldEditor;
     22import org.eclipse.jface.preference.FieldEditorPreferencePage;
     23import org.eclipse.jface.preference.IPreferenceStore;
     24import org.eclipse.jface.preference.PreferenceStore;
     25import org.eclipse.jface.preference.StringFieldEditor;
    1726import org.eclipse.ui.IWorkbenchPropertyPage;
     27import org.rtems.cdt.Activator;
     28import org.rtems.cdt.Constants;
    1829
    19 public class PropertyPage
    20         extends org.eclipse.ui.dialogs.PropertyPage
    21         implements IWorkbenchPropertyPage {
    22 
     30public class PropertyPage extends FieldEditorPreferencePage implements IWorkbenchPropertyPage {
     31        private IAdaptable mElement;
     32       
     33        private IPreferenceStore mStore;
     34       
    2335        public PropertyPage() {
    24                 // TODO Auto-generated constructor stub
     36                super( GRID);
     37               
     38                // Get the default values from the workbench preferences
     39                IPreferenceStore store = Activator.getDefault().getPreferenceStore();
     40               
     41                mStore = new PreferenceStore();
     42                mStore.setDefault( Constants.BASE_PATH_KEY, store.getString( Constants.BASE_PATH_KEY));
     43                mStore.setDefault( Constants.VERSION_KEY, store.getString( Constants.VERSION_KEY));
     44                mStore.setDefault( Constants.TARGET_KEY, store.getString( Constants.TARGET_KEY));
     45                mStore.setDefault( Constants.BSP_PATH_KEY, store.getString( Constants.BSP_PATH_KEY));
     46                System.out.println( store.getString( Constants.BASE_PATH_KEY));
     47                System.out.println( store.getString( Constants.VERSION_KEY));
     48                System.out.println( store.getString( Constants.TARGET_KEY));
     49                System.out.println( store.getString( Constants.BSP_PATH_KEY));
     50                setPreferenceStore( mStore);
     51               
     52                setDescription( "You can change the RTEMS base installation path, the RTEMS version, the target architecture and the board support package (BSP) installation path.  This affects only the current project.");
     53        }
     54       
     55        protected void createFieldEditors() {
     56                IProject project = ((IResource) getElement()).getProject();
     57               
     58                // Store current values
     59                try {
     60                        mStore.setValue(
     61                                Constants.BASE_PATH_KEY,
     62                                project.getPersistentProperty(
     63                                        new QualifiedName( "", Constants.BASE_PATH_KEY)
     64                                )
     65                        );
     66                } catch (CoreException e) {
     67                        // TODO
     68                        e.printStackTrace();
     69                }
     70                try {
     71                        mStore.setValue(
     72                                Constants.VERSION_KEY,
     73                                project.getPersistentProperty(
     74                                        new QualifiedName( "", Constants.VERSION_KEY)
     75                                )
     76                        );
     77                } catch (CoreException e) {                             
     78                        // TODO
     79                        e.printStackTrace();
     80                }
     81                try {
     82                        mStore.setValue(
     83                                Constants.TARGET_KEY,
     84                                project.getPersistentProperty(
     85                                        new QualifiedName( "", Constants.TARGET_KEY)
     86                                )
     87                        );
     88                } catch (CoreException e) {                             
     89                        // TODO
     90                        e.printStackTrace();
     91                }
     92                try {
     93                        mStore.setValue(
     94                                Constants.BSP_PATH_KEY,
     95                                project.getPersistentProperty(
     96                                        new QualifiedName( "", Constants.BSP_PATH_KEY)
     97                                )
     98                        );
     99                } catch (CoreException e) {                             
     100                        // TODO
     101                        e.printStackTrace();
     102                }
     103                System.out.println("addFields...");
     104                addField(
     105                                new DirectoryFieldEditor(
     106                                        Constants.BASE_PATH_KEY,
     107                                        "Base path:",
     108                                        getFieldEditorParent()
     109                                )
     110                        );             
     111                        addField(
     112                                new StringFieldEditor(
     113                                        Constants.VERSION_KEY,
     114                                        "Version:",
     115                                        getFieldEditorParent()
     116                                )
     117                        );     
     118                        addField(
     119                                new ComboFieldEditor(
     120                                        Constants.TARGET_KEY,
     121                                        "Target:",
     122                                        Constants.TARGETS,
     123                                        getFieldEditorParent()
     124                                )
     125                        );
     126                        addField(
     127                                new DirectoryFieldEditor(
     128                                        Constants.BSP_PATH_KEY,
     129                                        "BSP path:",
     130                                        getFieldEditorParent()
     131                                )
     132                        );
     133                        System.out.println("...done");
     134        }
     135       
     136        public boolean performOk() {
     137                System.out.println("performOk");
     138                try {
     139                        IProject project = ((IResource) getElement()).getProject();
     140                        project.setPersistentProperty(
     141                                new QualifiedName(
     142                                        "",
     143                                        Constants.BASE_PATH_KEY
     144                                ),
     145                                mStore.getString( Constants.BASE_PATH_KEY)
     146                        );
     147                        project.setPersistentProperty(
     148                                new QualifiedName(
     149                                        "",
     150                                        Constants.VERSION_KEY
     151                                ),
     152                                mStore.getString( Constants.VERSION_KEY)
     153                        );
     154                        project.setPersistentProperty(
     155                                new QualifiedName(
     156                                        "",
     157                                        Constants.TARGET_KEY
     158                                ),
     159                                mStore.getString( Constants.TARGET_KEY)
     160                        );
     161                        project.setPersistentProperty(
     162                                new QualifiedName(
     163                                        "",
     164                                        Constants.BSP_PATH_KEY
     165                                ),
     166                                mStore.getString( Constants.BSP_PATH_KEY)
     167                        );
     168                } catch (CoreException e) {
     169                        return false;
     170                }
     171                return true;
    25172        }
    26173
    27         @Override
    28         protected Control createContents(Composite parent) {
    29                 // TODO Auto-generated method stub
    30                 return null;
     174        public IAdaptable getElement() {
     175                return mElement;
    31176        }
    32177
     178        public void setElement( IAdaptable element) {
     179                this.mElement = element;
     180        }
    33181}
  • org.rtems.cdt.toolchain2/org/rtems/cdt/wizards/BasicSetup.java

    r3a85b45 rf81e6d5  
    210210
    211211        protected boolean isCustomPageComplete() {
    212                 return false;
     212                return true;
    213213        }
    214214       
Note: See TracChangeset for help on using the changeset viewer.