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 125060
Collapse All | Expand All

(-)org/netbeans/modules/editor/java/ExcludeCompletion.java (+142 lines)
Line 0 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
5
 *
6
 * The contents of this file are subject to the terms of either the GNU
7
 * General Public License Version 2 only ("GPL") or the Common
8
 * Development and Distribution License("CDDL") (collectively, the
9
 * "License"). You may not use this file except in compliance with the
10
 * License. You can obtain a copy of the License at
11
 * http://www.netbeans.org/cddl-gplv2.html
12
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
13
 * specific language governing permissions and limitations under the
14
 * License.  When distributing the software, include this License Header
15
 * Notice in each file and include the License file at
16
 * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
17
 * particular file as subject to the "Classpath" exception as provided
18
 * by Sun in the GPL Version 2 section of the License file that
19
 * accompanied this code. If applicable, add the following below the
20
 * License Header, with the fields enclosed by brackets [] replaced by
21
 * your own identifying information:
22
 * "Portions Copyrighted [year] [name of copyright owner]"
23
 *
24
 * If you wish your version of this file to be governed by only the CDDL
25
 * or only the GPL Version 2, indicate your decision by adding
26
 * "[Contributor] elects to include this software in this distribution
27
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
28
 * single choice of license, a recipient has the option to distribute
29
 * your version of this file under either the CDDL, the GPL Version 2 or
30
 * to extend the choice of license to its licensees as provided above.
31
 * However, if you add GPL Version 2 code and therefore, elected the GPL
32
 * Version 2 license, then the option applies only if the new code is
33
 * made subject to such option by the copyright holder.
34
 *
35
 * Contributor(s):
36
 *
37
 * Samuel Halliday
38
 *
39
 * Portions Copyrighted 2009 Sun Microsystems, Inc.
40
 */
41
package org.netbeans.modules.editor.java;
42
43
import java.util.ArrayList;
44
import java.util.Collection;
45
import java.util.concurrent.locks.ReadWriteLock;
46
import java.util.concurrent.locks.ReentrantReadWriteLock;
47
48
/**
49
 * A whitelist/blacklist of excluded classes and packages for the Java completer.
50
 * Requested in RFE #125060.
51
 *
52
 * @author Samuel Halliday
53
 */
54
final class ExcludeCompletion {
55
56
    private final Collection<String> exclude = new ArrayList<String>();
57
    private final Collection<String> include = new ArrayList<String>();
58
    private final ReadWriteLock lock = new ReentrantReadWriteLock();
59
60
    /** */
61
    public ExcludeCompletion() {
62
    }
63
64
    /**
65
     * @param fqn Fully Qualified Name
66
     * @return
67
     */
68
    public boolean isExcluded(final CharSequence fqn) {
69
        //#122334: do not propose imports from the default package
70
        if (fqn == null || fqn.length() == 0) {
71
            return true;
72
        }
73
74
        String s = fqn.toString();
75
        lock.readLock().lock();
76
        try {
77
            if (include.size() > 0) {
78
                for (String entry : include) {
79
                    if (entry.length() > fqn.length()) {
80
                        if (entry.startsWith(s)) {
81
                            return false;
82
                        }
83
                    } else if (s.startsWith(entry)) {
84
                        return false;
85
                    }
86
                }
87
            }
88
89
            if (exclude.size() > 0) {
90
                for (String entry : exclude) {
91
                    if (entry.endsWith(".") && fqn.equals(entry.substring(0, entry.length() - 1))) { // NOI18N
92
                        // exclude packages names (no trailing fullstop)
93
                        return true;
94
                    }
95
                    if (entry.length() > fqn.length()) {
96
                        // fqn not long enough to filter yet
97
                        continue;
98
                    }
99
                    if (s.startsWith(entry)) {
100
                        return true;
101
                    }
102
                }
103
            }
104
105
            return false;
106
        } finally {
107
            lock.readLock().unlock();
108
        }
109
    }
110
111
    /**
112
     * @param blacklist comma separated list of fqns
113
     */
114
    public void updateBlacklist(String blacklist) {
115
        update(exclude, blacklist);
116
    }
117
118
    /**
119
     * @param whitelist comma separated list of fqns
120
     */
121
    public void updateWhitelist(String whitelist) {
122
        update(include, whitelist);
123
    }
124
125
    private void update(Collection<String> existing, String updated) {
126
        lock.writeLock().lock();
127
        try {
128
            existing.clear();
129
            if (updated == null || updated.length() == 0) {
130
                return;
131
            }
132
            String[] entries = updated.split(","); //NOI18N
133
            for (String entry : entries) {
134
                if (entry != null && entry.length() != 0) {
135
                    existing.add(entry);
136
                }
137
            }
138
        } finally {
139
            lock.writeLock().unlock();
140
        }
141
    }
142
}
(-)org/netbeans/modules/editor/java/JavaCompletionProvider.java (-1 / +1 lines)
Lines 2729-2735 Link Here
2729
            if (fqnPrefix == null)
2729
            if (fqnPrefix == null)
2730
                fqnPrefix = EMPTY;
2730
                fqnPrefix = EMPTY;
2731
            for (String pkgName : env.getController().getClasspathInfo().getClassIndex().getPackageNames(fqnPrefix, true,EnumSet.allOf(ClassIndex.SearchScope.class)))
2731
            for (String pkgName : env.getController().getClasspathInfo().getClassIndex().getPackageNames(fqnPrefix, true,EnumSet.allOf(ClassIndex.SearchScope.class)))
2732
                if (pkgName.length() > 0)
2732
                if (!Utilities.isExcluded(pkgName))
2733
                    results.add(JavaCompletionItem.createPackageItem(pkgName, anchorOffset, inPkgStmt));
2733
                    results.add(JavaCompletionItem.createPackageItem(pkgName, anchorOffset, inPkgStmt));
2734
        }
2734
        }
2735
        
2735
        
(-)org/netbeans/modules/editor/java/LazyTypeCompletionItem.java (-1 / +1 lines)
Lines 117-123 Link Here
117
                            TypeElement e = handle.resolve(controller);
117
                            TypeElement e = handle.resolve(controller);
118
                            Elements elements = controller.getElements();
118
                            Elements elements = controller.getElements();
119
                            if (e != null && (Utilities.isShowDeprecatedMembers() || !elements.isDeprecated(e)) && controller.getTrees().isAccessible(scope, e)) {
119
                            if (e != null && (Utilities.isShowDeprecatedMembers() || !elements.isDeprecated(e)) && controller.getTrees().isAccessible(scope, e)) {
120
                                if (isOfKind(e, kinds) && (!isInDefaultPackage(e) || isInDefaultPackage(scope.getEnclosingClass())))
120
                                if (isOfKind(e, kinds) && (!isInDefaultPackage(e) || isInDefaultPackage(scope.getEnclosingClass())) && !Utilities.isExcluded(e.getQualifiedName()))
121
                                    delegate = JavaCompletionItem.createTypeItem(e, (DeclaredType)e.asType(), substitutionOffset, true, controller.getElements().isDeprecated(e), insideNew, false);
121
                                    delegate = JavaCompletionItem.createTypeItem(e, (DeclaredType)e.asType(), substitutionOffset, true, controller.getElements().isDeprecated(e), insideNew, false);
122
                            }
122
                            }
123
                        }
123
                        }
(-)org/netbeans/modules/editor/java/Utilities.java (-6 / +24 lines)
Lines 113-137 Link Here
113
                showDeprecatedMembers = preferences.getBoolean(SimpleValueNames.SHOW_DEPRECATED_MEMBERS, true);
113
                showDeprecatedMembers = preferences.getBoolean(SimpleValueNames.SHOW_DEPRECATED_MEMBERS, true);
114
            }
114
            }
115
            if (settingName == null || CodeCompletionPanel.GUESS_METHOD_ARGUMENTS.equals(settingName)) {
115
            if (settingName == null || CodeCompletionPanel.GUESS_METHOD_ARGUMENTS.equals(settingName)) {
116
                guessMethodArguments = preferences.getBoolean(CodeCompletionPanel.GUESS_METHOD_ARGUMENTS, true);
116
                guessMethodArguments = preferences.getBoolean(CodeCompletionPanel.GUESS_METHOD_ARGUMENTS, CodeCompletionPanel.GUESS_METHOD_ARGUMENTS_DEFAULT);
117
            }
117
            }
118
            if (settingName == null || CodeCompletionPanel.JAVA_AUTO_POPUP_ON_IDENTIFIER_PART.equals(settingName)) {
118
            if (settingName == null || CodeCompletionPanel.JAVA_AUTO_POPUP_ON_IDENTIFIER_PART.equals(settingName)) {
119
                autoPopupOnJavaIdentifierPart = preferences.getBoolean(CodeCompletionPanel.JAVA_AUTO_POPUP_ON_IDENTIFIER_PART, false);
119
                autoPopupOnJavaIdentifierPart = preferences.getBoolean(CodeCompletionPanel.JAVA_AUTO_POPUP_ON_IDENTIFIER_PART, CodeCompletionPanel.JAVA_AUTO_POPUP_ON_IDENTIFIER_PART_DEFAULT);
120
            }
120
            }
121
            if (settingName == null || CodeCompletionPanel.JAVA_AUTO_COMPLETION_TRIGGERS.equals(settingName)) {
121
            if (settingName == null || CodeCompletionPanel.JAVA_AUTO_COMPLETION_TRIGGERS.equals(settingName)) {
122
                javaCompletionAutoPopupTriggers = preferences.get(CodeCompletionPanel.JAVA_AUTO_COMPLETION_TRIGGERS, "."); //NOI18N
122
                javaCompletionAutoPopupTriggers = preferences.get(CodeCompletionPanel.JAVA_AUTO_COMPLETION_TRIGGERS, CodeCompletionPanel.JAVA_AUTO_COMPLETION_TRIGGERS_DEFAULT);
123
            }
123
            }
124
            if (settingName == null || CodeCompletionPanel.JAVA_COMPLETION_SELECTORS.equals(settingName)) {
124
            if (settingName == null || CodeCompletionPanel.JAVA_COMPLETION_SELECTORS.equals(settingName)) {
125
                javaCompletionSelectors = preferences.get(CodeCompletionPanel.JAVA_COMPLETION_SELECTORS, ".,;:([+-="); //NOI18N
125
                javaCompletionSelectors = preferences.get(CodeCompletionPanel.JAVA_COMPLETION_SELECTORS, CodeCompletionPanel.JAVA_COMPLETION_SELECTORS_DEFAULT);
126
            }
126
            }
127
            if (settingName == null || CodeCompletionPanel.JAVADOC_AUTO_COMPLETION_TRIGGERS.equals(settingName)) {
127
            if (settingName == null || CodeCompletionPanel.JAVADOC_AUTO_COMPLETION_TRIGGERS.equals(settingName)) {
128
                javadocCompletionAutoPopupTriggers = preferences.get(CodeCompletionPanel.JAVADOC_AUTO_COMPLETION_TRIGGERS, ".#@"); //NOI18N
128
                javadocCompletionAutoPopupTriggers = preferences.get(CodeCompletionPanel.JAVADOC_AUTO_COMPLETION_TRIGGERS, CodeCompletionPanel.JAVADOC_AUTO_COMPLETION_TRIGGERS_DEFAULT);
129
            }
129
            }
130
            if (settingName == null || CodeCompletionPanel.JAVA_COMPLETION_BLACKLIST.equals(settingName)) {
131
                String blacklist = preferences.get(CodeCompletionPanel.JAVA_COMPLETION_BLACKLIST, CodeCompletionPanel.JAVA_COMPLETION_BLACKLIST_DEFAULT);
132
                excluder.updateBlacklist(blacklist);
130
        }
133
        }
134
            if (settingName == null || CodeCompletionPanel.JAVA_COMPLETION_WHITELIST.equals(settingName)) {
135
                String whitelist = preferences.get(CodeCompletionPanel.JAVA_COMPLETION_WHITELIST, CodeCompletionPanel.JAVA_COMPLETION_WHITELIST_DEFAULT);
136
                excluder.updateWhitelist(whitelist);
137
            }
138
        }
131
    };
139
    };
132
    
140
    
133
    private static String cachedPrefix = null;
141
    private static String cachedPrefix = null;
134
    private static Pattern cachedPattern = null;
142
    private static Pattern cachedPattern = null;
143
    private static volatile ExcludeCompletion excluder = null;
135
    
144
    
136
    public static boolean startsWith(String theString, String prefix) {
145
    public static boolean startsWith(String theString, String prefix) {
137
        if (theString == null || theString.length() == 0 || ERROR.equals(theString))
146
        if (theString == null || theString.length() == 0 || ERROR.equals(theString))
Lines 215-223 Link Here
215
        return javadocCompletionAutoPopupTriggers;
224
        return javadocCompletionAutoPopupTriggers;
216
    }
225
    }
217
226
227
    /**
228
     * @param fqn Fully Qualified Name
229
     * @return
230
     */
231
    public static boolean isExcluded(CharSequence fqn){
232
        lazyInit();
233
        return excluder.isExcluded(fqn);
234
    }
235
218
    private static void lazyInit() {
236
    private static void lazyInit() {
219
        if (!inited) {
237
        if (!inited) {
220
            inited = true;
238
            inited = true;
239
            excluder = new ExcludeCompletion();
221
            preferences = MimeLookup.getLookup(JavaKit.JAVA_MIME_TYPE).lookup(Preferences.class);
240
            preferences = MimeLookup.getLookup(JavaKit.JAVA_MIME_TYPE).lookup(Preferences.class);
222
            preferences.addPreferenceChangeListener(WeakListeners.create(PreferenceChangeListener.class, preferencesTracker, preferences));
241
            preferences.addPreferenceChangeListener(WeakListeners.create(PreferenceChangeListener.class, preferencesTracker, preferences));
223
            preferencesTracker.preferenceChange(null);
242
            preferencesTracker.preferenceChange(null);
Lines 787-791 Link Here
787
        return found;
806
        return found;
788
    }
807
    }
789
    
808
    
790
    
791
}
809
}
(-)org/netbeans/modules/java/editor/imports/ComputeImports.java (-2 / +3 lines)
Lines 72-77 Link Here
72
import org.netbeans.api.java.source.ClassIndex.NameKind;
72
import org.netbeans.api.java.source.ClassIndex.NameKind;
73
import org.netbeans.api.java.source.ElementHandle;
73
import org.netbeans.api.java.source.ElementHandle;
74
import org.netbeans.api.java.source.support.CancellableTreePathScanner;
74
import org.netbeans.api.java.source.support.CancellableTreePathScanner;
75
import org.netbeans.modules.editor.java.Utilities;
75
import org.netbeans.modules.java.editor.javadoc.JavadocImports;
76
import org.netbeans.modules.java.editor.javadoc.JavadocImports;
76
import org.openide.util.Union2;
77
import org.openide.util.Union2;
77
78
Lines 145-152 Link Here
145
                    continue;
146
                    continue;
146
                }
147
                }
147
                
148
                
148
                //#122334: do not propose imports from the default package:
149
				CharSequence fqn = info.getElements().getPackageOf(te).getQualifiedName();
149
                if (info.getElements().getPackageOf(te).getQualifiedName().length() != 0) {
150
                if (!Utilities.isExcluded(fqn)){
150
                    classes.add(te);
151
                    classes.add(te);
151
                }
152
                }
152
            }
153
            }
(-)org/netbeans/modules/java/editor/imports/JavaFixAllImports.java (-1 / +2 lines)
Lines 309-315 Link Here
309
309
310
        private ImportVisitor (CompilationInfo info) {
310
        private ImportVisitor (CompilationInfo info) {
311
            this.info = info;
311
            this.info = info;
312
            currentPackage = info.getCompilationUnit().getPackageName().toString();
312
			ExpressionTree pkg = info.getCompilationUnit().getPackageName();
313
            currentPackage = pkg != null ? pkg.toString() : "";
313
            imports = new ArrayList<TreePathHandle>();
314
            imports = new ArrayList<TreePathHandle>();
314
        }
315
        }
315
316
(-)org/netbeans/modules/java/editor/javadoc/JavadocCompletionQuery.java (-1 / +1 lines)
Lines 603-609 Link Here
603
        }
603
        }
604
        
604
        
605
        for (String pkgName : jdctx.javac.getClasspathInfo().getClassIndex().getPackageNames(pkgPrefix, true, EnumSet.allOf(ClassIndex.SearchScope.class)))
605
        for (String pkgName : jdctx.javac.getClasspathInfo().getClassIndex().getPackageNames(pkgPrefix, true, EnumSet.allOf(ClassIndex.SearchScope.class)))
606
            if (pkgName.length() > 0)
606
            if (!Utilities.isExcluded(pkgName))
607
                items.add(JavaCompletionItem.createPackageItem(pkgName, substitutionOffset, false));
607
                items.add(JavaCompletionItem.createPackageItem(pkgName, substitutionOffset, false));
608
    }
608
    }
609
    
609
    
(-)org/netbeans/modules/java/editor/options/Bundle.properties (+15 lines)
Lines 116-118 Link Here
116
LBL_JavaCompletionLabel=Java Code Completion
116
LBL_JavaCompletionLabel=Java Code Completion
117
LBL_GuessMethodParameters=jCheckBox1
117
LBL_GuessMethodParameters=jCheckBox1
118
LBL_GuessMethodArgs=&Guess Filled Method Arguments
118
LBL_GuessMethodArgs=&Guess Filled Method Arguments
119
CodeCompletionPanel.javaCompletionExcluderLabel.text=Packages/classes:
120
CodeCompletionPanel.javaCompletionExcludeTable.columnModel.title3=Title 4
121
CodeCompletionPanel.javaCompletionExcludeTable.columnModel.title2=Title 3
122
CodeCompletionPanel.javaCompletionExcludeTable.columnModel.title1=Title 2
123
CodeCompletionPanel.javaCompletionExcluderButton.text=Exclude
124
CodeCompletionPanel.javaCompletionExcludeTable.columnModel.title3_1=Title 4
125
CodeCompletionPanel.javaCompletionExcludeTable.columnModel.title2_1=Title 3
126
CodeCompletionPanel.javaCompletionExcludeTable.columnModel.title1_1=Title 2
127
CodeCompletionPanel.javaCompletionExcludeScrollPane.TabConstraints.tabTitle=Exclude
128
CodeCompletionPanel.javaCompletionExcludeTable.columnModel.title0=Fully Qualified Name prefix
129
CodeCompletionPanel.javaCompletionExcluderAddButton.text=Add
130
CodeCompletionPanel.javaCompletionIncludeScrollPane.TabConstraints.tabTitle=Include
131
CodeCompletionPanel.javaCompletionExcluderRemoveButton.text=Remove
132
CodeCompletionPanel.javaCompletionExcluderFrame.title=Java Completion Excluder
133
CodeCompletionPanel.javaCompletionExcluderCloseButton.text=Close
(-)org/netbeans/modules/java/editor/options/CodeCompletionPanel.form (-23 / +253 lines)
Lines 1-7 Link Here
1
<?xml version="1.0" encoding="UTF-8" ?>
1
<?xml version="1.0" encoding="UTF-8" ?>
2
2
3
<Form version="1.4" maxVersion="1.4" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
3
<Form version="1.5" maxVersion="1.5" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
4
  <NonVisualComponents>
5
    <Container class="javax.swing.JFrame" name="javaCompletionExcluderFrame">
4
  <Properties>
6
  <Properties>
7
        <Property name="title" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
8
          <ResourceString bundle="org/netbeans/modules/java/editor/options/Bundle.properties" key="CodeCompletionPanel.javaCompletionExcluderFrame.title" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
9
        </Property>
10
        <Property name="alwaysOnTop" type="boolean" value="true"/>
11
        <Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
12
          <Dimension value="[409, 233]"/>
13
        </Property>
14
        <Property name="undecorated" type="boolean" value="true"/>
15
      </Properties>
16
17
      <Layout>
18
        <DimensionLayout dim="0">
19
          <Group type="103" groupAlignment="0" attributes="0">
20
              <Group type="102" alignment="1" attributes="0">
21
                  <EmptySpace max="-2" attributes="0"/>
22
                  <Component id="javaCompletionExcluderTab" min="-2" pref="298" max="-2" attributes="0"/>
23
                  <EmptySpace max="-2" attributes="0"/>
24
                  <Group type="103" groupAlignment="0" max="-2" attributes="0">
25
                      <Component id="javaCompletionExcluderCloseButton" min="0" pref="0" max="32767" attributes="1"/>
26
                      <Component id="javaCompletionExcluderRemoveButton" alignment="0" max="32767" attributes="1"/>
27
                      <Component id="javaCompletionExcluderAddButton" alignment="0" max="32767" attributes="1"/>
28
                  </Group>
29
                  <EmptySpace pref="10" max="32767" attributes="0"/>
30
              </Group>
31
          </Group>
32
        </DimensionLayout>
33
        <DimensionLayout dim="1">
34
          <Group type="103" groupAlignment="0" attributes="0">
35
              <Group type="102" attributes="0">
36
                  <Group type="103" groupAlignment="0" attributes="0">
37
                      <Group type="102" attributes="0">
38
                          <EmptySpace max="-2" attributes="0"/>
39
                          <Component id="javaCompletionExcluderTab" min="-2" pref="221" max="-2" attributes="0"/>
40
                      </Group>
41
                      <Group type="102" alignment="0" attributes="0">
42
                          <EmptySpace min="-2" pref="59" max="-2" attributes="0"/>
43
                          <Component id="javaCompletionExcluderAddButton" min="-2" max="-2" attributes="0"/>
44
                          <EmptySpace max="-2" attributes="0"/>
45
                          <Component id="javaCompletionExcluderRemoveButton" min="-2" max="-2" attributes="0"/>
46
                          <EmptySpace min="-2" pref="63" max="-2" attributes="0"/>
47
                          <Component id="javaCompletionExcluderCloseButton" min="-2" max="-2" attributes="0"/>
48
                      </Group>
49
                  </Group>
50
                  <EmptySpace max="32767" attributes="0"/>
51
              </Group>
52
          </Group>
53
        </DimensionLayout>
54
      </Layout>
55
      <SubComponents>
56
        <Container class="javax.swing.JTabbedPane" name="javaCompletionExcluderTab">
57
58
          <Layout class="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout"/>
59
          <SubComponents>
60
            <Container class="javax.swing.JScrollPane" name="javaCompletionExcludeScrollPane">
61
              <AuxValues>
62
                <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
63
              </AuxValues>
64
              <Constraints>
65
                <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout$JTabbedPaneConstraintsDescription">
66
                  <JTabbedPaneConstraints tabName="Exclude">
67
                    <Property name="tabTitle" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
68
                      <ResourceString bundle="org/netbeans/modules/java/editor/options/Bundle.properties" key="CodeCompletionPanel.javaCompletionExcludeScrollPane.TabConstraints.tabTitle" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
69
                    </Property>
70
                  </JTabbedPaneConstraints>
71
                </Constraint>
72
              </Constraints>
73
74
              <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
75
              <SubComponents>
76
                <Component class="javax.swing.JTable" name="javaCompletionExcludeTable">
77
                  <Properties>
78
                    <Property name="model" type="javax.swing.table.TableModel" editor="org.netbeans.modules.form.editors2.TableModelEditor">
79
                      <Table columnCount="1" rowCount="0">
80
                        <Column editable="true" title="Fully Qualified Name prefix" type="java.lang.String"/>
81
                      </Table>
82
                    </Property>
83
                    <Property name="columnModel" type="javax.swing.table.TableColumnModel" editor="org.netbeans.modules.form.editors2.TableColumnModelEditor">
84
                      <TableColumnModel selectionModel="0">
85
                        <Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true">
86
                          <Title editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
87
                            <ResourceString bundle="org/netbeans/modules/java/editor/options/Bundle.properties" key="CodeCompletionPanel.javaCompletionExcludeTable.columnModel.title0" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
88
                          </Title>
89
                          <Editor/>
90
                          <Renderer/>
91
                        </Column>
92
                      </TableColumnModel>
93
                    </Property>
94
                    <Property name="tableHeader" type="javax.swing.table.JTableHeader" editor="org.netbeans.modules.form.editors2.JTableHeaderEditor">
95
                      <TableHeader reorderingAllowed="false" resizingAllowed="true"/>
96
                    </Property>
97
                  </Properties>
98
                </Component>
99
              </SubComponents>
100
            </Container>
101
            <Container class="javax.swing.JScrollPane" name="javaCompletionIncludeScrollPane">
102
              <AuxValues>
103
                <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
104
              </AuxValues>
105
              <Constraints>
106
                <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout$JTabbedPaneConstraintsDescription">
107
                  <JTabbedPaneConstraints tabName="Include">
108
                    <Property name="tabTitle" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
109
                      <ResourceString bundle="org/netbeans/modules/java/editor/options/Bundle.properties" key="CodeCompletionPanel.javaCompletionIncludeScrollPane.TabConstraints.tabTitle" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
110
                    </Property>
111
                  </JTabbedPaneConstraints>
112
                </Constraint>
113
              </Constraints>
114
115
              <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
116
              <SubComponents>
117
                <Component class="javax.swing.JTable" name="javaCompletionIncludeTable">
118
                  <Properties>
119
                    <Property name="model" type="javax.swing.table.TableModel" editor="org.netbeans.modules.form.editors2.TableModelEditor">
120
                      <Table columnCount="1" rowCount="0">
121
                        <Column editable="true" title="Fully Qualified Name prefix" type="java.lang.String"/>
122
                      </Table>
123
                    </Property>
124
                    <Property name="columnModel" type="javax.swing.table.TableColumnModel" editor="org.netbeans.modules.form.editors2.TableColumnModelEditor">
125
                      <TableColumnModel selectionModel="0">
126
                        <Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true">
127
                          <Title editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
128
                            <ResourceString bundle="org/netbeans/modules/java/editor/options/Bundle.properties" key="CodeCompletionPanel.javaCompletionExcludeTable.columnModel.title0" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
129
                          </Title>
130
                          <Editor/>
131
                          <Renderer/>
132
                        </Column>
133
                      </TableColumnModel>
134
                    </Property>
135
                    <Property name="tableHeader" type="javax.swing.table.JTableHeader" editor="org.netbeans.modules.form.editors2.JTableHeaderEditor">
136
                      <TableHeader reorderingAllowed="false" resizingAllowed="true"/>
137
                    </Property>
138
                  </Properties>
139
                </Component>
140
              </SubComponents>
141
            </Container>
142
          </SubComponents>
143
        </Container>
144
        <Component class="javax.swing.JButton" name="javaCompletionExcluderAddButton">
145
          <Properties>
146
            <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
147
              <ResourceString bundle="org/netbeans/modules/java/editor/options/Bundle.properties" key="CodeCompletionPanel.javaCompletionExcluderAddButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
148
            </Property>
149
          </Properties>
150
          <Events>
151
            <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="javaCompletionExcluderAddButtonActionPerformed"/>
152
          </Events>
153
        </Component>
154
        <Component class="javax.swing.JButton" name="javaCompletionExcluderRemoveButton">
155
          <Properties>
156
            <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
157
              <ResourceString bundle="org/netbeans/modules/java/editor/options/Bundle.properties" key="CodeCompletionPanel.javaCompletionExcluderRemoveButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
158
            </Property>
159
          </Properties>
160
          <Events>
161
            <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="javaCompletionExcluderRemoveButtonActionPerformed"/>
162
          </Events>
163
        </Component>
164
        <Component class="javax.swing.JButton" name="javaCompletionExcluderCloseButton">
165
          <Properties>
166
            <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
167
              <ResourceString bundle="org/netbeans/modules/java/editor/options/Bundle.properties" key="CodeCompletionPanel.javaCompletionExcluderCloseButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
168
            </Property>
169
          </Properties>
170
          <Events>
171
            <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="javaCompletionExcluderCloseButtonActionPerformed"/>
172
          </Events>
173
        </Component>
174
      </SubComponents>
175
    </Container>
176
  </NonVisualComponents>
177
  <Properties>
5
    <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
178
    <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
6
      <Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
179
      <Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
7
        <EmptyBorder bottom="0" left="0" right="0" top="0"/>
180
        <EmptyBorder bottom="0" left="0" right="0" top="0"/>
Lines 23-59 Link Here
23
  <Layout>
196
  <Layout>
24
    <DimensionLayout dim="0">
197
    <DimensionLayout dim="0">
25
      <Group type="103" groupAlignment="0" attributes="0">
198
      <Group type="103" groupAlignment="0" attributes="0">
199
          <Component id="javaCompletionPane" alignment="0" max="32767" attributes="0"/>
200
      </Group>
201
    </DimensionLayout>
202
    <DimensionLayout dim="1">
203
      <Group type="103" groupAlignment="0" attributes="0">
204
          <Component id="javaCompletionPane" alignment="0" max="32767" attributes="0"/>
205
      </Group>
206
    </DimensionLayout>
207
  </Layout>
208
  <SubComponents>
209
    <Container class="javax.swing.JPanel" name="javaCompletionPane">
210
211
      <Layout>
212
        <DimensionLayout dim="0">
213
          <Group type="103" groupAlignment="0" attributes="0">
26
          <Group type="102" attributes="0">
214
          <Group type="102" attributes="0">
27
              <EmptySpace max="-2" attributes="0"/>
215
              <EmptySpace max="-2" attributes="0"/>
28
              <Group type="103" groupAlignment="0" attributes="0">
216
              <Group type="103" groupAlignment="0" attributes="0">
29
                  <Component id="jSeparator1" alignment="0" pref="362" max="32767" attributes="0"/>
217
                      <Component id="jSeparator1" pref="337" max="32767" attributes="0"/>
30
                  <Component id="guessMethodArguments" min="-2" max="-2" attributes="0"/>
31
                  <Group type="102" alignment="0" attributes="0">
218
                  <Group type="102" alignment="0" attributes="0">
219
                          <Component id="javadocAutoCompletionTriggersLabel" min="-2" max="-2" attributes="0"/>
220
                          <EmptySpace max="-2" attributes="0"/>
221
                          <Component id="javadocAutoCompletionTriggersField" min="-2" pref="86" max="-2" attributes="1"/>
222
                      </Group>
223
                  </Group>
224
                  <EmptySpace max="-2" attributes="0"/>
225
              </Group>
226
              <Group type="103" rootIndex="1" groupAlignment="0" attributes="0">
227
                  <Group type="102" alignment="0" attributes="0">
228
                      <EmptySpace max="-2" attributes="0"/>
229
                      <Group type="103" groupAlignment="0" attributes="0">
230
                          <Component id="guessMethodArguments" alignment="0" min="-2" max="-2" attributes="0"/>
231
                          <Group type="102" alignment="0" attributes="0">
32
                      <Component id="javaAutoCompletionTriggersLabel" min="-2" max="-2" attributes="1"/>
232
                      <Component id="javaAutoCompletionTriggersLabel" min="-2" max="-2" attributes="1"/>
33
                      <EmptySpace min="-2" pref="34" max="-2" attributes="0"/>
233
                      <EmptySpace min="-2" pref="34" max="-2" attributes="0"/>
34
                      <Component id="javaAutoCompletionTriggersField" min="-2" pref="86" max="-2" attributes="1"/>
234
                      <Component id="javaAutoCompletionTriggersField" min="-2" pref="86" max="-2" attributes="1"/>
35
                  </Group>
235
                  </Group>
36
                  <Component id="javaAutoPopupOnIdentifierPart" alignment="0" min="-2" max="-2" attributes="1"/>
236
                  <Component id="javaAutoPopupOnIdentifierPart" alignment="0" min="-2" max="-2" attributes="1"/>
37
                  <Group type="102" alignment="0" attributes="0">
237
                  <Group type="102" alignment="0" attributes="0">
38
                      <Component id="javaCompletionSelectorsLabel" min="-2" max="-2" attributes="1"/>
238
                              <Group type="103" groupAlignment="1" attributes="0">
239
                                  <Component id="javaCompletionExcluderLabel" alignment="1" min="-2" max="-2" attributes="0"/>
240
                                  <Component id="javaCompletionSelectorsLabel" alignment="1" min="-2" max="-2" attributes="1"/>
241
                              </Group>
242
                              <Group type="103" groupAlignment="0" attributes="0">
243
                                  <Group type="102" attributes="0">
39
                      <EmptySpace min="-2" pref="30" max="-2" attributes="0"/>
244
                      <EmptySpace min="-2" pref="30" max="-2" attributes="0"/>
40
                      <Component id="javaCompletionSelectorsField" min="-2" pref="86" max="-2" attributes="1"/>
245
                      <Component id="javaCompletionSelectorsField" min="-2" pref="86" max="-2" attributes="1"/>
41
                  </Group>
246
                  </Group>
42
                  <Group type="102" alignment="0" attributes="0">
247
                                  <Group type="102" alignment="1" attributes="0">
43
                      <Component id="javadocAutoCompletionTriggersLabel" min="-2" max="-2" attributes="0"/>
248
                                      <EmptySpace min="-2" pref="23" max="-2" attributes="0"/>
44
                      <EmptySpace max="-2" attributes="0"/>
249
                                      <Component id="javaCompletionExcluderButton" min="-2" pref="93" max="-2" attributes="0"/>
45
                      <Component id="javadocAutoCompletionTriggersField" min="-2" pref="86" max="-2" attributes="1"/>
46
                  </Group>
250
                  </Group>
47
              </Group>
251
              </Group>
48
              <EmptySpace max="-2" attributes="0"/>
49
          </Group>
252
          </Group>
50
      </Group>
253
      </Group>
254
                      <EmptySpace pref="25" max="32767" attributes="0"/>
255
                  </Group>
256
              </Group>
257
          </Group>
51
    </DimensionLayout>
258
    </DimensionLayout>
52
    <DimensionLayout dim="1">
259
    <DimensionLayout dim="1">
53
      <Group type="103" groupAlignment="0" attributes="0">
260
      <Group type="103" groupAlignment="0" attributes="0">
54
          <Group type="102" attributes="0">
261
              <Group type="102" alignment="0" attributes="0">
262
                  <EmptySpace min="-2" pref="171" max="-2" attributes="0"/>
263
                  <Component id="jSeparator1" min="-2" max="-2" attributes="0"/>
264
                  <EmptySpace type="separate" max="-2" attributes="0"/>
265
                  <Group type="103" groupAlignment="3" attributes="0">
266
                      <Component id="javadocAutoCompletionTriggersLabel" alignment="3" min="-2" max="-2" attributes="0"/>
267
                      <Component id="javadocAutoCompletionTriggersField" alignment="3" min="-2" max="-2" attributes="0"/>
268
                  </Group>
269
                  <EmptySpace pref="23" max="32767" attributes="0"/>
270
              </Group>
271
              <Group type="103" rootIndex="1" groupAlignment="0" attributes="0">
272
                  <Group type="102" alignment="0" attributes="0">
55
              <EmptySpace max="-2" attributes="0"/>
273
              <EmptySpace max="-2" attributes="0"/>
56
              <Component id="guessMethodArguments" min="-2" max="-2" attributes="0"/>
274
                      <Component id="guessMethodArguments" min="-2" pref="23" max="-2" attributes="0"/>
57
              <EmptySpace max="-2" attributes="0"/>
275
              <EmptySpace max="-2" attributes="0"/>
58
              <Group type="103" groupAlignment="3" attributes="0">
276
              <Group type="103" groupAlignment="3" attributes="0">
59
                  <Component id="javaAutoCompletionTriggersLabel" alignment="3" min="-2" max="-2" attributes="0"/>
277
                  <Component id="javaAutoCompletionTriggersLabel" alignment="3" min="-2" max="-2" attributes="0"/>
Lines 66-81 Link Here
66
                  <Component id="javaCompletionSelectorsLabel" alignment="3" min="-2" max="-2" attributes="0"/>
284
                  <Component id="javaCompletionSelectorsLabel" alignment="3" min="-2" max="-2" attributes="0"/>
67
                  <Component id="javaCompletionSelectorsField" alignment="3" min="-2" max="-2" attributes="0"/>
285
                  <Component id="javaCompletionSelectorsField" alignment="3" min="-2" max="-2" attributes="0"/>
68
              </Group>
286
              </Group>
69
              <EmptySpace type="separate" max="-2" attributes="0"/>
287
                      <EmptySpace max="-2" attributes="0"/>
70
              <Component id="jSeparator1" min="-2" max="-2" attributes="0"/>
71
              <EmptySpace type="separate" max="-2" attributes="0"/>
72
              <Group type="103" groupAlignment="3" attributes="0">
288
              <Group type="103" groupAlignment="3" attributes="0">
73
                  <Component id="javadocAutoCompletionTriggersLabel" alignment="3" min="-2" max="-2" attributes="0"/>
289
                          <Component id="javaCompletionExcluderButton" alignment="3" min="-2" max="-2" attributes="0"/>
74
                  <Component id="javadocAutoCompletionTriggersField" alignment="3" min="-2" max="-2" attributes="0"/>
290
                          <Component id="javaCompletionExcluderLabel" alignment="3" min="-2" max="-2" attributes="0"/>
75
              </Group>
291
              </Group>
76
              <EmptySpace pref="30" max="32767" attributes="0"/>
292
                      <EmptySpace pref="91" max="32767" attributes="0"/>
77
          </Group>
293
          </Group>
78
      </Group>
294
      </Group>
295
          </Group>
79
    </DimensionLayout>
296
    </DimensionLayout>
80
  </Layout>
297
  </Layout>
81
  <SubComponents>
298
  <SubComponents>
Lines 84-92 Link Here
84
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
301
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
85
          <ResourceString bundle="org/netbeans/modules/java/editor/options/Bundle.properties" key="LBL_GuessMethodArgs" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
302
          <ResourceString bundle="org/netbeans/modules/java/editor/options/Bundle.properties" key="LBL_GuessMethodArgs" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
86
        </Property>
303
        </Property>
87
        <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
88
          <Border info="null"/>
89
        </Property>
90
      </Properties>
304
      </Properties>
91
      <Events>
305
      <Events>
92
        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="guessMethodArgumentsActionPerformed"/>
306
        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="guessMethodArgumentsActionPerformed"/>
Lines 97-105 Link Here
97
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
311
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
98
          <ResourceString bundle="org/netbeans/modules/java/editor/options/Bundle.properties" key="LBL_AutoPopupOnIdentifierPartBox" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
312
          <ResourceString bundle="org/netbeans/modules/java/editor/options/Bundle.properties" key="LBL_AutoPopupOnIdentifierPartBox" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
99
        </Property>
313
        </Property>
100
        <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
101
          <Border info="null"/>
102
        </Property>
103
      </Properties>
314
      </Properties>
104
      <Events>
315
      <Events>
105
        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="javaAutoPopupOnIdentifierPartActionPerformed"/>
316
        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="javaAutoPopupOnIdentifierPartActionPerformed"/>
Lines 151-155 Link Here
151
    </Component>
362
    </Component>
152
    <Component class="javax.swing.JSeparator" name="jSeparator1">
363
    <Component class="javax.swing.JSeparator" name="jSeparator1">
153
    </Component>
364
    </Component>
365
        <Component class="javax.swing.JLabel" name="javaCompletionExcluderLabel">
366
          <Properties>
367
            <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
368
              <ResourceString bundle="org/netbeans/modules/java/editor/options/Bundle.properties" key="CodeCompletionPanel.javaCompletionExcluderLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
369
            </Property>
370
          </Properties>
371
        </Component>
372
        <Component class="javax.swing.JButton" name="javaCompletionExcluderButton">
373
          <Properties>
374
            <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
375
              <ResourceString bundle="org/netbeans/modules/java/editor/options/Bundle.properties" key="CodeCompletionPanel.javaCompletionExcluderButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
376
            </Property>
377
          </Properties>
378
          <Events>
379
            <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="javaCompletionExcluderButtonActionPerformed"/>
380
          </Events>
381
        </Component>
154
  </SubComponents>
382
  </SubComponents>
383
    </Container>
384
  </SubComponents>
155
</Form>
385
</Form>
(-)org/netbeans/modules/java/editor/options/CodeCompletionPanel.java (-39 / +320 lines)
Lines 38-50 Link Here
38
 * Version 2 license, then the option applies only if the new code is
38
 * Version 2 license, then the option applies only if the new code is
39
 * made subject to such option by the copyright holder.
39
 * made subject to such option by the copyright holder.
40
 */
40
 */
41
42
package org.netbeans.modules.java.editor.options;
41
package org.netbeans.modules.java.editor.options;
43
42
43
import java.awt.Component;
44
import java.util.ArrayList;
45
import java.util.Arrays;
46
import java.util.Collections;
47
import java.util.List;
48
import java.util.Vector;
44
import java.util.prefs.Preferences;
49
import java.util.prefs.Preferences;
45
import javax.swing.JComponent;
50
import javax.swing.JComponent;
51
import javax.swing.JTable;
46
import javax.swing.event.DocumentEvent;
52
import javax.swing.event.DocumentEvent;
47
import javax.swing.event.DocumentListener;
53
import javax.swing.event.DocumentListener;
54
import javax.swing.event.TableModelEvent;
55
import javax.swing.event.TableModelListener;
56
import javax.swing.table.DefaultTableModel;
48
import org.netbeans.modules.options.editor.spi.PreferencesCustomizer;
57
import org.netbeans.modules.options.editor.spi.PreferencesCustomizer;
49
import org.openide.util.HelpCtx;
58
import org.openide.util.HelpCtx;
50
59
Lines 52-76 Link Here
52
 *
61
 *
53
 * @author Dusan Balek
62
 * @author Dusan Balek
54
 */
63
 */
55
public class CodeCompletionPanel extends javax.swing.JPanel implements DocumentListener {
64
public class CodeCompletionPanel extends javax.swing.JPanel implements DocumentListener, TableModelListener {
56
65
57
    public static final String JAVA_AUTO_POPUP_ON_IDENTIFIER_PART = "javaAutoPopupOnIdentifierPart"; //NOI18N
66
    public static final String JAVA_AUTO_POPUP_ON_IDENTIFIER_PART = "javaAutoPopupOnIdentifierPart"; //NOI18N
67
    public static final boolean JAVA_AUTO_POPUP_ON_IDENTIFIER_PART_DEFAULT = false;
58
    public static final String JAVA_AUTO_COMPLETION_TRIGGERS = "javaAutoCompletionTriggers"; //NOI18N
68
    public static final String JAVA_AUTO_COMPLETION_TRIGGERS = "javaAutoCompletionTriggers"; //NOI18N
69
    public static final String JAVA_AUTO_COMPLETION_TRIGGERS_DEFAULT = "."; //NOI18N
59
    public static final String JAVA_COMPLETION_SELECTORS = "javaCompletionSelectors"; //NOI18N
70
    public static final String JAVA_COMPLETION_SELECTORS = "javaCompletionSelectors"; //NOI18N
71
    public static final String JAVA_COMPLETION_SELECTORS_DEFAULT = ".,;:([+-="; //NOI18N
60
    public static final String JAVADOC_AUTO_COMPLETION_TRIGGERS = "javadocAutoCompletionTriggers"; //NOI18N
72
    public static final String JAVADOC_AUTO_COMPLETION_TRIGGERS = "javadocAutoCompletionTriggers"; //NOI18N
73
    public static final String JAVADOC_AUTO_COMPLETION_TRIGGERS_DEFAULT = ".#@"; //NOI18N
61
    public static final String GUESS_METHOD_ARGUMENTS = "guessMethodArguments"; //NOI18N
74
    public static final String GUESS_METHOD_ARGUMENTS = "guessMethodArguments"; //NOI18N
75
    public static final boolean GUESS_METHOD_ARGUMENTS_DEFAULT = true;
76
    public static final String JAVA_COMPLETION_WHITELIST = "javaCompletionWhitelist"; //NOI18N
77
    public static final String JAVA_COMPLETION_WHITELIST_DEFAULT = ""; //NOI18N
78
    public static final String JAVA_COMPLETION_BLACKLIST = "javaCompletionBlacklist"; //NOI18N
79
    public static final String JAVA_COMPLETION_BLACKLIST_DEFAULT = ""; //NOI18N
62
80
63
    private Preferences preferences;
81
    private final Preferences preferences;
64
82
83
    private void initExcluderTable(JTable table, String pref) {
84
        String[] entries = pref.split(","); //NOI18N
85
        DefaultTableModel model = (DefaultTableModel) table.getModel();
86
        for (String entry : entries) {
87
            if (entry.length() > 0) {
88
                model.addRow(new String[]{entry});
89
            }
90
        }
91
        model.addTableModelListener(this);
92
    }
93
65
    /** Creates new form FmtTabsIndents */
94
    /** Creates new form FmtTabsIndents */
66
    public CodeCompletionPanel(Preferences p) {
95
    public CodeCompletionPanel(Preferences p) {
67
        initComponents();
96
        initComponents();
68
        preferences = p;
97
        preferences = p;
69
        guessMethodArguments.setSelected(preferences.getBoolean(GUESS_METHOD_ARGUMENTS, true));
98
        guessMethodArguments.setSelected(preferences.getBoolean(GUESS_METHOD_ARGUMENTS, GUESS_METHOD_ARGUMENTS_DEFAULT));
70
        javaAutoPopupOnIdentifierPart.setSelected(preferences.getBoolean(JAVA_AUTO_POPUP_ON_IDENTIFIER_PART, false));
99
        javaAutoPopupOnIdentifierPart.setSelected(preferences.getBoolean(JAVA_AUTO_POPUP_ON_IDENTIFIER_PART, JAVA_AUTO_POPUP_ON_IDENTIFIER_PART_DEFAULT));
71
        javaAutoCompletionTriggersField.setText(preferences.get(JAVA_AUTO_COMPLETION_TRIGGERS, ".")); //NOI18N
100
        javaAutoCompletionTriggersField.setText(preferences.get(JAVA_AUTO_COMPLETION_TRIGGERS, JAVA_AUTO_COMPLETION_TRIGGERS_DEFAULT));
72
        javaCompletionSelectorsField.setText(preferences.get(JAVA_COMPLETION_SELECTORS, ".,;:([+-=")); //NOI18N
101
        javaCompletionSelectorsField.setText(preferences.get(JAVA_COMPLETION_SELECTORS, JAVA_COMPLETION_SELECTORS_DEFAULT));
73
        javadocAutoCompletionTriggersField.setText(preferences.get(JAVADOC_AUTO_COMPLETION_TRIGGERS, ".#@")); //NOI18N
102
        javadocAutoCompletionTriggersField.setText(preferences.get(JAVADOC_AUTO_COMPLETION_TRIGGERS, JAVADOC_AUTO_COMPLETION_TRIGGERS_DEFAULT));
103
        String blacklist = preferences.get(JAVA_COMPLETION_BLACKLIST, JAVA_COMPLETION_BLACKLIST_DEFAULT);
104
        initExcluderTable(javaCompletionExcludeTable, blacklist);
105
        String whitelist = preferences.get(JAVA_COMPLETION_WHITELIST, JAVA_COMPLETION_WHITELIST);
106
        initExcluderTable(javaCompletionIncludeTable, whitelist);
74
        javaAutoCompletionTriggersField.getDocument().addDocumentListener(this);
107
        javaAutoCompletionTriggersField.getDocument().addDocumentListener(this);
75
        javaCompletionSelectorsField.getDocument().addDocumentListener(this);
108
        javaCompletionSelectorsField.getDocument().addDocumentListener(this);
76
        javadocAutoCompletionTriggersField.getDocument().addDocumentListener(this);
109
        javadocAutoCompletionTriggersField.getDocument().addDocumentListener(this);
Lines 97-102 Link Here
97
        update(e);
130
        update(e);
98
    }
131
    }
99
132
133
    // allows common excluder buttons to know which table to act on
134
    private JTable getSelectedExcluderTable() {
135
        Component selected = javaCompletionExcluderTab.getSelectedComponent();
136
        if (selected == javaCompletionExcludeScrollPane) {
137
            return javaCompletionExcludeTable;
138
        } else if (selected == javaCompletionIncludeScrollPane) {
139
            return javaCompletionIncludeTable;
140
        } else {
141
            throw new RuntimeException(selected.getName());
142
        }
143
    }
144
145
    // listen to changes in the excluder lists, and do sanity checking on input
146
    public void tableChanged(TableModelEvent e) {
147
        DefaultTableModel model = (DefaultTableModel) e.getSource();
148
        String pref;
149
        if (model == javaCompletionExcludeTable.getModel()) {
150
            pref = JAVA_COMPLETION_BLACKLIST;
151
        } else if (model == javaCompletionIncludeTable.getModel()) {
152
            pref = JAVA_COMPLETION_WHITELIST;
153
        } else {
154
            throw new RuntimeException();
155
        }
156
        @SuppressWarnings("unchecked")
157
        Vector<Vector<String>> data = model.getDataVector();
158
        List<String> entries = new ArrayList<String>();
159
        for (Vector<String> row : data) {
160
            String entry = row.elementAt(0);
161
            if (entry == null) {
162
                continue;
163
            }
164
            entry = entry.trim();
165
            if (entry.length() == 0) {
166
                continue;
167
            }
168
            // this could be checked by a custom editor
169
            if (!entry.matches("[$\\w.]*")) { //NOI18N
170
                continue;
171
            }
172
            entries.add(entry);
173
        }
174
        Collections.sort(entries);
175
        StringBuilder builder = new StringBuilder();
176
        for (String entry : entries) {
177
            if (builder.length() > 0) {
178
                builder.append(","); //NOI18N
179
            }
180
            builder.append(entry);
181
        }
182
        preferences.put(pref, builder.toString());
183
    }
184
100
    /** This method is called from within the constructor to
185
    /** This method is called from within the constructor to
101
     * initialize the form.
186
     * initialize the form.
102
     * WARNING: Do NOT modify this code. The content of this method is
187
     * WARNING: Do NOT modify this code. The content of this method is
Lines 105-110 Link Here
105
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
190
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
106
    private void initComponents() {
191
    private void initComponents() {
107
192
193
        javaCompletionExcluderFrame = new javax.swing.JFrame();
194
        javaCompletionExcluderTab = new javax.swing.JTabbedPane();
195
        javaCompletionExcludeScrollPane = new javax.swing.JScrollPane();
196
        javaCompletionExcludeTable = new javax.swing.JTable();
197
        javaCompletionIncludeScrollPane = new javax.swing.JScrollPane();
198
        javaCompletionIncludeTable = new javax.swing.JTable();
199
        javaCompletionExcluderAddButton = new javax.swing.JButton();
200
        javaCompletionExcluderRemoveButton = new javax.swing.JButton();
201
        javaCompletionExcluderCloseButton = new javax.swing.JButton();
202
        javaCompletionPane = new javax.swing.JPanel();
108
        guessMethodArguments = new javax.swing.JCheckBox();
203
        guessMethodArguments = new javax.swing.JCheckBox();
109
        javaAutoPopupOnIdentifierPart = new javax.swing.JCheckBox();
204
        javaAutoPopupOnIdentifierPart = new javax.swing.JCheckBox();
110
        javaAutoCompletionTriggersLabel = new javax.swing.JLabel();
205
        javaAutoCompletionTriggersLabel = new javax.swing.JLabel();
Lines 114-124 Link Here
114
        javadocAutoCompletionTriggersLabel = new javax.swing.JLabel();
209
        javadocAutoCompletionTriggersLabel = new javax.swing.JLabel();
115
        javadocAutoCompletionTriggersField = new javax.swing.JTextField();
210
        javadocAutoCompletionTriggersField = new javax.swing.JTextField();
116
        jSeparator1 = new javax.swing.JSeparator();
211
        jSeparator1 = new javax.swing.JSeparator();
212
        javaCompletionExcluderLabel = new javax.swing.JLabel();
213
        javaCompletionExcluderButton = new javax.swing.JButton();
117
214
215
        javaCompletionExcluderFrame.setTitle(org.openide.util.NbBundle.getMessage(CodeCompletionPanel.class, "CodeCompletionPanel.javaCompletionExcluderFrame.title")); // NOI18N
216
        javaCompletionExcluderFrame.setAlwaysOnTop(true);
217
        javaCompletionExcluderFrame.setMinimumSize(new java.awt.Dimension(409, 233));
218
        javaCompletionExcluderFrame.setUndecorated(true);
219
220
        javaCompletionExcludeTable.setModel(new javax.swing.table.DefaultTableModel(
221
            new Object [][] {
222
223
            },
224
            new String [] {
225
                "Fully Qualified Name prefix"
226
            }
227
        ) {
228
            Class[] types = new Class [] {
229
                java.lang.String.class
230
            };
231
232
            public Class getColumnClass(int columnIndex) {
233
                return types [columnIndex];
234
            }
235
        });
236
        javaCompletionExcludeTable.getTableHeader().setReorderingAllowed(false);
237
        javaCompletionExcludeScrollPane.setViewportView(javaCompletionExcludeTable);
238
        javaCompletionExcludeTable.getColumnModel().getColumn(0).setHeaderValue(org.openide.util.NbBundle.getMessage(CodeCompletionPanel.class, "CodeCompletionPanel.javaCompletionExcludeTable.columnModel.title0")); // NOI18N
239
240
        javaCompletionExcluderTab.addTab(org.openide.util.NbBundle.getMessage(CodeCompletionPanel.class, "CodeCompletionPanel.javaCompletionExcludeScrollPane.TabConstraints.tabTitle"), javaCompletionExcludeScrollPane); // NOI18N
241
242
        javaCompletionIncludeTable.setModel(new javax.swing.table.DefaultTableModel(
243
            new Object [][] {
244
245
            },
246
            new String [] {
247
                "Fully Qualified Name prefix"
248
            }
249
        ) {
250
            Class[] types = new Class [] {
251
                java.lang.String.class
252
            };
253
254
            public Class getColumnClass(int columnIndex) {
255
                return types [columnIndex];
256
            }
257
        });
258
        javaCompletionIncludeTable.getTableHeader().setReorderingAllowed(false);
259
        javaCompletionIncludeScrollPane.setViewportView(javaCompletionIncludeTable);
260
        javaCompletionIncludeTable.getColumnModel().getColumn(0).setHeaderValue(org.openide.util.NbBundle.getMessage(CodeCompletionPanel.class, "CodeCompletionPanel.javaCompletionExcludeTable.columnModel.title0")); // NOI18N
261
262
        javaCompletionExcluderTab.addTab(org.openide.util.NbBundle.getMessage(CodeCompletionPanel.class, "CodeCompletionPanel.javaCompletionIncludeScrollPane.TabConstraints.tabTitle"), javaCompletionIncludeScrollPane); // NOI18N
263
264
        org.openide.awt.Mnemonics.setLocalizedText(javaCompletionExcluderAddButton, org.openide.util.NbBundle.getMessage(CodeCompletionPanel.class, "CodeCompletionPanel.javaCompletionExcluderAddButton.text")); // NOI18N
265
        javaCompletionExcluderAddButton.addActionListener(new java.awt.event.ActionListener() {
266
            public void actionPerformed(java.awt.event.ActionEvent evt) {
267
                javaCompletionExcluderAddButtonActionPerformed(evt);
268
            }
269
        });
270
271
        org.openide.awt.Mnemonics.setLocalizedText(javaCompletionExcluderRemoveButton, org.openide.util.NbBundle.getMessage(CodeCompletionPanel.class, "CodeCompletionPanel.javaCompletionExcluderRemoveButton.text")); // NOI18N
272
        javaCompletionExcluderRemoveButton.addActionListener(new java.awt.event.ActionListener() {
273
            public void actionPerformed(java.awt.event.ActionEvent evt) {
274
                javaCompletionExcluderRemoveButtonActionPerformed(evt);
275
            }
276
        });
277
278
        org.openide.awt.Mnemonics.setLocalizedText(javaCompletionExcluderCloseButton, org.openide.util.NbBundle.getMessage(CodeCompletionPanel.class, "CodeCompletionPanel.javaCompletionExcluderCloseButton.text")); // NOI18N
279
        javaCompletionExcluderCloseButton.addActionListener(new java.awt.event.ActionListener() {
280
            public void actionPerformed(java.awt.event.ActionEvent evt) {
281
                javaCompletionExcluderCloseButtonActionPerformed(evt);
282
            }
283
        });
284
285
        org.jdesktop.layout.GroupLayout javaCompletionExcluderFrameLayout = new org.jdesktop.layout.GroupLayout(javaCompletionExcluderFrame.getContentPane());
286
        javaCompletionExcluderFrame.getContentPane().setLayout(javaCompletionExcluderFrameLayout);
287
        javaCompletionExcluderFrameLayout.setHorizontalGroup(
288
            javaCompletionExcluderFrameLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
289
            .add(org.jdesktop.layout.GroupLayout.TRAILING, javaCompletionExcluderFrameLayout.createSequentialGroup()
290
                .addContainerGap()
291
                .add(javaCompletionExcluderTab, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 298, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
292
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
293
                .add(javaCompletionExcluderFrameLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
294
                    .add(javaCompletionExcluderCloseButton, 0, 0, Short.MAX_VALUE)
295
                    .add(javaCompletionExcluderRemoveButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
296
                    .add(javaCompletionExcluderAddButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
297
                .addContainerGap(10, Short.MAX_VALUE))
298
        );
299
        javaCompletionExcluderFrameLayout.setVerticalGroup(
300
            javaCompletionExcluderFrameLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
301
            .add(javaCompletionExcluderFrameLayout.createSequentialGroup()
302
                .add(javaCompletionExcluderFrameLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
303
                    .add(javaCompletionExcluderFrameLayout.createSequentialGroup()
304
                        .addContainerGap()
305
                        .add(javaCompletionExcluderTab, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 221, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
306
                    .add(javaCompletionExcluderFrameLayout.createSequentialGroup()
307
                        .add(59, 59, 59)
308
                        .add(javaCompletionExcluderAddButton)
309
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
310
                        .add(javaCompletionExcluderRemoveButton)
311
                        .add(63, 63, 63)
312
                        .add(javaCompletionExcluderCloseButton)))
313
                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
314
        );
315
118
        setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
316
        setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
119
317
120
        org.openide.awt.Mnemonics.setLocalizedText(guessMethodArguments, org.openide.util.NbBundle.getMessage(CodeCompletionPanel.class, "LBL_GuessMethodArgs")); // NOI18N
318
        org.openide.awt.Mnemonics.setLocalizedText(guessMethodArguments, org.openide.util.NbBundle.getMessage(CodeCompletionPanel.class, "LBL_GuessMethodArgs")); // NOI18N
121
        guessMethodArguments.setBorder(null);
122
        guessMethodArguments.addActionListener(new java.awt.event.ActionListener() {
319
        guessMethodArguments.addActionListener(new java.awt.event.ActionListener() {
123
            public void actionPerformed(java.awt.event.ActionEvent evt) {
320
            public void actionPerformed(java.awt.event.ActionEvent evt) {
124
                guessMethodArgumentsActionPerformed(evt);
321
                guessMethodArgumentsActionPerformed(evt);
Lines 126-132 Link Here
126
        });
323
        });
127
324
128
        org.openide.awt.Mnemonics.setLocalizedText(javaAutoPopupOnIdentifierPart, org.openide.util.NbBundle.getMessage(CodeCompletionPanel.class, "LBL_AutoPopupOnIdentifierPartBox")); // NOI18N
325
        org.openide.awt.Mnemonics.setLocalizedText(javaAutoPopupOnIdentifierPart, org.openide.util.NbBundle.getMessage(CodeCompletionPanel.class, "LBL_AutoPopupOnIdentifierPartBox")); // NOI18N
129
        javaAutoPopupOnIdentifierPart.setBorder(null);
130
        javaAutoPopupOnIdentifierPart.addActionListener(new java.awt.event.ActionListener() {
326
        javaAutoPopupOnIdentifierPart.addActionListener(new java.awt.event.ActionListener() {
131
            public void actionPerformed(java.awt.event.ActionEvent evt) {
327
            public void actionPerformed(java.awt.event.ActionEvent evt) {
132
                javaAutoPopupOnIdentifierPartActionPerformed(evt);
328
                javaAutoPopupOnIdentifierPartActionPerformed(evt);
Lines 146-198 Link Here
146
342
147
        javadocAutoCompletionTriggersField.setText(org.openide.util.NbBundle.getMessage(CodeCompletionPanel.class, "CodeCompletionPanel.javadocAutoCompletionTriggersField.text")); // NOI18N
343
        javadocAutoCompletionTriggersField.setText(org.openide.util.NbBundle.getMessage(CodeCompletionPanel.class, "CodeCompletionPanel.javadocAutoCompletionTriggersField.text")); // NOI18N
148
344
149
        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
345
        org.openide.awt.Mnemonics.setLocalizedText(javaCompletionExcluderLabel, org.openide.util.NbBundle.getMessage(CodeCompletionPanel.class, "CodeCompletionPanel.javaCompletionExcluderLabel.text")); // NOI18N
150
        this.setLayout(layout);
346
151
        layout.setHorizontalGroup(
347
        org.openide.awt.Mnemonics.setLocalizedText(javaCompletionExcluderButton, org.openide.util.NbBundle.getMessage(CodeCompletionPanel.class, "CodeCompletionPanel.javaCompletionExcluderButton.text")); // NOI18N
152
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
348
        javaCompletionExcluderButton.addActionListener(new java.awt.event.ActionListener() {
153
            .add(layout.createSequentialGroup()
349
            public void actionPerformed(java.awt.event.ActionEvent evt) {
350
                javaCompletionExcluderButtonActionPerformed(evt);
351
            }
352
        });
353
354
        org.jdesktop.layout.GroupLayout javaCompletionPaneLayout = new org.jdesktop.layout.GroupLayout(javaCompletionPane);
355
        javaCompletionPane.setLayout(javaCompletionPaneLayout);
356
        javaCompletionPaneLayout.setHorizontalGroup(
357
            javaCompletionPaneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
358
            .add(javaCompletionPaneLayout.createSequentialGroup()
154
                .addContainerGap()
359
                .addContainerGap()
155
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
360
                .add(javaCompletionPaneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
156
                    .add(jSeparator1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 362, Short.MAX_VALUE)
361
                    .add(jSeparator1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 337, Short.MAX_VALUE)
362
                    .add(javaCompletionPaneLayout.createSequentialGroup()
363
                        .add(javadocAutoCompletionTriggersLabel)
364
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
365
                        .add(javadocAutoCompletionTriggersField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 86, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
366
                .addContainerGap())
367
            .add(javaCompletionPaneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
368
                .add(javaCompletionPaneLayout.createSequentialGroup()
369
                    .addContainerGap()
370
                    .add(javaCompletionPaneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
157
                    .add(guessMethodArguments)
371
                    .add(guessMethodArguments)
158
                    .add(layout.createSequentialGroup()
372
                        .add(javaCompletionPaneLayout.createSequentialGroup()
159
                        .add(javaAutoCompletionTriggersLabel)
373
                        .add(javaAutoCompletionTriggersLabel)
160
                        .add(34, 34, 34)
374
                        .add(34, 34, 34)
161
                        .add(javaAutoCompletionTriggersField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 86, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
375
                        .add(javaAutoCompletionTriggersField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 86, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
162
                    .add(javaAutoPopupOnIdentifierPart)
376
                    .add(javaAutoPopupOnIdentifierPart)
163
                    .add(layout.createSequentialGroup()
377
                        .add(javaCompletionPaneLayout.createSequentialGroup()
164
                        .add(javaCompletionSelectorsLabel)
378
                            .add(javaCompletionPaneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
379
                                .add(javaCompletionExcluderLabel)
380
                                .add(javaCompletionSelectorsLabel))
381
                            .add(javaCompletionPaneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
382
                                .add(javaCompletionPaneLayout.createSequentialGroup()
165
                        .add(30, 30, 30)
383
                        .add(30, 30, 30)
166
                        .add(javaCompletionSelectorsField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 86, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
384
                        .add(javaCompletionSelectorsField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 86, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
167
                    .add(layout.createSequentialGroup()
385
                                .add(org.jdesktop.layout.GroupLayout.TRAILING, javaCompletionPaneLayout.createSequentialGroup()
168
                        .add(javadocAutoCompletionTriggersLabel)
386
                                    .add(23, 23, 23)
169
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
387
                                    .add(javaCompletionExcluderButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 93, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))))
170
                        .add(javadocAutoCompletionTriggersField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 86, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
388
                    .addContainerGap(25, Short.MAX_VALUE)))
171
                .addContainerGap())
172
        );
389
        );
173
        layout.setVerticalGroup(
390
        javaCompletionPaneLayout.setVerticalGroup(
174
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
391
            javaCompletionPaneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
175
            .add(layout.createSequentialGroup()
392
            .add(javaCompletionPaneLayout.createSequentialGroup()
393
                .add(171, 171, 171)
394
                .add(jSeparator1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
395
                .add(18, 18, 18)
396
                .add(javaCompletionPaneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
397
                    .add(javadocAutoCompletionTriggersLabel)
398
                    .add(javadocAutoCompletionTriggersField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
399
                .addContainerGap(23, Short.MAX_VALUE))
400
            .add(javaCompletionPaneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
401
                .add(javaCompletionPaneLayout.createSequentialGroup()
176
                .addContainerGap()
402
                .addContainerGap()
177
                .add(guessMethodArguments)
403
                    .add(guessMethodArguments, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 23, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
178
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
404
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
179
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
405
                    .add(javaCompletionPaneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
180
                    .add(javaAutoCompletionTriggersLabel)
406
                    .add(javaAutoCompletionTriggersLabel)
181
                    .add(javaAutoCompletionTriggersField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
407
                    .add(javaAutoCompletionTriggersField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
182
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
408
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
183
                .add(javaAutoPopupOnIdentifierPart)
409
                .add(javaAutoPopupOnIdentifierPart)
184
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
410
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
185
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
411
                    .add(javaCompletionPaneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
186
                    .add(javaCompletionSelectorsLabel)
412
                    .add(javaCompletionSelectorsLabel)
187
                    .add(javaCompletionSelectorsField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
413
                    .add(javaCompletionSelectorsField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
188
                .add(18, 18, 18)
414
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
189
                .add(jSeparator1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
415
                    .add(javaCompletionPaneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
190
                .add(18, 18, 18)
416
                        .add(javaCompletionExcluderButton)
191
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
417
                        .add(javaCompletionExcluderLabel))
192
                    .add(javadocAutoCompletionTriggersLabel)
418
                    .addContainerGap(91, Short.MAX_VALUE)))
193
                    .add(javadocAutoCompletionTriggersField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
194
                .addContainerGap(30, Short.MAX_VALUE))
195
        );
419
        );
420
421
        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
422
        this.setLayout(layout);
423
        layout.setHorizontalGroup(
424
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
425
            .add(javaCompletionPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
426
        );
427
        layout.setVerticalGroup(
428
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
429
            .add(javaCompletionPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
430
        );
196
    }// </editor-fold>//GEN-END:initComponents
431
    }// </editor-fold>//GEN-END:initComponents
197
432
198
    private void javaAutoPopupOnIdentifierPartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_javaAutoPopupOnIdentifierPartActionPerformed
433
    private void javaAutoPopupOnIdentifierPartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_javaAutoPopupOnIdentifierPartActionPerformed
Lines 203-208 Link Here
203
        preferences.putBoolean(GUESS_METHOD_ARGUMENTS, guessMethodArguments.isSelected());
438
        preferences.putBoolean(GUESS_METHOD_ARGUMENTS, guessMethodArguments.isSelected());
204
}//GEN-LAST:event_guessMethodArgumentsActionPerformed
439
}//GEN-LAST:event_guessMethodArgumentsActionPerformed
205
440
441
	private void javaCompletionExcluderButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_javaCompletionExcluderButtonActionPerformed
442
        if (javaCompletionExcluderFrame.isVisible())
443
            return;
444
        javaCompletionExcluderFrame.pack();
445
        javaCompletionExcluderFrame.setLocationRelativeTo(this);
446
        javaCompletionExcluderFrame.setVisible(true);
447
}//GEN-LAST:event_javaCompletionExcluderButtonActionPerformed
448
449
	private void javaCompletionExcluderAddButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_javaCompletionExcluderAddButtonActionPerformed
450
        JTable table = getSelectedExcluderTable();
451
        DefaultTableModel model = (DefaultTableModel) table.getModel();
452
        int rows = model.getRowCount();
453
        model.setRowCount(rows + 1);
454
        table.editCellAt(rows, 0);
455
        table.requestFocus();
456
}//GEN-LAST:event_javaCompletionExcluderAddButtonActionPerformed
457
458
    private void javaCompletionExcluderRemoveButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_javaCompletionExcluderRemoveButtonActionPerformed
459
        JTable table = getSelectedExcluderTable();
460
        int[] rows = table.getSelectedRows();
461
        if (rows.length == 0)
462
            return;
463
        // remove rows in descending order: row numbers change when a row is removed
464
        Arrays.sort(rows);
465
        DefaultTableModel model = (DefaultTableModel) table.getModel();
466
        for (int row = rows.length - 1 ; row >=0 ; row--) {
467
            model.removeRow(row);
468
        }
469
}//GEN-LAST:event_javaCompletionExcluderRemoveButtonActionPerformed
470
471
    private void javaCompletionExcluderCloseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_javaCompletionExcluderCloseButtonActionPerformed
472
        javaCompletionExcluderFrame.setVisible(false);
473
    }//GEN-LAST:event_javaCompletionExcluderCloseButtonActionPerformed
474
206
    private void update(DocumentEvent e) {
475
    private void update(DocumentEvent e) {
207
        if (e.getDocument() == javaAutoCompletionTriggersField.getDocument())
476
        if (e.getDocument() == javaAutoCompletionTriggersField.getDocument())
208
            preferences.put(JAVA_AUTO_COMPLETION_TRIGGERS, javaAutoCompletionTriggersField.getText());
477
            preferences.put(JAVA_AUTO_COMPLETION_TRIGGERS, javaAutoCompletionTriggersField.getText());
Lines 218-223 Link Here
218
    private javax.swing.JTextField javaAutoCompletionTriggersField;
487
    private javax.swing.JTextField javaAutoCompletionTriggersField;
219
    private javax.swing.JLabel javaAutoCompletionTriggersLabel;
488
    private javax.swing.JLabel javaAutoCompletionTriggersLabel;
220
    private javax.swing.JCheckBox javaAutoPopupOnIdentifierPart;
489
    private javax.swing.JCheckBox javaAutoPopupOnIdentifierPart;
490
    private javax.swing.JScrollPane javaCompletionExcludeScrollPane;
491
    private javax.swing.JTable javaCompletionExcludeTable;
492
    private javax.swing.JButton javaCompletionExcluderAddButton;
493
    private javax.swing.JButton javaCompletionExcluderButton;
494
    private javax.swing.JButton javaCompletionExcluderCloseButton;
495
    private javax.swing.JFrame javaCompletionExcluderFrame;
496
    private javax.swing.JLabel javaCompletionExcluderLabel;
497
    private javax.swing.JButton javaCompletionExcluderRemoveButton;
498
    private javax.swing.JTabbedPane javaCompletionExcluderTab;
499
    private javax.swing.JScrollPane javaCompletionIncludeScrollPane;
500
    private javax.swing.JTable javaCompletionIncludeTable;
501
    private javax.swing.JPanel javaCompletionPane;
221
    private javax.swing.JTextField javaCompletionSelectorsField;
502
    private javax.swing.JTextField javaCompletionSelectorsField;
222
    private javax.swing.JLabel javaCompletionSelectorsLabel;
503
    private javax.swing.JLabel javaCompletionSelectorsLabel;
223
    private javax.swing.JTextField javadocAutoCompletionTriggersField;
504
    private javax.swing.JTextField javadocAutoCompletionTriggersField;
Lines 226-232 Link Here
226
    
507
    
227
    private static class CodeCompletionPreferencesCusromizer implements PreferencesCustomizer {
508
    private static class CodeCompletionPreferencesCusromizer implements PreferencesCustomizer {
228
509
229
        private Preferences preferences;
510
        private final Preferences preferences;
230
511
231
        private CodeCompletionPreferencesCusromizer(Preferences p) {
512
        private CodeCompletionPreferencesCusromizer(Preferences p) {
232
            preferences = p;
513
            preferences = p;

Return to bug 125060