Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDani Megert2012-02-17 09:09:19 +0000
committerDani Megert2012-02-17 09:09:19 +0000
commit0cfb9b481be22e581b008d11f97ddbe249ce561d (patch)
tree1f858176e0f64a4234a9d676b63c608dfa91ed53
parent27da83b9a695fd137ec84f15c00c478813e3394a (diff)
downloadeclipse.platform.text-0cfb9b481be22e581b008d11f97ddbe249ce561d.tar.gz
eclipse.platform.text-0cfb9b481be22e581b008d11f97ddbe249ce561d.tar.xz
eclipse.platform.text-0cfb9b481be22e581b008d11f97ddbe249ce561d.zip
Fixed bug 350409: [content assist] Extended Listener Support for Codev20120217-0909
Completion Interfaces
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/CompletionProposalPopup.java18
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ContentAssistant.java17
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ICompletionListener.java9
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ICompletionListenerExtension2.java32
4 files changed, 70 insertions, 6 deletions
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/CompletionProposalPopup.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/CompletionProposalPopup.java
index dc046a0aab0..8644363d15a 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/CompletionProposalPopup.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/CompletionProposalPopup.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * Copyright (c) 2000, 2012 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -934,6 +934,7 @@ class CompletionProposalPopup implements IContentAssistListener {
} else {
p.apply(document);
}
+ fireAppliedEvent(p);
Point selection= p.getSelection(document);
if (selection != null) {
@@ -1373,9 +1374,18 @@ class CompletionProposalPopup implements IContentAssistListener {
}
/**
- * Returns whether the given character is contained in the given array of
- * characters.
- *
+ * Fires an event after applying the given proposal, see {@link ICompletionListenerExtension2}.
+ *
+ * @param proposal the applied proposal
+ * @since 3.8
+ */
+ private void fireAppliedEvent(ICompletionProposal proposal) {
+ fContentAssistant.fireAppliedEvent(proposal);
+ }
+
+ /**
+ * Returns whether the given character is contained in the given array of characters.
+ *
* @param characters the list of characters
* @param c the character to look for in the list
* @return <code>true</code> if character belongs to the list
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ContentAssistant.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ContentAssistant.java
index b0981b5de30..e69d0197d8b 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ContentAssistant.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ContentAssistant.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 2012 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -2357,6 +2357,21 @@ public class ContentAssistant implements IContentAssistant, IContentAssistantExt
}
}
+ /**
+ * Fires an event after applying a proposal, see {@link ICompletionListenerExtension2}.
+ *
+ * @param proposal the applied proposal
+ * @since 3.8
+ */
+ void fireAppliedEvent(ICompletionProposal proposal) {
+ Object[] listeners= fCompletionListeners.getListeners();
+ for (int i= 0; i < listeners.length; i++) {
+ ICompletionListener listener= (ICompletionListener)listeners[i];
+ if (listener instanceof ICompletionListenerExtension2)
+ ((ICompletionListenerExtension2)listener).applied(proposal);
+ }
+ }
+
/*
* @see org.eclipse.jface.text.contentassist.IContentAssistantExtension3#setInvocationTrigger(org.eclipse.jface.bindings.keys.KeySequence)
* @since 3.2
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ICompletionListener.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ICompletionListener.java
index 4c491dfbec3..6a9dda441d2 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ICompletionListener.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ICompletionListener.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2008 IBM Corporation and others.
+ * Copyright (c) 2005, 2012 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -23,6 +23,12 @@ package org.eclipse.jface.text.contentassist;
* <li>additional notification about restarting the current code assist session</li>
* </ul>
* </li>
+ * <li>{@link org.eclipse.jface.text.contentassist.ICompletionListenerExtension2} since version 3.8 introducing
+ * the following functions:
+ * <ul>
+ * <li>additional notification after applying a proposal</li>
+ * </ul>
+ * </li>
* </ul>
* </p>
*
@@ -33,6 +39,7 @@ package org.eclipse.jface.text.contentassist;
* @since 3.2
*/
public interface ICompletionListener {
+
/**
* Called when code assist is invoked when there is no current code assist session.
*
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ICompletionListenerExtension2.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ICompletionListenerExtension2.java
new file mode 100644
index 00000000000..f888c90013b
--- /dev/null
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ICompletionListenerExtension2.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2012 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jface.text.contentassist;
+
+
+/**
+ * Extends {@link org.eclipse.jface.text.contentassist.ICompletionListener} with an additional
+ * notification after applying a proposal.
+ * <p>
+ * Clients may implement this interface.
+ * </p>
+ *
+ * @since 3.8
+ */
+public interface ICompletionListenerExtension2 {
+
+ /**
+ * Called after applying a proposal.
+ *
+ * @param proposal the applied proposal
+ */
+ void applied(ICompletionProposal proposal);
+
+} \ No newline at end of file

Back to the top