Java Code Examples for org.eclipse.debug.core.ILaunchConfiguration#delete()
The following examples show how to use
org.eclipse.debug.core.ILaunchConfiguration#delete() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NewProjectCreatorTool.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 6 votes |
private static void removeLaunchConfig(String launchConfigName) throws Exception { ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager(); try { ILaunchConfiguration[] launchConfigs = manager.getLaunchConfigurations(); for (ILaunchConfiguration launchConfig : launchConfigs) { if (launchConfig.getName().equals(launchConfigName)) { launchConfig.delete(); break; } } } catch (CoreException e) { GWTPluginLog.logError(e); throw new Exception("Could not remove existing Java launch configuration"); } }
Example 2
Source File: LaunchShortcutTest.java From dartboard with Eclipse Public License 2.0 | 5 votes |
@SuppressWarnings("unchecked") @Test public void launchShortcut__DartProjectNoLaunchConfig__NewLaunchConfigIsCreated() throws Exception { String projectName = RandomString.make(8); String mainClass = RandomString.make(4) + ".dart"; ProjectUtil.createDartProject(projectName); ProjectExplorer projectExplorer = new ProjectExplorer(); projectExplorer.open(); projectExplorer.getProject(projectName).select(); new ContextMenuItem(new WithMnemonicTextMatcher("Run As"), new RegexMatcher("\\d Run as Dart Program")) .select(); new WaitUntil(new ShellIsActive("Edit Configuration")); new LabeledCombo("Project:").setSelection(projectName); new LabeledText("Main class:").setText(mainClass); new PushButton("Run").click(); ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager(); // Find last launch configuration for selected project. ILaunchConfiguration launchConfiguration = null; for (ILaunchConfiguration conf : manager.getLaunchConfigurations()) { if (conf.getAttribute(Constants.LAUNCH_SELECTED_PROJECT, "").equalsIgnoreCase(projectName)) { //$NON-NLS-1$ launchConfiguration = conf; } } assertNotNull(launchConfiguration); assertEquals(launchConfiguration.getAttribute("main_class", ""), mainClass); // Cleanup launchConfiguration.delete(); }
Example 3
Source File: LaunchConfigCleaner.java From eclipse-extras with Eclipse Public License 1.0 | 5 votes |
private void launchTerminated( ILaunchConfiguration terminatedLaunchConfig ) throws CoreException { for( ILaunchConfiguration launchConfig : new ArrayList<>( cleanupLaunchConfigs ) ) { if( launchConfig.getType().equals( terminatedLaunchConfig.getType() ) && !isStoredInWorkspace( launchConfig ) && !launchConfig.equals( terminatedLaunchConfig ) ) { cleanupLaunchConfigs.remove( launchConfig ); launchConfig.delete(); } } }
Example 4
Source File: LaunchConfigLabelProviderPDETest.java From eclipse-extras with Eclipse Public License 1.0 | 5 votes |
@Test public void testGetImageForDeletedLaunchConfig() throws CoreException { ILaunchConfiguration launchConfig = launchConfigRule.createPublicLaunchConfig().doSave(); launchConfig.delete(); LaunchConfigLabelProvider labelProvider = createLabelProvider( LIST ); Image image = labelProvider.getImage( launchConfig ); assertThat( image ).isNull(); }
Example 5
Source File: LaunchConfigValidatorPDETest.java From eclipse-extras with Eclipse Public License 1.0 | 5 votes |
@Test public void testValidateWithDeletedLaunchConfig() throws CoreException { ILaunchConfiguration deletedLaunchConfig = launchConfig.doSave(); deletedLaunchConfig.delete(); IStatus status = new LaunchConfigValidator( deletedLaunchConfig, getSupportedMode() ).validate(); assertThat( status.matches( IStatus.ERROR ) ).isTrue(); assertThat( status.getMessage() ).isEqualTo( LaunchConfigValidator.LAUNCH_CONFIG_NOT_FOUND ); }
Example 6
Source File: LaunchModeComputerPDETest.java From eclipse-extras with Eclipse Public License 1.0 | 5 votes |
@Test public void testComputeLaunchModeWithDeletedLaunchConfig() throws CoreException { ILaunchMode supportedMode = getSupportedMode(); ILaunchConfiguration deletedLaunchConfig = launchConfig.doSave(); deletedLaunchConfig.delete(); ILaunchMode launchMode = new LaunchModeComputer( deletedLaunchConfig, supportedMode ).computeLaunchMode(); assertThat( launchMode ).isNull(); }
Example 7
Source File: LaunchModeComputerPDETest.java From eclipse-extras with Eclipse Public License 1.0 | 5 votes |
@Test public void testComputeLaunchGroupWithDeletedLaunchConfig() throws CoreException { ILaunchMode supportedMode = getSupportedMode(); ILaunchConfiguration deletedLaunchConfig = launchConfig.doSave(); deletedLaunchConfig.delete(); ILaunchGroup launchGroup = new LaunchModeComputer( deletedLaunchConfig, supportedMode ).computeLaunchGroup(); assertThat( launchGroup ).isNull(); }
Example 8
Source File: LaunchTerminatorPDETest.java From eclipse-extras with Eclipse Public License 1.0 | 5 votes |
@Test public void testTerminateLaunchesWithDeletedLaunchConfig() throws CoreException { ILaunchConfiguration unrelatedLaunchConfig = launchConfigRule.createPrivateLaunchConfig().doSave(); ILaunch unrelatedLaunch = unrelatedLaunchConfig.launch( RUN_MODE, new NullProgressMonitor() ); ILaunchConfiguration launchConfig = launchConfigRule.createPublicLaunchConfig().doSave(); unrelatedLaunchConfig.delete(); new LaunchTerminator( launchConfig ).terminateLaunches(); assertThat( unrelatedLaunch.isTerminated() ).isFalse(); }
Example 9
Source File: LaunchConfigCleanerPDETest.java From eclipse-extras with Eclipse Public License 1.0 | 5 votes |
@Test public void testNoCleanupWhenLaunchConfigDeleted() throws CoreException { prepareLaunchPreferences( true, launchConfigRule.getPublicTestLaunchConfigType() ); launchConfigCleaner.install(); ILaunchConfiguration launchConfig = launchConfigRule.createPublicLaunchConfig().doSave(); ILaunch launch = launchConfig.launch( RUN_MODE, null ); launchConfig.delete(); launch.terminate(); assertThat( getLaunchConfigs() ).extracting( "name" ).doesNotContain( launchConfig.getName() ); }
Example 10
Source File: ExportGhidraModuleWizard.java From ghidra with Apache License 2.0 | 4 votes |
/** * Exports the given Ghidra module project to an extension zip file. * * @param javaProject The Ghidra module project to export. * @param gradleDistribution The Gradle distribution to use to export. * @param monitor The monitor to use during export. * @throws InvocationTargetException if an error occurred during export. */ private void export(IJavaProject javaProject, GradleDistribution gradleDistribution, IProgressMonitor monitor) throws InvocationTargetException { try { IProject project = javaProject.getProject(); info("Exporting " + project.getName()); monitor.beginTask("Exporting " + project.getName(), 2); // Get path to Ghidra installation directory String ghidraInstallDirPath = project.getFolder( GhidraProjectUtils.GHIDRA_FOLDER_NAME).getLocation().toOSString(); // Get project's java. Gradle should use the same version. // TODO: It's more correct to get this from the project's classpath, since Ghidra's // saved Java home can change from launch to launch. GhidraApplicationLayout ghidraLayout = new GhidraApplicationLayout(new File(ghidraInstallDirPath)); File javaHomeDir = new JavaConfig( ghidraLayout.getApplicationInstallationDir().getFile(false)).getSavedJavaHome(); if(javaHomeDir == null) { throw new IOException("Failed to get the Java home associated with the project. " + "Perform a \"Link Ghidra\" operation on the project and try again."); } // Setup the Gradle build attributes List<String> tasks = new ArrayList<>(); String workingDir = project.getLocation().toOSString(); String gradleDist = gradleDistribution.toString(); String gradleUserHome = ""; String javaHome = javaHomeDir.getAbsolutePath(); List<String> jvmArgs = new ArrayList<>(); List<String> gradleArgs = Arrays.asList(new String[] { "-PGHIDRA_INSTALL_DIR=" + ghidraInstallDirPath }); boolean showExecutionView = false; boolean showConsoleView = true; boolean overrideWorkspaceSettings = true; boolean isOffline = true; boolean isBuildScansEnabled = false; GradleRunConfigurationAttributes gradleAttributes = new GradleRunConfigurationAttributes(tasks, workingDir, gradleDist, gradleUserHome, javaHome, jvmArgs, gradleArgs, showExecutionView, showConsoleView, overrideWorkspaceSettings, isOffline, isBuildScansEnabled); // Launch Gradle GradleLaunchConfigurationManager lm = CorePlugin.gradleLaunchConfigurationManager(); ILaunchConfiguration lc = lm.getOrCreateRunConfiguration(gradleAttributes); lc.launch(ILaunchManager.RUN_MODE, monitor, true, true); lc.delete(); monitor.worked(1); project.refreshLocal(IResource.DEPTH_INFINITE, monitor); monitor.worked(1); info("Finished exporting " + project.getName()); } catch (IOException | ParseException | CoreException e) { throw new InvocationTargetException(e); } finally { monitor.done(); } }
Example 11
Source File: LaunchConfigRule.java From eclipse-extras with Eclipse Public License 1.0 | 4 votes |
@Override protected void before() throws CoreException { // workaround for bug 482711 (https://bugs.eclipse.org/bugs/show_bug.cgi?id=482711) ILaunchConfiguration launchConfig = newPublicLaunchConfig().doSave(); launchConfig.delete(); }
Example 12
Source File: LaunchConfigRule.java From eclipse-extras with Eclipse Public License 1.0 | 4 votes |
private void deleteLaunchConfigs() throws CoreException { for( ILaunchConfiguration launchConfiguration : launchManager.getLaunchConfigurations() ) { launchConfiguration.delete(); } }