Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Barnes2006-03-07 17:50:03 -0500
committerKevin Barnes2006-03-07 17:50:03 -0500
commit5df2d776f9f6154cb7070d557a439d22047728c3 (patch)
tree04eb567b3c944f7ad10d76dfd354396dddb07f9a /org.eclipse.ui.console
parent03fd64aefdfc4c7c04101ad2d70e0ccb3db28f40 (diff)
downloadeclipse.platform.debug-5df2d776f9f6154cb7070d557a439d22047728c3.tar.gz
eclipse.platform.debug-5df2d776f9f6154cb7070d557a439d22047728c3.tar.xz
eclipse.platform.debug-5df2d776f9f6154cb7070d557a439d22047728c3.zip
Bug 130663 - Warn when console pattern matcher missing enablement expression
Diffstat (limited to 'org.eclipse.ui.console')
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleManager.java7
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleMessages.java6
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleMessages.properties5
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/PatternMatchListenerExtension.java7
4 files changed, 23 insertions, 2 deletions
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleManager.java b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleManager.java
index 57827384a..8582c9dba 100644
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleManager.java
+++ b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleManager.java
@@ -367,7 +367,12 @@ public class ConsoleManager implements IConsoleManager {
ArrayList list = new ArrayList();
for(Iterator i = fPatternMatchListeners.iterator(); i.hasNext(); ) {
PatternMatchListenerExtension extension = (PatternMatchListenerExtension) i.next();
- try {
+ try {
+ if (extension.getEnablementExpression() == null) {
+ i.remove();
+ continue;
+ }
+
if (extension.isEnabledFor(console)) {
list.add(new PatternMatchListener(extension));
}
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
index a3422f495..6edccf92d 100644
--- 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
@@ -58,4 +58,10 @@ public class ConsoleMessages extends NLS {
// load message values from bundle file
NLS.initializeMessages(BUNDLE_NAME, ConsoleMessages.class);
}
+
+ public static String PatternMatchListenerExtension_3;
+
+ public static String PatternMatchListenerExtension_4;
+
+ public static String PatternMatchListenerExtension_5;
} \ No newline at end of file
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleMessages.properties b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleMessages.properties
index 2b752dfd5..a366795a5 100644
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleMessages.properties
+++ b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleMessages.properties
@@ -47,4 +47,7 @@ TextConsolePage_CutDescrip=Cut
TextConsolePage_CopyText=&Copy
TextConsolePage_CopyDescrip=Copy
TextConsolePage_PasteText=&Paste
-TextConsolePage_PasteDescrip=Paste \ No newline at end of file
+TextConsolePage_PasteDescrip=Paste
+PatternMatchListenerExtension_3=Console Pattern Match Listener
+PatternMatchListenerExtension_4=contributed by
+PatternMatchListenerExtension_5=is missing required enablement expression and will be removed
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/PatternMatchListenerExtension.java b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/PatternMatchListenerExtension.java
index 788b4329e..10fa35e79 100644
--- 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
@@ -11,6 +11,7 @@
package org.eclipse.ui.internal.console;
import java.lang.reflect.Field;
+import java.text.MessageFormat;
import org.eclipse.core.expressions.EvaluationContext;
import org.eclipse.core.expressions.EvaluationResult;
@@ -19,6 +20,8 @@ import org.eclipse.core.expressions.ExpressionConverter;
import org.eclipse.core.expressions.ExpressionTagNames;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
import org.eclipse.core.variables.VariablesPlugin;
import org.eclipse.ui.IPluginContribution;
import org.eclipse.ui.console.ConsolePlugin;
@@ -80,6 +83,10 @@ public class PatternMatchListenerExtension implements IPluginContribution {
public Expression getEnablementExpression() throws CoreException {
if (fEnablementExpression == null) {
IConfigurationElement[] elements = fConfig.getChildren(ExpressionTagNames.ENABLEMENT);
+ if (elements.length == 0) {
+ String message = MessageFormat.format("{0} " +getLocalId() + " {1} " + getPluginId() + " {2}", new String[] {ConsoleMessages.PatternMatchListenerExtension_3,ConsoleMessages.PatternMatchListenerExtension_4,ConsoleMessages.PatternMatchListenerExtension_5}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ ConsolePlugin.log(new Status(IStatus.WARNING, ConsolePlugin.getUniqueIdentifier(), IStatus.OK, message, null));
+ }
IConfigurationElement enablement = elements.length > 0 ? elements[0] : null;
if (enablement != null) {

Back to the top