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

(-)a/cnd.asm/nbproject/project.xml (-1 / +1 lines)
Lines 137-143 Link Here
137
                    <build-prerequisite/>
137
                    <build-prerequisite/>
138
                    <compile-dependency/>
138
                    <compile-dependency/>
139
                    <run-dependency>
139
                    <run-dependency>
140
                        <specification-version>8.0</specification-version>
140
                        <specification-version>8.32</specification-version>
141
                    </run-dependency>
141
                    </run-dependency>
142
                </dependency>
142
                </dependency>
143
                <dependency>
143
                <dependency>
(-)a/cnd.asm/src/org/netbeans/modules/cnd/asm/core/assistance/GoToLabelAction.java (-4 / +4 lines)
Lines 47-53 Link Here
47
47
48
import org.netbeans.modules.cnd.asm.model.AsmState;
48
import org.netbeans.modules.cnd.asm.model.AsmState;
49
import org.netbeans.modules.cnd.asm.model.lang.AsmElement;
49
import org.netbeans.modules.cnd.asm.model.lang.AsmElement;
50
import org.netbeans.modules.cnd.asm.model.util.Pair;
50
import org.openide.util.Pair;
51
51
52
public class GoToLabelAction {
52
public class GoToLabelAction {
53
                
53
                
Lines 55-63 Link Here
55
        Pair<AsmElement, AsmElement> pair = state.resolveLink(pos);
55
        Pair<AsmElement, AsmElement> pair = state.resolveLink(pos);
56
        
56
        
57
        if (pair != null) {
57
        if (pair != null) {
58
            return new int[] { pair.getFirst().getStartOffset(), 
58
            return new int[] { pair.first().getStartOffset(),
59
                               pair.getFirst().getEndOffset(), 
59
                               pair.first().getEndOffset(),
60
                               pair.getSecond().getStartOffset()
60
                               pair.second().getStartOffset()
61
                             };                        
61
                             };                        
62
        } 
62
        } 
63
        
63
        
(-)a/cnd.asm/src/org/netbeans/modules/cnd/asm/core/editor/AsmModelAccessorImpl.java (-2 / +2 lines)
Lines 72-78 Link Here
72
import org.netbeans.modules.cnd.asm.model.lang.syntax.AsmParser;
72
import org.netbeans.modules.cnd.asm.model.lang.syntax.AsmParser;
73
import org.netbeans.modules.cnd.asm.model.util.AsmModelUtilities;
73
import org.netbeans.modules.cnd.asm.model.util.AsmModelUtilities;
74
import org.netbeans.modules.cnd.asm.model.util.EmptyAsmState;
74
import org.netbeans.modules.cnd.asm.model.util.EmptyAsmState;
75
import org.netbeans.modules.cnd.asm.model.util.Pair;
75
import org.openide.util.Pair;
76
76
77
public class AsmModelAccessorImpl implements AsmModelAccessor {            
77
public class AsmModelAccessorImpl implements AsmModelAccessor {            
78
    
78
    
Lines 215-221 Link Here
215
                AsmElement result = resolver.getResult();
215
                AsmElement result = resolver.getResult();
216
                
216
                
217
                if (result != null) {
217
                if (result != null) {
218
                    return Pair.getPair(inital, result);
218
                    return Pair.<AsmElement, AsmElement>of(inital, result);
219
                }
219
                }
220
            }
220
            }
221
                
221
                
(-)a/cnd.asm/src/org/netbeans/modules/cnd/asm/model/AsmState.java (-1 / +1 lines)
Lines 48-54 Link Here
48
import org.openide.util.Lookup;
48
import org.openide.util.Lookup;
49
49
50
import org.netbeans.modules.cnd.asm.model.lang.AsmElement;
50
import org.netbeans.modules.cnd.asm.model.lang.AsmElement;
51
import org.netbeans.modules.cnd.asm.model.util.Pair;
51
import org.openide.util.Pair;
52
52
53
public interface AsmState {
53
public interface AsmState {
54
    AsmElement getElements();  
54
    AsmElement getElements();  
(-)a/cnd.asm/src/org/netbeans/modules/cnd/asm/model/util/EmptyAsmState.java (+1 lines)
Lines 36-41 Link Here
36
import org.netbeans.modules.cnd.asm.model.AsmState;
36
import org.netbeans.modules.cnd.asm.model.AsmState;
37
import org.netbeans.modules.cnd.asm.model.lang.AsmElement;
37
import org.netbeans.modules.cnd.asm.model.lang.AsmElement;
38
import org.netbeans.modules.cnd.asm.model.lang.impl.LeafAsmElement;
38
import org.netbeans.modules.cnd.asm.model.lang.impl.LeafAsmElement;
39
import org.openide.util.Pair;
39
40
40
public class EmptyAsmState implements AsmState,
41
public class EmptyAsmState implements AsmState,
41
                              AsmFakeable {
42
                              AsmFakeable {
(-)a/cnd.asm/src/org/netbeans/modules/cnd/asm/model/util/Pair.java (-68 lines)
Lines 1-68 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 1997-2010 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
 * Contributor(s):
28
 *
29
 * The Original Software is NetBeans. The Initial Developer of the Original
30
 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
31
 * Microsystems, Inc. All Rights Reserved.
32
 *
33
 * If you wish your version of this file to be governed by only the CDDL
34
 * or only the GPL Version 2, indicate your decision by adding
35
 * "[Contributor] elects to include this software in this distribution
36
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
37
 * single choice of license, a recipient has the option to distribute
38
 * your version of this file under either the CDDL, the GPL Version 2 or
39
 * to extend the choice of license to its licensees as provided above.
40
 * However, if you add GPL Version 2 code and therefore, elected the GPL
41
 * Version 2 license, then the option applies only if the new code is
42
 * made subject to such option by the copyright holder.
43
 */
44
45
46
package org.netbeans.modules.cnd.asm.model.util;
47
48
public class Pair<T1, T2> {
49
    private final T1 p1; 
50
    private final T2 p2; 
51
    
52
    public Pair(T1 p1, T2 p2) {
53
        this.p1 = p1;
54
        this.p2 = p2;
55
    }
56
    
57
    public T1 getFirst() {
58
        return p1;
59
    }
60
    
61
    public T2 getSecond() {
62
        return p2;
63
    }    
64
    
65
    public static <T1, T2> Pair<T1, T2> getPair(T1 p1, T2 p2) {
66
        return new Pair<T1,T2>(p1, p2);
67
    }
68
}
(-)a/cnd.asm/src/org/netbeans/modules/cnd/asm/model/xml/ModelXMLRootContext.java (-3 / +3 lines)
Lines 58-68 Link Here
58
import org.xml.sax.Attributes;
58
import org.xml.sax.Attributes;
59
59
60
import org.netbeans.modules.cnd.asm.model.lang.BitWidth;
60
import org.netbeans.modules.cnd.asm.model.lang.BitWidth;
61
import org.netbeans.modules.cnd.asm.model.util.Pair;
62
import org.netbeans.modules.cnd.asm.model.lang.instruction.Instruction;
61
import org.netbeans.modules.cnd.asm.model.lang.instruction.Instruction;
63
import org.netbeans.modules.cnd.asm.model.lang.Register;
62
import org.netbeans.modules.cnd.asm.model.lang.Register;
64
import org.netbeans.modules.cnd.asm.model.lang.instruction.InstructionArgs;
63
import org.netbeans.modules.cnd.asm.model.lang.instruction.InstructionArgs;
65
import static org.netbeans.modules.cnd.asm.model.xml.ModelXMLAttributes.*;
64
import static org.netbeans.modules.cnd.asm.model.xml.ModelXMLAttributes.*;
65
import org.openide.util.Pair;
66
66
67
public class ModelXMLRootContext implements XMLReaderContext {
67
public class ModelXMLRootContext implements XMLReaderContext {
68
        
68
        
Lines 181-187 Link Here
181
                     XMLBaseRegister result = new DefaultXMLBaseRegister(ctx.getName(), ctx.getWidth());
181
                     XMLBaseRegister result = new DefaultXMLBaseRegister(ctx.getName(), ctx.getWidth());
182
                     Set<Register> children = new HashSet<Register>();
182
                     Set<Register> children = new HashSet<Register>();
183
                     for (Pair<String, Integer> pair : ctx.getChildren()) {
183
                     for (Pair<String, Integer> pair : ctx.getChildren()) {
184
                         XMLBaseRegister res = process(getForName(pair.getFirst())); 
184
                         XMLBaseRegister res = process(getForName(pair.first()));
185
                         children.addAll(res.getChildren());
185
                         children.addAll(res.getChildren());
186
                         children.add(res);
186
                         children.add(res);
187
                         res.setDirectParent(result);
187
                         res.setDirectParent(result);
Lines 230-236 Link Here
230
                String name = checkForName(attributes, REG_NAME_ATTRIBUTE); 
230
                String name = checkForName(attributes, REG_NAME_ATTRIBUTE); 
231
                String offset = checkForName(attributes, REG_OFFSET_ATTRIBUTE);
231
                String offset = checkForName(attributes, REG_OFFSET_ATTRIBUTE);
232
                
232
                
233
                children.add(new Pair<String, Integer>(name, Integer.parseInt(offset)));
233
                children.add(Pair.<String, Integer>of(name, Integer.parseInt(offset)));
234
                return null;
234
                return null;
235
            }
235
            }
236
            
236
            
(-)a/cnd.repository/nbproject/project.xml (-1 / +1 lines)
Lines 43-49 Link Here
43
                    <build-prerequisite/>
43
                    <build-prerequisite/>
44
                    <compile-dependency/>
44
                    <compile-dependency/>
45
                    <run-dependency>
45
                    <run-dependency>
46
                        <specification-version>8.0</specification-version>
46
                        <specification-version>8.32</specification-version>
47
                    </run-dependency>
47
                    </run-dependency>
48
                </dependency>
48
                </dependency>
49
                <dependency>
49
                <dependency>
(-)a/cnd.repository/src/org/netbeans/modules/cnd/repository/disk/MemoryCache.java (-2 / +2 lines)
Lines 60-67 Link Here
60
import org.netbeans.modules.cnd.debug.CndTraceFlags;
60
import org.netbeans.modules.cnd.debug.CndTraceFlags;
61
import org.netbeans.modules.cnd.repository.spi.Key;
61
import org.netbeans.modules.cnd.repository.spi.Key;
62
import org.netbeans.modules.cnd.repository.spi.Persistent;
62
import org.netbeans.modules.cnd.repository.spi.Persistent;
63
import org.netbeans.modules.cnd.repository.util.Pair;
64
import org.netbeans.modules.cnd.utils.CndUtils;
63
import org.netbeans.modules.cnd.utils.CndUtils;
64
import org.openide.util.Pair;
65
65
66
/**
66
/**
67
 * An in-memory cache for storing repository objects 
67
 * An in-memory cache for storing repository objects 
Lines 380-386 Link Here
380
                    s.r.unlock();
380
                    s.r.unlock();
381
                }
381
                }
382
                if (value instanceof Persistent ) {
382
                if (value instanceof Persistent ) {
383
                    result.add(new Pair<Key,Persistent>(key, (Persistent) value));
383
                    result.add(Pair.<Key,Persistent>of(key, (Persistent) value));
384
                    s.w.lock();
384
                    s.w.lock();
385
                    try {
385
                    try {
386
                        s.storage.remove(key);
386
                        s.storage.remove(key);
(-)a/cnd.repository/src/org/netbeans/modules/cnd/repository/disk/UnitImpl.java (-2 / +2 lines)
Lines 56-64 Link Here
56
import org.netbeans.modules.cnd.repository.spi.Key;
56
import org.netbeans.modules.cnd.repository.spi.Key;
57
import org.netbeans.modules.cnd.repository.spi.Key.Behavior;
57
import org.netbeans.modules.cnd.repository.spi.Key.Behavior;
58
import org.netbeans.modules.cnd.repository.spi.Persistent;
58
import org.netbeans.modules.cnd.repository.spi.Persistent;
59
import org.netbeans.modules.cnd.repository.util.Pair;
60
import org.netbeans.modules.cnd.utils.CndUtils;
59
import org.netbeans.modules.cnd.utils.CndUtils;
61
import org.openide.util.Lookup;
60
import org.openide.util.Lookup;
61
import org.openide.util.Pair;
62
62
63
/**
63
/**
64
 * Implements a repository unit
64
 * Implements a repository unit
Lines 197-203 Link Here
197
    public void close() throws IOException {
197
    public void close() throws IOException {
198
        Collection<Pair<Key, Persistent>> hung = cache.clearHungObjects();
198
        Collection<Pair<Key, Persistent>> hung = cache.clearHungObjects();
199
        for( Pair<Key, Persistent> pair : hung ) {
199
        for( Pair<Key, Persistent> pair : hung ) {
200
            putPhysically(pair.first, pair.second);
200
            putPhysically(pair.first(), pair.second());
201
        }
201
        }
202
        singleFileStorage.close();
202
        singleFileStorage.close();
203
        multyFileStorage.close();
203
        multyFileStorage.close();
(-)a/cnd.repository/src/org/netbeans/modules/cnd/repository/util/Pair.java (-59 lines)
Lines 1-59 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2010 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 2008 Sun Microsystems, Inc.
41
 */
42
43
package org.netbeans.modules.cnd.repository.util;
44
45
/**
46
 * A simple struct, mainly for returning pairs of values
47
 * @author Vladimir Kvashin
48
 */
49
public class Pair<T1, T2> {
50
    
51
    public final T1 first;
52
    public final T2 second;
53
    
54
    public Pair(T1 first, T2 second) {
55
        this.first = first;
56
        this.second = second;
57
    }
58
    
59
}
(-)a/csl.api/nbproject/project.xml (-1 / +1 lines)
Lines 358-364 Link Here
358
                    <build-prerequisite/>
358
                    <build-prerequisite/>
359
                    <compile-dependency/>
359
                    <compile-dependency/>
360
                    <run-dependency>
360
                    <run-dependency>
361
                        <specification-version>8.0</specification-version>
361
                        <specification-version>8.32</specification-version>
362
                    </run-dependency>
362
                    </run-dependency>
363
                </dependency>
363
                </dependency>
364
                <dependency>
364
                <dependency>
(-)a/csl.api/src/org/netbeans/modules/csl/hints/infrastructure/GsfHintsManager.java (-8 / +9 lines)
Lines 89-94 Link Here
89
import org.openide.filesystems.FileUtil;
89
import org.openide.filesystems.FileUtil;
90
import org.openide.loaders.DataObject;
90
import org.openide.loaders.DataObject;
91
import org.openide.util.Exceptions;
91
import org.openide.util.Exceptions;
92
import org.openide.util.Pair;
92
93
93
/**
94
/**
94
 *
95
 *
Lines 322-335 Link Here
322
                    r = instantiateRule(o);
323
                    r = instantiateRule(o);
323
                }
324
                }
324
                if ( r != null ) {
325
                if ( r != null ) {
325
                    rules.add( new Pair<Rule,FileObject>( r, o ) );
326
                    rules.add( Pair.<Rule,FileObject>of( r, o ) );
326
                }
327
                }
327
            }
328
            }
328
        }
329
        }
329
        Collections.sort(rules, new Comparator<Pair<Rule,FileObject>>() {
330
        Collections.sort(rules, new Comparator<Pair<Rule,FileObject>>() {
330
            @Override
331
            @Override
331
            public int compare(Pair<Rule,FileObject> p1, Pair<Rule,FileObject> p2) {
332
            public int compare(Pair<Rule,FileObject> p1, Pair<Rule,FileObject> p2) {
332
                return p1.getA().getDisplayName().compareTo(p2.getA().getDisplayName());
333
                return p1.first().getDisplayName().compareTo(p2.first().getDisplayName());
333
            }
334
            }
334
        });
335
        });
335
        return rules;
336
        return rules;
Lines 366-373 Link Here
366
        dir2node.put(rootFolder, rootNode);
367
        dir2node.put(rootFolder, rootNode);
367
368
368
        for( Pair<Rule,FileObject> pair : rules ) {
369
        for( Pair<Rule,FileObject> pair : rules ) {
369
            Rule rule = pair.getA();
370
            Rule rule = pair.first();
370
            FileObject fo = pair.getB();
371
            FileObject fo = pair.second();
371
372
372
            if ( rule instanceof ErrorRule ) {
373
            if ( rule instanceof ErrorRule ) {
373
                addRule( (ErrorRule)rule, (Map)dest );
374
                addRule( (ErrorRule)rule, (Map)dest );
Lines 395-402 Link Here
395
        dir2node.put(rootFolder, rootNode);
396
        dir2node.put(rootFolder, rootNode);
396
397
397
        for( Pair<Rule,FileObject> pair : rules ) {
398
        for( Pair<Rule,FileObject> pair : rules ) {
398
            Rule rule = pair.getA();
399
            Rule rule = pair.first();
399
            FileObject fo = pair.getB();
400
            FileObject fo = pair.second();
400
401
401
            if ( rule instanceof AstRule ) {
402
            if ( rule instanceof AstRule ) {
402
                
403
                
Lines 436-443 Link Here
436
        dir2node.put(rootFolder, rootNode);
437
        dir2node.put(rootFolder, rootNode);
437
438
438
        for( Pair<Rule,FileObject> pair : rules ) {
439
        for( Pair<Rule,FileObject> pair : rules ) {
439
            Rule rule = pair.getA();
440
            Rule rule = pair.first();
440
            FileObject fo = pair.getB();
441
            FileObject fo = pair.second();
441
442
442
            if ( rule instanceof SelectionRule ) {
443
            if ( rule instanceof SelectionRule ) {
443
                addRule((SelectionRule)rule, (List)dest );
444
                addRule((SelectionRule)rule, (List)dest );
(-)a/csl.api/src/org/netbeans/modules/csl/hints/infrastructure/Pair.java (-71 lines)
Lines 1-71 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 1997-2010 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
 * Contributor(s):
28
 *
29
 * The Original Software is NetBeans. The Initial Developer of the Original
30
 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
31
 * Microsystems, Inc. All Rights Reserved.
32
 *
33
 * If you wish your version of this file to be governed by only the CDDL
34
 * or only the GPL Version 2, indicate your decision by adding
35
 * "[Contributor] elects to include this software in this distribution
36
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
37
 * single choice of license, a recipient has the option to distribute
38
 * your version of this file under either the CDDL, the GPL Version 2 or
39
 * to extend the choice of license to its licensees as provided above.
40
 * However, if you add GPL Version 2 code and therefore, elected the GPL
41
 * Version 2 license, then the option applies only if the new code is
42
 * made subject to such option by the copyright holder.
43
 */
44
package org.netbeans.modules.csl.hints.infrastructure;
45
46
/**
47
 *
48
 * @author Jan Lahoda
49
 */
50
public final class Pair<A, B> {
51
52
    private final A a;
53
    private final B b;
54
55
    public Pair(A a, B b) {
56
        this.a = a;
57
        this.b = b;
58
    }
59
60
    public A getA() {
61
        return a;
62
    }
63
64
    public B getB() {
65
        return b;
66
    }
67
68
    public static <A,B> Pair<A,B> of(A a, B b) {
69
      return new Pair<A, B>(a, b);
70
    } 
71
}
(-)a/csl.api/test/unit/src/org/netbeans/modules/csl/api/test/CslTestBase.java (-3 / +3 lines)
Lines 173-179 Link Here
173
import org.netbeans.modules.csl.editor.codetemplates.CslCorePackageAccessor;
173
import org.netbeans.modules.csl.editor.codetemplates.CslCorePackageAccessor;
174
import org.netbeans.modules.csl.hints.infrastructure.GsfHintsManager;
174
import org.netbeans.modules.csl.hints.infrastructure.GsfHintsManager;
175
import org.netbeans.modules.csl.hints.infrastructure.HintsSettings;
175
import org.netbeans.modules.csl.hints.infrastructure.HintsSettings;
176
import org.netbeans.modules.csl.hints.infrastructure.Pair;
177
import org.netbeans.modules.csl.spi.DefaultError;
176
import org.netbeans.modules.csl.spi.DefaultError;
178
import org.netbeans.modules.csl.spi.GsfUtilities;
177
import org.netbeans.modules.csl.spi.GsfUtilities;
179
import org.netbeans.modules.csl.spi.ParserResult;
178
import org.netbeans.modules.csl.spi.ParserResult;
Lines 207-212 Link Here
207
import org.openide.filesystems.XMLFileSystem;
206
import org.openide.filesystems.XMLFileSystem;
208
import org.openide.loaders.DataObject;
207
import org.openide.loaders.DataObject;
209
import org.openide.loaders.DataObjectNotFoundException;
208
import org.openide.loaders.DataObjectNotFoundException;
209
import org.openide.util.Pair;
210
import org.openide.util.test.MockLookup;
210
import org.openide.util.test.MockLookup;
211
211
212
/**
212
/**
Lines 3391-3397 Link Here
3391
            }
3391
            }
3392
        }
3392
        }
3393
3393
3394
        return new Pair<EditHistory,String>(history, modifiedText);
3394
        return Pair.<EditHistory,String>of(history, modifiedText);
3395
    }
3395
    }
3396
3396
3397
    protected final Pair<EditHistory,String> getEditHistory(BaseDocument doc, final EditHistory history, String... edits) throws BadLocationException {
3397
    protected final Pair<EditHistory,String> getEditHistory(BaseDocument doc, final EditHistory history, String... edits) throws BadLocationException {
Lines 3466-3472 Link Here
3466
            }
3466
            }
3467
        }
3467
        }
3468
3468
3469
        return new Pair<EditHistory,String>(history, modifiedText);
3469
        return Pair.<EditHistory,String>of(history, modifiedText);
3470
    }
3470
    }
3471
3471
3472
//    /**
3472
//    /**
(-)a/css.editor/manifest.mf (-1 / +1 lines)
Lines 2-6 Link Here
2
OpenIDE-Module: org.netbeans.modules.css.editor/1
2
OpenIDE-Module: org.netbeans.modules.css.editor/1
3
OpenIDE-Module-Layer: org/netbeans/modules/css/resources/layer.xml
3
OpenIDE-Module-Layer: org/netbeans/modules/css/resources/layer.xml
4
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/css/resources/Bundle.properties
4
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/css/resources/Bundle.properties
5
OpenIDE-Module-Specification-Version: 1.52
5
OpenIDE-Module-Specification-Version: 1.53
6
AutoUpdate-Show-In-Client: false
6
AutoUpdate-Show-In-Client: false
(-)a/css.editor/nbproject/project.xml (-2 / +2 lines)
Lines 179-185 Link Here
179
                    <build-prerequisite/>
179
                    <build-prerequisite/>
180
                    <compile-dependency/>
180
                    <compile-dependency/>
181
                    <run-dependency>
181
                    <run-dependency>
182
                        <specification-version>1.28</specification-version>
182
                        <specification-version>1.46</specification-version>
183
                    </run-dependency>
183
                    </run-dependency>
184
                </dependency>
184
                </dependency>
185
                <dependency>
185
                <dependency>
Lines 259-265 Link Here
259
                    <build-prerequisite/>
259
                    <build-prerequisite/>
260
                    <compile-dependency/>
260
                    <compile-dependency/>
261
                    <run-dependency>
261
                    <run-dependency>
262
                        <specification-version>8.0</specification-version>
262
                        <specification-version>8.32</specification-version>
263
                    </run-dependency>
263
                    </run-dependency>
264
                </dependency>
264
                </dependency>
265
                <dependency>
265
                <dependency>
(-)a/css.editor/src/org/netbeans/modules/css/editor/csl/CssDeclarationFinder.java (-3 / +3 lines)
Lines 51-57 Link Here
51
import org.netbeans.modules.css.editor.module.spi.FeatureCancel;
51
import org.netbeans.modules.css.editor.module.spi.FeatureCancel;
52
import org.netbeans.modules.css.editor.module.spi.FutureParamTask;
52
import org.netbeans.modules.css.editor.module.spi.FutureParamTask;
53
import org.netbeans.modules.css.lib.api.CssParserResult;
53
import org.netbeans.modules.css.lib.api.CssParserResult;
54
import org.netbeans.modules.web.common.api.Pair;
54
import org.openide.util.Pair;
55
55
56
/**
56
/**
57
 * Hyperlinking for @import declaration only.
57
 * Hyperlinking for @import declaration only.
Lines 80-87 Link Here
80
    public OffsetRange getReferenceSpan(Document doc, int caretOffset) {
80
    public OffsetRange getReferenceSpan(Document doc, int caretOffset) {
81
        Pair<OffsetRange, FutureParamTask<DeclarationLocation, EditorFeatureContext>> declarationLocation = CssModuleSupport.getDeclarationLocation(doc, caretOffset, new FeatureCancel());
81
        Pair<OffsetRange, FutureParamTask<DeclarationLocation, EditorFeatureContext>> declarationLocation = CssModuleSupport.getDeclarationLocation(doc, caretOffset, new FeatureCancel());
82
        if(declarationLocation != null) {
82
        if(declarationLocation != null) {
83
            taskRef.set(declarationLocation.getB());
83
            taskRef.set(declarationLocation.second());
84
            return declarationLocation.getA();
84
            return declarationLocation.first();
85
        }
85
        }
86
        return OffsetRange.NONE;
86
        return OffsetRange.NONE;
87
    }
87
    }
(-)a/css.editor/src/org/netbeans/modules/css/editor/module/CssModuleSupport.java (-1 / +1 lines)
Lines 55-63 Link Here
55
import org.netbeans.modules.css.lib.api.Node;
55
import org.netbeans.modules.css.lib.api.Node;
56
import org.netbeans.modules.css.lib.api.NodeVisitor;
56
import org.netbeans.modules.css.lib.api.NodeVisitor;
57
import org.netbeans.modules.css.lib.api.properties.PropertyDefinition;
57
import org.netbeans.modules.css.lib.api.properties.PropertyDefinition;
58
import org.netbeans.modules.web.common.api.Pair;
59
import org.openide.filesystems.FileObject;
58
import org.openide.filesystems.FileObject;
60
import org.openide.util.Lookup;
59
import org.openide.util.Lookup;
60
import org.openide.util.Pair;
61
61
62
/**
62
/**
63
 *
63
 *
(-)a/css.editor/src/org/netbeans/modules/css/editor/module/PropertiesReader.java (-2 / +3 lines)
Lines 48-56 Link Here
48
import java.util.ArrayList;
48
import java.util.ArrayList;
49
import java.util.Collection;
49
import java.util.Collection;
50
import java.util.Properties;
50
import java.util.Properties;
51
import org.netbeans.modules.web.common.api.Pair;
51
52
import org.openide.util.Exceptions;
52
import org.openide.util.Exceptions;
53
import org.openide.util.Lookup;
53
import org.openide.util.Lookup;
54
import org.openide.util.Pair;
54
55
55
/**
56
/**
56
 *
57
 *
Lines 152-158 Link Here
152
            }
153
            }
153
            String key = loadConvert(lr.lineBuf, 0, keyLen, convtBuf);
154
            String key = loadConvert(lr.lineBuf, 0, keyLen, convtBuf);
154
            String value = loadConvert(lr.lineBuf, valueStart, limit - valueStart, convtBuf);
155
            String value = loadConvert(lr.lineBuf, valueStart, limit - valueStart, convtBuf);
155
            col.add(new Pair<String, String>(key, value));
156
            col.add(Pair.<String, String>of(key, value));
156
        }
157
        }
157
    }
158
    }
158
159
(-)a/css.editor/src/org/netbeans/modules/css/editor/module/main/DefaultCssEditorModule.java (-2 / +2 lines)
Lines 80-89 Link Here
80
import org.netbeans.modules.parsing.api.Snapshot;
80
import org.netbeans.modules.parsing.api.Snapshot;
81
import org.netbeans.modules.web.common.api.LexerUtils;
81
import org.netbeans.modules.web.common.api.LexerUtils;
82
import org.netbeans.modules.web.common.api.Lines;
82
import org.netbeans.modules.web.common.api.Lines;
83
import org.netbeans.modules.web.common.api.Pair;
84
import org.netbeans.modules.web.common.api.WebUtils;
83
import org.netbeans.modules.web.common.api.WebUtils;
85
import org.openide.filesystems.FileObject;
84
import org.openide.filesystems.FileObject;
86
import org.openide.util.NbBundle;
85
import org.openide.util.NbBundle;
86
import org.openide.util.Pair;
87
import org.openide.util.lookup.ServiceProvider;
87
import org.openide.util.lookup.ServiceProvider;
88
88
89
/**
89
/**
Lines 479-485 Link Here
479
            }
479
            }
480
        };
480
        };
481
481
482
        return new Pair<OffsetRange, FutureParamTask<DeclarationLocation, EditorFeatureContext>>(foundRange, callable);
482
        return Pair.<OffsetRange, FutureParamTask<DeclarationLocation, EditorFeatureContext>>of(foundRange, callable);
483
    }
483
    }
484
484
485
    @Override
485
    @Override
(-)a/css.editor/src/org/netbeans/modules/css/editor/module/spi/CssEditorModule.java (-1 / +1 lines)
Lines 54-61 Link Here
54
import org.netbeans.modules.csl.api.OffsetRange;
54
import org.netbeans.modules.csl.api.OffsetRange;
55
import org.netbeans.modules.csl.api.StructureItem;
55
import org.netbeans.modules.csl.api.StructureItem;
56
import org.netbeans.modules.css.lib.api.NodeVisitor;
56
import org.netbeans.modules.css.lib.api.NodeVisitor;
57
import org.netbeans.modules.web.common.api.Pair;
58
import org.openide.filesystems.FileObject;
57
import org.openide.filesystems.FileObject;
58
import org.openide.util.Pair;
59
59
60
/**
60
/**
61
 * The basic class clients wanting to extend the CSS editor functionality needs
61
 * The basic class clients wanting to extend the CSS editor functionality needs
(-)a/css.editor/src/org/netbeans/modules/css/editor/module/spi/Utilities.java (-3 / +3 lines)
Lines 59-67 Link Here
59
import org.netbeans.modules.css.lib.api.properties.PropertyDefinition;
59
import org.netbeans.modules.css.lib.api.properties.PropertyDefinition;
60
import org.netbeans.modules.parsing.api.Snapshot;
60
import org.netbeans.modules.parsing.api.Snapshot;
61
import org.netbeans.modules.web.common.api.LexerUtils;
61
import org.netbeans.modules.web.common.api.LexerUtils;
62
import org.netbeans.modules.web.common.api.Pair;
63
import org.openide.filesystems.FileObject;
62
import org.openide.filesystems.FileObject;
64
import org.openide.util.NbBundle;
63
import org.openide.util.NbBundle;
64
import org.openide.util.Pair;
65
65
66
/**
66
/**
67
 *
67
 *
Lines 180-187 Link Here
180
180
181
        PropertyCategory category = PropertyCategory.DEFAULT;
181
        PropertyCategory category = PropertyCategory.DEFAULT;
182
        for(Pair<String, String> pair : parseBundle) {
182
        for(Pair<String, String> pair : parseBundle) {
183
            String name = pair.getA();
183
            String name = pair.first();
184
            String value = pair.getB();
184
            String value = pair.second();
185
            
185
            
186
            if(name.startsWith("$")) {
186
            if(name.startsWith("$")) {
187
                //property category
187
                //property category
(-)a/css.lib/manifest.mf (-1 / +1 lines)
Lines 3-6 Link Here
3
OpenIDE-Module: org.netbeans.modules.css.lib/1
3
OpenIDE-Module: org.netbeans.modules.css.lib/1
4
OpenIDE-Module-Layer: org/netbeans/modules/css/lib/layer.xml
4
OpenIDE-Module-Layer: org/netbeans/modules/css/lib/layer.xml
5
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/css/lib/Bundle.properties
5
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/css/lib/Bundle.properties
6
OpenIDE-Module-Specification-Version: 1.54
6
OpenIDE-Module-Specification-Version: 1.55
(-)a/css.lib/nbproject/project.xml (-2 / +2 lines)
Lines 54-60 Link Here
54
                    <build-prerequisite/>
54
                    <build-prerequisite/>
55
                    <compile-dependency/>
55
                    <compile-dependency/>
56
                    <run-dependency>
56
                    <run-dependency>
57
                        <specification-version>1.21</specification-version>
57
                        <specification-version>1.46</specification-version>
58
                    </run-dependency>
58
                    </run-dependency>
59
                </dependency>
59
                </dependency>
60
                <dependency>
60
                <dependency>
Lines 70-76 Link Here
70
                    <build-prerequisite/>
70
                    <build-prerequisite/>
71
                    <compile-dependency/>
71
                    <compile-dependency/>
72
                    <run-dependency>
72
                    <run-dependency>
73
                        <specification-version>8.18</specification-version>
73
                        <specification-version>8.32</specification-version>
74
                    </run-dependency>
74
                    </run-dependency>
75
                </dependency>
75
                </dependency>
76
                <dependency>
76
                <dependency>
(-)a/css.lib/src/org/netbeans/modules/css/lib/api/properties/GrammarResolver.java (-4 / +4 lines)
Lines 47-53 Link Here
47
import java.util.logging.Logger;
47
import java.util.logging.Logger;
48
import static org.netbeans.modules.css.lib.api.properties.GrammarResolver.Log.*;
48
import static org.netbeans.modules.css.lib.api.properties.GrammarResolver.Log.*;
49
import org.netbeans.modules.css.lib.properties.GrammarParseTreeBuilder;
49
import org.netbeans.modules.css.lib.properties.GrammarParseTreeBuilder;
50
import org.netbeans.modules.web.common.api.Pair;
50
import org.openide.util.Pair;
51
51
52
/**
52
/**
53
 * Resolves a css property value against its grammar.
53
 * Resolves a css property value against its grammar.
Lines 328-334 Link Here
328
        }
328
        }
329
329
330
        Pair<InputState, Collection<ValueGrammarElement>> pair = resolvedSomething.get(lastResolved);
330
        Pair<InputState, Collection<ValueGrammarElement>> pair = resolvedSomething.get(lastResolved);
331
        pair.getB().add(valueGrammarElement);
331
        pair.second().add(valueGrammarElement);
332
    }
332
    }
333
333
334
    private void groupMemberResolved(GrammarElement member, GroupGrammarElement group, InputState state, boolean root) {
334
    private void groupMemberResolved(GrammarElement member, GroupGrammarElement group, InputState state, boolean root) {
Lines 340-353 Link Here
340
        if (LOG) {
340
        if (LOG) {
341
            log(ALTERNATIVES, String.format("input matched %s, %s", member.path(), state));
341
            log(ALTERNATIVES, String.format("input matched %s, %s", member.path(), state));
342
        }
342
        }
343
        resolvedSomething.put(group, new Pair<InputState, Collection<ValueGrammarElement>>(state, new LinkedList<ValueGrammarElement>()));
343
        resolvedSomething.put(group, Pair.<InputState, Collection<ValueGrammarElement>>of(state, new LinkedList<ValueGrammarElement>()));
344
        lastResolved = group;
344
        lastResolved = group;
345
    }
345
    }
346
346
347
    private Set<ValueGrammarElement> getAlternatives() {
347
    private Set<ValueGrammarElement> getAlternatives() {
348
        HashSet<ValueGrammarElement> alternatives = new HashSet<>();
348
        HashSet<ValueGrammarElement> alternatives = new HashSet<>();
349
        for (Pair<InputState, Collection<ValueGrammarElement>> tri : resolvedSomething.values()) {
349
        for (Pair<InputState, Collection<ValueGrammarElement>> tri : resolvedSomething.values()) {
350
            for (ValueGrammarElement value : tri.getB()) {
350
            for (ValueGrammarElement value : tri.second()) {
351
                alternatives.add(value);
351
                alternatives.add(value);
352
            }
352
            }
353
        }
353
        }
(-)a/css.prep/manifest.mf (-1 / +1 lines)
Lines 3-7 Link Here
3
OpenIDE-Module: org.netbeans.modules.css.prep
3
OpenIDE-Module: org.netbeans.modules.css.prep
4
OpenIDE-Module-Layer: org/netbeans/modules/css/prep/layer.xml
4
OpenIDE-Module-Layer: org/netbeans/modules/css/prep/layer.xml
5
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/css/prep/Bundle.properties
5
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/css/prep/Bundle.properties
6
OpenIDE-Module-Specification-Version: 1.10
6
OpenIDE-Module-Specification-Version: 1.11
7
7
(-)a/css.prep/nbproject/project.xml (-3 / +3 lines)
Lines 47-53 Link Here
47
                    <compile-dependency/>
47
                    <compile-dependency/>
48
                    <run-dependency>
48
                    <run-dependency>
49
                        <release-version>1</release-version>
49
                        <release-version>1</release-version>
50
                        <specification-version>1.49</specification-version>
50
                        <specification-version>1.53</specification-version>
51
                    </run-dependency>
51
                    </run-dependency>
52
                </dependency>
52
                </dependency>
53
                <dependency>
53
                <dependency>
Lines 161-167 Link Here
161
                    <build-prerequisite/>
161
                    <build-prerequisite/>
162
                    <compile-dependency/>
162
                    <compile-dependency/>
163
                    <run-dependency>
163
                    <run-dependency>
164
                        <specification-version>1.45</specification-version>
164
                        <specification-version>1.46</specification-version>
165
                    </run-dependency>
165
                    </run-dependency>
166
                </dependency>
166
                </dependency>
167
                <dependency>
167
                <dependency>
Lines 225-231 Link Here
225
                    <build-prerequisite/>
225
                    <build-prerequisite/>
226
                    <compile-dependency/>
226
                    <compile-dependency/>
227
                    <run-dependency>
227
                    <run-dependency>
228
                        <specification-version>8.30</specification-version>
228
                        <specification-version>8.32</specification-version>
229
                    </run-dependency>
229
                    </run-dependency>
230
                </dependency>
230
                </dependency>
231
                <dependency>
231
                <dependency>
(-)a/css.prep/src/org/netbeans/modules/css/prep/editor/CPCssEditorModule.java (-3 / +3 lines)
Lines 84-93 Link Here
84
import org.netbeans.modules.web.common.api.DependencyType;
84
import org.netbeans.modules.web.common.api.DependencyType;
85
import org.netbeans.modules.web.common.api.LexerUtils;
85
import org.netbeans.modules.web.common.api.LexerUtils;
86
import org.netbeans.modules.web.common.api.Lines;
86
import org.netbeans.modules.web.common.api.Lines;
87
import org.netbeans.modules.web.common.api.Pair;
88
import org.netbeans.modules.web.common.api.WebUtils;
87
import org.netbeans.modules.web.common.api.WebUtils;
89
import org.openide.filesystems.FileObject;
88
import org.openide.filesystems.FileObject;
90
import org.openide.util.Exceptions;
89
import org.openide.util.Exceptions;
90
import org.openide.util.Pair;
91
import org.openide.util.lookup.ServiceProvider;
91
import org.openide.util.lookup.ServiceProvider;
92
92
93
/**
93
/**
Lines 475-481 Link Here
475
                        return DeclarationLocation.NONE;
475
                        return DeclarationLocation.NONE;
476
                    }
476
                    }
477
                };
477
                };
478
                return new Pair<OffsetRange, FutureParamTask<DeclarationLocation, EditorFeatureContext>>(foundRange, callable);
478
                return Pair.<OffsetRange, FutureParamTask<DeclarationLocation, EditorFeatureContext>>of(foundRange, callable);
479
479
480
            case SASS_VAR:
480
            case SASS_VAR:
481
            case AT_IDENT: //less var //TODO - add default directives - see the css grammar file comment about that
481
            case AT_IDENT: //less var //TODO - add default directives - see the css grammar file comment about that
Lines 521-527 Link Here
521
                        return DeclarationLocation.NONE;
521
                        return DeclarationLocation.NONE;
522
                    }
522
                    }
523
                };
523
                };
524
                return new Pair<OffsetRange, FutureParamTask<DeclarationLocation, EditorFeatureContext>>(foundRange, callable);
524
                return Pair.<OffsetRange, FutureParamTask<DeclarationLocation, EditorFeatureContext>>of(foundRange, callable);
525
525
526
            default:
526
            default:
527
                return null;
527
                return null;
(-)a/css.prep/src/org/netbeans/modules/css/prep/util/ExternalExecutable.java (-4 / +4 lines)
Lines 70-77 Link Here
70
import org.netbeans.api.extexecution.input.InputProcessor;
70
import org.netbeans.api.extexecution.input.InputProcessor;
71
import org.netbeans.api.extexecution.input.InputProcessors;
71
import org.netbeans.api.extexecution.input.InputProcessors;
72
import org.netbeans.api.progress.ProgressUtils;
72
import org.netbeans.api.progress.ProgressUtils;
73
import org.netbeans.modules.web.common.api.Pair;
74
import org.openide.util.NbBundle;
73
import org.openide.util.NbBundle;
74
import org.openide.util.Pair;
75
import org.openide.util.Parameters;
75
import org.openide.util.Parameters;
76
import org.openide.util.Utilities;
76
import org.openide.util.Utilities;
77
import org.openide.windows.InputOutput;
77
import org.openide.windows.InputOutput;
Lines 126-133 Link Here
126
     */
126
     */
127
    public ExternalExecutable(String command) {
127
    public ExternalExecutable(String command) {
128
        Pair<String, List<String>> parsedCommand = parseCommand(command);
128
        Pair<String, List<String>> parsedCommand = parseCommand(command);
129
        executable = parsedCommand.getA();
129
        executable = parsedCommand.first();
130
        parameters = parsedCommand.getB();
130
        parameters = parsedCommand.second();
131
        this.command = command.trim();
131
        this.command = command.trim();
132
    }
132
    }
133
133
Lines 143-149 Link Here
143
            return Pair.of(tokens[0].trim(), Collections.<String>emptyList());
143
            return Pair.of(tokens[0].trim(), Collections.<String>emptyList());
144
        }
144
        }
145
        Pair<String, List<String>> parsedCommand = Pair.of(tokens[0].trim(), Arrays.asList(Utilities.parseParameters(tokens[1].trim())));
145
        Pair<String, List<String>> parsedCommand = Pair.of(tokens[0].trim(), Arrays.asList(Utilities.parseParameters(tokens[1].trim())));
146
        LOGGER.log(Level.FINE, "Parameters parsed: {0} {1}", new Object[] {parsedCommand.getA(), parsedCommand.getB()});
146
        LOGGER.log(Level.FINE, "Parameters parsed: {0} {1}", new Object[] {parsedCommand.first(), parsedCommand.second()});
147
        return parsedCommand;
147
        return parsedCommand;
148
    }
148
    }
149
149
(-)a/css.prep/src/org/netbeans/modules/css/prep/util/ExternalExecutableValidator.java (-1 / +1 lines)
Lines 67-73 Link Here
67
    public static String validateCommand(@NullAllowed String command, @NullAllowed String executableName) {
67
    public static String validateCommand(@NullAllowed String command, @NullAllowed String executableName) {
68
        String executable = null;
68
        String executable = null;
69
        if (command != null) {
69
        if (command != null) {
70
            executable = ExternalExecutable.parseCommand(command).getA();
70
            executable = ExternalExecutable.parseCommand(command).first();
71
        }
71
        }
72
        if (executableName == null) {
72
        if (executableName == null) {
73
            return FileUtils.validateFile(executable, false);
73
            return FileUtils.validateFile(executable, false);
(-)a/debugger.jpda.ui/nbproject/project.xml (-2 / +2 lines)
Lines 64-70 Link Here
64
                    <compile-dependency/>
64
                    <compile-dependency/>
65
                    <run-dependency>
65
                    <run-dependency>
66
                        <release-version>2</release-version>
66
                        <release-version>2</release-version>
67
			<specification-version>2.42</specification-version>
67
                        <specification-version>2.42</specification-version>
68
                    </run-dependency>
68
                    </run-dependency>
69
                </dependency>
69
                </dependency>
70
                <dependency>
70
                <dependency>
Lines 277-283 Link Here
277
                    <build-prerequisite/>
277
                    <build-prerequisite/>
278
                    <compile-dependency/>
278
                    <compile-dependency/>
279
                    <run-dependency>
279
                    <run-dependency>
280
                        <specification-version>8.0</specification-version>
280
                        <specification-version>8.32</specification-version>
281
                    </run-dependency>
281
                    </run-dependency>
282
                </dependency>
282
                </dependency>
283
                <dependency>
283
                <dependency>
(-)a/debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/breakpoints/ClassBreakpointPanel.java (-3 / +4 lines)
Lines 62-67 Link Here
62
import org.openide.NotifyDescriptor;
62
import org.openide.NotifyDescriptor;
63
import org.openide.util.HelpCtx;
63
import org.openide.util.HelpCtx;
64
import org.openide.util.NbBundle;
64
import org.openide.util.NbBundle;
65
import org.openide.util.Pair;
65
66
66
/**
67
/**
67
 * @author  Jan Jancura
68
 * @author  Jan Jancura
Lines 119-126 Link Here
119
        ResourceBundle bundle = NbBundle.getBundle(ClassBreakpointPanel.class);
120
        ResourceBundle bundle = NbBundle.getBundle(ClassBreakpointPanel.class);
120
        String tooltipText = bundle.getString("TTT_TF_Class_Breakpoint_Class_Name");
121
        String tooltipText = bundle.getString("TTT_TF_Class_Breakpoint_Class_Name");
121
        Pair<JScrollPane, JEditorPane> editorCC = addClassNameEditorCC(JavaClassNbDebugEditorKit.MIME_TYPE, pSettings, className, tooltipText);
122
        Pair<JScrollPane, JEditorPane> editorCC = addClassNameEditorCC(JavaClassNbDebugEditorKit.MIME_TYPE, pSettings, className, tooltipText);
122
        spClassName = editorCC.get1();
123
        spClassName = editorCC.first();
123
        epClassName = editorCC.get2();
124
        epClassName = editorCC.second();
124
        epClassName.getAccessibleContext().setAccessibleName(bundle.getString("ACSN_Method_Breakpoint_ClassName"));
125
        epClassName.getAccessibleContext().setAccessibleName(bundle.getString("ACSN_Method_Breakpoint_ClassName"));
125
        epClassName.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_Class_Breakpoint_ClassName"));
126
        epClassName.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_Class_Breakpoint_ClassName"));
126
        HelpCtx.setHelpIDString(epClassName, HELP_ID);
127
        HelpCtx.setHelpIDString(epClassName, HELP_ID);
Lines 347-353 Link Here
347
        }
348
        }
348
        sle.setToolTipText(tooltipText);
349
        sle.setToolTipText(tooltipText);
349
        epClassName.setToolTipText(tooltipText);
350
        epClassName.setToolTipText(tooltipText);
350
        return new Pair(sle, epClassName);
351
        return Pair.<JScrollPane, JEditorPane>of(sle, epClassName);
351
    }
352
    }
352
    
353
    
353
    // Variables declaration - do not modify//GEN-BEGIN:variables
354
    // Variables declaration - do not modify//GEN-BEGIN:variables
(-)a/debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/breakpoints/ExceptionBreakpointPanel.java (-2 / +3 lines)
Lines 59-64 Link Here
59
import org.openide.NotifyDescriptor;
59
import org.openide.NotifyDescriptor;
60
import org.openide.util.HelpCtx;
60
import org.openide.util.HelpCtx;
61
import org.openide.util.NbBundle;
61
import org.openide.util.NbBundle;
62
import org.openide.util.Pair;
62
63
63
64
64
/**
65
/**
Lines 114-121 Link Here
114
        String tooltipText = bundle.getString("TTT_TF_Field_Breakpoint_Class_Name");
115
        String tooltipText = bundle.getString("TTT_TF_Field_Breakpoint_Class_Name");
115
        Pair<JScrollPane, JEditorPane> editorCC = ClassBreakpointPanel.addClassNameEditorCC(
116
        Pair<JScrollPane, JEditorPane> editorCC = ClassBreakpointPanel.addClassNameEditorCC(
116
                ExceptionClassNbDebugEditorKit.MIME_TYPE, pSettings, className, tooltipText);
117
                ExceptionClassNbDebugEditorKit.MIME_TYPE, pSettings, className, tooltipText);
117
        spExceptionClassName = editorCC.get1();
118
        spExceptionClassName = editorCC.first();
118
        epExceptionClassName = editorCC.get2();
119
        epExceptionClassName = editorCC.second();
119
        epExceptionClassName.getAccessibleContext().setAccessibleName(bundle.getString("ACSN_Method_Breakpoint_ClassName"));
120
        epExceptionClassName.getAccessibleContext().setAccessibleName(bundle.getString("ACSN_Method_Breakpoint_ClassName"));
120
        epExceptionClassName.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_Exception_Breakpoint_ClassName"));
121
        epExceptionClassName.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_Exception_Breakpoint_ClassName"));
121
        HelpCtx.setHelpIDString(epExceptionClassName, HELP_ID);
122
        HelpCtx.setHelpIDString(epExceptionClassName, HELP_ID);
(-)a/debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/breakpoints/FieldBreakpointPanel.java (-4 / +5 lines)
Lines 62-67 Link Here
62
import org.openide.NotifyDescriptor;
62
import org.openide.NotifyDescriptor;
63
import org.openide.util.HelpCtx;
63
import org.openide.util.HelpCtx;
64
import org.openide.util.NbBundle;
64
import org.openide.util.NbBundle;
65
import org.openide.util.Pair;
65
66
66
/**
67
/**
67
 * @author  Jan Jancura
68
 * @author  Jan Jancura
Lines 124-139 Link Here
124
        ResourceBundle bundle = NbBundle.getBundle(FieldBreakpointPanel.class);
125
        ResourceBundle bundle = NbBundle.getBundle(FieldBreakpointPanel.class);
125
        String tooltipText = bundle.getString("TTT_TF_Field_Breakpoint_Class_Name");
126
        String tooltipText = bundle.getString("TTT_TF_Field_Breakpoint_Class_Name");
126
        Pair<JScrollPane, JEditorPane> editorCC = ClassBreakpointPanel.addClassNameEditorCC(JavaClassNbDebugEditorKit.MIME_TYPE, pSettings, className, tooltipText);
127
        Pair<JScrollPane, JEditorPane> editorCC = ClassBreakpointPanel.addClassNameEditorCC(JavaClassNbDebugEditorKit.MIME_TYPE, pSettings, className, tooltipText);
127
        spClassName = editorCC.get1();
128
        spClassName = editorCC.first();
128
        epClassName = editorCC.get2();
129
        epClassName = editorCC.second();
129
        epClassName.getAccessibleContext().setAccessibleName(bundle.getString("ACSN_Method_Breakpoint_ClassName"));
130
        epClassName.getAccessibleContext().setAccessibleName(bundle.getString("ACSN_Method_Breakpoint_ClassName"));
130
        epClassName.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_Field_Breakpoint_ClassName"));
131
        epClassName.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_Field_Breakpoint_ClassName"));
131
        HelpCtx.setHelpIDString(epClassName, HELP_ID);
132
        HelpCtx.setHelpIDString(epClassName, HELP_ID);
132
        jLabel3.setLabelFor(spClassName);
133
        jLabel3.setLabelFor(spClassName);
133
        
134
        
134
        editorCC = ClassBreakpointPanel.addClassNameEditorCC(JavaFieldNbDebugEditorKit.MIME_TYPE, null, b.getFieldName(), bundle.getString("TTT_TF_Field_Breakpoint_Field_Name"));
135
        editorCC = ClassBreakpointPanel.addClassNameEditorCC(JavaFieldNbDebugEditorKit.MIME_TYPE, null, b.getFieldName(), bundle.getString("TTT_TF_Field_Breakpoint_Field_Name"));
135
        spFieldName = editorCC.get1();
136
        spFieldName = editorCC.first();
136
        epFieldName = editorCC.get2();
137
        epFieldName = editorCC.second();
137
        
138
        
138
        jLabel1.setLabelFor(spFieldName);
139
        jLabel1.setLabelFor(spFieldName);
139
        java.awt.GridBagConstraints gridBagConstraints = new java.awt.GridBagConstraints();
140
        java.awt.GridBagConstraints gridBagConstraints = new java.awt.GridBagConstraints();
(-)a/debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/breakpoints/MethodBreakpointPanel.java (-4 / +5 lines)
Lines 60-65 Link Here
60
import org.openide.ErrorManager;
60
import org.openide.ErrorManager;
61
import org.openide.util.HelpCtx;
61
import org.openide.util.HelpCtx;
62
import org.openide.util.NbBundle;
62
import org.openide.util.NbBundle;
63
import org.openide.util.Pair;
63
64
64
/**
65
/**
65
 * @author  Jan Jancura
66
 * @author  Jan Jancura
Lines 126-133 Link Here
126
        className = ClassBreakpointPanel.concatClassFilters(cf);
127
        className = ClassBreakpointPanel.concatClassFilters(cf);
127
        String tooltipText = NbBundle.getMessage(MethodBreakpointPanel.class, "TTT_TF_Field_Breakpoint_Class_Name");
128
        String tooltipText = NbBundle.getMessage(MethodBreakpointPanel.class, "TTT_TF_Field_Breakpoint_Class_Name");
128
        Pair<JScrollPane, JEditorPane> editorCC = ClassBreakpointPanel.addClassNameEditorCC(JavaClassNbDebugEditorKit.MIME_TYPE, null, className, tooltipText);
129
        Pair<JScrollPane, JEditorPane> editorCC = ClassBreakpointPanel.addClassNameEditorCC(JavaClassNbDebugEditorKit.MIME_TYPE, null, className, tooltipText);
129
        spClassName = editorCC.get1();
130
        spClassName = editorCC.first();
130
        epClassName = editorCC.get2();
131
        epClassName = editorCC.second();
131
        epClassName.getAccessibleContext().setAccessibleName(NbBundle.getMessage(MethodBreakpointPanel.class, "ACSN_Method_Breakpoint_ClassName"));
132
        epClassName.getAccessibleContext().setAccessibleName(NbBundle.getMessage(MethodBreakpointPanel.class, "ACSN_Method_Breakpoint_ClassName"));
132
        epClassName.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(MethodBreakpointPanel.class, "ACSD_Method_Breakpoint_ClassName"));
133
        epClassName.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(MethodBreakpointPanel.class, "ACSD_Method_Breakpoint_ClassName"));
133
        jLabel3.setLabelFor(spClassName);
134
        jLabel3.setLabelFor(spClassName);
Lines 135-142 Link Here
135
        panelClassName.add(java.awt.BorderLayout.CENTER, spClassName);
136
        panelClassName.add(java.awt.BorderLayout.CENTER, spClassName);
136
        
137
        
137
        editorCC = ClassBreakpointPanel.addClassNameEditorCC(JavaMethodNbDebugEditorKit.MIME_TYPE, null, className, org.openide.util.NbBundle.getMessage(MethodBreakpointPanel.class, "TTT_TF_Method_Breakpoint_Method_Name"));
138
        editorCC = ClassBreakpointPanel.addClassNameEditorCC(JavaMethodNbDebugEditorKit.MIME_TYPE, null, className, org.openide.util.NbBundle.getMessage(MethodBreakpointPanel.class, "TTT_TF_Method_Breakpoint_Method_Name"));
138
        spMethodName = editorCC.get1();
139
        spMethodName = editorCC.first();
139
        epMethodName = editorCC.get2();
140
        epMethodName = editorCC.second();
140
        jLabel1.setLabelFor(spMethodName);
141
        jLabel1.setLabelFor(spMethodName);
141
        java.awt.GridBagConstraints gridBagConstraints = new java.awt.GridBagConstraints();
142
        java.awt.GridBagConstraints gridBagConstraints = new java.awt.GridBagConstraints();
142
        gridBagConstraints.gridx = 1;
143
        gridBagConstraints.gridx = 1;
(-)a/debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/breakpoints/Pair.java (-67 lines)
Lines 1-67 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.debugger.jpda.ui.breakpoints;
43
44
/**
45
 * A pair of values
46
 * 
47
 * @author Martin Entlicher
48
 */
49
final class Pair<T1, T2> {
50
        
51
    private final T1 o1;
52
    private final T2 o2;
53
54
    public Pair(final T1 o1, final T2 o2) {
55
        this.o1 = o1;
56
        this.o2 = o2;
57
    }
58
59
    public T1 get1() {
60
        return o1;
61
    }
62
63
    public T2 get2() {
64
        return o2;
65
    }
66
67
}
(-)a/html.editor/manifest.mf (-1 / +1 lines)
Lines 2-6 Link Here
2
OpenIDE-Module: org.netbeans.modules.html.editor/2
2
OpenIDE-Module: org.netbeans.modules.html.editor/2
3
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/html/editor/resources/Bundle.properties
3
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/html/editor/resources/Bundle.properties
4
OpenIDE-Module-Layer: org/netbeans/modules/html/editor/resources/layer.xml
4
OpenIDE-Module-Layer: org/netbeans/modules/html/editor/resources/layer.xml
5
OpenIDE-Module-Specification-Version: 2.19
5
OpenIDE-Module-Specification-Version: 2.20
6
AutoUpdate-Show-In-Client: false
6
AutoUpdate-Show-In-Client: false
(-)a/html.editor/nbproject/project.xml (-2 / +2 lines)
Lines 276-282 Link Here
276
                    <build-prerequisite/>
276
                    <build-prerequisite/>
277
                    <compile-dependency/>
277
                    <compile-dependency/>
278
                    <run-dependency>
278
                    <run-dependency>
279
                        <specification-version>1.12</specification-version>
279
                        <specification-version>1.46</specification-version>
280
                    </run-dependency>
280
                    </run-dependency>
281
                </dependency>
281
                </dependency>
282
                <dependency>
282
                <dependency>
Lines 365-371 Link Here
365
                    <build-prerequisite/>
365
                    <build-prerequisite/>
366
                    <compile-dependency/>
366
                    <compile-dependency/>
367
                    <run-dependency>
367
                    <run-dependency>
368
                        <specification-version>8.0</specification-version>
368
                        <specification-version>8.32</specification-version>
369
                    </run-dependency>
369
                    </run-dependency>
370
                </dependency>
370
                </dependency>
371
                <dependency>
371
                <dependency>
(-)a/html.editor/src/org/netbeans/modules/html/editor/gsf/HtmlStructureScanner.java (-6 / +6 lines)
Lines 57-66 Link Here
57
import org.netbeans.modules.html.editor.api.gsf.HtmlParserResult;
57
import org.netbeans.modules.html.editor.api.gsf.HtmlParserResult;
58
import org.netbeans.modules.html.editor.lib.api.elements.*;
58
import org.netbeans.modules.html.editor.lib.api.elements.*;
59
import org.netbeans.modules.parsing.api.Snapshot;
59
import org.netbeans.modules.parsing.api.Snapshot;
60
import org.netbeans.modules.web.common.api.Pair;
61
import org.openide.filesystems.FileObject;
60
import org.openide.filesystems.FileObject;
62
import org.openide.util.NbBundle;
61
import org.openide.util.NbBundle;
63
import static org.netbeans.modules.html.editor.gsf.Bundle.*;
62
import static org.netbeans.modules.html.editor.gsf.Bundle.*;
63
import org.openide.util.Pair;
64
64
65
/**
65
/**
66
 *
66
 *
Lines 99-106 Link Here
99
        if (cache != null) {
99
        if (cache != null) {
100
            Pair<ParserResult, List<HtmlStructureItem>> pair = cache.get();
100
            Pair<ParserResult, List<HtmlStructureItem>> pair = cache.get();
101
            if (pair != null) {
101
            if (pair != null) {
102
                if (info == pair.getA()) {
102
                if (info == pair.first()) {
103
                    return pair.getB();
103
                    return pair.second();
104
                }
104
                }
105
            }
105
            }
106
        }
106
        }
Lines 119-133 Link Here
119
119
120
        Snapshot snapshot = info.getSnapshot();
120
        Snapshot snapshot = info.getSnapshot();
121
        FileObject file = snapshot.getSource().getFileObject();
121
        FileObject file = snapshot.getSource().getFileObject();
122
        List<StructureItem> elements = new ArrayList<StructureItem>();
122
        List<HtmlStructureItem> elements = new ArrayList<HtmlStructureItem>();
123
        for(OpenTag tag : root.children(OpenTag.class)) {
123
        for(OpenTag tag : root.children(OpenTag.class)) {
124
            HtmlElementHandle handle = new HtmlElementHandle(tag, file);
124
            HtmlElementHandle handle = new HtmlElementHandle(tag, file);
125
            StructureItem si = new HtmlStructureItem(tag, handle, snapshot);
125
            HtmlStructureItem si = new HtmlStructureItem(tag, handle, snapshot);
126
            elements.add(si);
126
            elements.add(si);
127
        }
127
        }
128
128
129
        //cache
129
        //cache
130
        Pair<ParserResult, List<HtmlStructureItem>> pair = new Pair(info, elements);
130
        Pair<ParserResult, List<HtmlStructureItem>> pair = Pair.of(info, elements);
131
        cache = new WeakReference<Pair<ParserResult, List<HtmlStructureItem>>>(pair);
131
        cache = new WeakReference<Pair<ParserResult, List<HtmlStructureItem>>>(pair);
132
132
133
        return elements;
133
        return elements;
(-)a/java.hints/nbproject/project.xml (-1 / +1 lines)
Lines 425-431 Link Here
425
                    <build-prerequisite/>
425
                    <build-prerequisite/>
426
                    <compile-dependency/>
426
                    <compile-dependency/>
427
                    <run-dependency>
427
                    <run-dependency>
428
                        <specification-version>8.10</specification-version>
428
                        <specification-version>8.32</specification-version>
429
                    </run-dependency>
429
                    </run-dependency>
430
                </dependency>
430
                </dependency>
431
                <dependency>
431
                <dependency>
(-)a/java.hints/src/org/netbeans/modules/java/hints/ConvertAnonymousToInner.java (-3 / +3 lines)
Lines 83-89 Link Here
83
import org.netbeans.api.java.source.support.SelectionAwareJavaSourceTaskFactory;
83
import org.netbeans.api.java.source.support.SelectionAwareJavaSourceTaskFactory;
84
import org.netbeans.modules.java.editor.rename.InstantRenamePerformer;
84
import org.netbeans.modules.java.editor.rename.InstantRenamePerformer;
85
import org.netbeans.modules.java.hints.errors.Utilities;
85
import org.netbeans.modules.java.hints.errors.Utilities;
86
import org.netbeans.modules.java.hints.infrastructure.Pair;
87
import org.netbeans.modules.java.hints.spi.AbstractHint;
86
import org.netbeans.modules.java.hints.spi.AbstractHint;
88
import org.netbeans.spi.editor.hints.ChangeInfo;
87
import org.netbeans.spi.editor.hints.ChangeInfo;
89
import org.netbeans.spi.editor.hints.ErrorDescription;
88
import org.netbeans.spi.editor.hints.ErrorDescription;
Lines 96-101 Link Here
96
import org.openide.loaders.DataObjectNotFoundException;
95
import org.openide.loaders.DataObjectNotFoundException;
97
import org.openide.util.Exceptions;
96
import org.openide.util.Exceptions;
98
import org.openide.util.NbBundle;
97
import org.openide.util.NbBundle;
98
import org.openide.util.Pair;
99
99
100
/**
100
/**
101
 *
101
 *
Lines 491-498 Link Here
491
	    if (resolvedArguments != null) {
491
	    if (resolvedArguments != null) {
492
		nueSuperConstructorCallRealArguments = new LinkedList<ExpressionTree>();
492
		nueSuperConstructorCallRealArguments = new LinkedList<ExpressionTree>();
493
493
494
		Iterator<? extends TypeMirror> typeIt   = resolvedArguments.getA().iterator();
494
		Iterator<? extends TypeMirror> typeIt   = resolvedArguments.first().iterator();
495
		Iterator<String>               nameIt   = resolvedArguments.getB().iterator();
495
		Iterator<String>               nameIt   = resolvedArguments.second().iterator();
496
496
497
		while (typeIt.hasNext() && nameIt.hasNext()) {
497
		while (typeIt.hasNext() && nameIt.hasNext()) {
498
		    TypeMirror tm = typeIt.next();
498
		    TypeMirror tm = typeIt.next();
(-)a/java.hints/src/org/netbeans/modules/java/hints/bugs/UnusedAssignmentOrBranch.java (-4 / +4 lines)
Lines 57-63 Link Here
57
import org.netbeans.api.java.source.CompilationInfo;
57
import org.netbeans.api.java.source.CompilationInfo;
58
import org.netbeans.api.java.source.CompilationInfo.CacheClearPolicy;
58
import org.netbeans.api.java.source.CompilationInfo.CacheClearPolicy;
59
import org.netbeans.api.java.source.support.CancellableTreePathScanner;
59
import org.netbeans.api.java.source.support.CancellableTreePathScanner;
60
import org.netbeans.modules.java.hints.infrastructure.Pair;
61
import org.netbeans.modules.java.hints.introduce.Flow;
60
import org.netbeans.modules.java.hints.introduce.Flow;
62
import org.netbeans.modules.java.hints.introduce.Flow.FlowResult;
61
import org.netbeans.modules.java.hints.introduce.Flow.FlowResult;
63
import org.netbeans.spi.java.hints.Hint;
62
import org.netbeans.spi.java.hints.Hint;
Lines 69-74 Link Here
69
import org.netbeans.spi.java.hints.TriggerPattern;
68
import org.netbeans.spi.java.hints.TriggerPattern;
70
import org.netbeans.spi.java.hints.TriggerPatterns;
69
import org.netbeans.spi.java.hints.TriggerPatterns;
71
import org.openide.util.NbBundle;
70
import org.openide.util.NbBundle;
71
import org.openide.util.Pair;
72
72
73
/**
73
/**
74
 *
74
 *
Lines 136-142 Link Here
136
            }
136
            }
137
        }.scan(info.getCompilationUnit(), null);
137
        }.scan(info.getCompilationUnit(), null);
138
138
139
        info.putCachedValue(KEY_COMPUTED_ASSIGNMENTS, result = new Pair<Set<Tree>, Set<Element>>(usedAssignments, usedVariables), CacheClearPolicy.ON_TASK_END);
139
        info.putCachedValue(KEY_COMPUTED_ASSIGNMENTS, result = Pair.<Set<Tree>, Set<Element>>of(usedAssignments, usedVariables), CacheClearPolicy.ON_TASK_END);
140
140
141
        return result;
141
        return result;
142
    }
142
    }
Lines 155-162 Link Here
155
        if (ctx.isCanceled() || computedAssignments == null) return null;
155
        if (ctx.isCanceled() || computedAssignments == null) return null;
156
156
157
        final CompilationInfo info = ctx.getInfo();
157
        final CompilationInfo info = ctx.getInfo();
158
        final Set<Tree> usedAssignments = computedAssignments.getA();
158
        final Set<Tree> usedAssignments = computedAssignments.first();
159
        final Set<Element> usedVariables = computedAssignments.getB();
159
        final Set<Element> usedVariables = computedAssignments.second();
160
        Element var = info.getTrees().getElement(ctx.getVariables().get("$var"));
160
        Element var = info.getTrees().getElement(ctx.getVariables().get("$var"));
161
        Tree value = ctx.getVariables().get("$value").getLeaf();
161
        Tree value = ctx.getVariables().get("$value").getLeaf();
162
162
(-)a/java.hints/src/org/netbeans/modules/java/hints/errors/ChangeMethodParameters.java (-1 / +1 lines)
Lines 52-58 Link Here
52
import org.netbeans.api.java.source.TreePathHandle;
52
import org.netbeans.api.java.source.TreePathHandle;
53
import org.netbeans.api.java.source.TreeUtilities;
53
import org.netbeans.api.java.source.TreeUtilities;
54
import org.netbeans.modules.java.hints.infrastructure.ErrorHintsProvider;
54
import org.netbeans.modules.java.hints.infrastructure.ErrorHintsProvider;
55
import org.netbeans.modules.java.hints.infrastructure.Pair;
56
import org.netbeans.modules.java.hints.spi.ErrorRule;
55
import org.netbeans.modules.java.hints.spi.ErrorRule;
57
import org.netbeans.modules.java.hints.spi.ErrorRule.Data;
56
import org.netbeans.modules.java.hints.spi.ErrorRule.Data;
58
import org.netbeans.modules.refactoring.java.api.ChangeParametersRefactoring;
57
import org.netbeans.modules.refactoring.java.api.ChangeParametersRefactoring;
Lines 60-65 Link Here
60
import org.netbeans.spi.editor.hints.Fix;
59
import org.netbeans.spi.editor.hints.Fix;
61
import org.openide.util.Exceptions;
60
import org.openide.util.Exceptions;
62
import org.openide.util.NbBundle;
61
import org.openide.util.NbBundle;
62
import org.openide.util.Pair;
63
63
64
64
65
public class ChangeMethodParameters implements ErrorRule<Void> {
65
public class ChangeMethodParameters implements ErrorRule<Void> {
(-)a/java.hints/src/org/netbeans/modules/java/hints/errors/CreateElement.java (-5 / +5 lines)
Lines 85-91 Link Here
85
import org.netbeans.modules.java.hints.errors.CreateClassFix.CreateInnerClassFix;
85
import org.netbeans.modules.java.hints.errors.CreateClassFix.CreateInnerClassFix;
86
import org.netbeans.modules.java.hints.errors.CreateClassFix.CreateOuterClassFix;
86
import org.netbeans.modules.java.hints.errors.CreateClassFix.CreateOuterClassFix;
87
import org.netbeans.modules.java.hints.infrastructure.ErrorHintsProvider;
87
import org.netbeans.modules.java.hints.infrastructure.ErrorHintsProvider;
88
import org.netbeans.modules.java.hints.infrastructure.Pair;
89
import org.netbeans.modules.java.hints.spi.ErrorRule;
88
import org.netbeans.modules.java.hints.spi.ErrorRule;
90
import org.netbeans.spi.editor.hints.Fix;
89
import org.netbeans.spi.editor.hints.Fix;
91
import org.openide.ErrorManager;
90
import org.openide.ErrorManager;
Lines 96-101 Link Here
96
import static org.netbeans.modules.java.hints.errors.CreateElementUtilities.*;
95
import static org.netbeans.modules.java.hints.errors.CreateElementUtilities.*;
97
import org.netbeans.modules.java.hints.errors.ErrorFixesFakeHint.FixKind;
96
import org.netbeans.modules.java.hints.errors.ErrorFixesFakeHint.FixKind;
98
import org.netbeans.modules.java.hints.errors.Utilities.MethodArguments;
97
import org.netbeans.modules.java.hints.errors.Utilities.MethodArguments;
98
import org.openide.util.Pair;
99
99
100
/**
100
/**
101
 *
101
 *
Lines 449-455 Link Here
449
    }
449
    }
450
450
451
    private static List<Fix> prepareCreateOuterClassFix(CompilationInfo info, TreePath invocation, Element source, Set<Modifier> modifiers, String simpleName, List<? extends ExpressionTree> realArguments, TypeMirror superType, ElementKind kind, int numTypeParameters) {
451
    private static List<Fix> prepareCreateOuterClassFix(CompilationInfo info, TreePath invocation, Element source, Set<Modifier> modifiers, String simpleName, List<? extends ExpressionTree> realArguments, TypeMirror superType, ElementKind kind, int numTypeParameters) {
452
        Pair<List<? extends TypeMirror>, List<String>> formalArguments = invocation != null ? Utilities.resolveArguments(info, invocation, realArguments, null) : new Pair<List<? extends TypeMirror>, List<String>>(null, null);
452
        Pair<List<? extends TypeMirror>, List<String>> formalArguments = invocation != null ? Utilities.resolveArguments(info, invocation, realArguments, null) : Pair.<List<? extends TypeMirror>, List<String>>of(null, null);
453
453
454
        if (formalArguments == null) {
454
        if (formalArguments == null) {
455
            return Collections.<Fix>emptyList();
455
            return Collections.<Fix>emptyList();
Lines 464-474 Link Here
464
464
465
        PackageElement packageElement = (PackageElement) (source instanceof PackageElement ? source : info.getElementUtilities().outermostTypeElement(source).getEnclosingElement());
465
        PackageElement packageElement = (PackageElement) (source instanceof PackageElement ? source : info.getElementUtilities().outermostTypeElement(source).getEnclosingElement());
466
466
467
        return Collections.<Fix>singletonList(new CreateOuterClassFix(info, root, packageElement.getQualifiedName().toString(), simpleName, modifiers, formalArguments.getA(), formalArguments.getB(), superType, kind, numTypeParameters));
467
        return Collections.<Fix>singletonList(new CreateOuterClassFix(info, root, packageElement.getQualifiedName().toString(), simpleName, modifiers, formalArguments.first(), formalArguments.second(), superType, kind, numTypeParameters));
468
    }
468
    }
469
469
470
    private static List<Fix> prepareCreateInnerClassFix(CompilationInfo info, TreePath invocation, TypeElement target, Set<Modifier> modifiers, String simpleName, List<? extends ExpressionTree> realArguments, TypeMirror superType, ElementKind kind, int numTypeParameters) {
470
    private static List<Fix> prepareCreateInnerClassFix(CompilationInfo info, TreePath invocation, TypeElement target, Set<Modifier> modifiers, String simpleName, List<? extends ExpressionTree> realArguments, TypeMirror superType, ElementKind kind, int numTypeParameters) {
471
        Pair<List<? extends TypeMirror>, List<String>> formalArguments = invocation != null ? Utilities.resolveArguments(info, invocation, realArguments, target) : new Pair<List<? extends TypeMirror>, List<String>>(null, null);
471
        Pair<List<? extends TypeMirror>, List<String>> formalArguments = invocation != null ? Utilities.resolveArguments(info, invocation, realArguments, target) : Pair.<List<? extends TypeMirror>, List<String>>of(null, null);
472
472
473
        if (formalArguments == null) {
473
        if (formalArguments == null) {
474
            return Collections.<Fix>emptyList();
474
            return Collections.<Fix>emptyList();
Lines 483-489 Link Here
483
        if (targetFile == null)
483
        if (targetFile == null)
484
            return Collections.<Fix>emptyList();
484
            return Collections.<Fix>emptyList();
485
485
486
        return Collections.<Fix>singletonList(new CreateInnerClassFix(info, simpleName, modifiers, target, formalArguments.getA(), formalArguments.getB(), superType, kind, numTypeParameters, targetFile));
486
        return Collections.<Fix>singletonList(new CreateInnerClassFix(info, simpleName, modifiers, target, formalArguments.first(), formalArguments.second(), superType, kind, numTypeParameters, targetFile));
487
    }
487
    }
488
488
489
    private static ElementKind getClassType(Set<ElementKind> types) {
489
    private static ElementKind getClassType(Set<ElementKind> types) {
(-)a/java.hints/src/org/netbeans/modules/java/hints/errors/ImportClass.java (-9 / +9 lines)
Lines 85-91 Link Here
85
import org.netbeans.modules.java.hints.errors.ImportClass.ImportCandidatesHolder;
85
import org.netbeans.modules.java.hints.errors.ImportClass.ImportCandidatesHolder;
86
import org.netbeans.modules.java.hints.infrastructure.CreatorBasedLazyFixList;
86
import org.netbeans.modules.java.hints.infrastructure.CreatorBasedLazyFixList;
87
import org.netbeans.modules.java.hints.infrastructure.ErrorHintsProvider;
87
import org.netbeans.modules.java.hints.infrastructure.ErrorHintsProvider;
88
import org.netbeans.modules.java.hints.infrastructure.Pair;
89
import org.netbeans.modules.java.hints.spi.ErrorRule;
88
import org.netbeans.modules.java.hints.spi.ErrorRule;
90
import org.netbeans.modules.java.preprocessorbridge.spi.ImportProcessor;
89
import org.netbeans.modules.java.preprocessorbridge.spi.ImportProcessor;
91
import org.netbeans.spi.editor.hints.ChangeInfo;
90
import org.netbeans.spi.editor.hints.ChangeInfo;
Lines 100-105 Link Here
100
import org.openide.util.Lookup;
99
import org.openide.util.Lookup;
101
import org.openide.util.NbBundle;
100
import org.openide.util.NbBundle;
102
import org.openide.util.NbBundle.Messages;
101
import org.openide.util.NbBundle.Messages;
102
import org.openide.util.Pair;
103
import org.openide.util.RequestProcessor;
103
import org.openide.util.RequestProcessor;
104
104
105
105
Lines 160-166 Link Here
160
            Element el = info.getTrees().getElement(new TreePath(new TreePath(new TreePath(info.getCompilationUnit()), it), it.getQualifiedIdentifier()));
160
            Element el = info.getTrees().getElement(new TreePath(new TreePath(new TreePath(info.getCompilationUnit()), it), it.getQualifiedIdentifier()));
161
161
162
            if (candidates != null && el != null) {
162
            if (candidates != null && el != null) {
163
                List<Element> a = candidates.getA();
163
                List<Element> a = candidates.first();
164
                if (a != null && a.contains(el)) {
164
                if (a != null && a.contains(el)) {
165
                    return Collections.<Fix>emptyList();
165
                    return Collections.<Fix>emptyList();
166
                }
166
                }
Lines 179-186 Link Here
179
            imp = imp.getParentPath();
179
            imp = imp.getParentPath();
180
        }
180
        }
181
181
182
        List<Element> filtered = candidates.getA();
182
        List<Element> filtered = candidates.first();
183
        List<Element> unfiltered = candidates.getB();
183
        List<Element> unfiltered = candidates.second();
184
        List<Fix> fixes = new ArrayList<Fix>();
184
        List<Fix> fixes = new ArrayList<Fix>();
185
        
185
        
186
        if (unfiltered != null && filtered != null) {
186
        if (unfiltered != null && filtered != null) {
Lines 264-270 Link Here
264
        
264
        
265
        Pair<Map<String, List<Element>>, Map<String, List<Element>>> result = holder.getCandidates();
265
        Pair<Map<String, List<Element>>, Map<String, List<Element>>> result = holder.getCandidates();
266
        
266
        
267
        if (result == null || result.getA() == null || result.getB() == null) {
267
        if (result == null || result.first() == null || result.second() == null) {
268
            //compute imports:
268
            //compute imports:
269
            Map<String, List<String>> candidates = new HashMap<String, List<String>>();
269
            Map<String, List<String>> candidates = new HashMap<String, List<String>>();
270
            ComputeImports imp = new ComputeImports();
270
            ComputeImports imp = new ComputeImports();
Lines 303-317 Link Here
303
                notFilteredCandidates.put(sn, c);
303
                notFilteredCandidates.put(sn, c);
304
            }
304
            }
305
            
305
            
306
            result = new Pair<Map<String, List<Element>>, Map<String, List<Element>>>(rawCandidates.a, rawCandidates.b);
306
            result = Pair.<Map<String, List<Element>>, Map<String, List<Element>>>of(rawCandidates.a, rawCandidates.b);
307
            
307
            
308
            holder.setCandidates(result);
308
            holder.setCandidates(result);
309
        }
309
        }
310
        
310
        
311
        List<Element> candList = result.getA().get(simpleName);
311
        List<Element> candList = result.first().get(simpleName);
312
        List<Element> notFilteredCandList = result.getB().get(simpleName);
312
        List<Element> notFilteredCandList = result.second().get(simpleName);
313
        
313
        
314
        return new Pair(candList, notFilteredCandList);
314
        return Pair.<List<Element>, List<Element>>of(candList, notFilteredCandList);
315
    }
315
    }
316
    
316
    
317
    public static class ImportCandidatesHolder {
317
    public static class ImportCandidatesHolder {
(-)a/java.hints/src/org/netbeans/modules/java/hints/errors/Utilities.java (-2 / +2 lines)
Lines 59-65 Link Here
59
import org.netbeans.api.java.source.TreeUtilities;
59
import org.netbeans.api.java.source.TreeUtilities;
60
import org.openide.filesystems.FileUtil;
60
import org.openide.filesystems.FileUtil;
61
import org.openide.util.NbBundle;
61
import org.openide.util.NbBundle;
62
import org.netbeans.modules.java.hints.infrastructure.Pair;
63
import com.sun.source.tree.ArrayAccessTree;
62
import com.sun.source.tree.ArrayAccessTree;
64
import com.sun.source.tree.ArrayTypeTree;
63
import com.sun.source.tree.ArrayTypeTree;
65
import com.sun.source.tree.BinaryTree;
64
import com.sun.source.tree.BinaryTree;
Lines 138-143 Link Here
138
import org.openide.util.Exceptions;
137
import org.openide.util.Exceptions;
139
138
140
import static com.sun.source.tree.Tree.Kind.*;
139
import static com.sun.source.tree.Tree.Kind.*;
140
import org.openide.util.Pair;
141
141
142
/**
142
/**
143
 *
143
 *
Lines 880-886 Link Here
880
        
880
        
881
        if (ma == null) return null;
881
        if (ma == null) return null;
882
        
882
        
883
        return new Pair<List<? extends TypeMirror>, List<String>>(ma.parameterTypes, ma.parameterNames);
883
        return Pair.<List<? extends TypeMirror>, List<String>>of(ma.parameterTypes, ma.parameterNames);
884
    }
884
    }
885
    
885
    
886
    public static MethodArguments resolveArguments(CompilationInfo info, TreePath invocation, List<? extends ExpressionTree> realArguments, Element target, TypeMirror returnType) {
886
    public static MethodArguments resolveArguments(CompilationInfo info, TreePath invocation, List<? extends ExpressionTree> realArguments, Element target, TypeMirror returnType) {
(-)a/java.hints/src/org/netbeans/modules/java/hints/infrastructure/Pair.java (-73 lines)
Lines 1-73 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 1997-2010 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
 * Contributor(s):
28
 *
29
 * The Original Software is NetBeans. The Initial Developer of the Original
30
 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
31
 * Microsystems, Inc. All Rights Reserved.
32
 *
33
 * If you wish your version of this file to be governed by only the CDDL
34
 * or only the GPL Version 2, indicate your decision by adding
35
 * "[Contributor] elects to include this software in this distribution
36
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
37
 * single choice of license, a recipient has the option to distribute
38
 * your version of this file under either the CDDL, the GPL Version 2 or
39
 * to extend the choice of license to its licensees as provided above.
40
 * However, if you add GPL Version 2 code and therefore, elected the GPL
41
 * Version 2 license, then the option applies only if the new code is
42
 * made subject to such option by the copyright holder.
43
 */
44
45
package org.netbeans.modules.java.hints.infrastructure;
46
47
/**
48
 *
49
 * @author Jan Lahoda
50
 */
51
public final class Pair<A, B> {
52
53
    private A a;
54
    private B b;
55
56
    public Pair(A a, B b) {
57
        this.a = a;
58
        this.b = b;
59
    }
60
61
    public A getA() {
62
        return a;
63
    }
64
65
    public B getB() {
66
        return b;
67
    }
68
    
69
     @Override
70
     public String toString() {
71
         return "[" + String.valueOf(a) + "/" + String.valueOf(b) + "]";
72
     }
73
}
(-)a/java.hints/src/org/netbeans/modules/java/hints/jackpot/hintsimpl/ForbiddenMethod.java (-4 / +4 lines)
Lines 55-62 Link Here
55
import org.netbeans.spi.java.hints.TriggerTreeKind;
55
import org.netbeans.spi.java.hints.TriggerTreeKind;
56
import org.netbeans.spi.java.hints.HintContext;
56
import org.netbeans.spi.java.hints.HintContext;
57
import org.netbeans.spi.java.hints.ErrorDescriptionFactory;
57
import org.netbeans.spi.java.hints.ErrorDescriptionFactory;
58
import org.netbeans.modules.java.hints.infrastructure.Pair;
59
import org.netbeans.spi.editor.hints.ErrorDescription;
58
import org.netbeans.spi.editor.hints.ErrorDescription;
59
import org.openide.util.Pair;
60
60
61
/**
61
/**
62
 *
62
 *
Lines 69-75 Link Here
69
69
70
    static {
70
    static {
71
        map = new HashMap<String, Pair<String, String>>();
71
        map = new HashMap<String, Pair<String, String>>();
72
        map.put("exit", new Pair<String, String>("System", "Non-portable"));
72
        map.put("exit", Pair.<String, String>of("System", "Non-portable"));
73
    }
73
    }
74
74
75
    @TriggerTreeKind(Tree.Kind.METHOD_INVOCATION)
75
    @TriggerTreeKind(Tree.Kind.METHOD_INVOCATION)
Lines 86-93 Link Here
86
        String parent = e.getEnclosingElement().getSimpleName().toString();
86
        String parent = e.getEnclosingElement().getSimpleName().toString();
87
87
88
        Pair<String, String> pair = map.get(simpleName);
88
        Pair<String, String> pair = map.get(simpleName);
89
        if (pair != null && pair.getA().equals(parent)) {
89
        if (pair != null && pair.first().equals(parent)) {
90
            return ErrorDescriptionFactory.forName(ctx, mit, pair.getB());
90
            return ErrorDescriptionFactory.forName(ctx, mit, pair.second());
91
        }
91
        }
92
92
93
93
(-)a/java.j2seprofiles/nbproject/project.xml (-1 / +1 lines)
Lines 139-145 Link Here
139
                    <build-prerequisite/>
139
                    <build-prerequisite/>
140
                    <compile-dependency/>
140
                    <compile-dependency/>
141
                    <run-dependency>
141
                    <run-dependency>
142
                        <specification-version>8.31</specification-version>
142
                        <specification-version>8.32</specification-version>
143
                    </run-dependency>
143
                    </run-dependency>
144
                </dependency>
144
                </dependency>
145
                <dependency>
145
                <dependency>
(-)a/java.j2seprofiles/src/org/netbeans/modules/java/j2seprofiles/Pair.java (-87 lines)
Lines 1-87 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2010 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 2009 Sun Microsystems, Inc.
41
 */
42
43
package org.netbeans.modules.java.j2seprofiles;
44
45
/**
46
 * Just another copy of Pair.
47
 * @author Tomas Zezula
48
 */
49
final class Pair<P,K> {
50
51
    public final P first;
52
    public final K second;
53
54
    private Pair (P first, K second) {
55
        this.first = first;
56
        this.second = second;
57
    }
58
59
60
    public static <P,K> Pair<P,K> of (P first, K second) {
61
        return new Pair<P,K> (first,second);
62
    }
63
64
65
    @Override
66
    public int hashCode () {
67
        int hashCode  = 0;
68
        hashCode ^= first == null ? 0 : first.hashCode();
69
        hashCode ^= second == null ? 0: second.hashCode();
70
        return hashCode;
71
    }
72
73
    @Override
74
    public boolean equals (final Object other) {
75
        if (other instanceof Pair) {
76
            Pair<?,?> otherPair = (Pair<?,?>) other;
77
            return (this.first == null ? otherPair.first == null : this.first.equals(otherPair.first)) &&
78
                   (this.second == null ? otherPair.second == null : this.second.equals(otherPair.second));
79
        }
80
        return false;
81
    }
82
83
    @Override
84
    public String toString () {
85
        return String.format("Pair[%s,%s]", first,second);
86
    }
87
}
(-)a/java.j2seprofiles/src/org/netbeans/modules/java/j2seprofiles/ProfilesAnalyzer.java (-7 / +8 lines)
Lines 107-112 Link Here
107
import org.openide.filesystems.FileUtil;
107
import org.openide.filesystems.FileUtil;
108
import org.openide.filesystems.URLMapper;
108
import org.openide.filesystems.URLMapper;
109
import org.openide.util.Exceptions;
109
import org.openide.util.Exceptions;
110
import org.openide.util.Pair;
110
import org.openide.util.lookup.ServiceProvider;
111
import org.openide.util.lookup.ServiceProvider;
111
112
112
/**
113
/**
Lines 188-194 Link Here
188
                    filterForRoot = Pair.<Set<FileObject>,Set<FileObject>>of(new HashSet<FileObject>(), new HashSet<FileObject>());
189
                    filterForRoot = Pair.<Set<FileObject>,Set<FileObject>>of(new HashSet<FileObject>(), new HashSet<FileObject>());
189
                    filter.put(ownerRoot, filterForRoot);
190
                    filter.put(ownerRoot, filterForRoot);
190
                }
191
                }
191
                filterForRoot.first.add(f);
192
                filterForRoot.first().add(f);
192
            }
193
            }
193
        }
194
        }
194
        for (FileObject f : scope.getFiles()) {
195
        for (FileObject f : scope.getFiles()) {
Lines 200-206 Link Here
200
                    filterForRoot = Pair.<Set<FileObject>,Set<FileObject>>of(new HashSet<FileObject>(), new HashSet<FileObject>());
201
                    filterForRoot = Pair.<Set<FileObject>,Set<FileObject>>of(new HashSet<FileObject>(), new HashSet<FileObject>());
201
                    filter.put(ownerRoot, filterForRoot);
202
                    filter.put(ownerRoot, filterForRoot);
202
                }
203
                }
203
                filterForRoot.second.add(f);
204
                filterForRoot.second().add(f);
204
            }
205
            }
205
        }
206
        }
206
        final ProfileProvider pp = new ProfileProvider(context);
207
        final ProfileProvider pp = new ProfileProvider(context);
Lines 249-261 Link Here
249
                    if (canceled.get()) {
250
                    if (canceled.get()) {
250
                        break;
251
                        break;
251
                    }
252
                    }
252
                    final URI rootURI = violationsPair.first.first;
253
                    final URI rootURI = violationsPair.first().first();
253
                    final Set<Project> projects = submittedBinaries.remove(violationsPair.first);
254
                    final Set<Project> projects = submittedBinaries.remove(violationsPair.first());
254
                    final boolean binary = projects != null;
255
                    final boolean binary = projects != null;
255
                    if (!binary) {
256
                    if (!binary) {
256
                        submittedSources.remove(rootURI);
257
                        submittedSources.remove(rootURI);
257
                    }
258
                    }
258
                    final Collection<? extends ProfileSupport.Violation> violations = violationsPair.second;
259
                    final Collection<? extends ProfileSupport.Violation> violations = violationsPair.second();
259
                    if (violations.isEmpty()) {
260
                    if (violations.isEmpty()) {
260
                        continue;
261
                        continue;
261
                    }
262
                    }
Lines 526-535 Link Here
526
        if (filter == null) {
527
        if (filter == null) {
527
            return true;
528
            return true;
528
        }
529
        }
529
        if (filter.second.contains(source)) {
530
        if (filter.second().contains(source)) {
530
            return true;
531
            return true;
531
        }
532
        }
532
        for (FileObject folder : filter.first) {
533
        for (FileObject folder : filter.first()) {
533
            if (folder.equals(source.getParent())) {
534
            if (folder.equals(source.getParent())) {
534
                return true;
535
                return true;
535
            }            
536
            }            
(-)a/java.navigation/nbproject/project.xml (-1 / +1 lines)
Lines 296-302 Link Here
296
                    <build-prerequisite/>
296
                    <build-prerequisite/>
297
                    <compile-dependency/>
297
                    <compile-dependency/>
298
                    <run-dependency>
298
                    <run-dependency>
299
                        <specification-version>8.0</specification-version>
299
                        <specification-version>8.32</specification-version>
300
                    </run-dependency>
300
                    </run-dependency>
301
                </dependency>
301
                </dependency>
302
                <dependency>
302
                <dependency>
(-)a/java.navigation/src/org/netbeans/modules/java/navigation/ClassMemberPanelUI.java (-4 / +4 lines)
Lines 96-102 Link Here
96
import org.netbeans.modules.java.navigation.actions.SortActions;
96
import org.netbeans.modules.java.navigation.actions.SortActions;
97
import org.netbeans.modules.java.navigation.base.FiltersManager;
97
import org.netbeans.modules.java.navigation.base.FiltersManager;
98
import org.netbeans.modules.java.navigation.base.HistorySupport;
98
import org.netbeans.modules.java.navigation.base.HistorySupport;
99
import org.netbeans.modules.java.navigation.base.Pair;
100
import org.netbeans.modules.java.navigation.base.Resolvers;
99
import org.netbeans.modules.java.navigation.base.Resolvers;
101
import org.netbeans.modules.java.navigation.base.SelectJavadocTask;
100
import org.netbeans.modules.java.navigation.base.SelectJavadocTask;
102
import org.openide.nodes.Node;
101
import org.openide.nodes.Node;
Lines 117-122 Link Here
117
import org.openide.util.Lookup;
116
import org.openide.util.Lookup;
118
import org.openide.util.Mutex;
117
import org.openide.util.Mutex;
119
import org.openide.util.NbPreferences;
118
import org.openide.util.NbPreferences;
119
import org.openide.util.Pair;
120
import org.openide.util.RequestProcessor;
120
import org.openide.util.RequestProcessor;
121
import org.openide.util.lookup.AbstractLookup;
121
import org.openide.util.lookup.AbstractLookup;
122
import org.openide.util.lookup.InstanceContent;
122
import org.openide.util.lookup.InstanceContent;
Lines 756-762 Link Here
756
            try {
756
            try {
757
                final Pair<URI,ElementHandle<TypeElement>> handlePair = becomesHandle.get();
757
                final Pair<URI,ElementHandle<TypeElement>> handlePair = becomesHandle.get();
758
                if (handlePair != null) {
758
                if (handlePair != null) {
759
                    final FileObject target = URLMapper.findFileObject(handlePair.first.toURL());
759
                    final FileObject target = URLMapper.findFileObject(handlePair.first().toURL());
760
                    if (target != null) {
760
                    if (target != null) {
761
                        final JavaSource targetJs = JavaSource.forFileObject(target);
761
                        final JavaSource targetJs = JavaSource.forFileObject(target);
762
                        if (targetJs != null) {
762
                        if (targetJs != null) {
Lines 766-777 Link Here
766
                        } else {
766
                        } else {
767
                            clearNodes();
767
                            clearNodes();
768
                            StatusDisplayer.getDefault().setStatusText(Bundle.ERR_Cannot_Resolve_File(
768
                            StatusDisplayer.getDefault().setStatusText(Bundle.ERR_Cannot_Resolve_File(
769
                                handlePair.second.getQualifiedName()));
769
                                handlePair.second().getQualifiedName()));
770
                        }
770
                        }
771
                    } else {
771
                    } else {
772
                        clearNodes();
772
                        clearNodes();
773
                        StatusDisplayer.getDefault().setStatusText(Bundle.ERR_Cannot_Resolve_File(
773
                        StatusDisplayer.getDefault().setStatusText(Bundle.ERR_Cannot_Resolve_File(
774
                                handlePair.second.getQualifiedName()));
774
                                handlePair.second().getQualifiedName()));
775
                    }
775
                    }
776
                } else {
776
                } else {
777
                    clearNodes();
777
                    clearNodes();
(-)a/java.navigation/src/org/netbeans/modules/java/navigation/base/HistorySupport.java (-4 / +5 lines)
Lines 68-73 Link Here
68
import org.netbeans.api.annotations.common.NullAllowed;
68
import org.netbeans.api.annotations.common.NullAllowed;
69
import org.netbeans.api.java.source.ElementHandle;
69
import org.netbeans.api.java.source.ElementHandle;
70
import org.openide.util.Mutex;
70
import org.openide.util.Mutex;
71
import org.openide.util.Pair;
71
import org.openide.util.Parameters;
72
import org.openide.util.Parameters;
72
import org.openide.util.WeakListeners;
73
import org.openide.util.WeakListeners;
73
74
Lines 181-188 Link Here
181
        @Override
182
        @Override
182
        public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
183
        public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
183
            String toolTipText = null;
184
            String toolTipText = null;
184
            if (value instanceof Pair && ((Pair)value).second instanceof ElementHandle) {
185
            if (value instanceof Pair && ((Pair)value).second() instanceof ElementHandle) {
185
                final String fqn =  ((ElementHandle)((Pair)value).second).getQualifiedName();
186
                final String fqn =  ((ElementHandle)((Pair)value).second()).getQualifiedName();
186
                value = getSimpleName(fqn);
187
                value = getSimpleName(fqn);
187
                toolTipText = fqn;
188
                toolTipText = fqn;
188
            }
189
            }
Lines 291-298 Link Here
291
292
292
        @Override
293
        @Override
293
        public int compare(Pair<URI, ElementHandle<TypeElement>> o1, Pair<URI, ElementHandle<TypeElement>> o2) {
294
        public int compare(Pair<URI, ElementHandle<TypeElement>> o1, Pair<URI, ElementHandle<TypeElement>> o2) {
294
            final String q1 = o1.second.getQualifiedName();
295
            final String q1 = o1.second().getQualifiedName();
295
            final String q2 = o2.second.getQualifiedName();
296
            final String q2 = o2.second().getQualifiedName();
296
            final String simpleName1 = getSimpleName(q1);
297
            final String simpleName1 = getSimpleName(q1);
297
            final String simpleName2 = getSimpleName(q2);
298
            final String simpleName2 = getSimpleName(q2);
298
            int res = simpleName1.compareTo(simpleName2);
299
            int res = simpleName1.compareTo(simpleName2);
(-)a/java.navigation/src/org/netbeans/modules/java/navigation/base/Pair.java (-75 lines)
Lines 1-75 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 1997-2010 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
 * Contributor(s):
28
 *
29
 * Portions Copyrighted 2007 Sun Microsystems, Inc.
30
 */
31
package org.netbeans.modules.java.navigation.base;
32
33
/**
34
 *
35
 * @author Tomas Zezula
36
 */
37
public final class Pair<P,K> {
38
39
    public final P first;
40
    public final K second;
41
42
    private Pair (P first, K second) {
43
        this.first = first;
44
        this.second = second;
45
    }
46
47
    
48
    public static <P,K> Pair<P,K> of (P first, K second) {
49
        return new Pair<P,K> (first,second);
50
    }
51
    
52
    
53
    @Override
54
    public int hashCode () {
55
        int hashCode  = 0;
56
        hashCode ^= first == null ? 0 : first.hashCode();
57
        hashCode ^= second == null ? 0: second.hashCode();
58
        return hashCode;
59
    }
60
    
61
    @Override
62
    public boolean equals (final Object other) {
63
        if (other instanceof Pair) {
64
            Pair otherPair = (Pair) other;
65
            return (this.first == null ? otherPair.first == null : this.first.equals(otherPair.first)) &&
66
                   (this.second == null ? otherPair.second == null : this.second.equals(otherPair.second));
67
        }
68
        return false;
69
    }
70
    
71
    @Override
72
    public String toString () {
73
        return String.format("Pair[%s,%s]", first,second);
74
    }
75
}
(-)a/java.navigation/src/org/netbeans/modules/java/navigation/base/Resolvers.java (+1 lines)
Lines 63-68 Link Here
63
import org.netbeans.api.java.source.JavaSource;
63
import org.netbeans.api.java.source.JavaSource;
64
import org.netbeans.api.java.source.Task;
64
import org.netbeans.api.java.source.Task;
65
import org.openide.filesystems.FileObject;
65
import org.openide.filesystems.FileObject;
66
import org.openide.util.Pair;
66
import org.openide.util.Parameters;
67
import org.openide.util.Parameters;
67
68
68
/**
69
/**
(-)a/java.navigation/src/org/netbeans/modules/java/navigation/base/SelectJavadocTask.java (-1 / +2 lines)
Lines 58-63 Link Here
58
import org.openide.nodes.Node;
58
import org.openide.nodes.Node;
59
import org.openide.util.Exceptions;
59
import org.openide.util.Exceptions;
60
import org.openide.util.Lookup;
60
import org.openide.util.Lookup;
61
import org.openide.util.Pair;
61
import org.openide.util.Parameters;
62
import org.openide.util.Parameters;
62
63
63
/**
64
/**
Lines 90-96 Link Here
90
                        final JavadocTopComponent tc = JavadocTopComponent.findInstance();
91
                        final JavadocTopComponent tc = JavadocTopComponent.findInstance();
91
                        if (tc != null) {
92
                        if (tc != null) {
92
                            tc.open();
93
                            tc.open();
93
                            tc.setJavadoc(documentation.first,documentation.second);
94
                            tc.setJavadoc(documentation.first(),documentation.second());
94
                        }
95
                        }
95
                    }
96
                    }
96
                });
97
                });
(-)a/java.navigation/src/org/netbeans/modules/java/navigation/hierarchy/HierarchyTopComponent.java (-7 / +7 lines)
Lines 95-101 Link Here
95
import org.netbeans.modules.java.navigation.JavadocTopComponent;
95
import org.netbeans.modules.java.navigation.JavadocTopComponent;
96
import org.netbeans.modules.java.navigation.NoBorderToolBar;
96
import org.netbeans.modules.java.navigation.NoBorderToolBar;
97
import org.netbeans.modules.java.navigation.base.HistorySupport;
97
import org.netbeans.modules.java.navigation.base.HistorySupport;
98
import org.netbeans.modules.java.navigation.base.Pair;
99
import org.netbeans.modules.java.navigation.base.Resolvers;
98
import org.netbeans.modules.java.navigation.base.Resolvers;
100
import org.netbeans.modules.java.navigation.base.SelectJavadocTask;
99
import org.netbeans.modules.java.navigation.base.SelectJavadocTask;
101
import org.netbeans.modules.java.navigation.base.TapPanel;
100
import org.netbeans.modules.java.navigation.base.TapPanel;
Lines 116-121 Link Here
116
import org.openide.util.NbPreferences;
115
import org.openide.util.NbPreferences;
117
import org.openide.windows.TopComponent;
116
import org.openide.windows.TopComponent;
118
import org.openide.util.NbBundle.Messages;
117
import org.openide.util.NbBundle.Messages;
118
import org.openide.util.Pair;
119
import org.openide.util.RequestProcessor;
119
import org.openide.util.RequestProcessor;
120
import org.openide.util.lookup.AbstractLookup;
120
import org.openide.util.lookup.AbstractLookup;
121
import org.openide.util.lookup.InstanceContent;
121
import org.openide.util.lookup.InstanceContent;
Lines 530-549 Link Here
530
                final Pair<URI,ElementHandle<TypeElement>> pair = toShow.get();
530
                final Pair<URI,ElementHandle<TypeElement>> pair = toShow.get();
531
                if (pair != null) {
531
                if (pair != null) {
532
                    if (viewType == ViewType.SUB_TYPE &&
532
                    if (viewType == ViewType.SUB_TYPE &&
533
                        Object.class.getName().equals(pair.second.getQualifiedName())) {
533
                        Object.class.getName().equals(pair.second().getQualifiedName())) {
534
                        nonActiveInfo.setText(Bundle.WARN_Object());
534
                        nonActiveInfo.setText(Bundle.WARN_Object());
535
                        ((CardLayout)contentView.getLayout()).show(contentView, NON_ACTIVE_CONTENT);
535
                        ((CardLayout)contentView.getLayout()).show(contentView, NON_ACTIVE_CONTENT);
536
                    } else {
536
                    } else {
537
                        final FileObject file = URLMapper.findFileObject(pair.first.toURL());
537
                        final FileObject file = URLMapper.findFileObject(pair.first().toURL());
538
                        JavaSource js;
538
                        JavaSource js;
539
                        if (file != null && (js=JavaSource.forFileObject(file)) != null) {
539
                        if (file != null && (js=JavaSource.forFileObject(file)) != null) {
540
                            LOG.log(Level.FINE, "Showing hierarchy for: {0}", pair.second.getQualifiedName());  //NOI18N
540
                            LOG.log(Level.FINE, "Showing hierarchy for: {0}", pair.second().getQualifiedName());  //NOI18N
541
                            history.addToHistory(pair);
541
                            history.addToHistory(pair);
542
                            js.runUserActionTask(new Task<CompilationController>() {
542
                            js.runUserActionTask(new Task<CompilationController>() {
543
                                @Override
543
                                @Override
544
                                public void run(CompilationController cc) throws Exception {
544
                                public void run(CompilationController cc) throws Exception {
545
                                    cc.toPhase(Phase.ELEMENTS_RESOLVED);
545
                                    cc.toPhase(Phase.ELEMENTS_RESOLVED);
546
                                    final TypeElement te = pair.second.resolve(cc);
546
                                    final TypeElement te = pair.second().resolve(cc);
547
                                    if (te != null) {
547
                                    if (te != null) {
548
                                        final Node root;
548
                                        final Node root;
549
                                        if (viewType == ViewType.SUPER_TYPE) {
549
                                        if (viewType == ViewType.SUPER_TYPE) {
Lines 583-589 Link Here
583
                            }, true);
583
                            }, true);
584
                        } else {
584
                        } else {
585
                            rootChildren.set(null);
585
                            rootChildren.set(null);
586
                            StatusDisplayer.getDefault().setStatusText(Bundle.ERR_Cannot_Resolve_File(pair.second.getQualifiedName()));
586
                            StatusDisplayer.getDefault().setStatusText(Bundle.ERR_Cannot_Resolve_File(pair.second().getQualifiedName()));
587
                        }
587
                        }
588
                    }
588
                    }
589
                } else {
589
                } else {
Lines 642-648 Link Here
642
            toolbar.setFocusable(false);
642
            toolbar.setFocusable(false);
643
            toolbar.setLayout(new GridBagLayout());
643
            toolbar.setLayout(new GridBagLayout());
644
            for (Pair<JComponent,GridBagConstraints> p : components) {
644
            for (Pair<JComponent,GridBagConstraints> p : components) {
645
                toolbar.add(p.first,p.second);
645
                toolbar.add(p.first(),p.second());
646
            }
646
            }
647
            add (toolbar);
647
            add (toolbar);
648
        }
648
        }
(-)a/java.source/nbproject/project.xml (-1 / +1 lines)
Lines 383-389 Link Here
383
                    <build-prerequisite/>
383
                    <build-prerequisite/>
384
                    <compile-dependency/>
384
                    <compile-dependency/>
385
                    <run-dependency>
385
                    <run-dependency>
386
                        <specification-version>8.25</specification-version>
386
                        <specification-version>8.32</specification-version>
387
                    </run-dependency>
387
                    </run-dependency>
388
                </dependency>
388
                </dependency>
389
                <dependency>
389
                <dependency>
(-)a/java.source/src/org/netbeans/api/java/source/CompilationInfo.java (-2 / +2 lines)
Lines 75-87 Link Here
75
import org.netbeans.modules.java.source.parsing.FileObjects;
75
import org.netbeans.modules.java.source.parsing.FileObjects;
76
import org.netbeans.modules.java.source.parsing.JavacParser;
76
import org.netbeans.modules.java.source.parsing.JavacParser;
77
import org.netbeans.modules.java.source.parsing.JavacParserResult;
77
import org.netbeans.modules.java.source.parsing.JavacParserResult;
78
import org.netbeans.modules.java.source.usages.Pair;
79
import org.netbeans.modules.parsing.api.Snapshot;
78
import org.netbeans.modules.parsing.api.Snapshot;
80
import org.netbeans.modules.parsing.spi.Parser;
79
import org.netbeans.modules.parsing.spi.Parser;
81
import org.openide.cookies.EditorCookie;
80
import org.openide.cookies.EditorCookie;
82
import org.openide.filesystems.FileObject;
81
import org.openide.filesystems.FileObject;
83
import org.openide.filesystems.FileUtil;
82
import org.openide.filesystems.FileUtil;
84
import org.openide.loaders.DataObject;
83
import org.openide.loaders.DataObject;
84
import org.openide.util.Pair;
85
import org.openide.util.Parameters;
85
import org.openide.util.Parameters;
86
86
87
/** Assorted information about the JavaSource.
87
/** Assorted information about the JavaSource.
Lines 171-177 Link Here
171
        if (cu == null) {
171
        if (cu == null) {
172
            return null;
172
            return null;
173
        }
173
        }
174
        return TreePath.getPath(cu, changedTree.second);
174
        return TreePath.getPath(cu, changedTree.second());
175
    }       
175
    }       
176
    
176
    
177
    /**
177
    /**
(-)a/java.source/src/org/netbeans/api/java/source/SourceUtils.java (-4 / +4 lines)
Lines 113-119 Link Here
113
import org.netbeans.modules.java.source.usages.ClassIndexManager;
113
import org.netbeans.modules.java.source.usages.ClassIndexManager;
114
import org.netbeans.modules.java.source.usages.ClasspathInfoAccessor;
114
import org.netbeans.modules.java.source.usages.ClasspathInfoAccessor;
115
import org.netbeans.modules.java.source.usages.ExecutableFilesIndex;
115
import org.netbeans.modules.java.source.usages.ExecutableFilesIndex;
116
import org.netbeans.modules.java.source.usages.Pair;
117
import org.netbeans.modules.parsing.api.ParserManager;
116
import org.netbeans.modules.parsing.api.ParserManager;
118
import org.netbeans.modules.parsing.api.ResultIterator;
117
import org.netbeans.modules.parsing.api.ResultIterator;
119
import org.netbeans.modules.parsing.api.UserTask;
118
import org.netbeans.modules.parsing.api.UserTask;
Lines 126-131 Link Here
126
import org.openide.filesystems.URLMapper;
125
import org.openide.filesystems.URLMapper;
127
import org.openide.util.Exceptions;
126
import org.openide.util.Exceptions;
128
import org.openide.util.Lookup;
127
import org.openide.util.Lookup;
128
import org.openide.util.Pair;
129
import org.openide.util.Parameters;
129
import org.openide.util.Parameters;
130
import org.openide.util.Utilities;
130
import org.openide.util.Utilities;
131
131
Lines 491-509 Link Here
491
            }
491
            }
492
            final List<Pair<FileObject,ClassPath>> fos = findAllResources(pkgName, cps);
492
            final List<Pair<FileObject,ClassPath>> fos = findAllResources(pkgName, cps);
493
            for (Pair<FileObject,ClassPath> pair : fos) {                
493
            for (Pair<FileObject,ClassPath> pair : fos) {                
494
                FileObject root = pair.second.findOwnerRoot(pair.first);
494
                FileObject root = pair.second().findOwnerRoot(pair.first());
495
                if (root == null)
495
                if (root == null)
496
                    continue;
496
                    continue;
497
                FileObject[] sourceRoots = SourceForBinaryQuery.findSourceRoots(root.toURL()).getRoots();                        
497
                FileObject[] sourceRoots = SourceForBinaryQuery.findSourceRoots(root.toURL()).getRoots();                        
498
                ClassPath sourcePath = ClassPathSupport.createClassPath(sourceRoots);
498
                ClassPath sourcePath = ClassPathSupport.createClassPath(sourceRoots);
499
                LinkedList<FileObject> folders = new LinkedList<FileObject>(sourcePath.findAllResources(pkgName));
499
                LinkedList<FileObject> folders = new LinkedList<FileObject>(sourcePath.findAllResources(pkgName));
500
                if (pkg) {
500
                if (pkg) {
501
                    return folders.isEmpty() ? pair.first : folders.get(0);
501
                    return folders.isEmpty() ? pair.first() : folders.get(0);
502
                } else {               
502
                } else {               
503
                    final boolean caseSensitive = isCaseSensitive ();
503
                    final boolean caseSensitive = isCaseSensitive ();
504
                    final String sourceFileName = getSourceFileName (className);
504
                    final String sourceFileName = getSourceFileName (className);
505
                    final Match matchSet = caseSensitive ? new CaseSensitiveMatch(sourceFileName) : new CaseInsensitiveMatch(sourceFileName);
505
                    final Match matchSet = caseSensitive ? new CaseSensitiveMatch(sourceFileName) : new CaseInsensitiveMatch(sourceFileName);
506
                    folders.addFirst(pair.first);
506
                    folders.addFirst(pair.first());
507
                    for (FileObject folder : folders) {
507
                    for (FileObject folder : folders) {
508
                        for (FileObject child : folder.getChildren()) {
508
                        for (FileObject child : folder.getChildren()) {
509
                            if (matchSet.apply(child)) {
509
                            if (matchSet.apply(child)) {
(-)a/java.source/src/org/netbeans/modules/java/source/classpath/SourcePath.java (-6 / +6 lines)
Lines 54-63 Link Here
54
import org.netbeans.modules.java.source.usages.ClassIndexManager;
54
import org.netbeans.modules.java.source.usages.ClassIndexManager;
55
import org.netbeans.modules.java.source.usages.ClassIndexManagerEvent;
55
import org.netbeans.modules.java.source.usages.ClassIndexManagerEvent;
56
import org.netbeans.modules.java.source.usages.ClassIndexManagerListener;
56
import org.netbeans.modules.java.source.usages.ClassIndexManagerListener;
57
import org.netbeans.modules.java.source.usages.Pair;
58
import org.netbeans.spi.java.classpath.ClassPathImplementation;
57
import org.netbeans.spi.java.classpath.ClassPathImplementation;
59
import org.netbeans.spi.java.classpath.FilteringPathResourceImplementation;
58
import org.netbeans.spi.java.classpath.FilteringPathResourceImplementation;
60
import org.netbeans.spi.java.classpath.PathResourceImplementation;
59
import org.netbeans.spi.java.classpath.PathResourceImplementation;
60
import org.openide.util.Pair;
61
import org.openide.util.Parameters;
61
import org.openide.util.Parameters;
62
import org.openide.util.WeakListeners;
62
import org.openide.util.WeakListeners;
63
63
Lines 155-163 Link Here
155
        @Override
155
        @Override
156
        public List<PathResourceImplementation> apply(
156
        public List<PathResourceImplementation> apply(
157
                @NonNull final Pair<Boolean,List<? extends PathResourceImplementation>> resources) {
157
                @NonNull final Pair<Boolean,List<? extends PathResourceImplementation>> resources) {
158
            final List<PathResourceImplementation> res = new ArrayList<PathResourceImplementation>(resources.second.size());
158
            final List<PathResourceImplementation> res = new ArrayList<PathResourceImplementation>(resources.second().size());
159
            for (PathResourceImplementation pr : resources.second) {
159
            for (PathResourceImplementation pr : resources.second()) {
160
                res.add(new FR(pr,resources.first));
160
                res.add(new FR(pr,resources.first()));
161
            }
161
            }
162
            return res;
162
            return res;
163
        }
163
        }
Lines 169-176 Link Here
169
169
170
        @Override
170
        @Override
171
        public List<PathResourceImplementation> apply(Pair<Boolean, List<? extends PathResourceImplementation>> resources) {
171
        public List<PathResourceImplementation> apply(Pair<Boolean, List<? extends PathResourceImplementation>> resources) {
172
            final List<PathResourceImplementation> res = new ArrayList<PathResourceImplementation>(resources.second.size());
172
            final List<PathResourceImplementation> res = new ArrayList<PathResourceImplementation>(resources.second().size());
173
            for (PathResourceImplementation pr : resources.second) {
173
            for (PathResourceImplementation pr : resources.second()) {
174
                res.add(new FR(pr,true));
174
                res.add(new FR(pr,true));
175
            }
175
            }
176
            return res;
176
            return res;
(-)a/java.source/src/org/netbeans/modules/java/source/indexing/JavaCustomIndexer.java (-6 / +7 lines)
Lines 120-125 Link Here
120
import org.openide.util.Exceptions;
120
import org.openide.util.Exceptions;
121
import org.openide.util.ImageUtilities;
121
import org.openide.util.ImageUtilities;
122
import org.openide.util.NbBundle;
122
import org.openide.util.NbBundle;
123
import org.openide.util.Pair;
123
import org.openide.util.Parameters;
124
import org.openide.util.Parameters;
124
import org.openide.util.TopologicalSortException;
125
import org.openide.util.TopologicalSortException;
125
import org.openide.util.Utilities;
126
import org.openide.util.Utilities;
Lines 471-481 Link Here
471
            }
472
            }
472
        }
473
        }
473
        for (Pair<String,URL> relURLPair : sourceRelativeURLPairs) {
474
        for (Pair<String,URL> relURLPair : sourceRelativeURLPairs) {
474
            final String ext = FileObjects.getExtension(relURLPair.first);
475
            final String ext = FileObjects.getExtension(relURLPair.first());
475
            final String withoutExt = FileObjects.stripExtension(relURLPair.first);
476
            final String withoutExt = FileObjects.stripExtension(relURLPair.first());
476
            final boolean dieIfNoRefFile = VirtualSourceProviderQuery.hasVirtualSource(ext);
477
            final boolean dieIfNoRefFile = VirtualSourceProviderQuery.hasVirtualSource(ext);
477
            if (dieIfNoRefFile) {
478
            if (dieIfNoRefFile) {
478
                file = new File(classFolder, relURLPair.first + '.' + FileObjects.RX);
479
                file = new File(classFolder, relURLPair.first() + '.' + FileObjects.RX);
479
            } else {
480
            } else {
480
                file = new File(classFolder, withoutExt + '.' + FileObjects.RS);
481
                file = new File(classFolder, withoutExt + '.' + FileObjects.RS);
481
            }
482
            }
Lines 487-494 Link Here
487
                    for (String className : readRSFile(file)) {
488
                    for (String className : readRSFile(file)) {
488
                        File f = new File(classFolder, FileObjects.convertPackage2Folder(className) + '.' + FileObjects.SIG);
489
                        File f = new File(classFolder, FileObjects.convertPackage2Folder(className) + '.' + FileObjects.SIG);
489
                        if (!binaryName.equals(className)) {
490
                        if (!binaryName.equals(className)) {
490
                            if (javaContext.getFQNs().remove(className, relURLPair.second)) {
491
                            if (javaContext.getFQNs().remove(className, relURLPair.second())) {
491
                                toDelete.add(Pair.<String, String>of(className, relURLPair.first));
492
                                toDelete.add(Pair.<String, String>of(className, relURLPair.first()));
492
                                removedTypes.add(ElementHandleAccessor.getInstance().create(ElementKind.OTHER, className));
493
                                removedTypes.add(ElementHandleAccessor.getInstance().create(ElementKind.OTHER, className));
493
                                removedFiles.add(f);
494
                                removedFiles.add(f);
494
                                fmTx.delete(f);
495
                                fmTx.delete(f);
Lines 504-510 Link Here
504
                fmTx.delete(file);
505
                fmTx.delete(file);
505
            }
506
            }
506
            if (cont && (file = new File(classFolder, withoutExt + '.' + FileObjects.SIG)).exists()) {
507
            if (cont && (file = new File(classFolder, withoutExt + '.' + FileObjects.SIG)).exists()) {
507
                if (javaContext.getFQNs().remove(FileObjects.getBinaryName(file, classFolder), relURLPair.second)) {
508
                if (javaContext.getFQNs().remove(FileObjects.getBinaryName(file, classFolder), relURLPair.second())) {
508
                    String fileName = file.getName();
509
                    String fileName = file.getName();
509
                    fileName = fileName.substring(0, fileName.lastIndexOf('.'));
510
                    fileName = fileName.substring(0, fileName.lastIndexOf('.'));
510
                    final String[][] patterns = new String[][]{
511
                    final String[][] patterns = new String[][]{
(-)a/java.source/src/org/netbeans/modules/java/source/indexing/JavaParsingContext.java (-1 / +1 lines)
Lines 75-86 Link Here
75
import org.netbeans.modules.java.source.usages.ClassIndexImpl;
75
import org.netbeans.modules.java.source.usages.ClassIndexImpl;
76
import org.netbeans.modules.java.source.usages.ClassIndexManager;
76
import org.netbeans.modules.java.source.usages.ClassIndexManager;
77
import org.netbeans.modules.java.source.usages.ClasspathInfoAccessor;
77
import org.netbeans.modules.java.source.usages.ClasspathInfoAccessor;
78
import org.netbeans.modules.java.source.usages.Pair;
79
import org.netbeans.modules.java.source.usages.SourceAnalyzerFactory;
78
import org.netbeans.modules.java.source.usages.SourceAnalyzerFactory;
80
import org.netbeans.modules.parsing.spi.indexing.Context;
79
import org.netbeans.modules.parsing.spi.indexing.Context;
81
import org.netbeans.modules.parsing.spi.indexing.Indexable;
80
import org.netbeans.modules.parsing.spi.indexing.Indexable;
82
import org.openide.filesystems.FileObject;
81
import org.openide.filesystems.FileObject;
83
import org.openide.util.Lookup;
82
import org.openide.util.Lookup;
83
import org.openide.util.Pair;
84
import org.openide.util.lookup.Lookups;
84
import org.openide.util.lookup.Lookups;
85
85
86
//@NotThreadSafe
86
//@NotThreadSafe
(-)a/java.source/src/org/netbeans/modules/java/source/indexing/OnePassCompileWorker.java (-8 / +8 lines)
Lines 76-88 Link Here
76
import org.netbeans.modules.java.source.usages.ClassNamesForFileOraculumImpl;
76
import org.netbeans.modules.java.source.usages.ClassNamesForFileOraculumImpl;
77
import org.netbeans.modules.java.source.usages.ClasspathInfoAccessor;
77
import org.netbeans.modules.java.source.usages.ClasspathInfoAccessor;
78
import org.netbeans.modules.java.source.usages.ExecutableFilesIndex;
78
import org.netbeans.modules.java.source.usages.ExecutableFilesIndex;
79
import org.netbeans.modules.java.source.usages.Pair;
80
import org.netbeans.modules.parsing.lucene.support.LowMemoryWatcher;
79
import org.netbeans.modules.parsing.lucene.support.LowMemoryWatcher;
81
import org.netbeans.modules.parsing.spi.indexing.Context;
80
import org.netbeans.modules.parsing.spi.indexing.Context;
82
import org.netbeans.modules.parsing.spi.indexing.Indexable;
81
import org.netbeans.modules.parsing.spi.indexing.Indexable;
83
import org.netbeans.modules.parsing.spi.indexing.SuspendStatus;
82
import org.netbeans.modules.parsing.spi.indexing.SuspendStatus;
84
import org.openide.filesystems.FileUtil;
83
import org.openide.filesystems.FileUtil;
85
import org.openide.util.Exceptions;
84
import org.openide.util.Exceptions;
85
import org.openide.util.Pair;
86
86
87
/**
87
/**
88
 *
88
 *
Lines 217-223 Link Here
217
                    return null;
217
                    return null;
218
                }
218
                }
219
                Pair<CompilationUnitTree, CompileTuple> unit = units.removeFirst();
219
                Pair<CompilationUnitTree, CompileTuple> unit = units.removeFirst();
220
                active = unit.second;
220
                active = unit.second();
221
                if (finished.contains(active.indexable)) {
221
                if (finished.contains(active.indexable)) {
222
                    continue;
222
                    continue;
223
                }
223
                }
Lines 228-234 Link Here
228
                }
228
                }
229
                Iterable<? extends TypeElement> types;
229
                Iterable<? extends TypeElement> types;
230
                s = System.nanoTime();
230
                s = System.nanoTime();
231
                types = jt.enterTrees(Collections.singletonList(unit.first));
231
                types = jt.enterTrees(Collections.singletonList(unit.first()));
232
                total += System.nanoTime() - s;
232
                total += System.nanoTime() - s;
233
                if (jfo2units.remove(active.jfo) != null) {
233
                if (jfo2units.remove(active.jfo) != null) {
234
                    final Types ts = Types.instance(jt.getContext());
234
                    final Types ts = Types.instance(jt.getContext());
Lines 242-250 Link Here
242
                                if (st.hasTag(TypeTag.CLASS)) {
242
                                if (st.hasTag(TypeTag.CLASS)) {
243
                                    ClassSymbol c = st.tsym.outermostClass();
243
                                    ClassSymbol c = st.tsym.outermostClass();
244
                                    Pair<CompilationUnitTree, CompileTuple> u = jfo2units.remove(c.sourcefile);
244
                                    Pair<CompilationUnitTree, CompileTuple> u = jfo2units.remove(c.sourcefile);
245
                                    if (u != null && !finished.contains(u.second.indexable) && !u.second.indexable.equals(activeIndexable)) {
245
                                    if (u != null && !finished.contains(u.second().indexable) && !u.second().indexable.equals(activeIndexable)) {
246
                                        if (dependencies.add(u)) {
246
                                        if (dependencies.add(u)) {
247
                                            scan((JCCompilationUnit)u.first);
247
                                            scan((JCCompilationUnit)u.first());
248
                                        }
248
                                        }
249
                                    }
249
                                    }
250
                                }
250
                                }
Lines 253-259 Link Here
253
                        }
253
                        }
254
                    }
254
                    }
255
                    ScanNested scanner = new ScanNested();
255
                    ScanNested scanner = new ScanNested();
256
                    scanner.scan((JCCompilationUnit)unit.first);
256
                    scanner.scan((JCCompilationUnit)unit.first());
257
                    if (!scanner.dependencies.isEmpty()) {
257
                    if (!scanner.dependencies.isEmpty()) {
258
                        units.addFirst(unit);
258
                        units.addFirst(unit);
259
                        for (Pair<CompilationUnitTree, CompileTuple> pair : scanner.dependencies) {
259
                        for (Pair<CompilationUnitTree, CompileTuple> pair : scanner.dependencies) {
Lines 281-290 Link Here
281
                javaContext.getFQNs().set(types, active.indexable.getURL());
281
                javaContext.getFQNs().set(types, active.indexable.getURL());
282
                boolean[] main = new boolean[1];
282
                boolean[] main = new boolean[1];
283
                if (javaContext.getCheckSums().checkAndSet(active.indexable.getURL(), types, jt.getElements()) || context.isSupplementaryFilesIndexing()) {
283
                if (javaContext.getCheckSums().checkAndSet(active.indexable.getURL(), types, jt.getElements()) || context.isSupplementaryFilesIndexing()) {
284
                    javaContext.analyze(Collections.singleton(unit.first), jt, unit.second, addedTypes, main);
284
                    javaContext.analyze(Collections.singleton(unit.first()), jt, unit.second(), addedTypes, main);
285
                } else {
285
                } else {
286
                    final Set<ElementHandle<TypeElement>> aTypes = new HashSet<ElementHandle<TypeElement>>();
286
                    final Set<ElementHandle<TypeElement>> aTypes = new HashSet<ElementHandle<TypeElement>>();
287
                    javaContext.analyze(Collections.singleton(unit.first), jt, unit.second, aTypes, main);
287
                    javaContext.analyze(Collections.singleton(unit.first()), jt, unit.second(), aTypes, main);
288
                    addedTypes.addAll(aTypes);
288
                    addedTypes.addAll(aTypes);
289
                    modifiedTypes.addAll(aTypes);
289
                    modifiedTypes.addAll(aTypes);
290
                }
290
                }
(-)a/java.source/src/org/netbeans/modules/java/source/parsing/CachingArchiveProvider.java (-4 / +4 lines)
Lines 58-68 Link Here
58
import org.netbeans.api.annotations.common.NonNull;
58
import org.netbeans.api.annotations.common.NonNull;
59
import org.netbeans.api.java.platform.JavaPlatform;
59
import org.netbeans.api.java.platform.JavaPlatform;
60
import org.netbeans.api.java.platform.JavaPlatformManager;
60
import org.netbeans.api.java.platform.JavaPlatformManager;
61
import org.netbeans.modules.java.source.usages.Pair;
62
import org.openide.filesystems.FileObject;
61
import org.openide.filesystems.FileObject;
63
import org.openide.filesystems.FileUtil;
62
import org.openide.filesystems.FileUtil;
64
import org.openide.filesystems.URLMapper;
63
import org.openide.filesystems.URLMapper;
65
import org.openide.util.Exceptions;
64
import org.openide.util.Exceptions;
65
import org.openide.util.Pair;
66
import org.openide.util.Utilities;
66
import org.openide.util.Utilities;
67
67
68
68
Lines 197-203 Link Here
197
        }
197
        }
198
        synchronized (this) {
198
        synchronized (this) {
199
            final Pair<File,String> res = mapJarToCtSym(f, root);
199
            final Pair<File,String> res = mapJarToCtSym(f, root);
200
            return res.second != null;
200
            return res.second() != null;
201
        }
201
        }
202
202
203
    }
203
    }
Lines 233-240 Link Here
233
                if (f.isFile()) {
233
                if (f.isFile()) {
234
                    final Pair<File,String> resolved = mapJarToCtSym(f, root);
234
                    final Pair<File,String> resolved = mapJarToCtSym(f, root);
235
                    return new CachingArchive(
235
                    return new CachingArchive(
236
                            resolved.first,
236
                            resolved.first(),
237
                            resolved.second,
237
                            resolved.second(),
238
                            cacheFile);
238
                            cacheFile);
239
                }
239
                }
240
                else {
240
                else {
(-)a/java.source/src/org/netbeans/modules/java/source/parsing/CompilationInfoImpl.java (-1 / +1 lines)
Lines 74-86 Link Here
74
import org.netbeans.api.java.source.JavaSource;
74
import org.netbeans.api.java.source.JavaSource;
75
import org.netbeans.api.lexer.TokenHierarchy;
75
import org.netbeans.api.lexer.TokenHierarchy;
76
import org.netbeans.modules.java.source.JavaFileFilterQuery;
76
import org.netbeans.modules.java.source.JavaFileFilterQuery;
77
import org.netbeans.modules.java.source.usages.Pair;
78
import org.netbeans.modules.parsing.api.Snapshot;
77
import org.netbeans.modules.parsing.api.Snapshot;
79
import org.openide.cookies.EditorCookie;
78
import org.openide.cookies.EditorCookie;
80
import org.openide.filesystems.FileObject;
79
import org.openide.filesystems.FileObject;
81
import org.openide.loaders.DataObject;
80
import org.openide.loaders.DataObject;
82
import org.openide.loaders.DataObjectNotFoundException;
81
import org.openide.loaders.DataObjectNotFoundException;
83
import org.openide.util.Exceptions;
82
import org.openide.util.Exceptions;
83
import org.openide.util.Pair;
84
84
85
/**
85
/**
86
 *
86
 *
(-)a/java.source/src/org/netbeans/modules/java/source/parsing/FindMethodRegionsVisitor.java (-2 / +1 lines)
Lines 53-60 Link Here
53
import java.util.concurrent.atomic.AtomicBoolean;
53
import java.util.concurrent.atomic.AtomicBoolean;
54
import javax.swing.text.BadLocationException;
54
import javax.swing.text.BadLocationException;
55
import javax.swing.text.Document;
55
import javax.swing.text.Document;
56
import org.netbeans.modules.java.source.usages.Pair;
56
import org.openide.util.Pair;
57
import org.openide.util.Exceptions;
58
57
59
/**
58
/**
60
 *
59
 *
(-)a/java.source/src/org/netbeans/modules/java/source/parsing/JavacParser.java (-4 / +4 lines)
Lines 145-151 Link Here
145
import org.netbeans.modules.java.source.tasklist.CompilerSettings;
145
import org.netbeans.modules.java.source.tasklist.CompilerSettings;
146
import org.netbeans.modules.java.source.usages.ClassIndexImpl;
146
import org.netbeans.modules.java.source.usages.ClassIndexImpl;
147
import org.netbeans.modules.java.source.usages.ClasspathInfoAccessor;
147
import org.netbeans.modules.java.source.usages.ClasspathInfoAccessor;
148
import org.netbeans.modules.java.source.usages.Pair;
149
import org.netbeans.modules.parsing.api.Snapshot;
148
import org.netbeans.modules.parsing.api.Snapshot;
150
import org.netbeans.modules.parsing.api.Source;
149
import org.netbeans.modules.parsing.api.Source;
151
import org.netbeans.modules.parsing.api.Task;
150
import org.netbeans.modules.parsing.api.Task;
Lines 163-168 Link Here
163
import org.openide.modules.SpecificationVersion;
162
import org.openide.modules.SpecificationVersion;
164
import org.openide.util.ChangeSupport;
163
import org.openide.util.ChangeSupport;
165
import org.openide.util.Exceptions;
164
import org.openide.util.Exceptions;
165
import org.openide.util.Pair;
166
import org.openide.util.WeakListeners;
166
import org.openide.util.WeakListeners;
167
167
168
/**
168
/**
Lines 432-439 Link Here
432
                    if (supportsReparse) {
432
                    if (supportsReparse) {
433
                        final Pair<DocPositionRegion,MethodTree> _changedMethod = changedMethod.getAndSet(null);
433
                        final Pair<DocPositionRegion,MethodTree> _changedMethod = changedMethod.getAndSet(null);
434
                        if (_changedMethod != null && ciImpl != null) {
434
                        if (_changedMethod != null && ciImpl != null) {
435
                            LOGGER.log(Level.FINE, "\t:trying partial reparse:\n{0}", _changedMethod.first.getText());                           //NOI18N
435
                            LOGGER.log(Level.FINE, "\t:trying partial reparse:\n{0}", _changedMethod.first().getText());                           //NOI18N
436
                            needsFullReparse = !reparseMethod(ciImpl, snapshot, _changedMethod.second, _changedMethod.first.getText());
436
                            needsFullReparse = !reparseMethod(ciImpl, snapshot, _changedMethod.second(), _changedMethod.first().getText());
437
                            if (!needsFullReparse) {
437
                            if (!needsFullReparse) {
438
                                ciImpl.setChangedMethod(_changedMethod);
438
                                ciImpl.setChangedMethod(_changedMethod);
439
                            }
439
                            }
Lines 1243-1249 Link Here
1243
                    int end = evt.affectedEndOffset();
1243
                    int end = evt.affectedEndOffset();
1244
                    synchronized (positions) {
1244
                    synchronized (positions) {
1245
                        for (Pair<DocPositionRegion,MethodTree> pe : positions) {
1245
                        for (Pair<DocPositionRegion,MethodTree> pe : positions) {
1246
                            PositionRegion p = pe.first;
1246
                            PositionRegion p = pe.first();
1247
                            if (start > p.getStartOffset() && end < p.getEndOffset()) {
1247
                            if (start > p.getStartOffset() && end < p.getEndOffset()) {
1248
                                changedMethod = pe;
1248
                                changedMethod = pe;
1249
                                break;
1249
                                break;
(-)a/java.source/src/org/netbeans/modules/java/source/parsing/ProcessorGenerated.java (-6 / +6 lines)
Lines 68-75 Link Here
68
import org.netbeans.modules.java.source.classpath.AptCacheForSourceQuery;
68
import org.netbeans.modules.java.source.classpath.AptCacheForSourceQuery;
69
import org.netbeans.modules.java.source.indexing.JavaIndex;
69
import org.netbeans.modules.java.source.indexing.JavaIndex;
70
import org.netbeans.modules.java.source.indexing.TransactionContext;
70
import org.netbeans.modules.java.source.indexing.TransactionContext;
71
import org.netbeans.modules.java.source.usages.Pair;
72
import org.openide.util.Exceptions;
71
import org.openide.util.Exceptions;
72
import org.openide.util.Pair;
73
import org.openide.util.Parameters;
73
import org.openide.util.Parameters;
74
import org.openide.util.Utilities;
74
import org.openide.util.Utilities;
75
75
Lines 107-113 Link Here
107
    public Set<javax.tools.FileObject> getGeneratedSources(final URL forSource) {
107
    public Set<javax.tools.FileObject> getGeneratedSources(final URL forSource) {
108
        Pair<Set<javax.tools.FileObject>,Set<javax.tools.FileObject>> res = 
108
        Pair<Set<javax.tools.FileObject>,Set<javax.tools.FileObject>> res = 
109
            generated.get(forSource);
109
            generated.get(forSource);
110
        return res == null ? null : res.first;
110
        return res == null ? null : res.first();
111
    }
111
    }
112
    
112
    
113
    public boolean canWrite() {
113
    public boolean canWrite() {
Lines 173-182 Link Here
173
        }
173
        }
174
        switch (type) {
174
        switch (type) {
175
            case SOURCE:
175
            case SOURCE:
176
                insertInto.first.add(file);
176
                insertInto.first().add(file);
177
                break;
177
                break;
178
            case RESOURCE:
178
            case RESOURCE:
179
                insertInto.second.add(file);
179
                insertInto.second().add(file);
180
                break;
180
                break;
181
            default:
181
            default:
182
                throw new IllegalArgumentException();
182
                throw new IllegalArgumentException();
Lines 196-203 Link Here
196
                for (Map.Entry<URL,Pair<Set<javax.tools.FileObject>,Set<javax.tools.FileObject>>> entry : generated.entrySet()) {
196
                for (Map.Entry<URL,Pair<Set<javax.tools.FileObject>,Set<javax.tools.FileObject>>> entry : generated.entrySet()) {
197
                    final URL source = entry.getKey();
197
                    final URL source = entry.getKey();
198
                    final Pair<Set<javax.tools.FileObject>,Set<javax.tools.FileObject>> gen = entry.getValue();
198
                    final Pair<Set<javax.tools.FileObject>,Set<javax.tools.FileObject>> gen = entry.getValue();
199
                    final Set<javax.tools.FileObject> genSources = gen.first;
199
                    final Set<javax.tools.FileObject> genSources = gen.first();
200
                    final Set<javax.tools.FileObject> genResources =  gen.second;
200
                    final Set<javax.tools.FileObject> genResources =  gen.second();
201
                    commitSource(source, genSources, genResources);
201
                    commitSource(source, genSources, genResources);
202
                }
202
                }
203
                writeResources();
203
                writeResources();
(-)a/java.source/src/org/netbeans/modules/java/source/parsing/SiblingSupport.java (-6 / +6 lines)
Lines 47-53 Link Here
47
import java.util.logging.Level;
47
import java.util.logging.Level;
48
import java.util.logging.Logger;
48
import java.util.logging.Logger;
49
import org.netbeans.api.annotations.common.NonNull;
49
import org.netbeans.api.annotations.common.NonNull;
50
import org.netbeans.modules.java.source.usages.Pair;
50
import org.openide.util.Pair;
51
51
52
/**
52
/**
53
 *
53
 *
Lines 81-87 Link Here
81
        } else {
81
        } else {
82
            LOG.log(Level.FINE, "Poped sibling: {0} size: {1}", new Object[] {removed, siblings.size()});     //NOI18N
82
            LOG.log(Level.FINE, "Poped sibling: {0} size: {1}", new Object[] {removed, siblings.size()});     //NOI18N
83
        }
83
        }
84
        return removed.first;
84
        return removed.first();
85
    }
85
    }
86
86
87
    @Override
87
    @Override
Lines 104-113 Link Here
104
                Level.FINER,
104
                Level.FINER,
105
                "Returns sibling: {0} in source root? {1}",    //NOI18N
105
                "Returns sibling: {0} in source root? {1}",    //NOI18N
106
                new Object[] {
106
                new Object[] {
107
                    result.first,
107
                    result.first(),
108
                    result.second
108
                    result.second()
109
                });
109
                });
110
            return result.first;
110
            return result.first();
111
        }
111
        }
112
112
113
        @Override
113
        @Override
Lines 119-125 Link Here
119
119
120
        @Override
120
        @Override
121
        public boolean isInSourceRoot() {
121
        public boolean isInSourceRoot() {
122
            return siblings.peek().second;
122
            return siblings.peek().second();
123
        }
123
        }
124
    }
124
    }
125
125
(-)a/java.source/src/org/netbeans/modules/java/source/parsing/WriteBackTransaction.java (-15 / +15 lines)
Lines 68-75 Link Here
68
import org.netbeans.api.annotations.common.NonNull;
68
import org.netbeans.api.annotations.common.NonNull;
69
import org.netbeans.api.annotations.common.NullAllowed;
69
import org.netbeans.api.annotations.common.NullAllowed;
70
import org.netbeans.modules.java.preprocessorbridge.spi.JavaFileFilterImplementation;
70
import org.netbeans.modules.java.preprocessorbridge.spi.JavaFileFilterImplementation;
71
import org.netbeans.modules.java.source.usages.Pair;
72
import org.netbeans.modules.java.source.util.Iterators;
71
import org.netbeans.modules.java.source.util.Iterators;
72
import org.openide.util.Pair;
73
import org.openide.util.Utilities;
73
import org.openide.util.Utilities;
74
74
75
/**
75
/**
Lines 270-280 Link Here
270
            @NonNull final Location location,
270
            @NonNull final Location location,
271
            final boolean readOnly) {
271
            final boolean readOnly) {
272
        if (location == StandardLocation.CLASS_OUTPUT) {
272
        if (location == StandardLocation.CLASS_OUTPUT) {
273
            return contentCache.first;
273
            return contentCache.first();
274
        } else if (location == StandardLocation.SOURCE_OUTPUT) {
274
        } else if (location == StandardLocation.SOURCE_OUTPUT) {
275
            return contentCache.second;
275
            return contentCache.second();
276
        } else if (readOnly && location == StandardLocation.CLASS_PATH) {
276
        } else if (readOnly && location == StandardLocation.CLASS_PATH) {
277
            return contentCache.first;
277
            return contentCache.first();
278
        } else {
278
        } else {
279
            throw new IllegalArgumentException("Unsupported Location: " + location);    //NOI18N
279
            throw new IllegalArgumentException("Unsupported Location: " + location);    //NOI18N
280
        }
280
        }
Lines 298-305 Link Here
298
298
299
    private void flushFiles(boolean inCommit) throws IOException {
299
    private void flushFiles(boolean inCommit) throws IOException {
300
        LOG.log(Level.FINE, "Flushing:{0}", getRootDir());
300
        LOG.log(Level.FINE, "Flushing:{0}", getRootDir());
301
        doFlushFiles(contentCache.first, inCommit);
301
        doFlushFiles(contentCache.first(), inCommit);
302
        doFlushFiles(contentCache.second, inCommit);
302
        doFlushFiles(contentCache.second(), inCommit);
303
    }
303
    }
304
304
305
    private void doFlushFiles(
305
    private void doFlushFiles(
Lines 326-333 Link Here
326
            FileObjects.deleteRecursively(d);
326
            FileObjects.deleteRecursively(d);
327
        }
327
        }
328
        deleted.clear();
328
        deleted.clear();
329
        contentCache.first.clear();
329
        contentCache.first().clear();
330
        contentCache.second.clear();
330
        contentCache.second().clear();
331
    }
331
    }
332
332
333
    @Override
333
    @Override
Lines 426-432 Link Here
426
                        (FileObjects.FileBase)FileObjects.fileFileObject(shadowFile, getRootFile(shadowFile, getPackage()), filter, encoding),
426
                        (FileObjects.FileBase)FileObjects.fileFileObject(shadowFile, getRootFile(shadowFile, getPackage()), filter, encoding),
427
                        Boolean.TRUE);
427
                        Boolean.TRUE);
428
            }
428
            }
429
            return delegate.first;
429
            return delegate.first();
430
        }
430
        }
431
        
431
        
432
        public File getCurrentFile() {
432
        public File getCurrentFile() {
Lines 442-448 Link Here
442
            if (wasFlushed()) {
442
            if (wasFlushed()) {
443
                return;
443
                return;
444
            }
444
            }
445
            if (delegate != null && delegate.second == Boolean.FALSE) {
445
            if (delegate != null && delegate.second() == Boolean.FALSE) {
446
                if (inCommit) {
446
                if (inCommit) {
447
                    shadowFile = this.f;
447
                    shadowFile = this.f;
448
                    release();
448
                    release();
Lines 510-517 Link Here
510
510
511
        @Override
511
        @Override
512
        public boolean delete() {
512
        public boolean delete() {
513
            if (delegate != null && delegate.second == Boolean.TRUE) {
513
            if (delegate != null && delegate.second() == Boolean.TRUE) {
514
                return delegate.first.delete();
514
                return delegate.first().delete();
515
            } else {
515
            } else {
516
                if (writer != null) {
516
                if (writer != null) {
517
                    writer.delete(toFile(this));
517
                    writer.delete(toFile(this));
Lines 523-529 Link Here
523
        @Override
523
        @Override
524
        public InputStream openInputStream() throws IOException {
524
        public InputStream openInputStream() throws IOException {
525
            if (delegate != null) {
525
            if (delegate != null) {
526
                return delegate.first.openInputStream();
526
                return delegate.first().openInputStream();
527
            } else {
527
            } else {
528
                return new ByteArrayInputStream(content);
528
                return new ByteArrayInputStream(content);
529
            }
529
            }
Lines 533-539 Link Here
533
        public OutputStream openOutputStream() throws IOException {
533
        public OutputStream openOutputStream() throws IOException {
534
            modify();
534
            modify();
535
            if (delegate != null) {
535
            if (delegate != null) {
536
                return delegate.first.openOutputStream();
536
                return delegate.first().openOutputStream();
537
            } else {
537
            } else {
538
                return new ByteArrayOutputStream() {
538
                return new ByteArrayOutputStream() {
539
                    boolean closed;
539
                    boolean closed;
Lines 554-560 Link Here
554
        }
554
        }
555
555
556
        private void modify() {
556
        private void modify() {
557
            if (delegate != null && delegate.second == Boolean.FALSE) {
557
            if (delegate != null && delegate.second() == Boolean.FALSE) {
558
                delegate = null;
558
                delegate = null;
559
            }
559
            }
560
        }
560
        }
(-)a/java.source/src/org/netbeans/modules/java/source/save/PositionEstimator.java (-4 / +4 lines)
Lines 62-72 Link Here
62
import org.netbeans.api.editor.guards.GuardedSectionManager;
62
import org.netbeans.api.editor.guards.GuardedSectionManager;
63
import org.netbeans.api.java.lexer.JavaTokenId;
63
import org.netbeans.api.java.lexer.JavaTokenId;
64
import org.netbeans.modules.java.source.transform.FieldGroupTree;
64
import org.netbeans.modules.java.source.transform.FieldGroupTree;
65
import org.netbeans.modules.java.source.usages.Pair;
66
import static org.netbeans.api.java.lexer.JavaTokenId.*;
65
import static org.netbeans.api.java.lexer.JavaTokenId.*;
67
import org.netbeans.api.lexer.Token;
66
import org.netbeans.api.lexer.Token;
68
import org.netbeans.api.lexer.TokenSequence;
67
import org.netbeans.api.lexer.TokenSequence;
69
import org.netbeans.modules.java.source.save.CasualDiff.LineInsertionType;
68
import org.netbeans.modules.java.source.save.CasualDiff.LineInsertionType;
69
import org.openide.util.Pair;
70
70
71
/**
71
/**
72
 * Estimates the position for given element or element set. Offsets are
72
 * Estimates the position for given element or element set. Offsets are
Lines 997-1003 Link Here
997
                                    if (commentEndPos.isEmpty()) {
997
                                    if (commentEndPos.isEmpty()) {
998
                                        wideEnd = seq.offset() + indexOf + 1;
998
                                        wideEnd = seq.offset() + indexOf + 1;
999
                                    } else {
999
                                    } else {
1000
                                        commentEndPos.add(Pair.of(commentEndPos.getLast().first, seq.offset() + indexOf + 1));                                            
1000
                                        commentEndPos.add(Pair.of(commentEndPos.getLast().first(), seq.offset() + indexOf + 1));
1001
                                    }
1001
                                    }
1002
                                }
1002
                                }
1003
                            }
1003
                            }
Lines 1031-1038 Link Here
1031
                }
1031
                }
1032
                maxLines = Math.max(maxLines, newlines);
1032
                maxLines = Math.max(maxLines, newlines);
1033
                for (Pair<Integer, Integer> comment : commentEndPos) {
1033
                for (Pair<Integer, Integer> comment : commentEndPos) {
1034
                    if (comment.first < maxLines || comment.first == 0) {
1034
                    if (comment.first() < maxLines || comment.first() == 0) {
1035
                        wideEnd = comment.second;
1035
                        wideEnd = comment.second();
1036
                    } else {
1036
                    } else {
1037
                        break;
1037
                        break;
1038
                    }
1038
                    }
(-)a/java.source/src/org/netbeans/modules/java/source/save/Reformatter.java (-10 / +10 lines)
Lines 66-72 Link Here
66
import org.netbeans.modules.java.source.JavaSourceAccessor;
66
import org.netbeans.modules.java.source.JavaSourceAccessor;
67
import org.netbeans.modules.java.source.parsing.FileObjects;
67
import org.netbeans.modules.java.source.parsing.FileObjects;
68
import org.netbeans.modules.java.source.parsing.JavacParser;
68
import org.netbeans.modules.java.source.parsing.JavacParser;
69
import org.netbeans.modules.java.source.usages.Pair;
70
import org.netbeans.modules.parsing.api.Embedding;
69
import org.netbeans.modules.parsing.api.Embedding;
71
import org.netbeans.modules.parsing.api.ParserManager;
70
import org.netbeans.modules.parsing.api.ParserManager;
72
import org.netbeans.modules.parsing.api.ResultIterator;
71
import org.netbeans.modules.parsing.api.ResultIterator;
Lines 76-81 Link Here
76
import org.netbeans.modules.parsing.spi.ParseException;
75
import org.netbeans.modules.parsing.spi.ParseException;
77
import org.netbeans.modules.parsing.spi.Parser;
76
import org.netbeans.modules.parsing.spi.Parser;
78
import org.netbeans.spi.java.classpath.support.ClassPathSupport;
77
import org.netbeans.spi.java.classpath.support.ClassPathSupport;
78
import org.openide.util.Pair;
79
79
80
/**
80
/**
81
 *
81
 *
Lines 3867-3873 Link Here
3867
                            tokenText = javadocTokens.token().text().toString();
3867
                            tokenText = javadocTokens.token().text().toString();
3868
                            if (tokenText.endsWith(">")) { //NOI18N
3868
                            if (tokenText.endsWith(">")) { //NOI18N
3869
                                if (P_TAG.equalsIgnoreCase(tokenText)) {
3869
                                if (P_TAG.equalsIgnoreCase(tokenText)) {
3870
                                    if (currWSOffset >= 0 && (toAdd == null || toAdd.first < currWSOffset)) {
3870
                                    if (currWSOffset >= 0 && (toAdd == null || toAdd.first() < currWSOffset)) {
3871
                                        marks.add(Pair.of(currWSOffset, 1));
3871
                                        marks.add(Pair.of(currWSOffset, 1));
3872
                                    }
3872
                                    }
3873
                                    lastAddedNLOffset = javadocTokens.offset() + javadocTokens.token().length() - offset;
3873
                                    lastAddedNLOffset = javadocTokens.offset() + javadocTokens.token().length() - offset;
Lines 3875-3881 Link Here
3875
                                    afterText = false;
3875
                                    afterText = false;
3876
                                } else if (PRE_TAG.equalsIgnoreCase(tokenText)
3876
                                } else if (PRE_TAG.equalsIgnoreCase(tokenText)
3877
                                        || CODE_TAG.equalsIgnoreCase(tokenText)) {
3877
                                        || CODE_TAG.equalsIgnoreCase(tokenText)) {
3878
                                    if (currWSOffset >= 0 && state == 0 && (toAdd == null || toAdd.first < currWSOffset)) {
3878
                                    if (currWSOffset >= 0 && state == 0 && (toAdd == null || toAdd.first() < currWSOffset)) {
3879
                                        marks.add(Pair.of(currWSOffset, 1));
3879
                                        marks.add(Pair.of(currWSOffset, 1));
3880
                                    }
3880
                                    }
3881
                                    marks.add(Pair.of(javadocTokens.offset() - offset, 5));
3881
                                    marks.add(Pair.of(javadocTokens.offset() - offset, 5));
Lines 3884-3890 Link Here
3884
                                    marks.add(Pair.of(currWSOffset >= 0 ? currWSOffset : javadocTokens.offset() - offset, 6));
3884
                                    marks.add(Pair.of(currWSOffset >= 0 ? currWSOffset : javadocTokens.offset() - offset, 6));
3885
                                } else {
3885
                                } else {
3886
                                    if (currWSOffset >= 0 && lastNLOffset >= currWSOffset
3886
                                    if (currWSOffset >= 0 && lastNLOffset >= currWSOffset
3887
                                            && lastAddedNLOffset < currWSOffset && (toAdd == null || toAdd.first < currWSOffset)) {
3887
                                            && lastAddedNLOffset < currWSOffset && (toAdd == null || toAdd.first() < currWSOffset)) {
3888
                                        marks.add(Pair.of(currWSOffset, 1));
3888
                                        marks.add(Pair.of(currWSOffset, 1));
3889
                                    }
3889
                                    }
3890
                                    nlAdd = Pair.of(javadocTokens.offset() + javadocTokens.token().length() - offset, 1);
3890
                                    nlAdd = Pair.of(javadocTokens.offset() + javadocTokens.token().length() - offset, 1);
Lines 4001-4008 Link Here
4001
            Iterator<Pair<Integer, Integer>> it = marks.iterator();
4001
            Iterator<Pair<Integer, Integer>> it = marks.iterator();
4002
            if (it.hasNext()) {
4002
            if (it.hasNext()) {
4003
                Pair<Integer, Integer> next = it.next();
4003
                Pair<Integer, Integer> next = it.next();
4004
                checkOffset = next.first;
4004
                checkOffset = next.first();
4005
                actionType = next.second;
4005
                actionType = next.second();
4006
            } else {
4006
            } else {
4007
                checkOffset = Integer.MAX_VALUE;
4007
                checkOffset = Integer.MAX_VALUE;
4008
                actionType = -1;
4008
                actionType = -1;
Lines 4089-4096 Link Here
4089
                        align = -1;
4089
                        align = -1;
4090
                        if (it.hasNext()) {
4090
                        if (it.hasNext()) {
4091
                            Pair<Integer, Integer> next = it.next();
4091
                            Pair<Integer, Integer> next = it.next();
4092
                            checkOffset = next.first;
4092
                            checkOffset = next.first();
4093
                            actionType = next.second;
4093
                            actionType = next.second();
4094
                        } else {
4094
                        } else {
4095
                            checkOffset = Integer.MAX_VALUE;
4095
                            checkOffset = Integer.MAX_VALUE;
4096
                            actionType = -1;
4096
                            actionType = -1;
Lines 4162-4169 Link Here
4162
                            }
4162
                            }
4163
                            if (it.hasNext()) {
4163
                            if (it.hasNext()) {
4164
                                Pair<Integer, Integer> next = it.next();
4164
                                Pair<Integer, Integer> next = it.next();
4165
                                checkOffset = next.first;
4165
                                checkOffset = next.first();
4166
                                actionType = next.second;
4166
                                actionType = next.second();
4167
                            } else {
4167
                            } else {
4168
                                checkOffset = Integer.MAX_VALUE;
4168
                                checkOffset = Integer.MAX_VALUE;
4169
                                actionType = -1;
4169
                                actionType = -1;
(-)a/java.source/src/org/netbeans/modules/java/source/usages/BinaryAnalyser.java (-19 / +20 lines)
Lines 114-119 Link Here
114
import org.openide.filesystems.FileUtil;
114
import org.openide.filesystems.FileUtil;
115
import org.openide.filesystems.URLMapper;
115
import org.openide.filesystems.URLMapper;
116
import org.openide.util.Exceptions;
116
import org.openide.util.Exceptions;
117
import org.openide.util.Pair;
117
import org.openide.util.Parameters;
118
import org.openide.util.Parameters;
118
import org.openide.util.Utilities;
119
import org.openide.util.Utilities;
119
120
Lines 330-338 Link Here
330
            final PrintWriter out = new PrintWriter(new OutputStreamWriter(new FileOutputStream(file),"UTF-8"));   //NOI18N
331
            final PrintWriter out = new PrintWriter(new OutputStreamWriter(new FileOutputStream(file),"UTF-8"));   //NOI18N
331
            try {
332
            try {
332
                for (Pair<ElementHandle<TypeElement>,Long> pair : state) {
333
                for (Pair<ElementHandle<TypeElement>,Long> pair : state) {
333
                    StringBuilder sb = new StringBuilder(pair.first.getBinaryName());
334
                    StringBuilder sb = new StringBuilder(pair.first().getBinaryName());
334
                    sb.append('='); //NOI18N
335
                    sb.append('='); //NOI18N
335
                    sb.append(pair.second.longValue());
336
                    sb.append(pair.second().longValue());
336
                    out.println(sb.toString());
337
                    out.println(sb.toString());
337
                }
338
                }
338
            } finally {
339
            } finally {
Lines 375-385 Link Here
375
        if (timeStamps == null) {
376
        if (timeStamps == null) {
376
            f.delete();
377
            f.delete();
377
        } else {
378
        } else {
378
            timeStamps.first.keySet().removeAll(timeStamps.second);
379
            timeStamps.first().keySet().removeAll(timeStamps.second());
379
            final BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(f), "UTF-8")); //NOI18N
380
            final BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(f), "UTF-8")); //NOI18N
380
            try {
381
            try {
381
                // write data
382
                // write data
382
                for(LongHashMap.Entry<String> entry : timeStamps.first.entrySet()) {
383
                for(LongHashMap.Entry<String> entry : timeStamps.first().entrySet()) {
383
                    out.write(entry.getKey());
384
                    out.write(entry.getKey());
384
                    out.write('='); //NOI18N
385
                    out.write('='); //NOI18N
385
                    out.write(Long.toString(entry.getValue()));
386
                    out.write(Long.toString(entry.getValue()));
Lines 394-406 Link Here
394
    }
395
    }
395
396
396
    private boolean timeStampsEmpty() {
397
    private boolean timeStampsEmpty() {
397
        return timeStamps == null || timeStamps.second.isEmpty();
398
        return timeStamps == null || timeStamps.second().isEmpty();
398
    }
399
    }
399
400
400
    private boolean isUpToDate(final String resourceName, final long timeStamp) throws IOException {
401
    private boolean isUpToDate(final String resourceName, final long timeStamp) throws IOException {
401
        final Pair<LongHashMap<String>,Set<String>> ts = getTimeStamps();
402
        final Pair<LongHashMap<String>,Set<String>> ts = getTimeStamps();
402
        long oldTime = ts.first.put(resourceName,timeStamp);
403
        long oldTime = ts.first().put(resourceName,timeStamp);
403
        ts.second.remove(resourceName);
404
        ts.second().remove(resourceName);
404
        return oldTime == timeStamp;
405
        return oldTime == timeStamp;
405
    }
406
    }
406
407
Lines 424-456 Link Here
424
            if (newE == null) {
425
            if (newE == null) {
425
                newE = newIt.next();
426
                newE = newIt.next();
426
            }
427
            }
427
            int ni = oldE.first.getBinaryName().compareTo(newE.first.getBinaryName());
428
            int ni = oldE.first().getBinaryName().compareTo(newE.first().getBinaryName());
428
            if (ni == 0) {
429
            if (ni == 0) {
429
                if (oldE.second.longValue() == 0 || oldE.second.longValue() != newE.second.longValue()) {
430
                if (oldE.second().longValue() == 0 || oldE.second().longValue() != newE.second().longValue()) {
430
                    changed.add(oldE.first);
431
                    changed.add(oldE.first());
431
                }
432
                }
432
                oldE = newE = null;
433
                oldE = newE = null;
433
            }
434
            }
434
            else if (ni < 0) {
435
            else if (ni < 0) {
435
                removed.add(oldE.first);
436
                removed.add(oldE.first());
436
                oldE = null;
437
                oldE = null;
437
            }
438
            }
438
            else if (ni > 0) {
439
            else if (ni > 0) {
439
                added.add(newE.first);
440
                added.add(newE.first());
440
                newE = null;
441
                newE = null;
441
            }
442
            }
442
        }
443
        }
443
        if (oldE != null) {
444
        if (oldE != null) {
444
            removed.add(oldE.first);
445
            removed.add(oldE.first());
445
        }
446
        }
446
        while (oldIt.hasNext()) {
447
        while (oldIt.hasNext()) {
447
            removed.add(oldIt.next().first);
448
            removed.add(oldIt.next().first());
448
        }
449
        }
449
        if (newE != null) {
450
        if (newE != null) {
450
            added.add(newE.first);
451
            added.add(newE.first());
451
        }
452
        }
452
        while (newIt.hasNext()) {
453
        while (newIt.hasNext()) {
453
            added.add(newIt.next().first);
454
            added.add(newIt.next().first());
454
        }
455
        }
455
        return new Changes(true, added, removed, changed, preBuildArgs);
456
        return new Changes(true, added, removed, changed, preBuildArgs);
456
    }
457
    }
Lines 859-865 Link Here
859
                public int compare(
860
                public int compare(
860
                        final Pair<ElementHandle<TypeElement>,Long> o1,
861
                        final Pair<ElementHandle<TypeElement>,Long> o1,
861
                        final Pair<ElementHandle<TypeElement>,Long> o2) {
862
                        final Pair<ElementHandle<TypeElement>,Long> o2) {
862
                    return o1.first.getBinaryName().compareTo(o2.first.getBinaryName());
863
                    return o1.first().getBinaryName().compareTo(o2.first().getBinaryName());
863
                }
864
                }
864
            };
865
            };
865
866
Lines 1077-1083 Link Here
1077
                    return false;
1078
                    return false;
1078
                }
1079
                }
1079
            }
1080
            }
1080
            for (String deleted : getTimeStamps().second) {
1081
            for (String deleted : getTimeStamps().second()) {
1081
                delete(deleted);
1082
                delete(deleted);
1082
                markChanged();
1083
                markChanged();
1083
            }
1084
            }
Lines 1137-1143 Link Here
1137
        DeletedRootProcessor(@NonNull final Context ctx) throws IOException {
1138
        DeletedRootProcessor(@NonNull final Context ctx) throws IOException {
1138
            super(ctx);
1139
            super(ctx);
1139
            final Pair<LongHashMap<String>, Set<String>> ts = getTimeStamps();
1140
            final Pair<LongHashMap<String>, Set<String>> ts = getTimeStamps();
1140
            if (!ts.first.isEmpty()) {
1141
            if (!ts.first().isEmpty()) {
1141
                markChanged();
1142
                markChanged();
1142
            }
1143
            }
1143
        }
1144
        }
(-)a/java.source/src/org/netbeans/modules/java/source/usages/ClassIndexImpl.java (+1 lines)
Lines 67-72 Link Here
67
import org.netbeans.modules.parsing.lucene.support.Convertor;
67
import org.netbeans.modules.parsing.lucene.support.Convertor;
68
import org.openide.filesystems.FileObject;
68
import org.openide.filesystems.FileObject;
69
import org.openide.util.Exceptions;
69
import org.openide.util.Exceptions;
70
import org.openide.util.Pair;
70
import org.openide.util.Utilities;
71
import org.openide.util.Utilities;
71
72
72
/** Should probably final class with private constructor.
73
/** Should probably final class with private constructor.
(-)a/java.source/src/org/netbeans/modules/java/source/usages/ClassIndexManager.java (-4 / +5 lines)
Lines 61-66 Link Here
61
import org.netbeans.modules.java.source.indexing.TransactionContext;
61
import org.netbeans.modules.java.source.indexing.TransactionContext;
62
import org.openide.filesystems.FileUtil;
62
import org.openide.filesystems.FileUtil;
63
import org.openide.util.Exceptions;
63
import org.openide.util.Exceptions;
64
import org.openide.util.Pair;
64
65
65
/**
66
/**
66
 *
67
 *
Lines 106-119 Link Here
106
                        return;
107
                        return;
107
                    }
108
                    }
108
                    Pair<ClassIndexImpl,Boolean> pair = getClassIndex(root, beforeCreateAllowed, false);
109
                    Pair<ClassIndexImpl,Boolean> pair = getClassIndex(root, beforeCreateAllowed, false);
109
                    index[0] = pair.first;
110
                    index[0] = pair.first();
110
                    if (index[0] != null) {
111
                    if (index[0] != null) {
111
                        return;
112
                        return;
112
                    }
113
                    }
113
                    URL translatedRoot = AptCacheForSourceQuery.getSourceFolder(root);
114
                    URL translatedRoot = AptCacheForSourceQuery.getSourceFolder(root);
114
                    if (translatedRoot != null) {
115
                    if (translatedRoot != null) {
115
                        pair = getClassIndex(translatedRoot, beforeCreateAllowed, false);
116
                        pair = getClassIndex(translatedRoot, beforeCreateAllowed, false);
116
                        index[0] = pair.first;
117
                        index[0] = pair.first();
117
                        if (index[0] != null) {
118
                        if (index[0] != null) {
118
                            return;
119
                            return;
119
                        }
120
                        }
Lines 170-176 Link Here
170
                return null;
171
                return null;
171
            }
172
            }
172
            Pair<ClassIndexImpl,Boolean> pair = getClassIndex (root, true, true);
173
            Pair<ClassIndexImpl,Boolean> pair = getClassIndex (root, true, true);
173
            ClassIndexImpl qi = pair.first;
174
            ClassIndexImpl qi = pair.first();
174
            if (qi == null) {
175
            if (qi == null) {
175
                qi = getUsagesQuery(root, true);
176
                qi = getUsagesQuery(root, true);
176
                if (qi == null) {
177
                if (qi == null) {
Lines 194-200 Link Here
194
                this.instances.put(root,qi);
195
                this.instances.put(root,qi);
195
                this.transientInstances.remove(root);
196
                this.transientInstances.remove(root);
196
                markAddedRoot(root);
197
                markAddedRoot(root);
197
            } else if (pair.second) {
198
            } else if (pair.second()) {
198
                markAddedRoot(root);
199
                markAddedRoot(root);
199
            }
200
            }
200
            return qi;
201
            return qi;
(-)a/java.source/src/org/netbeans/modules/java/source/usages/DocumentUtil.java (-8 / +9 lines)
Lines 77-82 Link Here
77
import org.netbeans.modules.parsing.lucene.support.Queries;
77
import org.netbeans.modules.parsing.lucene.support.Queries;
78
import org.openide.filesystems.FileObject;
78
import org.openide.filesystems.FileObject;
79
import org.openide.util.Exceptions;
79
import org.openide.util.Exceptions;
80
import org.openide.util.Pair;
80
81
81
/**
82
/**
82
 *
83
 *
Lines 529-538 Link Here
529
    private static class DocumentConvertor implements Convertor<Pair<Pair<String,String>,Object[]>,Document> {
530
    private static class DocumentConvertor implements Convertor<Pair<Pair<String,String>,Object[]>,Document> {
530
        @Override
531
        @Override
531
        public Document convert(Pair<Pair<String, String>, Object[]> entry) {
532
        public Document convert(Pair<Pair<String, String>, Object[]> entry) {
532
            final Pair<String,String> pair = entry.first;
533
            final Pair<String,String> pair = entry.first();
533
            final String cn = pair.first;
534
            final String cn = pair.first();
534
            final String srcName = pair.second;
535
            final String srcName = pair.second();
535
            final Object[] data = entry.second;
536
            final Object[] data = entry.second();
536
            final List<String> cr = (List<String>) data[0];
537
            final List<String> cr = (List<String>) data[0];
537
            final String fids = (String) data[1];
538
            final String fids = (String) data[1];
538
            final String ids = (String) data[2];
539
            final String ids = (String) data[2];
Lines 550-557 Link Here
550
551
551
        @Override
552
        @Override
552
        public Query convert(Pair<String, String> p) {
553
        public Query convert(Pair<String, String> p) {
553
            final String resourceName = p.first;
554
            final String resourceName = p.first();
554
            final String sourceName = p.second;
555
            final String sourceName = p.second();
555
            return fileBased ? createClassesInFileQuery(resourceName,sourceName) : createClassWithEnclosedQuery(resourceName, sourceName);
556
            return fileBased ? createClassesInFileQuery(resourceName,sourceName) : createClassWithEnclosedQuery(resourceName, sourceName);
556
        }
557
        }
557
        
558
        
Lines 613-620 Link Here
613
        
614
        
614
        private static Query binaryNameSourceNamePairQuery (final Pair<String,String> binaryNameSourceNamePair) {
615
        private static Query binaryNameSourceNamePairQuery (final Pair<String,String> binaryNameSourceNamePair) {
615
            assert binaryNameSourceNamePair != null;
616
            assert binaryNameSourceNamePair != null;
616
            final String binaryName = binaryNameSourceNamePair.first;
617
            final String binaryName = binaryNameSourceNamePair.first();
617
            final String sourceName = binaryNameSourceNamePair.second;
618
            final String sourceName = binaryNameSourceNamePair.second();
618
            final Query query = binaryNameQuery(binaryName);
619
            final Query query = binaryNameQuery(binaryName);
619
            if (sourceName != null) {
620
            if (sourceName != null) {
620
                assert query instanceof BooleanQuery : "The DocumentUtil.binaryNameQuery was incompatibly changed!";        //NOI18N
621
                assert query instanceof BooleanQuery : "The DocumentUtil.binaryNameQuery was incompatibly changed!";        //NOI18N
(-)a/java.source/src/org/netbeans/modules/java/source/usages/Pair.java (-75 lines)
Lines 1-75 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 1997-2010 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
 * Contributor(s):
28
 *
29
 * Portions Copyrighted 2007 Sun Microsystems, Inc.
30
 */
31
package org.netbeans.modules.java.source.usages;
32
33
/**
34
 *
35
 * @author Tomas Zezula
36
 */
37
public final class Pair<P,K> {
38
39
    public final P first;
40
    public final K second;
41
42
    private Pair (P first, K second) {
43
        this.first = first;
44
        this.second = second;
45
    }
46
47
    
48
    public static <P,K> Pair<P,K> of (P first, K second) {
49
        return new Pair<P,K> (first,second);
50
    }
51
    
52
    
53
    @Override
54
    public int hashCode () {
55
        int hashCode  = 0;
56
        hashCode ^= first == null ? 0 : first.hashCode();
57
        hashCode ^= second == null ? 0: second.hashCode();
58
        return hashCode;
59
    }
60
    
61
    @Override
62
    public boolean equals (final Object other) {
63
        if (other instanceof Pair) {
64
            Pair otherPair = (Pair) other;
65
            return (this.first == null ? otherPair.first == null : this.first.equals(otherPair.first)) &&
66
                   (this.second == null ? otherPair.second == null : this.second.equals(otherPair.second));
67
        }
68
        return false;
69
    }
70
    
71
    @Override
72
    public String toString () {
73
        return String.format("Pair[%s,%s]", first,second);
74
    }
75
}
(-)a/java.source/src/org/netbeans/modules/java/source/usages/PersistentClassIndex.java (-15 / +16 lines)
Lines 79-84 Link Here
79
import org.openide.filesystems.FileUtil;
79
import org.openide.filesystems.FileUtil;
80
import org.openide.filesystems.URLMapper;
80
import org.openide.filesystems.URLMapper;
81
import org.openide.util.Exceptions;
81
import org.openide.util.Exceptions;
82
import org.openide.util.Pair;
82
import org.openide.util.Parameters;
83
import org.openide.util.Parameters;
83
84
84
/**
85
/**
Lines 213-221 Link Here
213
                                QueryUtil.createPackageUsagesQuery(binaryName,usageType,Occur.SHOULD),
214
                                QueryUtil.createPackageUsagesQuery(binaryName,usageType,Occur.SHOULD),
214
                                scope);
215
                                scope);
215
                        if (q!=null) {
216
                        if (q!=null) {
216
                            index.query(result, ctu.first, DocumentUtil.declaredTypesFieldSelector(), cancel.get(), q);
217
                            index.query(result, ctu.first(), DocumentUtil.declaredTypesFieldSelector(), cancel.get(), q);
217
                            if (ctu.second != null) {
218
                            if (ctu.second() != null) {
218
                                ctu.second.query(result, convertor, DocumentUtil.declaredTypesFieldSelector(), cancel.get(), q);
219
                                ctu.second().query(result, convertor, DocumentUtil.declaredTypesFieldSelector(), cancel.get(), q);
219
                            }
220
                            }
220
                        }
221
                        }
221
                        return null;
222
                        return null;
Lines 239-247 Link Here
239
                                    QueryUtil.createUsagesQuery(binaryName, usageType, Occur.SHOULD),
240
                                    QueryUtil.createUsagesQuery(binaryName, usageType, Occur.SHOULD),
240
                                    scope);
241
                                    scope);
241
                            if (usagesQuery != null) {
242
                            if (usagesQuery != null) {
242
                                index.query(result, ctu.first, DocumentUtil.declaredTypesFieldSelector(), cancel.get(), usagesQuery);
243
                                index.query(result, ctu.first(), DocumentUtil.declaredTypesFieldSelector(), cancel.get(), usagesQuery);
243
                                if (ctu.second != null) {
244
                                if (ctu.second() != null) {
244
                                    ctu.second.query(result, convertor, DocumentUtil.declaredTypesFieldSelector(), cancel.get(), usagesQuery);
245
                                    ctu.second().query(result, convertor, DocumentUtil.declaredTypesFieldSelector(), cancel.get(), usagesQuery);
245
                                }
246
                                }
246
                            }
247
                            }
247
                            return null;
248
                            return null;
Lines 277-285 Link Here
277
                            DocumentUtil.translateQueryKind(kind)),
278
                            DocumentUtil.translateQueryKind(kind)),
278
                        scope);
279
                        scope);
279
                    if (query != null) {
280
                    if (query != null) {
280
                        index.query(result, ctu.first, DocumentUtil.declaredTypesFieldSelector(), cancel.get(), query);
281
                        index.query(result, ctu.first(), DocumentUtil.declaredTypesFieldSelector(), cancel.get(), query);
281
                        if (ctu.second != null) {
282
                        if (ctu.second() != null) {
282
                            ctu.second.query(result, convertor, DocumentUtil.declaredTypesFieldSelector(), cancel.get(), query);
283
                            ctu.second().query(result, convertor, DocumentUtil.declaredTypesFieldSelector(), cancel.get(), query);
283
                        }
284
                        }
284
                    }
285
                    }
285
                    return null;
286
                    return null;
Lines 315-327 Link Here
315
                        };
316
                        };
316
                    index.queryDocTerms(
317
                    index.queryDocTerms(
317
                            result,
318
                            result,
318
                            ctu.first,
319
                            ctu.first(),
319
                            t2s,
320
                            t2s,
320
                            DocumentUtil.declaredTypesFieldSelector(),
321
                            DocumentUtil.declaredTypesFieldSelector(),
321
                            cancel.get(),
322
                            cancel.get(),
322
                            query);
323
                            query);
323
                    if (ctu.second != null) {
324
                    if (ctu.second() != null) {
324
                        ctu.second.queryDocTerms(
325
                        ctu.second().queryDocTerms(
325
                            result,
326
                            result,
326
                            convertor,
327
                            convertor,
327
                            t2s,
328
                            t2s,
Lines 360-366 Link Here
360
                        collectInto = result;
361
                        collectInto = result;
361
                    }
362
                    }
362
                    final Pair<StoppableConvertor<Term,String>,Term> filter = QueryUtil.createPackageFilter(prefix,directOnly);
363
                    final Pair<StoppableConvertor<Term,String>,Term> filter = QueryUtil.createPackageFilter(prefix,directOnly);
363
                    index.queryTerms(collectInto, filter.second, filter.first, cancel.get());
364
                    index.queryTerms(collectInto, filter.second(), filter.first(), cancel.get());
364
                    if (cacheOp) {
365
                    if (cacheOp) {
365
                        synchronized (PersistentClassIndex.this) {
366
                        synchronized (PersistentClassIndex.this) {
366
                            if (rootPkgCache == null) {
367
                            if (rootPkgCache == null) {
Lines 543-550 Link Here
543
                final Pair<Index,Set<String>> data = updateDirty();
544
                final Pair<Index,Set<String>> data = updateDirty();
544
                if (data != null) {
545
                if (data != null) {
545
                    return Pair.<Convertor<? super Document, T>,Index>of(
546
                    return Pair.<Convertor<? super Document, T>,Index>of(
546
                            new FilterConvertor<T>(data.second, delegate),
547
                            new FilterConvertor<T>(data.second(), delegate),
547
                            data.first);
548
                            data.first());
548
                }
549
                }
549
            } catch (IOException ioe) {
550
            } catch (IOException ioe) {
550
                Exceptions.printStackTrace(ioe);
551
                Exceptions.printStackTrace(ioe);
(-)a/java.source/src/org/netbeans/modules/java/source/usages/QueryUtil.java (+1 lines)
Lines 59-64 Link Here
59
import org.netbeans.modules.java.source.usages.ClassIndexImpl.UsageType;
59
import org.netbeans.modules.java.source.usages.ClassIndexImpl.UsageType;
60
import org.netbeans.modules.parsing.lucene.support.Queries;
60
import org.netbeans.modules.parsing.lucene.support.Queries;
61
import org.netbeans.modules.parsing.lucene.support.StoppableConvertor;
61
import org.netbeans.modules.parsing.lucene.support.StoppableConvertor;
62
import org.openide.util.Pair;
62
import org.openide.util.Parameters;
63
import org.openide.util.Parameters;
63
64
64
/**
65
/**
(-)a/java.source/src/org/netbeans/modules/java/source/usages/SourceAnalyzerFactory.java (-5 / +6 lines)
Lines 85-90 Link Here
85
import org.openide.filesystems.FileUtil;
85
import org.openide.filesystems.FileUtil;
86
import org.openide.filesystems.URLMapper;
86
import org.openide.filesystems.URLMapper;
87
import org.openide.util.Exceptions;
87
import org.openide.util.Exceptions;
88
import org.openide.util.Pair;
88
import org.openide.util.Parameters;
89
import org.openide.util.Parameters;
89
90
90
/**
91
/**
Lines 443-449 Link Here
443
                    final String classNameType = className + DocumentUtil.encodeKind(ElementKind.CLASS);
444
                    final String classNameType = className + DocumentUtil.encodeKind(ElementKind.CLASS);
444
                    final Pair<String,String> name = Pair.<String,String>of(classNameType, null);
445
                    final Pair<String,String> name = Pair.<String,String>of(classNameType, null);
445
                    for (Pair<Symbol,ClassIndexImpl.UsageType> usage : packageAnnotations) {
446
                    for (Pair<Symbol,ClassIndexImpl.UsageType> usage : packageAnnotations) {
446
                        addUsage(usage.first, name, p, usage.second);
447
                        addUsage(usage.first(), name, p, usage.second());
447
                    }
448
                    }
448
                    for (CharSequence ident : packageAnnotationIdents) {
449
                    for (CharSequence ident : packageAnnotationIdents) {
449
                        addIdent(name, ident, p, false);
450
                        addIdent(name, ident, p, false);
Lines 641-647 Link Here
641
                                crossedTopLevel = true;
642
                                crossedTopLevel = true;
642
                            }
643
                            }
643
                        } else {
644
                        } else {
644
                            resourceName = activeClass.peek().second;
645
                            resourceName = activeClass.peek().second();
645
                        }
646
                        }
646
                        name = Pair.<String,String>of(classNameType, resourceName);
647
                        name = Pair.<String,String>of(classNameType, resourceName);
647
                        nameFrom = 2;
648
                        nameFrom = 2;
Lines 663-669 Link Here
663
                if (className != null) {
664
                if (className != null) {
664
                    if (topLevel) {
665
                    if (topLevel) {
665
                        if (topLevels != null) {
666
                        if (topLevels != null) {
666
                            topLevels.add (Pair.<String,String>of(className, name.second));
667
                            topLevels.add (Pair.<String,String>of(className, name.second()));
667
                        }
668
                        }
668
                        try {
669
                        try {
669
                            addAndClearImports(name, p);
670
                            addAndClearImports(name, p);
Lines 937-944 Link Here
937
        private UsagesData<String> getData (@NonNull final Pair<String,String>owner, @NonNull final Map<Pair<String,String>, UsagesData<String>> map) {
938
        private UsagesData<String> getData (@NonNull final Pair<String,String>owner, @NonNull final Map<Pair<String,String>, UsagesData<String>> map) {
938
            UsagesData<String> data = map.get(owner);
939
            UsagesData<String> data = map.get(owner);
939
            if (data == null) {
940
            if (data == null) {
940
                if (owner.first.charAt(owner.first.length()-2) == '.') {    //NOI18N
941
                if (owner.first().charAt(owner.first().length()-2) == '.') {    //NOI18N
941
                    throw new IllegalArgumentException(owner.first);
942
                    throw new IllegalArgumentException(owner.first());
942
                }
943
                }
943
                data = new UsagesData<String> (CONVERTOR);
944
                data = new UsagesData<String> (CONVERTOR);
944
                map.put(owner,data);
945
                map.put(owner,data);
(-)a/java.source/src/org/netbeans/modules/java/source/usages/VirtualSourceProviderQuery.java (-3 / +4 lines)
Lines 62-67 Link Here
62
import org.openide.util.Lookup;
62
import org.openide.util.Lookup;
63
import org.openide.util.LookupEvent;
63
import org.openide.util.LookupEvent;
64
import org.openide.util.LookupListener;
64
import org.openide.util.LookupListener;
65
import org.openide.util.Pair;
65
import org.openide.util.Parameters;
66
import org.openide.util.Parameters;
66
import org.openide.util.Utilities;
67
import org.openide.util.Utilities;
67
import org.openide.util.WeakListeners;
68
import org.openide.util.WeakListeners;
Lines 131-137 Link Here
131
                   m.put(ext, Pair.of(prov, l));
132
                   m.put(ext, Pair.of(prov, l));
132
               }
133
               }
133
               else {
134
               else {
134
                   l = p.second;
135
                   l = p.second();
135
               }
136
               }
136
               try {
137
               try {
137
                   final File file = Utilities.toFile(indexable.getURL().toURI());
138
                   final File file = Utilities.toFile(indexable.getURL().toURI());
Lines 147-154 Link Here
147
        
148
        
148
        final R r = new R (root, file2indexables);
149
        final R r = new R (root, file2indexables);
149
        for (Pair<VirtualSourceProvider,List<File>> p : m.values()) {
150
        for (Pair<VirtualSourceProvider,List<File>> p : m.values()) {
150
            final VirtualSourceProvider prov = p.first;
151
            final VirtualSourceProvider prov = p.first();
151
            final List<File> tf = p.second;
152
            final List<File> tf = p.second();
152
            r.setProvider(prov);
153
            r.setProvider(prov);
153
            prov.translate(tf, root,r);
154
            prov.translate(tf, root,r);
154
        }
155
        }
(-)a/java.source/test/unit/src/org/netbeans/api/java/source/JavaSourceTest.java (-1 / +1 lines)
Lines 106-112 Link Here
106
import org.netbeans.modules.java.source.parsing.DocPositionRegion;
106
import org.netbeans.modules.java.source.parsing.DocPositionRegion;
107
import org.netbeans.modules.java.source.parsing.JavaFileObjectProvider;
107
import org.netbeans.modules.java.source.parsing.JavaFileObjectProvider;
108
import org.netbeans.modules.java.source.parsing.SourceFileObject;
108
import org.netbeans.modules.java.source.parsing.SourceFileObject;
109
import org.netbeans.modules.java.source.usages.Pair;
110
import org.netbeans.modules.parsing.lucene.IndexFactory;
109
import org.netbeans.modules.parsing.lucene.IndexFactory;
111
import org.netbeans.modules.parsing.lucene.support.Convertor;
110
import org.netbeans.modules.parsing.lucene.support.Convertor;
112
import org.netbeans.modules.parsing.lucene.support.Index;
111
import org.netbeans.modules.parsing.lucene.support.Index;
Lines 140-145 Link Here
140
import org.netbeans.modules.parsing.spi.TaskIndexingMode;
139
import org.netbeans.modules.parsing.spi.TaskIndexingMode;
141
import org.netbeans.spi.java.classpath.ClassPathProvider;
140
import org.netbeans.spi.java.classpath.ClassPathProvider;
142
import org.openide.util.Exceptions;
141
import org.openide.util.Exceptions;
142
import org.openide.util.Pair;
143
/**
143
/**
144
 *
144
 *
145
 * @author Tomas Zezula
145
 * @author Tomas Zezula
(-)a/java.source/test/unit/src/org/netbeans/api/java/source/support/ProfileSupportTest.java (-4 / +4 lines)
Lines 78-88 Link Here
78
import org.netbeans.modules.java.platform.JavaPlatformProvider;
78
import org.netbeans.modules.java.platform.JavaPlatformProvider;
79
import org.netbeans.modules.java.source.ElementHandleAccessor;
79
import org.netbeans.modules.java.source.ElementHandleAccessor;
80
import org.netbeans.modules.java.source.parsing.FileObjects;
80
import org.netbeans.modules.java.source.parsing.FileObjects;
81
import org.netbeans.modules.java.source.usages.Pair;
82
import org.netbeans.spi.java.classpath.support.ClassPathSupport;
81
import org.netbeans.spi.java.classpath.support.ClassPathSupport;
83
import org.openide.filesystems.FileObject;
82
import org.openide.filesystems.FileObject;
84
import org.openide.filesystems.FileUtil;
83
import org.openide.filesystems.FileUtil;
85
import org.openide.modules.SpecificationVersion;
84
import org.openide.modules.SpecificationVersion;
85
import org.openide.util.Pair;
86
import org.openide.util.Utilities;
86
import org.openide.util.Utilities;
87
87
88
/**
88
/**
Lines 214-220 Link Here
214
                public int compare(
214
                public int compare(
215
                        Pair<ElementHandle<TypeElement>, SourceLevelQuery.Profile> o1,
215
                        Pair<ElementHandle<TypeElement>, SourceLevelQuery.Profile> o1,
216
                        Pair<ElementHandle<TypeElement>, SourceLevelQuery.Profile> o2) {
216
                        Pair<ElementHandle<TypeElement>, SourceLevelQuery.Profile> o2) {
217
                    return o1.first.getBinaryName().compareTo(o2.first.getBinaryName());
217
                    return o1.first().getBinaryName().compareTo(o2.first().getBinaryName());
218
                }
218
                }
219
            });
219
            });
220
        }
220
        }
Lines 352-359 Link Here
352
352
353
353
354
            JP(Pair<File,URL> p) {
354
            JP(Pair<File,URL> p) {
355
                this.home = FileUtil.toFileObject(p.first);
355
                this.home = FileUtil.toFileObject(p.first());
356
                this.boot = ClassPathSupport.createClassPath(p.second);
356
                this.boot = ClassPathSupport.createClassPath(p.second());
357
            }
357
            }
358
358
359
359
(-)a/java.source/test/unit/src/org/netbeans/modules/java/source/parsing/CachingFileManagerTest.java (-8 / +8 lines)
Lines 58-66 Link Here
58
import javax.tools.StandardLocation;
58
import javax.tools.StandardLocation;
59
import org.netbeans.api.java.classpath.ClassPath;
59
import org.netbeans.api.java.classpath.ClassPath;
60
import org.netbeans.junit.NbTestCase;
60
import org.netbeans.junit.NbTestCase;
61
import org.netbeans.modules.java.source.usages.Pair;
62
import org.netbeans.spi.java.classpath.support.ClassPathSupport;
61
import org.netbeans.spi.java.classpath.support.ClassPathSupport;
63
import org.openide.filesystems.FileUtil;
62
import org.openide.filesystems.FileUtil;
63
import org.openide.util.Pair;
64
import org.openide.util.Utilities;
64
import org.openide.util.Utilities;
65
65
66
/**
66
/**
Lines 120-139 Link Here
120
        final CachingArchiveProvider provider = CachingArchiveProvider.getDefault();
120
        final CachingArchiveProvider provider = CachingArchiveProvider.getDefault();
121
        final CachingFileManager manager = new CachingFileManager(provider, cp, false, true);
121
        final CachingFileManager manager = new CachingFileManager(provider, cp, false, true);
122
        for (Pair<Pair<String,String>,URI> testCase : testCases) {
122
        for (Pair<Pair<String,String>,URI> testCase : testCases) {
123
            final Pair<String,String> name = testCase.first;
123
            final Pair<String,String> name = testCase.first();
124
            final URI expectedURI = testCase.second;
124
            final URI expectedURI = testCase.second();
125
            FileObject fo = manager.getFileForInput(StandardLocation.CLASS_PATH, name.first, name.second);
125
            FileObject fo = manager.getFileForInput(StandardLocation.CLASS_PATH, name.first(), name.second());
126
            if (expectedURI == null) {
126
            if (expectedURI == null) {
127
                assertNull(
127
                assertNull(
128
                    String.format("Lookup: %s/%s expected: null",
128
                    String.format("Lookup: %s/%s expected: null",
129
                    name.first,
129
                    name.first(),
130
                    name.second),
130
                    name.second()),
131
                    fo);
131
                    fo);
132
            } else {
132
            } else {
133
                assertEquals(
133
                assertEquals(
134
                    String.format("Lookup: %s/%s expected: %s",
134
                    String.format("Lookup: %s/%s expected: %s",
135
                    name.first,
135
                    name.first(),
136
                    name.second,
136
                    name.second(),
137
                    expectedURI),
137
                    expectedURI),
138
                    expectedURI,
138
                    expectedURI,
139
                    fo.toUri());
139
                    fo.toUri());
(-)a/java.source/test/unit/src/org/netbeans/modules/java/source/usages/BinaryAnalyserTest.java (+1 lines)
Lines 76-81 Link Here
76
import org.openide.filesystems.FileObject;
76
import org.openide.filesystems.FileObject;
77
import org.openide.filesystems.FileUtil;
77
import org.openide.filesystems.FileUtil;
78
import org.openide.util.Exceptions;
78
import org.openide.util.Exceptions;
79
import org.openide.util.Pair;
79
import org.openide.util.Utilities;
80
import org.openide.util.Utilities;
80
81
81
/**
82
/**
(-)a/java.source/test/unit/src/org/netbeans/modules/java/source/usages/LucenePerformanceTest.java (-1 / +2 lines)
Lines 71-76 Link Here
71
import org.netbeans.modules.parsing.lucene.support.IndexManagerTestUtilities;
71
import org.netbeans.modules.parsing.lucene.support.IndexManagerTestUtilities;
72
import org.netbeans.modules.parsing.lucene.support.Queries;
72
import org.netbeans.modules.parsing.lucene.support.Queries;
73
import org.netbeans.modules.parsing.lucene.support.StoppableConvertor;
73
import org.netbeans.modules.parsing.lucene.support.StoppableConvertor;
74
import org.openide.util.Pair;
74
75
75
/**
76
/**
76
 *
77
 *
Lines 115-121 Link Here
115
        Set<String> result = new HashSet<String>();
116
        Set<String> result = new HashSet<String>();
116
        startTime = System.currentTimeMillis();
117
        startTime = System.currentTimeMillis();
117
        final Pair<StoppableConvertor<Term,String>,Term> filter = QueryUtil.createPackageFilter("", true);
118
        final Pair<StoppableConvertor<Term,String>,Term> filter = QueryUtil.createPackageFilter("", true);
118
        index.queryTerms(result, filter.second, filter.first, null);
119
        index.queryTerms(result, filter.second(), filter.first(), null);
119
        endTime = System.currentTimeMillis();
120
        endTime = System.currentTimeMillis();
120
        delta = (endTime-startTime);
121
        delta = (endTime-startTime);
121
        System.out.println("Packages: " + delta);
122
        System.out.println("Packages: " + delta);
(-)a/java.sourceui/nbproject/project.xml (-1 / +1 lines)
Lines 216-222 Link Here
216
                    <build-prerequisite/>
216
                    <build-prerequisite/>
217
                    <compile-dependency/>
217
                    <compile-dependency/>
218
                    <run-dependency>
218
                    <run-dependency>
219
                        <specification-version>8.0</specification-version>
219
                        <specification-version>8.32</specification-version>
220
                    </run-dependency>
220
                    </run-dependency>
221
                </dependency>
221
                </dependency>
222
                <dependency>
222
                <dependency>
(-)a/java.sourceui/src/org/netbeans/api/java/source/ui/ElementJavadoc.java (-23 / +23 lines)
Lines 79-91 Link Here
79
import org.netbeans.modules.java.preprocessorbridge.api.JavaSourceUtil;
79
import org.netbeans.modules.java.preprocessorbridge.api.JavaSourceUtil;
80
import org.netbeans.modules.java.source.JavadocHelper;
80
import org.netbeans.modules.java.source.JavadocHelper;
81
import org.netbeans.modules.java.source.parsing.FileObjects;
81
import org.netbeans.modules.java.source.parsing.FileObjects;
82
import org.netbeans.modules.java.source.usages.Pair;
83
import org.netbeans.spi.java.classpath.support.ClassPathSupport;
82
import org.netbeans.spi.java.classpath.support.ClassPathSupport;
84
import org.openide.filesystems.FileObject;
83
import org.openide.filesystems.FileObject;
85
import org.openide.filesystems.FileStateInvalidException;
84
import org.openide.filesystems.FileStateInvalidException;
86
import org.openide.filesystems.FileUtil;
85
import org.openide.filesystems.FileUtil;
87
import org.openide.util.Exceptions;
86
import org.openide.util.Exceptions;
88
import org.openide.util.NbBundle;
87
import org.openide.util.NbBundle;
88
import org.openide.util.Pair;
89
import org.openide.util.RequestProcessor;
89
import org.openide.util.RequestProcessor;
90
import org.openide.xml.XMLUtil;
90
import org.openide.xml.XMLUtil;
91
91
Lines 344-350 Link Here
344
        this.cpInfo = compilationInfo.getClasspathInfo();
344
        this.cpInfo = compilationInfo.getClasspathInfo();
345
        this.handle = element == null ? null : ElementHandle.create(element);
345
        this.handle = element == null ? null : ElementHandle.create(element);
346
        this.cancel = cancel;
346
        this.cancel = cancel;
347
        Doc doc = context.second.javaDocFor(element);
347
        Doc doc = context.second().javaDocFor(element);
348
        boolean localized = false;
348
        boolean localized = false;
349
        StringBuilder content = new StringBuilder();
349
        StringBuilder content = new StringBuilder();
350
        JavadocHelper.TextStream page = null;
350
        JavadocHelper.TextStream page = null;
Lines 397-403 Link Here
397
                    c.toPhase(Phase.RESOLVED);
397
                    c.toPhase(Phase.RESOLVED);
398
                    final Element element = handle.resolve(c);
398
                    final Element element = handle.resolve(c);
399
                    Pair<Trees,ElementUtilities> context = Pair.of(c.getTrees(), c.getElementUtilities());
399
                    Pair<Trees,ElementUtilities> context = Pair.of(c.getTrees(), c.getElementUtilities());
400
                    Doc doc = context.second.javaDocFor(element);
400
                    Doc doc = context.second().javaDocFor(element);
401
                    JavadocHelper.TextStream page = JavadocHelper.getJavadoc(element, cancel);
401
                    JavadocHelper.TextStream page = JavadocHelper.getJavadoc(element, cancel);
402
                    return prepareContent(contentFin, doc,localizedFin, page, cancel, false, context).get();
402
                    return prepareContent(contentFin, doc,localizedFin, page, cancel, false, context).get();
403
                }
403
                }
Lines 787-793 Link Here
787
        StringBuilder sb = new StringBuilder();
787
        StringBuilder sb = new StringBuilder();
788
        ClassDoc cls = peDoc.containingClass();
788
        ClassDoc cls = peDoc.containingClass();
789
        if (cls != null) {
789
        if (cls != null) {
790
            Element e = ctx.second.elementFor(cls);
790
            Element e = ctx.second().elementFor(cls);
791
            if (e != null) {
791
            if (e != null) {
792
                switch(e.getEnclosingElement().getKind()) {
792
                switch(e.getEnclosingElement().getKind()) {
793
                    case ANNOTATION_TYPE:
793
                    case ANNOTATION_TYPE:
Lines 806-812 Link Here
806
            PackageDoc pkg = peDoc.containingPackage();
806
            PackageDoc pkg = peDoc.containingPackage();
807
            if (pkg != null) {
807
            if (pkg != null) {
808
                sb.append("<font size='+0'><b>"); //NOI18N
808
                sb.append("<font size='+0'><b>"); //NOI18N
809
                createLink(sb, ctx.second.elementFor(pkg), makeNameLineBreakable(pkg.name()));
809
                createLink(sb, ctx.second().elementFor(pkg), makeNameLineBreakable(pkg.name()));
810
                sb.append("</b></font>"); //NOI18N)
810
                sb.append("</b></font>"); //NOI18N)
811
            }
811
            }
812
        }
812
        }
Lines 973-979 Link Here
973
                    sb.append('('); //NOI18N
973
                    sb.append('('); //NOI18N
974
                    for (int i = 0; i < pairs.length; i++) {
974
                    for (int i = 0; i < pairs.length; i++) {
975
                        AnnotationTypeElementDoc ated = pairs[i].element();
975
                        AnnotationTypeElementDoc ated = pairs[i].element();
976
                        createLink(sb, ctx.second.elementFor(ated), ated.name());
976
                        createLink(sb, ctx.second().elementFor(ated), ated.name());
977
                        sb.append('='); //NOI18N
977
                        sb.append('='); //NOI18N
978
                        appendAnnotationValue(sb, pairs[i].value(), ctx);
978
                        appendAnnotationValue(sb, pairs[i].value(), ctx);
979
                        if (i < pairs.length - 1)
979
                        if (i < pairs.length - 1)
Lines 1009-1015 Link Here
1009
            if (length > 1)
1009
            if (length > 1)
1010
                sb.append('}'); //NOI18N
1010
                sb.append('}'); //NOI18N
1011
        } else if (value instanceof Doc) {
1011
        } else if (value instanceof Doc) {
1012
            createLink(sb, ctx.second.elementFor((Doc)value), ((Doc)value).name());
1012
            createLink(sb, ctx.second().elementFor((Doc)value), ((Doc)value).name());
1013
        } else {
1013
        } else {
1014
            sb.append(value.toString());
1014
            sb.append(value.toString());
1015
        }
1015
        }
Lines 1061-1067 Link Here
1061
                thr.append("<code>"); //NOI18N
1061
                thr.append("<code>"); //NOI18N
1062
                Type exType = throwsTag.exceptionType();
1062
                Type exType = throwsTag.exceptionType();
1063
                if (exType != null) {
1063
                if (exType != null) {
1064
                    createLink(thr, ctx.second.elementFor(exType.asClassDoc()), exType.simpleTypeName());
1064
                    createLink(thr, ctx.second().elementFor(exType.asClassDoc()), exType.simpleTypeName());
1065
                } else {
1065
                } else {
1066
                    thr.append(throwsTag.exceptionName());
1066
                    thr.append(throwsTag.exceptionName());
1067
                }
1067
                }
Lines 1090-1096 Link Here
1090
                String label = stag.label();
1090
                String label = stag.label();
1091
                if (memberName != null) {
1091
                if (memberName != null) {
1092
                    if (refClass != null) {
1092
                    if (refClass != null) {
1093
                        createLink(see, ctx.second.elementFor(stag.referencedMember()), "<code>" + (label != null && label.length() > 0 ? label : (refClass.simpleTypeName() + "." + memberName)) + "</code>"); //NOI18N
1093
                        createLink(see, ctx.second().elementFor(stag.referencedMember()), "<code>" + (label != null && label.length() > 0 ? label : (refClass.simpleTypeName() + "." + memberName)) + "</code>"); //NOI18N
1094
                    } else {
1094
                    } else {
1095
                        see.append(className);
1095
                        see.append(className);
1096
                        see.append('.'); //NOI18N
1096
                        see.append('.'); //NOI18N
Lines 1099-1107 Link Here
1099
                    see.append(", "); //NOI18N
1099
                    see.append(", "); //NOI18N
1100
                } else if (className != null) {
1100
                } else if (className != null) {
1101
                    if (refClass != null) {
1101
                    if (refClass != null) {
1102
                        createLink(see, ctx.second.elementFor(refClass), "<code>" + (label != null && label.length() > 0 ? label : refClass.simpleTypeName()) + "</code>"); //NOI18N
1102
                        createLink(see, ctx.second().elementFor(refClass), "<code>" + (label != null && label.length() > 0 ? label : refClass.simpleTypeName()) + "</code>"); //NOI18N
1103
                    } else if (refPackage != null) {
1103
                    } else if (refPackage != null) {
1104
                        createLink(see, ctx.second.elementFor(refPackage), "<code>" + (label != null && label.length() > 0 ? label : refPackage.name()) + "</code>"); //NOI18N
1104
                        createLink(see, ctx.second().elementFor(refPackage), "<code>" + (label != null && label.length() > 0 ? label : refPackage.name()) + "</code>"); //NOI18N
1105
                    } else {
1105
                    } else {
1106
                        see.append(className);
1106
                        see.append(className);
1107
                    }
1107
                    }
Lines 1159-1165 Link Here
1159
                thr.append("<code>"); //NOI18N
1159
                thr.append("<code>"); //NOI18N
1160
                Type exType = ((ThrowsTag)tag).exceptionType();
1160
                Type exType = ((ThrowsTag)tag).exceptionType();
1161
                if (exType != null)
1161
                if (exType != null)
1162
                    createLink(thr, ctx.second.elementFor(exType.asClassDoc()), exType.simpleTypeName());
1162
                    createLink(thr, ctx.second().elementFor(exType.asClassDoc()), exType.simpleTypeName());
1163
                else
1163
                else
1164
                    thr.append(((ThrowsTag)tag).exceptionName());
1164
                    thr.append(((ThrowsTag)tag).exceptionName());
1165
                thr.append("</code>"); //NOI18N
1165
                thr.append("</code>"); //NOI18N
Lines 1181-1187 Link Here
1181
                String label = stag.label();
1181
                String label = stag.label();
1182
                if (memberName != null) {
1182
                if (memberName != null) {
1183
                    if (refClass != null) {
1183
                    if (refClass != null) {
1184
                        createLink(see, ctx.second.elementFor(stag.referencedMember()), "<code>" + (label != null && label.length() > 0 ? label : (refClass.simpleTypeName() + "." + memberName)) + "</code>"); //NOI18N
1184
                        createLink(see, ctx.second().elementFor(stag.referencedMember()), "<code>" + (label != null && label.length() > 0 ? label : (refClass.simpleTypeName() + "." + memberName)) + "</code>"); //NOI18N
1185
                    } else {
1185
                    } else {
1186
                        see.append(className);
1186
                        see.append(className);
1187
                        see.append('.'); //NOI18N
1187
                        see.append('.'); //NOI18N
Lines 1190-1198 Link Here
1190
                    see.append(", "); //NOI18N
1190
                    see.append(", "); //NOI18N
1191
                } else if (className != null) {
1191
                } else if (className != null) {
1192
                    if (refClass != null) {
1192
                    if (refClass != null) {
1193
                        createLink(see, ctx.second.elementFor(refClass), "<code>" + (label != null && label.length() > 0 ? label : refClass.simpleTypeName()) + "</code>"); //NOI18N
1193
                        createLink(see, ctx.second().elementFor(refClass), "<code>" + (label != null && label.length() > 0 ? label : refClass.simpleTypeName()) + "</code>"); //NOI18N
1194
                    } else if (refPackage != null) {
1194
                    } else if (refPackage != null) {
1195
                        createLink(see, ctx.second.elementFor(refPackage), "<code>" + (label != null && label.length() > 0 ? label : refPackage.name()) + "</code>"); //NOI18N
1195
                        createLink(see, ctx.second().elementFor(refPackage), "<code>" + (label != null && label.length() > 0 ? label : refPackage.name()) + "</code>"); //NOI18N
1196
                    } else {
1196
                    } else {
1197
                        see.append(className);
1197
                        see.append(className);
1198
                    }
1198
                    }
Lines 1262-1268 Link Here
1262
                    boolean plain = LINKPLAIN_TAG.equals(stag.name());
1262
                    boolean plain = LINKPLAIN_TAG.equals(stag.name());
1263
                    if (memberName != null) {
1263
                    if (memberName != null) {
1264
                        if (refClass != null) {
1264
                        if (refClass != null) {
1265
                            createLink(sb, ctx.second.elementFor(stag.referencedMember()), (plain ? "" : "<code>") + (label != null && label.length() > 0 ? label : (refClass.simpleTypeName() + "." + memberName)) + (plain ? "" : "</code>")); //NOI18N
1265
                            createLink(sb, ctx.second().elementFor(stag.referencedMember()), (plain ? "" : "<code>") + (label != null && label.length() > 0 ? label : (refClass.simpleTypeName() + "." + memberName)) + (plain ? "" : "</code>")); //NOI18N
1266
                        } else {
1266
                        } else {
1267
                            sb.append(stag.referencedClassName());
1267
                            sb.append(stag.referencedClassName());
1268
                            sb.append('.'); //NOI18N
1268
                            sb.append('.'); //NOI18N
Lines 1270-1278 Link Here
1270
                        }
1270
                        }
1271
                    } else {
1271
                    } else {
1272
                        if (refClass != null) {
1272
                        if (refClass != null) {
1273
                            createLink(sb, ctx.second.elementFor(refClass), (plain ? "" : "<code>") + (label != null && label.length() > 0 ? label : refClass.simpleTypeName()) + (plain ? "" : "</code>")); //NOI18N
1273
                            createLink(sb, ctx.second().elementFor(refClass), (plain ? "" : "<code>") + (label != null && label.length() > 0 ? label : refClass.simpleTypeName()) + (plain ? "" : "</code>")); //NOI18N
1274
                        } else if (refPackage != null) {
1274
                        } else if (refPackage != null) {
1275
                            createLink(sb, ctx.second.elementFor(refPackage), (plain ? "" : "<code>") + (label != null && label.length() > 0 ? label : refPackage.name()) + (plain ? "" : "</code>")); //NOI18N
1275
                            createLink(sb, ctx.second().elementFor(refPackage), (plain ? "" : "<code>") + (label != null && label.length() > 0 ? label : refPackage.name()) + (plain ? "" : "</code>")); //NOI18N
1276
                        } else {
1276
                        } else {
1277
                            String className = stag.referencedClassName();
1277
                            String className = stag.referencedClassName();
1278
                            sb.append(className != null ? className : stag.text());
1278
                            sb.append(className != null ? className : stag.text());
Lines 1383-1389 Link Here
1383
                String tName = cd != null ? cd.name() : type.simpleTypeName();
1383
                String tName = cd != null ? cd.name() : type.simpleTypeName();
1384
                if (cd != null && cd.isAnnotationType() && annotation)
1384
                if (cd != null && cd.isAnnotationType() && annotation)
1385
                    tName = "@" + tName; //NOI18N
1385
                    tName = "@" + tName; //NOI18N
1386
                len += createLink(sb, ctx.second.elementFor(type.asClassDoc()), tName);
1386
                len += createLink(sb, ctx.second().elementFor(type.asClassDoc()), tName);
1387
                ParameterizedType pt = type.asParameterizedType();
1387
                ParameterizedType pt = type.asParameterizedType();
1388
                if (pt != null) {
1388
                if (pt != null) {
1389
                    Type[] targs = pt.typeArguments();
1389
                    Type[] targs = pt.typeArguments();
Lines 1433-1439 Link Here
1433
            for (ClassDoc ifaceDoc : cdoc.interfaces()) {
1433
            for (ClassDoc ifaceDoc : cdoc.interfaces()) {
1434
                for (MethodDoc methodDoc : ifaceDoc.methods(false)) {
1434
                for (MethodDoc methodDoc : ifaceDoc.methods(false)) {
1435
                    if (mdoc.overrides(methodDoc)) {
1435
                    if (mdoc.overrides(methodDoc)) {
1436
                        Element e = ctx.second.elementFor(methodDoc);
1436
                        Element e = ctx.second().elementFor(methodDoc);
1437
                        boolean isLocalized = false;
1437
                        boolean isLocalized = false;
1438
                        if (e != null) {
1438
                        if (e != null) {
1439
                            inheritedPage = JavadocHelper.getJavadoc(e, cancel);
1439
                            inheritedPage = JavadocHelper.getJavadoc(e, cancel);
Lines 1441-1447 Link Here
1441
                                docURL = inheritedPage.getLocation();
1441
                                docURL = inheritedPage.getLocation();
1442
                            }
1442
                            }
1443
                            if (!(isLocalized = isLocalized(docURL, e)))
1443
                            if (!(isLocalized = isLocalized(docURL, e)))
1444
                                ctx.first.getTree(e);
1444
                                ctx.first().getTree(e);
1445
                        }
1445
                        }
1446
                        if (!isLocalized) {
1446
                        if (!isLocalized) {
1447
                            List<Tag> inheritedInlineTags = null;
1447
                            List<Tag> inheritedInlineTags = null;
Lines 1606-1612 Link Here
1606
            if (superclass != null) { //NOI18N
1606
            if (superclass != null) { //NOI18N
1607
                for (MethodDoc methodDoc : superclass.methods(false)) {
1607
                for (MethodDoc methodDoc : superclass.methods(false)) {
1608
                    if (mdoc.overrides(methodDoc)) {
1608
                    if (mdoc.overrides(methodDoc)) {
1609
                        Element e = ctx.second.elementFor(methodDoc);
1609
                        Element e = ctx.second().elementFor(methodDoc);
1610
                        boolean isLocalized = false;
1610
                        boolean isLocalized = false;
1611
                        if (e != null) {
1611
                        if (e != null) {
1612
                            inheritedPage = JavadocHelper.getJavadoc(e, cancel);
1612
                            inheritedPage = JavadocHelper.getJavadoc(e, cancel);
Lines 1614-1620 Link Here
1614
                                docURL = inheritedPage.getLocation();
1614
                                docURL = inheritedPage.getLocation();
1615
                            }
1615
                            }
1616
                            if (!(isLocalized = isLocalized(docURL, e)))
1616
                            if (!(isLocalized = isLocalized(docURL, e)))
1617
                                ctx.first.getTree(e);
1617
                                ctx.first().getTree(e);
1618
                        }
1618
                        }
1619
                        if (!isLocalized) {
1619
                        if (!isLocalized) {
1620
                            List<Tag> inheritedInlineTags = null;
1620
                            List<Tag> inheritedInlineTags = null;
(-)a/javascript.editing/nbproject/project.xml (-1 / +1 lines)
Lines 262-268 Link Here
262
                    <build-prerequisite/>
262
                    <build-prerequisite/>
263
                    <compile-dependency/>
263
                    <compile-dependency/>
264
                    <run-dependency>
264
                    <run-dependency>
265
                        <specification-version>8.0</specification-version>
265
                        <specification-version>8.32</specification-version>
266
                    </run-dependency>
266
                    </run-dependency>
267
                </dependency>
267
                </dependency>
268
                <dependency>
268
                <dependency>
(-)a/javascript.editing/src/org/netbeans/modules/javascript/editing/JsCodeCompletion.java (-6 / +7 lines)
Lines 99-104 Link Here
99
import org.openide.util.Exceptions;
99
import org.openide.util.Exceptions;
100
import org.openide.util.ImageUtilities;
100
import org.openide.util.ImageUtilities;
101
import org.openide.util.NbBundle;
101
import org.openide.util.NbBundle;
102
import org.openide.util.Pair;
102
103
103
/**
104
/**
104
 * Code completion handler for JavaScript
105
 * Code completion handler for JavaScript
Lines 1222-1229 Link Here
1222
            matches = index.getElements(prefix, fqn, kind, result);
1223
            matches = index.getElements(prefix, fqn, kind, result);
1223
        } else {
1224
        } else {
1224
            Pair<Set<IndexedElement>, Boolean> names = index.getAllNamesTruncated(prefix, kind, result);
1225
            Pair<Set<IndexedElement>, Boolean> names = index.getAllNamesTruncated(prefix, kind, result);
1225
            matches = names.getA();
1226
            matches = names.first();
1226
            boolean isTruncated = names.getB();
1227
            boolean isTruncated = names.second();
1227
            if (isTruncated) {
1228
            if (isTruncated) {
1228
                request.completionResult.setTruncated(true);
1229
                request.completionResult.setTruncated(true);
1229
                includeNonFqn = false;
1230
                includeNonFqn = false;
Lines 1446-1453 Link Here
1446
//                    return true;
1447
//                    return true;
1447
//                } else {
1448
//                } else {
1448
                Pair<Set<IndexedElement>, Boolean> names = index.getAllNamesTruncated(prefix, kind, result);
1449
                Pair<Set<IndexedElement>, Boolean> names = index.getAllNamesTruncated(prefix, kind, result);
1449
                elements = names.getA();
1450
                elements = names.first();
1450
                boolean isTruncated = names.getB();
1451
                boolean isTruncated = names.second();
1451
                if (isTruncated) {
1452
                if (isTruncated) {
1452
                    request.completionResult.setTruncated(true);
1453
                    request.completionResult.setTruncated(true);
1453
                }
1454
                }
Lines 1583-1590 Link Here
1583
1584
1584
                if (token.id() == JsTokenId.NEW) {
1585
                if (token.id() == JsTokenId.NEW) {
1585
                    Pair<Set<IndexedElement>, Boolean> constructors = index.getConstructors(prefix, kind);
1586
                    Pair<Set<IndexedElement>, Boolean> constructors = index.getConstructors(prefix, kind);
1586
                    Set<IndexedElement> elements = constructors.getA();
1587
                    Set<IndexedElement> elements = constructors.first();
1587
                    if (constructors.getB()) {
1588
                    if (constructors.second()) {
1588
                        request.completionResult.setTruncated(true);
1589
                        request.completionResult.setTruncated(true);
1589
                    }
1590
                    }
1590
                    String lhs = request.call.getLhs();
1591
                    String lhs = request.call.getLhs();
(-)a/javascript.editing/src/org/netbeans/modules/javascript/editing/JsIndex.java (-3 / +4 lines)
Lines 61-66 Link Here
61
import org.openide.filesystems.FileObject;
61
import org.openide.filesystems.FileObject;
62
import org.openide.filesystems.FileStateInvalidException;
62
import org.openide.filesystems.FileStateInvalidException;
63
import org.openide.util.Exceptions;
63
import org.openide.util.Exceptions;
64
import org.openide.util.Pair;
64
65
65
/**
66
/**
66
 *
67
 *
Lines 134-140 Link Here
134
    @SuppressWarnings("unchecked")
135
    @SuppressWarnings("unchecked")
135
    public Set<IndexedElement> getAllNames(final String name, QuerySupport.Kind kind, JsParseResult context) {
136
    public Set<IndexedElement> getAllNames(final String name, QuerySupport.Kind kind, JsParseResult context) {
136
        // TODO - search by the FIELD_CLASS thingy
137
        // TODO - search by the FIELD_CLASS thingy
137
        return getUnknownFunctions(name, kind, false, context, true, true).getA();
138
        return getUnknownFunctions(name, kind, false, context, true, true).first();
138
    }
139
    }
139
140
140
    @SuppressWarnings("unchecked")
141
    @SuppressWarnings("unchecked")
Lines 351-363 Link Here
351
                    elements.add(element);
352
                    elements.add(element);
352
                    
353
                    
353
                    if (elements.size() == MAX_SEARCH_ITEMS) {
354
                    if (elements.size() == MAX_SEARCH_ITEMS) {
354
                        return new Pair<Set<IndexedElement>,Boolean>(elements, true);
355
                        return Pair.<Set<IndexedElement>,Boolean>of(elements, true);
355
                    }
356
                    }
356
                }
357
                }
357
            }
358
            }
358
        }
359
        }
359
        
360
        
360
        return new Pair<Set<IndexedElement>,Boolean>(elements, false);
361
        return Pair.<Set<IndexedElement>,Boolean>of(elements, false);
361
    }
362
    }
362
    
363
    
363
    private Set<IndexedElement> getByFqn(
364
    private Set<IndexedElement> getByFqn(
(-)a/javascript.editing/src/org/netbeans/modules/javascript/editing/Pair.java (-71 lines)
Lines 1-71 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 1997-2010 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
 * Contributor(s):
28
 *
29
 * The Original Software is NetBeans. The Initial Developer of the Original
30
 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
31
 * Microsystems, Inc. All Rights Reserved.
32
 *
33
 * If you wish your version of this file to be governed by only the CDDL
34
 * or only the GPL Version 2, indicate your decision by adding
35
 * "[Contributor] elects to include this software in this distribution
36
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
37
 * single choice of license, a recipient has the option to distribute
38
 * your version of this file under either the CDDL, the GPL Version 2 or
39
 * to extend the choice of license to its licensees as provided above.
40
 * However, if you add GPL Version 2 code and therefore, elected the GPL
41
 * Version 2 license, then the option applies only if the new code is
42
 * made subject to such option by the copyright holder.
43
 */
44
package org.netbeans.modules.javascript.editing;
45
46
/**
47
 *
48
 * @author Jan Lahoda
49
 */
50
public final class Pair<A, B> {
51
52
    private final A a;
53
    private final B b;
54
55
    public Pair(A a, B b) {
56
        this.a = a;
57
        this.b = b;
58
    }
59
60
    public A getA() {
61
        return a;
62
    }
63
64
    public B getB() {
65
        return b;
66
    }
67
68
    public static <A,B> Pair<A,B> of(A a, B b) {
69
      return new Pair<A, B>(a, b);
70
    } 
71
}
(-)a/jumpto/nbproject/project.xml (-1 / +1 lines)
Lines 189-195 Link Here
189
                    <build-prerequisite/>
189
                    <build-prerequisite/>
190
                    <compile-dependency/>
190
                    <compile-dependency/>
191
                    <run-dependency>
191
                    <run-dependency>
192
                        <specification-version>8.0</specification-version>
192
                        <specification-version>8.32</specification-version>
193
                    </run-dependency>
193
                    </run-dependency>
194
                </dependency>
194
                </dependency>
195
                <dependency>
195
                <dependency>
(-)a/jumpto/src/org/netbeans/modules/jumpto/common/Models.java (+1 lines)
Lines 48-53 Link Here
48
import javax.swing.AbstractListModel;
48
import javax.swing.AbstractListModel;
49
import javax.swing.ListModel;
49
import javax.swing.ListModel;
50
import org.netbeans.api.annotations.common.NonNull;
50
import org.netbeans.api.annotations.common.NonNull;
51
import org.openide.util.Pair;
51
52
52
/**
53
/**
53
 * (copied from org.netbeans.modules.java.source.util.Models
54
 * (copied from org.netbeans.modules.java.source.util.Models
(-)a/jumpto/src/org/netbeans/modules/jumpto/common/Pair.java (-101 lines)
Lines 1-101 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.jumpto.common;
43
44
import org.netbeans.api.annotations.common.NonNull;
45
import org.netbeans.api.annotations.common.NullAllowed;
46
47
/**
48
 *
49
 * @author Tomas Zezula
50
 */
51
public final class Pair<F,S> {
52
53
    public final F first;
54
    public final S second;
55
56
57
    private Pair(
58
        @NullAllowed final F first,
59
        @NullAllowed final S second) {
60
        this.first = first;
61
        this.second = second;
62
    }
63
64
    @Override
65
    public String toString() {
66
        return String.format(
67
            "Pair[%s,%s]",  //NOI18N
68
            first,
69
            second);
70
    }
71
72
    @Override
73
    public int hashCode() {
74
        int res = 17;
75
        res = res * 31 + (first == null ? 0 : first.hashCode());
76
        res = res * 31 + (second == null ? 0 : second.hashCode());
77
        return res;
78
    }
79
80
    @Override
81
    public boolean equals(@NullAllowed final Object other) {
82
        if (other == this) {
83
            return true;
84
        }
85
        if (!(other instanceof Pair)) {
86
            return false;
87
        }
88
        final Pair<?,?> otherPair = (Pair<?,?>) other;
89
        return first == null ? otherPair.first == null : first.equals(otherPair.first) &&
90
            second == null ? otherPair.second == null : second.equals(otherPair.second);
91
    }
92
93
94
    @NonNull
95
    public static <F,S> Pair<F,S> of(
96
        @NullAllowed final F first,
97
        @NullAllowed final S second) {
98
        return new Pair<F,S>(first,second);
99
    }
100
101
}
(-)a/jumpto/src/org/netbeans/modules/jumpto/file/FileSearchAction.java (-2 / +2 lines)
Lines 110-116 Link Here
110
import org.netbeans.modules.jumpto.common.Factory;
110
import org.netbeans.modules.jumpto.common.Factory;
111
import org.netbeans.modules.jumpto.type.GoToTypeAction;
111
import org.netbeans.modules.jumpto.type.GoToTypeAction;
112
import org.netbeans.modules.jumpto.common.Models;
112
import org.netbeans.modules.jumpto.common.Models;
113
import org.netbeans.modules.jumpto.common.Pair;
114
import org.netbeans.modules.parsing.spi.indexing.support.IndexResult;
113
import org.netbeans.modules.parsing.spi.indexing.support.IndexResult;
115
import org.netbeans.modules.parsing.spi.indexing.support.QuerySupport;
114
import org.netbeans.modules.parsing.spi.indexing.support.QuerySupport;
116
import org.netbeans.spi.jumpto.file.FileDescriptor;
115
import org.netbeans.spi.jumpto.file.FileDescriptor;
Lines 133-138 Link Here
133
import org.openide.util.ImageUtilities;
132
import org.openide.util.ImageUtilities;
134
import org.openide.util.Lookup;
133
import org.openide.util.Lookup;
135
import org.openide.util.NbBundle;
134
import org.openide.util.NbBundle;
135
import org.openide.util.Pair;
136
import org.openide.util.Parameters;
136
import org.openide.util.Parameters;
137
import org.openide.util.RequestProcessor;
137
import org.openide.util.RequestProcessor;
138
import org.openide.util.Utilities;
138
import org.openide.util.Utilities;
Lines 491-497 Link Here
491
                    new Factory<FileDescriptor, Pair<FileDescriptor,Runnable>>() {
491
                    new Factory<FileDescriptor, Pair<FileDescriptor,Runnable>>() {
492
                        @Override
492
                        @Override
493
                        public FileDescriptor create(@NonNull final Pair<FileDescriptor,Runnable> param) {
493
                        public FileDescriptor create(@NonNull final Pair<FileDescriptor,Runnable> param) {
494
                            return new AsyncFileDescriptor(param.first, param.second);
494
                            return new AsyncFileDescriptor(param.first(), param.second());
495
                        }
495
                        }
496
                    });
496
                    });
497
497
(-)a/maven.hints/nbproject/project.xml (-1 / +1 lines)
Lines 287-293 Link Here
287
                    <build-prerequisite/>
287
                    <build-prerequisite/>
288
                    <compile-dependency/>
288
                    <compile-dependency/>
289
                    <run-dependency>
289
                    <run-dependency>
290
                        <specification-version>8.0</specification-version>
290
                        <specification-version>8.32</specification-version>
291
                    </run-dependency>
291
                    </run-dependency>
292
                </dependency>
292
                </dependency>
293
                <dependency>
293
                <dependency>
(-)a/maven.hints/src/org/netbeans/modules/maven/hints/pom/Pair.java (-73 lines)
Lines 1-73 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 1997-2010 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
 * Contributor(s):
28
 *
29
 * The Original Software is NetBeans. The Initial Developer of the Original
30
 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
31
 * Microsystems, Inc. All Rights Reserved.
32
 *
33
 * If you wish your version of this file to be governed by only the CDDL
34
 * or only the GPL Version 2, indicate your decision by adding
35
 * "[Contributor] elects to include this software in this distribution
36
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
37
 * single choice of license, a recipient has the option to distribute
38
 * your version of this file under either the CDDL, the GPL Version 2 or
39
 * to extend the choice of license to its licensees as provided above.
40
 * However, if you add GPL Version 2 code and therefore, elected the GPL
41
 * Version 2 license, then the option applies only if the new code is
42
 * made subject to such option by the copyright holder.
43
 */
44
45
package org.netbeans.modules.maven.hints.pom;
46
47
/**
48
 *
49
 * @author Jan Lahoda
50
 */
51
public final class Pair<A, B> {
52
53
    private A a;
54
    private B b;
55
56
    public Pair(A a, B b) {
57
        this.a = a;
58
        this.b = b;
59
    }
60
61
    public A getA() {
62
        return a;
63
    }
64
65
    public B getB() {
66
        return b;
67
    }
68
    
69
     @Override
70
     public String toString() {
71
         return "[" + String.valueOf(a) + "/" + String.valueOf(b) + "]";
72
     }
73
}
(-)a/maven.hints/src/org/netbeans/modules/maven/hints/pom/RulesManager.java (-3 / +4 lines)
Lines 61-66 Link Here
61
import org.openide.filesystems.FileObject;
61
import org.openide.filesystems.FileObject;
62
import org.openide.filesystems.FileUtil;
62
import org.openide.filesystems.FileUtil;
63
import org.openide.loaders.DataObject;
63
import org.openide.loaders.DataObject;
64
import org.openide.util.Pair;
64
65
65
/** Manages rules read from the system filesystem.
66
/** Manages rules read from the system filesystem.
66
 *
67
 *
Lines 126-132 Link Here
126
                    r = instantiateRule(o);
127
                    r = instantiateRule(o);
127
                }
128
                }
128
                if ( r != null ) {
129
                if ( r != null ) {
129
                    rules.add( new Pair<POMErrorFixBase,FileObject>( r, o ) );
130
                    rules.add( Pair.<POMErrorFixBase,FileObject>of( r, o ) );
130
                }
131
                }
131
            }
132
            }
132
        }
133
        }
Lines 140-147 Link Here
140
        dir2node.put(rootFolder, rootNode);
141
        dir2node.put(rootFolder, rootNode);
141
142
142
        for( Pair<POMErrorFixBase,FileObject> pair : rules ) {
143
        for( Pair<POMErrorFixBase,FileObject> pair : rules ) {
143
            POMErrorFixBase rule = pair.getA();
144
            POMErrorFixBase rule = pair.first();
144
            FileObject fo = pair.getB();
145
            FileObject fo = pair.second();
145
146
146
                Object nonGuiObject = fo.getAttribute(NON_GUI);
147
                Object nonGuiObject = fo.getAttribute(NON_GUI);
147
                boolean toGui = true;
148
                boolean toGui = true;
(-)a/maven.j2ee/manifest.mf (-1 / +1 lines)
Lines 3-6 Link Here
3
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/maven/j2ee/Bundle.properties
3
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/maven/j2ee/Bundle.properties
4
OpenIDE-Module-Layer: org/netbeans/modules/maven/j2ee/layer.xml
4
OpenIDE-Module-Layer: org/netbeans/modules/maven/j2ee/layer.xml
5
AutoUpdate-Show-In-Client: false
5
AutoUpdate-Show-In-Client: false
6
OpenIDE-Module-Specification-Version: 1.34
6
OpenIDE-Module-Specification-Version: 1.35
(-)a/maven.j2ee/nbproject/project.xml (-1 / +1 lines)
Lines 324-330 Link Here
324
                    <build-prerequisite/>
324
                    <build-prerequisite/>
325
                    <compile-dependency/>
325
                    <compile-dependency/>
326
                    <run-dependency>
326
                    <run-dependency>
327
                        <specification-version>1.27</specification-version>
327
                        <specification-version>1.28</specification-version>
328
                    </run-dependency>
328
                    </run-dependency>
329
                </dependency>
329
                </dependency>
330
                <dependency>
330
                <dependency>
(-)a/openide.util/apichanges.xml (+15 lines)
Lines 51-56 Link Here
51
    <apidef name="actions">Actions API</apidef>
51
    <apidef name="actions">Actions API</apidef>
52
</apidefs>
52
</apidefs>
53
<changes>
53
<changes>
54
    <change id="pair">
55
        <api name="util"/>
56
        <summary>Added a type safe Pair of 2 elements</summary>
57
        <version major="8" minor="32"/>
58
        <date year="2013" month="5" day="1"/>
59
        <author login="tzezula"/>
60
        <compatibility addition="yes" binary="compatible" source="compatible"/>
61
        <description>
62
            <p>
63
                Added a type safe Pair of 2 elements.
64
            </p>
65
        </description>
66
        <class package="org.openide.util" name="Pair"/>
67
        <issue number="228994"/>
68
    </change>
54
    <change id="automatic-uqe">
69
    <change id="automatic-uqe">
55
        <api name="util"/>
70
        <api name="util"/>
56
        <summary>Automatic support for UserQuestionException</summary>
71
        <summary>Automatic support for UserQuestionException</summary>
(-)a/openide.util/manifest.mf (-1 / +1 lines)
Lines 1-5 Link Here
1
Manifest-Version: 1.0
1
Manifest-Version: 1.0
2
OpenIDE-Module: org.openide.util
2
OpenIDE-Module: org.openide.util
3
OpenIDE-Module-Localizing-Bundle: org/openide/util/Bundle.properties
3
OpenIDE-Module-Localizing-Bundle: org/openide/util/Bundle.properties
4
OpenIDE-Module-Specification-Version: 8.31
4
OpenIDE-Module-Specification-Version: 8.32
5
5
(-)a/openide.util/src/org/openide/util/Pair.java (+114 lines)
Line 0 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2013 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 2013 Sun Microsystems, Inc.
41
 */
42
package org.openide.util;
43
44
/**
45
 * A type safe pair of two object.
46
 * @author Tomas Zezula
47
 * @since 8.32
48
 */
49
public final class Pair<First,Second> {
50
51
    private final First first;
52
    private final Second second;
53
54
55
    private Pair(final First first, final Second second) {
56
        this.first = first;
57
        this.second = second;
58
    }
59
60
    /**
61
     * Returns the first element of the {@link Pair}.
62
     * @return the first element.
63
     */
64
    public First first() {
65
        return first;
66
    }
67
68
    /**
69
     * Returns the second element of the {@link Pair}.
70
     * @return the second element.
71
     */
72
    public Second second() {
73
        return second;
74
    }
75
76
    @Override
77
    public String toString () {
78
        return String.format("Pair[%s,%s]", first,second);  //NOI18N
79
    }
80
81
    @Override
82
    public boolean equals(final Object other) {
83
        if (other == this) {
84
            return true;
85
        }
86
        if (!(other instanceof Pair)) {
87
            return false;
88
        }
89
        final Pair<?,?> otherPair = (Pair<?,?>) other;
90
        return (first == null ? otherPair.first == null : first.equals(otherPair.first)) &&
91
            (second == null ? otherPair.second == null : second.equals(otherPair.second));
92
    }
93
94
    @Override
95
    public int hashCode() {
96
        int res = 17;
97
        res = res * 31 + (first == null ? 0 : first.hashCode());
98
        res = res * 31 + (second == null ? 0 : second.hashCode());
99
        return res;
100
    }
101
102
103
    /**
104
     * Creates a new Pair.
105
     * @param <First>   the type of the first element
106
     * @param <Second>  the type of the second element
107
     * @param first     the first element
108
     * @param second    the second element
109
     * @return  the new {@link Pair} of the first and second elements.
110
     */
111
    public static <First,Second> Pair<First,Second> of (final First first, final Second second) {
112
        return new Pair<First, Second>(first, second);
113
    }
114
}
(-)a/openide.util/test/unit/src/org/openide/util/PairTest.java (+79 lines)
Line 0 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2013 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 2013 Sun Microsystems, Inc.
41
 */
42
package org.openide.util;
43
44
import org.netbeans.junit.NbTestCase;
45
46
/**
47
 *
48
 * @author Tomas Zezula
49
 */
50
public class PairTest extends NbTestCase {
51
52
    public PairTest(String name) {
53
        super(name);
54
    }
55
56
57
    public void testPairs() {
58
        final Pair<Integer,Integer> p1a = Pair.of(1, 1);
59
        final Pair<Integer,Integer> p1b = Pair.of(1, 1);
60
        final Pair<Integer,Integer> p2 = Pair.of(1, 2);
61
        final Pair<Integer,Integer> p3 = Pair.of(2, 1);
62
        final Pair<Integer,Integer> p4 = Pair.of(null, 1);
63
        final Pair<Integer,Integer> p5 = Pair.of(1, null);
64
        final Pair<Integer,Integer> p6 = Pair.of(null, null);
65
        assertTrue(p1a.equals(p1a));
66
        assertTrue(p1a.equals(p1b));
67
        assertFalse(p1a.equals(p2));
68
        assertFalse(p1a.equals(p3));
69
        assertFalse(p1a.equals(p4));
70
        assertFalse(p1a.equals(p5));
71
        assertFalse(p1a.equals(p6));
72
        assertEquals(p1a.hashCode(), p1b.hashCode());
73
        assertEquals(p4.hashCode(), p4.hashCode());
74
        assertEquals(p5.hashCode(), p5.hashCode());
75
        assertEquals(p6.hashCode(), p6.hashCode());
76
        assertFalse(p4.hashCode() == p5.hashCode());
77
    }
78
79
}
(-)a/parsing.api/nbproject/project.xml (-1 / +1 lines)
Lines 218-224 Link Here
218
                    <build-prerequisite/>
218
                    <build-prerequisite/>
219
                    <compile-dependency/>
219
                    <compile-dependency/>
220
                    <run-dependency>
220
                    <run-dependency>
221
                        <specification-version>8.25</specification-version>
221
                        <specification-version>8.32</specification-version>
222
                    </run-dependency>
222
                    </run-dependency>
223
                </dependency>
223
                </dependency>
224
                <dependency>
224
                <dependency>
(-)a/parsing.api/src/org/netbeans/modules/parsing/impl/SourceCache.java (-1 / +1 lines)
Lines 63-69 Link Here
63
import org.netbeans.modules.parsing.api.Snapshot;
63
import org.netbeans.modules.parsing.api.Snapshot;
64
import org.netbeans.modules.parsing.api.Source;
64
import org.netbeans.modules.parsing.api.Source;
65
import org.netbeans.modules.parsing.api.Task;
65
import org.netbeans.modules.parsing.api.Task;
66
import org.netbeans.modules.parsing.impl.indexing.Pair;
67
import org.netbeans.modules.parsing.spi.EmbeddingProvider;
66
import org.netbeans.modules.parsing.spi.EmbeddingProvider;
68
import org.netbeans.modules.parsing.spi.ParseException;
67
import org.netbeans.modules.parsing.spi.ParseException;
69
import org.netbeans.modules.parsing.spi.Parser;
68
import org.netbeans.modules.parsing.spi.Parser;
Lines 76-81 Link Here
76
import org.netbeans.modules.parsing.spi.Scheduler;
75
import org.netbeans.modules.parsing.spi.Scheduler;
77
import org.openide.filesystems.FileObject;
76
import org.openide.filesystems.FileObject;
78
import org.openide.util.Lookup;
77
import org.openide.util.Lookup;
78
import org.openide.util.Pair;
79
79
80
80
81
/**
81
/**
(-)a/parsing.api/src/org/netbeans/modules/parsing/impl/TaskProcessor.java (-3 / +3 lines)
Lines 79-91 Link Here
79
import org.netbeans.modules.parsing.api.Task;
79
import org.netbeans.modules.parsing.api.Task;
80
import org.netbeans.modules.parsing.api.UserTask;
80
import org.netbeans.modules.parsing.api.UserTask;
81
import org.netbeans.modules.parsing.api.indexing.IndexingManager;
81
import org.netbeans.modules.parsing.api.indexing.IndexingManager;
82
import org.netbeans.modules.parsing.impl.indexing.Pair;
83
import org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater;
82
import org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater;
84
import org.netbeans.modules.parsing.impl.indexing.Util;
83
import org.netbeans.modules.parsing.impl.indexing.Util;
85
import org.netbeans.modules.parsing.spi.*;
84
import org.netbeans.modules.parsing.spi.*;
86
import org.netbeans.modules.parsing.spi.Parser.Result;
85
import org.netbeans.modules.parsing.spi.Parser.Result;
87
import org.openide.util.Exceptions;
86
import org.openide.util.Exceptions;
88
import org.openide.util.Mutex;
87
import org.openide.util.Mutex;
88
import org.openide.util.Pair;
89
import org.openide.util.Parameters;
89
import org.openide.util.Parameters;
90
import org.openide.util.RequestProcessor;
90
import org.openide.util.RequestProcessor;
91
91
Lines 476-487 Link Here
476
        Parameters.notNull("cache", cache);   //NOI18N
476
        Parameters.notNull("cache", cache);   //NOI18N
477
        List<Request> _requests = new ArrayList<Request> ();
477
        List<Request> _requests = new ArrayList<Request> ();
478
        for (Pair<SchedulerTask,Class<? extends Scheduler>> task : tasks) {
478
        for (Pair<SchedulerTask,Class<? extends Scheduler>> task : tasks) {
479
            final String taskClassName = task.first.getClass().getName();
479
            final String taskClassName = task.first().getClass().getName();
480
            if (excludedTasks != null && excludedTasks.matcher(taskClassName).matches()) {
480
            if (excludedTasks != null && excludedTasks.matcher(taskClassName).matches()) {
481
                if (includedTasks == null || !includedTasks.matcher(taskClassName).matches())
481
                if (includedTasks == null || !includedTasks.matcher(taskClassName).matches())
482
                    continue;
482
                    continue;
483
            }
483
            }
484
            _requests.add (new Request (task.first, cache, bridge ? ReschedulePolicy.ON_CHANGE : ReschedulePolicy.CANCELED, task.second));
484
            _requests.add (new Request (task.first(), cache, bridge ? ReschedulePolicy.ON_CHANGE : ReschedulePolicy.CANCELED, task.second()));
485
        }
485
        }
486
        return _requests;
486
        return _requests;
487
    }
487
    }
(-)a/parsing.api/src/org/netbeans/modules/parsing/impl/Utilities.java (-1 / +1 lines)
Lines 50-61 Link Here
50
import org.netbeans.modules.masterfs.providers.ProvidedExtensions;
50
import org.netbeans.modules.masterfs.providers.ProvidedExtensions;
51
import org.netbeans.modules.parsing.api.Source;
51
import org.netbeans.modules.parsing.api.Source;
52
import org.netbeans.modules.parsing.impl.event.EventSupport;
52
import org.netbeans.modules.parsing.impl.event.EventSupport;
53
import org.netbeans.modules.parsing.impl.indexing.Pair;
54
import org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater;
53
import org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater;
55
import org.netbeans.modules.parsing.spi.Parser;
54
import org.netbeans.modules.parsing.spi.Parser;
56
import org.netbeans.modules.parsing.spi.ParserResultTask;
55
import org.netbeans.modules.parsing.spi.ParserResultTask;
57
import org.netbeans.modules.parsing.spi.Scheduler;
56
import org.netbeans.modules.parsing.spi.Scheduler;
58
import org.netbeans.modules.parsing.spi.SchedulerTask;
57
import org.netbeans.modules.parsing.spi.SchedulerTask;
58
import org.openide.util.Pair;
59
import org.openide.util.Parameters;
59
import org.openide.util.Parameters;
60
60
61
/**
61
/**
(-)a/parsing.api/src/org/netbeans/modules/parsing/impl/indexing/ArchiveTimeStamps.java (-5 / +6 lines)
Lines 56-61 Link Here
56
import org.openide.filesystems.FileUtil;
56
import org.openide.filesystems.FileUtil;
57
import org.openide.util.EditableProperties;
57
import org.openide.util.EditableProperties;
58
import org.openide.util.Exceptions;
58
import org.openide.util.Exceptions;
59
import org.openide.util.Pair;
59
import org.openide.util.Parameters;
60
import org.openide.util.Parameters;
60
import org.openide.util.RequestProcessor;
61
import org.openide.util.RequestProcessor;
61
62
Lines 158-174 Link Here
158
    @NonNull
159
    @NonNull
159
    private static String generate(Pair<Long,Map<Pair<String,Integer>,Integer>> data) {
160
    private static String generate(Pair<Long,Map<Pair<String,Integer>,Integer>> data) {
160
        final StringBuilder sb = new StringBuilder();
161
        final StringBuilder sb = new StringBuilder();
161
        for (Map.Entry<Pair<String,Integer>,Integer> r : data.second.entrySet()) {
162
        for (Map.Entry<Pair<String,Integer>,Integer> r : data.second().entrySet()) {
162
            final Pair<String,Integer> key = r.getKey();
163
            final Pair<String,Integer> key = r.getKey();
163
            assert key.first.indexOf(SEPARATOR) < 0;
164
            assert key.first().indexOf(SEPARATOR) < 0;
164
            sb.append(key.first);
165
            sb.append(key.first());
165
            sb.append(SEPARATOR);
166
            sb.append(SEPARATOR);
166
            sb.append(key.second);
167
            sb.append(key.second());
167
            sb.append(SEPARATOR);
168
            sb.append(SEPARATOR);
168
            sb.append(r.getValue());
169
            sb.append(r.getValue());
169
            sb.append(SEPARATOR);
170
            sb.append(SEPARATOR);
170
        }
171
        }
171
        sb.append(data.first);
172
        sb.append(data.first());
172
        return sb.toString();
173
        return sb.toString();
173
    }
174
    }
174
175
(-)a/parsing.api/src/org/netbeans/modules/parsing/impl/indexing/ClusteredIndexables.java (-4 / +5 lines)
Lines 72-77 Link Here
72
import org.netbeans.modules.parsing.lucene.support.DocumentIndexCache;
72
import org.netbeans.modules.parsing.lucene.support.DocumentIndexCache;
73
import org.netbeans.modules.parsing.lucene.support.IndexDocument;
73
import org.netbeans.modules.parsing.lucene.support.IndexDocument;
74
import org.netbeans.modules.parsing.spi.indexing.Indexable;
74
import org.netbeans.modules.parsing.spi.indexing.Indexable;
75
import org.openide.util.Pair;
75
import org.openide.util.Parameters;
76
import org.openide.util.Parameters;
76
import org.openide.util.Utilities;
77
import org.openide.util.Utilities;
77
78
Lines 725-734 Link Here
725
                    MessageFormat.format(
726
                    MessageFormat.format(
726
                        "{0} : Attached at: {1} by: {2}, Detached at: {3} by: {4}",   //NOI18N
727
                        "{0} : Attached at: {1} by: {2}, Detached at: {3} by: {4}",   //NOI18N
727
                        reason,
728
                        reason,
728
                        attach == null ? null : attach.first,
729
                        attach == null ? null : attach.first(),
729
                        attach == null ? null : Arrays.asList(attach.second),
730
                        attach == null ? null : Arrays.asList(attach.second()),
730
                        detach == null ? null : detach.first,
731
                        detach == null ? null : detach.first(),
731
                        detach == null ? null : Arrays.asList(detach.second)));
732
                        detach == null ? null : Arrays.asList(detach.second())));
732
            }
733
            }
733
            
734
            
734
        }
735
        }
(-)a/parsing.api/src/org/netbeans/modules/parsing/impl/indexing/FileEventLog.java (-5 / +6 lines)
Lines 52-57 Link Here
52
import java.util.logging.Logger;
52
import java.util.logging.Logger;
53
import org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater.Work;
53
import org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater.Work;
54
import org.openide.filesystems.FileEvent;
54
import org.openide.filesystems.FileEvent;
55
import org.openide.util.Pair;
55
56
56
/**
57
/**
57
 *
58
 *
Lines 123-136 Link Here
123
        if (myChanges != null) {
124
        if (myChanges != null) {
124
            for (Map<String,Pair<FileOp,Work>> changesInRoot : myChanges.values()) {
125
            for (Map<String,Pair<FileOp,Work>> changesInRoot : myChanges.values()) {
125
                for (Pair<FileOp,Work> desc : changesInRoot.values()) {
126
                for (Pair<FileOp,Work> desc : changesInRoot.values()) {
126
                    if (desc.first == FileOp.DELETE) {
127
                    if (desc.first() == FileOp.DELETE) {
127
                        if (!seenDelete.containsKey(desc.second)) {
128
                        if (!seenDelete.containsKey(desc.second())) {
128
                            first.add(desc.second);
129
                            first.add(desc.second());
129
                            seenDelete.put(desc.second, desc.second);
130
                            seenDelete.put(desc.second(), desc.second());
130
                        }
131
                        }
131
                    }
132
                    }
132
                    else {
133
                    else {
133
                        rest.add(desc.second);
134
                        rest.add(desc.second());
134
                    }
135
                    }
135
                }
136
                }
136
            }
137
            }
(-)a/parsing.api/src/org/netbeans/modules/parsing/impl/indexing/FileObjectCrawler.java (+1 lines)
Lines 65-70 Link Here
65
import org.netbeans.modules.parsing.spi.indexing.Indexable;
65
import org.netbeans.modules.parsing.spi.indexing.Indexable;
66
import org.openide.filesystems.FileObject;
66
import org.openide.filesystems.FileObject;
67
import org.openide.filesystems.FileUtil;
67
import org.openide.filesystems.FileUtil;
68
import org.openide.util.Pair;
68
69
69
/**
70
/**
70
 *
71
 *
(-)a/parsing.api/src/org/netbeans/modules/parsing/impl/indexing/IndexBinaryWorkPool.java (+1 lines)
Lines 52-57 Link Here
52
import java.util.logging.Logger;
52
import java.util.logging.Logger;
53
import org.netbeans.api.annotations.common.NonNull;
53
import org.netbeans.api.annotations.common.NonNull;
54
import org.openide.util.Exceptions;
54
import org.openide.util.Exceptions;
55
import org.openide.util.Pair;
55
import org.openide.util.RequestProcessor;
56
import org.openide.util.RequestProcessor;
56
57
57
/**
58
/**
(-)a/parsing.api/src/org/netbeans/modules/parsing/impl/indexing/LogContext.java (-2 / +3 lines)
Lines 49-54 Link Here
49
import org.netbeans.api.java.classpath.ClassPath;
49
import org.netbeans.api.java.classpath.ClassPath;
50
import org.openide.filesystems.FileObject;
50
import org.openide.filesystems.FileObject;
51
import org.openide.util.NbBundle;
51
import org.openide.util.NbBundle;
52
import org.openide.util.Pair;
52
import org.openide.util.Parameters;
53
import org.openide.util.Parameters;
53
import org.openide.util.RequestProcessor;
54
import org.openide.util.RequestProcessor;
54
import org.openide.util.Utilities;
55
import org.openide.util.Utilities;
Lines 1038-1048 Link Here
1038
                return;
1039
                return;
1039
            }
1040
            }
1040
            
1041
            
1041
            LOG.log(Level.WARNING, "Excessive indexing rate detected: " + dataSize(found.first, found.second) + " in " + minutes + "mins, treshold is " + treshold + 
1042
            LOG.log(Level.WARNING, "Excessive indexing rate detected: " + dataSize(found.first(), found.second()) + " in " + minutes + "mins, treshold is " + treshold +
1042
                    ". Dumping suspicious contexts");
1043
                    ". Dumping suspicious contexts");
1043
            int index;
1044
            int index;
1044
            
1045
            
1045
             for (index = found.first; index != found.second; index = (index + 1) % times.length) {
1046
             for (index = found.first(); index != found.second(); index = (index + 1) % times.length) {
1046
                contexts[index].log(false, false);
1047
                contexts[index].log(false, false);
1047
            }
1048
            }
1048
            LOG.log(Level.WARNING, "=== End excessive indexing");
1049
            LOG.log(Level.WARNING, "=== End excessive indexing");
(-)a/parsing.api/src/org/netbeans/modules/parsing/impl/indexing/Pair.java (-87 lines)
Lines 1-87 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2010 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 2009 Sun Microsystems, Inc.
41
 */
42
43
package org.netbeans.modules.parsing.impl.indexing;
44
45
/**
46
 *
47
 * @author Tomas Zezula
48
 */
49
public final class Pair<P,K> {
50
51
    public final P first;
52
    public final K second;
53
54
    private Pair (P first, K second) {
55
        this.first = first;
56
        this.second = second;
57
    }
58
59
60
    public static <P,K> Pair<P,K> of (P first, K second) {
61
        return new Pair<P,K> (first,second);
62
    }
63
64
65
    @Override
66
    public int hashCode () {
67
        int hashCode  = 0;
68
        hashCode ^= first == null ? 0 : first.hashCode();
69
        hashCode ^= second == null ? 0: second.hashCode();
70
        return hashCode;
71
    }
72
73
    @Override
74
    public boolean equals (final Object other) {
75
        if (other instanceof Pair) {
76
            Pair otherPair = (Pair) other;
77
            return (this.first == null ? otherPair.first == null : this.first.equals(otherPair.first)) &&
78
                   (this.second == null ? otherPair.second == null : this.second.equals(otherPair.second));
79
        }
80
        return false;
81
    }
82
83
    @Override
84
    public String toString () {
85
        return String.format("Pair[%s,%s]", first,second);
86
    }
87
}
(-)a/parsing.api/src/org/netbeans/modules/parsing/impl/indexing/RepositoryUpdater.java (-127 / +128 lines)
Lines 126-131 Link Here
126
import org.openide.util.Lookup;
126
import org.openide.util.Lookup;
127
import org.openide.util.Mutex.ExceptionAction;
127
import org.openide.util.Mutex.ExceptionAction;
128
import org.openide.util.NbBundle;
128
import org.openide.util.NbBundle;
129
import org.openide.util.Pair;
129
import org.openide.util.Parameters;
130
import org.openide.util.Parameters;
130
import org.openide.util.RequestProcessor;
131
import org.openide.util.RequestProcessor;
131
import org.openide.util.TopologicalSortException;
132
import org.openide.util.TopologicalSortException;
Lines 626-645 Link Here
626
        if (fo != null && fo.isValid()) {
627
        if (fo != null && fo.isValid()) {
627
            if (source == null || source.booleanValue()) {
628
            if (source == null || source.booleanValue()) {
628
                root = getOwningSourceRoot(fo);
629
                root = getOwningSourceRoot(fo);
629
                if (root != null && visibilitySupport.isVisible(fo, root.second)) {
630
                if (root != null && visibilitySupport.isVisible(fo, root.second())) {
630
                    if (root.second == null) {
631
                    if (root.second() == null) {
631
                        LOGGER.log(
632
                        LOGGER.log(
632
                            Level.INFO,
633
                            Level.INFO,
633
                            "Ignoring event from non existing FileObject {0}",  //NOI18N
634
                            "Ignoring event from non existing FileObject {0}",  //NOI18N
634
                            root.first);
635
                            root.first());
635
                        return;
636
                        return;
636
                    }
637
                    }
637
                    boolean sourcForBinaryRoot = sourcesForBinaryRoots.contains(root.first);
638
                    boolean sourcForBinaryRoot = sourcesForBinaryRoots.contains(root.first());
638
                    ClassPath.Entry entry = sourcForBinaryRoot ? null : getClassPathEntry(root.second);
639
                    ClassPath.Entry entry = sourcForBinaryRoot ? null : getClassPathEntry(root.second());
639
                    if (entry == null || entry.includes(fo)) {
640
                    if (entry == null || entry.includes(fo)) {
640
                        Work wrk;
641
                        Work wrk;
641
                        if (fo.equals(root.second)) {
642
                        if (fo.equals(root.second())) {
642
                            if (scannedRoots2Dependencies.get(root.first) == EMPTY_DEPS) {
643
                            if (scannedRoots2Dependencies.get(root.first()) == EMPTY_DEPS) {
643
                                //For first time seeing valid root do roots work to recalculate dependencies
644
                                //For first time seeing valid root do roots work to recalculate dependencies
644
                                wrk = new RootsWork(
645
                                wrk = new RootsWork(
645
                                    scannedRoots2Dependencies,
646
                                    scannedRoots2Dependencies,
Lines 649-655 Link Here
649
                                    false,
650
                                    false,
650
                                    scannedRoots2DependenciesLamport,
651
                                    scannedRoots2DependenciesLamport,
651
                                    suspendSupport.getSuspendStatus(),
652
                                    suspendSupport.getSuspendStatus(),
652
                                    LogContext.create(LogContext.EventType.FILE, null).addRoots(Collections.singleton(root.first)));
653
                                    LogContext.create(LogContext.EventType.FILE, null).addRoots(Collections.singleton(root.first())));
653
                            } else {
654
                            } else {
654
                                //Already seen files work is enough
655
                                //Already seen files work is enough
655
                                final FileObject[] children = fo.getChildren();
656
                                final FileObject[] children = fo.getChildren();
Lines 657-663 Link Here
657
                                if (children.length > 0) {
658
                                if (children.length > 0) {
658
                                    wrk = new FileListWork(
659
                                    wrk = new FileListWork(
659
                                        scannedRoots2Dependencies,
660
                                        scannedRoots2Dependencies,
660
                                        root.first,
661
                                        root.first(),
661
                                        c,
662
                                        c,
662
                                        false,
663
                                        false,
663
                                        false,
664
                                        false,
Lines 666-672 Link Here
666
                                        true,
667
                                        true,
667
                                        suspendSupport.getSuspendStatus(),
668
                                        suspendSupport.getSuspendStatus(),
668
                                        LogContext.create(LogContext.EventType.FILE, null).
669
                                        LogContext.create(LogContext.EventType.FILE, null).
669
                                            withRoot(root.first).
670
                                            withRoot(root.first()).
670
                                            addFileObjects(c));
671
                                            addFileObjects(c));
671
                                } else {
672
                                } else {
672
                                    //If no children nothing needs to be done - save some CPU time
673
                                    //If no children nothing needs to be done - save some CPU time
Lines 677-683 Link Here
677
                            Collection<FileObject> c = Collections.singleton(fo);
678
                            Collection<FileObject> c = Collections.singleton(fo);
678
                            wrk = new FileListWork(
679
                            wrk = new FileListWork(
679
                                scannedRoots2Dependencies,
680
                                scannedRoots2Dependencies,
680
                                root.first,
681
                                root.first(),
681
                                c,
682
                                c,
682
                                false,
683
                                false,
683
                                false,
684
                                false,
Lines 686-696 Link Here
686
                                true,
687
                                true,
687
                                suspendSupport.getSuspendStatus(),
688
                                suspendSupport.getSuspendStatus(),
688
                                LogContext.create(LogContext.EventType.FILE, null).
689
                                LogContext.create(LogContext.EventType.FILE, null).
689
                                    withRoot(root.first).
690
                                    withRoot(root.first()).
690
                                    addFileObjects(c));
691
                                    addFileObjects(c));
691
                        }
692
                        }
692
                        if (wrk != null) {
693
                        if (wrk != null) {
693
                            eventQueue.record(FileEventLog.FileOp.CREATE, root.first, FileUtil.getRelativePath(root.second, fo), fe, wrk);
694
                            eventQueue.record(FileEventLog.FileOp.CREATE, root.first(), FileUtil.getRelativePath(root.second(), fo), fe, wrk);
694
                        }
695
                        }
695
                        processed = true;
696
                        processed = true;
696
                    }
697
                    }
Lines 699-712 Link Here
699
700
700
            if (!processed && (source == null || !source.booleanValue())) {
701
            if (!processed && (source == null || !source.booleanValue())) {
701
                root = getOwningBinaryRoot(fo);
702
                root = getOwningBinaryRoot(fo);
702
                if (root != null && visibilitySupport.isVisible(fo, root.second)) {
703
                if (root != null && visibilitySupport.isVisible(fo, root.second())) {
703
                    final Work wrk = new BinaryWork(
704
                    final Work wrk = new BinaryWork(
704
                        root.first,
705
                        root.first(),
705
                        suspendSupport.getSuspendStatus(),
706
                        suspendSupport.getSuspendStatus(),
706
                        LogContext.create(LogContext.EventType.FILE, null).
707
                        LogContext.create(LogContext.EventType.FILE, null).
707
                            withRoot(root.first).
708
                            withRoot(root.first()).
708
                            addFileObjects(Collections.singleton(fo)));
709
                            addFileObjects(Collections.singleton(fo)));
709
                    eventQueue.record(FileEventLog.FileOp.CREATE, root.first, null, fe, wrk);
710
                    eventQueue.record(FileEventLog.FileOp.CREATE, root.first(), null, fe, wrk);
710
                    processed = true;
711
                    processed = true;
711
                }
712
                }
712
            }
713
            }
Lines 734-753 Link Here
734
        if (fo != null && fo.isValid()) {
735
        if (fo != null && fo.isValid()) {
735
            if (source == null || source.booleanValue()) {
736
            if (source == null || source.booleanValue()) {
736
                root = getOwningSourceRoot (fo);
737
                root = getOwningSourceRoot (fo);
737
                if (root != null && visibilitySupport.isVisible(fo,root.second)) {
738
                if (root != null && visibilitySupport.isVisible(fo,root.second())) {
738
                    if (root.second == null) {
739
                    if (root.second() == null) {
739
                        LOGGER.log(
740
                        LOGGER.log(
740
                            Level.INFO,
741
                            Level.INFO,
741
                            "Ignoring event from non existing FileObject {0}",  //NOI18N
742
                            "Ignoring event from non existing FileObject {0}",  //NOI18N
742
                            root.first);
743
                            root.first());
743
                        return;
744
                        return;
744
                    }
745
                    }
745
                    boolean sourceForBinaryRoot = sourcesForBinaryRoots.contains(root.first);
746
                    boolean sourceForBinaryRoot = sourcesForBinaryRoots.contains(root.first());
746
                    ClassPath.Entry entry = sourceForBinaryRoot ? null : getClassPathEntry(root.second);
747
                    ClassPath.Entry entry = sourceForBinaryRoot ? null : getClassPathEntry(root.second());
747
                    if (entry == null || entry.includes(fo)) {
748
                    if (entry == null || entry.includes(fo)) {
748
                        final Work wrk = new FileListWork(
749
                        final Work wrk = new FileListWork(
749
                            scannedRoots2Dependencies,
750
                            scannedRoots2Dependencies,
750
                            root.first,
751
                            root.first(),
751
                            Collections.singleton(fo),
752
                            Collections.singleton(fo),
752
                            false,
753
                            false,
753
                            false,
754
                            false,
Lines 756-764 Link Here
756
                            true,
757
                            true,
757
                            suspendSupport.getSuspendStatus(),
758
                            suspendSupport.getSuspendStatus(),
758
                            LogContext.create(LogContext.EventType.FILE, null).
759
                            LogContext.create(LogContext.EventType.FILE, null).
759
                                withRoot(root.first).
760
                                withRoot(root.first()).
760
                                addFiles(Collections.singleton(fo.toURL())));
761
                                addFiles(Collections.singleton(fo.toURL())));
761
                        eventQueue.record(FileEventLog.FileOp.CREATE, root.first, FileUtil.getRelativePath(root.second, fo), fe, wrk);
762
                        eventQueue.record(FileEventLog.FileOp.CREATE, root.first(), FileUtil.getRelativePath(root.second(), fo), fe, wrk);
762
                        processed = true;
763
                        processed = true;
763
                    }
764
                    }
764
                }
765
                }
Lines 766-779 Link Here
766
767
767
            if (!processed && (source == null || !source.booleanValue())) {
768
            if (!processed && (source == null || !source.booleanValue())) {
768
                root = getOwningBinaryRoot(fo);
769
                root = getOwningBinaryRoot(fo);
769
                if (root != null && visibilitySupport.isVisible(fo,root.second)) {
770
                if (root != null && visibilitySupport.isVisible(fo,root.second())) {
770
                    final Work wrk = new BinaryWork(
771
                    final Work wrk = new BinaryWork(
771
                        root.first,
772
                        root.first(),
772
                        suspendSupport.getSuspendStatus(),
773
                        suspendSupport.getSuspendStatus(),
773
                        LogContext.create(LogContext.EventType.FILE, null).
774
                        LogContext.create(LogContext.EventType.FILE, null).
774
                            withRoot(root.first).
775
                            withRoot(root.first()).
775
                            addFiles(Collections.singleton(fo.toURL())));
776
                            addFiles(Collections.singleton(fo.toURL())));
776
                    eventQueue.record(FileEventLog.FileOp.CREATE, root.first, null, fe, wrk);
777
                    eventQueue.record(FileEventLog.FileOp.CREATE, root.first(), null, fe, wrk);
777
                    processed = true;
778
                    processed = true;
778
                }
779
                }
779
            }
780
            }
Lines 807-830 Link Here
807
        if (fo != null) {
808
        if (fo != null) {
808
            if (source == null || source.booleanValue()) {
809
            if (source == null || source.booleanValue()) {
809
                root = getOwningSourceRoot (fo);
810
                root = getOwningSourceRoot (fo);
810
                if (root != null && fo.isData() && visibilitySupport.isVisible(fo, root.second)) {
811
                if (root != null && fo.isData() && visibilitySupport.isVisible(fo, root.second())) {
811
                    String relativePath = null;
812
                    String relativePath = null;
812
                    try {
813
                    try {
813
                    //Root may be deleted -> no root.second available
814
                    //Root may be deleted -> no root.second available
814
                        if (root.second != null) {
815
                        if (root.second() != null) {
815
                            relativePath = FileUtil.getRelativePath(root.second, fo);
816
                            relativePath = FileUtil.getRelativePath(root.second(), fo);
816
                        } else {
817
                        } else {
817
                            relativePath = root.first.toURI().relativize(fo.getURL().toURI()).getPath();
818
                            relativePath = root.first().toURI().relativize(fo.getURL().toURI()).getPath();
818
                        }
819
                        }
819
                        assert relativePath != null : "FileObject not under root: f=" + fo + ", root=" + root; //NOI18N
820
                        assert relativePath != null : "FileObject not under root: f=" + fo + ", root=" + root; //NOI18N
820
                        final Work wrk = new DeleteWork(
821
                        final Work wrk = new DeleteWork(
821
                            root.first,
822
                            root.first(),
822
                            Collections.singleton(relativePath),
823
                            Collections.singleton(relativePath),
823
                            suspendSupport.getSuspendStatus(),
824
                            suspendSupport.getSuspendStatus(),
824
                            LogContext.create(LogContext.EventType.FILE, null).
825
                            LogContext.create(LogContext.EventType.FILE, null).
825
                                withRoot(root.first).
826
                                withRoot(root.first()).
826
                                addFiles(Collections.singleton(fo.toURL())));
827
                                addFiles(Collections.singleton(fo.toURL())));
827
                        eventQueue.record(FileEventLog.FileOp.DELETE, root.first, relativePath, fe, wrk);
828
                        eventQueue.record(FileEventLog.FileOp.DELETE, root.first(), relativePath, fe, wrk);
828
                        processed = true;
829
                        processed = true;
829
                    } catch (FileStateInvalidException fse) {
830
                    } catch (FileStateInvalidException fse) {
830
                        Exceptions.printStackTrace(fse);
831
                        Exceptions.printStackTrace(fse);
Lines 836-849 Link Here
836
837
837
            if (!processed && (source == null || !source.booleanValue())) {
838
            if (!processed && (source == null || !source.booleanValue())) {
838
                root = getOwningBinaryRoot(fo);
839
                root = getOwningBinaryRoot(fo);
839
                if (root != null && visibilitySupport.isVisible(fo, root.second)) {
840
                if (root != null && visibilitySupport.isVisible(fo, root.second())) {
840
                    final Work wrk = new BinaryWork(
841
                    final Work wrk = new BinaryWork(
841
                        root.first,
842
                        root.first(),
842
                        suspendSupport.getSuspendStatus(),
843
                        suspendSupport.getSuspendStatus(),
843
                        LogContext.create(LogContext.EventType.FILE, null).
844
                        LogContext.create(LogContext.EventType.FILE, null).
844
                            withRoot(root.first).
845
                            withRoot(root.first()).
845
                            addFiles(Collections.singleton(fo.toURL())));
846
                            addFiles(Collections.singleton(fo.toURL())));
846
                    eventQueue.record(FileEventLog.FileOp.DELETE, root.first, null, fe, wrk);
847
                    eventQueue.record(FileEventLog.FileOp.DELETE, root.first(), null, fe, wrk);
847
                    processed = true;
848
                    processed = true;
848
                }
849
                }
849
            }
850
            }
Lines 879-892 Link Here
879
            if (source == null || source.booleanValue()) {
880
            if (source == null || source.booleanValue()) {
880
                root = getOwningSourceRoot(newFile);
881
                root = getOwningSourceRoot(newFile);
881
                if (root != null) {
882
                if (root != null) {
882
                    if (root.second == null) {
883
                    if (root.second() == null) {
883
                        LOGGER.log(
884
                        LOGGER.log(
884
                            Level.INFO,
885
                            Level.INFO,
885
                            "Ignoring event from non existing FileObject {0}",  //NOI18N
886
                            "Ignoring event from non existing FileObject {0}",  //NOI18N
886
                            root.first);
887
                            root.first());
887
                        return;
888
                        return;
888
                    }
889
                    }
889
                    FileObject rootFo = root.second;
890
                    FileObject rootFo = root.second();
890
                    if (rootFo.equals(newFile)) {
891
                    if (rootFo.equals(newFile)) {
891
                        //Root renamed do nothing, will be fired as ClassPath change.
892
                        //Root renamed do nothing, will be fired as ClassPath change.
892
                        return;
893
                        return;
Lines 895-929 Link Here
895
                    String oldFilePath =  ownerPath.length() == 0 ? oldNameExt : ownerPath + "/" + oldNameExt; //NOI18N
896
                    String oldFilePath =  ownerPath.length() == 0 ? oldNameExt : ownerPath + "/" + oldNameExt; //NOI18N
896
                    if (newFile.isData()) {
897
                    if (newFile.isData()) {
897
                        final Work work = new DeleteWork(
898
                        final Work work = new DeleteWork(
898
                            root.first,
899
                            root.first(),
899
                            Collections.singleton(oldFilePath),
900
                            Collections.singleton(oldFilePath),
900
                            suspendSupport.getSuspendStatus(),
901
                            suspendSupport.getSuspendStatus(),
901
                            LogContext.create(LogContext.EventType.FILE, null).
902
                            LogContext.create(LogContext.EventType.FILE, null).
902
                                withRoot(root.first).
903
                                withRoot(root.first()).
903
                                addFilePaths(Collections.singleton(oldFilePath)));
904
                                addFilePaths(Collections.singleton(oldFilePath)));
904
                        eventQueue.record(FileEventLog.FileOp.DELETE, root.first, oldFilePath, fe, work);
905
                        eventQueue.record(FileEventLog.FileOp.DELETE, root.first(), oldFilePath, fe, work);
905
                    } else {
906
                    } else {
906
                        Set<String> oldFilePaths = new HashSet<String>();
907
                        Set<String> oldFilePaths = new HashSet<String>();
907
                        collectFilePaths(newFile, oldFilePath, oldFilePaths);
908
                        collectFilePaths(newFile, oldFilePath, oldFilePaths);
908
                        for (String path : oldFilePaths) {
909
                        for (String path : oldFilePaths) {
909
                            final Work work = new DeleteWork(
910
                            final Work work = new DeleteWork(
910
                                root.first,
911
                                root.first(),
911
                                oldFilePaths,
912
                                oldFilePaths,
912
                                suspendSupport.getSuspendStatus(),
913
                                suspendSupport.getSuspendStatus(),
913
                                LogContext.create(LogContext.EventType.FILE, null).
914
                                LogContext.create(LogContext.EventType.FILE, null).
914
                                    withRoot(root.first).
915
                                    withRoot(root.first()).
915
                                    addFilePaths(oldFilePaths));
916
                                    addFilePaths(oldFilePaths));
916
                            eventQueue.record(FileEventLog.FileOp.DELETE, root.first, path, fe, work);
917
                            eventQueue.record(FileEventLog.FileOp.DELETE, root.first(), path, fe, work);
917
                        }
918
                        }
918
                    }
919
                    }
919
920
920
                    if (visibilitySupport.isVisible(newFile,root.second)) {
921
                    if (visibilitySupport.isVisible(newFile,root.second())) {
921
                        final boolean sourceForBinaryRoot = sourcesForBinaryRoots.contains(root.first);
922
                        final boolean sourceForBinaryRoot = sourcesForBinaryRoots.contains(root.first());
922
                        ClassPath.Entry entry = sourceForBinaryRoot ? null : getClassPathEntry(rootFo);
923
                        ClassPath.Entry entry = sourceForBinaryRoot ? null : getClassPathEntry(rootFo);
923
                        if (entry == null || entry.includes(newFile)) {
924
                        if (entry == null || entry.includes(newFile)) {
924
                            final FileListWork flw = new FileListWork(
925
                            final FileListWork flw = new FileListWork(
925
                                scannedRoots2Dependencies,
926
                                scannedRoots2Dependencies,
926
                                root.first,
927
                                root.first(),
927
                                Collections.singleton(newFile),
928
                                Collections.singleton(newFile),
928
                                false,
929
                                false,
929
                                false,
930
                                false,
Lines 932-940 Link Here
932
                                true,
933
                                true,
933
                                suspendSupport.getSuspendStatus(),
934
                                suspendSupport.getSuspendStatus(),
934
                                LogContext.create(LogContext.EventType.FILE, null).
935
                                LogContext.create(LogContext.EventType.FILE, null).
935
                                    withRoot(root.first).
936
                                    withRoot(root.first()).
936
                                    addFileObjects(Collections.singleton(newFile)));
937
                                    addFileObjects(Collections.singleton(newFile)));
937
                            eventQueue.record(FileEventLog.FileOp.CREATE, root.first, FileUtil.getRelativePath(rootFo, newFile), fe,flw);
938
                            eventQueue.record(FileEventLog.FileOp.CREATE, root.first(), FileUtil.getRelativePath(rootFo, newFile), fe,flw);
938
                        }
939
                        }
939
                    }
940
                    }
940
                    processed = true;
941
                    processed = true;
Lines 964-977 Link Here
964
965
965
                    eventQueue.record(
966
                    eventQueue.record(
966
                            FileEventLog.FileOp.CREATE,
967
                            FileEventLog.FileOp.CREATE,
967
                            root.first,
968
                            root.first(),
968
                            null,
969
                            null,
969
                            fe,
970
                            fe,
970
                            new BinaryWork(root.first,
971
                            new BinaryWork(root.first(),
971
                                suspendSupport.getSuspendStatus(),
972
                                suspendSupport.getSuspendStatus(),
972
                                LogContext.create(LogContext.EventType.FILE, null).
973
                                LogContext.create(LogContext.EventType.FILE, null).
973
                                    withRoot(root.first).
974
                                    withRoot(root.first()).
974
                                    addRoots(Collections.singleton(root.first))));
975
                                    addRoots(Collections.singleton(root.first()))));
975
                    processed = true;
976
                    processed = true;
976
                }
977
                }
977
            }
978
            }
Lines 1076-1084 Link Here
1076
                Document doc = jtc.getDocument();
1077
                Document doc = jtc.getDocument();
1077
                Pair<URL, FileObject> root = getOwningSourceRoot(doc);
1078
                Pair<URL, FileObject> root = getOwningSourceRoot(doc);
1078
                if (root != null) {
1079
                if (root != null) {
1079
                    if (root.second == null) {
1080
                    if (root.second() == null) {
1080
                        final FileObject file = Util.getFileObject(doc);
1081
                        final FileObject file = Util.getFileObject(doc);
1081
                        assert file == null || !file.isValid() : "Expecting both owningSourceRootUrl=" + root.first + " and owningSourceRoot=" + root.second; //NOI18N
1082
                        assert file == null || !file.isValid() : "Expecting both owningSourceRootUrl=" + root.first() + " and owningSourceRoot=" + root.second(); //NOI18N
1082
                        return;
1083
                        return;
1083
                    }                    
1084
                    }                    
1084
                    long version = DocumentUtilities.getDocumentVersion(doc);
1085
                    long version = DocumentUtilities.getDocumentVersion(doc);
Lines 1109-1134 Link Here
1109
                    if (reindex) {
1110
                    if (reindex) {
1110
                        // we have already seen the document and it's been modified since the last time
1111
                        // we have already seen the document and it's been modified since the last time
1111
                        if (LOGGER.isLoggable(Level.FINE)) {
1112
                        if (LOGGER.isLoggable(Level.FINE)) {
1112
                            LOGGER.fine("Document modified (reindexing): " + FileUtil.getFileDisplayName(docFile) + " Owner: " + root.first); //NOI18N
1113
                            LOGGER.fine("Document modified (reindexing): " + FileUtil.getFileDisplayName(docFile) + " Owner: " + root.first()); //NOI18N
1113
                        }
1114
                        }
1114
1115
1115
                        FileListWork job = jobs.get(root.first);
1116
                        FileListWork job = jobs.get(root.first());
1116
                        if (job == null) {
1117
                        if (job == null) {
1117
                            Collection<FileObject> c = Collections.singleton(docFile);
1118
                            Collection<FileObject> c = Collections.singleton(docFile);
1118
                            job = new FileListWork(
1119
                            job = new FileListWork(
1119
                                    scannedRoots2Dependencies,
1120
                                    scannedRoots2Dependencies,
1120
                                    root.first,
1121
                                    root.first(),
1121
                                    c,
1122
                                    c,
1122
                                    false,
1123
                                    false,
1123
                                    openedInEditor,
1124
                                    openedInEditor,
1124
                                    true,
1125
                                    true,
1125
                                    sourcesForBinaryRoots.contains(root.first),
1126
                                    sourcesForBinaryRoots.contains(root.first()),
1126
                                    true,
1127
                                    true,
1127
                                    suspendSupport.getSuspendStatus(),
1128
                                    suspendSupport.getSuspendStatus(),
1128
                                    LogContext.create(LogContext.EventType.FILE, null).
1129
                                    LogContext.create(LogContext.EventType.FILE, null).
1129
                                        withRoot(root.first).
1130
                                        withRoot(root.first()).
1130
                                        addFileObjects(c));
1131
                                        addFileObjects(c));
1131
                            jobs.put(root.first, job);
1132
                            jobs.put(root.first(), job);
1132
                        } else {
1133
                        } else {
1133
                            // XXX: strictly speaking we should set 'checkEditor' for each file separately
1134
                            // XXX: strictly speaking we should set 'checkEditor' for each file separately
1134
                            // and not for each job; in reality we normally do not end up here
1135
                            // and not for each job; in reality we normally do not end up here
Lines 1301-1311 Link Here
1301
1302
1302
        final Pair<URL, FileObject> root = getOwningSourceRoot(document);
1303
        final Pair<URL, FileObject> root = getOwningSourceRoot(document);
1303
        if (root != null) {
1304
        if (root != null) {
1304
            if (root.second == null) {
1305
            if (root.second() == null) {
1305
                LOGGER.log(
1306
                LOGGER.log(
1306
                    Level.INFO,
1307
                    Level.INFO,
1307
                    "Ignoring event from non existing FileObject {0}",  //NOI18N
1308
                    "Ignoring event from non existing FileObject {0}",  //NOI18N
1308
                    root.first);
1309
                    root.first());
1309
                return;
1310
                return;
1310
            }
1311
            }
1311
            if (activeDocument == document) {
1312
            if (activeDocument == document) {
Lines 1326-1335 Link Here
1326
                    // An active document was modified, we've indexed that document berfore,
1327
                    // An active document was modified, we've indexed that document berfore,
1327
                    // so mark it dirty
1328
                    // so mark it dirty
1328
                    if (LOGGER.isLoggable(Level.FINE)) {
1329
                    if (LOGGER.isLoggable(Level.FINE)) {
1329
                        LOGGER.fine("Active document modified (marking dirty): " + FileUtil.getFileDisplayName(docFile) + " Owner: " + root.first); //NOI18N
1330
                        LOGGER.fine("Active document modified (marking dirty): " + FileUtil.getFileDisplayName(docFile) + " Owner: " + root.first()); //NOI18N
1330
                    }
1331
                    }
1331
1332
1332
                    Collection<? extends Indexable> dirty = Collections.singleton(SPIAccessor.getInstance().create(new FileObjectIndexable(root.second, docFile)));
1333
                    Collection<? extends Indexable> dirty = Collections.singleton(SPIAccessor.getInstance().create(new FileObjectIndexable(root.second(), docFile)));
1333
                    String mimeType = DocumentUtilities.getMimeType(document);
1334
                    String mimeType = DocumentUtilities.getMimeType(document);
1334
1335
1335
                    TransientUpdateSupport.setTransientUpdate(true);
1336
                    TransientUpdateSupport.setTransientUpdate(true);
Lines 1340-1346 Link Here
1340
                                @Override
1341
                                @Override
1341
                                public FileObject call() throws Exception {
1342
                                public FileObject call() throws Exception {
1342
                                    if (cache == null) {
1343
                                    if (cache == null) {
1343
                                        cache = CacheFolder.getDataFolder(root.first);
1344
                                        cache = CacheFolder.getDataFolder(root.first());
1344
                                    }
1345
                                    }
1345
                                    return cache;
1346
                                    return cache;
1346
                                }
1347
                                }
Lines 1351-1357 Link Here
1351
                                final CustomIndexerFactory factory = info.getIndexerFactory();
1352
                                final CustomIndexerFactory factory = info.getIndexerFactory();
1352
                                final Context ctx = SPIAccessor.getInstance().createContext(
1353
                                final Context ctx = SPIAccessor.getInstance().createContext(
1353
                                        indexFolderFactory,
1354
                                        indexFolderFactory,
1354
                                        root.first,
1355
                                        root.first(),
1355
                                        factory.getIndexerName(),
1356
                                        factory.getIndexerName(),
1356
                                        factory.getIndexVersion(),
1357
                                        factory.getIndexVersion(),
1357
                                        null,
1358
                                        null,
Lines 1373-1379 Link Here
1373
                                final EmbeddingIndexerFactory factory = info.getIndexerFactory();
1374
                                final EmbeddingIndexerFactory factory = info.getIndexerFactory();
1374
                                final Context ctx = SPIAccessor.getInstance().createContext(
1375
                                final Context ctx = SPIAccessor.getInstance().createContext(
1375
                                        indexFolderFactory,
1376
                                        indexFolderFactory,
1376
                                        root.first,
1377
                                        root.first(),
1377
                                        factory.getIndexerName(),
1378
                                        factory.getIndexerName(),
1378
                                        factory.getIndexVersion(),
1379
                                        factory.getIndexVersion(),
1379
                                        null,
1380
                                        null,
Lines 1398-1404 Link Here
1398
                    FileObject f = Util.getFileObject(document);
1399
                    FileObject f = Util.getFileObject(document);
1399
                    Collection<URL> c = Collections.singleton(f.getURL());
1400
                    Collection<URL> c = Collections.singleton(f.getURL());
1400
                    addIndexingJob(
1401
                    addIndexingJob(
1401
                        root.first,
1402
                        root.first(),
1402
                        c,
1403
                        c,
1403
                        false,
1404
                        false,
1404
                        true,
1405
                        true,
Lines 1406-1412 Link Here
1406
                        true,
1407
                        true,
1407
                        true,
1408
                        true,
1408
                        LogContext.create(LogContext.EventType.FILE, null).
1409
                        LogContext.create(LogContext.EventType.FILE, null).
1409
                            withRoot(root.first).
1410
                            withRoot(root.first()).
1410
                            addFiles(c));
1411
                            addFiles(c));
1411
                } catch (FileStateInvalidException ex) {
1412
                } catch (FileStateInvalidException ex) {
1412
                    LOGGER.log(Level.WARNING, null, ex);
1413
                    LOGGER.log(Level.WARNING, null, ex);
Lines 2200-2206 Link Here
2200
                }
2201
                }
2201
                logStartIndexer(factory.getIndexerName());
2202
                logStartIndexer(factory.getIndexerName());
2202
                try {
2203
                try {
2203
                    boolean vote = factory.scanStarted(value.second);
2204
                    boolean vote = factory.scanStarted(value.second());
2204
                    votes.put(factory,vote);
2205
                    votes.put(factory,vote);
2205
                } catch (Throwable t) {
2206
                } catch (Throwable t) {
2206
                    if (t instanceof ThreadDeath) {
2207
                    if (t instanceof ThreadDeath) {
Lines 2246-2252 Link Here
2246
                    }
2247
                    }
2247
                    logStartIndexer(eif.getIndexerName());
2248
                    logStartIndexer(eif.getIndexerName());
2248
                    try {
2249
                    try {
2249
                        boolean vote = eif.scanStarted(value.second);
2250
                        boolean vote = eif.scanStarted(value.second());
2250
                        votes.put(eif, vote);
2251
                        votes.put(eif, vote);
2251
                    } catch (Throwable t) {
2252
                    } catch (Throwable t) {
2252
                        if (t instanceof ThreadDeath) {
2253
                        if (t instanceof ThreadDeath) {
Lines 2270-2283 Link Here
2270
                    parkWhileSuspended();
2271
                    parkWhileSuspended();
2271
                    if (TEST_LOGGER.isLoggable(Level.FINEST)) {
2272
                    if (TEST_LOGGER.isLoggable(Level.FINEST)) {
2272
                        TEST_LOGGER.log(Level.FINEST, "scanFinishing:{0}:{1}", 
2273
                        TEST_LOGGER.log(Level.FINEST, "scanFinishing:{0}:{1}", 
2273
                                new Object[] { entry.first.getIndexerName(), entry.second.getRootURI().toExternalForm() });
2274
                                new Object[] { entry.first().getIndexerName(), entry.second().getRootURI().toExternalForm() });
2274
                    }
2275
                    }
2275
                    logStartIndexer(entry.first.getIndexerName());
2276
                    logStartIndexer(entry.first().getIndexerName());
2276
                    SPIAccessor.getInstance().putProperty(entry.second, ClusteredIndexables.DELETE, null);
2277
                    SPIAccessor.getInstance().putProperty(entry.second(), ClusteredIndexables.DELETE, null);
2277
                    SPIAccessor.getInstance().putProperty(entry.second, ClusteredIndexables.INDEX, null);
2278
                    SPIAccessor.getInstance().putProperty(entry.second(), ClusteredIndexables.INDEX, null);
2278
                    cancelRequest.setResult(finished);
2279
                    cancelRequest.setResult(finished);
2279
                    try {
2280
                    try {
2280
                        entry.first.scanFinished(entry.second);
2281
                        entry.first().scanFinished(entry.second());
2281
                    }  catch (Throwable t) {
2282
                    }  catch (Throwable t) {
2282
                        if (t instanceof ThreadDeath) {
2283
                        if (t instanceof ThreadDeath) {
2283
                            throw (ThreadDeath) t;
2284
                            throw (ThreadDeath) t;
Lines 2287-2296 Link Here
2287
                    } finally {
2288
                    } finally {
2288
                        cancelRequest.setResult(null);
2289
                        cancelRequest.setResult(null);
2289
                    }
2290
                    }
2290
                    logFinishIndexer(entry.first.getIndexerName());
2291
                    logFinishIndexer(entry.first().getIndexerName());
2291
                    if (TEST_LOGGER.isLoggable(Level.FINEST)) {
2292
                    if (TEST_LOGGER.isLoggable(Level.FINEST)) {
2292
                        TEST_LOGGER.log(Level.FINEST, "scanFinished:{0}:{1}", 
2293
                        TEST_LOGGER.log(Level.FINEST, "scanFinished:{0}:{1}", 
2293
                                new Object[] { entry.first.getIndexerName(), entry.second.getRootURI().toExternalForm() });
2294
                                new Object[] { entry.first().getIndexerName(), entry.second().getRootURI().toExternalForm() });
2294
                    }
2295
                    }
2295
                }
2296
                }
2296
            } finally {
2297
            } finally {
Lines 2298-2311 Link Here
2298
                    boolean indexOk = true;
2299
                    boolean indexOk = true;
2299
                    for(Pair<SourceIndexerFactory,Context> entry : ctxToFinish) {
2300
                    for(Pair<SourceIndexerFactory,Context> entry : ctxToFinish) {
2300
                        indexOk &= storeChanges(
2301
                        indexOk &= storeChanges(
2301
                                entry.first.getIndexerName(),
2302
                                entry.first().getIndexerName(),
2302
                                entry.second,
2303
                                entry.second(),
2303
                                isSteady(),
2304
                                isSteady(),
2304
                                usedIterables.get(),
2305
                                usedIterables.get(),
2305
                                finished);
2306
                                finished);
2306
                    }
2307
                    }
2307
                    if (!indexOk) {
2308
                    if (!indexOk) {
2308
                        final Context ctx = ctxToFinish.iterator().next().second;
2309
                        final Context ctx = ctxToFinish.iterator().next().second();
2309
                        RepositoryUpdater.getDefault().addIndexingJob(
2310
                        RepositoryUpdater.getDefault().addIndexingJob(
2310
                            ctx.getRootURI(),
2311
                            ctx.getRootURI(),
2311
                            null,
2312
                            null,
Lines 2336-2347 Link Here
2336
            try {
2337
            try {
2337
                for (Pair<SourceIndexerFactory,Context> pair : contexts.values()) {
2338
                for (Pair<SourceIndexerFactory,Context> pair : contexts.values()) {
2338
                    parkWhileSuspended();
2339
                    parkWhileSuspended();
2339
                    SPIAccessor.getInstance().putProperty(pair.second, ClusteredIndexables.DELETE, ci);
2340
                    SPIAccessor.getInstance().putProperty(pair.second(), ClusteredIndexables.DELETE, ci);
2340
                    pair.first.filesDeleted(ci.getIndexablesFor(null), pair.second);
2341
                    pair.first().filesDeleted(ci.getIndexablesFor(null), pair.second());
2341
                }
2342
                }
2342
            } finally {
2343
            } finally {
2343
                for(Pair<SourceIndexerFactory,Context> pair : contexts.values()) {
2344
                for(Pair<SourceIndexerFactory,Context> pair : contexts.values()) {
2344
                    DocumentIndex index = SPIAccessor.getInstance().getIndexFactory(pair.second).getIndex(pair.second.getIndexFolder());
2345
                    DocumentIndex index = SPIAccessor.getInstance().getIndexFactory(pair.second()).getIndex(pair.second().getIndexFolder());
2345
                    if (index != null) {
2346
                    if (index != null) {
2346
                        usedIterables.offer(ci.getIndexablesFor(null));
2347
                        usedIterables.offer(ci.getIndexablesFor(null));
2347
                    }
2348
                    }
Lines 2435-2441 Link Here
2435
                                        factory
2436
                                        factory
2436
                                    });
2437
                                    });
2437
                        }
2438
                        }
2438
                        SPIAccessor.getInstance().setAllFilesJob(value.second, allFiles);
2439
                        SPIAccessor.getInstance().setAllFilesJob(value.second(), allFiles);
2439
                        List<Iterable<Indexable>> indexerIndexablesList = new LinkedList<Iterable<Indexable>>();
2440
                        List<Iterable<Indexable>> indexerIndexablesList = new LinkedList<Iterable<Indexable>>();
2440
                        ClusteredIndexables usedCi = null;
2441
                        ClusteredIndexables usedCi = null;
2441
                        for(String mimeType : cifInfo.getMimeTypes()) {
2442
                        for(String mimeType : cifInfo.getMimeTypes()) {
Lines 2466-2475 Link Here
2466
                        final CustomIndexer indexer = factory.createIndexer();
2467
                        final CustomIndexer indexer = factory.createIndexer();
2467
                        long tm1 = -1, tm2 = -1;
2468
                        long tm1 = -1, tm2 = -1;
2468
                        logStartIndexer(factory.getIndexerName());
2469
                        logStartIndexer(factory.getIndexerName());
2469
                        SPIAccessor.getInstance().putProperty(value.second, ClusteredIndexables.INDEX, usedCi);
2470
                        SPIAccessor.getInstance().putProperty(value.second(), ClusteredIndexables.INDEX, usedCi);
2470
                        try {
2471
                        try {
2471
                            tm1 = System.currentTimeMillis();
2472
                            tm1 = System.currentTimeMillis();
2472
                            SPIAccessor.getInstance().index(indexer, indexables, value.second);
2473
                            SPIAccessor.getInstance().index(indexer, indexables, value.second());
2473
                        } catch (ThreadDeath td) {
2474
                        } catch (ThreadDeath td) {
2474
                            throw td;
2475
                            throw td;
2475
                        } catch (Throwable t) {
2476
                        } catch (Throwable t) {
Lines 2551-2557 Link Here
2551
                                        value = Pair.<SourceIndexerFactory,Context>of(factory,ctx);
2552
                                        value = Pair.<SourceIndexerFactory,Context>of(factory,ctx);
2552
                                        contexts.put(key,value);
2553
                                        contexts.put(key,value);
2553
                                    }
2554
                                    }
2554
                                    SPIAccessor.getInstance().setAllFilesJob(value.second, allFiles);
2555
                                    SPIAccessor.getInstance().setAllFilesJob(value.second(), allFiles);
2555
                                }
2556
                                }
2556
                            }
2557
                            }
2557
                        }
2558
                        }
Lines 2705-2719 Link Here
2705
        protected final  boolean checkBinaryIndexers(
2706
        protected final  boolean checkBinaryIndexers(
2706
                @NullAllowed Pair<Long,Map<Pair<String,Integer>,Integer>> lastState,
2707
                @NullAllowed Pair<Long,Map<Pair<String,Integer>,Integer>> lastState,
2707
                @NonNull Map<BinaryIndexerFactory, Context> contexts) throws IOException {
2708
                @NonNull Map<BinaryIndexerFactory, Context> contexts) throws IOException {
2708
            if (lastState == null || lastState.first == 0L) {
2709
            if (lastState == null || lastState.first() == 0L) {
2709
                //Nothing known about the last state
2710
                //Nothing known about the last state
2710
                return false;
2711
                return false;
2711
            }
2712
            }
2712
            if (contexts.size() != lastState.second.size()) {
2713
            if (contexts.size() != lastState.second().size()) {
2713
                //Factories changed
2714
                //Factories changed
2714
                return false;
2715
                return false;
2715
            }
2716
            }
2716
            final Map<Pair<String,Integer>,Integer> copy = new HashMap<Pair<String,Integer>,Integer>(lastState.second);
2717
            final Map<Pair<String,Integer>,Integer> copy = new HashMap<Pair<String,Integer>,Integer>(lastState.second());
2717
            for (Map.Entry<BinaryIndexerFactory,Context> e : contexts.entrySet()) {
2718
            for (Map.Entry<BinaryIndexerFactory,Context> e : contexts.entrySet()) {
2718
                final BinaryIndexerFactory bif = e.getKey();
2719
                final BinaryIndexerFactory bif = e.getKey();
2719
                final Integer state = copy.remove(Pair.<String,Integer>of(bif.getIndexerName(),bif.getIndexVersion()));
2720
                final Integer state = copy.remove(Pair.<String,Integer>of(bif.getIndexerName(),bif.getIndexVersion()));
Lines 2866-2876 Link Here
2866
2867
2867
                                            final EmbeddingIndexer indexer = indexerFactory.createIndexer(dirty, pr.getSnapshot());
2868
                                            final EmbeddingIndexer indexer = indexerFactory.createIndexer(dirty, pr.getSnapshot());
2868
                                            if (indexer != null) {
2869
                                            if (indexer != null) {
2869
                                                SPIAccessor.getInstance().putProperty(value.second, ClusteredIndexables.INDEX, usedCi);
2870
                                                SPIAccessor.getInstance().putProperty(value.second(), ClusteredIndexables.INDEX, usedCi);
2870
                                                long st = System.currentTimeMillis();
2871
                                                long st = System.currentTimeMillis();
2871
                                                logStartIndexer(indexerName);
2872
                                                logStartIndexer(indexerName);
2872
                                                try {
2873
                                                try {
2873
                                                    SPIAccessor.getInstance().index(indexer, dirty, pr, value.second);
2874
                                                    SPIAccessor.getInstance().index(indexer, dirty, pr, value.second());
2874
                                                } catch (ThreadDeath td) {
2875
                                                } catch (ThreadDeath td) {
2875
                                                    throw td;
2876
                                                    throw td;
2876
                                                } catch (Throwable t) {
2877
                                                } catch (Throwable t) {
Lines 3672-3678 Link Here
3672
                                        final Pair<String,Integer> indexerKey = Pair.<String,Integer>of(factory.getIndexerName(),factory.getIndexVersion());
3673
                                        final Pair<String,Integer> indexerKey = Pair.<String,Integer>of(factory.getIndexerName(),factory.getIndexVersion());
3673
                                        final Pair<SourceIndexerFactory, Context> ctx = transactionContexts.get(indexerKey);
3674
                                        final Pair<SourceIndexerFactory, Context> ctx = transactionContexts.get(indexerKey);
3674
                                        if (ctx != null) {
3675
                                        if (ctx != null) {
3675
                                            SPIAccessor.getInstance().setAllFilesJob(ctx.second, true);
3676
                                            SPIAccessor.getInstance().setAllFilesJob(ctx.second(), true);
3676
                                            final CustomIndexer indexer = factory.createIndexer();
3677
                                            final CustomIndexer indexer = factory.createIndexer();
3677
                                            if (LOGGER.isLoggable(Level.FINE)) {
3678
                                            if (LOGGER.isLoggable(Level.FINE)) {
3678
                                                StringBuilder sb = printMimeTypes(cifInfo.getMimeTypes(), new StringBuilder());
3679
                                                StringBuilder sb = printMimeTypes(cifInfo.getMimeTypes(), new StringBuilder());
Lines 3685-3695 Link Here
3685
                                                        sb
3686
                                                        sb
3686
                                                    });
3687
                                                    });
3687
                                            }
3688
                                            }
3688
                                            SPIAccessor.getInstance().putProperty(ctx.second, ClusteredIndexables.INDEX, ci);
3689
                                            SPIAccessor.getInstance().putProperty(ctx.second(), ClusteredIndexables.INDEX, ci);
3689
                                            long st = System.currentTimeMillis();
3690
                                            long st = System.currentTimeMillis();
3690
                                            logStartIndexer(factory.getIndexerName());
3691
                                            logStartIndexer(factory.getIndexerName());
3691
                                            try {
3692
                                            try {
3692
                                                SPIAccessor.getInstance().index(indexer, indexables, ctx.second);
3693
                                                SPIAccessor.getInstance().index(indexer, indexables, ctx.second());
3693
                                            } catch (ThreadDeath td) {
3694
                                            } catch (ThreadDeath td) {
3694
                                                throw td;
3695
                                                throw td;
3695
                                            } catch (Throwable t) {
3696
                                            } catch (Throwable t) {
Lines 3969-3981 Link Here
3969
                    for(Pair<Object, Boolean> fileOrFileObject : suspectFilesOrFileObjects) {
3970
                    for(Pair<Object, Boolean> fileOrFileObject : suspectFilesOrFileObjects) {
3970
                        Pair<FileObject, Boolean> fileObject = null;
3971
                        Pair<FileObject, Boolean> fileObject = null;
3971
3972
3972
                        if (fileOrFileObject.first instanceof File) {
3973
                        if (fileOrFileObject.first() instanceof File) {
3973
                            FileObject f = FileUtil.toFileObject((File) fileOrFileObject.first);
3974
                            FileObject f = FileUtil.toFileObject((File) fileOrFileObject.first());
3974
                            if (f != null) {
3975
                            if (f != null) {
3975
                                fileObject = Pair.<FileObject, Boolean>of(f, fileOrFileObject.second);
3976
                                fileObject = Pair.<FileObject, Boolean>of(f, fileOrFileObject.second());
3976
                            }
3977
                            }
3977
                        } else if (fileOrFileObject.first instanceof FileObject) {
3978
                        } else if (fileOrFileObject.first() instanceof FileObject) {
3978
                            fileObject = Pair.<FileObject, Boolean>of((FileObject) fileOrFileObject.first, fileOrFileObject.second);
3979
                            fileObject = Pair.<FileObject, Boolean>of((FileObject) fileOrFileObject.first(), fileOrFileObject.second());
3979
                        } else {
3980
                        } else {
3980
                            LOGGER.fine("Not File or FileObject, ignoring: " + fileOrFileObject); //NOI18N
3981
                            LOGGER.fine("Not File or FileObject, ignoring: " + fileOrFileObject); //NOI18N
3981
                        }
3982
                        }
Lines 3993-3999 Link Here
3993
                                if (rootFile != null) {
3994
                                if (rootFile != null) {
3994
                                    FileObject rootFo = FileUtil.toFileObject(rootFile);
3995
                                    FileObject rootFo = FileUtil.toFileObject(rootFile);
3995
                                    if (rootFo != null) {
3996
                                    if (rootFo != null) {
3996
                                        if (f.first == rootFo || FileUtil.isParentOf(f.first, rootFo)) {
3997
                                        if (f.first() == rootFo || FileUtil.isParentOf(f.first(), rootFo)) {
3997
                                            depCtx.newBinariesToScan.add(root);
3998
                                            depCtx.newBinariesToScan.add(root);
3998
                                            break;
3999
                                            break;
3999
                                        }
4000
                                        }
Lines 4003-4009 Link Here
4003
                                // check roots that own a suspect
4004
                                // check roots that own a suspect
4004
                                FileObject rootFo = URLCache.getInstance().findFileObject(root, true);
4005
                                FileObject rootFo = URLCache.getInstance().findFileObject(root, true);
4005
                                if (rootFo != null) {
4006
                                if (rootFo != null) {
4006
                                    if (f.first == rootFo || FileUtil.isParentOf(rootFo, f.first)) {
4007
                                    if (f.first() == rootFo || FileUtil.isParentOf(rootFo, f.first())) {
4007
                                        depCtx.newBinariesToScan.add(root);
4008
                                        depCtx.newBinariesToScan.add(root);
4008
                                        break;
4009
                                        break;
4009
                                    }
4010
                                    }
Lines 4020-4031 Link Here
4020
                            FileObject rootFo = URLCache.getInstance().findFileObject(root, true);
4021
                            FileObject rootFo = URLCache.getInstance().findFileObject(root, true);
4021
                            if (rootFo != null) {
4022
                            if (rootFo != null) {
4022
                                for(Pair<FileObject, Boolean> f : suspects) {
4023
                                for(Pair<FileObject, Boolean> f : suspects) {
4023
                                    if (f.first == rootFo || FileUtil.isParentOf(f.first, rootFo)) {
4024
                                    if (f.first() == rootFo || FileUtil.isParentOf(f.first(), rootFo)) {
4024
                                        Pair<FileObject, Boolean> pair = sourceRootsToScan.get(root);
4025
                                        Pair<FileObject, Boolean> pair = sourceRootsToScan.get(root);
4025
                                        if (pair == null) {
4026
                                        if (pair == null) {
4026
                                            pair = Pair.<FileObject, Boolean>of(rootFo, f.second);
4027
                                            pair = Pair.<FileObject, Boolean>of(rootFo, f.second());
4027
                                        } else {
4028
                                        } else {
4028
                                            pair = Pair.<FileObject, Boolean>of(rootFo, pair.second || f.second);
4029
                                            pair = Pair.<FileObject, Boolean>of(rootFo, pair.second() || f.second());
4029
                                        }
4030
                                        }
4030
                                        sourceRootsToScan.put(root, pair);
4031
                                        sourceRootsToScan.put(root, pair);
4031
                                        containers.add(f);
4032
                                        containers.add(f);
Lines 4039-4045 Link Here
4039
                            for(Iterator<Pair<FileObject, Boolean>> it = suspects.iterator(); it.hasNext(); ) {
4040
                            for(Iterator<Pair<FileObject, Boolean>> it = suspects.iterator(); it.hasNext(); ) {
4040
                                Pair<FileObject, Boolean> f = it.next();
4041
                                Pair<FileObject, Boolean> f = it.next();
4041
                                Pair<FileObject, Boolean> root = entry.getValue();
4042
                                Pair<FileObject, Boolean> root = entry.getValue();
4042
                                if (FileUtil.isParentOf(root.first, f.first) && (root.second || !f.second)) { // second means fullRescan
4043
                                if (FileUtil.isParentOf(root.first(), f.first()) && (root.second() || !f.second())) { // second means fullRescan
4043
                                    it.remove();
4044
                                    it.remove();
4044
                                }
4045
                                }
4045
                            }
4046
                            }
Lines 4047-4053 Link Here
4047
4048
4048
                        for(Map.Entry<URL, Pair<FileObject, Boolean>> entry : sourceRootsToScan.entrySet()) {
4049
                        for(Map.Entry<URL, Pair<FileObject, Boolean>> entry : sourceRootsToScan.entrySet()) {
4049
                            depCtx.newRootsToScan.add(entry.getKey());
4050
                            depCtx.newRootsToScan.add(entry.getKey());
4050
                            if (entry.getValue().second) {
4051
                            if (entry.getValue().second()) {
4051
                                depCtx.fullRescanSourceRoots.add(entry.getKey());
4052
                                depCtx.fullRescanSourceRoots.add(entry.getKey());
4052
                            }
4053
                            }
4053
                        }
4054
                        }
Lines 4060-4073 Link Here
4060
                        for(Pair<FileObject, Boolean> f : suspects) {
4061
                        for(Pair<FileObject, Boolean> f : suspects) {
4061
                            for(URL root : scannedRoots2Dependencies.keySet()) {
4062
                            for(URL root : scannedRoots2Dependencies.keySet()) {
4062
                                FileObject rootFo = URLCache.getInstance().findFileObject(root, true);
4063
                                FileObject rootFo = URLCache.getInstance().findFileObject(root, true);
4063
                                if (rootFo != null && (f.first == rootFo || FileUtil.isParentOf(rootFo, f.first))) {
4064
                                if (rootFo != null && (f.first() == rootFo || FileUtil.isParentOf(rootFo, f.first()))) {
4064
                                    Map<URL, Set<FileObject>> map = f.second ? fullRescanFiles : checkTimestampFiles;
4065
                                    Map<URL, Set<FileObject>> map = f.second() ? fullRescanFiles : checkTimestampFiles;
4065
                                    Set<FileObject> files = map.get(root);
4066
                                    Set<FileObject> files = map.get(root);
4066
                                    if (files == null) {
4067
                                    if (files == null) {
4067
                                        files = new HashSet<FileObject>();
4068
                                        files = new HashSet<FileObject>();
4068
                                        map.put(root, files);
4069
                                        map.put(root, files);
4069
                                    }
4070
                                    }
4070
                                    files.add(f.first);
4071
                                    files.add(f.first());
4071
                                    break;
4072
                                    break;
4072
                                }
4073
                                }
4073
                            }
4074
                            }
Lines 4631-4637 Link Here
4631
            final long binaryScanStart = System.currentTimeMillis();
4632
            final long binaryScanStart = System.currentTimeMillis();
4632
            final Pair<Boolean,Collection<? extends URL>> res = pool.execute();
4633
            final Pair<Boolean,Collection<? extends URL>> res = pool.execute();
4633
            final long binaryScanEnd = System.currentTimeMillis();
4634
            final long binaryScanEnd = System.currentTimeMillis();
4634
            ctx.scannedBinaries.addAll(res.second);
4635
            ctx.scannedBinaries.addAll(res.second());
4635
            if (LOGGER.isLoggable(Level.INFO)) {
4636
            if (LOGGER.isLoggable(Level.INFO)) {
4636
                LOGGER.log(
4637
                LOGGER.log(
4637
                    Level.INFO,
4638
                    Level.INFO,
Lines 4642-4648 Link Here
4642
                    });
4643
                    });
4643
            }
4644
            }
4644
            TEST_LOGGER.log(Level.FINEST, "scanBinary", ctx.newBinariesToScan);       //NOI18N
4645
            TEST_LOGGER.log(Level.FINEST, "scanBinary", ctx.newBinariesToScan);       //NOI18N
4645
            return res.first;
4646
            return res.first();
4646
        }
4647
        }
4647
4648
4648
        protected final boolean scanBinary(URL root, BinaryIndexers binaryIndexers, AtomicInteger scannedRootsCnt) {
4649
        protected final boolean scanBinary(URL root, BinaryIndexers binaryIndexers, AtomicInteger scannedRootsCnt) {
Lines 4664-4670 Link Here
4664
                    final Pair<Long,Map<Pair<String,Integer>,Integer>> lastState = ArchiveTimeStamps.getLastModified(file.getURL());
4665
                    final Pair<Long,Map<Pair<String,Integer>,Integer>> lastState = ArchiveTimeStamps.getLastModified(file.getURL());
4665
                    final boolean indexersUpToDate = checkBinaryIndexers(lastState, contexts);
4666
                    final boolean indexersUpToDate = checkBinaryIndexers(lastState, contexts);
4666
                    currentLastModified = file.lastModified().getTime();
4667
                    currentLastModified = file.lastModified().getTime();
4667
                    upToDate = indexersUpToDate && lastState.first ==  currentLastModified;
4668
                    upToDate = indexersUpToDate && lastState.first() ==  currentLastModified;
4668
                } else {
4669
                } else {
4669
                    currentLastModified = -1L;
4670
                    currentLastModified = -1L;
4670
                    upToDate = false;
4671
                    upToDate = false;
Lines 4926-4932 Link Here
4926
                        final Pair<String,Integer> indexerKey = Pair.<String,Integer>of(factory.getIndexerName(),factory.getIndexVersion());
4927
                        final Pair<String,Integer> indexerKey = Pair.<String,Integer>of(factory.getIndexerName(),factory.getIndexVersion());
4927
                        final Pair<SourceIndexerFactory,Context> ctx = transactionContexts.get(indexerKey);
4928
                        final Pair<SourceIndexerFactory,Context> ctx = transactionContexts.get(indexerKey);
4928
                        if (ctx != null) {
4929
                        if (ctx != null) {
4929
                            SPIAccessor.getInstance().index(indexer, Collections.<Indexable>emptySet(), ctx.second);
4930
                            SPIAccessor.getInstance().index(indexer, Collections.<Indexable>emptySet(), ctx.second());
4930
                        } else {
4931
                        } else {
4931
                            LOGGER.log(
4932
                            LOGGER.log(
4932
                                Level.WARNING, "RefreshCifIndices ignored recently added factory: {0}", //NOI18N
4933
                                Level.WARNING, "RefreshCifIndices ignored recently added factory: {0}", //NOI18N
Lines 5870-5879 Link Here
5870
                    }
5871
                    }
5871
                    sourceRoots.clear();
5872
                    sourceRoots.clear();
5872
                    for(Map.Entry<URL, Pair<File, Boolean>> entry : binaryRoots.entrySet()) {
5873
                    for(Map.Entry<URL, Pair<File, Boolean>> entry : binaryRoots.entrySet()) {
5873
                        if (entry.getValue().second) {
5874
                        if (entry.getValue().second()) {
5874
                            safeRemoveFileChangeListener(this.binariesListener, entry.getValue().first);
5875
                            safeRemoveFileChangeListener(this.binariesListener, entry.getValue().first());
5875
                        } else {
5876
                        } else {
5876
                            safeRemoveRecursiveListener(this.binariesListener, entry.getValue().first);
5877
                            safeRemoveRecursiveListener(this.binariesListener, entry.getValue().first());
5877
                        }
5878
                        }
5878
                    }
5879
                    }
5879
                    binaryRoots.clear();
5880
                    binaryRoots.clear();
Lines 5949-5958 Link Here
5949
                    if (binariesListener != null) {
5950
                    if (binariesListener != null) {
5950
                        Pair<File, Boolean> pair = binaryRoots.remove(root);
5951
                        Pair<File, Boolean> pair = binaryRoots.remove(root);
5951
                        if (pair != null) {
5952
                        if (pair != null) {
5952
                            if (pair.second) {
5953
                            if (pair.second()) {
5953
                                safeRemoveFileChangeListener(binariesListener, pair.first);
5954
                                safeRemoveFileChangeListener(binariesListener, pair.first());
5954
                            } else {
5955
                            } else {
5955
                                safeRemoveRecursiveListener(binariesListener, pair.first);
5956
                                safeRemoveRecursiveListener(binariesListener, pair.first());
5956
                            }
5957
                            }
5957
                        }
5958
                        }
5958
                    }
5959
                    }
(-)a/parsing.api/src/org/netbeans/modules/parsing/impl/indexing/VisibilitySupport.java (-7 / +8 lines)
Lines 69-74 Link Here
69
import org.openide.filesystems.FileObject;
69
import org.openide.filesystems.FileObject;
70
import org.openide.filesystems.FileUtil;
70
import org.openide.filesystems.FileUtil;
71
import org.openide.util.Exceptions;
71
import org.openide.util.Exceptions;
72
import org.openide.util.Pair;
72
import org.openide.util.Parameters;
73
import org.openide.util.Parameters;
73
import org.openide.util.RequestProcessor;
74
import org.openide.util.RequestProcessor;
74
75
Lines 229-249 Link Here
229
                    if (owner != null) {
230
                    if (owner != null) {
230
                        final boolean visible = vq.isVisible(chf);
231
                        final boolean visible = vq.isVisible(chf);
231
                        try {
232
                        try {
232
                            final URI ownerURI = owner.first.toURI();
233
                            final URI ownerURI = owner.first().toURI();
233
                            if (visible) {
234
                            if (visible) {
234
                                Collection<URL> files = srcShownPerRoot.get(ownerURI);
235
                                Collection<URL> files = srcShownPerRoot.get(ownerURI);
235
                                if (files == null) {
236
                                if (files == null) {
236
                                    files = new ArrayList<URL>();
237
                                    files = new ArrayList<URL>();
237
                                    srcShownPerRoot.put(ownerURI, files);
238
                                    srcShownPerRoot.put(ownerURI, files);
238
                                }
239
                                }
239
                                if (chf.equals(owner.second)) {
240
                                if (chf.equals(owner.second())) {
240
                                    for (FileObject cld : chf.getChildren()) {
241
                                    for (FileObject cld : chf.getChildren()) {
241
                                        files.add(cld.toURL());
242
                                        files.add(cld.toURL());
242
                                    }
243
                                    }
243
                                } else {
244
                                } else {
244
                                    files.add(chf.toURL());
245
                                    files.add(chf.toURL());
245
                                }
246
                                }
246
                            } else if (owner.second != null) {
247
                            } else if (owner.second() != null) {
247
                                Set<String> files = srcHiddenPerRoot.get(ownerURI);
248
                                Set<String> files = srcHiddenPerRoot.get(ownerURI);
248
                                if (files == null) {
249
                                if (files == null) {
249
                                    files = new HashSet<String>();
250
                                    files = new HashSet<String>();
Lines 252-263 Link Here
252
                                if (chf.isFolder()) {
253
                                if (chf.isFolder()) {
253
                                    TimeStamps ts = tsPerRoot.get(ownerURI);
254
                                    TimeStamps ts = tsPerRoot.get(ownerURI);
254
                                    if (ts == null) {
255
                                    if (ts == null) {
255
                                        ts = TimeStamps.forRoot(owner.first, false);
256
                                        ts = TimeStamps.forRoot(owner.first(), false);
256
                                        tsPerRoot.put(ownerURI, ts);
257
                                        tsPerRoot.put(ownerURI, ts);
257
                                    }
258
                                    }
258
                                    files.addAll(ts.getEnclosedFiles(FileUtil.getRelativePath(owner.second, chf)));
259
                                    files.addAll(ts.getEnclosedFiles(FileUtil.getRelativePath(owner.second(), chf)));
259
                                } else {
260
                                } else {
260
                                    files.add(FileUtil.getRelativePath(owner.second, chf));
261
                                    files.add(FileUtil.getRelativePath(owner.second(), chf));
261
                                }
262
                                }
262
                            }
263
                            }
263
                        } catch (URISyntaxException e) {
264
                        } catch (URISyntaxException e) {
Lines 270-276 Link Here
270
                    owner = ru.getOwningBinaryRoot(chf);
271
                    owner = ru.getOwningBinaryRoot(chf);
271
                    if (owner != null) {
272
                    if (owner != null) {
272
                        try {
273
                        try {
273
                            final URI ownerURI = owner.first.toURI();
274
                            final URI ownerURI = owner.first().toURI();
274
                            binChangedRoot.add(ownerURI);
275
                            binChangedRoot.add(ownerURI);
275
                        } catch (URISyntaxException e) {
276
                        } catch (URISyntaxException e) {
276
                            Exceptions.printStackTrace(e);
277
                            Exceptions.printStackTrace(e);
(-)a/parsing.api/src/org/netbeans/modules/parsing/impl/indexing/lucene/DocumentBasedIndexManager.java (-6 / +6 lines)
Lines 51-62 Link Here
51
import org.netbeans.api.annotations.common.CheckForNull;
51
import org.netbeans.api.annotations.common.CheckForNull;
52
import org.netbeans.api.annotations.common.NonNull;
52
import org.netbeans.api.annotations.common.NonNull;
53
import org.netbeans.modules.parsing.impl.indexing.ClusteredIndexables;
53
import org.netbeans.modules.parsing.impl.indexing.ClusteredIndexables;
54
import org.netbeans.modules.parsing.impl.indexing.Pair;
55
import org.netbeans.modules.parsing.impl.indexing.PathRegistry;
54
import org.netbeans.modules.parsing.impl.indexing.PathRegistry;
56
import org.netbeans.modules.parsing.lucene.support.DocumentIndex;
55
import org.netbeans.modules.parsing.lucene.support.DocumentIndex;
57
import org.netbeans.modules.parsing.lucene.support.DocumentIndexCache;
56
import org.netbeans.modules.parsing.lucene.support.DocumentIndexCache;
58
import org.netbeans.modules.parsing.lucene.support.IndexManager;
57
import org.netbeans.modules.parsing.lucene.support.IndexManager;
59
import org.openide.util.Exceptions;
58
import org.openide.util.Exceptions;
59
import org.openide.util.Pair;
60
import org.openide.util.Parameters;
60
import org.openide.util.Parameters;
61
import org.openide.util.Utilities;
61
import org.openide.util.Utilities;
62
62
Lines 136-156 Link Here
136
                throw new IOException(e);
136
                throw new IOException(e);
137
            }
137
            }
138
        }
138
        }
139
        return li == null ? null : li.first;
139
        return li == null ? null : li.first();
140
    }
140
    }
141
141
142
   @CheckForNull
142
   @CheckForNull
143
   public synchronized DocumentIndexCache getCache(@NonNull final URL root) {
143
   public synchronized DocumentIndexCache getCache(@NonNull final URL root) {
144
       final Pair<DocumentIndex.Transactional, DocumentIndexCache> entry = indexes.get(root);
144
       final Pair<DocumentIndex.Transactional, DocumentIndexCache> entry = indexes.get(root);
145
       return entry == null ? null : entry.second;
145
       return entry == null ? null : entry.second();
146
   }
146
   }
147
147
148
   @CheckForNull
148
   @CheckForNull
149
   public synchronized DocumentIndex.Transactional getIndex(@NonNull final DocumentIndexCache cache) {
149
   public synchronized DocumentIndex.Transactional getIndex(@NonNull final DocumentIndexCache cache) {
150
       Parameters.notNull("cache", cache);  //NOI18N
150
       Parameters.notNull("cache", cache);  //NOI18N
151
       for (Pair<DocumentIndex.Transactional,DocumentIndexCache> e : indexes.values()) {
151
       for (Pair<DocumentIndex.Transactional,DocumentIndexCache> e : indexes.values()) {
152
           if (cache.equals(e.second)) {
152
           if (cache.equals(e.second())) {
153
               return e.first;
153
               return e.first();
154
           }
154
           }
155
       }
155
       }
156
       return null;
156
       return null;
Lines 163-169 Link Here
163
       closed = true;
163
       closed = true;
164
       for (Pair<DocumentIndex.Transactional, DocumentIndexCache> index : indexes.values()) {
164
       for (Pair<DocumentIndex.Transactional, DocumentIndexCache> index : indexes.values()) {
165
           try {
165
           try {
166
            index.first.close();
166
            index.first().close();
167
           } catch (IOException ioe) {
167
           } catch (IOException ioe) {
168
               Exceptions.printStackTrace(ioe);
168
               Exceptions.printStackTrace(ioe);
169
           }
169
           }
(-)a/parsing.api/src/org/netbeans/modules/parsing/impl/indexing/lucene/LayeredDocumentIndex.java (-11 / +11 lines)
Lines 50-56 Link Here
50
import java.util.Set;
50
import java.util.Set;
51
import org.apache.lucene.analysis.KeywordAnalyzer;
51
import org.apache.lucene.analysis.KeywordAnalyzer;
52
import org.netbeans.api.annotations.common.NonNull;
52
import org.netbeans.api.annotations.common.NonNull;
53
import org.netbeans.modules.parsing.impl.indexing.Pair;
54
import org.netbeans.modules.parsing.lucene.support.DocumentIndex;
53
import org.netbeans.modules.parsing.lucene.support.DocumentIndex;
55
import org.netbeans.modules.parsing.lucene.support.Index.Status;
54
import org.netbeans.modules.parsing.lucene.support.Index.Status;
56
import org.netbeans.modules.parsing.lucene.support.IndexDocument;
55
import org.netbeans.modules.parsing.lucene.support.IndexDocument;
Lines 58-63 Link Here
58
import org.netbeans.modules.parsing.lucene.support.Queries.QueryKind;
57
import org.netbeans.modules.parsing.lucene.support.Queries.QueryKind;
59
import org.openide.util.Exceptions;
58
import org.openide.util.Exceptions;
60
import static org.netbeans.modules.parsing.impl.indexing.TransientUpdateSupport.isTransientUpdate;
59
import static org.netbeans.modules.parsing.impl.indexing.TransientUpdateSupport.isTransientUpdate;
60
import org.openide.util.Pair;
61
/**
61
/**
62
 *
62
 *
63
 * @author Tomas Zezula
63
 * @author Tomas Zezula
Lines 118-125 Link Here
118
    public void store(boolean optimize) throws IOException {
118
    public void store(boolean optimize) throws IOException {
119
        if (isTransientUpdate()) {
119
        if (isTransientUpdate()) {
120
            final Pair<DocumentIndex,Set<String>> ovl = getOverlayIfExists();
120
            final Pair<DocumentIndex,Set<String>> ovl = getOverlayIfExists();
121
            if (ovl.first != null) {
121
            if (ovl.first() != null) {
122
                ovl.first.store(false);
122
                ovl.first().store(false);
123
            }
123
            }
124
        } else {
124
        } else {
125
            base.store(optimize);
125
            base.store(optimize);
Lines 167-178 Link Here
167
    public Collection<? extends IndexDocument> query(String fieldName, String value, QueryKind kind, String... fieldsToLoad) throws IOException, InterruptedException {
167
    public Collection<? extends IndexDocument> query(String fieldName, String value, QueryKind kind, String... fieldsToLoad) throws IOException, InterruptedException {
168
        final Collection<? extends IndexDocument> br = base.query(fieldName, value, kind, fieldsToLoad);
168
        final Collection<? extends IndexDocument> br = base.query(fieldName, value, kind, fieldsToLoad);
169
        final Pair<DocumentIndex,Set<String>> ovl = getOverlayIfExists();
169
        final Pair<DocumentIndex,Set<String>> ovl = getOverlayIfExists();
170
        if (ovl.first == null) {
170
        if (ovl.first() == null) {
171
            return ovl.second == null ? br : filter(br,ovl.second);
171
            return ovl.second() == null ? br : filter(br,ovl.second());
172
        } else {
172
        } else {
173
            return new ProxyCollection<IndexDocument>(
173
            return new ProxyCollection<IndexDocument>(
174
                ovl.second == null ? br : filter(br,ovl.second),
174
                ovl.second() == null ? br : filter(br,ovl.second()),
175
                ovl.first.query(fieldName, value, kind, fieldsToLoad));
175
                ovl.first().query(fieldName, value, kind, fieldsToLoad));
176
        }
176
        }
177
    }
177
    }
178
178
Lines 180-191 Link Here
180
    public Collection<? extends IndexDocument> findByPrimaryKey(String primaryKeyValue, QueryKind kind, String... fieldsToLoad) throws IOException, InterruptedException {
180
    public Collection<? extends IndexDocument> findByPrimaryKey(String primaryKeyValue, QueryKind kind, String... fieldsToLoad) throws IOException, InterruptedException {
181
        final Collection<? extends IndexDocument> br = base.findByPrimaryKey(primaryKeyValue, kind, fieldsToLoad);
181
        final Collection<? extends IndexDocument> br = base.findByPrimaryKey(primaryKeyValue, kind, fieldsToLoad);
182
        final Pair<DocumentIndex,Set<String>> ovl = getOverlayIfExists();
182
        final Pair<DocumentIndex,Set<String>> ovl = getOverlayIfExists();
183
        if (ovl.first == null) {
183
        if (ovl.first() == null) {
184
            return ovl.second == null ? br : filter(br, ovl.second);
184
            return ovl.second() == null ? br : filter(br, ovl.second());
185
        } else {
185
        } else {
186
            return new ProxyCollection<IndexDocument>(
186
            return new ProxyCollection<IndexDocument>(
187
                ovl.second == null ? br : filter(br,ovl.second),
187
                ovl.second() == null ? br : filter(br,ovl.second()),
188
                ovl.first.findByPrimaryKey(primaryKeyValue, kind, fieldsToLoad));
188
                ovl.first().findByPrimaryKey(primaryKeyValue, kind, fieldsToLoad));
189
        }
189
        }
190
    }
190
    }
191
191
(-)a/parsing.api/src/org/netbeans/modules/parsing/spi/indexing/support/QuerySupport.java (-6 / +6 lines)
Lines 72-78 Link Here
72
import org.netbeans.modules.parsing.impl.Utilities;
72
import org.netbeans.modules.parsing.impl.Utilities;
73
import org.netbeans.modules.parsing.impl.indexing.CacheFolder;
73
import org.netbeans.modules.parsing.impl.indexing.CacheFolder;
74
import org.netbeans.modules.parsing.impl.indexing.IndexFactoryImpl;
74
import org.netbeans.modules.parsing.impl.indexing.IndexFactoryImpl;
75
import org.netbeans.modules.parsing.impl.indexing.Pair;
76
import org.netbeans.modules.parsing.impl.indexing.PathRecognizerRegistry;
75
import org.netbeans.modules.parsing.impl.indexing.PathRecognizerRegistry;
77
import org.netbeans.modules.parsing.impl.indexing.PathRegistry;
76
import org.netbeans.modules.parsing.impl.indexing.PathRegistry;
78
import org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater;
77
import org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater;
Lines 89-94 Link Here
89
import org.openide.filesystems.FileObject;
88
import org.openide.filesystems.FileObject;
90
import org.openide.filesystems.FileStateInvalidException;
89
import org.openide.filesystems.FileStateInvalidException;
91
import org.openide.filesystems.URLMapper;
90
import org.openide.filesystems.URLMapper;
91
import org.openide.util.Pair;
92
import org.openide.util.Parameters;
92
import org.openide.util.Parameters;
93
93
94
/**
94
/**
Lines 327-333 Link Here
327
                    Iterable<? extends Pair<URL, LayeredDocumentIndex>> indices = indexerQuery.getIndices(roots);
327
                    Iterable<? extends Pair<URL, LayeredDocumentIndex>> indices = indexerQuery.getIndices(roots);
328
                    // check if there are stale indices
328
                    // check if there are stale indices
329
                    for (Pair<URL, LayeredDocumentIndex> pair : indices) {
329
                    for (Pair<URL, LayeredDocumentIndex> pair : indices) {
330
                        final LayeredDocumentIndex index = pair.second;
330
                        final LayeredDocumentIndex index = pair.second();
331
                        final Collection<? extends String> staleFiles = index.getDirtyKeys();
331
                        final Collection<? extends String> staleFiles = index.getDirtyKeys();
332
                        final boolean scanningThread = RunWhenScanFinishedSupport.isScanningThread();
332
                        final boolean scanningThread = RunWhenScanFinishedSupport.isScanningThread();
333
                        LOG.log(
333
                        LOG.log(
Lines 339-345 Link Here
339
                                scanningThread
339
                                scanningThread
340
                            });
340
                            });
341
                        if (!staleFiles.isEmpty() && !scanningThread) {
341
                        if (!staleFiles.isEmpty() && !scanningThread) {
342
                            final URL root = pair.first;
342
                            final URL root = pair.first();
343
                            LinkedList<URL> list = new LinkedList<URL>();
343
                            LinkedList<URL> list = new LinkedList<URL>();
344
                            for (String staleFile : staleFiles) {
344
                            for (String staleFile : staleFiles) {
345
                                try {
345
                                try {
Lines 358-365 Link Here
358
                    }
358
                    }
359
                    final List<IndexResult> result = new LinkedList<IndexResult>();
359
                    final List<IndexResult> result = new LinkedList<IndexResult>();
360
                    for (Pair<URL, LayeredDocumentIndex> pair : indices) {
360
                    for (Pair<URL, LayeredDocumentIndex> pair : indices) {
361
                        final DocumentIndex index = pair.second;
361
                        final DocumentIndex index = pair.second();
362
                        final URL root = pair.first;
362
                        final URL root = pair.first();
363
                        final Collection<? extends org.netbeans.modules.parsing.lucene.support.IndexDocument> pr = index.query(
363
                        final Collection<? extends org.netbeans.modules.parsing.lucene.support.IndexDocument> pr = index.query(
364
                                fieldName,
364
                                fieldName,
365
                                fieldValue,
365
                                fieldValue,
Lines 450-456 Link Here
450
            LOG.fine(getClass().getSimpleName() + "@" + Integer.toHexString(System.identityHashCode(this)) //NOI18N
450
            LOG.fine(getClass().getSimpleName() + "@" + Integer.toHexString(System.identityHashCode(this)) //NOI18N
451
                    + "[indexer=" + indexerQuery.getIndexerId() + "]:"); //NOI18N
451
                    + "[indexer=" + indexerQuery.getIndexerId() + "]:"); //NOI18N
452
            for(Pair<URL, LayeredDocumentIndex> pair : indexerQuery.getIndices(this.roots)) {
452
            for(Pair<URL, LayeredDocumentIndex> pair : indexerQuery.getIndices(this.roots)) {
453
                LOG.fine(" " + pair.first + " -> index: " + pair.second); //NOI18N
453
                LOG.fine(" " + pair.first() + " -> index: " + pair.second()); //NOI18N
454
            }
454
            }
455
            LOG.fine("----"); //NOI18N
455
            LOG.fine("----"); //NOI18N
456
        }
456
        }
(-)a/parsing.api/test/unit/src/org/netbeans/modules/parsing/impl/RunWhenScanFinishedSupportTest.java (-3 / +3 lines)
Lines 57-69 Link Here
57
import org.netbeans.api.annotations.common.NonNull;
57
import org.netbeans.api.annotations.common.NonNull;
58
import org.netbeans.junit.NbTestCase;
58
import org.netbeans.junit.NbTestCase;
59
import org.netbeans.modules.parsing.api.Source;
59
import org.netbeans.modules.parsing.api.Source;
60
import org.netbeans.modules.parsing.impl.indexing.Pair;
61
import org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater.IndexingState;
60
import org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater.IndexingState;
62
import org.netbeans.modules.parsing.spi.ParseException;
61
import org.netbeans.modules.parsing.spi.ParseException;
63
import org.openide.filesystems.FileObject;
62
import org.openide.filesystems.FileObject;
64
import org.openide.filesystems.FileUtil;
63
import org.openide.filesystems.FileUtil;
65
import org.openide.util.Exceptions;
64
import org.openide.util.Exceptions;
66
import org.openide.util.Mutex;
65
import org.openide.util.Mutex;
66
import org.openide.util.Pair;
67
67
68
/**
68
/**
69
 *
69
 *
Lines 281-290 Link Here
281
            final Object param = record.getParameters()[0];
281
            final Object param = record.getParameters()[0];
282
            for (Iterator<Pair<Pair<String, Object>, CountDownLatch>> it = condition.iterator(); it.hasNext();) {
282
            for (Iterator<Pair<Pair<String, Object>, CountDownLatch>> it = condition.iterator(); it.hasNext();) {
283
                final Pair<Pair<String,Object>,CountDownLatch> cnd = it.next();
283
                final Pair<Pair<String,Object>,CountDownLatch> cnd = it.next();
284
                if (cnd != null && cnd.first.first.equals(message) && cnd.first.second.equals(param)) {
284
                if (cnd != null && cnd.first().first().equals(message) && cnd.first().second().equals(param)) {
285
                    //System.out.println("GOT: " + cnd.first.first + " " + cnd.first.second);
285
                    //System.out.println("GOT: " + cnd.first.first + " " + cnd.first.second);
286
                    it.remove();
286
                    it.remove();
287
                    cnd.second.countDown();
287
                    cnd.second().countDown();
288
                    break;
288
                    break;
289
                }
289
                }
290
            }
290
            }
(-)a/parsing.api/test/unit/src/org/netbeans/modules/parsing/impl/TaskProcessorTest.java (-2 / +2 lines)
Lines 86-92 Link Here
86
import org.netbeans.modules.parsing.api.Task;
86
import org.netbeans.modules.parsing.api.Task;
87
import org.netbeans.modules.parsing.api.UserTask;
87
import org.netbeans.modules.parsing.api.UserTask;
88
import org.netbeans.modules.parsing.impl.event.EventSupport;
88
import org.netbeans.modules.parsing.impl.event.EventSupport;
89
import org.netbeans.modules.parsing.impl.indexing.Pair;
90
import org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater;
89
import org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater;
91
import org.netbeans.modules.parsing.impl.indexing.RepositoryUpdaterTestSupport;
90
import org.netbeans.modules.parsing.impl.indexing.RepositoryUpdaterTestSupport;
92
import org.netbeans.modules.parsing.impl.indexing.Util;
91
import org.netbeans.modules.parsing.impl.indexing.Util;
Lines 106-111 Link Here
106
import org.openide.loaders.DataObject;
105
import org.openide.loaders.DataObject;
107
import org.openide.text.NbDocument;
106
import org.openide.text.NbDocument;
108
import org.openide.util.Exceptions;
107
import org.openide.util.Exceptions;
108
import org.openide.util.Pair;
109
109
110
/**
110
/**
111
 *
111
 *
Lines 229-235 Link Here
229
            start_b.countDown();
229
            start_b.countDown();
230
            start_a.await();
230
            start_a.await();
231
            SourceAccessor.getINSTANCE().getCache(src).invalidate();
231
            SourceAccessor.getINSTANCE().getCache(src).invalidate();
232
            TaskProcessor.removePhaseCompletionTasks(Collections.<SchedulerTask>singleton(tasks.iterator().next().first), src);
232
            TaskProcessor.removePhaseCompletionTasks(Collections.<SchedulerTask>singleton(tasks.iterator().next().first()), src);
233
        }
233
        }
234
        end.countDown();
234
        end.countDown();
235
    }
235
    }
(-)a/parsing.api/test/unit/src/org/netbeans/modules/parsing/impl/indexing/ArchiveTimeStampsTest.java (+1 lines)
Lines 58-63 Link Here
58
import org.netbeans.junit.NbTestCase;
58
import org.netbeans.junit.NbTestCase;
59
import org.openide.filesystems.FileObject;
59
import org.openide.filesystems.FileObject;
60
import org.openide.filesystems.FileUtil;
60
import org.openide.filesystems.FileUtil;
61
import org.openide.util.Pair;
61
import org.openide.util.Utilities;
62
import org.openide.util.Utilities;
62
63
63
/**
64
/**
(-)a/parsing.api/test/unit/src/org/netbeans/modules/parsing/impl/indexing/ClusteredIndexablesCacheTest.java (-3 / +4 lines)
Lines 89-94 Link Here
89
import org.openide.filesystems.FileObject;
89
import org.openide.filesystems.FileObject;
90
import org.openide.filesystems.FileUtil;
90
import org.openide.filesystems.FileUtil;
91
import org.openide.util.Exceptions;
91
import org.openide.util.Exceptions;
92
import org.openide.util.Pair;
92
import org.openide.util.Parameters;
93
import org.openide.util.Parameters;
93
94
94
/**
95
/**
Lines 484-495 Link Here
484
485
485
        @Override
486
        @Override
486
        public Boolean convert(@NonNull final Pair<URL,String> p) {
487
        public Boolean convert(@NonNull final Pair<URL,String> p) {
487
            if (!forIndexer.equals(p.second)) {
488
            if (!forIndexer.equals(p.second())) {
488
                return null;
489
                return null;
489
            }
490
            }
490
            try {
491
            try {
491
                final FileObject cacheFolder = CacheFolder.getDataFolder(p.first);
492
                final FileObject cacheFolder = CacheFolder.getDataFolder(p.first());
492
                final FileObject indexer = cacheFolder.getFileObject(p.second);
493
                final FileObject indexer = cacheFolder.getFileObject(p.second());
493
                final FileObject indexFolder = indexer.getFileObject("1/1");
494
                final FileObject indexFolder = indexer.getFileObject("1/1");
494
                final DocumentIndexCache cache = DocumentBasedIndexManager.getDefault().getCache(indexFolder.toURL());
495
                final DocumentIndexCache cache = DocumentBasedIndexManager.getDefault().getCache(indexFolder.toURL());
495
                final Class<?> c = Class.forName("org.netbeans.modules.parsing.impl.indexing.ClusteredIndexables$DocumentIndexCacheImpl");  //NOI18N
496
                final Class<?> c = Class.forName("org.netbeans.modules.parsing.impl.indexing.ClusteredIndexables$DocumentIndexCacheImpl");  //NOI18N
(-)a/parsing.api/test/unit/src/org/netbeans/modules/parsing/impl/indexing/DocumentStoreTest.java (-3 / +4 lines)
Lines 60-65 Link Here
60
import org.netbeans.modules.parsing.lucene.support.Index;
60
import org.netbeans.modules.parsing.lucene.support.Index;
61
import org.netbeans.modules.parsing.lucene.support.IndexDocument;
61
import org.netbeans.modules.parsing.lucene.support.IndexDocument;
62
import org.netbeans.modules.parsing.lucene.support.IndexManager;
62
import org.netbeans.modules.parsing.lucene.support.IndexManager;
63
import org.openide.util.Pair;
63
64
64
/**
65
/**
65
 *
66
 *
Lines 204-212 Link Here
204
                createDefaultData(size);
205
                createDefaultData(size);
205
        final long st = System.currentTimeMillis();
206
        final long st = System.currentTimeMillis();
206
        index.store(
207
        index.store(
207
            p.first,
208
            p.first(),
208
            Collections.<String>emptySet(),
209
            Collections.<String>emptySet(),
209
            p.second,
210
            p.second(),
210
            new Convertor<String, Query>() {
211
            new Convertor<String, Query>() {
211
                @Override
212
                @Override
212
                public Query convert(String p) {
213
                public Query convert(String p) {
Lines 215-221 Link Here
215
            },
216
            },
216
            true);
217
            true);
217
        final long et = System.currentTimeMillis();
218
        final long et = System.currentTimeMillis();
218
        System.out.println(p.first.getClass().getSimpleName() + " : " + (et-st));
219
        System.out.println(p.first().getClass().getSimpleName() + " : " + (et-st));
219
        index.close();
220
        index.close();
220
    }
221
    }
221
222
(-)a/parsing.api/test/unit/src/org/netbeans/modules/parsing/impl/indexing/FileObjectCrawlerTest.java (+1 lines)
Lines 68-73 Link Here
68
import org.openide.filesystems.FileStateInvalidException;
68
import org.openide.filesystems.FileStateInvalidException;
69
import org.openide.filesystems.FileSystem;
69
import org.openide.filesystems.FileSystem;
70
import org.openide.filesystems.FileUtil;
70
import org.openide.filesystems.FileUtil;
71
import org.openide.util.Pair;
71
72
72
/**
73
/**
73
 *
74
 *
(-)a/parsing.api/test/unit/src/org/netbeans/modules/parsing/impl/indexing/RefreshWorkTest.java (+1 lines)
Lines 63-68 Link Here
63
import org.openide.filesystems.FileChangeAdapter;
63
import org.openide.filesystems.FileChangeAdapter;
64
import org.openide.filesystems.FileObject;
64
import org.openide.filesystems.FileObject;
65
import org.openide.filesystems.FileUtil;
65
import org.openide.filesystems.FileUtil;
66
import org.openide.util.Pair;
66
import org.openide.util.Utilities;
67
import org.openide.util.Utilities;
67
68
68
/**
69
/**
(-)a/parsing.api/test/unit/src/org/netbeans/modules/parsing/impl/indexing/RepositoryUpdater2Test.java (-7 / +8 lines)
Lines 95-100 Link Here
95
import org.openide.filesystems.URLMapper;
95
import org.openide.filesystems.URLMapper;
96
import org.openide.util.Exceptions;
96
import org.openide.util.Exceptions;
97
import org.openide.util.Lookup;
97
import org.openide.util.Lookup;
98
import org.openide.util.Pair;
98
import org.openide.util.Parameters;
99
import org.openide.util.Parameters;
99
import org.openide.util.RequestProcessor;
100
import org.openide.util.RequestProcessor;
100
import org.openide.util.test.MockLookup;
101
import org.openide.util.test.MockLookup;
Lines 882-890 Link Here
882
        ruSync.await();
883
        ruSync.await();
883
884
884
        assertEquals("Wrong number of roots", 1, indexer.indexed.size());
885
        assertEquals("Wrong number of roots", 1, indexer.indexed.size());
885
        assertEquals("Expecting nested root", nestedRoot.getURL(), indexer.indexed.get(0).first.getRootURI());
886
        assertEquals("Expecting nested root", nestedRoot.getURL(), indexer.indexed.get(0).first().getRootURI());
886
        assertEquals("Wrong number of files under nestedRoot", 1, indexer.indexed.get(0).second.size());
887
        assertEquals("Wrong number of files under nestedRoot", 1, indexer.indexed.get(0).second().size());
887
        assertEquals("Wring file indexed", file2.getURL(), indexer.indexed.get(0).second.get(0).getURL());
888
        assertEquals("Wring file indexed", file2.getURL(), indexer.indexed.get(0).second().get(0).getURL());
888
    }
889
    }
889
890
890
    public void testMarkingIndexesDirty() throws Exception {
891
    public void testMarkingIndexesDirty() throws Exception {
Lines 916-922 Link Here
916
917
917
        // the indexer does not store any data and so physically there is no lucene index on the disk
918
        // the indexer does not store any data and so physically there is no lucene index on the disk
918
        // therefore we have to forcibly create one
919
        // therefore we have to forcibly create one
919
        Context ctx = indexer.indexed.get(0).first;
920
        Context ctx = indexer.indexed.get(0).first();
920
        DocumentIndex ii = SPIAccessor.getInstance().getIndexFactory(ctx).createIndex(ctx);
921
        DocumentIndex ii = SPIAccessor.getInstance().getIndexFactory(ctx).createIndex(ctx);
921
        ii.markKeyDirty("file1.txt"); // marks index as dirty and adds file1.txt among stale files
922
        ii.markKeyDirty("file1.txt"); // marks index as dirty and adds file1.txt among stale files
922
        assertEquals("Wrong number of stale files", 1, ii.getDirtyKeys().size());
923
        assertEquals("Wrong number of stale files", 1, ii.getDirtyKeys().size());
Lines 928-936 Link Here
928
        ruSync.await();
929
        ruSync.await();
929
930
930
        assertEquals("Wrong number of roots", 1, indexer.indexed.size());
931
        assertEquals("Wrong number of roots", 1, indexer.indexed.size());
931
        assertEquals("Expecting root", root.getURL(), indexer.indexed.get(0).first.getRootURI());
932
        assertEquals("Expecting root", root.getURL(), indexer.indexed.get(0).first().getRootURI());
932
        assertEquals("Wrong number of files under root", 1, indexer.indexed.get(0).second.size());
933
        assertEquals("Wrong number of files under root", 1, indexer.indexed.get(0).second().size());
933
        assertEquals("Wrong file indexed", file1.getURL(), indexer.indexed.get(0).second.get(0).getURL());
934
        assertEquals("Wrong file indexed", file1.getURL(), indexer.indexed.get(0).second().get(0).getURL());
934
        assertEquals("Expecting no stale files", 0, ii.getDirtyKeys().size());
935
        assertEquals("Expecting no stale files", 0, ii.getDirtyKeys().size());
935
    }
936
    }
936
937
(-)a/parsing.api/test/unit/src/org/netbeans/modules/parsing/impl/indexing/RepositoryUpdaterTest.java (-22 / +23 lines)
Lines 150-155 Link Here
150
import org.openide.util.ChangeSupport;
150
import org.openide.util.ChangeSupport;
151
import org.openide.util.Exceptions;
151
import org.openide.util.Exceptions;
152
import org.openide.util.Lookup;
152
import org.openide.util.Lookup;
153
import org.openide.util.Pair;
153
import org.openide.util.RequestProcessor;
154
import org.openide.util.RequestProcessor;
154
155
155
/**
156
/**
Lines 1509-1523 Link Here
1509
        assertEquals(1, contextState.size());
1510
        assertEquals(1, contextState.size());
1510
        Pair<Boolean,Boolean> state = contextState.get(this.srcRootWithFiles1.getURL());
1511
        Pair<Boolean,Boolean> state = contextState.get(this.srcRootWithFiles1.getURL());
1511
        assertNotNull(state);
1512
        assertNotNull(state);
1512
        assertTrue(state.first);
1513
        assertTrue(state.first());
1513
        assertFalse(state.second);
1514
        assertFalse(state.second());
1514
        contextState = eindexerFactory.indexer.getContextState();
1515
        contextState = eindexerFactory.indexer.getContextState();
1515
        assertEquals(embeddedFiles.length, contextState.size());
1516
        assertEquals(embeddedFiles.length, contextState.size());
1516
        for (URL url : embeddedFiles) {
1517
        for (URL url : embeddedFiles) {
1517
            state = contextState.get(url);
1518
            state = contextState.get(url);
1518
            assertNotNull(state);
1519
            assertNotNull(state);
1519
            assertTrue(state.first);
1520
            assertTrue(state.first());
1520
            assertFalse(state.second);
1521
            assertFalse(state.second());
1521
        }
1522
        }
1522
1523
1523
        //2nd) Clean up - unregister
1524
        //2nd) Clean up - unregister
Lines 1544-1551 Link Here
1544
        assertEquals(1, contextState.size());
1545
        assertEquals(1, contextState.size());
1545
        state = contextState.get(this.srcRootWithFiles1.getURL());
1546
        state = contextState.get(this.srcRootWithFiles1.getURL());
1546
        assertNotNull(state);
1547
        assertNotNull(state);
1547
        assertFalse(state.first);
1548
        assertFalse(state.first());
1548
        assertFalse(state.second);
1549
        assertFalse(state.second());
1549
        contextState = eindexerFactory.indexer.getContextState();
1550
        contextState = eindexerFactory.indexer.getContextState();
1550
        assertEquals(0, contextState.size());
1551
        assertEquals(0, contextState.size());
1551
1552
Lines 1576-1589 Link Here
1576
        assertEquals(1, contextState.size());
1577
        assertEquals(1, contextState.size());
1577
        state = contextState.get(this.srcRootWithFiles1.getURL());
1578
        state = contextState.get(this.srcRootWithFiles1.getURL());
1578
        assertNotNull(state);
1579
        assertNotNull(state);
1579
        assertFalse(state.first);
1580
        assertFalse(state.first());
1580
        assertFalse(state.second);
1581
        assertFalse(state.second());
1581
        contextState = eindexerFactory.indexer.getContextState();
1582
        contextState = eindexerFactory.indexer.getContextState();
1582
        assertEquals(1, contextState.size());
1583
        assertEquals(1, contextState.size());
1583
        state = contextState.get(embeddedFiles[0]);
1584
        state = contextState.get(embeddedFiles[0]);
1584
        assertNotNull(state);
1585
        assertNotNull(state);
1585
        assertFalse(state.first);
1586
        assertFalse(state.first());
1586
        assertFalse(state.second);
1587
        assertFalse(state.second());
1587
1588
1588
        //6th Do some modification when source are registered (allFiles should be false)
1589
        //6th Do some modification when source are registered (allFiles should be false)
1589
        indexerFactory.indexer.setExpectedFile(new URL[] {customFiles[0]}, new URL[0], new URL[0]);
1590
        indexerFactory.indexer.setExpectedFile(new URL[] {customFiles[0]}, new URL[0], new URL[0]);
Lines 1597-1610 Link Here
1597
        assertEquals(1, contextState.size());
1598
        assertEquals(1, contextState.size());
1598
        state = contextState.get(this.srcRootWithFiles1.getURL());
1599
        state = contextState.get(this.srcRootWithFiles1.getURL());
1599
        assertNotNull(state);
1600
        assertNotNull(state);
1600
        assertFalse(state.first);
1601
        assertFalse(state.first());
1601
        assertFalse(state.second);
1602
        assertFalse(state.second());
1602
        contextState = eindexerFactory.indexer.getContextState();
1603
        contextState = eindexerFactory.indexer.getContextState();
1603
        assertEquals(1, contextState.size());
1604
        assertEquals(1, contextState.size());
1604
        state = contextState.get(embeddedFiles[0]);
1605
        state = contextState.get(embeddedFiles[0]);
1605
        assertNotNull(state);
1606
        assertNotNull(state);
1606
        assertFalse(state.first);
1607
        assertFalse(state.first());
1607
        assertFalse(state.second);
1608
        assertFalse(state.second());
1608
        
1609
        
1609
        //7th IndexingManager.refreshIndex(root, all_files, fullRescan==true) (allFiles should be true)
1610
        //7th IndexingManager.refreshIndex(root, all_files, fullRescan==true) (allFiles should be true)
1610
        indexerFactory.indexer.setExpectedFile(customFiles, new URL[0], new URL[0]);
1611
        indexerFactory.indexer.setExpectedFile(customFiles, new URL[0], new URL[0]);
Lines 1616-1630 Link Here
1616
        assertEquals(1, contextState.size());
1617
        assertEquals(1, contextState.size());
1617
        state = contextState.get(this.srcRootWithFiles1.getURL());
1618
        state = contextState.get(this.srcRootWithFiles1.getURL());
1618
        assertNotNull(state);
1619
        assertNotNull(state);
1619
        assertTrue(state.first);
1620
        assertTrue(state.first());
1620
        assertFalse(state.second);
1621
        assertFalse(state.second());
1621
        contextState = eindexerFactory.indexer.getContextState();
1622
        contextState = eindexerFactory.indexer.getContextState();
1622
        assertEquals(embeddedFiles.length, contextState.size());
1623
        assertEquals(embeddedFiles.length, contextState.size());
1623
        for (URL url : embeddedFiles) {
1624
        for (URL url : embeddedFiles) {
1624
            state = contextState.get(url);
1625
            state = contextState.get(url);
1625
            assertNotNull(state);
1626
            assertNotNull(state);
1626
            assertTrue(state.first);
1627
            assertTrue(state.first());
1627
            assertFalse(state.second);
1628
            assertFalse(state.second());
1628
        }
1629
        }
1629
1630
1630
        //8th IndexingManager.refreshIndex(root, specifoc_file, fullRescan==true, checkEditor==true) (allFiles should be false, checkForEditorModifications should be true)
1631
        //8th IndexingManager.refreshIndex(root, specifoc_file, fullRescan==true, checkEditor==true) (allFiles should be false, checkForEditorModifications should be true)
Lines 1637-1650 Link Here
1637
        assertEquals(1, contextState.size());
1638
        assertEquals(1, contextState.size());
1638
        state = contextState.get(this.srcRootWithFiles1.getURL());
1639
        state = contextState.get(this.srcRootWithFiles1.getURL());
1639
        assertNotNull(state);
1640
        assertNotNull(state);
1640
        assertFalse(state.first);
1641
        assertFalse(state.first());
1641
        assertTrue(state.second);
1642
        assertTrue(state.second());
1642
        contextState = eindexerFactory.indexer.getContextState();
1643
        contextState = eindexerFactory.indexer.getContextState();
1643
        assertEquals(1, contextState.size());
1644
        assertEquals(1, contextState.size());
1644
        state = contextState.get(embeddedFiles[0]);
1645
        state = contextState.get(embeddedFiles[0]);
1645
        assertNotNull(state);
1646
        assertNotNull(state);
1646
        assertFalse(state.first);
1647
        assertFalse(state.first());
1647
        assertTrue(state.second);        
1648
        assertTrue(state.second());
1648
    }
1649
    }
1649
1650
1650
    public void testVisibilityQueryAmongIDERestarts() throws Exception {
1651
    public void testVisibilityQueryAmongIDERestarts() throws Exception {
(-)a/parsing.api/test/unit/src/org/netbeans/modules/parsing/impl/indexing/ScanStartedTest.java (-2 / +3 lines)
Lines 70-75 Link Here
70
import org.netbeans.spi.java.classpath.support.ClassPathSupport;
70
import org.netbeans.spi.java.classpath.support.ClassPathSupport;
71
import org.openide.filesystems.FileObject;
71
import org.openide.filesystems.FileObject;
72
import org.openide.filesystems.FileUtil;
72
import org.openide.filesystems.FileUtil;
73
import org.openide.util.Pair;
73
74
74
/**
75
/**
75
 *
76
 *
Lines 534-541 Link Here
534
            if (ie != null &&
535
            if (ie != null &&
535
                msg != null &&
536
                msg != null &&
536
                msg.startsWith("scanStarting:") &&  //NOI18N
537
                msg.startsWith("scanStarting:") &&  //NOI18N
537
                ie.first.equals(record.getParameters()[0])) {
538
                ie.first().equals(record.getParameters()[0])) {
538
                throw ie.second;
539
                throw ie.second();
539
            } else {
540
            } else {
540
                super.publish(record);
541
                super.publish(record);
541
            }
542
            }
(-)a/parsing.api/test/unit/src/org/netbeans/modules/parsing/spi/indexing/support/QuerySupportTest.java (-3 / +3 lines)
Lines 59-65 Link Here
59
import org.netbeans.api.java.queries.SourceForBinaryQuery;
59
import org.netbeans.api.java.queries.SourceForBinaryQuery;
60
import org.netbeans.junit.MockServices;
60
import org.netbeans.junit.MockServices;
61
import org.netbeans.junit.NbTestCase;
61
import org.netbeans.junit.NbTestCase;
62
import org.netbeans.modules.parsing.impl.indexing.Pair;
63
import org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater;
62
import org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater;
64
import org.netbeans.modules.parsing.impl.indexing.RepositoryUpdaterTest;
63
import org.netbeans.modules.parsing.impl.indexing.RepositoryUpdaterTest;
65
import org.netbeans.modules.parsing.impl.indexing.friendapi.IndexingController;
64
import org.netbeans.modules.parsing.impl.indexing.friendapi.IndexingController;
Lines 70-75 Link Here
70
import org.netbeans.spi.java.queries.SourceForBinaryQueryImplementation2;
69
import org.netbeans.spi.java.queries.SourceForBinaryQueryImplementation2;
71
import org.openide.filesystems.FileObject;
70
import org.openide.filesystems.FileObject;
72
import org.openide.filesystems.FileUtil;
71
import org.openide.filesystems.FileUtil;
72
import org.openide.util.Pair;
73
73
74
/**
74
/**
75
 *
75
 *
Lines 584-595 Link Here
584
            return new Result() {
584
            return new Result() {
585
                @Override
585
                @Override
586
                public boolean preferSources() {
586
                public boolean preferSources() {
587
                    return sources.first;
587
                    return sources.first();
588
                }
588
                }
589
589
590
                @Override
590
                @Override
591
                public FileObject[] getRoots() {
591
                public FileObject[] getRoots() {
592
                    return sources.second.toArray(new FileObject[sources.second.size()]);
592
                    return sources.second().toArray(new FileObject[sources.second().size()]);
593
                }
593
                }
594
594
595
                @Override
595
                @Override
(-)a/php.api.editor/manifest.mf (-1 / +1 lines)
Lines 1-4 Link Here
1
Manifest-Version: 1.0
1
Manifest-Version: 1.0
2
OpenIDE-Module: org.netbeans.modules.php.api.editor/0
2
OpenIDE-Module: org.netbeans.modules.php.api.editor/0
3
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/php/api/editor/resources/Bundle.properties
3
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/php/api/editor/resources/Bundle.properties
4
OpenIDE-Module-Specification-Version: 0.11
4
OpenIDE-Module-Specification-Version: 0.12
(-)a/php.api.editor/nbproject/project.xml (-2 / +2 lines)
Lines 19-25 Link Here
19
                    <build-prerequisite/>
19
                    <build-prerequisite/>
20
                    <compile-dependency/>
20
                    <compile-dependency/>
21
                    <run-dependency>
21
                    <run-dependency>
22
                        <specification-version>2.0</specification-version>
22
                        <specification-version>2.19</specification-version>
23
                    </run-dependency>
23
                    </run-dependency>
24
                </dependency>
24
                </dependency>
25
                <dependency>
25
                <dependency>
Lines 35-41 Link Here
35
                    <build-prerequisite/>
35
                    <build-prerequisite/>
36
                    <compile-dependency/>
36
                    <compile-dependency/>
37
                    <run-dependency>
37
                    <run-dependency>
38
                        <specification-version>8.26</specification-version>
38
                        <specification-version>8.32</specification-version>
39
                    </run-dependency>
39
                    </run-dependency>
40
                </dependency>
40
                </dependency>
41
            </module-dependencies>
41
            </module-dependencies>
(-)a/php.api.editor/src/org/netbeans/modules/php/api/editor/EditorSupport.java (-1 / +1 lines)
Lines 43-50 Link Here
43
package org.netbeans.modules.php.api.editor;
43
package org.netbeans.modules.php.api.editor;
44
44
45
import java.util.Collection;
45
import java.util.Collection;
46
import org.netbeans.modules.php.api.util.Pair;
47
import org.openide.filesystems.FileObject;
46
import org.openide.filesystems.FileObject;
47
import org.openide.util.Pair;
48
48
49
/**
49
/**
50
 * Helper editor class that can be found in the default lookup.
50
 * Helper editor class that can be found in the default lookup.
(-)a/php.api.executable/manifest.mf (-1 / +1 lines)
Lines 1-4 Link Here
1
Manifest-Version: 1.0
1
Manifest-Version: 1.0
2
OpenIDE-Module: org.netbeans.modules.php.api.executable/0
2
OpenIDE-Module: org.netbeans.modules.php.api.executable/0
3
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/php/api/executable/resources/Bundle.properties
3
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/php/api/executable/resources/Bundle.properties
4
OpenIDE-Module-Specification-Version: 0.13
4
OpenIDE-Module-Specification-Version: 0.14
(-)a/php.api.executable/nbproject/project.xml (-2 / +2 lines)
Lines 37-43 Link Here
37
                    <build-prerequisite/>
37
                    <build-prerequisite/>
38
                    <compile-dependency/>
38
                    <compile-dependency/>
39
                    <run-dependency>
39
                    <run-dependency>
40
                        <specification-version>2.0</specification-version>
40
                        <specification-version>2.19</specification-version>
41
                    </run-dependency>
41
                    </run-dependency>
42
                </dependency>
42
                </dependency>
43
                <dependency>
43
                <dependency>
Lines 87-93 Link Here
87
                    <build-prerequisite/>
87
                    <build-prerequisite/>
88
                    <compile-dependency/>
88
                    <compile-dependency/>
89
                    <run-dependency>
89
                    <run-dependency>
90
                        <specification-version>8.26</specification-version>
90
                        <specification-version>8.32</specification-version>
91
                    </run-dependency>
91
                    </run-dependency>
92
                </dependency>
92
                </dependency>
93
                <dependency>
93
                <dependency>
(-)a/php.api.executable/src/org/netbeans/modules/php/api/executable/PhpExecutable.java (-4 / +4 lines)
Lines 79-85 Link Here
79
import org.netbeans.api.project.Project;
79
import org.netbeans.api.project.Project;
80
import org.netbeans.api.queries.FileEncodingQuery;
80
import org.netbeans.api.queries.FileEncodingQuery;
81
import org.netbeans.modules.php.api.phpmodule.PhpOptions;
81
import org.netbeans.modules.php.api.phpmodule.PhpOptions;
82
import org.netbeans.modules.php.api.util.Pair;
83
import org.netbeans.modules.php.api.util.StringUtils;
82
import org.netbeans.modules.php.api.util.StringUtils;
84
import org.netbeans.modules.php.api.util.UiUtils;
83
import org.netbeans.modules.php.api.util.UiUtils;
85
import org.netbeans.modules.php.spi.executable.DebugStarter;
84
import org.netbeans.modules.php.spi.executable.DebugStarter;
Lines 89-94 Link Here
89
import org.openide.util.Cancellable;
88
import org.openide.util.Cancellable;
90
import org.openide.util.Lookup;
89
import org.openide.util.Lookup;
91
import org.openide.util.NbBundle;
90
import org.openide.util.NbBundle;
91
import org.openide.util.Pair;
92
import org.openide.util.Parameters;
92
import org.openide.util.Parameters;
93
import org.openide.util.Utilities;
93
import org.openide.util.Utilities;
94
import org.openide.windows.InputOutput;
94
import org.openide.windows.InputOutput;
Lines 162-169 Link Here
162
     */
162
     */
163
    public PhpExecutable(String command) {
163
    public PhpExecutable(String command) {
164
        Pair<String, List<String>> parsedCommand = parseCommand(command);
164
        Pair<String, List<String>> parsedCommand = parseCommand(command);
165
        executable = parsedCommand.first;
165
        executable = parsedCommand.first();
166
        parameters = parsedCommand.second;
166
        parameters = parsedCommand.second();
167
        this.command = command.trim();
167
        this.command = command.trim();
168
    }
168
    }
169
169
Lines 179-185 Link Here
179
            return Pair.of(tokens[0].trim(), Collections.<String>emptyList());
179
            return Pair.of(tokens[0].trim(), Collections.<String>emptyList());
180
        }
180
        }
181
        Pair<String, List<String>> parsedCommand = Pair.of(tokens[0].trim(), Arrays.asList(Utilities.parseParameters(tokens[1].trim())));
181
        Pair<String, List<String>> parsedCommand = Pair.of(tokens[0].trim(), Arrays.asList(Utilities.parseParameters(tokens[1].trim())));
182
        LOGGER.log(Level.FINE, "Parameters parsed: {0} {1}", new Object[] {parsedCommand.first, parsedCommand.second});
182
        LOGGER.log(Level.FINE, "Parameters parsed: {0} {1}", new Object[] {parsedCommand.first(), parsedCommand.second()});
183
        return parsedCommand;
183
        return parsedCommand;
184
    }
184
    }
185
185
(-)a/php.api.executable/src/org/netbeans/modules/php/api/executable/PhpExecutableValidator.java (-2 / +2 lines)
Lines 71-77 Link Here
71
    public static String validateCommand(@NullAllowed String command, @NullAllowed String executableName) {
71
    public static String validateCommand(@NullAllowed String command, @NullAllowed String executableName) {
72
        String executable = null;
72
        String executable = null;
73
        if (command != null) {
73
        if (command != null) {
74
            executable = PhpExecutable.parseCommand(command).first;
74
            executable = PhpExecutable.parseCommand(command).first();
75
        }
75
        }
76
        if (executableName == null) {
76
        if (executableName == null) {
77
            return FileUtils.validateFile(executable, false);
77
            return FileUtils.validateFile(executable, false);
Lines 86-92 Link Here
86
     * @return error if it is not valid, {@code null} otherwise
86
     * @return error if it is not valid, {@code null} otherwise
87
     */
87
     */
88
    public static String validateCommand(@NonNull String command, @NonNull ValidationHandler validationHandler) {
88
    public static String validateCommand(@NonNull String command, @NonNull ValidationHandler validationHandler) {
89
        return validationHandler.validate(PhpExecutable.parseCommand(command).first);
89
        return validationHandler.validate(PhpExecutable.parseCommand(command).first());
90
    }
90
    }
91
91
92
    //~ Inner classes
92
    //~ Inner classes
(-)a/php.api.executable/src/org/netbeans/modules/php/spi/executable/DebugStarter.java (-1 / +1 lines)
Lines 50-58 Link Here
50
import org.netbeans.api.annotations.common.NonNull;
50
import org.netbeans.api.annotations.common.NonNull;
51
import org.netbeans.api.annotations.common.NullAllowed;
51
import org.netbeans.api.annotations.common.NullAllowed;
52
import org.netbeans.api.project.Project;
52
import org.netbeans.api.project.Project;
53
import org.netbeans.modules.php.api.util.Pair;
54
import org.openide.filesystems.FileObject;
53
import org.openide.filesystems.FileObject;
55
import org.openide.util.Cancellable;
54
import org.openide.util.Cancellable;
55
import org.openide.util.Pair;
56
import org.openide.util.Parameters;
56
import org.openide.util.Parameters;
57
57
58
/**
58
/**
(-)a/php.api.executable/test/unit/src/org/netbeans/modules/php/api/executable/PhpExecutableTest.java (-21 / +21 lines)
Lines 45-51 Link Here
45
import java.util.List;
45
import java.util.List;
46
import org.junit.Test;
46
import org.junit.Test;
47
import org.netbeans.junit.NbTestCase;
47
import org.netbeans.junit.NbTestCase;
48
import org.netbeans.modules.php.api.util.Pair;
48
import org.openide.util.Pair;
49
49
50
public class PhpExecutableTest extends NbTestCase {
50
public class PhpExecutableTest extends NbTestCase {
51
51
Lines 56-111 Link Here
56
    @Test
56
    @Test
57
    public void testParseNullCommand() {
57
    public void testParseNullCommand() {
58
        Pair<String, List<String>> command = PhpExecutable.parseCommand(null);
58
        Pair<String, List<String>> command = PhpExecutable.parseCommand(null);
59
        assertEquals("", command.first);
59
        assertEquals("", command.first());
60
        assertTrue(command.second.isEmpty());
60
        assertTrue(command.second().isEmpty());
61
    }
61
    }
62
62
63
    @Test
63
    @Test
64
    public void testParseEmptyCommand() {
64
    public void testParseEmptyCommand() {
65
        Pair<String, List<String>> command = PhpExecutable.parseCommand("");
65
        Pair<String, List<String>> command = PhpExecutable.parseCommand("");
66
        assertEquals("", command.first);
66
        assertEquals("", command.first());
67
        assertTrue(command.second.isEmpty());
67
        assertTrue(command.second().isEmpty());
68
    }
68
    }
69
69
70
    @Test
70
    @Test
71
    public void testParseOnlyCommand() {
71
    public void testParseOnlyCommand() {
72
        Pair<String, List<String>> command = PhpExecutable.parseCommand("/usr/bin/php");
72
        Pair<String, List<String>> command = PhpExecutable.parseCommand("/usr/bin/php");
73
        assertEquals("/usr/bin/php", command.first);
73
        assertEquals("/usr/bin/php", command.first());
74
        assertTrue(command.second.isEmpty());
74
        assertTrue(command.second().isEmpty());
75
    }
75
    }
76
76
77
    @Test
77
    @Test
78
    public void testParseCommandWithParam1() {
78
    public void testParseCommandWithParam1() {
79
        Pair<String, List<String>> command = PhpExecutable.parseCommand("/usr/bin/php --verbose");
79
        Pair<String, List<String>> command = PhpExecutable.parseCommand("/usr/bin/php --verbose");
80
        assertEquals("/usr/bin/php", command.first);
80
        assertEquals("/usr/bin/php", command.first());
81
        assertEquals(1, command.second.size());
81
        assertEquals(1, command.second().size());
82
        assertEquals("--verbose", command.second.get(0));
82
        assertEquals("--verbose", command.second().get(0));
83
    }
83
    }
84
84
85
    @Test
85
    @Test
86
    public void testParseCommandWithParam2() {
86
    public void testParseCommandWithParam2() {
87
        Pair<String, List<String>> command = PhpExecutable.parseCommand("/usr/bin/php /verbose");
87
        Pair<String, List<String>> command = PhpExecutable.parseCommand("/usr/bin/php /verbose");
88
        assertEquals("/usr/bin/php", command.first);
88
        assertEquals("/usr/bin/php", command.first());
89
        assertEquals(1, command.second.size());
89
        assertEquals(1, command.second().size());
90
        assertEquals("/verbose", command.second.get(0));
90
        assertEquals("/verbose", command.second().get(0));
91
    }
91
    }
92
92
93
    @Test
93
    @Test
94
    public void testParseCommandWithParams1() {
94
    public void testParseCommandWithParams1() {
95
        Pair<String, List<String>> command = PhpExecutable.parseCommand("/usr/bin/php --verbose --version");
95
        Pair<String, List<String>> command = PhpExecutable.parseCommand("/usr/bin/php --verbose --version");
96
        assertEquals("/usr/bin/php", command.first);
96
        assertEquals("/usr/bin/php", command.first());
97
        assertEquals(2, command.second.size());
97
        assertEquals(2, command.second().size());
98
        assertEquals("--verbose", command.second.get(0));
98
        assertEquals("--verbose", command.second().get(0));
99
        assertEquals("--version", command.second.get(1));
99
        assertEquals("--version", command.second().get(1));
100
    }
100
    }
101
101
102
    @Test
102
    @Test
103
    public void testParseCommandWithParams2() {
103
    public void testParseCommandWithParams2() {
104
        Pair<String, List<String>> command = PhpExecutable.parseCommand("/usr/bin/php /verbose /version");
104
        Pair<String, List<String>> command = PhpExecutable.parseCommand("/usr/bin/php /verbose /version");
105
        assertEquals("/usr/bin/php", command.first);
105
        assertEquals("/usr/bin/php", command.first());
106
        assertEquals(2, command.second.size());
106
        assertEquals(2, command.second().size());
107
        assertEquals("/verbose", command.second.get(0));
107
        assertEquals("/verbose", command.second().get(0));
108
        assertEquals("/version", command.second.get(1));
108
        assertEquals("/version", command.second().get(1));
109
    }
109
    }
110
110
111
    public void testInfoCommand() {
111
    public void testInfoCommand() {
(-)a/php.api.phpmodule/manifest.mf (-1 / +1 lines)
Lines 1-4 Link Here
1
Manifest-Version: 1.0
1
Manifest-Version: 1.0
2
OpenIDE-Module: org.netbeans.modules.php.api.phpmodule
2
OpenIDE-Module: org.netbeans.modules.php.api.phpmodule
3
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/php/api/phpmodule/resources/Bundle.properties
3
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/php/api/phpmodule/resources/Bundle.properties
4
OpenIDE-Module-Specification-Version: 2.18
4
OpenIDE-Module-Specification-Version: 2.19
(-)a/php.api.phpmodule/nbproject/project.xml (-1 / +1 lines)
Lines 104-110 Link Here
104
                    <build-prerequisite/>
104
                    <build-prerequisite/>
105
                    <compile-dependency/>
105
                    <compile-dependency/>
106
                    <run-dependency>
106
                    <run-dependency>
107
                        <specification-version>8.26</specification-version>
107
                        <specification-version>8.32</specification-version>
108
                    </run-dependency>
108
                    </run-dependency>
109
                </dependency>
109
                </dependency>
110
                <dependency>
110
                <dependency>
(-)a/php.api.phpmodule/src/org/netbeans/modules/php/api/util/Pair.java (-83 lines)
Lines 1-83 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2010 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 2008 Sun Microsystems, Inc.
41
 */
42
package org.netbeans.modules.php.api.util;
43
44
/**
45
 * Class representing a pair of values.
46
 */
47
public final class Pair<P, K> {
48
49
    public final P first;
50
    public final K second;
51
52
    private Pair(P first, K second) {
53
        this.first = first;
54
        this.second = second;
55
    }
56
57
    public static <P, K> Pair<P, K> of(P first, K second) {
58
        return new Pair<P, K>(first, second);
59
    }
60
61
    @Override
62
    public int hashCode() {
63
        int hashCode  = 0;
64
        hashCode ^= first == null ? 0 : first.hashCode();
65
        hashCode ^= second == null ? 0 : second.hashCode();
66
        return hashCode;
67
    }
68
69
    @Override
70
    public boolean equals(final Object other) {
71
        if (other instanceof Pair) {
72
            Pair<?, ?> otherPair = (Pair) other;
73
            return (this.first == null ? otherPair.first == null : this.first.equals(otherPair.first))
74
                    && (this.second == null ? otherPair.second == null : this.second.equals(otherPair.second));
75
        }
76
        return false;
77
    }
78
79
    @Override
80
    public String toString() {
81
        return String.format("Pair [%s, %s]", first, second); // NOI18N
82
    }
83
}
(-)a/php.dbgp/manifest.mf (-1 / +1 lines)
Lines 3-7 Link Here
3
OpenIDE-Module: org.netbeans.modules.php.dbgp
3
OpenIDE-Module: org.netbeans.modules.php.dbgp
4
OpenIDE-Module-Layer: org/netbeans/modules/php/dbgp/resources/layer.xml
4
OpenIDE-Module-Layer: org/netbeans/modules/php/dbgp/resources/layer.xml
5
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/php/dbgp/resources/Bundle.properties
5
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/php/dbgp/resources/Bundle.properties
6
OpenIDE-Module-Specification-Version: 1.29
6
OpenIDE-Module-Specification-Version: 1.30
7
7
(-)a/php.dbgp/nbproject/project.xml (-3 / +3 lines)
Lines 74-80 Link Here
74
                    <compile-dependency/>
74
                    <compile-dependency/>
75
                    <run-dependency>
75
                    <run-dependency>
76
                        <release-version>0</release-version>
76
                        <release-version>0</release-version>
77
                        <specification-version>0.10</specification-version>
77
                        <specification-version>0.14</specification-version>
78
                    </run-dependency>
78
                    </run-dependency>
79
                </dependency>
79
                </dependency>
80
                <dependency>
80
                <dependency>
Lines 82-88 Link Here
82
                    <build-prerequisite/>
82
                    <build-prerequisite/>
83
                    <compile-dependency/>
83
                    <compile-dependency/>
84
                    <run-dependency>
84
                    <run-dependency>
85
                        <specification-version>2.0</specification-version>
85
                        <specification-version>2.19</specification-version>
86
                    </run-dependency>
86
                    </run-dependency>
87
                </dependency>
87
                </dependency>
88
                <dependency>
88
                <dependency>
Lines 189-195 Link Here
189
                    <build-prerequisite/>
189
                    <build-prerequisite/>
190
                    <compile-dependency/>
190
                    <compile-dependency/>
191
                    <run-dependency>
191
                    <run-dependency>
192
                        <specification-version>8.0</specification-version>
192
                        <specification-version>8.32</specification-version>
193
                    </run-dependency>
193
                    </run-dependency>
194
                </dependency>
194
                </dependency>
195
                <dependency>
195
                <dependency>
(-)a/php.dbgp/src/org/netbeans/modules/php/dbgp/DebuggerOptions.java (-1 / +1 lines)
Lines 42-49 Link Here
42
package org.netbeans.modules.php.dbgp;
42
package org.netbeans.modules.php.dbgp;
43
43
44
import java.util.List;
44
import java.util.List;
45
import org.netbeans.modules.php.api.util.Pair;
46
import org.netbeans.modules.php.project.api.PhpOptions;
45
import org.netbeans.modules.php.project.api.PhpOptions;
46
import org.openide.util.Pair;
47
47
48
/**
48
/**
49
 * @author Radek Matous
49
 * @author Radek Matous
(-)a/php.dbgp/src/org/netbeans/modules/php/dbgp/ProxyClient.java (-4 / +4 lines)
Lines 71-81 Link Here
71
71
72
    private ProxyClient(DebuggerOptions options) {
72
    private ProxyClient(DebuggerOptions options) {
73
        assert options != null;
73
        assert options != null;
74
        assert options.getDebugProxy().first != null;
74
        assert options.getDebugProxy().first() != null;
75
        assert options.getDebugProxy().second != null;
75
        assert options.getDebugProxy().second() != null;
76
76
77
        this.proxyHost = options.getDebugProxy().first;
77
        this.proxyHost = options.getDebugProxy().first();
78
        this.proxyPort = options.getDebugProxy().second;
78
        this.proxyPort = options.getDebugProxy().second();
79
        this.idePort = PhpOptions.getInstance().getDebuggerPort();
79
        this.idePort = PhpOptions.getInstance().getDebuggerPort();
80
        this.ideKey = PhpOptions.getInstance().getDebuggerSessionId();
80
        this.ideKey = PhpOptions.getInstance().getDebuggerSessionId();
81
    }
81
    }
(-)a/php.dbgp/src/org/netbeans/modules/php/dbgp/SessionId.java (-1 / +1 lines)
Lines 53-62 Link Here
53
import org.netbeans.api.project.ProjectUtils;
53
import org.netbeans.api.project.ProjectUtils;
54
import org.netbeans.api.project.SourceGroup;
54
import org.netbeans.api.project.SourceGroup;
55
import org.netbeans.api.project.Sources;
55
import org.netbeans.api.project.Sources;
56
import org.netbeans.modules.php.api.util.Pair;
57
import org.netbeans.modules.php.project.api.PhpOptions;
56
import org.netbeans.modules.php.project.api.PhpOptions;
58
import org.openide.filesystems.FileObject;
57
import org.openide.filesystems.FileObject;
59
import org.openide.filesystems.FileUtil;
58
import org.openide.filesystems.FileUtil;
59
import org.openide.util.Pair;
60
60
61
61
62
/**
62
/**
(-)a/php.dbgp/src/org/netbeans/modules/php/dbgp/URIMapper.java (-5 / +5 lines)
Lines 55-64 Link Here
55
import java.util.Map;
55
import java.util.Map;
56
import java.util.logging.Level;
56
import java.util.logging.Level;
57
import java.util.logging.Logger;
57
import java.util.logging.Logger;
58
import org.netbeans.modules.php.api.util.Pair;
59
import org.openide.filesystems.FileObject;
58
import org.openide.filesystems.FileObject;
60
import org.openide.filesystems.FileUtil;
59
import org.openide.filesystems.FileUtil;
61
import org.openide.util.Exceptions;
60
import org.openide.util.Exceptions;
61
import org.openide.util.Pair;
62
import org.openide.util.Utilities;
62
import org.openide.util.Utilities;
63
63
64
/**
64
/**
Lines 86-93 Link Here
86
        for (Pair<String, String> pair : pathMapping) {
86
        for (Pair<String, String> pair : pathMapping) {
87
            //1. mapper provided by user via project UI if any
87
            //1. mapper provided by user via project UI if any
88
            pair = encodedPathMappingPair(pair);
88
            pair = encodedPathMappingPair(pair);
89
            String uriPath = pair.first;
89
            String uriPath = pair.first();
90
            String filePath = pair.second;
90
            String filePath = pair.second();
91
            if (uriPath.length() > 0 && filePath.length() > 0) {
91
            if (uriPath.length() > 0 && filePath.length() > 0) {
92
                if (!uriPath.startsWith("file:")) {//NOI18N
92
                if (!uriPath.startsWith("file:")) {//NOI18N
93
                    if (!uriPath.startsWith("/")) {
93
                    if (!uriPath.startsWith("/")) {
Lines 368-374 Link Here
368
    }
368
    }
369
369
370
    private static Pair<String, String> encodedPathMappingPair(Pair<String, String> pathMapping)  {
370
    private static Pair<String, String> encodedPathMappingPair(Pair<String, String> pathMapping)  {
371
        String resName = pathMapping.first;
371
        String resName = pathMapping.first();
372
        resName = resName.replace('\\', '/');//NOI18N
372
        resName = resName.replace('\\', '/');//NOI18N
373
        final String[] elements = resName.split("/"); // NOI18N
373
        final String[] elements = resName.split("/"); // NOI18N
374
        final StringBuilder sb = new StringBuilder(200);
374
        final StringBuilder sb = new StringBuilder(200);
Lines 391-397 Link Here
391
                sb.append('/');
391
                sb.append('/');
392
            }
392
            }
393
        }
393
        }
394
        return Pair.of(sb.toString(), pathMapping.second);//NOI18N
394
        return Pair.of(sb.toString(), pathMapping.second());//NOI18N
395
    }
395
    }
396
396
397
}
397
}
(-)a/php.dbgp/test/unit/src/org/netbeans/modules/php/dbgp/URIMapperTest.java (-1 / +1 lines)
Lines 42-48 Link Here
42
package org.netbeans.modules.php.dbgp;
42
package org.netbeans.modules.php.dbgp;
43
43
44
import java.util.LinkedList;
44
import java.util.LinkedList;
45
import org.netbeans.modules.php.api.util.Pair;
46
import java.io.File;
45
import java.io.File;
47
import java.io.IOException;
46
import java.io.IOException;
48
import java.net.URI;
47
import java.net.URI;
Lines 52-57 Link Here
52
import org.netbeans.junit.NbTestCase;
51
import org.netbeans.junit.NbTestCase;
53
import org.openide.filesystems.FileUtil;
52
import org.openide.filesystems.FileUtil;
54
import static org.junit.Assert.*;
53
import static org.junit.Assert.*;
54
import org.openide.util.Pair;
55
55
56
/**
56
/**
57
 * @author Radek Matous
57
 * @author Radek Matous
(-)a/php.editor/nbproject/project.properties (-1 / +1 lines)
Lines 3-9 Link Here
3
build.compiler=extJavac
3
build.compiler=extJavac
4
javac.compilerargs=-J-Xmx512m
4
javac.compilerargs=-J-Xmx512m
5
nbm.needs.restart=true
5
nbm.needs.restart=true
6
spec.version.base=1.36.0
6
spec.version.base=1.37.0
7
release.external/predefined_vars.zip=docs/predefined_vars.zip
7
release.external/predefined_vars.zip=docs/predefined_vars.zip
8
sigtest.gen.fail.on.error=false
8
sigtest.gen.fail.on.error=false
9
9
(-)a/php.editor/nbproject/project.xml (-3 / +3 lines)
Lines 235-241 Link Here
235
                    <compile-dependency/>
235
                    <compile-dependency/>
236
                    <run-dependency>
236
                    <run-dependency>
237
                        <release-version>0</release-version>
237
                        <release-version>0</release-version>
238
                        <specification-version>0.1</specification-version>
238
                        <specification-version>0.12</specification-version>
239
                    </run-dependency>
239
                    </run-dependency>
240
                </dependency>
240
                </dependency>
241
                <dependency>
241
                <dependency>
Lines 243-249 Link Here
243
                    <build-prerequisite/>
243
                    <build-prerequisite/>
244
                    <compile-dependency/>
244
                    <compile-dependency/>
245
                    <run-dependency>
245
                    <run-dependency>
246
                        <specification-version>2.14</specification-version>
246
                        <specification-version>2.19</specification-version>
247
                    </run-dependency>
247
                    </run-dependency>
248
                </dependency>
248
                </dependency>
249
                <dependency>
249
                <dependency>
Lines 351-357 Link Here
351
                    <build-prerequisite/>
351
                    <build-prerequisite/>
352
                    <compile-dependency/>
352
                    <compile-dependency/>
353
                    <run-dependency>
353
                    <run-dependency>
354
                        <specification-version>8.0</specification-version>
354
                        <specification-version>8.32</specification-version>
355
                    </run-dependency>
355
                    </run-dependency>
356
                </dependency>
356
                </dependency>
357
                <dependency>
357
                <dependency>
(-)a/php.editor/src/org/netbeans/modules/php/editor/model/impl/EditorSupportImpl.java (-1 / +1 lines)
Lines 56-62 Link Here
56
import org.netbeans.modules.php.api.editor.PhpBaseElement;
56
import org.netbeans.modules.php.api.editor.PhpBaseElement;
57
import org.netbeans.modules.php.api.editor.PhpClass;
57
import org.netbeans.modules.php.api.editor.PhpClass;
58
import org.netbeans.modules.php.api.editor.PhpFunction;
58
import org.netbeans.modules.php.api.editor.PhpFunction;
59
import org.netbeans.modules.php.api.util.Pair;
60
import org.netbeans.modules.php.editor.api.ElementQuery.Index;
59
import org.netbeans.modules.php.editor.api.ElementQuery.Index;
61
import org.netbeans.modules.php.editor.api.ElementQueryFactory;
60
import org.netbeans.modules.php.editor.api.ElementQueryFactory;
62
import org.netbeans.modules.php.editor.api.NameKind;
61
import org.netbeans.modules.php.editor.api.NameKind;
Lines 75-80 Link Here
75
import org.netbeans.modules.php.editor.parser.PHPParseResult;
74
import org.netbeans.modules.php.editor.parser.PHPParseResult;
76
import org.openide.filesystems.FileObject;
75
import org.openide.filesystems.FileObject;
77
import org.openide.util.Exceptions;
76
import org.openide.util.Exceptions;
77
import org.openide.util.Pair;
78
import org.openide.util.lookup.ServiceProvider;
78
import org.openide.util.lookup.ServiceProvider;
79
79
80
/**
80
/**
(-)a/php.phpunit/manifest.mf (-1 / +1 lines)
Lines 3-7 Link Here
3
OpenIDE-Module: org.netbeans.modules.php.phpunit/0
3
OpenIDE-Module: org.netbeans.modules.php.phpunit/0
4
OpenIDE-Module-Layer: org/netbeans/modules/php/phpunit/resources/layer.xml
4
OpenIDE-Module-Layer: org/netbeans/modules/php/phpunit/resources/layer.xml
5
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/php/phpunit/resources/Bundle.properties
5
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/php/phpunit/resources/Bundle.properties
6
OpenIDE-Module-Specification-Version: 0.5
6
OpenIDE-Module-Specification-Version: 0.6
7
7
(-)a/php.phpunit/nbproject/project.xml (-4 / +4 lines)
Lines 56-62 Link Here
56
                    <compile-dependency/>
56
                    <compile-dependency/>
57
                    <run-dependency>
57
                    <run-dependency>
58
                        <release-version>0</release-version>
58
                        <release-version>0</release-version>
59
                        <specification-version>0.8</specification-version>
59
                        <specification-version>0.12</specification-version>
60
                    </run-dependency>
60
                    </run-dependency>
61
                </dependency>
61
                </dependency>
62
                <dependency>
62
                <dependency>
Lines 65-71 Link Here
65
                    <compile-dependency/>
65
                    <compile-dependency/>
66
                    <run-dependency>
66
                    <run-dependency>
67
                        <release-version>0</release-version>
67
                        <release-version>0</release-version>
68
                        <specification-version>0.10</specification-version>
68
                        <specification-version>0.14</specification-version>
69
                    </run-dependency>
69
                    </run-dependency>
70
                </dependency>
70
                </dependency>
71
                <dependency>
71
                <dependency>
Lines 73-79 Link Here
73
                    <build-prerequisite/>
73
                    <build-prerequisite/>
74
                    <compile-dependency/>
74
                    <compile-dependency/>
75
                    <run-dependency>
75
                    <run-dependency>
76
                        <specification-version>2.12</specification-version>
76
                        <specification-version>2.19</specification-version>
77
                    </run-dependency>
77
                    </run-dependency>
78
                </dependency>
78
                </dependency>
79
                <dependency>
79
                <dependency>
Lines 173-179 Link Here
173
                    <build-prerequisite/>
173
                    <build-prerequisite/>
174
                    <compile-dependency/>
174
                    <compile-dependency/>
175
                    <run-dependency>
175
                    <run-dependency>
176
                        <specification-version>8.30</specification-version>
176
                        <specification-version>8.32</specification-version>
177
                    </run-dependency>
177
                    </run-dependency>
178
                </dependency>
178
                </dependency>
179
                <dependency>
179
                <dependency>
(-)a/php.phpunit/src/org/netbeans/modules/php/phpunit/locate/PhpUnitTestLocator.java (-5 / +5 lines)
Lines 51-63 Link Here
51
import org.netbeans.modules.php.api.editor.PhpClass;
51
import org.netbeans.modules.php.api.editor.PhpClass;
52
import org.netbeans.modules.php.api.phpmodule.PhpModule;
52
import org.netbeans.modules.php.api.phpmodule.PhpModule;
53
import org.netbeans.modules.php.api.util.FileUtils;
53
import org.netbeans.modules.php.api.util.FileUtils;
54
import org.netbeans.modules.php.api.util.Pair;
55
import org.netbeans.modules.php.phpunit.commands.PhpUnit;
54
import org.netbeans.modules.php.phpunit.commands.PhpUnit;
56
import org.netbeans.modules.php.spi.testing.locate.Locations;
55
import org.netbeans.modules.php.spi.testing.locate.Locations;
57
import org.netbeans.modules.php.spi.testing.locate.TestLocator;
56
import org.netbeans.modules.php.spi.testing.locate.TestLocator;
58
import org.openide.filesystems.FileObject;
57
import org.openide.filesystems.FileObject;
59
import org.openide.filesystems.FileUtil;
58
import org.openide.filesystems.FileUtil;
60
import org.openide.util.Lookup;
59
import org.openide.util.Lookup;
60
import org.openide.util.Pair;
61
61
62
public class PhpUnitTestLocator implements TestLocator {
62
public class PhpUnitTestLocator implements TestLocator {
63
63
Lines 110-123 Link Here
110
110
111
            for (Pair<String, String> namePair : classes) {
111
            for (Pair<String, String> namePair : classes) {
112
                // prefer FQN
112
                // prefer FQN
113
                Collection<Pair<FileObject, Integer>> files = editorSupport.filesForClass(sourceRoot, new PhpClass(namePair.first, namePair.second, -1));
113
                Collection<Pair<FileObject, Integer>> files = editorSupport.filesForClass(sourceRoot, new PhpClass(namePair.first(), namePair.second(), -1));
114
                List<Locations.Offset> results = filterPhpFiles(sourceRoot, files);
114
                List<Locations.Offset> results = filterPhpFiles(sourceRoot, files);
115
                if (!results.isEmpty()) {
115
                if (!results.isEmpty()) {
116
                    phpFiles.addAll(results);
116
                    phpFiles.addAll(results);
117
                    continue;
117
                    continue;
118
                }
118
                }
119
                // #221816 - search only by class name
119
                // #221816 - search only by class name
120
                files = editorSupport.filesForClass(sourceRoot, new PhpClass(namePair.first, null, -1));
120
                files = editorSupport.filesForClass(sourceRoot, new PhpClass(namePair.first(), null, -1));
121
                results = filterPhpFiles(sourceRoot, files);
121
                results = filterPhpFiles(sourceRoot, files);
122
                phpFiles.addAll(results);
122
                phpFiles.addAll(results);
123
            }
123
            }
Lines 128-137 Link Here
128
    private List<Locations.Offset> filterPhpFiles(FileObject sourceRoot, Collection<Pair<FileObject, Integer>> files) {
128
    private List<Locations.Offset> filterPhpFiles(FileObject sourceRoot, Collection<Pair<FileObject, Integer>> files) {
129
        List<Locations.Offset> results = new ArrayList<Locations.Offset>(files.size());
129
        List<Locations.Offset> results = new ArrayList<Locations.Offset>(files.size());
130
        for (Pair<FileObject, Integer> pair : files) {
130
        for (Pair<FileObject, Integer> pair : files) {
131
            FileObject fileObject = pair.first;
131
            FileObject fileObject = pair.first();
132
            if (FileUtils.isPhpFile(fileObject)
132
            if (FileUtils.isPhpFile(fileObject)
133
                    && FileUtil.isParentOf(sourceRoot, fileObject)) {
133
                    && FileUtil.isParentOf(sourceRoot, fileObject)) {
134
                results.add(new Locations.Offset(fileObject, pair.second));
134
                results.add(new Locations.Offset(fileObject, pair.second()));
135
            }
135
            }
136
        }
136
        }
137
        return results;
137
        return results;
(-)a/php.project/manifest.mf (-1 / +1 lines)
Lines 1-6 Link Here
1
Manifest-Version: 1.0
1
Manifest-Version: 1.0
2
AutoUpdate-Show-In-Client: false
2
AutoUpdate-Show-In-Client: false
3
OpenIDE-Module-Specification-Version: 2.81
3
OpenIDE-Module-Specification-Version: 2.82
4
OpenIDE-Module: org.netbeans.modules.php.project
4
OpenIDE-Module: org.netbeans.modules.php.project
5
OpenIDE-Module-Layer: org/netbeans/modules/php/project/resources/layer.xml
5
OpenIDE-Module-Layer: org/netbeans/modules/php/project/resources/layer.xml
6
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/php/project/resources/Bundle.properties
6
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/php/project/resources/Bundle.properties
(-)a/php.project/nbproject/project.xml (-4 / +4 lines)
Lines 258-264 Link Here
258
                    <compile-dependency/>
258
                    <compile-dependency/>
259
                    <run-dependency>
259
                    <run-dependency>
260
                        <release-version>0</release-version>
260
                        <release-version>0</release-version>
261
                        <specification-version>0.3</specification-version>
261
                        <specification-version>0.14</specification-version>
262
                    </run-dependency>
262
                    </run-dependency>
263
                </dependency>
263
                </dependency>
264
                <dependency>
264
                <dependency>
Lines 275-281 Link Here
275
                    <build-prerequisite/>
275
                    <build-prerequisite/>
276
                    <compile-dependency/>
276
                    <compile-dependency/>
277
                    <run-dependency>
277
                    <run-dependency>
278
                        <specification-version>2.18</specification-version>
278
                        <specification-version>2.19</specification-version>
279
                    </run-dependency>
279
                    </run-dependency>
280
                </dependency>
280
                </dependency>
281
                <dependency>
281
                <dependency>
Lines 336-342 Link Here
336
                    <build-prerequisite/>
336
                    <build-prerequisite/>
337
                    <compile-dependency/>
337
                    <compile-dependency/>
338
                    <run-dependency>
338
                    <run-dependency>
339
                        <specification-version>1.21</specification-version>
339
                        <specification-version>1.28</specification-version>
340
                    </run-dependency>
340
                    </run-dependency>
341
                </dependency>
341
                </dependency>
342
                <dependency>
342
                <dependency>
Lines 441-447 Link Here
441
                    <build-prerequisite/>
441
                    <build-prerequisite/>
442
                    <compile-dependency/>
442
                    <compile-dependency/>
443
                    <run-dependency>
443
                    <run-dependency>
444
                        <specification-version>8.25</specification-version>
444
                        <specification-version>8.32</specification-version>
445
                    </run-dependency>
445
                    </run-dependency>
446
                </dependency>
446
                </dependency>
447
                <dependency>
447
                <dependency>
(-)a/php.project/src/org/netbeans/modules/php/project/ProjectPropertiesSupport.java (-1 / +1 lines)
Lines 52-58 Link Here
52
import org.netbeans.api.progress.ProgressUtils;
52
import org.netbeans.api.progress.ProgressUtils;
53
import org.netbeans.modules.php.api.executable.InvalidPhpExecutableException;
53
import org.netbeans.modules.php.api.executable.InvalidPhpExecutableException;
54
import org.netbeans.modules.php.api.executable.PhpInterpreter;
54
import org.netbeans.modules.php.api.executable.PhpInterpreter;
55
import org.netbeans.modules.php.api.util.Pair;
56
import org.netbeans.modules.php.api.util.StringUtils;
55
import org.netbeans.modules.php.api.util.StringUtils;
57
import org.netbeans.modules.php.project.api.PhpLanguageProperties;
56
import org.netbeans.modules.php.project.api.PhpLanguageProperties;
58
import org.netbeans.modules.php.project.api.PhpOptions;
57
import org.netbeans.modules.php.project.api.PhpOptions;
Lines 65-70 Link Here
65
import org.openide.filesystems.FileObject;
64
import org.openide.filesystems.FileObject;
66
import org.openide.filesystems.FileUtil;
65
import org.openide.filesystems.FileUtil;
67
import org.openide.util.NbBundle;
66
import org.openide.util.NbBundle;
67
import org.openide.util.Pair;
68
68
69
/**
69
/**
70
 * Helper class for getting <b>all</b> the properties of a PHP project.
70
 * Helper class for getting <b>all</b> the properties of a PHP project.
(-)a/php.project/src/org/netbeans/modules/php/project/connections/sync/SyncPanel.java (-2 / +2 lines)
Lines 103-109 Link Here
103
import javax.swing.table.TableModel;
103
import javax.swing.table.TableModel;
104
import javax.swing.table.TableRowSorter;
104
import javax.swing.table.TableRowSorter;
105
import org.netbeans.api.annotations.common.StaticResource;
105
import org.netbeans.api.annotations.common.StaticResource;
106
import org.netbeans.modules.php.api.util.Pair;
107
import org.netbeans.modules.php.project.PhpProject;
106
import org.netbeans.modules.php.project.PhpProject;
108
import org.netbeans.modules.php.project.ProjectPropertiesSupport;
107
import org.netbeans.modules.php.project.ProjectPropertiesSupport;
109
import org.netbeans.modules.php.project.connections.RemoteClient;
108
import org.netbeans.modules.php.project.connections.RemoteClient;
Lines 120-125 Link Here
120
import org.openide.util.ImageUtilities;
119
import org.openide.util.ImageUtilities;
121
import org.openide.util.Mutex;
120
import org.openide.util.Mutex;
122
import org.openide.util.NbBundle;
121
import org.openide.util.NbBundle;
122
import org.openide.util.Pair;
123
import org.openide.util.RequestProcessor;
123
import org.openide.util.RequestProcessor;
124
124
125
/**
125
/**
Lines 822-828 Link Here
822
            if (!iterator.hasNext()) {
822
            if (!iterator.hasNext()) {
823
                selectionIsAdjusting = false;
823
                selectionIsAdjusting = false;
824
            }
824
            }
825
            itemTable.getSelectionModel().addSelectionInterval(pair.first, pair.second);
825
            itemTable.getSelectionModel().addSelectionInterval(pair.first(), pair.second());
826
        }
826
        }
827
        selectionIsAdjusting = false;
827
        selectionIsAdjusting = false;
828
    }
828
    }
(-)a/php.project/src/org/netbeans/modules/php/project/copysupport/LocalOperationFactory.java (-4 / +4 lines)
Lines 50-62 Link Here
50
import org.netbeans.modules.php.api.util.FileUtils;
50
import org.netbeans.modules.php.api.util.FileUtils;
51
import org.netbeans.modules.php.project.PhpProject;
51
import org.netbeans.modules.php.project.PhpProject;
52
import org.netbeans.modules.php.project.ProjectPropertiesSupport;
52
import org.netbeans.modules.php.project.ProjectPropertiesSupport;
53
import org.netbeans.modules.php.api.util.Pair;
54
import org.netbeans.modules.php.project.ui.customizer.CompositePanelProviderImpl;
53
import org.netbeans.modules.php.project.ui.customizer.CompositePanelProviderImpl;
55
import org.openide.filesystems.FileEvent;
54
import org.openide.filesystems.FileEvent;
56
import org.openide.filesystems.FileObject;
55
import org.openide.filesystems.FileObject;
57
import org.openide.filesystems.FileRenameEvent;
56
import org.openide.filesystems.FileRenameEvent;
58
import org.openide.filesystems.FileUtil;
57
import org.openide.filesystems.FileUtil;
59
import org.openide.util.NbBundle;
58
import org.openide.util.NbBundle;
59
import org.openide.util.Pair;
60
60
61
/**
61
/**
62
 * @author Radek Matous
62
 * @author Radek Matous
Lines 304-311 Link Here
304
            return null;
304
            return null;
305
        }
305
        }
306
306
307
        FileObject sourceRoot = cfgPair.first;
307
        FileObject sourceRoot = cfgPair.first();
308
        File targetRoot = cfgPair.second;
308
        File targetRoot = cfgPair.second();
309
        assert sourceRoot != null;
309
        assert sourceRoot != null;
310
        assert targetRoot != null;
310
        assert targetRoot != null;
311
311
Lines 353-359 Link Here
353
    }
353
    }
354
354
355
    private static boolean isPairValid(Pair<FileObject, File> pair) {
355
    private static boolean isPairValid(Pair<FileObject, File> pair) {
356
        return pair != null && pair.first != null && pair.second != null;
356
        return pair != null && pair.first() != null && pair.second() != null;
357
    }
357
    }
358
358
359
    @Override
359
    @Override
(-)a/php.project/src/org/netbeans/modules/php/project/ui/actions/support/CommandUtils.java (-1 / +1 lines)
Lines 57-63 Link Here
57
import java.util.logging.Logger;
57
import java.util.logging.Logger;
58
import org.netbeans.api.annotations.common.CheckForNull;
58
import org.netbeans.api.annotations.common.CheckForNull;
59
import org.netbeans.modules.php.api.util.FileUtils;
59
import org.netbeans.modules.php.api.util.FileUtils;
60
import org.netbeans.modules.php.api.util.Pair;
61
import org.netbeans.modules.php.api.util.StringUtils;
60
import org.netbeans.modules.php.api.util.StringUtils;
62
import org.netbeans.modules.php.project.PhpActionProvider;
61
import org.netbeans.modules.php.project.PhpActionProvider;
63
import org.netbeans.modules.php.project.PhpProject;
62
import org.netbeans.modules.php.project.PhpProject;
Lines 75-80 Link Here
75
import org.openide.util.Exceptions;
74
import org.openide.util.Exceptions;
76
import org.openide.util.Lookup;
75
import org.openide.util.Lookup;
77
import org.openide.util.NbBundle;
76
import org.openide.util.NbBundle;
77
import org.openide.util.Pair;
78
import org.openide.windows.TopComponent;
78
import org.openide.windows.TopComponent;
79
79
80
/**
80
/**
(-)a/php.project/src/org/netbeans/modules/php/project/ui/actions/support/ConfigActionTest.java (-2 / +2 lines)
Lines 52-58 Link Here
52
import org.netbeans.modules.gsf.testrunner.api.Testcase;
52
import org.netbeans.modules.gsf.testrunner.api.Testcase;
53
import org.netbeans.modules.php.api.phpmodule.PhpModule;
53
import org.netbeans.modules.php.api.phpmodule.PhpModule;
54
import org.netbeans.modules.php.api.util.FileUtils;
54
import org.netbeans.modules.php.api.util.FileUtils;
55
import org.netbeans.modules.php.api.util.Pair;
56
import org.netbeans.modules.php.project.PhpActionProvider;
55
import org.netbeans.modules.php.project.PhpActionProvider;
57
import org.netbeans.modules.php.project.PhpProject;
56
import org.netbeans.modules.php.project.PhpProject;
58
import org.netbeans.modules.php.project.ProjectPropertiesSupport;
57
import org.netbeans.modules.php.project.ProjectPropertiesSupport;
Lines 66-71 Link Here
66
import org.openide.filesystems.FileUtil;
65
import org.openide.filesystems.FileUtil;
67
import org.openide.util.ChangeSupport;
66
import org.openide.util.ChangeSupport;
68
import org.openide.util.Lookup;
67
import org.openide.util.Lookup;
68
import org.openide.util.Pair;
69
69
70
/**
70
/**
71
 * Action implementation for TEST configuration.
71
 * Action implementation for TEST configuration.
Lines 208-214 Link Here
208
        TestRunInfo testRunInfo = getTestRunInfoForFile(file, debug);
208
        TestRunInfo testRunInfo = getTestRunInfoForFile(file, debug);
209
        assert testRunInfo != null;
209
        assert testRunInfo != null;
210
        Pair<String, String> method = CommandUtils.decodeMethod(singleMethod.getMethodName());
210
        Pair<String, String> method = CommandUtils.decodeMethod(singleMethod.getMethodName());
211
        TestRunInfo.TestInfo testInfo = new TestRunInfo.TestInfo(TestRunInfo.TestInfo.UNKNOWN_TYPE, method.second, method.first,
211
        TestRunInfo.TestInfo testInfo = new TestRunInfo.TestInfo(TestRunInfo.TestInfo.UNKNOWN_TYPE, method.second(), method.first(),
212
                FileUtil.toFile(file).getAbsolutePath());
212
                FileUtil.toFile(file).getAbsolutePath());
213
        testRunInfo.setCustomTests(Collections.singleton(testInfo));
213
        testRunInfo.setCustomTests(Collections.singleton(testInfo));
214
        return testRunInfo;
214
        return testRunInfo;
(-)a/php.project/src/org/netbeans/modules/php/project/ui/actions/support/DebugScript.java (-1 / +1 lines)
Lines 36-42 Link Here
36
import org.netbeans.api.extexecution.ExternalProcessBuilder;
36
import org.netbeans.api.extexecution.ExternalProcessBuilder;
37
import org.netbeans.api.project.Project;
37
import org.netbeans.api.project.Project;
38
import org.netbeans.api.queries.FileEncodingQuery;
38
import org.netbeans.api.queries.FileEncodingQuery;
39
import org.netbeans.modules.php.api.util.Pair;
40
import org.netbeans.modules.php.project.PhpProject;
39
import org.netbeans.modules.php.project.PhpProject;
41
import org.netbeans.modules.php.project.ProjectPropertiesSupport;
40
import org.netbeans.modules.php.project.ProjectPropertiesSupport;
42
import org.netbeans.modules.php.spi.executable.DebugStarter;
41
import org.netbeans.modules.php.spi.executable.DebugStarter;
Lines 45-50 Link Here
45
import org.openide.filesystems.FileObject;
44
import org.openide.filesystems.FileObject;
46
import org.openide.util.Cancellable;
45
import org.openide.util.Cancellable;
47
import org.openide.util.NbBundle;
46
import org.openide.util.NbBundle;
47
import org.openide.util.Pair;
48
48
49
/**
49
/**
50
 * @author Radek Matous, Tomas Mysik
50
 * @author Radek Matous, Tomas Mysik
(-)a/php.project/src/org/netbeans/modules/php/project/ui/actions/support/FileRunner.java (-1 / +1 lines)
Lines 62-68 Link Here
62
import org.netbeans.api.queries.FileEncodingQuery;
62
import org.netbeans.api.queries.FileEncodingQuery;
63
import org.netbeans.modules.php.api.executable.PhpExecutable;
63
import org.netbeans.modules.php.api.executable.PhpExecutable;
64
import org.netbeans.modules.php.api.executable.PhpInterpreter;
64
import org.netbeans.modules.php.api.executable.PhpInterpreter;
65
import org.netbeans.modules.php.api.util.Pair;
66
import org.netbeans.modules.php.api.util.StringUtils;
65
import org.netbeans.modules.php.api.util.StringUtils;
67
import org.netbeans.modules.php.api.util.UiUtils;
66
import org.netbeans.modules.php.api.util.UiUtils;
68
import org.netbeans.modules.php.project.PhpProject;
67
import org.netbeans.modules.php.project.PhpProject;
Lines 76-81 Link Here
76
import org.openide.util.Cancellable;
75
import org.openide.util.Cancellable;
77
import org.openide.util.Lookup;
76
import org.openide.util.Lookup;
78
import org.openide.util.NbBundle;
77
import org.openide.util.NbBundle;
78
import org.openide.util.Pair;
79
import org.openide.util.RequestProcessor;
79
import org.openide.util.RequestProcessor;
80
import org.openide.util.Utilities;
80
import org.openide.util.Utilities;
81
import org.openide.windows.InputOutput;
81
import org.openide.windows.InputOutput;
(-)a/php.project/src/org/netbeans/modules/php/project/ui/customizer/RunAsLocalWeb.java (-5 / +5 lines)
Lines 60-72 Link Here
60
import org.netbeans.modules.php.project.ProjectPropertiesSupport;
60
import org.netbeans.modules.php.project.ProjectPropertiesSupport;
61
import org.netbeans.modules.php.project.ui.Utils;
61
import org.netbeans.modules.php.project.ui.Utils;
62
import org.netbeans.modules.php.project.ui.customizer.PhpProjectProperties.RunAsType;
62
import org.netbeans.modules.php.project.ui.customizer.PhpProjectProperties.RunAsType;
63
import org.netbeans.modules.php.api.util.Pair;
64
import org.netbeans.modules.php.project.PhpVisibilityQuery;
63
import org.netbeans.modules.php.project.PhpVisibilityQuery;
65
import org.netbeans.modules.php.project.runconfigs.RunConfigLocal;
64
import org.netbeans.modules.php.project.runconfigs.RunConfigLocal;
66
import org.netbeans.modules.php.project.runconfigs.validation.RunConfigLocalValidator;
65
import org.netbeans.modules.php.project.runconfigs.validation.RunConfigLocalValidator;
67
import org.netbeans.spi.project.ui.support.ProjectCustomizer.Category;
66
import org.netbeans.spi.project.ui.support.ProjectCustomizer.Category;
68
import org.openide.awt.Mnemonics;
67
import org.openide.awt.Mnemonics;
69
import org.openide.util.NbBundle;
68
import org.openide.util.NbBundle;
69
import org.openide.util.Pair;
70
70
71
/**
71
/**
72
 * @author  Radek Matous, Tomas Mysik
72
 * @author  Radek Matous, Tomas Mysik
Lines 336-345 Link Here
336
            Pair<String, String> pathMapping = advanced.getPathMapping();
336
            Pair<String, String> pathMapping = advanced.getPathMapping();
337
            Pair<String, String> debugProxy = advanced.getDebugProxy();
337
            Pair<String, String> debugProxy = advanced.getDebugProxy();
338
            RunAsLocalWeb.this.putValue(PhpProjectProperties.DEBUG_URL, advanced.getDebugUrl().name());
338
            RunAsLocalWeb.this.putValue(PhpProjectProperties.DEBUG_URL, advanced.getDebugUrl().name());
339
            RunAsLocalWeb.this.putValue(PhpProjectProperties.DEBUG_PATH_MAPPING_REMOTE, pathMapping.first);
339
            RunAsLocalWeb.this.putValue(PhpProjectProperties.DEBUG_PATH_MAPPING_REMOTE, pathMapping.first());
340
            RunAsLocalWeb.this.putValue(PhpProjectProperties.DEBUG_PATH_MAPPING_LOCAL, pathMapping.second);
340
            RunAsLocalWeb.this.putValue(PhpProjectProperties.DEBUG_PATH_MAPPING_LOCAL, pathMapping.second());
341
            RunAsLocalWeb.this.putValue(PhpProjectProperties.DEBUG_PROXY_HOST, debugProxy.first);
341
            RunAsLocalWeb.this.putValue(PhpProjectProperties.DEBUG_PROXY_HOST, debugProxy.first());
342
            RunAsLocalWeb.this.putValue(PhpProjectProperties.DEBUG_PROXY_PORT, debugProxy.second);
342
            RunAsLocalWeb.this.putValue(PhpProjectProperties.DEBUG_PROXY_PORT, debugProxy.second());
343
        }
343
        }
344
    }//GEN-LAST:event_advancedButtonActionPerformed
344
    }//GEN-LAST:event_advancedButtonActionPerformed
345
345
(-)a/php.project/src/org/netbeans/modules/php/project/ui/customizer/RunAsRemoteWeb.java (-5 / +5 lines)
Lines 70-76 Link Here
70
import javax.swing.event.DocumentEvent;
70
import javax.swing.event.DocumentEvent;
71
import javax.swing.event.DocumentListener;
71
import javax.swing.event.DocumentListener;
72
import javax.swing.plaf.UIResource;
72
import javax.swing.plaf.UIResource;
73
import org.netbeans.modules.php.api.util.Pair;
74
import org.netbeans.modules.php.project.PhpProject;
73
import org.netbeans.modules.php.project.PhpProject;
75
import org.netbeans.modules.php.project.PhpVisibilityQuery;
74
import org.netbeans.modules.php.project.PhpVisibilityQuery;
76
import org.netbeans.modules.php.project.ProjectPropertiesSupport;
75
import org.netbeans.modules.php.project.ProjectPropertiesSupport;
Lines 86-91 Link Here
86
import org.netbeans.spi.project.ui.support.ProjectCustomizer.Category;
85
import org.netbeans.spi.project.ui.support.ProjectCustomizer.Category;
87
import org.openide.awt.Mnemonics;
86
import org.openide.awt.Mnemonics;
88
import org.openide.util.NbBundle;
87
import org.openide.util.NbBundle;
88
import org.openide.util.Pair;
89
89
90
/**
90
/**
91
 * @author Tomas Mysik
91
 * @author Tomas Mysik
Lines 620-629 Link Here
620
            Pair<String, String> pathMapping = advanced.getPathMapping();
620
            Pair<String, String> pathMapping = advanced.getPathMapping();
621
            Pair<String, String> debugProxy = advanced.getDebugProxy();
621
            Pair<String, String> debugProxy = advanced.getDebugProxy();
622
            RunAsRemoteWeb.this.putValue(PhpProjectProperties.DEBUG_URL, advanced.getDebugUrl().name());
622
            RunAsRemoteWeb.this.putValue(PhpProjectProperties.DEBUG_URL, advanced.getDebugUrl().name());
623
            RunAsRemoteWeb.this.putValue(PhpProjectProperties.DEBUG_PATH_MAPPING_REMOTE, pathMapping.first);
623
            RunAsRemoteWeb.this.putValue(PhpProjectProperties.DEBUG_PATH_MAPPING_REMOTE, pathMapping.first());
624
            RunAsRemoteWeb.this.putValue(PhpProjectProperties.DEBUG_PATH_MAPPING_LOCAL, pathMapping.second);
624
            RunAsRemoteWeb.this.putValue(PhpProjectProperties.DEBUG_PATH_MAPPING_LOCAL, pathMapping.second());
625
            RunAsRemoteWeb.this.putValue(PhpProjectProperties.DEBUG_PROXY_HOST, debugProxy.first);
625
            RunAsRemoteWeb.this.putValue(PhpProjectProperties.DEBUG_PROXY_HOST, debugProxy.first());
626
            RunAsRemoteWeb.this.putValue(PhpProjectProperties.DEBUG_PROXY_PORT, debugProxy.second);
626
            RunAsRemoteWeb.this.putValue(PhpProjectProperties.DEBUG_PROXY_PORT, debugProxy.second());
627
        }
627
        }
628
    }//GEN-LAST:event_advancedButtonActionPerformed
628
    }//GEN-LAST:event_advancedButtonActionPerformed
629
629
(-)a/php.project/src/org/netbeans/modules/php/project/ui/customizer/RunAsWebAdvanced.java (-3 / +3 lines)
Lines 73-79 Link Here
73
import javax.swing.event.TableModelListener;
73
import javax.swing.event.TableModelListener;
74
import javax.swing.table.DefaultTableModel;
74
import javax.swing.table.DefaultTableModel;
75
import javax.swing.table.TableCellRenderer;
75
import javax.swing.table.TableCellRenderer;
76
import org.netbeans.modules.php.api.util.Pair;
77
import org.netbeans.modules.php.api.util.StringUtils;
76
import org.netbeans.modules.php.api.util.StringUtils;
78
import org.netbeans.modules.php.project.PhpProject;
77
import org.netbeans.modules.php.project.PhpProject;
79
import org.netbeans.modules.php.project.ProjectPropertiesSupport;
78
import org.netbeans.modules.php.project.ProjectPropertiesSupport;
Lines 90-95 Link Here
90
import org.openide.filesystems.FileUtil;
89
import org.openide.filesystems.FileUtil;
91
import org.openide.util.HelpCtx;
90
import org.openide.util.HelpCtx;
92
import org.openide.util.NbBundle;
91
import org.openide.util.NbBundle;
92
import org.openide.util.Pair;
93
93
94
/**
94
/**
95
 * @author Tomas Mysik
95
 * @author Tomas Mysik
Lines 318-325 Link Here
318
                local = locals.get(i);
318
                local = locals.get(i);
319
            }
319
            }
320
            Pair<String, String> pathMapping = getPathMapping(remotes.get(i), local);
320
            Pair<String, String> pathMapping = getPathMapping(remotes.get(i), local);
321
            paths[i][COLUMN_REMOTE_PATH] = pathMapping.first;
321
            paths[i][COLUMN_REMOTE_PATH] = pathMapping.first();
322
            paths[i][COLUMN_LOCAL_PATH] = new LocalPathCell(pathMapping.second);
322
            paths[i][COLUMN_LOCAL_PATH] = new LocalPathCell(pathMapping.second());
323
        }
323
        }
324
        paths[remotesSize][COLUMN_REMOTE_PATH] = null;
324
        paths[remotesSize][COLUMN_REMOTE_PATH] = null;
325
        paths[remotesSize][COLUMN_LOCAL_PATH] = new LocalPathCell(DEFAULT_LOCAL_PATH);
325
        paths[remotesSize][COLUMN_LOCAL_PATH] = new LocalPathCell(DEFAULT_LOCAL_PATH);
(-)a/php.project/src/org/netbeans/modules/php/project/ui/logicalview/ImportantFilesNodeFactory.java (-5 / +5 lines)
Lines 55-61 Link Here
55
import javax.swing.event.ChangeListener;
55
import javax.swing.event.ChangeListener;
56
import org.netbeans.api.project.Project;
56
import org.netbeans.api.project.Project;
57
import org.netbeans.modules.php.api.phpmodule.PhpModule;
57
import org.netbeans.modules.php.api.phpmodule.PhpModule;
58
import org.netbeans.modules.php.api.util.Pair;
59
import org.netbeans.modules.php.api.util.UiUtils;
58
import org.netbeans.modules.php.api.util.UiUtils;
60
import org.netbeans.modules.php.project.PhpProject;
59
import org.netbeans.modules.php.project.PhpProject;
61
import org.netbeans.modules.php.project.PhpVisibilityQuery;
60
import org.netbeans.modules.php.project.PhpVisibilityQuery;
Lines 81-86 Link Here
81
import org.openide.util.ChangeSupport;
80
import org.openide.util.ChangeSupport;
82
import org.openide.util.ImageUtilities;
81
import org.openide.util.ImageUtilities;
83
import org.openide.util.NbBundle;
82
import org.openide.util.NbBundle;
83
import org.openide.util.Pair;
84
import org.openide.util.RequestProcessor;
84
import org.openide.util.RequestProcessor;
85
85
86
/**
86
/**
Lines 309-326 Link Here
309
        private final FileObject sourceDir;
309
        private final FileObject sourceDir;
310
310
311
        public ImportantFileNode(Pair<PhpFrameworkProvider, FileObject> pair, FileObject sourceDir) throws DataObjectNotFoundException {
311
        public ImportantFileNode(Pair<PhpFrameworkProvider, FileObject> pair, FileObject sourceDir) throws DataObjectNotFoundException {
312
            super(DataObject.find(pair.second).getNodeDelegate());
312
            super(DataObject.find(pair.second()).getNodeDelegate());
313
            this.pair = pair;
313
            this.pair = pair;
314
            this.sourceDir = sourceDir;
314
            this.sourceDir = sourceDir;
315
        }
315
        }
316
316
317
        @Override
317
        @Override
318
        public String getShortDescription() {
318
        public String getShortDescription() {
319
            String filepath = FileUtil.getRelativePath(sourceDir, pair.second);
319
            String filepath = FileUtil.getRelativePath(sourceDir, pair.second());
320
            if (filepath == null) {
320
            if (filepath == null) {
321
                filepath = FileUtil.getFileDisplayName(pair.second);
321
                filepath = FileUtil.getFileDisplayName(pair.second());
322
            }
322
            }
323
            return NbBundle.getMessage(ImportantFileNode.class, "LBL_ImportantFileTooltip", filepath, pair.first.getName());
323
            return NbBundle.getMessage(ImportantFileNode.class, "LBL_ImportantFileTooltip", filepath, pair.first().getName());
324
        }
324
        }
325
    }
325
    }
326
}
326
}
(-)a/php.project/src/org/netbeans/modules/php/project/util/PhpProjectUtils.java (-1 / +1 lines)
Lines 60-66 Link Here
60
import org.netbeans.api.project.Sources;
60
import org.netbeans.api.project.Sources;
61
import org.netbeans.editor.BaseDocument;
61
import org.netbeans.editor.BaseDocument;
62
import org.netbeans.modules.editor.indent.api.Reformat;
62
import org.netbeans.modules.editor.indent.api.Reformat;
63
import org.netbeans.modules.php.api.util.Pair;
64
import org.netbeans.modules.php.api.util.StringUtils;
63
import org.netbeans.modules.php.api.util.StringUtils;
65
import org.netbeans.modules.php.project.PhpProject;
64
import org.netbeans.modules.php.project.PhpProject;
66
import org.netbeans.modules.php.project.PhpSources;
65
import org.netbeans.modules.php.project.PhpSources;
Lines 83-88 Link Here
83
import org.openide.text.Line.Set;
82
import org.openide.text.Line.Set;
84
import org.openide.util.Mutex;
83
import org.openide.util.Mutex;
85
import org.openide.util.NbBundle;
84
import org.openide.util.NbBundle;
85
import org.openide.util.Pair;
86
import org.openide.util.UserQuestionException;
86
import org.openide.util.UserQuestionException;
87
87
88
/**
88
/**
(-)a/php.project/test/unit/src/org/netbeans/modules/php/project/util/PhpProjectUtilsTest.java (-1 / +1 lines)
Lines 50-56 Link Here
50
import org.netbeans.modules.php.api.util.StringUtils;
50
import org.netbeans.modules.php.api.util.StringUtils;
51
import org.netbeans.modules.php.project.ui.customizer.PhpProjectProperties;
51
import org.netbeans.modules.php.project.ui.customizer.PhpProjectProperties;
52
import static org.junit.Assert.*;
52
import static org.junit.Assert.*;
53
import org.netbeans.modules.php.api.util.Pair;
53
import org.openide.util.Pair;
54
54
55
public class PhpProjectUtilsTest extends NbTestCase {
55
public class PhpProjectUtilsTest extends NbTestCase {
56
56
(-)a/php.symfony/manifest.mf (-1 / +1 lines)
Lines 2-6 Link Here
2
OpenIDE-Module: org.netbeans.modules.php.symfony
2
OpenIDE-Module: org.netbeans.modules.php.symfony
3
OpenIDE-Module-Layer: org/netbeans/modules/php/symfony/resources/layer.xml
3
OpenIDE-Module-Layer: org/netbeans/modules/php/symfony/resources/layer.xml
4
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/php/symfony/resources/Bundle.properties
4
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/php/symfony/resources/Bundle.properties
5
OpenIDE-Module-Specification-Version: 1.30
5
OpenIDE-Module-Specification-Version: 1.31
6
6
(-)a/php.symfony/nbproject/project.xml (-4 / +4 lines)
Lines 74-80 Link Here
74
                    <compile-dependency/>
74
                    <compile-dependency/>
75
                    <run-dependency>
75
                    <run-dependency>
76
                        <release-version>0</release-version>
76
                        <release-version>0</release-version>
77
                        <specification-version>0.1</specification-version>
77
                        <specification-version>0.12</specification-version>
78
                    </run-dependency>
78
                    </run-dependency>
79
                </dependency>
79
                </dependency>
80
                <dependency>
80
                <dependency>
Lines 83-89 Link Here
83
                    <compile-dependency/>
83
                    <compile-dependency/>
84
                    <run-dependency>
84
                    <run-dependency>
85
                        <release-version>0</release-version>
85
                        <release-version>0</release-version>
86
                        <specification-version>0.3</specification-version>
86
                        <specification-version>0.14</specification-version>
87
                    </run-dependency>
87
                    </run-dependency>
88
                </dependency>
88
                </dependency>
89
                <dependency>
89
                <dependency>
Lines 100-106 Link Here
100
                    <build-prerequisite/>
100
                    <build-prerequisite/>
101
                    <compile-dependency/>
101
                    <compile-dependency/>
102
                    <run-dependency>
102
                    <run-dependency>
103
                        <specification-version>2.18</specification-version>
103
                        <specification-version>2.19</specification-version>
104
                    </run-dependency>
104
                    </run-dependency>
105
                </dependency>
105
                </dependency>
106
                <dependency>
106
                <dependency>
Lines 196-202 Link Here
196
                    <build-prerequisite/>
196
                    <build-prerequisite/>
197
                    <compile-dependency/>
197
                    <compile-dependency/>
198
                    <run-dependency>
198
                    <run-dependency>
199
                        <specification-version>8.22</specification-version>
199
                        <specification-version>8.32</specification-version>
200
                    </run-dependency>
200
                    </run-dependency>
201
                </dependency>
201
                </dependency>
202
                <dependency>
202
                <dependency>
(-)a/php.symfony/src/org/netbeans/modules/php/symfony/SymfonyPhpModuleExtender.java (-2 / +2 lines)
Lines 51-63 Link Here
51
import org.netbeans.modules.php.api.executable.InvalidPhpExecutableException;
51
import org.netbeans.modules.php.api.executable.InvalidPhpExecutableException;
52
import org.netbeans.modules.php.api.executable.PhpInterpreter;
52
import org.netbeans.modules.php.api.executable.PhpInterpreter;
53
import org.netbeans.modules.php.api.phpmodule.PhpModule;
53
import org.netbeans.modules.php.api.phpmodule.PhpModule;
54
import org.netbeans.modules.php.api.util.Pair;
55
import org.netbeans.modules.php.spi.framework.PhpModuleExtender;
54
import org.netbeans.modules.php.spi.framework.PhpModuleExtender;
56
import org.netbeans.modules.php.symfony.ui.wizards.NewProjectConfigurationPanel;
55
import org.netbeans.modules.php.symfony.ui.wizards.NewProjectConfigurationPanel;
57
import org.openide.filesystems.FileObject;
56
import org.openide.filesystems.FileObject;
58
import org.openide.util.Exceptions;
57
import org.openide.util.Exceptions;
59
import org.openide.util.HelpCtx;
58
import org.openide.util.HelpCtx;
60
import org.openide.util.NbBundle;
59
import org.openide.util.NbBundle;
60
import org.openide.util.Pair;
61
61
62
/**
62
/**
63
 * @author Tomas Mysik
63
 * @author Tomas Mysik
Lines 87-93 Link Here
87
87
88
        // generate apps
88
        // generate apps
89
        for (Pair<String, String[]> app : getPanel().getApps()) {
89
        for (Pair<String, String[]> app : getPanel().getApps()) {
90
            symfonyScript.initApp(phpModule, app.first, app.second);
90
            symfonyScript.initApp(phpModule, app.first(), app.second());
91
        }
91
        }
92
92
93
        // prefetch commands
93
        // prefetch commands
(-)a/php.symfony/src/org/netbeans/modules/php/symfony/ui/wizards/NewProjectConfigurationPanel.java (-1 / +1 lines)
Lines 64-76 Link Here
64
import javax.swing.event.DocumentEvent;
64
import javax.swing.event.DocumentEvent;
65
import javax.swing.event.DocumentListener;
65
import javax.swing.event.DocumentListener;
66
import org.netbeans.api.options.OptionsDisplayer;
66
import org.netbeans.api.options.OptionsDisplayer;
67
import org.netbeans.modules.php.api.util.Pair;
68
import org.netbeans.modules.php.api.util.StringUtils;
67
import org.netbeans.modules.php.api.util.StringUtils;
69
import org.netbeans.modules.php.symfony.SymfonyScript;
68
import org.netbeans.modules.php.symfony.SymfonyScript;
70
import org.netbeans.modules.php.symfony.ui.options.SymfonyOptions;
69
import org.netbeans.modules.php.symfony.ui.options.SymfonyOptions;
71
import org.openide.awt.Mnemonics;
70
import org.openide.awt.Mnemonics;
72
import org.openide.util.ChangeSupport;
71
import org.openide.util.ChangeSupport;
73
import org.openide.util.NbBundle;
72
import org.openide.util.NbBundle;
73
import org.openide.util.Pair;
74
import org.openide.util.Utilities;
74
import org.openide.util.Utilities;
75
75
76
/**
76
/**
(-)a/refactoring.java/nbproject/project.xml (-1 / +1 lines)
Lines 294-300 Link Here
294
                    <build-prerequisite/>
294
                    <build-prerequisite/>
295
                    <compile-dependency/>
295
                    <compile-dependency/>
296
                    <run-dependency>
296
                    <run-dependency>
297
                        <specification-version>8.0</specification-version>
297
                        <specification-version>8.32</specification-version>
298
                    </run-dependency>
298
                    </run-dependency>
299
                </dependency>
299
                </dependency>
300
                <dependency>
300
                <dependency>
(-)a/refactoring.java/src/org/netbeans/modules/refactoring/java/Pair.java (-75 lines)
Lines 1-75 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 1997-2010 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
 * Contributor(s):
28
 *
29
 * Portions Copyrighted 2007 Sun Microsystems, Inc.
30
 */
31
package org.netbeans.modules.refactoring.java;
32
33
/**
34
 * Copy from org.netbeans.modules.java.source.usages.Pair;
35
 * @author Ralph Ruijs
36
 */
37
public final class Pair<P,K> {
38
39
    public final P first;
40
    public final K second;
41
42
    private Pair (P first, K second) {
43
        this.first = first;
44
        this.second = second;
45
    }
46
47
    
48
    public static <P,K> Pair<P,K> of (P first, K second) {
49
        return new Pair<P,K> (first,second);
50
    }
51
    
52
    
53
    @Override
54
    public int hashCode () {
55
        int hashCode  = 0;
56
        hashCode ^= first == null ? 0 : first.hashCode();
57
        hashCode ^= second == null ? 0: second.hashCode();
58
        return hashCode;
59
    }
60
    
61
    @Override
62
    public boolean equals (final Object other) {
63
        if (other instanceof Pair) {
64
            Pair otherPair = (Pair) other;
65
            return (this.first == null ? otherPair.first == null : this.first.equals(otherPair.first)) &&
66
                   (this.second == null ? otherPair.second == null : this.second.equals(otherPair.second));
67
        }
68
        return false;
69
    }
70
    
71
    @Override
72
    public String toString () {
73
        return String.format("Pair[%s,%s]", first,second);
74
    }
75
}
(-)a/refactoring.java/src/org/netbeans/modules/refactoring/java/plugins/InlineMethodTransformer.java (-5 / +5 lines)
Lines 77-88 Link Here
77
import org.netbeans.api.java.source.GeneratorUtilities;
77
import org.netbeans.api.java.source.GeneratorUtilities;
78
import org.netbeans.api.java.source.TreePathHandle;
78
import org.netbeans.api.java.source.TreePathHandle;
79
import org.netbeans.modules.refactoring.api.Problem;
79
import org.netbeans.modules.refactoring.api.Problem;
80
import org.netbeans.modules.refactoring.java.Pair;
81
import org.netbeans.modules.refactoring.java.RefactoringUtils;
80
import org.netbeans.modules.refactoring.java.RefactoringUtils;
82
import org.netbeans.modules.refactoring.java.api.JavaRefactoringUtils;
81
import org.netbeans.modules.refactoring.java.api.JavaRefactoringUtils;
83
import org.netbeans.modules.refactoring.java.spi.RefactoringVisitor;
82
import org.netbeans.modules.refactoring.java.spi.RefactoringVisitor;
84
import org.openide.filesystems.FileUtil;
83
import org.openide.filesystems.FileUtil;
85
import org.openide.util.NbBundle;
84
import org.openide.util.NbBundle;
85
import org.openide.util.Pair;
86
86
87
/**
87
/**
88
 *
88
 *
Lines 476-483 Link Here
476
                if(path != null) {
476
                if(path != null) {
477
                    el = trees.getElement(path);
477
                    el = trees.getElement(path);
478
                }
478
                }
479
                if (p.first.equals(el)) {
479
                if (p.first().equals(el)) {
480
                    original2TranslatedBody.put(node, make.setLabel(node, p.second));
480
                    original2TranslatedBody.put(node, make.setLabel(node, p.second()));
481
                }
481
                }
482
                return super.visitIdentifier(node, p);
482
                return super.visitIdentifier(node, p);
483
            }
483
            }
Lines 513-520 Link Here
513
                if(currentPath != null) {
513
                if(currentPath != null) {
514
                    el = trees.getElement(currentPath);
514
                    el = trees.getElement(currentPath);
515
                }
515
                }
516
                if (p.first.equals(el)) {
516
                if (p.first().equals(el)) {
517
                    original2TranslatedBody.put(node, p.second);
517
                    original2TranslatedBody.put(node, p.second());
518
                }
518
                }
519
                return super.visitIdentifier(node, p);
519
                return super.visitIdentifier(node, p);
520
            }
520
            }
(-)a/refactoring.java/src/org/netbeans/modules/refactoring/java/plugins/MoveMembersTransformer.java (-3 / +3 lines)
Lines 59-65 Link Here
59
import org.netbeans.api.java.source.*;
59
import org.netbeans.api.java.source.*;
60
import org.netbeans.modules.refactoring.api.MoveRefactoring;
60
import org.netbeans.modules.refactoring.api.MoveRefactoring;
61
import org.netbeans.modules.refactoring.api.Problem;
61
import org.netbeans.modules.refactoring.api.Problem;
62
import org.netbeans.modules.refactoring.java.Pair;
63
import org.netbeans.modules.refactoring.java.RefactoringUtils;
62
import org.netbeans.modules.refactoring.java.RefactoringUtils;
64
import org.netbeans.modules.refactoring.java.api.JavaMoveMembersProperties;
63
import org.netbeans.modules.refactoring.java.api.JavaMoveMembersProperties;
65
import org.netbeans.modules.refactoring.java.api.JavaMoveMembersProperties.Visibility;
64
import org.netbeans.modules.refactoring.java.api.JavaMoveMembersProperties.Visibility;
Lines 68-73 Link Here
68
import org.openide.filesystems.FileObject;
67
import org.openide.filesystems.FileObject;
69
import org.openide.filesystems.FileUtil;
68
import org.openide.filesystems.FileUtil;
70
import org.openide.util.NbBundle;
69
import org.openide.util.NbBundle;
70
import org.openide.util.Pair;
71
71
72
/**
72
/**
73
 *
73
 *
Lines 648-655 Link Here
648
                            public Void visitIdentifier(IdentifierTree node, Pair<Element, ExpressionTree> p) {
648
                            public Void visitIdentifier(IdentifierTree node, Pair<Element, ExpressionTree> p) {
649
                                TreePath currentPath = new TreePath(resolvedPath, node);
649
                                TreePath currentPath = new TreePath(resolvedPath, node);
650
                                Element el = trees.getElement(currentPath);
650
                                Element el = trees.getElement(currentPath);
651
                                if (p.first.equals(el)) {
651
                                if (p.first().equals(el)) {
652
                                    original2Translated.put(node, p.second);
652
                                    original2Translated.put(node, p.second());
653
                                }
653
                                }
654
                                return super.visitIdentifier(node, p);
654
                                return super.visitIdentifier(node, p);
655
                            }
655
                            }
(-)a/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/WhereUsedPanel.java (-1 / +1 lines)
Lines 57-67 Link Here
57
import org.netbeans.api.java.source.*;
57
import org.netbeans.api.java.source.*;
58
import org.netbeans.api.java.source.JavaSource.Phase;
58
import org.netbeans.api.java.source.JavaSource.Phase;
59
import org.netbeans.modules.refactoring.api.Scope;
59
import org.netbeans.modules.refactoring.api.Scope;
60
import org.netbeans.modules.refactoring.java.Pair;
61
import org.netbeans.modules.refactoring.spi.ui.CustomRefactoringPanel;
60
import org.netbeans.modules.refactoring.spi.ui.CustomRefactoringPanel;
62
import org.openide.filesystems.FileObject;
61
import org.openide.filesystems.FileObject;
63
import org.openide.util.NbBundle;
62
import org.openide.util.NbBundle;
64
import org.openide.util.NbPreferences;
63
import org.openide.util.NbPreferences;
64
import org.openide.util.Pair;
65
import org.openide.util.lookup.Lookups;
65
import org.openide.util.lookup.Lookups;
66
66
67
67
(-)a/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/WhereUsedPanelMethod.java (-5 / +5 lines)
Lines 57-64 Link Here
57
import org.netbeans.api.java.source.CompilationController;
57
import org.netbeans.api.java.source.CompilationController;
58
import org.netbeans.api.java.source.TreePathHandle;
58
import org.netbeans.api.java.source.TreePathHandle;
59
import org.netbeans.api.java.source.ui.ElementIcons;
59
import org.netbeans.api.java.source.ui.ElementIcons;
60
import org.netbeans.modules.refactoring.java.Pair;
61
import org.netbeans.modules.refactoring.java.RefactoringModule;
60
import org.netbeans.modules.refactoring.java.RefactoringModule;
61
import org.openide.util.Pair;
62
62
63
/**
63
/**
64
 *
64
 *
Lines 238-250 Link Here
238
    @SuppressWarnings("unchecked")
238
    @SuppressWarnings("unchecked")
239
    String getMethodDeclaringClass() {
239
    String getMethodDeclaringClass() {
240
        Pair<Pair<String, Icon>, TreePathHandle> selectedItem = (Pair<Pair<String, Icon>, TreePathHandle>) jComboBox1.getSelectedItem();
240
        Pair<Pair<String, Icon>, TreePathHandle> selectedItem = (Pair<Pair<String, Icon>, TreePathHandle>) jComboBox1.getSelectedItem();
241
        return selectedItem.first.first;
241
        return selectedItem.first().first();
242
    }
242
    }
243
243
244
    @SuppressWarnings("unchecked")
244
    @SuppressWarnings("unchecked")
245
    public TreePathHandle getMethodHandle() {
245
    public TreePathHandle getMethodHandle() {
246
        Pair<Pair<String, Icon>, TreePathHandle> selectedItem = (Pair<Pair<String, Icon>, TreePathHandle>) jComboBox1.getSelectedItem();
246
        Pair<Pair<String, Icon>, TreePathHandle> selectedItem = (Pair<Pair<String, Icon>, TreePathHandle>) jComboBox1.getSelectedItem();
247
        return selectedItem == null ? tph : selectedItem.second;
247
        return selectedItem == null ? tph : selectedItem.second();
248
    }
248
    }
249
249
250
    public boolean isMethodFromBaseClass() {
250
    public boolean isMethodFromBaseClass() {
Lines 291-298 Link Here
291
                    setIcon(getEmptyIcon());
291
                    setIcon(getEmptyIcon());
292
                } else {
292
                } else {
293
                    Pair<Pair<String, Icon>, TreePathHandle> selectedPair = (Pair<Pair<String, Icon>, TreePathHandle>) value;
293
                    Pair<Pair<String, Icon>, TreePathHandle> selectedPair = (Pair<Pair<String, Icon>, TreePathHandle>) value;
294
                    setText(selectedPair.first.first);
294
                    setText(selectedPair.first().first());
295
                    setIcon(selectedPair.first.second);
295
                    setIcon(selectedPair.first().second());
296
                }
296
                }
297
            } else {
297
            } else {
298
                setText(null);
298
                setText(null);
(-)a/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/WhereUsedQueryUI.java (-1 / +1 lines)
Lines 64-70 Link Here
64
import org.netbeans.modules.refactoring.api.AbstractRefactoring;
64
import org.netbeans.modules.refactoring.api.AbstractRefactoring;
65
import org.netbeans.modules.refactoring.api.Scope;
65
import org.netbeans.modules.refactoring.api.Scope;
66
import org.netbeans.modules.refactoring.api.WhereUsedQuery;
66
import org.netbeans.modules.refactoring.api.WhereUsedQuery;
67
import org.netbeans.modules.refactoring.java.Pair;
68
import org.netbeans.modules.refactoring.java.RefactoringUtils;
67
import org.netbeans.modules.refactoring.java.RefactoringUtils;
69
import org.netbeans.modules.refactoring.java.api.JavaRefactoringUtils;
68
import org.netbeans.modules.refactoring.java.api.JavaRefactoringUtils;
70
import org.netbeans.modules.refactoring.java.api.WhereUsedQueryConstants;
69
import org.netbeans.modules.refactoring.java.api.WhereUsedQueryConstants;
Lines 73-78 Link Here
73
import org.openide.filesystems.FileObject;
72
import org.openide.filesystems.FileObject;
74
import org.openide.util.HelpCtx;
73
import org.openide.util.HelpCtx;
75
import org.openide.util.NbBundle;
74
import org.openide.util.NbBundle;
75
import org.openide.util.Pair;
76
import org.openide.util.lookup.Lookups;
76
import org.openide.util.lookup.Lookups;
77
77
78
/**
78
/**
(-)a/spellchecker.bindings.htmlxml/nbproject/project.xml (-8 / +8 lines)
Lines 66-71 Link Here
66
                    </run-dependency>
66
                    </run-dependency>
67
                </dependency>
67
                </dependency>
68
                <dependency>
68
                <dependency>
69
                    <code-name-base>org.openide.util</code-name-base>
70
                    <build-prerequisite/>
71
                    <compile-dependency/>
72
                    <run-dependency>
73
                        <specification-version>8.32</specification-version>
74
                    </run-dependency>
75
                </dependency>
76
                <dependency>
69
                    <code-name-base>org.openide.util.lookup</code-name-base>
77
                    <code-name-base>org.openide.util.lookup</code-name-base>
70
                    <build-prerequisite/>
78
                    <build-prerequisite/>
71
                    <compile-dependency/>
79
                    <compile-dependency/>
Lines 73-86 Link Here
73
                        <specification-version>8.16</specification-version>
81
                        <specification-version>8.16</specification-version>
74
                    </run-dependency>
82
                    </run-dependency>
75
                </dependency>
83
                </dependency>
76
                <dependency>
77
                    <code-name-base>org.openide.util</code-name-base>
78
                    <build-prerequisite/>
79
                    <compile-dependency/>
80
                    <run-dependency>
81
                        <specification-version>8.2</specification-version>
82
                    </run-dependency>
83
                </dependency>
84
            </module-dependencies>
84
            </module-dependencies>
85
            <public-packages/>
85
            <public-packages/>
86
        </data>
86
        </data>
(-)a/spellchecker.bindings.htmlxml/src/org/netbeans/modules/spellchecker/bindings/htmlxml/Pair.java (-46 lines)
Lines 1-46 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 1997-2010 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
 * Contributor(s):
28
 *
29
 * Portions Copyrighted 2007-2008 Sun Microsystems, Inc.
30
 */
31
package org.netbeans.modules.spellchecker.bindings.htmlxml;
32
33
/**
34
 *
35
 * @author Tor Norbye
36
 */
37
public class Pair<A,B> {
38
39
    A a;
40
    B b;
41
42
    public Pair(A a, B b) {
43
        this.a = a;
44
        this.b = b;
45
    }
46
}
(-)a/web.clientproject.api/manifest.mf (-1 / +1 lines)
Lines 1-5 Link Here
1
Manifest-Version: 1.0
1
Manifest-Version: 1.0
2
OpenIDE-Module: org.netbeans.modules.web.clientproject.api
2
OpenIDE-Module: org.netbeans.modules.web.clientproject.api
3
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/web/clientproject/api/Bundle.properties
3
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/web/clientproject/api/Bundle.properties
4
OpenIDE-Module-Specification-Version: 1.27
4
OpenIDE-Module-Specification-Version: 1.28
5
5
(-)a/web.clientproject.api/nbproject/project.xml (-2 / +2 lines)
Lines 90-96 Link Here
90
                    <build-prerequisite/>
90
                    <build-prerequisite/>
91
                    <compile-dependency/>
91
                    <compile-dependency/>
92
                    <run-dependency>
92
                    <run-dependency>
93
                        <specification-version>1.34</specification-version>
93
                        <specification-version>1.46</specification-version>
94
                    </run-dependency>
94
                    </run-dependency>
95
                </dependency>
95
                </dependency>
96
                <dependency>
96
                <dependency>
Lines 146-152 Link Here
146
                    <build-prerequisite/>
146
                    <build-prerequisite/>
147
                    <compile-dependency/>
147
                    <compile-dependency/>
148
                    <run-dependency>
148
                    <run-dependency>
149
                        <specification-version>8.26</specification-version>
149
                        <specification-version>8.32</specification-version>
150
                    </run-dependency>
150
                    </run-dependency>
151
                </dependency>
151
                </dependency>
152
                <dependency>
152
                <dependency>
(-)a/web.clientproject.api/src/org/netbeans/modules/web/clientproject/api/jslibs/JavaScriptLibraryCustomizerPanel.java (-1 / +1 lines)
Lines 73-79 Link Here
73
import org.netbeans.modules.web.clientproject.api.util.StringUtilities;
73
import org.netbeans.modules.web.clientproject.api.util.StringUtilities;
74
import org.netbeans.modules.web.clientproject.api.validation.FolderValidator;
74
import org.netbeans.modules.web.clientproject.api.validation.FolderValidator;
75
import org.netbeans.modules.web.clientproject.api.validation.ValidationResult;
75
import org.netbeans.modules.web.clientproject.api.validation.ValidationResult;
76
import org.netbeans.modules.web.common.api.Pair;
77
import org.netbeans.spi.project.ui.support.ProjectCustomizer;
76
import org.netbeans.spi.project.ui.support.ProjectCustomizer;
78
import org.openide.DialogDisplayer;
77
import org.openide.DialogDisplayer;
79
import org.openide.NotifyDescriptor;
78
import org.openide.NotifyDescriptor;
Lines 81-86 Link Here
81
import org.openide.filesystems.FileUtil;
80
import org.openide.filesystems.FileUtil;
82
import org.openide.util.HelpCtx;
81
import org.openide.util.HelpCtx;
83
import org.openide.util.NbBundle;
82
import org.openide.util.NbBundle;
83
import org.openide.util.Pair;
84
import org.openide.util.Parameters;
84
import org.openide.util.Parameters;
85
85
86
/**
86
/**
(-)a/web.clientproject.api/src/org/netbeans/modules/web/clientproject/api/jslibs/JavaScriptLibrarySelectionPanel.java (-3 / +3 lines)
Lines 96-108 Link Here
96
import org.netbeans.api.project.libraries.Library;
96
import org.netbeans.api.project.libraries.Library;
97
import org.netbeans.modules.web.clientproject.api.WebClientLibraryManager;
97
import org.netbeans.modules.web.clientproject.api.WebClientLibraryManager;
98
import org.netbeans.modules.web.clientproject.api.util.StringUtilities;
98
import org.netbeans.modules.web.clientproject.api.util.StringUtilities;
99
import org.netbeans.modules.web.common.api.Pair;
100
import org.netbeans.modules.web.common.api.Version;
99
import org.netbeans.modules.web.common.api.Version;
101
import org.openide.DialogDisplayer;
100
import org.openide.DialogDisplayer;
102
import org.openide.NotifyDescriptor;
101
import org.openide.NotifyDescriptor;
103
import org.openide.util.ChangeSupport;
102
import org.openide.util.ChangeSupport;
104
import org.openide.util.Mutex;
103
import org.openide.util.Mutex;
105
import org.openide.util.NbBundle;
104
import org.openide.util.NbBundle;
105
import org.openide.util.Pair;
106
import org.openide.util.Parameters;
106
import org.openide.util.Parameters;
107
import org.openide.util.RequestProcessor;
107
import org.openide.util.RequestProcessor;
108
import org.openide.util.WeakListeners;
108
import org.openide.util.WeakListeners;
Lines 566-573 Link Here
566
        Pair<Set<SelectedLibrary>, String> result = librariesValidator.validate(librariesFolder, newLibraries);
566
        Pair<Set<SelectedLibrary>, String> result = librariesValidator.validate(librariesFolder, newLibraries);
567
        // libraries
567
        // libraries
568
        invalidLibraries.clear();
568
        invalidLibraries.clear();
569
        invalidLibraries.addAll(result.getA());
569
        invalidLibraries.addAll(result.first());
570
        return result.getB();
570
        return result.second();
571
    }
571
    }
572
572
573
    private void fireSelectedLibrariesChangeInEDT() {
573
    private void fireSelectedLibrariesChangeInEDT() {
(-)a/web.clientproject.api/src/org/netbeans/modules/web/clientproject/api/network/NetworkSupport.java (-3 / +3 lines)
Lines 63-74 Link Here
63
import org.netbeans.api.progress.ProgressHandle;
63
import org.netbeans.api.progress.ProgressHandle;
64
import org.netbeans.api.progress.ProgressHandleFactory;
64
import org.netbeans.api.progress.ProgressHandleFactory;
65
import org.netbeans.modules.web.clientproject.api.network.ui.NetworkErrorPanel;
65
import org.netbeans.modules.web.clientproject.api.network.ui.NetworkErrorPanel;
66
import org.netbeans.modules.web.common.api.Pair;
67
import org.openide.DialogDescriptor;
66
import org.openide.DialogDescriptor;
68
import org.openide.DialogDisplayer;
67
import org.openide.DialogDisplayer;
69
import org.openide.NotifyDescriptor;
68
import org.openide.NotifyDescriptor;
70
import org.openide.util.Cancellable;
69
import org.openide.util.Cancellable;
71
import org.openide.util.NbBundle;
70
import org.openide.util.NbBundle;
71
import org.openide.util.Pair;
72
import org.openide.util.Parameters;
72
import org.openide.util.Parameters;
73
73
74
/**
74
/**
Lines 276-284 Link Here
276
        if (progressHandle != null) {
276
        if (progressHandle != null) {
277
            progressHandle.progress(Bundle.NetworkSupport_progress_download(url));
277
            progressHandle.progress(Bundle.NetworkSupport_progress_download(url));
278
        }
278
        }
279
        InputStream is = downloadSetup.getA();
279
        InputStream is = downloadSetup.first();
280
        try {
280
        try {
281
            copyToFile(is, target, progressHandle, downloadSetup.getB());
281
            copyToFile(is, target, progressHandle, downloadSetup.second());
282
        } catch (IOException ex) {
282
        } catch (IOException ex) {
283
            // error => ensure file is deleted
283
            // error => ensure file is deleted
284
            if (!target.delete()) {
284
            if (!target.delete()) {
(-)a/web.clientproject/manifest.mf (-1 / +1 lines)
Lines 3-6 Link Here
3
OpenIDE-Module: org.netbeans.modules.web.clientproject
3
OpenIDE-Module: org.netbeans.modules.web.clientproject
4
OpenIDE-Module-Layer: org/netbeans/modules/web/clientproject/resources/layer.xml
4
OpenIDE-Module-Layer: org/netbeans/modules/web/clientproject/resources/layer.xml
5
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/web/clientproject/Bundle.properties
5
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/web/clientproject/Bundle.properties
6
OpenIDE-Module-Specification-Version: 1.27
6
OpenIDE-Module-Specification-Version: 1.28
(-)a/web.clientproject/nbproject/project.xml (-3 / +3 lines)
Lines 133-139 Link Here
133
                    <build-prerequisite/>
133
                    <build-prerequisite/>
134
                    <compile-dependency/>
134
                    <compile-dependency/>
135
                    <run-dependency>
135
                    <run-dependency>
136
                        <specification-version>1.26</specification-version>
136
                        <specification-version>1.28</specification-version>
137
                    </run-dependency>
137
                    </run-dependency>
138
                </dependency>
138
                </dependency>
139
                <dependency>
139
                <dependency>
Lines 141-147 Link Here
141
                    <build-prerequisite/>
141
                    <build-prerequisite/>
142
                    <compile-dependency/>
142
                    <compile-dependency/>
143
                    <run-dependency>
143
                    <run-dependency>
144
                        <specification-version>1.45</specification-version>
144
                        <specification-version>1.46</specification-version>
145
                    </run-dependency>
145
                    </run-dependency>
146
                </dependency>
146
                </dependency>
147
                <dependency>
147
                <dependency>
Lines 213-219 Link Here
213
                    <build-prerequisite/>
213
                    <build-prerequisite/>
214
                    <compile-dependency/>
214
                    <compile-dependency/>
215
                    <run-dependency>
215
                    <run-dependency>
216
                        <specification-version>8.22</specification-version>
216
                        <specification-version>8.32</specification-version>
217
                    </run-dependency>
217
                    </run-dependency>
218
                </dependency>
218
                </dependency>
219
                <dependency>
219
                <dependency>
(-)a/web.clientproject/src/org/netbeans/modules/web/clientproject/ui/wizard/JavaScriptLibrarySelectionPanel.java (-1 / +1 lines)
Lines 63-75 Link Here
63
import org.netbeans.modules.web.clientproject.spi.SiteTemplateImplementation;
63
import org.netbeans.modules.web.clientproject.spi.SiteTemplateImplementation;
64
import org.netbeans.modules.web.clientproject.ui.customizer.ClientSideProjectProperties;
64
import org.netbeans.modules.web.clientproject.ui.customizer.ClientSideProjectProperties;
65
import org.netbeans.modules.web.clientproject.util.FileUtilities;
65
import org.netbeans.modules.web.clientproject.util.FileUtilities;
66
import org.netbeans.modules.web.common.api.Pair;
67
import org.openide.WizardDescriptor;
66
import org.openide.WizardDescriptor;
68
import org.openide.WizardValidationException;
67
import org.openide.WizardValidationException;
69
import org.openide.filesystems.FileObject;
68
import org.openide.filesystems.FileObject;
70
import org.openide.filesystems.FileUtil;
69
import org.openide.filesystems.FileUtil;
71
import org.openide.util.HelpCtx;
70
import org.openide.util.HelpCtx;
72
import org.openide.util.NbBundle;
71
import org.openide.util.NbBundle;
72
import org.openide.util.Pair;
73
73
74
public class JavaScriptLibrarySelectionPanel implements WizardDescriptor.AsynchronousValidatingPanel<WizardDescriptor>,
74
public class JavaScriptLibrarySelectionPanel implements WizardDescriptor.AsynchronousValidatingPanel<WizardDescriptor>,
75
        WizardDescriptor.FinishablePanel<WizardDescriptor> {
75
        WizardDescriptor.FinishablePanel<WizardDescriptor> {
(-)a/web.common/manifest.mf (-1 / +1 lines)
Lines 1-5 Link Here
1
Manifest-Version: 1.0
1
Manifest-Version: 1.0
2
OpenIDE-Module: org.netbeans.modules.web.common
2
OpenIDE-Module: org.netbeans.modules.web.common
3
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/web/common/Bundle.properties
3
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/web/common/Bundle.properties
4
OpenIDE-Module-Specification-Version: 1.45
4
OpenIDE-Module-Specification-Version: 1.46
5
5
(-)a/web.common/nbproject/project.xml (-1 / +1 lines)
Lines 146-152 Link Here
146
                    <build-prerequisite/>
146
                    <build-prerequisite/>
147
                    <compile-dependency/>
147
                    <compile-dependency/>
148
                    <run-dependency>
148
                    <run-dependency>
149
                        <specification-version>8.0</specification-version>
149
                        <specification-version>8.32</specification-version>
150
                    </run-dependency>
150
                    </run-dependency>
151
                </dependency>
151
                </dependency>
152
                <dependency>
152
                <dependency>
(-)a/web.common/src/org/netbeans/modules/web/common/api/Pair.java (-69 lines)
Lines 1-69 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2011 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 2011 Sun Microsystems, Inc.
41
 */
42
package org.netbeans.modules.web.common.api;
43
44
/**
45
 *
46
 * @author Jan Lahoda
47
 */
48
public final class Pair<A, B> {
49
50
    private final A a;
51
    private final B b;
52
53
    public Pair(A a, B b) {
54
        this.a = a;
55
        this.b = b;
56
    }
57
58
    public A getA() {
59
        return a;
60
    }
61
62
    public B getB() {
63
        return b;
64
    }
65
66
    public static <A,B> Pair<A,B> of(A a, B b) {
67
      return new Pair<A, B>(a, b);
68
    } 
69
}
(-)a/web.el/nbproject/project.xml (-1 / +1 lines)
Lines 295-301 Link Here
295
                    <build-prerequisite/>
295
                    <build-prerequisite/>
296
                    <compile-dependency/>
296
                    <compile-dependency/>
297
                    <run-dependency>
297
                    <run-dependency>
298
                        <specification-version>8.0</specification-version>
298
                        <specification-version>8.32</specification-version>
299
                    </run-dependency>
299
                    </run-dependency>
300
                </dependency>
300
                </dependency>
301
                <dependency>
301
                <dependency>
(-)a/web.el/src/org/netbeans/modules/web/el/ELOccurrencesFinder.java (-7 / +8 lines)
Lines 65-70 Link Here
65
import org.netbeans.modules.parsing.spi.SchedulerEvent;
65
import org.netbeans.modules.parsing.spi.SchedulerEvent;
66
import org.openide.filesystems.FileObject;
66
import org.openide.filesystems.FileObject;
67
import org.openide.util.Exceptions;
67
import org.openide.util.Exceptions;
68
import org.openide.util.Pair;
68
69
69
/**
70
/**
70
 * Occurrences finder for Expression Language.
71
 * Occurrences finder for Expression Language.
Lines 175-181 Link Here
175
        // the logic here is a bit strange, maybe should add new methods to ResourceBundles
176
        // the logic here is a bit strange, maybe should add new methods to ResourceBundles
176
        // for a more straightforward computation.
177
        // for a more straightforward computation.
177
        // first, check whether the current EL elements has keys
178
        // first, check whether the current EL elements has keys
178
        keys.addAll(resourceBundles.collectKeys(target.first.getNode()));
179
        keys.addAll(resourceBundles.collectKeys(target.first().getNode()));
179
        if (keys.isEmpty()) {
180
        if (keys.isEmpty()) {
180
            return Collections.emptyMap();
181
            return Collections.emptyMap();
181
        }
182
        }
Lines 183-189 Link Here
183
        // second, if yes, check whether it has a key matching to the node under the caret
184
        // second, if yes, check whether it has a key matching to the node under the caret
184
        boolean found = false;
185
        boolean found = false;
185
        for (Pair<AstIdentifier, Node> pair : keys) {
186
        for (Pair<AstIdentifier, Node> pair : keys) {
186
            if (pair.second.equals(target.second)) {
187
            if (pair.second().equals(target.second())) {
187
                found = true;
188
                found = true;
188
                break;
189
                break;
189
            }
190
            }
Lines 198-205 Link Here
198
                continue;
199
                continue;
199
            }
200
            }
200
            for (Pair<AstIdentifier, Node> candidate : resourceBundles.collectKeys(each.getNode())) {
201
            for (Pair<AstIdentifier, Node> candidate : resourceBundles.collectKeys(each.getNode())) {
201
                if (candidate.second.equals(target.second)) {
202
                if (candidate.second().equals(target.second())) {
202
                    OffsetRange range = each.getOriginalOffset(candidate.second);
203
                    OffsetRange range = each.getOriginalOffset(candidate.second());
203
                    result.put(range, ColoringAttributes.MARK_OCCURRENCES);
204
                    result.put(range, ColoringAttributes.MARK_OCCURRENCES);
204
                }
205
                }
205
            }
206
            }
Lines 208-223 Link Here
208
    }
209
    }
209
210
210
    private Map<OffsetRange, ColoringAttributes> findMatchingTypes(CompilationContext info, ELParserResult parserResult, Pair<ELElement,Node> target, List<Pair<ELElement,Node>> candidates) {
211
    private Map<OffsetRange, ColoringAttributes> findMatchingTypes(CompilationContext info, ELParserResult parserResult, Pair<ELElement,Node> target, List<Pair<ELElement,Node>> candidates) {
211
        Element targetType = ELTypeUtilities.resolveElement(info, target.first, target.second);
212
        Element targetType = ELTypeUtilities.resolveElement(info, target.first(), target.second());
212
        Map<OffsetRange, ColoringAttributes>  result = new HashMap<OffsetRange, ColoringAttributes>();
213
        Map<OffsetRange, ColoringAttributes>  result = new HashMap<OffsetRange, ColoringAttributes>();
213
214
214
        for (Pair<ELElement,Node> candidate : candidates) {
215
        for (Pair<ELElement,Node> candidate : candidates) {
215
            if (checkAndResetCancel()) {
216
            if (checkAndResetCancel()) {
216
                return result;
217
                return result;
217
            }
218
            }
218
            Element type = ELTypeUtilities.resolveElement(info, candidate.first, candidate.second);
219
            Element type = ELTypeUtilities.resolveElement(info, candidate.first(), candidate.second());
219
            if (type != null && type.equals(targetType)) {
220
            if (type != null && type.equals(targetType)) {
220
                OffsetRange range = candidate.first.getOriginalOffset(candidate.second);
221
                OffsetRange range = candidate.first().getOriginalOffset(candidate.second());
221
                result.put(range, ColoringAttributes.MARK_OCCURRENCES);
222
                result.put(range, ColoringAttributes.MARK_OCCURRENCES);
222
            }
223
            }
223
        }
224
        }
(-)a/web.el/src/org/netbeans/modules/web/el/Pair.java (-94 lines)
Lines 1-94 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2010 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 2010 Sun Microsystems, Inc.
41
 */
42
43
package org.netbeans.modules.web.el;
44
45
/**
46
 *
47
 * @author Erno Mononen
48
 */
49
public final class Pair<P, K> {
50
51
    public final P first;
52
    public final K second;
53
54
    private Pair(P first, K second) {
55
        this.first = first;
56
        this.second = second;
57
    }
58
59
    public static <P, K> Pair<P, K> of(P first, K second) {
60
        return new Pair<P, K>(first, second);
61
    }
62
63
    @Override
64
    public boolean equals(Object obj) {
65
        if (obj == null) {
66
            return false;
67
        }
68
        if (getClass() != obj.getClass()) {
69
            return false;
70
        }
71
        final Pair<P, K> other = (Pair<P, K>) obj;
72
        if (this.first != other.first && (this.first == null || !this.first.equals(other.first))) {
73
            return false;
74
        }
75
        if (this.second != other.second && (this.second == null || !this.second.equals(other.second))) {
76
            return false;
77
        }
78
        return true;
79
    }
80
81
    @Override
82
    public int hashCode() {
83
        int hash = 7;
84
        hash = 83 * hash + (this.first != null ? this.first.hashCode() : 0);
85
        hash = 83 * hash + (this.second != null ? this.second.hashCode() : 0);
86
        return hash;
87
    }
88
89
    @Override
90
    public String toString() {
91
        return "Pair{" + "first=" + first + "second=" + second + '}';
92
    }
93
94
}
(-)a/web.el/src/org/netbeans/modules/web/el/ResourceBundles.java (+1 lines)
Lines 61-66 Link Here
61
import org.netbeans.modules.web.el.spi.ResourceBundle;
61
import org.netbeans.modules.web.el.spi.ResourceBundle;
62
import org.netbeans.spi.java.classpath.ClassPathProvider;
62
import org.netbeans.spi.java.classpath.ClassPathProvider;
63
import org.openide.filesystems.*;
63
import org.openide.filesystems.*;
64
import org.openide.util.Pair;
64
import org.openide.util.Parameters;
65
import org.openide.util.Parameters;
65
import org.openide.util.WeakListeners;
66
import org.openide.util.WeakListeners;
66
67
(-)a/web.el/src/org/netbeans/modules/web/el/completion/ELSanitizer.java (-4 / +4 lines)
Lines 49-55 Link Here
49
import org.netbeans.modules.web.el.ELElement;
49
import org.netbeans.modules.web.el.ELElement;
50
import org.netbeans.modules.web.el.ELParser;
50
import org.netbeans.modules.web.el.ELParser;
51
import org.netbeans.modules.web.el.ELPreprocessor;
51
import org.netbeans.modules.web.el.ELPreprocessor;
52
import org.netbeans.modules.web.el.Pair;
52
import org.openide.util.Pair;
53
53
54
/**
54
/**
55
 * Attempts to sanitize EL statements. Check the unit test
55
 * Attempts to sanitize EL statements. Check the unit test
Lines 146-154 Link Here
146
            }
146
            }
147
            // special handling for brackets
147
            // special handling for brackets
148
            for (Pair<ELTokenId, ELTokenId> bracket : BRACKETS) {
148
            for (Pair<ELTokenId, ELTokenId> bracket : BRACKETS) {
149
                if (expression.endsWith(bracket.first.fixedText())) {
149
                if (expression.endsWith(bracket.first().fixedText())) {
150
                    return expression + bracket.second.fixedText();
150
                    return expression + bracket.second().fixedText();
151
                } else if (expression.endsWith(bracket.second.fixedText())) {
151
                } else if (expression.endsWith(bracket.second().fixedText())) {
152
                    return expression;
152
                    return expression;
153
                }
153
                }
154
            }
154
            }
(-)a/web.el/src/org/netbeans/modules/web/el/hints/ResourceBundleKeys.java (-4 / +4 lines)
Lines 52-61 Link Here
52
import org.netbeans.modules.web.el.CompilationContext;
52
import org.netbeans.modules.web.el.CompilationContext;
53
import org.netbeans.modules.web.el.ELElement;
53
import org.netbeans.modules.web.el.ELElement;
54
import org.netbeans.modules.web.el.ELParserResult;
54
import org.netbeans.modules.web.el.ELParserResult;
55
import org.netbeans.modules.web.el.Pair;
56
import org.netbeans.modules.web.el.ResourceBundles;
55
import org.netbeans.modules.web.el.ResourceBundles;
57
import org.openide.filesystems.FileObject;
56
import org.openide.filesystems.FileObject;
58
import org.openide.util.NbBundle;
57
import org.openide.util.NbBundle;
58
import org.openide.util.Pair;
59
59
60
/**
60
/**
61
 * Hint for checking unknown resource bundle keys.
61
 * Hint for checking unknown resource bundle keys.
Lines 95-106 Link Here
95
                continue;
95
                continue;
96
            }
96
            }
97
            for (Pair<AstIdentifier, Node> pair : resourceBundles.collectKeys(each.getNode(), info.context())) {
97
            for (Pair<AstIdentifier, Node> pair : resourceBundles.collectKeys(each.getNode(), info.context())) {
98
                String clearedKey = pair.second.getImage().replace("'", "").replace("\"", "");
98
                String clearedKey = pair.second().getImage().replace("'", "").replace("\"", "");
99
                if (!resourceBundles.isValidKey(pair.first.getImage(), clearedKey)) {
99
                if (!resourceBundles.isValidKey(pair.first().getImage(), clearedKey)) {
100
                    Hint hint = new Hint(this,
100
                    Hint hint = new Hint(this,
101
                            NbBundle.getMessage(ResourceBundleKeys.class, "ResourceBundleKeys_Unknown", clearedKey),
101
                            NbBundle.getMessage(ResourceBundleKeys.class, "ResourceBundleKeys_Unknown", clearedKey),
102
                            elResult.getFileObject(),
102
                            elResult.getFileObject(),
103
                            each.getOriginalOffset(pair.second),
103
                            each.getOriginalOffset(pair.second()),
104
                            Collections.<HintFix>emptyList(), 200);
104
                            Collections.<HintFix>emptyList(), 200);
105
                    result.add(hint);
105
                    result.add(hint);
106
                }
106
                }
(-)a/web.el/src/org/netbeans/modules/web/el/navigation/ELDeclarationFinder.java (-2 / +2 lines)
Lines 63-71 Link Here
63
import org.netbeans.modules.web.el.CompilationContext;
63
import org.netbeans.modules.web.el.CompilationContext;
64
import org.netbeans.modules.web.el.ELElement;
64
import org.netbeans.modules.web.el.ELElement;
65
import org.netbeans.modules.web.el.ELTypeUtilities;
65
import org.netbeans.modules.web.el.ELTypeUtilities;
66
import org.netbeans.modules.web.el.Pair;
67
import org.openide.filesystems.FileObject;
66
import org.openide.filesystems.FileObject;
68
import org.openide.util.Exceptions;
67
import org.openide.util.Exceptions;
68
import org.openide.util.Pair;
69
69
70
/**
70
/**
71
 * Simple DeclarationFinder based on the ELHyperlinkProvider code.
71
 * Simple DeclarationFinder based on the ELHyperlinkProvider code.
Lines 90-96 Link Here
90
                public void run(CompilationController cc) throws Exception {
90
                public void run(CompilationController cc) throws Exception {
91
                    cc.toPhase(JavaSource.Phase.RESOLVED);
91
                    cc.toPhase(JavaSource.Phase.RESOLVED);
92
                    CompilationContext context = CompilationContext.create(file, cc);
92
                    CompilationContext context = CompilationContext.create(file, cc);
93
                    Element javaElement = ELTypeUtilities.resolveElement(context, nodeElem.second, nodeElem.first);
93
                    Element javaElement = ELTypeUtilities.resolveElement(context, nodeElem.second(), nodeElem.first());
94
                    if (javaElement != null) {
94
                    if (javaElement != null) {
95
                        refs.handle = ElementHandle.<Element>create(javaElement);
95
                        refs.handle = ElementHandle.<Element>create(javaElement);
96
                        refs.fo = SourceUtils.getFile(refs.handle, cp);
96
                        refs.fo = SourceUtils.getFile(refs.handle, cp);
(-)a/web.el/src/org/netbeans/modules/web/el/navigation/ELHyperlinkProvider.java (-11 / +11 lines)
Lines 93-103 Link Here
93
import org.netbeans.modules.web.el.ELLanguage;
93
import org.netbeans.modules.web.el.ELLanguage;
94
import org.netbeans.modules.web.el.ELParserResult;
94
import org.netbeans.modules.web.el.ELParserResult;
95
import org.netbeans.modules.web.el.ELTypeUtilities;
95
import org.netbeans.modules.web.el.ELTypeUtilities;
96
import org.netbeans.modules.web.el.Pair;
97
import org.netbeans.modules.web.el.ResourceBundles;
96
import org.netbeans.modules.web.el.ResourceBundles;
98
import org.openide.filesystems.FileObject;
97
import org.openide.filesystems.FileObject;
99
import org.openide.util.Exceptions;
98
import org.openide.util.Exceptions;
100
import org.openide.util.NbBundle;
99
import org.openide.util.NbBundle;
100
import org.openide.util.Pair;
101
101
102
/**
102
/**
103
 * Go to declaration for Expression Language.
103
 * Go to declaration for Expression Language.
Lines 153-159 Link Here
153
    public String getTooltipText(Document doc, int offset, HyperlinkType type) {
153
    public String getTooltipText(Document doc, int offset, HyperlinkType type) {
154
        Pair<Node, ELElement> nodeAndElement = resolveNodeAndElement(doc, offset, new AtomicBoolean());
154
        Pair<Node, ELElement> nodeAndElement = resolveNodeAndElement(doc, offset, new AtomicBoolean());
155
        if (nodeAndElement != null) {
155
        if (nodeAndElement != null) {
156
            if (nodeAndElement.first instanceof AstString) {
156
            if (nodeAndElement.first() instanceof AstString) {
157
                // could be a resource bundle key
157
                // could be a resource bundle key
158
                return getTooltipTextForBundleKey(nodeAndElement);
158
                return getTooltipTextForBundleKey(nodeAndElement);
159
            } else {
159
            } else {
Lines 165-171 Link Here
165
165
166
    private String getTooltipTextForElement(final Pair<Node, ELElement> pair) {
166
    private String getTooltipTextForElement(final Pair<Node, ELElement> pair) {
167
        final String[] result = new String[1];
167
        final String[] result = new String[1];
168
        final FileObject file = pair.second.getSnapshot().getSource().getFileObject();
168
        final FileObject file = pair.second().getSnapshot().getSource().getFileObject();
169
        ClasspathInfo cp = ClasspathInfo.create(file);
169
        ClasspathInfo cp = ClasspathInfo.create(file);
170
        try {
170
        try {
171
            JavaSource.create(cp, file).runUserActionTask(new Task<CompilationController>() {
171
            JavaSource.create(cp, file).runUserActionTask(new Task<CompilationController>() {
Lines 173-179 Link Here
173
                @Override
173
                @Override
174
                public void run(CompilationController cc) throws Exception {
174
                public void run(CompilationController cc) throws Exception {
175
                    cc.toPhase(JavaSource.Phase.RESOLVED);
175
                    cc.toPhase(JavaSource.Phase.RESOLVED);
176
                    final Element resolvedElement = ELTypeUtilities.resolveElement(CompilationContext.create(file, cc), pair.second, pair.first);
176
                    final Element resolvedElement = ELTypeUtilities.resolveElement(CompilationContext.create(file, cc), pair.second(), pair.first());
177
                    if (resolvedElement == null) {
177
                    if (resolvedElement == null) {
178
                        return;
178
                        return;
179
                    }
179
                    }
Lines 190-206 Link Here
190
    }
190
    }
191
    
191
    
192
    private String getTooltipTextForBundleKey(Pair<Node, ELElement> pair) {
192
    private String getTooltipTextForBundleKey(Pair<Node, ELElement> pair) {
193
        FileObject context = pair.second.getSnapshot().getSource().getFileObject();
193
        FileObject context = pair.second().getSnapshot().getSource().getFileObject();
194
        ResourceBundles resourceBundles = ResourceBundles.get(context);
194
        ResourceBundles resourceBundles = ResourceBundles.get(context);
195
        if (!resourceBundles.canHaveBundles()) {
195
        if (!resourceBundles.canHaveBundles()) {
196
            return null;
196
            return null;
197
        }
197
        }
198
        for (Pair<AstIdentifier, Node> each : resourceBundles.collectKeys(pair.second.getNode())) {
198
        for (Pair<AstIdentifier, Node> each : resourceBundles.collectKeys(pair.second().getNode())) {
199
            if (each.second.equals(pair.first)) {
199
            if (each.second().equals(pair.first())) {
200
                StringBuilder result = new StringBuilder();
200
                StringBuilder result = new StringBuilder();
201
                String key = each.second.getImage();
201
                String key = each.second().getImage();
202
                String value = resourceBundles.getValue(each.first.getImage(), each.second.getImage());
202
                String value = resourceBundles.getValue(each.first().getImage(), each.second().getImage());
203
                String bundle = each.first.getImage();
203
                String bundle = each.first().getImage();
204
                result.append("<html><body>")
204
                result.append("<html><body>")
205
                        /* displaying the bundle in the tooltip looks a bit strange,
205
                        /* displaying the bundle in the tooltip looks a bit strange,
206
                          so commented out for now - maybe using a smaller font would
206
                          so commented out for now - maybe using a smaller font would
Lines 273-279 Link Here
273
                @Override
273
                @Override
274
                public void run(CompilationController cc) throws Exception {
274
                public void run(CompilationController cc) throws Exception {
275
                    cc.toPhase(JavaSource.Phase.RESOLVED);
275
                    cc.toPhase(JavaSource.Phase.RESOLVED);
276
                    Element javaElement = ELTypeUtilities.resolveElement(CompilationContext.create(file, cc), nodeElem.second, nodeElem.first);
276
                    Element javaElement = ELTypeUtilities.resolveElement(CompilationContext.create(file, cc), nodeElem.second(), nodeElem.first());
277
                    if(javaElement != null) {
277
                    if(javaElement != null) {
278
                        handleRef.set(ElementHandle.create(javaElement));
278
                        handleRef.set(ElementHandle.create(javaElement));
279
                    }
279
                    }
(-)a/web.project/nbproject/project.properties (-1 / +1 lines)
Lines 56-62 Link Here
56
javac.compilerargs=-Xlint:unchecked
56
javac.compilerargs=-Xlint:unchecked
57
javadoc.arch=${basedir}/arch.xml
57
javadoc.arch=${basedir}/arch.xml
58
58
59
spec.version.base=1.46.0
59
spec.version.base=1.47.0
60
60
61
# needed for the TestUtil class
61
# needed for the TestUtil class
62
test.unit.cp.extra=
62
test.unit.cp.extra=
(-)a/web.project/nbproject/project.xml (-1 / +1 lines)
Lines 348-354 Link Here
348
                    <build-prerequisite/>
348
                    <build-prerequisite/>
349
                    <compile-dependency/>
349
                    <compile-dependency/>
350
                    <run-dependency>
350
                    <run-dependency>
351
                        <specification-version>1.18</specification-version>
351
                        <specification-version>1.28</specification-version>
352
                    </run-dependency>
352
                    </run-dependency>
353
                </dependency>
353
                </dependency>
354
                <dependency>
354
                <dependency>

Return to bug 228994