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

(-)java/project/build.xml (-2 / +6 lines)
Lines 19-24 Link Here
19
-->
19
-->
20
<project basedir="." default="netbeans" name="java/project">
20
<project basedir="." default="netbeans" name="java/project">
21
    <import file="../../nbbuild/templates/projectized.xml"/>
21
    <import file="../../nbbuild/templates/projectized.xml"/>
22
    <target name="IncludeExcludeVisualizerPanel" depends="compile" description="Try running IncludeExcludeVisualizerPanel interactively.">
23
        <java fork="true" classname="org.netbeans.spi.java.project.support.ui.IncludeExcludeVisualizerPanel" classpath="${build.classes.dir}:${cp}">
24
            <arg file="../../uml/core/src"/>
25
            <arg file="src"/>
26
        </java>
27
    </target>
22
</project>
28
</project>
23
24
(-)java/project/nbproject/project.xml (+8 lines)
Lines 140-145 Link Here
140
                    </run-dependency>
140
                    </run-dependency>
141
                </dependency>
141
                </dependency>
142
                <dependency>
142
                <dependency>
143
                    <code-name-base>org.openide.explorer</code-name-base>
144
                    <build-prerequisite/>
145
                    <compile-dependency/>
146
                    <run-dependency>
147
                        <specification-version>6.11</specification-version>
148
                    </run-dependency>
149
                </dependency>
150
                <dependency>
143
                    <code-name-base>org.openide.filesystems</code-name-base>
151
                    <code-name-base>org.openide.filesystems</code-name-base>
144
                    <build-prerequisite/>
152
                    <build-prerequisite/>
145
                    <compile-dependency/>
153
                    <compile-dependency/>
(-)java/project/src/org/netbeans/spi/java/project/support/ui/Bundle.properties (-4 / +7 lines)
Lines 28-36 Link Here
28
28
29
# {0} - root folder
29
# {0} - root folder
30
PackageView.find_packages_progress=Finding packages in {0}
30
PackageView.find_packages_progress=Finding packages in {0}
31
IncludeExcludeVisualizerPanel.includedListLabel.text=Incl&uded Files:
31
IncludeExcludeVisualizerPanel.includedListLabel.text=&Included Files and Folders:
32
IncludeExcludeVisualizerPanel.excludedListLabel.text=E&xcluded Files:
32
IncludeExcludeVisualizerPanel.excludedListLabel.text=&Excluded Files and Folders
33
IncludeExcludeVisualizerPanel.scanningLabel.text=Scanning...
33
IncludeExcludeVisualizerPanel.scanningLabel.text=Scanning...
34
IncludeExcludeVisualizerPanel.includesLabel.text=&Includes:
34
IncludeExcludeVisualizerPanel.includesLabel.text=Incl&udes:
35
IncludeExcludeVisualizerPanel.excludesLabel.text=&Excludes:
35
IncludeExcludeVisualizerPanel.excludesLabel.text=Exclu&des:
36
IncludeExcludeVisualizerPanel.explanation.text=Sample patterns: com/mycorp/, **/doc-files/, **/*.html
36
IncludeExcludeVisualizerPanel.explanation.text=Sample patterns: com/mycorp/, **/doc-files/, **/*.html
37
IncludeExcludeVisualizerPanel.border.advancedPanel.title=Advanced:
38
IncludeExcludeVisualizerPanel.excludeButton.text=→ E&xclude
39
IncludeExcludeVisualizerPanel.includeButton.text=← I&nclude
(-)java/project/src/org/netbeans/spi/java/project/support/ui/IncludeExcludeVisualizer.java (-120 / +11 lines)
Lines 21-38 Link Here
21
21
22
import java.awt.EventQueue;
22
import java.awt.EventQueue;
23
import java.io.File;
23
import java.io.File;
24
import java.util.ArrayList;
25
import java.util.List;
26
import java.util.SortedSet;
27
import java.util.TreeSet;
28
import java.util.regex.Pattern;
29
import javax.swing.JComponent;
24
import javax.swing.JComponent;
30
import javax.swing.event.ChangeEvent;
31
import javax.swing.event.ChangeListener;
25
import javax.swing.event.ChangeListener;
32
import org.netbeans.spi.project.support.ant.PathMatcher;
26
import org.openide.util.ChangeSupport;
33
import org.openide.util.NbPreferences;
34
import org.openide.util.Parameters;
27
import org.openide.util.Parameters;
35
import org.openide.util.RequestProcessor;
36
28
37
/**
29
/**
38
 * Utility permitting a user to easily see the effect of changing include
30
 * Utility permitting a user to easily see the effect of changing include
Lines 50-63 Link Here
50
    private File[] roots = {};
42
    private File[] roots = {};
51
    private String includes = "**"; // NOI18N
43
    private String includes = "**"; // NOI18N
52
    private String excludes = ""; // NOI18N
44
    private String excludes = ""; // NOI18N
53
    private final List<ChangeListener> listeners = new ArrayList<ChangeListener>(1);
45
    private final ChangeSupport cs = new ChangeSupport(this);
54
    private IncludeExcludeVisualizerPanel panel;
46
    private IncludeExcludeVisualizerPanel panel;
55
    private SortedSet<File> included = new TreeSet<File>();
56
    private SortedSet<File> excluded = new TreeSet<File>();
57
    private boolean busy = false;
58
    private boolean interrupted = false;
59
    private static final RequestProcessor RP = new RequestProcessor(IncludeExcludeVisualizer.class.getName());
60
    private final RequestProcessor.Task task = RP.create(new RecalculateTask());
61
47
62
    /**
48
    /**
63
     * Create a new visualizer.
49
     * Create a new visualizer.
Lines 79-85 Link Here
79
            }
65
            }
80
        }
66
        }
81
        this.roots = roots;
67
        this.roots = roots;
82
        recalculate();
68
        updateFields();
83
    }
69
    }
84
70
85
    /**
71
    /**
Lines 98-105 Link Here
98
    public synchronized void setIncludePattern(String pattern) {
84
    public synchronized void setIncludePattern(String pattern) {
99
        Parameters.notNull("pattern", pattern);
85
        Parameters.notNull("pattern", pattern);
100
        includes = pattern;
86
        includes = pattern;
101
        updateIncludesExcludes();
87
        updateFields();
102
        recalculate();
103
    }
88
    }
104
89
105
    /**
90
    /**
Lines 118-132 Link Here
118
    public synchronized void setExcludePattern(String pattern) {
103
    public synchronized void setExcludePattern(String pattern) {
119
        Parameters.notNull("pattern", pattern);
104
        Parameters.notNull("pattern", pattern);
120
        excludes = pattern;
105
        excludes = pattern;
121
        updateIncludesExcludes();
106
        updateFields();
122
        recalculate();
123
    }
107
    }
124
108
125
    private synchronized void updateIncludesExcludes() {
109
    private synchronized void updateFields() {
126
        if (panel != null) {
110
        if (panel != null) {
127
            EventQueue.invokeLater(new Runnable() {
111
            EventQueue.invokeLater(new Runnable() {
128
                public void run() {
112
                public void run() {
129
                    panel.setFields(includes, excludes);
113
                    panel.setFields(includes, excludes, roots);
130
                }
114
                }
131
            });
115
            });
132
        }
116
        }
Lines 137-143 Link Here
137
     * @param l the listener
121
     * @param l the listener
138
     */
122
     */
139
    public synchronized void addChangeListener(ChangeListener l) {
123
    public synchronized void addChangeListener(ChangeListener l) {
140
        listeners.add(l);
124
        cs.addChangeListener(l);
141
    }
125
    }
142
126
143
    /**
127
    /**
Lines 145-151 Link Here
145
     * @param l the listener
129
     * @param l the listener
146
     */
130
     */
147
    public synchronized void removeChangeListener(ChangeListener l) {
131
    public synchronized void removeChangeListener(ChangeListener l) {
148
        listeners.remove(l);
132
        cs.removeChangeListener(l);
149
    }
133
    }
150
134
151
    /**
135
    /**
Lines 154-170 Link Here
154
    synchronized void changedPatterns(String includes, String excludes) {
138
    synchronized void changedPatterns(String includes, String excludes) {
155
        this.includes = includes;
139
        this.includes = includes;
156
        this.excludes = excludes;
140
        this.excludes = excludes;
157
        recalculate();
141
        cs.fireChange();
158
        fireChange();
159
    }
142
    }
160
143
161
    private synchronized void fireChange() {
162
        ChangeEvent e = new ChangeEvent(this);
163
        for (ChangeListener l : listeners) {
164
            l.stateChanged(e);
165
        }
166
    }
167
168
    /**
144
    /**
169
     * Get the associated visual panel.
145
     * Get the associated visual panel.
170
     * @return a panel displaying this include and exclude information
146
     * @return a panel displaying this include and exclude information
Lines 176-269 Link Here
176
        }
152
        }
177
        if (panel == null) {
153
        if (panel == null) {
178
            panel = new IncludeExcludeVisualizerPanel(this);
154
            panel = new IncludeExcludeVisualizerPanel(this);
179
            panel.setFields(includes, excludes);
155
            panel.setFields(includes, excludes, roots);
180
            panel.setFiles(included.toArray(new File[included.size()]), excluded.toArray(new File[excluded.size()]), busy);
181
        }
156
        }
182
        return panel;
157
        return panel;
183
    }
158
    }
184
159
185
    private static final int DELAY = 200;
186
    private synchronized void recalculate() {
187
        interrupted = true;
188
        task.schedule(DELAY);
189
    }
160
    }
190
191
    private void updateFiles() {
192
        assert Thread.holdsLock(this);
193
        EventQueue.invokeLater(new Runnable() {
194
            public void run() {
195
                synchronized (IncludeExcludeVisualizer.this) {
196
                    if (panel != null) {
197
                        panel.setFiles(included.toArray(new File[included.size()]), excluded.toArray(new File[excluded.size()]), busy);
198
                    }
199
                }
200
            }
201
        });
202
    }
203
204
    private int scanCounter;
205
    private static final int GRANULARITY = 1000;
206
    private void scan(File d, String prefix, PathMatcher matcher, Pattern ignoredFiles) {
207
        String[] children = d.list();
208
        if (children == null) {
209
            return;
210
        }
211
        for (String child : children) {
212
            if (ignoredFiles.matcher(child).find()) {
213
                continue;
214
            }
215
            File f = new File(d, child);
216
            boolean dir = f.isDirectory();
217
            if (dir) {
218
                scan(f, prefix + child + "/", matcher, ignoredFiles); // NOI18N
219
            } else {
220
                synchronized (this) {
221
                    if (interrupted) {
222
                        return;
223
                    }
224
                    if (matcher.matches(prefix + child, false)) {
225
                        included.add(f);
226
                    } else {
227
                        excluded.add(f);
228
                    }
229
                    if (++scanCounter % GRANULARITY == 0) {
230
                        updateFiles();
231
                    }
232
                }
233
            }
234
        }
235
    }
236
237
    private final class RecalculateTask implements Runnable {
238
239
        // XXX #95974: VisibilityQuery only works on FileObject, and that would be too slow
240
        // copied from: org.netbeans.modules.masterfs.GlobalVisibilityQueryImpl
241
        final Pattern ignoredFiles = Pattern.compile(NbPreferences.root().node("/org/netbeans/core"). // NOI18N
242
                get("IgnoredFiles", "^(CVS|SCCS|vssver\\.scc|#.*#|%.*%|\\.(cvsignore|svn|DS_Store)|_svn)$|~$|^\\..*$")); // NOI18N
243
244
        public void run() {
245
            File[] _roots;
246
            String _includes, _excludes;
247
            synchronized (IncludeExcludeVisualizer.this) {
248
                busy = true;
249
                included.clear();
250
                excluded.clear();
251
                _roots = roots.clone();
252
                _includes = includes;
253
                _excludes = excludes;
254
                interrupted = false;
255
                updateFiles();
256
            }
257
            PathMatcher matcher = new PathMatcher(_includes, _excludes, null);
258
            for (File root : _roots) {
259
                scan(root, "", matcher, ignoredFiles);
260
            }
261
            synchronized (IncludeExcludeVisualizer.this) {
262
                busy = false;
263
                updateFiles();
264
            }
265
        }
266
267
    }
268
269
}
(-)java/project/src/org/netbeans/spi/java/project/support/ui/IncludeExcludeVisualizerPanel.form (-66 / +161 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.3" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
3
<Form version="1.4" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
4
  <Properties>
5
    <Property name="name" type="java.lang.String" value="Form" noResource="true"/>
6
  </Properties>
4
  <AuxValues>
7
  <AuxValues>
8
    <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="true"/>
5
    <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
9
    <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
6
    <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
10
    <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
7
    <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="2"/>
11
    <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="2"/>
Lines 13-84 Link Here
13
  <Layout>
17
  <Layout>
14
    <DimensionLayout dim="0">
18
    <DimensionLayout dim="0">
15
      <Group type="103" groupAlignment="0" attributes="0">
19
      <Group type="103" groupAlignment="0" attributes="0">
16
          <Group type="102" alignment="0" attributes="0">
20
          <Group type="102" attributes="0">
17
              <EmptySpace max="-2" attributes="0"/>
18
              <Group type="103" groupAlignment="0" attributes="0">
21
              <Group type="103" groupAlignment="0" attributes="0">
19
                  <Group type="102" attributes="0">
22
                  <Group type="102" attributes="0">
20
                      <Group type="103" groupAlignment="0" attributes="0">
23
                      <Group type="103" groupAlignment="0" attributes="0">
21
                          <Group type="102" alignment="0" attributes="0">
24
                          <Component id="includedListPanel" alignment="0" min="-2" max="-2" attributes="0"/>
22
                              <Group type="103" groupAlignment="0" attributes="0">
25
                          <Component id="includedListLabel" alignment="0" min="-2" max="-2" attributes="0"/>
23
                                  <Component id="includesLabel" alignment="0" min="-2" max="-2" attributes="0"/>
24
                                  <Component id="excludesLabel" alignment="0" min="-2" max="-2" attributes="0"/>
25
                              </Group>
26
                              </Group>
27
                      <EmptySpace min="-2" pref="12" max="-2" attributes="0"/>
28
                      <Group type="103" groupAlignment="1" attributes="0">
29
                          <Component id="excludeButton" max="32767" attributes="1"/>
30
                          <Component id="includeButton" alignment="1" pref="89" max="32767" attributes="1"/>
31
                      </Group>
26
                              <EmptySpace max="-2" attributes="0"/>
32
                              <EmptySpace max="-2" attributes="0"/>
27
                              <Group type="103" groupAlignment="0" attributes="0">
33
                              <Group type="103" groupAlignment="0" attributes="0">
28
                                  <Component id="excludes" alignment="0" pref="371" max="32767" attributes="1"/>
34
                          <Component id="excludedListLabel" min="-2" max="-2" attributes="0"/>
29
                                  <Component id="includes" alignment="0" pref="371" max="32767" attributes="1"/>
35
                          <Component id="excludedListPanel" min="-2" max="-2" attributes="0"/>
30
                              </Group>
36
                              </Group>
31
                          </Group>
37
                          </Group>
32
                          <Component id="scanningLabel" alignment="0" min="-2" max="-2" attributes="0"/>
38
                          <Component id="scanningLabel" alignment="0" min="-2" max="-2" attributes="0"/>
33
                          <Component id="includedListLabel" alignment="0" min="-2" max="-2" attributes="0"/>
39
                  <Component id="advancedPanel" alignment="0" max="32767" attributes="0"/>
34
                      </Group>
40
                      </Group>
35
                      <EmptySpace max="-2" attributes="0"/>
41
                      <EmptySpace max="-2" attributes="0"/>
36
                  </Group>
42
                  </Group>
43
      </Group>
44
    </DimensionLayout>
45
    <DimensionLayout dim="1">
46
      <Group type="103" groupAlignment="0" attributes="0">
37
                  <Group type="102" alignment="0" attributes="0">
47
                  <Group type="102" alignment="0" attributes="0">
48
              <Group type="103" groupAlignment="0" attributes="0">
49
                  <Component id="includedListLabel" min="-2" max="-2" attributes="0"/>
38
                      <Component id="excludedListLabel" min="-2" max="-2" attributes="0"/>
50
                      <Component id="excludedListLabel" min="-2" max="-2" attributes="0"/>
39
                      <EmptySpace pref="361" max="32767" attributes="0"/>
40
                  </Group>
51
                  </Group>
41
                  <Group type="102" alignment="1" attributes="0">
42
                      <Component id="includedListPane" pref="440" max="32767" attributes="0"/>
43
                      <EmptySpace max="-2" attributes="0"/>
52
                      <EmptySpace max="-2" attributes="0"/>
44
                  </Group>
53
              <Group type="103" groupAlignment="0" attributes="0">
45
                  <Group type="102" alignment="1" attributes="0">
54
                  <Group type="102" alignment="1" attributes="0">
46
                      <Group type="103" groupAlignment="1" attributes="0">
55
                      <Component id="excludeButton" min="-2" max="-2" attributes="0"/>
47
                          <Component id="explanation" alignment="1" pref="440" max="32767" attributes="0"/>
48
                          <Component id="excludedListPane" alignment="1" pref="440" max="32767" attributes="0"/>
49
                      </Group>
50
                      <EmptySpace max="-2" attributes="0"/>
56
                      <EmptySpace max="-2" attributes="0"/>
57
                      <Component id="includeButton" min="-2" max="-2" attributes="0"/>
58
                      <EmptySpace min="-2" pref="67" max="-2" attributes="0"/>
51
                  </Group>
59
                  </Group>
52
              </Group>
53
          </Group>
54
      </Group>
55
    </DimensionLayout>
56
    <DimensionLayout dim="1">
57
      <Group type="103" groupAlignment="0" attributes="0">
58
          <Group type="102" alignment="0" attributes="0">
60
          <Group type="102" alignment="0" attributes="0">
59
              <EmptySpace max="-2" attributes="0"/>
61
              <EmptySpace max="-2" attributes="0"/>
60
              <Group type="103" groupAlignment="3" attributes="0">
62
                      <Group type="103" groupAlignment="1" attributes="0">
61
                  <Component id="includesLabel" alignment="3" min="-2" max="-2" attributes="0"/>
63
                          <Component id="excludedListPanel" alignment="0" max="32767" attributes="0"/>
62
                  <Component id="includes" alignment="3" min="-2" max="-2" attributes="0"/>
64
                          <Component id="includedListPanel" alignment="0" min="-2" max="-2" attributes="0"/>
63
              </Group>
65
              </Group>
64
              <EmptySpace max="-2" attributes="0"/>
66
              <EmptySpace max="-2" attributes="0"/>
65
              <Group type="103" groupAlignment="3" attributes="0">
66
                  <Component id="excludesLabel" alignment="3" min="-2" max="-2" attributes="0"/>
67
                  <Component id="excludes" alignment="3" min="-2" max="-2" attributes="0"/>
68
              </Group>
69
              <EmptySpace max="-2" attributes="0"/>
70
              <Component id="scanningLabel" min="-2" max="-2" attributes="0"/>
67
              <Component id="scanningLabel" min="-2" max="-2" attributes="0"/>
71
              <EmptySpace max="-2" attributes="0"/>
68
              <EmptySpace max="-2" attributes="0"/>
72
              <Component id="includedListLabel" min="-2" max="-2" attributes="0"/>
69
                  </Group>
70
              </Group>
73
              <EmptySpace max="-2" attributes="0"/>
71
              <EmptySpace max="-2" attributes="0"/>
74
              <Component id="includedListPane" min="-2" max="-2" attributes="0"/>
72
              <Component id="advancedPanel" min="-2" max="-2" attributes="0"/>
75
              <EmptySpace max="-2" attributes="0"/>
76
              <Component id="excludedListLabel" min="-2" max="-2" attributes="0"/>
77
              <EmptySpace max="-2" attributes="0"/>
78
              <Component id="excludedListPane" min="-2" pref="143" max="-2" attributes="0"/>
79
              <EmptySpace max="-2" attributes="0"/>
80
              <Component id="explanation" pref="40" max="32767" attributes="0"/>
81
              <EmptySpace max="-2" attributes="0"/>
82
          </Group>
73
          </Group>
83
      </Group>
74
      </Group>
84
    </DimensionLayout>
75
    </DimensionLayout>
Lines 86-138 Link Here
86
  <SubComponents>
77
  <SubComponents>
87
    <Component class="javax.swing.JLabel" name="includedListLabel">
78
    <Component class="javax.swing.JLabel" name="includedListLabel">
88
      <Properties>
79
      <Properties>
89
        <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
90
          <ComponentRef name="includedList"/>
91
        </Property>
92
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
80
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
93
          <ResourceString bundle="org/netbeans/spi/java/project/support/ui/Bundle.properties" key="IncludeExcludeVisualizerPanel.includedListLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
81
          <ResourceString bundle="org/netbeans/spi/java/project/support/ui/Bundle.properties" key="IncludeExcludeVisualizerPanel.includedListLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
94
        </Property>
82
        </Property>
83
        <Property name="name" type="java.lang.String" value="includedListLabel" noResource="true"/>
95
      </Properties>
84
      </Properties>
96
    </Component>
85
    </Component>
97
    <Container class="javax.swing.JScrollPane" name="includedListPane">
86
    <Container class="javax.swing.JPanel" name="includedListPanel">
98
      <AuxValues>
87
      <Properties>
99
        <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
88
        <Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
100
      </AuxValues>
89
          <Color blue="cc" green="33" red="ff" type="rgb"/>
90
        </Property>
91
        <Property name="name" type="java.lang.String" value="includedListPanel" noResource="true"/>
92
      </Properties>
101
93
102
      <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
94
      <Layout>
103
      <SubComponents>
95
        <DimensionLayout dim="0">
104
        <Component class="javax.swing.JList" name="includedList">
96
          <Group type="103" groupAlignment="0" attributes="0">
105
        </Component>
97
              <EmptySpace min="0" pref="274" max="32767" attributes="0"/>
106
      </SubComponents>
98
          </Group>
99
        </DimensionLayout>
100
        <DimensionLayout dim="1">
101
          <Group type="103" groupAlignment="0" attributes="0">
102
              <EmptySpace min="0" pref="143" max="32767" attributes="0"/>
103
          </Group>
104
        </DimensionLayout>
105
      </Layout>
107
    </Container>
106
    </Container>
108
    <Component class="javax.swing.JLabel" name="excludedListLabel">
107
    <Component class="javax.swing.JLabel" name="excludedListLabel">
109
      <Properties>
108
      <Properties>
110
        <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
111
          <ComponentRef name="excludedList"/>
112
        </Property>
113
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
109
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
114
          <ResourceString bundle="org/netbeans/spi/java/project/support/ui/Bundle.properties" key="IncludeExcludeVisualizerPanel.excludedListLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
110
          <ResourceString bundle="org/netbeans/spi/java/project/support/ui/Bundle.properties" key="IncludeExcludeVisualizerPanel.excludedListLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
115
        </Property>
111
        </Property>
112
        <Property name="name" type="java.lang.String" value="excludedListLabel" noResource="true"/>
116
      </Properties>
113
      </Properties>
117
    </Component>
114
    </Component>
118
    <Container class="javax.swing.JScrollPane" name="excludedListPane">
115
    <Component class="javax.swing.JButton" name="excludeButton">
119
      <AuxValues>
116
      <Properties>
120
        <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
117
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
121
      </AuxValues>
118
          <ResourceString bundle="org/netbeans/spi/java/project/support/ui/Bundle.properties" key="IncludeExcludeVisualizerPanel.excludeButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
122
119
        </Property>
123
      <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
120
        <Property name="name" type="java.lang.String" value="excludeButton" noResource="true"/>
124
      <SubComponents>
121
      </Properties>
125
        <Component class="javax.swing.JList" name="excludedList">
122
      <Events>
123
        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="excludeButtonActionPerformed"/>
124
      </Events>
126
        </Component>
125
        </Component>
127
      </SubComponents>
126
    <Component class="javax.swing.JButton" name="includeButton">
128
    </Container>
127
      <Properties>
128
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
129
          <ResourceString bundle="org/netbeans/spi/java/project/support/ui/Bundle.properties" key="IncludeExcludeVisualizerPanel.includeButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
130
        </Property>
131
        <Property name="name" type="java.lang.String" value="includeButton" noResource="true"/>
132
      </Properties>
133
      <Events>
134
        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="includeButtonActionPerformed"/>
135
      </Events>
136
    </Component>
129
    <Component class="javax.swing.JLabel" name="scanningLabel">
137
    <Component class="javax.swing.JLabel" name="scanningLabel">
130
      <Properties>
138
      <Properties>
131
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
139
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
132
          <ResourceString bundle="org/netbeans/spi/java/project/support/ui/Bundle.properties" key="IncludeExcludeVisualizerPanel.scanningLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
140
          <ResourceString bundle="org/netbeans/spi/java/project/support/ui/Bundle.properties" key="IncludeExcludeVisualizerPanel.scanningLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
133
        </Property>
141
        </Property>
142
        <Property name="name" type="java.lang.String" value="scanningLabel" noResource="true"/>
134
      </Properties>
143
      </Properties>
135
    </Component>
144
    </Component>
145
    <Container class="javax.swing.JPanel" name="advancedPanel">
146
      <Properties>
147
        <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
148
          <Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
149
            <TitledBorder title="Advanced:">
150
              <ResourceString PropertyName="titleX" bundle="org/netbeans/spi/java/project/support/ui/Bundle.properties" key="IncludeExcludeVisualizerPanel.border.advancedPanel.title" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
151
            </TitledBorder>
152
          </Border>
153
        </Property>
154
        <Property name="name" type="java.lang.String" value="advancedPanel" noResource="true"/>
155
      </Properties>
156
157
      <Layout>
158
        <DimensionLayout dim="0">
159
          <Group type="103" groupAlignment="0" attributes="0">
160
              <Group type="102" attributes="0">
161
                  <EmptySpace max="-2" attributes="0"/>
162
                  <Group type="103" groupAlignment="0" attributes="0">
163
                      <Group type="102" alignment="0" attributes="0">
164
                          <Group type="103" groupAlignment="0" attributes="0">
165
                              <Component id="includesLabel" alignment="0" min="-2" max="-2" attributes="0"/>
166
                              <Component id="excludesLabel" alignment="0" min="-2" max="-2" attributes="0"/>
167
                          </Group>
168
                          <EmptySpace max="-2" attributes="0"/>
169
                          <Group type="103" groupAlignment="0" attributes="0">
170
                              <Component id="excludes" alignment="0" pref="580" max="32767" attributes="1"/>
171
                              <Component id="includes" alignment="0" pref="580" max="32767" attributes="1"/>
172
                          </Group>
173
                      </Group>
174
                      <Component id="explanation" alignment="0" pref="643" max="32767" attributes="0"/>
175
                  </Group>
176
                  <EmptySpace max="-2" attributes="0"/>
177
              </Group>
178
          </Group>
179
        </DimensionLayout>
180
        <DimensionLayout dim="1">
181
          <Group type="103" groupAlignment="0" attributes="0">
182
              <Group type="102" alignment="0" attributes="0">
183
                  <Group type="103" groupAlignment="3" attributes="0">
184
                      <Component id="includesLabel" alignment="3" min="-2" max="-2" attributes="0"/>
185
                      <Component id="includes" alignment="3" min="-2" max="-2" attributes="0"/>
186
                  </Group>
187
                  <EmptySpace max="-2" attributes="0"/>
188
                  <Group type="103" groupAlignment="3" attributes="0">
189
                      <Component id="excludesLabel" alignment="3" min="-2" max="-2" attributes="0"/>
190
                      <Component id="excludes" alignment="3" min="-2" max="-2" attributes="0"/>
191
                  </Group>
192
                  <EmptySpace max="-2" attributes="0"/>
193
                  <Component id="explanation" max="32767" attributes="0"/>
194
              </Group>
195
          </Group>
196
        </DimensionLayout>
197
      </Layout>
198
      <SubComponents>
136
    <Component class="javax.swing.JLabel" name="includesLabel">
199
    <Component class="javax.swing.JLabel" name="includesLabel">
137
      <Properties>
200
      <Properties>
138
        <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
201
        <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
Lines 141-149 Link Here
141
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
204
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
142
          <ResourceString bundle="org/netbeans/spi/java/project/support/ui/Bundle.properties" key="IncludeExcludeVisualizerPanel.includesLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
205
          <ResourceString bundle="org/netbeans/spi/java/project/support/ui/Bundle.properties" key="IncludeExcludeVisualizerPanel.includesLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
143
        </Property>
206
        </Property>
207
            <Property name="name" type="java.lang.String" value="includesLabel" noResource="true"/>
144
      </Properties>
208
      </Properties>
145
    </Component>
209
    </Component>
146
    <Component class="javax.swing.JTextField" name="includes">
210
    <Component class="javax.swing.JTextField" name="includes">
211
          <Properties>
212
            <Property name="name" type="java.lang.String" value="includes" noResource="true"/>
213
          </Properties>
147
    </Component>
214
    </Component>
148
    <Component class="javax.swing.JLabel" name="excludesLabel">
215
    <Component class="javax.swing.JLabel" name="excludesLabel">
149
      <Properties>
216
      <Properties>
Lines 153-168 Link Here
153
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
220
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
154
          <ResourceString bundle="org/netbeans/spi/java/project/support/ui/Bundle.properties" key="IncludeExcludeVisualizerPanel.excludesLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
221
          <ResourceString bundle="org/netbeans/spi/java/project/support/ui/Bundle.properties" key="IncludeExcludeVisualizerPanel.excludesLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
155
        </Property>
222
        </Property>
223
            <Property name="name" type="java.lang.String" value="excludesLabel" noResource="true"/>
156
      </Properties>
224
      </Properties>
157
    </Component>
225
    </Component>
158
    <Component class="javax.swing.JTextField" name="excludes">
226
    <Component class="javax.swing.JTextField" name="excludes">
227
          <Properties>
228
            <Property name="name" type="java.lang.String" value="excludes" noResource="true"/>
229
          </Properties>
159
    </Component>
230
    </Component>
160
    <Component class="javax.swing.JLabel" name="explanation">
231
    <Component class="javax.swing.JLabel" name="explanation">
161
      <Properties>
232
      <Properties>
162
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
233
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
163
          <ResourceString bundle="org/netbeans/spi/java/project/support/ui/Bundle.properties" key="IncludeExcludeVisualizerPanel.explanation.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
234
          <ResourceString bundle="org/netbeans/spi/java/project/support/ui/Bundle.properties" key="IncludeExcludeVisualizerPanel.explanation.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
164
        </Property>
235
        </Property>
236
            <Property name="name" type="java.lang.String" value="explanation" noResource="true"/>
165
      </Properties>
237
      </Properties>
166
    </Component>
238
    </Component>
167
  </SubComponents>
239
  </SubComponents>
240
    </Container>
241
    <Container class="javax.swing.JPanel" name="excludedListPanel">
242
      <Properties>
243
        <Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
244
          <Color blue="33" green="ff" red="33" type="rgb"/>
245
        </Property>
246
        <Property name="name" type="java.lang.String" value="excludedListPanel" noResource="true"/>
247
      </Properties>
248
249
      <Layout>
250
        <DimensionLayout dim="0">
251
          <Group type="103" groupAlignment="0" attributes="0">
252
              <EmptySpace min="0" pref="290" max="32767" attributes="0"/>
253
          </Group>
254
        </DimensionLayout>
255
        <DimensionLayout dim="1">
256
          <Group type="103" groupAlignment="0" attributes="0">
257
              <EmptySpace min="0" pref="143" max="32767" attributes="0"/>
258
          </Group>
259
        </DimensionLayout>
260
      </Layout>
261
    </Container>
262
  </SubComponents>
168
</Form>
263
</Form>
(-)java/project/src/org/netbeans/spi/java/project/support/ui/IncludeExcludeVisualizerPanel.java (-62 / +329 lines)
Lines 20-38 Link Here
20
package org.netbeans.spi.java.project.support.ui;
20
package org.netbeans.spi.java.project.support.ui;
21
21
22
import java.awt.EventQueue;
22
import java.awt.EventQueue;
23
import java.beans.PropertyChangeEvent;
24
import java.beans.PropertyChangeListener;
23
import java.io.File;
25
import java.io.File;
26
import java.util.Set;
27
import java.util.regex.Pattern;
24
import javax.swing.DefaultListModel;
28
import javax.swing.DefaultListModel;
29
import javax.swing.JFrame;
25
import javax.swing.JPanel;
30
import javax.swing.JPanel;
31
import javax.swing.WindowConstants;
26
import javax.swing.event.DocumentEvent;
32
import javax.swing.event.DocumentEvent;
27
import javax.swing.event.DocumentListener;
33
import javax.swing.event.DocumentListener;
34
import org.netbeans.spi.project.support.ant.PathMatcher;
35
import org.openide.explorer.ExplorerManager;
36
import org.openide.explorer.view.BeanTreeView;
37
import org.openide.nodes.AbstractNode;
38
import org.openide.nodes.Children;
39
import org.openide.nodes.Node;
40
import org.openide.util.NbPreferences;
41
import org.openide.util.RequestProcessor;
42
import org.openide.util.WeakSet;
28
43
29
class IncludeExcludeVisualizerPanel extends JPanel {
44
class IncludeExcludeVisualizerPanel extends JPanel {
30
45
31
    private final IncludeExcludeVisualizer handle;
46
    private final IncludeExcludeVisualizer handle;
47
    private File[] roots;
48
    private String currentIncludes;
49
    private String currentExcludes;
32
    private final DocumentListener listener = new DocumentListener() {
50
    private final DocumentListener listener = new DocumentListener() {
33
        private void changes() {
51
        private void changes() {
34
            handle.changedPatterns(includes.getText(), excludes.getText());
52
            String _includes = includes.getText();
53
            String _excludes = excludes.getText();
54
            synchronized (IncludeExcludeVisualizerPanel.this) {
55
                currentIncludes = _includes;
56
                currentExcludes = _excludes;
35
        }
57
        }
58
            handle.changedPatterns(_includes, _excludes);
59
            recalculate();
60
        }
36
        public void insertUpdate(DocumentEvent e) {
61
        public void insertUpdate(DocumentEvent e) {
37
            changes();
62
            changes();
38
        }
63
        }
Lines 41-81 Link Here
41
        }
66
        }
42
        public void changedUpdate(DocumentEvent e) {}
67
        public void changedUpdate(DocumentEvent e) {}
43
    };
68
    };
44
    private final DefaultListModel includedListModel = new DefaultListModel();
45
    private final DefaultListModel excludedListModel = new DefaultListModel();
46
69
70
    private final ExplorerManager includeSelection = new ExplorerManager();
71
    private final ExplorerManager excludeSelection = new ExplorerManager();
72
47
    public IncludeExcludeVisualizerPanel(IncludeExcludeVisualizer handle) {
73
    public IncludeExcludeVisualizerPanel(IncludeExcludeVisualizer handle) {
48
        this.handle = handle;
74
        this.handle = handle;
49
        initComponents();
75
        initComponents();
50
        includes.getDocument().addDocumentListener(listener);
76
        includes.getDocument().addDocumentListener(listener);
51
        excludes.getDocument().addDocumentListener(listener);
77
        excludes.getDocument().addDocumentListener(listener);
52
        includedList.setModel(includedListModel);
78
        includeSelection.setRootContext(new AbstractNode(includedRoots));
53
        excludedList.setModel(excludedListModel);
79
        excludeSelection.setRootContext(new AbstractNode(excludedRoots));
80
        class ExplorerPanel extends JPanel implements ExplorerManager.Provider {
81
            final ExplorerManager mgr;
82
            ExplorerPanel(ExplorerManager mgr) {
83
                this.mgr = mgr;
84
                add(new BeanTreeView());
54
    }
85
    }
86
            public ExplorerManager getExplorerManager() {
87
                return mgr;
88
            }
89
        }
90
        includedListPanel.add(new ExplorerPanel(includeSelection));
91
        excludedListPanel.add(new ExplorerPanel(excludeSelection));
92
        PropertyChangeListener updateButtons = new PropertyChangeListener() {
93
            public void propertyChange(PropertyChangeEvent evt) {
94
                // XXX update button states
95
            }
96
        };
97
        includeSelection.addPropertyChangeListener(updateButtons);
98
        excludeSelection.addPropertyChangeListener(updateButtons);
99
    }
55
100
56
    void setFields(String includes, String excludes) {
101
    synchronized void setFields(String includes, String excludes, File[] roots) {
57
        assert EventQueue.isDispatchThread();
102
        assert EventQueue.isDispatchThread();
103
        this.roots = roots;
104
        currentIncludes = includes;
105
        currentExcludes = excludes;
58
        this.includes.getDocument().removeDocumentListener(listener);
106
        this.includes.getDocument().removeDocumentListener(listener);
59
        this.includes.setText(includes);
107
        this.includes.setText(includes);
60
        this.includes.getDocument().addDocumentListener(listener);
108
        this.includes.getDocument().addDocumentListener(listener);
61
        this.excludes.getDocument().removeDocumentListener(listener);
109
        this.excludes.getDocument().removeDocumentListener(listener);
62
        this.excludes.setText(excludes);
110
        this.excludes.setText(excludes);
63
        this.excludes.getDocument().addDocumentListener(listener);
111
        this.excludes.getDocument().addDocumentListener(listener);
112
        recalculate();
64
    }
113
    }
65
114
66
    void setFiles(File[] included, File[] excluded, boolean busy) {
115
    //private boolean interrupted;
67
        assert EventQueue.isDispatchThread();
116
    private static final RequestProcessor RP = new RequestProcessor(IncludeExcludeVisualizerPanel.class.getName());
68
        includedListModel.clear();
117
    private final RequestProcessor.Task task = RP.create(new RecalculateTask());
69
        for (File f : included) {
118
    private static final int DELAY = 200;
70
            includedListModel.addElement(f);
119
    private synchronized void recalculate() {
120
        //interrupted = true;
121
        task.schedule(DELAY);
71
        }
122
        }
72
        excludedListModel.clear();
123
    
73
        for (File f : excluded) {
124
    private final class RecalculateTask implements Runnable {
74
            excludedListModel.addElement(f);
125
126
        public void run() {
127
            scanningLabel.setVisible(true);
128
            File[] _roots;
129
            String _includes, _excludes;
130
            synchronized (IncludeExcludeVisualizerPanel.this) {
131
                //interrupted = false;
132
                _roots = roots.clone();
133
                _includes = currentIncludes;
134
                _excludes = currentExcludes;
75
        }
135
        }
76
        scanningLabel.setVisible(busy);
136
            includedRoots.update(roots, _includes, _excludes);
137
            excludedRoots.update(roots, _includes, _excludes);
138
            scanningLabel.setVisible(false);
77
    }
139
    }
78
140
141
    }
142
143
    // XXX #95974: VisibilityQuery only works on FileObject, and that would be too slow
144
    // copied from: org.netbeans.modules.masterfs.GlobalVisibilityQueryImpl
145
    private final Pattern ignoredFiles = Pattern.compile(NbPreferences.root().node("/org/netbeans/core").get("IgnoredFiles", // NOI18N
146
            "^(CVS|SCCS|vssver\\.scc|#.*#|%.*%|\\.(cvsignore|svn|DS_Store)|_svn)$|~$|^\\..*$")); // NOI18N
147
148
                    /*
149
    private void scan(File d, String prefix, PathMatcher matcher) {
150
        String[] children = d.list();
151
        if (children == null) {
152
            return;
153
        }
154
        for (String child : children) {
155
            if (ignoredFiles.matcher(child).find()) {
156
                continue;
157
            }
158
            File f = new File(d, child);
159
            boolean dir = f.isDirectory();
160
            if (dir) {
161
                scan(f, prefix + child + "/", matcher); // NOI18N
162
            } else {
163
                synchronized (this) {
164
                    if (interrupted) {
165
                        return;
166
                    }
167
                    if (matcher.matches(prefix + child, false)) {
168
                        included.add(f);
169
                    } else {
170
                        excluded.add(f);
171
                    }
172
                }
173
            }
174
        }
175
    }
176
                     */
177
178
    private final RootChildren includedRoots = new RootChildren(true);
179
    private final RootChildren excludedRoots = new RootChildren(false);
180
181
    private final class RootChildren extends Children.Keys<File> {
182
183
        private final boolean includeMode;
184
        private String includes;
185
        private String excludes;
186
        
187
        RootChildren(boolean includeMode) {
188
            this.includeMode = includeMode;
189
        }
190
191
        void update(File[] roots, String includes, String excludes) {
192
            this.includes = includes;
193
            this.excludes = excludes;
194
            setKeys(roots);
195
            for (Node n : getNodes(true)) {
196
                //XXX((FileNode) n).update(matcher);
197
            }
198
        }
199
200
        protected Node[] createNodes(File file) {
201
            return new Node[] {new FileNode(file, true, new PathMatcher(includes, excludes, file))};
202
        }
203
204
    }
205
    
206
    private final class FileNode extends AbstractNode {
207
        
208
        private final File file;
209
        private boolean top;
210
        private PathMatcher matcher;
211
212
        FileNode(File file, boolean top, PathMatcher matcher) {
213
            super(file.isDirectory() ? new FileChildren(file) : Children.LEAF);
214
            this.file = file;
215
            this.top = top;
216
        }
217
218
        public @Override String getDisplayName() {
219
            return top ? file.getAbsolutePath() : file.getName();
220
        }
221
        
222
    }
223
    
224
    private final class FileChildren extends Children.Keys<File> {
225
        
226
        private final File file;
227
        private PathMatcher matcher;
228
229
        FileChildren(File file, PathMatcher matcher) {
230
            this.file = file;
231
        }
232
233
        protected @Override void addNotify() {
234
            super.addNotify();
235
            
236
        }
237
238
        protected Node[] createNodes(File key) {
239
            return new Node[] {new FileNode(key, false)};
240
        }
241
        
242
    }
243
79
    /** This method is called from within the constructor to
244
    /** This method is called from within the constructor to
80
     * initialize the form.
245
     * initialize the form.
81
     * WARNING: Do NOT modify this code. The content of this method is
246
     * WARNING: Do NOT modify this code. The content of this method is
Lines 85-195 Link Here
85
    private void initComponents() {
250
    private void initComponents() {
86
251
87
        includedListLabel = new javax.swing.JLabel();
252
        includedListLabel = new javax.swing.JLabel();
88
        includedListPane = new javax.swing.JScrollPane();
253
        includedListPanel = new javax.swing.JPanel();
89
        includedList = new javax.swing.JList();
90
        excludedListLabel = new javax.swing.JLabel();
254
        excludedListLabel = new javax.swing.JLabel();
91
        excludedListPane = new javax.swing.JScrollPane();
255
        excludeButton = new javax.swing.JButton();
92
        excludedList = new javax.swing.JList();
256
        includeButton = new javax.swing.JButton();
93
        scanningLabel = new javax.swing.JLabel();
257
        scanningLabel = new javax.swing.JLabel();
258
        advancedPanel = new javax.swing.JPanel();
94
        includesLabel = new javax.swing.JLabel();
259
        includesLabel = new javax.swing.JLabel();
95
        includes = new javax.swing.JTextField();
260
        includes = new javax.swing.JTextField();
96
        excludesLabel = new javax.swing.JLabel();
261
        excludesLabel = new javax.swing.JLabel();
97
        excludes = new javax.swing.JTextField();
262
        excludes = new javax.swing.JTextField();
98
        explanation = new javax.swing.JLabel();
263
        explanation = new javax.swing.JLabel();
264
        excludedListPanel = new javax.swing.JPanel();
99
265
100
        includedListLabel.setLabelFor(includedList);
266
        setName("Form"); // NOI18N
267
101
        org.openide.awt.Mnemonics.setLocalizedText(includedListLabel, org.openide.util.NbBundle.getMessage(IncludeExcludeVisualizerPanel.class, "IncludeExcludeVisualizerPanel.includedListLabel.text")); // NOI18N
268
        org.openide.awt.Mnemonics.setLocalizedText(includedListLabel, org.openide.util.NbBundle.getMessage(IncludeExcludeVisualizerPanel.class, "IncludeExcludeVisualizerPanel.includedListLabel.text")); // NOI18N
269
        includedListLabel.setName("includedListLabel"); // NOI18N
102
270
103
        includedListPane.setViewportView(includedList);
271
        includedListPanel.setBackground(new java.awt.Color(255, 51, 204));
272
        includedListPanel.setName("includedListPanel"); // NOI18N
104
273
105
        excludedListLabel.setLabelFor(excludedList);
274
        org.jdesktop.layout.GroupLayout includedListPanelLayout = new org.jdesktop.layout.GroupLayout(includedListPanel);
275
        includedListPanel.setLayout(includedListPanelLayout);
276
        includedListPanelLayout.setHorizontalGroup(
277
            includedListPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
278
            .add(0, 274, Short.MAX_VALUE)
279
        );
280
        includedListPanelLayout.setVerticalGroup(
281
            includedListPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
282
            .add(0, 143, Short.MAX_VALUE)
283
        );
284
106
        org.openide.awt.Mnemonics.setLocalizedText(excludedListLabel, org.openide.util.NbBundle.getMessage(IncludeExcludeVisualizerPanel.class, "IncludeExcludeVisualizerPanel.excludedListLabel.text")); // NOI18N
285
        org.openide.awt.Mnemonics.setLocalizedText(excludedListLabel, org.openide.util.NbBundle.getMessage(IncludeExcludeVisualizerPanel.class, "IncludeExcludeVisualizerPanel.excludedListLabel.text")); // NOI18N
286
        excludedListLabel.setName("excludedListLabel"); // NOI18N
107
287
108
        excludedListPane.setViewportView(excludedList);
288
        org.openide.awt.Mnemonics.setLocalizedText(excludeButton, org.openide.util.NbBundle.getMessage(IncludeExcludeVisualizerPanel.class, "IncludeExcludeVisualizerPanel.excludeButton.text")); // NOI18N
289
        excludeButton.setName("excludeButton"); // NOI18N
290
        excludeButton.addActionListener(new java.awt.event.ActionListener() {
291
            public void actionPerformed(java.awt.event.ActionEvent evt) {
292
                excludeButtonActionPerformed(evt);
293
            }
294
        });
109
295
296
        org.openide.awt.Mnemonics.setLocalizedText(includeButton, org.openide.util.NbBundle.getMessage(IncludeExcludeVisualizerPanel.class, "IncludeExcludeVisualizerPanel.includeButton.text")); // NOI18N
297
        includeButton.setName("includeButton"); // NOI18N
298
        includeButton.addActionListener(new java.awt.event.ActionListener() {
299
            public void actionPerformed(java.awt.event.ActionEvent evt) {
300
                includeButtonActionPerformed(evt);
301
            }
302
        });
303
110
        org.openide.awt.Mnemonics.setLocalizedText(scanningLabel, org.openide.util.NbBundle.getMessage(IncludeExcludeVisualizerPanel.class, "IncludeExcludeVisualizerPanel.scanningLabel.text")); // NOI18N
304
        org.openide.awt.Mnemonics.setLocalizedText(scanningLabel, org.openide.util.NbBundle.getMessage(IncludeExcludeVisualizerPanel.class, "IncludeExcludeVisualizerPanel.scanningLabel.text")); // NOI18N
305
        scanningLabel.setName("scanningLabel"); // NOI18N
111
306
307
        advancedPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(org.openide.util.NbBundle.getMessage(IncludeExcludeVisualizerPanel.class, "IncludeExcludeVisualizerPanel.border.advancedPanel.title"))); // NOI18N
308
        advancedPanel.setName("advancedPanel"); // NOI18N
309
112
        includesLabel.setLabelFor(includes);
310
        includesLabel.setLabelFor(includes);
113
        org.openide.awt.Mnemonics.setLocalizedText(includesLabel, org.openide.util.NbBundle.getMessage(IncludeExcludeVisualizerPanel.class, "IncludeExcludeVisualizerPanel.includesLabel.text")); // NOI18N
311
        org.openide.awt.Mnemonics.setLocalizedText(includesLabel, org.openide.util.NbBundle.getMessage(IncludeExcludeVisualizerPanel.class, "IncludeExcludeVisualizerPanel.includesLabel.text")); // NOI18N
312
        includesLabel.setName("includesLabel"); // NOI18N
114
313
314
        includes.setName("includes"); // NOI18N
315
115
        excludesLabel.setLabelFor(excludes);
316
        excludesLabel.setLabelFor(excludes);
116
        org.openide.awt.Mnemonics.setLocalizedText(excludesLabel, org.openide.util.NbBundle.getMessage(IncludeExcludeVisualizerPanel.class, "IncludeExcludeVisualizerPanel.excludesLabel.text")); // NOI18N
317
        org.openide.awt.Mnemonics.setLocalizedText(excludesLabel, org.openide.util.NbBundle.getMessage(IncludeExcludeVisualizerPanel.class, "IncludeExcludeVisualizerPanel.excludesLabel.text")); // NOI18N
318
        excludesLabel.setName("excludesLabel"); // NOI18N
117
319
320
        excludes.setName("excludes"); // NOI18N
321
118
        org.openide.awt.Mnemonics.setLocalizedText(explanation, org.openide.util.NbBundle.getMessage(IncludeExcludeVisualizerPanel.class, "IncludeExcludeVisualizerPanel.explanation.text")); // NOI18N
322
        org.openide.awt.Mnemonics.setLocalizedText(explanation, org.openide.util.NbBundle.getMessage(IncludeExcludeVisualizerPanel.class, "IncludeExcludeVisualizerPanel.explanation.text")); // NOI18N
323
        explanation.setName("explanation"); // NOI18N
119
324
325
        org.jdesktop.layout.GroupLayout advancedPanelLayout = new org.jdesktop.layout.GroupLayout(advancedPanel);
326
        advancedPanel.setLayout(advancedPanelLayout);
327
        advancedPanelLayout.setHorizontalGroup(
328
            advancedPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
329
            .add(advancedPanelLayout.createSequentialGroup()
330
                .addContainerGap()
331
                .add(advancedPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
332
                    .add(advancedPanelLayout.createSequentialGroup()
333
                        .add(advancedPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
334
                            .add(includesLabel)
335
                            .add(excludesLabel))
336
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
337
                        .add(advancedPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
338
                            .add(excludes, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 567, Short.MAX_VALUE)
339
                            .add(includes, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 567, Short.MAX_VALUE)))
340
                    .add(explanation, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 630, Short.MAX_VALUE))
341
                .addContainerGap())
342
        );
343
        advancedPanelLayout.setVerticalGroup(
344
            advancedPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
345
            .add(advancedPanelLayout.createSequentialGroup()
346
                .add(advancedPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
347
                    .add(includesLabel)
348
                    .add(includes, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
349
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
350
                .add(advancedPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
351
                    .add(excludesLabel)
352
                    .add(excludes, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
353
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
354
                .add(explanation, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
355
        );
356
357
        excludedListPanel.setBackground(new java.awt.Color(51, 255, 51));
358
        excludedListPanel.setName("excludedListPanel"); // NOI18N
359
360
        org.jdesktop.layout.GroupLayout excludedListPanelLayout = new org.jdesktop.layout.GroupLayout(excludedListPanel);
361
        excludedListPanel.setLayout(excludedListPanelLayout);
362
        excludedListPanelLayout.setHorizontalGroup(
363
            excludedListPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
364
            .add(0, 290, Short.MAX_VALUE)
365
        );
366
        excludedListPanelLayout.setVerticalGroup(
367
            excludedListPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
368
            .add(0, 143, Short.MAX_VALUE)
369
        );
370
120
        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
371
        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
121
        this.setLayout(layout);
372
        this.setLayout(layout);
122
        layout.setHorizontalGroup(
373
        layout.setHorizontalGroup(
123
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
374
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
124
            .add(layout.createSequentialGroup()
375
            .add(layout.createSequentialGroup()
125
                .addContainerGap()
126
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
376
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
127
                    .add(layout.createSequentialGroup()
377
                    .add(layout.createSequentialGroup()
128
                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
378
                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
129
                            .add(layout.createSequentialGroup()
379
                            .add(includedListPanel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
130
                                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
380
                            .add(includedListLabel))
131
                                    .add(includesLabel)
381
                        .add(12, 12, 12)
132
                                    .add(excludesLabel))
382
                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
383
                            .add(excludeButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
384
                            .add(includeButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 76, Short.MAX_VALUE))
133
                                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
385
                                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
134
                                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
386
                                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
135
                                    .add(excludes, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 371, Short.MAX_VALUE)
387
                            .add(excludedListLabel)
136
                                    .add(includes, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 371, Short.MAX_VALUE)))
388
                            .add(excludedListPanel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
137
                            .add(scanningLabel)
389
                            .add(scanningLabel)
138
                            .add(includedListLabel))
390
                    .add(advancedPanel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
139
                        .addContainerGap())
391
                        .addContainerGap())
140
                    .add(layout.createSequentialGroup()
141
                        .add(excludedListLabel)
142
                        .addContainerGap(361, Short.MAX_VALUE))
143
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
144
                        .add(includedListPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 440, Short.MAX_VALUE)
145
                        .addContainerGap())
146
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
147
                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
148
                            .add(explanation, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 440, Short.MAX_VALUE)
149
                            .add(excludedListPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 440, Short.MAX_VALUE))
150
                        .addContainerGap())))
151
        );
392
        );
152
        layout.setVerticalGroup(
393
        layout.setVerticalGroup(
153
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
394
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
154
            .add(layout.createSequentialGroup()
395
            .add(layout.createSequentialGroup()
155
                .addContainerGap()
396
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
156
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
157
                    .add(includesLabel)
158
                    .add(includes, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
159
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
160
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
161
                    .add(excludesLabel)
162
                    .add(excludes, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
163
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
164
                .add(scanningLabel)
165
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
166
                .add(includedListLabel)
397
                .add(includedListLabel)
398
                    .add(excludedListLabel))
167
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
399
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
168
                .add(includedListPane, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
400
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
401
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
402
                        .add(excludeButton)
169
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
403
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
170
                .add(excludedListLabel)
404
                        .add(includeButton)
405
                        .add(67, 67, 67))
406
                    .add(layout.createSequentialGroup()
171
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
407
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
172
                .add(excludedListPane, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 143, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
408
                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
409
                            .add(org.jdesktop.layout.GroupLayout.LEADING, excludedListPanel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
410
                            .add(org.jdesktop.layout.GroupLayout.LEADING, includedListPanel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
173
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
411
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
174
                .add(explanation, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 40, Short.MAX_VALUE)
412
                        .add(scanningLabel)
175
                .addContainerGap())
413
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)))
414
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
415
                .add(advancedPanel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
176
        );
416
        );
177
    }// </editor-fold>//GEN-END:initComponents
417
    }// </editor-fold>//GEN-END:initComponents
178
418
419
    private void includeButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_includeButtonActionPerformed
420
        // XXX
421
}//GEN-LAST:event_includeButtonActionPerformed
179
422
423
    private void excludeButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_excludeButtonActionPerformed
424
        // XXX
425
    }//GEN-LAST:event_excludeButtonActionPerformed
426
427
180
    // Variables declaration - do not modify//GEN-BEGIN:variables
428
    // Variables declaration - do not modify//GEN-BEGIN:variables
181
    private javax.swing.JList excludedList;
429
    private javax.swing.JPanel advancedPanel;
430
    private javax.swing.JButton excludeButton;
182
    private javax.swing.JLabel excludedListLabel;
431
    private javax.swing.JLabel excludedListLabel;
183
    private javax.swing.JScrollPane excludedListPane;
432
    private javax.swing.JPanel excludedListPanel;
184
    private javax.swing.JTextField excludes;
433
    private javax.swing.JTextField excludes;
185
    private javax.swing.JLabel excludesLabel;
434
    private javax.swing.JLabel excludesLabel;
186
    private javax.swing.JLabel explanation;
435
    private javax.swing.JLabel explanation;
187
    private javax.swing.JList includedList;
436
    private javax.swing.JButton includeButton;
188
    private javax.swing.JLabel includedListLabel;
437
    private javax.swing.JLabel includedListLabel;
189
    private javax.swing.JScrollPane includedListPane;
438
    private javax.swing.JPanel includedListPanel;
190
    private javax.swing.JTextField includes;
439
    private javax.swing.JTextField includes;
191
    private javax.swing.JLabel includesLabel;
440
    private javax.swing.JLabel includesLabel;
192
    private javax.swing.JLabel scanningLabel;
441
    private javax.swing.JLabel scanningLabel;
193
    // End of variables declaration//GEN-END:variables
442
    // End of variables declaration//GEN-END:variables
194
443
444
    public static void main(final String[] args) {
445
        EventQueue.invokeAndWait(new Runnable() {
446
            public void run() {
447
                IncludeExcludeVisualizer iev = new IncludeExcludeVisualizer();
448
                File[] roots = new File[args.length];
449
                for (int i = 0; i < args.length; i++) {
450
                    roots[i] = new File(args[i]);
195
}
451
}
452
                iev.setRoots(roots);
453
                JFrame f = new JFrame("IncludeExcludeVisualizerPanel Test");
454
                f.add(iev.getVisualizerPanel());
455
                f.pack();
456
                f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
457
                f.setVisible(true);
458
            }
459
        });
460
    }
461
462
}

Return to bug 111681