|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface Application
Provides access to core application-wide functionality and methods for working with the IDEA thread model. The thread model defines two main types of actions which can access the PSI and other IDEA data structures: read actions (which do not modify the data) and write actions (which modify some data).
You can call methods requiring read access from the Swing event-dispatch thread without using
runReadAction(java.lang.Runnable) method. If you need to invoke such methods from another thread you have to use
runReadAction(java.lang.Runnable). Multiple read actions can run at the same time without locking each other.
Write actions can be called only from the Swing thread using runWriteAction(java.lang.Runnable) method.
If there are read actions running at this moment runWriteAction is blocked until they are completed.
| Method Summary | ||
|---|---|---|
void |
addApplicationListener(ApplicationListener listener)
Adds an ApplicationListener. |
|
void |
assertIsDispatchThread()
Asserts whether the method is being called from the event dispatch thread. |
|
void |
assertReadAccessAllowed()
Asserts whether the read access is allowed. |
|
void |
assertWriteAccessAllowed()
Asserts whether the write access is allowed. |
|
void |
exit()
Exits the application, showing the exit confirmation prompt if it is enabled. |
|
ModalityState |
getCurrentModalityState()
Returns the current modality state for the Swing dispatch thread. |
|
java.lang.Object |
getCurrentWriteAction(java.lang.Class actionClass)
Returns the currently executing write action of the specified class. |
|
ModalityState |
getDefaultModalityState()
Returns the current modality state for the current thread (which may be different from the Swing dispatch thread). |
|
long |
getIdleTime()
Returns the time in milliseconds during which IDEA received no input events. |
|
ModalityState |
getModalityStateForComponent(java.awt.Component c)
Returns the modality state for the dialog to which the specified component belongs. |
|
ModalityState |
getNoneModalityState()
Returns the modality state representing the state when no modal dialogs are active. |
|
long |
getStartTime()
Returns the time of IDEA start, in milliseconds since midnight, January 1, 1970 UTC. |
|
void |
invokeAndWait(java.lang.Runnable runnable,
ModalityState modalityState)
Causes runnable.run() to be executed synchronously on the
AWT event dispatching thread, when IDEA is in the specified modality
state. |
|
void |
invokeLater(java.lang.Runnable runnable)
Causes runnable.run() to be executed asynchronously on the AWT event dispatching thread. |
|
void |
invokeLater(java.lang.Runnable runnable,
ModalityState state)
Causes runnable.run() to be executed asynchronously on the AWT event dispatching thread, when IDEA is in the specified modality state. |
|
boolean |
isDispatchThread()
Checks if the current thread is the Swing dispatch thread. |
|
boolean |
isHeadlessEnvironment()
Checks if IDEA is running as a command line applet or in unit test mode. |
|
boolean |
isReadAccessAllowed()
Checks if the read access is currently allowed. |
|
boolean |
isUnitTestMode()
Checks if IDEA is currently running unit tests. |
|
boolean |
isWriteAccessAllowed()
Checks if the write access is currently allowed. |
|
void |
removeApplicationListener(ApplicationListener listener)
Removes an ApplicationListener. |
|
boolean |
runProcessWithProgressSynchronously(java.lang.Runnable process,
java.lang.String progressTitle,
boolean canBeCanceled,
Project project)
Runs the specified operation in a background thread and shows a modal progress dialog in the main thread while the operation is executing. |
|
|
runReadAction(Computable<T> computation)
Runs the specified computation in a read action. |
|
void |
runReadAction(java.lang.Runnable action)
Runs the specified read action. |
|
|
runWriteAction(Computable<T> computation)
Runs the specified computation in a write action. |
|
void |
runWriteAction(java.lang.Runnable action)
Runs the specified write action. |
|
void |
saveAll()
Saves all open documents and projects. |
|
void |
saveSettings()
Saves all application settings. |
|
| Methods inherited from interface com.intellij.openapi.components.ComponentManager |
|---|
getComponent, getComponent, getComponent, getComponentInterfaces, getComponents, getPicoContainer, hasComponent |
| Methods inherited from interface com.intellij.openapi.util.UserDataHolder |
|---|
getUserData, putUserData |
| Method Detail |
|---|
void runReadAction(java.lang.Runnable action)
action - the action to run.<T> T runReadAction(Computable<T> computation)
computation - the computation to perform.
void runWriteAction(java.lang.Runnable action)
action - the action to run<T> T runWriteAction(Computable<T> computation)
computation - the computation to run
@Nullable java.lang.Object getCurrentWriteAction(java.lang.Class actionClass)
actionClass - the class of the write action to return.
void assertReadAccessAllowed()
void assertWriteAccessAllowed()
void assertIsDispatchThread()
void addApplicationListener(ApplicationListener listener)
ApplicationListener.
listener - the listener to addvoid removeApplicationListener(ApplicationListener listener)
ApplicationListener.
listener - the listener to removevoid saveAll()
void saveSettings()
void exit()
boolean isWriteAccessAllowed()
assertWriteAccessAllowed(),
runWriteAction(Runnable)boolean isReadAccessAllowed()
assertReadAccessAllowed(),
runReadAction(Runnable)boolean isDispatchThread()
boolean runProcessWithProgressSynchronously(java.lang.Runnable process,
java.lang.String progressTitle,
boolean canBeCanceled,
Project project)
process - the operation to execute.progressTitle - the title of the progress window.canBeCanceled - whether "Cancel" button is shown on the progress window.project - the project in the context of which the operation is executed.
void invokeLater(java.lang.Runnable runnable)
runnable - the runnable to execute.
void invokeLater(java.lang.Runnable runnable,
@NotNull
ModalityState state)
runnable - the runnable to execute.state - the state in which the runnable will be executed.
void invokeAndWait(java.lang.Runnable runnable,
@NotNull
ModalityState modalityState)
runnable.run() to be executed synchronously on the
AWT event dispatching thread, when IDEA is in the specified modality
state. This call blocks until all pending AWT events have been processed and (then)
runnable.run() returns.
runnable - the runnable to execute.modalityState - the state in which the runnable will be executed.ModalityState getCurrentModalityState()
ModalityState getModalityStateForComponent(java.awt.Component c)
c - the component for which the modality state is requested.
ModalityState getDefaultModalityState()
ModalityState getNoneModalityState()
long getStartTime()
long getIdleTime()
boolean isUnitTestMode()
boolean isHeadlessEnvironment()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||