IPreferencesSupport
, IPropertySupport
Represents the content, configuration, and current state of a Workshop application.
The IWorkspace currently open in Workshop may be obtained by using Application.getWorkspace(). An IWorkspace may contain IProjects, shared libraries, and J2EE modules. If the application is a deployable J2EE EAR, then the root directory of the IWorkspace will be the exploded EAR directory deployed to WebLogic Server.
A .work file in the IWorkspace's root directory contains application configuration information, including the set of projects in the app. The .work file is intended to be sharable among application developers, and any paths it contains should be relative to the workspace or project root directories. Use the system Preferences node to read and write information to the .work file. User and machine-specific information may be persisted with the user Preferences node.
IPreferencesSupport
, IPropertySupport
Nested Class Summary |
public static interface | IWorkspace.IWorkspaceState
Represents an IWorkspace state. |
Field Summary |
public static final |
|
public static final |
|
public static final |
|
Method Summary |
public boolean |
|
public boolean |
|
public boolean | |
public void |
|
public boolean |
|
public |
|
public |
|
public boolean |
|
public |
|
public |
|
public |
|
public |
|
public |
|
public | |
public |
|
public |
|
public |
|
public |
|
public |
|
public |
|
public |
|
public |
|
public |
|
public |
|
public |
|
public |
|
public |
|
public |
|
public | |
public | |
public boolean |
|
public boolean |
|
public boolean |
|
public boolean |
|
public boolean |
|
public void |
|
public void | |
public void |
|
public |
|
public |
|
Methods from interface com.bea.ide.core. |
|
Methods from interface com.bea.ide.core. |
|
Field Detail |
public static final String
PROP_IsDeploying
public static final String
STATE_IsBuilding
public static final String
STATE_IsRunning
Method Detail |
public boolean addLibrary(URI
libraryURI)
Adds a file as a library. This copies the file into the APP-INF/lib directory.
Library name will be the same as the source URI file name.
If the libary exists, the user will be prompted for whether to overwrite.
public boolean addLibrary(Adds a file as a library. This copies a file into the APP-INF/lib directory.URI
libraryURI,String
destName, boolean overwrite)
public boolean addModule(URI
moduleURI)
Adds a file as a module, deploying it if the server is running.
public void clearState(String
stateName)
Call this method after successfully seting the state to signify the state
is no longer in effect.
public boolean close()Saves the .work and .pref files, removes all listeners that the workspace has registered. There is no way to make the workspace "live" again after calling close.
publicFind the project that contains the given URI. May return null.IProject
findProject(URI
uri)
publicFind the project with the specified name. May return null.IProject
findProject(String
name)
public boolean getBooleanProperty(String
propName)
Returns an IWorkspace property as a boolean value.
public IFile
getCacheRoot()
Returns a directory where workspace-related files
may be cached by Workshop services. The content of this
directory will not be deleted when the IWorkspace is closed.
It is located beneath the application root directory,
so it will be deleted if/when the user deletes the
application from the filesystem.
publicCompute the class name for the given file. Does this by finding a parent directory in the source path and computing package.String
getClassName(URI
doc)
public IProject
getCurrentSelectedProject()
Returns the currently selected project.
Application.PROP_FocusedURIs is used to determine the currently focused
URI in Workshop. If the focused URI is within a workspace project, then that
project will be returned. Otherwise, the project of the last opened
document will be returned. If the last opened document cannot be determined,
then the first IProject in the project list will be returned.
public IFile
getDirectory()
Returns the workspace root directory.
publicReturns the display path for the uri. This includes the project name and the project relative path only.String
getDisplayPath(URI
uri)
publicUsed to lookup home directory paths.String
getHome(String
homeKey)
public String
getHttpRoot()
Get the base of the URL for this workspace's server. e.g. http://localhost:7001
public IFile
getIFile()
Returns the .work file for this workspace.
public URI
[] getLibraries()
Returns an array containing all of the shared libraries in this workspace.
public IFile
getLibrariesDirectory()
Returns the J2EE libraries directory.
public IModule
[] getModules()
Returns an array of URIs containing all of the modules (EJBs,
web-apps, etc.)
public IFile
getModulesDirectory()
Returns the J2EE Modules directory.
public String
getName()
Returns the name of this workspace. The name is independent of the
filename or the containing folder, and is stored inside
the workspace file.
publicFind the project that has the given name. May return null.IProject
getProject(String
name)
publicReturns the relative path of the given file inside this project.String
getProjectPath(URI
uri)
public IProject
[] getProjects()
Returns a list of all the projects in this workspace.
publicReturns a list of all the projects in this workspace that support a given attribute.IProject
[] getProjects(String
attribute)
publicReturns a path relative to .work file. If the uri does not refer to a resource within the directory containing the .work file, this method returns null.String
getRelativePath(URI
uri)
public ISecurityConfig
getSecurityConfig()
Gets the current security configuration. The SecurityConfiguration
represents a snapshot of the present security settings, such as
the current security roles and test users. It is mutable, and is not stored
permanently until saveSecurityConfig() is called.
Related Topics
public IWorkspace.IWorkspaceState
getState()
Returns the current state of the workspace, or null if it is not in a specific state.
The name and verb of the current state is available through IWorkspaceState.
publicReturns a file given a path relative to the workspace directory. Can safely be called with absolute paths.IFile
newFile(String
path)
publicreturns a URI given a path relative to the workspace directory. Can safely be called with absolute paths.URI
newURI(String
path)
public boolean removeLibrary(String
libraryName)
Removes a file from the libraries. This deletes the given
file from the APP-INF/lib directory.
public boolean removeModule(String
moduleName)
Removes a module from the application. This will also
undeploy it.
public boolean removeProject(String
name,
boolean delete)
Remove the project from the Workspace. Optionally deletes the project on disk.
public boolean renameProject(Renames the Project. Does not change the directory name, just the user-visible name.String
oldName,String
newName)
public boolean save()Saves the .work and user preferences file to disk.
public void saveSecurityConfig(ISecurityConfig
config)
Sets this security configuration as the workspace's and stores
its settings.
Related Topics
public void setName(String
name)
Sets the name of this workspace.
public void setState(Projects can be set in states that exclude all other actions from changing the state until the state is cleared. A good example is build; when the project is being built, the project's state is set with this call. Other actions that need to set the state, such as debugging, will not be able to change the state unless the user agrees to stop the current active state (like build) in order to perform the new action(debugging).String
stateName,String
userVerb,IActionProxy
stopAction)
throwsIllegalStateException
If the user chooses not to cancel the current state, an IllegalStateException is thrown and the caller must cancel their operation.
The only predefined state is the closed state, where a project has been removed from the workspace or the workspace itself has been closed. Ideally, closed projects should be discarded, but race conditions exist between when the project is closed and when the notifications of said closing are processed.
SetState helps resolve this problem for those operations that require the project to be in a non-closed state for their duration. The user must authorize the canceling of pending state-changing operations for the close to go forward.
Callers of this method must bound their operation between setState and clearState. The caller must pass in a user-readable operation verb (for instance, "building") as well as an IActionProxy that can be used to stop the operation. All states must pass in a stopAction. This stopAction must be synchronous, and thus should not return from actionPerformed until the action it stops is completely stopped.
IllegalStateException
publicGet the preference subtree in the system preferences that corresponds to the given package name.Preferences
systemNodeForPackage(String
name)
publicGet the preference subtree in the user preferences that corresponds to the given package name.Preferences
userNodeForPackage(String
name)