Lines 42-49
Link Here
|
42 |
package org.netbeans.modules.editor.completion; |
42 |
package org.netbeans.modules.editor.completion; |
43 |
|
43 |
|
44 |
import java.awt.Dimension; |
44 |
import java.awt.Dimension; |
45 |
import java.lang.ref.Reference; |
|
|
46 |
import java.lang.ref.SoftReference; |
47 |
import java.util.Arrays; |
45 |
import java.util.Arrays; |
48 |
import java.util.HashSet; |
46 |
import java.util.HashSet; |
49 |
import java.util.Set; |
47 |
import java.util.Set; |
Lines 72-83
Link Here
|
72 |
// ----------------------------------------------------------------------- |
70 |
// ----------------------------------------------------------------------- |
73 |
// public implementation |
71 |
// public implementation |
74 |
// ----------------------------------------------------------------------- |
72 |
// ----------------------------------------------------------------------- |
|
|
73 |
public static CompletionSettings instance; |
75 |
|
74 |
|
76 |
public static synchronized CompletionSettings getInstance() { |
75 |
public static synchronized CompletionSettings getInstance() { |
77 |
CompletionSettings instance = ref == null ? null : ref.get(); |
|
|
78 |
if (instance == null) { |
76 |
if (instance == null) { |
79 |
instance = new CompletionSettings(); |
77 |
instance = new CompletionSettings(); |
80 |
ref = new SoftReference<CompletionSettings>(instance); |
|
|
81 |
} |
78 |
} |
82 |
return instance; |
79 |
return instance; |
83 |
} |
80 |
} |
Lines 177-184
Link Here
|
177 |
SimpleValueNames.JAVADOC_PREFERRED_SIZE, |
174 |
SimpleValueNames.JAVADOC_PREFERRED_SIZE, |
178 |
})); |
175 |
})); |
179 |
|
176 |
|
180 |
private static Reference<CompletionSettings> ref = null; |
|
|
181 |
|
182 |
private Preferences preferences = null; |
177 |
private Preferences preferences = null; |
183 |
private PreferenceChangeListener weakListener = null; |
178 |
private PreferenceChangeListener weakListener = null; |
184 |
|
179 |
|