Index: api/doc/changes/apichanges.xml =================================================================== RCS file: /cvs/openide/api/doc/changes/apichanges.xml,v --- api/doc/changes/apichanges.xml 1.236 +++ api/doc/changes/apichanges.xml @@ -117,0 +117,35 @@ + + + + Added a new SHOW_TOFRONT constant to the org.openide.text.Line class. + + + + + The new constant is used in the EditorSupportLineSet and brings + editor's parent Window to be fronted above all other top-level windows. + + + + + + + + + Added the TopComponent ability to bring their parent + Window to front of other windows. + + + + + The TopComponent class has a new method toFront() + that attempts to bring the parent Window of the TopComponent to + front of other top-level windows. + The method is implemented in the WindowManager class + using AWT's java.awt.Window#toFront(). + + + + + + @@ -6490,1 +6525,1 @@ - --- + Index: src/org/openide/text/EditorSupportLineSet.java =================================================================== RCS file: /cvs/openide/src/org/openide/text/EditorSupportLineSet.java,v --- src/org/openide/text/EditorSupportLineSet.java 1.41 +++ src/org/openide/text/EditorSupportLineSet.java @@ -81,1 +81,4 @@ - editor.getComponent ().requestActive(); --- + editor.getComponent().requestActive(); + } else if (kind == SHOW_TOFRONT) { + editor.getComponent().toFront(); + editor.getComponent().requestActive(); @@ -83,0 +86,1 @@ + Index: src/org/openide/text/Line.java =================================================================== RCS file: /cvs/openide/src/org/openide/text/Line.java,v --- src/org/openide/text/Line.java 1.30 +++ src/org/openide/text/Line.java @@ -81,0 +81,9 @@ + + /** Same as SHOW_GOTO except that the Window Manager attempts to front the + * editor window (i.e. make it the top most window). + * @see #show(int) show + * @see org.openide.windows.TopComponent#toFront() + * @since 5.8 + */ + public final static int SHOW_TOFRONT = 3; + Index: src/org/openide/windows/TopComponent.java =================================================================== RCS file: /cvs/openide/src/org/openide/windows/TopComponent.java,v --- src/org/openide/windows/TopComponent.java 1.138 +++ src/org/openide/windows/TopComponent.java @@ -556,0 +556,9 @@ + /** + * Attempts to bring the parent Window or Frame + * of this TopComponent to front of other windows. + * @since 5.8 + */ + public void toFront() { + WindowManager.getDefault().topComponentToFront(this); + } + Index: src/org/openide/windows/WindowManager.java =================================================================== RCS file: /cvs/openide/src/org/openide/windows/WindowManager.java,v --- src/org/openide/windows/WindowManager.java 1.48 +++ src/org/openide/windows/WindowManager.java @@ -18,0 +18,1 @@ +import java.awt.Frame; @@ -19,0 +20,1 @@ +import java.awt.Window; @@ -22,0 +24,1 @@ +import javax.swing.SwingUtilities; @@ -380,0 +383,20 @@ + } + + /** + * Attempts to bring the parent Window of the given TopComponent + * to front of other windows. + * @see java.awt.Window#toFront() + * @since 5.8 + */ + protected void topComponentToFront(TopComponent tc) { + Window parentWindow = SwingUtilities.getWindowAncestor( tc ); + // be defensive, although w probably will always be non-null here + if( null != parentWindow ) { + if( parentWindow instanceof Frame ) { + Frame parentFrame = (Frame)parentWindow; + int state = parentFrame.getExtendedState(); + if( (state & Frame.ICONIFIED) > 0 ) + parentFrame.setExtendedState( state & ~Frame.ICONIFIED ); + } + parentWindow.toFront(); + }