Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.ui.console/src/org/eclipse/ui/internal/console')
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleDocument.java115
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleDocumentAdapter.java394
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleDropDownAction.java169
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleFactoryExtension.java121
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleHyperlinkPosition.java51
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleManager.java471
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleMessages.java70
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleMessages.properties54
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsolePageParticipantExtension.java73
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsolePatternMatcher.java310
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsolePluginImages.java158
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleResourceBundleMessages.java35
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleResourceBundleMessages.properties19
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleTypePropertyTester.java32
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleView.java809
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleViewConsoleFactory.java46
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleWorkbenchPart.java125
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/FollowHyperlinkAction.java55
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/HyperlinkUpdater.java56
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IConsoleHelpContextIds.java46
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IInternalConsoleConstants.java31
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsolePage.java141
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsolePartition.java209
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsolePartitioner.java699
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsoleViewer.java144
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/OpenConsoleAction.java153
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/PatternMatchListener.java71
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/PatternMatchListenerExtension.java153
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/PinConsoleAction.java54
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ScrollLockAction.java51
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ShowConsoleAction.java64
31 files changed, 0 insertions, 4979 deletions
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleDocument.java b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleDocument.java
deleted file mode 100644
index ddf2491c6..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleDocument.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.internal.console;
-
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.BadPositionCategoryException;
-import org.eclipse.jface.text.Document;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.Position;
-
-/**
- * A console document. Requires synchronization for multi-threaded access.
- */
-public class ConsoleDocument extends Document {
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.text.IDocument#get(int, int)
- */
- public synchronized String get(int pos, int length) throws BadLocationException {
- return super.get(pos, length);
- }
- /* (non-Javadoc)
- * @see org.eclipse.jface.text.IDocument#getLength()
- */
- public synchronized int getLength() {
- return super.getLength();
- }
- /* (non-Javadoc)
- * @see org.eclipse.jface.text.IDocument#getLineDelimiter(int)
- */
- public synchronized String getLineDelimiter(int line) throws BadLocationException {
- return super.getLineDelimiter(line);
- }
- /* (non-Javadoc)
- * @see org.eclipse.jface.text.IDocument#getLineInformation(int)
- */
- public synchronized IRegion getLineInformation(int line) throws BadLocationException {
- return super.getLineInformation(line);
- }
- /* (non-Javadoc)
- * @see org.eclipse.jface.text.IDocument#getLineInformationOfOffset(int)
- */
- public synchronized IRegion getLineInformationOfOffset(int offset) throws BadLocationException {
- return super.getLineInformationOfOffset(offset);
- }
- /* (non-Javadoc)
- * @see org.eclipse.jface.text.IDocument#getLineLength(int)
- */
- public synchronized int getLineLength(int line) throws BadLocationException {
- return super.getLineLength(line);
- }
- /* (non-Javadoc)
- * @see org.eclipse.jface.text.IDocument#getLineOffset(int)
- */
- public synchronized int getLineOffset(int line) throws BadLocationException {
- return super.getLineOffset(line);
- }
- /* (non-Javadoc)
- * @see org.eclipse.jface.text.IDocument#getLineOfOffset(int)
- */
- public int getLineOfOffset(int pos) throws BadLocationException {
- return super.getLineOfOffset(pos);
- }
- /* (non-Javadoc)
- * @see org.eclipse.jface.text.IDocument#getNumberOfLines()
- */
- public synchronized int getNumberOfLines() {
- return super.getNumberOfLines();
- }
- /* (non-Javadoc)
- * @see org.eclipse.jface.text.IDocument#replace(int, int, java.lang.String)
- */
- public synchronized void replace(int pos, int length, String text) throws BadLocationException {
- super.replace(pos, length, text);
- }
- /* (non-Javadoc)
- * @see org.eclipse.jface.text.IDocument#set(java.lang.String)
- */
- public synchronized void set(String text) {
- super.set(text);
- }
- /* (non-Javadoc)
- * @see org.eclipse.jface.text.AbstractDocument#completeInitialization()
- */
- protected void completeInitialization() {
- super.completeInitialization();
- addPositionUpdater(new HyperlinkUpdater());
- }
- /* (non-Javadoc)
- * @see org.eclipse.jface.text.IDocument#addPosition(java.lang.String, org.eclipse.jface.text.Position)
- */
- public synchronized void addPosition(String category, Position position) throws BadLocationException, BadPositionCategoryException {
- super.addPosition(category, position);
- }
- /* (non-Javadoc)
- * @see org.eclipse.jface.text.IDocument#removePosition(java.lang.String, org.eclipse.jface.text.Position)
- */
- public synchronized void removePosition(String category, Position position) throws BadPositionCategoryException {
- super.removePosition(category, position);
- }
- /* (non-Javadoc)
- * @see org.eclipse.jface.text.IDocument#getPositions(java.lang.String)
- */
- public synchronized Position[] getPositions(String category) throws BadPositionCategoryException {
- return super.getPositions(category);
- }
-}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleDocumentAdapter.java b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleDocumentAdapter.java
deleted file mode 100644
index 2b00475d4..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleDocumentAdapter.java
+++ /dev/null
@@ -1,394 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.internal.console;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.eclipse.swt.custom.TextChangeListener;
-import org.eclipse.swt.custom.TextChangedEvent;
-import org.eclipse.swt.custom.TextChangingEvent;
-
-import org.eclipse.core.runtime.Assert;
-
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.DocumentEvent;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IDocumentAdapter;
-import org.eclipse.jface.text.IDocumentListener;
-
-/**
- * Adapts a Console's document to the viewer StyledText widget. Allows proper line
- * wrapping of fixed width consoles without having to add line delimiters to the StyledText.
- *
- * By using this adapter, the offset of any character is the same in both the widget and the
- * document.
- *
- * @since 3.1
- */
-public class ConsoleDocumentAdapter implements IDocumentAdapter, IDocumentListener {
-
- private int consoleWidth = -1;
- private List textChangeListeners;
- private IDocument document;
-
- int[] offsets = new int[5000];
- int[] lengths = new int[5000];
- private int regionCount = 1;
- private Pattern pattern = Pattern.compile("$", Pattern.MULTILINE); //$NON-NLS-1$
-
-
- public ConsoleDocumentAdapter(int width) {
- textChangeListeners = new ArrayList();
- consoleWidth = width;
- }
-
- /*
- * repairs lines list from the beginning of the line containing the offset of any
- * DocumentEvent, to the end of the Document.
- */
- private void repairLines(int eventOffset) {
- if (document == null) {
- return;
- }
- try {
- int docLine = document.getLineOfOffset(eventOffset);
- int docLineOffset = document.getLineOffset(docLine);
- int widgetLine = getLineAtOffset(docLineOffset);
-
- for (int i=regionCount-1; i>=widgetLine; i--) {
- regionCount--;
- }
-
- int numLinesInDoc = document.getNumberOfLines();
-
- int nextOffset = document.getLineOffset(docLine);
- for (int i = docLine; i<numLinesInDoc; i++) {
- int offset = nextOffset;
- int length = document.getLineLength(i);
- nextOffset += length;
-
- if (length == 0) {
- addRegion(offset, 0);
- } else {
- while (length > 0) {
- int trimmedLength = length;
- String lineDelimiter = document.getLineDelimiter(i);
- int lineDelimiterLength = 0;
- if (lineDelimiter != null) {
- lineDelimiterLength = lineDelimiter.length();
- trimmedLength -= lineDelimiterLength;
- }
-
- if (consoleWidth > 0 && consoleWidth < trimmedLength) {
- addRegion(offset, consoleWidth);
- offset += consoleWidth;
- length -= consoleWidth;
- } else {
- addRegion(offset, length);
- offset += length;
- length -= length;
- }
- }
- }
- }
- } catch (BadLocationException e) {
- }
-
- if (regionCount == 0) {
- addRegion(0, document.getLength());
- }
- }
-
- private void addRegion(int offset, int length) {
- if (regionCount == 0) {
- offsets[0] = offset;
- lengths[0] = length;
- } else {
- if (regionCount == offsets.length) {
- growRegionArray(regionCount * 2);
- }
- offsets[regionCount] = offset;
- lengths[regionCount] = length;
- }
- regionCount++;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.text.IDocumentAdapter#setDocument(org.eclipse.jface.text.IDocument)
- */
- public void setDocument(IDocument doc) {
- if (document != null) {
- document.removeDocumentListener(this);
- }
-
- document = doc;
-
- if (document != null) {
- document.addDocumentListener(this);
- repairLines(0);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.swt.custom.StyledTextContent#addTextChangeListener(org.eclipse.swt.custom.TextChangeListener)
- */
- public synchronized void addTextChangeListener(TextChangeListener listener) {
- Assert.isNotNull(listener);
- if (!textChangeListeners.contains(listener)) {
- textChangeListeners.add(listener);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.swt.custom.StyledTextContent#removeTextChangeListener(org.eclipse.swt.custom.TextChangeListener)
- */
- public synchronized void removeTextChangeListener(TextChangeListener listener) {
- if(textChangeListeners != null) {
- Assert.isNotNull(listener);
- textChangeListeners.remove(listener);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.swt.custom.StyledTextContent#getCharCount()
- */
- public int getCharCount() {
- return document.getLength();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.swt.custom.StyledTextContent#getLine(int)
- */
- public String getLine(int lineIndex) {
- try {
- StringBuffer line = new StringBuffer(document.get(offsets[lineIndex], lengths[lineIndex]));
- int index = line.length() - 1;
- while(index > -1 && (line.charAt(index)=='\n' || line.charAt(index)=='\r')) {
- index--;
- }
- return new String(line.substring(0, index+1));
- } catch (BadLocationException e) {
- }
- return ""; //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.swt.custom.StyledTextContent#getLineAtOffset(int)
- */
- public int getLineAtOffset(int offset) {
- if (offset == 0 || regionCount <= 1) {
- return 0;
- }
-
- if (offset == document.getLength()) {
- return regionCount-1;
- }
-
- int left= 0;
- int right= regionCount-1;
- int midIndex = 0;
-
- while (left <= right) {
- if(left == right) {
- return right;
- }
- midIndex = (left + right) / 2;
-
- if (offset < offsets[midIndex]) {
- right = midIndex;
- } else if (offset >= offsets[midIndex] + lengths[midIndex]) {
- left = midIndex + 1;
- } else {
- return midIndex;
- }
- }
-
- return midIndex;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.swt.custom.StyledTextContent#getLineCount()
- */
- public int getLineCount() {
- return regionCount;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.swt.custom.StyledTextContent#getLineDelimiter()
- */
- public String getLineDelimiter() {
- return System.getProperty("line.separator"); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.swt.custom.StyledTextContent#getOffsetAtLine(int)
- */
- public int getOffsetAtLine(int lineIndex) {
- return offsets[lineIndex];
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.swt.custom.StyledTextContent#getTextRange(int, int)
- */
- public String getTextRange(int start, int length) {
- try {
- return document.get(start, length);
- } catch (BadLocationException e) {
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.swt.custom.StyledTextContent#replaceTextRange(int, int, java.lang.String)
- */
- public void replaceTextRange(int start, int replaceLength, String text) {
- try {
- document.replace(start, replaceLength, text);
- } catch (BadLocationException e) {
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.swt.custom.StyledTextContent#setText(java.lang.String)
- */
- public synchronized void setText(String text) {
- TextChangedEvent changeEvent = new TextChangedEvent(this);
- for (Iterator iter = textChangeListeners.iterator(); iter.hasNext();) {
- TextChangeListener element = (TextChangeListener) iter.next();
- element.textSet(changeEvent);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.text.IDocumentListener#documentAboutToBeChanged(org.eclipse.jface.text.DocumentEvent)
- */
- public synchronized void documentAboutToBeChanged(DocumentEvent event) {
- if (document == null) {
- return;
- }
-
- TextChangingEvent changeEvent = new TextChangingEvent(this);
- changeEvent.start = event.fOffset;
- changeEvent.newText = (event.fText == null ? "" : event.fText); //$NON-NLS-1$
- changeEvent.replaceCharCount = event.fLength;
- changeEvent.newCharCount = (event.fText == null ? 0 : event.fText.length());
-
- int first = getLineAtOffset(event.fOffset);
- int lOffset = Math.max(event.fOffset + event.fLength - 1, 0);
- int last = getLineAtOffset(lOffset);
- changeEvent.replaceLineCount = Math.max(last - first, 0);
-
- int newLineCount = countNewLines(event.fText);
- changeEvent.newLineCount = newLineCount >= 0 ? newLineCount : 0;
-
- if (changeEvent.newLineCount > offsets.length-regionCount) {
- growRegionArray(changeEvent.newLineCount);
- }
-
- for (Iterator iter = textChangeListeners.iterator(); iter.hasNext();) {
- TextChangeListener element = (TextChangeListener) iter.next();
- element.textChanging(changeEvent);
- }
- }
-
- private void growRegionArray(int minSize) {
- int size = Math.max(offsets.length*2, minSize*2);
- int[] newOffsets = new int[size];
- System.arraycopy(offsets, 0, newOffsets, 0, regionCount);
- offsets = newOffsets;
- int[] newLengths = new int[size];
- System.arraycopy(lengths, 0, newLengths, 0, regionCount);
- lengths = newLengths;
- }
-
- private int countNewLines(String string) {
- int count = 0;
-
- if (string.length() == 0) return 0;
-
- // work around to
- // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4994840
- // see bug 84641
- int offset = string.length() - 1;
- while (offset > -1 && string.charAt(offset) == '\r') {
- offset--;
- count++;
- }
- // if offset == -1, the line was all '\r' and there is no string to search for matches (bug 207743)
- if (offset > -1) {
- if (offset < (string.length() - 1)) {
- string = string.substring(0, offset);
- }
-
- int lastIndex = 0;
- int index = 0;
-
- Matcher matcher = pattern.matcher(string);
-
- while (matcher.find()) {
- index = matcher.start();
-
- if (index == 0)
- count++;
- else if (index!=string.length())
- count++;
-
- if (consoleWidth > 0) {
- int lineLen = index - lastIndex + 1;
- if (index == 0) lineLen += lengths[regionCount-1];
- count += lineLen/consoleWidth;
- }
-
- lastIndex = index;
- }
- }
- return count;
- }
-
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.text.IDocumentListener#documentChanged(org.eclipse.jface.text.DocumentEvent)
- */
- public synchronized void documentChanged(DocumentEvent event) {
- if (document == null) {
- return;
- }
-
- repairLines(event.fOffset);
-
- TextChangedEvent changeEvent = new TextChangedEvent(this);
-
- for (Iterator iter = textChangeListeners.iterator(); iter.hasNext();) {
- TextChangeListener element = (TextChangeListener) iter.next();
- element.textChanged(changeEvent);
- }
- }
-
- /**
- * sets consoleWidth, repairs line information, then fires event to the viewer text widget.
- * @param width The console's width
- */
- public void setWidth(int width) {
- if (width != consoleWidth) {
- consoleWidth = width;
- repairLines(0);
- TextChangedEvent changeEvent = new TextChangedEvent(this);
- for (Iterator iter = textChangeListeners.iterator(); iter.hasNext();) {
- TextChangeListener element = (TextChangeListener) iter.next();
- element.textSet(changeEvent);
- }
- }
- }
-}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleDropDownAction.java b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleDropDownAction.java
deleted file mode 100644
index ab3b388ee..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleDropDownAction.java
+++ /dev/null
@@ -1,169 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.internal.console;
-
-
-import java.util.List;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.ActionContributionItem;
-import org.eclipse.jface.action.IMenuCreator;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.console.ConsolePlugin;
-import org.eclipse.ui.console.IConsole;
-import org.eclipse.ui.console.IConsoleConstants;
-import org.eclipse.ui.console.IConsoleListener;
-import org.eclipse.ui.console.IConsoleView;
-import org.eclipse.ui.progress.UIJob;
-import org.eclipse.ui.texteditor.IUpdate;
-
-/**
- * Drop down action in the console to select the console to display.
- */
-class ConsoleDropDownAction extends Action implements IMenuCreator, IConsoleListener, IUpdate {
-
- private IConsoleView fView;
- private Menu fMenu;
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.texteditor.IUpdate#update()
- */
- public void update() {
- IConsole[] consoles = ConsolePlugin.getDefault().getConsoleManager().getConsoles();
- setEnabled(consoles.length > 1);
- }
-
- public ConsoleDropDownAction(IConsoleView view) {
- fView= view;
- setText(ConsoleMessages.ConsoleDropDownAction_0);
- setToolTipText(ConsoleMessages.ConsoleDropDownAction_1);
- setImageDescriptor(ConsolePluginImages.getImageDescriptor(IConsoleConstants.IMG_VIEW_CONSOLE));
- PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IConsoleHelpContextIds.CONSOLE_DISPLAY_CONSOLE_ACTION);
- setMenuCreator(this);
- ConsolePlugin.getDefault().getConsoleManager().addConsoleListener(this);
- update();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.IMenuCreator#dispose()
- */
- public void dispose() {
- if (fMenu != null) {
- fMenu.dispose();
- }
-
- fView= null;
- ConsolePlugin.getDefault().getConsoleManager().removeConsoleListener(this);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.IMenuCreator#getMenu(org.eclipse.swt.widgets.Menu)
- */
- public Menu getMenu(Menu parent) {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.IMenuCreator#getMenu(org.eclipse.swt.widgets.Control)
- */
- public Menu getMenu(Control parent) {
- if (fMenu != null) {
- fMenu.dispose();
- }
-
- fMenu= new Menu(parent);
- IConsole[] consoles= ConsolePlugin.getDefault().getConsoleManager().getConsoles();
- IConsole current = fView.getConsole();
- for (int i = 0; i < consoles.length; i++) {
- IConsole console = consoles[i];
- Action action = new ShowConsoleAction(fView, console);
- action.setChecked(console.equals(current));
- addActionToMenu(fMenu, action, i + 1);
- }
- return fMenu;
- }
-
- private void addActionToMenu(Menu parent, Action action, int accelerator) {
- if (accelerator < 10) {
- StringBuffer label= new StringBuffer();
- //add the numerical accelerator
- label.append('&');
- label.append(accelerator);
- label.append(' ');
- label.append(action.getText());
- action.setText(label.toString());
- }
- ActionContributionItem item= new ActionContributionItem(action);
- item.fill(parent, -1);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.IAction#run()
- */
- public void run() {
- ConsoleView consoleView = (ConsoleView) fView;
- boolean pinned = consoleView.isPinned();
- if (pinned) {
- consoleView.setPinned(false);
- }
- List stack = consoleView.getConsoleStack();
- if (stack.size() > 1) {
- IConsole console = (IConsole) stack.get(1);
- fView.display(console);
- }
- if (pinned) {
- consoleView.setPinned(true);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.IConsoleListener#consolesAdded(org.eclipse.ui.console.IConsole[])
- */
- public void consolesAdded(IConsole[] consoles) {
- UIJob job = new UIJob("") { //$NON-NLS-1$
- public IStatus runInUIThread(IProgressMonitor monitor) {
- update();
- return Status.OK_STATUS;
- }
- };
- job.setSystem(true);
- job.setPriority(Job.INTERACTIVE);
- job.schedule();
- }
-
- /* (non-Javadoc)
- *
- * Dispose the menu when a launch is removed, such that the actions in this
- * menu do not hang on to associated resources.
- *
- * @see org.eclipse.ui.console.IConsoleListener#consolesRemoved(org.eclipse.ui.console.IConsole[])
- */
- public void consolesRemoved(IConsole[] consoles) {
- UIJob job = new UIJob("") { //$NON-NLS-1$
- public IStatus runInUIThread(IProgressMonitor monitor) {
- if (fMenu != null) {
- fMenu.dispose();
- }
- update();
- return Status.OK_STATUS;
- }
- };
- job.setSystem(true);
- job.setPriority(Job.INTERACTIVE);
- job.schedule();
- }
-}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleFactoryExtension.java b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleFactoryExtension.java
deleted file mode 100644
index 377d3d56d..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleFactoryExtension.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.internal.console;
-
-import java.net.URL;
-
-import org.eclipse.core.expressions.EvaluationContext;
-import org.eclipse.core.expressions.EvaluationResult;
-import org.eclipse.core.expressions.Expression;
-import org.eclipse.core.expressions.ExpressionConverter;
-import org.eclipse.core.expressions.ExpressionTagNames;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.FileLocator;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.ui.IPluginContribution;
-import org.eclipse.ui.console.ConsolePlugin;
-import org.eclipse.ui.console.IConsoleFactory;
-import org.osgi.framework.Bundle;
-
-/**
- * @since 3.1
- */
-public class ConsoleFactoryExtension implements IPluginContribution {
-
- private IConfigurationElement fConfig;
- private Expression fEnablementExpression;
- private String fLabel;
- private ImageDescriptor fImageDescriptor;
- private IConsoleFactory fFactory;
-
- ConsoleFactoryExtension(IConfigurationElement config) {
- fConfig = config;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IPluginContribution#getLocalId()
- */
- public String getLocalId() {
- return fConfig.getAttribute("id"); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IPluginContribution#getPluginId()
- */
- public String getPluginId() {
- return fConfig.getContributor().getName();
- }
-
- public boolean isEnabled() {
- try {
- Expression enablementExpression = getEnablementExpression();
- if (enablementExpression == null) {
- return true;
- }
- EvaluationContext context = new EvaluationContext(null, this);
- EvaluationResult evaluationResult = enablementExpression.evaluate(context);
- return evaluationResult != EvaluationResult.FALSE;
- } catch (CoreException e) {
- ConsolePlugin.log(e);
- return false;
- }
- }
-
- public Expression getEnablementExpression() throws CoreException {
- if (fEnablementExpression == null) {
- IConfigurationElement[] elements = fConfig.getChildren(ExpressionTagNames.ENABLEMENT);
- IConfigurationElement enablement = elements.length > 0 ? elements[0] : null;
-
- if (enablement != null) {
- fEnablementExpression = ExpressionConverter.getDefault().perform(enablement);
- }
- }
- return fEnablementExpression;
- }
-
- public String getLabel() {
- if (fLabel == null) {
- fLabel = fConfig.getAttribute("label"); //$NON-NLS-1$
- }
- return fLabel;
- }
-
- /**
- * @return
- */
- public ImageDescriptor getImageDescriptor() {
- if (fImageDescriptor == null) {
- String path = fConfig.getAttribute("icon"); //$NON-NLS-1$
- if (path != null) {
- Bundle bundle = Platform.getBundle(getPluginId());
- URL url = FileLocator.find(bundle, new Path(path), null);
- if (url != null) {
- fImageDescriptor = ImageDescriptor.createFromURL(url);
- }
- }
- }
- return fImageDescriptor;
- }
-
- /**
- * @return
- * @throws CoreException
- */
- public IConsoleFactory createFactory() throws CoreException {
- if (fFactory == null) {
- fFactory = (IConsoleFactory) fConfig.createExecutableExtension("class"); //$NON-NLS-1$
- }
- return fFactory;
- }
-}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleHyperlinkPosition.java b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleHyperlinkPosition.java
deleted file mode 100644
index b98df7300..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleHyperlinkPosition.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.internal.console;
-
-import org.eclipse.jface.text.Position;
-import org.eclipse.ui.console.ConsolePlugin;
-import org.eclipse.ui.console.IHyperlink;
-
-/**
- * Describes the postition of a hyperlink within the Console's document.
- *
- * @since 3.1
- */
-public class ConsoleHyperlinkPosition extends Position {
-
- public static final String HYPER_LINK_CATEGORY = ConsolePlugin.getUniqueIdentifier() + ".CONSOLE_HYPERLINK_POSITION"; //$NON-NLS-1$
-
- private IHyperlink fLink = null;
-
- public ConsoleHyperlinkPosition(IHyperlink link, int offset, int length) {
- super(offset, length);
- fLink = link;
- }
-
- public IHyperlink getHyperLink() {
- return fLink;
- }
-
- /**
- * @see java.lang.Object#equals(java.lang.Object)
- */
- public boolean equals(Object arg) {
- return arg instanceof ConsoleHyperlinkPosition && super.equals(arg) && getHyperLink().equals(((ConsoleHyperlinkPosition)arg).getHyperLink());
- }
-
- /**
- * @see java.lang.Object#hashCode()
- */
- public int hashCode() {
- return super.hashCode() + getHyperLink().hashCode();
- }
-
-}
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
deleted file mode 100644
index aea898a2f..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleManager.java
+++ /dev/null
@@ -1,471 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.internal.console;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-import java.util.regex.PatternSyntaxException;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.ISafeRunnable;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.ListenerList;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.SafeRunner;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.IViewPart;
-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.IConsole;
-import org.eclipse.ui.console.IConsoleConstants;
-import org.eclipse.ui.console.IConsoleListener;
-import org.eclipse.ui.console.IConsoleManager;
-import org.eclipse.ui.console.IConsolePageParticipant;
-import org.eclipse.ui.console.IConsoleView;
-import org.eclipse.ui.console.IPatternMatchListener;
-import org.eclipse.ui.console.TextConsole;
-import org.eclipse.ui.progress.UIJob;
-import org.eclipse.ui.progress.WorkbenchJob;
-
-/**
- * The singleton console manager.
- *
- * @since 3.0
- */
-public class ConsoleManager implements IConsoleManager {
-
- /**
- * Console listeners
- */
- private ListenerList fListeners = null;
-
- /**
- * List of registered consoles
- */
- private List fConsoles = new ArrayList(10);
-
-
- // change notification constants
- private final static int ADDED = 1;
- private final static int REMOVED = 2;
-
- private List fPatternMatchListeners;
-
- private List fPageParticipants;
-
- private List fConsoleFactoryExtensions;
-
- private List fConsoleViews = new ArrayList();
-
- private boolean fWarnQueued = false;
-
- private RepaintJob fRepaintJob = new RepaintJob();
-
- private class RepaintJob extends WorkbenchJob {
- private Set list = new HashSet();
-
- public RepaintJob() {
- super("schedule redraw() of viewers"); //$NON-NLS-1$
- setSystem(true);
- }
-
- void addConsole(IConsole console) {
- synchronized (list) {
- list.add(console);
- }
- }
-
- public IStatus runInUIThread(IProgressMonitor monitor) {
- synchronized (list) {
- if (list.isEmpty()) {
- return Status.OK_STATUS;
- }
-
- IWorkbenchWindow[] workbenchWindows = PlatformUI.getWorkbench().getWorkbenchWindows();
- for (int i = 0; i < workbenchWindows.length; i++) {
- IWorkbenchWindow window = workbenchWindows[i];
- if (window != null) {
- IWorkbenchPage page = window.getActivePage();
- if (page != null) {
- IViewPart part = page.findView(IConsoleConstants.ID_CONSOLE_VIEW);
- if (part != null && part instanceof IConsoleView) {
- ConsoleView view = (ConsoleView) part;
- if (list.contains(view.getConsole())) {
- Control control = view.getCurrentPage().getControl();
- if (!control.isDisposed()) {
- control.redraw();
- }
- }
- }
-
- }
- }
- }
- list.clear();
- }
- return Status.OK_STATUS;
- }
- }
-
- /**
- * Notifies a console listener of additions or removals
- */
- class ConsoleNotifier implements ISafeRunnable {
-
- private IConsoleListener fListener;
- private int fType;
- private IConsole[] fChanged;
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.ISafeRunnable#handleException(java.lang.Throwable)
- */
- public void handleException(Throwable exception) {
- IStatus status = new Status(IStatus.ERROR, ConsolePlugin.getUniqueIdentifier(), IConsoleConstants.INTERNAL_ERROR, ConsoleMessages.ConsoleManager_0, exception);
- ConsolePlugin.log(status);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.ISafeRunnable#run()
- */
- public void run() throws Exception {
- switch (fType) {
- case ADDED:
- fListener.consolesAdded(fChanged);
- break;
- case REMOVED:
- fListener.consolesRemoved(fChanged);
- break;
- }
- }
-
- /**
- * Notifies the given listener of the adds/removes
- *
- * @param consoles the consoles that changed
- * @param update the type of change
- */
- public void notify(IConsole[] consoles, int update) {
- if (fListeners == null) {
- return;
- }
- fChanged = consoles;
- fType = update;
- Object[] copiedListeners= fListeners.getListeners();
- for (int i= 0; i < copiedListeners.length; i++) {
- fListener = (IConsoleListener)copiedListeners[i];
- SafeRunner.run(this);
- }
- fChanged = null;
- fListener = null;
- }
- }
-
- public void registerConsoleView(ConsoleView view) {
- synchronized (fConsoleViews) {
- fConsoleViews.add(view);
- }
- }
- public void unregisterConsoleView(ConsoleView view) {
- synchronized (fConsoleViews) {
- fConsoleViews.remove(view);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.IConsoleManager#addConsoleListener(org.eclipse.ui.console.IConsoleListener)
- */
- public void addConsoleListener(IConsoleListener listener) {
- if (fListeners == null) {
- fListeners = new ListenerList();
- }
- fListeners.add(listener);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.IConsoleManager#removeConsoleListener(org.eclipse.ui.console.IConsoleListener)
- */
- public void removeConsoleListener(IConsoleListener listener) {
- if (fListeners != null) {
- fListeners.remove(listener);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.IConsoleManager#addConsoles(org.eclipse.ui.console.IConsole[])
- */
- public void addConsoles(IConsole[] consoles) {
- List added = new ArrayList(consoles.length);
- synchronized (fConsoles) {
- for (int i = 0; i < consoles.length; i++) {
- IConsole console = consoles[i];
- if(console instanceof TextConsole) {
- TextConsole ioconsole = (TextConsole)console;
- createPatternMatchListeners(ioconsole);
- }
- if (!fConsoles.contains(console)) {
- fConsoles.add(console);
- added.add(console);
- }
- }
- }
- if (!added.isEmpty()) {
- fireUpdate((IConsole[])added.toArray(new IConsole[added.size()]), ADDED);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.IConsoleManager#removeConsoles(org.eclipse.ui.console.IConsole[])
- */
- public void removeConsoles(IConsole[] consoles) {
- List removed = new ArrayList(consoles.length);
- synchronized (fConsoles) {
- for (int i = 0; i < consoles.length; i++) {
- IConsole console = consoles[i];
- if (fConsoles.remove(console)) {
- removed.add(console);
- }
- }
- }
- if (!removed.isEmpty()) {
- fireUpdate((IConsole[])removed.toArray(new IConsole[removed.size()]), REMOVED);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.IConsoleManager#getConsoles()
- */
- public IConsole[] getConsoles() {
- synchronized (fConsoles) {
- return (IConsole[])fConsoles.toArray(new IConsole[fConsoles.size()]);
- }
- }
-
- /**
- * Fires notification.
- *
- * @param consoles consoles added/removed
- * @param type ADD or REMOVE
- */
- private void fireUpdate(IConsole[] consoles, int type) {
- new ConsoleNotifier().notify(consoles, type);
- }
-
-
- private class ShowConsoleViewJob extends WorkbenchJob {
- private IConsole console;
-
- ShowConsoleViewJob() {
- super("Show Console View"); //$NON-NLS-1$
- setSystem(true);
- setPriority(Job.SHORT);
- }
-
- void setConsole(IConsole console) {
- this.console = console;
- }
-
- public IStatus runInUIThread(IProgressMonitor monitor) {
- boolean consoleFound = false;
- IWorkbenchWindow window= PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- if (window != null && console != null) {
- IWorkbenchPage page= window.getActivePage();
- if (page != null) {
- synchronized (fConsoleViews) {
- for (Iterator iter = fConsoleViews.iterator(); iter.hasNext();) {
- ConsoleView consoleView = (ConsoleView) iter.next();
- if (consoleView.getSite().getPage().equals(page)) {
- boolean consoleVisible = page.isPartVisible(consoleView);
- if (consoleVisible) {
- consoleFound = true;
- boolean bringToTop = shouldBringToTop(console, consoleView);
- if (bringToTop) {
- page.bringToTop(consoleView);
- }
- consoleView.display(console);
- }
- }
- }
- }
-
- if (!consoleFound) {
- try {
- IConsoleView consoleView = (IConsoleView) page.showView(IConsoleConstants.ID_CONSOLE_VIEW, null, IWorkbenchPage.VIEW_CREATE);
- boolean bringToTop = shouldBringToTop(console, consoleView);
- if (bringToTop) {
- page.bringToTop(consoleView);
- }
- consoleView.display(console);
- } catch (PartInitException pie) {
- ConsolePlugin.log(pie);
- }
- }
- }
- }
- console = null;
- return Status.OK_STATUS;
- }
- }
-
- private ShowConsoleViewJob showJob = new ShowConsoleViewJob();
- /**
- * @see IConsoleManager#showConsoleView(IConsole)
- */
- public void showConsoleView(final IConsole console) {
- showJob.setConsole(console);
- showJob.schedule(100);
- }
-
- /**
- * Returns whether the given console view should be brought to the top.
- * The view should not be brought to the top if the view is pinned on
- * a console other than the given console.
- */
- private boolean shouldBringToTop(IConsole console, IViewPart consoleView) {
- boolean bringToTop= true;
- if (consoleView instanceof IConsoleView) {
- IConsoleView cView= (IConsoleView)consoleView;
- if (cView.isPinned()) {
- IConsole pinnedConsole= cView.getConsole();
- bringToTop = console.equals(pinnedConsole);
- }
- }
- return bringToTop;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.IConsoleManager#warnOfContentChange(org.eclipse.ui.console.IConsole)
- */
- public void warnOfContentChange(final IConsole console) {
- if (!fWarnQueued) {
- fWarnQueued = true;
- Job job = new UIJob(ConsolePlugin.getStandardDisplay(), ConsoleMessages.ConsoleManager_consoleContentChangeJob) {
- public IStatus runInUIThread(IProgressMonitor monitor) {
- IWorkbenchWindow window= PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- if (window != null) {
- IWorkbenchPage page= window.getActivePage();
- if (page != null) {
- IConsoleView consoleView= (IConsoleView)page.findView(IConsoleConstants.ID_CONSOLE_VIEW);
- if (consoleView != null) {
- consoleView.warnOfContentChange(console);
- }
- }
- }
- fWarnQueued = false;
- return Status.OK_STATUS;
- }
- };
- job.setSystem(true);
- job.schedule();
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.IConsoleManager#getPatternMatchListenerDelegates(org.eclipse.ui.console.IConsole)
- */
- public IPatternMatchListener[] createPatternMatchListeners(IConsole console) {
- if (fPatternMatchListeners == null) {
- fPatternMatchListeners = new ArrayList();
- IExtensionPoint extensionPoint= Platform.getExtensionRegistry().getExtensionPoint(ConsolePlugin.getUniqueIdentifier(), IConsoleConstants.EXTENSION_POINT_CONSOLE_PATTERN_MATCH_LISTENERS);
- IConfigurationElement[] elements = extensionPoint.getConfigurationElements();
- for (int i = 0; i < elements.length; i++) {
- IConfigurationElement config = elements[i];
- PatternMatchListenerExtension extension = new PatternMatchListenerExtension(config);
- fPatternMatchListeners.add(extension);
- }
- }
- ArrayList list = new ArrayList();
- for(Iterator i = fPatternMatchListeners.iterator(); i.hasNext(); ) {
- PatternMatchListenerExtension extension = (PatternMatchListenerExtension) i.next();
- try {
- if (extension.getEnablementExpression() == null) {
- i.remove();
- continue;
- }
-
- if (console instanceof TextConsole && extension.isEnabledFor(console)) {
- TextConsole textConsole = (TextConsole) console;
- PatternMatchListener patternMatchListener = new PatternMatchListener(extension);
- try {
- textConsole.addPatternMatchListener(patternMatchListener);
- list.add(patternMatchListener);
- } catch (PatternSyntaxException e) {
- ConsolePlugin.log(e);
- i.remove();
- }
- }
- } catch (CoreException e) {
- ConsolePlugin.log(e);
- }
- }
- return (PatternMatchListener[])list.toArray(new PatternMatchListener[0]);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.IConsoleManager#getPageParticipants(org.eclipse.ui.console.IConsole)
- */
- public IConsolePageParticipant[] getPageParticipants(IConsole console) {
- if(fPageParticipants == null) {
- fPageParticipants = new ArrayList();
- IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(ConsolePlugin.getUniqueIdentifier(), IConsoleConstants.EXTENSION_POINT_CONSOLE_PAGE_PARTICIPANTS);
- IConfigurationElement[] elements = extensionPoint.getConfigurationElements();
- for(int i = 0; i < elements.length; i++) {
- IConfigurationElement config = elements[i];
- ConsolePageParticipantExtension extension = new ConsolePageParticipantExtension(config);
- fPageParticipants.add(extension);
- }
- }
- ArrayList list = new ArrayList();
- for(Iterator i = fPageParticipants.iterator(); i.hasNext(); ) {
- ConsolePageParticipantExtension extension = (ConsolePageParticipantExtension) i.next();
- try {
- if (extension.isEnabledFor(console)) {
- list.add(extension.createDelegate());
- }
- } catch (CoreException e) {
- ConsolePlugin.log(e);
- }
- }
- return (IConsolePageParticipant[]) list.toArray(new IConsolePageParticipant[0]);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.IConsoleManager#getConsoleFactories()
- */
- public ConsoleFactoryExtension[] getConsoleFactoryExtensions() {
- if (fConsoleFactoryExtensions == null) {
- fConsoleFactoryExtensions = new ArrayList();
- IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(ConsolePlugin.getUniqueIdentifier(), IConsoleConstants.EXTENSION_POINT_CONSOLE_FACTORIES);
- IConfigurationElement[] configurationElements = extensionPoint.getConfigurationElements();
- for (int i = 0; i < configurationElements.length; i++) {
- fConsoleFactoryExtensions.add(new ConsoleFactoryExtension(configurationElements[i]));
- }
- }
- return (ConsoleFactoryExtension[]) fConsoleFactoryExtensions.toArray(new ConsoleFactoryExtension[0]);
- }
-
-
- public void refresh(final IConsole console) {
- fRepaintJob.addConsole(console);
- fRepaintJob.schedule(50);
- }
-
-}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleMessages.java b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleMessages.java
deleted file mode 100644
index e6212af78..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleMessages.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.internal.console;
-
-import org.eclipse.osgi.util.NLS;
-
-public class ConsoleMessages extends NLS {
- private static final String BUNDLE_NAME = "org.eclipse.ui.internal.console.ConsoleMessages";//$NON-NLS-1$
-
- public static String AbstractConsole_0;
-
- public static String ConsoleDropDownAction_0;
- public static String ConsoleDropDownAction_1;
-
- public static String ConsoleManager_0;
-
- public static String ConsoleManager_consoleContentChangeJob;
-
- public static String ConsoleView_0;
-
- public static String PinConsoleAction_0;
- public static String PinConsoleAction_1;
-
- public static String ClearOutputAction_title;
- public static String ClearOutputAction_toolTipText;
-
- public static String TextViewerGotoLineAction_Enter_line_number__8;
- public static String TextViewerGotoLineAction_Exceptions_occurred_attempt_to_go_to_line_2;
- public static String TextViewerGotoLineAction_Go_to__Line____Ctrl_L_4;
- public static String TextViewerGotoLineAction_Go_To_Line_1;
- public static String TextViewerGotoLineAction_Line_number_out_of_range_1;
- public static String TextViewerGotoLineAction_Not_a_number_2;
-
- public static String ScrollLockAction_0;
- public static String ScrollLockAction_1;
- public static String FollowHyperlinkAction_0;
- public static String FollowHyperlinkAction_1;
- public static String OpenConsoleAction_0;
- public static String OpenConsoleAction_1;
- public static String CloseConsoleAction_0;
- public static String CloseConsoleAction_1;
-
- public static String TextConsolePage_SelectAllDescrip;
- public static String TextConsolePage_SelectAllText;
- public static String TextConsolePage_CutText;
- public static String TextConsolePage_CutDescrip;
- public static String TextConsolePage_CopyText;
- public static String TextConsolePage_CopyDescrip;
- public static String TextConsolePage_PasteText;
- public static String TextConsolePage_PasteDescrip;
-
- static {
- // load message values from bundle file
- NLS.initializeMessages(BUNDLE_NAME, ConsoleMessages.class);
- }
-
- public static String PatternMatchListenerExtension_3;
-
- public static String PatternMatchListenerExtension_4;
-
- public static String PatternMatchListenerExtension_5;
-}
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
deleted file mode 100644
index d873a37bd..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleMessages.properties
+++ /dev/null
@@ -1,54 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2010 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-
-AbstractConsole_0=Exception occurred during console property change notification.
-
-ConsoleDropDownAction_0=Select Console
-ConsoleDropDownAction_1=Display Selected Console
-
-ConsoleManager_0=An exception occurred during console notification
-ConsoleManager_consoleContentChangeJob=Console content change
-
-ConsoleView_0=No consoles to display at this time.
-
-PinConsoleAction_0=Pi&n Console
-PinConsoleAction_1=Pin Console
-
-ClearOutputAction_title=Clea&r
-ClearOutputAction_toolTipText=Clear Console
-
-TextViewerGotoLineAction_Enter_line_number__8=Enter line number (1...{0}):
-TextViewerGotoLineAction_Exceptions_occurred_attempt_to_go_to_line_2=Exceptions occurred attempt to go to line
-TextViewerGotoLineAction_Go_to__Line____Ctrl_L_4=Go to &Line...@Ctrl+L
-TextViewerGotoLineAction_Go_To_Line_1=Go to Line
-TextViewerGotoLineAction_Line_number_out_of_range_1=Line number out of range
-TextViewerGotoLineAction_Not_a_number_2=Not a number
-
-ScrollLockAction_0=&Scroll Lock
-ScrollLockAction_1=Scroll Lock
-FollowHyperlinkAction_0=&Open Link
-FollowHyperlinkAction_1=Follow the selected hyperlink
-OpenConsoleAction_0=Open Console
-OpenConsoleAction_1=Open Console
-CloseConsoleAction_0=&Close Console
-CloseConsoleAction_1=Close Console
-
-TextConsolePage_SelectAllDescrip=Select All
-TextConsolePage_SelectAllText=Select &All
-TextConsolePage_CutText=C&ut
-TextConsolePage_CutDescrip=Cut
-TextConsolePage_CopyText=&Copy
-TextConsolePage_CopyDescrip=Copy
-TextConsolePage_PasteText=&Paste
-TextConsolePage_PasteDescrip=Paste
-PatternMatchListenerExtension_3=Console Pattern Match Listener
-PatternMatchListenerExtension_4=contributed by
-PatternMatchListenerExtension_5=is missing required enablement expression and will be removed
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsolePageParticipantExtension.java b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsolePageParticipantExtension.java
deleted file mode 100644
index 37a522f51..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsolePageParticipantExtension.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.internal.console;
-
-import org.eclipse.core.expressions.EvaluationContext;
-import org.eclipse.core.expressions.EvaluationResult;
-import org.eclipse.core.expressions.Expression;
-import org.eclipse.core.expressions.ExpressionConverter;
-import org.eclipse.core.expressions.ExpressionTagNames;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.ui.IPluginContribution;
-import org.eclipse.ui.console.IConsole;
-import org.eclipse.ui.console.IConsolePageParticipant;
-
-public class ConsolePageParticipantExtension implements IPluginContribution {
-
- private IConfigurationElement fConfig;
- private Expression fEnablementExpression;
-
- public ConsolePageParticipantExtension(IConfigurationElement config) {
- fConfig = config;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IPluginContribution#getLocalId()
- */
- public String getLocalId() {
- return fConfig.getAttribute("id"); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IPluginContribution#getPluginId()
- */
- public String getPluginId() {
- return fConfig.getContributor().getName();
- }
-
- public boolean isEnabledFor(IConsole console) throws CoreException {
- EvaluationContext context = new EvaluationContext(null, console);
- Expression expression = getEnablementExpression();
- if (expression != null){
- EvaluationResult evaluationResult = expression.evaluate(context);
- return evaluationResult == EvaluationResult.TRUE;
- }
- return true;
- }
-
- public Expression getEnablementExpression() throws CoreException {
- if (fEnablementExpression == null) {
- IConfigurationElement[] elements = fConfig.getChildren(ExpressionTagNames.ENABLEMENT);
- IConfigurationElement enablement = elements.length > 0 ? elements[0] : null;
-
- if (enablement != null) {
- fEnablementExpression = ExpressionConverter.getDefault().perform(enablement);
- }
- }
- return fEnablementExpression;
- }
-
- public IConsolePageParticipant createDelegate() throws CoreException {
- return (IConsolePageParticipant) fConfig.createExecutableExtension("class"); //$NON-NLS-1$;
- }
-
-}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsolePatternMatcher.java b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsolePatternMatcher.java
deleted file mode 100644
index e1d9abe3d..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsolePatternMatcher.java
+++ /dev/null
@@ -1,310 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.internal.console;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.DocumentEvent;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IDocumentListener;
-import org.eclipse.ui.console.ConsolePlugin;
-import org.eclipse.ui.console.IPatternMatchListener;
-import org.eclipse.ui.console.PatternMatchEvent;
-import org.eclipse.ui.console.TextConsole;
-
-public class ConsolePatternMatcher implements IDocumentListener {
-
- private MatchJob fMatchJob = new MatchJob();
-
- /**
- * Collection of compiled pattern match listeners
- */
- private ArrayList fPatterns = new ArrayList();
-
- private TextConsole fConsole;
-
- private boolean fFinalMatch;
-
- private boolean fScheduleFinal;
-
- public ConsolePatternMatcher(TextConsole console) {
- fConsole = console;
- }
-
- private class MatchJob extends Job {
- MatchJob() {
- super("Match Job"); //$NON-NLS-1$
- setSystem(true);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor)
- */
- protected IStatus run(IProgressMonitor monitor) {
- IDocument doc = fConsole.getDocument();
- String text = null;
- int prevBaseOffset = -1;
- if (doc != null && !monitor.isCanceled()) {
- int endOfSearch = doc.getLength();
- int indexOfLastChar = endOfSearch;
- if (indexOfLastChar > 0) {
- indexOfLastChar--;
- }
- int lastLineToSearch = 0;
- int offsetOfLastLineToSearch = 0;
- try {
- lastLineToSearch = doc.getLineOfOffset(indexOfLastChar);
- offsetOfLastLineToSearch = doc.getLineOffset(lastLineToSearch);
- } catch (BadLocationException e) {
- // perhaps the buffer was re-set
- return Status.OK_STATUS;
- }
- Object[] patterns = null;
- synchronized (fPatterns) {
- patterns = fPatterns.toArray();
- }
- for (int i = 0; i < patterns.length; i++) {
- if (monitor.isCanceled()) {
- break;
- }
- CompiledPatternMatchListener notifier = (CompiledPatternMatchListener) patterns[i];
- int baseOffset = notifier.end;
- int lengthToSearch = endOfSearch - baseOffset;
- if (lengthToSearch > 0) {
- try {
- if (prevBaseOffset != baseOffset) {
- // reuse the text string if possible
- text = doc.get(baseOffset, lengthToSearch);
- }
- Matcher reg = notifier.pattern.matcher(text);
- Matcher quick = null;
- if (notifier.qualifier != null) {
- quick = notifier.qualifier.matcher(text);
- }
- int startOfNextSearch = 0;
- int endOfLastMatch = -1;
- int lineOfLastMatch = -1;
- while ((startOfNextSearch < lengthToSearch) && !monitor.isCanceled()) {
- if (quick != null) {
- if (quick.find(startOfNextSearch)) {
- // start searching on the beginning
- // of the line where the potential
- // match was found, or after the
- // last match on the same line
- int matchLine = doc.getLineOfOffset(baseOffset + quick.start());
- if (lineOfLastMatch == matchLine) {
- startOfNextSearch = endOfLastMatch;
- } else {
- startOfNextSearch = doc.getLineOffset(matchLine) - baseOffset;
- }
- } else {
- startOfNextSearch = lengthToSearch;
- }
- }
- if (startOfNextSearch < 0) {
- startOfNextSearch = 0;
- }
- if (startOfNextSearch < lengthToSearch) {
- if (reg.find(startOfNextSearch)) {
- endOfLastMatch = reg.end();
- lineOfLastMatch = doc.getLineOfOffset(baseOffset + endOfLastMatch - 1);
- int regStart = reg.start();
- IPatternMatchListener listener = notifier.listener;
- if (listener != null && !monitor.isCanceled()) {
- listener.matchFound(new PatternMatchEvent(fConsole, baseOffset + regStart, endOfLastMatch - regStart));
- }
- startOfNextSearch = endOfLastMatch;
- } else {
- startOfNextSearch = lengthToSearch;
- }
- }
- }
- // update start of next search to the last line
- // searched
- // or the end of the last match if it was on the
- // line that
- // was last searched
- if (lastLineToSearch == lineOfLastMatch) {
- notifier.end = baseOffset + endOfLastMatch;
- } else {
- notifier.end = offsetOfLastLineToSearch;
- }
- } catch (BadLocationException e) {
- ConsolePlugin.log(e);
- }
- }
- prevBaseOffset = baseOffset;
- }
- }
-
- if (fFinalMatch) {
- disconnect();
- fConsole.matcherFinished();
- } else if (fScheduleFinal) {
- fFinalMatch = true;
- schedule();
- }
-
- return Status.OK_STATUS;
- }
-
- public boolean belongsTo(Object family) {
- return family == fConsole;
- }
-
-
- }
-
- private class CompiledPatternMatchListener {
- Pattern pattern;
-
- Pattern qualifier;
-
- IPatternMatchListener listener;
-
- int end = 0;
-
- CompiledPatternMatchListener(Pattern pattern, Pattern qualifier, IPatternMatchListener matchListener) {
- this.pattern = pattern;
- this.listener = matchListener;
- this.qualifier = qualifier;
- }
-
- public void dispose() {
- listener.disconnect();
- pattern = null;
- qualifier = null;
- listener = null;
- }
- }
-
- /**
- * Adds the given pattern match listener to this console. The listener will
- * be connected and receive match notifications.
- *
- * @param matchListener
- * the pattern match listener to add
- */
- public void addPatternMatchListener(IPatternMatchListener matchListener) {
- synchronized (fPatterns) {
-
- // check for dups
- for (Iterator iter = fPatterns.iterator(); iter.hasNext();) {
- CompiledPatternMatchListener element = (CompiledPatternMatchListener) iter.next();
- if (element.listener == matchListener) {
- return;
- }
- }
-
- if (matchListener == null || matchListener.getPattern() == null) {
- throw new IllegalArgumentException("Pattern cannot be null"); //$NON-NLS-1$
- }
-
- Pattern pattern = Pattern.compile(matchListener.getPattern(), matchListener.getCompilerFlags());
- String qualifier = matchListener.getLineQualifier();
- Pattern qPattern = null;
- if (qualifier != null) {
- qPattern = Pattern.compile(qualifier, matchListener.getCompilerFlags());
- }
- CompiledPatternMatchListener notifier = new CompiledPatternMatchListener(pattern, qPattern, matchListener);
- fPatterns.add(notifier);
- matchListener.connect(fConsole);
- fMatchJob.schedule();
- }
- }
-
- /**
- * Removes the given pattern match listener from this console. The listener
- * will be disconnected and will no longer receive match notifications.
- *
- * @param matchListener
- * the pattern match listener to remove.
- */
- public void removePatternMatchListener(IPatternMatchListener matchListener) {
- synchronized (fPatterns) {
- for (Iterator iter = fPatterns.iterator(); iter.hasNext();) {
- CompiledPatternMatchListener element = (CompiledPatternMatchListener) iter.next();
- if (element.listener == matchListener) {
- iter.remove();
- matchListener.disconnect();
- }
- }
- }
- }
-
- public void disconnect() {
- fMatchJob.cancel();
- synchronized (fPatterns) {
- Iterator iterator = fPatterns.iterator();
- while (iterator.hasNext()) {
- CompiledPatternMatchListener notifier = (CompiledPatternMatchListener) iterator.next();
- notifier.dispose();
- }
- fPatterns.clear();
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.text.IDocumentListener#documentAboutToBeChanged(org.eclipse.jface.text.DocumentEvent)
- */
- public void documentAboutToBeChanged(DocumentEvent event) {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.text.IDocumentListener#documentChanged(org.eclipse.jface.text.DocumentEvent)
- */
- public void documentChanged(DocumentEvent event) {
- if (event.fLength > 0) {
- synchronized (fPatterns) {
- if (event.fDocument.getLength() == 0) {
- // document has been cleared, reset match listeners
- Iterator iter = fPatterns.iterator();
- while (iter.hasNext()) {
- CompiledPatternMatchListener notifier = (CompiledPatternMatchListener) iter.next();
- notifier.end = 0;
- }
- } else {
- if (event.fOffset == 0) {
- //document was trimmed
- Iterator iter = fPatterns.iterator();
- while (iter.hasNext()) {
- CompiledPatternMatchListener notifier = (CompiledPatternMatchListener) iter.next();
- notifier.end = notifier.end > event.fLength ? notifier.end-event.fLength : 0;
- }
- }
- }
- }
- }
- fMatchJob.schedule();
- }
-
-
- public void forceFinalMatching() {
- fScheduleFinal = true;
- fMatchJob.schedule();
- }
-
-}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsolePluginImages.java b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsolePluginImages.java
deleted file mode 100644
index c5abc8c6f..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsolePluginImages.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.internal.console;
-
-
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.resource.ImageRegistry;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.console.ConsolePlugin;
-import org.eclipse.ui.console.IConsoleConstants;
-
-/**
- * The images provided by the debug plugin.
- */
-public class ConsolePluginImages {
-
- /**
- * The image registry containing <code>Image</code>s and the <code>ImageDescriptor</code>s.
- */
- private static ImageRegistry imageRegistry;
-
- /* Declare Common paths */
- private static URL ICON_BASE_URL= null;
-
- static {
- String pathSuffix = "icons/full/"; //$NON-NLS-1$
- ICON_BASE_URL= ConsolePlugin.getDefault().getBundle().getEntry(pathSuffix);
- }
-
- // Use IPath and toOSString to build the names to ensure they have the slashes correct
- private final static String LOCALTOOL= "clcl16/"; //basic colors - size 16x16 //$NON-NLS-1$
- private final static String DLCL= "dlcl16/"; //disabled - size 16x16 //$NON-NLS-1$
- private final static String ELCL= "elcl16/"; //enabled - size 16x16 //$NON-NLS-1$
- private final static String VIEW= "cview16/"; // views //$NON-NLS-1$
-
- /**
- * Declare all images
- */
- private static void declareImages() {
- // Actions
-
- //local toolbars
- declareRegistryImage(IConsoleConstants.IMG_LCL_CLEAR, LOCALTOOL + "clear_co.gif"); //$NON-NLS-1$
- declareRegistryImage(IInternalConsoleConstants.IMG_LCL_PIN, LOCALTOOL + "pin.gif"); //$NON-NLS-1$
- declareRegistryImage(IInternalConsoleConstants.IMG_LCL_LOCK, LOCALTOOL + "lock_co.gif"); //$NON-NLS-1$
-
- // disabled local toolbars
- declareRegistryImage(IInternalConsoleConstants.IMG_DLCL_CLEAR, DLCL + "clear_co.gif"); //$NON-NLS-1$
- declareRegistryImage(IInternalConsoleConstants.IMG_DLCL_PIN, DLCL + "pin.gif"); //$NON-NLS-1$
- declareRegistryImage(IInternalConsoleConstants.IMG_DLCL_LOCK, DLCL + "lock_co.gif"); //$NON-NLS-1$
- declareRegistryImage(IInternalConsoleConstants.IMG_DLCL_CLOSE, DLCL + "rem_co.gif"); //$NON-NLS-1$
-
- // enabled local toolbars
- declareRegistryImage(IInternalConsoleConstants.IMG_ELCL_CLEAR, ELCL + "clear_co.gif"); //$NON-NLS-1$
- declareRegistryImage(IInternalConsoleConstants.IMG_ELCL_PIN, ELCL + "pin.gif"); //$NON-NLS-1$
- declareRegistryImage(IInternalConsoleConstants.IMG_ELCL_LOCK, ELCL + "lock_co.gif"); //$NON-NLS-1$
- declareRegistryImage(IInternalConsoleConstants.IMG_ELCL_CLOSE, ELCL + "rem_co.gif"); //$NON-NLS-1$
- declareRegistryImage(IInternalConsoleConstants.IMG_ELCL_NEW_CON, ELCL + "new_con.gif"); //$NON-NLS-1$
-
- // Views
- declareRegistryImage(IConsoleConstants.IMG_VIEW_CONSOLE, VIEW + "console_view.gif"); //$NON-NLS-1$
- }
-
- /**
- * Declare an Image in the registry table.
- * @param key The key to use when registering the image
- * @param path The path where the image can be found. This path is relative to where
- * this plugin class is found (i.e. typically the packages directory)
- */
- private final static void declareRegistryImage(String key, String path) {
- ImageDescriptor desc= ImageDescriptor.getMissingImageDescriptor();
- try {
- desc= ImageDescriptor.createFromURL(makeIconFileURL(path));
- } catch (MalformedURLException me) {
- ConsolePlugin.log(me);
- }
- imageRegistry.put(key, desc);
- }
-
- /**
- * Returns the ImageRegistry.
- */
- public static ImageRegistry getImageRegistry() {
- if (imageRegistry == null) {
- initializeImageRegistry();
- }
- return imageRegistry;
- }
-
- /**
- * Initialize the image registry by declaring all of the required
- * graphics. This involves creating JFace image descriptors describing
- * how to create/find the image should it be needed.
- * The image is not actually allocated until requested.
- *
- * Prefix conventions
- * Wizard Banners WIZBAN_
- * Preference Banners PREF_BAN_
- * Property Page Banners PROPBAN_
- * Color toolbar CTOOL_
- * Enable toolbar ETOOL_
- * Disable toolbar DTOOL_
- * Local enabled toolbar ELCL_
- * Local Disable toolbar DLCL_
- * Object large OBJL_
- * Object small OBJS_
- * View VIEW_
- * Product images PROD_
- * Misc images MISC_
- *
- * Where are the images?
- * The images (typically gifs) are found in the same location as this plugin class.
- * This may mean the same package directory as the package holding this class.
- * The images are declared using this.getClass() to ensure they are looked up via
- * this plugin class.
- * @see org.eclipse.jface.resource.ImageRegistry
- */
- public static ImageRegistry initializeImageRegistry() {
- imageRegistry= new ImageRegistry(ConsolePlugin.getStandardDisplay());
- declareImages();
- return imageRegistry;
- }
-
- /**
- * Returns the <code>Image<code> identified by the given key,
- * or <code>null</code> if it does not exist.
- */
- public static Image getImage(String key) {
- return getImageRegistry().get(key);
- }
-
- /**
- * Returns the <code>ImageDescriptor<code> identified by the given key,
- * or <code>null</code> if it does not exist.
- */
- public static ImageDescriptor getImageDescriptor(String key) {
- return getImageRegistry().getDescriptor(key);
- }
-
- private static URL makeIconFileURL(String iconPath) throws MalformedURLException {
- if (ICON_BASE_URL == null) {
- throw new MalformedURLException();
- }
-
- return new URL(ICON_BASE_URL, iconPath);
- }
-}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleResourceBundleMessages.java b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleResourceBundleMessages.java
deleted file mode 100644
index 33b7d8568..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleResourceBundleMessages.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.internal.console;
-
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-public class ConsoleResourceBundleMessages {
- private static final String BUNDLE_NAME = "org.eclipse.ui.internal.console.ConsoleResourceBundleMessages"; //$NON-NLS-1$
-
- private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME);
-
- private ConsoleResourceBundleMessages() {
- }
-
- public static String getString(String key) {
- try {
- return RESOURCE_BUNDLE.getString(key);
- } catch (MissingResourceException e) {
- return '!' + key + '!';
- }
- }
-
- public static ResourceBundle getBundle() {
- return RESOURCE_BUNDLE;
- }
-}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleResourceBundleMessages.properties b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleResourceBundleMessages.properties
deleted file mode 100644
index 9aeb0ef43..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleResourceBundleMessages.properties
+++ /dev/null
@@ -1,19 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2005 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-
-
-# These strings are used by the Find Replace Action and loaded as a Resource Bundle.
-# See TextConsolePage.createActions()
-
-find_replace_action_label=&Find/Replace...
-find_replace_action_tooltip=Find/Replace
-find_replace_action_image=
-find_replace_action_description=Find/Replace
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleTypePropertyTester.java b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleTypePropertyTester.java
deleted file mode 100644
index 46dc213fe..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleTypePropertyTester.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.internal.console;
-
-import org.eclipse.core.expressions.PropertyTester;
-import org.eclipse.ui.console.IConsole;
-
-/**
- * Tests if an IOConsole's type matches the expected value
- *
- * @since 3.1
- */
-public class ConsoleTypePropertyTester extends PropertyTester {
-
- /* (non-Javadoc)
- * @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Object)
- */
- public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
- IConsole console = (IConsole) receiver;
- String type = console.getType();
- return type != null ? type.equals(expectedValue) : false;
- }
-
-}
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
deleted file mode 100644
index 31c867809..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleView.java
+++ /dev/null
@@ -1,809 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.internal.console;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.runtime.ISafeRunnable;
-import org.eclipse.core.runtime.ListenerList;
-import org.eclipse.core.runtime.SafeRunner;
-
-import org.eclipse.swt.events.MouseAdapter;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.ToolBar;
-import org.eclipse.swt.widgets.ToolItem;
-
-import org.eclipse.jface.action.ActionContributionItem;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.action.ToolBarManager;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.jface.viewers.IBasicPropertyConstants;
-
-import org.eclipse.ui.IPartListener2;
-import org.eclipse.ui.IViewReference;
-import org.eclipse.ui.IViewSite;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchPartReference;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.console.AbstractConsole;
-import org.eclipse.ui.console.ConsolePlugin;
-import org.eclipse.ui.console.IConsole;
-import org.eclipse.ui.console.IConsoleConstants;
-import org.eclipse.ui.console.IConsoleListener;
-import org.eclipse.ui.console.IConsoleManager;
-import org.eclipse.ui.console.IConsolePageParticipant;
-import org.eclipse.ui.console.IConsoleView;
-import org.eclipse.ui.contexts.IContextActivation;
-import org.eclipse.ui.contexts.IContextService;
-import org.eclipse.ui.part.IPage;
-import org.eclipse.ui.part.IPageBookViewPage;
-import org.eclipse.ui.part.MessagePage;
-import org.eclipse.ui.part.PageBook;
-import org.eclipse.ui.part.PageBookView;
-import org.eclipse.ui.part.PageSwitcher;
-import org.eclipse.ui.progress.IWorkbenchSiteProgressService;
-
-/**
- * Page book console view.
- *
- * @since 3.0
- */
-public class ConsoleView extends PageBookView implements IConsoleView, IConsoleListener, IPropertyChangeListener, IPartListener2 {
-
- /**
- * Whether this console is pinned.
- */
- private boolean fPinned = false;
-
- /**
- * Stack of consoles in MRU order
- */
- private List fStack = new ArrayList();
-
- /**
- * The console being displayed, or <code>null</code> if none
- */
- private IConsole fActiveConsole = null;
-
- /**
- * Map of consoles to dummy console parts (used to close pages)
- */
- private Map fConsoleToPart;
-
- /**
- * Map of consoles to array of page participants
- */
- private Map fConsoleToPageParticipants;
-
- /**
- * Map of parts to consoles
- */
- private Map fPartToConsole;
-
- /**
- * Whether this view is active
- */
- private boolean fActive = false;
-
- /**
- * 'In Console View' context
- */
- private IContextActivation fActivatedContext;
-
- // actions
- private PinConsoleAction fPinAction = null;
- private ConsoleDropDownAction fDisplayConsoleAction = null;
-
- private OpenConsoleAction fOpenConsoleAction = null;
-
- private boolean fScrollLock;
-
- private boolean isAvailable() {
- return getPageBook() != null && !getPageBook().isDisposed();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
- */
- public void propertyChange(PropertyChangeEvent event) {
- Object source = event.getSource();
- if (source instanceof IConsole && event.getProperty().equals(IBasicPropertyConstants.P_TEXT)) {
- if (source.equals(getConsole())) {
- updateTitle();
- }
- }
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IPartListener#partClosed(org.eclipse.ui.IWorkbenchPart)
- */
- public void partClosed(IWorkbenchPart part) {
- super.partClosed(part);
- fPinAction.update();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.ui.console.IConsoleView#getConsole()
- */
- public IConsole getConsole() {
- return fActiveConsole;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.PageBookView#showPageRec(org.eclipse.ui.part.PageBookView.PageRec)
- */
- protected void showPageRec(PageRec pageRec) {
- // don't show the page when pinned, unless this is the first console to be added
- // or its the default page
- if (fActiveConsole != null && pageRec.page != getDefaultPage() && fPinned && fConsoleToPart.size() > 1) {
- IConsole console = (IConsole)fPartToConsole.get(pageRec.part);
- if (!fStack.contains(console)) {
- fStack.add(console);
- }
- return;
- }
-
- IConsole recConsole = (IConsole)fPartToConsole.get(pageRec.part);
- if (recConsole!=null && recConsole.equals(fActiveConsole)) {
- return;
- }
-
- super.showPageRec(pageRec);
- fActiveConsole = recConsole;
- IConsole tos = null;
- if (!fStack.isEmpty()) {
- tos = (IConsole) fStack.get(0);
- }
- if (tos != null && !tos.equals(fActiveConsole)) {
- deactivateParticipants(tos);
- }
- if (fActiveConsole != null && !fActiveConsole.equals(tos)) {
- fStack.remove(fActiveConsole);
- fStack.add(0,fActiveConsole);
- activateParticipants(fActiveConsole);
- }
- updateTitle();
- updateHelp();
- // update console actions
- if (fPinAction != null) {
- fPinAction.update();
- }
- IPage page = getCurrentPage();
- if (page instanceof IOConsolePage) {
- ((IOConsolePage)page).setAutoScroll(!fScrollLock);
- }
- }
-
- /**
- * Activates the participants for the given console, if any.
- *
- * @param console
- */
- private void activateParticipants(IConsole console) {
- // activate
- if (console != null && fActive) {
- final ListenerList listeners = getParticipants(console);
- if (listeners != null) {
- Object[] participants = listeners.getListeners();
- for (int i = 0; i < participants.length; i++) {
- final IConsolePageParticipant participant = (IConsolePageParticipant) participants[i];
- SafeRunner.run(new ISafeRunnable() {
- public void run() throws Exception {
- participant.activated();
- }
- public void handleException(Throwable exception) {
- ConsolePlugin.log(exception);
- listeners.remove(participant);
- }
- });
- }
- }
- }
- }
-
- /**
- * Returns a stack of consoles in the view in MRU order.
- *
- * @return a stack of consoles in the view in MRU order
- */
- protected List getConsoleStack() {
- return fStack;
- }
-
- /**
- * Updates the view title based on the active console
- */
- protected void updateTitle() {
- IConsole console = getConsole();
- if (console == null) {
- setContentDescription(ConsoleMessages.ConsoleView_0);
- } else {
- String newName = console.getName();
- String oldName = getContentDescription();
- if (newName!=null && !(newName.equals(oldName))) {
- setContentDescription(console.getName());
- }
- }
- }
-
- protected void updateHelp() {
- IConsole console = getConsole();
- String helpContextId = null;
- if (console instanceof AbstractConsole) {
- AbstractConsole abs = (AbstractConsole) console;
- helpContextId = abs.getHelpContextId();
- }
- if (helpContextId == null) {
- helpContextId = IConsoleHelpContextIds.CONSOLE_VIEW;
- }
- PlatformUI.getWorkbench().getHelpSystem().setHelp(getPageBook().getParent(), helpContextId);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.PageBookView#doDestroyPage(org.eclipse.ui.IWorkbenchPart, org.eclipse.ui.part.PageBookView.PageRec)
- */
- protected void doDestroyPage(IWorkbenchPart part, PageRec pageRecord) {
- IConsole console = (IConsole)fPartToConsole.get(part);
-
- // dispose page participants
- ListenerList listeners = (ListenerList) fConsoleToPageParticipants.remove(console);
- if (listeners != null) {
- Object[] participants = listeners.getListeners();
- for (int i = 0; i < participants.length; i++) {
- final IConsolePageParticipant participant = (IConsolePageParticipant) participants[i];
- SafeRunner.run(new ISafeRunnable() {
- public void run() throws Exception {
- participant.dispose();
- }
- public void handleException(Throwable exception) {
- ConsolePlugin.log(exception);
- }
- });
- }
- }
-
- IPage page = pageRecord.page;
- page.dispose();
- pageRecord.dispose();
- console.removePropertyChangeListener(this);
-
- // empty cross-reference cache
- fPartToConsole.remove(part);
- fConsoleToPart.remove(console);
- if (fPartToConsole.isEmpty()) {
- fActiveConsole = null;
- }
-
- // update console actions
- fPinAction.update();
- }
-
- /**
- * Returns the page participants registered for the given console, or <code>null</code>
- *
- * @param console
- * @return registered page participants or <code>null</code>
- */
- private ListenerList getParticipants(IConsole console) {
- return (ListenerList) fConsoleToPageParticipants.get(console);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.PageBookView#doCreatePage(org.eclipse.ui.IWorkbenchPart)
- */
- protected PageRec doCreatePage(IWorkbenchPart dummyPart) {
- ConsoleWorkbenchPart part = (ConsoleWorkbenchPart)dummyPart;
- final IConsole console = part.getConsole();
- final IPageBookViewPage page = console.createPage(this);
- initPage(page);
- page.createControl(getPageBook());
- console.addPropertyChangeListener(this);
-
- // initialize page participants
- IConsolePageParticipant[] consoleParticipants = ((ConsoleManager)getConsoleManager()).getPageParticipants(console);
- final ListenerList participants = new ListenerList();
- for (int i = 0; i < consoleParticipants.length; i++) {
- participants.add(consoleParticipants[i]);
- }
- fConsoleToPageParticipants.put(console, participants);
- Object[] listeners = participants.getListeners();
- for (int i = 0; i < listeners.length; i++) {
- final IConsolePageParticipant participant = (IConsolePageParticipant) listeners[i];
- SafeRunner.run(new ISafeRunnable() {
- public void run() throws Exception {
- participant.init(page, console);
- }
- public void handleException(Throwable exception) {
- ConsolePlugin.log(exception);
- participants.remove(participant);
- }
- });
- }
-
- PageRec rec = new PageRec(dummyPart, page);
- return rec;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.PageBookView#isImportant(org.eclipse.ui.IWorkbenchPart)
- */
- protected boolean isImportant(IWorkbenchPart part) {
- return part instanceof ConsoleWorkbenchPart;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPart#dispose()
- */
- public void dispose() {
- IViewSite site = getViewSite();
- if(site != null) {
- site.getPage().removePartListener((IPartListener2)this);
- }
- super.dispose();
- ConsoleManager consoleManager = (ConsoleManager) ConsolePlugin.getDefault().getConsoleManager();
- consoleManager.removeConsoleListener(this);
- consoleManager.unregisterConsoleView(this);
- }
-
- /**
- * Returns the console manager.
- *
- * @return the console manager
- */
- private IConsoleManager getConsoleManager() {
- return ConsolePlugin.getDefault().getConsoleManager();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.PageBookView#createDefaultPage(org.eclipse.ui.part.PageBook)
- */
- protected IPage createDefaultPage(PageBook book) {
- MessagePage page = new MessagePage();
- page.createControl(getPageBook());
- initPage(page);
- return page;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.IConsoleListener#consolesAdded(org.eclipse.ui.console.IConsole[])
- */
- public void consolesAdded(final IConsole[] consoles) {
- if (isAvailable()) {
- Runnable r = new Runnable() {
- public void run() {
- for (int i = 0; i < consoles.length; i++) {
- if (isAvailable()) {
- IConsole console = consoles[i];
- // ensure it's still registered since this is done asynchronously
- IConsole[] allConsoles = getConsoleManager().getConsoles();
- for (int j = 0; j < allConsoles.length; j++) {
- IConsole registered = allConsoles[j];
- if (registered.equals(console)) {
- ConsoleWorkbenchPart part = new ConsoleWorkbenchPart(console, getSite());
- fConsoleToPart.put(console, part);
- fPartToConsole.put(part, console);
- partActivated(part);
- break;
- }
- }
-
- }
- }
- }
- };
- asyncExec(r);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.IConsoleListener#consolesRemoved(org.eclipse.ui.console.IConsole[])
- */
- public void consolesRemoved(final IConsole[] consoles) {
- if (isAvailable()) {
- Runnable r = new Runnable() {
- public void run() {
- for (int i = 0; i < consoles.length; i++) {
- if (isAvailable()) {
- IConsole console = consoles[i];
- fStack.remove(console);
- ConsoleWorkbenchPart part = (ConsoleWorkbenchPart)fConsoleToPart.get(console);
- if (part != null) {
- partClosed(part);
- }
- if (getConsole() == null) {
- IConsole[] available = getConsoleManager().getConsoles();
- if (available.length > 0) {
- display(available[available.length - 1]);
- }
- }
- }
- }
- }
- };
- asyncExec(r);
- }
- }
-
- /**
- * Constructs a console view
- */
- public ConsoleView() {
- super();
- fConsoleToPart = new HashMap();
- fPartToConsole = new HashMap();
- fConsoleToPageParticipants = new HashMap();
-
- ConsoleManager consoleManager = (ConsoleManager) ConsolePlugin.getDefault().getConsoleManager();
- consoleManager.registerConsoleView(this);
- }
-
- protected void createActions() {
- fPinAction = new PinConsoleAction(this);
- fDisplayConsoleAction = new ConsoleDropDownAction(this);
- ConsoleFactoryExtension[] extensions = ((ConsoleManager)ConsolePlugin.getDefault().getConsoleManager()).getConsoleFactoryExtensions();
- if (extensions.length > 0) {
- fOpenConsoleAction = new OpenConsoleAction();
- }
- }
-
- protected void configureToolBar(IToolBarManager mgr) {
- mgr.add(new Separator(IConsoleConstants.LAUNCH_GROUP));
- mgr.add(new Separator(IConsoleConstants.OUTPUT_GROUP));
- mgr.add(new Separator("fixedGroup")); //$NON-NLS-1$
- mgr.add(fPinAction);
- mgr.add(fDisplayConsoleAction);
- if (fOpenConsoleAction != null) {
- mgr.add(fOpenConsoleAction);
- if (mgr instanceof ToolBarManager) {
- ToolBarManager tbm= (ToolBarManager) mgr;
- final ToolBar tb= tbm.getControl();
- tb.addMouseListener(new MouseAdapter() {
- public void mouseDown(MouseEvent e) {
- ToolItem ti= tb.getItem(new Point(e.x, e.y));
- if (ti != null) {
- if (ti.getData() instanceof ActionContributionItem) {
- ActionContributionItem actionContributionItem= (ActionContributionItem) ti.getData();
- IAction action= actionContributionItem.getAction();
- if (action == fOpenConsoleAction) {
- Event event= new Event();
- event.widget= ti;
- event.x= e.x;
- event.y= e.y;
- action.runWithEvent(event);
- }
- }
- }
- }
- });
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.IConsoleView#display(org.eclipse.ui.console.IConsole)
- */
- public void display(IConsole console) {
- if (fPinned && fActiveConsole != null) {
- return;
- }
- if (console.equals(fActiveConsole)) {
- return;
- }
- ConsoleWorkbenchPart part = (ConsoleWorkbenchPart)fConsoleToPart.get(console);
- if (part != null) {
- partActivated(part);
- }
- }
-
- /*/* (non-Javadoc)
- * @see org.eclipse.ui.console.IConsoleView#pin(org.eclipse.ui.console.IConsole)
- */
- public void setPinned(boolean pin) {
- fPinned = pin;
- if (fPinAction != null) {
- fPinAction.update();
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.IConsoleView#isPinned()
- */
- public boolean isPinned() {
- return fPinned;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.PageBookView#getBootstrapPart()
- */
- protected IWorkbenchPart getBootstrapPart() {
- return null;
- }
-
- /**
- * Registers the given runnable with the display
- * associated with this view's control, if any.
- *
- * @see org.eclipse.swt.widgets.Display#asyncExec(java.lang.Runnable)
- */
- public void asyncExec(Runnable r) {
- if (isAvailable()) {
- getPageBook().getDisplay().asyncExec(r);
- }
- }
-
- /**
- * Creates this view's underlying viewer and actions.
- * Hooks a pop-up menu to the underlying viewer's control,
- * as well as a key listener. When the delete key is pressed,
- * the <code>REMOVE_ACTION</code> is invoked. Hooks help to
- * this view. Subclasses must implement the following methods
- * which are called in the following order when a view is
- * created:<ul>
- * <li><code>createViewer(Composite)</code> - the context
- * menu is hooked to the viewer's control.</li>
- * <li><code>createActions()</code></li>
- * <li><code>configureToolBar(IToolBarManager)</code></li>
- * <li><code>getHelpContextId()</code></li>
- * </ul>
- * @see IWorkbenchPart#createPartControl(Composite)
- */
- public void createPartControl(Composite parent) {
- super.createPartControl(parent);
- createActions();
- IToolBarManager tbm= getViewSite().getActionBars().getToolBarManager();
- configureToolBar(tbm);
- updateForExistingConsoles();
- getViewSite().getActionBars().updateActionBars();
- PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, IConsoleHelpContextIds.CONSOLE_VIEW);
- getViewSite().getPage().addPartListener((IPartListener2)this);
- initPageSwitcher();
- }
-
- /**
- * Initialize the PageSwitcher.
- */
- private void initPageSwitcher() {
- new PageSwitcher(this) {
- public void activatePage(Object page) {
- ShowConsoleAction.showConsole((IConsole) page, ConsoleView.this);
- }
-
- public ImageDescriptor getImageDescriptor(Object page) {
- return ((IConsole) page).getImageDescriptor();
- }
-
- public String getName(Object page) {
- return ((IConsole) page).getName();
- }
-
- public Object[] getPages() {
- return getConsoleManager().getConsoles();
- }
-
- public int getCurrentPageIndex() {
- IConsole currentConsole= getConsole();
- IConsole[] consoles= getConsoleManager().getConsoles();
- for (int i= 0; i < consoles.length; i++) {
- if (consoles[i].equals(currentConsole))
- return i;
- }
- return super.getCurrentPageIndex();
- }
- };
- }
-
- /**
- * Initialize for existing consoles
- */
- private void updateForExistingConsoles() {
- IConsoleManager manager = getConsoleManager();
- // create pages for consoles
- IConsole[] consoles = manager.getConsoles();
- consolesAdded(consoles);
- // add as a listener
- manager.addConsoleListener(this);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.IConsoleView#warnOfContentChange(org.eclipse.ui.console.IConsole)
- */
- public void warnOfContentChange(IConsole console) {
- IWorkbenchPart part = (IWorkbenchPart)fConsoleToPart.get(console);
- if (part != null) {
- IWorkbenchSiteProgressService service = (IWorkbenchSiteProgressService) part.getSite().getAdapter(IWorkbenchSiteProgressService.class);
- if (service != null) {
- service.warnOfContentChange();
- }
- }
- }
-
- public Object getAdapter(Class key) {
- Object adpater = super.getAdapter(key);
- if (adpater == null) {
- IConsole console = getConsole();
- if (console != null) {
- ListenerList listeners = getParticipants(console);
- // an adapter can be asked for before the console participants are created
- if (listeners != null) {
- Object[] participants = listeners.getListeners();
- for (int i = 0; i < participants.length; i++) {
- IConsolePageParticipant participant = (IConsolePageParticipant) participants[i];
- adpater = participant.getAdapter(key);
- if (adpater != null) {
- return adpater;
- }
- }
- }
- }
- }
- return adpater;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IPartListener2#partActivated(org.eclipse.ui.IWorkbenchPartReference)
- */
- public void partActivated(IWorkbenchPartReference partRef) {
- if (isThisPart(partRef)) {
- fActive = true;
- IContextService contextService = (IContextService)getSite().getService(IContextService.class);
- if(contextService != null) {
- fActivatedContext = contextService.activateContext(IConsoleConstants.ID_CONSOLE_VIEW);
- activateParticipants(fActiveConsole);
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IPartListener2#partBroughtToTop(org.eclipse.ui.IWorkbenchPartReference)
- */
- public void partBroughtToTop(IWorkbenchPartReference partRef) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IPartListener2#partClosed(org.eclipse.ui.IWorkbenchPartReference)
- */
- public void partClosed(IWorkbenchPartReference partRef) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IPartListener2#partDeactivated(org.eclipse.ui.IWorkbenchPartReference)
- */
- public void partDeactivated(IWorkbenchPartReference partRef) {
- if (isThisPart(partRef)) {
- fActive = false;
- IContextService contextService = (IContextService)getSite().getService(IContextService.class);
- if(contextService != null) {
- contextService.deactivateContext(fActivatedContext);
- deactivateParticipants(fActiveConsole);
- }
- }
- }
-
- /**
- * Returns if the specified part reference is to this view part (if the part
- * reference is the console view or not)
- * @param partRef
- * @return true if the specified part reference is the console view
- */
- protected boolean isThisPart(IWorkbenchPartReference partRef) {
- if (partRef instanceof IViewReference) {
- IViewReference viewRef = (IViewReference) partRef;
- if (getViewSite() != null && viewRef.getId().equals(getViewSite().getId())) {
- String secId = viewRef.getSecondaryId();
- String mySec = null;
- if (getSite() instanceof IViewSite) {
- mySec = ((IViewSite)getSite()).getSecondaryId();
- }
- if (mySec == null) {
- return secId == null;
- }
- return mySec.equals(secId);
- }
- }
- return false;
- }
-
- /**
- * Deactivates participants for the given console, if any.
- *
- * @param console console to deactivate
- */
- private void deactivateParticipants(IConsole console) {
- // deactivate
- if (console != null) {
- final ListenerList listeners = getParticipants(console);
- if (listeners != null) {
- Object[] participants = listeners.getListeners();
- for (int i = 0; i < participants.length; i++) {
- final IConsolePageParticipant participant = (IConsolePageParticipant) participants[i];
- SafeRunner.run(new ISafeRunnable() {
- public void run() throws Exception {
- participant.deactivated();
- }
- public void handleException(Throwable exception) {
- ConsolePlugin.log(exception);
- listeners.remove(participant);
- }
- });
- }
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IPartListener2#partOpened(org.eclipse.ui.IWorkbenchPartReference)
- */
- public void partOpened(IWorkbenchPartReference partRef) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IPartListener2#partHidden(org.eclipse.ui.IWorkbenchPartReference)
- */
- public void partHidden(IWorkbenchPartReference partRef) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IPartListener2#partVisible(org.eclipse.ui.IWorkbenchPartReference)
- */
- public void partVisible(IWorkbenchPartReference partRef) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IPartListener2#partInputChanged(org.eclipse.ui.IWorkbenchPartReference)
- */
- 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;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.IConsoleView#pin(org.eclipse.ui.console.IConsole)
- */
- public void pin(IConsole console) {
- if (console == null) {
- setPinned(false);
- } else {
- if (isPinned()) {
- setPinned(false);
- }
- display(console);
- setPinned(true);
- }
- }
-}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleViewConsoleFactory.java b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleViewConsoleFactory.java
deleted file mode 100644
index 8a32fc8c1..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleViewConsoleFactory.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.internal.console;
-
-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;
-
-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 = "Console View #" + counter; //$NON-NLS-1$
- page.showView(IConsoleConstants.ID_CONSOLE_VIEW, secondaryId, 1);
- counter++;
- } catch (PartInitException e) {
- ConsolePlugin.log(e);
- }
- }
- }
- }
-
-}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleWorkbenchPart.java b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleWorkbenchPart.java
deleted file mode 100644
index e3377a4dc..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleWorkbenchPart.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.internal.console;
-
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.IPropertyListener;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchPartSite;
-import org.eclipse.ui.console.IConsole;
-
-/**
- * Fake part to use as keys in page book for console pages
- */
-public class ConsoleWorkbenchPart implements IWorkbenchPart {
-
- private IConsole fConsole = null;
- private IWorkbenchPartSite fSite = null;
-
- /* (non-Javadoc)
- * @see java.lang.Object#equals(java.lang.Object)
- */
- public boolean equals(Object obj) {
- return (obj instanceof ConsoleWorkbenchPart) &&
- fConsole.equals(((ConsoleWorkbenchPart)obj).fConsole);
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#hashCode()
- */
- public int hashCode() {
- return fConsole.hashCode();
- }
-
- /**
- * Constructs a part for the given console that binds to the given
- * site
- */
- public ConsoleWorkbenchPart(IConsole console, IWorkbenchPartSite site) {
- fConsole = console;
- fSite = site;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPart#addPropertyListener(org.eclipse.ui.IPropertyListener)
- */
- public void addPropertyListener(IPropertyListener listener) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
- */
- public void createPartControl(Composite parent) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPart#dispose()
- */
- public void dispose() {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPart#getSite()
- */
- public IWorkbenchPartSite getSite() {
- return fSite;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPart#getTitle()
- */
- public String getTitle() {
- return ""; //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPart#getTitleImage()
- */
- public Image getTitleImage() {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPart#getTitleToolTip()
- */
- public String getTitleToolTip() {
- return ""; //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPart#removePropertyListener(org.eclipse.ui.IPropertyListener)
- */
- public void removePropertyListener(IPropertyListener listener) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPart#setFocus()
- */
- public void setFocus() {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
- */
- public Object getAdapter(Class adapter) {
- return null;
- }
-
- /**
- * Returns the console associated with this part.
- *
- * @return console associated with this part
- */
- protected IConsole getConsole() {
- return fConsole;
- }
-}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/FollowHyperlinkAction.java b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/FollowHyperlinkAction.java
deleted file mode 100644
index 492dfd552..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/FollowHyperlinkAction.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.internal.console;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.console.IHyperlink;
-import org.eclipse.ui.console.TextConsoleViewer;
-
-/**
- * Follows a hyperlink in the console
- *
- * @since 3.1
- */
-public class FollowHyperlinkAction extends Action {
-
- private TextConsoleViewer viewer;
-
- /**
- * Constructs a follow link action
- */
- public FollowHyperlinkAction(TextConsoleViewer consoleViewer) {
- super(ConsoleMessages.FollowHyperlinkAction_0);
- setToolTipText(ConsoleMessages.FollowHyperlinkAction_1);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IConsoleHelpContextIds.CONSOLE_OPEN_LINK_ACTION);
- this.viewer = consoleViewer;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.IAction#isEnabled()
- */
- public boolean isEnabled() {
- return viewer.getHyperlink() != null;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.action.IAction#run()
- */
- public void run() {
- IHyperlink link = viewer.getHyperlink();
- if (link != null) {
- link.linkActivated();
- }
- }
-
-}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/HyperlinkUpdater.java b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/HyperlinkUpdater.java
deleted file mode 100644
index 3ed6aa714..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/HyperlinkUpdater.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.internal.console;
-
-import org.eclipse.jface.text.BadPositionCategoryException;
-import org.eclipse.jface.text.DefaultPositionUpdater;
-import org.eclipse.ui.internal.console.ConsoleHyperlinkPosition;
-
-/**
- * When any region of a hyperlink is replaced, the hyperlink needs to be deleted.
- *
- * @since 3.3
- */
-public class HyperlinkUpdater extends DefaultPositionUpdater {
-
- /**
- * @param category
- */
- public HyperlinkUpdater() {
- super(ConsoleHyperlinkPosition.HYPER_LINK_CATEGORY);
- }
- /**
- * When any region of a hyperlink is replaced, the hyperlink needs to be deleted.
- *
- * @return <code>true</code> if position has NOT been deleted
- */
- protected boolean notDeleted() {
-
- int positionEnd = fPosition.offset + fPosition.length - 1;
- int editEnd = fOffset + fLength - 1;
- if ((fOffset <= fPosition.offset && (editEnd > fPosition.offset)) ||
- (fOffset < positionEnd && (editEnd > positionEnd)) ||
- (fOffset >= fPosition.offset && fOffset <= positionEnd) ||
- (editEnd >= fPosition.offset && editEnd <= positionEnd)) {
-
- fPosition.delete();
-
- try {
- fDocument.removePosition(ConsoleHyperlinkPosition.HYPER_LINK_CATEGORY, fPosition);
- } catch (BadPositionCategoryException x) {
- }
-
- return false;
- }
-
- return true;
- }
-}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IConsoleHelpContextIds.java b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IConsoleHelpContextIds.java
deleted file mode 100644
index 85a4e69b2..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IConsoleHelpContextIds.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.internal.console;
-
-import org.eclipse.ui.console.IConsoleConstants;
-
-/**
- * Help context ids for the console plugin.
- * <p>
- * This interface contains constants only; it is not intended to be implemented
- * or extended.
- * </p>
- *
- */
-public interface IConsoleHelpContextIds {
-
- public static final String PREFIX = IConsoleConstants.PLUGIN_ID + "."; //$NON-NLS-1$
-
- // Actions
- public static final String CLEAR_CONSOLE_ACTION = PREFIX + "clear_console_action_context"; //$NON-NLS-1$
- public static final String CONSOLE_SCROLL_LOCK_ACTION = PREFIX + "console_scroll_lock_action_context"; //$NON-NLS-1$
- public static final String CONSOLE_SELECT_ALL_ACTION = PREFIX + "console_select_all_action_context"; //$NON-NLS-1$
- public static final String CONSOLE_COPY_ACTION = PREFIX + "copy_to_clipboard_action_context"; //$NON-NLS-1$
- public static final String CONSOLE_CUT_ACTION = PREFIX + "console_cut_action_context"; //$NON-NLS-1$
- public static final String CONSOLE_PASTE_ACTION = PREFIX + "console_paste_action_context"; //$NON-NLS-1$
- public static final String CONSOLE_FIND_REPLACE_ACTION = PREFIX + "console_find_replace_action_context"; //$NON-NLS-1$
- public static final String CONSOLE_OPEN_LINK_ACTION = PREFIX + "console_open_link_action_context"; //$NON-NLS-1$
- public static final String CONSOLE_OPEN_CONSOLE_ACTION = PREFIX + "console_open_console_action_context"; //$NON-NLS-1$
- public static final String CONSOLE_DISPLAY_CONSOLE_ACTION = PREFIX + "console_display_console_action"; //$NON-NLS-1$
- public static final String CONSOLE_PIN_CONSOLE_ACITON = PREFIX + "console_pin_console_action"; //$NON-NLS-1$
-
- // Views
- public static final String CONSOLE_VIEW = PREFIX + "console_view_context"; //$NON-NLS-1$
-
- // Preference pages
- public static final String CONSOLE_PREFERENCE_PAGE = PREFIX + "console_preference_page_context"; //$NON-NLS-1$
-}
-
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
deleted file mode 100644
index 00f5cbc3b..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IInternalConsoleConstants.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.internal.console;
-
-public interface IInternalConsoleConstants {
-
- // tool images
- public static final String IMG_LCL_PIN = "IMG_LCL_PIN"; //$NON-NLS-1$
- public static final String IMG_LCL_LOCK = "IMG_LCL_LOCK"; //$NON-NLS-1$
-
- // disabled local tool images
- public static final String IMG_DLCL_PIN = "IMG_DLCL_PIN"; //$NON-NLS-1$
- public static final String IMG_DLCL_CLEAR= "IMG_DLCL_CLEAR"; //$NON-NLS-1$
- public static final String IMG_DLCL_LOCK = "IMG_DLCL_LOCK"; //$NON-NLS-1$
- public static final String IMG_DLCL_CLOSE = "IMG_DLCL_CLOSE"; //$NON-NLS-1$
-
- // enabled local tool images
- public static final String IMG_ELCL_PIN = "IMG_ELCL_PIN"; //$NON-NLS-1$
- public static final String IMG_ELCL_CLEAR= "IMG_ELCL_CLEAR"; //$NON-NLS-1$
- public static final String IMG_ELCL_LOCK = "IMG_ELCL_LOCK"; //$NON-NLS-1$
- public static final String IMG_ELCL_CLOSE = "IMG_ELCL_CLOSE"; //$NON-NLS-1$
- public static final String IMG_ELCL_NEW_CON = "IMG_ELCL_NEW_CON"; //$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
deleted file mode 100644
index 3f8d72fe9..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsolePage.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.internal.console;
-
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-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.TextConsole;
-import org.eclipse.ui.console.TextConsolePage;
-import org.eclipse.ui.console.TextConsoleViewer;
-
-/**
- * A page for an IOConsole
- *
- * @since 3.1
- *
- */
-public class IOConsolePage extends TextConsolePage {
-
- private ScrollLockAction fScrollLockAction;
-
- private boolean fReadOnly;
-
- private IPropertyChangeListener fPropertyChangeListener;
-
- public IOConsolePage(TextConsole console, IConsoleView view) {
- super(console, view);
-
- fPropertyChangeListener = new IPropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- String property = event.getProperty();
- if (property.equals(IConsoleConstants.P_CONSOLE_OUTPUT_COMPLETE)) {
- setReadOnly();
- }
- }
- };
- console.addPropertyChangeListener(fPropertyChangeListener);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.part.IPage#createControl(org.eclipse.swt.widgets.Composite)
- */
- public void createControl(Composite parent) {
- super.createControl(parent);
- if (fReadOnly) {
- IOConsoleViewer viewer = (IOConsoleViewer) getViewer();
- viewer.setReadOnly();
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.console.TextConsolePage#createViewer(org.eclipse.swt.widgets.Composite,
- * org.eclipse.ui.console.TextConsole)
- */
- protected TextConsoleViewer createViewer(Composite parent) {
- return new IOConsoleViewer(parent, (TextConsole)getConsole());
- }
-
- public void setAutoScroll(boolean scroll) {
- IOConsoleViewer viewer = (IOConsoleViewer) getViewer();
- if (viewer != null) {
- viewer.setAutoScroll(scroll);
- fScrollLockAction.setChecked(!scroll);
- }
- }
-
- /**
- * Informs the viewer that it's text widget should not be editable.
- */
- public void setReadOnly() {
- fReadOnly = true;
- IOConsoleViewer viewer = (IOConsoleViewer) getViewer();
- if (viewer != null) {
- viewer.setReadOnly();
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.TextConsolePage#createActions()
- */
- protected void createActions() {
- super.createActions();
- fScrollLockAction = new ScrollLockAction(getConsoleView());
- setAutoScroll(!fScrollLockAction.isChecked());
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.TextConsolePage#contextMenuAboutToShow(org.eclipse.jface.action.IMenuManager)
- */
- protected void contextMenuAboutToShow(IMenuManager menuManager) {
- super.contextMenuAboutToShow(menuManager);
- menuManager.add(fScrollLockAction);
- IOConsoleViewer viewer = (IOConsoleViewer) getViewer();
- if (!viewer.isReadOnly()) {
- menuManager.remove(ActionFactory.CUT.getId());
- menuManager.remove(ActionFactory.PASTE.getId());
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.console.TextConsolePage#configureToolBar(org.eclipse.jface.action.IToolBarManager)
- */
- protected void configureToolBar(IToolBarManager mgr) {
- super.configureToolBar(mgr);
- mgr.appendToGroup(IConsoleConstants.OUTPUT_GROUP, fScrollLockAction);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.part.IPage#dispose()
- */
- public void dispose() {
- if (fScrollLockAction != null) {
- fScrollLockAction.dispose();
- fScrollLockAction = null;
- }
- getConsole().removePropertyChangeListener(fPropertyChangeListener);
- super.dispose();
- }
-
-}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsolePartition.java b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsolePartition.java
deleted file mode 100644
index 519cbc76b..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsolePartition.java
+++ /dev/null
@@ -1,209 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.internal.console;
-
-import org.eclipse.jface.text.ITypedRegion;
-import org.eclipse.swt.custom.StyleRange;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.ui.console.ConsolePlugin;
-import org.eclipse.ui.console.IOConsoleInputStream;
-import org.eclipse.ui.console.IOConsoleOutputStream;
-
-/**
- * A region in an IOConsole's document.
- *
- * @since 3.1
- */
-public class IOConsolePartition implements ITypedRegion {
- public static final String OUTPUT_PARTITION_TYPE = ConsolePlugin.getUniqueIdentifier() + ".io_console_output_partition_type"; //$NON-NLS-1$
- public static final String INPUT_PARTITION_TYPE = ConsolePlugin.getUniqueIdentifier() + ".io_console_input_partition_type"; //$NON-NLS-1$
-
- /**
- * The data contained by this partition.
- */
- private StringBuffer buffer;
- private String type;
- private int offset;
- /**
- * Output partitions are all read only.
- * Input partitions are read only once they have been appended to the console's input stream.
- */
- private boolean readOnly;
-
- /**
- * Only one of inputStream or outputStream will be null depending on the partitions type.
- */
- private IOConsoleOutputStream outputStream;
- private IOConsoleInputStream inputStream;
- private int length;
-
- /**
- * Creates a new partition to contain output to console.
- */
- public IOConsolePartition(IOConsoleOutputStream outputStream, int length) {
- this.outputStream = outputStream;
- this.length = length;
- this.type = OUTPUT_PARTITION_TYPE;
- this.readOnly = true;
- }
-
- /**
- * Creates a new partition to contain input from a console
- */
- public IOConsolePartition(IOConsoleInputStream inputStream, String text) {
- this.inputStream = inputStream;
- buffer = new StringBuffer(text);
- length = text.length();
- this.type = INPUT_PARTITION_TYPE;
- this.readOnly = false;
- }
-
- /**
- * Inserts a string into this partition.
- * @param s The string to insert
- * @param offset the offset in the partition
- */
- public void insert(String s, int insertOffset) {
- buffer.insert(insertOffset, s);
- length += s.length();
- }
-
- /**
- * Deletes data from this partition.
- * @param delOffset
- * @param delLength
- */
- public void delete(int delOffset, int delLength) {
- buffer.delete(delOffset, delOffset+delLength);
- length -= delLength;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.text.ITypedRegion#getType()
- */
- public String getType() {
- return type;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.text.IRegion#getLength()
- */
- public int getLength() {
- return length;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.text.IRegion#getOffset()
- */
- public int getOffset() {
- return offset;
- }
-
- /**
- * Sets this partitions offset in the document.
- *
- * @param offset This partitions offset in the document.
- */
- public void setOffset(int offset) {
- this.offset = offset;
- }
-
- /**
- * Sets this partition's length.
- *
- * @param length
- */
- public void setLength(int length) {
- this.length = length;
- }
-
- /**
- * Returns the data contained in this partition.
- * @return The data contained in this partition.
- */
- public String getString() {
- return buffer.toString();
- }
-
- /**
- * Returns a StyleRange object which may be used for setting the style
- * of this partition in a viewer.
- */
- public StyleRange getStyleRange(int rangeOffset, int rangeLength) {
- return new StyleRange(rangeOffset, rangeLength, getColor(), null, getFontStyle());
- }
-
- /**
- * Returns the font of the input stream if the type of the partition
- * is <code>INPUT_PARTITION_TYPE</code>, otherwise it returns the output
- * stream font
- *
- * @return the font of one of the backing streams
- */
- private int getFontStyle() {
- if (type.equals(INPUT_PARTITION_TYPE)) {
- return inputStream.getFontStyle();
- }
- return outputStream.getFontStyle();
- }
-
- /**
- * Returns the colour of the input stream if the type of the partition
- * is <code>INPUT_PARTITION_TYPE</code>, otherwise it returns the output
- * stream colour
- *
- * @return the colour of one of the backing streams
- */
- public Color getColor() {
- if (type.equals(INPUT_PARTITION_TYPE)) {
- return inputStream.getColor();
- }
- return outputStream.getColor();
- }
-
- /**
- * Returns if this partition is read-only.
- *
- * @see org.eclipse.ui.console.IConsoleDocumentPartitioner#isReadOnly(int)
- * @return if this partition is read-only
- */
- public boolean isReadOnly() {
- return readOnly;
- }
-
- /**
- * Sets the read-only state of this partition to <code>true</code>.
- *
- * @see org.eclipse.ui.console.IConsoleDocumentPartitioner#isReadOnly(int)
- */
- public void setReadOnly() {
- readOnly = true;
- }
-
- /**
- * Clears the contents of the buffer
- */
- public void clearBuffer() {
- buffer.setLength(0);
- }
-
- /**
- * Returns the underlying output stream
- *
- * @return the underlying output stream
- */
- IOConsoleOutputStream getStream() {
- return outputStream;
- }
-}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsolePartitioner.java b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsolePartitioner.java
deleted file mode 100644
index 5a74807b2..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsolePartitioner.java
+++ /dev/null
@@ -1,699 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.internal.console;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.IJobManager;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.DocumentEvent;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IDocumentPartitionerExtension;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.ITypedRegion;
-import org.eclipse.jface.text.Region;
-import org.eclipse.swt.custom.StyleRange;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.console.ConsolePlugin;
-import org.eclipse.ui.console.IConsoleDocumentPartitioner;
-import org.eclipse.ui.console.IOConsole;
-import org.eclipse.ui.console.IOConsoleInputStream;
-import org.eclipse.ui.console.IOConsoleOutputStream;
-import org.eclipse.ui.progress.UIJob;
-import org.eclipse.ui.progress.WorkbenchJob;
-
-/**
- * Partitions an IOConsole's document
- * @since 3.1
- *
- */
-public class IOConsolePartitioner implements IConsoleDocumentPartitioner, IDocumentPartitionerExtension {
- private PendingPartition consoleClosedPartition;
- private IDocument document;
- private ArrayList partitions;
- /**
- * Blocks of data that have not yet been appended to the document.
- */
- private ArrayList pendingPartitions;
- /**
- * A list of PendingPartitions to be appended by the updateJob
- */
- private ArrayList updatePartitions;
- /**
- * The last partition appended to the document
- */
- private IOConsolePartition lastPartition;
- /**
- * Job that appends pending partitions to the document.
- */
- private QueueProcessingJob queueJob;
- /**
- * The input stream attached to this document.
- */
- private IOConsoleInputStream inputStream;
- /**
- * Flag to indicate that the updateJob is updating the document.
- */
- private boolean updateInProgress;
- /**
- * A list of partitions containing input from the console, that have
- * not been appended to the input stream yet.
- */
- private ArrayList inputPartitions;
- /**
- * offset used by updateJob
- */
- private int firstOffset;
- /**
- * An array of legal line delimiters
- */
- private String[] lld;
- private int highWaterMark = -1;
- private int lowWaterMark = -1;
- private boolean connected = false;
-
- private IOConsole console;
-
- private TrimJob trimJob = new TrimJob();
- /**
- * Lock for appending to and removing from the document - used
- * to synchronize addition of new text/partitions in the update
- * job and handling buffer overflow/clearing of the console.
- */
- private Object overflowLock = new Object();
-
-
- private int fBuffer;
-
- public IOConsolePartitioner(IOConsoleInputStream inputStream, IOConsole console) {
- this.inputStream = inputStream;
- this.console = console;
- trimJob.setRule(console.getSchedulingRule());
- }
-
- public IDocument getDocument() {
- return document;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.text.IDocumentPartitioner#connect(org.eclipse.jface.text.IDocument)
- */
- public void connect(IDocument doc) {
- document = doc;
- document.setDocumentPartitioner(this);
- lld = document.getLegalLineDelimiters();
- partitions = new ArrayList();
- pendingPartitions = new ArrayList();
- inputPartitions = new ArrayList();
- queueJob = new QueueProcessingJob();
- queueJob.setSystem(true);
- queueJob.setPriority(Job.INTERACTIVE);
- queueJob.setRule(console.getSchedulingRule());
- connected = true;
- }
-
- public int getHighWaterMark() {
- return highWaterMark;
- }
-
- public int getLowWaterMark() {
- return lowWaterMark;
- }
-
- public void setWaterMarks(int low, int high) {
- lowWaterMark = low;
- highWaterMark = high;
- ConsolePlugin.getStandardDisplay().asyncExec(new Runnable() {
- public void run() {
- checkBufferSize();
- }
- });
- }
-
- /**
- * Notification from the console that all of its streams have been closed.
- */
- public void streamsClosed() {
- consoleClosedPartition = new PendingPartition(null, null);
- synchronized (pendingPartitions) {
- pendingPartitions.add(consoleClosedPartition);
- }
- queueJob.schedule(); //ensure that all pending partitions are processed.
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.text.IDocumentPartitioner#disconnect()
- */
- public void disconnect() {
- synchronized (overflowLock) {
- document = null;
- partitions.clear();
- connected = false;
- try {
- inputStream.close();
- } catch (IOException e) {
- }
- }
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.text.IDocumentPartitioner#documentAboutToBeChanged(org.eclipse.jface.text.DocumentEvent)
- */
- public void documentAboutToBeChanged(DocumentEvent event) {
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.text.IDocumentPartitioner#documentChanged(org.eclipse.jface.text.DocumentEvent)
- */
- public boolean documentChanged(DocumentEvent event) {
- return documentChanged2(event) != null;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.text.IDocumentPartitioner#getLegalContentTypes()
- */
- public String[] getLegalContentTypes() {
- return new String[] { IOConsolePartition.OUTPUT_PARTITION_TYPE, IOConsolePartition.INPUT_PARTITION_TYPE };
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.text.IDocumentPartitioner#getContentType(int)
- */
- public String getContentType(int offset) {
- return getPartition(offset).getType();
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.text.IDocumentPartitioner#computePartitioning(int, int)
- */
- public ITypedRegion[] computePartitioning(int offset, int length) {
- int rangeEnd = offset + length;
- int left= 0;
- int right= partitions.size() - 1;
- int mid= 0;
- IOConsolePartition position= null;
-
- if (left == right) {
- return new IOConsolePartition[]{(IOConsolePartition) partitions.get(0)};
- }
- while (left < right) {
-
- mid= (left + right) / 2;
-
- position= (IOConsolePartition) partitions.get(mid);
- if (rangeEnd < position.getOffset()) {
- if (left == mid)
- right= left;
- else
- right= mid -1;
- } else if (offset > (position.getOffset() + position.getLength() - 1)) {
- if (right == mid)
- left= right;
- else
- left= mid +1;
- } else {
- left= right= mid;
- }
- }
-
-
- List list = new ArrayList();
- int index = left - 1;
- if (index >= 0) {
- position= (IOConsolePartition) partitions.get(index);
- while (index >= 0 && (position.getOffset() + position.getLength()) > offset) {
- index--;
- if (index >= 0) {
- position= (IOConsolePartition) partitions.get(index);
- }
- }
- }
- index++;
- position= (IOConsolePartition) partitions.get(index);
- while (index < partitions.size() && (position.getOffset() < rangeEnd)) {
- list.add(position);
- index++;
- if (index < partitions.size()) {
- position= (IOConsolePartition) partitions.get(index);
- }
- }
-
- return (ITypedRegion[]) list.toArray(new IOConsolePartition[list.size()]);
- }
-
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.text.IDocumentPartitioner#getPartition(int)
- */
- public ITypedRegion getPartition(int offset) {
- for (int i = 0; i < partitions.size(); i++) {
- ITypedRegion partition = (ITypedRegion) partitions.get(i);
- int start = partition.getOffset();
- int end = start + partition.getLength();
- if (offset >= start && offset < end) {
- return partition;
- }
- }
-
- if (lastPartition == null) {
- synchronized(partitions) {
- lastPartition = new IOConsolePartition(inputStream, ""); //$NON-NLS-1$
- lastPartition.setOffset(offset);
- partitions.add(lastPartition);
- inputPartitions.add(lastPartition);
- }
- }
- return lastPartition;
- }
-
- /**
- * Enforces the buffer size.
- * When the number of lines in the document exceeds the high water mark, the
- * beginning of the document is trimmed until the number of lines equals the
- * low water mark.
- */
- private void checkBufferSize() {
- if (document != null && highWaterMark > 0) {
- int length = document.getLength();
- if (length > highWaterMark) {
- if (trimJob.getState() == Job.NONE) { //if the job isn't already running
- trimJob.setOffset(length - lowWaterMark);
- trimJob.schedule();
- }
- }
- }
- }
-
- /**
- * Clears the console
- */
- public void clearBuffer() {
- synchronized (overflowLock) {
- trimJob.setOffset(-1);
- trimJob.schedule();
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.text.IDocumentPartitionerExtension#documentChanged2(org.eclipse.jface.text.DocumentEvent)
- */
- public IRegion documentChanged2(DocumentEvent event) {
- if (document == null) {
- return null; //another thread disconnected the partitioner
- }
- if (document.getLength() == 0) { //document cleared
- if (lastPartition != null && lastPartition.getType().equals(IOConsolePartition.INPUT_PARTITION_TYPE)) {
- synchronized (partitions) {
- partitions.remove(lastPartition);
- inputPartitions.remove(lastPartition);
- }
- }
- lastPartition = null;
- return new Region(0, 0);
- }
-
-
- if (updateInProgress) {
- synchronized(partitions) {
- if (updatePartitions != null) {
- for (Iterator i = updatePartitions.iterator(); i.hasNext(); ) {
- PendingPartition pp = (PendingPartition) i.next();
- if (pp == consoleClosedPartition) {
- continue;
- }
-
- int ppLen = pp.text.length();
- if (lastPartition != null && lastPartition.getStream() == pp.stream) {
- int len = lastPartition.getLength();
- lastPartition.setLength(len + ppLen);
- } else {
- IOConsolePartition partition = new IOConsolePartition(pp.stream, ppLen);
- partition.setOffset(firstOffset);
- lastPartition = partition;
- partitions.add(partition);
- }
- firstOffset += ppLen;
- }
- }
- }
- } else {// user input.
- int amountDeleted = event.getLength() ;
-
- if (amountDeleted > 0) {
- int offset = event.fOffset;
- IOConsolePartition partition = (IOConsolePartition) getPartition(offset);
- if(partition == lastPartition) {
- partition.delete(event.fOffset-partition.getOffset(), amountDeleted);
- }
- }
-
- synchronized(partitions) {
- if (lastPartition == null || lastPartition.isReadOnly()) {
- lastPartition = new IOConsolePartition(inputStream, event.fText);
- lastPartition.setOffset(event.fOffset);
- partitions.add(lastPartition);
- inputPartitions.add(lastPartition);
- } else {
- lastPartition.insert(event.fText, (event.fOffset-lastPartition.getOffset()));
- }
-
- int lastLineDelimiter = -1;
- String partitionText = lastPartition.getString();
- for (int i = 0; i < lld.length; i++) {
- String ld = lld[i];
- int index = partitionText.lastIndexOf(ld);
- if (index != -1) {
- index += ld.length();
- }
- if (index > lastLineDelimiter) {
- lastLineDelimiter = index;
- }
- }
- if (lastLineDelimiter != -1) {
- StringBuffer input = new StringBuffer();
- Iterator it = inputPartitions.iterator();
- while (it.hasNext()) {
- IOConsolePartition partition = (IOConsolePartition) it.next();
- if (partition.getOffset() + partition.getLength() <= event.fOffset + lastLineDelimiter) {
- if (partition == lastPartition) {
- lastPartition = null;
- }
- input.append(partition.getString());
- partition.clearBuffer();
- partition.setReadOnly();
- it.remove();
- } else {
- //create a new partition containing everything up to the line delimiter
- //and append that to the string buffer.
- String contentBefore = partitionText.substring(0, lastLineDelimiter);
- IOConsolePartition newPartition = new IOConsolePartition(inputStream, contentBefore);
- newPartition.setOffset(partition.getOffset());
- newPartition.setReadOnly();
- newPartition.clearBuffer();
- int index = partitions.indexOf(partition);
- partitions.add(index, newPartition);
- input.append(contentBefore);
- //delete everything that has been appended to the buffer.
- partition.delete(0, lastLineDelimiter);
- partition.setOffset(lastLineDelimiter + partition.getOffset());
- lastLineDelimiter = 0;
- }
- }
- if (input.length() > 0) {
- inputStream.appendData(input.toString());
- }
-
- }
- }
- }
-
- return new Region(event.fOffset, event.fText.length());
- }
-
- private void setUpdateInProgress(boolean b) {
- updateInProgress = b;
- }
-
- /**
- * A stream has been appended, add to pendingPartions list and schedule updateJob.
- * updateJob is scheduled with a slight delay, this allows the console to run the job
- * less frequently and update the document with a greater amount of data each time
- * the job is run
- * @param stream The stream that was written to.
- * @param s The string that should be appended to the document.
- */
- public void streamAppended(IOConsoleOutputStream stream, String s) throws IOException {
- if (document == null) {
- throw new IOException("Document is closed"); //$NON-NLS-1$
- }
- synchronized(pendingPartitions) {
- PendingPartition last = (PendingPartition) (pendingPartitions.size() > 0 ? pendingPartitions.get(pendingPartitions.size()-1) : null);
- if (last != null && last.stream == stream) {
- last.append(s);
- } else {
- pendingPartitions.add(new PendingPartition(stream, s));
- if (fBuffer > 1000) {
- queueJob.schedule();
- } else {
- queueJob.schedule(50);
- }
- }
-
- if (fBuffer > 160000) {
- if(Display.getCurrent() == null){
- try {
- pendingPartitions.wait();
- } catch (InterruptedException e) {
- }
- } else {
- /*
- * if we are in UI thread we cannot lock it, so process
- * queued output.
- */
- processQueue();
- }
- }
- }
- }
-
- /**
- * Holds data until updateJob can be run and the document can be updated.
- */
- private class PendingPartition {
- StringBuffer text = new StringBuffer(8192);
- IOConsoleOutputStream stream;
-
- PendingPartition(IOConsoleOutputStream stream, String text) {
- this.stream = stream;
- if (text != null) {
- append(text);
- }
- }
-
- void append(String moreText) {
- text.append(moreText);
- fBuffer += moreText.length();
- }
- }
-
- /**
- * Updates the document. Will append everything that is available before
- * finishing.
- */
- private class QueueProcessingJob extends UIJob {
-
- QueueProcessingJob() {
- super("IOConsole Updater"); //$NON-NLS-1$
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.core.internal.jobs.InternalJob#run(org.eclipse.core.runtime.IProgressMonitor)
- */
- public IStatus runInUIThread(IProgressMonitor monitor) {
- processQueue();
- return Status.OK_STATUS;
- }
-
- /*
- * Job will process as much as it can each time it's run, but it gets
- * scheduled everytime a PendingPartition is added to the list, meaning
- * that this job could get scheduled unnecessarily in cases of heavy output.
- * Note however, that schedule() will only reschedule a running/scheduled Job
- * once even if it's called many times.
- */
- public boolean shouldRun() {
- boolean shouldRun = connected && pendingPartitions != null && pendingPartitions.size() > 0;
- return shouldRun;
- }
- }
-
- void processQueue() {
- synchronized (overflowLock) {
- ArrayList pendingCopy = new ArrayList();
- StringBuffer buffer = null;
- boolean consoleClosed = false;
- synchronized(pendingPartitions) {
- pendingCopy.addAll(pendingPartitions);
- pendingPartitions.clear();
- fBuffer = 0;
- pendingPartitions.notifyAll();
- }
- // determine buffer size
- int size = 0;
- for (Iterator i = pendingCopy.iterator(); i.hasNext(); ) {
- PendingPartition pp = (PendingPartition) i.next();
- if (pp != consoleClosedPartition) {
- size+= pp.text.length();
- }
- }
- buffer = new StringBuffer(size);
- for (Iterator i = pendingCopy.iterator(); i.hasNext(); ) {
- PendingPartition pp = (PendingPartition) i.next();
- if (pp != consoleClosedPartition) {
- buffer.append(pp.text);
- } else {
- consoleClosed = true;
- }
- }
-
- if (connected) {
- setUpdateInProgress(true);
- updatePartitions = pendingCopy;
- firstOffset = document.getLength();
- try {
- if (buffer != null) {
- document.replace(firstOffset, 0, buffer.toString());
- }
- } catch (BadLocationException e) {
- }
- updatePartitions = null;
- setUpdateInProgress(false);
- }
- if (consoleClosed) {
- console.partitionerFinished();
- }
- checkBufferSize();
- }
-
- }
-
- /**
- * Job to trim the console document, runs in the UI thread.
- */
- private class TrimJob extends WorkbenchJob {
-
- /**
- * trims output up to the line containing the given offset,
- * or all output if -1.
- */
- private int truncateOffset;
-
- /**
- * Creates a new job to trim the buffer.
- */
- TrimJob() {
- super("Trim Job"); //$NON-NLS-1$
- setSystem(true);
- }
-
- /**
- * Sets the trim offset.
- *
- * @param offset trims output up to the line containing the given offset
- */
- public void setOffset(int offset) {
- truncateOffset = offset;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.progress.UIJob#runInUIThread(org.eclipse.core.runtime.IProgressMonitor)
- */
- public IStatus runInUIThread(IProgressMonitor monitor) {
- IJobManager jobManager = Job.getJobManager();
- try {
- jobManager.join(console, monitor);
- } catch (OperationCanceledException e1) {
- return Status.CANCEL_STATUS;
- } catch (InterruptedException e1) {
- return Status.CANCEL_STATUS;
- }
- if (document == null) {
- return Status.OK_STATUS;
- }
-
- int length = document.getLength();
- if (truncateOffset < length) {
- synchronized (overflowLock) {
- try {
- if (truncateOffset < 0) {
- // clear
- setUpdateInProgress(true);
- document.set(""); //$NON-NLS-1$
- setUpdateInProgress(false);
- partitions.clear();
- } else {
- // overflow
- int cutoffLine = document.getLineOfOffset(truncateOffset);
- int cutOffset = document.getLineOffset(cutoffLine);
-
-
- // set the new length of the first partition
- IOConsolePartition partition = (IOConsolePartition) getPartition(cutOffset);
- partition.setLength(partition.getOffset() + partition.getLength() - cutOffset);
-
- setUpdateInProgress(true);
- document.replace(0, cutOffset, ""); //$NON-NLS-1$
- setUpdateInProgress(false);
-
- //remove partitions and reset Partition offsets
- int index = partitions.indexOf(partition);
- for (int i = 0; i < index; i++) {
- partitions.remove(0);
- }
-
- int offset = 0;
- for (Iterator i = partitions.iterator(); i.hasNext(); ) {
- IOConsolePartition p = (IOConsolePartition) i.next();
- p.setOffset(offset);
- offset += p.getLength();
- }
- }
- } catch (BadLocationException e) {
- }
- }
- }
- return Status.OK_STATUS;
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.IConsoleDocumentPartitioner#isReadOnly(int)
- */
- public boolean isReadOnly(int offset) {
- return ((IOConsolePartition)getPartition(offset)).isReadOnly();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.IConsoleDocumentPartitioner#computeStyleRange(int, int)
- */
- public StyleRange[] getStyleRanges(int offset, int length) {
- if (!connected) {
- return new StyleRange[0];
- }
- IOConsolePartition[] computedPartitions = (IOConsolePartition[])computePartitioning(offset, length);
- StyleRange[] styles = new StyleRange[computedPartitions.length];
- for (int i = 0; i < computedPartitions.length; i++) {
- int rangeStart = Math.max(computedPartitions[i].getOffset(), offset);
- int rangeLength = computedPartitions[i].getLength();
- styles[i] = computedPartitions[i].getStyleRange(rangeStart, rangeLength);
- }
- return styles;
- }
-}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsoleViewer.java b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsoleViewer.java
deleted file mode 100644
index e686955f0..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsoleViewer.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.internal.console;
-
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.DocumentEvent;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IDocumentListener;
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.events.VerifyEvent;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.console.ConsolePlugin;
-import org.eclipse.ui.console.IConsoleDocumentPartitioner;
-import org.eclipse.ui.console.TextConsole;
-import org.eclipse.ui.console.TextConsoleViewer;
-
-/**
- * Viewer used to display an IOConsole
- *
- * @since 3.1
- */
-public class IOConsoleViewer extends TextConsoleViewer {
- /**
- * will always scroll with output if value is true.
- */
- private boolean fAutoScroll = true;
-
- private IDocumentListener fDocumentListener;
-
- public IOConsoleViewer(Composite parent, TextConsole console) {
- super(parent, console);
- }
-
- public boolean isAutoScroll() {
- return fAutoScroll;
- }
-
- public void setAutoScroll(boolean scroll) {
- fAutoScroll = scroll;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.text.TextViewer#handleVerifyEvent(org.eclipse.swt.events.VerifyEvent)
- */
- protected void handleVerifyEvent(VerifyEvent e) {
- IDocument doc = getDocument();
- String[] legalLineDelimiters = doc.getLegalLineDelimiters();
- String eventString = e.text;
- try {
- IConsoleDocumentPartitioner partitioner = (IConsoleDocumentPartitioner) doc.getDocumentPartitioner();
- if (!partitioner.isReadOnly(e.start)) {
- boolean isCarriageReturn = false;
- for (int i = 0; i < legalLineDelimiters.length; i++) {
- if (e.text.equals(legalLineDelimiters[i])) {
- isCarriageReturn = true;
- break;
- }
- }
-
- if (!isCarriageReturn) {
- super.handleVerifyEvent(e);
- return;
- }
- }
-
- int length = doc.getLength();
- if (e.start == length) {
- super.handleVerifyEvent(e);
- } else {
- try {
- doc.replace(length, 0, eventString);
- } catch (BadLocationException e1) {
- }
- e.doit = false;
- }
- } finally {
- StyledText text = (StyledText) e.widget;
- text.setCaretOffset(text.getCharCount());
- }
- }
-
- /**
- * makes the associated text widget uneditable.
- */
- public void setReadOnly() {
- ConsolePlugin.getStandardDisplay().asyncExec(new Runnable() {
- public void run() {
- StyledText text = getTextWidget();
- if (text != null && !text.isDisposed()) {
- text.setEditable(false);
- }
- }
- });
- }
-
- /**
- * @return <code>false</code> if text is editable
- */
- public boolean isReadOnly() {
- return !getTextWidget().getEditable();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.text.ITextViewer#setDocument(org.eclipse.jface.text.IDocument)
- */
- public void setDocument(IDocument document) {
- IDocument oldDocument= getDocument();
-
- super.setDocument(document);
-
- if (oldDocument != null) {
- oldDocument.removeDocumentListener(getDocumentListener());
- }
- if (document != null) {
- document.addDocumentListener(getDocumentListener());
- }
- }
-
- private IDocumentListener getDocumentListener() {
- if (fDocumentListener == null) {
- fDocumentListener= new IDocumentListener() {
- public void documentAboutToBeChanged(DocumentEvent event) {
- }
-
- public void documentChanged(DocumentEvent event) {
- if (fAutoScroll) {
- revealEndOfDocument();
- }
- }
- };
- }
- return fDocumentListener;
- }
-}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/OpenConsoleAction.java b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/OpenConsoleAction.java
deleted file mode 100644
index ab8d900a7..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/OpenConsoleAction.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.internal.console;
-
-import org.eclipse.core.runtime.CoreException;
-
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.ToolItem;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.ActionContributionItem;
-import org.eclipse.jface.action.IMenuCreator;
-import org.eclipse.jface.resource.ImageDescriptor;
-
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.activities.WorkbenchActivityHelper;
-import org.eclipse.ui.console.ConsolePlugin;
-import org.eclipse.ui.console.IConsoleFactory;
-
-/**
- * @since 3.1
- */
-public class OpenConsoleAction extends Action implements IMenuCreator {
-
- private ConsoleFactoryExtension[] fFactoryExtensions;
- private Menu fMenu;
-
- public OpenConsoleAction() {
- fFactoryExtensions = ((ConsoleManager)ConsolePlugin.getDefault().getConsoleManager()).getConsoleFactoryExtensions();
- setText(ConsoleMessages.OpenConsoleAction_0);
- setToolTipText(ConsoleMessages.OpenConsoleAction_1);
- setImageDescriptor(ConsolePluginImages.getImageDescriptor(IInternalConsoleConstants.IMG_ELCL_NEW_CON));
- setMenuCreator(this);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IConsoleHelpContextIds.CONSOLE_OPEN_CONSOLE_ACTION);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.IMenuCreator#dispose()
- */
- public void dispose() {
- fFactoryExtensions = null;
- }
-
- /*
- * @see org.eclipse.jface.action.Action#runWithEvent(org.eclipse.swt.widgets.Event)
- * @since 3.5
- */
- public void runWithEvent(Event event) {
- if (event.widget instanceof ToolItem) {
- ToolItem toolItem= (ToolItem) event.widget;
- Control control= toolItem.getParent();
- Menu menu= getMenu(control);
-
- Rectangle bounds= toolItem.getBounds();
- Point topLeft= new Point(bounds.x, bounds.y + bounds.height);
- menu.setLocation(control.toDisplay(topLeft));
- menu.setVisible(true);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.IMenuCreator#getMenu(org.eclipse.swt.widgets.Control)
- */
- public Menu getMenu(Control parent) {
- if (fMenu != null) {
- fMenu.dispose();
- }
-
- fMenu= new Menu(parent);
- int accel = 1;
- for (int i = 0; i < fFactoryExtensions.length; i++) {
- ConsoleFactoryExtension extension = fFactoryExtensions[i];
- if (!WorkbenchActivityHelper.filterItem(extension) && extension.isEnabled()) {
- String label = extension.getLabel();
- ImageDescriptor image = extension.getImageDescriptor();
- addActionToMenu(fMenu, new ConsoleFactoryAction(label, image, extension), accel);
- accel++;
- }
- }
- return fMenu;
- }
-
- private void addActionToMenu(Menu parent, Action action, int accelerator) {
- if (accelerator < 10) {
- StringBuffer label= new StringBuffer();
- //add the numerical accelerator
- label.append('&');
- label.append(accelerator);
- label.append(' ');
- label.append(action.getText());
- action.setText(label.toString());
- }
-
- ActionContributionItem item= new ActionContributionItem(action);
- item.fill(parent, -1);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.IMenuCreator#getMenu(org.eclipse.swt.widgets.Menu)
- */
- public Menu getMenu(Menu parent) {
- return null;
- }
-
- private class ConsoleFactoryAction extends Action {
-
- private ConsoleFactoryExtension fConfig;
- private IConsoleFactory fFactory;
-
- public ConsoleFactoryAction(String label, ImageDescriptor image, ConsoleFactoryExtension extension) {
- setText(label);
- if (image != null) {
- setImageDescriptor(image);
- }
- fConfig = extension;
- }
-
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.IAction#run()
- */
- public void run() {
- try {
- if (fFactory == null) {
- fFactory = fConfig.createFactory();
- }
-
- fFactory.openConsole();
- } catch (CoreException e) {
- ConsolePlugin.log(e);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.IAction#runWithEvent(org.eclipse.swt.widgets.Event)
- */
- public void runWithEvent(Event event) {
- run();
- }
- }
-}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/PatternMatchListener.java b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/PatternMatchListener.java
deleted file mode 100644
index eab75136a..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/PatternMatchListener.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.internal.console;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.ui.console.IPatternMatchListener;
-import org.eclipse.ui.console.IPatternMatchListenerDelegate;
-import org.eclipse.ui.console.PatternMatchEvent;
-import org.eclipse.ui.console.TextConsole;
-
-public class PatternMatchListener implements IPatternMatchListener {
-
- private PatternMatchListenerExtension fExtension;
- private IPatternMatchListenerDelegate fDelegate;
-
- public PatternMatchListener(PatternMatchListenerExtension extension) throws CoreException {
- fExtension = extension;
- fDelegate = fExtension.createDelegate();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.IPatternMatchListener#getPattern()
- */
- public String getPattern() {
- return fExtension.getPattern();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.IPatternMatchListener#getCompilerFlags()
- */
- public int getCompilerFlags() {
- return fExtension.getCompilerFlags();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.IPatternMatchListener#matchFound(org.eclipse.ui.console.PatternMatchEvent)
- */
- public void matchFound(PatternMatchEvent event) {
- fDelegate.matchFound(event);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.IPatternMatchListenerDelegate#connect(org.eclipse.ui.console.TextConsole)
- */
- public void connect(TextConsole console) {
- fDelegate.connect(console);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.IPatternMatchListener#disconnect()
- */
- public void disconnect() {
- fDelegate.disconnect();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.IPatternMatchListener#getQuickPattern()
- */
- public String getLineQualifier() {
- return fExtension.getQuickPattern();
- }
-
-}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/PatternMatchListenerExtension.java b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/PatternMatchListenerExtension.java
deleted file mode 100644
index b4081dfe6..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/PatternMatchListenerExtension.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.internal.console;
-
-import java.lang.reflect.Field;
-
-import org.eclipse.core.expressions.EvaluationContext;
-import org.eclipse.core.expressions.EvaluationResult;
-import org.eclipse.core.expressions.Expression;
-import org.eclipse.core.expressions.ExpressionConverter;
-import org.eclipse.core.expressions.ExpressionTagNames;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.variables.VariablesPlugin;
-import org.eclipse.ui.IPluginContribution;
-import org.eclipse.ui.console.ConsolePlugin;
-import org.eclipse.ui.console.IConsole;
-import org.eclipse.ui.console.IPatternMatchListenerDelegate;
-
-import com.ibm.icu.text.MessageFormat;
-
-public class PatternMatchListenerExtension implements IPluginContribution {
-
- private IConfigurationElement fConfig;
- private Expression fEnablementExpression;
- private String fPattern;
- private String fQualifier;
- private int fFlags = -1;
-
- public PatternMatchListenerExtension(IConfigurationElement extension) {
- fConfig = extension;
- }
-
- /*
- * returns the integer value of the flags defined in java.util.regex.Pattern.
- * Both <code>Pattern.MULTILINE</code> and <code>MULTILINE</code> will return
- * the same value.
- */
- public int parseFlags(String flagsElement) {
- int val = 0;
- if (flagsElement == null) {
- return val;
- }
-
- try {
- flagsElement = flagsElement.replaceAll("Pattern.", ""); //$NON-NLS-1$ //$NON-NLS-2$
- String[] tokens = flagsElement.split("\\s\\|\\s"); //$NON-NLS-1$
- Class clazz = Class.forName("java.util.regex.Pattern"); //$NON-NLS-1$
-
- for (int i = 0; i < tokens.length; i++) {
- Field field = clazz.getDeclaredField(tokens[i]);
- val |= field.getInt(null);
- }
- } catch (ClassNotFoundException e) {
- ConsolePlugin.log(e);
- } catch (NoSuchFieldException e) {
- ConsolePlugin.log(e);
- } catch (IllegalAccessException e) {
- ConsolePlugin.log(e);
- }
- return val;
- }
-
- public boolean isEnabledFor(IConsole console) throws CoreException {
- EvaluationContext context = new EvaluationContext(null, console);
- EvaluationResult evaluationResult = getEnablementExpression().evaluate(context);
- return evaluationResult == EvaluationResult.TRUE;
- }
-
- public IPatternMatchListenerDelegate createDelegate() throws CoreException {
- return (IPatternMatchListenerDelegate) fConfig.createExecutableExtension("class"); //$NON-NLS-1$
- }
-
- public Expression getEnablementExpression() throws CoreException {
- if (fEnablementExpression == null) {
- IConfigurationElement[] elements = fConfig.getChildren(ExpressionTagNames.ENABLEMENT);
- if (elements.length == 0) {
- String message = MessageFormat.format("{0} " +getLocalId() + " {1} " + getPluginId() + " {2}", new String[] {ConsoleMessages.PatternMatchListenerExtension_3,ConsoleMessages.PatternMatchListenerExtension_4,ConsoleMessages.PatternMatchListenerExtension_5}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- ConsolePlugin.log(new Status(IStatus.WARNING, ConsolePlugin.getUniqueIdentifier(), IStatus.OK, message, null));
- }
- IConfigurationElement enablement = elements.length > 0 ? elements[0] : null;
-
- if (enablement != null) {
- fEnablementExpression = ExpressionConverter.getDefault().perform(enablement);
- }
- }
- return fEnablementExpression;
- }
-
- /*
- * returns the regular expression to be matched.
- */
- public String getPattern() {
- if (fPattern == null) {
- fPattern = fConfig.getAttribute("regex"); //$NON-NLS-1$
- try {
- fPattern = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(fPattern, false);
- } catch (CoreException e) {
- ConsolePlugin.log(e);
- }
- }
- return fPattern;
- }
-
- /*
- * returns the flags to be used by <code>Pattern.compile(pattern, flags)</code>
- */
- public int getCompilerFlags() {
- if(fFlags < 0) {
- String flagsAttribute = fConfig.getAttribute("flags"); //$NON-NLS-1$
- fFlags = parseFlags(flagsAttribute);
- }
- return fFlags;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IPluginContribution#getLocalId()
- */
- public String getLocalId() {
- return fConfig.getAttribute("id"); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IPluginContribution#getPluginId()
- */
- public String getPluginId() {
- return fConfig.getContributor().getName();
- }
-
- public String getQuickPattern() {
- if (fQualifier == null) {
- fQualifier = fConfig.getAttribute("qualifier"); //$NON-NLS-1$
- try {
- if (fQualifier != null) {
- fQualifier = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(fQualifier, false);
- }
- } catch (CoreException e) {
- ConsolePlugin.log(e);
- }
- }
- return fQualifier;
- }
-}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/PinConsoleAction.java b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/PinConsoleAction.java
deleted file mode 100644
index 61d307407..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/PinConsoleAction.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.internal.console;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.console.IConsoleView;
-import org.eclipse.ui.texteditor.IUpdate;
-
-/**
- * Pins the currently visible console in a console view.
- */
-public class PinConsoleAction extends Action implements IUpdate {
-
- private IConsoleView fView = null;
-
- /**
- * Constructs a 'pin console' action
- */
- public PinConsoleAction(IConsoleView view) {
- super(ConsoleMessages.PinConsoleAction_0, IAction.AS_CHECK_BOX);
- setToolTipText(ConsoleMessages.PinConsoleAction_1);
- setImageDescriptor(ConsolePluginImages.getImageDescriptor(IInternalConsoleConstants.IMG_ELCL_PIN));
- setDisabledImageDescriptor(ConsolePluginImages.getImageDescriptor(IInternalConsoleConstants.IMG_DLCL_PIN));
- setHoverImageDescriptor(ConsolePluginImages.getImageDescriptor(IInternalConsoleConstants.IMG_LCL_PIN));
- PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IConsoleHelpContextIds.CONSOLE_PIN_CONSOLE_ACITON);
- fView = view;
- update();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.IAction#run()
- */
- public void run() {
- fView.setPinned(isChecked());
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.texteditor.IUpdate#update()
- */
- public void update() {
- setEnabled(fView.getConsole() != null);
- setChecked(fView.isPinned());
- }
-}
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
deleted file mode 100644
index e0b2ad268..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ScrollLockAction.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.internal.console;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.console.IConsoleView;
-
-/**
- * Toggles console auto-scroll
- *
- * @since 3.1
- */
-public class ScrollLockAction extends Action {
-
- private IConsoleView fConsoleView;
-
- public ScrollLockAction(IConsoleView consoleView) {
- super(ConsoleMessages.ScrollLockAction_0);
- fConsoleView = consoleView;
-
- setToolTipText(ConsoleMessages.ScrollLockAction_1);
- setHoverImageDescriptor(ConsolePluginImages.getImageDescriptor(IInternalConsoleConstants.IMG_LCL_LOCK));
- setDisabledImageDescriptor(ConsolePluginImages.getImageDescriptor(IInternalConsoleConstants.IMG_DLCL_LOCK));
- setImageDescriptor(ConsolePluginImages.getImageDescriptor(IInternalConsoleConstants.IMG_ELCL_LOCK));
- PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IConsoleHelpContextIds.CONSOLE_SCROLL_LOCK_ACTION);
- boolean checked = fConsoleView.getScrollLock();
- setChecked(checked);
- }
-
- /**
- * @see org.eclipse.jface.action.IAction#run()
- */
- public void run() {
- fConsoleView.setScrollLock(isChecked());
- }
-
- public void dispose() {
- fConsoleView = null;
- }
-
-}
-
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ShowConsoleAction.java b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ShowConsoleAction.java
deleted file mode 100644
index ed846b0cf..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ShowConsoleAction.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.internal.console;
-
-import org.eclipse.jface.action.Action;
-
-import org.eclipse.ui.console.IConsole;
-import org.eclipse.ui.console.IConsoleView;
-
-/**
- * Shows a specific console in the console view
- */
-public class ShowConsoleAction extends Action {
-
- private IConsole fConsole;
- private IConsoleView fView;
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.IAction#run()
- */
- public void run() {
- showConsole(fConsole, fView);
- }
-
- /**
- * Shows the given console in the given console view.
- *
- * @param console the console to show
- * @param consoleView the console view
- */
- public static void showConsole(IConsole console, IConsoleView consoleView) {
- if (!console.equals(consoleView.getConsole())) {
- boolean pinned = consoleView.isPinned();
- if (pinned) {
- consoleView.setPinned(false);
- }
- consoleView.display(console);
- if (pinned) {
- consoleView.setPinned(true);
- }
- }
- }
-
- /**
- * Constructs an action to display the given console.
- *
- * @param view the console view in which the given console is contained
- * @param console the console
- */
- public ShowConsoleAction(IConsoleView view, IConsole console) {
- super(console.getName(), AS_RADIO_BUTTON);
- fConsole = console;
- fView = view;
- setImageDescriptor(console.getImageDescriptor());
- }
-}

Back to the top