diff --git a/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/ConsolePreferencePage.java b/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/ConsolePreferencePage.java
index 91ac6956fc5..b339991b156 100644
--- a/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/ConsolePreferencePage.java
+++ b/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/ConsolePreferencePage.java
@@ -177,6 +177,10 @@ public void widgetSelected(SelectionEvent e) {
addField(new BooleanFieldEditor(IDebugPreferenceConstants.CONSOLE_OPEN_ON_OUT, DebugPreferencesMessages.ConsolePreferencePage_Show__Console_View_when_there_is_program_output_3, SWT.NONE, getFieldEditorParent()));
addField(new BooleanFieldEditor(IDebugPreferenceConstants.CONSOLE_OPEN_ON_ERR, DebugPreferencesMessages.ConsolePreferencePage_Show__Console_View_when_there_is_program_error_3, SWT.NONE, getFieldEditorParent()));
+ BooleanFieldEditor autoPinEditor = new BooleanFieldEditor(IConsoleConstants.AUTO_PIN_ENABLED_PREF_NAME,
+ DebugPreferencesMessages.ConsolePreferencePage_ConsoleAutoPinEnable, SWT.NONE, getFieldEditorParent());
+ autoPinEditor.setPreferenceStore(ConsolePlugin.getDefault().getPreferenceStore());
+ addField(autoPinEditor);
Label comboLabel = new Label(getFieldEditorParent(), SWT.NONE);
comboLabel.setText(DebugPreferencesMessages.ConsoleElapsedTimeLabel);
fElapsedFormat = new ComboViewer(getFieldEditorParent(), SWT.DROP_DOWN | SWT.BORDER);
@@ -324,6 +328,9 @@ protected void performDefaults() {
updateBufferSizeEditor();
updateInterpretCrAsControlCharacterEditor();
updateElapsedTimePreferences();
+
+ IPreferenceStore prefStore = ConsolePlugin.getDefault().getPreferenceStore();
+ prefStore.setValue(IConsoleConstants.REMEMBER_AUTO_PIN_DECISION_PREF_NAME, false);
}
protected boolean canClearErrorMessage() {
diff --git a/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.java b/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.java
index d1213fa11cb..cf401c4152e 100644
--- a/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.java
+++ b/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.java
@@ -31,6 +31,8 @@ public class DebugPreferencesMessages extends NLS {
public static String ConsolePreferencePage_Console_width;
public static String ConsolePreferencePage_Limit_console_output_1;
public static String ConsolePreferencePage_Console_buffer_size__characters___2;
+
+ public static String ConsolePreferencePage_ConsoleAutoPinEnable;
public static String ConsolePreferencePage_The_console_buffer_size_must_be_at_least_1000_characters__1;
public static String ConsolePreferencePage_console_width;
public static String ConsolePreferencePage_12;
diff --git a/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.properties b/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.properties
index 78819ff3c93..e29da0fd839 100644
--- a/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.properties
+++ b/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.properties
@@ -23,6 +23,7 @@ ConsolePreferencePage_Wrap_text_1=Fixed &width console
ConsolePreferencePage_Console_width=&Maximum character width:
ConsolePreferencePage_Limit_console_output_1=&Limit console output
ConsolePreferencePage_Console_buffer_size__characters___2=Console &buffer size (characters):
+ConsolePreferencePage_ConsoleAutoPinEnable=Pin current and the new Console views when a new Console view is opened
ConsolePreferencePage_The_console_buffer_size_must_be_at_least_1000_characters__1=Buffer size must be between 1000 and {0} inclusive.
ConsolePreferencePage_console_width=Character width must be between 80 and 1000 inclusive.
ConsolePreferencePage_12=Displayed &tab width:
diff --git a/debug/org.eclipse.ui.console/META-INF/MANIFEST.MF b/debug/org.eclipse.ui.console/META-INF/MANIFEST.MF
index 77a7668e488..532662eaff8 100644
--- a/debug/org.eclipse.ui.console/META-INF/MANIFEST.MF
+++ b/debug/org.eclipse.ui.console/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.ui.console; singleton:=true
-Bundle-Version: 3.14.400.qualifier
+Bundle-Version: 3.15.0.qualifier
Bundle-Activator: org.eclipse.ui.console.ConsolePlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin
diff --git a/debug/org.eclipse.ui.console/src/org/eclipse/ui/console/IConsoleConstants.java b/debug/org.eclipse.ui.console/src/org/eclipse/ui/console/IConsoleConstants.java
index 8c0a61a59cd..8f4dc8f24d2 100644
--- a/debug/org.eclipse.ui.console/src/org/eclipse/ui/console/IConsoleConstants.java
+++ b/debug/org.eclipse.ui.console/src/org/eclipse/ui/console/IConsoleConstants.java
@@ -163,6 +163,22 @@ public interface IConsoleConstants {
*/
String P_CONSOLE_WORD_WRAP = ConsolePlugin.getUniqueIdentifier() + ".P_CONSOLE_WORD_WRAP"; //$NON-NLS-1$
+ /**
+ * The preference name for the auto pin question to avoid that opening for every
+ * new console opening.
+ *
+ * @since 3.15
+ */
+ String REMEMBER_AUTO_PIN_DECISION_PREF_NAME = ConsolePlugin.getUniqueIdentifier() + ".AUTO_PIN_ASKED"; //$NON-NLS-1$
+
+ /**
+ * The preference name for automatically pinning current Console view when
+ * opening a new Console view.
+ *
+ * @since 3.15
+ */
+ String AUTO_PIN_ENABLED_PREF_NAME = ConsolePlugin.getUniqueIdentifier() + ".AUTO_PIN_ENABLED"; //$NON-NLS-1$
+
/**
* The default tab size for text consoles.
*
diff --git a/debug/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleMessages.java b/debug/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleMessages.java
index 85c24291cc2..47414b13a89 100644
--- a/debug/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleMessages.java
+++ b/debug/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleMessages.java
@@ -33,6 +33,10 @@ public class ConsoleMessages extends NLS {
public static String PinConsoleAction_0;
public static String PinConsoleAction_1;
+ public static String TurnOnAutoPinDialogMessage;
+ public static String TurnOnAutoPinDialogTitle;
+ public static String TurnOnAutoPinRememberDecision;
+
public static String ClearOutputAction_title;
public static String ClearOutputAction_toolTipText;
@@ -63,6 +67,7 @@ public class ConsoleMessages extends NLS {
public static String TextConsolePage_PasteText;
public static String TextConsolePage_PasteDescrip;
+
static {
// load message values from bundle file
NLS.initializeMessages(BUNDLE_NAME, ConsoleMessages.class);
diff --git a/debug/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleMessages.properties b/debug/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleMessages.properties
index 30412ba434e..af42f0c44d6 100644
--- a/debug/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleMessages.properties
+++ b/debug/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleMessages.properties
@@ -58,4 +58,7 @@ TextConsolePage_PasteDescrip=Paste
PatternMatchListenerExtension_3=Console Pattern Match Listener
PatternMatchListenerExtension_4=contributed by
PatternMatchListenerExtension_5=is missing required enablement expression and will be removed
-UpdatingConsoleState=Updating console state
\ No newline at end of file
+UpdatingConsoleState=Updating console state
+TurnOnAutoPinDialogMessage=To see updates of different console pages in parallel, both current and new Console view will be pinned now.
+TurnOnAutoPinDialogTitle=Pin Console views?
+TurnOnAutoPinRememberDecision=Remember my decision
diff --git a/debug/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleUIPreferenceInitializer.java b/debug/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleUIPreferenceInitializer.java
index e87dc6605e6..ee7869fc84f 100644
--- a/debug/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleUIPreferenceInitializer.java
+++ b/debug/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleUIPreferenceInitializer.java
@@ -29,6 +29,8 @@ public void initializeDefaultPreferences() {
IPreferenceStore prefs = ConsolePlugin.getDefault().getPreferenceStore();
prefs.setDefault(IConsoleConstants.P_CONSOLE_AUTO_SCROLL_LOCK, true);
prefs.setDefault(IConsoleConstants.P_CONSOLE_WORD_WRAP, false);
+ prefs.setDefault(IConsoleConstants.AUTO_PIN_ENABLED_PREF_NAME, true);
+ prefs.setDefault(IConsoleConstants.REMEMBER_AUTO_PIN_DECISION_PREF_NAME, false);
}
}
diff --git a/debug/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleView.java b/debug/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleView.java
index 865f83c24ee..145fcd3d5ea 100644
--- a/debug/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleView.java
+++ b/debug/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleView.java
@@ -461,7 +461,7 @@ protected void createActions() {
fDisplayConsoleAction = new ConsoleDropDownAction(this);
ConsoleFactoryExtension[] extensions = ((ConsoleManager)ConsolePlugin.getDefault().getConsoleManager()).getConsoleFactoryExtensions();
if (extensions.length > 0) {
- fOpenConsoleAction = new OpenConsoleAction();
+ fOpenConsoleAction = new OpenConsoleAction(this);
}
}
diff --git a/debug/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleViewConsoleFactory.java b/debug/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleViewConsoleFactory.java
index 6330831e19d..7ebab677345 100644
--- a/debug/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleViewConsoleFactory.java
+++ b/debug/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleViewConsoleFactory.java
@@ -13,6 +13,12 @@
*******************************************************************************/
package org.eclipse.ui.internal.console;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.MessageDialogWithToggle;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IViewPart;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PartInitException;
@@ -24,22 +30,70 @@
public class ConsoleViewConsoleFactory implements IConsoleFactory {
int counter = 1;
+ private ConsoleView currentConsoleView;
@Override
public void openConsole() {
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- if (window != null) {
- IWorkbenchPage page = window.getActivePage();
- if (page != null) {
- try {
- String secondaryId = "Console View #" + counter; //$NON-NLS-1$
- page.showView(IConsoleConstants.ID_CONSOLE_VIEW, secondaryId, 1);
- counter++;
- } catch (PartInitException e) {
- ConsolePlugin.log(e);
- }
+ if (window == null) {
+ return;
+ }
+ IWorkbenchPage page = window.getActivePage();
+ if (page == null) {
+ return;
+ }
+ boolean shouldPin = handleAutoPin();
+ try {
+ String secondaryId = "Console View #" + counter; //$NON-NLS-1$
+ IViewPart view = page.showView(IConsoleConstants.ID_CONSOLE_VIEW, secondaryId, 1);
+ if (view instanceof ConsoleView newConsoleView) {
+ newConsoleView.setPinned(shouldPin);
}
+ counter++;
+ } catch (PartInitException e) {
+ ConsolePlugin.log(e);
+ }
+ }
+
+ /**
+ * This handler checks if the remember auto-pin decision state not true
+ * and asks the user if auto pin of the view content should be enabled.
+ * Afterwards it checks if remember auto-pin decision was checked and sets the
+ * preference according to that
+ *
+ * If the remember auto-pin decision state is true it gathers the auto
+ * pin preference value and sets this to the current view.
+ */
+ private boolean handleAutoPin() {
+ if (currentConsoleView == null) {
+ return false;
+ }
+ IPreferenceStore store = ConsolePlugin.getDefault().getPreferenceStore();
+ if (!store.getBoolean(IConsoleConstants.REMEMBER_AUTO_PIN_DECISION_PREF_NAME)) {
+ Shell shell = Display.getDefault().getActiveShell();
+ MessageDialogWithToggle toggleDialog = MessageDialogWithToggle.openOkCancelConfirm(shell,
+ ConsoleMessages.TurnOnAutoPinDialogTitle, ConsoleMessages.TurnOnAutoPinDialogMessage,
+ ConsoleMessages.TurnOnAutoPinRememberDecision, false, null, null);
+
+ store.setValue(IConsoleConstants.AUTO_PIN_ENABLED_PREF_NAME,
+ toggleDialog.getReturnCode() == IDialogConstants.OK_ID);
+
+ store.setValue(IConsoleConstants.REMEMBER_AUTO_PIN_DECISION_PREF_NAME, toggleDialog.getToggleState());
+ }
+
+ if (store.getBoolean(IConsoleConstants.AUTO_PIN_ENABLED_PREF_NAME)) {
+ // To avoid if pinned manually and unpin due to preference..
+ currentConsoleView.setPinned(true);
+ return true;
}
+ return false;
+ }
+
+ /**
+ * Sets the console view, on which the open new console action was called.
+ */
+ void setConsoleView(ConsoleView consoleView) {
+ this.currentConsoleView = consoleView;
}
}
diff --git a/debug/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/OpenConsoleAction.java b/debug/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/OpenConsoleAction.java
index 7d5b63eb8c2..5e0fb74ead5 100644
--- a/debug/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/OpenConsoleAction.java
+++ b/debug/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/OpenConsoleAction.java
@@ -39,9 +39,14 @@ public class OpenConsoleAction extends Action implements IMenuCreator {
private ConsoleFactoryExtension[] fFactoryExtensions;
private Menu fMenu;
+ private ConsoleView consoleView;
- public OpenConsoleAction() {
+ /**
+ * @param consoleView the view which this action belongs to.
+ */
+ public OpenConsoleAction(ConsoleView consoleView) {
super(ConsoleMessages.OpenConsoleAction_0, AS_DROP_DOWN_MENU);
+ this.consoleView = consoleView;
fFactoryExtensions = getSortedFactories();
setToolTipText(ConsoleMessages.OpenConsoleAction_1);
setImageDescriptor(ConsolePluginImages.getImageDescriptor(IInternalConsoleConstants.IMG_ELCL_NEW_CON));
@@ -66,6 +71,7 @@ private ConsoleFactoryExtension[] getSortedFactories() {
@Override
public void dispose() {
+ consoleView = null;
fFactoryExtensions = null;
if (fMenu != null) {
fMenu.dispose();
@@ -98,7 +104,7 @@ public Menu getMenu(Control parent) {
if (!WorkbenchActivityHelper.filterItem(extension) && extension.isEnabled()) {
String label = extension.getLabel();
ImageDescriptor image = extension.getImageDescriptor();
- addActionToMenu(fMenu, new ConsoleFactoryAction(label, image, extension), accel);
+ addActionToMenu(fMenu, new ConsoleFactoryAction(label, image, extension, consoleView), accel);
accel++;
if (extension.isNewConsoleExtenson()) {
new Separator("new").fill(fMenu, -1); //$NON-NLS-1$
@@ -128,17 +134,20 @@ public Menu getMenu(Menu parent) {
return null;
}
- private class ConsoleFactoryAction extends Action {
+ private static class ConsoleFactoryAction extends Action {
+ private final ConsoleView fConsoleView;
private final ConsoleFactoryExtension fConfig;
private IConsoleFactory fFactory;
- public ConsoleFactoryAction(String label, ImageDescriptor image, ConsoleFactoryExtension extension) {
+ public ConsoleFactoryAction(String label, ImageDescriptor image, ConsoleFactoryExtension extension,
+ ConsoleView consoleView) {
setText(label);
if (image != null) {
setImageDescriptor(image);
}
fConfig = extension;
+ this.fConsoleView = consoleView;
}
@Override
@@ -147,7 +156,9 @@ public void run() {
if (fFactory == null) {
fFactory = fConfig.createFactory();
}
-
+ if (fFactory instanceof ConsoleViewConsoleFactory consViewConsFactory) {
+ consViewConsFactory.setConsoleView(fConsoleView);
+ }
fFactory.openConsole();
} catch (CoreException e) {
ConsolePlugin.log(e);