Beispiel #1
0
 /** @return secondary id, or null if not available */
 private String getViewSiteSecondaryId() {
   IMemoryRenderingSite renderingSite = fViewPane.getMemoryRenderingSite();
   IWorkbenchPartSite ps = renderingSite.getSite();
   if (ps instanceof IViewSite) {
     IViewSite vs = (IViewSite) ps;
     String secondaryId = vs.getSecondaryId();
     return secondaryId;
   }
   return null;
 }
Beispiel #2
0
 private String getPrefId() {
   // constructs id based on memory view's secondary id + the rendering view pane id
   // format:  secondaryId:viewPaneId
   StringBuffer id = new StringBuffer();
   IMemoryRenderingSite renderingSite = fViewPane.getMemoryRenderingSite();
   IWorkbenchPartSite ps = renderingSite.getSite();
   if (ps instanceof IViewSite) {
     IViewSite vs = (IViewSite) ps;
     String secondaryId = vs.getSecondaryId();
     if (secondaryId != null) {
       id.append(secondaryId);
       id.append(":"); // $NON-NLS-1$
     }
   }
   id.append(fViewPane.getId());
   String prefId = id.toString();
   return prefId;
 }
Beispiel #3
0
  public void run(IAction action) {
    ISelection selection = fView.getSite().getSelectionProvider().getSelection();

    if (selection instanceof IStructuredSelection) {
      IStructuredSelection strucSel = (IStructuredSelection) selection;

      // return if current selection is empty
      if (strucSel.isEmpty()) return;

      Object obj = strucSel.getFirstElement();

      if (obj == null) return;

      IMemoryBlock memBlock = null;

      if (obj instanceof IMemoryRendering) {
        memBlock = ((IMemoryRendering) obj).getMemoryBlock();
      } else if (obj instanceof IMemoryBlock) {
        memBlock = (IMemoryBlock) obj;
      }

      Shell shell = CDebugUIPlugin.getActiveWorkbenchShell();
      FindReplaceDialog dialog =
          new FindReplaceDialog(
              shell, (IMemoryBlockExtension) memBlock, fView, fSearchDialogProperties, fAction);
      if (action.getId().equals(FIND_NEXT_ID)) {
        if (Boolean.valueOf(
            fSearchDialogProperties.getProperty(
                FindReplaceDialog.SEARCH_ENABLE_FIND_NEXT, Boolean.FALSE.toString()))) {
          dialog.performFindNext();
        }
        return;
      } else {
        dialog.open();

        // TODO: finish feature?
        // Object results[] = dialog.getResult();
      }
    }
  }