protected void setDefaultSourceLocator(ILaunch launch, ILaunchConfiguration configuration) throws CoreException { ILaunchConfigurationWorkingCopy wc = null; if (configuration.isWorkingCopy()) { wc = (ILaunchConfigurationWorkingCopy) configuration; } else { wc = configuration.getWorkingCopy(); } String id = configuration.getAttribute(IJavaLaunchConfigurationConstants.ATTR_SOURCE_PATH_PROVIDER, (String) null); if (!PDESourcePathProvider.ID.equals(id)) { wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_SOURCE_PATH_PROVIDER, PDESourcePathProvider.ID); wc.doSave(); } manageLaunch(launch); }
/** * {@inheritDoc} * * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object) */ public String getText(Object element) { return ((ILaunchConfiguration) element).getName(); }
@Override public ISourcePathComputer getSourcePathComputer(ILaunchConfiguration configuration) throws CoreException { String id = null; id = configuration.getAttribute(ISourcePathComputer.ATTR_SOURCE_PATH_COMPUTER_ID, (String)null); if (id == null) { //use default computer for configuration type, if any return configuration.getType().getSourcePathComputer(); } return getSourcePathComputer(id); }
@Override public boolean getShowLogInfoFlag(ILaunchConfiguration configuration) { try { return configuration.getAttribute(ATTR_SHOW_LOG_INFO, DEFAULT_SHOW_LOG_INFO); } catch (CoreException e) { return DEFAULT_SHOW_LOG_INFO; } }
private ILaunchConfigurationWorkingCopy getWorkingCopy() throws CoreException{ ILaunchConfigurationWorkingCopy workingcopy = null; if( fLaunchConfiguration instanceof ILaunchConfigurationWorkingCopy){ workingcopy = (ILaunchConfigurationWorkingCopy) fLaunchConfiguration; }else{ workingcopy = fLaunchConfiguration.getWorkingCopy(); } return workingcopy; }
@Override public String getEncoding(ILaunchConfiguration configuration) throws CoreException { String encoding = configuration.getAttribute(DebugPlugin.ATTR_CONSOLE_ENCODING, (String)null); if(encoding == null) { IResource[] resources = configuration.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(); } } else { return ResourcesPlugin.getEncoding(); } } return encoding; }
/** * Used to render launch history items in the re-launch drop downs */ protected String getLaunchText(ILaunch launch) { if (launch.getLaunchConfiguration() == null || (!launch.getLaunchConfiguration().exists() && !launch.getLaunchConfiguration().isWorkingCopy())) { return DebugUIMessages.DefaultLabelProvider__unknown__1; } // new launch configuration ILaunchConfiguration config = launch.getLaunchConfiguration(); StringBuffer buff= new StringBuffer(config.getName()); buff.append(" ["); //$NON-NLS-1$ try { buff.append(config.getType().getName()); } catch (CoreException e) { DebugUIPlugin.log(e); } buff.append("]"); //$NON-NLS-1$ return buff.toString(); }
/** * Notification that the 'Revert' button has been pressed */ protected void handleRevertPressed() { try { if(fTabGroup != null) { fTabGroup.initializeFrom(fOriginal); fNameWidget.setText(fOriginal.getName()); fWorkingCopy = fOriginal.getWorkingCopy(); refreshStatus(); } } catch (CoreException e) {DebugUIPlugin.log(e);} }
private void launchBuild(int kind, ILaunchConfiguration config, Map args, IProgressMonitor monitor) throws CoreException { monitor.subTask(NLS.bind(ExternalToolsModelMessages.ExternalToolBuilder_Running__0_____1, new String[] { config.getName()})); buildStarted(kind, args); // The default value for "launch in background" is true in debug core. If // the user doesn't go through the UI, the new attribute won't be set. This means // that existing Ant builders will try to run in the background (and likely conflict with // each other) without migration. ILaunchConfiguration newconfig= ExternalToolMigration.migrateRunInBackground(config); newconfig.launch(ILaunchManager.RUN_MODE, monitor); buildEnded(); }
@Override public void launchConfigurationChanged(ILaunchConfiguration configuration) { if (fConfig == null || configuration.isWorkingCopy()) { return; } if(fConfig.equals(configuration)) { try{ String locatorMemento = configuration.getAttribute(ILaunchConfiguration.ATTR_SOURCE_LOCATOR_MEMENTO,(String)null); if (locatorMemento == null) { initializeDefaults(configuration); } else { initializeFromMemento(locatorMemento, configuration); } } catch (CoreException e){ } } }
/** * Only does work if we are not currently using the default classpath * * @see org.eclipse.jface.action.Action#run() */ public void run() { try { ILaunchConfiguration config = fTab.getLaunchConfiguration(); ILaunchConfigurationWorkingCopy copy = null; if(config.isWorkingCopy()) { copy = (ILaunchConfigurationWorkingCopy) config; } else { copy = config.getWorkingCopy(); } copy.removeAttribute(customAttributeName); fTab.refreshSelection(); } catch (CoreException e) {return;} }
ILaunchConfiguration cfg = programType.newInstance(null, "YourCommandName"); ILaunchConfigurationWorkingCopy wc = cfg.getWorkingCopy(); wc.setAttribute(IExternalToolConstants.ATTR_LOCATION, "${system_path:" + systemCommand+ "}"); wc.setAttribute(IExternalToolConstants.ATTR_WORKING_DIRECTORY, directoryToStartFrom); wc.setAttribute(IExternalToolConstants.ATTR_TOOL_ARGUMENTS, parametersToPass); cfg = wc.doSave(); cfg.launch(ILaunchManager.RUN_MODE, null, false, true); cfg.delete();
@Override public Object getParent(Object element) { if(element instanceof ILaunchConfiguration) { try { return ((ILaunchConfiguration)element).getType(); } catch (CoreException e) { return null; } } return null; } @Override
public ILaunch launch(String mode, IProgressMonitor monitor) throws CoreException { return delegate.launch(mode, monitor); }
/** * Returns if the specified configuration should be considered as a potential candidate * @param config to configuration * @return if the specified configuration should be considered as a potential candidate * @throws CoreException if an exception occurs */ private boolean acceptConfiguration(ILaunchConfiguration config) throws CoreException { if(config != null && !DebugUITools.isPrivate(config)) { if(!"org.eclipse.ui.externaltools".equals(config.getType().getCategory())) { //$NON-NLS-1$ return true; } else { IResource[] res = config.getMappedResources(); if(res != null) { return true; } } } return false; }
public IResource[] getMappedResources() throws CoreException { return delegate.getMappedResources(); }
/** * Returns whether the given configuration is an "unmigrated" builder. * Unmigrated builders are external tools that are stored in an old format * but have not been migrated by the user. Old format builders are always * translated into launch config working copies in memory, but they're not * considered "migrated" until the config has been saved and the project * spec updated. * * @param config * the config to examine * @return whether the given config represents an unmigrated builder */ public static boolean isUnmigratedConfig(ILaunchConfiguration config) { return config.isWorkingCopy() && ((ILaunchConfigurationWorkingCopy) config).getOriginal() == null; }
IResource[] resources = null; for(int i = 0; i < configs.length; i++) { if(configs[i].isLocal()) { resources = configs[i].getMappedResources(); if(resources != null) { for(int j = 0; j < resources.length; j++){
@Override public boolean isEmbeddedSRE(ILaunchConfiguration configuration) { try { return configuration.getAttribute(ATTR_EMBEDDED_SRE, DEFAULT_EMBEDDED_SRE); } catch (CoreException e) { return DEFAULT_EMBEDDED_SRE; } }