blob: c25acb2f10338ea113888507455fcbc4f1024535 (
plain) (
blame)
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
117
118
119
120
121
122
123
124
125
126
127
128
|
/*******************************************************************************
* Copyright (c) 2004, 2006 IBM Corporation 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:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.wst.html.ui.internal.preferences.ui;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Preferences;
import org.eclipse.core.runtime.content.IContentType;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Group;
import org.eclipse.ui.PlatformUI;
import org.eclipse.wst.html.core.internal.HTMLCorePlugin;
import org.eclipse.wst.html.core.internal.provisional.contenttype.ContentTypeIdForHTML;
import org.eclipse.wst.html.ui.internal.HTMLUIMessages;
import org.eclipse.wst.html.ui.internal.HTMLUIPlugin;
import org.eclipse.wst.html.ui.internal.editor.IHelpContextIds;
import org.eclipse.wst.sse.core.internal.encoding.CommonEncodingPreferenceNames;
import org.eclipse.wst.xml.ui.internal.preferences.WorkbenchDefaultEncodingSettings;
import org.eclipse.wst.xml.ui.internal.preferences.XMLFilesPreferencePage;
public class HTMLFilesPreferencePage extends XMLFilesPreferencePage {
private WorkbenchDefaultEncodingSettings fInputEncodingSettings = null;
protected Preferences getModelPreferences() {
return HTMLCorePlugin.getDefault().getPluginPreferences();
}
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.preference.PreferencePage#doGetPreferenceStore()
*/
protected IPreferenceStore doGetPreferenceStore() {
return HTMLUIPlugin.getDefault().getPreferenceStore();
}
protected void doSavePreferenceStore() {
HTMLCorePlugin.getDefault().savePluginPreferences(); // model
}
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
*/
protected Control createContents(Composite parent) {
Composite scrolledComposite = createScrolledComposite(parent);
createContentsForCreatingOrSavingGroup(scrolledComposite);
createContentsForCreatingGroup(scrolledComposite);
createContentsForLoadingGroup(scrolledComposite);
PlatformUI.getWorkbench().getHelpSystem().setHelp(scrolledComposite, IHelpContextIds.HTML_PREFWEBX_FILES_HELPID);
setSize(scrolledComposite);
loadPreferences();
return scrolledComposite;
}
protected void createContentsForLoadingGroup(Composite parent) {
Group group = createGroup(parent, 1);
group.setText(HTMLUIMessages.HTMLFilesPreferencePage_0);
fInputEncodingSettings = new WorkbenchDefaultEncodingSettings(group);
}
protected IContentType getContentType() {
return Platform.getContentTypeManager().getContentType(ContentTypeIdForHTML.ContentTypeID_HTML);
}
protected void initializeValues() {
super.initializeValues();
initializeValuesForLoadingGroup();
}
protected void initializeValuesForLoadingGroup() {
String encoding = getModelPreferences().getString(CommonEncodingPreferenceNames.INPUT_CODESET);
fInputEncodingSettings.setIANATag(encoding);
}
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.preference.PreferencePage#performDefaults()
*/
protected void performDefaults() {
super.performDefaults();
performDefaultsForLoadingGroup();
}
protected void performDefaultsForLoadingGroup() {
String encoding = getModelPreferences().getDefaultString(CommonEncodingPreferenceNames.INPUT_CODESET);
fInputEncodingSettings.setIANATag(encoding);
}
protected void storeValues() {
super.storeValues();
storeValuesForLoadingGroup();
}
protected void storeValuesForLoadingGroup() {
getModelPreferences().setValue(CommonEncodingPreferenceNames.INPUT_CODESET, fInputEncodingSettings.getIANATag());
}
protected void createContentsForCreatingGroup(Composite parent) {
super.createContentsForCreatingGroup(parent);
// Group creatingGroup = createGroup(parent, 2);
// creatingGroup.setText(HTMLUIMessages.Creating_files);
//
// // Encoding..
// Label label = createLabel(creatingGroup,
// HTMLUIMessages.Encoding_desc);
// ((GridData)label.getLayoutData()).horizontalSpan = 2;
// fEncodingSettings = new EncodingSettings(creatingGroup);
// ((GridData)fEncodingSettings.getLayoutData()).horizontalSpan = 2;
}
}
|