示例#1
0
 /**
  * Sets the selection state of a file. Note that PART_SELECTED is not an option.
  *
  * @param filePath the path to the file
  * @param select true/false to select/deselect the file and all its functions
  */
 @Override
 protected void setFileSelected(String filePath, boolean select) {
   Tracker.autoloadMap.remove(filePath);
   if (!select) {
     String[] function = new String[] {"*"}; // $NON-NLS-1$
     Tracker.autoloadMap.put(filePath, function);
   }
   Tracker.autoloadDataFunctions();
   refreshAutoloadData();
   // reload autoloaded functions into existing panels
   for (String name : getPanelNames()) {
     DataFunctionPanel panel = (DataFunctionPanel) getPanel(name);
     addPanel(name, panel);
   }
 }
示例#2
0
    /**
     * Sets the selection state of a function.
     *
     * @param filePath the path to the file defining the function
     * @param function the function {name, expression, optional descriptor}
     * @param select true to select the function
     */
    @Override
    protected void setFunctionSelected(String filePath, String[] function, boolean select) {

      String[] oldExclusions = Tracker.autoloadMap.get(filePath);
      String[] newExclusions = null;
      if (!select) {
        // create or add entry to newExclusions
        if (oldExclusions == null) {
          newExclusions = new String[] {function[0]};
        } else {
          int n = oldExclusions.length;
          newExclusions = new String[n + 1];
          System.arraycopy(oldExclusions, 0, newExclusions, 0, n);
          newExclusions[n] = function[0];
        }
      } else if (oldExclusions != null) {
        // remove entry
        int n = oldExclusions.length;
        if (n > 1) {
          ArrayList<String> exclusions = new ArrayList<String>();
          for (String f : oldExclusions) {
            if (f.equals(function[0])) continue;
            exclusions.add(f);
          }
          newExclusions = exclusions.toArray(new String[exclusions.size()]);
        }
      }

      Tracker.autoloadMap.remove(filePath);
      if (newExclusions != null) {
        Tracker.autoloadMap.put(filePath, newExclusions);
      }

      Tracker.autoloadDataFunctions();
      refreshAutoloadData();
      // reload autoloaded functions into existing panels
      for (String name : getPanelNames()) {
        DataFunctionPanel panel = (DataFunctionPanel) getPanel(name);
        addPanel(name, panel);
      }
    }