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 106620 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/wst/sse/ui/internal/PreferenceInitializer.java (+3 lines)
Lines 61-66 Link Here
61
		
61
		
62
		// set default enable folding value
62
		// set default enable folding value
63
		store.setDefault(IStructuredTextFoldingProvider.FOLDING_ENABLED, false);
63
		store.setDefault(IStructuredTextFoldingProvider.FOLDING_ENABLED, false);
64
		
65
		// set default for show message dialog when unknown content type in editor
66
		store.setDefault(EditorPreferenceNames.SHOW_UNKNOWN_CONTENT_TYPE_MSG, true);
64
	}
67
	}
65
68
66
	private void setMatchingBracketsPreferences(IPreferenceStore store) {
69
	private void setMatchingBracketsPreferences(IPreferenceStore store) {
(-)src/org/eclipse/wst/sse/ui/internal/SSEUIMessages.java (+5 lines)
Lines 396-401 Link Here
396
	public static String Editor_ManageTasks_add_dialog_message;
396
	public static String Editor_ManageTasks_add_dialog_message;
397
	public static String Editor_ManageTasks_error_dialog_title;
397
	public static String Editor_ManageTasks_error_dialog_title;
398
	public static String Editor_ManageTasks_error_dialog_message;
398
	public static String Editor_ManageTasks_error_dialog_message;
399
	public static String StructuredTextEditorPreferencePage_39;
400
	public static String StructuredTextEditor_0;
401
	public static String UnknownContentTypeDialog_0;
402
	public static String UnknownContentTypeDialog_1;
403
	public static String UnknownContentTypeDialog_2;
399
404
400
	/*
405
	/*
401
	 * *****Above are possibly unused strings that may be removed*****
406
	 * *****Above are possibly unused strings that may be removed*****
(-)src/org/eclipse/wst/sse/ui/internal/SSEUIPluginResources.properties (-1 / +7 lines)
Lines 179-184 Link Here
179
StructuredTextEditorPreferencePage_30=&Report problems as you type
179
StructuredTextEditorPreferencePage_30=&Report problems as you type
180
StructuredTextEditorPreferencePage_37=Empty input
180
StructuredTextEditorPreferencePage_37=Empty input
181
StructuredTextEditorPreferencePage_38=is not a valid input.
181
StructuredTextEditorPreferencePage_38=is not a valid input.
182
StructuredTextEditorPreferencePage_39=Inform when unsupported content type is in editor
182
TaskTagPreferenceTab_0=Low
183
TaskTagPreferenceTab_0=Low
183
TaskTagPreferenceTab_1=Normal
184
TaskTagPreferenceTab_1=Normal
184
TaskTagPreferenceTab_2=High
185
TaskTagPreferenceTab_2=High
Lines 274-279 Link Here
274
OffsetStatusLineContributionItem_17=Text Length
275
OffsetStatusLineContributionItem_17=Text Length
275
OffsetStatusLineContributionItem_18=Context
276
OffsetStatusLineContributionItem_18=Context
276
277
278
StructuredTextEditor_0=Unsupported content type warning
279
UnknownContentTypeDialog_0=Unsupported Content Type
280
UnknownContentTypeDialog_1=Do not show this message again
281
UnknownContentTypeDialog_2=Unsupported content type in editor.\nTo associate file extension with a supported content type,\nplease see <a>Content Types Preference Page</a>
282
277
################################################################################
283
################################################################################
278
## Below are possibly unused strings that may be removed
284
## Below are possibly unused strings that may be removed
279
################################################################################
285
################################################################################
Lines 375-378 Link Here
375
Editor_ManageTasks_error_dialog_message=Problems managing tasks
381
Editor_ManageTasks_error_dialog_message=Problems managing tasks
376
################################################################################
382
################################################################################
377
## Above are possibly unused strings that may be removed
383
## Above are possibly unused strings that may be removed
378
################################################################################
384
###############################################################################
(-)src/org/eclipse/wst/sse/ui/internal/StructuredTextEditor.java (-5 / +21 lines)
Lines 33-38 Link Here
33
import org.eclipse.core.runtime.Path;
33
import org.eclipse.core.runtime.Path;
34
import org.eclipse.core.runtime.Platform;
34
import org.eclipse.core.runtime.Platform;
35
import org.eclipse.core.runtime.Status;
35
import org.eclipse.core.runtime.Status;
36
import org.eclipse.core.runtime.jobs.Job;
36
import org.eclipse.debug.ui.actions.IToggleBreakpointsTarget;
37
import org.eclipse.debug.ui.actions.IToggleBreakpointsTarget;
37
import org.eclipse.emf.common.command.Command;
38
import org.eclipse.emf.common.command.Command;
38
import org.eclipse.jface.action.Action;
39
import org.eclipse.jface.action.Action;
Lines 98-103 Link Here
98
import org.eclipse.ui.part.EditorActionBarContributor;
99
import org.eclipse.ui.part.EditorActionBarContributor;
99
import org.eclipse.ui.part.IShowInTargetList;
100
import org.eclipse.ui.part.IShowInTargetList;
100
import org.eclipse.ui.progress.IWorkbenchSiteProgressService;
101
import org.eclipse.ui.progress.IWorkbenchSiteProgressService;
102
import org.eclipse.ui.progress.UIJob;
101
import org.eclipse.ui.texteditor.ChainedPreferenceStore;
103
import org.eclipse.ui.texteditor.ChainedPreferenceStore;
102
import org.eclipse.ui.texteditor.DefaultRangeIndicator;
104
import org.eclipse.ui.texteditor.DefaultRangeIndicator;
103
import org.eclipse.ui.texteditor.IAbstractTextEditorHelpContextIds;
105
import org.eclipse.ui.texteditor.IAbstractTextEditorHelpContextIds;
Lines 1142-1148 Link Here
1142
		if (doc instanceof IStructuredDocument) {
1144
		if (doc instanceof IStructuredDocument) {
1143
			((IStructuredDocument) doc).getUndoManager().getCommandStack().flush();
1145
			((IStructuredDocument) doc).getUndoManager().getCommandStack().flush();
1144
		}
1146
		}
1145
		
1147
1146
		// update menu text
1148
		// update menu text
1147
		updateMenuText();
1149
		updateMenuText();
1148
	}
1150
	}
Lines 1534-1542 Link Here
1534
		}
1536
		}
1535
		return fStructuredModel;
1537
		return fStructuredModel;
1536
	}
1538
	}
1537
	
1539
1538
	public int getOrientation() {
1540
	public int getOrientation() {
1539
		//https://bugs.eclipse.org/bugs/show_bug.cgi?id=88714
1541
		// https://bugs.eclipse.org/bugs/show_bug.cgi?id=88714
1540
		return SWT.LEFT_TO_RIGHT;
1542
		return SWT.LEFT_TO_RIGHT;
1541
	}
1543
	}
1542
1544
Lines 1808-1817 Link Here
1808
	public boolean isSaveOnCloseNeeded() {
1810
	public boolean isSaveOnCloseNeeded() {
1809
		if (getInternalModel() == null)
1811
		if (getInternalModel() == null)
1810
			return false;
1812
			return false;
1811
		return getInternalModel().isSaveNeeded();
1813
		// BUG99793 - always prompt for save if dirty (even if others have
1814
		// model for edit)
1815
		return getInternalModel().isDirty();
1812
	}
1816
	}
1813
1817
1814
	private void logUnexpectedDocumentKind(IEditorInput input) {
1818
	private void logUnexpectedDocumentKind(IEditorInput input) {
1819
		// display a dialog informing user of uknown content type
1820
		if (SSEUIPlugin.getDefault().getPreferenceStore().getBoolean(EditorPreferenceNames.SHOW_UNKNOWN_CONTENT_TYPE_MSG)) {
1821
			Job job = new UIJob(SSEUIMessages.StructuredTextEditor_0) {
1822
				public IStatus runInUIThread(IProgressMonitor monitor) {
1823
					UnknownContentTypeDialog dialog = new UnknownContentTypeDialog(getSite().getShell(), SSEUIPlugin.getDefault().getPreferenceStore(), EditorPreferenceNames.SHOW_UNKNOWN_CONTENT_TYPE_MSG);
1824
					dialog.open();
1825
					return Status.OK_STATUS;
1826
				}
1827
			};
1828
			job.schedule();
1829
		}
1830
1815
		Logger.log(Logger.WARNING, "StructuredTextEditor being used without StructuredDocument"); //$NON-NLS-1$
1831
		Logger.log(Logger.WARNING, "StructuredTextEditor being used without StructuredDocument"); //$NON-NLS-1$
1816
		String name = null;
1832
		String name = null;
1817
		if (input != null) {
1833
		if (input != null) {
Lines 1999-2005 Link Here
1999
	 * @deprecated - can eventually be eliminated
2015
	 * @deprecated - can eventually be eliminated
2000
	 */
2016
	 */
2001
	private void setModel(IStructuredModel newModel) {
2017
	private void setModel(IStructuredModel newModel) {
2002
		Assert.isNotNull(getDocumentProvider(), "document provider can not be null when setting model");
2018
		Assert.isNotNull(getDocumentProvider(), "document provider can not be null when setting model"); //$NON-NLS-1$
2003
		if (fStructuredModel != null) {
2019
		if (fStructuredModel != null) {
2004
			if (fStructuredModel.getStructuredDocument() != null) {
2020
			if (fStructuredModel.getStructuredDocument() != null) {
2005
				fStructuredModel.getStructuredDocument().removeDocumentListener(getInternalDocumentListener());
2021
				fStructuredModel.getStructuredDocument().removeDocumentListener(getInternalDocumentListener());
(-)src/org/eclipse/wst/sse/ui/internal/preferences/EditorPreferenceNames.java (-5 / +11 lines)
Lines 22-32 Link Here
22
	 * </p>
22
	 * </p>
23
	 */
23
	 */
24
	public static final String EVALUATE_TEMPORARY_PROBLEMS = getEvaluateTemporaryProblemsKey();
24
	public static final String EVALUATE_TEMPORARY_PROBLEMS = getEvaluateTemporaryProblemsKey();
25
	
25
26
	private static String getEvaluateTemporaryProblemsKey() {
26
	private static String getEvaluateTemporaryProblemsKey() {
27
		return "evaluateTemporaryProblems"; //$NON-NLS-1$
27
		return "evaluateTemporaryProblems"; //$NON-NLS-1$
28
	}
28
	}
29
	
29
30
	/**
30
	/**
31
	 * A named preference that controls whether bracket matching highlighting
31
	 * A named preference that controls whether bracket matching highlighting
32
	 * is turned on or off.
32
	 * is turned on or off.
Lines 65-80 Link Here
65
	private static String getTextHoverModifiersKey() {
65
	private static String getTextHoverModifiersKey() {
66
		return "hoverModifiers"; //$NON-NLS-1$
66
		return "hoverModifiers"; //$NON-NLS-1$
67
	}
67
	}
68
	
68
69
	/**
69
	/**
70
	 * A named preference that defines read only contrast scale.
70
	 * A named preference that defines read only contrast scale.
71
	 * <p>
71
	 * <p>
72
	 * Value is of type <code>Integer</code>.
72
	 * Value is of type <code>Integer</code>.
73
	 * </p> 
73
	 * </p>
74
	 */
74
	 */
75
	public static final String READ_ONLY_FOREGROUND_SCALE = getReadOnlyForegroundScaleKey();
75
	public static final String READ_ONLY_FOREGROUND_SCALE = getReadOnlyForegroundScaleKey();
76
	
76
77
	private static String getReadOnlyForegroundScaleKey() {
77
	private static String getReadOnlyForegroundScaleKey() {
78
		return "readOnlyForegroundScale"; //$NON-NLS-1$
78
		return "readOnlyForegroundScale"; //$NON-NLS-1$
79
	}
79
	}
80
81
	/**
82
	 * A named preference that defines whether or not to show a message dialog
83
	 * informing user of unknown content type in editor.
84
	 */
85
	public static final String SHOW_UNKNOWN_CONTENT_TYPE_MSG = "showUnknownContentTypeMsg"; //$NON-NLS-1$
80
}
86
}
(-)src/org/eclipse/wst/sse/ui/internal/preferences/ui/StructuredTextEditorPreferencePage.java (-1 / +5 lines)
Lines 151-156 Link Here
151
151
152
		label = SSEUIMessages.StructuredTextEditorPreferencePage_30; //$NON-NLS-1$
152
		label = SSEUIMessages.StructuredTextEditorPreferencePage_30; //$NON-NLS-1$
153
		addCheckBox(appearanceComposite, label, CommonEditorPreferenceNames.EVALUATE_TEMPORARY_PROBLEMS, 0);
153
		addCheckBox(appearanceComposite, label, CommonEditorPreferenceNames.EVALUATE_TEMPORARY_PROBLEMS, 0);
154
		
155
		label = SSEUIMessages.StructuredTextEditorPreferencePage_39;
156
		addCheckBox(appearanceComposite, label, EditorPreferenceNames.SHOW_UNKNOWN_CONTENT_TYPE_MSG, 0);
154
157
155
		if (showFoldingPreference) {
158
		if (showFoldingPreference) {
156
			label = "Enable folding (work in progress)"; 		//$NON-NLS-1$
159
			label = "Enable folding (work in progress)"; 		//$NON-NLS-1$
Lines 288-294 Link Here
288
		overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, EditorPreferenceNames.MATCHING_BRACKETS));
291
		overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, EditorPreferenceNames.MATCHING_BRACKETS));
289
		
292
		
290
		overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, CommonEditorPreferenceNames.EVALUATE_TEMPORARY_PROBLEMS));
293
		overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, CommonEditorPreferenceNames.EVALUATE_TEMPORARY_PROBLEMS));
291
294
		overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, EditorPreferenceNames.SHOW_UNKNOWN_CONTENT_TYPE_MSG));
295
		
292
		if (showFoldingPreference)
296
		if (showFoldingPreference)
293
			overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, IStructuredTextFoldingProvider.FOLDING_ENABLED));
297
			overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, IStructuredTextFoldingProvider.FOLDING_ENABLED));
294
		
298
		
(-)src/org/eclipse/wst/sse/ui/internal/UnknownContentTypeDialog.java (+67 lines)
Added Link Here
1
package org.eclipse.wst.sse.ui.internal;
2
3
import org.eclipse.jface.dialogs.IDialogConstants;
4
import org.eclipse.jface.dialogs.MessageDialogWithToggle;
5
import org.eclipse.jface.preference.IPreferenceStore;
6
import org.eclipse.jface.preference.PreferenceDialog;
7
import org.eclipse.swt.SWT;
8
import org.eclipse.swt.events.SelectionAdapter;
9
import org.eclipse.swt.events.SelectionEvent;
10
import org.eclipse.swt.widgets.Composite;
11
import org.eclipse.swt.widgets.Control;
12
import org.eclipse.swt.widgets.Link;
13
import org.eclipse.swt.widgets.Shell;
14
import org.eclipse.ui.dialogs.PreferencesUtil;
15
16
/**
17
 * Message dialog informing user that an editor was open on unsupported
18
 * content type
19
 */
20
class UnknownContentTypeDialog extends MessageDialogWithToggle {
21
22
	public UnknownContentTypeDialog(Shell parent, IPreferenceStore store, String key) {
23
		// set message to null in super so that message does not appear twice
24
		super(parent, SSEUIMessages.UnknownContentTypeDialog_0, null, null, INFORMATION, new String[]{IDialogConstants.OK_LABEL}, 0, SSEUIMessages.UnknownContentTypeDialog_1, false);
25
		setPrefStore(store);
26
		setPrefKey(key);
27
	}
28
29
	protected void buttonPressed(int buttonId) {
30
		super.buttonPressed(buttonId);
31
32
		// overwritten so that value stored is boolean, not string
33
		if (buttonId != IDialogConstants.CANCEL_ID && getToggleState() && getPrefStore() != null && getPrefKey() != null) {
34
			switch (buttonId) {
35
				case IDialogConstants.YES_ID :
36
				case IDialogConstants.YES_TO_ALL_ID :
37
				case IDialogConstants.PROCEED_ID :
38
				case IDialogConstants.OK_ID :
39
					getPrefStore().setValue(getPrefKey(), false);
40
					break;
41
				case IDialogConstants.NO_ID :
42
				case IDialogConstants.NO_TO_ALL_ID :
43
					getPrefStore().setValue(getPrefKey(), true);
44
					break;
45
			}
46
		}
47
48
	}
49
50
	protected Control createMessageArea(Composite composite) {
51
		super.createMessageArea(composite);
52
		Link messageLink = new Link(composite, SWT.NONE);
53
		messageLink.setText(SSEUIMessages.UnknownContentTypeDialog_2);
54
		messageLink.addSelectionListener(new SelectionAdapter() {
55
			public void widgetSelected(SelectionEvent e) {
56
				linkClicked();
57
			}
58
		});
59
		return composite;
60
	}
61
62
	private void linkClicked() {
63
		String pageId = "org.eclipse.ui.preferencePages.ContentTypes"; //$NON-NLS-1$
64
		PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(getShell(), pageId, new String[]{pageId}, null);
65
		dialog.open();
66
	}
67
}

Return to bug 106620