Example #1
0
 /* (non-Javadoc)
  * @see org.eclipse.core.runtime.Plugin#startup()
  */
 @Override
 public void start(BundleContext context) throws Exception {
   super.start(context);
   ICDebugConfiguration dc = CDebugCorePlugin.getDefault().getDefaultDefaultDebugConfiguration();
   if (dc == null) {
     CDebugCorePlugin.getDefault()
         .getPluginPreferences()
         .setDefault(
             ICDebugConstants.PREF_DEFAULT_DEBUGGER_TYPE,
             "org.eclipse.cdt.debug.mi.core.CDebuggerNew"); //$NON-NLS-1$
   }
 }
 public SetSteppingModeHandler() {
   super();
   fCurrentValue =
       CDebugCorePlugin.getDefault()
           .getPluginPreferences()
           .getString(ICDebugConstants.PREF_STEP_MODE);
 }
  /** @deprecated Not intended to be public - do not use */
  @Deprecated
  public String getDefaultDebugger(final ILaunchConfiguration config) throws CoreException {
    // Mostly from CDebbuggerTab
    String defaultDebugger = null;

    String projectName =
        config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, "");
    if (projectName.length() > 0) {
      IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
      ICProjectDescription projDesc = CoreModel.getDefault().getProjectDescription(project);
      if (projDesc != null) {
        ICConfigurationDescription configDesc = projDesc.getActiveConfiguration();
        String configId = configDesc.getId();
        ICDebugConfiguration[] debugConfigs =
            CDebugCorePlugin.getDefault().getActiveDebugConfigurations();
        outer:
        for (int i = 0; i < debugConfigs.length; ++i) {
          ICDebugConfiguration debugConfig = debugConfigs[i];
          String[] patterns = debugConfig.getSupportedBuildConfigPatterns();
          if (patterns != null) {
            for (int j = 0; j < patterns.length; ++j) {
              if (configId.matches(patterns[j])) {
                defaultDebugger = debugConfig.getID();
                break outer;
              }
            }
          }
        }
      }
    }

    if (defaultDebugger == null) {
      ICDebugConfiguration dc = CDebugCorePlugin.getDefault().getDefaultDebugConfiguration();
      if (dc != null) {
        defaultDebugger = dc.getID();
      }
    }

    return defaultDebugger;
  }
  /* (non-Javadoc)
   * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
   */
  @Override
  public Object execute(ExecutionEvent event) throws ExecutionException {
    String param = event.getParameter(ID_PARAMETER_MODE);
    if (param == null || param.equals(fCurrentValue)) return null;

    fCurrentValue = param;
    CDebugCorePlugin.getDefault()
        .getPluginPreferences()
        .setValue(ICDebugConstants.PREF_STEP_MODE, fCurrentValue);

    IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
    ICommandService service = window.getService(ICommandService.class);
    service.refreshElements(event.getCommand().getId(), null);

    return null;
  }
	private IEditorInput findFileInCommonSourceLookup(IPath path)
	{
		try {
			AbstractSourceLookupDirector director = CDebugCorePlugin.getDefault().getCommonSourceLookupDirector();
			ISourceContainer[] c = director.getSourceContainers();
			for (ISourceContainer sourceContainer : c) {
				Object[] o = sourceContainer.findSourceElements(path.toOSString());
				for (Object object : o) {
					if (object instanceof IFile) {
						return new FileEditorInput((IFile)object);
					} else if (object instanceof LocalFileStorage) {
						LocalFileStorage storage = (LocalFileStorage) object;
						IFileStore ifs = EFS.getStore(storage.getFile().toURI());
						return new FileStoreEditorInput(ifs);
					}
				}
			}
		} catch (Exception _) {
			// do nothing
		}
		return null;
	}