protected void setSelectionToClient(
      VirtualTreeModelViewer virtualViewer, ILabelProvider labelProvider, VirtualItem findItem) {
    virtualViewer.getTree().setSelection(new VirtualItem[] {findItem});
    ModelDelta stateDelta = new ModelDelta(virtualViewer.getInput(), IModelDelta.NO_CHANGE);
    virtualViewer.saveElementState(TreePath.EMPTY, stateDelta, IModelDelta.SELECT);
    // Set the force flag to all select delta in order to override model's selection policy.
    stateDelta.accept(
        new IModelDeltaVisitor() {
          @Override
          public boolean visit(IModelDelta delta, int depth) {
            if ((delta.getFlags() & IModelDelta.SELECT) != 0) {
              ((ModelDelta) delta).setFlags(delta.getFlags() | IModelDelta.FORCE);
            }
            return true;
          }
        });
    fClientViewer.updateViewer(stateDelta);

    ISelection selection = fClientViewer.getSelection();
    if (!selection.isEmpty()
        && selection instanceof IStructuredSelection
        && ((IStructuredSelection) selection).getFirstElement().equals(findItem.getData())) {
    } else {
      DebugUIPlugin.errorDialog(
          fClientViewer.getControl().getShell(),
          ActionMessages.VirtualFindAction_0,
          MessageFormat.format(
              ActionMessages.VirtualFindAction_1, new Object[] {labelProvider.getText(findItem)}),
          new Status(
              IStatus.ERROR,
              DebugUIPlugin.getUniqueIdentifier(),
              ActionMessages.VirtualFindAction_1));
    }
  }
 /**
  * Compares two line breakpoints.
  *
  * @param b1
  * @param b2
  * @param name1
  * @param name2
  * @return
  */
 private int compareLineBreakpoints(IBreakpoint b1, IBreakpoint b2, String name1, String name2) {
   int colon1 = name1.indexOf(':');
   if (colon1 != -1) {
     int colon2 = name2.indexOf(':');
     if (colon2 != -1) {
       String upToColon1 = name1.substring(0, colon1);
       if (name2.startsWith(upToColon1)) {
         int l1 = 0;
         int l2 = 0;
         try {
           l1 = ((ILineBreakpoint) b1).getLineNumber();
         } catch (CoreException e) {
           DebugUIPlugin.log(e);
         }
         try {
           l2 = ((ILineBreakpoint) b2).getLineNumber();
         } catch (CoreException e) {
           DebugUIPlugin.log(e);
         }
         return l1 - l2;
       }
     }
   }
   return name1.compareTo(name2);
 }
  /** Add the new exception in the content pane */
  private void addCustomException() {
    String customException = addNewExceptionField.getText().trim();
    Object[] currentElements = contentProvider.getElements(inputElement);

    ArrayList<Object> currentElementsList = new ArrayList<Object>();
    for (int i = 0; i < currentElements.length; ++i) {
      Object element = currentElements[i];
      currentElementsList.add(element);
    }

    if (customException.isEmpty()) {
      return;
    }

    if (!currentElementsList.contains(customException)) {
      getViewer().add(customException);
      addNewExceptionField.setText("");
      ((PyExceptionListProvider) contentProvider).addUserConfiguredException(customException);
    } else {
      IStatus status =
          new Status(
              IStatus.WARNING,
              DebugUIPlugin.getUniqueIdentifier(),
              "Duplicate: This exception already exists");
      DebugUIPlugin.errorDialog(
          getShell(),
          DebugUIPlugin.removeAccelerators("Add Custom User Exception"),
          "Error",
          status);
    }
  }
  private void storeViewPaneVisibility() {
    fVisibleViewPanes.clear();
    StringBuffer visibleViewPanes = new StringBuffer();

    Enumeration<String> enumeration = fViewPaneControls.keys();

    while (enumeration.hasMoreElements()) {
      String paneId = enumeration.nextElement();

      Control control = fViewPaneControls.get(paneId);
      if (control.isVisible()) {
        visibleViewPanes.append(paneId);
        visibleViewPanes.append(","); // $NON-NLS-1$
        fVisibleViewPanes.add(paneId);
      }
    }
    IEclipsePreferences node = InstanceScope.INSTANCE.getNode(DebugUIPlugin.getUniqueIdentifier());
    if (node != null) {
      try {
        node.put(getVisibilityPrefId(), visibleViewPanes.toString());
        node.flush();
      } catch (BackingStoreException e) {
        DebugUIPlugin.log(e);
      }
    }
  }
  @Override
  public void init(IViewSite site) throws PartInitException {
    super.init(site);

    fViewCnt++;
    String secondaryId = site.getSecondaryId();
    if (secondaryId != null) MemoryViewIdRegistry.registerView(secondaryId);

    // only do this the first time
    // not sure if there is a bug in the UI... if the view is
    // not a primary view and if it's hidden, the view is not
    // init and created until it becomes visible.
    if (fViewCnt == 1) {
      // also try to find other views and register
      if (DebugUIPlugin.getActiveWorkbenchWindow() != null
          && DebugUIPlugin.getActiveWorkbenchWindow().getActivePage() != null) {
        IViewReference references[] =
            DebugUIPlugin.getActiveWorkbenchWindow().getActivePage().getViewReferences();
        for (int i = 0; i < references.length; i++) {
          if (references[i].getSecondaryId() != null) {
            MemoryViewIdRegistry.registerView(references[i].getSecondaryId());
          }
        }
      }
    }

    fSyncService = new MemoryViewSynchronizationService();
  }
Exemplo n.º 6
0
 /* (non-Javadoc)
  * @see org.eclipse.jface.dialogs.Dialog#okPressed()
  */
 protected void okPressed() {
   String text = getValue();
   try {
     DebugUIPlugin.getDefault()
         .getPreferenceStore()
         .setValue(IDebugUIConstants.PREF_MAX_DETAIL_LENGTH, Integer.parseInt(text));
   } catch (NumberFormatException e) {
     DebugUIPlugin.log(e);
   }
   super.okPressed();
 }
 private void saveOrientation() {
   IEclipsePreferences node = InstanceScope.INSTANCE.getNode(DebugUIPlugin.getUniqueIdentifier());
   if (node != null) {
     try {
       node.putInt(getOrientationPrefId(), fViewOrientation);
       node.flush();
     } catch (BackingStoreException e) {
       DebugUIPlugin.log(e);
     }
   }
 }
Exemplo n.º 8
0
 /**
  * Constructs an action that opens the launch configuration dialog in the context of the specified
  * launch group.
  *
  * @param identifier unique identifier of a launch group extension
  */
 public OpenLaunchDialogAction(String identifier) {
   fIdentifier = identifier;
   ILaunchGroup group =
       DebugUIPlugin.getDefault().getLaunchConfigurationManager().getLaunchGroup(fIdentifier);
   if (group != null) {
     String lbl = group.getLabel();
     String actionLabel =
         MessageFormat.format(ActionMessages.OpenLaunchDialogAction_1, new String[] {lbl});
     setText(DebugUIPlugin.adjustDBCSAccelerator(actionLabel));
   }
   PlatformUI.getWorkbench()
       .getHelpSystem()
       .setHelp(this, IDebugHelpContextIds.OPEN_LAUNCH_CONFIGURATION_ACTION);
 }
Exemplo n.º 9
0
    /*
     * (non-Javadoc)
     * @see org.eclipse.ui.progress.UIJob#runInUIThread(org.eclipse.core.runtime .IProgressMonitor)
     */
    public IStatus runInUIThread(IProgressMonitor monitor) {
      ISourceLookupResult result = null;
      IWorkbenchPage page = null;
      synchronized (this) {
        result = fResult;
        page = fPage;
        setDisplayInfo(null, null);
      }
      if (!monitor.isCanceled() && result != null && page != null) {
        if (result.getEditorInput() == null) {
          MessageDialog.openError(
              page.getWorkbenchWindow().getShell(),
              Messages.getString("SourceDisplayAdapter.Error_Opening_Source"), // $NON-NLS-1$
              MessageFormat.format(
                  Messages.getString("SourceDisplayAdapter.Source_Not_Located"), // $NON-NLS-1$
                  JSDebugUIPlugin.getDefault()
                      .getModelPresentation()
                      .getText(result.getArtifact())));
          return Status.CANCEL_STATUS;
        }
        // Workaround for http://support.aptana.com/asap/browse/STU-3818
        if (result.getArtifact() instanceof ISourceLink) {
          boolean oldReuseValue =
              DebugUIPlugin.getDefault()
                  .getPreferenceStore()
                  .getBoolean(IDebugUIConstants.PREF_REUSE_EDITOR);
          DebugUIPlugin.getDefault()
              .getPreferenceStore()
              .setValue(IDebugUIConstants.PREF_REUSE_EDITOR, false);
          DebugUITools.displaySource(result, page);
          DebugUIPlugin.getDefault()
              .getPreferenceStore()
              .setValue(IDebugUIConstants.PREF_REUSE_EDITOR, oldReuseValue);
        } else {
          DebugUITools.displaySource(result, page);
        }
        if (result.getArtifact() instanceof IJSScriptElement) {
          int lineNumber = ((IJSScriptElement) result.getArtifact()).getBaseLine();
          IEditorInput editorInput = result.getEditorInput();
          if (editorInput != null && lineNumber > 0) {
            IEditorPart editorPart = SourceDisplayUtil.findEditor(editorInput);
            if (editorPart != null) {
              SourceDisplayUtil.revealLineInEditor(editorPart, lineNumber);
            }
          }
        }
      }

      return Status.OK_STATUS;
    }
Exemplo n.º 10
0
 /** @see org.eclipse.jface.action.IAction#run() */
 public void run() {
   LaunchHistory history =
       DebugUIPlugin.getDefault().getLaunchConfigurationManager().getLaunchHistory(fIdentifier);
   ILaunchConfiguration configuration = history.getRecentLaunch();
   IStructuredSelection selection = null;
   if (configuration == null) {
     selection = new StructuredSelection();
   } else {
     selection = new StructuredSelection(configuration);
   }
   int result =
       DebugUITools.openLaunchConfigurationDialogOnGroup(
           DebugUIPlugin.getShell(), selection, fIdentifier);
   notifyResult(result == Window.OK);
 }
 /**
  * Sets the selected resource in the navigator view.
  *
  * @param resource resource to select or <code>null</code> if empty
  */
 protected void setSelection(final IResource resource) {
   Runnable r =
       new Runnable() {
         public void run() {
           IWorkbenchPage page = DebugUIPlugin.getActiveWorkbenchWindow().getActivePage();
           assertNotNull("the active workbench window page should not be null", page);
           IViewPart part;
           try {
             part = page.showView("org.eclipse.ui.views.ResourceNavigator");
             assertNotNull(
                 "the part org.eclipse.ui.views.ResourceNavigator should not be null", part);
             ISelection selection = null;
             if (resource == null) {
               selection = new StructuredSelection();
             } else {
               selection = new StructuredSelection(resource);
             }
             IWorkbenchPartSite site = part.getSite();
             assertNotNull(
                 "The part site for org.eclipse.ui.views.ResourceNavigator should not be null ",
                 site);
             ISelectionProvider provider = site.getSelectionProvider();
             assertNotNull(
                 "the selection provider should not be null for org.eclipse.ui.views.ResourceNavigator",
                 provider);
             provider.setSelection(selection);
           } catch (PartInitException e) {
             assertNotNull("Failed to open navigator view", null);
           }
         }
       };
   DebugUIPlugin.getStandardDisplay().syncExec(r);
 }
 /**
  * Since these actions are re-created each time the run/debug as menu is filled, the enablement of
  * this action is static.
  */
 private void updateEnablement() {
   IWorkbenchWindow wb = DebugUIPlugin.getActiveWorkbenchWindow();
   boolean enabled = false;
   if (wb != null) {
     IWorkbenchPage page = wb.getActivePage();
     if (page != null) {
       ISelection selection = page.getSelection();
       if (selection instanceof IStructuredSelection) {
         IStructuredSelection structuredSelection = (IStructuredSelection) selection;
         try {
           // check enablement logic, if any
           Expression expression = fShortcut.getShortcutEnablementExpression();
           if (expression == null) {
             enabled = !structuredSelection.isEmpty();
           } else {
             List list = structuredSelection.toList();
             IEvaluationContext context = new EvaluationContext(null, list);
             context.addVariable("selection", list); // $NON-NLS-1$
             enabled = fShortcut.evalEnablementExpression(context, expression);
           }
         } catch (CoreException e) {
         }
       } else {
         IEditorPart editor = page.getActiveEditor();
         if (editor != null) {
           enabled = true;
         }
       }
     }
   }
   setEnabled(enabled);
 }
  private void loadViewPanesVisibility() {
    String visiblePanes =
        Platform.getPreferencesService()
            .getString(DebugUIPlugin.getUniqueIdentifier(), getVisibilityPrefId(), null, null);

    if (visiblePanes != null && visiblePanes.length() > 0) {
      StringTokenizer tokenizer = new StringTokenizer(visiblePanes, ","); // $NON-NLS-1$
      while (tokenizer.hasMoreTokens()) {
        String paneId = tokenizer.nextToken();
        fVisibleViewPanes.add(paneId);
      }
    } else {
      for (int i = 0; i < defaultVisiblePaneIds.length; i++) {
        fVisibleViewPanes.add(defaultVisiblePaneIds[i]);
      }
    }

    Enumeration<String> enumeration = fViewPaneControls.keys();
    while (enumeration.hasMoreElements()) {
      String paneId = enumeration.nextElement();
      boolean visible = false;
      if (fVisibleViewPanes.contains(paneId)) visible = true;

      Control control = fViewPaneControls.get(paneId);
      control.setVisible(visible);

      IMemoryViewPane viewPane = fViewPanes.get(paneId);
      viewPane.setVisible(visible);
    }

    fSashForm.layout();
  }
Exemplo n.º 14
0
 /* (non-Javadoc)
  * @see org.eclipse.ui.dialogs.SelectionDialog#getDialogBoundsSettings()
  */
 protected IDialogSettings getDialogBoundsSettings() {
   IDialogSettings settings = DebugUIPlugin.getDefault().getDialogSettings();
   IDialogSettings section = settings.getSection(SETTINGS_ID);
   if (section == null) {
     section = settings.addNewSection(SETTINGS_ID);
   }
   return section;
 }
Exemplo n.º 15
0
 /**
  * Returns the {@link IDialogSettings} for the given id
  *
  * @param id the id of the dialog settings to get
  * @return the {@link IDialogSettings} to pass into the {@link ContainerSelectionDialog}
  * @since 3.6
  */
 IDialogSettings getDialogBoundsSettings(String id) {
   IDialogSettings settings = DebugUIPlugin.getDefault().getDialogSettings();
   IDialogSettings section = settings.getSection(id);
   if (section == null) {
     section = settings.addNewSection(id);
   }
   return section;
 }
Exemplo n.º 16
0
  /**
   * Store renderings as preferences. If renderings are stored, renderings can be persisted even
   * after the memory view is closed.
   */
  private void storeRenderings() {
    Preferences prefs = DebugUIPlugin.getDefault().getPluginPreferences();
    String renderingsStr = IInternalDebugCoreConstants.EMPTY_STRING;
    try {
      renderingsStr = getRenderingsAsXML();
    } catch (IOException e) {
      DebugUIPlugin.log(e);
    } catch (ParserConfigurationException e) {
      DebugUIPlugin.log(e);
    } catch (TransformerException e) {
      DebugUIPlugin.log(e);
    }

    String prefid = getPrefId();

    if (renderingsStr != null) prefs.setValue(prefid, renderingsStr);
    else prefs.setToDefault(prefid);
  }
 protected IStructuredSelection getCurrentSelection() {
   IWorkbenchPage page = DebugUIPlugin.getActiveWorkbenchWindow().getActivePage();
   if (page != null) {
     ISelection selection = page.getSelection();
     if (selection instanceof IStructuredSelection) {
       return (IStructuredSelection) selection;
     }
   }
   return null;
 }
 private void addKeyToQueue(Object topIndexKey) {
   synchronized (fTopIndexQueue) {
     if (DebugUIPlugin.DEBUG_DYNAMIC_LOADING) {
       DebugUIPlugin.trace(
           " >>> add to top index queue: "
               + ((BigInteger) topIndexKey).toString(16)); // $NON-NLS-1$
     }
     fTopIndexQueue.add(topIndexKey);
   }
 }
 private void removeKeyFromQueue(Object topIndexKey) {
   synchronized (fTopIndexQueue) {
     if (DebugUIPlugin.DEBUG_DYNAMIC_LOADING) {
       DebugUIPlugin.trace(
           " >>> remove frome top index queue: "
               + ((BigInteger) topIndexKey).toString(16)); // $NON-NLS-1$
     }
     fTopIndexQueue.remove(topIndexKey);
   }
 }
  @Override
  public void run() {
    final VirtualViewerListener listener = new VirtualViewerListener();
    VirtualTreeModelViewer virtualViewer = initVirtualViewer(fClientViewer, listener);

    ProgressMonitorDialog dialog =
        new TimeTriggeredProgressMonitorDialog(fClientViewer.getControl().getShell(), 500);
    final IProgressMonitor monitor = dialog.getProgressMonitor();
    dialog.setCancelable(true);

    try {
      dialog.run(
          true,
          true,
          new IRunnableWithProgress() {
            @Override
            public void run(final IProgressMonitor m)
                throws InvocationTargetException, InterruptedException {
              synchronized (listener) {
                listener.fProgressMonitor = m;
                listener.fProgressMonitor.beginTask(
                    DebugUIPlugin.removeAccelerators(getText()), listener.fRemainingUpdatesCount);
              }

              while ((!listener.fLabelUpdatesComplete || !listener.fViewerUpdatesComplete)
                  && !listener.fProgressMonitor.isCanceled()) {
                Thread.sleep(1);
              }
              synchronized (listener) {
                listener.fProgressMonitor = null;
              }
            }
          });
    } catch (InvocationTargetException e) {
      DebugUIPlugin.log(e);
      return;
    } catch (InterruptedException e) {
      return;
    }

    VirtualItem root = virtualViewer.getTree();
    if (!monitor.isCanceled()) {
      List<VirtualItem> list = new ArrayList<VirtualItem>();
      collectAllChildren(root, list);
      FindLabelProvider labelProvider = new FindLabelProvider(virtualViewer, list);
      VirtualItem result = performFind(list, labelProvider);
      if (result != null) {
        setSelectionToClient(virtualViewer, labelProvider, result);
      }
    }

    virtualViewer.removeLabelUpdateListener(listener);
    virtualViewer.removeViewerUpdateListener(listener);
    virtualViewer.dispose();
  }
 /**
  * If the dragged data is a structured selection, get any IVariables in it and create expressions
  * for each of them. Insert the created expressions at the currently selected target or add them
  * to the end of the collection if no target is selected.
  *
  * @param selection Structured selection containing IVariables
  * @return whether the drop was successful
  */
 private boolean performVariableOrWatchAdaptableDrop(IStructuredSelection selection) {
   List expressions = new ArrayList(selection.size());
   for (Iterator itr = selection.iterator(); itr.hasNext(); ) {
     Object element = itr.next();
     String expressionText = createExpressionString(element);
     if (expressionText != null) {
       IExpression expression = createExpression(expressionText);
       if (expression != null) {
         expressions.add(expression);
       } else {
         DebugUIPlugin.log(
             new Status(
                 IStatus.ERROR,
                 DebugUIPlugin.getUniqueIdentifier(),
                 "Drop failed.  Watch expression could not be created for the text "
                     + expressionText)); //$NON-NLS-1$
         return false;
       }
     } else {
       return false;
     }
   }
   if (expressions.size() == selection.size()) {
     IExpressionManager manager = DebugPlugin.getDefault().getExpressionManager();
     if (manager instanceof ExpressionManager) {
       IExpression targetExpression = getTargetExpression(getCurrentTarget());
       if (targetExpression != null) {
         ((ExpressionManager) manager)
             .insertExpressions(
                 (IExpression[]) expressions.toArray(new IExpression[expressions.size()]),
                 targetExpression,
                 fInsertBefore);
       } else {
         ((ExpressionManager) manager)
             .addExpressions(
                 (IExpression[]) expressions.toArray(new IExpression[expressions.size()]));
       }
       return true;
     }
   }
   return false;
 }
  public static void run(IEditorPart editor) {
    List<LaunchShortcutExtension> launchShortcuts =
        DebugUIPlugin.getDefault().getLaunchConfigurationManager().getLaunchShortcuts();

    for (LaunchShortcutExtension lse : launchShortcuts) {
      if (lse.getId().equals(TalendDebugUIConstants.TALEND_JOB_LAUNCH_SHORTCUT_ID)) {
        lse.launch(editor, ILaunchManager.RUN_MODE);
        return;
      }
    }
  }
  public VirtualFindAction(TreeModelViewer viewer) {
    fClientViewer = viewer;

    setText(ActionMessages.FindAction_0);
    setId(DebugUIPlugin.getUniqueIdentifier() + ".FindElementAction"); // $NON-NLS-1$
    PlatformUI.getWorkbench()
        .getHelpSystem()
        .setHelp(this, IDebugHelpContextIds.FIND_ELEMENT_ACTION);
    setActionDefinitionId(IWorkbenchCommandConstants.EDIT_FIND_AND_REPLACE);
    fClientViewer = viewer;
  }
 protected void prepareUseStepFilter(ILaunchConfiguration config) throws CoreException {
   if (isUseStepFilter(config)) {
     // This listener does not remove itself from the debug plug-in
     // as an event listener (there is no dispose notification for
     // launch delegates). However, since there is only one delegate
     // instantiated per config type, this is tolerable.
     DebugPlugin.getDefault().addDebugEventListener(this);
     IPreferenceStore store = DebugUIPlugin.getDefault().getPreferenceStore();
     store.addPropertyChangeListener(CjStepFilterOptionManager.getDefault());
   }
 }
Exemplo n.º 25
0
  public void dispose() {
    // remove all renderings
    fRenderings.clear();

    String secondaryId = getViewSiteSecondaryId();
    if (secondaryId != null) {
      // do not save renderings if this is not the primary rendering view
      String prefid = getPrefId();
      Preferences prefs = DebugUIPlugin.getDefault().getPluginPreferences();
      prefs.setToDefault(prefid);
    }

    DebugPlugin.getDefault().removeDebugEventListener(this);
  }
 /**
  * Performs the drop when text was dragged. Creates a new watch expression from the text. Inserts
  * the expression at the currently selected target or adds it to the end of the collection if no
  * target is selected.
  *
  * @param text string to use to create the expression
  * @return whether the drop was successful
  */
 private boolean performTextDrop(String text) {
   IExpression expression = createExpression(text);
   if (expression != null) {
     IExpressionManager manager = DebugPlugin.getDefault().getExpressionManager();
     if (manager instanceof ExpressionManager) {
       IExpression targetExpression = getTargetExpression(getCurrentTarget());
       if (targetExpression != null) {
         ((ExpressionManager) manager)
             .insertExpressions(new IExpression[] {expression}, targetExpression, fInsertBefore);
       } else {
         ((ExpressionManager) manager).addExpression(expression);
       }
       return true;
     }
   }
   DebugUIPlugin.log(
       new Status(
           IStatus.ERROR,
           DebugUIPlugin.getUniqueIdentifier(),
           "Drop failed.  Watch expression could not be created for the text "
               + text)); //$NON-NLS-1$
   return false;
 }
  private void loadOrientation() {
    fViewOrientation =
        Platform.getPreferencesService()
            .getInt(
                DebugUIPlugin.getUniqueIdentifier(),
                getOrientationPrefId(),
                HORIZONTAL_VIEW_ORIENTATION,
                null);

    for (int i = 0; i < fOrientationActions.length; i++) {
      if (fOrientationActions[i].getOrientation() == fViewOrientation) {
        fOrientationActions[i].run();
      }
    }
    updateOrientationActions();
  }
  public void topIndexChanged() {
    if (DebugUIPlugin.DEBUG_DYNAMIC_LOADING) {
      MemorySegment a = (MemorySegment) getTable().getItem(getTable().getTopIndex()).getData();
      DebugUIPlugin.trace(
          Thread.currentThread().getName()
              + " "
              + this
              + " handle scroll bar moved:  top index: "
              + a.getAddress().toString(16)); // $NON-NLS-1$ //$NON-NLS-2$
    }

    setTopIndexKey(getVirtualContentModel().getKey(getTable().getTopIndex()));

    notifyListenersAtBufferStart();
    notifyListenersAtBufferEnd();
  }
 /* (non-Javadoc)
  * @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
  */
 @Override
 public boolean select(Viewer viewer, Object parentElement, Object element) {
   if (element instanceof ILaunchConfigurationType) {
     return true;
   }
   if (element instanceof ILaunchConfiguration) {
     ILaunchConfiguration config = (ILaunchConfiguration) element;
     try {
       IResource[] resources = config.getMappedResources();
       if (resources == null) {
         return true;
       }
       IWorkbenchWindow window = DebugUIPlugin.getActiveWorkbenchWindow();
       if (window == null) {
         return true;
       }
       IWorkbenchPage page = window.getActivePage();
       if (page == null) {
         return true;
       }
       IWorkingSet[] wsets = page.getWorkingSets();
       if (wsets.length < 1) {
         return true;
       }
       // remove breakpoint working sets
       ArrayList<IWorkingSet> ws = new ArrayList<IWorkingSet>();
       for (int i = 0; i < wsets.length; i++) {
         if (!IDebugUIConstants.BREAKPOINT_WORKINGSET_ID.equals(wsets[i].getId())) {
           ws.add(wsets[i]);
         }
       }
       if (ws.isEmpty()) {
         return true;
       }
       for (int i = 0; i < resources.length; i++) {
         if (workingSetContains(ws.toArray(new IWorkingSet[ws.size()]), resources[i])) {
           return true;
         }
       }
     } catch (CoreException e) {
     }
   }
   return false;
 }
  /**
   * Compares two breakpoints.
   *
   * @param b1
   * @param b2
   * @return
   */
  private int doCompare(IBreakpoint b1, IBreakpoint b2) {
    String text1 = IInternalDebugCoreConstants.EMPTY_STRING;
    String text2 = IInternalDebugCoreConstants.EMPTY_STRING;

    text1 += b1.getModelIdentifier();
    text2 += b2.getModelIdentifier();

    IMarker marker1 = b1.getMarker();
    IMarker marker2 = b2.getMarker();
    try {
      if (marker1.exists() && marker2.exists()) {
        text1 += SPACE + marker1.getType();
        text2 += SPACE + marker2.getType();
      }
    } catch (CoreException e) {
      DebugUIPlugin.log(e);
    }

    int result = text1.compareTo(text2);
    if (result != 0) {
      return result;
    }

    // model and type are the same
    if (fContext != null) {
      String name1 = fContext.getModelPresentation().getText(b1);
      String name2 = fContext.getModelPresentation().getText(b2);

      boolean lineBreakpoint = false;
      try {
        lineBreakpoint = marker1.isSubtypeOf(IBreakpoint.LINE_BREAKPOINT_MARKER);
      } catch (CoreException ce) {
      }
      if (lineBreakpoint) {
        return compareLineBreakpoints(b1, b2, name1, name2);
      }

      return name1.compareTo(name2);
    }

    return result;
  }