This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 181523
Collapse All | Expand All

(-)a/editor.lib2/apichanges.xml (+13 lines)
Lines 104-109 Link Here
104
    <!-- ACTUAL CHANGES BEGIN HERE: -->
104
    <!-- ACTUAL CHANGES BEGIN HERE: -->
105
105
106
    <changes>
106
    <changes>
107
        <change id="added-line-column-based-dialog-bindings">
108
            <summary>Adding line/column based dialog bindings</summary>
109
            <version major="1" minor="24"/>
110
            <date day="26" month="3" year="2010"/>
111
            <author login="vstejskal"/>
112
            <compatibility binary="compatible" source="compatible" semantic="compatible" addition="yes"/>
113
            <description>
114
                Added <code>DialogBinding.bindComponentToDocument(FileObject fileObject, int line, int column, int length, JTextComponent component)</code>
115
                and <code>DialogBinding.bindComponentToDocument(Document fileObject, int line, int column, int length, JTextComponent component)</code>.
116
            </description>
117
            <issue number="181523"/>
118
        </change>
119
107
        <change id="added-toggleNonPrintableCharacters">
120
        <change id="added-toggleNonPrintableCharacters">
108
            <summary>EditorActionNames.toggleNonPrintableCharacters added.</summary>
121
            <summary>EditorActionNames.toggleNonPrintableCharacters added.</summary>
109
            <version major="1" minor="20"/>
122
            <version major="1" minor="20"/>
(-)a/editor.lib2/nbproject/project.properties (-1 / +1 lines)
Lines 40-46 Link Here
40
is.autoload=true
40
is.autoload=true
41
javac.source=1.6
41
javac.source=1.6
42
javac.compilerargs=-Xlint:unchecked
42
javac.compilerargs=-Xlint:unchecked
43
spec.version.base=1.23
43
spec.version.base=1.24
44
44
45
javadoc.arch=${basedir}/arch.xml
45
javadoc.arch=${basedir}/arch.xml
46
javadoc.apichanges=${basedir}/apichanges.xml
46
javadoc.apichanges=${basedir}/apichanges.xml
(-)a/editor.lib2/src/org/netbeans/api/editor/DialogBinding.java (-3 / +69 lines)
Lines 46-79 Link Here
46
 */
46
 */
47
public final class DialogBinding {
47
public final class DialogBinding {
48
48
49
    // -----------------------------------------------------------------------
50
    // Public implementation
51
    // -----------------------------------------------------------------------
52
49
    /**
53
    /**
50
     * Bind given component and given file together.
54
     * Bind given component and given file together.
55
     *
51
     * @param fileObject to bind
56
     * @param fileObject to bind
52
     * @param offset position at which content of the component will be virtually placed
57
     * @param offset position at which content of the component will be virtually placed
53
     * @param length how many characters replace from the original file
58
     * @param length how many characters replace from the original file
54
     * @param component component to bind
59
     * @param component component to bind
55
     */
60
     */
56
    public static void bindComponentToFile(final FileObject fileObject, int offset, int length, final JTextComponent component) {
61
    public static void bindComponentToFile(FileObject fileObject, int offset, int length, JTextComponent component) {
57
        Parameters.notNull("fileObject", fileObject); //NOI18N
62
        Parameters.notNull("fileObject", fileObject); //NOI18N
58
        Parameters.notNull("component", component); //NOI18N
63
        Parameters.notNull("component", component); //NOI18N
59
        if (!fileObject.isValid() || !fileObject.isData())
64
        if (!fileObject.isValid() || !fileObject.isData()) {
60
            return;
65
            return;
66
        }
67
        if (offset < 0 || offset > fileObject.getSize()) {
68
            throw new IllegalArgumentException("Invalid offset=" + offset + "; file.size=" + fileObject.getSize()); //NOI18N
69
        }
70
        if (length < 0 || offset + length > fileObject.getSize()) {
71
            throw new IllegalArgumentException("Invalid lenght=" + length + "; offset=" + offset + ", file.size=" + fileObject.getSize()); //NOI18N
72
        }
61
        bind(component, null, fileObject, offset, -1, -1, length, fileObject.getMIMEType());
73
        bind(component, null, fileObject, offset, -1, -1, length, fileObject.getMIMEType());
62
    }
74
    }
63
75
64
    /**
76
    /**
65
     * Bind given component and given document together.
77
     * Bind given component and given document together.
78
     *
66
     * @param document to bind
79
     * @param document to bind
67
     * @param offset position at which content of the component will be virtually placed
80
     * @param offset position at which content of the component will be virtually placed
68
     * @param length how many characters replace from the original document
81
     * @param length how many characters replace from the original document
69
     * @param component component to bind
82
     * @param component component to bind
70
     */
83
     */
71
    public static void bindComponentToDocument(final Document document, int offset, int length, final JTextComponent component) {
84
    public static void bindComponentToDocument(Document document, int offset, int length, JTextComponent component) {
72
        Parameters.notNull("document", document); //NOI18N
85
        Parameters.notNull("document", document); //NOI18N
73
        Parameters.notNull("component", component); //NOI18N
86
        Parameters.notNull("component", component); //NOI18N
87
        if (offset < 0 || offset > document.getLength()) {
88
            throw new IllegalArgumentException("Invalid offset=" + offset + "; file.size=" + document.getLength()); //NOI18N
89
        }
90
        if (length < 0 || offset + length > document.getLength()) {
91
            throw new IllegalArgumentException("Invalid lenght=" + length + "; offset=" + offset + ", file.size=" + document.getLength()); //NOI18N
92
        }
74
        bind(component, document, null, offset, -1, -1, length, (String)document.getProperty("mimeType")); //NOI18N
93
        bind(component, document, null, offset, -1, -1, length, (String)document.getProperty("mimeType")); //NOI18N
75
    }
94
    }
76
95
96
    /**
97
     * Bind given component and given file together.
98
     * 
99
     * @param fileObject to bind
100
     * @param line an index (zero based) of the line where to place the component's content
101
     * @param column position (number of characters) at the line where to place the content
102
     * @param length how many characters replace from the original file
103
     * @param component component to bind
104
     *
105
     * @since 1.24
106
     */
107
    public static void bindComponentToFile(FileObject fileObject, int line, int column, int length, JTextComponent component) {
108
        Parameters.notNull("fileObject", fileObject); //NOI18N
109
        Parameters.notNull("component", component); //NOI18N
110
        if (!fileObject.isValid() || !fileObject.isData()) {
111
            return;
112
        }
113
        if (line < 0 || column < 0) {
114
            throw new IllegalArgumentException("Invalid line=" + line + " or column=" + column); //NOI18N
115
        }
116
        bind(component, null, fileObject, -1, line, column, length, fileObject.getMIMEType());
117
    }
118
119
    /**
120
     * Bind given component and given document together.
121
     *
122
     * @param document to bind
123
     * @param line an index (zero based) of the line where to place the component's content
124
     * @param column position (number of characters) at the line where to place the content
125
     * @param length how many characters replace from the original document
126
     * @param component component to bind
127
     *
128
     * @since 1.24
129
     */
130
    public static void bindComponentToDocument(Document document, int line, int column, int length, JTextComponent component) {
131
        Parameters.notNull("document", document); //NOI18N
132
        Parameters.notNull("component", component); //NOI18N
133
        if (line < 0 || column < 0) {
134
            throw new IllegalArgumentException("Invalid line=" + line + " or column=" + column); //NOI18N
135
        }
136
        bind(component, document, null, -1, line, column, length, (String)document.getProperty("mimeType")); //NOI18N
137
    }
138
139
    // -----------------------------------------------------------------------
140
    // Private implementation
141
    // -----------------------------------------------------------------------
142
77
    // -J-Dorg.netbeans.api.editor.DialogBinding.level=FINE
143
    // -J-Dorg.netbeans.api.editor.DialogBinding.level=FINE
78
    private static final Logger LOG = Logger.getLogger(DialogBinding.class.getName());
144
    private static final Logger LOG = Logger.getLogger(DialogBinding.class.getName());
79
    
145
    

Return to bug 181523