public void init(java.util.List<Pair<String, TextWithImports>> data) {
   myData.clear();
   for (Iterator<Pair<String, TextWithImports>> it = data.iterator(); it.hasNext(); ) {
     final Pair<String, TextWithImports> pair = it.next();
     myData.add(new Row(pair.getFirst(), pair.getSecond()));
   }
 }
Exemple #2
0
  // takes the most recently enetered keystroke
  // return true if the player has just completed the cheat
  // return false otherwise
  public boolean nextKey(int k) {
    if (cheatCode.get(keys.size()) == k) {
      keys.add(k);
      if (keys.size() == cheatCode.size()) {
        keys.clear();
        return true;
      } else return false;
    }

    // else the player has messed up and has to start over

    keys.clear();
    if (cheatCode.get(0) == k)
      keys.add(k); // if the incorrect keystroke is the start of the sequence we'll use it
    return false;
  }
 public void emptyAll() {
   myLog.clear();
   myCommandsProcessedCount = 0;
   myErrorCount = 0;
   myWarningCount = 0;
   myPlainTextView.clearAllMessages();
   myTreeView.clearAllMessages();
 }
Exemple #4
0
 public static void animationPause(int pauseTime) {
   if ((pauseTime < 1) || (pauseTime > 1000)) {
     pauseTime = 100;
   }
   try {
     Thread.sleep(pauseTime);
     synchronized (animPoints) {
       animPoints.clear();
     }
     synchronized (animLines) {
       animLines.clear();
     }
     synchronized (animOvals) {
       animOvals.clear();
     }
     synchronized (animRectangles) {
       animRectangles.clear();
     }
   } catch (InterruptedException e) {
   }
 }
Exemple #5
0
  /**
   * Runs clean-up for associated resources which need explicit disposal (e.g. listeners keeping
   * this instance alive because they were added to the model which operationally outlives this
   * instance).
   */
  public void dispose() {
    GuiActivator.getUIService().removePluginComponentListener(this);

    /*
     * Explicitly remove the components of the PluginComponent instances
     * because the latter are registered with OSGi and are thus global.
     */
    synchronized (this) {
      for (PluginComponent pluginComponent : pluginComponents)
        container.remove((Component) pluginComponent.getComponent());
      pluginComponents.clear();
    }
  }
 public synchronized void actionPerformed(ActionEvent e) {
   java.util.List<JComponent> componentsToRemove = null;
   java.util.List<Part> partsToRemove = null;
   for (JComponent component : animationStateMap.keySet()) {
     component.repaint();
     if (partsToRemove != null) {
       partsToRemove.clear();
     }
     Map<Part, AnimationState> map = animationStateMap.get(component);
     if (!component.isShowing() || map == null || map.size() == 0) {
       if (componentsToRemove == null) {
         componentsToRemove = new ArrayList<JComponent>();
       }
       componentsToRemove.add(component);
       continue;
     }
     for (Part part : map.keySet()) {
       if (map.get(part).isDone()) {
         if (partsToRemove == null) {
           partsToRemove = new ArrayList<Part>();
         }
         partsToRemove.add(part);
       }
     }
     if (partsToRemove != null) {
       if (partsToRemove.size() == map.size()) {
         // animation is done for the component
         if (componentsToRemove == null) {
           componentsToRemove = new ArrayList<JComponent>();
         }
         componentsToRemove.add(component);
       } else {
         for (Part part : partsToRemove) {
           map.remove(part);
         }
       }
     }
   }
   if (componentsToRemove != null) {
     for (JComponent component : componentsToRemove) {
       animationStateMap.remove(component);
     }
   }
   if (animationStateMap.size() == 0) {
     timer.stop();
   }
 }
 private void copy2view() {
   list_view.clear();
   for (int i = 0; i < list.size(); i++) {
     list_view.add(list.get(i));
   }
 }
 public void clear() {
   myData.clear();
   fireTableDataChanged();
 }