diff options
author | Kevin Barnes | 2004-12-09 19:05:26 +0000 |
---|---|---|
committer | Kevin Barnes | 2004-12-09 19:05:26 +0000 |
commit | 3863ef6fc0f8fe85d55ba9996808d065ecea4092 (patch) | |
tree | bde13372bd23a03df32d3b5e6d83ce41a42b13fe | |
parent | be761dab9f87419a60ca5a685d30c7645a199662 (diff) | |
download | eclipse.platform.debug-3863ef6fc0f8fe85d55ba9996808d065ecea4092.tar.gz eclipse.platform.debug-3863ef6fc0f8fe85d55ba9996808d065ecea4092.tar.xz eclipse.platform.debug-3863ef6fc0f8fe85d55ba9996808d065ecea4092.zip |
Bug 1654 - USABILITY - Can't look at client server output in one perspective (1GFX2ZU)
12 files changed, 145 insertions, 89 deletions
diff --git a/org.eclipse.ui.console/plugin.properties b/org.eclipse.ui.console/plugin.properties index 9a93d9b3f..1c77c1e9e 100644 --- a/org.eclipse.ui.console/plugin.properties +++ b/org.eclipse.ui.console/plugin.properties @@ -19,4 +19,6 @@ ViewCommand.consoleView.description=Show the Console view ConsolePatternMatchListenerName= Console Pattern Match Listeners ConsolePageParticipantName= Console Page Participants -ConsoleFactoryName= Console Factories
\ No newline at end of file +ConsoleFactoryName= Console Factories + +consoleViewConsoleFactory.name=New Console View
\ No newline at end of file diff --git a/org.eclipse.ui.console/plugin.xml b/org.eclipse.ui.console/plugin.xml index 6ed80d45a..3b2856782 100644 --- a/org.eclipse.ui.console/plugin.xml +++ b/org.eclipse.ui.console/plugin.xml @@ -27,10 +27,11 @@ <extension point="org.eclipse.ui.views"> <view - name="%ConsoleView.name" + allowMultiple="true" + class="org.eclipse.ui.internal.console.ConsoleView" icon="icons/full/cview16/console_view.gif" category="org.eclipse.ui" - class="org.eclipse.ui.internal.console.ConsoleView" + name="%ConsoleView.name" id="org.eclipse.ui.console.ConsoleView"> </view> </extension> @@ -65,5 +66,11 @@ M4 = Platform-specific fourth key properties="consoleTypeTest" id="org.eclipse.ui.console.ConsoleTypePropertyTester"/> </extension> + <extension + point="org.eclipse.ui.console.consoleFactories"> + <consoleFactory + label="%consoleViewConsoleFactory.name" + class="org.eclipse.ui.console.actions.ConsoleViewConsoleFactory"/> + </extension> </plugin> diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/console/IConsoleConstants.java b/org.eclipse.ui.console/src/org/eclipse/ui/console/IConsoleConstants.java index c34286471..6af34d610 100644 --- a/org.eclipse.ui.console/src/org/eclipse/ui/console/IConsoleConstants.java +++ b/org.eclipse.ui.console/src/org/eclipse/ui/console/IConsoleConstants.java @@ -137,12 +137,6 @@ public interface IConsoleConstants { */ public static final String P_CONSOLE_OUTPUT_COMPLETE = ConsolePlugin.getUniqueIdentifier() + ".P_CONSOLE_STREAMS_CLOSED"; //$NON-NLS-1$ - /** - * Property constant indicating that the auto scrolling should be turned on (or off) - * - * @since 3.1 - */ - public static final String P_AUTO_SCROLL = ConsolePlugin.getUniqueIdentifier() + ".P_AUTO_SCROLL"; //$NON-NLS-1$ /** * The default tab size diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/console/IConsoleView.java b/org.eclipse.ui.console/src/org/eclipse/ui/console/IConsoleView.java index f3fc4daf2..57ed9b453 100644 --- a/org.eclipse.ui.console/src/org/eclipse/ui/console/IConsoleView.java +++ b/org.eclipse.ui.console/src/org/eclipse/ui/console/IConsoleView.java @@ -62,5 +62,17 @@ public interface IConsoleView extends IViewPart { * @param console the console that has changed */ public void warnOfContentChange(IConsole console); + + /** + * Sets the scroll lock state of the currently active console. + * @param scrollLock <code>true</code> to turn scroll lock on, otherwise <code>false</code> + */ + public void setScrollLock(boolean scrollLock); + + /** + * Returns the scroll lock state of the currently active console + * @return <code>true</code> if scroll lock is on, <code>false</code> otherwise + */ + public boolean getScrollLock(); } diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsole.java b/org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsole.java index 7489b7751..55eb393d2 100644 --- a/org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsole.java +++ b/org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsole.java @@ -54,13 +54,7 @@ public abstract class TextConsole extends AbstractConsole { /** * The font used by this console */ - private Font fFont; - /** - * Whether the console srolls to show the end of text as output - * is appended. - */ - private boolean fAutoScroll; - + private Font fFont; /** * The Console's regular expression pattern matcher */ @@ -235,26 +229,13 @@ public abstract class TextConsole extends AbstractConsole { * output is appened to the console. * * @param scroll whether this console scrolls automatically + * + * @deprecated Since a console can now exist in more than one ConsoleView in the same + * perspective, autoscroll can not be set on the console itself. It would not be + * desirable to change the state of scroll lock in every console view. + * This method will be deleted before 3.1. */ public void setAutoScroll(boolean scroll) { - if (scroll != fAutoScroll) { - fAutoScroll = scroll; - ConsolePlugin.getStandardDisplay().asyncExec(new Runnable() { - public void run() { - firePropertyChange(TextConsole.this, IConsoleConstants.P_AUTO_SCROLL, new Boolean(!fAutoScroll), new Boolean(fAutoScroll)); - } - }); - } - } - - /** - * Returns whether this console scrolls automatically to show the end of text as - * output is appened to the console. - * - * @return whether this console scrolls automatically - */ - public boolean getAutoScroll() { - return fAutoScroll; } /** diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/console/actions/ConsoleViewConsoleFactory.java b/org.eclipse.ui.console/src/org/eclipse/ui/console/actions/ConsoleViewConsoleFactory.java new file mode 100644 index 000000000..5f0002121 --- /dev/null +++ b/org.eclipse.ui.console/src/org/eclipse/ui/console/actions/ConsoleViewConsoleFactory.java @@ -0,0 +1,46 @@ +/******************************************************************************* + * Copyright (c) 2000, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.ui.console.actions; + +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PartInitException; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.console.ConsolePlugin; +import org.eclipse.ui.console.IConsoleConstants; +import org.eclipse.ui.console.IConsoleFactory; +import org.eclipse.ui.internal.console.ConsoleMessages; + +public class ConsoleViewConsoleFactory implements IConsoleFactory { + + int counter = 1; + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.console.IConsoleFactory#openConsole() + */ + public void openConsole() { + IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); + if (window != null) { + IWorkbenchPage page = window.getActivePage(); + if (page != null) { + try { + String secondaryId = ConsoleMessages.getString("ConsoleViewConsoleFactory.0") + counter; //$NON-NLS-1$ + page.showView(IConsoleConstants.ID_CONSOLE_VIEW, secondaryId, 1); + } catch (PartInitException e) { + ConsolePlugin.log(e); + } + } + } + } + +} diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleManager.java b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleManager.java index 0030801aa..dbc5aa670 100644 --- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleManager.java +++ b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleManager.java @@ -23,8 +23,10 @@ import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Status; import org.eclipse.jface.util.ListenerList; import org.eclipse.ui.IViewPart; +import org.eclipse.ui.IViewReference; import org.eclipse.ui.IWindowListener; import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchPart; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.PartInitException; import org.eclipse.ui.PlatformUI; @@ -54,6 +56,7 @@ public class ConsoleManager implements IConsoleManager { * List of registered consoles */ private List fConsoles = new ArrayList(10); + // change notification constants private final static int ADDED = 1; @@ -225,25 +228,36 @@ public class ConsoleManager implements IConsoleManager { if (window != null) { IWorkbenchPage page= window.getActivePage(); if (page != null) { - IViewPart consoleView= page.findView(IConsoleConstants.ID_CONSOLE_VIEW); - if (consoleView == null) { - try { - consoleView = page.showView(IConsoleConstants.ID_CONSOLE_VIEW, null, IWorkbenchPage.VIEW_CREATE); - } catch (PartInitException pie) { - ConsolePlugin.log(pie); - } - } - boolean bringToTop = shouldBringToTop(console, consoleView); - if (bringToTop) { - page.bringToTop(consoleView); - } - - if (consoleView instanceof IConsoleView) { - ((IConsoleView)consoleView).display(console); - } + IViewReference[] viewReferences = page.getViewReferences(); + for (int i = 0; i < viewReferences.length; i++) { + IViewReference viewRef = viewReferences[i]; + if (viewRef == null) { + continue; + } + if(IConsoleConstants.ID_CONSOLE_VIEW.equals(viewRef.getId())) { + IWorkbenchPart part = viewRef.getPart(false); + IConsoleView consoleView = null; + if (part == null) { + try { + consoleView = (IConsoleView) page.showView(IConsoleConstants.ID_CONSOLE_VIEW, null, IWorkbenchPage.VIEW_CREATE); + } catch (PartInitException pie) { + ConsolePlugin.log(pie); + } + } else if (!(part instanceof IConsoleView)) { + continue; + } else { + consoleView = (IConsoleView) part; + } + boolean bringToTop = shouldBringToTop(console, consoleView); + if (bringToTop) { + page.bringToTop(consoleView); + } + consoleView.display(console); + } + } } - } - } + } + } }); } @@ -358,4 +372,5 @@ public class ConsoleManager implements IConsoleManager { } return (ConsoleFactoryExtension[]) fConsoleFactoryExtensions.toArray(new ConsoleFactoryExtension[0]); } + } diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleMessages.properties b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleMessages.properties index 0803db75b..1b67ae0d0 100644 --- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleMessages.properties +++ b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleMessages.properties @@ -13,6 +13,7 @@ AbstractConsole.0=Exception occurred during console property change notification ConsoleDropDownAction.0=Select Console ConsoleDropDownAction.1=Display Selected Console +ConsoleViewConsoleFactory.0=Console View \# ConsoleManager.0=An exception occurred during console notification diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleView.java b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleView.java index 9d452378f..6f4ec1f2c 100644 --- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleView.java +++ b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleView.java @@ -87,6 +87,8 @@ public class ConsoleView extends PageBookView implements IConsoleView, IConsoleL private OpenConsoleAction fOpenConsoleAction = null; + private boolean fScrollLock; + private boolean isAvailable() { return getPageBook() != null && !getPageBook().isDisposed(); } @@ -150,6 +152,10 @@ public class ConsoleView extends PageBookView implements IConsoleView, IConsoleL if (fPinAction != null) { fPinAction.update(); } + IPage page = getCurrentPage(); + if (page instanceof IOConsolePage) { + ((IOConsolePage)page).setAutoScroll(!fScrollLock); + } } } @@ -575,5 +581,24 @@ public class ConsoleView extends PageBookView implements IConsoleView, IConsoleL */ public void partInputChanged(IWorkbenchPartReference partRef) { } + + /* (non-Javadoc) + * @see org.eclipse.ui.console.IConsoleView#setScrollLock(boolean) + */ + public void setScrollLock(boolean scrollLock) { + fScrollLock = scrollLock; + + IPage page = getCurrentPage(); + if (page instanceof IOConsolePage) { + ((IOConsolePage)page).setAutoScroll(!scrollLock); + } + } + + /* (non-Javadoc) + * @see org.eclipse.ui.console.IConsoleView#getScrollLock() + */ + public boolean getScrollLock() { + return fScrollLock; + } }
\ No newline at end of file diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IInternalConsoleConstants.java b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IInternalConsoleConstants.java index a603d9ebf..17a002a2f 100644 --- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IInternalConsoleConstants.java +++ b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IInternalConsoleConstants.java @@ -10,10 +10,7 @@ *******************************************************************************/ package org.eclipse.ui.internal.console; -import org.eclipse.ui.console.ConsolePlugin; - public interface IInternalConsoleConstants { - public static final String PREF_CONSOLE_SCROLL_LOCK = ConsolePlugin.getUniqueIdentifier() + ".PREF_CONSOLE_LOCK"; //$NON-NLS-1$ // tool images public static final String IMG_LCL_PIN = "IMG_LCL_PIN"; //$NON-NLS-1$ diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsolePage.java b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsolePage.java index de3bf1a06..145a1724e 100644 --- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsolePage.java +++ b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsolePage.java @@ -16,7 +16,6 @@ import org.eclipse.swt.widgets.Composite; import org.eclipse.ui.actions.ActionFactory; import org.eclipse.ui.console.IConsoleConstants; import org.eclipse.ui.console.IConsoleView; -import org.eclipse.ui.console.IOConsole; import org.eclipse.ui.console.TextConsole; import org.eclipse.ui.console.TextConsolePage; import org.eclipse.ui.console.TextConsoleViewer; @@ -41,10 +40,7 @@ public class IOConsolePage extends TextConsolePage { fPropertyChangeListener = new IPropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { String property = event.getProperty(); - if (property.equals(IConsoleConstants.P_AUTO_SCROLL)) { - IOConsole ioconsole = (IOConsole) getConsole(); - setAutoScroll(ioconsole.getAutoScroll()); - } else if (property.equals(IConsoleConstants.P_CONSOLE_OUTPUT_COMPLETE)) { + if (property.equals(IConsoleConstants.P_CONSOLE_OUTPUT_COMPLETE)) { setReadOnly(); } } @@ -98,7 +94,7 @@ public class IOConsolePage extends TextConsolePage { */ protected void createActions() { super.createActions(); - fScrollLockAction = new ScrollLockAction((IOConsole) getConsole()); + fScrollLockAction = new ScrollLockAction(getConsoleView()); setAutoScroll(!fScrollLockAction.isChecked()); } diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ScrollLockAction.java b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ScrollLockAction.java index ed42ad3e0..0b0bd369c 100644 --- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ScrollLockAction.java +++ b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ScrollLockAction.java @@ -1,60 +1,40 @@ package org.eclipse.ui.internal.console; import org.eclipse.jface.action.Action; -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.jface.util.IPropertyChangeListener; -import org.eclipse.jface.util.PropertyChangeEvent; -import org.eclipse.ui.console.ConsolePlugin; -import org.eclipse.ui.console.IOConsole; +import org.eclipse.ui.console.IConsoleView; /** * Toggles console auto-scroll * * @since 3.1 */ -public class ScrollLockAction extends Action implements IPropertyChangeListener { +public class ScrollLockAction extends Action { - private IPreferenceStore prefStore = ConsolePlugin.getDefault().getPreferenceStore(); - private IOConsole fConsole; + private IConsoleView fConsoleView; - public ScrollLockAction(IOConsole console) { + public ScrollLockAction(IConsoleView consoleView) { super(ConsoleMessages.getString("ScrollLockAction.0")); //$NON-NLS-1$ - fConsole = console; + fConsoleView = consoleView; setToolTipText(ConsoleMessages.getString("ScrollLockAction.1")); //$NON-NLS-1$ setHoverImageDescriptor(ConsolePluginImages.getImageDescriptor(IInternalConsoleConstants.IMG_LCL_LOCK)); setDisabledImageDescriptor(ConsolePluginImages.getImageDescriptor(IInternalConsoleConstants.IMG_DLCL_LOCK)); setImageDescriptor(ConsolePluginImages.getImageDescriptor(IInternalConsoleConstants.IMG_ELCL_LOCK)); - boolean checked = prefStore.getBoolean(IInternalConsoleConstants.PREF_CONSOLE_SCROLL_LOCK); + boolean checked = fConsoleView.getScrollLock(); setChecked(checked); - fConsole.setAutoScroll(!checked); - prefStore.addPropertyChangeListener(this); } /** * @see org.eclipse.jface.action.IAction#run() */ public void run() { - // There may be mulitple consoles open but scroll lock is considered global to all of them. - // Need to fire the event so that all consoles have a chance to update their state. - prefStore.setValue(IInternalConsoleConstants.PREF_CONSOLE_SCROLL_LOCK, isChecked()); + fConsoleView.setScrollLock(isChecked()); } public void dispose() { - prefStore.removePropertyChangeListener(this); + fConsoleView = null; } - /* (non-Javadoc) - * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent) - */ - public void propertyChange(PropertyChangeEvent event) { - if (event.getProperty().equals(IInternalConsoleConstants.PREF_CONSOLE_SCROLL_LOCK)) { - boolean checked = prefStore.getBoolean(IInternalConsoleConstants.PREF_CONSOLE_SCROLL_LOCK); - setChecked(checked); - fConsole.setAutoScroll(!checked); - } - - } } |