--- a/openide.awt/apichanges.xml +++ a/openide.awt/apichanges.xml @@ -47,6 +47,25 @@ AWT API + + + Allow messages to show in the main status line permanently. + + + + + + Because of merging of editor's status line with main window's status line + it is necessary to define the 'importance' of messages being displayed in the + main status line. Messages with higher importance will replace messages + with lower importance. These important messages will stay permanently visible + until explicitly cleared or replaced (as opposed to current implementation + when all status line messages are removed after some time) or when handle + object associated with these messages get garbage-collected. + + + + Actions can have "menuText" and "popupText" properties --- a/openide.awt/nbproject/project.properties +++ a/openide.awt/nbproject/project.properties @@ -46,4 +46,4 @@ #javadoc.apichanges=${basedir}/api/apichanges.xml javadoc.apichanges=${basedir}/apichanges.xml -spec.version.base=7.4.0 +spec.version.base=7.5.0 --- a/openide.awt/src/org/openide/awt/StatusDisplayer.java +++ a/openide.awt/src/org/openide/awt/StatusDisplayer.java @@ -51,6 +51,24 @@ * @since 3.14 */ public abstract class StatusDisplayer { + + /** + * Default message 'importance' for file annotations. + */ + public static final int IMPORTANCE_ANNOTATION = 1000; + /** + * Default message 'importance' for messages from incremental find. + */ + public static final int IMPORTANCE_INCREMENTAL_FIND = 900; + /** + * Default message 'importance' for messages from find and replace actions. + */ + public static final int IMPORTANCE_FIND_OR_REPLACE = 800; + /** + * Default message 'importance' for error and warning messages on current line. + */ + public static final int IMPORTANCE_ERROR_HIGHLIGHT = 700; + private static StatusDisplayer INSTANCE = null; /** Subclass constructor. */ @@ -89,10 +107,34 @@ *

Default implementation of status line in NetBeans * displays the text in status line and clears it after a while. * Also there is no guarantee how long the text will be displayed as - * it can be replaced with new call to this method at any time. + * it can be replaced with new call to this method at any time.

+ *

Note: The text may not show in the status line at all if some + * other text with higher importance is currently showing in the status line.

* @param text the text to be shown + * @see #setStatusText(String,int) */ public abstract void setStatusText(String text); + + /** + *

Show text in the status line. importance argument + * indicates that the text should stay in the status line until it is replaced + * with new text by calling setStatusText(String,int) again with + * the same or higher importance value.

+ *

The text will be removed from status line when this method's return value is + * garbage-collected or excplicitly by calling Message.clear(int). + * @param text The text to be shown until some other text with the same or higher + * importance is passed into the status line. + * @param importance Positive integer defining the 'Importance' of the message + * to be displayed, the higher number the higher importance. + * @return Handle associated with given status line text. The text will be removed + * from status line either after calling clear(int) on this handle or when + * the Message object is garbage-collected. + * @throws IllegalArgumentException If importance <= 0 + */ + public Message setStatusText(String text, int importance) { + setStatusText(text); + return new Message(); + } /** Add a listener for when the text changes. * @param l a listener @@ -103,6 +145,22 @@ * @param l a listener */ public abstract void removeChangeListener(ChangeListener l); + + /** + * Handle for 'important' status line messages. The message will be removed + * from status line when this object is garbage-collected. + * + * @see #setStatusText(String,int) + */ + public static class Message { + /** + * Removes this message from status line after timeInMillis + * milliseconds. + * @param timeInMillis + */ + public void clear(int timeInMillis) { + } + } /** * Trivial default impl for standalone usage.