01 package ideExtensions.customProject;
02
03 import com.bea.ide.Application;
04 import com.bea.ide.core.MessageSvc;
05 import com.bea.ide.filesystem.IFile;
06 import com.bea.ide.workspace.IProject;
07 import com.bea.ide.workspace.IWorkspace;
08 import com.bea.ide.workspace.project.IProjectDriver;
09
10 /**
11 * A project driver loaded for each project of the PHP project type.
12 * A project driver implements IProjectDriver, whose two methods,
13 * activate and deactivate, provide a way for you to associate code
14 * with the start and end of a project's use in an application.
15 *
16 * This sample shows a typical use of these methods: adding and removing
17 * listeners. By adding a property event listener in the driver's
18 * activate method and removing it in the deactivate method, you
19 * associate the listener with the project for the duration of
20 * the project's use. In this way you can listen for IDE-,
21 * application- and document-related events and changes to properties
22 * defined by WebLogic Workshop.
23 */
24 public class PhpProjectDriver implements IProjectDriver
25 {
26 IProject m_project = null;
27 PhpProjectListener m_listener = null;
28
29 /**
30 * Constructs a new instance of this driver using the
31 * property with which this instance is associated. A
32 * project driver must provide a constructor that takes
33 * an IProject instance. If multiple projects of this type
34 * are included in the application, then multiple instances
35 * of this driver will be created, one for each project.
36 *
37 * @param project The project with which this driver instance
38 * is associated.
39 */
40 public PhpProjectDriver(IProject project)
41 {
42 m_project = project;
43 /**
44 * Create a listener with the project associated with
45 * this instance of the driver.
46 */
47 m_listener = new PhpProjectListener(m_project);
48 }
49
50 /**
51 * Called by the IDE when a project of this type is activated, such as
52 * when a project of this type is discovered to be present in
53 * the open application.
54 */
55 public void activate()
56 {
57 /**
58 * Add a listener that will be used for changes to the PROP_InitLevel
59 * property. This property's value changes to track progress of the IDE's
60 * startup.
61 */
62 Application.get().addPropertyChangeListener(Application.PROP_InitLevel, m_listener);
63 }
64
65 /**
66 * Called by the IDE when a project of this type is deactivated, such as
67 * when a project of this type is removed from the open application.
68 */
69 public void deactivate()
70 {
71 /**
72 * Remove the listener that was added when this project
73 * type was activated.
74 */
75 Application.get().removePropertyChangeListener(m_listener);
76 }
77 }
|