Lines 1599-1604
Link Here
|
1599 |
return false; |
1599 |
return false; |
1600 |
} |
1600 |
} |
1601 |
|
1601 |
|
|
|
1602 |
// source modified, remove it from tab-reusing slot |
1603 |
lastReusable.clear(); |
1602 |
updateTitles(); |
1604 |
updateTitles(); |
1603 |
|
1605 |
|
1604 |
return true; |
1606 |
return true; |
Lines 1960-1970
Link Here
|
1960 |
} |
1962 |
} |
1961 |
} |
1963 |
} |
1962 |
|
1964 |
|
|
|
1965 |
private static Reference<CloneableTopComponent> lastReusable = new WeakReference(null); |
1966 |
|
1967 |
// temporal - should be replaced by better impl in winsys |
1968 |
private static void replaceTc(TopComponent orig, TopComponent open) { |
1969 |
orig.close(); |
1970 |
open.open(); |
1971 |
} |
1972 |
|
1963 |
// #18981. There could happen a thing also another class type |
1973 |
// #18981. There could happen a thing also another class type |
1964 |
// of CloneableTopCoponent then CloneableEditor could be in allEditors. |
1974 |
// of CloneableTopCoponent then CloneableEditor could be in allEditors. |
1965 |
|
1975 |
|
1966 |
/** Opens a <code>CloneableEditor</code> component. */ |
1976 |
/** Opens a <code>CloneableEditor</code> component. */ |
1967 |
private Pane openPane() { |
1977 |
private Pane openPane(boolean reuse) { |
1968 |
Pane ce = null; |
1978 |
Pane ce = null; |
1969 |
boolean displayMsgOpened = false; |
1979 |
boolean displayMsgOpened = false; |
1970 |
|
1980 |
|
Lines 1991-1998
Link Here
|
1991 |
} |
2001 |
} |
1992 |
|
2002 |
|
1993 |
// #36601 - open moved outside getLock() synchronization |
2003 |
// #36601 - open moved outside getLock() synchronization |
1994 |
ce.getComponent().open(); |
2004 |
CloneableTopComponent ctc = ce.getComponent(); |
1995 |
|
2005 |
if (reuse && displayMsgOpened) { |
|
|
2006 |
CloneableTopComponent last = lastReusable.get(); |
2007 |
if (last != null) { |
2008 |
replaceTc(last, ctc); |
2009 |
} else { |
2010 |
ctc.open(); |
2011 |
} |
2012 |
lastReusable = new WeakReference(ctc); |
2013 |
} else { |
2014 |
ctc.open(); |
2015 |
} |
2016 |
|
1996 |
if (displayMsgOpened) { |
2017 |
if (displayMsgOpened) { |
1997 |
String msg = messageOpened(); |
2018 |
String msg = messageOpened(); |
1998 |
|
2019 |
|
Lines 2046-2052
Link Here
|
2046 |
return null; |
2067 |
return null; |
2047 |
} |
2068 |
} |
2048 |
} |
2069 |
} |
2049 |
|
2070 |
|
|
|
2071 |
final Pane openReuse(final PositionRef pos, final int column) { |
2072 |
return openAtImpl(pos, column, true); |
2073 |
} |
2074 |
|
2050 |
/** Forcibly create one editor component. Then set the caret |
2075 |
/** Forcibly create one editor component. Then set the caret |
2051 |
* to the given position. |
2076 |
* to the given position. |
2052 |
* @param pos where to place the caret |
2077 |
* @param pos where to place the caret |
Lines 2054-2060
Link Here
|
2054 |
* @since 5.2 |
2079 |
* @since 5.2 |
2055 |
*/ |
2080 |
*/ |
2056 |
protected final Pane openAt(final PositionRef pos, final int column) { |
2081 |
protected final Pane openAt(final PositionRef pos, final int column) { |
2057 |
final Pane e = openPane(); |
2082 |
return openAtImpl(pos, column,false); |
|
|
2083 |
} |
2084 |
/** Forcibly create one editor component. Then set the caret |
2085 |
* to the given position. |
2086 |
* @param pos where to place the caret |
2087 |
* @return always non-<code>null</code> editor |
2088 |
* @since 5.2 |
2089 |
*/ |
2090 |
private final Pane openAtImpl(final PositionRef pos, final int column, boolean reuse) { |
2091 |
final Pane e = openPane(reuse); |
2058 |
final Task t = prepareDocument(); |
2092 |
final Task t = prepareDocument(); |
2059 |
e.ensureVisible(); |
2093 |
e.ensureVisible(); |
2060 |
class Selector implements TaskListener, Runnable { |
2094 |
class Selector implements TaskListener, Runnable { |