129
|
1 /*******************************************************************************
|
|
2 * Copyright (c) 2007, 2008 IBM Corporation and others.
|
|
3 * All rights reserved. This program and the accompanying materials
|
|
4 * are made available under the terms of the Eclipse Public License v1.0
|
|
5 * which accompanies this distribution, and is available at
|
|
6 * http://www.eclipse.org/legal/epl-v10.html
|
|
7 *
|
|
8 * Contributors:
|
|
9 * IBM Corporation - initial API and implementation
|
|
10 * Port to the D programming language:
|
|
11 * Frank Benoit <benoit@tionex.de>
|
|
12 *******************************************************************************/
|
|
13 module dwtx.jface.text.ITextViewerExtension8;
|
|
14
|
|
15 import dwt.dwthelper.utils;
|
|
16
|
|
17 import dwt.custom.StyledTextPrintOptions;
|
|
18
|
|
19
|
|
20 /**
|
|
21 * Extension interface for {@link dwtx.jface.text.ITextViewer}. Adds the
|
|
22 * ability to print and set how hovers should be enriched when the mouse is moved into them.
|
|
23 *
|
|
24 * @since 3.4
|
|
25 */
|
|
26 public interface ITextViewerExtension8 {
|
|
27
|
|
28 /**
|
|
29 * Print the text viewer contents using the given options.
|
|
30 *
|
|
31 * @param options the print options
|
|
32 */
|
|
33 void print(StyledTextPrintOptions options);
|
|
34
|
|
35 /**
|
|
36 * Sets the hover enrich mode.
|
|
37 * A non-<code>null</code> <code>mode</code> defines when hovers
|
|
38 * should be enriched once the mouse is moved into them.
|
|
39 * If <code>mode</code> is <code>null</code>, hovers are automatically closed
|
|
40 * when the mouse is moved out of the {@link ITextHover#getHoverRegion(ITextViewer, int) hover region}.
|
|
41 * <p>
|
|
42 * Note that a hover can only be enriched if its {@link IInformationControlExtension5#getInformationPresenterControlCreator()}
|
|
43 * is not <code>null</code>.
|
|
44 * </p>
|
|
45 *
|
|
46 * @param mode the enrich mode, or <code>null</code>
|
|
47 */
|
|
48 void setHoverEnrichMode(EnrichMode mode);
|
|
49
|
|
50
|
|
51 /**
|
|
52 * Type-safe enum of the available enrich modes.
|
|
53 */
|
|
54 public static final class EnrichMode {
|
|
55
|
|
56 /**
|
|
57 * Enrich the hover shortly after the mouse has been moved into it and
|
|
58 * stopped moving.
|
|
59 *
|
|
60 * @see ITextViewerExtension8#setHoverEnrichMode(dwtx.jface.text.ITextViewerExtension8.EnrichMode)
|
|
61 */
|
|
62 public static final EnrichMode AFTER_DELAY= new EnrichMode("after delay"); //$NON-NLS-1$
|
|
63
|
|
64 /**
|
|
65 * Enrich the hover immediately when the mouse is moved into it.
|
|
66 *
|
|
67 * @see ITextViewerExtension8#setHoverEnrichMode(dwtx.jface.text.ITextViewerExtension8.EnrichMode)
|
|
68 */
|
|
69 public static final EnrichMode IMMEDIATELY= new EnrichMode("immediately"); //$NON-NLS-1$
|
|
70
|
|
71 /**
|
|
72 * Enrich the hover on explicit mouse click.
|
|
73 *
|
|
74 * @see ITextViewerExtension8#setHoverEnrichMode(dwtx.jface.text.ITextViewerExtension8.EnrichMode)
|
|
75 */
|
|
76 public static final EnrichMode ON_CLICK= new EnrichMode("on click"); //$NON-NLS-1$;
|
|
77
|
|
78
|
|
79 private String fName;
|
|
80
|
|
81 private EnrichMode(String name) {
|
|
82 fName= name;
|
|
83 }
|
|
84
|
|
85 /*
|
|
86 * @see java.lang.Object#toString()
|
|
87 */
|
|
88 public String toString() {
|
|
89 return fName;
|
|
90 }
|
|
91 }
|
|
92
|
|
93 }
|