diff --git a/ui/org.eclipse.pde.launching/META-INF/MANIFEST.MF b/ui/org.eclipse.pde.launching/META-INF/MANIFEST.MF index 4d331f7d01..dd20c98b7c 100644 --- a/ui/org.eclipse.pde.launching/META-INF/MANIFEST.MF +++ b/ui/org.eclipse.pde.launching/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %name Bundle-SymbolicName: org.eclipse.pde.launching;singleton:=true -Bundle-Version: 3.13.700.qualifier +Bundle-Version: 3.14.0.qualifier Bundle-RequiredExecutionEnvironment: JavaSE-17 Bundle-Vendor: %provider-name Require-Bundle: org.eclipse.jdt.junit.core;bundle-version="[3.6.0,4.0.0)", diff --git a/ui/org.eclipse.pde.launching/src/org/eclipse/pde/launching/EclipseApplicationLaunchConfiguration.java b/ui/org.eclipse.pde.launching/src/org/eclipse/pde/launching/EclipseApplicationLaunchConfiguration.java index 7780f95814..9955b19763 100644 --- a/ui/org.eclipse.pde.launching/src/org/eclipse/pde/launching/EclipseApplicationLaunchConfiguration.java +++ b/ui/org.eclipse.pde.launching/src/org/eclipse/pde/launching/EclipseApplicationLaunchConfiguration.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2024 IBM Corporation and others. + * Copyright (c) 2005, 2026 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -158,6 +158,9 @@ public String[] getProgramArguments(ILaunchConfiguration configuration) throws C programArgs.add(1, computeShowsplashArgument()); } } + if (configuration.getAttribute(IPDELauncherConstants.ADD_CONSOLE, false)) { + programArgs.add("-console"); //$NON-NLS-1$ + } return programArgs.toArray(new String[programArgs.size()]); } diff --git a/ui/org.eclipse.pde.launching/src/org/eclipse/pde/launching/IPDELauncherConstants.java b/ui/org.eclipse.pde.launching/src/org/eclipse/pde/launching/IPDELauncherConstants.java index 5e17819c35..456c287e89 100644 --- a/ui/org.eclipse.pde.launching/src/org/eclipse/pde/launching/IPDELauncherConstants.java +++ b/ui/org.eclipse.pde.launching/src/org/eclipse/pde/launching/IPDELauncherConstants.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2022 IBM Corporation and others. + * Copyright (c) 2005, 2026 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -580,4 +580,14 @@ public interface IPDELauncherConstants { * @since 3.6 */ String ADDITIONAL_PLUGINS = "additional_plugins"; //$NON-NLS-1$ + /** + * Launch configuration attribute key. The value is a boolean specifying whether + * the -console argument should be added when launching. + * When set to true, the application will be started with + * console support enabled. + * @since 3.14 + * + * + */ + String ADD_CONSOLE = "add_console"; //$NON-NLS-1$ } diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/PDEUIMessages.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/PDEUIMessages.java index 1ea86406bb..367feae3be 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/PDEUIMessages.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/PDEUIMessages.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2014, 2025 IBM Corporation and others. + * Copyright (c) 2014, 2026 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -40,6 +40,8 @@ public class PDEUIMessages extends NLS { public static String AbstractTargetPage_setTarget; + public static String ProgramBlock_runWithConsoleOption; + public static String AbstractTargetPage_reloadTarget; public static String AbstractTargetPage_openPreferences; diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/ProgramBlock.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/ProgramBlock.java index c603d5daf2..2ef3f81678 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/ProgramBlock.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/ProgramBlock.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2015 IBM Corporation and others. + * Copyright (c) 2005, 2026 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -46,6 +46,7 @@ public class ProgramBlock { private Button fProductButton; private Combo fProductCombo; private Button fApplicationButton; + private Button fRunAsConsoleSectionButton; private final AbstractLauncherTab fTab; private final Listener fListener = new Listener(); private ControlDecoration fProductComboDecoration; @@ -109,6 +110,7 @@ public void createControl(Composite parent) { createProductSection(group); createApplicationSection(group); + createRunWithConsoleOption(group); } protected void createProductSection(Composite parent) { @@ -135,16 +137,24 @@ protected void createApplicationSection(Composite parent) { fApplicationCombo.addSelectionListener(fListener); } + protected void createRunWithConsoleOption(Composite parent) { + fRunAsConsoleSectionButton = new Button(parent, SWT.CHECK); + fRunAsConsoleSectionButton.setText(PDEUIMessages.ProgramBlock_runWithConsoleOption); + fRunAsConsoleSectionButton.addSelectionListener(fListener); + } + public void initializeFrom(ILaunchConfiguration config) throws CoreException { initializeProductSection(config); initializeApplicationSection(config); boolean useProduct = config.getAttribute(IPDELauncherConstants.USE_PRODUCT, false) && fProductCombo.getItemCount() > 0; + boolean addConsole = config.getAttribute(IPDELauncherConstants.ADD_CONSOLE, false); fApplicationButton.setSelection(!useProduct); fApplicationCombo.setEnabled(!useProduct); fProductButton.setSelection(useProduct); fProductButton.setEnabled(fProductCombo.getItemCount() > 0); fProductCombo.setEnabled(useProduct); + fRunAsConsoleSectionButton.setSelection(addConsole); } protected void initializeProductSection(ILaunchConfiguration config) throws CoreException { @@ -196,6 +206,8 @@ protected void initializeApplicationSection(ILaunchConfiguration config) throws public void performApply(ILaunchConfigurationWorkingCopy config) { saveApplicationSection(config); saveProductSection(config); + saveConsoleSection(config); + } protected void saveProductSection(ILaunchConfigurationWorkingCopy config) { @@ -213,6 +225,18 @@ protected void saveApplicationSection(ILaunchConfigurationWorkingCopy config) { } } + protected void saveConsoleSection(ILaunchConfigurationWorkingCopy config) { + try { + boolean updatePreferences = false; + if (fRunAsConsoleSectionButton.getSelection()) { + updatePreferences = true; + } + config.setAttribute(IPDELauncherConstants.ADD_CONSOLE, updatePreferences); + config.doSave(); + } catch (CoreException e) { + } + } + public void setDefaults(ILaunchConfigurationWorkingCopy config) { String product = TargetPlatform.getDefaultProduct(); if (product != null) { diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/pderesources.properties b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/pderesources.properties index 333482bffa..0f4ddd77f3 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/pderesources.properties +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/pderesources.properties @@ -1,5 +1,5 @@ ############################################################################### -# Copyright (c) 2000, 2025 IBM Corporation and others. +# Copyright (c) 2000, 2026 IBM Corporation and others. # # This program and the accompanying materials # are made available under the terms of the Eclipse Public License 2.0 @@ -536,6 +536,7 @@ ProgramBlock_runProduct=Run a &product: ProgramBlock_productDecorationWarning0=A product with this name cannot be found in any required bundle. This launch may fail to start as expected unless there is an available IProductProvider that can supply this product. ProgramBlock_programToRun=Program to Run ProgramBlock_runApplication=Run an &application: +ProgramBlock_runWithConsoleOption = Enable OSGi Console BasicLauncherTab_javaExec=Java executable: BasicLauncherTab_unbound=unbound BasicLauncherTab_ee=E&xecution environment: