1 package com.stateofflow.eclipse.metrics.export.wizard;
2
3 import org.eclipse.core.runtime.CoreException;
4 import org.eclipse.jface.preference.StringFieldEditor;
5
6 import com.stateofflow.eclipse.metrics.swt.SWTBuilder;
7
8 class ProjectAgent implements Agent {
9 private final StringFieldEditor projectText;
10
11 public ProjectAgent(final SWTBuilder builder) {
12 projectText = builder.createDisabledStringFieldEditor("Project:");
13 builder.addLabel("");
14 }
15
16 public String getProject() {
17 return projectText.getStringValue();
18 }
19
20 public void updateStatus(final StatusUpdateable updateable) {
21 updateable.updateStatus(isProjectSpecified(), "Project must be specified");
22 }
23
24 private boolean isProjectSpecified() {
25 return getProject().length() != 0;
26 }
27
28 public void initialise(final ProjectProperties properties) throws CoreException {
29 projectText.setStringValue(properties.getProject().getPath().toString());
30 }
31 }
32