コード例 #1
0
 /* (non-Javadoc)
  * @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
  */
 public boolean select(Viewer viewer, Object parent, Object element) {
   // always let through types, we only care about configs
   if (element instanceof ILaunchConfigurationType) {
     return true;
   }
   if (element instanceof ILaunchConfiguration) {
     try {
       ILaunchConfiguration config = (ILaunchConfiguration) element;
       IResource[] resources = config.getMappedResources();
       // if it has no mapping, it might not have migration delegate, so let it pass
       if (resources == null) {
         return true;
       }
       for (int i = 0; i < resources.length; i++) {
         IProject project = resources[i].getProject();
         // we don't want overlap with the deleted projects filter, so we need to allow projects
         // that don't exist through
         if (project != null && (project.isOpen() || !project.exists())) {
           return true;
         }
       }
     } catch (CoreException e) {
     }
   }
   return false;
 }
コード例 #2
0
  protected IQtBuildConfiguration getQtBuildConfiguration(
      ILaunchConfiguration configuration,
      String mode,
      ILaunchTarget target,
      IProgressMonitor monitor)
      throws CoreException {
    // Find the Qt build config
    ICBuildConfigurationManager configManager =
        Activator.getService(ICBuildConfigurationManager.class);
    QtBuildConfigurationProvider provider =
        (QtBuildConfigurationProvider) configManager.getProvider(QtBuildConfigurationProvider.ID);
    IProject project = configuration.getMappedResources()[0].getProject();

    // Find the toolchains that support this target
    Map<String, String> properties = new HashMap<>();
    populateToolChainProperties(target, properties);

    IToolChainManager toolChainManager = Activator.getService(IToolChainManager.class);
    for (IToolChain toolChain : toolChainManager.getToolChainsMatching(properties)) {
      IQtBuildConfiguration qtConfig = provider.getConfiguration(project, toolChain, mode, monitor);
      if (qtConfig == null) {
        qtConfig = provider.createConfiguration(project, toolChain, mode, monitor);
      }
      if (qtConfig != null) {
        return qtConfig;
      }
    }

    // Couldn't find any
    throw new CoreException(
        new Status(
            IStatus.ERROR,
            Activator.ID,
            String.format("No suitable SDK found for target %s.", target.getId())));
  }
コード例 #3
0
 @Override
 protected IProject[] getBuildOrder(ILaunchConfiguration configuration, String mode)
     throws CoreException {
   // 1. Extract project from configuration
   // TODO dependencies too.
   IProject project = configuration.getMappedResources()[0].getProject();
   return new IProject[] {project};
 }
コード例 #4
0
 /**
  * Returns the default encoding for the specified config
  *
  * @param config the configuration to get the encoding for
  * @return the default encoding
  * @since 3.4
  */
 private String getDefaultEncoding(ILaunchConfiguration config) {
   try {
     IResource[] resources = config.getMappedResources();
     if (resources != null && resources.length > 0) {
       IResource res = resources[0];
       if (res instanceof IFile) {
         return ((IFile) res).getCharset();
       } else if (res instanceof IContainer) {
         return ((IContainer) res).getDefaultCharset();
       }
     }
   } catch (CoreException ce) {
     LaunchPlugin.log(ce);
   }
   return ResourcesPlugin.getEncoding();
 }
コード例 #5
0
 private String getDefaultSharedConfigLocation(ILaunchConfiguration config) {
   String path = IInternalDebugCoreConstants.EMPTY_STRING;
   try {
     IResource[] res = config.getMappedResources();
     if (res != null) {
       IProject proj;
       for (int i = 0; i < res.length; i++) {
         proj = res[i].getProject();
         if (proj != null && proj.isAccessible()) {
           return proj.getFullPath().toOSString();
         }
       }
     }
   } catch (CoreException e) {
     LaunchPlugin.log(e);
   }
   return path;
 }
コード例 #6
0
 /* (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;
 }