Examples of FindWindow


Examples of net.sourceforge.ztail.ui.windows.FindWindow

  private ContentController() {}
 
  public void searchReq(Shell sh) {
    if (TabPanelManager.instance().getCount() <= 0) return;
   
    final FindWindow win = new FindWindow(sh);
    UXWindowsUtil.screenCenter(win);
    win.setFindAction(new UXAbstractAction() {
      @Override
      public void doAction() {
        TabItem tab = TabPanelManager.instance().getActiveTab();
        SearchEntity sEntity = new SearchEntity(
            tab.getText(),
            win.getPattern(),
            win.isRegx(),
            win.isCaseSensitive());
       
        SearchResult rs;
        try {
           rs = SearchService.instance().compileSearch(sEntity);
        } catch (ServiceException e) {
          BaseController.instance().showErrorMessage(e);
          return;
        }
       
        int ccPos = tab.getCarretPosition();
        SearchResult.SearchRangeResult srr = null;
       
        Iterator<SearchRangeResult> it = rs.getIterator();
       
        if (!it.hasNext()) {
          BaseController.instance().showWarningMessage("String not found");
          return;
        }
       
        boolean wasFound = false;
       
        while (it.hasNext()) {
          srr = it.next();
         
          if (win.getDirection() == FindWindow.DIRECTION_UP) {
            if (srr.start < ccPos) {
              wasFound = true;
              tab.select(srr.start, srr.end);
              break;
            }
          } else {
            if (srr.start >= ccPos) {
              wasFound = true;
              tab.select(srr.start, srr.end);
              break;
            }
          }
        }
       
        if (!wasFound) {
          BaseController.instance().showWarningMessage("String not found");
        }
      }
    });
    win.open();
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.