Lines 74-79
Link Here
|
74 |
import javax.swing.JFileChooser; |
74 |
import javax.swing.JFileChooser; |
75 |
import javax.swing.SwingUtilities; |
75 |
import javax.swing.SwingUtilities; |
76 |
import javax.swing.filechooser.FileSystemView; |
76 |
import javax.swing.filechooser.FileSystemView; |
|
|
77 |
import org.openide.filesystems.FileSystem.AtomicAction; |
77 |
import org.openide.util.Exceptions; |
78 |
import org.openide.util.Exceptions; |
78 |
import org.openide.util.Lookup; |
79 |
import org.openide.util.Lookup; |
79 |
import org.openide.util.NbBundle; |
80 |
import org.openide.util.NbBundle; |
Lines 125-130
Link Here
|
125 |
} |
126 |
} |
126 |
|
127 |
|
127 |
/** |
128 |
/** |
|
|
129 |
* Executes atomic action. For more info see {@link FileSystem#runAtomicAction}. |
130 |
* <p> |
131 |
* All events about filesystem changes (related to events on all affected instances of <code>FileSystem</code>) |
132 |
* are postponed after the whole <code>atomicCode</code> |
133 |
* is executed. |
134 |
* </p> |
135 |
* @param atomicCode code that is supposed to be run as atomic action. See {@link FileSystem#runAtomicAction} |
136 |
* @throws java.io.IOException |
137 |
* @since 7.5 |
138 |
*/ |
139 |
public static final void runAtomicAction(final AtomicAction atomicCode) throws IOException { |
140 |
Repository.getDefault().getDefaultFileSystem().runAtomicAction(atomicCode); |
141 |
} |
142 |
|
143 |
/** |
144 |
* Executes atomic action. For more info see {@link FileSystem#runAtomicAction}. |
145 |
* <p> |
146 |
* All events about filesystem changes (related to events on all affected instances of <code>FileSystem</code>) |
147 |
* are postponed after the whole <code>atomicCode</code> |
148 |
* is executed. |
149 |
* </p> |
150 |
* @param atomicCode code that is supposed to be run as atomic action. See {@link FileSystem#runAtomicAction} |
151 |
* @since 7.5 |
152 |
*/ |
153 |
public static final void runAtomicAction(final Runnable atomicCode) { |
154 |
final AtomicAction action = new FileSystem.AtomicAction() { |
155 |
public void run() throws IOException { |
156 |
atomicCode.run(); |
157 |
} |
158 |
}; |
159 |
try { |
160 |
FileUtil.runAtomicAction(action); |
161 |
} catch (IOException ex) { |
162 |
Exceptions.printStackTrace(ex); |
163 |
} |
164 |
} |
165 |
/** |
128 |
* Returns FileObject for a folder. |
166 |
* Returns FileObject for a folder. |
129 |
* If such a folder does not exist then it is created, including any necessary but nonexistent parent |
167 |
* If such a folder does not exist then it is created, including any necessary but nonexistent parent |
130 |
* folders. Note that if this operation fails it may have succeeded in creating some of the necessary |
168 |
* folders. Note that if this operation fails it may have succeeded in creating some of the necessary |