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.isEmpty()) {
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.isEmpty()) {
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/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 / +318 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.Arrays;
45
import java.util.Collection;
46
import java.util.TreeSet;
47
import java.util.Vector;
44
import java.util.prefs.Preferences;
48
import java.util.prefs.Preferences;
45
import javax.swing.JComponent;
49
import javax.swing.JComponent;
50
import javax.swing.JTable;
46
import javax.swing.event.DocumentEvent;
51
import javax.swing.event.DocumentEvent;
47
import javax.swing.event.DocumentListener;
52
import javax.swing.event.DocumentListener;
53
import javax.swing.event.TableModelEvent;
54
import javax.swing.event.TableModelListener;
55
import javax.swing.table.DefaultTableModel;
48
import org.netbeans.modules.options.editor.spi.PreferencesCustomizer;
56
import org.netbeans.modules.options.editor.spi.PreferencesCustomizer;
49
import org.openide.util.HelpCtx;
57
import org.openide.util.HelpCtx;
50
58
Lines 52-76 Link Here
52
 *
60
 *
53
 * @author Dusan Balek
61
 * @author Dusan Balek
54
 */
62
 */
55
public class CodeCompletionPanel extends javax.swing.JPanel implements DocumentListener {
63
public class CodeCompletionPanel extends javax.swing.JPanel implements DocumentListener, TableModelListener {
56
64
57
    public static final String JAVA_AUTO_POPUP_ON_IDENTIFIER_PART = "javaAutoPopupOnIdentifierPart"; //NOI18N
65
    public static final String JAVA_AUTO_POPUP_ON_IDENTIFIER_PART = "javaAutoPopupOnIdentifierPart"; //NOI18N
66
    public static final boolean JAVA_AUTO_POPUP_ON_IDENTIFIER_PART_DEFAULT = false;
58
    public static final String JAVA_AUTO_COMPLETION_TRIGGERS = "javaAutoCompletionTriggers"; //NOI18N
67
    public static final String JAVA_AUTO_COMPLETION_TRIGGERS = "javaAutoCompletionTriggers"; //NOI18N
68
    public static final String JAVA_AUTO_COMPLETION_TRIGGERS_DEFAULT = "."; //NOI18N
59
    public static final String JAVA_COMPLETION_SELECTORS = "javaCompletionSelectors"; //NOI18N
69
    public static final String JAVA_COMPLETION_SELECTORS = "javaCompletionSelectors"; //NOI18N
70
    public static final String JAVA_COMPLETION_SELECTORS_DEFAULT = ".,;:([+-="; //NOI18N
60
    public static final String JAVADOC_AUTO_COMPLETION_TRIGGERS = "javadocAutoCompletionTriggers"; //NOI18N
71
    public static final String JAVADOC_AUTO_COMPLETION_TRIGGERS = "javadocAutoCompletionTriggers"; //NOI18N
72
    public static final String JAVADOC_AUTO_COMPLETION_TRIGGERS_DEFAULT = ".#@"; //NOI18N
61
    public static final String GUESS_METHOD_ARGUMENTS = "guessMethodArguments"; //NOI18N
73
    public static final String GUESS_METHOD_ARGUMENTS = "guessMethodArguments"; //NOI18N
74
    public static final boolean GUESS_METHOD_ARGUMENTS_DEFAULT = true;
75
    public static final String JAVA_COMPLETION_WHITELIST = "javaCompletionWhitelist"; //NOI18N
76
    public static final String JAVA_COMPLETION_WHITELIST_DEFAULT = ""; //NOI18N
77
    public static final String JAVA_COMPLETION_BLACKLIST = "javaCompletionBlacklist"; //NOI18N
78
    public static final String JAVA_COMPLETION_BLACKLIST_DEFAULT = ""; //NOI18N
62
79
63
    private Preferences preferences;
80
    private final Preferences preferences;
64
81
82
    private void initExcluderTable(JTable table, String pref) {
83
        String[] entries = pref.split(","); //NOI18N
84
        DefaultTableModel model = (DefaultTableModel) table.getModel();
85
        for (String entry : entries) {
86
            if (entry.length() > 0) {
87
                model.addRow(new String[]{entry});
88
            }
89
        }
90
        model.addTableModelListener(this);
91
    }
92
65
    /** Creates new form FmtTabsIndents */
93
    /** Creates new form FmtTabsIndents */
66
    public CodeCompletionPanel(Preferences p) {
94
    public CodeCompletionPanel(Preferences p) {
67
        initComponents();
95
        initComponents();
68
        preferences = p;
96
        preferences = p;
69
        guessMethodArguments.setSelected(preferences.getBoolean(GUESS_METHOD_ARGUMENTS, true));
97
        guessMethodArguments.setSelected(preferences.getBoolean(GUESS_METHOD_ARGUMENTS, GUESS_METHOD_ARGUMENTS_DEFAULT));
70
        javaAutoPopupOnIdentifierPart.setSelected(preferences.getBoolean(JAVA_AUTO_POPUP_ON_IDENTIFIER_PART, false));
98
        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
99
        javaAutoCompletionTriggersField.setText(preferences.get(JAVA_AUTO_COMPLETION_TRIGGERS, JAVA_AUTO_COMPLETION_TRIGGERS_DEFAULT));
72
        javaCompletionSelectorsField.setText(preferences.get(JAVA_COMPLETION_SELECTORS, ".,;:([+-=")); //NOI18N
100
        javaCompletionSelectorsField.setText(preferences.get(JAVA_COMPLETION_SELECTORS, JAVA_COMPLETION_SELECTORS_DEFAULT));
73
        javadocAutoCompletionTriggersField.setText(preferences.get(JAVADOC_AUTO_COMPLETION_TRIGGERS, ".#@")); //NOI18N
101
        javadocAutoCompletionTriggersField.setText(preferences.get(JAVADOC_AUTO_COMPLETION_TRIGGERS, JAVADOC_AUTO_COMPLETION_TRIGGERS_DEFAULT));
102
        String blacklist = preferences.get(JAVA_COMPLETION_BLACKLIST, JAVA_COMPLETION_BLACKLIST_DEFAULT);
103
        initExcluderTable(javaCompletionExcludeTable, blacklist);
104
        String whitelist = preferences.get(JAVA_COMPLETION_WHITELIST, JAVA_COMPLETION_WHITELIST);
105
        initExcluderTable(javaCompletionIncludeTable, whitelist);
74
        javaAutoCompletionTriggersField.getDocument().addDocumentListener(this);
106
        javaAutoCompletionTriggersField.getDocument().addDocumentListener(this);
75
        javaCompletionSelectorsField.getDocument().addDocumentListener(this);
107
        javaCompletionSelectorsField.getDocument().addDocumentListener(this);
76
        javadocAutoCompletionTriggersField.getDocument().addDocumentListener(this);
108
        javadocAutoCompletionTriggersField.getDocument().addDocumentListener(this);
Lines 97-102 Link Here
97
        update(e);
129
        update(e);
98
    }
130
    }
99
131
132
    // allows common excluder buttons to know which table to act on
133
    private JTable getSelectedExcluderTable() {
134
        Component selected = javaCompletionExcluderTab.getSelectedComponent();
135
        if (selected == javaCompletionExcludeScrollPane) {
136
            return javaCompletionExcludeTable;
137
        } else if (selected == javaCompletionIncludeScrollPane) {
138
            return javaCompletionIncludeTable;
139
        } else {
140
            throw new RuntimeException(selected.getName());
141
        }
142
    }
143
144
    // listen to changes in the excluder lists, and do sanity checking on input
145
    public void tableChanged(TableModelEvent e) {
146
        DefaultTableModel model = (DefaultTableModel) e.getSource();
147
        String pref;
148
        if (model == javaCompletionExcludeTable.getModel()) {
149
            pref = JAVA_COMPLETION_BLACKLIST;
150
        } else if (model == javaCompletionIncludeTable.getModel()) {
151
            pref = JAVA_COMPLETION_WHITELIST;
152
        } else {
153
            throw new RuntimeException();
154
        }
155
        @SuppressWarnings("unchecked")
156
        Vector<Vector<String>> data = model.getDataVector();
157
        Collection<String> entries = new TreeSet<String>();
158
        for (Vector<String> row : data) {
159
            String entry = row.elementAt(0);
160
            if (entry == null) {
161
                continue;
162
            }
163
            entry = entry.trim();
164
            if (entry.length() == 0) {
165
                continue;
166
            }
167
            // this could be checked by a custom editor
168
            if (!entry.matches("[$\\w.]*")) { //NOI18N
169
                continue;
170
            }
171
            entries.add(entry);
172
        }
173
        StringBuilder builder = new StringBuilder();
174
        for (String entry : entries) {
175
            if (builder.length() > 0) {
176
                builder.append(","); //NOI18N
177
            }
178
            builder.append(entry);
179
        }
180
        preferences.put(pref, builder.toString());
181
    }
182
100
    /** This method is called from within the constructor to
183
    /** This method is called from within the constructor to
101
     * initialize the form.
184
     * initialize the form.
102
     * WARNING: Do NOT modify this code. The content of this method is
185
     * 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
188
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
106
    private void initComponents() {
189
    private void initComponents() {
107
190
191
        javaCompletionExcluderFrame = new javax.swing.JFrame();
192
        javaCompletionExcluderTab = new javax.swing.JTabbedPane();
193
        javaCompletionExcludeScrollPane = new javax.swing.JScrollPane();
194
        javaCompletionExcludeTable = new javax.swing.JTable();
195
        javaCompletionIncludeScrollPane = new javax.swing.JScrollPane();
196
        javaCompletionIncludeTable = new javax.swing.JTable();
197
        javaCompletionExcluderAddButton = new javax.swing.JButton();
198
        javaCompletionExcluderRemoveButton = new javax.swing.JButton();
199
        javaCompletionExcluderCloseButton = new javax.swing.JButton();
200
        javaCompletionPane = new javax.swing.JPanel();
108
        guessMethodArguments = new javax.swing.JCheckBox();
201
        guessMethodArguments = new javax.swing.JCheckBox();
109
        javaAutoPopupOnIdentifierPart = new javax.swing.JCheckBox();
202
        javaAutoPopupOnIdentifierPart = new javax.swing.JCheckBox();
110
        javaAutoCompletionTriggersLabel = new javax.swing.JLabel();
203
        javaAutoCompletionTriggersLabel = new javax.swing.JLabel();
Lines 114-124 Link Here
114
        javadocAutoCompletionTriggersLabel = new javax.swing.JLabel();
207
        javadocAutoCompletionTriggersLabel = new javax.swing.JLabel();
115
        javadocAutoCompletionTriggersField = new javax.swing.JTextField();
208
        javadocAutoCompletionTriggersField = new javax.swing.JTextField();
116
        jSeparator1 = new javax.swing.JSeparator();
209
        jSeparator1 = new javax.swing.JSeparator();
210
        javaCompletionExcluderLabel = new javax.swing.JLabel();
211
        javaCompletionExcluderButton = new javax.swing.JButton();
117
212
213
        javaCompletionExcluderFrame.setTitle(org.openide.util.NbBundle.getMessage(CodeCompletionPanel.class, "CodeCompletionPanel.javaCompletionExcluderFrame.title")); // NOI18N
214
        javaCompletionExcluderFrame.setAlwaysOnTop(true);
215
        javaCompletionExcluderFrame.setMinimumSize(new java.awt.Dimension(409, 233));
216
        javaCompletionExcluderFrame.setUndecorated(true);
217
218
        javaCompletionExcludeTable.setModel(new javax.swing.table.DefaultTableModel(
219
            new Object [][] {
220
221
            },
222
            new String [] {
223
                "Fully Qualified Name prefix"
224
            }
225
        ) {
226
            Class[] types = new Class [] {
227
                java.lang.String.class
228
            };
229
230
            public Class getColumnClass(int columnIndex) {
231
                return types [columnIndex];
232
            }
233
        });
234
        javaCompletionExcludeTable.getTableHeader().setReorderingAllowed(false);
235
        javaCompletionExcludeScrollPane.setViewportView(javaCompletionExcludeTable);
236
        javaCompletionExcludeTable.getColumnModel().getColumn(0).setHeaderValue(org.openide.util.NbBundle.getMessage(CodeCompletionPanel.class, "CodeCompletionPanel.javaCompletionExcludeTable.columnModel.title0")); // NOI18N
237
238
        javaCompletionExcluderTab.addTab(org.openide.util.NbBundle.getMessage(CodeCompletionPanel.class, "CodeCompletionPanel.javaCompletionExcludeScrollPane.TabConstraints.tabTitle"), javaCompletionExcludeScrollPane); // NOI18N
239
240
        javaCompletionIncludeTable.setModel(new javax.swing.table.DefaultTableModel(
241
            new Object [][] {
242
243
            },
244
            new String [] {
245
                "Fully Qualified Name prefix"
246
            }
247
        ) {
248
            Class[] types = new Class [] {
249
                java.lang.String.class
250
            };
251
252
            public Class getColumnClass(int columnIndex) {
253
                return types [columnIndex];
254
            }
255
        });
256
        javaCompletionIncludeTable.getTableHeader().setReorderingAllowed(false);
257
        javaCompletionIncludeScrollPane.setViewportView(javaCompletionIncludeTable);
258
        javaCompletionIncludeTable.getColumnModel().getColumn(0).setHeaderValue(org.openide.util.NbBundle.getMessage(CodeCompletionPanel.class, "CodeCompletionPanel.javaCompletionExcludeTable.columnModel.title0")); // NOI18N
259
260
        javaCompletionExcluderTab.addTab(org.openide.util.NbBundle.getMessage(CodeCompletionPanel.class, "CodeCompletionPanel.javaCompletionIncludeScrollPane.TabConstraints.tabTitle"), javaCompletionIncludeScrollPane); // NOI18N
261
262
        org.openide.awt.Mnemonics.setLocalizedText(javaCompletionExcluderAddButton, org.openide.util.NbBundle.getMessage(CodeCompletionPanel.class, "CodeCompletionPanel.javaCompletionExcluderAddButton.text")); // NOI18N
263
        javaCompletionExcluderAddButton.addActionListener(new java.awt.event.ActionListener() {
264
            public void actionPerformed(java.awt.event.ActionEvent evt) {
265
                javaCompletionExcluderAddButtonActionPerformed(evt);
266
            }
267
        });
268
269
        org.openide.awt.Mnemonics.setLocalizedText(javaCompletionExcluderRemoveButton, org.openide.util.NbBundle.getMessage(CodeCompletionPanel.class, "CodeCompletionPanel.javaCompletionExcluderRemoveButton.text")); // NOI18N
270
        javaCompletionExcluderRemoveButton.addActionListener(new java.awt.event.ActionListener() {
271
            public void actionPerformed(java.awt.event.ActionEvent evt) {
272
                javaCompletionExcluderRemoveButtonActionPerformed(evt);
273
            }
274
        });
275
276
        org.openide.awt.Mnemonics.setLocalizedText(javaCompletionExcluderCloseButton, org.openide.util.NbBundle.getMessage(CodeCompletionPanel.class, "CodeCompletionPanel.javaCompletionExcluderCloseButton.text")); // NOI18N
277
        javaCompletionExcluderCloseButton.addActionListener(new java.awt.event.ActionListener() {
278
            public void actionPerformed(java.awt.event.ActionEvent evt) {
279
                javaCompletionExcluderCloseButtonActionPerformed(evt);
280
            }
281
        });
282
283
        org.jdesktop.layout.GroupLayout javaCompletionExcluderFrameLayout = new org.jdesktop.layout.GroupLayout(javaCompletionExcluderFrame.getContentPane());
284
        javaCompletionExcluderFrame.getContentPane().setLayout(javaCompletionExcluderFrameLayout);
285
        javaCompletionExcluderFrameLayout.setHorizontalGroup(
286
            javaCompletionExcluderFrameLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
287
            .add(org.jdesktop.layout.GroupLayout.TRAILING, javaCompletionExcluderFrameLayout.createSequentialGroup()
288
                .addContainerGap()
289
                .add(javaCompletionExcluderTab, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 298, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
290
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
291
                .add(javaCompletionExcluderFrameLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
292
                    .add(javaCompletionExcluderCloseButton, 0, 0, Short.MAX_VALUE)
293
                    .add(javaCompletionExcluderRemoveButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
294
                    .add(javaCompletionExcluderAddButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
295
                .addContainerGap(10, Short.MAX_VALUE))
296
        );
297
        javaCompletionExcluderFrameLayout.setVerticalGroup(
298
            javaCompletionExcluderFrameLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
299
            .add(javaCompletionExcluderFrameLayout.createSequentialGroup()
300
                .add(javaCompletionExcluderFrameLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
301
                    .add(javaCompletionExcluderFrameLayout.createSequentialGroup()
302
                        .addContainerGap()
303
                        .add(javaCompletionExcluderTab, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 221, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
304
                    .add(javaCompletionExcluderFrameLayout.createSequentialGroup()
305
                        .add(59, 59, 59)
306
                        .add(javaCompletionExcluderAddButton)
307
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
308
                        .add(javaCompletionExcluderRemoveButton)
309
                        .add(63, 63, 63)
310
                        .add(javaCompletionExcluderCloseButton)))
311
                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
312
        );
313
118
        setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
314
        setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
119
315
120
        org.openide.awt.Mnemonics.setLocalizedText(guessMethodArguments, org.openide.util.NbBundle.getMessage(CodeCompletionPanel.class, "LBL_GuessMethodArgs")); // NOI18N
316
        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() {
317
        guessMethodArguments.addActionListener(new java.awt.event.ActionListener() {
123
            public void actionPerformed(java.awt.event.ActionEvent evt) {
318
            public void actionPerformed(java.awt.event.ActionEvent evt) {
124
                guessMethodArgumentsActionPerformed(evt);
319
                guessMethodArgumentsActionPerformed(evt);
Lines 126-132 Link Here
126
        });
321
        });
127
322
128
        org.openide.awt.Mnemonics.setLocalizedText(javaAutoPopupOnIdentifierPart, org.openide.util.NbBundle.getMessage(CodeCompletionPanel.class, "LBL_AutoPopupOnIdentifierPartBox")); // NOI18N
323
        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() {
324
        javaAutoPopupOnIdentifierPart.addActionListener(new java.awt.event.ActionListener() {
131
            public void actionPerformed(java.awt.event.ActionEvent evt) {
325
            public void actionPerformed(java.awt.event.ActionEvent evt) {
132
                javaAutoPopupOnIdentifierPartActionPerformed(evt);
326
                javaAutoPopupOnIdentifierPartActionPerformed(evt);
Lines 146-198 Link Here
146
340
147
        javadocAutoCompletionTriggersField.setText(org.openide.util.NbBundle.getMessage(CodeCompletionPanel.class, "CodeCompletionPanel.javadocAutoCompletionTriggersField.text")); // NOI18N
341
        javadocAutoCompletionTriggersField.setText(org.openide.util.NbBundle.getMessage(CodeCompletionPanel.class, "CodeCompletionPanel.javadocAutoCompletionTriggersField.text")); // NOI18N
148
342
149
        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
343
        org.openide.awt.Mnemonics.setLocalizedText(javaCompletionExcluderLabel, org.openide.util.NbBundle.getMessage(CodeCompletionPanel.class, "CodeCompletionPanel.javaCompletionExcluderLabel.text")); // NOI18N
150
        this.setLayout(layout);
344
151
        layout.setHorizontalGroup(
345
        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)
346
        javaCompletionExcluderButton.addActionListener(new java.awt.event.ActionListener() {
153
            .add(layout.createSequentialGroup()
347
            public void actionPerformed(java.awt.event.ActionEvent evt) {
348
                javaCompletionExcluderButtonActionPerformed(evt);
349
            }
350
        });
351
352
        org.jdesktop.layout.GroupLayout javaCompletionPaneLayout = new org.jdesktop.layout.GroupLayout(javaCompletionPane);
353
        javaCompletionPane.setLayout(javaCompletionPaneLayout);
354
        javaCompletionPaneLayout.setHorizontalGroup(
355
            javaCompletionPaneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
356
            .add(javaCompletionPaneLayout.createSequentialGroup()
154
                .addContainerGap()
357
                .addContainerGap()
155
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
358
                .add(javaCompletionPaneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
156
                    .add(jSeparator1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 362, Short.MAX_VALUE)
359
                    .add(jSeparator1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 337, Short.MAX_VALUE)
360
                    .add(javaCompletionPaneLayout.createSequentialGroup()
361
                        .add(javadocAutoCompletionTriggersLabel)
362
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
363
                        .add(javadocAutoCompletionTriggersField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 86, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
364
                .addContainerGap())
365
            .add(javaCompletionPaneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
366
                .add(javaCompletionPaneLayout.createSequentialGroup()
367
                    .addContainerGap()
368
                    .add(javaCompletionPaneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
157
                    .add(guessMethodArguments)
369
                    .add(guessMethodArguments)
158
                    .add(layout.createSequentialGroup()
370
                        .add(javaCompletionPaneLayout.createSequentialGroup()
159
                        .add(javaAutoCompletionTriggersLabel)
371
                        .add(javaAutoCompletionTriggersLabel)
160
                        .add(34, 34, 34)
372
                        .add(34, 34, 34)
161
                        .add(javaAutoCompletionTriggersField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 86, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
373
                        .add(javaAutoCompletionTriggersField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 86, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
162
                    .add(javaAutoPopupOnIdentifierPart)
374
                    .add(javaAutoPopupOnIdentifierPart)
163
                    .add(layout.createSequentialGroup()
375
                        .add(javaCompletionPaneLayout.createSequentialGroup()
164
                        .add(javaCompletionSelectorsLabel)
376
                            .add(javaCompletionPaneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
377
                                .add(javaCompletionExcluderLabel)
378
                                .add(javaCompletionSelectorsLabel))
379
                            .add(javaCompletionPaneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
380
                                .add(javaCompletionPaneLayout.createSequentialGroup()
165
                        .add(30, 30, 30)
381
                        .add(30, 30, 30)
166
                        .add(javaCompletionSelectorsField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 86, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
382
                        .add(javaCompletionSelectorsField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 86, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
167
                    .add(layout.createSequentialGroup()
383
                                .add(org.jdesktop.layout.GroupLayout.TRAILING, javaCompletionPaneLayout.createSequentialGroup()
168
                        .add(javadocAutoCompletionTriggersLabel)
384
                                    .add(23, 23, 23)
169
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
385
                                    .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)))
386
                    .addContainerGap(25, Short.MAX_VALUE)))
171
                .addContainerGap())
172
        );
387
        );
173
        layout.setVerticalGroup(
388
        javaCompletionPaneLayout.setVerticalGroup(
174
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
389
            javaCompletionPaneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
175
            .add(layout.createSequentialGroup()
390
            .add(javaCompletionPaneLayout.createSequentialGroup()
391
                .add(171, 171, 171)
392
                .add(jSeparator1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
393
                .add(18, 18, 18)
394
                .add(javaCompletionPaneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
395
                    .add(javadocAutoCompletionTriggersLabel)
396
                    .add(javadocAutoCompletionTriggersField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
397
                .addContainerGap(23, Short.MAX_VALUE))
398
            .add(javaCompletionPaneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
399
                .add(javaCompletionPaneLayout.createSequentialGroup()
176
                .addContainerGap()
400
                .addContainerGap()
177
                .add(guessMethodArguments)
401
                    .add(guessMethodArguments, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 23, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
178
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
402
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
179
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
403
                    .add(javaCompletionPaneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
180
                    .add(javaAutoCompletionTriggersLabel)
404
                    .add(javaAutoCompletionTriggersLabel)
181
                    .add(javaAutoCompletionTriggersField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
405
                    .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)
406
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
183
                .add(javaAutoPopupOnIdentifierPart)
407
                .add(javaAutoPopupOnIdentifierPart)
184
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
408
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
185
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
409
                    .add(javaCompletionPaneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
186
                    .add(javaCompletionSelectorsLabel)
410
                    .add(javaCompletionSelectorsLabel)
187
                    .add(javaCompletionSelectorsField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
411
                    .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)
412
                    .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)
413
                    .add(javaCompletionPaneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
190
                .add(18, 18, 18)
414
                        .add(javaCompletionExcluderButton)
191
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
415
                        .add(javaCompletionExcluderLabel))
192
                    .add(javadocAutoCompletionTriggersLabel)
416
                    .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
        );
417
        );
418
419
        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
420
        this.setLayout(layout);
421
        layout.setHorizontalGroup(
422
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
423
            .add(javaCompletionPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
424
        );
425
        layout.setVerticalGroup(
426
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
427
            .add(javaCompletionPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
428
        );
196
    }// </editor-fold>//GEN-END:initComponents
429
    }// </editor-fold>//GEN-END:initComponents
197
430
198
    private void javaAutoPopupOnIdentifierPartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_javaAutoPopupOnIdentifierPartActionPerformed
431
    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());
436
        preferences.putBoolean(GUESS_METHOD_ARGUMENTS, guessMethodArguments.isSelected());
204
}//GEN-LAST:event_guessMethodArgumentsActionPerformed
437
}//GEN-LAST:event_guessMethodArgumentsActionPerformed
205
438
439
	private void javaCompletionExcluderButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_javaCompletionExcluderButtonActionPerformed
440
        if (javaCompletionExcluderFrame.isVisible())
441
            return;
442
        javaCompletionExcluderFrame.pack();
443
        javaCompletionExcluderFrame.setLocationRelativeTo(this);
444
        javaCompletionExcluderFrame.setVisible(true);
445
}//GEN-LAST:event_javaCompletionExcluderButtonActionPerformed
446
447
	private void javaCompletionExcluderAddButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_javaCompletionExcluderAddButtonActionPerformed
448
        JTable table = getSelectedExcluderTable();
449
        DefaultTableModel model = (DefaultTableModel) table.getModel();
450
        int rows = model.getRowCount();
451
        model.setRowCount(rows + 1);
452
        table.editCellAt(rows, 0);
453
        table.requestFocus();
454
}//GEN-LAST:event_javaCompletionExcluderAddButtonActionPerformed
455
456
    private void javaCompletionExcluderRemoveButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_javaCompletionExcluderRemoveButtonActionPerformed
457
        JTable table = getSelectedExcluderTable();
458
        int[] rows = table.getSelectedRows();
459
        if (rows.length == 0)
460
            return;
461
        // remove rows in descending order: row numbers change when a row is removed
462
        Arrays.sort(rows);
463
        DefaultTableModel model = (DefaultTableModel) table.getModel();
464
        for (int row = rows.length - 1 ; row >=0 ; row--) {
465
            model.removeRow(row);
466
        }
467
}//GEN-LAST:event_javaCompletionExcluderRemoveButtonActionPerformed
468
469
    private void javaCompletionExcluderCloseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_javaCompletionExcluderCloseButtonActionPerformed
470
        javaCompletionExcluderFrame.setVisible(false);
471
    }//GEN-LAST:event_javaCompletionExcluderCloseButtonActionPerformed
472
206
    private void update(DocumentEvent e) {
473
    private void update(DocumentEvent e) {
207
        if (e.getDocument() == javaAutoCompletionTriggersField.getDocument())
474
        if (e.getDocument() == javaAutoCompletionTriggersField.getDocument())
208
            preferences.put(JAVA_AUTO_COMPLETION_TRIGGERS, javaAutoCompletionTriggersField.getText());
475
            preferences.put(JAVA_AUTO_COMPLETION_TRIGGERS, javaAutoCompletionTriggersField.getText());
Lines 218-223 Link Here
218
    private javax.swing.JTextField javaAutoCompletionTriggersField;
485
    private javax.swing.JTextField javaAutoCompletionTriggersField;
219
    private javax.swing.JLabel javaAutoCompletionTriggersLabel;
486
    private javax.swing.JLabel javaAutoCompletionTriggersLabel;
220
    private javax.swing.JCheckBox javaAutoPopupOnIdentifierPart;
487
    private javax.swing.JCheckBox javaAutoPopupOnIdentifierPart;
488
    private javax.swing.JScrollPane javaCompletionExcludeScrollPane;
489
    private javax.swing.JTable javaCompletionExcludeTable;
490
    private javax.swing.JButton javaCompletionExcluderAddButton;
491
    private javax.swing.JButton javaCompletionExcluderButton;
492
    private javax.swing.JButton javaCompletionExcluderCloseButton;
493
    private javax.swing.JFrame javaCompletionExcluderFrame;
494
    private javax.swing.JLabel javaCompletionExcluderLabel;
495
    private javax.swing.JButton javaCompletionExcluderRemoveButton;
496
    private javax.swing.JTabbedPane javaCompletionExcluderTab;
497
    private javax.swing.JScrollPane javaCompletionIncludeScrollPane;
498
    private javax.swing.JTable javaCompletionIncludeTable;
499
    private javax.swing.JPanel javaCompletionPane;
221
    private javax.swing.JTextField javaCompletionSelectorsField;
500
    private javax.swing.JTextField javaCompletionSelectorsField;
222
    private javax.swing.JLabel javaCompletionSelectorsLabel;
501
    private javax.swing.JLabel javaCompletionSelectorsLabel;
223
    private javax.swing.JTextField javadocAutoCompletionTriggersField;
502
    private javax.swing.JTextField javadocAutoCompletionTriggersField;
Lines 226-232 Link Here
226
    
505
    
227
    private static class CodeCompletionPreferencesCusromizer implements PreferencesCustomizer {
506
    private static class CodeCompletionPreferencesCusromizer implements PreferencesCustomizer {
228
507
229
        private Preferences preferences;
508
        private final Preferences preferences;
230
509
231
        private CodeCompletionPreferencesCusromizer(Preferences p) {
510
        private CodeCompletionPreferencesCusromizer(Preferences p) {
232
            preferences = p;
511
            preferences = p;

Return to bug 125060