1   package com.stateofflow.eclipse.metrics.export.wizard;
2   
3   import java.io.File;
4   
5   import org.eclipse.core.runtime.CoreException;
6   import org.eclipse.jface.util.IPropertyChangeListener;
7   import org.eclipse.swt.widgets.Shell;
8   
9   import com.stateofflow.eclipse.metrics.swt.SWTBuilder;
10  
11  class CommonControlsAgent implements Agent {
12      private final ProjectAgent projectFragment;
13      private final ExportDirectoryAgent exportDirectoryFragment;
14  
15      public CommonControlsAgent(final SWTBuilder builder, final IPropertyChangeListener listener, final Shell shell) {
16          builder.addGroup().setGridLayout(3);
17          projectFragment = new ProjectAgent(builder);
18          exportDirectoryFragment = new ExportDirectoryAgent(builder, listener, shell);
19          builder.pop();
20      }
21  
22      public void updateStatus(final StatusUpdateable updateable) {
23          projectFragment.updateStatus(updateable);
24          exportDirectoryFragment.updateStatus(updateable);
25      }
26  
27      public void initialise(final ProjectProperties properties) throws CoreException {
28          projectFragment.initialise(properties);
29          exportDirectoryFragment.initialise(properties);
30      }
31  
32      public String getProject() {
33          return projectFragment.getProject();
34      }
35  
36      public File getExportDirectory() {
37          return exportDirectoryFragment.getDirectory();
38      }
39  }
40