• R/O
  • SSH
  • HTTPS

propedit: 提交


Commit MetaInfo

修订版181 (tree)
时间2009-05-16 16:37:47
作者chomakichi

Log Message

ぷリファレンスのエンコード設定を除去

更改概述

差异

--- trunk/PropertiesEditor/src/jp/gr/java_conf/ussiy/app/propedit/eclipse/plugin/property/PropertiesProperty.java (revision 180)
+++ trunk/PropertiesEditor/src/jp/gr/java_conf/ussiy/app/propedit/eclipse/plugin/property/PropertiesProperty.java (revision 181)
@@ -4,7 +4,6 @@
44 import jp.gr.java_conf.ussiy.app.propedit.eclipse.plugin.resources.Messages;
55
66 import org.eclipse.core.resources.IProject;
7-import org.eclipse.core.resources.ResourcesPlugin;
87 import org.eclipse.core.runtime.CoreException;
98 import org.eclipse.core.runtime.IAdaptable;
109 import org.eclipse.core.runtime.ILog;
@@ -29,8 +28,6 @@
2928
3029 public class PropertiesProperty extends PropertyPage {
3130
32- public static final String P_ENCODE = "readEncode"; //$NON-NLS-1$
33-
3431 public static final String P_NOT_CONVERT_COMMENT = "notConvertComment"; //$NON-NLS-1$
3532
3633 public static final String P_NOT_ALL_CONVERT = "notConvert"; //$NON-NLS-1$
@@ -40,15 +37,11 @@
4037 public static final String P_CONVERT_CHAR_CASE = "convertCharCase"; //$NON-NLS-1$
4138
4239 public static final String P_ORIGINAL_SETTINGS = "originalSettings"; //$NON-NLS-1$
43-
44- private String[] items = new String[] { System.getProperty("file.encoding"), "US-ASCII", "UTF-8", "UTF-16" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
4540
4641 private String[] charCaseItems = new String[] { Messages.getString("eclipse.propertieseditor.preference.convert.char.uppercase"), Messages.getString("eclipse.propertieseditor.preference.convert.char.lowercase") }; //$NON-NLS-1$ //$NON-NLS-2$
4742
4843 private Button orgCheckBox = null;
4944
50- private Combo encodeCombo = null;
51-
5245 private Text commentText = null;
5346
5447 private Combo convertCharCaseCombo = null;
@@ -73,7 +66,6 @@
7366 orgCheckBox.addSelectionListener(new SelectionAdapter() {
7467 public void widgetSelected(SelectionEvent e) {
7568 if (orgCheckBox.getSelection()) {
76- encodeCombo.setEnabled(true);
7769 commentText.setEnabled(true);
7870 convertCharCaseCombo.setEnabled(true);
7971 notAllConvertCheckBox.setEnabled(true);
@@ -83,7 +75,6 @@
8375 notConvertCommentCheckBox.setEnabled(true);
8476 }
8577 } else {
86- encodeCombo.setEnabled(false);
8778 commentText.setEnabled(false);
8879 convertCharCaseCombo.setEnabled(false);
8980 notAllConvertCheckBox.setEnabled(false);
@@ -97,13 +88,7 @@
9788 gd.horizontalSpan = 2;
9889 separator.setLayoutData(gd);
9990
100- Label label= new Label(composite, SWT.NONE);
101- label.setText(Messages.getString("eclipse.propertieseditor.preference.read.encode")); //$NON-NLS-1$
102-
103- encodeCombo = new Combo(composite, SWT.DROP_DOWN);
104- encodeCombo.setItems(items);
105-
106- label = new Label(composite, SWT.NONE);
91+ Label label = new Label(composite, SWT.NONE);
10792 label.setText(Messages.getString("eclipse.propertieseditor.preference.comment.character")); //$NON-NLS-1$
10893
10994 commentText = new Text(composite, SWT.BORDER);
@@ -144,7 +129,6 @@
144129
145130 private void initialize() {
146131 String org = null;
147- String encode = null;
148132 String commentChar = null;
149133 String charcase = null;
150134 String notAllConvert = null;
@@ -158,7 +142,6 @@
158142 project = (IProject)adaptable;
159143 }
160144 org = project.getPersistentProperty(new QualifiedName(PropertiesEditorPlugin.PLUGIN_ID, P_ORIGINAL_SETTINGS));
161- encode = project.getPersistentProperty(new QualifiedName(PropertiesEditorPlugin.PLUGIN_ID, P_ENCODE));
162145 commentChar = project.getPersistentProperty(new QualifiedName(PropertiesEditorPlugin.PLUGIN_ID, P_COMMENT_CHARACTER));
163146 charcase = project.getPersistentProperty(new QualifiedName(PropertiesEditorPlugin.PLUGIN_ID, P_CONVERT_CHAR_CASE));
164147 notAllConvert = project.getPersistentProperty(new QualifiedName(PropertiesEditorPlugin.PLUGIN_ID, P_NOT_ALL_CONVERT));
@@ -170,11 +153,6 @@
170153 ErrorDialog.openError(null, Messages.getString("eclipse.propertieseditor.property.error_title"), Messages.getString("eclipse.propertieseditor.property.get.settings.error"), status); //$NON-NLS-1$ //$NON-NLS-2$
171154 }
172155
173- if (encode != null) {
174- encodeCombo.setText(encode);
175- } else {
176- encodeCombo.setText(ResourcesPlugin.getEncoding());
177- }
178156 if (commentChar != null) {
179157 commentText.setText(commentChar);
180158 } else {
@@ -205,7 +183,6 @@
205183 if (org != null) {
206184 orgCheckBox.setSelection(Boolean.valueOf(org).booleanValue());
207185 if (orgCheckBox.getSelection()) {
208- encodeCombo.setEnabled(true);
209186 commentText.setEnabled(true);
210187 convertCharCaseCombo.setEnabled(true);
211188 notAllConvertCheckBox.setEnabled(true);
@@ -215,7 +192,6 @@
215192 notConvertCommentCheckBox.setEnabled(true);
216193 }
217194 } else {
218- encodeCombo.setEnabled(false);
219195 commentText.setEnabled(false);
220196 convertCharCaseCombo.setEnabled(false);
221197 notAllConvertCheckBox.setEnabled(false);
@@ -223,7 +199,6 @@
223199 }
224200 } else {
225201 orgCheckBox.setSelection(false);
226- encodeCombo.setEnabled(false);
227202 commentText.setEnabled(false);
228203 convertCharCaseCombo.setEnabled(false);
229204 notAllConvertCheckBox.setEnabled(false);
@@ -237,9 +212,15 @@
237212 */
238213 protected void performApply() {
239214 try {
240- IProject project = (IProject)getElement();
215+ IAdaptable adapter = getElement();
216+ IProject project = null;
217+ if (adapter instanceof IJavaProject) {
218+ IJavaProject jp = (IJavaProject)adapter;
219+ project = jp.getProject();
220+ } else {
221+ project = (IProject)adapter;
222+ }
241223 project.setPersistentProperty(new QualifiedName(PropertiesEditorPlugin.PLUGIN_ID, P_ORIGINAL_SETTINGS), Boolean.toString(orgCheckBox.getSelection()));
242- project.setPersistentProperty(new QualifiedName(PropertiesEditorPlugin.PLUGIN_ID, P_ENCODE), encodeCombo.getText());
243224 project.setPersistentProperty(new QualifiedName(PropertiesEditorPlugin.PLUGIN_ID, P_COMMENT_CHARACTER), commentText.getText());
244225 project.setPersistentProperty(new QualifiedName(PropertiesEditorPlugin.PLUGIN_ID, P_CONVERT_CHAR_CASE), convertCharCaseCombo.getText());
245226 project.setPersistentProperty(new QualifiedName(PropertiesEditorPlugin.PLUGIN_ID, P_NOT_ALL_CONVERT), Boolean.toString(notAllConvertCheckBox.getSelection()));
@@ -248,12 +229,11 @@
248229 IStatus status = new Status(IStatus.ERROR, PropertiesEditorPlugin.PLUGIN_ID, 0, e.getMessage(), e);
249230 ILog log = PropertiesEditorPlugin.getDefault().getLog();
250231 log.log(status);
251- ErrorDialog.openError(null, Messages.getString("eclipse.propertieseditor.property.error_title"), Messages.getString("eclipse.propertieseditor.property.save.settings.error"), status); //$NON-NLS-1$ //$NON-NLS-2$
232+ ErrorDialog.openError(getShell(), Messages.getString("eclipse.propertieseditor.property.error_title"), Messages.getString("eclipse.propertieseditor.property.save.settings.error"), status); //$NON-NLS-1$ //$NON-NLS-2$
252233 }
253234 }
254235
255236 protected void performDefaults() {
256- encodeCombo.setText(ResourcesPlugin.getEncoding());
257237 commentText.setText("#"); //$NON-NLS-1$
258238 convertCharCaseCombo.setText(Messages.getString("eclipse.propertieseditor.preference.convert.char.lowercase"));
259239 notAllConvertCheckBox.setSelection(false);
@@ -260,7 +240,6 @@
260240 notConvertCommentCheckBox.setEnabled(false);
261241 notConvertCommentCheckBox.setSelection(false);
262242 orgCheckBox.setSelection(false);
263- encodeCombo.setEnabled(false);
264243 commentText.setEnabled(false);
265244 convertCharCaseCombo.setEnabled(false);
266245 notAllConvertCheckBox.setEnabled(false);
--- trunk/PropertiesEditor/src/jp/gr/java_conf/ussiy/app/propedit/eclipse/plugin/property/PropertyUtil.java (revision 180)
+++ trunk/PropertiesEditor/src/jp/gr/java_conf/ussiy/app/propedit/eclipse/plugin/property/PropertyUtil.java (revision 181)
@@ -12,30 +12,6 @@
1212 import org.eclipse.jface.dialogs.ErrorDialog;
1313
1414 public class PropertyUtil {
15-
16- public static String getEncode(IProject project, String preference) {
17- String org = null;
18- String encode = null;
19- try {
20- org = project.getPersistentProperty(new QualifiedName(PropertiesEditorPlugin.PLUGIN_ID, PropertiesProperty.P_ORIGINAL_SETTINGS));
21- encode = project.getPersistentProperty(new QualifiedName(PropertiesEditorPlugin.PLUGIN_ID, PropertiesProperty.P_ENCODE));
22- } catch (CoreException e) {
23- IStatus status = new Status(IStatus.ERROR, PropertiesEditorPlugin.PLUGIN_ID, 0, e.getMessage(), e);
24- ILog log = PropertiesEditorPlugin.getDefault().getLog();
25- log.log(status);
26- ErrorDialog.openError(null, Messages.getString("eclipse.propertieseditor.property.error_title"), Messages.getString("eclipse.propertieseditor.property.get.settings.error"), status); //$NON-NLS-1$ //$NON-NLS-2$
27- }
28- if (org != null) {
29- if (Boolean.valueOf(org).booleanValue()) {
30- if (encode == null || encode.equals("")) { //$NON-NLS-1$
31- return preference;
32- } else {
33- return encode;
34- }
35- }
36- }
37- return preference;
38- }
3915
4016 public static String getCommentChar(IProject project, String preference) {
4117 String org = null;
--- trunk/PropertiesEditor/src/jp/gr/java_conf/ussiy/app/propedit/eclipse/plugin/editors/MultiPagePropertiesEditor.java (revision 180)
+++ trunk/PropertiesEditor/src/jp/gr/java_conf/ussiy/app/propedit/eclipse/plugin/editors/MultiPagePropertiesEditor.java (nonexistent)
@@ -1,252 +0,0 @@
1-package jp.gr.java_conf.ussiy.app.propedit.eclipse.plugin.editors;
2-
3-import java.net.MalformedURLException;
4-import java.net.URL;
5-
6-import jp.gr.java_conf.ussiy.app.propedit.eclipse.plugin.PropertiesEditorPlugin;
7-import jp.gr.java_conf.ussiy.app.propedit.eclipse.plugin.preference.PropertiesEditorPreference;
8-import jp.gr.java_conf.ussiy.app.propedit.eclipse.plugin.preference.PropertiesPreference;
9-import jp.gr.java_conf.ussiy.app.propedit.eclipse.plugin.property.PropertyUtil;
10-import jp.gr.java_conf.ussiy.app.propedit.eclipse.plugin.resources.Messages;
11-import jp.gr.java_conf.ussiy.app.propedit.util.EncodeChanger;
12-
13-import org.eclipse.core.resources.IMarker;
14-import org.eclipse.core.resources.IProject;
15-import org.eclipse.core.runtime.ILog;
16-import org.eclipse.core.runtime.IProgressMonitor;
17-import org.eclipse.core.runtime.IStatus;
18-import org.eclipse.core.runtime.Status;
19-import org.eclipse.jface.dialogs.ErrorDialog;
20-import org.eclipse.jface.preference.IPreferenceStore;
21-import org.eclipse.jface.preference.PreferenceConverter;
22-import org.eclipse.jface.resource.ImageDescriptor;
23-import org.eclipse.jface.util.IPropertyChangeListener;
24-import org.eclipse.jface.util.PropertyChangeEvent;
25-import org.eclipse.swt.SWT;
26-import org.eclipse.swt.custom.CTabFolder;
27-import org.eclipse.swt.custom.StyledText;
28-import org.eclipse.swt.graphics.Color;
29-import org.eclipse.swt.graphics.Image;
30-import org.eclipse.swt.graphics.RGB;
31-import org.eclipse.swt.layout.FillLayout;
32-import org.eclipse.swt.widgets.Composite;
33-import org.eclipse.swt.widgets.Display;
34-import org.eclipse.ui.IEditorInput;
35-import org.eclipse.ui.IEditorPart;
36-import org.eclipse.ui.IEditorSite;
37-import org.eclipse.ui.IFileEditorInput;
38-import org.eclipse.ui.IWorkbenchPreferenceConstants;
39-import org.eclipse.ui.PartInitException;
40-import org.eclipse.ui.ide.IDE;
41-import org.eclipse.ui.ide.IGotoMarker;
42-import org.eclipse.ui.part.MultiPageEditorPart;
43-
44-/**
45- * An example showing how to create a multi-page editor. This example has 2 pages:
46- */
47-public class MultiPagePropertiesEditor extends MultiPageEditorPart implements IGotoMarker {
48-
49- /** The text editor used in page 0. */
50- private PropertiesEditor editor;
51-
52- /** The text widget used in page 1. */
53- private StyledText text;
54-
55- /**
56- * Creates a multi-page editor example.
57- */
58- public MultiPagePropertiesEditor() {
59- super();
60- }
61-
62- /**
63- * Creates page 0 of the multi-page editor, which contains a text editor.
64- */
65- void createPage0() {
66- URL url = PropertiesEditorPlugin.getDefault().getBundle().getEntry("/"); //$NON-NLS-1$
67- String path = "icons/editPage.gif"; //$NON-NLS-1$
68- ImageDescriptor descriptor = null;
69- try {
70- descriptor = ImageDescriptor.createFromURL(new URL(url, path));
71- } catch (MalformedURLException e) {
72- descriptor = ImageDescriptor.getMissingImageDescriptor();
73- }
74- Image image = descriptor.createImage();
75- try {
76- editor = new PropertiesEditor();
77- int index = addPage(editor, getEditorInput());
78- setPageText(index, Messages.getString("eclipse.tabname.edit")); //$NON-NLS-1$
79- setPartName(editor.getTitle());
80- setPageImage(index, image);
81- IPreferenceStore pStore = PropertiesEditorPlugin.getDefault().getPreferenceStore();
82- RGB rgb = PreferenceConverter.getColor(pStore, PropertiesEditorPreference.P_BACKGROUND_COLOR);
83- Color color = new ColorManager().getColor(rgb);
84- editor.setBackground(color);
85- } catch (PartInitException e) {
86- ErrorDialog.openError(getSite().getShell(), "Error creating nested text editor", null, e.getStatus()); //$NON-NLS-1$
87- }
88- }
89-
90- /**
91- * Creates page 1 of the multi-page editor.
92- */
93- void createPage1() {
94- URL url = PropertiesEditorPlugin.getDefault().getBundle().getEntry("/"); //$NON-NLS-1$
95- String path = "icons/previewPage.gif"; //$NON-NLS-1$
96- ImageDescriptor descriptor = null;
97- try {
98- descriptor = ImageDescriptor.createFromURL(new URL(url, path));
99- } catch (MalformedURLException e) {
100- descriptor = ImageDescriptor.getMissingImageDescriptor();
101- }
102- Image image = descriptor.createImage();
103-
104- Composite composite = new Composite(getContainer(), SWT.NONE);
105- FillLayout layout = new FillLayout();
106- composite.setLayout(layout);
107- text = new StyledText(composite, SWT.H_SCROLL | SWT.V_SCROLL);
108- text.setEditable(false);
109- Display display = Display.getCurrent();
110- RGB rgb = new RGB(240, 240, 240);
111- Color color = new Color(display, rgb);
112- text.setBackground(color);
113-
114- int index = addPage(composite);
115- setPageText(index, Messages.getString("eclipse.tabname.preview")); //$NON-NLS-1$
116- setPageImage(index, image);
117- }
118-
119- /**
120- * Creates the pages of the multi-page editor.
121- */
122- protected void createPages() {
123-
124- createPage0();
125- createPage1();
126-
127- IPreferenceStore apiStore = PropertiesEditorPlugin.getDefault().getPreferenceStore();
128-
129- Composite container = getContainer();
130- if (container != null && container instanceof CTabFolder) {
131- apiStore.addPropertyChangeListener(
132- new IPropertyChangeListener() {
133- public void propertyChange(PropertyChangeEvent event) {
134- if (IWorkbenchPreferenceConstants.SHOW_TRADITIONAL_STYLE_TABS.equals(event.getProperty())) {
135- setTabStyle();
136- }
137- }
138- }
139- );
140- CTabFolder tabFolder = (CTabFolder)getContainer();
141-
142- Display display = Display.getCurrent();
143- Color titleForeColor = display.getSystemColor(SWT.COLOR_TITLE_FOREGROUND);
144- Color titleBackColor1 = display.getSystemColor(SWT.COLOR_TITLE_BACKGROUND);
145- Color titleBackColor2 = display.getSystemColor(SWT.COLOR_TITLE_BACKGROUND_GRADIENT);
146-
147- tabFolder.setSelectionForeground(titleForeColor);
148- tabFolder.setSelectionBackground(
149- new Color[] {titleBackColor1, titleBackColor2},
150- new int[] {100},
151- true
152- );
153- setTabStyle();
154- }
155- }
156-
157- protected void setTabStyle() {
158- IPreferenceStore apiStore = PropertiesEditorPlugin.getDefault().getPreferenceStore();
159- boolean simple = apiStore.getBoolean(IWorkbenchPreferenceConstants.SHOW_TRADITIONAL_STYLE_TABS);
160-
161- Composite container = getContainer();
162- if (container != null && container instanceof CTabFolder) {
163- CTabFolder tabFolder = (CTabFolder)getContainer();
164- tabFolder.setSimple(simple);
165- }
166-
167- }
168-
169- /**
170- * Saves the multi-page editor's document.
171- */
172- public void doSave(IProgressMonitor monitor) {
173-
174- getEditor(0).doSave(monitor);
175- }
176-
177- /**
178- * Saves the multi-page editor's document as another file. Also updates the text for page 0's tab, and updates this multi-page editor's input to correspond to the nested editor's.
179- */
180- public void doSaveAs() {
181-
182- IEditorPart editor = getEditor(0);
183- editor.doSaveAs();
184- setPageText(0, editor.getTitle());
185- setInput(editor.getEditorInput());
186- }
187-
188- public void gotoMarker(IMarker marker) {
189-
190- setActivePage(0);
191- IDE.gotoMarker(getEditor(0), marker);
192- }
193-
194- public void init(IEditorSite site, IEditorInput editorInput) throws PartInitException {
195-
196- // if (!(editorInput instanceof IFileEditorInput)) {
197- // throw new PartInitException(
198- // "Invalid Input: Must be IFileEditorInput");
199- // }
200- super.init(site, editorInput);
201- }
202-
203- public boolean isSaveAsAllowed() {
204-
205- return true;
206- }
207-
208- protected void pageChange(int newPageIndex) {
209-
210- super.pageChange(newPageIndex);
211- String editorText = editor.getDocumentProvider().getDocument(editor.getEditorInput()).get();
212- IProject project = ((IFileEditorInput)editor.getEditorInput()).getFile().getProject();
213- if (PropertyUtil.getNotConvertComment(project, PropertiesEditorPlugin.getDefault().getPreferenceStore().getBoolean(PropertiesPreference.P_NOT_CONVERT_COMMENT))) {
214- String charcase = PropertyUtil.getCharCase(project, PropertiesEditorPlugin.getDefault().getPreferenceStore().getString(PropertiesPreference.P_CONVERT_CHAR_CASE));
215- try {
216- if (Messages.getString("eclipse.propertieseditor.preference.convert.char.uppercase").equals(charcase)) { //$NON-NLS-1$
217- text.setText(EncodeChanger.unicode2UnicodeEscWithoutComment(editorText, EncodeChanger.UPPERCASE));
218- } else {
219- text.setText(EncodeChanger.unicode2UnicodeEscWithoutComment(editorText, EncodeChanger.LOWERCASE));
220- }
221- } catch (Exception e) {
222- IStatus status = new Status(IStatus.ERROR, PropertiesEditorPlugin.PLUGIN_ID, 0, e.getMessage(), e);
223- ILog log = PropertiesEditorPlugin.getDefault().getLog();
224- log.log(status);
225- ErrorDialog.openError(null, Messages.getString("eclipse.propertieseditor.convert.error"), Messages.getString("eclipse.propertieseditor.property.get.settings.error"), status); //$NON-NLS-1$ //$NON-NLS-2$
226- }
227- } else {
228- text.setText(EncodeChanger.unicode2UnicodeEsc(editorText));
229- }
230- }
231-
232- public PropertiesEditor getEditor() {
233-
234- return editor;
235- }
236-
237- /**
238- * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
239- */
240- public Object getAdapter(Class adapter) {
241- return getEditor().getAdapter(adapter);
242- }
243-
244- /**
245- * @see org.eclipse.ui.IWorkbenchPart#dispose()
246- */
247- public void dispose() {
248- editor.dispose();
249- text.dispose();
250- super.dispose();
251- }
252-}
\ No newline at end of file
Deleted: svn:mime-type
## -1 +0,0 ##
-text/plain
\ No newline at end of property
--- trunk/PropertiesEditor/src/jp/gr/java_conf/ussiy/app/propedit/eclipse/plugin/editors/PropertiesOutlineContentProvider.java (revision 180)
+++ trunk/PropertiesEditor/src/jp/gr/java_conf/ussiy/app/propedit/eclipse/plugin/editors/PropertiesOutlineContentProvider.java (nonexistent)
@@ -1,238 +0,0 @@
1-package jp.gr.java_conf.ussiy.app.propedit.eclipse.plugin.editors;
2-
3-import java.io.BufferedReader;
4-import java.io.IOException;
5-import java.io.StringReader;
6-import java.util.ArrayList;
7-import java.util.List;
8-
9-import jp.gr.java_conf.ussiy.app.propedit.eclipse.plugin.editors.PropertiesContentOutlinePage.Segment;
10-
11-import org.eclipse.jface.text.BadPositionCategoryException;
12-import org.eclipse.jface.text.DefaultPositionUpdater;
13-import org.eclipse.jface.text.DocumentEvent;
14-import org.eclipse.jface.text.IDocument;
15-import org.eclipse.jface.text.IDocumentListener;
16-import org.eclipse.jface.text.IPositionUpdater;
17-import org.eclipse.jface.text.Position;
18-import org.eclipse.jface.viewers.ITreeContentProvider;
19-import org.eclipse.jface.viewers.Viewer;
20-
21-/**
22- * Divides the editor's document into ten segments and provides elements for
23- * them.
24- */
25-class PropertiesOutlineContentProvider implements ITreeContentProvider, IDocumentListener {
26-
27- private final PropertiesContentOutlinePage fContentOutlinePage;
28-
29- /**
30- * @param page
31- */
32- PropertiesOutlineContentProvider(PropertiesContentOutlinePage page) {
33- this.fContentOutlinePage = page;
34- }
35-
36- protected final static String SEGMENTS = "__properties_segments"; //$NON-NLS-1$
37-
38- protected IPositionUpdater fPositionUpdater = new DefaultPositionUpdater(
39- SEGMENTS);
40-
41- protected List fContent = new ArrayList(10);
42-
43- protected void parse(IDocument document) {
44- String line = null;
45- int cntLine = 0;
46- boolean multipleValueFlg = false;
47-
48- BufferedReader reader = null;
49- try {
50- reader = new BufferedReader(new StringReader(document.get()));
51- while ((line = reader.readLine()) != null) {
52- cntLine++;
53- if (multipleValueFlg) {
54- if (line.endsWith("\\")) { //$NON-NLS-1$
55- multipleValueFlg = true;
56- } else {
57- multipleValueFlg = false;
58- }
59- continue;
60- } else {
61- if (line.trim().equals("") || line.trim().startsWith("#") || line.trim().startsWith("!")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
62- continue;
63- }
64- }
65- line = line.trim();
66- boolean escapeFlg = false;
67- boolean nonSeparate = true;
68- for (int i = 0; i < line.length(); i++) {
69- char achar = line.charAt(i);
70- if (achar == '\\') {
71- if (escapeFlg) {
72- String tmp = line;
73- line = ""; //$NON-NLS-1$
74- line = tmp.substring(0, i);
75- line += tmp.substring(i + 1, tmp.length());
76- escapeFlg = false;
77- i--;
78- } else {
79- escapeFlg = true;
80- }
81- } else if (achar == '=' || achar == '\t' || achar == ':' || achar == ' ') {
82- if (escapeFlg) {
83- String tmp = line;
84- line = ""; //$NON-NLS-1$
85- line = tmp.substring(0, i - 1);
86- line += tmp.substring(i, tmp.length());
87- escapeFlg = false;
88- i--;
89- continue;
90- } else {
91- int offset = document.getLineOffset(cntLine - 1);
92- Position p = new Position(offset, i);
93- document.addPosition(SEGMENTS, p);
94-
95- fContent.add(new Segment(line.substring(0, i).trim(), p)); //$NON-NLS-1$
96-
97- nonSeparate = false;
98- escapeFlg = false;
99- break;
100- }
101- } else {
102- if (escapeFlg) {
103- String tmp = line;
104- line = ""; //$NON-NLS-1$
105- line = tmp.substring(0, i - 1);
106- line += tmp.substring(i, tmp.length());
107- i--;
108- }
109- escapeFlg = false;
110- }
111- }
112- if (nonSeparate) {
113- if (line.endsWith("\\")) { //$NON-NLS-1$
114- continue;
115- }
116- }
117- if (line.endsWith("\\")) { //$NON-NLS-1$
118- multipleValueFlg = true;
119- } else {
120- multipleValueFlg = false;
121- }
122- }
123-
124- } catch (Exception e) {
125- e.printStackTrace();
126- } finally {
127- try {
128- if (reader != null) {
129- reader.close();
130- }
131- } catch (IOException e) {
132- }
133- }
134-
135- }
136-
137- /*
138- * @see IContentProvider#inputChanged(Viewer, Object, Object)
139- */
140- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
141- if (oldInput != null) {
142- IDocument document = this.fContentOutlinePage.fDocumentProvider
143- .getDocument(oldInput);
144- if (document != null) {
145- try {
146- document.removePositionCategory(SEGMENTS);
147- } catch (BadPositionCategoryException x) {
148- }
149- document.removePositionUpdater(fPositionUpdater);
150- }
151- }
152-
153- fContent.clear();
154-
155- if (newInput != null) {
156- IDocument document = this.fContentOutlinePage.fDocumentProvider
157- .getDocument(newInput);
158- if (document != null) {
159- document.addPositionCategory(SEGMENTS);
160- document.addPositionUpdater(fPositionUpdater);
161-
162- parse(document);
163- }
164- }
165- }
166-
167- /*
168- * @see IContentProvider#dispose
169- */
170- public void dispose() {
171- if (fContent != null) {
172- fContent.clear();
173- fContent = null;
174- }
175- }
176-
177- /*
178- * @see IContentProvider#isDeleted(Object)
179- */
180- public boolean isDeleted(Object element) {
181- return false;
182- }
183-
184- /*
185- * @see IStructuredContentProvider#getElements(Object)
186- */
187- public Object[] getElements(Object element) {
188- return fContent.toArray();
189- }
190-
191- /*
192- * @see ITreeContentProvider#hasChildren(Object)
193- */
194- public boolean hasChildren(Object element) {
195- return element == this.fContentOutlinePage.fInput;
196- }
197-
198- /*
199- * @see ITreeContentProvider#getParent(Object)
200- */
201- public Object getParent(Object element) {
202- if (element instanceof Segment)
203- return this.fContentOutlinePage.fInput;
204- return null;
205- }
206-
207- /*
208- * @see ITreeContentProvider#getChildren(Object)
209- */
210- public Object[] getChildren(Object element) {
211- if (element == this.fContentOutlinePage.fInput)
212- return fContent.toArray();
213- return new Object[0];
214- }
215-
216- /**
217- * @see org.eclipse.jface.text.IDocumentListener#documentAboutToBeChanged(org.eclipse.jface.text.DocumentEvent)
218- */
219- public void documentAboutToBeChanged(DocumentEvent event) {
220- }
221-
222- /**
223- * @see org.eclipse.jface.text.IDocumentListener#documentChanged(org.eclipse.jface.text.DocumentEvent)
224- */
225- public void documentChanged(DocumentEvent event) {
226-// try {
227-// event.getDocument().removePositionCategory(SEGMENTS);
228-// } catch (BadPositionCategoryException x) {
229-// }
230-// event.getDocument().removePositionUpdater(fPositionUpdater);
231-// fContent.clear();
232-// event.getDocument().addPositionCategory(SEGMENTS);
233-// event.getDocument().addPositionUpdater(fPositionUpdater);
234-// parse(event.getDocument());
235-// fContentOutlinePage.update();
236- }
237-
238-}
\ No newline at end of file
Deleted: svn:mime-type
## -1 +0,0 ##
-text/plain
\ No newline at end of property
--- trunk/PropertiesEditor/src/jp/gr/java_conf/ussiy/app/propedit/eclipse/plugin/editors/PropertiesOutlineLabelProvider.java (revision 180)
+++ trunk/PropertiesEditor/src/jp/gr/java_conf/ussiy/app/propedit/eclipse/plugin/editors/PropertiesOutlineLabelProvider.java (nonexistent)
@@ -1,43 +0,0 @@
1-package jp.gr.java_conf.ussiy.app.propedit.eclipse.plugin.editors;
2-
3-import java.net.MalformedURLException;
4-import java.net.URL;
5-
6-import jp.gr.java_conf.ussiy.app.propedit.eclipse.plugin.PropertiesEditorPlugin;
7-
8-import org.eclipse.jface.resource.ImageDescriptor;
9-import org.eclipse.jface.viewers.LabelProvider;
10-import org.eclipse.swt.graphics.Image;
11-
12-public class PropertiesOutlineLabelProvider extends LabelProvider {
13- protected static Image markerImage;
14-
15- /**
16- * @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object)
17- */
18- public Image getImage(Object element) {
19- if (markerImage != null && !markerImage.isDisposed()) {
20- return markerImage;
21- }
22- URL url = PropertiesEditorPlugin.getDefault().getBundle().getEntry("/"); //$NON-NLS-1$
23- String path = "icons/outlineMarker.gif"; //$NON-NLS-1$
24- ImageDescriptor descriptor = null;
25- try {
26- descriptor = ImageDescriptor.createFromURL(new URL(url, path));
27- } catch (MalformedURLException e) {
28- descriptor = ImageDescriptor.getMissingImageDescriptor();
29- }
30- markerImage = descriptor.createImage();
31- return markerImage;
32- }
33-
34- /**
35- * @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose()
36- */
37- public void dispose() {
38- super.dispose();
39- if (markerImage != null) {
40- markerImage.dispose();
41- }
42- }
43-}
Deleted: svn:mime-type
## -1 +0,0 ##
-text/plain
\ No newline at end of property
--- trunk/PropertiesEditor/src/jp/gr/java_conf/ussiy/app/propedit/eclipse/plugin/editors/PropertiesContentOutlinePage.java (revision 180)
+++ trunk/PropertiesEditor/src/jp/gr/java_conf/ussiy/app/propedit/eclipse/plugin/editors/PropertiesContentOutlinePage.java (nonexistent)
@@ -1,186 +0,0 @@
1-package jp.gr.java_conf.ussiy.app.propedit.eclipse.plugin.editors;
2-
3-import java.net.MalformedURLException;
4-import java.net.URL;
5-
6-import jp.gr.java_conf.ussiy.app.propedit.eclipse.plugin.PropertiesEditorPlugin;
7-import jp.gr.java_conf.ussiy.app.propedit.eclipse.plugin.resources.Messages;
8-
9-import org.eclipse.jface.action.Action;
10-import org.eclipse.jface.action.IToolBarManager;
11-import org.eclipse.jface.resource.ImageDescriptor;
12-import org.eclipse.jface.text.Position;
13-import org.eclipse.jface.viewers.ISelection;
14-import org.eclipse.jface.viewers.IStructuredSelection;
15-import org.eclipse.jface.viewers.SelectionChangedEvent;
16-import org.eclipse.jface.viewers.TreeViewer;
17-import org.eclipse.jface.viewers.ViewerSorter;
18-import org.eclipse.swt.widgets.Composite;
19-import org.eclipse.swt.widgets.Control;
20-import org.eclipse.ui.texteditor.IDocumentProvider;
21-import org.eclipse.ui.texteditor.ITextEditor;
22-import org.eclipse.ui.views.contentoutline.ContentOutlinePage;
23-
24-public class PropertiesContentOutlinePage extends ContentOutlinePage {
25- protected static String ALPHA_SORT_BTN_CHECK_KEY = "jp.gr.java_conf.ussiy.app.propedit.eclipse.plugin.editors.alphaSortCheckKey"; //$NON-NLS-1$
26-
27- /**
28- * A segment element.
29- */
30- protected static class Segment {
31- public String name;
32- public Position position;
33-
34- public Segment(String name, Position position) {
35- this.name= name;
36- this.position= position;
37- }
38-
39- public String toString() {
40- return name;
41- }
42- }
43-
44- protected Object fInput;
45- protected IDocumentProvider fDocumentProvider;
46- protected ITextEditor fTextEditor;
47- protected PropertiesOutlineContentProvider contentProvider;
48-
49- protected static ImageDescriptor sortImageDescriptor;
50-
51- /**
52- * Creates a content outline page using the given provider and the given editor.
53- */
54- public PropertiesContentOutlinePage(IDocumentProvider provider, ITextEditor editor) {
55- super();
56- fDocumentProvider= provider;
57- fTextEditor= editor;
58- fDocumentProvider.getDocument(fTextEditor.getEditorInput()).addDocumentListener(getContentProvider());
59- }
60-
61- protected PropertiesOutlineContentProvider getContentProvider() {
62- if (contentProvider == null) {
63- contentProvider = new PropertiesOutlineContentProvider(this);
64- }
65- return contentProvider;
66- }
67-
68- /**
69- * Method declared on ContentOutlinePage
70- */
71- public void createControl(Composite parent) {
72-
73- super.createControl(parent);
74-
75- // create tree viewer
76- TreeViewer viewer= getTreeViewer();
77- viewer.setContentProvider(getContentProvider());
78- viewer.setLabelProvider(new PropertiesOutlineLabelProvider());
79- viewer.addSelectionChangedListener(this);
80-
81- if (fInput != null)
82- viewer.setInput(fInput);
83-
84- // create toolbar action
85- PropertiesEditorPlugin.getDefault().getPluginPreferences().setDefault(ALPHA_SORT_BTN_CHECK_KEY, false);
86- IToolBarManager toolbar = getSite().getActionBars().getToolBarManager();
87- String label = Messages.getString("eclipse.contentoutline.sort.label"); //$NON-NLS-1$
88- Action action = new Action(label, Action.AS_CHECK_BOX) {
89- public void run() {
90- PropertiesEditorPlugin.getDefault().getPluginPreferences().setValue(ALPHA_SORT_BTN_CHECK_KEY, isChecked());
91- if (isChecked()) {
92- TreeViewer v = getTreeViewer();
93- v.setSorter(new ViewerSorter());
94- v.setInput(v.getInput());
95- } else {
96- getTreeViewer().setSorter(null);
97- redraw();
98- }
99- }
100- };
101- action.setToolTipText(action.getText());
102- if (sortImageDescriptor == null) {
103- URL url = PropertiesEditorPlugin.getDefault().getBundle().getEntry("/"); //$NON-NLS-1$
104- String path = "icons/alphab_sort_co.gif"; //$NON-NLS-1$
105- try {
106- sortImageDescriptor = ImageDescriptor.createFromURL(new URL(url, path));
107- } catch (MalformedURLException e) {
108- sortImageDescriptor = ImageDescriptor.getMissingImageDescriptor();
109- }
110- }
111- action.setImageDescriptor(sortImageDescriptor);
112- toolbar.add(action);
113-
114- action.setChecked(PropertiesEditorPlugin.getDefault().getPluginPreferences().getBoolean(ALPHA_SORT_BTN_CHECK_KEY));
115- action.run();
116- }
117-
118- /* (non-Javadoc)
119- * Method declared on ContentOutlinePage
120- */
121- public void selectionChanged(SelectionChangedEvent event) {
122-
123- super.selectionChanged(event);
124-
125- ISelection selection= event.getSelection();
126- if (selection.isEmpty())
127- fTextEditor.resetHighlightRange();
128- else {
129- Segment segment= (Segment) ((IStructuredSelection) selection).getFirstElement();
130- int start= segment.position.getOffset();
131- int length= segment.position.getLength();
132- try {
133- fTextEditor.setHighlightRange(start, length, true);
134- } catch (IllegalArgumentException x) {
135- fTextEditor.resetHighlightRange();
136- }
137- }
138- }
139-
140- /**
141- * Sets the input of the outline page
142- */
143- public void setInput(Object input) {
144- fInput= input;
145- update();
146- }
147-
148- /**
149- * Updates the outline page.
150- */
151- protected void update() {
152- TreeViewer viewer= getTreeViewer();
153- if (viewer != null) {
154- Control control= viewer.getControl();
155- if (control != null && !control.isDisposed()) {
156- control.setRedraw(false);
157- viewer.setInput(fInput);
158- viewer.expandAll();
159- control.setRedraw(true);
160- }
161- }
162- }
163-
164- /**
165- * Redraw the outline page.
166- */
167- public void redraw() {
168- TreeViewer viewer= getTreeViewer();
169-
170- if (viewer != null) {
171- Control control= viewer.getControl();
172- if (control != null && !control.isDisposed()) {
173- control.setRedraw(false);
174- viewer.expandAll();
175- control.setRedraw(true);
176- }
177- }
178- }
179-
180- /**
181- * @see org.eclipse.ui.part.IPage#dispose()
182- */
183- public void dispose() {
184- super.dispose();
185- }
186-}
Deleted: svn:mime-type
## -1 +0,0 ##
-text/plain
\ No newline at end of property
--- trunk/PropertiesEditor/src/jp/gr/java_conf/ussiy/app/propedit/eclipse/plugin/editors/PropertiesEditor.java (revision 180)
+++ trunk/PropertiesEditor/src/jp/gr/java_conf/ussiy/app/propedit/eclipse/plugin/editors/PropertiesEditor.java (revision 181)
@@ -4,6 +4,7 @@
44 import java.util.Iterator;
55
66 import jp.gr.java_conf.ussiy.app.propedit.eclipse.plugin.PropertiesEditorPlugin;
7+import jp.gr.java_conf.ussiy.app.propedit.eclipse.plugin.editors.view.outline.PropertiesContentOutlinePage;
78 import jp.gr.java_conf.ussiy.app.propedit.eclipse.plugin.preference.PropertiesEditorPreference;
89
910 import org.eclipse.core.runtime.CoreException;
@@ -96,6 +97,8 @@
9697
9798 //turn projection mode on
9899 viewer.doOperation(ProjectionViewer.TOGGLE);
100+
101+ getSite().setSelectionProvider(viewer);
99102
100103 annotationModel = viewer
101104 .getProjectionAnnotationModel();
--- trunk/PropertiesEditor/src/jp/gr/java_conf/ussiy/app/propedit/eclipse/plugin/editors/PropertiesDocumentProvider.java (revision 180)
+++ trunk/PropertiesEditor/src/jp/gr/java_conf/ussiy/app/propedit/eclipse/plugin/editors/PropertiesDocumentProvider.java (revision 181)
@@ -1,8 +1,5 @@
11 package jp.gr.java_conf.ussiy.app.propedit.eclipse.plugin.editors;
22
3-import java.io.ByteArrayInputStream;
4-import java.io.IOException;
5-import java.io.InputStream;
63 import java.util.ArrayList;
74 import java.util.List;
85
@@ -13,7 +10,6 @@
1310 import jp.gr.java_conf.ussiy.app.propedit.eclipse.plugin.resources.Messages;
1411 import jp.gr.java_conf.ussiy.app.propedit.util.EncodeChanger;
1512
16-import org.eclipse.core.resources.IFile;
1713 import org.eclipse.core.resources.IProject;
1814 import org.eclipse.core.runtime.CoreException;
1915 import org.eclipse.core.runtime.IConfigurationElement;
@@ -30,11 +26,8 @@
3026 import org.eclipse.jface.text.IDocument;
3127 import org.eclipse.jface.text.IDocumentPartitioner;
3228 import org.eclipse.jface.text.rules.FastPartitioner;
33-import org.eclipse.ui.IEditorInput;
3429 import org.eclipse.ui.IFileEditorInput;
35-import org.eclipse.ui.PlatformUI;
3630 import org.eclipse.ui.editors.text.FileDocumentProvider;
37-import org.eclipse.ui.texteditor.ResourceMarkerAnnotationModel;
3831
3932 public class PropertiesDocumentProvider extends FileDocumentProvider {
4033 private static final String EXTENSION_POINT = "jp.gr.java_conf.ussiy.app.propedit.listeners"; //$NON-NLS-1$
@@ -63,19 +56,7 @@
6356
6457 protected IDocument createDocument(Object element) throws CoreException {
6558
66- String readEncode = PropertiesEditorPlugin.getDefault().getPreferenceStore().getString(PropertiesPreference.P_ENCODE);
67- if (readEncode == null || readEncode.equals("")) { //$NON-NLS-1$
68- readEncode = getDefaultEncoding();
69- }
70- IDocument document = null;
71- if (element instanceof IEditorInput) {
72- document = createEmptyDocument();
73- IProject project = ((IFileEditorInput)element).getFile().getProject();
74- readEncode = PropertyUtil.getEncode(project, readEncode);
75- if (!setDocumentContent(document, (IEditorInput) element, readEncode)) {
76- document = null;
77- }
78- }
59+ IDocument document = super.createDocument(element);
7960
8061 List listeners = computePropertiesDocumentListeners();
8162 for (int i = 0; i < listeners.size(); i++) {
@@ -122,116 +103,63 @@
122103
123104 IProject project = input.getFile().getProject();
124105
125- try {
126- String encoding = PropertyUtil.getEncode(project, PropertiesEditorPlugin.getDefault().getPreferenceStore().getString(PropertiesPreference.P_ENCODE));
127- if (encoding == null || encoding.equals("")) { //$NON-NLS-1$
128- encoding = getDefaultEncoding();
106+ List listeners = computePropertiesDocumentListeners();
107+ for (int i = 0; i < listeners.size(); i++) {
108+ IPropertiesDocumentListener listener = (IPropertiesDocumentListener)listeners.get(i);
109+ try {
110+ listener.beforeUnicodeConvertAtSavingDocument(monitor, element, document, overwrite);
111+ } catch(Exception e) {
112+ IStatus status = new Status(IStatus.ERROR, PropertiesEditorPlugin.PLUGIN_ID, 0, e.getMessage(), e);
113+ ILog log = PropertiesEditorPlugin.getDefault().getLog();
114+ log.log(status);
129115 }
130-
131- List listeners = computePropertiesDocumentListeners();
132- for (int i = 0; i < listeners.size(); i++) {
133- IPropertiesDocumentListener listener = (IPropertiesDocumentListener)listeners.get(i);
134- try {
135- listener.beforeUnicodeConvertAtSavingDocument(monitor, element, document, overwrite);
136- } catch(Exception e) {
137- IStatus status = new Status(IStatus.ERROR, PropertiesEditorPlugin.PLUGIN_ID, 0, e.getMessage(), e);
138- ILog log = PropertiesEditorPlugin.getDefault().getLog();
139- log.log(status);
116+ }
117+
118+ String uniEscStr = null;
119+ String charcase = PropertyUtil.getCharCase(project, PropertiesEditorPlugin.getDefault().getPreferenceStore().getString(PropertiesPreference.P_CONVERT_CHAR_CASE));
120+ if (PropertyUtil.getNotAllConvert(project, PropertiesEditorPlugin.getDefault().getPreferenceStore().getBoolean(PropertiesPreference.P_NOT_ALL_CONVERT))) {
121+ uniEscStr = document.get();
122+ } else if (PropertyUtil.getNotConvertComment(project, PropertiesEditorPlugin.getDefault().getPreferenceStore().getBoolean(PropertiesPreference.P_NOT_CONVERT_COMMENT))) {
123+ try {
124+ if (Messages.getString("eclipse.propertieseditor.preference.convert.char.uppercase").equals(charcase)) { //$NON-NLS-1$
125+ uniEscStr = EncodeChanger.unicode2UnicodeEscWithoutComment(document.get(), EncodeChanger.UPPERCASE);
126+ } else {
127+ uniEscStr = EncodeChanger.unicode2UnicodeEscWithoutComment(document.get(), EncodeChanger.LOWERCASE);
140128 }
129+ } catch (Exception e) {
130+ IStatus status = new Status(IStatus.ERROR, PropertiesEditorPlugin.PLUGIN_ID, 0, e.getMessage(), e);
131+ ILog log = PropertiesEditorPlugin.getDefault().getLog();
132+ log.log(status);
133+ ErrorDialog.openError(null, Messages.getString("eclipse.propertieseditor.convert.error"), Messages.getString("eclipse.propertieseditor.property.get.settings.error"), status); //$NON-NLS-1$ //$NON-NLS-2$
141134 }
142-
143- String uniEscStr = null;
144- String charcase = PropertyUtil.getCharCase(project, PropertiesEditorPlugin.getDefault().getPreferenceStore().getString(PropertiesPreference.P_CONVERT_CHAR_CASE));
145- if (PropertyUtil.getNotAllConvert(project, PropertiesEditorPlugin.getDefault().getPreferenceStore().getBoolean(PropertiesPreference.P_NOT_ALL_CONVERT))) {
146- uniEscStr = document.get();
147- } else if (PropertyUtil.getNotConvertComment(project, PropertiesEditorPlugin.getDefault().getPreferenceStore().getBoolean(PropertiesPreference.P_NOT_CONVERT_COMMENT))) {
148- try {
149- if (Messages.getString("eclipse.propertieseditor.preference.convert.char.uppercase").equals(charcase)) { //$NON-NLS-1$
150- uniEscStr = EncodeChanger.unicode2UnicodeEscWithoutComment(document.get(), EncodeChanger.UPPERCASE);
151- } else {
152- uniEscStr = EncodeChanger.unicode2UnicodeEscWithoutComment(document.get(), EncodeChanger.LOWERCASE);
153- }
154- } catch (Exception e) {
155- IStatus status = new Status(IStatus.ERROR, PropertiesEditorPlugin.PLUGIN_ID, 0, e.getMessage(), e);
156- ILog log = PropertiesEditorPlugin.getDefault().getLog();
157- log.log(status);
158- ErrorDialog.openError(null, Messages.getString("eclipse.propertieseditor.convert.error"), Messages.getString("eclipse.propertieseditor.property.get.settings.error"), status); //$NON-NLS-1$ //$NON-NLS-2$
135+ } else {
136+ try {
137+ if (Messages.getString("eclipse.propertieseditor.preference.convert.char.uppercase").equals(charcase)) { //$NON-NLS-1$
138+ uniEscStr = EncodeChanger.unicode2UnicodeEsc(document.get(), EncodeChanger.UPPERCASE);
139+ } else {
140+ uniEscStr = EncodeChanger.unicode2UnicodeEsc(document.get(), EncodeChanger.LOWERCASE);
159141 }
160- } else {
161- try {
162- if (Messages.getString("eclipse.propertieseditor.preference.convert.char.uppercase").equals(charcase)) { //$NON-NLS-1$
163- uniEscStr = EncodeChanger.unicode2UnicodeEsc(document.get(), EncodeChanger.UPPERCASE);
164- } else {
165- uniEscStr = EncodeChanger.unicode2UnicodeEsc(document.get(), EncodeChanger.LOWERCASE);
166- }
167- } catch (Exception e) {
168- IStatus status = new Status(IStatus.ERROR, PropertiesEditorPlugin.PLUGIN_ID, 0, e.getMessage(), e);
169- ILog log = PropertiesEditorPlugin.getDefault().getLog();
170- log.log(status);
171- ErrorDialog.openError(null, Messages.getString("eclipse.propertieseditor.convert.error"), Messages.getString("eclipse.propertieseditor.property.get.settings.error"), status); //$NON-NLS-1$ //$NON-NLS-2$
172- }
142+ } catch (Exception e) {
143+ IStatus status = new Status(IStatus.ERROR, PropertiesEditorPlugin.PLUGIN_ID, 0, e.getMessage(), e);
144+ ILog log = PropertiesEditorPlugin.getDefault().getLog();
145+ log.log(status);
146+ ErrorDialog.openError(null, Messages.getString("eclipse.propertieseditor.convert.error"), Messages.getString("eclipse.propertieseditor.property.get.settings.error"), status); //$NON-NLS-1$ //$NON-NLS-2$
173147 }
174- document = new Document(uniEscStr);
175-
176- for (int i = 0; i < listeners.size(); i++) {
177- IPropertiesDocumentListener listener = (IPropertiesDocumentListener)listeners.get(i);
178- try {
179- listener.afterUnicodeConvertAtSavingDocument(monitor, element, document, overwrite);
180- } catch(Exception e) {
181- IStatus status = new Status(IStatus.ERROR, PropertiesEditorPlugin.PLUGIN_ID, 0, e.getMessage(), e);
182- ILog log = PropertiesEditorPlugin.getDefault().getLog();
183- log.log(status);
184- }
148+ }
149+ document = new Document(uniEscStr);
150+
151+ for (int i = 0; i < listeners.size(); i++) {
152+ IPropertiesDocumentListener listener = (IPropertiesDocumentListener)listeners.get(i);
153+ try {
154+ listener.afterUnicodeConvertAtSavingDocument(monitor, element, document, overwrite);
155+ } catch(Exception e) {
156+ IStatus status = new Status(IStatus.ERROR, PropertiesEditorPlugin.PLUGIN_ID, 0, e.getMessage(), e);
157+ ILog log = PropertiesEditorPlugin.getDefault().getLog();
158+ log.log(status);
185159 }
186-
187- InputStream stream = new ByteArrayInputStream(uniEscStr.toString().getBytes(encoding));
188- IFile file = input.getFile();
189-
190- if (file.exists()) {
191-
192- FileInfo info = (FileInfo) getElementInfo(element);
193-
194- if (info != null && !overwrite) {
195- checkSynchronizationState(info.fModificationStamp, file);
196-
197- // inform about the upcoming content change
198- }
199- fireElementStateChanging(element);
200- try {
201- file.setContents(stream, overwrite, true, monitor);
202- } catch (CoreException x) {
203- // inform about failure
204- fireElementStateChangeFailed(element);
205- throw x;
206- } catch (RuntimeException x) {
207- // inform about failure
208- fireElementStateChangeFailed(element);
209- throw x;
210- }
211-
212- // If here, the editor state will be flipped to "not dirty".
213- // Thus, the state changing flag will be reset.
214-
215- if (info != null) {
216-
217- ResourceMarkerAnnotationModel model = (ResourceMarkerAnnotationModel) info.fModel;
218- model.updateMarkers(info.fDocument);
219-
220- info.fModificationStamp = computeModificationStamp(file);
221- }
222-
223- } else {
224- super.doSaveDocument(monitor, element, document, overwrite);
225- return;
226- }
227-
228- } catch (IOException x) {
229- IStatus s = new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, IStatus.OK, x.getMessage(), x);
230- throw new CoreException(s);
231160 }
232161
233- } else {
234- super.doSaveDocument(monitor, element, document, overwrite);
235162 }
163+ super.doSaveDocument(monitor, element, document, overwrite);
236164 }
237165 }
\ No newline at end of file
--- trunk/PropertiesEditor/src/jp/gr/java_conf/ussiy/app/propedit/eclipse/plugin/editors/view/outline/PropertiesOutlineContentProvider.java (nonexistent)
+++ trunk/PropertiesEditor/src/jp/gr/java_conf/ussiy/app/propedit/eclipse/plugin/editors/view/outline/PropertiesOutlineContentProvider.java (revision 181)
@@ -0,0 +1,238 @@
1+package jp.gr.java_conf.ussiy.app.propedit.eclipse.plugin.editors.view.outline;
2+
3+import java.io.BufferedReader;
4+import java.io.IOException;
5+import java.io.StringReader;
6+import java.util.ArrayList;
7+import java.util.List;
8+
9+import jp.gr.java_conf.ussiy.app.propedit.eclipse.plugin.editors.view.outline.PropertiesContentOutlinePage.Segment;
10+
11+import org.eclipse.jface.text.BadPositionCategoryException;
12+import org.eclipse.jface.text.DefaultPositionUpdater;
13+import org.eclipse.jface.text.DocumentEvent;
14+import org.eclipse.jface.text.IDocument;
15+import org.eclipse.jface.text.IDocumentListener;
16+import org.eclipse.jface.text.IPositionUpdater;
17+import org.eclipse.jface.text.Position;
18+import org.eclipse.jface.viewers.ITreeContentProvider;
19+import org.eclipse.jface.viewers.Viewer;
20+
21+/**
22+ * Divides the editor's document into ten segments and provides elements for
23+ * them.
24+ */
25+class PropertiesOutlineContentProvider implements ITreeContentProvider, IDocumentListener {
26+
27+ private final PropertiesContentOutlinePage fContentOutlinePage;
28+
29+ /**
30+ * @param page
31+ */
32+ PropertiesOutlineContentProvider(PropertiesContentOutlinePage page) {
33+ this.fContentOutlinePage = page;
34+ }
35+
36+ protected final static String SEGMENTS = "__properties_segments"; //$NON-NLS-1$
37+
38+ protected IPositionUpdater fPositionUpdater = new DefaultPositionUpdater(
39+ SEGMENTS);
40+
41+ protected List fContent = new ArrayList(10);
42+
43+ protected void parse(IDocument document) {
44+ String line = null;
45+ int cntLine = 0;
46+ boolean multipleValueFlg = false;
47+
48+ BufferedReader reader = null;
49+ try {
50+ reader = new BufferedReader(new StringReader(document.get()));
51+ while ((line = reader.readLine()) != null) {
52+ cntLine++;
53+ if (multipleValueFlg) {
54+ if (line.endsWith("\\")) { //$NON-NLS-1$
55+ multipleValueFlg = true;
56+ } else {
57+ multipleValueFlg = false;
58+ }
59+ continue;
60+ } else {
61+ if (line.trim().equals("") || line.trim().startsWith("#") || line.trim().startsWith("!")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
62+ continue;
63+ }
64+ }
65+ line = line.trim();
66+ boolean escapeFlg = false;
67+ boolean nonSeparate = true;
68+ for (int i = 0; i < line.length(); i++) {
69+ char achar = line.charAt(i);
70+ if (achar == '\\') {
71+ if (escapeFlg) {
72+ String tmp = line;
73+ line = ""; //$NON-NLS-1$
74+ line = tmp.substring(0, i);
75+ line += tmp.substring(i + 1, tmp.length());
76+ escapeFlg = false;
77+ i--;
78+ } else {
79+ escapeFlg = true;
80+ }
81+ } else if (achar == '=' || achar == '\t' || achar == ':' || achar == ' ') {
82+ if (escapeFlg) {
83+ String tmp = line;
84+ line = ""; //$NON-NLS-1$
85+ line = tmp.substring(0, i - 1);
86+ line += tmp.substring(i, tmp.length());
87+ escapeFlg = false;
88+ i--;
89+ continue;
90+ } else {
91+ int offset = document.getLineOffset(cntLine - 1);
92+ Position p = new Position(offset, i);
93+ document.addPosition(SEGMENTS, p);
94+
95+ fContent.add(new Segment(line.substring(0, i).trim(), p)); //$NON-NLS-1$
96+
97+ nonSeparate = false;
98+ escapeFlg = false;
99+ break;
100+ }
101+ } else {
102+ if (escapeFlg) {
103+ String tmp = line;
104+ line = ""; //$NON-NLS-1$
105+ line = tmp.substring(0, i - 1);
106+ line += tmp.substring(i, tmp.length());
107+ i--;
108+ }
109+ escapeFlg = false;
110+ }
111+ }
112+ if (nonSeparate) {
113+ if (line.endsWith("\\")) { //$NON-NLS-1$
114+ continue;
115+ }
116+ }
117+ if (line.endsWith("\\")) { //$NON-NLS-1$
118+ multipleValueFlg = true;
119+ } else {
120+ multipleValueFlg = false;
121+ }
122+ }
123+
124+ } catch (Exception e) {
125+ e.printStackTrace();
126+ } finally {
127+ try {
128+ if (reader != null) {
129+ reader.close();
130+ }
131+ } catch (IOException e) {
132+ }
133+ }
134+
135+ }
136+
137+ /*
138+ * @see IContentProvider#inputChanged(Viewer, Object, Object)
139+ */
140+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
141+ if (oldInput != null) {
142+ IDocument document = this.fContentOutlinePage.fDocumentProvider
143+ .getDocument(oldInput);
144+ if (document != null) {
145+ try {
146+ document.removePositionCategory(SEGMENTS);
147+ } catch (BadPositionCategoryException x) {
148+ }
149+ document.removePositionUpdater(fPositionUpdater);
150+ }
151+ }
152+
153+ fContent.clear();
154+
155+ if (newInput != null) {
156+ IDocument document = this.fContentOutlinePage.fDocumentProvider
157+ .getDocument(newInput);
158+ if (document != null) {
159+ document.addPositionCategory(SEGMENTS);
160+ document.addPositionUpdater(fPositionUpdater);
161+
162+ parse(document);
163+ }
164+ }
165+ }
166+
167+ /*
168+ * @see IContentProvider#dispose
169+ */
170+ public void dispose() {
171+ if (fContent != null) {
172+ fContent.clear();
173+ fContent = null;
174+ }
175+ }
176+
177+ /*
178+ * @see IContentProvider#isDeleted(Object)
179+ */
180+ public boolean isDeleted(Object element) {
181+ return false;
182+ }
183+
184+ /*
185+ * @see IStructuredContentProvider#getElements(Object)
186+ */
187+ public Object[] getElements(Object element) {
188+ return fContent.toArray();
189+ }
190+
191+ /*
192+ * @see ITreeContentProvider#hasChildren(Object)
193+ */
194+ public boolean hasChildren(Object element) {
195+ return element == this.fContentOutlinePage.fInput;
196+ }
197+
198+ /*
199+ * @see ITreeContentProvider#getParent(Object)
200+ */
201+ public Object getParent(Object element) {
202+ if (element instanceof Segment)
203+ return this.fContentOutlinePage.fInput;
204+ return null;
205+ }
206+
207+ /*
208+ * @see ITreeContentProvider#getChildren(Object)
209+ */
210+ public Object[] getChildren(Object element) {
211+ if (element == this.fContentOutlinePage.fInput)
212+ return fContent.toArray();
213+ return new Object[0];
214+ }
215+
216+ /**
217+ * @see org.eclipse.jface.text.IDocumentListener#documentAboutToBeChanged(org.eclipse.jface.text.DocumentEvent)
218+ */
219+ public void documentAboutToBeChanged(DocumentEvent event) {
220+ }
221+
222+ /**
223+ * @see org.eclipse.jface.text.IDocumentListener#documentChanged(org.eclipse.jface.text.DocumentEvent)
224+ */
225+ public void documentChanged(DocumentEvent event) {
226+// try {
227+// event.getDocument().removePositionCategory(SEGMENTS);
228+// } catch (BadPositionCategoryException x) {
229+// }
230+// event.getDocument().removePositionUpdater(fPositionUpdater);
231+// fContent.clear();
232+// event.getDocument().addPositionCategory(SEGMENTS);
233+// event.getDocument().addPositionUpdater(fPositionUpdater);
234+// parse(event.getDocument());
235+// fContentOutlinePage.update();
236+ }
237+
238+}
\ No newline at end of file
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
--- trunk/PropertiesEditor/src/jp/gr/java_conf/ussiy/app/propedit/eclipse/plugin/editors/view/outline/PropertiesContentOutlinePage.java (nonexistent)
+++ trunk/PropertiesEditor/src/jp/gr/java_conf/ussiy/app/propedit/eclipse/plugin/editors/view/outline/PropertiesContentOutlinePage.java (revision 181)
@@ -0,0 +1,186 @@
1+package jp.gr.java_conf.ussiy.app.propedit.eclipse.plugin.editors.view.outline;
2+
3+import java.net.MalformedURLException;
4+import java.net.URL;
5+
6+import jp.gr.java_conf.ussiy.app.propedit.eclipse.plugin.PropertiesEditorPlugin;
7+import jp.gr.java_conf.ussiy.app.propedit.eclipse.plugin.resources.Messages;
8+
9+import org.eclipse.jface.action.Action;
10+import org.eclipse.jface.action.IToolBarManager;
11+import org.eclipse.jface.resource.ImageDescriptor;
12+import org.eclipse.jface.text.Position;
13+import org.eclipse.jface.viewers.ISelection;
14+import org.eclipse.jface.viewers.IStructuredSelection;
15+import org.eclipse.jface.viewers.SelectionChangedEvent;
16+import org.eclipse.jface.viewers.TreeViewer;
17+import org.eclipse.jface.viewers.ViewerSorter;
18+import org.eclipse.swt.widgets.Composite;
19+import org.eclipse.swt.widgets.Control;
20+import org.eclipse.ui.texteditor.IDocumentProvider;
21+import org.eclipse.ui.texteditor.ITextEditor;
22+import org.eclipse.ui.views.contentoutline.ContentOutlinePage;
23+
24+public class PropertiesContentOutlinePage extends ContentOutlinePage {
25+ protected static String ALPHA_SORT_BTN_CHECK_KEY = "jp.gr.java_conf.ussiy.app.propedit.eclipse.plugin.editors.alphaSortCheckKey"; //$NON-NLS-1$
26+
27+ /**
28+ * A segment element.
29+ */
30+ protected static class Segment {
31+ public String name;
32+ public Position position;
33+
34+ public Segment(String name, Position position) {
35+ this.name= name;
36+ this.position= position;
37+ }
38+
39+ public String toString() {
40+ return name;
41+ }
42+ }
43+
44+ protected Object fInput;
45+ protected IDocumentProvider fDocumentProvider;
46+ protected ITextEditor fTextEditor;
47+ protected PropertiesOutlineContentProvider contentProvider;
48+
49+ protected static ImageDescriptor sortImageDescriptor;
50+
51+ /**
52+ * Creates a content outline page using the given provider and the given editor.
53+ */
54+ public PropertiesContentOutlinePage(IDocumentProvider provider, ITextEditor editor) {
55+ super();
56+ fDocumentProvider= provider;
57+ fTextEditor= editor;
58+ fDocumentProvider.getDocument(fTextEditor.getEditorInput()).addDocumentListener(getContentProvider());
59+ }
60+
61+ protected PropertiesOutlineContentProvider getContentProvider() {
62+ if (contentProvider == null) {
63+ contentProvider = new PropertiesOutlineContentProvider(this);
64+ }
65+ return contentProvider;
66+ }
67+
68+ /**
69+ * Method declared on ContentOutlinePage
70+ */
71+ public void createControl(Composite parent) {
72+
73+ super.createControl(parent);
74+
75+ // create tree viewer
76+ TreeViewer viewer= getTreeViewer();
77+ viewer.setContentProvider(getContentProvider());
78+ viewer.setLabelProvider(new PropertiesOutlineLabelProvider());
79+ viewer.addSelectionChangedListener(this);
80+
81+ if (fInput != null)
82+ viewer.setInput(fInput);
83+
84+ // create toolbar action
85+ PropertiesEditorPlugin.getDefault().getPluginPreferences().setDefault(ALPHA_SORT_BTN_CHECK_KEY, false);
86+ IToolBarManager toolbar = getSite().getActionBars().getToolBarManager();
87+ String label = Messages.getString("eclipse.contentoutline.sort.label"); //$NON-NLS-1$
88+ Action action = new Action(label, Action.AS_CHECK_BOX) {
89+ public void run() {
90+ PropertiesEditorPlugin.getDefault().getPluginPreferences().setValue(ALPHA_SORT_BTN_CHECK_KEY, isChecked());
91+ if (isChecked()) {
92+ TreeViewer v = getTreeViewer();
93+ v.setSorter(new ViewerSorter());
94+ v.setInput(v.getInput());
95+ } else {
96+ getTreeViewer().setSorter(null);
97+ redraw();
98+ }
99+ }
100+ };
101+ action.setToolTipText(action.getText());
102+ if (sortImageDescriptor == null) {
103+ URL url = PropertiesEditorPlugin.getDefault().getBundle().getEntry("/"); //$NON-NLS-1$
104+ String path = "icons/alphab_sort_co.gif"; //$NON-NLS-1$
105+ try {
106+ sortImageDescriptor = ImageDescriptor.createFromURL(new URL(url, path));
107+ } catch (MalformedURLException e) {
108+ sortImageDescriptor = ImageDescriptor.getMissingImageDescriptor();
109+ }
110+ }
111+ action.setImageDescriptor(sortImageDescriptor);
112+ toolbar.add(action);
113+
114+ action.setChecked(PropertiesEditorPlugin.getDefault().getPluginPreferences().getBoolean(ALPHA_SORT_BTN_CHECK_KEY));
115+ action.run();
116+ }
117+
118+ /* (non-Javadoc)
119+ * Method declared on ContentOutlinePage
120+ */
121+ public void selectionChanged(SelectionChangedEvent event) {
122+
123+ super.selectionChanged(event);
124+
125+ ISelection selection= event.getSelection();
126+ if (selection.isEmpty())
127+ fTextEditor.resetHighlightRange();
128+ else {
129+ Segment segment= (Segment) ((IStructuredSelection) selection).getFirstElement();
130+ int start= segment.position.getOffset();
131+ int length= segment.position.getLength();
132+ try {
133+ fTextEditor.setHighlightRange(start, length, true);
134+ } catch (IllegalArgumentException x) {
135+ fTextEditor.resetHighlightRange();
136+ }
137+ }
138+ }
139+
140+ /**
141+ * Sets the input of the outline page
142+ */
143+ public void setInput(Object input) {
144+ fInput= input;
145+ update();
146+ }
147+
148+ /**
149+ * Updates the outline page.
150+ */
151+ public void update() {
152+ TreeViewer viewer= getTreeViewer();
153+ if (viewer != null) {
154+ Control control= viewer.getControl();
155+ if (control != null && !control.isDisposed()) {
156+ control.setRedraw(false);
157+ viewer.setInput(fInput);
158+ viewer.expandAll();
159+ control.setRedraw(true);
160+ }
161+ }
162+ }
163+
164+ /**
165+ * Redraw the outline page.
166+ */
167+ public void redraw() {
168+ TreeViewer viewer= getTreeViewer();
169+
170+ if (viewer != null) {
171+ Control control= viewer.getControl();
172+ if (control != null && !control.isDisposed()) {
173+ control.setRedraw(false);
174+ viewer.expandAll();
175+ control.setRedraw(true);
176+ }
177+ }
178+ }
179+
180+ /**
181+ * @see org.eclipse.ui.part.IPage#dispose()
182+ */
183+ public void dispose() {
184+ super.dispose();
185+ }
186+}
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
--- trunk/PropertiesEditor/src/jp/gr/java_conf/ussiy/app/propedit/eclipse/plugin/editors/view/outline/PropertiesOutlineLabelProvider.java (nonexistent)
+++ trunk/PropertiesEditor/src/jp/gr/java_conf/ussiy/app/propedit/eclipse/plugin/editors/view/outline/PropertiesOutlineLabelProvider.java (revision 181)
@@ -0,0 +1,43 @@
1+package jp.gr.java_conf.ussiy.app.propedit.eclipse.plugin.editors.view.outline;
2+
3+import java.net.MalformedURLException;
4+import java.net.URL;
5+
6+import jp.gr.java_conf.ussiy.app.propedit.eclipse.plugin.PropertiesEditorPlugin;
7+
8+import org.eclipse.jface.resource.ImageDescriptor;
9+import org.eclipse.jface.viewers.LabelProvider;
10+import org.eclipse.swt.graphics.Image;
11+
12+public class PropertiesOutlineLabelProvider extends LabelProvider {
13+ protected static Image markerImage;
14+
15+ /**
16+ * @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object)
17+ */
18+ public Image getImage(Object element) {
19+ if (markerImage != null && !markerImage.isDisposed()) {
20+ return markerImage;
21+ }
22+ URL url = PropertiesEditorPlugin.getDefault().getBundle().getEntry("/"); //$NON-NLS-1$
23+ String path = "icons/outlineMarker.gif"; //$NON-NLS-1$
24+ ImageDescriptor descriptor = null;
25+ try {
26+ descriptor = ImageDescriptor.createFromURL(new URL(url, path));
27+ } catch (MalformedURLException e) {
28+ descriptor = ImageDescriptor.getMissingImageDescriptor();
29+ }
30+ markerImage = descriptor.createImage();
31+ return markerImage;
32+ }
33+
34+ /**
35+ * @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose()
36+ */
37+ public void dispose() {
38+ super.dispose();
39+ if (markerImage != null) {
40+ markerImage.dispose();
41+ }
42+ }
43+}
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
--- trunk/PropertiesEditor/src/jp/gr/java_conf/ussiy/app/propedit/eclipse/plugin/action/ToggleCommentAction.java (revision 180)
+++ trunk/PropertiesEditor/src/jp/gr/java_conf/ussiy/app/propedit/eclipse/plugin/action/ToggleCommentAction.java (revision 181)
@@ -1,7 +1,6 @@
11 package jp.gr.java_conf.ussiy.app.propedit.eclipse.plugin.action;
22
33 import jp.gr.java_conf.ussiy.app.propedit.eclipse.plugin.PropertiesEditorPlugin;
4-import jp.gr.java_conf.ussiy.app.propedit.eclipse.plugin.editors.MultiPagePropertiesEditor;
54 import jp.gr.java_conf.ussiy.app.propedit.eclipse.plugin.editors.PropertiesEditor;
65 import jp.gr.java_conf.ussiy.app.propedit.eclipse.plugin.preference.PropertiesPreference;
76 import jp.gr.java_conf.ussiy.app.propedit.eclipse.plugin.property.PropertyUtil;
@@ -26,9 +25,7 @@
2625 * @see org.eclipse.ui.IEditorActionDelegate#setActiveEditor(org.eclipse.jface.action.IAction, org.eclipse.ui.IEditorPart)
2726 */
2827 public void setActiveEditor(IAction action, IEditorPart targetEditor) {
29- if (targetEditor instanceof MultiPagePropertiesEditor) {
30- textEditor = ((MultiPagePropertiesEditor)targetEditor).getEditor();
31- } else if (targetEditor instanceof PropertiesEditor) {
28+ if (targetEditor instanceof PropertiesEditor) {
3229 textEditor = (PropertiesEditor)targetEditor;
3330 }
3431
--- trunk/PropertiesEditor/src/jp/gr/java_conf/ussiy/app/propedit/eclipse/plugin/action/ExpandAllFoldingAction.java (revision 180)
+++ trunk/PropertiesEditor/src/jp/gr/java_conf/ussiy/app/propedit/eclipse/plugin/action/ExpandAllFoldingAction.java (revision 181)
@@ -2,7 +2,6 @@
22
33 import java.util.Iterator;
44
5-import jp.gr.java_conf.ussiy.app.propedit.eclipse.plugin.editors.MultiPagePropertiesEditor;
65 import jp.gr.java_conf.ussiy.app.propedit.eclipse.plugin.editors.PropertiesEditor;
76
87 import org.eclipse.jface.action.IAction;
@@ -19,9 +18,7 @@
1918 * @see org.eclipse.ui.IEditorActionDelegate#setActiveEditor(org.eclipse.jface.action.IAction, org.eclipse.ui.IEditorPart)
2019 */
2120 public void setActiveEditor(IAction action, IEditorPart targetEditor) {
22- if (targetEditor instanceof MultiPagePropertiesEditor) {
23- textEditor = ((MultiPagePropertiesEditor)targetEditor).getEditor();
24- } else if (targetEditor instanceof PropertiesEditor) {
21+ if (targetEditor instanceof PropertiesEditor) {
2522 textEditor = (PropertiesEditor)targetEditor;
2623 }
2724 }
--- trunk/PropertiesEditor/src/jp/gr/java_conf/ussiy/app/propedit/eclipse/plugin/action/CollapseAllFoldingAction.java (revision 180)
+++ trunk/PropertiesEditor/src/jp/gr/java_conf/ussiy/app/propedit/eclipse/plugin/action/CollapseAllFoldingAction.java (revision 181)
@@ -2,7 +2,6 @@
22
33 import java.util.Iterator;
44
5-import jp.gr.java_conf.ussiy.app.propedit.eclipse.plugin.editors.MultiPagePropertiesEditor;
65 import jp.gr.java_conf.ussiy.app.propedit.eclipse.plugin.editors.PropertiesEditor;
76
87 import org.eclipse.jface.action.IAction;
@@ -19,9 +18,7 @@
1918 * @see org.eclipse.ui.IEditorActionDelegate#setActiveEditor(org.eclipse.jface.action.IAction, org.eclipse.ui.IEditorPart)
2019 */
2120 public void setActiveEditor(IAction action, IEditorPart targetEditor) {
22- if (targetEditor instanceof MultiPagePropertiesEditor) {
23- textEditor = ((MultiPagePropertiesEditor)targetEditor).getEditor();
24- } else if (targetEditor instanceof PropertiesEditor) {
21+ if (targetEditor instanceof PropertiesEditor) {
2522 textEditor = (PropertiesEditor)targetEditor;
2623 }
2724 }
--- trunk/PropertiesEditor/src/jp/gr/java_conf/ussiy/app/propedit/eclipse/plugin/preference/PreferenceInitializer.java (revision 180)
+++ trunk/PropertiesEditor/src/jp/gr/java_conf/ussiy/app/propedit/eclipse/plugin/preference/PreferenceInitializer.java (revision 181)
@@ -3,7 +3,6 @@
33 import jp.gr.java_conf.ussiy.app.propedit.eclipse.plugin.PropertiesEditorPlugin;
44 import jp.gr.java_conf.ussiy.app.propedit.eclipse.plugin.resources.Messages;
55
6-import org.eclipse.core.resources.ResourcesPlugin;
76 import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
87 import org.eclipse.jface.preference.IPreferenceStore;
98
@@ -16,7 +15,6 @@
1615
1716 IPreferenceStore pStore = PropertiesEditorPlugin.getDefault().getPreferenceStore();
1817 pStore.setDefault(PropertiesEditorDuplicationCheckerPreference.P_CHECK_KEY, false);
19- pStore.setDefault(PropertiesPreference.P_ENCODE, ResourcesPlugin.getEncoding());
2018 pStore.setDefault(PropertiesPreference.P_COMMENT_CHARACTER, "#"); //$NON-NLS-1$
2119 pStore.setDefault(PropertiesPreference.P_CONVERT_CHAR_CASE, Messages.getString("eclipse.propertieseditor.preference.convert.char.lowercase")); //$NON-NLS-1$
2220 pStore.setDefault(PropertiesEditorPreference.P_COLLAPSE, false);
--- trunk/PropertiesEditor/src/jp/gr/java_conf/ussiy/app/propedit/eclipse/plugin/preference/PropertiesEditorPreference.java (revision 180)
+++ trunk/PropertiesEditor/src/jp/gr/java_conf/ussiy/app/propedit/eclipse/plugin/preference/PropertiesEditorPreference.java (revision 181)
@@ -2,7 +2,6 @@
22
33 import jp.gr.java_conf.ussiy.app.propedit.eclipse.plugin.PropertiesEditorPlugin;
44 import jp.gr.java_conf.ussiy.app.propedit.eclipse.plugin.editors.ColorManager;
5-import jp.gr.java_conf.ussiy.app.propedit.eclipse.plugin.editors.MultiPagePropertiesEditor;
65 import jp.gr.java_conf.ussiy.app.propedit.eclipse.plugin.resources.Messages;
76
87 import org.eclipse.jface.preference.BooleanFieldEditor;
@@ -130,14 +129,9 @@
130129 for (int k = 0; k < editorReferences.length; k++) {
131130 IEditorReference ref = editorReferences[k];
132131 IEditorPart editorPart = ref.getEditor(false);
133- if (editorPart instanceof MultiPagePropertiesEditor) {
132+ if (editorPart instanceof jp.gr.java_conf.ussiy.app.propedit.eclipse.plugin.editors.PropertiesEditor) {
134133 RGB rgb = PreferenceConverter.getColor(pStore, PropertiesEditorPreference.P_BACKGROUND_COLOR);
135134 Color color = new ColorManager().getColor(rgb);
136- jp.gr.java_conf.ussiy.app.propedit.eclipse.plugin.editors.PropertiesEditor editor = ((MultiPagePropertiesEditor) editorPart).getEditor();
137- editor.setBackground(color);
138- } else if (editorPart instanceof jp.gr.java_conf.ussiy.app.propedit.eclipse.plugin.editors.PropertiesEditor) {
139- RGB rgb = PreferenceConverter.getColor(pStore, PropertiesEditorPreference.P_BACKGROUND_COLOR);
140- Color color = new ColorManager().getColor(rgb);
141135 jp.gr.java_conf.ussiy.app.propedit.eclipse.plugin.editors.PropertiesEditor editor =
142136 (jp.gr.java_conf.ussiy.app.propedit.eclipse.plugin.editors.PropertiesEditor)editorPart;
143137 editor.setBackground(color);
--- trunk/PropertiesEditor/src/jp/gr/java_conf/ussiy/app/propedit/eclipse/plugin/preference/PropertiesPreference.java (revision 180)
+++ trunk/PropertiesEditor/src/jp/gr/java_conf/ussiy/app/propedit/eclipse/plugin/preference/PropertiesPreference.java (revision 181)
@@ -1,7 +1,6 @@
11 package jp.gr.java_conf.ussiy.app.propedit.eclipse.plugin.preference;
22
33 import jp.gr.java_conf.ussiy.app.propedit.eclipse.plugin.PropertiesEditorPlugin;
4-import jp.gr.java_conf.ussiy.app.propedit.eclipse.plugin.editors.ComboFieldEditor;
54 import jp.gr.java_conf.ussiy.app.propedit.eclipse.plugin.resources.Messages;
65
76 import org.eclipse.jface.preference.BooleanFieldEditor;
@@ -18,8 +17,6 @@
1817
1918 public class PropertiesPreference extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {
2019
21- public static final String P_ENCODE = "readEncode"; //$NON-NLS-1$
22-
2320 public static final String P_NOT_CONVERT_COMMENT = "notConvertComment"; //$NON-NLS-1$
2421
2522 public static final String P_NOT_ALL_CONVERT = "notConvert"; //$NON-NLS-1$
@@ -28,8 +25,6 @@
2825
2926 public static final String P_CONVERT_CHAR_CASE = "convertCharCase"; //$NON-NLS-1$
3027
31- private ComboFieldEditor encodeComboFieldEditor;
32-
3328 private BooleanFieldEditor notAllConvertEditor;
3429
3530 private BooleanFieldEditor notConvertCommentField;
@@ -37,8 +32,6 @@
3732 private StringFieldEditor commentCharacterField;
3833
3934 private RadioGroupFieldEditor convertCharCaseField;
40-
41- private String[] items = new String[] { System.getProperty("file.encoding"), "US-ASCII", "UTF-8", "UTF-16" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
4235
4336 private String[][] charCaseItems = new String[][] { { Messages.getString("eclipse.propertieseditor.preference.convert.char.uppercase"), Messages.getString("eclipse.propertieseditor.preference.convert.char.uppercase") }, { Messages.getString("eclipse.propertieseditor.preference.convert.char.lowercase"), Messages.getString("eclipse.propertieseditor.preference.convert.char.lowercase") } }; //$NON-NLS-1$ //$NON-NLS-2$
4437
@@ -53,7 +46,6 @@
5346
5447 Composite parent = getFieldEditorParent();
5548
56- encodeComboFieldEditor = new ComboFieldEditor(P_ENCODE, Messages.getString("eclipse.propertieseditor.preference.read.encode"), items, parent); //$NON-NLS-1$
5749 commentCharacterField = new StringFieldEditor(P_COMMENT_CHARACTER, Messages.getString("eclipse.propertieseditor.preference.comment.character"), 1, parent); //$NON-NLS-1$
5850 commentCharacterField.setTextLimit(1);
5951 convertCharCaseField = new RadioGroupFieldEditor(P_CONVERT_CHAR_CASE, Messages.getString("eclipse.propertieseditor.preference.convert.char.case"), 2, charCaseItems, parent, true); //$NON-NLS-1$
@@ -79,7 +71,6 @@
7971 notConvertCommentField.setEnabled(!PropertiesEditorPlugin.getDefault().getPreferenceStore().getBoolean(PropertiesPreference.P_NOT_ALL_CONVERT), convGroup);
8072
8173 addField(commentCharacterField);
82- addField(encodeComboFieldEditor);
8374 addField(convertCharCaseField);
8475 addField(notAllConvertEditor);
8576 addField(notConvertCommentField);
--- trunk/PropertiesEditor/plugin.xml (revision 180)
+++ trunk/PropertiesEditor/plugin.xml (revision 181)
@@ -214,6 +214,7 @@
214214 name="Properties File"
215215 base-type="org.eclipse.core.runtime.text"
216216 file-extensions="properties"
217+ priority="high"
217218 default-charset=""/>
218219 </extension>
219220
Show on old repository browser