Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 109468 | Differences between
and this patch

Collapse All | Expand All

(-)plugin.properties (-1 / +19 lines)
Lines 32-35 Link Here
32
AddTask.label=Add &Task...
32
AddTask.label=Add &Task...
33
AddTask.tooltip=Add Task...
33
AddTask.tooltip=Add Task...
34
AddBookmark.label=Add Boo&kmark...
34
AddBookmark.label=Add Boo&kmark...
35
AddBookmark.tooltip=Add Bookmark...
35
AddBookmark.tooltip=Add Bookmark...
36
##
37
CleanupDocument_label=Cleanup Document...
38
CleanupDocument_tooltip=Cleanup Document
39
ToggleComment_label=Toggle Comment
40
ToggleComment_tooltip=Toggle Comment
41
AddBlockComment_label=Add Block Comment
42
AddBlockComment_tooltip=Add Block Comment
43
RemoveBlockComment_label=Remove Block Comment
44
RemoveBlockComment_tooltip=Remove Block Comment
45
FindOccurrences_label=Occurrences in File
46
StructureSelectEnclosing_label=Enclosing Element
47
StructureSelectEnclosing_tooltip=Expand selection to include enclosing element
48
StructureSelectNext_label=Next Element
49
StructureSelectNext_tooltip=Expand selection to include next sibling
50
StructureSelectPrevious_label=Previous Element
51
StructureSelectPrevious_tooltip=Expand selection to include previous sibling
52
StructureSelectHistory_label=Restore Last Selection
53
StructureSelectHistory_tooltip=Restore last selection
(-)plugin.xml (-1 / +79 lines)
Lines 12-18 Link Here
12
			icon="icons/full/obj16/sourceEditor.gif"
12
			icon="icons/full/obj16/sourceEditor.gif"
13
			default="true"
13
			default="true"
14
			contributorClass="org.eclipse.wst.html.ui.internal.edit.ui.ActionContributorHTML"
14
			contributorClass="org.eclipse.wst.html.ui.internal.edit.ui.ActionContributorHTML"
15
			class="org.eclipse.wst.html.ui.internal.provisional.StructuredTextEditorHTML"
15
			class="org.eclipse.wst.sse.ui.internal.StructuredTextEditor"
16
			symbolicFontName="org.eclipse.wst.sse.ui.textfont"
16
			symbolicFontName="org.eclipse.wst.sse.ui.textfont"
17
			id="org.eclipse.wst.html.core.htmlsource.source">
17
			id="org.eclipse.wst.html.core.htmlsource.source">
18
			<contentTypeBinding
18
			<contentTypeBinding
Lines 385-388 Link Here
385
			</action>
385
			</action>
386
		</viewerContribution>
386
		</viewerContribution>
387
	</extension>
387
	</extension>
388
	
389
	<extension point="org.eclipse.ui.editorActions">
390
		<editorContribution
391
			id="org.eclipse.wst.html.core.htmlsource.source.editorActions"
392
			targetID="org.eclipse.wst.html.core.htmlsource.source">
393
			<action
394
				id="CleanupDocument"
395
				label="%CleanupDocument_label"
396
				definitionId="org.eclipse.wst.sse.ui.cleanup.document"
397
				tooltip="%CleanupDocument_tooltip"
398
				class="org.eclipse.wst.html.ui.internal.edit.ui.CleanupActionHTMLDelegate"
399
				actionID="CleanupDocument">
400
			</action>
401
			<action
402
				id="ToggleComment"
403
				label="%ToggleComment_label"
404
				definitionId="org.eclipse.wst.sse.ui.toggle.comment"
405
				tooltip="%ToggleComment_tooltip"
406
				class="org.eclipse.wst.xml.ui.internal.actions.ToggleCommentActionXMLDelegate"
407
				actionID="ToggleComment">
408
			</action>
409
			<action
410
				id="AddBlockComment"
411
				label="%AddBlockComment_label"
412
				definitionId="org.eclipse.wst.sse.ui.add.block.comment"
413
				tooltip="%AddBlockComment_tooltip"
414
				class="org.eclipse.wst.xml.ui.internal.actions.AddBlockCommentActionXMLDelegate"
415
				actionID="AddBlockComment">
416
			</action>
417
			<action
418
				id="RemoveBlockComment"
419
				label="%RemoveBlockComment_label"
420
				definitionId="org.eclipse.wst.sse.ui.remove.block.comment"
421
				tooltip="%RemoveBlockComment_tooltip"
422
				class="org.eclipse.wst.xml.ui.internal.actions.RemoveBlockCommentActionXMLDelegate"
423
				actionID="RemoveBlockComment">
424
			</action>
425
			<action
426
				id="FindOccurrences"
427
				label="%FindOccurrences_label"
428
				definitionId="org.eclipse.wst.sse.ui.search.find.occurrences"
429
				class="org.eclipse.wst.html.ui.internal.search.HTMLFindOccurrencesActionDelegate"
430
				actionID="FindOccurrences">
431
			</action>
432
			<action
433
				id="StructureSelectEnclosing"
434
				label="%StructureSelectEnclosing_label"
435
				definitionId="org.eclipse.wst.sse.ui.structure.select.enclosing"
436
				tooltip="%StructureSelectEnclosing_tooltip"
437
				class="org.eclipse.wst.xml.ui.internal.selection.StructuredSelectEnclosingXMLActionDelegate"
438
				actionID="StructureSelectEnclosing">
439
			</action>
440
			<action
441
				id="StructureSelectNext"
442
				label="%StructureSelectNext_label"
443
				definitionId="org.eclipse.wst.sse.ui.structure.select.next"
444
				tooltip="%StructureSelectNext_tooltip"
445
				class="org.eclipse.wst.xml.ui.internal.selection.StructuredSelectNextXMLActionDelegate"
446
				actionID="StructureSelectNext">
447
			</action>
448
			<action
449
				id="StructureSelectPrevious"
450
				label="%StructureSelectPrevious_label"
451
				definitionId="org.eclipse.wst.sse.ui.structure.select.previous"
452
				tooltip="%StructureSelectPrevious_tooltip"
453
				class="org.eclipse.wst.xml.ui.internal.selection.StructuredSelectPreviousXMLActionDelegate"
454
				actionID="StructureSelectPrevious">
455
			</action>
456
			<action
457
				id="StructureSelectHistory"
458
				label="%StructureSelectHistory_label"
459
				definitionId="org.eclipse.wst.sse.ui.structure.select.last"
460
				tooltip="%StructureSelectHistory_tooltip"
461
				class="org.eclipse.wst.sse.ui.internal.selection.StructuredSelectHistoryActionDelegate"
462
				actionID="StructureSelectHistory">
463
			</action>
464
		</editorContribution>
465
	</extension>
388
</plugin>
466
</plugin>
(-)src/org/eclipse/wst/html/ui/internal/HTMLUIPluginResources.properties (-5 / +5 lines)
Lines 30-48 Link Here
30
Creating_files_encoding=Creating files encoding preference
30
Creating_files_encoding=Creating files encoding preference
31
MESSAGE_HTML_VALIDATION_MESSAGE_UI_=HTML Syntax : {0}
31
MESSAGE_HTML_VALIDATION_MESSAGE_UI_=HTML Syntax : {0}
32
# Copied from sse.ui
32
# Copied from sse.ui
33
CleanupDocument_label=C&leanup Document...
33
CleanupDocument_label=Cleanup Document...
34
CleanupDocument_tooltip=Cleanup Document
34
CleanupDocument_tooltip=Cleanup Document
35
CleanupDocument_description=Cleanup Document
35
CleanupDocument_description=Cleanup Document
36
ToggleComment_label=Togg&le Comment
36
ToggleComment_label=Toggle Comment
37
ToggleComment_tooltip=Toggle Comment
37
ToggleComment_tooltip=Toggle Comment
38
ToggleComment_description=Toggle Comment
38
ToggleComment_description=Toggle Comment
39
AddBlockComment_label=Add &Block Comment
39
AddBlockComment_label=Add Block Comment
40
AddBlockComment_tooltip=Add Block Comment
40
AddBlockComment_tooltip=Add Block Comment
41
AddBlockComment_description=Add Block Comment
41
AddBlockComment_description=Add Block Comment
42
RemoveBlockComment_label=Remove Bloc&k Comment
42
RemoveBlockComment_label=Remove Block Comment
43
RemoveBlockComment_tooltip=Remove Block Comment
43
RemoveBlockComment_tooltip=Remove Block Comment
44
RemoveBlockComment_description=Remove Block Comment
44
RemoveBlockComment_description=Remove Block Comment
45
FindOccurrences_label=O&ccurrences in File
45
FindOccurrences_label=Occurrences in File
46
Creating_files=Creating files
46
Creating_files=Creating files
47
Encoding_desc=The following encoding will apply:
47
Encoding_desc=The following encoding will apply:
48
Preferred_markup_case_UI_=Preferred markup case for content assist, and code generation
48
Preferred_markup_case_UI_=Preferred markup case for content assist, and code generation
(-)src/org/eclipse/wst/html/ui/internal/edit/ui/CleanupActionHTML.java (+3 lines)
Lines 24-29 Link Here
24
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
24
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
25
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
25
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
26
26
27
/**
28
 * @deprecated Use CleanupActionHTMLDelegate instead.
29
 */
27
public class CleanupActionHTML extends CleanupAction {
30
public class CleanupActionHTML extends CleanupAction {
28
	protected IStructuredCleanupProcessor fCleanupProcessor;
31
	protected IStructuredCleanupProcessor fCleanupProcessor;
29
32
(-)src/org/eclipse/wst/html/ui/internal/provisional/StructuredTextEditorHTML.java (+4 lines)
Lines 25-30 Link Here
25
import org.eclipse.wst.xml.ui.internal.actions.RemoveBlockCommentActionXML;
25
import org.eclipse.wst.xml.ui.internal.actions.RemoveBlockCommentActionXML;
26
import org.eclipse.wst.xml.ui.internal.actions.ToggleCommentActionXML;
26
import org.eclipse.wst.xml.ui.internal.actions.ToggleCommentActionXML;
27
27
28
/**
29
 * @deprecated HTML editor is created from StructuredTextEditor with
30
 *             HTML configurations
31
 */
28
public class StructuredTextEditorHTML extends StructuredTextEditor {
32
public class StructuredTextEditorHTML extends StructuredTextEditor {
29
	private final static String UNDERSCORE = "_"; //$NON-NLS-1$
33
	private final static String UNDERSCORE = "_"; //$NON-NLS-1$
30
	
34
	
(-)src/org/eclipse/wst/html/ui/internal/search/HTMLFindOccurrencesAction.java (-1 / +1 lines)
Lines 22-28 Link Here
22
/**
22
/**
23
 * Configures a BasicFindOccurrencesAction with HTML partitions and regions
23
 * Configures a BasicFindOccurrencesAction with HTML partitions and regions
24
 * 
24
 * 
25
 * @author pavery
25
 * @deprecated use HTMLFindOccurrencesProcessor instead
26
 */
26
 */
27
public class HTMLFindOccurrencesAction extends BasicFindOccurrencesAction {
27
public class HTMLFindOccurrencesAction extends BasicFindOccurrencesAction {
28
28
(-)src/org/eclipse/wst/html/ui/internal/edit/ui/CleanupActionHTMLDelegate.java (+163 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2005 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 * 
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *     
11
 *******************************************************************************/
12
13
package org.eclipse.wst.html.ui.internal.edit.ui;
14
15
import org.eclipse.jface.action.IAction;
16
import org.eclipse.jface.text.IDocument;
17
import org.eclipse.jface.text.ITextSelection;
18
import org.eclipse.jface.viewers.ISelection;
19
import org.eclipse.jface.window.Window;
20
import org.eclipse.swt.custom.BusyIndicator;
21
import org.eclipse.swt.widgets.Event;
22
import org.eclipse.ui.IActionDelegate2;
23
import org.eclipse.ui.IEditorActionDelegate;
24
import org.eclipse.ui.IEditorPart;
25
import org.eclipse.ui.IViewActionDelegate;
26
import org.eclipse.ui.IViewPart;
27
import org.eclipse.ui.texteditor.ITextEditor;
28
import org.eclipse.wst.html.core.internal.cleanup.HTMLCleanupProcessorImpl;
29
import org.eclipse.wst.html.ui.internal.HTMLUIMessages;
30
import org.eclipse.wst.sse.core.internal.cleanup.IStructuredCleanupProcessor;
31
import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
32
import org.eclipse.wst.sse.core.internal.provisional.StructuredModelManager;
33
import org.eclipse.wst.sse.ui.internal.SSEUIMessages;
34
import org.eclipse.wst.sse.ui.internal.StructuredTextEditor;
35
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
36
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
37
38
/**
39
 * Cleanup action delegate for HTML editor
40
 */
41
public class CleanupActionHTMLDelegate implements IEditorActionDelegate, IActionDelegate2, IViewActionDelegate {
42
	private IEditorPart fEditor;
43
	private IStructuredCleanupProcessor fCleanupProcessor;
44
45
	public void setActiveEditor(IAction action, IEditorPart targetEditor) {
46
		fEditor = targetEditor;
47
	}
48
49
	public void dispose() {
50
		// nulling out just in case
51
		fEditor = null;
52
		fCleanupProcessor = null;
53
	}
54
55
	public void init(IAction action) {
56
		if (action != null) {
57
			action.setText(HTMLUIMessages.CleanupDocument_label);
58
			action.setToolTipText(HTMLUIMessages.CleanupDocument_tooltip);
59
			action.setDescription(HTMLUIMessages.CleanupDocument_description);
60
		}
61
	}
62
63
	public void runWithEvent(IAction action, Event event) {
64
		run(action);
65
	}
66
67
	public void init(IViewPart view) {
68
		// do nothing
69
	}
70
71
	public void run(IAction action) {
72
		if (fEditor instanceof StructuredTextEditor) {
73
			final StructuredTextEditor editor = (StructuredTextEditor) fEditor;
74
			CleanupDialogHTML cleanupDialog = new CleanupDialogHTML(editor.getSite().getShell());
75
			cleanupDialog.setisXHTMLType(isXHTML());
76
			if (cleanupDialog.open() == Window.OK) {
77
				// setup runnable
78
				Runnable runnable = new Runnable() {
79
					public void run() {
80
						IStructuredCleanupProcessor cleanupProcessor = getCleanupProcessor();
81
						if (cleanupProcessor != null) {
82
							IStructuredModel model = null;
83
							try {
84
								model = StructuredModelManager.getModelManager().getExistingModelForEdit(editor.getDocumentProvider().getDocument(editor.getEditorInput()));
85
								if (model != null)
86
									cleanupProcessor.cleanupModel(model);
87
							}
88
							finally {
89
								if (model != null)
90
									model.releaseFromEdit();
91
							}
92
						}
93
					}
94
				};
95
96
				// TODO: make independent of 'model'.
97
				IStructuredModel model = null;
98
				try {
99
					model = StructuredModelManager.getModelManager().getExistingModelForEdit(editor.getDocumentProvider().getDocument(editor.getEditorInput()));
100
					if (model != null) {
101
						// begin recording
102
						ITextSelection selection = (ITextSelection) editor.getSelectionProvider().getSelection();
103
						model.beginRecording(this, SSEUIMessages.Cleanup_Document_UI_, SSEUIMessages.Cleanup_Document_UI_, selection.getOffset(), selection.getLength()); //$NON-NLS-1$ //$NON-NLS-2$
104
105
						// tell the model that we are about to make a big
106
						// model change
107
						model.aboutToChangeModel();
108
109
						// run
110
						BusyIndicator.showWhile(editor.getTextViewer().getControl().getDisplay(), runnable);
111
					}
112
				}
113
				finally {
114
					if (model != null) {
115
						// tell the model that we are done with the big
116
						// model
117
						// change
118
						model.changedModel();
119
120
						// end recording
121
						ITextSelection selection = (ITextSelection) editor.getSelectionProvider().getSelection();
122
						model.endRecording(this, selection.getOffset(), selection.getLength());
123
						model.releaseFromEdit();
124
					}
125
				}
126
			}
127
		}
128
	}
129
130
	public void selectionChanged(IAction action, ISelection selection) {
131
		// do nothing
132
	}
133
134
	IStructuredCleanupProcessor getCleanupProcessor() {
135
		if (fCleanupProcessor == null)
136
			fCleanupProcessor = new HTMLCleanupProcessorImpl();
137
138
		return fCleanupProcessor;
139
	}
140
141
	private boolean isXHTML() {
142
		boolean isxhtml = false;
143
		if (fEditor instanceof ITextEditor) {
144
			ITextEditor textEditor = (ITextEditor) fEditor;
145
			IDocument document = textEditor.getDocumentProvider().getDocument(textEditor.getEditorInput());
146
			IStructuredModel model = null;
147
			try {
148
				model = StructuredModelManager.getModelManager().getExistingModelForRead(document);
149
				if (model instanceof IDOMModel) {
150
					IDOMDocument domDocument = ((IDOMModel) model).getDocument();
151
					if (domDocument != null)
152
						isxhtml = domDocument.isXMLType();
153
				}
154
			}
155
			finally {
156
				if (model != null) {
157
					model.releaseFromRead();
158
				}
159
			}
160
		}
161
		return isxhtml;
162
	}
163
}
(-)src/org/eclipse/wst/html/ui/internal/search/HTMLFindOccurrencesActionDelegate.java (+34 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2005 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 * 
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *     
11
 *******************************************************************************/
12
13
package org.eclipse.wst.html.ui.internal.search;
14
15
import java.util.ArrayList;
16
import java.util.List;
17
18
import org.eclipse.wst.sse.ui.internal.search.FindOccurrencesActionDelegate;
19
20
/**
21
 * Sets up FindOccurrencesActionDelegate for html find occurrences processors
22
 */
23
public class HTMLFindOccurrencesActionDelegate extends FindOccurrencesActionDelegate {
24
	private List fProcessors;
25
26
	protected List getProcessors() {
27
		if (fProcessors == null) {
28
			fProcessors = new ArrayList();
29
			HTMLFindOccurrencesProcessor htmlProcessor = new HTMLFindOccurrencesProcessor();
30
			fProcessors.add(htmlProcessor);
31
		}
32
		return fProcessors;
33
	}
34
}
(-)src/org/eclipse/wst/html/ui/internal/search/HTMLFindOccurrencesProcessor.java (+32 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2005 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 * 
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *     
11
 *******************************************************************************/
12
13
package org.eclipse.wst.html.ui.internal.search;
14
15
import org.eclipse.wst.html.core.internal.provisional.text.IHTMLPartitionTypes;
16
import org.eclipse.wst.sse.ui.internal.search.FindOccurrencesProcessor;
17
import org.eclipse.wst.xml.core.internal.provisional.text.IXMLPartitions;
18
import org.eclipse.wst.xml.core.internal.regions.DOMRegionContext;
19
20
/**
21
 * Configures a FindOccurrencesProcessor with HTML partitions and regions
22
 */
23
public class HTMLFindOccurrencesProcessor extends FindOccurrencesProcessor {
24
25
	protected String[] getPartitionTypes() {
26
		return new String[]{IHTMLPartitionTypes.HTML_DEFAULT, IXMLPartitions.XML_DEFAULT};
27
	}
28
29
	protected String[] getRegionTypes() {
30
		return new String[]{DOMRegionContext.XML_TAG_NAME, DOMRegionContext.XML_TAG_ATTRIBUTE_NAME, DOMRegionContext.XML_TAG_ATTRIBUTE_VALUE};
31
	}
32
}

Return to bug 109468