source: rtems-eclipse-plug-in/org.rtems.cdt.toolchain/src/org/rtems/cdt/toolchain/RtemsBspDefinedSymbolsValueHandler.java @ 52a6839

initial-import base
Last change on this file since 52a6839 was 52a6839, checked in by Joel Sherrill <joel.sherrill@…>, on 11/20/08 at 16:33:19

Initial import.

  • Property mode set to 100644
File size: 2.1 KB
Line 
1package org.rtems.cdt.toolchain;
2
3import java.util.Iterator;
4import java.util.List;
5import java.util.ArrayList;
6
7import org.eclipse.cdt.managedbuilder.core.IBuildObject;
8import org.eclipse.cdt.managedbuilder.core.IHoldsOptions;
9import org.eclipse.cdt.managedbuilder.core.IManagedOptionValueHandler;
10import org.eclipse.cdt.managedbuilder.core.IOption;
11import org.eclipse.cdt.managedbuilder.core.ManagedOptionValueHandler;
12
13public class RtemsBspDefinedSymbolsValueHandler extends ManagedOptionValueHandler
14                                             implements IManagedOptionValueHandler {
15  private List<String> bspDefinedSymbolList;   
16
17  public RtemsBspDefinedSymbolsValueHandler() {
18    bspDefinedSymbolList = RtemsScannerInfoCollector.getBspDefinedSymbols();
19  }
20
21  /**
22   * Handles transfer between values between UI element and
23   * back-end in different circumstances.
24   *
25   * @param configuration  build configuration of option
26   *                       (may be IConfiguration or IResourceConfiguration)
27   * @param holder         contains the holder of the option
28   * @param option         the option that is handled
29   * @param extraArgument  extra argument for handler
30   * @param event          event to be handled, one of the following:
31   *                       (EVENT_OPEN = 1, EVENT_CLOSE = 2,
32   *                        EVENT_SETDEFAULT = 3,
33   *                        EVENT_APPLY = 4, EVENT_LOAD = 5)
34   *
35   * @return  True when the event was handled, false otherwise.
36   * This enables default event handling can take place.
37   */
38  public boolean handleValue(IBuildObject configuration, IHoldsOptions holder,
39      IOption option, String extraArgument, int event) {
40    if (event == EVENT_CLOSE) return false;
41   
42    try {
43      Object defaultValue = option.getDefaultValue();
44     
45      if (   defaultValue==null
46          || (   defaultValue instanceof List
47              && ((List)defaultValue).size()<=0
48             )
49         ) {     
50        option.setDefaultValue(bspDefinedSymbolList);
51      }     
52    } catch (Exception e) {
53      return false;
54    }
55
56    return true;
57  }
58}
Note: See TracBrowser for help on using the repository browser.