Пример #1
0
 public LinkedPosition getCurrentLinkedPosition() {
   int start = context.getSelectionOffset();
   int end = start + context.getSelectionLength();
   LinkedPosition[] positions = fLinkedPositionGroup.getPositions();
   for (int i = 0; i < positions.length; i++) {
     LinkedPosition position = positions[i];
     if (position.includes(start) && position.includes(end)) {
       return position;
     }
   }
   return null;
 }
 public LinkedPosition getCurrentLinkedPosition() {
   Point selection = fEditor.getViewer().getSelectedRange();
   int start = selection.x;
   int end = start + selection.y;
   LinkedPosition[] positions = fLinkedPositionGroup.getPositions();
   for (int i = 0; i < positions.length; i++) {
     LinkedPosition position = positions[i];
     if (position.includes(start) && position.includes(end)) {
       return position;
     }
   }
   return null;
 }
Пример #3
0
 private void restoreFullSelection() {
   if (fOriginalSelection.y != 0) {
     int originalOffset = fOriginalSelection.x;
     LinkedPosition[] positions = fLinkedPositionGroup.getPositions();
     for (int i = 0; i < positions.length; i++) {
       LinkedPosition position = positions[i];
       if (!position.isDeleted() && position.includes(originalOffset)) {
         fEditor.getViewer().setSelectedRange(position.offset, position.length);
         return;
       }
     }
   }
 }