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

(-)a/java.hints.ui/nbproject/project.xml (-1 / +27 lines)
Lines 33-38 Link Here
33
                    </run-dependency>
33
                    </run-dependency>
34
                </dependency>
34
                </dependency>
35
                <dependency>
35
                <dependency>
36
                    <code-name-base>org.netbeans.libs.javacapi</code-name-base>
37
                    <build-prerequisite/>
38
                    <compile-dependency/>
39
                    <run-dependency>
40
                        <specification-version>7.11</specification-version>
41
                    </run-dependency>
42
                </dependency>
43
                <dependency>
36
                    <code-name-base>org.netbeans.modules.code.analysis</code-name-base>
44
                    <code-name-base>org.netbeans.modules.code.analysis</code-name-base>
37
                    <build-prerequisite/>
45
                    <build-prerequisite/>
38
                    <compile-dependency/>
46
                    <compile-dependency/>
Lines 42-47 Link Here
42
                    </run-dependency>
50
                    </run-dependency>
43
                </dependency>
51
                </dependency>
44
                <dependency>
52
                <dependency>
53
                    <code-name-base>org.netbeans.modules.editor.lib2</code-name-base>
54
                    <build-prerequisite/>
55
                    <compile-dependency/>
56
                    <run-dependency>
57
                        <release-version>1</release-version>
58
                        <specification-version>1.66</specification-version>
59
                    </run-dependency>
60
                </dependency>
61
                <dependency>
62
                    <code-name-base>org.netbeans.modules.editor.mimelookup</code-name-base>
63
                    <build-prerequisite/>
64
                    <compile-dependency/>
65
                    <run-dependency>
66
                        <release-version>1</release-version>
67
                        <specification-version>1.27</specification-version>
68
                    </run-dependency>
69
                </dependency>
70
                <dependency>
45
                    <code-name-base>org.netbeans.modules.java.project</code-name-base>
71
                    <code-name-base>org.netbeans.modules.java.project</code-name-base>
46
                    <build-prerequisite/>
72
                    <build-prerequisite/>
47
                    <compile-dependency/>
73
                    <compile-dependency/>
Lines 149-155 Link Here
149
                    <build-prerequisite/>
175
                    <build-prerequisite/>
150
                    <compile-dependency/>
176
                    <compile-dependency/>
151
                    <run-dependency>
177
                    <run-dependency>
152
                        <specification-version>7.60</specification-version>
178
                        <specification-version>8.0</specification-version>
153
                    </run-dependency>
179
                    </run-dependency>
154
                </dependency>
180
                </dependency>
155
                <dependency>
181
                <dependency>
(-)cbdf0aa62e1e (+2 lines)
Added Link Here
1
OnSaveCustomizer.removeUnusedImports.text=Remove Unused Imports
2
OnSaveCustomizer.organizeImports.text=Organize Imports
(-)cbdf0aa62e1e (+63 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8" ?>
2
3
<Form version="1.5" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
4
  <AuxValues>
5
    <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
6
    <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
7
    <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
8
    <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
9
    <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
10
    <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
11
    <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
12
    <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
13
    <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
14
  </AuxValues>
15
16
  <Layout>
17
    <DimensionLayout dim="0">
18
      <Group type="103" groupAlignment="0" attributes="0">
19
          <Group type="102" attributes="0">
20
              <EmptySpace max="-2" attributes="0"/>
21
              <Group type="103" groupAlignment="0" attributes="0">
22
                  <Component id="removeUnusedImports" alignment="0" min="-2" max="-2" attributes="0"/>
23
                  <Component id="organizeImports" alignment="0" min="-2" max="-2" attributes="0"/>
24
              </Group>
25
              <EmptySpace pref="196" max="32767" attributes="0"/>
26
          </Group>
27
      </Group>
28
    </DimensionLayout>
29
    <DimensionLayout dim="1">
30
      <Group type="103" groupAlignment="0" attributes="0">
31
          <Group type="102" alignment="0" attributes="0">
32
              <EmptySpace max="-2" attributes="0"/>
33
              <Component id="removeUnusedImports" min="-2" max="-2" attributes="0"/>
34
              <EmptySpace type="unrelated" max="-2" attributes="0"/>
35
              <Component id="organizeImports" min="-2" max="-2" attributes="0"/>
36
              <EmptySpace pref="242" max="32767" attributes="0"/>
37
          </Group>
38
      </Group>
39
    </DimensionLayout>
40
  </Layout>
41
  <SubComponents>
42
    <Component class="javax.swing.JCheckBox" name="removeUnusedImports">
43
      <Properties>
44
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
45
          <ResourceString bundle="org/netbeans/modules/java/hints/onsave/Bundle.properties" key="OnSaveCustomizer.removeUnusedImports.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
46
        </Property>
47
      </Properties>
48
      <Events>
49
        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="removeUnusedImportsActionPerformed"/>
50
      </Events>
51
    </Component>
52
    <Component class="javax.swing.JCheckBox" name="organizeImports">
53
      <Properties>
54
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
55
          <ResourceString bundle="org/netbeans/modules/java/hints/onsave/Bundle.properties" key="OnSaveCustomizer.organizeImports.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
56
        </Property>
57
      </Properties>
58
      <Events>
59
        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="organizeImportsActionPerformed"/>
60
      </Events>
61
    </Component>
62
  </SubComponents>
63
</Form>
(-)cbdf0aa62e1e (+123 lines)
Added Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2012 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 *
38
 * Contributor(s):
39
 *
40
 * Portions Copyrighted 2012 Sun Microsystems, Inc.
41
 */
42
package org.netbeans.modules.java.hints.onsave;
43
44
import java.util.prefs.Preferences;
45
46
/**
47
 *
48
 * @author lahvac
49
 */
50
public class OnSaveCustomizer extends javax.swing.JPanel {
51
    private final Preferences settings;
52
53
    /**
54
     * Creates new form OnSaveCustomizer
55
     */
56
    public OnSaveCustomizer(Preferences settings) {
57
        initComponents();
58
        this.settings = settings;
59
        removeUnusedImports.setSelected(RemoveUnusedAfterSave.getValue(settings, "Imports_UNUSED"));
60
        organizeImports.setSelected(RemoveUnusedAfterSave.getValue(settings, "org.netbeans.modules.java.hints.OrganizeImports"));
61
    }
62
63
    /**
64
     * This method is called from within the constructor to initialize the form.
65
     * WARNING: Do NOT modify this code. The content of this method is always
66
     * regenerated by the Form Editor.
67
     */
68
    @SuppressWarnings("unchecked")
69
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
70
    private void initComponents() {
71
72
        removeUnusedImports = new javax.swing.JCheckBox();
73
        organizeImports = new javax.swing.JCheckBox();
74
75
        org.openide.awt.Mnemonics.setLocalizedText(removeUnusedImports, org.openide.util.NbBundle.getMessage(OnSaveCustomizer.class, "OnSaveCustomizer.removeUnusedImports.text")); // NOI18N
76
        removeUnusedImports.addActionListener(new java.awt.event.ActionListener() {
77
            public void actionPerformed(java.awt.event.ActionEvent evt) {
78
                removeUnusedImportsActionPerformed(evt);
79
            }
80
        });
81
82
        org.openide.awt.Mnemonics.setLocalizedText(organizeImports, org.openide.util.NbBundle.getMessage(OnSaveCustomizer.class, "OnSaveCustomizer.organizeImports.text")); // NOI18N
83
        organizeImports.addActionListener(new java.awt.event.ActionListener() {
84
            public void actionPerformed(java.awt.event.ActionEvent evt) {
85
                organizeImportsActionPerformed(evt);
86
            }
87
        });
88
89
        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
90
        this.setLayout(layout);
91
        layout.setHorizontalGroup(
92
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
93
            .addGroup(layout.createSequentialGroup()
94
                .addContainerGap()
95
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
96
                    .addComponent(removeUnusedImports)
97
                    .addComponent(organizeImports))
98
                .addContainerGap(196, Short.MAX_VALUE))
99
        );
100
        layout.setVerticalGroup(
101
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
102
            .addGroup(layout.createSequentialGroup()
103
                .addContainerGap()
104
                .addComponent(removeUnusedImports)
105
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
106
                .addComponent(organizeImports)
107
                .addContainerGap(242, Short.MAX_VALUE))
108
        );
109
    }// </editor-fold>//GEN-END:initComponents
110
111
    private void removeUnusedImportsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_removeUnusedImportsActionPerformed
112
        settings.putBoolean(RemoveUnusedAfterSave.KEY_SETTINGS_PREFIX + "Imports_UNUSED", removeUnusedImports.isSelected());
113
    }//GEN-LAST:event_removeUnusedImportsActionPerformed
114
115
    private void organizeImportsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_organizeImportsActionPerformed
116
        settings.putBoolean(RemoveUnusedAfterSave.KEY_SETTINGS_PREFIX + "org.netbeans.modules.java.hints.OrganizeImports", organizeImports.isSelected());
117
    }//GEN-LAST:event_organizeImportsActionPerformed
118
119
    // Variables declaration - do not modify//GEN-BEGIN:variables
120
    private javax.swing.JCheckBox organizeImports;
121
    private javax.swing.JCheckBox removeUnusedImports;
122
    // End of variables declaration//GEN-END:variables
123
}
(-)cbdf0aa62e1e (+90 lines)
Added Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2012 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 *
38
 * Contributor(s):
39
 *
40
 * Portions Copyrighted 2012 Sun Microsystems, Inc.
41
 */
42
package org.netbeans.modules.java.hints.onsave;
43
44
import java.util.prefs.Preferences;
45
import javax.swing.JComponent;
46
import org.netbeans.modules.options.editor.spi.PreferencesCustomizer;
47
import org.openide.util.HelpCtx;
48
49
/**
50
 *
51
 * @author lahvac
52
 */
53
public class OnSavePreferencesCustomizer implements PreferencesCustomizer {
54
55
    private final Preferences preferences;
56
57
    public OnSavePreferencesCustomizer(Preferences preferences) {
58
        this.preferences = preferences;
59
    }
60
    
61
    @Override
62
    public String getId() {
63
        return "java-hints-on-save";
64
    }
65
66
    @Override
67
    public String getDisplayName() {
68
        return "Java";
69
    }
70
71
    @Override
72
    public HelpCtx getHelpCtx() {
73
        return null;
74
    }
75
76
    @Override
77
    public JComponent getComponent() {
78
        return new OnSaveCustomizer(preferences);
79
    }
80
    
81
    public static final class FactoryImpl implements Factory {
82
83
        @Override
84
        public PreferencesCustomizer create(Preferences preferences) {
85
            return new OnSavePreferencesCustomizer(preferences);
86
        }
87
        
88
    }
89
    
90
}
(-)cbdf0aa62e1e (+160 lines)
Added Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2012 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 *
38
 * Contributor(s):
39
 *
40
 * Portions Copyrighted 2012 Sun Microsystems, Inc.
41
 */
42
package org.netbeans.modules.java.hints.onsave;
43
44
import java.io.IOException;
45
import java.util.ArrayList;
46
import java.util.Collection;
47
import java.util.HashMap;
48
import java.util.HashSet;
49
import java.util.List;
50
import java.util.Map;
51
import java.util.Map.Entry;
52
import java.util.Set;
53
import java.util.concurrent.atomic.AtomicBoolean;
54
import java.util.prefs.Preferences;
55
import javax.swing.undo.UndoableEdit;
56
import org.netbeans.api.editor.mimelookup.MimeLookup;
57
import org.netbeans.api.editor.mimelookup.MimePath;
58
import org.netbeans.api.editor.mimelookup.MimeRegistration;
59
import org.netbeans.api.java.source.CompilationController;
60
import org.netbeans.api.java.source.JavaSource;
61
import org.netbeans.api.java.source.ModificationResult;
62
import org.netbeans.api.java.source.Task;
63
import org.netbeans.modules.java.hints.providers.spi.HintDescription;
64
import org.netbeans.modules.java.hints.providers.spi.HintMetadata;
65
import org.netbeans.modules.java.hints.spiimpl.MessageImpl;
66
import org.netbeans.modules.java.hints.spiimpl.RulesManager;
67
import org.netbeans.modules.java.hints.spiimpl.batch.BatchSearch;
68
import org.netbeans.modules.java.hints.spiimpl.batch.BatchSearch.BatchResult;
69
import org.netbeans.modules.java.hints.spiimpl.batch.BatchSearch.Folder;
70
import org.netbeans.modules.java.hints.spiimpl.batch.BatchUtilities;
71
import org.netbeans.modules.java.hints.spiimpl.batch.ProgressHandleWrapper;
72
import org.netbeans.modules.java.hints.spiimpl.batch.Scopes;
73
import org.netbeans.modules.refactoring.spi.RefactoringElementImplementation;
74
import org.netbeans.spi.editor.document.OnSaveTask;
75
import org.openide.filesystems.FileObject;
76
import org.openide.util.Exceptions;
77
78
/**
79
 *
80
 * @author lahvac
81
 */
82
public class RemoveUnusedAfterSave implements OnSaveTask {
83
84
    public static final String KEY_SETTINGS_PREFIX = "on-save.";
85
    
86
    private final Context c;
87
    private final JavaSource javaSource;
88
    private final Set<String> toRun;
89
    private final AtomicBoolean cancel = new AtomicBoolean();
90
91
    public RemoveUnusedAfterSave(Context c, JavaSource javaSource, Set<String> toRun) {
92
        this.c = c;
93
        this.javaSource = javaSource;
94
        this.toRun = toRun;
95
    }
96
    
97
    @Override
98
    public void performTask(UndoableEdit undoEdit) {
99
        try {
100
            List<HintDescription> hints = new ArrayList<HintDescription>();
101
            for (Entry<HintMetadata, ? extends Collection<? extends HintDescription>> e : RulesManager.getInstance().readHints(null, null, cancel).entrySet()) {
102
                if (toRun.contains(e.getKey().id)) {
103
                    hints.addAll(e.getValue());
104
                }
105
            }
106
            FileObject file = javaSource.getFileObjects().iterator().next();
107
            BatchResult batchResult = BatchSearch.findOccurrences(hints, Scopes.specifiedFoldersScope(Folder.convert(file)));
108
            for (ModificationResult mr : BatchUtilities.applyFixes(batchResult, new ProgressHandleWrapper(1), cancel, new ArrayList<RefactoringElementImplementation>(), null, true, new ArrayList<MessageImpl>())) {
109
                mr.commit();
110
            }
111
        } catch (IOException ex) {
112
            Exceptions.printStackTrace(ex);
113
        }
114
    }
115
116
    @Override
117
    public void runLocked(final Runnable run) {
118
        try {
119
            javaSource.runUserActionTask(new Task<CompilationController>() {
120
                @Override public void run(CompilationController parameter) throws Exception {
121
                    run.run();
122
                }
123
            }, true);
124
        } catch (IOException ex) {
125
            throw new IllegalStateException(ex);
126
        }
127
    }
128
    
129
    @MimeRegistration(mimeType="text/x-java", service=Factory.class)
130
    public static class TaskFactory implements Factory {
131
        @Override public OnSaveTask createTask(Context context) {
132
            JavaSource javaSource = JavaSource.forDocument(context.getDocument());
133
            
134
            if (javaSource == null) return null;
135
            
136
            Set<String> toRun = new HashSet<String>();
137
            Preferences settings = MimeLookup.getLookup(MimePath.get("text/x-java")).lookup(Preferences.class);
138
139
            for (Entry<String, Boolean> e : id2DefaultState.entrySet()) {
140
                if (settings.getBoolean(KEY_SETTINGS_PREFIX + e.getKey(), e.getValue())) toRun.add(e.getKey());
141
            }
142
            
143
            if (toRun.isEmpty()) return null;
144
145
            return new RemoveUnusedAfterSave(context, javaSource, toRun);
146
        }
147
    }
148
149
    private static final Map<String, Boolean> id2DefaultState = new HashMap<String, Boolean>();
150
    
151
    static {
152
        id2DefaultState.put("Imports_UNUSED", false);
153
        id2DefaultState.put("org.netbeans.modules.java.hints.OrganizeImports", false);
154
    }
155
    
156
    static boolean getValue(Preferences settings, String id) {
157
        return settings.getBoolean(KEY_SETTINGS_PREFIX + id, id2DefaultState.get(id));
158
    }
159
    
160
}
(-)a/java.hints.ui/src/org/netbeans/modules/java/hints/spiimpl/layer.xml (+10 lines)
Lines 15-20 Link Here
15
                  </folder>
15
                  </folder>
16
              </folder>
16
              </folder>
17
          </folder>
17
          </folder>
18
          <folder name="OnSave">
19
              <folder name="text">
20
                  <folder name="x-java">
21
                      <file name="JavaHints.instance">
22
                          <!--<attr name="instanceOf" stringvalue="org.netbeans.spi.options.OptionsPanelController"/>-->
23
                          <attr name="instanceCreate" newvalue="org.netbeans.modules.java.hints.onsave.OnSavePreferencesCustomizer$FactoryImpl"/>
24
                      </file>
25
                  </folder>
26
              </folder>
27
          </folder>
18
      </folder>
28
      </folder>
19
  </folder>
29
  </folder>
20
30
(-)a/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/batch/BatchSearch.java (-1 / +1 lines)
Lines 550-556 Link Here
550
            super(src);
550
            super(src);
551
        }
551
        }
552
        public void validateResource(Collection<? extends Resource> resources, ProgressHandleWrapper progress, VerifiedSpansCallBack callback, boolean doNotRegisterClassPath, Collection<? super MessageImpl> problems, AtomicBoolean cancel) {
552
        public void validateResource(Collection<? extends Resource> resources, ProgressHandleWrapper progress, VerifiedSpansCallBack callback, boolean doNotRegisterClassPath, Collection<? super MessageImpl> problems, AtomicBoolean cancel) {
553
            getLocalVerifiedSpans(resources, progress, callback, false/*XXX*/, problems, cancel);
553
            getLocalVerifiedSpans(resources, progress, callback, doNotRegisterClassPath, problems, cancel);
554
        }
554
        }
555
    }
555
    }
556
556
(-)a/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/batch/BatchUtilities.java (-1 / +5 lines)
Lines 124-129 Link Here
124
    }
124
    }
125
    
125
    
126
    public static Collection<ModificationResult> applyFixes(BatchResult candidates, @NonNull final ProgressHandleWrapper progress, AtomicBoolean cancel, final Collection<? super RefactoringElementImplementation> fileChanges, final Map<JavaFix, ModificationResult> changesPerFix, final Collection<? super MessageImpl> problems) {
126
    public static Collection<ModificationResult> applyFixes(BatchResult candidates, @NonNull final ProgressHandleWrapper progress, AtomicBoolean cancel, final Collection<? super RefactoringElementImplementation> fileChanges, final Map<JavaFix, ModificationResult> changesPerFix, final Collection<? super MessageImpl> problems) {
127
        return applyFixes(candidates, progress, cancel, fileChanges, changesPerFix, false, problems);
128
    }
129
    
130
    public static Collection<ModificationResult> applyFixes(BatchResult candidates, @NonNull final ProgressHandleWrapper progress, AtomicBoolean cancel, final Collection<? super RefactoringElementImplementation> fileChanges, final Map<JavaFix, ModificationResult> changesPerFix, boolean doNotRegisterClassPath, final Collection<? super MessageImpl> problems) {
127
        final Map<Project, Set<String>> processedDependencyChanges = new IdentityHashMap<Project, Set<String>>();
131
        final Map<Project, Set<String>> processedDependencyChanges = new IdentityHashMap<Project, Set<String>>();
128
        final Map<FileObject, List<ModificationResult.Difference>> result = new LinkedHashMap<FileObject, List<ModificationResult.Difference>>();
132
        final Map<FileObject, List<ModificationResult.Difference>> result = new LinkedHashMap<FileObject, List<ModificationResult.Difference>>();
129
        final Map<FileObject, byte[]> resourceContentChanges = new HashMap<FileObject, byte[]>();
133
        final Map<FileObject, byte[]> resourceContentChanges = new HashMap<FileObject, byte[]>();
Lines 175-181 Link Here
175
            }
179
            }
176
        };
180
        };
177
181
178
        BatchSearch.getVerifiedSpans(candidates, progress, callback, problems, cancel);
182
        BatchSearch.getVerifiedSpans(candidates, progress, callback, doNotRegisterClassPath, problems, cancel);
179
        
183
        
180
        addResourceContentChanges(resourceContentChanges, result);
184
        addResourceContentChanges(resourceContentChanges, result);
181
185

Return to bug 217904