2 * Copyright (C) 2007-2012 Argeo GmbH
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package org
.argeo
.slc
.client
.ui
.dist
.views
;
18 import org
.argeo
.jcr
.ArgeoNames
;
19 import org
.argeo
.slc
.client
.ui
.dist
.DistConstants
;
20 import org
.argeo
.slc
.client
.ui
.dist
.DistPlugin
;
21 import org
.argeo
.slc
.client
.ui
.dist
.controllers
.DistTreeComparator
;
22 import org
.argeo
.slc
.client
.ui
.dist
.controllers
.DistTreeDoubleClickListener
;
23 import org
.argeo
.slc
.client
.ui
.dist
.controllers
.DistTreeLabelProvider
;
24 import org
.argeo
.slc
.jcr
.SlcNames
;
25 import org
.eclipse
.jface
.viewers
.ITreeContentProvider
;
26 import org
.eclipse
.jface
.viewers
.TreeViewer
;
27 import org
.eclipse
.jface
.viewers
.TreeViewerColumn
;
28 import org
.eclipse
.swt
.SWT
;
29 import org
.eclipse
.swt
.widgets
.Composite
;
30 import org
.eclipse
.swt
.widgets
.Tree
;
31 import org
.eclipse
.ui
.part
.ViewPart
;
34 * Browse, manipulate and manage distributions accross multiple repositories
35 * (like fetch, merge, publish, etc.).
37 public class AnonymousDistributionsView
extends ViewPart
implements SlcNames
,
39 // private final static Log log = LogFactory
40 // .getLog(AnonymousDistributionsView.class);
41 public final static String ID
= DistPlugin
.ID
42 + ".anonymousDistributionsView";
44 /* DEPENDENCY INJECTION */
45 private ITreeContentProvider treeContentProvider
;
48 private TreeViewer viewer
;
51 public void createPartControl(Composite parent
) {
52 // Define the TableViewer
53 viewer
= new TreeViewer(parent
, SWT
.MULTI
| SWT
.H_SCROLL
| SWT
.V_SCROLL
54 | SWT
.FULL_SELECTION
| SWT
.BORDER
);
56 TreeViewerColumn col
= new TreeViewerColumn(viewer
, SWT
.NONE
);
57 col
.getColumn().setWidth(400);
58 col
.setLabelProvider(new DistTreeLabelProvider());
60 final Tree tree
= viewer
.getTree();
61 tree
.setHeaderVisible(false);
62 tree
.setLinesVisible(false);
64 // viewer.setContentProvider(new DistTreeContentProvider());
65 viewer
.setContentProvider(treeContentProvider
);
66 viewer
.addDoubleClickListener(new DistTreeDoubleClickListener());
67 viewer
.setComparator(new DistTreeComparator());
74 * Force refresh of the whole view
76 public void refresh() {
77 Object
[] ee
= viewer
.getExpandedElements();
78 viewer
.setInput(DistConstants
.DEFAULT_PUBLIC_REPOSITORY_URI
);
79 // viewer.expandToLevel(2);
80 viewer
.setExpandedElements(ee
);
84 public void setFocus() {
85 viewer
.getTree().setFocus();
89 * DEPENDENCY INJECTION
91 public void setTreeContentProvider(ITreeContentProvider treeContentProvider
) {
92 this.treeContentProvider
= treeContentProvider
;