Lines 94-99
Link Here
|
94 |
import javax.swing.undo.UndoableEdit; |
94 |
import javax.swing.undo.UndoableEdit; |
95 |
import org.netbeans.api.editor.mimelookup.MimeLookup; |
95 |
import org.netbeans.api.editor.mimelookup.MimeLookup; |
96 |
import org.netbeans.api.editor.mimelookup.MimePath; |
96 |
import org.netbeans.api.editor.mimelookup.MimePath; |
|
|
97 |
import org.openide.text.CloneableEditorSupportRedirector.RequestType; |
97 |
import org.openide.util.Exceptions; |
98 |
import org.openide.util.Exceptions; |
98 |
import org.openide.util.Mutex; |
99 |
import org.openide.util.Mutex; |
99 |
import org.openide.util.Parameters; |
100 |
import org.openide.util.Parameters; |
Lines 375-381
Link Here
|
375 |
* @return the manager |
376 |
* @return the manager |
376 |
*/ |
377 |
*/ |
377 |
protected final synchronized UndoRedo.Manager getUndoRedo() { |
378 |
protected final synchronized UndoRedo.Manager getUndoRedo() { |
378 |
CloneableEditorSupport redirect = CloneableEditorSupportRedirector.findRedirect(this); |
379 |
CloneableEditorSupport redirect = CloneableEditorSupportRedirector.findRedirect(this, RequestType.GET_UNDO_REDO); |
379 |
if (redirect != null) { |
380 |
if (redirect != null) { |
380 |
return redirect.getUndoRedo(); |
381 |
return redirect.getUndoRedo(); |
381 |
} |
382 |
} |
Lines 490-496
Link Here
|
490 |
* @see #prepareDocument */ |
491 |
* @see #prepareDocument */ |
491 |
@Override |
492 |
@Override |
492 |
public void open() { |
493 |
public void open() { |
493 |
CloneableEditorSupport redirect = CloneableEditorSupportRedirector.findRedirect(this); |
494 |
CloneableEditorSupport redirect = CloneableEditorSupportRedirector.findRedirect(this, RequestType.OPEN); |
494 |
if (redirect != null) { |
495 |
if (redirect != null) { |
495 |
redirect.open(); |
496 |
redirect.open(); |
496 |
return; |
497 |
return; |
Lines 604-610
Link Here
|
604 |
* @return task for control over loading |
605 |
* @return task for control over loading |
605 |
*/ |
606 |
*/ |
606 |
public Task prepareDocument() { |
607 |
public Task prepareDocument() { |
607 |
CloneableEditorSupport redirect = CloneableEditorSupportRedirector.findRedirect(this); |
608 |
CloneableEditorSupport redirect = CloneableEditorSupportRedirector.findRedirect(this, RequestType.PREPARE_DOCUMENT); |
608 |
if (redirect != null) { |
609 |
if (redirect != null) { |
609 |
return redirect.prepareDocument(); |
610 |
return redirect.prepareDocument(); |
610 |
} |
611 |
} |
Lines 860-866
Link Here
|
860 |
* @exception IOException if the document could not be loaded |
861 |
* @exception IOException if the document could not be loaded |
861 |
*/ |
862 |
*/ |
862 |
public StyledDocument openDocument() throws IOException { |
863 |
public StyledDocument openDocument() throws IOException { |
863 |
CloneableEditorSupport redirect = CloneableEditorSupportRedirector.findRedirect(this); |
864 |
CloneableEditorSupport redirect = CloneableEditorSupportRedirector.findRedirect(this, RequestType.OPEN_DOCUMENT); |
864 |
if (redirect != null) { |
865 |
if (redirect != null) { |
865 |
return redirect.openDocument(); |
866 |
return redirect.openDocument(); |
866 |
} |
867 |
} |
Lines 960-966
Link Here
|
960 |
* @return document or <code>null</code> if it is not yet loaded |
961 |
* @return document or <code>null</code> if it is not yet loaded |
961 |
*/ |
962 |
*/ |
962 |
public StyledDocument getDocument() { |
963 |
public StyledDocument getDocument() { |
963 |
CloneableEditorSupport redirect = CloneableEditorSupportRedirector.findRedirect(this); |
964 |
CloneableEditorSupport redirect = CloneableEditorSupportRedirector.findRedirect(this, RequestType.GET_DOCUMENT); |
964 |
if (redirect != null) { |
965 |
if (redirect != null) { |
965 |
return redirect.getDocument(); |
966 |
return redirect.getDocument(); |
966 |
} |
967 |
} |
Lines 1011-1017
Link Here
|
1011 |
* otherwise <code>false</code> |
1012 |
* otherwise <code>false</code> |
1012 |
*/ |
1013 |
*/ |
1013 |
public boolean isModified() { |
1014 |
public boolean isModified() { |
1014 |
CloneableEditorSupport redirect = CloneableEditorSupportRedirector.findRedirect(this); |
1015 |
CloneableEditorSupport redirect = CloneableEditorSupportRedirector.findRedirect(this, RequestType.IS_MODIFIED); |
1015 |
if (redirect != null) { |
1016 |
if (redirect != null) { |
1016 |
return redirect.isModified(); |
1017 |
return redirect.isModified(); |
1017 |
} |
1018 |
} |
Lines 1023-1029
Link Here
|
1023 |
* @exception IOException on I/O error |
1024 |
* @exception IOException on I/O error |
1024 |
*/ |
1025 |
*/ |
1025 |
public void saveDocument() throws IOException { |
1026 |
public void saveDocument() throws IOException { |
1026 |
CloneableEditorSupport redirect = CloneableEditorSupportRedirector.findRedirect(this); |
1027 |
CloneableEditorSupport redirect = CloneableEditorSupportRedirector.findRedirect(this, RequestType.SAVE_DOCUMENT); |
1027 |
final boolean log = ERR.isLoggable(Level.FINE); |
1028 |
final boolean log = ERR.isLoggable(Level.FINE); |
1028 |
if (log) { |
1029 |
if (log) { |
1029 |
ERR.fine(documentID() + ": saveDocument() started."); // NOI18N |
1030 |
ERR.fine(documentID() + ": saveDocument() started."); // NOI18N |
Lines 1228-1234
Link Here
|
1228 |
// expected in AWT only |
1229 |
// expected in AWT only |
1229 |
assert SwingUtilities.isEventDispatchThread() |
1230 |
assert SwingUtilities.isEventDispatchThread() |
1230 |
: "CloneableEditorSupport.getOpenedPanes() must be called from AWT thread only"; // NOI18N |
1231 |
: "CloneableEditorSupport.getOpenedPanes() must be called from AWT thread only"; // NOI18N |
1231 |
CloneableEditorSupport redirect = CloneableEditorSupportRedirector.findRedirect(this); |
1232 |
CloneableEditorSupport redirect = CloneableEditorSupportRedirector.findRedirect(this, RequestType.GET_OPENED_PANES); |
1232 |
if (redirect != null) { |
1233 |
if (redirect != null) { |
1233 |
return redirect.getOpenedPanes(); |
1234 |
return redirect.getOpenedPanes(); |
1234 |
} |
1235 |
} |
Lines 1281-1287
Link Here
|
1281 |
// expected in AWT only |
1282 |
// expected in AWT only |
1282 |
assert SwingUtilities.isEventDispatchThread() |
1283 |
assert SwingUtilities.isEventDispatchThread() |
1283 |
: "CloneableEditorSupport.getRecentPane must be called from AWT thread only"; // NOI18N |
1284 |
: "CloneableEditorSupport.getRecentPane must be called from AWT thread only"; // NOI18N |
1284 |
CloneableEditorSupport redirect = CloneableEditorSupportRedirector.findRedirect(this); |
1285 |
CloneableEditorSupport redirect = CloneableEditorSupportRedirector.findRedirect(this, RequestType.GET_RECENT_PANE); |
1285 |
if (redirect != null) { |
1286 |
if (redirect != null) { |
1286 |
return redirect.getRecentPane(); |
1287 |
return redirect.getRecentPane(); |
1287 |
} |
1288 |
} |
Lines 1345-1351
Link Here
|
1345 |
* @return positions of all paragraphs on last save |
1346 |
* @return positions of all paragraphs on last save |
1346 |
*/ |
1347 |
*/ |
1347 |
public Line.Set getLineSet() { |
1348 |
public Line.Set getLineSet() { |
1348 |
CloneableEditorSupport redirect = CloneableEditorSupportRedirector.findRedirect(this); |
1349 |
CloneableEditorSupport redirect = CloneableEditorSupportRedirector.findRedirect(this, RequestType.GET_LINE_SET); |
1349 |
if (redirect != null) { |
1350 |
if (redirect != null) { |
1350 |
return redirect.getLineSet(); |
1351 |
return redirect.getLineSet(); |
1351 |
} |
1352 |
} |
Lines 1374-1380
Link Here
|
1374 |
|
1375 |
|
1375 |
/** A printing implementation suitable for {@link org.openide.cookies.PrintCookie}. */ |
1376 |
/** A printing implementation suitable for {@link org.openide.cookies.PrintCookie}. */ |
1376 |
public void print() { |
1377 |
public void print() { |
1377 |
CloneableEditorSupport redirect = CloneableEditorSupportRedirector.findRedirect(this); |
1378 |
CloneableEditorSupport redirect = CloneableEditorSupportRedirector.findRedirect(this, RequestType.PRINT); |
1378 |
if (redirect != null) { |
1379 |
if (redirect != null) { |
1379 |
redirect.print(); |
1380 |
redirect.print(); |
1380 |
return; |
1381 |
return; |
Lines 1603-1609
Link Here
|
1603 |
* @return <code>true</code> if document is loaded |
1604 |
* @return <code>true</code> if document is loaded |
1604 |
*/ |
1605 |
*/ |
1605 |
public boolean isDocumentLoaded() { |
1606 |
public boolean isDocumentLoaded() { |
1606 |
CloneableEditorSupport redirect = CloneableEditorSupportRedirector.findRedirect(this); |
1607 |
CloneableEditorSupport redirect = CloneableEditorSupportRedirector.findRedirect(this, RequestType.IS_DOCUMENT_LOADED); |
1607 |
if (redirect != null) { |
1608 |
if (redirect != null) { |
1608 |
return redirect.isDocumentLoaded(); |
1609 |
return redirect.isDocumentLoaded(); |
1609 |
} |
1610 |
} |
Lines 1614-1620
Link Here
|
1614 |
* @return <code>true</code> if document is ready |
1615 |
* @return <code>true</code> if document is ready |
1615 |
*/ |
1616 |
*/ |
1616 |
boolean isDocumentReady() { |
1617 |
boolean isDocumentReady() { |
1617 |
CloneableEditorSupport redirect = CloneableEditorSupportRedirector.findRedirect(this); |
1618 |
CloneableEditorSupport redirect = CloneableEditorSupportRedirector.findRedirect(this, RequestType.IS_DOCUMENT_READY); |
1618 |
if (redirect != null) { |
1619 |
if (redirect != null) { |
1619 |
return redirect.isDocumentReady(); |
1620 |
return redirect.isDocumentReady(); |
1620 |
} |
1621 |
} |
Lines 1626-1632
Link Here
|
1626 |
* @param s the new MIME type |
1627 |
* @param s the new MIME type |
1627 |
*/ |
1628 |
*/ |
1628 |
public void setMIMEType(String s) { |
1629 |
public void setMIMEType(String s) { |
1629 |
CloneableEditorSupport redirect = CloneableEditorSupportRedirector.findRedirect(this, true); |
1630 |
CloneableEditorSupport redirect = CloneableEditorSupportRedirector.findRedirect(this, RequestType.SET_MIME_TYPE, true); |
1630 |
if (redirect != null) { |
1631 |
if (redirect != null) { |
1631 |
redirect.setMIMEType(s); |
1632 |
redirect.setMIMEType(s); |
1632 |
return; |
1633 |
return; |
Lines 1728-1734
Link Here
|
1728 |
* @since 4.7 |
1729 |
* @since 4.7 |
1729 |
*/ |
1730 |
*/ |
1730 |
public InputStream getInputStream() throws IOException { |
1731 |
public InputStream getInputStream() throws IOException { |
1731 |
CloneableEditorSupport redirect = CloneableEditorSupportRedirector.findRedirect(this); |
1732 |
CloneableEditorSupport redirect = CloneableEditorSupportRedirector.findRedirect(this, RequestType.GET_INPUT_STREAM); |
1732 |
if (redirect != null) { |
1733 |
if (redirect != null) { |
1733 |
return redirect.getInputStream(); |
1734 |
return redirect.getInputStream(); |
1734 |
} |
1735 |
} |
Lines 2232-2238
Link Here
|
2232 |
*/ |
2233 |
*/ |
2233 |
@Override |
2234 |
@Override |
2234 |
protected boolean close(boolean ask) { |
2235 |
protected boolean close(boolean ask) { |
2235 |
CloneableEditorSupport redirect = CloneableEditorSupportRedirector.findRedirect(this); |
2236 |
CloneableEditorSupport redirect = CloneableEditorSupportRedirector.findRedirect(this, RequestType.CLOSE); |
2236 |
if (redirect != null) { |
2237 |
if (redirect != null) { |
2237 |
return redirect.close(ask); |
2238 |
return redirect.close(ask); |
2238 |
} |
2239 |
} |
Lines 2602-2608
Link Here
|
2602 |
* @return always non-<code>null</code> editor |
2603 |
* @return always non-<code>null</code> editor |
2603 |
*/ |
2604 |
*/ |
2604 |
private final Pane openAtImpl(final PositionRef pos, final int column, boolean reuse) { |
2605 |
private final Pane openAtImpl(final PositionRef pos, final int column, boolean reuse) { |
2605 |
CloneableEditorSupport redirect = CloneableEditorSupportRedirector.findRedirect(this); |
2606 |
CloneableEditorSupport redirect = CloneableEditorSupportRedirector.findRedirect(this, RequestType.OPEN_AT); |
2606 |
if (redirect != null) { |
2607 |
if (redirect != null) { |
2607 |
return redirect.openAtImpl(pos, column, reuse); |
2608 |
return redirect.openAtImpl(pos, column, reuse); |
2608 |
} |
2609 |
} |