Lines 57-64
Link Here
|
57 |
import java.io.ObjectInput; |
57 |
import java.io.ObjectInput; |
58 |
import java.io.ObjectOutput; |
58 |
import java.io.ObjectOutput; |
59 |
import java.io.Serializable; |
59 |
import java.io.Serializable; |
|
|
60 |
import java.util.ArrayList; |
60 |
import java.util.Enumeration; |
61 |
import java.util.Enumeration; |
|
|
62 |
import java.util.HashMap; |
61 |
import java.util.Iterator; |
63 |
import java.util.Iterator; |
|
|
64 |
import java.util.List; |
62 |
import javax.swing.Action; |
65 |
import javax.swing.Action; |
63 |
import javax.swing.event.ChangeListener; |
66 |
import javax.swing.event.ChangeListener; |
64 |
import javax.swing.JPanel; |
67 |
import javax.swing.JPanel; |
Lines 91-97
Link Here
|
91 |
import org.openide.util.actions.SystemAction; |
94 |
import org.openide.util.actions.SystemAction; |
92 |
import org.openide.windows.CloneableOpenSupport; |
95 |
import org.openide.windows.CloneableOpenSupport; |
93 |
import org.openide.windows.CloneableTopComponent; |
96 |
import org.openide.windows.CloneableTopComponent; |
94 |
import org.openide.util.Utilities; |
|
|
95 |
import org.openide.DialogDescriptor; |
97 |
import org.openide.DialogDescriptor; |
96 |
import org.openide.filesystems.FileUtil; |
98 |
import org.openide.filesystems.FileUtil; |
97 |
|
99 |
|
Lines 105-112
Link Here
|
105 |
implements OpenCookie, CloseCookie { |
107 |
implements OpenCookie, CloseCookie { |
106 |
|
108 |
|
107 |
/** Main properties dataobject */ |
109 |
/** Main properties dataobject */ |
|
|
110 |
@Deprecated |
108 |
PropertiesDataObject propDataObject; |
111 |
PropertiesDataObject propDataObject; |
109 |
|
112 |
|
|
|
113 |
|
114 |
private List<PropertiesDataObject> dataObjectList; |
115 |
|
116 |
private BundleStructure bundleStructure; |
110 |
/** Listener for modificationc on dataobject, adding and removing save cookie */ |
117 |
/** Listener for modificationc on dataobject, adding and removing save cookie */ |
111 |
PropertyChangeListener modifL; |
118 |
PropertyChangeListener modifL; |
112 |
|
119 |
|
Lines 118-133
Link Here
|
118 |
|
125 |
|
119 |
|
126 |
|
120 |
/** Constructor */ |
127 |
/** Constructor */ |
|
|
128 |
@Deprecated |
121 |
public PropertiesOpen(PropertiesDataObject propDataObject) { |
129 |
public PropertiesOpen(PropertiesDataObject propDataObject) { |
122 |
super(new Environment(propDataObject)); |
130 |
super(new Environment(propDataObject)); |
123 |
|
131 |
|
124 |
this.propDataObject = propDataObject; |
132 |
this.propDataObject = propDataObject; |
125 |
|
133 |
|
126 |
this.propDataObject.addPropertyChangeListener(WeakListeners.propertyChange(modifL = |
134 |
//PENDING Add Listeners for all DataObject from this OpenSupport |
|
|
135 |
this.propDataObject.addPropertyChangeListener(WeakListeners.propertyChange(modifL = |
127 |
new ModifiedListener(), this.propDataObject)); |
136 |
new ModifiedListener(), this.propDataObject)); |
128 |
} |
137 |
} |
129 |
|
138 |
|
|
|
139 |
public PropertiesOpen(BundleStructure structure) { |
140 |
super(new Environment(structure)); |
130 |
|
141 |
|
|
|
142 |
this.bundleStructure = structure; |
143 |
addModifiedListeners(); |
144 |
} |
145 |
|
146 |
private void addModifiedListeners() { |
147 |
BundleStructure structure = bundleStructure; |
148 |
dataObjectList = new ArrayList<PropertiesDataObject>(); |
149 |
PropertiesDataObject dataObject; |
150 |
modifL = new ModifiedListener(); |
151 |
for (int i=0;i<structure.getEntryCount();i++) { |
152 |
dataObject = (PropertiesDataObject) structure.getNthEntry(i).getDataObject(); |
153 |
dataObject.addPropertyChangeListener(WeakListeners.propertyChange(modifL, dataObject)); |
154 |
dataObjectList.add(dataObject); |
155 |
} |
156 |
} |
157 |
|
158 |
protected void addDataObject(PropertiesDataObject dataObject) { |
159 |
dataObject.removePropertyChangeListener(WeakListeners.propertyChange(modifL, dataObject)); |
160 |
dataObject.addPropertyChangeListener(WeakListeners.propertyChange(modifL, dataObject)); |
161 |
env = new Environment(bundleStructure); |
162 |
PropertiesCloneableTopComponent topComp = (PropertiesCloneableTopComponent) allEditors.getArbitraryComponent(); |
163 |
if (topComp != null) { |
164 |
topComp.dataObjectAdded(dataObject); |
165 |
} |
166 |
dataObjectList.add(dataObject); |
167 |
} |
131 |
/** |
168 |
/** |
132 |
* Tests whether all data is saved, and if not, prompts the user to save. |
169 |
* Tests whether all data is saved, and if not, prompts the user to save. |
133 |
* |
170 |
* |
Lines 135-142
Link Here
|
135 |
*/ |
172 |
*/ |
136 |
@Override |
173 |
@Override |
137 |
protected boolean canClose() { |
174 |
protected boolean canClose() { |
138 |
SaveCookie saveCookie = propDataObject.getCookie(SaveCookie.class); |
175 |
PropertiesDataObject dataObject; |
139 |
if (saveCookie == null) { |
176 |
SaveCookie saveCookie = null; |
|
|
177 |
HashMap<SaveCookie,PropertiesDataObject> map = new HashMap<SaveCookie,PropertiesDataObject>(); |
178 |
for (int i=0;i<bundleStructure.getEntryCount();i++) { |
179 |
dataObject = (PropertiesDataObject) bundleStructure.getNthEntry(i).getDataObject(); |
180 |
saveCookie = dataObject.getCookie(SaveCookie.class); |
181 |
//Need to find all saveCookie |
182 |
if (saveCookie != null) map.put(saveCookie, dataObject); |
183 |
} |
184 |
if (map.isEmpty()) { |
140 |
return true; |
185 |
return true; |
141 |
} |
186 |
} |
142 |
stopEditing(); |
187 |
stopEditing(); |
Lines 149-155
Link Here
|
149 |
"CTL_Question"); //NOI18N |
194 |
"CTL_Question"); //NOI18N |
150 |
String question = NbBundle.getMessage(PropertiesOpen.class, |
195 |
String question = NbBundle.getMessage(PropertiesOpen.class, |
151 |
"MSG_SaveFile", //NOI18N |
196 |
"MSG_SaveFile", //NOI18N |
152 |
propDataObject.getName()); |
197 |
bundleStructure.getNthEntry(0).getName()); |
153 |
String optionSave = NbBundle.getMessage(PropertiesOpen.class, |
198 |
String optionSave = NbBundle.getMessage(PropertiesOpen.class, |
154 |
"CTL_Save"); //NOI18N |
199 |
"CTL_Save"); //NOI18N |
155 |
String optionDiscard = NbBundle.getMessage(PropertiesOpen.class, |
200 |
String optionDiscard = NbBundle.getMessage(PropertiesOpen.class, |
Lines 171-185
Link Here
|
171 |
/* Save the file if the answer was "Save": */ |
216 |
/* Save the file if the answer was "Save": */ |
172 |
if (answer == optionSave) { |
217 |
if (answer == optionSave) { |
173 |
try { |
218 |
try { |
174 |
saveCookie.save(); |
219 |
for (SaveCookie save : map.keySet()) { |
175 |
propDataObject.updateModificationStatus(); |
220 |
save.save(); |
|
|
221 |
map.get(save).updateModificationStatus(); |
222 |
} |
176 |
} |
223 |
} |
177 |
catch (IOException e) { |
224 |
catch (IOException e) { |
178 |
ErrorManager.getDefault().notify(e); |
225 |
ErrorManager.getDefault().notify(e); |
179 |
return false; |
226 |
return false; |
180 |
} |
227 |
} |
181 |
} |
228 |
} |
182 |
propDataObject.updateModificationStatus(); |
229 |
dataObject = null; |
|
|
230 |
for (int i=0;i<bundleStructure.getEntryCount();i++) { |
231 |
dataObject = (PropertiesDataObject) bundleStructure.getNthEntry(i).getDataObject(); |
232 |
dataObject.updateModificationStatus(); |
233 |
} |
183 |
|
234 |
|
184 |
return (answer == optionSave || answer == optionDiscard); |
235 |
return (answer == optionSave || answer == optionDiscard); |
185 |
} |
236 |
} |
Lines 215-221
Link Here
|
215 |
* @return the cloneable top component for this support |
266 |
* @return the cloneable top component for this support |
216 |
*/ |
267 |
*/ |
217 |
protected CloneableTopComponent createCloneableTopComponent() { |
268 |
protected CloneableTopComponent createCloneableTopComponent() { |
218 |
return new PropertiesCloneableTopComponent(propDataObject); |
269 |
// return new PropertiesCloneableTopComponent(propDataObject); |
|
|
270 |
return new PropertiesCloneableTopComponent(bundleStructure); |
219 |
} |
271 |
} |
220 |
|
272 |
|
221 |
/** |
273 |
/** |
Lines 225-232
Link Here
|
225 |
*/ |
277 |
*/ |
226 |
protected String messageOpening() { |
278 |
protected String messageOpening() { |
227 |
return NbBundle.getMessage(PropertiesOpen.class, "LBL_ObjectOpen", // NOI18N |
279 |
return NbBundle.getMessage(PropertiesOpen.class, "LBL_ObjectOpen", // NOI18N |
228 |
propDataObject.getName(), |
280 |
bundleStructure.getNthEntry(0).getName(), |
229 |
propDataObject.getPrimaryFile().toString() |
281 |
bundleStructure.getNthEntry(0).getFile().toString() |
230 |
); |
282 |
); |
231 |
} |
283 |
} |
232 |
|
284 |
|
Lines 249-263
Link Here
|
249 |
if (undoRedoManager != null) { |
301 |
if (undoRedoManager != null) { |
250 |
return undoRedoManager; |
302 |
return undoRedoManager; |
251 |
} else { |
303 |
} else { |
252 |
return new CompoundUndoRedoManager(propDataObject); |
304 |
return new CompoundUndoRedoManager(bundleStructure); |
253 |
} |
305 |
} |
254 |
} |
306 |
} |
255 |
|
307 |
|
256 |
/** Helper method. Closes documents. */ |
308 |
/** Helper method. Closes documents. */ |
257 |
private synchronized void closeDocuments() { |
309 |
private synchronized void closeDocuments() { |
258 |
closeEntry((PropertiesFileEntry)propDataObject.getPrimaryEntry()); |
310 |
BundleStructure structure = bundleStructure; |
259 |
for (Iterator it = propDataObject.secondaryEntries().iterator(); it.hasNext(); ) { |
311 |
for (int i = 0; i< structure.getEntryCount(); i++) { |
260 |
closeEntry((PropertiesFileEntry)it.next()); |
312 |
closeEntry(structure.getNthEntry(i)); |
261 |
} |
313 |
} |
262 |
} |
314 |
} |
263 |
|
315 |
|
Lines 278-284
Link Here
|
278 |
} |
330 |
} |
279 |
} |
331 |
} |
280 |
|
332 |
|
281 |
/** |
333 |
/** |
282 |
* Helper method. Should be called only if the object has SaveCookie |
334 |
* Helper method. Should be called only if the object has SaveCookie |
283 |
* @return true if closing this editor whithout saving would result in loss of data |
335 |
* @return true if closing this editor whithout saving would result in loss of data |
284 |
* because al least one of the modified files is not open in the code editor |
336 |
* because al least one of the modified files is not open in the code editor |
Lines 286-300
Link Here
|
286 |
private boolean shouldAskSave() { |
338 |
private boolean shouldAskSave() { |
287 |
// for each entry : if there is a SaveCookie and no open editor component, return true. |
339 |
// for each entry : if there is a SaveCookie and no open editor component, return true. |
288 |
// if passed for all entries, return false |
340 |
// if passed for all entries, return false |
289 |
PropertiesFileEntry entry = (PropertiesFileEntry)propDataObject.getPrimaryEntry(); |
341 |
BundleStructure structure = bundleStructure; |
290 |
SaveCookie savec = entry.getCookie(SaveCookie.class); |
342 |
PropertiesFileEntry entry; |
291 |
|
343 |
SaveCookie savec; |
292 |
if ((savec != null) && !entry.getPropertiesEditor().hasOpenedEditorComponent()) { |
344 |
for (int i = 0; i < structure.getEntryCount(); i++) { |
293 |
return true; |
345 |
entry = structure.getNthEntry(i); |
294 |
} |
|
|
295 |
|
296 |
for (Iterator it = propDataObject.secondaryEntries().iterator(); it.hasNext(); ) { |
297 |
entry = (PropertiesFileEntry)it.next(); |
298 |
savec = entry.getCookie(SaveCookie.class); |
346 |
savec = entry.getCookie(SaveCookie.class); |
299 |
if ((savec != null) && !entry.getPropertiesEditor().hasOpenedEditorComponent()) { |
347 |
if ((savec != null) && !entry.getPropertiesEditor().hasOpenedEditorComponent()) { |
300 |
return true; |
348 |
return true; |
Lines 303-309
Link Here
|
303 |
return false; |
351 |
return false; |
304 |
} |
352 |
} |
305 |
|
353 |
|
306 |
|
354 |
|
307 |
/** Environment that connects the open support together with {@code DataObject}. */ |
355 |
/** Environment that connects the open support together with {@code DataObject}. */ |
308 |
private static class Environment implements CloneableOpenSupport.Env, Serializable, |
356 |
private static class Environment implements CloneableOpenSupport.Env, Serializable, |
309 |
PropertyChangeListener, VetoableChangeListener { |
357 |
PropertyChangeListener, VetoableChangeListener { |
Lines 312-318
Link Here
|
312 |
static final long serialVersionUID = -1934890789745432531L; |
360 |
static final long serialVersionUID = -1934890789745432531L; |
313 |
|
361 |
|
314 |
/** Object to serialize and be connected to. */ |
362 |
/** Object to serialize and be connected to. */ |
|
|
363 |
@Deprecated |
315 |
private DataObject dataObject; |
364 |
private DataObject dataObject; |
|
|
365 |
|
366 |
private BundleStructure bundleStructure; |
316 |
|
367 |
|
317 |
/** Support for firing of property changes. */ |
368 |
/** Support for firing of property changes. */ |
318 |
private transient PropertyChangeSupport propSupp; |
369 |
private transient PropertyChangeSupport propSupp; |
Lines 327-339
Link Here
|
327 |
* are also rethrown to own listeners. |
378 |
* are also rethrown to own listeners. |
328 |
* @param dataObject data object to be attached to |
379 |
* @param dataObject data object to be attached to |
329 |
*/ |
380 |
*/ |
|
|
381 |
@Deprecated |
330 |
public Environment(PropertiesDataObject dataObject) { |
382 |
public Environment(PropertiesDataObject dataObject) { |
331 |
this.dataObject = dataObject; |
383 |
this.dataObject = dataObject; |
332 |
dataObject.addPropertyChangeListener(WeakListeners.propertyChange(this, dataObject)); |
384 |
dataObject.addPropertyChangeListener(WeakListeners.propertyChange(this, dataObject)); |
333 |
dataObject.addVetoableChangeListener(WeakListeners.vetoableChange(this, dataObject)); |
385 |
dataObject.addVetoableChangeListener(WeakListeners.vetoableChange(this, dataObject)); |
334 |
} |
386 |
} |
335 |
|
387 |
|
336 |
|
388 |
public Environment(BundleStructure structure) { |
|
|
389 |
this.bundleStructure = structure; |
390 |
dataObject = bundleStructure.getNthEntry(0).getDataObject(); |
391 |
addListeners(); |
392 |
} |
393 |
|
394 |
|
395 |
private void addListeners() { |
396 |
BundleStructure structure = bundleStructure; |
397 |
PropertiesDataObject dataObj; |
398 |
for(int i=0;i<structure.getEntryCount();i++) { |
399 |
dataObj = (PropertiesDataObject) structure.getNthEntry(i).getDataObject(); |
400 |
dataObj.addPropertyChangeListener(WeakListeners.propertyChange(this, dataObj)); |
401 |
dataObj.addVetoableChangeListener(WeakListeners.vetoableChange(this, dataObj)); |
402 |
} |
403 |
|
404 |
} |
337 |
/** Implements {@code CloneableOpenSupport.Env} interface. Adds property listener. */ |
405 |
/** Implements {@code CloneableOpenSupport.Env} interface. Adds property listener. */ |
338 |
public void addPropertyChangeListener(PropertyChangeListener l) { |
406 |
public void addPropertyChangeListener(PropertyChangeListener l) { |
339 |
prop().addPropertyChangeListener(l); |
407 |
prop().addPropertyChangeListener(l); |
Lines 354-370
Link Here
|
354 |
veto().removeVetoableChangeListener(l); |
422 |
veto().removeVetoableChangeListener(l); |
355 |
} |
423 |
} |
356 |
|
424 |
|
357 |
/** |
425 |
/** |
358 |
* Implements {@code CloneableOpenSupport} interface. |
426 |
* Implements {@code CloneableOpenSupport} interface. |
359 |
* Method that allows environment to find its cloneable open support. |
427 |
* Method that allows environment to find its cloneable open support. |
360 |
* @return the support or null if the environemnt is not in valid |
428 |
* @return the support or null if the environemnt is not in valid |
361 |
* state and the CloneableOpenSupport cannot be found for associated |
429 |
* state and the CloneableOpenSupport cannot be found for associated |
362 |
* data object |
430 |
* data object |
363 |
*/ |
431 |
*/ |
|
|
432 |
@Deprecated |
433 |
//TODO PENDING Called from super class need to preserve |
364 |
public CloneableOpenSupport findCloneableOpenSupport() { |
434 |
public CloneableOpenSupport findCloneableOpenSupport() { |
|
|
435 |
return (CloneableOpenSupport) dataObject.getCookie(OpenCookie.class); |
436 |
} |
437 |
|
438 |
public CloneableOpenSupport findCloneableOpenSupport(PropertiesDataObject dataObject) { |
365 |
return (CloneableOpenSupport)dataObject.getCookie(OpenCookie.class); |
439 |
return (CloneableOpenSupport)dataObject.getCookie(OpenCookie.class); |
366 |
} |
440 |
} |
367 |
|
441 |
|
368 |
/** |
442 |
/** |
369 |
* Implements {@code CloneableOpenSupport.Env} interface. |
443 |
* Implements {@code CloneableOpenSupport.Env} interface. |
370 |
* Test whether the support is in valid state or not. |
444 |
* Test whether the support is in valid state or not. |
Lines 372-380
Link Here
|
372 |
* referenced to does not exist anymore. |
446 |
* referenced to does not exist anymore. |
373 |
* @return true or false depending on its state |
447 |
* @return true or false depending on its state |
374 |
*/ |
448 |
*/ |
|
|
449 |
@Deprecated |
375 |
public boolean isValid() { |
450 |
public boolean isValid() { |
376 |
return dataObject.isValid(); |
451 |
return dataObject.isValid(); |
377 |
} |
452 |
} |
|
|
453 |
|
454 |
public boolean isValid(PropertiesDataObject dataObject) { |
455 |
return dataObject.isValid(); |
456 |
} |
457 |
|
378 |
|
458 |
|
379 |
/** |
459 |
/** |
380 |
* Implements {@code CloneableOpenSupport.Env} interface. |
460 |
* Implements {@code CloneableOpenSupport.Env} interface. |
Lines 382-387
Link Here
|
382 |
* @return true if the object is modified |
462 |
* @return true if the object is modified |
383 |
*/ |
463 |
*/ |
384 |
public boolean isModified() { |
464 |
public boolean isModified() { |
|
|
465 |
//if one dataObject is modified assume that everything modified |
466 |
for (int i=0; i < bundleStructure.getEntryCount();i++) { |
467 |
if (bundleStructure.getNthEntry(i).getDataObject().isModified()) { |
468 |
return true; |
469 |
} |
470 |
} |
471 |
return false; |
472 |
} |
473 |
|
474 |
public boolean isModified(PropertiesDataObject dataObject) { |
385 |
return dataObject.isModified(); |
475 |
return dataObject.isModified(); |
386 |
} |
476 |
} |
387 |
|
477 |
|
Lines 392-406
Link Here
|
392 |
* (for example when the file is readonly), when such exception |
482 |
* (for example when the file is readonly), when such exception |
393 |
* is the support should discard all previous changes |
483 |
* is the support should discard all previous changes |
394 |
*/ |
484 |
*/ |
|
|
485 |
@Deprecated |
395 |
public void markModified() throws java.io.IOException { |
486 |
public void markModified() throws java.io.IOException { |
396 |
dataObject.setModified(true); |
487 |
dataObject.setModified(true); |
397 |
} |
488 |
} |
398 |
|
489 |
|
|
|
490 |
public void markModified(PropertiesDataObject dataObject) throws java.io.IOException { |
491 |
dataObject.setModified(true); |
492 |
} |
399 |
/** |
493 |
/** |
400 |
* Implements {@code CloneableOpenSupport.Env} interface. |
494 |
* Implements {@code CloneableOpenSupport.Env} interface. |
401 |
* Reverse method that can be called to make the environment unmodified. |
495 |
* Reverse method that can be called to make the environment unmodified. |
402 |
*/ |
496 |
*/ |
|
|
497 |
@Deprecated |
403 |
public void unmarkModified() { |
498 |
public void unmarkModified() { |
|
|
499 |
dataObject.setModified(false); |
500 |
} |
501 |
|
502 |
public void unmarkModified(PropertiesDataObject dataObject) { |
404 |
dataObject.setModified(false); |
503 |
dataObject.setModified(false); |
405 |
} |
504 |
} |
406 |
|
505 |
|
Lines 410-419
Link Here
|
410 |
*/ |
509 |
*/ |
411 |
public void propertyChange(PropertyChangeEvent evt) { |
510 |
public void propertyChange(PropertyChangeEvent evt) { |
412 |
if(DataObject.PROP_MODIFIED.equals(evt.getPropertyName())) { |
511 |
if(DataObject.PROP_MODIFIED.equals(evt.getPropertyName())) { |
413 |
if(dataObject.isModified()) { |
512 |
PropertiesDataObject dataObj = null; |
414 |
dataObject.addVetoableChangeListener(this); |
513 |
if (evt.getSource() instanceof PropertiesDataObject) { |
415 |
} else { |
514 |
dataObj = (PropertiesDataObject) evt.getSource(); |
416 |
dataObject.removeVetoableChangeListener(this); |
515 |
} |
|
|
516 |
if (dataObj!=null) { |
517 |
if(dataObj.isModified()) { |
518 |
dataObj.addVetoableChangeListener(this); |
519 |
} else { |
520 |
dataObj.removeVetoableChangeListener(this); |
521 |
} |
417 |
} |
522 |
} |
418 |
} else if(DataObject.PROP_VALID.equals(evt.getPropertyName ())) { |
523 |
} else if(DataObject.PROP_VALID.equals(evt.getPropertyName ())) { |
419 |
// We will handle the object invalidation here. |
524 |
// We will handle the object invalidation here. |
Lines 422-436
Link Here
|
422 |
return; |
527 |
return; |
423 |
} |
528 |
} |
424 |
|
529 |
|
|
|
530 |
//TODO XXX PENDING Check it |
531 |
PropertiesDataObject dataObject = null; |
532 |
if (evt.getSource() instanceof PropertiesDataObject) { |
533 |
dataObject = (PropertiesDataObject) evt.getSource(); |
534 |
} |
535 |
if (dataObject != null) { |
536 |
bundleStructure.updateEntries(); |
537 |
bundleStructure.notifyOneFileChanged(dataObject.getPrimaryFile()); |
538 |
if (bundleStructure.getEntryCount() == 0) { |
425 |
// Loosing validity. |
539 |
// Loosing validity. |
426 |
PropertiesOpen support = (PropertiesOpen)findCloneableOpenSupport(); |
540 |
// PropertiesOpen support = (PropertiesOpen)findCloneableOpenSupport(); |
427 |
if(support != null) { |
541 |
PropertiesOpen support = (PropertiesOpen)findCloneableOpenSupport(dataObject); |
|
|
542 |
if(support != null ) { |
428 |
|
543 |
|
429 |
// Mark the object as not being modified, so nobody |
544 |
// Mark the object as not being modified, so nobody |
430 |
// will ask for save. |
545 |
// will ask for save. |
431 |
unmarkModified(); |
546 |
unmarkModified((PropertiesDataObject) evt.getSource()); |
432 |
|
547 |
|
433 |
support.close(false); |
548 |
support.close(false); |
|
|
549 |
} |
550 |
} |
434 |
} |
551 |
} |
435 |
} else { |
552 |
} else { |
436 |
firePropertyChange ( |
553 |
firePropertyChange ( |
Lines 496-515
Link Here
|
496 |
/** Inner class. Listens to modifications and updates save cookie. */ |
613 |
/** Inner class. Listens to modifications and updates save cookie. */ |
497 |
private final class ModifiedListener implements SaveCookie, PropertyChangeListener { |
614 |
private final class ModifiedListener implements SaveCookie, PropertyChangeListener { |
498 |
|
615 |
|
|
|
616 |
|
499 |
/** Gives notification that the DataObject was changed. |
617 |
/** Gives notification that the DataObject was changed. |
500 |
* @param ev PropertyChangeEvent |
618 |
* @param ev PropertyChangeEvent |
501 |
*/ |
619 |
*/ |
502 |
public void propertyChange(PropertyChangeEvent evt) { |
620 |
public void propertyChange(PropertyChangeEvent evt) { |
503 |
// Data object changed, reset the UndoRedo manager. |
621 |
// Data object changed, reset the UndoRedo manager. |
504 |
if (evt.getSource().equals(propDataObject)) { |
622 |
if (DataObject.PROP_MODIFIED.equals(evt.getPropertyName())) { |
505 |
((CompoundUndoRedoManager) PropertiesOpen.this.getUndoRedo()).reset(propDataObject); |
623 |
if (evt.getSource() instanceof PropertiesDataObject) { |
506 |
} |
624 |
PropertiesDataObject dataObject = (PropertiesDataObject) evt.getSource(); |
507 |
|
625 |
if(bundleStructure.getEntryByFileName(dataObject.getName())!=null) { |
508 |
if ((evt.getSource() == propDataObject) && (DataObject.PROP_MODIFIED.equals(evt.getPropertyName()))) { |
626 |
((CompoundUndoRedoManager) PropertiesOpen.this.getUndoRedo()).reset(bundleStructure); |
509 |
if (((Boolean)evt.getNewValue()).booleanValue()) { |
627 |
if (((Boolean)evt.getNewValue()).booleanValue()) { |
510 |
addSaveCookie(); |
628 |
addSaveCookie(dataObject); |
511 |
} else { |
629 |
} else { |
512 |
removeSaveCookie(); |
630 |
removeSaveCookie(dataObject); |
|
|
631 |
} |
632 |
} |
513 |
} |
633 |
} |
514 |
} |
634 |
} |
515 |
} |
635 |
} |
Lines 538-551
Link Here
|
538 |
* @exception IOException on I/O error |
658 |
* @exception IOException on I/O error |
539 |
*/ |
659 |
*/ |
540 |
public void saveDocument() throws IOException { |
660 |
public void saveDocument() throws IOException { |
541 |
PropertiesFileEntry pfe = (PropertiesFileEntry)propDataObject.getPrimaryEntry(); |
661 |
BundleStructure structure = bundleStructure; |
542 |
SaveCookie save = pfe.getCookie(SaveCookie.class); |
662 |
SaveCookie save; |
543 |
if (save != null) { |
663 |
for (int i=0; i<structure.getEntryCount();i++) { |
544 |
save.save(); |
664 |
save = structure.getNthEntry(i).getCookie(SaveCookie.class); |
545 |
} |
|
|
546 |
|
547 |
for (Iterator it = propDataObject.secondaryEntries().iterator(); it.hasNext();) { |
548 |
save = ((PropertiesFileEntry) it.next()).getCookie(SaveCookie.class); |
549 |
if (save != null) { |
665 |
if (save != null) { |
550 |
save.save(); |
666 |
save.save(); |
551 |
} |
667 |
} |
Lines 553-566
Link Here
|
553 |
} |
669 |
} |
554 |
|
670 |
|
555 |
/** Adds save cookie to the dataobject. */ |
671 |
/** Adds save cookie to the dataobject. */ |
|
|
672 |
@Deprecated |
556 |
private void addSaveCookie() { |
673 |
private void addSaveCookie() { |
|
|
674 |
if(propDataObject.getCookie(SaveCookie.class) == null) { |
675 |
propDataObject.getCookieSet0().add(this); |
676 |
} |
677 |
} |
678 |
|
679 |
private void addSaveCookie(PropertiesDataObject propDataObject) { |
557 |
if(propDataObject.getCookie(SaveCookie.class) == null) { |
680 |
if(propDataObject.getCookie(SaveCookie.class) == null) { |
558 |
propDataObject.getCookieSet0().add(this); |
681 |
propDataObject.getCookieSet0().add(this); |
559 |
} |
682 |
} |
560 |
} |
683 |
} |
561 |
|
684 |
|
562 |
/** Removes save cookie from the dataobject. */ |
685 |
/** Removes save cookie from the dataobject. */ |
|
|
686 |
@Deprecated |
563 |
private void removeSaveCookie() { |
687 |
private void removeSaveCookie() { |
|
|
688 |
if(propDataObject.getCookie(SaveCookie.class) == this) { |
689 |
propDataObject.getCookieSet0().remove(this); |
690 |
} |
691 |
} |
692 |
|
693 |
private void removeSaveCookie(PropertiesDataObject propDataObject) { |
564 |
if(propDataObject.getCookie(SaveCookie.class) == this) { |
694 |
if(propDataObject.getCookie(SaveCookie.class) == this) { |
565 |
propDataObject.getCookieSet0().remove(this); |
695 |
propDataObject.getCookieSet0().remove(this); |
566 |
} |
696 |
} |
Lines 597-603
Link Here
|
597 |
final PropertiesCloneableTopComponent editor = (PropertiesCloneableTopComponent)PropertiesOpen.super.openCloneableTopComponent(); |
727 |
final PropertiesCloneableTopComponent editor = (PropertiesCloneableTopComponent)PropertiesOpen.super.openCloneableTopComponent(); |
598 |
editor.requestActive(); |
728 |
editor.requestActive(); |
599 |
|
729 |
|
600 |
BundleStructure bs = propDataObject.getBundleStructure(); |
730 |
BundleStructure bs = bundleStructure; |
|
|
731 |
bs.updateEntries(); |
601 |
// Find indexes. |
732 |
// Find indexes. |
602 |
int entryIndex = bs.getEntryIndexByFileName(entry.getFile().getName()); |
733 |
int entryIndex = bs.getEntryIndexByFileName(entry.getFile().getName()); |
603 |
int rowIndex = bs.getKeyIndexByName(key); |
734 |
int rowIndex = bs.getKeyIndexByName(key); |
Lines 633-644
Link Here
|
633 |
public static class PropertiesCloneableTopComponent extends CloneableTopComponent { |
764 |
public static class PropertiesCloneableTopComponent extends CloneableTopComponent { |
634 |
|
765 |
|
635 |
/** Reference to underlying {@code PropertiesDataObject}. */ |
766 |
/** Reference to underlying {@code PropertiesDataObject}. */ |
|
|
767 |
@Deprecated |
636 |
private PropertiesDataObject propDataObject; |
768 |
private PropertiesDataObject propDataObject; |
637 |
|
769 |
|
|
|
770 |
private PropertiesDataObject[] dataObjecs; |
638 |
/** Listener for changes on {@code propDataObject} name and cookie properties. |
771 |
/** Listener for changes on {@code propDataObject} name and cookie properties. |
639 |
* Changes display name of components accordingly. */ |
772 |
* Changes display name of components accordingly. */ |
640 |
private transient PropertyChangeListener dataObjectListener; |
773 |
private transient PropertyChangeListener dataObjectListener; |
641 |
|
774 |
|
|
|
775 |
private transient static HashMap<PropertiesDataObject,PropertyChangeListener> weakListeners; |
776 |
|
642 |
/** Generated serial version UID. */ |
777 |
/** Generated serial version UID. */ |
643 |
static final long serialVersionUID =2836248291419024296L; |
778 |
static final long serialVersionUID =2836248291419024296L; |
644 |
|
779 |
|
Lines 649-660
Link Here
|
649 |
|
784 |
|
650 |
/** Constructor. |
785 |
/** Constructor. |
651 |
* @param propDataObject data object we belong to */ |
786 |
* @param propDataObject data object we belong to */ |
|
|
787 |
@Deprecated |
652 |
public PropertiesCloneableTopComponent (PropertiesDataObject propDataObject) { |
788 |
public PropertiesCloneableTopComponent (PropertiesDataObject propDataObject) { |
653 |
this.propDataObject = propDataObject; |
789 |
this.propDataObject = propDataObject; |
654 |
|
790 |
|
655 |
initialize(); |
791 |
initialize(); |
656 |
} |
792 |
} |
657 |
|
793 |
|
|
|
794 |
private MultiBundleStructure bundleStructure; |
795 |
|
796 |
public PropertiesCloneableTopComponent(BundleStructure structure) { |
797 |
this.bundleStructure = (MultiBundleStructure) structure; |
798 |
propDataObject = (PropertiesDataObject) bundleStructure.getNthEntry(0).getDataObject(); |
799 |
dataObjecs = new PropertiesDataObject[bundleStructure.getEntryCount()]; |
800 |
for (int i=0; i<bundleStructure.getEntryCount();i++) { |
801 |
dataObjecs[i] = (PropertiesDataObject) bundleStructure.getNthEntry(i).getDataObject(); |
802 |
} |
803 |
weakListeners = new HashMap<PropertiesDataObject, PropertyChangeListener>(); |
804 |
initialize(); |
805 |
} |
658 |
/** |
806 |
/** |
659 |
*/ |
807 |
*/ |
660 |
@Override |
808 |
@Override |
Lines 681-694
Link Here
|
681 |
private void initialize() { |
829 |
private void initialize() { |
682 |
initComponents(); |
830 |
initComponents(); |
683 |
setupActions(); |
831 |
setupActions(); |
684 |
setActivatedNodes(new Node[] {propDataObject.getNodeDelegate()}); |
832 |
//TODO XXX PENDING Probable need to add activated Nodes |
|
|
833 |
BundleStructure structure = bundleStructure; |
834 |
PropertiesDataObject dataObject; |
685 |
|
835 |
|
|
|
836 |
Node[] node = new Node[structure.getEntryCount()]; |
686 |
dataObjectListener = new NameUpdater(); |
837 |
dataObjectListener = new NameUpdater(); |
687 |
propDataObject.addPropertyChangeListener( |
838 |
|
688 |
WeakListeners.propertyChange(dataObjectListener, |
839 |
for( int i=0; i<structure.getEntryCount();i++) { |
689 |
propDataObject)); |
840 |
dataObject = dataObjecs[i];//(PropertiesDataObject) structure.getNthEntry(i).getDataObject(); |
|
|
841 |
node[i] = dataObject.getNodeDelegate(); |
842 |
weakListeners.put(dataObject,WeakListeners.propertyChange(dataObjectListener, dataObject)); |
843 |
dataObject.addPropertyChangeListener(weakListeners.get(dataObject)); |
844 |
} |
690 |
|
845 |
|
|
|
846 |
setActivatedNodes(node); |
847 |
|
691 |
updateName(); |
848 |
updateName(); |
|
|
849 |
} |
850 |
|
851 |
/** |
852 |
* Called from PropertiesOpen when new DataObject added |
853 |
* @param dataObject to add listener to |
854 |
*/ |
855 |
protected void dataObjectAdded(PropertiesDataObject dataObject) { |
856 |
dataObject.removePropertyChangeListener(WeakListeners.propertyChange(dataObjectListener, dataObject)); |
857 |
dataObject.addPropertyChangeListener(WeakListeners.propertyChange(dataObjectListener, dataObject)); |
692 |
} |
858 |
} |
693 |
|
859 |
|
694 |
/* Based on class DataNode.PropL. */ |
860 |
/* Based on class DataNode.PropL. */ |
Lines 710-716
Link Here
|
710 |
|
876 |
|
711 |
/** */ |
877 |
/** */ |
712 |
private final int action; |
878 |
private final int action; |
713 |
|
879 |
|
714 |
/** |
880 |
/** |
715 |
*/ |
881 |
*/ |
716 |
NameUpdater() { |
882 |
NameUpdater() { |
Lines 730-736
Link Here
|
730 |
previous.removeFileStatusListener(weakL); |
896 |
previous.removeFileStatusListener(weakL); |
731 |
} |
897 |
} |
732 |
try { |
898 |
try { |
733 |
previous = propDataObject.getPrimaryFile().getFileSystem(); |
899 |
previous = bundleStructure.getNthEntry(0).getFile().getFileSystem(); |
734 |
if (weakL == null) { |
900 |
if (weakL == null) { |
735 |
weakL = org.openide.filesystems.FileUtil |
901 |
weakL = org.openide.filesystems.FileUtil |
736 |
.weakFileStatusListener(this, previous); |
902 |
.weakFileStatusListener(this, previous); |
Lines 750-757
Link Here
|
750 |
} |
916 |
} |
751 |
|
917 |
|
752 |
boolean thisChanged = false; |
918 |
boolean thisChanged = false; |
753 |
for (FileObject fo : propDataObject.files()) { |
919 |
//PENDING Check it |
754 |
if (ev.hasChanged(fo)) { |
920 |
for (int i=0;i<bundleStructure.getEntryCount();i++) { |
|
|
921 |
if(ev.hasChanged(bundleStructure.getNthEntry(i).getFile())) { |
755 |
thisChanged = true; |
922 |
thisChanged = true; |
756 |
break; |
923 |
break; |
757 |
} |
924 |
} |
Lines 765-771
Link Here
|
765 |
/** |
932 |
/** |
766 |
*/ |
933 |
*/ |
767 |
public void propertyChange(PropertyChangeEvent e) { |
934 |
public void propertyChange(PropertyChangeEvent e) { |
768 |
if (!propDataObject.isValid()) { |
935 |
//PENDING Add correct propDataObject |
|
|
936 |
if (bundleStructure.getEntryCount() == 0) {return;} |
937 |
if (!bundleStructure.getNthEntry(0).getDataObject().isValid()) { |
769 |
return; |
938 |
return; |
770 |
} |
939 |
} |
771 |
|
940 |
|
Lines 819-825
Link Here
|
819 |
private void updateName() { |
988 |
private void updateName() { |
820 |
assert EventQueue.isDispatchThread(); |
989 |
assert EventQueue.isDispatchThread(); |
821 |
|
990 |
|
822 |
final String name = propDataObject.getName(); |
991 |
final String name = bundleStructure.getNthEntry(0).getName(); |
823 |
final String displayName = displayName(); |
992 |
final String displayName = displayName(); |
824 |
final String htmlDisplayName = htmlDisplayName(); |
993 |
final String htmlDisplayName = htmlDisplayName(); |
825 |
final String toolTip = messageToolTip(); |
994 |
final String toolTip = messageToolTip(); |
Lines 853-860
Link Here
|
853 |
/** |
1022 |
/** |
854 |
*/ |
1023 |
*/ |
855 |
private String addModifiedInfo(String name) { |
1024 |
private String addModifiedInfo(String name) { |
856 |
boolean modified |
1025 |
boolean modified = false; |
857 |
= propDataObject.getCookie(SaveCookie.class) != null; |
1026 |
for (int i=0;i<bundleStructure.getEntryCount();i++) { |
|
|
1027 |
if(bundleStructure.getNthEntry(i).getDataObject().getCookie(SaveCookie.class) != null) { |
1028 |
modified = true; |
1029 |
break; |
1030 |
} |
1031 |
} |
858 |
int version = modified ? 1 : 3; |
1032 |
int version = modified ? 1 : 3; |
859 |
return NbBundle.getMessage(PropertiesCloneableTopComponent.class, |
1033 |
return NbBundle.getMessage(PropertiesCloneableTopComponent.class, |
860 |
"LBL_EditorName", //NOI18N |
1034 |
"LBL_EditorName", //NOI18N |
Lines 869-875
Link Here
|
869 |
* @see #htmlDisplayName |
1043 |
* @see #htmlDisplayName |
870 |
*/ |
1044 |
*/ |
871 |
private String displayName() { |
1045 |
private String displayName() { |
872 |
String nameBase = propDataObject.getNodeDelegate().getDisplayName(); |
1046 |
String nameBase = bundleStructure.getNthEntry(0).getDataObject().getNodeDelegate().getDisplayName(); |
873 |
return addModifiedInfo(nameBase); |
1047 |
return addModifiedInfo(nameBase); |
874 |
} |
1048 |
} |
875 |
|
1049 |
|
Lines 880-886
Link Here
|
880 |
* @see #displayName() |
1054 |
* @see #displayName() |
881 |
*/ |
1055 |
*/ |
882 |
private String htmlDisplayName() { |
1056 |
private String htmlDisplayName() { |
883 |
final Node node = propDataObject.getNodeDelegate(); |
1057 |
final Node node = bundleStructure.getNthEntry(0).getDataObject().getNodeDelegate(); |
884 |
String displayName = node.getHtmlDisplayName(); |
1058 |
String displayName = node.getHtmlDisplayName(); |
885 |
if (displayName != null) { |
1059 |
if (displayName != null) { |
886 |
if (!displayName.startsWith("<html>")) { //NOI18N |
1060 |
if (!displayName.startsWith("<html>")) { //NOI18N |
Lines 894-915
Link Here
|
894 |
|
1068 |
|
895 |
/** Gets string for tooltip. */ |
1069 |
/** Gets string for tooltip. */ |
896 |
private String messageToolTip() { |
1070 |
private String messageToolTip() { |
897 |
FileObject fo = propDataObject.getPrimaryFile(); |
1071 |
FileObject fo = bundleStructure.getNthEntry(0).getFile(); |
898 |
return FileUtil.getFileDisplayName(fo); |
1072 |
return FileUtil.getFileDisplayName(fo); |
899 |
} |
1073 |
} |
900 |
|
1074 |
|
901 |
/** |
1075 |
/** |
|
|
1076 |
* |
902 |
* Overrides superclass method. When closing last view, also close the document. |
1077 |
* Overrides superclass method. When closing last view, also close the document. |
903 |
* @return {@code true} if close succeeded |
1078 |
* @return {@code true} if close succeeded |
904 |
*/ |
1079 |
*/ |
905 |
@Override |
1080 |
@Override |
906 |
protected boolean closeLast () { |
1081 |
protected boolean closeLast () { |
907 |
if (!propDataObject.getOpenSupport().canClose ()) { |
1082 |
if (!bundleStructure.getOpenSupport().canClose ()) { |
908 |
// if we cannot close the last window |
1083 |
// if we cannot close the last window |
909 |
return false; |
1084 |
return false; |
910 |
} |
1085 |
} |
911 |
propDataObject.getOpenSupport().closeDocuments(); |
1086 |
bundleStructure.getOpenSupport().closeDocuments(); |
912 |
|
1087 |
PropertyChangeListener l; |
|
|
1088 |
for (PropertiesDataObject dataObject:dataObjecs) { |
1089 |
l = weakListeners.get(dataObject); |
1090 |
if (l!=null) { |
1091 |
dataObject.removePropertyChangeListener(l); |
1092 |
weakListeners.remove(l); |
1093 |
} |
1094 |
} |
913 |
return true; |
1095 |
return true; |
914 |
} |
1096 |
} |
915 |
|
1097 |
|
Lines 920-926
Link Here
|
920 |
*/ |
1102 |
*/ |
921 |
@Override |
1103 |
@Override |
922 |
protected CloneableTopComponent createClonedObject () { |
1104 |
protected CloneableTopComponent createClonedObject () { |
923 |
return new PropertiesCloneableTopComponent(propDataObject); |
1105 |
return new PropertiesCloneableTopComponent(bundleStructure); |
924 |
} |
1106 |
} |
925 |
|
1107 |
|
926 |
/** Gets {@code Icon}. */ |
1108 |
/** Gets {@code Icon}. */ |
Lines 950-956
Link Here
|
950 |
*/ |
1132 |
*/ |
951 |
@Override |
1133 |
@Override |
952 |
public UndoRedo getUndoRedo () { |
1134 |
public UndoRedo getUndoRedo () { |
953 |
return propDataObject.getOpenSupport().getUndoRedo(); |
1135 |
return bundleStructure.getOpenSupport().getUndoRedo(); |
954 |
} |
1136 |
} |
955 |
|
1137 |
|
956 |
/** Inits the subcomponents. Sets layout for this top component and adds {@code BundleEditPanel} to it. |
1138 |
/** Inits the subcomponents. Sets layout for this top component and adds {@code BundleEditPanel} to it. |
Lines 964-970
Link Here
|
964 |
c.weightx = 1.0; |
1146 |
c.weightx = 1.0; |
965 |
c.weighty = 1.0; |
1147 |
c.weighty = 1.0; |
966 |
c.gridwidth = GridBagConstraints.REMAINDER; |
1148 |
c.gridwidth = GridBagConstraints.REMAINDER; |
967 |
JPanel panel = new BundleEditPanel(propDataObject, new PropertiesTableModel(propDataObject.getBundleStructure())); |
1149 |
JPanel panel = new BundleEditPanel(bundleStructure, new PropertiesTableModel(bundleStructure)); |
968 |
gridbag.setConstraints(panel, c); |
1150 |
gridbag.setConstraints(panel, c); |
969 |
add(panel); |
1151 |
add(panel); |
970 |
} |
1152 |
} |
Lines 973-979
Link Here
|
973 |
* is not valid. |
1155 |
* is not valid. |
974 |
*/ |
1156 |
*/ |
975 |
private boolean discard () { |
1157 |
private boolean discard () { |
976 |
return propDataObject == null; |
1158 |
return bundleStructure == null; |
977 |
} |
1159 |
} |
978 |
|
1160 |
|
979 |
|
1161 |
|
Lines 985-991
Link Here
|
985 |
@Override |
1167 |
@Override |
986 |
public void writeExternal (ObjectOutput out) throws IOException { |
1168 |
public void writeExternal (ObjectOutput out) throws IOException { |
987 |
super.writeExternal(out); |
1169 |
super.writeExternal(out); |
988 |
out.writeObject(propDataObject); |
1170 |
out.writeObject(bundleStructure.getNthEntry(0).getDataObject()); |
989 |
} |
1171 |
} |
990 |
|
1172 |
|
991 |
/** |
1173 |
/** |
Lines 998-1004
Link Here
|
998 |
super.readExternal(in); |
1180 |
super.readExternal(in); |
999 |
|
1181 |
|
1000 |
propDataObject = (PropertiesDataObject)in.readObject(); |
1182 |
propDataObject = (PropertiesDataObject)in.readObject(); |
1001 |
|
1183 |
bundleStructure = (MultiBundleStructure) propDataObject.getBundleStructure(); |
|
|
1184 |
dataObjecs = new PropertiesDataObject[bundleStructure.getEntryCount()]; |
1185 |
for (int i=0;i<bundleStructure.getEntryCount();i++) { |
1186 |
dataObjecs[i] = (PropertiesDataObject) bundleStructure.getNthEntry(i).getDataObject(); |
1187 |
} |
1188 |
weakListeners = new HashMap<PropertiesDataObject, PropertyChangeListener>(); |
1002 |
initialize(); |
1189 |
initialize(); |
1003 |
} |
1190 |
} |
1004 |
} // End of nested class PropertiesCloneableTopComponent. |
1191 |
} // End of nested class PropertiesCloneableTopComponent. |
Lines 1017-1038
Link Here
|
1017 |
// Constructor |
1204 |
// Constructor |
1018 |
|
1205 |
|
1019 |
/** Collects all UndoRedo managers from all editor support of all entries. */ |
1206 |
/** Collects all UndoRedo managers from all editor support of all entries. */ |
|
|
1207 |
@Deprecated |
1020 |
public CompoundUndoRedoManager(PropertiesDataObject obj) { |
1208 |
public CompoundUndoRedoManager(PropertiesDataObject obj) { |
1021 |
init(obj); |
1209 |
init(obj); |
1022 |
} |
1210 |
} |
|
|
1211 |
public CompoundUndoRedoManager(BundleStructure structure) { |
1212 |
init(structure); |
1213 |
} |
1023 |
|
1214 |
|
1024 |
/** Initialize set of managers. */ |
1215 |
/** Initialize set of managers. */ |
|
|
1216 |
@Deprecated |
1025 |
private void init(PropertiesDataObject obj) { |
1217 |
private void init(PropertiesDataObject obj) { |
1026 |
managers.add( ((PropertiesFileEntry)obj.getPrimaryEntry()).getPropertiesEditor().getUndoRedoManager()); |
1218 |
BundleStructure structure = obj.getBundleStructure(); |
1027 |
for (Iterator it = obj.secondaryEntries().iterator(); it.hasNext(); ) { |
1219 |
for(int i=0; i< structure.getEntryCount(); i++) { |
1028 |
managers.add( ((PropertiesFileEntry)it.next()).getPropertiesEditor().getUndoRedoManager() ); |
1220 |
managers.add(structure.getNthEntry(i).getPropertiesEditor().getUndoRedoManager()); |
1029 |
} |
1221 |
} |
|
|
1222 |
} |
1223 |
|
1224 |
private void init(BundleStructure structure) { |
1225 |
for(int i=0; i< structure.getEntryCount(); i++) { |
1226 |
managers.add(structure.getNthEntry(i).getPropertiesEditor().getUndoRedoManager()); |
1227 |
} |
1030 |
} |
1228 |
} |
1031 |
|
1229 |
|
1032 |
/** Resets the managers. Used when data object has changed. */ |
1230 |
/** Resets the managers. Used when data object has changed. */ |
|
|
1231 |
@Deprecated |
1033 |
public synchronized void reset(PropertiesDataObject obj) { |
1232 |
public synchronized void reset(PropertiesDataObject obj) { |
1034 |
managers.clear(); |
1233 |
managers.clear(); |
1035 |
init(obj); |
1234 |
init(obj); |
|
|
1235 |
} |
1236 |
|
1237 |
public synchronized void reset(BundleStructure structure) { |
1238 |
managers.clear(); |
1239 |
init(structure); |
1036 |
} |
1240 |
} |
1037 |
|
1241 |
|
1038 |
/** Gets manager which undo edit comes to play.*/ |
1242 |
/** Gets manager which undo edit comes to play.*/ |