/** * use {@link GraphicalViewerKeyHandler} first if auto-layout is active handles the searching on * the graph (depth-first, same way as in Outline) */ @Override public boolean keyPressed(KeyEvent e) { if (Character.isISOControl(e.character)) { if (featureModel.getLayout().hasFeaturesAutoLayout()) { return gvKeyHandler.keyPressed(e); } else { return super.keyPressed(e); } } final long currentTime = System.currentTimeMillis(); if (currentTime - lastTime > timeoutThreshold) { curSearchString = ""; } lastTime = currentTime; curIndex = updateIterator(); if (curSearchString.length() == 1 && curSearchString.charAt(0) == Character.toLowerCase(e.character)) { curSearchString = ""; curIndex = (curIndex + 1) % featureList.size(); } curSearchString += Character.toLowerCase(e.character); final int foundIndex = search(); if (foundIndex >= 0) { // select the new feature final Feature curFeature = featureModel.getFeature(featureList.get(foundIndex)); if (curFeature != null) { FeatureEditPart part = (FeatureEditPart) viewer.getEditPartRegistry().get(curFeature); viewer.setSelection(new StructuredSelection(part)); viewer.reveal(part); curIndex = foundIndex; } } return true; }