summaryrefslogtreecommitdiffstats
path: root/org.rtems.cdt.toolchain/src/org/rtems/cdt/toolchain/RtemsManagerRelocationLinkHandler.java
diff options
context:
space:
mode:
Diffstat (limited to 'org.rtems.cdt.toolchain/src/org/rtems/cdt/toolchain/RtemsManagerRelocationLinkHandler.java')
-rw-r--r--org.rtems.cdt.toolchain/src/org/rtems/cdt/toolchain/RtemsManagerRelocationLinkHandler.java177
1 files changed, 0 insertions, 177 deletions
diff --git a/org.rtems.cdt.toolchain/src/org/rtems/cdt/toolchain/RtemsManagerRelocationLinkHandler.java b/org.rtems.cdt.toolchain/src/org/rtems/cdt/toolchain/RtemsManagerRelocationLinkHandler.java
deleted file mode 100644
index 5d41b60..0000000
--- a/org.rtems.cdt.toolchain/src/org/rtems/cdt/toolchain/RtemsManagerRelocationLinkHandler.java
+++ /dev/null
@@ -1,177 +0,0 @@
-package org.rtems.cdt.toolchain;
-
-import java.util.Map;
-import java.util.HashMap;
-import java.util.Iterator;
-
-import org.eclipse.cdt.managedbuilder.core.IBuildObject;
-import org.eclipse.cdt.managedbuilder.core.IHoldsOptions;
-import org.eclipse.cdt.managedbuilder.core.IManagedOptionValueHandler;
-import org.eclipse.cdt.managedbuilder.core.IOption;
-
-public class RtemsManagerRelocationLinkHandler implements
- IManagedOptionValueHandler {
- private static HashMap<String, Boolean> defaultMgrStatusMap = new HashMap<String, Boolean>(32);
- private static HashMap<String, Boolean> mgrStatusMap = new HashMap<String, Boolean>(32);
- private static HashMap<String, String> no_mgr_relMap = new HashMap<String, String>(32);
-
- private static String bspLibDir;
- private static String relocationLinkObjs;
-
- static {
- bspLibDir = " " + RtemsEnvironmentVariableSupplier.
- getRtemsInstallBspLibDirectory().toPortableString() + "/";
-
- defaultMgrStatusMap.put("barrier", Boolean.FALSE);
- defaultMgrStatusMap.put("console", Boolean.TRUE);
- defaultMgrStatusMap.put("dpmem", Boolean.FALSE);
- defaultMgrStatusMap.put("event", Boolean.FALSE);
- defaultMgrStatusMap.put("ext", Boolean.FALSE);
- defaultMgrStatusMap.put("filesystem", Boolean.FALSE);
- defaultMgrStatusMap.put("io", Boolean.TRUE);
- defaultMgrStatusMap.put("mp", Boolean.FALSE);
- defaultMgrStatusMap.put("msg", Boolean.FALSE);
- defaultMgrStatusMap.put("part", Boolean.FALSE);
- defaultMgrStatusMap.put("region", Boolean.FALSE);
- defaultMgrStatusMap.put("rtmon", Boolean.FALSE);
- defaultMgrStatusMap.put("sem", Boolean.FALSE);
- defaultMgrStatusMap.put("signal", Boolean.FALSE);
- defaultMgrStatusMap.put("timer", Boolean.FALSE);
-
- no_mgr_relMap.put("barrier" , "no-barrier.rel");
- no_mgr_relMap.put("console" , "no-console.rel");
- no_mgr_relMap.put("dpmem" , "no-dpmem.rel");
- no_mgr_relMap.put("event" , "no-event.rel");
- no_mgr_relMap.put("ext" , "no-ext.rel");
- no_mgr_relMap.put("filesystem", "no-filesystem.rel");
- no_mgr_relMap.put("io" , "no-io.rel");
- no_mgr_relMap.put("mp" , "no-mp.rel");
- no_mgr_relMap.put("msg" , "no-msg.rel");
- no_mgr_relMap.put("part" , "no-part.rel");
- no_mgr_relMap.put("region" , "no-region.rel");
- no_mgr_relMap.put("rtmon" , "no-rtmon.rel");
- no_mgr_relMap.put("sem" , "no-sem.rel");
- no_mgr_relMap.put("signal" , "no-signal.rel");
- no_mgr_relMap.put("timer" , "no-timer.rel");
- }
-
- public RtemsManagerRelocationLinkHandler() {
- }
-
- /**
- * @return the relocationLinkObjs
- */
- public static synchronized String getRelocationLinkObjs() {
- return relocationLinkObjs;
- }
-
- private static synchronized void updateRelocationLink(String selectedMgrId,
- Boolean enabled) {
- StringBuilder rel = new StringBuilder(1024); // relocation link builder
- mgrStatusMap.put(selectedMgrId, enabled);
-
- for(Iterator<Map.Entry<String, Boolean>>
- i = mgrStatusMap.entrySet().iterator(); i.hasNext(); ) {
- Map.Entry<String, Boolean> entry = (Map.Entry<String, Boolean>) i.next();
-
- String mgrId = (String)entry.getKey();
- Boolean mgrEnabled = (Boolean) entry.getValue();
-
- if (!mgrEnabled.booleanValue()) {
- rel = rel.append(bspLibDir).append( no_mgr_relMap.get(mgrId) );
- }
- }
-
- relocationLinkObjs = rel.toString();
- }
-
- /**
- * Handles transfer between values between UI element and
- * back-end in different circumstances.
- *
- * @param configuration build configuration of option
- * (may be IConfiguration or IResourceConfiguration)
- * @param holder contains the holder of the option
- * @param option the option that is handled
- * @param extraArgument extra argument for handler
- * @param event event to be handled, one of the following:
- * (EVENT_OPEN = 1, EVENT_CLOSE = 2,
- * EVENT_SETDEFAULT = 3,
- * EVENT_APPLY = 4, EVENT_LOAD = 5)
- *
- * @return True when the event was handled, false otherwise.
- * This enables default event handling can take place.
- */
- public boolean handleValue(IBuildObject configuration, IHoldsOptions holder,
- IOption option, String extraArgument, int event) {
- if (event == EVENT_CLOSE) return false;
-
- try {
- String mgrId = extraArgument;
- Boolean enabled = (Boolean) option.getValue();
-
- if (enabled==null) {
- enabled = defaultMgrStatusMap.get(mgrId);
- option.setValue(enabled.booleanValue());
- }
-
- updateRelocationLink(mgrId, enabled);
- } catch (Exception e) {
- return false;
- }
-
- return true;
- }
-
- /**
- * Checks whether the value of an option is its default value.
- *
- * @param configuration build configuration of option
- * (may be IConfiguration or IResourceConfiguration)
- * @param holder contains the holder of the option
- * @param option the option that is handled
- * @param extraArgument extra argument for handler
- *
- * The additional options besides configuration are supplied to
- * provide enough information for querying the default value from
- * a potential data storage back-end.
- *
- * @return True if the options value is its default value and
- * False otherwise. This enables that default event handling can
- * take place.
- */
- public boolean isDefaultValue(IBuildObject configuration,
- IHoldsOptions holder, IOption option, String extraArgument) {
- String mgrId = extraArgument;
- return defaultMgrStatusMap.get(mgrId).equals(option.getValue());
- }
-
- /**
- * Checks whether an enumeration value of an option is currently a
- * valid choice. The use-case for this method is the case, where
- * the set of valid enumerations in the plugin.xml file changes.
- * The UI will remove entries from selection lists if the value
- * returns false.
- *
- * @param configuration build configuration of option
- * (may be IConfiguration or IResourceConfiguration)
- * @param holder contains the holder of the option
- * @param option the option that is handled
- * @param extraArgument extra argument for handler
- * @param enumValue enumeration value that is to be checked
- *
- * The additional options besides configuration are supplied to
- * provide enough information for querying information from a
- * a potential data storage back-end.
- *
- * @return True if the enumeration value is valid and False
- * otherwise.
- */
- public boolean isEnumValueAppropriate(IBuildObject configuration,
- IHoldsOptions holder, IOption option, String extraArgument,
- String enumValue) {
- // By default return true for all the enum values.
- return true;
- }
-
-}