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

(-)a/openide.loaders/src/org/openide/text/DataEditorSupport.java (-2 / +36 lines)
Lines 121-132 Link Here
121
public class DataEditorSupport extends CloneableEditorSupport {
121
public class DataEditorSupport extends CloneableEditorSupport {
122
    /** error manager for CloneableEditorSupport logging and error reporting */
122
    /** error manager for CloneableEditorSupport logging and error reporting */
123
    static final Logger ERR = Logger.getLogger("org.openide.text.DataEditorSupport"); // NOI18N
123
    static final Logger ERR = Logger.getLogger("org.openide.text.DataEditorSupport"); // NOI18N
124
    private static final RequestProcessor RP = new RequestProcessor(DataEditorSupport.class);
124
125
125
    /** Which data object we are associated with */
126
    /** Which data object we are associated with */
126
    private final DataObject obj;
127
    private final DataObject obj;
127
    /** listener to associated node's events */
128
    /** listener to associated node's events */
128
    private NodeListener nodeL;
129
    private NodeListener nodeL;
129
130
131
    private volatile boolean fileWritable = true;
132
    private volatile boolean checkFileWritable = true;
133
130
    /** Editor support for a given data object. The file is taken from the
134
    /** Editor support for a given data object. The file is taken from the
131
    * data object and is updated if the object moves or renames itself.
135
    * data object and is updated if the object moves or renames itself.
132
    * @param obj object to work with
136
    * @param obj object to work with
Lines 327-335 Link Here
327
            }
331
            }
328
        }
332
        }
329
333
330
        return annotateName(name, true, isModified(), !obj.getPrimaryFile().canWrite());
334
        String res = annotateName(name, true, isModified(), fileWritable);
335
        if (checkFileWritable) {
336
            checkWritableLater();
337
        } else {
338
            checkFileWritable = true; // Just computed, check it the next time.
339
        }
340
        return res;
331
    }
341
    }
332
        
342
343
    /**
344
     * Check that correct "writable" status was used. If not, fix the status and
345
     * update the titles. See bug 227452.
346
     */
347
    private void checkWritableLater() {
348
        RP.post(new Runnable() {
349
            @Override
350
            public void run() {
351
                boolean newValue = !obj.getPrimaryFile().canWrite();
352
                if (fileWritable != newValue) {
353
                    fileWritable = newValue;
354
                    checkFileWritable = false;
355
                    EventQueue.invokeLater(new Runnable() {
356
357
                        @Override
358
                        public void run() {
359
                            callUpdateTitles();
360
                        }
361
                    });
362
                }
363
            }
364
        });
365
    }
366
333
    @Override
367
    @Override
334
    protected String documentID() {
368
    protected String documentID() {
335
        if (! obj.isValid()) {
369
        if (! obj.isValid()) {

Return to bug 227452