Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.ui.console')
-rw-r--r--org.eclipse.ui.console/.classpath7
-rw-r--r--org.eclipse.ui.console/.cvsignore1
-rw-r--r--org.eclipse.ui.console/.options1
-rw-r--r--org.eclipse.ui.console/.project26
-rw-r--r--org.eclipse.ui.console/.settings/org.eclipse.jdt.core.prefs69
-rw-r--r--org.eclipse.ui.console/.settings/org.eclipse.pde.prefs14
-rw-r--r--org.eclipse.ui.console/about.html30
-rw-r--r--org.eclipse.ui.console/build.properties19
-rw-r--r--org.eclipse.ui.console/hglegal2003.htm14
-rw-r--r--org.eclipse.ui.console/icons/full/clcl16/clear_co.gifbin545 -> 0 bytes
-rw-r--r--org.eclipse.ui.console/icons/full/clcl16/lock_co.gifbin626 -> 0 bytes
-rw-r--r--org.eclipse.ui.console/icons/full/clcl16/pin.gifbin358 -> 0 bytes
-rw-r--r--org.eclipse.ui.console/icons/full/cview16/console_view.gifbin582 -> 0 bytes
-rw-r--r--org.eclipse.ui.console/icons/full/dlcl16/clear_co.gifbin328 -> 0 bytes
-rw-r--r--org.eclipse.ui.console/icons/full/dlcl16/lock_co.gifbin588 -> 0 bytes
-rw-r--r--org.eclipse.ui.console/icons/full/dlcl16/pin.gifbin223 -> 0 bytes
-rw-r--r--org.eclipse.ui.console/icons/full/dlcl16/rem_co.gifbin159 -> 0 bytes
-rw-r--r--org.eclipse.ui.console/icons/full/elcl16/clear_co.gifbin545 -> 0 bytes
-rw-r--r--org.eclipse.ui.console/icons/full/elcl16/lock_co.gifbin626 -> 0 bytes
-rw-r--r--org.eclipse.ui.console/icons/full/elcl16/new_con.gifbin612 -> 0 bytes
-rw-r--r--org.eclipse.ui.console/icons/full/elcl16/pin.gifbin358 -> 0 bytes
-rw-r--r--org.eclipse.ui.console/icons/full/elcl16/rem_co.gifbin163 -> 0 bytes
-rw-r--r--org.eclipse.ui.console/icons/full/eview16/console_view.gifbin582 -> 0 bytes
-rw-r--r--org.eclipse.ui.console/ngibmcpy2003.gifbin1101 -> 0 bytes
-rw-r--r--org.eclipse.ui.console/plugin.properties24
-rw-r--r--org.eclipse.ui.console/plugin.xml76
-rw-r--r--org.eclipse.ui.console/schema/consoleFactories.exsd130
-rw-r--r--org.eclipse.ui.console/schema/consolePageParticipants.exsd119
-rw-r--r--org.eclipse.ui.console/schema/consolePatternMatchListeners.exsd150
-rw-r--r--org.eclipse.ui.console/scripts/exportplugin.xml35
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/AbstractConsole.java321
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/ConsolePlugin.java138
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/IConsole.java98
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/IConsoleConstants.java154
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/IConsoleDocumentPartitioner.java48
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/IConsoleFactory.java48
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/IConsoleListener.java39
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/IConsoleManager.java100
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/IConsolePageParticipant.java71
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/IConsoleView.java94
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/IHyperlink.java37
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/IOConsole.java254
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/IOConsoleInputStream.java274
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/IOConsoleOutputStream.java224
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/IPatternMatchListener.java87
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/IPatternMatchListenerDelegate.java46
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/MessageConsole.java77
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/MessageConsoleStream.java80
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/PatternMatchEvent.java70
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsole.java494
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsolePage.java411
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsoleViewer.java575
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/actions/ClearOutputAction.java96
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/actions/CloseConsoleAction.java36
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/actions/TextViewerAction.java84
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/actions/TextViewerGotoLineAction.java121
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/actions/package.html20
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/package.html29
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleDocument.java116
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleDocumentAdapter.java352
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleDropDownAction.java157
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleFactoryExtension.java124
-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.java386
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleMessages.java36
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleMessages.properties68
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsolePageParticipantExtension.java69
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsolePatternMatcher.java307
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsolePluginImages.java170
-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.java639
-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.java54
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IConsoleHelpContextIds.java37
-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.java137
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsolePartition.java165
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsolePartitioner.java669
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsoleViewer.java138
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/OpenConsoleAction.java128
-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.java128
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/PinConsoleAction.java52
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ScrollLockAction.java40
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ShowConsoleAction.java54
86 files changed, 0 insertions, 9223 deletions
diff --git a/org.eclipse.ui.console/.classpath b/org.eclipse.ui.console/.classpath
deleted file mode 100644
index 065ac06e1..000000000
--- a/org.eclipse.ui.console/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/org.eclipse.ui.console/.cvsignore b/org.eclipse.ui.console/.cvsignore
deleted file mode 100644
index ba077a403..000000000
--- a/org.eclipse.ui.console/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-bin
diff --git a/org.eclipse.ui.console/.options b/org.eclipse.ui.console/.options
deleted file mode 100644
index d7752adbc..000000000
--- a/org.eclipse.ui.console/.options
+++ /dev/null
@@ -1 +0,0 @@
-# Debugging options for the org.eclipse.ui.console plugin.
diff --git a/org.eclipse.ui.console/.project b/org.eclipse.ui.console/.project
deleted file mode 100644
index aa92a70c1..000000000
--- a/org.eclipse.ui.console/.project
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.ui.console</name>
- <comment></comment>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.pde.PluginNature</nature>
- </natures>
-</projectDescription>
diff --git a/org.eclipse.ui.console/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.ui.console/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index e488162ed..000000000
--- a/org.eclipse.ui.console/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,69 +0,0 @@
-#Mon Nov 01 18:52:47 GMT-08:00 2004
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled
-org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.debug.lineNumber=generate
-org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
-org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
-org.eclipse.jdt.core.compiler.problem.unsafeTypeOperation=warning
-org.eclipse.jdt.core.compiler.problem.forbiddenReference=ignore
-org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
-org.eclipse.jdt.core.compiler.problem.unusedImport=warning
-org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
-org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
-org.eclipse.jdt.core.builder.invalidClasspath=abort
-org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch
-org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
-org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
-org.eclipse.jdt.core.compiler.debug.localVariable=generate
-org.eclipse.jdt.core.compiler.problem.deprecation=warning
-org.eclipse.jdt.core.compiler.source=1.3
-org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore
-org.eclipse.jdt.core.compiler.problem.unusedParameter=warning
-org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore
-org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
-org.eclipse.jdt.core.compiler.compliance=1.4
-org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
-org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
-org.eclipse.jdt.core.builder.cleanOutputFolder=clean
-org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
-org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
-org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=enabled
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
-org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
-org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
-org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
-org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
-org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
-org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private
-org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
-org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
-org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
-org.eclipse.jdt.core.incompatibleJDKLevel=ignore
-eclipse.preferences.version=1
-org.eclipse.jdt.core.circularClasspath=error
-org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=enabled
-org.eclipse.jdt.core.compiler.maxProblemPerUnit=100
-org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
-org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=private
-org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
-org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
-org.eclipse.jdt.core.compiler.debug.sourceFile=generate
-org.eclipse.jdt.core.compiler.doc.comment.support=disabled
-org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
-org.eclipse.jdt.core.incompleteClasspath=error
-org.eclipse.jdt.core.compiler.problem.invalidJavadoc=ignore
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=enabled
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
-org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
-org.eclipse.jdt.core.builder.duplicateResourceTask=warning
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
diff --git a/org.eclipse.ui.console/.settings/org.eclipse.pde.prefs b/org.eclipse.ui.console/.settings/org.eclipse.pde.prefs
deleted file mode 100644
index de0a1d23a..000000000
--- a/org.eclipse.ui.console/.settings/org.eclipse.pde.prefs
+++ /dev/null
@@ -1,14 +0,0 @@
-#Wed Nov 24 22:35:45 GMT-08:00 2004
-compilers.p.unused-element-or-attribute=1
-compilers.p.unresolved-ex-points=0
-compilers.p.deprecated=1
-compilers.p.unknown-element=0
-compilers.p.unknown-resource=1
-compilers.p.unknown-class=1
-compilers.p.unknown-attribute=0
-compilers.p.no-required-att=0
-eclipse.preferences.version=1
-compilers.p.unresolved-import=0
-compilers.p.not-externalized-att=1
-compilers.p.illegal-att-value=0
-compilers.use-project=true
diff --git a/org.eclipse.ui.console/about.html b/org.eclipse.ui.console/about.html
deleted file mode 100644
index 6b68e1890..000000000
--- a/org.eclipse.ui.console/about.html
+++ /dev/null
@@ -1,30 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
-<html>
-<head>
-<title>About</title>
-<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1">
-</head>
-<body lang="EN-US">
-<h2>About This Content</h2>
-
-<p>8th September, 2003</p>
-<h3>License</h3>
-<p>Eclipse.org makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the
-Common Public License Version 1.0 (&quot;CPL&quot;). A copy of the CPL is available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>.
-For purposes of the CPL, &quot;Program&quot; will mean the Content.</p>
-
-<h3>Contributions</h3>
-
-<p>If this Content is licensed to you under the terms and conditions of the CPL, any Contributions, as defined in the CPL, uploaded, submitted, or otherwise
-made available to Eclipse.org, members of Eclipse.org and/or the host of Eclipse.org web site, by you that relate to such
-Content are provided under the terms and conditions of the CPL and can be made available to others under the terms of the CPL.</p>
-
-<p>If this Content is licensed to you under license terms and conditions other than the CPL (&quot;Other License&quot;), any modifications, enhancements and/or
-other code and/or documentation (&quot;Modifications&quot;) uploaded, submitted, or otherwise made available to Eclipse.org, members of Eclipse.org and/or the
-host of Eclipse.org, by you that relate to such Content are provided under terms and conditions of the Other License and can be made available
-to others under the terms of the Other License. In addition, with regard to Modifications for which you are the copyright holder, you are also
-providing the Modifications under the terms and conditions of the CPL and such Modifications can be made available to others under the terms of
-the CPL.</p>
-
-</body>
-</html> \ No newline at end of file
diff --git a/org.eclipse.ui.console/build.properties b/org.eclipse.ui.console/build.properties
deleted file mode 100644
index d166e5892..000000000
--- a/org.eclipse.ui.console/build.properties
+++ /dev/null
@@ -1,19 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2003 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Common Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/cpl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-bin.includes = icons/,\
- .options,\
- plugin.xml,\
- plugin.properties,\
- *.jar,\
- about.html
-
-source.console.jar src/
-src.includes=about.html
diff --git a/org.eclipse.ui.console/hglegal2003.htm b/org.eclipse.ui.console/hglegal2003.htm
deleted file mode 100644
index 47c8540c8..000000000
--- a/org.eclipse.ui.console/hglegal2003.htm
+++ /dev/null
@@ -1,14 +0,0 @@
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <LINK REL="stylesheet" HREF="book.css" CHARSET="ISO-8859-1" TYPE="text/css">
- <title>Legal Notices</title>
-</head>
-<body>
-
-<h3>
-<a NAME="Notices"></a>Notices</h3>
-(c) Copyright (c) 2000, 2003 IBM Corporation and others. All Rights Reserved.
-</body>
-</html>
diff --git a/org.eclipse.ui.console/icons/full/clcl16/clear_co.gif b/org.eclipse.ui.console/icons/full/clcl16/clear_co.gif
deleted file mode 100644
index 6bc10f9d0..000000000
--- a/org.eclipse.ui.console/icons/full/clcl16/clear_co.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.ui.console/icons/full/clcl16/lock_co.gif b/org.eclipse.ui.console/icons/full/clcl16/lock_co.gif
deleted file mode 100644
index 68fd6cf39..000000000
--- a/org.eclipse.ui.console/icons/full/clcl16/lock_co.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.ui.console/icons/full/clcl16/pin.gif b/org.eclipse.ui.console/icons/full/clcl16/pin.gif
deleted file mode 100644
index ec50b70fa..000000000
--- a/org.eclipse.ui.console/icons/full/clcl16/pin.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.ui.console/icons/full/cview16/console_view.gif b/org.eclipse.ui.console/icons/full/cview16/console_view.gif
deleted file mode 100644
index a598f6082..000000000
--- a/org.eclipse.ui.console/icons/full/cview16/console_view.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.ui.console/icons/full/dlcl16/clear_co.gif b/org.eclipse.ui.console/icons/full/dlcl16/clear_co.gif
deleted file mode 100644
index 9ff641606..000000000
--- a/org.eclipse.ui.console/icons/full/dlcl16/clear_co.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.ui.console/icons/full/dlcl16/lock_co.gif b/org.eclipse.ui.console/icons/full/dlcl16/lock_co.gif
deleted file mode 100644
index b77647893..000000000
--- a/org.eclipse.ui.console/icons/full/dlcl16/lock_co.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.ui.console/icons/full/dlcl16/pin.gif b/org.eclipse.ui.console/icons/full/dlcl16/pin.gif
deleted file mode 100644
index 61615d57d..000000000
--- a/org.eclipse.ui.console/icons/full/dlcl16/pin.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.ui.console/icons/full/dlcl16/rem_co.gif b/org.eclipse.ui.console/icons/full/dlcl16/rem_co.gif
deleted file mode 100644
index 559e46298..000000000
--- a/org.eclipse.ui.console/icons/full/dlcl16/rem_co.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.ui.console/icons/full/elcl16/clear_co.gif b/org.eclipse.ui.console/icons/full/elcl16/clear_co.gif
deleted file mode 100644
index 6bc10f9d0..000000000
--- a/org.eclipse.ui.console/icons/full/elcl16/clear_co.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.ui.console/icons/full/elcl16/lock_co.gif b/org.eclipse.ui.console/icons/full/elcl16/lock_co.gif
deleted file mode 100644
index 68fd6cf39..000000000
--- a/org.eclipse.ui.console/icons/full/elcl16/lock_co.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.ui.console/icons/full/elcl16/new_con.gif b/org.eclipse.ui.console/icons/full/elcl16/new_con.gif
deleted file mode 100644
index 7aea894d0..000000000
--- a/org.eclipse.ui.console/icons/full/elcl16/new_con.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.ui.console/icons/full/elcl16/pin.gif b/org.eclipse.ui.console/icons/full/elcl16/pin.gif
deleted file mode 100644
index ec50b70fa..000000000
--- a/org.eclipse.ui.console/icons/full/elcl16/pin.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.ui.console/icons/full/elcl16/rem_co.gif b/org.eclipse.ui.console/icons/full/elcl16/rem_co.gif
deleted file mode 100644
index 2cd9c5444..000000000
--- a/org.eclipse.ui.console/icons/full/elcl16/rem_co.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.ui.console/icons/full/eview16/console_view.gif b/org.eclipse.ui.console/icons/full/eview16/console_view.gif
deleted file mode 100644
index a598f6082..000000000
--- a/org.eclipse.ui.console/icons/full/eview16/console_view.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.ui.console/ngibmcpy2003.gif b/org.eclipse.ui.console/ngibmcpy2003.gif
deleted file mode 100644
index c786e43e1..000000000
--- a/org.eclipse.ui.console/ngibmcpy2003.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.ui.console/plugin.properties b/org.eclipse.ui.console/plugin.properties
deleted file mode 100644
index 1c77c1e9e..000000000
--- a/org.eclipse.ui.console/plugin.properties
+++ /dev/null
@@ -1,24 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2004 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Common Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/cpl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-
-pluginName=Console
-providerName=Eclipse.org
-ConsoleView.name=Console
-
-ViewCommand.consoleView.name=Console
-ViewCommand.consoleView.description=Show the Console view
-
-ConsolePatternMatchListenerName= Console Pattern Match Listeners
-ConsolePageParticipantName= Console Page Participants
-
-ConsoleFactoryName= Console Factories
-
-consoleViewConsoleFactory.name=New Console View \ No newline at end of file
diff --git a/org.eclipse.ui.console/plugin.xml b/org.eclipse.ui.console/plugin.xml
deleted file mode 100644
index c842c0d33..000000000
--- a/org.eclipse.ui.console/plugin.xml
+++ /dev/null
@@ -1,76 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<plugin
- id="org.eclipse.ui.console"
- name="%pluginName"
- version="3.1.0"
- provider-name="%providerName"
- class="org.eclipse.ui.console.ConsolePlugin">
-
- <runtime>
- <library name="console.jar">
- <export name="*"/>
- </library>
- </runtime>
- <requires>
- <import plugin="org.eclipse.ui"/>
- <import plugin="org.eclipse.jface.text"/>
- <import plugin="org.eclipse.ui.workbench.texteditor"/>
- <import plugin="org.eclipse.core.runtime"/>
- <import plugin="org.eclipse.core.expressions"/>
- </requires>
- <extension-point id="consolePatternMatchListeners" name="%ConsolePatternMatchListenerName" schema="schema/consolePatternMatchListeners.exsd"/>
- <extension-point id="consolePageParticipants" name="%ConsolePageParticipantName" schema="schema/consolePageParticipants.exsd"/>
- <extension-point id="consoleFactories" name="%ConsoleFactoryName" schema="schema/consoleFactories.exsd"/>
-
-
- <extension
- point="org.eclipse.ui.views">
- <view
- allowMultiple="true"
- class="org.eclipse.ui.internal.console.ConsoleView"
- icon="icons/full/cview16/console_view.gif"
- category="org.eclipse.ui"
- name="%ConsoleView.name"
- id="org.eclipse.ui.console.ConsoleView">
- </view>
- </extension>
-<!-- commands and their bindings
-NOTE:
-M1 = CTRL/COMMAND
-M2 = SHIFT
-M3 = ALT
-M4 = Platform-specific fourth key
--->
- <extension
- point="org.eclipse.ui.commands">
- <command
- name="%ViewCommand.consoleView.name"
- description="%ViewCommand.consoleView.description"
- categoryId="org.eclipse.ui.category.views"
- id="org.eclipse.ui.console.ConsoleView">
- </command>
- <keyBinding
- keySequence="M3+M2+Q C"
- contextId="org.eclipse.ui.globalScope"
- commandId="org.eclipse.ui.console.ConsoleView"
- keyConfigurationId="org.eclipse.ui.defaultAcceleratorConfiguration">
- </keyBinding>
- </extension>
- <extension
- point="org.eclipse.core.expressions.propertyTesters">
- <propertyTester
- namespace="org.eclipse.ui.console"
- type="org.eclipse.ui.console.IConsole"
- class="org.eclipse.ui.internal.console.ConsoleTypePropertyTester"
- properties="consoleTypeTest"
- id="org.eclipse.ui.console.ConsoleTypePropertyTester"/>
- </extension>
- <extension
- point="org.eclipse.ui.console.consoleFactories">
- <consoleFactory
- label="%consoleViewConsoleFactory.name"
- class="org.eclipse.ui.internal.console.ConsoleViewConsoleFactory"/>
- </extension>
-
-</plugin>
diff --git a/org.eclipse.ui.console/schema/consoleFactories.exsd b/org.eclipse.ui.console/schema/consoleFactories.exsd
deleted file mode 100644
index e6560040d..000000000
--- a/org.eclipse.ui.console/schema/consoleFactories.exsd
+++ /dev/null
@@ -1,130 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.ui.console">
-<annotation>
- <appInfo>
- <meta.schema plugin="org.eclipse.ui.console" id="consoleFactories" name="Console Factories"/>
- </appInfo>
- <documentation>
- A console factory creates or activates a console, and appears as action in the console view.
- </documentation>
- </annotation>
-
- <element name="extension">
- <complexType>
- <sequence>
- <element ref="consoleFactory"/>
- </sequence>
- <attribute name="point" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="consoleFactory">
- <complexType>
- <attribute name="label" type="string" use="required">
- <annotation>
- <documentation>
- action label to appear in menu
- </documentation>
- <appInfo>
- <meta.attribute translatable="true"/>
- </appInfo>
- </annotation>
- </attribute>
- <attribute name="icon" type="string">
- <annotation>
- <documentation>
- optional plug-in relative path to an icon to appear with the action
- </documentation>
- </annotation>
- </attribute>
- <attribute name="class" type="string" use="required">
- <annotation>
- <documentation>
- class implementing &lt;code&gt;org.eclipse.ui.console.IConsoleFactory&lt;/code&gt; that will be called when the associated action is invoked
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appInfo>
- <meta.section type="since"/>
- </appInfo>
- <documentation>
- 3.1
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="examples"/>
- </appInfo>
- <documentation>
- The following is an example of a console factory extension point:
-&lt;pre&gt;
-&lt;extension point=&quot;org.eclipse.ui.console.consoleFactories&quot;&gt;
- &lt;consoleFactory
- label=&quot;Command Console&quot;
- class=&quot;com.example.CommandConsoleFactory&quot;
- icon=&quot;icons/cmd_console.gif&quot;&gt;
- &lt;/consoleFactory&gt;
-&lt;/extension&gt;
-&lt;/pre&gt;
-This extension will cause an entry to appear in the console view&apos;s &lt;b&gt;Open Console&lt;/b&gt; drop-down menu labelled &lt;b&gt;Command Console&lt;/b&gt; with the specified icon. When the action is invoked by a user, the method &lt;b&gt;openConsole()&lt;/b&gt; on the class &lt;b&gt;com.example.CommandConsoleFactory&lt;/b&gt; will be called. The factory can the decide to create a new console or activate an existing console.
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="apiInfo"/>
- </appInfo>
- <documentation>
- Value of the attribute &lt;b&gt;class&lt;/b&gt; must be a fully qualified name of a Java class that implements the interface &lt;b&gt;org.eclipse.ui.console.IConsoleFactory&lt;/b&gt;.
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="implementation"/>
- </appInfo>
- <documentation>
- The console plug-in provides a console factory to open a new console view.
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="copyright"/>
- </appInfo>
- <documentation>
- Copyright (c) 2004 IBM Corporation and others.&lt;br&gt;
-All rights reserved. This program and the accompanying materials are made
-available under the terms of the Common Public License v1.0 which
-accompanies this distribution, and is available at
-&lt;a href=&quot;http://www.eclipse.org/legal/cpl-v10.html&quot;&gt;http://www.eclipse.org/legal/cpl-v10.html&lt;/a&gt;
- </documentation>
- </annotation>
-
-</schema>
diff --git a/org.eclipse.ui.console/schema/consolePageParticipants.exsd b/org.eclipse.ui.console/schema/consolePageParticipants.exsd
deleted file mode 100644
index 905d92f15..000000000
--- a/org.eclipse.ui.console/schema/consolePageParticipants.exsd
+++ /dev/null
@@ -1,119 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.ui.console">
-<annotation>
- <appInfo>
- <meta.schema plugin="org.eclipse.ui.console" id="consolePageParticipants" name="Console Page Participants"/>
- </appInfo>
- <documentation>
- This extension point provides a mechanism for contributing a console page participant. The page participant will be able to modify the console&apos;s context menu and tool bar.
- </documentation>
- </annotation>
-
- <include schemaLocation="schema://org.eclipse.core.expressions/schema/expressionLanguage.exsd"/>
-
- <element name="extension">
- <complexType>
- <sequence>
- <element ref="consolePageParticipant"/>
- </sequence>
- <attribute name="point" type="string" use="required">
- <annotation>
- <documentation>
- a fully qualified identifier of the target extension point
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
- an optional identifier of the extension instance
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
- an optional name of the extension instance
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="consolePageParticipant">
- <complexType>
- <sequence>
- <element ref="enablement"/>
- </sequence>
- <attribute name="id" type="string" use="required">
- <annotation>
- <documentation>
- specifies a unique identifier for this Console Page Participant
- </documentation>
- </annotation>
- </attribute>
- <attribute name="class" type="string" use="required">
- <annotation>
- <documentation>
- specifies a fully qualified name of a Java class that implements &lt;code&gt;IConsolePageParticipant&lt;/code&gt;
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appInfo>
- <meta.section type="since"/>
- </appInfo>
- <documentation>
- 3.1
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="examples"/>
- </appInfo>
- <documentation>
- The following is an example of a console page participant extension point:
-&lt;pre&gt;
- &lt;extension
- point=&quot;org.eclipse.ui.console.consolePageParticipant&quot;&gt;
- &lt;consolePageParticipant
- class=&quot;com.example.ExamplePageParticipant&quot;
- id=&quot;com.example.ExamplePageParticipant&quot;&gt;
- &lt;enablement&gt;
- &lt;instanceof value=&quot;com.example.ExampleConsole&quot;/&gt;
- &lt;/enablement&gt;
- &lt;/consolePageParticipant&gt;
- &lt;/extension&gt;
-&lt;/pre&gt;
-In the above example, the contributed console page participant will be used for all consoles of type &quot;com.example.ExampleConsole.&quot;
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="apiInfo"/>
- </appInfo>
- <documentation>
- Value of the attribute &lt;b&gt;class&lt;/b&gt; must be a fully qualified name of a Java class that implements the interface &lt;b&gt;org.eclipse.debug.ui.console.IConsolePageParticipantDelegate&lt;/b&gt;.
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="copyright"/>
- </appInfo>
- <documentation>
- Copyright (c) 2000, 2004 IBM Corporation and others.&lt;br&gt;
-All rights reserved. This program and the accompanying materials are made
-available under the terms of the Common Public License v1.0 which
-accompanies this distribution, and is available at
-&lt;a href=&quot;http://www.eclipse.org/legal/cpl-v10.html&quot;&gt;http://www.eclipse.org/legal/cpl-v10.html&lt;/a&gt;
- </documentation>
- </annotation>
-
-</schema>
diff --git a/org.eclipse.ui.console/schema/consolePatternMatchListeners.exsd b/org.eclipse.ui.console/schema/consolePatternMatchListeners.exsd
deleted file mode 100644
index 7bb88393a..000000000
--- a/org.eclipse.ui.console/schema/consolePatternMatchListeners.exsd
+++ /dev/null
@@ -1,150 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.ui.console">
-<annotation>
- <appInfo>
- <meta.schema plugin="org.eclipse.ui.console" id="consolePatternMatchListeners" name="Console Pattern Match Listeners"/>
- </appInfo>
- <documentation>
- Provides regular expression matching for text consoles. Pattern match listeners can be contributed to specific consoles by using an enablement expression. Listeners are notified as matches are found.
- </documentation>
- </annotation>
-
- <include schemaLocation="schema://org.eclipse.core.expressions/schema/expressionLanguage.exsd"/>
-
- <element name="extension">
- <complexType>
- <sequence>
- <element ref="consolePatternMatchListener" minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="point" type="string" use="required">
- <annotation>
- <documentation>
- a fully qualified identifier of the target extension point
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
- an optional identifier of the extension instance
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
- an optional name of the extension instance
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="consolePatternMatchListener">
- <complexType>
- <sequence>
- <element ref="enablement"/>
- </sequence>
- <attribute name="id" type="string" use="required">
- <annotation>
- <documentation>
- specifies a unique identifier for this console pattern match listener
- </documentation>
- </annotation>
- </attribute>
- <attribute name="class" type="string" use="required">
- <annotation>
- <documentation>
- specifies a fully qualified name of a Java class that implements &lt;code&gt;IPatternMatchListenerDelegate&lt;/code&gt;
- </documentation>
- </annotation>
- </attribute>
- <attribute name="regex" type="string" use="required">
- <annotation>
- <documentation>
- specifies the regular expression to be matched
- </documentation>
- </annotation>
- </attribute>
- <attribute name="flags" type="string">
- <annotation>
- <documentation>
- specifies flags to be used when matching the pattern. Acceptable flags are defined in &lt;code&gt;java.util.regex.Pattern&lt;/code&gt; and should be specified as Strings (eg &quot;Pattern.MULTILINE&quot; or &quot;MULTILINE&quot;)
- </documentation>
- </annotation>
- </attribute>
- <attribute name="qualifier" type="string">
- <annotation>
- <documentation>
- a simple regular expression used to identify a line that may contain this pattern match listener&apos;s complete regular expression &lt;code&gt;regex&lt;/code&gt;. When a line is found containing this expression, a search is performed from the beginning of the line for this pattern matcher&apos;s complete &lt;code&gt;regex&lt;/code&gt;. Use of this attribute is optional but can greatly improve performance as lines not containing this expression are disqualified from the search.
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appInfo>
- <meta.section type="since"/>
- </appInfo>
- <documentation>
- 3.1
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="examples"/>
- </appInfo>
- <documentation>
- The following is an example of a console pattern match listener extension point:
-&lt;pre&gt;
- &lt;extension
- point=&quot;org.eclipse.ui.console.consolePatternMatchListener&quot;&gt;
- &lt;consolePatternMatchListener
- class=&quot;com.example.ExampleConsolePatternMatcher&quot;
- id=&quot;com.example.ExampleConsolePatternMatcher&quot;
- regex=&quot;.*foo.*&quot;&gt;
- &lt;enablement&gt;
- &lt;test property=&quot;org.eclipse.ui.console.consoleTypeTest&quot; value=&quot;exampleConsole&quot;/&gt;
- &lt;/enablement&gt;
- &lt;/consolePatternMatchListener&gt;
- &lt;/extension&gt;
-&lt;/pre&gt;
-In the above example, the contributed console pattern matcher will be used for consoles with a type of &quot;exampleConsole.&quot;
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="apiInfo"/>
- </appInfo>
- <documentation>
- Value of the attribute &lt;b&gt;class&lt;/b&gt; must be a fully qualified name of a Java class that implements the interface &lt;b&gt;org.eclipse.ui.console.IPatternMatchListenerDelegate&lt;/b&gt;.
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="implementation"/>
- </appInfo>
- <documentation>
- The console plug-in provides a console type property tester for enablement expressions that tests the value of &lt;code&gt;IConsole.getType()&lt;/code&gt;. The property tester&apos;s identifier is &lt;code&gt;org.eclipse.ui.console.consoleTypeTest&lt;/code&gt;.
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="copyright"/>
- </appInfo>
- <documentation>
- Copyright (c) 2000, 2004 IBM Corporation and others.&lt;br&gt;
-All rights reserved. This program and the accompanying materials are made
-available under the terms of the Common Public License v1.0 which
-accompanies this distribution, and is available at
-&lt;a href=&quot;http://www.eclipse.org/legal/cpl-v10.html&quot;&gt;http://www.eclipse.org/legal/cpl-v10.html&lt;/a&gt;
- </documentation>
- </annotation>
-
-</schema>
diff --git a/org.eclipse.ui.console/scripts/exportplugin.xml b/org.eclipse.ui.console/scripts/exportplugin.xml
deleted file mode 100644
index af246f1b1..000000000
--- a/org.eclipse.ui.console/scripts/exportplugin.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<!-- Export a jar of .class files for the org.eclipse.ui.console Eclipse plugin
- along with other important plugin files to the "plugin-export" subdirectory
- of the target Eclipse installation -->
-<project name="Export ui.console" default="export" basedir="..">
-
- <!-- Set the timestamp and important properties -->
- <target name="init">
- <tstamp/>
- <property name="destdir" value="../../plugin-export" />
- <property name="dest" value="${destdir}/org.eclipse.ui.console_3.0.0" />
- </target>
-
- <!-- Create the jar of .class files, and copy other important files to export dir -->
- <target name="export" depends="init">
- <mkdir dir="${destdir}" />
- <delete dir="${dest}" />
- <mkdir dir="${dest}" />
- <jar
- jarfile="${dest}/console.jar"
- basedir="bin"
- />
- <!-- Create the source zip -->
- <zip zipfile="${dest}/consolesrc.zip">
- <fileset dir="src"/>
- </zip>
- <copy file="plugin.xml" todir="${dest}"/>
- <copy file="plugin.properties" todir="${dest}"/>
- <copy file=".classpath" todir="${dest}"/>
- <copy file=".options" todir="${dest}"/>
- <copy todir="${dest}/icons">
- <fileset dir="icons" />
- </copy>
- </target>
-
-</project>
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/console/AbstractConsole.java b/org.eclipse.ui.console/src/org/eclipse/ui/console/AbstractConsole.java
deleted file mode 100644
index 356ee4893..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/AbstractConsole.java
+++ /dev/null
@@ -1,321 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.console;
-
-import org.eclipse.core.runtime.ISafeRunnable;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.ListenerList;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.jface.viewers.IBasicPropertyConstants;
-import org.eclipse.ui.internal.console.ConsoleMessages;
-
-/**
- * Common function for consoles.
- * <p>
- * Clients implementing consoles should subclass this class.
- * </p>
- * @since 3.0
- */
-public abstract class AbstractConsole implements IConsole {
-
- // property listeners
- private ListenerList fListeners;
-
- /**
- * Console name
- */
- private String fName = null;
-
- /**
- * Console image descriptor
- */
- private ImageDescriptor fImageDescriptor = null;
-
- /**
- * Console type identifier
- */
- private String fType = null;
-
- /**
- * Used to notify this console of lifecycle methods <code>init()</code>
- * and <code>dispose()</code>.
- */
- class Lifecycle implements IConsoleListener {
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.IConsoleListener#consolesAdded(org.eclipse.ui.console.IConsole[])
- */
- public void consolesAdded(IConsole[] consoles) {
- for (int i = 0; i < consoles.length; i++) {
- IConsole console = consoles[i];
- if (console == AbstractConsole.this) {
- initialize();
- }
- }
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.IConsoleListener#consolesRemoved(org.eclipse.ui.console.IConsole[])
- */
- public void consolesRemoved(IConsole[] consoles) {
- for (int i = 0; i < consoles.length; i++) {
- IConsole console = consoles[i];
- if (console == AbstractConsole.this) {
- ConsolePlugin.getDefault().getConsoleManager().removeConsoleListener(this);
- destroy();
- }
- }
- }
- }
-
- /**
- * Notifies listeners of property changes, handling any exceptions
- */
- class PropertyNotifier implements ISafeRunnable {
-
- private IPropertyChangeListener fListener;
- private PropertyChangeEvent fEvent;
-
- /**
- * @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.getString("AbstractConsole.0"), exception); //$NON-NLS-1$
- ConsolePlugin.log(status);
- }
-
- /**
- * @see org.eclipse.core.runtime.ISafeRunnable#run()
- */
- public void run() throws Exception {
- fListener.propertyChange(fEvent);
- }
-
- /**
- * Notifies listeners of the property change
- *
- * @param event the event that describes the property that has changed
- */
- public void notify(PropertyChangeEvent event) {
- if (fListeners == null) {
- return;
- }
- fEvent = event;
- Object[] copiedListeners= fListeners.getListeners();
- for (int i= 0; i < copiedListeners.length; i++) {
- fListener = (IPropertyChangeListener)copiedListeners[i];
- Platform.run(this);
- }
- fListener = null;
- }
- }
-
- /**
- * Constructs a new console with the given name and image.
- *
- * @param name console name, cannot be <code>null</code>
- * @param imageDescriptor image descriptor, or <code>null</code> if none
- * @param autoLifecycle whether this console's lifecycle methods should be called
- * automatically when it is added (<code>initialize()</code>) and removed
- * (<code>destroy()</code>) from the console manager. When <code>false</code>,
- * clients are responsible for calling the lifecycle methdods.
- * @since 3.1
- */
- public AbstractConsole(String name, ImageDescriptor imageDescriptor, boolean autoLifecycle) {
- this(name, null, imageDescriptor, autoLifecycle);
- }
-
- /**
- * Constructs a new console with the given name, type, image and lifecycle.
- *
- * @param name console name, cannot be <code>null</code>
- * @param consoleType console type identifier or <code>null</code>
- * @param imageDescriptor image descriptor, or <code>null</code> if none
- * @param autoLifecycle whether this console's lifecycle methods should be called
- * automatically when it is added (<code>initialize()</code>) and removed
- * (<code>destroy()</code>) from the console manager. When <code>false</code>,
- * clients are responsible for calling the lifecycle methdods.
- * @since 3.1
- */
- public AbstractConsole(String name, String type, ImageDescriptor imageDescriptor, boolean autoLifecycle) {
- setName(name);
- setType(type);
- setImageDescriptor(imageDescriptor);
- if (autoLifecycle) {
- ConsolePlugin.getDefault().getConsoleManager().addConsoleListener(new Lifecycle());
- }
- }
-
- /**
- * Constructs a new console with the given name and image. The console's lifecycle
- * methods <code>init()</code> and <code>dispose()</code> will be called when the
- * console is added and removed from the console manager.
- *
- * @param name console name, cannot be <code>null</code>
- * @param imageDescriptor image descriptor, or <code>null</code> if none
- */
- public AbstractConsole(String name, ImageDescriptor imageDescriptor) {
- this(name, imageDescriptor, true);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.IConsole#getName()
- */
- public String getName() {
- return fName;
- }
-
- /**
- * Sets the name of this console to the specified value and notifies
- * property listeners of the change.
- *
- * @param name the new name
- */
- protected void setName(String name) {
- String old = fName;
- fName = name;
- firePropertyChange(this, IBasicPropertyConstants.P_TEXT, old, name);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.IConsole#getImageDescriptor()
- */
- public ImageDescriptor getImageDescriptor() {
- return fImageDescriptor;
- }
-
- /**
- * Sets the image descriptor for this console to the specified value and notifies
- * property listeners of the change.
- *
- * @param imageDescriptor the new image descriptor
- */
- protected void setImageDescriptor(ImageDescriptor imageDescriptor) {
- ImageDescriptor old = fImageDescriptor;
- fImageDescriptor =imageDescriptor;
- firePropertyChange(this, IBasicPropertyConstants.P_IMAGE, old, imageDescriptor);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.IConsole#addPropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener)
- */
- public void addPropertyChangeListener(IPropertyChangeListener listener) {
- if (fListeners == null) {
- fListeners = new ListenerList();
- }
- fListeners.add(listener);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.IConsole#removePropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener)
- */
- public void removePropertyChangeListener(IPropertyChangeListener listener) {
- if (fListeners != null) {
- fListeners.remove(listener);
- }
- }
-
- /**
- * Notify all listeners that the given property has changed.
- *
- * @param source the object on which a property has changed
- * @param property identifier of the property that has changed
- * @param oldValue the old value of the property, or <code>null</code>
- * @param newValue the new value of the property, or <code>null</code>
- */
- public void firePropertyChange(Object source, String property, Object oldValue, Object newValue) {
- if (fListeners == null) {
- return;
- }
- PropertyNotifier notifier = new PropertyNotifier();
- notifier.notify(new PropertyChangeEvent(source, property, oldValue, newValue));
- }
-
- /**
- * Initializes this console. This method should only be called by clients managing a
- * console's lifecycle, otherwise this method will be called automatically when this console
- * is added to the console manager. The method is called once to initialize this console,
- * marking the beginning of its lifecycle.
- *
- * @since 3.1
- */
- public final void initialize() {
- init();
- }
-
- /**
- * Called when this console is added to the console manager. Default
- * implementation does nothing. Subclasses may override.
- * <p>
- * Since 3.1, this method is only called automatically if this console was
- * created with an automatic lifecycle.
- * </p>
- */
- protected void init() {
- }
-
- /**
- * Disposes this console. This method should only be called by clients managing a
- * console's lifecycle, otherwise this method will be called automatically when this
- * console is removed from the console manager. The method is called once to dispose
- * this console, afterwhich this console will no longer be used.
- *
- * @since 3.1
- */
- public final void destroy() {
- dispose();
- }
-
- /**
- * Called when this console is removed from the console manager. Default
- * implementation does nothing. Subclasses may override.
- * <p>
- * Since 3.1, this methods is only called automatically if this console was
- * created with an automatic lifecycle.
- * </p>
- */
- protected void dispose() {
- }
-
- /**
- * Shows this console in all console views. This console will be become visible
- * if another console is currently pinned.
- *
- * @since 3.1
- */
- public void activate() {
- ConsolePlugin.getDefault().getConsoleManager().showConsoleView(this);
- }
-
- /**
- * Sets this console's type identifier.
- *
- * @param typeIdentifier the type identifier for this console
- * @since 3.1
- */
- protected void setType(String typeIdentifier) {
- fType = typeIdentifier;
- }
-
- /**
- * @see org.eclipse.ui.console.IConsole#getType()
- * @since 3.1
- */
- public String getType() {
- return fType;
- }
-
-} \ No newline at end of file
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/console/ConsolePlugin.java b/org.eclipse.ui.console/src/org/eclipse/ui/console/ConsolePlugin.java
deleted file mode 100644
index 5446acf8b..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/ConsolePlugin.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.console;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.internal.console.ConsoleManager;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-
-/**
- * The console plug-in class.
- *
- * @since 3.0
- */
-
-public class ConsolePlugin extends AbstractUIPlugin {
-
- /**
- * Singleton console manager
- */
- private IConsoleManager fConsoleManager = null;
-
- /**
- * The singleton console plugin instance
- */
- private static ConsolePlugin fgPlugin= null;
-
- /**
- * Unique identifier constant (value <code>"org.eclipse.ui.console"</code>)
- * for the UI Console plug-in.
- */
- private static final String PI_UI_CONSOLE = "org.eclipse.ui.console"; //$NON-NLS-1$
-
- /**
- * Returns the singleton instance of the console plugin.
- */
- public static ConsolePlugin getDefault() {
- return fgPlugin;
- }
-
- public ConsolePlugin() {
- super();
- fgPlugin = this;
- }
-
- /**
- * Convenience method which returns the unique identifier of this plugin.
- */
- public static String getUniqueIdentifier() {
- return PI_UI_CONSOLE;
- }
-
- /**
- * Logs the specified status with this plug-in's log.
- *
- * @param status status to log
- */
- public static void log(IStatus status) {
- getDefault().getLog().log(status);
- }
-
- /**
- * Logs the specified throwable with this plug-in's log.
- *
- * @param t throwable to log
- */
- public static void log(Throwable t) {
- log(newErrorStatus("Error logged from Console plug-in: ", t)); //$NON-NLS-1$
- }
-
- /**
- * Returns a new error status for this plugin with the given message
- * @param message the message to be included in the status
- * @param exception the exception to be included in the status or <code>null</code> if none
- * @return a new error status
- */
- public static IStatus newErrorStatus(String message, Throwable exception) {
- return new Status(IStatus.ERROR, getUniqueIdentifier(), IConsoleConstants.INTERNAL_ERROR, message, exception);
- }
-
- /**
- * Returns the console manager. The manager will be created lazily on
- * the first access.
- *
- * @return IConsoleManager
- */
- public IConsoleManager getConsoleManager() {
- if (fConsoleManager == null) {
- fConsoleManager = new ConsoleManager();
- }
- return fConsoleManager;
- }
-
- /**
- * Returns the standard display to be used. The method first checks, if
- * the thread calling this method has an associated display. If so, this
- * display is returned. Otherwise the method returns the default display.
- */
- public static Display getStandardDisplay() {
- Display display= Display.getCurrent();
- if (display == null) {
- display= Display.getDefault();
- }
- return display;
- }
-
- /**
- * Utility method with conventions
- */
- public static void errorDialog(Shell shell, String title, String message, Throwable t) {
- IStatus status;
- if (t instanceof CoreException) {
- status= ((CoreException)t).getStatus();
- // if the 'message' resource string and the IStatus' message are the same,
- // don't show both in the dialog
- if (status != null && message.equals(status.getMessage())) {
- message= null;
- }
- } else {
- status= new Status(IStatus.ERROR, getUniqueIdentifier(), IConsoleConstants.INTERNAL_ERROR, "Error within Debug UI: ", t); //$NON-NLS-1$
- log(status);
- }
- ErrorDialog.openError(shell, title, message, status);
- }
-}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/console/IConsole.java b/org.eclipse.ui.console/src/org/eclipse/ui/console/IConsole.java
deleted file mode 100644
index d3f88ba7e..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/IConsole.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.console;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.ui.part.IPageBookViewPage;
-
-/**
- * A console. A console is commonly used to display messages such as the output
- * streams of a system process. A console can be displayed in one or more console
- * views.
- * <p>
- * The console implementations provided by this plug-in are textual
- * (<code>TextConsole</code>, <code>MessageConsole</code> and <code>IOConsole</code>).
- * However a client can provide alternate presentations since a console implementation
- * is responsible for providing is page for the page book views in which consoles are
- * displayed.
- * </p>
- * <p>
- * This interface is not intended to be implemented directly by clients.
- * Subclass <code>AbstractConsole</code> instead.
- * </p>
- * @since 3.0
- */
-public interface IConsole {
-
- /**
- * Returns the name of this console.
- *
- * @return the name of this console
- */
- public String getName();
-
- /**
- * Returns an image descriptor for this console, or <code>null</code>
- * if none.
- *
- * @return an image descriptor for this console, or <code>null</code>
- * if none
- */
- public ImageDescriptor getImageDescriptor();
-
- /**
- * Creates and returns a new page for this console. The page is displayed
- * for this console in the console given view.
- *
- * @param view the view in which the page is to be created
- * @return a page book view page representation of this console
- */
- public IPageBookViewPage createPage(IConsoleView view);
-
- /**
- * Adds a listener for changes to properties of this console.
- * Has no effect if an identical listener is already registered.
- * <p>
- * The changes supported by the console view are as follows:
- * <ul>
- * <li><code>IBasicPropertyConstants.P_TEXT</code> - indicates the name
- * of a console has changed</li>
- * <li><code>IBasicPropertyConstants.P_IMAGE</code> - indicates the image
- * of a console has changed</li>
- * </ul>
- * </p>
- * <p>
- * Consoles may define additional properties as required.
- * </p>
- *
- * @param listener a property change listener
- */
- public void addPropertyChangeListener(IPropertyChangeListener listener);
-
- /**
- * Removes the given property listener from this console page.
- * Has no effect if an identical listener is not alread registered.
- *
- * @param listener a property listener
- */
- public void removePropertyChangeListener(IPropertyChangeListener listener);
-
- /**
- * Returns a unique identifier for this console's type, or <code>null</code>
- * if unspecified.
- *
- * @return a unique identifier for this console's type, or <code>null</code>
- * @since 3.1
- */
- public String getType();
-
-}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/console/IConsoleConstants.java b/org.eclipse.ui.console/src/org/eclipse/ui/console/IConsoleConstants.java
deleted file mode 100644
index f773476e9..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/IConsoleConstants.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.console;
-
-/**
- * Constants relating to the console plug-in.
- *
- * @since 3.0
- */
-public interface IConsoleConstants {
-
- /**
- * Console plug-in identifier (value <code>"org.eclipse.ui.console"</code>).
- */
- public static final String PLUGIN_ID = ConsolePlugin.getUniqueIdentifier();
-
- /**
- * Console view identifier (value <code>"org.eclipse.ui.console.ConsoleView"</code>).
- */
- public static final String ID_CONSOLE_VIEW= "org.eclipse.ui.console.ConsoleView"; //$NON-NLS-1$
-
- /**
- * Type identifier for MessageConsole
- * @since 3.1
- */
- public static final String MESSAGE_CONSOLE_TYPE = "org.eclipse.ui.MessageConsole"; //$NON-NLS-1$
-
- /**
- * The name of the font to use for the Console (value <code>"org.eclipse.ui.console.ConsoleFont"</code>).
- *
- * @deprecated When a console is created, its font is set to the default text font as specified
- * by <code>JFaveResources.TEXT_FONT</code>. Clients must provide their own infrastructure to
- * manage console specific fonts.
- */
- public static final String CONSOLE_FONT= "org.eclipse.ui.console.ConsoleFont"; //$NON-NLS-1$
-
- /**
- * Menu group identifier for the console view context menu and toolbar, for actions pertaining to
- * launching (value <code>"launchGroup"</code>).
- */
- public static final String LAUNCH_GROUP = "launchGroup"; //$NON-NLS-1$
-
- /**
- * Menu group identifier for the console view context menu and toolbar, for actions pertaining to
- * console output. (value<code>"outputGroup"</code>).
- */
- public static final String OUTPUT_GROUP = "outputGroup"; //$NON-NLS-1$
-
- /**
- * Console view image identifier.
- */
- public static final String IMG_VIEW_CONSOLE= "IMG_VIEW_CONSOLE"; //$NON-NLS-1$
-
- /**
- * Clear action image identifier.
- */
- public static final String IMG_LCL_CLEAR= "IMG_LCL_CLEAR"; //$NON-NLS-1$
-
- /**
- * Status code indicating an unexpected internal error.
- */
- public static final int INTERNAL_ERROR = 120;
-
- /**
- * Console pattern match listeners extension point identifier
- * (value <code>"consolePatternMatchListeners"</code>).
- *
- * @since 3.1
- */
- public static final String EXTENSION_POINT_CONSOLE_PATTERN_MATCH_LISTENERS = "consolePatternMatchListeners"; //$NON-NLS-1$
-
- /**
- * Console page participants extension point identifier
- * (value <code>"consolePageParticipants"</code>).
- *
- * @since 3.1
- */
- public static final String EXTENSION_POINT_CONSOLE_PAGE_PARTICIPANTS = "consolePageParticipants"; //$NON-NLS-1$
-
- /**
- * Console factories extension point identifier
- * (value <code>"consoleFactories"</code>).
- *
- * @since 3.1
- */
- public static final String EXTENSION_POINT_CONSOLE_FACTORIES = "consoleFactories"; //$NON-NLS-1$
-
- /**
- * Property constant indicating a console's font has changed.
- *
- * @since 3.1
- */
- public static final String P_FONT = ConsolePlugin.getUniqueIdentifier() + ".P_FONT"; //$NON-NLS-1$
-
- /**
- * Property constant indicating that a font style has changed
- *
- * @since 3.1
- */
- public static final String P_FONT_STYLE = ConsolePlugin.getUniqueIdentifier() + ".P_FONT_STYLE"; //$NON-NLS-1$
-
- /**
- * Property constant indicating the color of a stream has changed.
- *
- * @since 3.1
- */
- public static final String P_STREAM_COLOR = ConsolePlugin.getUniqueIdentifier() + ".P_STREAM_COLOR"; //$NON-NLS-1$
-
- /**
- * Property constant indicating tab size has changed
- *
- * @since 3.1
- */
- public static final String P_TAB_SIZE = ConsolePlugin.getUniqueIdentifier() + ".P_TAB_SIZE"; //$NON-NLS-1$
-
- /**
- * Property constant indicating the width of a fixed width console has changed.
- *
- * @since 3.1
- */
- public static final String P_CONSOLE_WIDTH = ConsolePlugin.getUniqueIdentifier() + ".P_CONSOLE_WIDTH"; //$NON-NLS-1$
-
- /**
- * Property constant indicating that all streams connected to this console have been closed
- * and that all queued output has been processed.
- *
- * @since 3.1
- */
- public static final String P_CONSOLE_OUTPUT_COMPLETE = ConsolePlugin.getUniqueIdentifier() + ".P_CONSOLE_STREAMS_CLOSED"; //$NON-NLS-1$
-
- /**
- * Property constant indicating a hyperlink has been added to a console.
- *
- * @since 3.1
- */
- public static final String P_CONSOLE_HYPERLINK_ADDED = ConsolePlugin.getUniqueIdentifier() + ".P_CONSOLE_HYPERLINK_ADDED"; //$NON-NLS-1$
-
- /**
- * The default tab size for text consoles.
- *
- * @since 3.1
- */
- public static final int DEFAULT_TAB_SIZE = 8;
-
-}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/console/IConsoleDocumentPartitioner.java b/org.eclipse.ui.console/src/org/eclipse/ui/console/IConsoleDocumentPartitioner.java
deleted file mode 100644
index 01cc3c2ba..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/IConsoleDocumentPartitioner.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.console;
-
-import org.eclipse.jface.text.IDocumentPartitioner;
-import org.eclipse.swt.custom.StyleRange;
-
-/**
- * A document partitioner for a text console.
- * <p>
- * In addition to regular partitioner duties, a console document partitioner
- * dicates which regions in its document are read-only and provides style ranges.
- * </p>
- * @see org.eclipse.ui.console.TextConsole
- * @since 3.1
- */
-public interface IConsoleDocumentPartitioner extends IDocumentPartitioner {
-
- /**
- * Returns whether this partitioner's document is read-only at the specified
- * offset. The user is not allowed to type in read-only locations.
- *
- * @param offset document offset
- * @return whether this partitioner's document is read-only at the specified
- * offset
- */
- public boolean isReadOnly(int offset);
-
- /**
- * Returns style ranges for the specified region of this partitioner's document
- * to use when rendering, or <code>null</code> if none.
- *
- * @param offset beginning offset for which style ranges are requested
- * @param length the length of text for which style ranges are requested
- * @return style ranges for the specified region of this partitioner's document
- * to use when rendering, or <code>null</code> if none
- */
- public StyleRange[] getStyleRanges(int offset, int length);
-}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/console/IConsoleFactory.java b/org.eclipse.ui.console/src/org/eclipse/ui/console/IConsoleFactory.java
deleted file mode 100644
index 50dda286b..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/IConsoleFactory.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.console;
-
-/**
- * A console factory extension is responsible for opening a console in the console view.
- * Extensions appear on a menu in the console view, and their <code>openConsole</code>
- * method is called when the action is invoked. Implementations may choose to open a new
- * cosnole or activate an existing console. The extension point used to contribute a
- * console factory is <code>org.eclipse.ui.console.consoleFactories</code>.
- * <p>
- * Following is an example console factory extension.
- * </pre>
- * &lt;extension point="org.eclipse.ui.console.consoleFactories"&gt;
- * &lt;consoleFactory
- * label="Command Console"
- * icon="icons\cmd_console.gif"
- * class="com.example.CommandConsoleFactory"&gt;
- * &lt;/consoleFactory&gt;
- * &lt;/extension&gt;
- * </pre>
- * An action appears in the console view's 'Open Console' drop-down menu with the
- * corresponding <code>label</code> and option <code>icon</code>. When the action
- * is invoked, the specified <code>class</code> is instantiated and called to
- * open a console, via the method <code>openConsole()</code>.
- * </p>
- * <p>
- * Clients providing console factory extensions are intended to implement
- * this interface.
- * </p>
- * @since 3.1
- */
-public interface IConsoleFactory {
- /**
- * Opens a console in the console view. Implementations may create a new
- * console or activate an existing console.
- */
- public void openConsole();
-
-}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/console/IConsoleListener.java b/org.eclipse.ui.console/src/org/eclipse/ui/console/IConsoleListener.java
deleted file mode 100644
index 7d22c8a21..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/IConsoleListener.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.console;
-
-/**
- * A console listener is notified when consoles are added or removed from
- * the console manager.
- * <p>
- * Clients may implement this interface.
- * </p>
- * @since 3.0
- */
-public interface IConsoleListener {
-
- /**
- * Notification the given consoles have been added to the console
- * manager.
- *
- * @param consoles added consoles
- */
- public void consolesAdded(IConsole[] consoles);
-
- /**
- * Notification the given consoles have been removed from the
- * console manager.
- *
- * @param consoles removed consoles
- */
- public void consolesRemoved(IConsole[] consoles);
-
-}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/console/IConsoleManager.java b/org.eclipse.ui.console/src/org/eclipse/ui/console/IConsoleManager.java
deleted file mode 100644
index 31fcee3ea..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/IConsoleManager.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.console;
-
-/**
- * The console manager manages registered consoles.
- * <p>
- * Clients are not intended to implement this interface.
- * </p>
- * @since 3.0
- */
-public interface IConsoleManager {
-
- /**
- * Registers the given listener for console notifications. Has
- * no effect if an identical listener is already registered.
- *
- * @param listener listener to register
- */
- public void addConsoleListener(IConsoleListener listener);
-
- /**
- * Deregisters the given listener for console notifications. Has
- * no effect if an identical listener is not already registered.
- *
- * @param listener listener to deregister
- */
- public void removeConsoleListener(IConsoleListener listener);
-
- /**
- * Adds the given consoles to the console manager. Has no effect for
- * equivalent consoles already registered. The consoles will be added
- * to any existing console views.
- *
- * @param consoles consoles to add
- */
- public void addConsoles(IConsole[] consoles);
-
- /**
- * Removes the given consoles from the console manager. If the consoles are
- * being displayed in any console views, the associated pages will be removed
- * and disposed.
- *
- * @param consoles consoles to remove
- */
- public void removeConsoles(IConsole[] consoles);
-
- /**
- * Returns a collection of consoles registered with the console manager.
- *
- * @return a collection of consoles registered with the console manager
- */
- public IConsole[] getConsoles();
-
- /**
- * Opens the console view and displays given the console.
- * If the view is already open, it is brought to the front unless
- * the view is pinned on a console other than the given console.
- * Has no effect if the given console is not currently registered.
- *
- * @param console console to display
- */
- public void showConsoleView(IConsole console);
-
- /**
- * Warns that the content of the given console has changed in
- * all console views. Has no effect if the given console is not
- * currently registered.
- *
- * @param console the console that has changed
- */
- public void warnOfContentChange(IConsole console);
-
- /**
- * Creates and returns a collection of new pattern match listeners enabled for
- * the given console. The pattern match listeners are new instances, intended
- * to be used in a new console. No methods on the participants have been
- * called. Clients are responsible for connecting to and disconnecting from
- * the pattern match listeners.
- * <p>
- * Console pattern match listeners are contributed via the
- * <code>org.eclipse.ui.console.consolePatternMatchListeners</code> extension point.
- * </p>
- *
- * @param console the console for which pattern match listeners are requested
- * @return a collection of new pattern match listeners
- * @see IPatternMatchListener
- * @since 3.1
- */
- public IPatternMatchListener[] createPatternMatchListeners(IConsole console);
-
-}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/console/IConsolePageParticipant.java b/org.eclipse.ui.console/src/org/eclipse/ui/console/IConsolePageParticipant.java
deleted file mode 100644
index 9a8a15d7c..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/IConsolePageParticipant.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.console;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.ui.part.IPageBookViewPage;
-
-/**
- * A console page participant is notified of page lifecycle events such as
- * creation, activation, deactivation and disposal. A page participant can
- * also provide adapters for a page. Participants are contributed via the
- * <code>org.eclispe.ui.console.consolePageParticipants</code> extension point.
- * <p>
- * Participant behavior is implementation dependent. For example, a page participant
- * could add actions to a console's toolbar by accessing a its page's action bars.
- * </p>
- * <p>
- * Following is an example extension definition.
- * <pre>
- * </pre>
- * &lt;extension point="org.eclipse.ui.console.consolePageParticipants"&gt;
- * &lt;consolePageParticipant
- * id="com.example.ExamplePageParticipant"
- * class="com.example.ExamplePageParticipant"&gt;
- * &lt;/consolePageParticipant&gt;
- * &lt;/extension&gt;
- * </p>
- * The example page participant is contributed to all console pages. An optional
- * <code>enablement</code> attriubte may be specified to control which consoles
- * a page participant is applicable to.
- * <p>
- * Clients contributing console page participant extensions are intended to
- * implement this interface.
- * </p>
- * @since 3.1
- */
-public interface IConsolePageParticipant extends IAdaptable {
- /**
- * Called during page initialization. Marks the start of this
- * page participant's lifecycle.
- *
- * @param page the page corresponsing to the given console
- * @param console the console for which a page has been created
- */
- public void init(IPageBookViewPage page, IConsole console);
-
- /**
- * Disposes this page participant. Marks the end of this
- * page participant's lifecycle.
- */
- public void dispose();
-
- /**
- * Notification this participant's page has been activated.
- */
- public void activated();
-
- /**
- * Notification this participant's page has been deactivated.
- */
- public void deactivated();
-
-}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/console/IConsoleView.java b/org.eclipse.ui.console/src/org/eclipse/ui/console/IConsoleView.java
deleted file mode 100644
index 784af61ce..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/IConsoleView.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.console;
-
-import org.eclipse.ui.IViewPart;
-
-/**
- * A view that displays consoles registered with the console manager.
- * <p>
- * Clients are not intended to implement this interface.
- * </p>
- * @since 3.0
- */
-public interface IConsoleView extends IViewPart {
-
- /**
- * Displays the page for the given console in this console view.
- * Has no effect if this console view has a pinned console.
- *
- * @param console console to display, cannot be <code>null</code>
- */
- public void display(IConsole console);
-
- /**
- * Pins this console view. No other console page will be displayed until
- * this console view is un-pinned.
- *
- * @param pin <code>true</code> to pin the current console to the
- * top of the stack, <code>false</code> otherwise
- * @since 3.1
- */
- public void setPinned(boolean pin);
-
- /**
- * Displays and pins the given console in this console view. No
- * other console can be displayed until this console view is
- * un-pinned. Specifying <code>null</code> un-pins this console
- *
- * @param console console to pin, or <code>null</code> to un-pin
- * @deprecated rather than pinning a specific console, a console view is
- * pinned - use <code>setPinned(boolean)</code>
- */
- public void pin(IConsole console);
-
- /**
- * Returns whether this console view is currently pinned to a
- * specific console.
- *
- * @return whether this console view is currently pinned to a
- * specific console
- */
- public boolean isPinned();
-
- /**
- * Returns the console currently being displayed, or <code>null</code>
- * if none
- *
- * @return the console currently being displayed, or <code>null</code>
- * if none
- */
- public IConsole getConsole();
-
- /**
- * Warns that the content of the given console has changed.
- *
- * @param console the console that has changed
- */
- public void warnOfContentChange(IConsole console);
-
- /**
- * Sets the scroll lock state of the currently active console.
- *
- * @param scrollLock <code>true</code> to turn scroll lock on, otherwise <code>false</code>
- * @since 3.1
- */
- public void setScrollLock(boolean scrollLock);
-
- /**
- * Returns the scroll lock state of the currently active console.
- *
- * @return <code>true</code> if scroll lock is on, <code>false</code> otherwise
- * @since 3.1
- */
- public boolean getScrollLock();
-
-}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/console/IHyperlink.java b/org.eclipse.ui.console/src/org/eclipse/ui/console/IHyperlink.java
deleted file mode 100644
index 0c3b999f3..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/IHyperlink.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.console;
-
-/**
- * A hyperlink in a console. Link behavior is implementation dependent.
- * <p>
- * Clients may implement this interface.
- * </p>
- * @since 3.1
- */
-public interface IHyperlink {
-
- /**
- * Notification that the mouse has entered this link's region.
- */
- public void linkEntered();
-
- /**
- * Notification that the mouse has exited this link's region
- */
- public void linkExited();
-
- /**
- * Notification that this link has been activated. Performs
- * context specific linking.
- */
- public void linkActivated();
-}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/console/IOConsole.java b/org.eclipse.ui.console/src/org/eclipse/ui/console/IOConsole.java
deleted file mode 100644
index ed6f85237..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/IOConsole.java
+++ /dev/null
@@ -1,254 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.console;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.ui.WorkbenchEncoding;
-import org.eclipse.ui.internal.console.IOConsolePage;
-import org.eclipse.ui.internal.console.IOConsolePartitioner;
-import org.eclipse.ui.part.IPageBookViewPage;
-
-/**
- * A console that displays text from I/O streams. An I/O console can have multiple
- * output streams connected to it and provides one input stream connected to the
- * keyboard.
- * <p>
- * Clients may instantiate and subclass this class.
- * </p>
- * @since 3.1
- */
-public class IOConsole extends TextConsole {
- /**
- * The document partitioner
- */
- private IOConsolePartitioner partitioner;
-
- /**
- * The stream from which user input may be read
- */
- private IOConsoleInputStream inputStream;
-
- /**
- * A collection of open streams connected to this console.
- */
- private List openStreams;
-
- /**
- * The encoding used to for displaying console output.
- */
- private String fEncoding = WorkbenchEncoding.getWorkbenchDefaultEncoding();
-
-
- /**
- * Constructs a console with the given name, type, image, and lifecycle, with the
- * workbench's default encoding.
- *
- * @param name name to display for this console
- * @param consoleType console type identifier or <code>null</code>
- * @param imageDescriptor image to display for this console or <code>null</code>
- * @param autoLifecycle whether lifecycle methods should be called automatically
- * when this console is added/removed from the console manager
- */
- public IOConsole(String name, String consoleType, ImageDescriptor imageDescriptor, boolean autoLifecycle) {
- this(name, consoleType, imageDescriptor, null, autoLifecycle);
- }
-
- /**
- * Constructs a console with the given name, type, image, encoding and lifecycle.
- *
- * @param name name to display for this console
- * @param consoleType console type identifier or <code>null</code>
- * @param imageDescriptor image to display for this console or <code>null</code>
- * @param autoLifecycle whether lifecycle methods should be called automatically
- * when this console is added/removed from the console manager
- */
- public IOConsole(String name, String consoleType, ImageDescriptor imageDescriptor, String encoding, boolean autoLifecycle) {
- super(name, consoleType, imageDescriptor, autoLifecycle);
- if (encoding != null) {
- fEncoding = encoding;
- }
- openStreams = new ArrayList();
- inputStream = new IOConsoleInputStream(this);
- openStreams.add(inputStream);
- partitioner = new IOConsolePartitioner(inputStream, this);
- partitioner.connect(getDocument());
- }
-
- /**
- * Constructs a console with the given name, type, and image with the workbench's
- * default encoding. Lifecycle methods will be called when this console is
- * added/removed from the console manager.
- *
- * @param name name to display for this console
- * @param consoleType console type identifier or <code>null</code>
- * @param imageDescriptor image to display for this console or <code>null</code>
- */
- public IOConsole(String name, String consoleType, ImageDescriptor imageDescriptor) {
- this(name, consoleType, imageDescriptor, true);
- }
-
- /**
- * Constructs a console with the given name and image. Lifecycle methods
- * will be called when this console is added/removed from the console manager.
- * This console will have an unspecified (<code>null</code>) type.
- *
- * @param name name to display for this console
- * @param imageDescriptor image to display for this console or <code>null</code>
- */
- public IOConsole(String name, ImageDescriptor imageDescriptor) {
- this(name, null, imageDescriptor);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.IConsole#createPage(org.eclipse.ui.console.IConsoleView)
- */
- public IPageBookViewPage createPage(IConsoleView view) {
- return new IOConsolePage(this, view);
- }
-
- /**
- * Creates and returns a new output stream which may be used to write to this console.
- * A console may be connected to more than one output stream at once. Clients are
- * responsible for closing any output streams created on this console.
- *
- * @return a new output stream connected to this console
- */
- public IOConsoleOutputStream newOutputStream() {
- IOConsoleOutputStream outputStream = new IOConsoleOutputStream(this);
- outputStream.setEncoding(fEncoding);
- synchronized(openStreams) {
- openStreams.add(outputStream);
- }
- return outputStream;
- }
-
- /**
- * Returns the input stream connected to the keyboard.
- *
- * @return the input stream connected to the keyboard.
- */
- public IOConsoleInputStream getInputStream() {
- return inputStream;
- }
-
- /**
- * Returns this console's document partitioner.
- *
- * @return this console's document partitioner
- */
- protected IConsoleDocumentPartitioner getPartitioner() {
- return partitioner;
- }
-
- /**
- * Returns the maximum number of characters that the console will display at
- * once. This is analagous to the size of the text buffer this console
- * maintains.
- *
- * @return the maximum number of characters that the console will display
- */
- public int getHighWaterMark() {
- return partitioner.getHighWaterMark();
- }
-
- /**
- * Returns the number of characters that will remain in this console
- * when its high water mark is exceeded.
- *
- * @return the number of characters that will remain in this console
- * when its high water mark is exceeded
- */
- public int getLowWaterMark() {
- return partitioner.getLowWaterMark();
- }
-
- /**
- * Sets the text buffer size for this console. The high water mark indicates
- * the maximum number of characters stored in the buffer. The low water mark
- * indicates the number of characters remaining in the buffer when the high
- * water mark is exceeded.
- *
- * @param low the number of characters remaining in the buffer when the high
- * water mark is exceeded (if -1 the console does not limit output)
- * @param high the maximum number of characters this console will cache in
- * its text buffer (if -1 the console does not limit output)
- * @exception IllegalArgumentException if low >= high & low != -1
- */
- public void setWaterMarks(int low, int high) {
- if (low >= 0) {
- if (low >= high) {
- throw new IllegalArgumentException("High water mark must be greater than low water mark"); //$NON-NLS-1$
- }
- }
- partitioner.setWaterMarks(low, high);
- }
-
- /**
- * Check if all streams connected to this console are closed. If so,
- * notifiy the partitioner that this console is finished.
- */
- private void checkFinished() {
- if (openStreams.isEmpty()) {
- partitioner.streamsClosed();
- }
- }
-
- /**
- * Notification that an output stream connected to this console has been closed.
- *
- * @param stream stream that closed
- */
- void streamClosed(IOConsoleOutputStream stream) {
- synchronized (openStreams) {
- openStreams.remove(stream);
- checkFinished();
- }
- }
-
- /**
- * Notification that the input stream connected to this console has been closed.
- *
- * @param stream stream that closed
- */
- void streamClosed(IOConsoleInputStream stream) {
- synchronized (openStreams) {
- openStreams.remove(stream);
- checkFinished();
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.TextConsole#clearConsole()
- */
- public void clearConsole() {
- if (partitioner != null) {
- partitioner.clearBuffer();
- }
- }
-
- /**
- * Disposes this console.
- */
- protected void dispose() {
- super.dispose();
- partitioner.disconnect();
- try {
- inputStream.close();
- } catch (IOException ioe) {
- }
- inputStream = null;
- }
-}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/console/IOConsoleInputStream.java b/org.eclipse.ui.console/src/org/eclipse/ui/console/IOConsoleInputStream.java
deleted file mode 100644
index 3517c77f7..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/IOConsoleInputStream.java
+++ /dev/null
@@ -1,274 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.console;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Color;
-
-/**
- * InputStream used to read input from an IOConsole.
- * This stream will buffer input that it receives until it has been read.
- * <p>
- * Clients are not intended to instantiate this class directly, instead
- * use <code>IOConsole.getInputStream()</code>.
- * </p>
- * @since 3.1
- *
- */
-public class IOConsoleInputStream extends InputStream {
- /**
- * Buffer to hold data from console until it is read.
- */
- private byte[] input = new byte[1024*2];
-
- /**
- * Location in the buffer that the next byte of data from the
- * console should be stored.
- */
- private int inPointer = 0;
-
- /**
- * Location in the buffer that the next byte of data read from
- * this stream should come from.
- */
- private int outPointer = 0;
-
- /**
- * The number of bytes of real data currently in the buffer.
- */
- private int size = 0;
-
- /**
- * Flag to indicate that EOF has been sent already.
- */
- private boolean eofSent = false;
-
- /**
- * Flag to indicate that the stream has been closed.
- */
- private boolean closed = false;
-
- /**
- * The console that this stream is connected to.
- */
- private IOConsole console;
-
- /**
- * The color used to display input in the console.
- */
- private Color color;
-
- /**
- * The font stye used to decorate input in the console.
- */
- private int fontStyle = SWT.NORMAL;
-
-
- /**
- * Constructs a new input stream on the given console.
- *
- * @param console I/O console
- */
- IOConsoleInputStream(IOConsole console) {
- this.console = console;
- }
-
- /*
- * (non-Javadoc)
- * @see java.io.InputStream#read(byte[], int, int)
- */
- public synchronized int read(byte[] b, int off, int len) throws IOException {
- waitForData();
- if (available() == -1) {
- return -1;
- }
-
- int toCopy = Math.min(len, size);
- if(input.length-outPointer > toCopy) {
- System.arraycopy(input, outPointer, b, off, toCopy);
- outPointer += toCopy;
- size -= toCopy;
- } else {
- int bytesToEnd = input.length-outPointer;
- System.arraycopy(input, outPointer, b, off, bytesToEnd);
- System.arraycopy(input, 0, b, off+bytesToEnd, toCopy-bytesToEnd);
- outPointer = toCopy-bytesToEnd;
- size -=toCopy;
- }
- return toCopy;
- }
-
- /*
- * (non-Javadoc)
- * @see java.io.InputStream#read(byte[])
- */
- public int read(byte[] b) throws IOException {
- return read(b, 0, b.length);
- }
-
- /*
- * (non-Javadoc)
- * @see java.io.InputStream#read()
- */
- public synchronized int read() throws IOException {
- waitForData();
- if (available() == -1) {
- return -1;
- }
-
- byte b = input[outPointer];
- outPointer++;
- if (outPointer == input.length) {
- outPointer = 0;
- }
- return b;
- }
-
- /**
- * Blocks until data is available to be read.
- * Ensure that the monitor for this object is obtained before
- * calling this method.
- */
- private void waitForData() {
- while (size == 0 && !closed) {
- try {
- wait();
- } catch (InterruptedException e) {
- }
- }
- }
-
- /**
- * Appends text to this input stream's buffer.
- *
- * @param text the text to append to the buffer.
- */
- public synchronized void appendData(String text) {
- byte[] newData = text.getBytes();
- while(input.length-size < newData.length) {
- growArray();
- }
-
- if (size == 0) { //inPointer == outPointer
- System.arraycopy(newData, 0, input, 0, newData.length);
- inPointer = newData.length;
- size = newData.length;
- outPointer = 0;
- } else if (inPointer < outPointer || input.length - inPointer > newData.length) {
- System.arraycopy(newData, 0, input, inPointer, newData.length);
- inPointer += newData.length;
- size += newData.length;
- } else {
- System.arraycopy(newData, 0, input, inPointer, input.length-inPointer);
- System.arraycopy(newData, input.length-inPointer, input, 0, newData.length-(input.length-inPointer));
- inPointer = newData.length-(input.length-inPointer);
- size += newData.length;
- }
-
- if (inPointer == input.length) {
- inPointer = 0;
- }
- notifyAll();
- }
-
- /**
- * Enlarges the buffer.
- */
- private void growArray() {
- byte[] newInput = new byte[input.length+1024];
- if (outPointer < inPointer) {
- System.arraycopy(input, outPointer, newInput, 0, size);
- } else {
- System.arraycopy(input, outPointer, newInput, 0, input.length-outPointer);
- System.arraycopy(input, 0, newInput, input.length-outPointer, inPointer);
- }
- outPointer = 0;
- inPointer = size;
- input = newInput;
- newInput = null;
- }
-
- /**
- * Returns this stream's font style.
- *
- * @return the font style used to decorate input in the associated console
- */
- public int getFontStyle() {
- return fontStyle;
- }
-
- /**
- * Sets this stream's font style.
- *
- * @param newFontStyle the font style to be used to decorate input in the associated console
- */
- public void setFontStyle(int newFontStyle) {
- if (newFontStyle != fontStyle) {
- int old = fontStyle;
- fontStyle = newFontStyle;
- console.firePropertyChange(this, IConsoleConstants.P_FONT_STYLE, new Integer(old), new Integer(fontStyle));
- }
- }
-
- /**
- * Sets the color to used to decorate input in the associated console.
- *
- * @param newColor the color to used to decorate input in the associated console.
- */
- public void setColor(Color newColor) {
- Color old = color;
- if (old == null || !old.equals(newColor)) {
- color = newColor;
- console.firePropertyChange(this, IConsoleConstants.P_STREAM_COLOR, old, newColor);
- }
- }
-
- /**
- * Returns the color used to decorate input in the associated console
- *
- * @return the color used to decorate input in the associated console
- */
- public Color getColor() {
- return color;
- }
-
- /* (non-Javadoc)
- * @see java.io.InputStream#available()
- */
- public int available() throws IOException {
- if (closed && eofSent) {
- throw new IOException("Input Stream Closed"); //$NON-NLS-1$
- } else if (size == 0) {
- if (!eofSent) {
- eofSent = true;
- return -1;
- }
- throw new IOException("Input Stream Closed"); //$NON-NLS-1$
- }
-
- return size;
- }
-
- /* (non-Javadoc)
- * @see java.io.InputStream#close()
- */
- public synchronized void close() throws IOException {
- if(closed) {
- throw new IOException("Input Stream Closed"); //$NON-NLS-1$
- }
- closed = true;
- notifyAll();
- console.streamClosed(this);
- }
-}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/console/IOConsoleOutputStream.java b/org.eclipse.ui.console/src/org/eclipse/ui/console/IOConsoleOutputStream.java
deleted file mode 100644
index 5bb4323a9..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/IOConsoleOutputStream.java
+++ /dev/null
@@ -1,224 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.console;
-
-import java.io.IOException;
-import java.io.OutputStream;
-
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.ui.WorkbenchEncoding;
-import org.eclipse.ui.internal.console.IOConsolePartitioner;
-
-/**
- * OutputStream used to write to an IOConsole.
- * <p>
- * Clients are not intended to instantiate this class directly, instead
- * use <code>IOConsole.newOutputStream()</code>.
- * </p>
- * @since 3.1
- */
-public class IOConsoleOutputStream extends OutputStream {
- /**
- * Flag indicating whether this stream has been closed.
- */
- private boolean closed = false;
-
- /**
- * The console's document partitioner.
- */
- private IOConsolePartitioner partitioner;
-
- /**
- * The console this stream is attached to.
- */
- private IOConsole console;
-
- /**
- * Flag indicating that the console should be activated when data
- * is written to this stream.
- */
- private boolean activateOnWrite = false;
-
- /**
- * The color used to decorate data written to this stream.
- */
- private Color color;
-
- /**
- * The font style used to decorate data written to this stream.
- */
- private int fontStyle;
-
- private String fEncoding;
- private String fDefaultEncoding = WorkbenchEncoding.getWorkbenchDefaultEncoding();
-
- /**
- * Constructs a new output stream on the given console.
- *
- * @param console I/O console
- */
- IOConsoleOutputStream(IOConsole console) {
- this.console = console;
- this.partitioner = (IOConsolePartitioner) console.getPartitioner();
- }
-
- /**
- * Returns the font style used to decorate data written to this stream.
- *
- * @return the font style used to decorate data written to this stream
- */
- public int getFontStyle() {
- return fontStyle;
- }
-
- /**
- * Sets the font style to be used to decorate data written to this stream.
- *
- * @param newFontStyle the font style to be used to decorate data written to this stream
- */
- public void setFontStyle(int newFontStyle) {
- if (newFontStyle != fontStyle) {
- int old = fontStyle;
- fontStyle = newFontStyle;
- console.firePropertyChange(this, IConsoleConstants.P_FONT_STYLE, new Integer(old), new Integer(fontStyle));
- }
- }
-
- /**
- * Returns whether the console this stream is writing to will be activated when this stream
- * is written to.
- *
- * @return whether the console this stream is writing to will be activated when this stream
- * is written to.
- */
- public boolean isActivateOnWrite() {
- return activateOnWrite;
- }
-
- /**
- * Sets whether to activate the console this stream is writing to when this stream
- * is written to.
- *
- * @param activateOnWrite whether the console this stream is writing to will be activated when this stream
- * is written to.
- */
- public void setActivateOnWrite(boolean activateOnWrite) {
- this.activateOnWrite = activateOnWrite;
- }
-
- /**
- * Sets the color of this stream. Use <code>null</code> to indicate
- * the default color.
- *
- * @param color color of this stream, or <code>null</code>
- */
- public void setColor(Color newColor) {
- Color old = color;
- if (old == null || !old.equals(newColor)) {
- color = newColor;
- console.firePropertyChange(this, IConsoleConstants.P_STREAM_COLOR, old, newColor);
- }
- }
-
- /**
- * Returns the color of this stream, or <code>null</code>
- * if default.
- *
- * @return the color of this stream, or <code>null</code>
- */
- public Color getColor() {
- return color;
- }
-
- /*
- * (non-Javadoc)
- * @see java.io.OutputStream#close()
- */
- public synchronized void close() throws IOException {
- if(closed) {
- throw new IOException("Output Stream is closed"); //$NON-NLS-1$
- }
- console.streamClosed(this);
- closed = true;
- partitioner = null;
- }
-
- /*
- * (non-Javadoc)
- * @see java.io.OutputStream#flush()
- */
- public void flush() throws IOException {
- if(closed) {
- throw new IOException("Output Stream is closed"); //$NON-NLS-1$
- }
- }
-
- /*
- * (non-Javadoc)
- * @see java.io.OutputStream#write(byte[], int, int)
- */
- public void write(byte[] b, int off, int len) throws IOException {
- if (fEncoding!=null && !fEncoding.equals(fDefaultEncoding)) {
- encodedWrite(new String(b, off, len, fEncoding));
- } else {
- encodedWrite(new String(b, off, len));
- }
- }
- /*
- * (non-Javadoc)
- * @see java.io.OutputStream#write(byte[])
- */
- public void write(byte[] b) throws IOException {
- write(b, 0, b.length);
- }
- /*
- * (non-Javadoc)
- * @see java.io.OutputStream#write(int)
- */
- public void write(int b) throws IOException {
- write(new byte[] {(byte)b}, 0, 1);
- }
-
- /**
- * Writes a string to the attached console.
- *
- * @param str the string to write to the attached console.
- * @throws IOException if the stream is closed.
- */
- public synchronized void write(String str) throws IOException {
- if (fEncoding!=null && !fEncoding.equals(fDefaultEncoding)) {
- byte[] defaultBytes = str.getBytes();
- str = new String(defaultBytes, fEncoding);
- }
- encodedWrite(str);
- }
-
- private void encodedWrite(String encodedString) throws IOException {
- if(closed) {
- throw new IOException("Output Stream is closed"); //$NON-NLS-1$
- }
- partitioner.streamAppended(this, encodedString);
- if (activateOnWrite) {
- console.activate();
- } else {
- ConsolePlugin.getDefault().getConsoleManager().warnOfContentChange(console);
- }
- }
-
- /**
- * Sets the character encoding used to interpret characters written to this steam.
- *
- * @param encoding endcoding identifier
- */
- public void setEncoding(String encoding) {
- fEncoding = encoding;
- }
-}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/console/IPatternMatchListener.java b/org.eclipse.ui.console/src/org/eclipse/ui/console/IPatternMatchListener.java
deleted file mode 100644
index 8d47365ff..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/IPatternMatchListener.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.console;
-
-/**
- * A pattern match listener is registered with a <code>TextConsole</code>,
- * and is notified when its pattern has been matched to contents in
- * that console. A pattern match listener can be registered with a console
- * programmatically or via the <code>consolePatternMatchListeners</code> extension
- * point.
- * <p>
- * Following is an example console pattern match listener extension definition.
- * </pre>
- * &lt;extension point="org.eclipse.ui.console.consolePatternMatchListeners"&gt;
- * &lt;consolePatternMatchListener
- * id="com.example.ConsolePatternMatcher"
- * regex=".*foo.*"
- * class="com.example.ConsolePatternMatcher"&gt;
- * &lt;/consolePatternMatchListener&gt;
- * &lt;/extension&gt;
- * </pre>
- * Attributes are specified as follows:
- * <ul>
- * <li><code>id</code> - a unique identifier for the pattern match listener</li>
- * <li><code>regex</code> - regular expression to match</li>
- * <li><code>class</code> - fully qualified name of the Java class implementing
- * <code>org.eclipse.ui.console.IPatternMatchListenerDelegate</code></li>
- * </ul>
- * </p>
- * <p>
- * Optionally a <code>qualifier</code> attribute may be specified to improve performance
- * of regular expression matching. A qualifier specifies a simple regular expression used to
- * qualify lines for the search. Lines that do not contain the qualifier are not considered.
- * </p>
- * <p>
- * Optionally an <code>enablement</code> expression may be provided to specify
- * which console(s) a pattern matcher should be contributed to.
- * </p>
- * <p>
- * Clients may implement this interface directly if registering a pattern match listener with
- * a text console programmatically. Clients contributing a pattern match listener via an
- * extension implement <code>IPatternMatchListenerDelegate</code> instead.
- * </p>
- * @see org.eclipse.ui.console.TextConsole
- * @since 3.1
- */
-public interface IPatternMatchListener extends IPatternMatchListenerDelegate {
- /**
- * Returns the pattern to be used for matching. The pattern is
- * a string representing a regular expression.
- *
- * @return the regular expression to be used for matching
- */
- public String getPattern();
-
- /**
- * Returns the flags to use when compiling this pattern match listener's
- * regular expression, as defined by by <code>Pattern.compile(String regex, int flags)</code>
- *
- * @return the flags to use when compiling this pattern match listener's
- * regular expression
- * @see java.util.regex.Pattern#compile(java.lang.String, int)
- */
- public int getCompilerFlags();
-
- /**
- * Returns a simple regular expression used to identify lines that may
- * match this pattern matcher's complete pattern, or <code>null</code>.
- * Use of this attribute can improve performance by disqualifying lines
- * from the search. When a line is found containing a match for this expression,
- * the line is searched from the beginning for this pattern matcher's
- * complete pattern. Lines not containing this pattern are discarded.
- *
- * @return a simple regular expression used to identify lines that may
- * match this pattern matcher's complete pattern, or <code>null</code>
- */
- public String getLineQualifier();
-
-}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/console/IPatternMatchListenerDelegate.java b/org.eclipse.ui.console/src/org/eclipse/ui/console/IPatternMatchListenerDelegate.java
deleted file mode 100644
index 026f22233..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/IPatternMatchListenerDelegate.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.console;
-
-/**
- * A pattern match listener delegate is notified of regular expression matches
- * in a text console. A delegate is contributed via the
- * <code>consolePatternMatcherListeners</code> extension point.
- * <p>
- * Clients contributing a console pattern match listener extension are intended
- * to implement this interface.
- * </p>
- * @see org.eclipse.ui.console.IPatternMatchListener
- * @see org.eclipse.ui.console.TextConsole
- * @since 3.1
- */
-public interface IPatternMatchListenerDelegate {
- /**
- * Notification that pattern matching will begin in the specified console.
- * A pattern matcher is connected to only one console at a time.
- *
- * @param console the console in which pattern matching will be performed
- */
- public void connect(TextConsole console);
-
- /**
- * Notification that pattern matching has been completed in the console
- * this delegate was last connected to.
- */
- public void disconnect();
-
- /**
- * Notification that a match has been found.
- *
- * @param event event describing where the match was found
- */
- public void matchFound(PatternMatchEvent event);
-}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/console/MessageConsole.java b/org.eclipse.ui.console/src/org/eclipse/ui/console/MessageConsole.java
deleted file mode 100644
index ead1be56c..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/MessageConsole.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.console;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.ui.internal.console.IOConsolePage;
-import org.eclipse.ui.part.IPageBookViewPage;
-
-/**
- * A console that displays messages. A message console may have one or
- * more streams connected to it (<code>MessageConsoleStream</code>).
- * Text written to streams is buffered and processed in a Job by the
- * console's document partitioner.
- * <p>
- * Clients may instantiate this class.
- * </p>
- * @since 3.0
- */
-public class MessageConsole extends IOConsole {
-
- /**
- * Consturcts a message console with the given name and image.
- *
- * @param name console name
- * @param imageDescriptor console image descriptor or <code>null</code>
- */
- public MessageConsole(String name, ImageDescriptor imageDescriptor) {
- this(name, imageDescriptor, true);
- }
-
- /**
- * Constructs a message console.
- *
- * @param name console name
- * @param imageDescriptor console image descriptor or <code>null</code>
- * @param autoLifecycle whether lifecycle methods should be called automatically
- * when added and removed from the console manager
- * @since 3.1
- */
- public MessageConsole(String name, ImageDescriptor imageDescriptor, boolean autoLifecycle) {
- super(name, IConsoleConstants.MESSAGE_CONSOLE_TYPE, imageDescriptor, autoLifecycle);
- }
-
- /**
- * Returns a new message stream connected to this console.
- *
- * @return a new message stream connected to this console
- */
- public MessageConsoleStream newMessageStream() {
- return new MessageConsoleStream(this);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.IConsole#createPage(org.eclipse.ui.console.IConsoleView)
- */
- public IPageBookViewPage createPage(IConsoleView view) {
- IOConsolePage page = (IOConsolePage) super.createPage(view);
- page.setReadOnly();
- return page;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.IOConsole#getInputStream()
- */
- public IOConsoleInputStream getInputStream() {
- throw new UnsupportedOperationException("Message Console does not support user input"); //$NON-NLS-1$
- }
-
-}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/console/MessageConsoleStream.java b/org.eclipse.ui.console/src/org/eclipse/ui/console/MessageConsoleStream.java
deleted file mode 100644
index 9357e2654..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/MessageConsoleStream.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.console;
-
-import java.io.IOException;
-
-/**
- * Used to write messages to a message console. A message console may have more
- * than one stream connected to it. Each stream may be displayed in a different
- * color.
- *
- * @since 3.0
- */
-public class MessageConsoleStream extends IOConsoleOutputStream {
-
- private MessageConsole fMessageConsole;
-
- /**
- * Constructs a new stream connected to the given console.
- *
- * @param console the console to write messages to
- */
- public MessageConsoleStream(MessageConsole console) {
- super(console);
- fMessageConsole = console;
- }
-
- /**
- * Appends the specified message to this stream.
- *
- * @param message message to append
- */
- public void print(String message) {
- try {
- write(message);
- } catch (IOException e) {
- ConsolePlugin.log(e);
- }
- }
-
-
- /**
- * Appends a line separator string to this stream.
- */
- public void println() {
- try {
- write("\n"); //$NON-NLS-1$
- } catch (IOException e) {
- ConsolePlugin.log(e);
- }
- }
-
- /**
- * Appends the specified message to this stream, followed by a line
- * separator string.
- *
- * @param message message to print
- */
- public void println(String message) {
- print(message);
- println();
- }
-
- /**
- * Returns the console this stream is connected to.
- *
- * @return the console this stream is connected to
- */
- public MessageConsole getConsole() {
- return fMessageConsole;
- }
-}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/console/PatternMatchEvent.java b/org.eclipse.ui.console/src/org/eclipse/ui/console/PatternMatchEvent.java
deleted file mode 100644
index 139b4871a..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/PatternMatchEvent.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.console;
-
-import java.util.EventObject;
-
-/**
- * An event describing a pattern match in a text console. The source of the event
- * is a <code>TextConsole</code>.
- *
- * @see org.eclipse.ui.console.IPatternMatchListener
- * @see org.eclipse.ui.console.TextConsole
- * @since 3.1
- */
-public class PatternMatchEvent extends EventObject {
- /*
- * required by EventObject for ObjectSerialization.
- */
- private static final long serialVersionUID = 876890383326854537L;
-
- /**
- * The offset of the match within the console's document.
- */
- private int offset;
-
- /**
- * The length of the matched string
- */
- private int length;
-
- /**
- * Constructs a new pattern match event.
- *
- * @param console the console in which the match was found
- * @param matchOffset the offset at which the match was found
- * @param matchLength the length of the text that matched
- */
- public PatternMatchEvent(TextConsole console, int matchOffset, int matchLength) {
- super(console);
- offset = matchOffset;
- length = matchLength;
- }
-
- /**
- * Returns the length of the matched string.
- *
- * @return the length of the matched string
- */
- public int getLength() {
- return length;
- }
-
- /**
- * Returns the offset of the match within the document.
- *
- * @return the offset of the match within the document
- */
- public int getOffset() {
- return offset;
- }
-
-}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsole.java b/org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsole.java
deleted file mode 100644
index 92e97b854..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsole.java
+++ /dev/null
@@ -1,494 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.console;
-
-import java.util.HashMap;
-
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.BadPositionCategoryException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.Position;
-import org.eclipse.jface.text.Region;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.ui.internal.console.ConsoleDocument;
-import org.eclipse.ui.internal.console.ConsoleHyperlinkPosition;
-import org.eclipse.ui.internal.console.ConsolePatternMatcher;
-import org.eclipse.ui.part.IPageBookViewPage;
-
-/**
- * An abstract text console that supports regular expression matching and
- * hyperlinks.
- * <p>
- * Pattern match listeners can be registered with a console programmatically
- * or via the <code>org.eclipse.ui.console.consolePatternMatchListeners</code>
- * extension point.
- * </p>
- * <p>
- * Clients may subclass this class. Subclasses must provide a document partitioner.
- * </p>
- * @since 3.1
- */
-public abstract class TextConsole extends AbstractConsole {
-
- /**
- * The current width of the console. Used for fixed width consoles.
- * A value of <=0 means does not have a fixed width.
- */
- private int fConsoleWidth;
- /**
- * The current tab width
- */
- private int fTabWidth;
- /**
- * The font used by this console
- */
- private Font fFont;
- /**
- * The Console's regular expression pattern matcher
- */
- private ConsolePatternMatcher fPatternMatcher;
-
- /**
- * The Console's document
- */
- private ConsoleDocument fDocument;
-
- /**
- * indication that the console's partitioner is not expecting more input
- */
- private boolean fPartitionerFinished = false;
-
- /**
- * Indication that the console's pattern matcher has finished.
- * (all matches have been found and all listeners notified)
- */
- private boolean fMatcherFinished = false;
-
- /**
- * indication that the console output complete property has been fired
- */
- private boolean fCompleteFired = false;
-
-
- /**
- * Map of client defined attributes
- */
- private HashMap fAttributes = new HashMap();
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.AbstractConsole#dispose()
- */
- protected void dispose() {
- super.dispose();
- fFont = null;
- synchronized(fAttributes) {
- fAttributes.clear();
- }
- }
- /**
- * Constructs a console with the given name, image descriptor, and lifecycle
- *
- * @param name name to display for this console
- * @param consoleType console type identifier or <code>null</code>
- * @param imageDescriptor image to display for this console or <code>null</code>
- * @param autoLifecycle whether lifecycle methods should be called automatically
- * when this console is added/removed from the console manager
- */
- public TextConsole(String name, String consoleType, ImageDescriptor imageDescriptor, boolean autoLifecycle) {
- super(name, consoleType, imageDescriptor, autoLifecycle);
- fDocument = new ConsoleDocument();
- fDocument.addPositionCategory(ConsoleHyperlinkPosition.HYPER_LINK_CATEGORY);
- fPatternMatcher = new ConsolePatternMatcher(this);
- fDocument.addDocumentListener(fPatternMatcher);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.IConsole#createPage(org.eclipse.ui.console.IConsoleView)
- */
- public IPageBookViewPage createPage(IConsoleView view) {
- return new TextConsolePage(this, view);
- }
-
- /**
- * Returns this console's document.
- * <p>
- * Note that a console may or may not support direct manipulation of its document.
- * For example, an I/O console document and its partitions are produced from the
- * streams connected to it, and clients are not intended to modify the document's
- * contents.
- * </p>
- *
- * @return this console's document
- */
- public IDocument getDocument() {
- return fDocument;
- }
-
- /**
- * Returns the current width of this console. A value of zero of less
- * indicates this console has no fixed width.
- *
- * @return the current width of this console
- */
- public int getConsoleWidth() {
- return fConsoleWidth;
- }
-
- /**
- * Sets the width of this console in characters. Any value greater than zero
- * will cause this console to have a fixed width.
- *
- * @param width the width to make this console. Values of 0 or less imply
- * the console does not have any fixed width.
- */
- public void setConsoleWidth(int width) {
- if (fConsoleWidth != width) {
- int old = fConsoleWidth;
- fConsoleWidth = width;
-
- firePropertyChange(this, IConsoleConstants.P_CONSOLE_WIDTH, new Integer(old), new Integer(fConsoleWidth));
- }
- }
-
- /**
- * Sets the tab width used in this console.
- *
- * @param newTabWidth the tab width
- */
- public void setTabWidth(final int newTabWidth) {
- if (fTabWidth != newTabWidth) {
- final int oldTabWidth = fTabWidth;
- fTabWidth = newTabWidth;
- ConsolePlugin.getStandardDisplay().asyncExec(new Runnable() {
- public void run() {
- firePropertyChange(TextConsole.this, IConsoleConstants.P_TAB_SIZE, new Integer(oldTabWidth), new Integer(fTabWidth));
- }
- });
- }
- }
-
- /**
- * Returns the tab width used in this console.
- *
- * @return tab width used in this console
- */
- public int getTabWidth() {
- return fTabWidth;
- }
-
- /**
- * Returns the font used by this console. Must be called in the UI thread.
- *
- * @return font used by this console
- */
- public Font getFont() {
- if (fFont == null) {
- fFont = getDefaultFont();
- }
- return fFont;
- }
-
- /**
- * Returns the default text font.
- *
- * @return the default text font
- */
- private Font getDefaultFont() {
- return JFaceResources.getFont(JFaceResources.TEXT_FONT);
- }
-
- /**
- * Sets the font used by this console. Specify <code>null</code> to use
- * the default text font.
- *
- * @param font font, or <code>null</code> to indicate the default font
- */
- public void setFont(Font newFont) {
- // ensure font is initialized
- getFont();
- // translate null to default font
- if (newFont == null) {
- newFont = getDefaultFont();
- }
- // fire property change if required
- if (!fFont.equals(newFont)) {
- Font old = fFont;
- fFont = newFont;
- firePropertyChange(this, IConsoleConstants.P_FONT, old, fFont);
- }
- }
-
- /**
- * Clears the console.
- * <p>
- * Since a console may or may not support direct manipulation
- * of its document's contents, this method should be called to clear a text console's
- * document. The default implementation sets this console's document content
- * to the empty string directly. Subclasses should override as required.
- * </p>
- */
- public void clearConsole() {
- IDocument document = getDocument();
- if (document != null) {
- document.set(""); //$NON-NLS-1$
- }
- }
-
- /**
- * Returns the console's document partitioner.
- * @return
- */
- protected abstract IConsoleDocumentPartitioner getPartitioner();
-
- /**
- * Returns all hyperlinks in this console.
- *
- * @return all hyperlinks in this console
- */
- public IHyperlink[] getHyperlinks() {
- try {
- Position[] positions = getDocument().getPositions(ConsoleHyperlinkPosition.HYPER_LINK_CATEGORY);
- IHyperlink[] hyperlinks = new IHyperlink[positions.length];
- for (int i = 0; i < positions.length; i++) {
- ConsoleHyperlinkPosition position = (ConsoleHyperlinkPosition) positions[i];
- hyperlinks[i] = position.getHyperLink();
- }
- return hyperlinks;
- } catch (BadPositionCategoryException e) {
- return new IHyperlink[0];
- }
- }
-
- /**
- * Returns the hyperlink at the given offset of <code>null</code> if none.
- *
- * @param offset offset for which a hyperlink is requested
- * @return the hyperlink at the given offset of <code>null</code> if none
- */
- public IHyperlink getHyperlink(int offset) {
- try {
- IDocument document = getDocument();
- if (document != null) {
- Position[] positions = document.getPositions(ConsoleHyperlinkPosition.HYPER_LINK_CATEGORY);
- Position position = findPosition(offset, positions);
- if (position instanceof ConsoleHyperlinkPosition) {
- return ((ConsoleHyperlinkPosition) position).getHyperLink();
- }
- }
- } catch (BadPositionCategoryException e) {
- }
- return null;
- }
-
- /**
- * Binary search for the position at a given offset.
- *
- * @param offset the offset whose position should be found
- * @return the position containing the offset, or <code>null</code>
- */
- private Position findPosition(int offset, Position[] positions) {
-
- if (positions.length == 0)
- return null;
-
- int left= 0;
- int right= positions.length -1;
- int mid= 0;
- Position position= null;
-
- while (left < right) {
-
- mid= (left + right) / 2;
-
- position= positions[mid];
- if (offset < 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;
- }
- }
-
- position= positions[left];
- if (offset >= position.getOffset() && (offset < (position.getOffset() + position.getLength()))) {
- return position;
- }
- return null;
- }
-
- /**
- * Adds the given pattern match listener to this console. The listener will
- * be connected and receive match notifications. Has no effect if an identical
- * listener has already been added.
- *
- * @param listener the listener to add
- */
- public void addPatternMatchListener(IPatternMatchListener listener) {
- fPatternMatcher.addPatternMatchListener(listener);
- }
-
- /**
- * Removes the given pattern match listener from this console. The listener will be
- * disconnected and will no longer receive match notifications. Has no effect
- * if the listener was not previously added.
- *
- * @param listener the pattern match listener to remove
- */
- public void removePatternMatchListener(IPatternMatchListener listener) {
- fPatternMatcher.removePatternMatchListener(listener);
- }
-
-
- /**
- * Job scheduling rule that prevent the job from running if the console's PatternMatcher
- * is active.
- */
- private class MatcherSchedulingRule implements ISchedulingRule {
- public boolean contains(ISchedulingRule rule) {
- return rule == this;
- }
-
- public boolean isConflicting(ISchedulingRule rule) {
- if (contains(rule)) {
- return true;
- }
- if (rule != this && rule instanceof MatcherSchedulingRule) {
- return (((MatcherSchedulingRule)rule).getConsole() == TextConsole.this);
- }
- return false;
- }
-
- public TextConsole getConsole() {
- return TextConsole.this;
- }
- }
-
- /**
- * Returns a scheduling rule which can be used to prevent jobs from running
- * while this console's pattern matcher is active.
- *
- * @return a scheduling rule which can be used to prevent jobs from running
- * while this console's pattern matcher is active
- */
- public ISchedulingRule getSchedulingRule() {
- return new MatcherSchedulingRule();
- }
-
- /**
- * This console's partitioner should call this method when it is not expecting any new data
- * to be appended to the document.
- */
- public void partitionerFinished() {
- fPatternMatcher.forceFinalMatching();
- fPartitionerFinished = true;
- checkFinished();
- }
-
- /**
- * Called by this console's pattern matcher when matching is complete.
- * <p>
- * Clients should not call this method.
- * <p>
- */
- public void matcherFinished() {
- fMatcherFinished = true;
- fDocument.removeDocumentListener(fPatternMatcher);
- checkFinished();
- }
-
- /**
- * Fires the console output complete property change event.
- */
- private synchronized void checkFinished() {
- if (!fCompleteFired && fPartitionerFinished && fMatcherFinished ) {
- fCompleteFired = true;
- firePropertyChange(this, IConsoleConstants.P_CONSOLE_OUTPUT_COMPLETE, null, null);
- }
- }
-
- /**
- * Adds a hyperlink to this console.
- *
- * @param hyperlink the hyperlink to add
- * @param offset the offset in the console document at which the hyperlink should be added
- * @param length the length of the text which should be hyperlinked
- * @throws BadLocationException if the specified location is not valid.
- */
- public void addHyperlink(IHyperlink hyperlink, int offset, int length) throws BadLocationException {
- IDocument document = getDocument();
- ConsoleHyperlinkPosition hyperlinkPosition = new ConsoleHyperlinkPosition(hyperlink, offset, length);
- try {
- document.addPosition(ConsoleHyperlinkPosition.HYPER_LINK_CATEGORY, hyperlinkPosition);
- firePropertyChange(this, IConsoleConstants.P_CONSOLE_HYPERLINK_ADDED, null, null);
- } catch (BadPositionCategoryException e) {
- ConsolePlugin.log(e);
- }
- }
-
- /**
- * Returns the region assocaited with the given hyperlink.
- *
- * @param link hyperlink
- * @return the region associated witht the hyperlink
- */
- public IRegion getRegion(IHyperlink link) {
- try {
- IDocument doc = getDocument();
- if (doc != null) {
- Position[] positions = doc.getPositions(ConsoleHyperlinkPosition.HYPER_LINK_CATEGORY);
- for (int i = 0; i < positions.length; i++) {
- ConsoleHyperlinkPosition position = (ConsoleHyperlinkPosition)positions[i];
- if (position.getHyperLink().equals(link)) {
- return new Region(position.getOffset(), position.getLength());
- }
- }
- }
- } catch (BadPositionCategoryException e) {
- }
- return null;
- }
-
- /**
- * Returns the attribue associated with the specified key.
- *
- * @param key attribute key
- * @return the attribue associated with the specified key
- */
- public Object getAttribute(String key) {
- synchronized (fAttributes) {
- return fAttributes.get(key);
- }
- }
-
- /**
- * Sets an attribute value. Intended for client data.
- *
- * @param key attribute key
- * @param value attribute value
- */
- public void setAttribute(String key, Object value) {
- synchronized(fAttributes) {
- fAttributes.put(key, value);
- }
- }
-}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsolePage.java b/org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsolePage.java
deleted file mode 100644
index 3183e7f5b..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsolePage.java
+++ /dev/null
@@ -1,411 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.console;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.ResourceBundle;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IMenuListener;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IFindReplaceTarget;
-import org.eclipse.jface.text.ITextListener;
-import org.eclipse.jface.text.ITextOperationTarget;
-import org.eclipse.jface.text.TextEvent;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.Widget;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.ISharedImages;
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.actions.ActionFactory;
-import org.eclipse.ui.console.actions.ClearOutputAction;
-import org.eclipse.ui.console.actions.TextViewerAction;
-import org.eclipse.ui.internal.console.ConsoleMessages;
-import org.eclipse.ui.internal.console.FollowHyperlinkAction;
-import org.eclipse.ui.part.IPageBookViewPage;
-import org.eclipse.ui.part.IPageSite;
-import org.eclipse.ui.texteditor.FindReplaceAction;
-import org.eclipse.ui.texteditor.IUpdate;
-import org.eclipse.ui.texteditor.IWorkbenchActionDefinitionIds;
-
-/**
- * A page for a text console.
- * <p>
- * Clients may contribute actions to the context menu of a text console page
- * using the <code>org.eclipse.ui.popupMenus</code> extension point. The context
- * menu identifier for a text console page is the associated console's type
- * suffixed with <code>.#ContextMenu</code>. When a console does not specify
- * a type, the context menu id is <code>#ContextMenu</code>.
- * </p>
- * <p>
- * Clients may subclass this class.
- * </p>
- * @since 3.1
- */
-public class TextConsolePage implements IPageBookViewPage, IPropertyChangeListener, IAdaptable {
- private IPageSite fSite;
- private TextConsole fConsole;
- private IConsoleView fConsoleView;
- private TextConsoleViewer fViewer;
- private MenuManager fMenuManager;
- protected Map fGlobalActions = new HashMap();
- protected ArrayList fSelectionActions = new ArrayList();
- protected ClearOutputAction fClearOutputAction;
-
- private Object fLock = new Object();
- private boolean fUpdateScheduled = false;
-
- // text selection listener, used to update selection dependant actions on selection changes
- private ISelectionChangedListener selectionChangedListener = new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- updateSelectionDependentActions();
- }
- };
-
- // updates the find replace action if the document length is > 0
- private ITextListener textListener = new ITextListener() {
- public void textChanged(TextEvent event) {
- IUpdate findReplace = (IUpdate)fGlobalActions.get(ActionFactory.FIND.getId());
- if (findReplace != null) {
- findReplace.update();
- }
- }
- };
-
- /**
- * Constructs a text console page for the given console in the given view.
- *
- * @param console text console
- * @param view console view the page is contained in
- */
- public TextConsolePage(TextConsole console, IConsoleView view) {
- fConsole = console;
- fConsoleView = view;
- }
-
- /**
- * Returns a viewer used to display the contents of this page's console.
- *
- * @param parent container for the viewer
- * @return a viewer used to display the contents of this page's console
- */
- protected TextConsoleViewer createViewer(Composite parent) {
- return new TextConsoleViewer(parent, fConsole);
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.part.IPageBookViewPage#getSite()
- */
- public IPageSite getSite() {
- return fSite;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.part.IPageBookViewPage#init(org.eclipse.ui.part.IPageSite)
- */
- public void init(IPageSite pageSite) throws PartInitException {
- fSite = pageSite;
- }
-
- /**
- * Updates selection dependent actions.
- */
- protected void updateSelectionDependentActions() {
- Iterator iterator= fSelectionActions.iterator();
- while (iterator.hasNext()) {
- updateAction((String)iterator.next());
- }
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.part.IPage#createControl(org.eclipse.swt.widgets.Composite)
- */
- public void createControl(Composite parent) {
- fViewer = createViewer(parent);
- fViewer.setConsoleWidth(fConsole.getConsoleWidth());
- fViewer.setTabWidth(fConsole.getTabWidth());
- fConsole.addPropertyChangeListener(this);
- JFaceResources.getFontRegistry().addListener(this);
-
- String id = "#ContextMenu"; //$NON-NLS-1$
- if (getConsole().getType() != null) {
- id = getConsole().getType() + "." + id; //$NON-NLS-1$
- }
- fMenuManager= new MenuManager("#ContextMenu", id); //$NON-NLS-1$//$NON-NLS-2$
- fMenuManager.setRemoveAllWhenShown(true);
- fMenuManager.addMenuListener(new IMenuListener() {
- public void menuAboutToShow(IMenuManager m) {
- contextMenuAboutToShow(m);
- }
- });
- Menu menu = fMenuManager.createContextMenu(getControl());
- getControl().setMenu(menu);
-
- createActions();
- configureToolBar(getSite().getActionBars().getToolBarManager());
-
- getSite().registerContextMenu(id, fMenuManager, fViewer); //$NON-NLS-1$
- getSite().setSelectionProvider(fViewer);
-
- fViewer.getSelectionProvider().addSelectionChangedListener(selectionChangedListener);
- fViewer.addTextListener(textListener);
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.part.IPage#dispose()
- */
- public void dispose() {
- fConsole.removePropertyChangeListener(this);
- JFaceResources.getFontRegistry().removeListener(this);
-
- if (fMenuManager != null) {
- fMenuManager.dispose();
- }
- fClearOutputAction = null;
- fSelectionActions.clear();
- fGlobalActions.clear();
-
- fViewer.getSelectionProvider().removeSelectionChangedListener(selectionChangedListener);
- fViewer.removeTextListener(textListener);
- fViewer = null;
- }
-
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.part.IPage#getControl()
- */
- public Control getControl() {
- return fViewer != null ? fViewer.getControl() : null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.IPage#setActionBars(org.eclipse.ui.IActionBars)
- */
- public void setActionBars(IActionBars actionBars) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.IPage#setFocus()
- */
- public void setFocus() {
- if (fViewer != null) {
- fViewer.getTextWidget().setFocus();
- }
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
- */
- public void propertyChange(PropertyChangeEvent event) {
- if (fViewer != null) {
- Object source = event.getSource();
- String property = event.getProperty();
-
- if (source.equals(fConsole) && IConsoleConstants.P_FONT.equals(property)) {
- fViewer.setFont(fConsole.getFont());
- } else if (IConsoleConstants.P_FONT_STYLE.equals(property)) {
- fViewer.getTextWidget().redraw();
- } else if (property.equals(IConsoleConstants.P_STREAM_COLOR)) {
- fViewer.getTextWidget().redraw();
- } else if (source.equals(fConsole) && property.equals(IConsoleConstants.P_TAB_SIZE)) {
- Integer tabSize = (Integer)event.getNewValue();
- fViewer.setTabWidth(tabSize.intValue());
- } else if (source.equals(fConsole) && property.equals(IConsoleConstants.P_CONSOLE_WIDTH)) {
- fViewer.setConsoleWidth(fConsole.getConsoleWidth());
- } else if (property.equals(IConsoleConstants.P_CONSOLE_HYPERLINK_ADDED)) {
- synchronized (fLock) {
- if (fUpdateScheduled) {
- return;
- } else if (fViewer != null) {
- fUpdateScheduled = true;
- ConsolePlugin.getStandardDisplay().asyncExec(new Runnable() {
- public void run() {
- synchronized (fLock) {
- if(fViewer != null) {
- fViewer.getTextWidget().redraw();
- }
- fUpdateScheduled = false;
- }
- }
- });
- }
- }
- }
- }
- }
-
- /**
- * Creates actions.
- */
- protected void createActions() {
- IActionBars actionBars= getSite().getActionBars();
- TextViewerAction action= new TextViewerAction(fViewer, ITextOperationTarget.SELECT_ALL);
- action.configureAction(ConsoleMessages.getString("IOConsolePage.0"), ConsoleMessages.getString("IOConsolePage.1"), ConsoleMessages.getString("IOConsolePage.2")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- setGlobalAction(actionBars, ActionFactory.SELECT_ALL.getId(), action);
-
- action= new TextViewerAction(fViewer, ITextOperationTarget.CUT);
- action.configureAction(ConsoleMessages.getString("IOConsolePage.3"), ConsoleMessages.getString("IOConsolePage.4"), ConsoleMessages.getString("IOConsolePage.5")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- action.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_CUT));
- action.setActionDefinitionId(IWorkbenchActionDefinitionIds.CUT);
- setGlobalAction(actionBars, ActionFactory.CUT.getId(), action);
-
- action= new TextViewerAction(fViewer, ITextOperationTarget.COPY);
- action.configureAction(ConsoleMessages.getString("IOConsolePage.6"), ConsoleMessages.getString("IOConsolePage.7"), ConsoleMessages.getString("IOConsolePage.8")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- action.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_COPY));
- action.setActionDefinitionId(IWorkbenchActionDefinitionIds.COPY);
- setGlobalAction(actionBars, ActionFactory.COPY.getId(), action);
-
- action= new TextViewerAction(fViewer, ITextOperationTarget.PASTE);
- action.configureAction(ConsoleMessages.getString("IOConsolePage.9"), ConsoleMessages.getString("IOConsolePage.10"), ConsoleMessages.getString("IOConsolePage.11")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- action.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_PASTE));
- action.setActionDefinitionId(IWorkbenchActionDefinitionIds.PASTE);
- setGlobalAction(actionBars, ActionFactory.PASTE.getId(), action);
-
- fClearOutputAction = new ClearOutputAction(fConsole);
-
- ResourceBundle bundle= ResourceBundle.getBundle("org.eclipse.ui.internal.console.ConsoleMessages"); //$NON-NLS-1$
- setGlobalAction(actionBars, ActionFactory.FIND.getId(), new FindReplaceAction(bundle, "find_replace_action.", fConsoleView)); //$NON-NLS-1$
-
- fSelectionActions.add(ActionFactory.CUT.getId());
- fSelectionActions.add(ActionFactory.COPY.getId());
- fSelectionActions.add(ActionFactory.PASTE.getId());
- fSelectionActions.add(ActionFactory.FIND.getId());
-
- actionBars.updateActionBars();
- }
-
- /**
- * Configures an action for key bindings.
- *
- * @param actionBars action bars for this page
- * @param actionID action definition id
- * @param action associated action
- */
- protected void setGlobalAction(IActionBars actionBars, String actionID, IAction action) {
- fGlobalActions.put(actionID, action);
- actionBars.setGlobalActionHandler(actionID, action);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
- */
- public Object getAdapter(Class required) {
- if (IFindReplaceTarget.class.equals(required)) {
- return fViewer.getFindReplaceTarget();
- }
- if (Widget.class.equals(required)) {
- return fViewer.getTextWidget();
- }
- return null;
- }
-
- /**
- * Returns the view this page is contained in.
- *
- * @return the view this page is contained in
- */
- protected IConsoleView getConsoleView() {
- return fConsoleView;
- }
-
- /**
- * Returns the console this page is displaying.
- *
- * @return the console this page is displaying
- */
- protected IConsole getConsole() {
- return fConsole;
- }
-
- /**
- * Updates the global action with the given id
- *
- * @param actionId action definition id
- */
- protected void updateAction(String actionId) {
- IAction action= (IAction)fGlobalActions.get(actionId);
- if (action instanceof IUpdate) {
- ((IUpdate) action).update();
- }
- }
-
-
- /**
- * Fill the context menu
- *
- * @param menuManager menu
- */
- protected void contextMenuAboutToShow(IMenuManager menuManager) {
- IDocument doc= fViewer.getDocument();
- if (doc == null) {
- return;
- }
-
- menuManager.add((IAction)fGlobalActions.get(ActionFactory.CUT.getId()));
- menuManager.add((IAction)fGlobalActions.get(ActionFactory.COPY.getId()));
- menuManager.add((IAction)fGlobalActions.get(ActionFactory.PASTE.getId()));
- menuManager.add((IAction)fGlobalActions.get(ActionFactory.SELECT_ALL.getId()));
-
- menuManager.add(new Separator("FIND")); //$NON-NLS-1$
- menuManager.add((IAction)fGlobalActions.get(ActionFactory.FIND.getId()));
- menuManager.add(new FollowHyperlinkAction(fViewer));
- menuManager.add(fClearOutputAction);
-
- menuManager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
- }
-
- protected void configureToolBar(IToolBarManager mgr) {
- mgr.appendToGroup(IConsoleConstants.OUTPUT_GROUP, fClearOutputAction);
- }
-
-
- /**
- * Returns the viewer contained in this page.
- *
- * @return the viewer contained in this page
- */
- public TextConsoleViewer getViewer() {
- return fViewer;
- }
-
- /**
- * Sets the viewer contained in this page.
- *
- * @param viewer text viewer
- */
- public void setViewer(TextConsoleViewer viewer) {
- this.fViewer = viewer;
- }
-}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsoleViewer.java b/org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsoleViewer.java
deleted file mode 100644
index 006c2a595..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsoleViewer.java
+++ /dev/null
@@ -1,575 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Common Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors: IBM Corporation - initial API and implementation
- ******************************************************************************/
-
-package org.eclipse.ui.console;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jface.preference.JFacePreferences;
-import org.eclipse.jface.resource.ColorRegistry;
-import org.eclipse.jface.resource.JFaceColors;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.text.BadPositionCategoryException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IDocumentAdapter;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.Position;
-import org.eclipse.jface.text.TextViewer;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.LineBackgroundEvent;
-import org.eclipse.swt.custom.LineBackgroundListener;
-import org.eclipse.swt.custom.LineStyleEvent;
-import org.eclipse.swt.custom.LineStyleListener;
-import org.eclipse.swt.custom.StyleRange;
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseListener;
-import org.eclipse.swt.events.MouseMoveListener;
-import org.eclipse.swt.events.MouseTrackListener;
-import org.eclipse.swt.events.PaintEvent;
-import org.eclipse.swt.events.PaintListener;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Cursor;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.FontMetrics;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.internal.console.ConsoleDocumentAdapter;
-import org.eclipse.ui.internal.console.ConsoleHyperlinkPosition;
-
-/**
- * Default viewer used to display a <code>TextConsole</code>.
- * <p>
- * Clients may subclass this class.
- * </p>
- * @since 3.1
- */
-public class TextConsoleViewer extends TextViewer implements LineStyleListener, LineBackgroundListener, MouseTrackListener, MouseMoveListener, MouseListener, PaintListener {
- /**
- * Adapts document to the text widget.
- */
- private ConsoleDocumentAdapter documentAdapter;
-
- private IHyperlink hyperlink;
-
- private Cursor handCursor;
-
- private Cursor textCursor;
-
- private int consoleWidth = -1;
-
- private TextConsole console;
-
- private IPropertyChangeListener propertyChangeListener;
-
- /**
- * Constructs a new viewer in the given parent for the specified console.
- *
- * @param parent containing widget
- * @param console text console
- */
- public TextConsoleViewer(Composite parent, TextConsole console) {
- super(parent, SWT.H_SCROLL | SWT.V_SCROLL);
- this.console = console;
- setDocument(console.getDocument());
-
- StyledText styledText = getTextWidget();
- styledText.setDoubleClickEnabled(true);
- styledText.addLineStyleListener(this);
- styledText.addLineBackgroundListener(this);
- styledText.setEditable(true);
- setFont(console.getFont());
- styledText.addMouseTrackListener(this);
- styledText.addPaintListener(this);
-
- ColorRegistry colorRegistry = JFaceResources.getColorRegistry();
- propertyChangeListener = new HyperlinkColorChangeListener();
- colorRegistry.addListener(propertyChangeListener);
- }
-
- /**
- * Sets the tab width used by this viewer.
- *
- * @param tabWidth the tab width used by this viewer
- */
- public void setTabWidth(int tabWidth) {
- StyledText styledText = getTextWidget();
- styledText.setTabs(tabWidth);
- styledText.redraw();
- }
-
- /**
- * Sets the font used by this viewer.
- *
- * @param font the font used by this viewer
- */
- public void setFont(Font font) {
- StyledText styledText = getTextWidget();
- styledText.setFont(font);
- styledText.redraw();
- }
-
- /**
- * Positions the cursor at the end of the document.
- */
- protected void revealEndOfDocument() {
- StyledText text = getTextWidget();
- if (text != null) {
- int charCount = text.getCharCount();
- text.setCaretOffset(charCount);
- text.showSelection();
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.swt.custom.LineStyleListener#lineGetStyle(org.eclipse.swt.custom.LineStyleEvent)
- */
- public void lineGetStyle(LineStyleEvent event) {
- IDocument document = getDocument();
- if (document != null && document.getLength() > 0) {
- ArrayList ranges = new ArrayList();
- int offset = event.lineOffset;
- int length = event.lineText.length();
-
- StyleRange[] partitionerStyles = ((IConsoleDocumentPartitioner) document.getDocumentPartitioner()).getStyleRanges(event.lineOffset, event.lineText.length());
- if (partitionerStyles != null) {
- for (int i = 0; i < partitionerStyles.length; i++) {
- ranges.add(partitionerStyles[i]);
- }
- }
-
- try {
- Display display = ConsolePlugin.getStandardDisplay();
- Color hyperlinkText = JFaceColors.getHyperlinkText(display);
- Position[] positions = getDocument().getPositions(ConsoleHyperlinkPosition.HYPER_LINK_CATEGORY);
- Position[] overlap = findPosition(offset, length, positions);
- if (overlap != null) {
- for (int i = 0; i < overlap.length; i++) {
- weave(ranges, new StyleRange(overlap[i].offset, overlap[i].length, hyperlinkText, null));
- }
- }
- } catch (BadPositionCategoryException e) {
- }
-
- if (ranges.size() > 0) {
- event.styles = (StyleRange[]) ranges.toArray(new StyleRange[ranges.size()]);
- }
- }
- }
-
- /**
- * Weaves the given style range into the given list of style ranges. The given
- * range may overlap ranges in the list of ranges, and must be split into
- * non-overlapping ranges and inserted into the list to maintain order.
- *
- * @param ranges
- * @param styleRange
- */
- private void weave(List ranges, StyleRange styleRange) {
- if (ranges.isEmpty()) {
- ranges.add(styleRange);
- return;
- }
- int start = styleRange.start;
- int end = start + styleRange.length;
- for (int i = 0; i < ranges.size(); i++) {
- StyleRange r = (StyleRange) ranges.get(i);
- int rEnd = r.start + r.length;
- if (start < r.start) {
- if (end >= r.start) {
- ranges.add(i, new StyleRange(start, r.start - start, styleRange.foreground, styleRange.background));
- if (end > rEnd) {
- start = rEnd + 1;
- } else {
- return;
- }
- } else {
-
- }
- } else if (start < rEnd) {
- if (end > rEnd) {
- start = rEnd + 1;
- } else {
- return;
- }
- }
- }
- if (start < end) {
- ranges.add(new StyleRange(start, end - start, styleRange.foreground, styleRange.background));
- }
- }
-
- /**
- * Binary search for the positions overlapping the given range
- *
- * @param offset the offset of the range
- * @param length the length of the range
- * @param positions the positions to search
- * @return the positions overlapping the given range, or <code>null</code>
- */
- private Position[] findPosition(int offset, int length, Position[] positions) {
-
- if (positions.length == 0)
- return null;
-
- int rangeEnd = offset + length;
- int left= 0;
- int right= positions.length - 1;
- int mid= 0;
- Position position= null;
-
- while (left < right) {
-
- mid= (left + right) / 2;
-
- position= positions[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= positions[index];
- while (index >= 0 && (position.getOffset() + position.getLength()) > offset) {
- index--;
- if (index > 0) {
- position= positions[index];
- }
- }
- }
- index++;
- position= positions[index];
- while (index < positions.length && (position.getOffset() < rangeEnd)) {
- list.add(position);
- index++;
- if (index < positions.length) {
- position= positions[index];
- }
- }
-
- if (list.isEmpty()) {
- return null;
- }
- return (Position[])list.toArray(new Position[list.size()]);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.swt.custom.LineBackgroundListener#lineGetBackground(org.eclipse.swt.custom.LineBackgroundEvent)
- */
- public void lineGetBackground(LineBackgroundEvent event) {
- event.lineBackground = null;
- }
-
- /**
- * @see org.eclipse.swt.events.PaintListener#paintControl(org.eclipse.swt.events.PaintEvent)
- */
- public void paintControl(PaintEvent e) {
- if (hyperlink != null) {
- IDocument doc = getDocument();
- StyledText text = getTextWidget();
-
- if (doc == null || text == null) {
- return;
- }
-
- IConsoleDocumentPartitioner partitioner = (IConsoleDocumentPartitioner) doc.getDocumentPartitioner();
- if (partitioner == null) {
- return;
- }
-
- IRegion linkRegion = console.getRegion(hyperlink);
- if (linkRegion != null) {
- int start = linkRegion.getOffset();
- int end = start + linkRegion.getLength();
-
- Color fontColor = JFaceColors.getActiveHyperlinkText(Display.getCurrent());
- Color color = e.gc.getForeground();
- e.gc.setForeground(fontColor);
-
- FontMetrics metrics = e.gc.getFontMetrics();
- int height = metrics.getHeight();
- int width = metrics.getAverageCharWidth();
-
- int startLine = text.getLineAtOffset(start);
- int endLine = text.getLineAtOffset(end);
- int baseLineBias = text.getBaseline() - (metrics.getAscent() + metrics.getLeading());
-
- for (int i = startLine; i <= endLine; i++) {
- int styleStart = i == startLine ? start : text.getOffsetAtLine(i);
- int styleEnd = i == endLine ? end : text.getOffsetAtLine(i + 1);
- Point p1 = text.getLocationAtOffset(styleStart);
- Point p2 = text.getLocationAtOffset(styleEnd - 1);
- e.gc.drawLine(p1.x, p1.y + height + baseLineBias, p2.x + width, p2.y + height + baseLineBias);
-
- String hyperlinkText = text.getText(styleStart, styleEnd-1);
- e.gc.drawString(hyperlinkText, p1.x, p1.y + baseLineBias);
- }
- e.gc.setForeground(color);
- }
- }
- }
-
- /**
- * Returns the hand cursor.
- *
- * @return the hand cursor
- */
- protected Cursor getHandCursor() {
- if (handCursor == null) {
- handCursor = new Cursor(ConsolePlugin.getStandardDisplay(), SWT.CURSOR_HAND);
- }
- return handCursor;
- }
-
- /**
- * Returns the text cursor.
- *
- * @return the text cursor
- */
- protected Cursor getTextCursor() {
- if (textCursor == null) {
- textCursor = new Cursor(ConsolePlugin.getStandardDisplay(), SWT.CURSOR_IBEAM);
- }
- return textCursor;
- }
-
- /**
- * Notification a hyperlink has been entered.
- *
- * @param link the link that was entered
- */
- protected void linkEntered(IHyperlink link) {
- Control control = getTextWidget();
- control.setRedraw(false);
- if (hyperlink != null) {
- linkExited(hyperlink);
- }
- hyperlink = link;
- hyperlink.linkEntered();
- control.setCursor(getHandCursor());
- control.setRedraw(true);
- control.redraw();
- control.addMouseListener(this);
- }
-
- /**
- * Notification a link was exited.
- *
- * @param link the link that was exited
- */
- protected void linkExited(IHyperlink link) {
- link.linkExited();
- hyperlink = null;
- Control control = getTextWidget();
- control.setCursor(getTextCursor());
- control.redraw();
- control.removeMouseListener(this);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.swt.events.MouseTrackListener#mouseEnter(org.eclipse.swt.events.MouseEvent)
- */
- public void mouseEnter(MouseEvent e) {
- getTextWidget().addMouseMoveListener(this);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.swt.events.MouseTrackListener#mouseExit(org.eclipse.swt.events.MouseEvent)
- */
- public void mouseExit(MouseEvent e) {
- getTextWidget().removeMouseMoveListener(this);
- if (hyperlink != null) {
- linkExited(hyperlink);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.swt.events.MouseTrackListener#mouseHover(org.eclipse.swt.events.MouseEvent)
- */
- public void mouseHover(MouseEvent e) {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.swt.events.MouseMoveListener#mouseMove(org.eclipse.swt.events.MouseEvent)
- */
- public void mouseMove(MouseEvent e) {
- int offset = -1;
- try {
- Point p = new Point(e.x, e.y);
- offset = getTextWidget().getOffsetAtLocation(p);
- } catch (IllegalArgumentException ex) {
- // out of the document range
- }
- updateLinks(offset);
- }
-
- /**
- * The cursor has just be moved to the given offset, the mouse has hovered
- * over the given offset. Update link rendering.
- *
- * @param offset
- */
- protected void updateLinks(int offset) {
- if (offset >= 0) {
- IHyperlink link = getHyperlink(offset);
- if (link != null) {
- if (link.equals(hyperlink)) {
- return;
- }
- linkEntered(link);
- return;
- }
- }
- if (hyperlink != null) {
- linkExited(hyperlink);
- }
- }
-
- /**
- * Returns the currently active hyperlink or <code>null</code> if none.
- *
- * @return the currently active hyperlink or <code>null</code> if none
- */
- public IHyperlink getHyperlink() {
- return hyperlink;
- }
-
- /**
- * Returns the hyperlink at the specified offset, or <code>null</code> if none.
- *
- * @param offset offset at which a hyperlink has been requested
- * @return hyperlink at the specified offset, or <code>null</code> if none
- */
- public IHyperlink getHyperlink(int offset) {
- if (offset >= 0 && console != null) {
- return console.getHyperlink(offset);
- }
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.swt.events.MouseListener#mouseDoubleClick(org.eclipse.swt.events.MouseEvent)
- */
- public void mouseDoubleClick(MouseEvent e) {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.swt.events.MouseListener#mouseDown(org.eclipse.swt.events.MouseEvent)
- */
- public void mouseDown(MouseEvent e) {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.swt.events.MouseListener#mouseUp(org.eclipse.swt.events.MouseEvent)
- */
- public void mouseUp(MouseEvent e) {
- if (hyperlink != null) {
- String selection = getTextWidget().getSelectionText();
- if (selection.length() <= 0) {
- if (e.button == 1) {
- hyperlink.linkActivated();
- }
- }
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.text.TextViewer#createDocumentAdapter()
- */
- protected IDocumentAdapter createDocumentAdapter() {
- if (documentAdapter == null) {
- documentAdapter = new ConsoleDocumentAdapter(consoleWidth = -1);
- }
- return documentAdapter;
- }
-
- /**
- * Sets the console to have a fixed character width. Use -1 to indicate that a fixed
- * width should not be used.
- *
- * @param consoleWidth fixed characater width of the console, or -1
- */
- public void setConsoleWidth(int width) {
- consoleWidth = width;
- if (documentAdapter != null) {
- documentAdapter.setWidth(consoleWidth);
-
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.text.TextViewer#handleDispose()
- */
- protected void handleDispose() {
- super.handleDispose();
-
- StyledText styledText = getTextWidget();
- styledText.removeLineStyleListener(this);
- styledText.removeLineBackgroundListener(this);
- styledText.removeMouseTrackListener(this);
- styledText.removePaintListener(this);
-
- handCursor = null;
- textCursor = null;
- hyperlink = null;
- console = null;
-
- ColorRegistry colorRegistry = JFaceResources.getColorRegistry();
- colorRegistry.removeListener(propertyChangeListener);
- }
-
- class HyperlinkColorChangeListener implements IPropertyChangeListener {
- public void propertyChange(PropertyChangeEvent event) {
- if (event.getProperty().equals(JFacePreferences.ACTIVE_HYPERLINK_COLOR) || event.getProperty().equals(JFacePreferences.HYPERLINK_COLOR)) {
- getTextWidget().redraw();
- }
- }
-
- }
-}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/console/actions/ClearOutputAction.java b/org.eclipse.ui.console/src/org/eclipse/ui/console/actions/ClearOutputAction.java
deleted file mode 100644
index 88692ccd7..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/actions/ClearOutputAction.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.console.actions;
-
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.ui.console.ConsolePlugin;
-import org.eclipse.ui.console.IConsoleConstants;
-import org.eclipse.ui.console.TextConsole;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.console.ConsoleMessages;
-import org.eclipse.ui.internal.console.ConsolePluginImages;
-import org.eclipse.ui.internal.console.IConsoleHelpContextIds;
-import org.eclipse.ui.internal.console.IInternalConsoleConstants;
-
-/**
- * Clears the output in a text console.
- * <p>
- * Clients may instantiate this class; this class is not intended to
- * be subclassed.
- * </p>
- * @since 3.0
- */
-public class ClearOutputAction extends Action {
-
- private ITextViewer fViewer;
- private TextConsole fIOConsole;
-
- /**
- * Constructs a clear output action.
- *
- * @since 3.1
- */
- private ClearOutputAction() {
- super(ConsoleMessages.getString("ClearOutputAction.title")); //$NON-NLS-1$
- setToolTipText(ConsoleMessages.getString("ClearOutputAction.toolTipText")); //$NON-NLS-1$
- setHoverImageDescriptor(ConsolePluginImages.getImageDescriptor(IConsoleConstants.IMG_LCL_CLEAR));
- setDisabledImageDescriptor(ConsolePluginImages.getImageDescriptor(IInternalConsoleConstants.IMG_DLCL_CLEAR));
- setImageDescriptor(ConsolePluginImages.getImageDescriptor(IInternalConsoleConstants.IMG_ELCL_CLEAR));
- WorkbenchHelp.setHelp(this, IConsoleHelpContextIds.CLEAR_CONSOLE_ACTION);
- }
-
- /**
- * Constructs a clear output action for an I/O console. Clearing an I/O console
- * is performed via API on the <code>IOConsole</code>, rather than clearing
- * its document directly.
- *
- * @param ioConsole I/O console the action is associated with
- * @since 3.1
- */
- public ClearOutputAction(TextConsole ioConsole) {
- this();
- fIOConsole = ioConsole;
- }
-
- /**
- * Constructs an action to clear the document associated with a text viewer.
- *
- * @param viewer viewer whose document this action is associated with
- */
- public ClearOutputAction(ITextViewer viewer) {
- this();
- fViewer = viewer;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.IAction#run()
- */
- public void run() {
- BusyIndicator.showWhile(ConsolePlugin.getStandardDisplay(), new Runnable() {
- public void run() {
- if (fIOConsole == null) {
- IDocument document = fViewer.getDocument();
- if (document != null) {
- document.set(""); //$NON-NLS-1$
- }
- fViewer.setSelectedRange(0, 0);
- fViewer.getTextWidget().redraw();
- } else {
- fIOConsole.clearConsole();
- }
- }
- });
- }
-} \ No newline at end of file
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/console/actions/CloseConsoleAction.java b/org.eclipse.ui.console/src/org/eclipse/ui/console/actions/CloseConsoleAction.java
deleted file mode 100644
index c1939e2e9..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/actions/CloseConsoleAction.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.console.actions;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.ui.console.ConsolePlugin;
-import org.eclipse.ui.console.IConsole;
-import org.eclipse.ui.internal.console.ConsoleMessages;
-import org.eclipse.ui.internal.console.ConsolePluginImages;
-import org.eclipse.ui.internal.console.IInternalConsoleConstants;
-
-/**
- * Removes a console from the console manager.
- */
-public class CloseConsoleAction extends Action {
-
- private IConsole fConsole;
-
- public CloseConsoleAction(IConsole console) {
- super(ConsoleMessages.getString("CloseConsoleAction.0"), ConsolePluginImages.getImageDescriptor(IInternalConsoleConstants.IMG_ELCL_CLOSE)); //$NON-NLS-1$
- setToolTipText(ConsoleMessages.getString("CloseConsoleAction.1")); //$NON-NLS-1$
- fConsole = console;
- }
-
- public void run() {
- ConsolePlugin.getDefault().getConsoleManager().removeConsoles(new IConsole[]{fConsole});
- }
-}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/console/actions/TextViewerAction.java b/org.eclipse.ui.console/src/org/eclipse/ui/console/actions/TextViewerAction.java
deleted file mode 100644
index ee3639a68..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/actions/TextViewerAction.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.console.actions;
-
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.text.ITextOperationTarget;
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.ui.texteditor.IUpdate;
-
-/**
- * Common function for actions that operate on a text viewer.
- * <p>
- * Clients may subclass this class.
- * </p>
- * @since 3.0
- */
-public class TextViewerAction extends Action implements IUpdate {
-
- private int fOperationCode= -1;
- private ITextOperationTarget fOperationTarget;
-
- /**
- * Constructs a new action in the given text viewer with
- * the specified operation code.
- *
- * @param viewer
- * @param operationCode
- */
- public TextViewerAction(ITextViewer viewer, int operationCode) {
- fOperationCode= operationCode;
- fOperationTarget= viewer.getTextOperationTarget();
- update();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.texteditor.IUpdate#update()
- *
- * Updates the enabled state of the action.
- * Fires a property change if the enabled state changes.
- *
- * @see org.eclipse.jface.action.Action#firePropertyChange(String, Object, Object)
- */
- public void update() {
-
- boolean wasEnabled= isEnabled();
- boolean isEnabled= (fOperationTarget != null && fOperationTarget.canDoOperation(fOperationCode));
- setEnabled(isEnabled);
-
- if (wasEnabled != isEnabled) {
- firePropertyChange(ENABLED, wasEnabled ? Boolean.TRUE : Boolean.FALSE, isEnabled ? Boolean.TRUE : Boolean.FALSE);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.IAction#run()
- */
- public void run() {
- if (fOperationCode != -1 && fOperationTarget != null) {
- fOperationTarget.doOperation(fOperationCode);
- }
- }
-
- /**
- * Configures this action with a label, tool tip, and description.
- *
- * @param text action label
- * @param toolTipText action tool tip
- * @param description action description
- */
- public void configureAction(String text, String toolTipText, String description) {
- setText(text);
- setToolTipText(toolTipText);
- setDescription(description);
- }
-}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/console/actions/TextViewerGotoLineAction.java b/org.eclipse.ui.console/src/org/eclipse/ui/console/actions/TextViewerGotoLineAction.java
deleted file mode 100644
index ea740b8d2..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/actions/TextViewerGotoLineAction.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.console.actions;
-
-
-import java.text.MessageFormat;
-
-import org.eclipse.jface.dialogs.IInputValidator;
-import org.eclipse.jface.dialogs.InputDialog;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.jface.window.Window;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.console.ConsolePlugin;
-import org.eclipse.ui.internal.console.ConsoleMessages;
-
-/**
- * Action to position a text viewer to a specific line.
- * <p>
- * Clients may instantiate this class; this class is not intended to
- * be subclassed.
- * </p>
- * @since 3.0
- */
-public class TextViewerGotoLineAction extends TextViewerAction {
-
- /**
- * Validates whether the text found in the input field of the
- * dialog forms a valid line number, i.e. one to which can be
- * jumped.
- */
- class NumberValidator implements IInputValidator {
-
- public String isValid(String input) {
- try {
- int i= Integer.parseInt(input);
- if (i <= 0 || fLastLine < i)
- return ConsoleMessages.getString("TextViewerGotoLineAction.Line_number_out_of_range_1"); //$NON-NLS-1$
-
- } catch (NumberFormatException x) {
- return ConsoleMessages.getString("TextViewerGotoLineAction.Not_a_number_2"); //$NON-NLS-1$
- }
-
- return null;
- }
- }
-
- protected int fLastLine;
- protected ITextViewer fTextViewer;
-
- /**
- * Constructs a goto line action for the viewer using the provided resource bundle
- */
- public TextViewerGotoLineAction(ITextViewer viewer) {
- super(viewer, -1);
- fTextViewer= viewer;
- setText(ConsoleMessages.getString("TextViewerGotoLineAction.Go_to_&Line...@Ctrl+L_4")); //$NON-NLS-1$
- setToolTipText(ConsoleMessages.getString("TextViewerGotoLineAction.Go_To_Line_1")); //$NON-NLS-1$
- setDescription(ConsoleMessages.getString("TextViewerGotoLineAction.Go_To_Line_1")); //$NON-NLS-1$
- }
-
- /**
- * @see TextViewerAction#update()
- */
- public void update() {
- }
-
- /**
- * Jumps to the line.
- */
- protected void gotoLine(int line) {
-
- IDocument document= fTextViewer.getDocument();
- try {
- int start= document.getLineOffset(line);
- int length= document.getLineLength(line);
- fTextViewer.getTextWidget().setSelection(start, start + length);
- fTextViewer.revealRange(start, length);
- } catch (BadLocationException x) {
- ConsolePlugin.errorDialog(fTextViewer.getTextWidget().getShell(), ConsoleMessages.getString("TextViewerGotoLineAction.Go_To_Line_1"), ConsoleMessages.getString("TextViewerGotoLineAction.Exceptions_occurred_attempt_to_go_to_line_2"), x); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.IAction#run()
- */
- public void run() {
- try {
- Point selection= fTextViewer.getTextWidget().getSelection();
- IDocument document= fTextViewer.getDocument();
- fLastLine= document.getLineOfOffset(document.getLength()) + 1;
- int startLine= selection == null ? 1 : fTextViewer.getTextWidget().getLineAtOffset(selection.x) + 1;
- String title= ConsoleMessages.getString("TextViewerGotoLineAction.Go_To_Line_1"); //$NON-NLS-1$
- String message= MessageFormat.format(ConsoleMessages.getString("TextViewerGotoLineAction.Enter_line_number__8"), new Object[] {new Integer(fLastLine)}); //$NON-NLS-1$
- String value= Integer.toString(startLine);
- Shell activeShell= fTextViewer.getTextWidget().getShell();
- InputDialog d= new InputDialog(activeShell, title, message, value, new NumberValidator());
- if (d.open() == Window.OK) {
- try {
- int line= Integer.parseInt(d.getValue());
- gotoLine(line - 1);
- } catch (NumberFormatException x) {
- ConsolePlugin.errorDialog(activeShell, ConsoleMessages.getString("TextViewerGotoLineAction.Go_To_Line_1"), ConsoleMessages.getString("TextViewerGotoLineAction.Exceptions_occurred_attempt_to_go_to_line_2"), x); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
- } catch (BadLocationException x) {
- ConsolePlugin.errorDialog(fTextViewer.getTextWidget().getShell(), ConsoleMessages.getString("TextViewerGotoLineAction.Go_To_Line_1"), ConsoleMessages.getString("TextViewerGotoLineAction.Exceptions_occurred_attempt_to_go_to_line_2"), x); //$NON-NLS-1$ //$NON-NLS-2$
- return;
- }
- }
-} \ No newline at end of file
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/console/actions/package.html b/org.eclipse.ui.console/src/org/eclipse/ui/console/actions/package.html
deleted file mode 100644
index cfb538c69..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/actions/package.html
+++ /dev/null
@@ -1,20 +0,0 @@
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<title>Console Actions</title>
-</head>
-
-<body link="#0000FF" vlink="#800080">
-
-<p align="left"> Application programming interfaces for Eclipse console specific
- actions.</p>
-
-<h2 align="left">Package Specification</h2>
-
-<p>This package provides a set of actions related to the Eclipse console.</p>
-<p>Clients are allowed to instantiate classes from this package. The classes are
- not intended to be subclassed.</p>
-</body>
-</html>
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/console/package.html b/org.eclipse.ui.console/src/org/eclipse/ui/console/package.html
deleted file mode 100644
index 95aa4ac5a..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/package.html
+++ /dev/null
@@ -1,29 +0,0 @@
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<title>Eclipse Console</title>
-</head>
-
-<body bgcolor="#FFFFFF">
-
-<p>Application programming interfaces for interaction
-with the Eclipse console.</p>
-
-<h2>Package Specification</h2>
-
-<p>The Eclipse platform UI console plug-in provides a set of classes and interfaces to
-support a generic console. This package contains a generic abstract console that provides the common functionality
-for consoles. Clients implementing consoles should subclass this <b>AbstractConsole</b>.</p>
-<p>The classes <b>MessageConsole</b> and <b>MessageConsoleStream</b> provide an
- implementation of a message console and message console stream that enables
- logging of messages to a console.</p>
-<p>A console manager (<b>IConsoleManager</b>) manages all active consoles, and
- provides notification of consoles which are added and removed. Consoles are
- displayed in a page book view. Each console implementation is reponsible for
- creating its page (<b>IPageBookView</b>), which provides freedom of presentation
- to the console implementation. A single console may be displayed simultaneously
- in multiple console views, in different workbench windows.</p>
-</body>
-</html>
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 826590cda..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleDocument.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.internal.console;
-
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.BadPositionCategoryException;
-import org.eclipse.jface.text.DefaultPositionUpdater;
-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 synchronized 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 DefaultPositionUpdater(ConsoleHyperlinkPosition.HYPER_LINK_CATEGORY));
- }
- /* (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 7145fe09b..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleDocumentAdapter.java
+++ /dev/null
@@ -1,352 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.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.jface.text.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;
-import org.eclipse.jface.text.Region;
-import org.eclipse.swt.custom.TextChangeListener;
-import org.eclipse.swt.custom.TextChangedEvent;
-import org.eclipse.swt.custom.TextChangingEvent;
-
-/**
- * Adapts a Console's document to the viewer StyledText widget. Allows proper line
- * wrapping of fixed width consoles without having to add line delimeters 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;
-
- private List regions;
- private Pattern pattern = Pattern.compile("^.*$", Pattern.MULTILINE); //$NON-NLS-1$
-
- public ConsoleDocumentAdapter(int width) {
- textChangeListeners = new ArrayList();
- consoleWidth = width;
- regions = new ArrayList();
- }
-
- /*
- * 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) {
- try {
- int docLine = document.getLineOfOffset(eventOffset);
- int docLineStart = document.getLineOffset(docLine);
- int textLine = getLineAtOffset(docLineStart);
-
- for (int i=regions.size()-1; i>=textLine; i--) {
- regions.remove(i);
- }
-
- int numLinesInDoc = document.getNumberOfLines();
- String line = null;
- int offset = 0;
- for (int i = docLine; i<numLinesInDoc; i++) {
- offset = document.getLineOffset(i);
- int length = document.getLineLength(i);
-
- if (length == 0) {
- regions.add(new Region(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) {
- regions.add(new Region(offset, consoleWidth));
- offset += consoleWidth;
- length -= consoleWidth;
- } else {
- regions.add(new Region(offset, length));
- offset += length;
- length -= length;
- }
- }
- }
- }
- if (line != null && lineEndsWithDelimeter(line)) {
- regions.add(new Region(offset, 0));
- }
-
- } catch (BadLocationException e) {
- }
-
- if (regions.size() == 0) {
- regions.add(new Region(document.getLength(), 0));
- }
- }
-
- /**
- * Returns <code>true</code> if the line ends with a legal line delimiter
- * @return <code>true</code> if the line ends with a legal line delimiter, <code>false</code> otherwise
- */
- private boolean lineEndsWithDelimeter(String line) {
- String[] lld = document.getLegalLineDelimiters();
- for (int i = 0; i < lld.length; i++) {
- if (line.endsWith(lld[i])) {
- return true;
- }
- }
- return false;
- }
-
- /* (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) {
- Region region = (Region) regions.get(lineIndex);
- try {
- StringBuffer line = new StringBuffer(document.get(region.getOffset(), region.getLength()));
- int index = line.length() - 1;
- while(index > -1 && (line.charAt(index)=='\n' || line.charAt(index)=='\r')) {
- index--;
- }
- return 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 || regions.size() <= 1) {
- return 0;
- }
-
- if (offset == document.getLength()) {
- return regions.size()-1;
- }
-
- int left= 0;
- int right= regions.size() -1;
- int midIndex = 0;
- Region mid = null;
-
- while (left <= right) {
- midIndex= (left + right) / 2;
-
- mid = (Region) regions.get(midIndex);
- if (offset < mid.getOffset()) {
- right = midIndex;
- } else if (offset >= mid.getOffset() + mid.getLength()) {
- left = midIndex + 1;
- } else {
- return midIndex;
- }
- }
-
- return midIndex;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.swt.custom.StyledTextContent#getLineCount()
- */
- public int getLineCount() {
- return regions.size();
- }
-
- /* (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 ((Region) regions.get(lineIndex)).getOffset();
- }
-
- /* (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 last = getLineAtOffset(event.fOffset + event.fLength);
- changeEvent.replaceLineCount= last - first;
-
- changeEvent.newLineCount = countLines(event.fText) ;
-
- for (Iterator iter = textChangeListeners.iterator(); iter.hasNext();) {
- TextChangeListener element = (TextChangeListener) iter.next();
- element.textChanging(changeEvent);
- }
- }
-
- /**
- * Counts the number of lines the viewer's text widget will need to use to
- * display the String
- * @return The number of lines necessary to display the string in the viewer.
- */
- private int countLines(String string) {
- Matcher matcher = pattern.matcher(string);
- int count = 0;
- while (matcher.find()) {
- count++;
- if (consoleWidth > 0) {
- String line = matcher.group();
- count += (line.length() / consoleWidth);
- }
- }
-
- if (lineEndsWithDelimeter(string)) {
- count++;
- }
-
- 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) {
- 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 18f994fc8..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleDropDownAction.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.internal.console;
-
-
-import java.util.List;
-
-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.Display;
-import org.eclipse.swt.widgets.Menu;
-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.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.getString("ConsoleDropDownAction.0")); //$NON-NLS-1$
- setToolTipText(ConsoleMessages.getString("ConsoleDropDownAction.1")); //$NON-NLS-1$
- setImageDescriptor(ConsolePluginImages.getImageDescriptor(IConsoleConstants.IMG_VIEW_CONSOLE));
- 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) {
- Display display = ConsolePlugin.getStandardDisplay();
- display.asyncExec(new Runnable() {
- public void run() {
- update();
- }
- });
- }
-
- /* (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) {
- Display display = ConsolePlugin.getStandardDisplay();
- display.asyncExec(new Runnable() {
- public void run() {
- if (fMenu != null) {
- fMenu.dispose();
- }
- update();
- }
- });
- }
-}
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 912a88cac..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleFactoryExtension.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.internal.console;
-
-import java.net.MalformedURLException;
-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.IConfigurationElement;
-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.getNamespace();
- }
-
- 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) {
- try {
- String path = fConfig.getAttributeAsIs("icon"); //$NON-NLS-1$
- if (path != null) {
- Bundle bundle = Platform.getBundle(getPluginId());
- URL url = bundle.getEntry("/"); //$NON-NLS-1$
- url = new URL(url, path); //$NON-NLS-1$
- fImageDescriptor = ImageDescriptor.createFromURL(url);
- }
-
- } catch (MalformedURLException e) {
- ConsolePlugin.log(e);
- }
- }
- 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 6bcc98719..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleHyperlinkPosition.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.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();
- }
-
-} \ No newline at end of file
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 7b0474573..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleManager.java
+++ /dev/null
@@ -1,386 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.internal.console;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.ISafeRunnable;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.util.ListenerList;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IViewReference;
-import org.eclipse.ui.IWindowListener;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
-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;
-
-/**
- * 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 IWindowListener fWindowListener;
-
- private boolean fWarnQueued = false;
-
- /**
- * 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.getString("ConsoleManager.0"), exception); //$NON-NLS-1$
- 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];
- Platform.run(this);
- }
- fChanged = null;
- fListener = null;
- }
- }
-
-
- public ConsoleManager() {
- fWindowListener = new IWindowListener() {
- public void windowActivated(IWorkbenchWindow window) {
- }
- public void windowDeactivated(IWorkbenchWindow window) {
- }
- public void windowOpened(IWorkbenchWindow window) {
- }
- public void windowClosed(IWorkbenchWindow window) {
- removeConsoles((IConsole[]) fConsoles.toArray(new IConsole[0]));
- }
- };
-
- ConsolePlugin.getDefault().getWorkbench().addWindowListener(fWindowListener);
- }
-
- /* (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(5);
- }
- 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 synchronized void addConsoles(IConsole[] consoles) {
- List added = new ArrayList(consoles.length);
- for (int i = 0; i < consoles.length; i++) {
- IConsole console = consoles[i];
- if(console instanceof TextConsole) {
- TextConsole ioconsole = (TextConsole)console;
- IPatternMatchListener[] matchListeners = createPatternMatchListeners(ioconsole);
- for (int j = 0; j < matchListeners.length; j++) {
- ioconsole.addPatternMatchListener(matchListeners[j]);
- }
- }
- 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 synchronized void removeConsoles(IConsole[] consoles) {
- List removed = new ArrayList(consoles.length);
- 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 synchronized IConsole[] getConsoles() {
- 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);
- }
-
- /**
- * @see IConsoleManager#showConsoleView(IConsole)
- */
- public void showConsoleView(final IConsole console) {
- ConsolePlugin.getStandardDisplay().asyncExec(new Runnable() {
- public void run() {
- boolean consoleFound = false;
- IWorkbenchWindow window= PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- if (window != null) {
- IWorkbenchPage page= window.getActivePage();
- if (page != null) {
- IViewReference[] viewReferences = page.getViewReferences();
- for (int i = 0; i < viewReferences.length; i++) {
- IViewReference viewRef = viewReferences[i];
- if (viewRef == null) {
- continue;
- }
- if(IConsoleConstants.ID_CONSOLE_VIEW.equals(viewRef.getId())) {
- IWorkbenchPart part = viewRef.getPart(false);
- IConsoleView consoleView = null;
-
- if (!(part instanceof IConsoleView)) {
- continue;
- }
- consoleFound = true;
- consoleView = (IConsoleView) part;
-
- 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);
- }
- }
- }
- }
- }
- });
- }
-
- /**
- * 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;
- ConsolePlugin.getStandardDisplay().asyncExec(new Runnable(){
- public void run() {
- 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;
- }
- });
- }
- }
-
- /* (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); //$NON-NLS-1$
- }
- }
- ArrayList list = new ArrayList();
- for(Iterator i = fPatternMatchListeners.iterator(); i.hasNext(); ) {
- PatternMatchListenerExtension extension = (PatternMatchListenerExtension) i.next();
- try {
- if (extension.isEnabledFor(console)) {
- list.add(new PatternMatchListener(extension));
- }
- } 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]);
- }
-
-}
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 6c89e23f6..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleMessages.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.internal.console;
-
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-/**
- * ConsoleMessages
- */
-public class ConsoleMessages {
-
- private static final String BUNDLE_NAME = "org.eclipse.ui.internal.console.ConsoleMessages"; //$NON-NLS-1$
-
- private static final ResourceBundle RESOURCE_BUNDLE =
- ResourceBundle.getBundle(BUNDLE_NAME);
-
- private ConsoleMessages() {
- }
-
- public static String getString(String key) {
- try {
- return RESOURCE_BUNDLE.getString(key);
- } catch (MissingResourceException e) {
- return '!' + key + '!';
- }
- }
-}
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 1b67ae0d0..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleMessages.properties
+++ /dev/null
@@ -1,68 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2004 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Common Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/cpl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-
-AbstractConsole.0=Exception occurred during console property change notification.
-
-ConsoleDropDownAction.0=Select Console
-ConsoleDropDownAction.1=Display Selected Console
-ConsoleViewConsoleFactory.0=Console View \#
-
-ConsoleManager.0=An exception occurred during console notification
-
-ConsoleView.0=Console
-
-
-find_replace_action.label=&Find/Replace...@Ctrl+F
-find_replace_action.tooltip=Find/Replace
-find_replace_action.image=
-find_replace_action.description=Find/Replace
-
-MessageConsolePage.&Copy@Ctrl+C_6=&Copy@Ctrl+C
-MessageConsolePage.Copy_7=Copy
-MessageConsolePage.Select_&All@Ctrl+A_12=Select &All@Ctrl+A
-MessageConsolePage.Select_All=Select All
-
-MessageConsolePartitioner.2=Low water mark must be less than high water mark.
-MessageConsolePartitioner.3=Low water mark must be greater than or equal to 1000.
-
-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
-
-IOConsolePage.0=Select &All@Ctrl+A
-IOConsolePage.1=Select All
-IOConsolePage.10=Paste
-IOConsolePage.11=Paste
-IOConsolePage.2=Select All
-IOConsolePage.3=Cut
-IOConsolePage.4=Cut
-IOConsolePage.5=Cut
-IOConsolePage.6=Copy
-IOConsolePage.7=Copy
-IOConsolePage.8=Copy
-IOConsolePage.9=Paste
-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
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 70cc13b14..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsolePageParticipantExtension.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.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.getNamespace();
- }
-
- public boolean isEnabledFor(IConsole console) throws CoreException {
- EvaluationContext context = new EvaluationContext(null, console);
- EvaluationResult evaluationResult = getEnablementExpression().evaluate(context);
- return evaluationResult == EvaluationResult.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 697f224f1..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsolePatternMatcher.java
+++ /dev/null
@@ -1,307 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.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 patterns = new ArrayList();
-
- private TextConsole fConsole;
-
- private boolean fFinalMatch;
-
- private boolean fScheduleFinal;
-
- public ConsolePatternMatcher(TextConsole console) {
- fConsole = console;
- fMatchJob.setRule(fConsole.getSchedulingRule());
- }
-
- 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;
- }
- for (int i = 0; i < patterns.size(); i++) {
- if (monitor.isCanceled()) {
- break;
- }
- CompiledPatternMatchListener notifier = (CompiledPatternMatchListener) patterns.get(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) {
- fConsole.matcherFinished();
- } else if (fScheduleFinal) {
- fFinalMatch = true;
- schedule();
- }
-
-
- return Status.OK_STATUS;
- }
- }
-
- 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 (patterns) {
-
- // check for dups
- for (Iterator iter = patterns.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);
- patterns.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 (patterns) {
- for (Iterator iter = patterns.iterator(); iter.hasNext();) {
- CompiledPatternMatchListener element = (CompiledPatternMatchListener) iter.next();
- if (element.listener == matchListener) {
- iter.remove();
- matchListener.disconnect();
- }
- }
- }
- }
-
- public void disconnect() {
- fMatchJob.cancel();
- synchronized (patterns) {
- Iterator iterator = patterns.iterator();
- while (iterator.hasNext()) {
- CompiledPatternMatchListener notifier = (CompiledPatternMatchListener) iterator.next();
- notifier.dispose();
- }
- patterns.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 (patterns) {
- if (event.fDocument.getLength() == 0) {
- // document has been cleared, reset match listeners
- Iterator iter = patterns.iterator();
- while (iter.hasNext()) {
- CompiledPatternMatchListener notifier = (CompiledPatternMatchListener) iter.next();
- notifier.end = 0;
- }
- } else {
- if (event.fOffset == 0) {
- //document was trimmed
- Iterator iter = patterns.iterator();
- while (iter.hasNext()) {
- CompiledPatternMatchListener notifier = (CompiledPatternMatchListener) iter.next();
- notifier.end = notifier.end > event.fLength ? notifier.end-event.fLength : 0;
- }
- }
- }
- }
- }
- fMatchJob.schedule();
- }
-
- /**
- * @return
- */
- public boolean isScheduled() {
- return fMatchJob.getState()==Job.NONE;
- }
-
- 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 2e1e19301..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsolePluginImages.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.internal.console;
-
-
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.HashMap;
-import java.util.Map;
-
-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.
- */
- private static ImageRegistry imageRegistry;
-
- /**
- * A table of all the <code>ImageDescriptor</code>s.
- */
- private static Map imageDescriptors;
-
- /* 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);
- imageDescriptors.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());
- imageDescriptors = new HashMap(30);
- 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) {
- if (imageDescriptors == null) {
- initializeImageRegistry();
- }
- return (ImageDescriptor)imageDescriptors.get(key);
- }
-
- private static URL makeIconFileURL(String iconPath) throws MalformedURLException {
- if (ICON_BASE_URL == null) {
- throw new MalformedURLException();
- }
-
- return new URL(ICON_BASE_URL, iconPath);
- }
-} \ No newline at end of file
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 aa743c768..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleTypePropertyTester.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.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 f8ba3f628..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleView.java
+++ /dev/null
@@ -1,639 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.internal.console;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.jface.viewers.IBasicPropertyConstants;
-import org.eclipse.swt.widgets.Composite;
-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.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.help.WorkbenchHelp;
-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.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;
-
- // 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;
- }
- super.showPageRec(pageRec);
- fActiveConsole = (IConsole)fPartToConsole.get(pageRec.part);
- 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();
- // update console actions
- if (fPinAction != null) {
- fPinAction.update();
- }
- IPage page = getCurrentPage();
- if (page instanceof IOConsolePage) {
- ((IOConsolePage)page).setAutoScroll(!fScrollLock);
- }
- }
-
- /**
- * Activates the participants fot the given console, if any.
- *
- * @param console
- */
- private void activateParticipants(IConsole console) {
- // activate
- if (console != null && fActive) {
- IConsolePageParticipant[] participants = getParticipants(console);
- if (participants != null) {
- for (int i = 0; i < participants.length; i++) {
- // TODO: safe runnable
- participants[i].activated();
- }
- }
- }
- }
-
- /**
- * 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.getString("ConsoleView.0")); //$NON-NLS-1$
- } else {
- setContentDescription(console.getName()); //$NON-NLS-1$
- }
- }
-
- /* (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
- IConsolePageParticipant[] participants = (IConsolePageParticipant[]) fConsoleToPageParticipants.remove(console);
- for (int i = 0; i < participants.length; i++) {
- IConsolePageParticipant participant = participants[i];
- // TODO: this should be done in a safe runnable
- participant.dispose();
- }
-
- 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 IConsolePageParticipant[] getParticipants(IConsole console) {
- return (IConsolePageParticipant[]) 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;
- IConsole console = part.getConsole();
- IPageBookViewPage page = console.createPage(this);
- initPage(page);
- page.createControl(getPageBook());
- console.addPropertyChangeListener(this);
-
- // initialize page participants
- IConsolePageParticipant[] participants = ((ConsoleManager)getConsoleManager()).getPageParticipants(console);
- fConsoleToPageParticipants.put(console, participants);
- for (int i = 0; i < participants.length; i++) {
- IConsolePageParticipant participant = participants[i];
- // TODO: this should be done in a safe runnable
- participant.init(page, console);
- }
-
- 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() {
- super.dispose();
- getViewSite().getPage().removePartListener((IPartListener2)this);
- getConsoleManager().removeConsoleListener(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();
- }
-
- 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);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.IConsoleView#display(org.eclipse.ui.console.IConsole)
- */
- public void display(IConsole console) {
- if (fPinned && fActiveConsole != null) {
- 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();
- WorkbenchHelp.setHelp(parent, IConsoleHelpContextIds.CONSOLE_VIEW);
- getViewSite().getPage().addPartListener((IPartListener2)this);
- }
-
- /**
- * 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) {
- IConsolePageParticipant[] participants = (IConsolePageParticipant[]) fConsoleToPageParticipants.get(console);
- // an adapter can be asked for before the console participants are created
- if (participants != null) {
- for (int i = 0; i < participants.length; i++) {
- IConsolePageParticipant participant = 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;
- 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;
- deactivateParticipants(fActiveConsole);
- }
- }
-
- protected boolean isThisPart(IWorkbenchPartReference partRef) {
- if (partRef instanceof IViewReference) {
- IViewReference viewRef = (IViewReference) partRef;
- if (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) {
- IConsolePageParticipant[] participants = getParticipants(console);
- if (participants != null) {
- for (int i = 0; i < participants.length; i++) {
- // TODO: safe runnable
- participants[i].deactivated();
- }
- }
- }
- }
-
- /* (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);
- }
- }
-} \ No newline at end of file
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 34b014db0..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleViewConsoleFactory.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.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 = ConsoleMessages.getString("ConsoleViewConsoleFactory.0") + 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 d31018090..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleWorkbenchPart.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.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;
- }
-} \ No newline at end of file
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 1c89b005e..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/FollowHyperlinkAction.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.internal.console;
-
-import org.eclipse.jface.action.Action;
-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.getString("FollowHyperlinkAction.0")); //$NON-NLS-1$
- setToolTipText(ConsoleMessages.getString("FollowHyperlinkAction.1")); //$NON-NLS-1$
- 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/IConsoleHelpContextIds.java b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IConsoleHelpContextIds.java
deleted file mode 100644
index b81cbea77..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IConsoleHelpContextIds.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.internal.console;
-
-import org.eclipse.ui.console.IConsoleConstants;
-
-/**
- * Help context ids for the debug ui.
- * <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$
-
- // 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 17a002a2f..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IInternalConsoleConstants.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.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 52c03352c..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsolePage.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Common Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors: IBM Corporation - initial API and implementation
- ******************************************************************************/
-package org.eclipse.ui.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);
- }
- }
-
- /**
- * 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 f243d35e9..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsolePartition.java
+++ /dev/null
@@ -1,165 +0,0 @@
-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 partitions 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 != null ? buffer.toString() : ""; //$NON-NLS-1$
- }
-
- /**
- * 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());
- }
-
- private int getFontStyle() {
- if (type.equals(INPUT_PARTITION_TYPE)) {
- return inputStream.getFontStyle();
- }
- return outputStream.getFontStyle();
- }
-
- public Color getColor() {
- if (type.equals(INPUT_PARTITION_TYPE)) {
- return inputStream.getColor();
- }
- return outputStream.getColor();
- }
-
- public boolean isReadOnly() {
- return readOnly;
- }
-
- public void setReadOnly() {
- readOnly = true;
- }
-
- public void clearBuffer() {
- buffer = null;
- }
-
- 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 412fe0d0b..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsolePartitioner.java
+++ /dev/null
@@ -1,669 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.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.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.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;
-
-/**
- * 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();
-
- 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.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.setRule(console.getSchedulingRule());
- 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
- partitions.clear();
- inputPartitions.clear();
- pendingPartitions.clear();
- 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); //$NON-NLS-1$
- 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) {
- 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));
- queueJob.schedule(100);
- }
- }
- }
-
- /**
- * Holds data until updateJob can be run and the document can be updated.
- */
- private class PendingPartition {
- String text;
- IOConsoleOutputStream stream;
-
- PendingPartition(IOConsoleOutputStream stream, String text) {
- this.stream = stream;
- this.text=text;
- }
-
- void append(String moreText) {
- text += moreText;
- }
- }
-
- /**
- * Updates the document. Will append everything that is available before
- * finishing.
- */
- private class QueueProcessingJob extends Job {
-
- QueueProcessingJob() {
- super("IOConsole Updater"); //$NON-NLS-1$
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.core.internal.jobs.InternalJob#run(org.eclipse.core.runtime.IProgressMonitor)
- */
- protected IStatus run(IProgressMonitor monitor) {
- synchronized (overflowLock) {
-
- Display display = ConsolePlugin.getStandardDisplay();
-
- ArrayList pendingCopy = new ArrayList();
- StringBuffer buffer = null;
- boolean consoleClosed = false;
- while (display != null && pendingPartitions.size() > 0) {
- synchronized(pendingPartitions) {
- pendingCopy.addAll(pendingPartitions);
- pendingPartitions.clear();
- }
-
- buffer = new StringBuffer();
- for (Iterator i = pendingCopy.iterator(); i.hasNext(); ) {
- PendingPartition pp = (PendingPartition) i.next();
- if (pp != consoleClosedPartition) {
- buffer.append(pp.text);
- } else {
- consoleClosed = true;
- }
- }
- }
-
- final ArrayList finalCopy = pendingCopy;
- final String toAppend = buffer.toString();
- final boolean notifyClosed = consoleClosed;
-
- display.asyncExec(new Runnable() {
- public void run() {
- if (connected) {
- setUpdateInProgress(true);
- updatePartitions = finalCopy;
- firstOffset = document.getLength();
- try {
- document.replace(firstOffset, 0, toAppend.toString());
- } catch (BadLocationException e) {
- }
- updatePartitions = null;
- setUpdateInProgress(false);
- }
- if (notifyClosed) {
- console.partitionerFinished();
- }
- checkBufferSize();
- }
- });
- }
-
- 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;
- }
- }
-
-
-
-
-
-
-
- /**
- * Job to trim the console document, runs in the UI thread.
- */
- private class TrimJob extends UIJob {
-
- /**
- * 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) {
- 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;
- }
-
-
-} \ No newline at end of file
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 5b75e330d..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsoleViewer.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Common Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors: IBM Corporation - initial API and implementation
- ******************************************************************************/
-package org.eclipse.ui.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;
-
- 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;
- }
- }
-
- /**
- * makes the associated text widget uneditable.
- */
- public void setReadOnly() {
- ConsolePlugin.getStandardDisplay().asyncExec(new Runnable() {
- public void run() {
- StyledText text = getTextWidget();
- if (text != null) {
- 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;
- }
-} \ No newline at end of file
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 8b6190d91..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/OpenConsoleAction.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.internal.console;
-
-import org.eclipse.core.runtime.CoreException;
-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.swt.widgets.Control;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Menu;
-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.getString("OpenConsoleAction.0")); //$NON-NLS-1$
- setToolTipText(ConsoleMessages.getString("OpenConsoleAction.1")); //$NON-NLS-1$
- setImageDescriptor(ConsolePluginImages.getImageDescriptor(IInternalConsoleConstants.IMG_ELCL_NEW_CON));
- setMenuCreator(this);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.IMenuCreator#dispose()
- */
- public void dispose() {
- fFactoryExtensions = 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);
- 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 1c3eecb17..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/PatternMatchListener.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.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 25c622658..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/PatternMatchListenerExtension.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.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.ui.IPluginContribution;
-import org.eclipse.ui.console.ConsolePlugin;
-import org.eclipse.ui.console.IConsole;
-import org.eclipse.ui.console.IPatternMatchListenerDelegate;
-
-public class PatternMatchListenerExtension implements IPluginContribution {
-
- private IConfigurationElement fConfig;
- private Expression fEnablementExpression;
- private String fPattern;
- 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);
- 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.getAttributeAsIs("regex"); //$NON-NLS-1$
- }
- return fPattern;
- }
-
- /*
- * returns the flags to be used by <code>Pattern.compile(pattern, flags)</code>
- */
- public int getCompilerFlags() {
- if(fFlags < 0) {
- String flagsAttribute = fConfig.getAttributeAsIs("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.getNamespace();
- }
-
- public String getQuickPattern() {
- return fConfig.getAttribute("qualifier"); //$NON-NLS-1$
- }
-}
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 f8d89f771..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/PinConsoleAction.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.internal.console;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IAction;
-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.getString("PinConsoleAction.0"), IAction.AS_CHECK_BOX); //$NON-NLS-1$
- setToolTipText(ConsoleMessages.getString("PinConsoleAction.1")); //$NON-NLS-1$
- setImageDescriptor(ConsolePluginImages.getImageDescriptor(IInternalConsoleConstants.IMG_ELCL_PIN));
- setDisabledImageDescriptor(ConsolePluginImages.getImageDescriptor(IInternalConsoleConstants.IMG_DLCL_PIN));
- setHoverImageDescriptor(ConsolePluginImages.getImageDescriptor(IInternalConsoleConstants.IMG_LCL_PIN));
- 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());
- }
-} \ No newline at end of file
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 0b0bd369c..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ScrollLockAction.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package org.eclipse.ui.internal.console;
-
-import org.eclipse.jface.action.Action;
-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.getString("ScrollLockAction.0")); //$NON-NLS-1$
- fConsoleView = consoleView;
-
- setToolTipText(ConsoleMessages.getString("ScrollLockAction.1")); //$NON-NLS-1$
- setHoverImageDescriptor(ConsolePluginImages.getImageDescriptor(IInternalConsoleConstants.IMG_LCL_LOCK));
- setDisabledImageDescriptor(ConsolePluginImages.getImageDescriptor(IInternalConsoleConstants.IMG_DLCL_LOCK));
- setImageDescriptor(ConsolePluginImages.getImageDescriptor(IInternalConsoleConstants.IMG_ELCL_LOCK));
-
- boolean checked = 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 17d562e66..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ShowConsoleAction.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.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() {
- if (!fConsole.equals(fView.getConsole())) {
- boolean pinned = fView.isPinned();
- if (pinned) {
- fView.setPinned(false);
- }
- fView.display(fConsole);
- if (pinned) {
- fView.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();
- fConsole = console;
- fView = view;
- setText(console.getName());
- setImageDescriptor(console.getImageDescriptor());
- }
-}

Back to the top