Rebuilds the item based on the current points.
504395
def rebuild( self ):
        
        scene       = self.scene()
        if not scene:
            return
        
        self._subpaths = []
        
        grid        = scene.gridRect()
        typ         = self.chartType()
        
        hruler      = scene.horizontalRuler()
        vruler      = scene.verticalRuler()
        
        path        = QPainterPath()
        area        = QPainterPath()
        
        self._buildData.clear()
        self._buildData['path_area'] = area
        
        self.setPos(0, 0)
        
        # draw a line item
        if typ == XChartScene.Type.Line:
            first = True
            pos   = None
            home  = None
            self._ellipses = []
            
            points = self.points()
            if ( self.orientation() == Qt.Horizontal ):
                points.sort(hruler.compareValues, key = lambda x: x[0])
            else:
                points.sort(vruler.compareValues, key = lambda y: y[1])
                points.reverse()
            
            for x, y in self.points():
                pos = scene.mapFromChart(x, y)
                if first:
                    home = QPointF(pos.x(), grid.bottom())
                    area.moveTo(home)
                    area.lineTo(pos)
                    path.moveTo(pos)
                    
                    self._ellipses.append(pos)
                    
                    first = False
                else:
                    path.lineTo(pos)
                    area.lineTo(pos)
                    
                    self._ellipses.append(pos)
            
            if pos and home:
                area.lineTo(pos.x(), grid.bottom())
                area.lineTo(home)
        
        # draw a bar item
        elif typ == XChartScene.Type.Bar:
            barsize = self.barSize()
            horiz   = self.orientation() == Qt.Horizontal
            
            for x, y in self.points():
                pos = scene.mapFromChart(x, y)
                subpath = QPainterPath()
                if horiz:
                    r = min(grid.bottom() - pos.y(), 8)
                    
                    subpath.moveTo(pos.x() - barsize / 2.0, grid.bottom())
                    subpath.lineTo(pos.x() - barsize / 2.0, pos.y() + r)
                    subpath.quadTo(pos.x() - barsize / 2.0, pos.y(),
                                   pos.x() - barsize / 2.0 + r, pos.y())
                    
                    subpath.lineTo(pos.x() + barsize / 2.0 - r, pos.y())
                    subpath.quadTo(pos.x() + barsize / 2.0, pos.y(),
                                   pos.x() + barsize / 2.0, pos.y() + r)
                    
                    subpath.lineTo(pos.x() + barsize / 2.0, grid.bottom())
                    subpath.lineTo(pos.x() - barsize / 2.0, grid.bottom())
                else:
                    subpath.moveTo(grid.left(), pos.y() - barsize / 2.0)
                    subpath.lineTo(pos.x(),     pos.y() - barsize / 2.0)
                    subpath.lineTo(pos.x(),     pos.y() + barsize / 2.0)
                    subpath.lineTo(grid.left(), pos.y() + barsize / 2.0)
                    subpath.lineTo(grid.left(), pos.y() - barsize / 2.0)
                
                path.addPath(subpath)
                self._subpaths.append((x, y, subpath))
        
        # draw a pie chart
        elif typ == XChartScene.Type.Pie:
            if self.orientation() == Qt.Horizontal:
                key_index   = 0
                value_index = 1
                value_ruler = self.verticalRuler()
            else:
                key_index   = 1
                value_index = 0
                value_ruler = self.horizontalRuler()
        
            pie_values = {}
            
            for point in self.points():
                key     = point[key_index]
                value   = point[value_index]
                
                pie_values.setdefault(key, [])
                pie_values[key].append(value)
        
            for key, values in pie_values.items():
                pie_values[key] = value_ruler.calcTotal(values)
            
            total = max(1, value_ruler.calcTotal(pie_values.values()))
            
            # calculate drawing parameters
            center   = self.pieCenter()
            radius   = self.radius()
            diameter = radius * 2
            angle    = 0
            bound    = QRectF(-radius, -radius, diameter, diameter)
            
            for key, value in sorted(pie_values.items(), key = lambda x: x[1]):
                # calculate the percentage
                perc  = float(value) / total
                
                # calculate the angle as the perc * 360
                item_angle = perc * 360
                self.setPos(center)
                
                sub_path = QPainterPath()
                sub_path.arcTo(bound, angle, item_angle)
                sub_path.lineTo(0, 0)
                
                path.addPath(sub_path)
                self._subpaths.append((key, value, sub_path))
                
                angle += item_angle
                
        self.setPath(path)
        self._dirty = False
431968
public function rebuild()
    {
        if ($this->tracker->isOutdated()) {
            $this->logger->info('[Webpack 1/2]: Compiling assets.');
            $output = $this->compiler->compile();
            $this->logger->debug($output);

            $this->logger->info('[Webpack 2/2]: Dumping assets.');
            $this->dumper->dump();
        } else {
            $this->logger->info('[Webpack]: Cache still up-to-date.');
        }
    }
1086196
public function rebuildtree(){
		//Rebuild categories ads trigger count.

		//Rebuild nested set - get cat
		BLog::addToLog('[Items] rebuilding nested sets...');
		//
		$bcache=\Brilliant\BFactory::getCache();
		if($bcache){
			$bcache->invalidate();
			}
		//
		$catslist=$this->itemsFilter(array());
		BLog::addToLog('[Items] Total categories count:'.count($catslist).'...');

		$rootcats=array();
		//
		foreach($catslist as $cat){
			$cat->level=0;
			$cat->lft=0;
			$cat->rgt=0;
			if(empty($cat->{$this->parentKeyName})){
				$rootcats[]=$cat;
				}
			}
		//Sort root categories.
		$n=count($rootcats);
		BLog::addToLog('[Items] Root categories count:'.$n.'...');
		for($i=0; $i<$n; $i++){
			$m=$i;
			for($j=$i+1; $j<$n; $j++){
				if($rootcats[$j]->ordering < $rootcats[$m]->ordering){
					$m=$j;
					}
				}
			if($m!=$i){
				$t=$rootcats[$i];
				$rootcats[$i]=$rootcats[$m];
				$rootcats[$m]=$t;
				}
			}

		//Foreach by root categories...
		foreach($rootcats as $rcat){
			BLog::addToLog('[Items] Processing root category ['.$rcat->id.']');

			$rcat->level=1;
			$lft=1; $rgt=2;
			$this->rebuildtree_recursive($rcat,$lft,$rgt);
			$rcat->lft=1;
			$rcat->rgt=$rgt;
			}
		$db=\Brilliant\BFactory::getDBO();
		if(empty($db)){
			return false;
			}
		BLog::addToLog('[Items] Updating nested set...');
		foreach($catslist as $ct){
			$qr='UPDATE `'.$this->tableName.'` set `'.$this->leftKeyName.'`='.$ct->lft.', `'.$this->rightKeyName.'`='.$ct->rgt.', `'.$this->levelKeyName.'`='.$ct->level.' WHERE `'.$this->primaryKeyName.'`='.$ct->id;
			$q=$db->query($qr);
			if(empty($q)){
				return false;
				}
			}
		//Invalidate all cache.
		$bcache=\Brilliant\BFactory::getCache();
		if($bcache){
			$bcache->invalidate();
			}
		return true;
		}
417132
def build(self):
        """"""
        if self.is_built():  # pragma: no cover
            return
        with _wait_signal(self.loadFinished, 20):
            self.rebuild()
        self._built = True
215300
def refresh_items(self):
        
        old_items = self.items[:]# if self._dirty else []
        old_iter_data = self._iter_data# if self._dirty else {}
        iterable = self.windowed_iterable
        pattern_nodes = self.pattern_nodes
        new_iter_data = sortedmap()
        new_items = []

        if iterable is not None and len(pattern_nodes) > 0:
            for loop_index, loop_item in enumerate(iterable):
                iteration = old_iter_data.get(loop_item)
                if iteration is not None:
                    new_iter_data[loop_item] = iteration
                    new_items.append(iteration)
                    old_items.remove(iteration)
                    continue
                iteration = []
                new_iter_data[loop_item] = iteration
                new_items.append(iteration)
                for nodes, key, f_locals in pattern_nodes:
                    with new_scope(key, f_locals) as f_locals:
                        f_locals['loop_index'] = loop_index
                        f_locals['loop_item'] = loop_item
                        for node in nodes:
                            child = node(None)
                            if isinstance(child, list):
                                iteration.extend(child)
                            else:
                                iteration.append(child)
        
        # Add to old items list
        #self.old_items.extend(old_items)
        
        #if self._dirty:
        for iteration in old_items:
            for old in iteration:
                if not old.is_destroyed:
                    old.destroy()

        if len(new_items) > 0:
            expanded = []
            recursive_expand(sum(new_items, []), expanded)
            self.parent.insert_children(self, expanded)

        self.items = new_items# if self._dirty else new_items+old_items
        self._iter_data = new_iter_data
314759
public void build() {
        Preconditions.checkState(!isBuilt);

        for (final InvoiceItem item : pendingItemAdj) {
            // If the linked item was ignored, ignore this adjustment too
            final InvoiceItem ignoredLinkedItem = Iterables.tryFind(existingIgnoredItems, new Predicate<InvoiceItem>() {
                @Override
                public boolean apply(final InvoiceItem input) {
                    return input.getId().equals(item.getLinkedItemId());
                }
            }).orNull();
            if (ignoredLinkedItem == null) {
                final Item fullyAdjustedItem = root.addAdjustment(item, targetInvoiceId);
                if (fullyAdjustedItem != null) {
                    existingFullyAdjustedItems.add(fullyAdjustedItem);
                }
            }
        }
        pendingItemAdj.clear();

        root.buildForExistingItems(items, targetInvoiceId);
        isBuilt = true;
    }
1180620
@Override
  protected void rebuild(final int newCapacity) {
    final int numValues = getNumValues();
    checkIfEnoughMemory(mem_, newCapacity, numValues);
    final int currCapacity = getCurrentCapacity();
    final long[] keys = new long[currCapacity];
    final double[] values = new double[currCapacity * numValues];
    mem_.getLongArray(keysOffset_, keys, 0, currCapacity);
    mem_.getDoubleArray(valuesOffset_, values, 0, currCapacity * numValues);
    mem_.clear(keysOffset_,
        ((long) SIZE_OF_KEY_BYTES * newCapacity) + ((long) SIZE_OF_VALUE_BYTES * newCapacity * numValues));
    mem_.putInt(RETAINED_ENTRIES_INT, 0);
    mem_.putByte(LG_CUR_CAPACITY_BYTE, (byte)Integer.numberOfTrailingZeros(newCapacity));
    valuesOffset_ = keysOffset_ + (SIZE_OF_KEY_BYTES * newCapacity);
    lgCurrentCapacity_ = Integer.numberOfTrailingZeros(newCapacity);
    for (int i = 0; i < keys.length; i++) {
      if ((keys[i] != 0) && (keys[i] < theta_)) {
        insert(keys[i], Arrays.copyOfRange(values, i * numValues, (i + 1) * numValues));
      }
    }
    setRebuildThreshold();
  }
363659
def rebuildGrid( self ):
        
        vruler = self.verticalRuler()
        hruler = self.horizontalRuler()
        
        rect   = self._buildData['grid_rect']
        
        # process the vertical ruler
        h_lines     = []
        h_alt       = []
        h_notches   = []
        
        vpstart  = vruler.padStart()
        vnotches = vruler.notches()
        vpend    = vruler.padEnd()
        vcount   = len(vnotches) + vpstart + vpend
        deltay   = rect.height() / max((vcount - 1), 1)
        y        = rect.bottom()
        alt      = False
        
        for i in range(vcount):
            h_lines.append(QLineF(rect.left(), y, rect.right(), y))
            
            # store alternate color
            if ( alt ):
                alt_rect = QRectF(rect.left(), y, rect.width(), deltay)
                h_alt.append(alt_rect)
            
            # store notch information
            nidx = i - vpstart
            if ( 0 <= nidx and nidx < len(vnotches) ):
                notch = vnotches[nidx]
                notch_rect = QRectF(0, y - 3, rect.left() - 3, deltay)
                h_notches.append((notch_rect, notch))
            
            y -= deltay
            alt = not alt
        
        self._buildData['grid_h_lines']     = h_lines
        self._buildData['grid_h_alt']       = h_alt
        self._buildData['grid_h_notches']   = h_notches
        
        # process the horizontal ruler
        v_lines     = []
        v_alt       = []
        v_notches   = []
        
        hpstart     = hruler.padStart()
        hnotches    = hruler.notches()
        hpend       = hruler.padEnd()
        hcount      = len(hnotches) + hpstart + hpend
        deltax      = rect.width() / max((hcount - 1), 1)
        x           = rect.left()
        alt         = False
        
        for i in range(hcount):
            v_lines.append(QLineF(x, rect.top(), x, rect.bottom()))
            
            # store alternate info
            if ( alt ):
                alt_rect = QRectF(x - deltax, rect.top(), deltax, rect.height())
                v_alt.append(alt_rect)
            
            # store notch information
            nidx = i - hpstart
            if ( 0 <= nidx and nidx < len(hnotches) ):
                notch = hnotches[nidx]
                notch_rect = QRectF(x - (deltax / 2.0), 
                                    rect.bottom() + 3, 
                                    deltax, 
                                    13)
                v_notches.append((notch_rect, notch))
            
            x += deltax
            alt = not alt
        
        self._buildData['grid_v_lines']     = v_lines
        self._buildData['grid_v_alt']       = v_alt
        self._buildData['grid_v_notches']   = v_notches
        
        # draw the axis lines
        axis_lines = []
        axis_lines.append(QLineF(rect.left(), 
                                 rect.top(), 
                                 rect.left(), 
                                 rect.bottom()))
                                 
        axis_lines.append(QLineF(rect.left(), 
                                 rect.bottom(), 
                                 rect.right(), 
                                 rect.bottom()))
        
        self._buildData['axis_lines'] = axis_lines
1205374
public void build() {
        Preconditions.checkState(!isBuilt);

        if (pendingItemAdj.size() > 0) {
            for (InvoiceItem item : pendingItemAdj) {
                addExistingItem(item, true);
            }
            pendingItemAdj.clear();
        }
        for (SubscriptionItemTree tree : subscriptionItemTree.values()) {
            tree.build();
        }
        isBuilt = true;
    }
183117
def rebuildButtons(self):
        
        for btn in self.findChildren(XAdvancedButton):
            btn.close()
            btn.setParent(None)
            btn.deleteLater()
        
        for standard, advanced in self._advancedMap.items():
            rect    = self.actionGeometry(standard)
            btn     = XAdvancedButton(self)
            btn.setFixedWidth(22)
            btn.setFixedHeight(rect.height())
            btn.setDefaultAction(advanced)
            btn.setAutoRaise(True)
            btn.move(rect.right() + 1, rect.top())
            btn.show()
            
            if btn.icon().isNull():
                btn.setIcon(QIcon(resources.find('img/advanced.png')))
            
            btn.clicked.connect(self.acceptAdvanced)
252803
def rebuildMonth( self ):
        
        # make sure we start at 0 for sunday vs. 7 for sunday
        day_map     = dict([(i+1, i+1) for i in range(7)])
        day_map[7]  = 0
        
        today   = QDate.currentDate()
        curr    = self.currentDate()
        first   = QDate(curr.year(), curr.month(), 1)
        last    = QDate(curr.year(), curr.month(), curr.daysInMonth())
        first   = first.addDays(-day_map[first.dayOfWeek()])
        last    = last.addDays(6-day_map[last.dayOfWeek()])
        
        cols    = 7
        rows    = (first.daysTo(last) + 1) / cols
        
        hlines  = []
        vlines  = []
        
        padx    = 6
        pady    = 6
        header  = 24
        
        w       = self.width() - (2 * padx)
        h       = self.height() - (2 * pady)
        
        dw      = (w / cols) - 1
        dh      = ((h - header) / rows) - 1
        
        x0      = padx
        y0      = pady + header
        
        x       = x0
        y       = y0
        
        for row in range(rows + 1):
            hlines.append(QLine(x0, y, w, y))
            y += dh
        
        for col in range(cols + 1):
            vlines.append(QLine(x, y0, x, h))
            x += dw
        
        self._buildData['grid'] = hlines + vlines
        
        # draw the date fields
        date = first
        row  = 0
        col  = 0
        
        # draw the headers
        x = x0
        y = pady
        
        regular_text = []
        mid_text     = []
        self._buildData['regular_text'] = regular_text
        self._buildData['mid_text']     = mid_text
        
        for day in ('Sun', 'Mon','Tue','Wed','Thu','Fri','Sat'):
            regular_text.append((x + 5,
                                 y,
                                 dw,
                                 y0,
                                 Qt.AlignLeft | Qt.AlignVCenter,
                                 day))
            x += dw
        
        for i in range(first.daysTo(last) + 1):
            top    = (y0 + (row * dh))
            left   = (x0 + (col * dw))
            rect   = QRectF(left - 1, top, dw, dh)
            
            # mark the current date on the calendar
            if ( date == curr ):
                self._buildData['curr_date'] = rect
            
            # mark today's date on the calendar
            elif ( date == today ):
                self._buildData['today'] = rect
            
            # determine how to draw the calendar
            format = 'd'
            if ( date.day() == 1 ):
                format = 'MMM d'
            
            # determine the color to draw the text
            if ( date.month() == curr.month() ):
                text = regular_text
            else:
                text = mid_text
            
            # draw the text
            text.append((left + 2,
                         top + 2,
                         dw - 4,
                         dh - 4,
                         Qt.AlignTop | Qt.AlignLeft,
                         date.toString(format)))
            
            # update the limits
            if ( not i ):
                self._minimumDate = date
            self._maximumDate = date
            
            self._dateGrid[date.toJulianDay()] = ((row, col), rect)
            if ( col == (cols - 1) ):
                row += 1
                col = 0
            else:
                col += 1
                
            date = date.addDays(1)
902874
def rebuild(self):
        
        table = self.tableType()
        form  = nativestring(self.filterFormat())
        
        if not table and form:
            if self.layout().count() == 0:
                self.layout().addWidget(QLabel(form, self))
            else:
                self.layout().itemAt(0).widget().setText(form)
            return
        
        elif not form:
            return
        
        for child in self.findChildren(QWidget):
            child.close()
            child.setParent(None)
            child.deleteLater()
        
        self.setUpdatesEnabled(False)
        schema = table.schema()
        
        vlayout = self.layout()
        for i in range(vlayout.count()):
            vlayout.takeAt(0)
        
        self._plugins = []
        for line in form.split('\n'):
            row = QHBoxLayout()
            row.setContentsMargins(0, 0, 0, 0)
            row.setSpacing(0)
            
            for label, lookup in FORMAT_SPLITTER.findall(line):
                # create the label
                lbl = QLabel(label, self)
                row.addWidget(lbl)
                
                # create the query plugin
                opts = lookup.split(':')
                if len(opts) == 1:
                    opts.append('is')
                
                column = schema.column(opts[0])
                if not column:
                    continue
                
                plugin = self.pluginFactory().plugin(column)
                if not plugin:
                    continue
                
                editor = plugin.createEditor(self, column, opts[1], None)
                if editor:
                    editor.setObjectName(opts[0])
                    row.addWidget(editor)
                    self._plugins.append((opts[0], opts[1], plugin, editor))
            
            row.addStretch(1)
            vlayout.addLayout(row)
        
        self.setUpdatesEnabled(True)
        self.adjustSize()
438592
def _rebuild_entries(self):
        
        self.entries = []
        def collapse_entries(group):
            for entry in group.entries:
                self.entries.append(entry)
            for subgroup in group.children:
                collapse_entries(subgroup)
                
        collapse_entries(self.root)
55759
protected function recalculateTotal(): void
    {
        $this->total = $this->itemsTotal + $this->adjustmentsTotal;

        if ($this->total < 0) {
            $this->total = 0;
        }
    }
171913
def _rebuild_circle(self):
        """"""
        self._hashring = {}
        self._sorted_keys = []
        total_weight = 0
        for node in self._nodes:
            total_weight += self._weights.get(node, 1)

        for node in self._nodes:
            weight = self._weights.get(node, 1)

            ks = math.floor((40 * len(self._nodes) * weight) / total_weight)

            for i in xrange(0, int(ks)):
                k = md5_bytes('%s-%s-salt' % (node, i))

                for l in xrange(0, 4):
                    key = ((k[3 + l * 4] << 24) | (k[2 + l * 4] << 16) |
                           (k[1 + l * 4] << 8) | k[l * 4])
                    self._hashring[key] = node
                    self._sorted_keys.append(key)

        self._sorted_keys.sort()
861009
def rebuild( self ):
        
        self.setUpdatesEnabled(False)
        
        # sync up the toolbuttons with our actions
        actions = self._actionGroup.actions()
        btns    = self.findChildren(QToolButton)
        horiz   = self.direction() in (QBoxLayout.LeftToRight, 
                                       QBoxLayout.RightToLeft)
        
        # remove unnecessary buttons
        if len(actions) < len(btns):
            rem_btns = btns[len(actions)-1:]
            btns = btns[:len(actions)]
            
            for btn in rem_btns:
                btn.close()
                btn.setParent(None)
                btn.deleteLater()
        
        # create new buttons
        elif len(btns) < len(actions):
            for i in range(len(btns), len(actions)):
                btn = QToolButton(self)
                btn.setAutoFillBackground(True)
                btns.append(btn)
                self.layout().addWidget(btn)
                
                btn.clicked.connect(self.emitClicked)
        
        # determine coloring options
        palette      = self.palette()
        checked      = palette.color(palette.Highlight)
        checked_fg   = palette.color(palette.HighlightedText)
        unchecked    = palette.color(palette.Button)
        unchecked_fg = palette.color(palette.ButtonText)
        border       = palette.color(palette.Mid)
        
        # define the stylesheet options
        options = {}
        options['top_left_radius']      = 0
        options['top_right_radius']     = 0
        options['bot_left_radius']      = 0
        options['bot_right_radius']     = 0
        options['border_color']         = border.name()
        options['checked_fg']           = checked_fg.name()
        options['checked_bg']           = checked.name()
        options['checked_bg_alt']       = checked.darker(120).name()
        options['unchecked_fg']         = unchecked_fg.name()
        options['unchecked_bg']         = unchecked.name()
        options['unchecked_bg_alt']     = unchecked.darker(120).name()
        options['padding_top']          = 1
        options['padding_bottom']       = 1
        options['padding_left']         = 1
        options['padding_right']        = 1
        
        if horiz:
            options['x1'] = 0
            options['y1'] = 0
            options['x2'] = 0
            options['y2'] = 1
        else:
            options['x1'] = 0
            options['y1'] = 0
            options['x2'] = 1
            options['y2'] = 1
        
        # sync up the actions and buttons
        count = len(actions)
        palette = self.palette()
        font = self.font()
        for i, action in enumerate(actions):
            btn = btns[i]
            
            # assign the action for this button
            if btn.defaultAction() != action:
                # clear out any existing actions
                for act in btn.actions():
                    btn.removeAction(act)
                
                # assign the given action
                btn.setDefaultAction(action)
            
            options['top_left_radius']  = 1
            options['bot_left_radius']  = 1
            options['top_right_radius'] = 1
            options['bot_right_radius'] = 1
            
            if horiz:
                options['padding_left']     = self._padding
                options['padding_right']    = self._padding
            else:
                options['padding_top']      = self._padding
                options['padding_bottom']   = self._padding
            
            if not i:
                if horiz:
                    options['top_left_radius'] = self.cornerRadius()
                    options['bot_left_radius'] = self.cornerRadius()
                    options['padding_left']    += self.cornerRadius() / 3.0
                else:
                    options['top_left_radius'] = self.cornerRadius()
                    options['top_right_radius'] = self.cornerRadius()
                    options['padding_top']     += self.cornerRadius() / 3.0
                    
            if i == count - 1:
                if horiz:
                    options['top_right_radius'] = self.cornerRadius()
                    options['bot_right_radius'] = self.cornerRadius()
                    options['padding_right']    += self.cornerRadius() / 3.0
                else:
                    options['bot_left_radius']  = self.cornerRadius()
                    options['bot_right_radius'] = self.cornerRadius()
                    options['padding_bottom']   += self.cornerRadius() / 3.0
            
            btn.setFont(font)
            btn.setPalette(palette)
            btn.setStyleSheet(TOOLBUTTON_STYLE % options)
            if horiz:
                btn.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred)
            else:
                btn.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Expanding)
        
        self.setUpdatesEnabled(True)
583461
public void rebuild() {
        if (TRACE) {
            System.out.println("rebuilding bug tree model");
        }

        NewFilterFromBug.closeAll();

        // If this thread is not interrupting a previous thread, set the paths
        // to be opened when the new tree is complete
        // If the thread is interrupting another thread, don't do this, because
        // you don't have the tree with the correct paths selected

        // As of now, it should be impossible to interrupt a rebuilding thread,
        // in another version this may change, so this if statement check is
        // left in, even though it should always be true.
        if (rebuildingThread == null) {
            setOldSelectedBugs();
        }

        Debug.println("Please Wait called right before starting rebuild thread");
        mainFrame.acquireDisplayWait();
        rebuildingThread =  edu.umd.cs.findbugs.util.Util.runInDameonThread(new Runnable() {
            BugTreeModel newModel;

            @Override
            public void run() {
                try {
                    newModel = new BugTreeModel(BugTreeModel.this);
                    newModel.listeners = listeners;
                    newModel.resetData();
                    newModel.bugSet.sortList();
                } finally {
                    rebuildingThread = null;
                    SwingUtilities.invokeLater(() -> {
                        if (newModel != null) {
                            JTree newTree = new JTree(newModel);
                            newModel.tree = newTree;
                            mainFrame.mainFrameTree.newTree(newTree, newModel);
                            mainFrame.releaseDisplayWait();
                        }
                        getOffListenerList();
                    });
                }
            }
        }, "Rebuilding thread");

    }