1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
|
/*******************************************************************************
* Copyright (c) 2011, 2012 Wind River Systems, Inc. and others. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
package org.eclipse.tcf.te.tcf.filesystem.ui.internal.tabbed;
import org.eclipse.core.runtime.Assert;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.tcf.te.tcf.filesystem.core.interfaces.IWindowsFileAttributes;
import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
import org.eclipse.tcf.te.tcf.filesystem.ui.internal.adapters.FSTreeNodeAdapterFactory.FSTreeNodePeerModelProvider;
import org.eclipse.tcf.te.tcf.filesystem.ui.nls.Messages;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModelProvider;
import org.eclipse.tcf.te.tcf.ui.tabbed.BaseTitledSection;
import org.eclipse.tcf.te.ui.swt.SWTControlUtil;
import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
/**
* The property section to display a folder's archive and index attributes on Windows.
*/
public class WindowsFolderAISection extends BaseTitledSection {
// The original node.
protected FSTreeNode node;
// The check box for archive attribute.
protected Button archiveButton;
// The check box for index attribute.
protected Button indexButton;
/*
* (non-Javadoc)
* @see
* org.eclipse.tcf.te.ui.views.tabbed.BaseTitledSection#createControls(org.eclipse.swt.widgets
* .Composite, org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage)
*/
@Override
public void createControls(Composite parent, TabbedPropertySheetPage aTabbedPropertySheetPage) {
super.createControls(parent, aTabbedPropertySheetPage);
archiveButton = getWidgetFactory().createButton(composite, getAchiveText(), SWT.CHECK);
FormData data = new FormData();
data.left = new FormAttachment(0, 0);
data.right = new FormAttachment(100, 0);
data.top = new FormAttachment(0, ITabbedPropertyConstants.VSPACE);
archiveButton.setLayoutData(data);
indexButton = getWidgetFactory().createButton(composite, getIndexText(), SWT.CHECK);
data = new FormData();
data.left = new FormAttachment(0, 0);
data.right = new FormAttachment(100, 0);
data.top = new FormAttachment(archiveButton, ITabbedPropertyConstants.VSPACE);
indexButton.setLayoutData(data);
}
/**
* Get the archive's label text.
*
* @return The archive's label text.
*/
protected String getAchiveText() {
return Messages.AdvancedAttributesDialog_FolderArchive;
}
/**
* Get the index's label text.
*
* @return The index's label text.
*/
protected String getIndexText() {
return Messages.AdvancedAttributesDialog_IndexFolder;
}
/*
* (non-Javadoc)
* @see org.eclipse.tcf.te.ui.views.tabbed.BaseTitledSection#updateData(org.eclipse.tcf.te.ui.interfaces.IPropertyChangeProvider)
*/
@Override
protected void updateInput(IPeerModelProvider input) {
Assert.isTrue(input instanceof FSTreeNodePeerModelProvider);
this.node = ((FSTreeNodePeerModelProvider)input).getFSTreeNode();
}
/*
* (non-Javadoc)
* @see org.eclipse.ui.views.properties.tabbed.AbstractPropertySection#refresh()
*/
@Override
public void refresh() {
boolean on = node != null ? node.isWin32AttrOn(IWindowsFileAttributes.FILE_ATTRIBUTE_ARCHIVE) : false;
SWTControlUtil.setSelection(archiveButton, on);
on = node != null ? !node.isWin32AttrOn(IWindowsFileAttributes.FILE_ATTRIBUTE_NOT_CONTENT_INDEXED) : false;
SWTControlUtil.setSelection(indexButton, on);
}
/*
* (non-Javadoc)
* @see org.eclipse.tcf.te.ui.views.tabbed.BaseTitledSection#getText()
*/
@Override
protected String getText() {
return Messages.AdvancedAttributesDialog_ArchiveIndex;
}
}
|