Esempio n. 1
0
 public List<ItemCell> getCells() {
   List<ItemCell> cells = decorator.getCells();
   if (cells == null) {
     cells = new ArrayList<ItemCell>();
     collectCells(cells);
     decorator.setCells(cells);
   }
   return cells;
 }
Esempio n. 2
0
 @Override
 public void dispose() {
   if (selection != null) {
     getItemProvider().select(getCell(selection).getItem());
   }
   decorator.dispose();
 }
Esempio n. 3
0
 protected void fireSelectionChanged() {
   SourceSelection selection = getSelection();
   ITextSourceListener[] listeners = decorator.getListeners();
   for (ITextSourceListener listener : listeners) {
     listener.selectionChanged(selection);
   }
 }
Esempio n. 4
0
 public void setMatches(Match[] matches) {
   cellToMatches = new HashMap<ItemCell, List<Match>>();
   for (Match match : matches) {
     ItemCell cell = getCell(match);
     List<Match> list = cellToMatches.get(cell);
     if (list == null) {
       list = new ArrayList<Match>();
       cellToMatches.put(cell, list);
     }
     list.add(match);
   }
   decorator.clearStyles();
   for (ItemCell cell : cellToMatches.keySet()) {
     updateCell(cell);
   }
   decorator.redraw();
 }
Esempio n. 5
0
 public void setMatch(Match match) {
   ItemCell cell1 = null, cell2 = null;
   if (selection != null) {
     cell1 = getCell(selection);
     selection = null;
     updateCell(cell1);
   }
   selection = match;
   if (selection != null) {
     cell2 = getCell(selection);
     updateCell(cell2);
   }
   if (cell1 != null) {
     decorator.redraw(cell1);
   }
   if (cell2 != null && cell2 != cell1) {
     decorator.redraw(cell2);
   }
 }
Esempio n. 6
0
 protected void updateCell(ItemCell cell) {
   List<StyleRange> list = new ArrayList<StyleRange>();
   boolean selectionFound = false;
   if (cellToMatches != null) {
     List<Match> matches = cellToMatches.get(cell);
     if (matches != null) {
       for (Match match : matches) {
         boolean sel = match.equals(selection);
         selectionFound = selectionFound | sel;
         StyleRange range = createRange(match, sel);
         list.add(range);
       }
     }
   }
   if (!selectionFound && selection != null) {
     ItemCell selCell = (ItemCell) selection.getBlock();
     if (selCell.equals(cell)) {
       list.add(createRange(selection, true));
     }
   }
   StyleRange[] ranges = list.toArray(new StyleRange[list.size()]);
   decorator.setStyles(cell, ranges);
 }
Esempio n. 7
0
 @Override
 public void removeTextSourceListener(ITextSourceListener listener) {
   decorator.removeTextSourceListener(listener);
 }
Esempio n. 8
0
 @Override
 public boolean isDisposed() {
   return decorator.isDisposed();
 }
Esempio n. 9
0
 @Override
 public void addTextSourceListener(ITextSourceListener listener) {
   decorator.addTextSourceListener(listener);
 }