70 final String bbUser = properties.get(
"bbUser");
71 final String bbHost = properties.get(
"bbHost");
72 final String bbPort = properties.get(
"bbPort");
73 final String bbContext = properties.get(
"bbContext");
74 final String bbCreateDir = URLDecoder.decode(properties.get(
"bbCreateDir"),
"UTF-8");
75 final String bbCreatePath = URLDecoder.decode(properties.get(
"bbCreatePath"),
"UTF-8");
84 final Resources resources =
new Resources(getClass().getName());
86 WTKXSerializer wtkxSerializer =
new WTKXSerializer(resources);
87 window = (Window) wtkxSerializer.readObject(
this,
"working_desktop.wtkx");
88 wtkxSerializer.bind(
this, WorkingDesktop.class);
90 commit = (Dialog) wtkxSerializer.readObject(
this,
"commit_dialog.wtkx");
91 wtkxSerializer.bind(
this, WorkingDesktop.class);
93 ProgressSheet.getInstance(window);
95 syncButton.getButtonPressListeners().add(
new ButtonPressListener() {
97 public void buttonPressed(Button button) {
98 commit.setModal(
true);
103 doSyncButton.getButtonPressListeners().add(
new ButtonPressListener() {
104 public void buttonPressed(Button button) {
107 SyncTask syncTask =
new SyncTask(workingTreeView, resources.getString(
"synchronize"),
108 commentCommitInput.getText(),
getSelection(commitAction),
109 commentUpdateInput.getText(),
getSelection(updateAction));
110 TaskListener<String> taskListener =
new TaskListener<String>() {
113 public void taskExecuted(Task<String> task) {
115 workingDirectory.
reload();
116 workingTreeView.setTreeData(
new WorkingTreeModel(workingDirectory));
117 TreeUtil.expandRootBranches(workingTreeView);
118 System.out.println(
"Synchronous task execution complete: \"" + task.getResult() +
"\"");
119 }
catch (ParseException ex) {
120 Logger.getLogger(WorkingDesktop.class.getName()).log(Level.SEVERE,
null, ex);
125 public void executeFailed(Task<String> task) {
127 workingDirectory.
reload();
128 workingTreeView.setTreeData(
new WorkingTreeModel(workingDirectory));
129 TreeUtil.expandRootBranches(workingTreeView);
130 System.err.println(task.getFault());
131 }
catch (ParseException ex) {
132 Logger.getLogger(WorkingDesktop.class.getName()).log(Level.SEVERE,
null, ex);
137 syncTask.execute(
new TaskAdapter<String>(taskListener));
141 openButton.getButtonPressListeners().add(
new ButtonPressListener() {
143 public void buttonPressed(Button button) {
144 TreeNode tn = (TreeNode) workingTreeView.getSelectedNode();
145 if(tn instanceof TreeDirectory) {
146 WdRuntime.launch(((TreeDirectory) tn).getDirectory().getSystemFile().getAbsolutePath());
147 }
else if(tn instanceof TreeWorkFile) {
148 WdRuntime.launch(((TreeWorkFile) tn).getWorkFile().getSystemFile().getAbsolutePath());
153 refreshButton.getButtonPressListeners().add(
new ButtonPressListener() {
155 public void buttonPressed(Button button) {
159 public Object execute() throws TaskExecutionException {
161 workingDirectory.
reload();
162 workingTreeView.setTreeData(
new WorkingTreeModel(workingDirectory));
163 TreeUtil.expandRootBranches(workingTreeView);
164 }
catch (Exception ex) {
165 Logger.getLogger(WorkingDesktop.class.getName()).log(Level.SEVERE,
null, ex);
175 deleteButton.getButtonPressListeners().add(
new ButtonPressListener() {
177 public void buttonPressed(Button button) {
178 DelTask delTask =
new DelTask(workingTreeView, resources.getString(
"deleteLocally"));
179 TaskListener<String> taskListener =
new TaskListener<String>() {
182 public void taskExecuted(Task<String> task) {
184 workingDirectory.
reload();
185 workingTreeView.setTreeData(
new WorkingTreeModel(workingDirectory));
186 TreeUtil.expandRootBranches(workingTreeView);
187 System.out.println(
"Deletion task execution complete: \"" + task.getResult() +
"\"");
188 }
catch (ParseException ex) {
189 Logger.getLogger(WorkingDesktop.class.getName()).log(Level.SEVERE,
null, ex);
194 public void executeFailed(Task<String> task) {
196 workingDirectory.
reload();
197 workingTreeView.setTreeData(
new WorkingTreeModel(workingDirectory));
198 TreeUtil.expandRootBranches(workingTreeView);
199 System.err.println(task.getFault());
200 }
catch (ParseException ex) {
201 Logger.getLogger(WorkingDesktop.class.getName()).log(Level.SEVERE,
null, ex);
206 delTask.execute(
new TaskAdapter<String>(taskListener));
210 window.open(display);
215 public Object execute() throws TaskExecutionException {
217 workingDirectory =
new WorkingDirectory(bbUser, bbHost, bbPort, bbContext);
218 workingDirectory.
initialize(bbCreateDir, bbCreatePath);
219 workingTreeView.setCheckmarksEnabled(
true);
220 workingTreeView.setSelectMode(TreeView.SelectMode.SINGLE);
221 workingTreeView.setShowMixedCheckmarkState(
true);
222 workingTreeView.setTreeData(
new WorkingTreeModel(workingDirectory));
223 TreeUtil.expandRootBranches(workingTreeView);
224 }
catch (ParseException ex) {
225 Logger.getLogger(WorkingDesktop.class.getName()).log(Level.SEVERE,
null, ex);
int getSelection(ButtonGroup group)
void initialize(String bbCreateDir, String bbCreatePath)