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
115
116
|
/*******************************************************************************
* Copyright (c) 2006 Sybase, 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:
* Sybase, Inc. - initial API and implementation
*******************************************************************************/
package org.eclipse.jst.pagedesigner.properties.attrgroup;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jst.jsf.common.ui.internal.dialogfield.DialogField;
import org.eclipse.jst.jsf.common.ui.internal.dialogfield.IDialogFieldApplyListener;
import org.eclipse.jst.jsf.common.ui.internal.dialogfield.ISupportTextValue;
import org.eclipse.jst.pagedesigner.commands.single.ChangeAttributeCommand;
import org.eclipse.jst.pagedesigner.meta.IAttributeDescriptor;
import org.eclipse.jst.pagedesigner.properties.BaseCustomSection;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
import org.eclipse.wst.sse.core.internal.provisional.INodeNotifier;
/**
* This is a section for a list of attribute dialog fields.
*
* @author mengbo
* @version 1.5
* @deprecated
*
*/
public class OLDAttributeGroupSection extends BaseCustomSection {
private static final Object KEY_ATTR = "KEY_ATTR"; //$NON-NLS-1$
private IDialogFieldApplyListener _fieldApplyListener = new IDialogFieldApplyListener() {
/*
* (non-Javadoc)
*
* @see org.eclipse.jst.jsf.common.ui.internal.dialogfield.IDialogFieldApplyListener#dialogFieldApplied(org.eclipse.jst.jsf.common.ui.internal.dialogfield.DialogField)
*/
public void dialogFieldApplied(DialogField field) {
Object attr = field.getAttachedData(KEY_ATTR);
if (attr instanceof IAttributeDescriptor && _element != null) {
ISupportTextValue textValue = (ISupportTextValue) field;
ChangeAttributeCommand c = new ChangeAttributeCommand(
AttributeGroupMessages
.getString("OLDAttributeGroupSection.changeAttribute"), _element, ((IAttributeDescriptor) attr).getAttributeName(), textValue.getText()); //$NON-NLS-1$
c.execute();
}
}
};
/**
* the attribute group
*/
protected OLDAttributeGroup _group;
/**
* create the section with a default AttributeGroup. In default
* AttributeGroup, there is no relationship between fields.
*
* @param uri
* @param tagName
* @param attrNames
*/
public OLDAttributeGroupSection(String uri, String tagName, String[] attrNames) {
this(new OLDAttributeGroup(uri, tagName, attrNames));
}
/**
* In case the group is not a default group (e.g. you may add some
* customized relationship between the fields).
*
* @param group
*/
public OLDAttributeGroupSection(OLDAttributeGroup group) {
_group = group;
_group.setDefaultApplyListener(_fieldApplyListener);
_group.initialize();
}
/*
* (non-Javadoc)
*
* @see org.eclipse.wst.common.ui.properties.internal.provisional.AbstractPropertySection#setInput(org.eclipse.ui.IWorkbenchPart,
* org.eclipse.jface.viewers.ISelection)
*/
public void setInput(IWorkbenchPart part, ISelection selection) {
super.setInput(part, selection);
_group.setElementContext(_element, _element);
}
/*
* (non-Javadoc)
*
* @see org.eclipse.jst.pagedesigner.integration.properties.section.AbstractCustomSection#createControls(org.eclipse.swt.widgets.Composite,
* org.eclipse.wst.common.ui.properties.internal.provisional.TabbedPropertySheetPage)
*/
public void createControls(Composite parent,
TabbedPropertySheetPage aTabbedPropertySheetPage) {
super.createControls(parent, aTabbedPropertySheetPage);
TabbedPropertySheetWidgetFactory factory = aTabbedPropertySheetPage
.getWidgetFactory();
_group.layoutDialogFields(factory, parent);
}
protected void notifyChanged(INodeNotifier notifier, int eventType,
Object changedFeature, Object oldValue, Object newValue, int pos) {
if (_group != null) {
_group.refreshData();
}
}
}
|