diff dwtx/jface/text/quickassist/IQuickAssistProcessor.d @ 129:eb30df5ca28b

Added JFace Text sources
author Frank Benoit <benoit@tionex.de>
date Sat, 23 Aug 2008 19:10:48 +0200
parents
children c4fb132a086c
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dwtx/jface/text/quickassist/IQuickAssistProcessor.d	Sat Aug 23 19:10:48 2008 +0200
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ * Port to the D programming language:
+ *     Frank Benoit <benoit@tionex.de>
+ *******************************************************************************/
+module dwtx.jface.text.quickassist.IQuickAssistProcessor;
+
+import dwt.dwthelper.utils;
+
+import dwtx.jface.text.contentassist.ICompletionProposal;
+import dwtx.jface.text.source.Annotation;
+
+
+/**
+ * Quick assist processor for quick fixes and quick assists.
+ * <p>
+ * A processor can provide just quick fixes, just quick assists
+ * or both.
+ * </p>
+ * <p>
+ * This interface can be implemented by clients.</p>
+ * 
+ * @since 3.2
+ */
+public interface IQuickAssistProcessor {
+
+    /**
+     * Returns the reason why this quick assist processor
+     * was unable to produce any completion proposals.
+     *
+     * @return an error message or <code>null</code> if no error occurred
+     */
+    String getErrorMessage();
+
+    /**
+     * Tells whether this processor has a fix for the given annotation.
+     * <p>
+     * <strong>Note:</strong> This test must be fast and optimistic i.e. it is OK to return
+     * <code>true</code> even though there might be no quick fix.
+     * </p>
+     * 
+     * @param annotation the annotation
+     * @return <code>true</code> if the assistant has a fix for the given annotation
+     */
+    bool canFix(Annotation annotation);
+    
+    /**
+     * Tells whether this assistant has assists for the given invocation context.
+     * 
+     * @param invocationContext the invocation context
+     * @return <code>true</code> if the assistant has a fix for the given annotation
+     */
+    bool canAssist(IQuickAssistInvocationContext invocationContext);
+    
+    /**
+     * Returns a list of quick assist and quick fix proposals for the
+     * given invocation context.
+     *
+     * @param invocationContext the invocation context
+     * @return an array of completion proposals or <code>null</code> if no proposals are available
+     */
+    ICompletionProposal[] computeQuickAssistProposals(IQuickAssistInvocationContext invocationContext);
+    
+}