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

(-)src/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.prefs.PreferenceChangeEvent;
46
import java.util.prefs.PreferenceChangeListener;
47
import java.util.prefs.Preferences;
48
import org.netbeans.api.editor.mimelookup.MimeLookup;
49
import org.netbeans.modules.java.editor.options.CodeCompletionPanel;
50
51
/**
52
 * A whitelist/blacklist of excluded classes and packages for the Java completer.
53
 * Requested in RFE #125060.
54
 *
55
 * @author Samuel Halliday
56
 */
57
public final class ExcludeCompletion implements PreferenceChangeListener {
58
59
	private final Collection<String> exclude = new ArrayList<String>();
60
	private final Collection<String> include = new ArrayList<String>();
61
	private static volatile ExcludeCompletion singleton = null;
62
63
	/**
64
	 * Cheap operation to return the instance
65
	 *
66
	 * @return
67
	 */
68
	public static ExcludeCompletion getInstance() {
69
		// lazy check without lock
70
		if (singleton == null)
71
			synchronized (ExcludeCompletion.class) {
72
				if (singleton == null) {
73
					Preferences preferences =
74
							MimeLookup.getLookup(JavaKit.JAVA_MIME_TYPE).lookup(Preferences.class);
75
					singleton = new ExcludeCompletion(preferences);
76
					preferences.addPreferenceChangeListener(singleton);
77
				}
78
			}
79
		assert singleton != null;
80
		return singleton;
81
	}
82
83
	private ExcludeCompletion(Preferences preferences) {
84
		String blacklist = preferences.get(CodeCompletionPanel.JAVA_COMPLETION_BLACKLIST, null);
85
		String whitelist = preferences.get(CodeCompletionPanel.JAVA_COMPLETION_WHITELIST, null);
86
		update(exclude, blacklist);
87
		update(include, whitelist);
88
	}
89
90
	/**
91
	 * @param fqn Fully Qualified Name
92
	 * @return
93
	 */
94
	public boolean isExcluded(final String fqn) {
95
		//#122334: do not propose imports from the default package
96
		if (fqn == null || fqn.length() == 0)
97
			return true;
98
99
		if (include.size() > 0)
100
			for (String entry : include) {
101
				if (entry.length() > fqn.length()) {
102
					if (entry.startsWith(fqn))
103
						return false;
104
				} else if (fqn.startsWith(entry))
105
					return false;
106
			}
107
108
		if (exclude.size() > 0)
109
			for (String entry : exclude) {
110
				if (entry.endsWith(".") && fqn.equals(entry.substring(0, entry.length() - 1))) // NOI18N
111
					// exclude packages names (no trailing fullstop)
112
					return true;
113
				if (entry.length() > fqn.length())
114
					// fqn not long enough to filter yet
115
					continue;
116
				if (fqn.startsWith(entry))
117
					return true;
118
			}
119
120
		return false;
121
	}
122
123
	public void preferenceChange(PreferenceChangeEvent evt) {
124
		if (evt == null)
125
			return;
126
		String key = evt.getKey();
127
		if (CodeCompletionPanel.JAVA_COMPLETION_BLACKLIST.equals(key))
128
			update(exclude, evt.getNewValue());
129
		else if (CodeCompletionPanel.JAVA_COMPLETION_WHITELIST.equals(key))
130
			update(include, evt.getNewValue());
131
	}
132
133
	private void update(Collection<String> existing, String updated) {
134
		existing.clear();
135
		if (updated == null || updated.length() == 0)
136
			return;
137
		String[] entries = updated.split(","); //NOI18N
138
		for (String entry : entries) {
139
			existing.add(entry);
140
		}
141
	}
142
}
(-)src/org/netbeans/modules/editor/java/JavaCompletionProvider.java (-2 / +9 lines)
Lines 2728-2737 Link Here
2728
        private void addPackages(Env env, String fqnPrefix, boolean inPkgStmt) {
2728
        private void addPackages(Env env, String fqnPrefix, boolean inPkgStmt) {
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
			ExcludeCompletion excluder = ExcludeCompletion.getInstance();
2732
                if (pkgName.length() > 0)
2732
            for (String pkgName : env.getController().getClasspathInfo().getClassIndex().getPackageNames(fqnPrefix, true,EnumSet.allOf(ClassIndex.SearchScope.class))){
2733
				if (excluder.isExcluded(pkgName))
2734
					continue;
2733
                    results.add(JavaCompletionItem.createPackageItem(pkgName, anchorOffset, inPkgStmt));
2735
                    results.add(JavaCompletionItem.createPackageItem(pkgName, anchorOffset, inPkgStmt));
2734
        }
2736
        }
2737
        }
2735
        
2738
        
2736
        private void addTypes(Env env, EnumSet<ElementKind> kinds, DeclaredType baseType, Set<? extends Element> toExclude, boolean insideNew) throws IOException {
2739
        private void addTypes(Env env, EnumSet<ElementKind> kinds, DeclaredType baseType, Set<? extends Element> toExclude, boolean insideNew) throws IOException {
2737
            if (queryType == COMPLETION_ALL_QUERY_TYPE) {
2740
            if (queryType == COMPLETION_ALL_QUERY_TYPE) {
Lines 2807-2813 Link Here
2807
            ClassIndex.NameKind kind = env.isCamelCasePrefix() ?
2810
            ClassIndex.NameKind kind = env.isCamelCasePrefix() ?
2808
                Utilities.isCaseSensitive() ? ClassIndex.NameKind.CAMEL_CASE : ClassIndex.NameKind.CAMEL_CASE_INSENSITIVE :
2811
                Utilities.isCaseSensitive() ? ClassIndex.NameKind.CAMEL_CASE : ClassIndex.NameKind.CAMEL_CASE_INSENSITIVE :
2809
                Utilities.isCaseSensitive() ? ClassIndex.NameKind.PREFIX : ClassIndex.NameKind.CASE_INSENSITIVE_PREFIX;
2812
                Utilities.isCaseSensitive() ? ClassIndex.NameKind.PREFIX : ClassIndex.NameKind.CASE_INSENSITIVE_PREFIX;
2813
			ExcludeCompletion excluder = ExcludeCompletion.getInstance();
2810
            for(ElementHandle<TypeElement> name : controller.getClasspathInfo().getClassIndex().getDeclaredTypes(prefix != null ? prefix : EMPTY, kind, EnumSet.allOf(ClassIndex.SearchScope.class))) {
2814
            for(ElementHandle<TypeElement> name : controller.getClasspathInfo().getClassIndex().getDeclaredTypes(prefix != null ? prefix : EMPTY, kind, EnumSet.allOf(ClassIndex.SearchScope.class))) {
2815
				String fqn = name.getQualifiedName();
2816
				if (excluder.isExcluded(fqn))
2817
					continue;
2811
                LazyTypeCompletionItem item = LazyTypeCompletionItem.create(name, kinds, anchorOffset, controller.getSnapshot().getSource(), insideNew);
2818
                LazyTypeCompletionItem item = LazyTypeCompletionItem.create(name, kinds, anchorOffset, controller.getSnapshot().getSource(), insideNew);
2812
                if (item.isAnnonInner())
2819
                if (item.isAnnonInner())
2813
                    continue;
2820
                    continue;
(-)src/org/netbeans/modules/java/editor/imports/ComputeImports.java (-3 / +5 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.ExcludeCompletion;
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 127-132 Link Here
127
        
128
        
128
        unresolvedNames.addAll(JavadocImports.computeUnresolvedImports(info));
129
        unresolvedNames.addAll(JavadocImports.computeUnresolvedImports(info));
129
        
130
        
131
		ExcludeCompletion excluder = ExcludeCompletion.getInstance();
130
        for (String unresolved : unresolvedNames) {
132
        for (String unresolved : unresolvedNames) {
131
            if (isCancelled())
133
            if (isCancelled())
132
                return null;
134
                return null;
Lines 145-155 Link Here
145
                    continue;
147
                    continue;
146
                }
148
                }
147
                
149
                
148
                //#122334: do not propose imports from the default package:
150
				String fqn = info.getElements().getPackageOf(te).getQualifiedName().toString();
149
                if (info.getElements().getPackageOf(te).getQualifiedName().length() != 0) {
151
				if (excluder.isExcluded(fqn))
152
					continue;
150
                    classes.add(te);
153
                    classes.add(te);
151
                }
154
                }
152
            }
153
            Collections.sort(classes, new Comparator<TypeElement>() {
155
            Collections.sort(classes, new Comparator<TypeElement>() {
154
                public int compare(TypeElement te1, TypeElement te2) {
156
                public int compare(TypeElement te1, TypeElement te2) {
155
                    return (te1 == te2) ? 0 : te1.getQualifiedName().toString().compareTo(te2.getQualifiedName().toString());
157
                    return (te1 == te2) ? 0 : te1.getQualifiedName().toString().compareTo(te2.getQualifiedName().toString());
(-)src/org/netbeans/modules/java/editor/imports/JavaFixAllImports.java (-1 / +2 lines)
Lines 321-327 Link Here
321
321
322
        private ImportVisitor (CompilationInfo info) {
322
        private ImportVisitor (CompilationInfo info) {
323
            this.info = info;
323
            this.info = info;
324
            currentPackage = info.getCompilationUnit().getPackageName().toString();
324
			ExpressionTree pkg = info.getCompilationUnit().getPackageName();
325
            currentPackage = pkg != null ? pkg.toString() : "";
325
            imports = new ArrayList<TreePathHandle>();
326
            imports = new ArrayList<TreePathHandle>();
326
        }
327
        }
327
328
(-)src/org/netbeans/modules/java/editor/javadoc/JavadocCompletionQuery.java (-2 / +10 lines)
Lines 94-99 Link Here
94
import org.netbeans.api.java.source.TreeUtilities;
94
import org.netbeans.api.java.source.TreeUtilities;
95
import org.netbeans.api.lexer.Token;
95
import org.netbeans.api.lexer.Token;
96
import org.netbeans.api.lexer.TokenSequence;
96
import org.netbeans.api.lexer.TokenSequence;
97
import org.netbeans.modules.editor.java.ExcludeCompletion;
97
import org.netbeans.modules.editor.java.JavaCompletionItem;
98
import org.netbeans.modules.editor.java.JavaCompletionItem;
98
import org.netbeans.modules.editor.java.LazyTypeCompletionItem;
99
import org.netbeans.modules.editor.java.LazyTypeCompletionItem;
99
import org.netbeans.modules.editor.java.Utilities;
100
import org.netbeans.modules.editor.java.Utilities;
Lines 602-611 Link Here
602
            }
603
            }
603
        }
604
        }
604
        
605
        
605
        for (String pkgName : jdctx.javac.getClasspathInfo().getClassIndex().getPackageNames(pkgPrefix, true, EnumSet.allOf(ClassIndex.SearchScope.class)))
606
		ExcludeCompletion excluder = ExcludeCompletion.getInstance();
606
            if (pkgName.length() > 0)
607
        for (String pkgName : jdctx.javac.getClasspathInfo().getClassIndex().getPackageNames(pkgPrefix, true, EnumSet.allOf(ClassIndex.SearchScope.class))){
608
			if (excluder.isExcluded(pkgName))
609
				continue;
607
                items.add(JavaCompletionItem.createPackageItem(pkgName, substitutionOffset, false));
610
                items.add(JavaCompletionItem.createPackageItem(pkgName, substitutionOffset, false));
608
    }
611
    }
612
    }
609
    
613
    
610
    private void completeThrowsOrPkg(String fqn, String prefix, int substitutionOffset, JavadocContext jdctx) {
614
    private void completeThrowsOrPkg(String fqn, String prefix, int substitutionOffset, JavadocContext jdctx) {
611
        final Elements elements = jdctx.javac.getElements();
615
        final Elements elements = jdctx.javac.getElements();
Lines 1006-1012 Link Here
1006
//        ClassIndex.NameKind kind = env.isCamelCasePrefix() ?
1010
//        ClassIndex.NameKind kind = env.isCamelCasePrefix() ?
1007
//            Utilities.isCaseSensitive() ? ClassIndex.NameKind.CAMEL_CASE : ClassIndex.NameKind.CAMEL_CASE_INSENSITIVE :
1011
//            Utilities.isCaseSensitive() ? ClassIndex.NameKind.CAMEL_CASE : ClassIndex.NameKind.CAMEL_CASE_INSENSITIVE :
1008
//            Utilities.isCaseSensitive() ? ClassIndex.NameKind.PREFIX : ClassIndex.NameKind.CASE_INSENSITIVE_PREFIX;
1012
//            Utilities.isCaseSensitive() ? ClassIndex.NameKind.PREFIX : ClassIndex.NameKind.CASE_INSENSITIVE_PREFIX;
1013
		ExcludeCompletion excluder = ExcludeCompletion.getInstance();
1009
        for(ElementHandle<TypeElement> name : controller.getClasspathInfo().getClassIndex().getDeclaredTypes(prefix, kind, EnumSet.allOf(ClassIndex.SearchScope.class))) {
1014
        for(ElementHandle<TypeElement> name : controller.getClasspathInfo().getClassIndex().getDeclaredTypes(prefix, kind, EnumSet.allOf(ClassIndex.SearchScope.class))) {
1015
			String fqn = name.getQualifiedName();
1016
			if (excluder.isExcluded(fqn))
1017
				continue;
1010
            LazyTypeCompletionItem item = LazyTypeCompletionItem.create(name, kinds, substitutionOffset, controller.getSnapshot().getSource(), false);
1018
            LazyTypeCompletionItem item = LazyTypeCompletionItem.create(name, kinds, substitutionOffset, controller.getSnapshot().getSource(), false);
1011
            // XXX item.isAnnonInner() is package private :-(
1019
            // XXX item.isAnnonInner() is package private :-(
1012
//            if (item.isAnnonInner())
1020
//            if (item.isAnnonInner())
(-)src/org/netbeans/modules/java/editor/options/Bundle.properties (+14 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.javaCompletionExcluderDeleteButton.text=Delete
131
CodeCompletionPanel.javaCompletionExcluderBackButton.text=Back
132
CodeCompletionPanel.javaCompletionIncludeScrollPane.TabConstraints.tabTitle=Include
(-)src/org/netbeans/modules/java/editor/options/CodeCompletionPanel.form (-21 / +234 lines)
Lines 1-6 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
  <Properties>
4
  <Properties>
5
    <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
5
    <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">
6
      <Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
Lines 18-32 Link Here
18
    <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
18
    <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
19
    <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
19
    <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
20
    <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
20
    <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
21
    <AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,55,0,0,1,-92"/>
21
  </AuxValues>
22
  </AuxValues>
22
23
24
  <Layout class="org.netbeans.modules.form.compat2.layouts.DesignCardLayout"/>
25
  <SubComponents>
26
    <Container class="javax.swing.JPanel" name="javaCompletionPane">
27
      <Constraints>
28
        <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignCardLayout" value="org.netbeans.modules.form.compat2.layouts.DesignCardLayout$CardConstraintsDescription">
29
          <CardConstraints cardName="javaCompletion"/>
30
        </Constraint>
31
      </Constraints>
32
23
  <Layout>
33
  <Layout>
24
    <DimensionLayout dim="0">
34
    <DimensionLayout dim="0">
25
      <Group type="103" groupAlignment="0" attributes="0">
35
      <Group type="103" groupAlignment="0" attributes="0">
26
          <Group type="102" attributes="0">
36
              <Group type="102" alignment="0" attributes="0">
27
              <EmptySpace max="-2" attributes="0"/>
37
              <EmptySpace max="-2" attributes="0"/>
38
                  <Component id="javadocAutoCompletionTriggersLabel" min="-2" max="-2" attributes="0"/>
39
                  <EmptySpace max="-2" attributes="0"/>
40
                  <Component id="javadocAutoCompletionTriggersField" min="-2" pref="86" max="-2" attributes="1"/>
41
                  <EmptySpace pref="115" max="32767" attributes="0"/>
42
              </Group>
43
              <Group type="103" rootIndex="1" groupAlignment="0" attributes="0">
44
                  <Group type="102" alignment="0" attributes="0">
45
                      <EmptySpace max="-2" attributes="0"/>
28
              <Group type="103" groupAlignment="0" attributes="0">
46
              <Group type="103" groupAlignment="0" attributes="0">
29
                  <Component id="jSeparator1" alignment="0" pref="362" max="32767" attributes="0"/>
30
                  <Component id="guessMethodArguments" min="-2" max="-2" attributes="0"/>
47
                  <Component id="guessMethodArguments" min="-2" max="-2" attributes="0"/>
31
                  <Group type="102" alignment="0" attributes="0">
48
                  <Group type="102" alignment="0" attributes="0">
32
                      <Component id="javaAutoCompletionTriggersLabel" min="-2" max="-2" attributes="1"/>
49
                      <Component id="javaAutoCompletionTriggersLabel" min="-2" max="-2" attributes="1"/>
Lines 34-57 Link Here
34
                      <Component id="javaAutoCompletionTriggersField" min="-2" pref="86" max="-2" attributes="1"/>
51
                      <Component id="javaAutoCompletionTriggersField" min="-2" pref="86" max="-2" attributes="1"/>
35
                  </Group>
52
                  </Group>
36
                  <Component id="javaAutoPopupOnIdentifierPart" alignment="0" min="-2" max="-2" attributes="1"/>
53
                  <Component id="javaAutoPopupOnIdentifierPart" alignment="0" min="-2" max="-2" attributes="1"/>
54
                          <Component id="jSeparator1" alignment="0" pref="408" max="32767" attributes="0"/>
37
                  <Group type="102" alignment="0" attributes="0">
55
                  <Group type="102" alignment="0" attributes="0">
38
                      <Component id="javaCompletionSelectorsLabel" min="-2" max="-2" attributes="1"/>
56
                              <Group type="103" groupAlignment="1" attributes="0">
57
                                  <Component id="javaCompletionExcluderLabel" alignment="1" min="-2" max="-2" attributes="0"/>
58
                                  <Component id="javaCompletionSelectorsLabel" alignment="1" min="-2" max="-2" attributes="1"/>
59
                              </Group>
60
                              <Group type="103" groupAlignment="0" attributes="0">
61
                                  <Group type="102" alignment="0" attributes="0">
39
                      <EmptySpace min="-2" pref="30" max="-2" attributes="0"/>
62
                      <EmptySpace min="-2" pref="30" max="-2" attributes="0"/>
40
                      <Component id="javaCompletionSelectorsField" min="-2" pref="86" max="-2" attributes="1"/>
63
                      <Component id="javaCompletionSelectorsField" min="-2" pref="86" max="-2" attributes="1"/>
41
                  </Group>
64
                  </Group>
42
                  <Group type="102" alignment="0" attributes="0">
65
                                  <Group type="102" alignment="1" attributes="0">
43
                      <Component id="javadocAutoCompletionTriggersLabel" min="-2" max="-2" attributes="0"/>
66
                                      <EmptySpace min="-2" pref="23" max="-2" attributes="0"/>
44
                      <EmptySpace max="-2" attributes="0"/>
67
                                      <Component id="javaCompletionExcluderButton" min="-2" max="-2" attributes="0"/>
45
                      <Component id="javadocAutoCompletionTriggersField" min="-2" pref="86" max="-2" attributes="1"/>
46
                  </Group>
68
                  </Group>
47
              </Group>
69
              </Group>
70
                          </Group>
71
                      </Group>
48
              <EmptySpace max="-2" attributes="0"/>
72
              <EmptySpace max="-2" attributes="0"/>
49
          </Group>
73
          </Group>
50
      </Group>
74
      </Group>
75
          </Group>
51
    </DimensionLayout>
76
    </DimensionLayout>
52
    <DimensionLayout dim="1">
77
    <DimensionLayout dim="1">
53
      <Group type="103" groupAlignment="0" attributes="0">
78
      <Group type="103" groupAlignment="0" attributes="0">
54
          <Group type="102" attributes="0">
79
              <Group type="102" alignment="1" attributes="0">
80
                  <EmptySpace min="-2" pref="231" max="-2" attributes="0"/>
81
                  <Group type="103" groupAlignment="3" attributes="0">
82
                      <Component id="javadocAutoCompletionTriggersLabel" alignment="3" min="-2" max="-2" attributes="0"/>
83
                      <Component id="javadocAutoCompletionTriggersField" alignment="3" min="-2" max="-2" attributes="0"/>
84
                  </Group>
85
                  <EmptySpace pref="52" max="32767" attributes="0"/>
86
              </Group>
87
              <Group type="103" rootIndex="1" groupAlignment="0" attributes="0">
88
                  <Group type="102" alignment="0" attributes="0">
55
              <EmptySpace max="-2" attributes="0"/>
89
              <EmptySpace max="-2" attributes="0"/>
56
              <Component id="guessMethodArguments" min="-2" max="-2" attributes="0"/>
90
              <Component id="guessMethodArguments" min="-2" max="-2" attributes="0"/>
57
              <EmptySpace max="-2" attributes="0"/>
91
              <EmptySpace max="-2" attributes="0"/>
Lines 66-81 Link Here
66
                  <Component id="javaCompletionSelectorsLabel" alignment="3" min="-2" max="-2" attributes="0"/>
100
                  <Component id="javaCompletionSelectorsLabel" alignment="3" min="-2" max="-2" attributes="0"/>
67
                  <Component id="javaCompletionSelectorsField" alignment="3" min="-2" max="-2" attributes="0"/>
101
                  <Component id="javaCompletionSelectorsField" alignment="3" min="-2" max="-2" attributes="0"/>
68
              </Group>
102
              </Group>
69
              <EmptySpace type="separate" max="-2" attributes="0"/>
103
                      <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">
104
              <Group type="103" groupAlignment="3" attributes="0">
73
                  <Component id="javadocAutoCompletionTriggersLabel" alignment="3" min="-2" max="-2" attributes="0"/>
105
                          <Component id="javaCompletionExcluderButton" alignment="3" min="-2" max="-2" attributes="0"/>
74
                  <Component id="javadocAutoCompletionTriggersField" alignment="3" min="-2" max="-2" attributes="0"/>
106
                          <Component id="javaCompletionExcluderLabel" alignment="3" min="-2" max="-2" attributes="0"/>
75
              </Group>
107
              </Group>
76
              <EmptySpace pref="30" max="32767" attributes="0"/>
108
                      <EmptySpace min="-2" pref="44" max="-2" attributes="0"/>
109
                      <Component id="jSeparator1" min="-2" max="-2" attributes="0"/>
110
                      <EmptySpace pref="94" max="32767" attributes="0"/>
77
          </Group>
111
          </Group>
78
      </Group>
112
      </Group>
113
          </Group>
79
    </DimensionLayout>
114
    </DimensionLayout>
80
  </Layout>
115
  </Layout>
81
  <SubComponents>
116
  <SubComponents>
Lines 84-92 Link Here
84
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
119
        <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;)"/>
120
          <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>
121
        </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>
122
      </Properties>
91
      <Events>
123
      <Events>
92
        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="guessMethodArgumentsActionPerformed"/>
124
        <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">
129
        <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;)"/>
130
          <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>
131
        </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>
132
      </Properties>
104
      <Events>
133
      <Events>
105
        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="javaAutoPopupOnIdentifierPartActionPerformed"/>
134
        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="javaAutoPopupOnIdentifierPartActionPerformed"/>
Lines 151-155 Link Here
151
    </Component>
180
    </Component>
152
    <Component class="javax.swing.JSeparator" name="jSeparator1">
181
    <Component class="javax.swing.JSeparator" name="jSeparator1">
153
    </Component>
182
    </Component>
183
        <Component class="javax.swing.JLabel" name="javaCompletionExcluderLabel">
184
          <Properties>
185
            <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
186
              <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;)"/>
187
            </Property>
188
          </Properties>
189
        </Component>
190
        <Component class="javax.swing.JButton" name="javaCompletionExcluderButton">
191
          <Properties>
192
            <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
193
              <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;)"/>
194
            </Property>
195
          </Properties>
196
          <Events>
197
            <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="javaCompletionExcluderButtonActionPerformed"/>
198
          </Events>
199
        </Component>
154
  </SubComponents>
200
  </SubComponents>
201
    </Container>
202
    <Container class="javax.swing.JPanel" name="javaCompletionExcluderPane">
203
      <Constraints>
204
        <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignCardLayout" value="org.netbeans.modules.form.compat2.layouts.DesignCardLayout$CardConstraintsDescription">
205
          <CardConstraints cardName="javaCompletionExcluder"/>
206
        </Constraint>
207
      </Constraints>
208
209
      <Layout>
210
        <DimensionLayout dim="0">
211
          <Group type="103" groupAlignment="0" attributes="0">
212
              <Group type="102" alignment="1" attributes="0">
213
                  <EmptySpace max="-2" attributes="0"/>
214
                  <Component id="javaCompletionExcluderTab" min="-2" pref="298" max="-2" attributes="0"/>
215
                  <EmptySpace min="-2" max="-2" attributes="0"/>
216
                  <Group type="103" groupAlignment="0" attributes="0">
217
                      <Component id="javaCompletionExcluderDeleteButton" min="-2" max="-2" attributes="0"/>
218
                      <Component id="javaCompletionExcluderAddButton" min="-2" max="-2" attributes="0"/>
219
                      <Component id="javaCompletionExcluderBackButton" min="-2" max="-2" attributes="0"/>
220
                  </Group>
221
                  <EmptySpace pref="26" max="32767" attributes="0"/>
222
              </Group>
223
          </Group>
224
        </DimensionLayout>
225
        <DimensionLayout dim="1">
226
          <Group type="103" groupAlignment="0" attributes="0">
227
              <Group type="102" attributes="0">
228
                  <EmptySpace max="-2" attributes="0"/>
229
                  <Component id="javaCompletionExcluderTab" pref="299" max="32767" attributes="0"/>
230
                  <EmptySpace max="-2" attributes="0"/>
231
              </Group>
232
              <Group type="102" alignment="0" attributes="0">
233
                  <EmptySpace min="-2" pref="59" max="-2" attributes="0"/>
234
                  <Component id="javaCompletionExcluderAddButton" min="-2" max="-2" attributes="0"/>
235
                  <EmptySpace max="-2" attributes="0"/>
236
                  <Component id="javaCompletionExcluderDeleteButton" min="-2" max="-2" attributes="0"/>
237
                  <EmptySpace pref="137" max="32767" attributes="0"/>
238
                  <Component id="javaCompletionExcluderBackButton" min="-2" max="-2" attributes="0"/>
239
                  <EmptySpace min="-2" pref="22" max="-2" attributes="0"/>
240
              </Group>
241
          </Group>
242
        </DimensionLayout>
243
      </Layout>
244
      <SubComponents>
245
        <Container class="javax.swing.JTabbedPane" name="javaCompletionExcluderTab">
246
247
          <Layout class="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout"/>
248
          <SubComponents>
249
            <Container class="javax.swing.JScrollPane" name="javaCompletionExcludeScrollPane">
250
              <AuxValues>
251
                <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
252
              </AuxValues>
253
              <Constraints>
254
                <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout$JTabbedPaneConstraintsDescription">
255
                  <JTabbedPaneConstraints tabName="Exclude">
256
                    <Property name="tabTitle" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
257
                      <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;)"/>
258
                    </Property>
259
                  </JTabbedPaneConstraints>
260
                </Constraint>
261
              </Constraints>
262
263
              <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
264
              <SubComponents>
265
                <Component class="javax.swing.JTable" name="javaCompletionExcludeTable">
266
                  <Properties>
267
                    <Property name="model" type="javax.swing.table.TableModel" editor="org.netbeans.modules.form.editors2.TableModelEditor">
268
                      <Table columnCount="1" rowCount="0">
269
                        <Column editable="true" title="Fully Qualified Name prefix" type="java.lang.String"/>
270
                      </Table>
271
                    </Property>
272
                    <Property name="columnModel" type="javax.swing.table.TableColumnModel" editor="org.netbeans.modules.form.editors2.TableColumnModelEditor">
273
                      <TableColumnModel selectionModel="0">
274
                        <Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true">
275
                          <Title editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
276
                            <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;)"/>
277
                          </Title>
278
                          <Editor editor="org.netbeans.modules.form.ComponentChooserEditor">
279
                            <ComponentRef name="null"/>
280
                          </Editor>
281
                          <Renderer/>
282
                        </Column>
283
                      </TableColumnModel>
284
                    </Property>
285
                    <Property name="tableHeader" type="javax.swing.table.JTableHeader" editor="org.netbeans.modules.form.editors2.JTableHeaderEditor">
286
                      <TableHeader reorderingAllowed="false" resizingAllowed="true"/>
287
                    </Property>
288
                  </Properties>
289
                </Component>
290
              </SubComponents>
291
            </Container>
292
            <Container class="javax.swing.JScrollPane" name="javaCompletionIncludeScrollPane">
293
              <AuxValues>
294
                <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
295
              </AuxValues>
296
              <Constraints>
297
                <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout$JTabbedPaneConstraintsDescription">
298
                  <JTabbedPaneConstraints tabName="Include">
299
                    <Property name="tabTitle" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
300
                      <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;)"/>
301
                    </Property>
302
                  </JTabbedPaneConstraints>
303
                </Constraint>
304
              </Constraints>
305
306
              <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
307
              <SubComponents>
308
                <Component class="javax.swing.JTable" name="javaCompletionIncludeTable">
309
                  <Properties>
310
                    <Property name="model" type="javax.swing.table.TableModel" editor="org.netbeans.modules.form.editors2.TableModelEditor">
311
                      <Table columnCount="1" rowCount="0">
312
                        <Column editable="true" title="Fully Qualified Name prefix" type="java.lang.String"/>
313
                      </Table>
314
                    </Property>
315
                    <Property name="columnModel" type="javax.swing.table.TableColumnModel" editor="org.netbeans.modules.form.editors2.TableColumnModelEditor">
316
                      <TableColumnModel selectionModel="0">
317
                        <Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true">
318
                          <Title editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
319
                            <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;)"/>
320
                          </Title>
321
                          <Editor/>
322
                          <Renderer/>
323
                        </Column>
324
                      </TableColumnModel>
325
                    </Property>
326
                    <Property name="tableHeader" type="javax.swing.table.JTableHeader" editor="org.netbeans.modules.form.editors2.JTableHeaderEditor">
327
                      <TableHeader reorderingAllowed="false" resizingAllowed="true"/>
328
                    </Property>
329
                  </Properties>
330
                </Component>
331
              </SubComponents>
332
            </Container>
333
          </SubComponents>
334
        </Container>
335
        <Component class="javax.swing.JButton" name="javaCompletionExcluderAddButton">
336
          <Properties>
337
            <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
338
              <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;)"/>
339
            </Property>
340
          </Properties>
341
          <Events>
342
            <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="javaCompletionExcluderAddButtonActionPerformed"/>
343
          </Events>
344
        </Component>
345
        <Component class="javax.swing.JButton" name="javaCompletionExcluderDeleteButton">
346
          <Properties>
347
            <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
348
              <ResourceString bundle="org/netbeans/modules/java/editor/options/Bundle.properties" key="CodeCompletionPanel.javaCompletionExcluderDeleteButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
349
            </Property>
350
          </Properties>
351
          <Events>
352
            <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="javaCompletionExcluderDeleteButtonActionPerformed"/>
353
          </Events>
354
        </Component>
355
        <Component class="javax.swing.JButton" name="javaCompletionExcluderBackButton">
356
          <Properties>
357
            <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
358
              <ResourceString bundle="org/netbeans/modules/java/editor/options/Bundle.properties" key="CodeCompletionPanel.javaCompletionExcluderBackButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
359
            </Property>
360
          </Properties>
361
          <Events>
362
            <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="javaCompletionExcluderBackButtonActionPerformed"/>
363
          </Events>
364
        </Component>
365
      </SubComponents>
366
    </Container>
367
  </SubComponents>
155
</Form>
368
</Form>
(-)src/org/netbeans/modules/java/editor/options/CodeCompletionPanel.java (-33 / +278 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.CardLayout;
44
import java.awt.Component;
45
import java.util.SortedSet;
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-67 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
58
    public static final String JAVA_AUTO_COMPLETION_TRIGGERS = "javaAutoCompletionTriggers"; //NOI18N
66
    public static final String JAVA_AUTO_COMPLETION_TRIGGERS = "javaAutoCompletionTriggers"; //NOI18N
59
    public static final String JAVA_COMPLETION_SELECTORS = "javaCompletionSelectors"; //NOI18N
67
    public static final String JAVA_COMPLETION_SELECTORS = "javaCompletionSelectors"; //NOI18N
60
    public static final String JAVADOC_AUTO_COMPLETION_TRIGGERS = "javadocAutoCompletionTriggers"; //NOI18N
68
    public static final String JAVADOC_AUTO_COMPLETION_TRIGGERS = "javadocAutoCompletionTriggers"; //NOI18N
61
    public static final String GUESS_METHOD_ARGUMENTS = "guessMethodArguments"; //NOI18N
69
    public static final String GUESS_METHOD_ARGUMENTS = "guessMethodArguments"; //NOI18N
70
	public static final String JAVA_COMPLETION_WHITELIST = "javaCompletionWhitelist"; //NOI18N
71
	public static final String JAVA_COMPLETION_BLACKLIST = "javaCompletionBlacklist"; //NOI18N
62
72
63
    private Preferences preferences;
73
	private final Preferences preferences;
64
74
75
	private void initExcluderTable(JTable table, String pref) {
76
		String[] entries = pref.split(","); //NOI18N
77
		DefaultTableModel model = (DefaultTableModel) table.getModel();
78
		for (String entry : entries) {
79
			if (entry.length() > 0)
80
				model.addRow(new String[]{entry});
81
		}
82
		model.addTableModelListener(this);
83
	}
84
65
    /** Creates new form FmtTabsIndents */
85
    /** Creates new form FmtTabsIndents */
66
    public CodeCompletionPanel(Preferences p) {
86
    public CodeCompletionPanel(Preferences p) {
67
        initComponents();
87
        initComponents();
Lines 71-76 Link Here
71
        javaAutoCompletionTriggersField.setText(preferences.get(JAVA_AUTO_COMPLETION_TRIGGERS, ".")); //NOI18N
91
        javaAutoCompletionTriggersField.setText(preferences.get(JAVA_AUTO_COMPLETION_TRIGGERS, ".")); //NOI18N
72
        javaCompletionSelectorsField.setText(preferences.get(JAVA_COMPLETION_SELECTORS, ".,;:([+-=")); //NOI18N
92
        javaCompletionSelectorsField.setText(preferences.get(JAVA_COMPLETION_SELECTORS, ".,;:([+-=")); //NOI18N
73
        javadocAutoCompletionTriggersField.setText(preferences.get(JAVADOC_AUTO_COMPLETION_TRIGGERS, ".#@")); //NOI18N
93
        javadocAutoCompletionTriggersField.setText(preferences.get(JAVADOC_AUTO_COMPLETION_TRIGGERS, ".#@")); //NOI18N
94
		String blacklist = preferences.get(JAVA_COMPLETION_BLACKLIST, "sun.,sunw."); //NOI18N
95
		initExcluderTable(javaCompletionExcludeTable, blacklist);
96
		String whitelist = preferences.get(JAVA_COMPLETION_WHITELIST, ""); //NOI18N
97
		initExcluderTable(javaCompletionIncludeTable, whitelist);
74
        javaAutoCompletionTriggersField.getDocument().addDocumentListener(this);
98
        javaAutoCompletionTriggersField.getDocument().addDocumentListener(this);
75
        javaCompletionSelectorsField.getDocument().addDocumentListener(this);
99
        javaCompletionSelectorsField.getDocument().addDocumentListener(this);
76
        javadocAutoCompletionTriggersField.getDocument().addDocumentListener(this);
100
        javadocAutoCompletionTriggersField.getDocument().addDocumentListener(this);
Lines 97-102 Link Here
97
        update(e);
121
        update(e);
98
    }
122
    }
99
123
124
	// allows common excluder buttons to know which table to act on
125
	private JTable getSelectedExcluderTable() {
126
		Component selected = javaCompletionExcluderTab.getSelectedComponent();
127
		if (selected == javaCompletionExcludeScrollPane)
128
			return javaCompletionExcludeTable;
129
		else if (selected == javaCompletionIncludeScrollPane)
130
			return javaCompletionIncludeTable;
131
		else
132
			throw new RuntimeException(selected.getName());
133
	}
134
135
	// listen to changes in the excluder lists, and do sanity checking on input
136
	public void tableChanged(TableModelEvent e) {
137
		DefaultTableModel model = (DefaultTableModel) e.getSource();
138
		String pref;
139
		if (model == javaCompletionExcludeTable.getModel())
140
			pref = JAVA_COMPLETION_BLACKLIST;
141
		else if (model == javaCompletionIncludeTable.getModel())
142
			pref = JAVA_COMPLETION_WHITELIST;
143
		else
144
			throw new RuntimeException();
145
		@SuppressWarnings("unchecked")
146
		Vector<Vector<String>> data = model.getDataVector();
147
		SortedSet<String> entries = new TreeSet<String>();
148
		for (Vector<String> row : data) {
149
			String entry = row.elementAt(0);
150
			if (entry == null)
151
				continue;
152
			entry = entry.trim();
153
			if (entry.length() == 0)
154
				continue;
155
			// this could be checked by a custom editor
156
			if (!entry.matches("[$\\w.]*")) //NOI18N
157
				continue;
158
			entries.add(entry);
159
		}
160
		StringBuilder builder = new StringBuilder();
161
		for (String entry : entries){
162
			if (builder.length() > 0)
163
				builder.append(","); //NOI18N
164
			builder.append(entry);
165
		}
166
		preferences.put(pref, builder.toString());
167
	}
168
100
    /** This method is called from within the constructor to
169
    /** This method is called from within the constructor to
101
     * initialize the form.
170
     * initialize the form.
102
     * WARNING: Do NOT modify this code. The content of this method is
171
     * 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
174
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
106
    private void initComponents() {
175
    private void initComponents() {
107
176
177
        javaCompletionPane = new javax.swing.JPanel();
108
        guessMethodArguments = new javax.swing.JCheckBox();
178
        guessMethodArguments = new javax.swing.JCheckBox();
109
        javaAutoPopupOnIdentifierPart = new javax.swing.JCheckBox();
179
        javaAutoPopupOnIdentifierPart = new javax.swing.JCheckBox();
110
        javaAutoCompletionTriggersLabel = new javax.swing.JLabel();
180
        javaAutoCompletionTriggersLabel = new javax.swing.JLabel();
Lines 114-124 Link Here
114
        javadocAutoCompletionTriggersLabel = new javax.swing.JLabel();
184
        javadocAutoCompletionTriggersLabel = new javax.swing.JLabel();
115
        javadocAutoCompletionTriggersField = new javax.swing.JTextField();
185
        javadocAutoCompletionTriggersField = new javax.swing.JTextField();
116
        jSeparator1 = new javax.swing.JSeparator();
186
        jSeparator1 = new javax.swing.JSeparator();
187
        javaCompletionExcluderLabel = new javax.swing.JLabel();
188
        javaCompletionExcluderButton = new javax.swing.JButton();
189
        javaCompletionExcluderPane = new javax.swing.JPanel();
190
        javaCompletionExcluderTab = new javax.swing.JTabbedPane();
191
        javaCompletionExcludeScrollPane = new javax.swing.JScrollPane();
192
        javaCompletionExcludeTable = new javax.swing.JTable();
193
        javaCompletionIncludeScrollPane = new javax.swing.JScrollPane();
194
        javaCompletionIncludeTable = new javax.swing.JTable();
195
        javaCompletionExcluderAddButton = new javax.swing.JButton();
196
        javaCompletionExcluderDeleteButton = new javax.swing.JButton();
197
        javaCompletionExcluderBackButton = new javax.swing.JButton();
117
198
118
        setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
199
        setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
200
        setLayout(new java.awt.CardLayout());
119
201
120
        org.openide.awt.Mnemonics.setLocalizedText(guessMethodArguments, org.openide.util.NbBundle.getMessage(CodeCompletionPanel.class, "LBL_GuessMethodArgs")); // NOI18N
202
        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() {
203
        guessMethodArguments.addActionListener(new java.awt.event.ActionListener() {
123
            public void actionPerformed(java.awt.event.ActionEvent evt) {
204
            public void actionPerformed(java.awt.event.ActionEvent evt) {
124
                guessMethodArgumentsActionPerformed(evt);
205
                guessMethodArgumentsActionPerformed(evt);
Lines 126-132 Link Here
126
        });
207
        });
127
208
128
        org.openide.awt.Mnemonics.setLocalizedText(javaAutoPopupOnIdentifierPart, org.openide.util.NbBundle.getMessage(CodeCompletionPanel.class, "LBL_AutoPopupOnIdentifierPartBox")); // NOI18N
209
        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() {
210
        javaAutoPopupOnIdentifierPart.addActionListener(new java.awt.event.ActionListener() {
131
            public void actionPerformed(java.awt.event.ActionEvent evt) {
211
            public void actionPerformed(java.awt.event.ActionEvent evt) {
132
                javaAutoPopupOnIdentifierPartActionPerformed(evt);
212
                javaAutoPopupOnIdentifierPartActionPerformed(evt);
Lines 146-208 Link Here
146
226
147
        javadocAutoCompletionTriggersField.setText(org.openide.util.NbBundle.getMessage(CodeCompletionPanel.class, "CodeCompletionPanel.javadocAutoCompletionTriggersField.text")); // NOI18N
227
        javadocAutoCompletionTriggersField.setText(org.openide.util.NbBundle.getMessage(CodeCompletionPanel.class, "CodeCompletionPanel.javadocAutoCompletionTriggersField.text")); // NOI18N
148
228
149
        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
229
        org.openide.awt.Mnemonics.setLocalizedText(javaCompletionExcluderLabel, org.openide.util.NbBundle.getMessage(CodeCompletionPanel.class, "CodeCompletionPanel.javaCompletionExcluderLabel.text")); // NOI18N
150
        this.setLayout(layout);
230
151
        layout.setHorizontalGroup(
231
        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)
232
        javaCompletionExcluderButton.addActionListener(new java.awt.event.ActionListener() {
153
            .add(layout.createSequentialGroup()
233
            public void actionPerformed(java.awt.event.ActionEvent evt) {
234
                javaCompletionExcluderButtonActionPerformed(evt);
235
            }
236
        });
237
238
        org.jdesktop.layout.GroupLayout javaCompletionPaneLayout = new org.jdesktop.layout.GroupLayout(javaCompletionPane);
239
        javaCompletionPane.setLayout(javaCompletionPaneLayout);
240
        javaCompletionPaneLayout.setHorizontalGroup(
241
            javaCompletionPaneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
242
            .add(javaCompletionPaneLayout.createSequentialGroup()
154
                .addContainerGap()
243
                .addContainerGap()
155
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
244
                .add(javadocAutoCompletionTriggersLabel)
156
                    .add(jSeparator1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 362, Short.MAX_VALUE)
245
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
246
                .add(javadocAutoCompletionTriggersField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 86, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
247
                .addContainerGap(115, Short.MAX_VALUE))
248
            .add(javaCompletionPaneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
249
                .add(javaCompletionPaneLayout.createSequentialGroup()
250
                    .addContainerGap()
251
                    .add(javaCompletionPaneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
157
                    .add(guessMethodArguments)
252
                    .add(guessMethodArguments)
158
                    .add(layout.createSequentialGroup()
253
                        .add(javaCompletionPaneLayout.createSequentialGroup()
159
                        .add(javaAutoCompletionTriggersLabel)
254
                        .add(javaAutoCompletionTriggersLabel)
160
                        .add(34, 34, 34)
255
                        .add(34, 34, 34)
161
                        .add(javaAutoCompletionTriggersField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 86, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
256
                        .add(javaAutoCompletionTriggersField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 86, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
162
                    .add(javaAutoPopupOnIdentifierPart)
257
                    .add(javaAutoPopupOnIdentifierPart)
163
                    .add(layout.createSequentialGroup()
258
                        .add(jSeparator1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 408, Short.MAX_VALUE)
164
                        .add(javaCompletionSelectorsLabel)
259
                        .add(javaCompletionPaneLayout.createSequentialGroup()
260
                            .add(javaCompletionPaneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
261
                                .add(javaCompletionExcluderLabel)
262
                                .add(javaCompletionSelectorsLabel))
263
                            .add(javaCompletionPaneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
264
                                .add(javaCompletionPaneLayout.createSequentialGroup()
165
                        .add(30, 30, 30)
265
                        .add(30, 30, 30)
166
                        .add(javaCompletionSelectorsField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 86, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
266
                        .add(javaCompletionSelectorsField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 86, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
167
                    .add(layout.createSequentialGroup()
267
                                .add(org.jdesktop.layout.GroupLayout.TRAILING, javaCompletionPaneLayout.createSequentialGroup()
168
                        .add(javadocAutoCompletionTriggersLabel)
268
                                    .add(23, 23, 23)
169
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
269
                                    .add(javaCompletionExcluderButton)))))
170
                        .add(javadocAutoCompletionTriggersField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 86, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
270
                    .addContainerGap()))
171
                .addContainerGap())
172
        );
271
        );
173
        layout.setVerticalGroup(
272
        javaCompletionPaneLayout.setVerticalGroup(
174
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
273
            javaCompletionPaneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
175
            .add(layout.createSequentialGroup()
274
            .add(org.jdesktop.layout.GroupLayout.TRAILING, javaCompletionPaneLayout.createSequentialGroup()
275
                .add(231, 231, 231)
276
                .add(javaCompletionPaneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
277
                    .add(javadocAutoCompletionTriggersLabel)
278
                    .add(javadocAutoCompletionTriggersField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
279
                .addContainerGap(52, Short.MAX_VALUE))
280
            .add(javaCompletionPaneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
281
                .add(javaCompletionPaneLayout.createSequentialGroup()
176
                .addContainerGap()
282
                .addContainerGap()
177
                .add(guessMethodArguments)
283
                .add(guessMethodArguments)
178
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
284
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
179
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
285
                    .add(javaCompletionPaneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
180
                    .add(javaAutoCompletionTriggersLabel)
286
                    .add(javaAutoCompletionTriggersLabel)
181
                    .add(javaAutoCompletionTriggersField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
287
                    .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)
288
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
183
                .add(javaAutoPopupOnIdentifierPart)
289
                .add(javaAutoPopupOnIdentifierPart)
184
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
290
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
185
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
291
                    .add(javaCompletionPaneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
186
                    .add(javaCompletionSelectorsLabel)
292
                    .add(javaCompletionSelectorsLabel)
187
                    .add(javaCompletionSelectorsField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
293
                    .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)
294
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
295
                    .add(javaCompletionPaneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
296
                        .add(javaCompletionExcluderButton)
297
                        .add(javaCompletionExcluderLabel))
298
                    .add(44, 44, 44)
189
                .add(jSeparator1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
299
                .add(jSeparator1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
190
                .add(18, 18, 18)
300
                    .addContainerGap(94, Short.MAX_VALUE)))
191
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
192
                    .add(javadocAutoCompletionTriggersLabel)
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
        );
301
        );
302
303
        add(javaCompletionPane, "javaCompletion");
304
305
        javaCompletionExcludeTable.setModel(new javax.swing.table.DefaultTableModel(
306
            new Object [][] {
307
308
            },
309
            new String [] {
310
                "Fully Qualified Name prefix"
311
            }
312
        ) {
313
            Class[] types = new Class [] {
314
                java.lang.String.class
315
            };
316
317
            public Class getColumnClass(int columnIndex) {
318
                return types [columnIndex];
319
            }
320
        });
321
        javaCompletionExcludeTable.getTableHeader().setReorderingAllowed(false);
322
        javaCompletionExcludeScrollPane.setViewportView(javaCompletionExcludeTable);
323
        javaCompletionExcludeTable.getColumnModel().getColumn(0).setHeaderValue(org.openide.util.NbBundle.getMessage(CodeCompletionPanel.class, "CodeCompletionPanel.javaCompletionExcludeTable.columnModel.title0")); // NOI18N
324
        javaCompletionExcludeTable.getColumnModel().getColumn(0).setCellEditor(null);
325
326
        javaCompletionExcluderTab.addTab(org.openide.util.NbBundle.getMessage(CodeCompletionPanel.class, "CodeCompletionPanel.javaCompletionExcludeScrollPane.TabConstraints.tabTitle"), javaCompletionExcludeScrollPane); // NOI18N
327
328
        javaCompletionIncludeTable.setModel(new javax.swing.table.DefaultTableModel(
329
            new Object [][] {
330
331
            },
332
            new String [] {
333
                "Fully Qualified Name prefix"
334
            }
335
        ) {
336
            Class[] types = new Class [] {
337
                java.lang.String.class
338
            };
339
340
            public Class getColumnClass(int columnIndex) {
341
                return types [columnIndex];
342
            }
343
        });
344
        javaCompletionIncludeTable.getTableHeader().setReorderingAllowed(false);
345
        javaCompletionIncludeScrollPane.setViewportView(javaCompletionIncludeTable);
346
        javaCompletionIncludeTable.getColumnModel().getColumn(0).setHeaderValue(org.openide.util.NbBundle.getMessage(CodeCompletionPanel.class, "CodeCompletionPanel.javaCompletionExcludeTable.columnModel.title0")); // NOI18N
347
348
        javaCompletionExcluderTab.addTab(org.openide.util.NbBundle.getMessage(CodeCompletionPanel.class, "CodeCompletionPanel.javaCompletionIncludeScrollPane.TabConstraints.tabTitle"), javaCompletionIncludeScrollPane); // NOI18N
349
350
        org.openide.awt.Mnemonics.setLocalizedText(javaCompletionExcluderAddButton, org.openide.util.NbBundle.getMessage(CodeCompletionPanel.class, "CodeCompletionPanel.javaCompletionExcluderAddButton.text")); // NOI18N
351
        javaCompletionExcluderAddButton.addActionListener(new java.awt.event.ActionListener() {
352
            public void actionPerformed(java.awt.event.ActionEvent evt) {
353
                javaCompletionExcluderAddButtonActionPerformed(evt);
354
            }
355
        });
356
357
        org.openide.awt.Mnemonics.setLocalizedText(javaCompletionExcluderDeleteButton, org.openide.util.NbBundle.getMessage(CodeCompletionPanel.class, "CodeCompletionPanel.javaCompletionExcluderDeleteButton.text")); // NOI18N
358
        javaCompletionExcluderDeleteButton.addActionListener(new java.awt.event.ActionListener() {
359
            public void actionPerformed(java.awt.event.ActionEvent evt) {
360
                javaCompletionExcluderDeleteButtonActionPerformed(evt);
361
            }
362
        });
363
364
        org.openide.awt.Mnemonics.setLocalizedText(javaCompletionExcluderBackButton, org.openide.util.NbBundle.getMessage(CodeCompletionPanel.class, "CodeCompletionPanel.javaCompletionExcluderBackButton.text")); // NOI18N
365
        javaCompletionExcluderBackButton.addActionListener(new java.awt.event.ActionListener() {
366
            public void actionPerformed(java.awt.event.ActionEvent evt) {
367
                javaCompletionExcluderBackButtonActionPerformed(evt);
368
            }
369
        });
370
371
        org.jdesktop.layout.GroupLayout javaCompletionExcluderPaneLayout = new org.jdesktop.layout.GroupLayout(javaCompletionExcluderPane);
372
        javaCompletionExcluderPane.setLayout(javaCompletionExcluderPaneLayout);
373
        javaCompletionExcluderPaneLayout.setHorizontalGroup(
374
            javaCompletionExcluderPaneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
375
            .add(org.jdesktop.layout.GroupLayout.TRAILING, javaCompletionExcluderPaneLayout.createSequentialGroup()
376
                .addContainerGap()
377
                .add(javaCompletionExcluderTab, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 298, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
378
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
379
                .add(javaCompletionExcluderPaneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
380
                    .add(javaCompletionExcluderDeleteButton)
381
                    .add(javaCompletionExcluderAddButton)
382
                    .add(javaCompletionExcluderBackButton))
383
                .addContainerGap(26, Short.MAX_VALUE))
384
        );
385
        javaCompletionExcluderPaneLayout.setVerticalGroup(
386
            javaCompletionExcluderPaneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
387
            .add(javaCompletionExcluderPaneLayout.createSequentialGroup()
388
                .addContainerGap()
389
                .add(javaCompletionExcluderTab, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 299, Short.MAX_VALUE)
390
                .addContainerGap())
391
            .add(javaCompletionExcluderPaneLayout.createSequentialGroup()
392
                .add(59, 59, 59)
393
                .add(javaCompletionExcluderAddButton)
394
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
395
                .add(javaCompletionExcluderDeleteButton)
396
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 137, Short.MAX_VALUE)
397
                .add(javaCompletionExcluderBackButton)
398
                .add(22, 22, 22))
399
        );
400
401
        add(javaCompletionExcluderPane, "javaCompletionExcluder");
196
    }// </editor-fold>//GEN-END:initComponents
402
    }// </editor-fold>//GEN-END:initComponents
197
403
198
    private void javaAutoPopupOnIdentifierPartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_javaAutoPopupOnIdentifierPartActionPerformed
404
    private void javaAutoPopupOnIdentifierPartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_javaAutoPopupOnIdentifierPartActionPerformed
199
        preferences.putBoolean(JAVA_AUTO_POPUP_ON_IDENTIFIER_PART, javaAutoPopupOnIdentifierPart.isSelected());
405
		preferences.putBoolean(JAVA_AUTO_POPUP_ON_IDENTIFIER_PART, javaAutoPopupOnIdentifierPart.
406
				isSelected());
200
    }//GEN-LAST:event_javaAutoPopupOnIdentifierPartActionPerformed
407
    }//GEN-LAST:event_javaAutoPopupOnIdentifierPartActionPerformed
201
408
202
    private void guessMethodArgumentsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_guessMethodArgumentsActionPerformed
409
    private void guessMethodArgumentsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_guessMethodArgumentsActionPerformed
203
        preferences.putBoolean(GUESS_METHOD_ARGUMENTS, guessMethodArguments.isSelected());
410
        preferences.putBoolean(GUESS_METHOD_ARGUMENTS, guessMethodArguments.isSelected());
204
}//GEN-LAST:event_guessMethodArgumentsActionPerformed
411
}//GEN-LAST:event_guessMethodArgumentsActionPerformed
205
412
413
	private void javaCompletionExcluderButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_javaCompletionExcluderButtonActionPerformed
414
		((CardLayout) getLayout()).next(this);
415
}//GEN-LAST:event_javaCompletionExcluderButtonActionPerformed
416
417
	private void javaCompletionExcluderAddButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_javaCompletionExcluderAddButtonActionPerformed
418
		JTable table = getSelectedExcluderTable();
419
		DefaultTableModel model = (DefaultTableModel) table.getModel();
420
		int rows = model.getRowCount();
421
		model.setRowCount(rows + 1);
422
		table.editCellAt(rows, 0);
423
		table.requestFocus();
424
}//GEN-LAST:event_javaCompletionExcluderAddButtonActionPerformed
425
426
	private void javaCompletionExcluderBackButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_javaCompletionExcluderBackButtonActionPerformed
427
		((CardLayout) getLayout()).previous(this);
428
	}//GEN-LAST:event_javaCompletionExcluderBackButtonActionPerformed
429
430
	private void javaCompletionExcluderDeleteButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_javaCompletionExcluderDeleteButtonActionPerformed
431
		JTable table = getSelectedExcluderTable();
432
		int row = table.getSelectedRow();
433
		if (row == -1)
434
			return;
435
		DefaultTableModel model = (DefaultTableModel) table.getModel();
436
		model.removeRow(row);
437
	}//GEN-LAST:event_javaCompletionExcluderDeleteButtonActionPerformed
438
206
    private void update(DocumentEvent e) {
439
    private void update(DocumentEvent e) {
207
        if (e.getDocument() == javaAutoCompletionTriggersField.getDocument())
440
        if (e.getDocument() == javaAutoCompletionTriggersField.getDocument())
208
            preferences.put(JAVA_AUTO_COMPLETION_TRIGGERS, javaAutoCompletionTriggersField.getText());
441
            preferences.put(JAVA_AUTO_COMPLETION_TRIGGERS, javaAutoCompletionTriggersField.getText());
Lines 218-223 Link Here
218
    private javax.swing.JTextField javaAutoCompletionTriggersField;
451
    private javax.swing.JTextField javaAutoCompletionTriggersField;
219
    private javax.swing.JLabel javaAutoCompletionTriggersLabel;
452
    private javax.swing.JLabel javaAutoCompletionTriggersLabel;
220
    private javax.swing.JCheckBox javaAutoPopupOnIdentifierPart;
453
    private javax.swing.JCheckBox javaAutoPopupOnIdentifierPart;
454
    private javax.swing.JScrollPane javaCompletionExcludeScrollPane;
455
    private javax.swing.JTable javaCompletionExcludeTable;
456
    private javax.swing.JButton javaCompletionExcluderAddButton;
457
    private javax.swing.JButton javaCompletionExcluderBackButton;
458
    private javax.swing.JButton javaCompletionExcluderButton;
459
    private javax.swing.JButton javaCompletionExcluderDeleteButton;
460
    private javax.swing.JLabel javaCompletionExcluderLabel;
461
    private javax.swing.JPanel javaCompletionExcluderPane;
462
    private javax.swing.JTabbedPane javaCompletionExcluderTab;
463
    private javax.swing.JScrollPane javaCompletionIncludeScrollPane;
464
    private javax.swing.JTable javaCompletionIncludeTable;
465
    private javax.swing.JPanel javaCompletionPane;
221
    private javax.swing.JTextField javaCompletionSelectorsField;
466
    private javax.swing.JTextField javaCompletionSelectorsField;
222
    private javax.swing.JLabel javaCompletionSelectorsLabel;
467
    private javax.swing.JLabel javaCompletionSelectorsLabel;
223
    private javax.swing.JTextField javadocAutoCompletionTriggersField;
468
    private javax.swing.JTextField javadocAutoCompletionTriggersField;
Lines 226-232 Link Here
226
    
471
    
227
    private static class CodeCompletionPreferencesCusromizer implements PreferencesCustomizer {
472
    private static class CodeCompletionPreferencesCusromizer implements PreferencesCustomizer {
228
473
229
        private Preferences preferences;
474
		private final Preferences preferences;
230
475
231
        private CodeCompletionPreferencesCusromizer(Preferences p) {
476
        private CodeCompletionPreferencesCusromizer(Preferences p) {
232
            preferences = p;
477
            preferences = p;

Return to bug 125060