[333359] Make showing the Properties view when opening the editor optional
diff --git a/bundles/org.eclipse.wst.dtd.ui/plugin.properties b/bundles/org.eclipse.wst.dtd.ui/plugin.properties
index 3bcb460..b06dedc 100644
--- a/bundles/org.eclipse.wst.dtd.ui/plugin.properties
+++ b/bundles/org.eclipse.wst.dtd.ui/plugin.properties
@@ -60,4 +60,4 @@
 Colors.dtdString=DTD String
 Colors.dtdData=DTD Data
 Colors.dtdSymbol=DTD Symbol
-			
+Editor.name=Editor
diff --git a/bundles/org.eclipse.wst.dtd.ui/plugin.xml b/bundles/org.eclipse.wst.dtd.ui/plugin.xml
index 58eed3d..59fecff 100644
--- a/bundles/org.eclipse.wst.dtd.ui/plugin.xml
+++ b/bundles/org.eclipse.wst.dtd.ui/plugin.xml
@@ -151,6 +151,12 @@
 			id="org.eclipse.wst.sse.ui.preferences.dtd.styles">
          	<keywordReference id="org.eclipse.wst.dtd.ui.styles"/>
 		</page>
+		<page
+			name="%Editor.name"
+			category="org.eclipse.wst.dtd.ui.preferences.dtd"
+			class="org.eclipse.wst.dtd.ui.internal.preferences.DTDEditorPreferencePage"
+			id="org.eclipse.wst.dtd.ui.preferences.editor">
+		</page>
 	</extension>
 	
 	<!-- Keywords for preference and properties pages -->
diff --git a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/DTDEditor.java b/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/DTDEditor.java
index 9dad7fb..41a7707 100644
--- a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/DTDEditor.java
+++ b/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/DTDEditor.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
+ * Copyright (c) 2006, 2010 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -24,6 +24,7 @@
 import org.eclipse.ui.views.properties.IPropertySheetPage;
 import org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor;
 import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
+import org.eclipse.wst.dtd.ui.internal.preferences.DTDUIPreferenceNames;
 import org.eclipse.wst.sse.ui.StructuredTextEditor;
 
 /**
@@ -88,15 +89,17 @@
 	public void init(IEditorSite site, IEditorInput editorInput) throws PartInitException {
 		super.init(site, editorInput);
 
-		IWorkbenchWindow dw = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
-		IWorkbenchPage page = dw.getActivePage();
-		try {
-			if (page != null) {
-				page.showView(IPageLayout.ID_PROP_SHEET);
+		if (DTDUIPlugin.getDefault().getPreferenceStore().getBoolean(DTDUIPreferenceNames.ACTIVATE_PROPERTIES)) {
+			IWorkbenchWindow dw = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+			IWorkbenchPage page = dw.getActivePage();
+			try {
+				if (page != null) {
+					page.showView(IPageLayout.ID_PROP_SHEET);
+				}
 			}
-		}
-		catch (PartInitException e) {
-			Logger.logException(e);
+			catch (PartInitException e) {
+				Logger.logException(e);
+			}
 		}
 	}
 }
\ No newline at end of file
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/DTDUIMessages.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/DTDUIMessages.java
index 710f2c7..c074210 100644
--- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/DTDUIMessages.java
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/DTDUIMessages.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2005, 2009 IBM Corporation and others.
+ * Copyright (c) 2005, 2010 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -73,6 +73,7 @@
 	public static String SyntaxColoringPage_5;
 	public static String SyntaxColoringPage_6;
 	public static String _UI_STRUCTURED_TEXT_EDITOR_PREFS_LINK;
+	public static String ShowProperties;
 
 	static {
 		// load message values from bundle file
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/DTDUIPluginResources.properties b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/DTDUIPluginResources.properties
index 6fff1f8..44a4572 100644
--- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/DTDUIPluginResources.properties
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/DTDUIPluginResources.properties
@@ -86,5 +86,6 @@
 SyntaxColoringPage_5=&Strikethrough
 SyntaxColoringPage_6=&Underline
 
-_UI_STRUCTURED_TEXT_EDITOR_PREFS_LINK=DTD preferences.  Note that some preferences may be set on the <a>{0}</a> preference page.
+_UI_STRUCTURED_TEXT_EDITOR_PREFS_LINK=DTD editor preferences.  Note that some preferences may be set on the <a>{0}</a> preference page.
 
+ShowProperties=Automatically show the Properties view
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/preferences/DTDEditorPreferencePage.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/preferences/DTDEditorPreferencePage.java
new file mode 100644
index 0000000..ac3eb60
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/preferences/DTDEditorPreferencePage.java
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * Copyright (c) 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     
+ *******************************************************************************/
+package org.eclipse.wst.dtd.ui.internal.preferences;
+
+import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.jface.preference.BooleanFieldEditor;
+import org.eclipse.jface.preference.FieldEditorPreferencePage;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+import org.eclipse.ui.dialogs.PreferenceLinkArea;
+import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer;
+import org.eclipse.wst.dtd.ui.internal.DTDUIMessages;
+import org.eclipse.wst.dtd.ui.internal.DTDUIPlugin;
+
+public class DTDEditorPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {
+
+	public DTDEditorPreferencePage() {
+		super();
+	}
+
+
+	public DTDEditorPreferencePage(int style) {
+		super(style);
+	}
+
+
+	public DTDEditorPreferencePage(String title, ImageDescriptor image, int style) {
+		super(title, image, style);
+	}
+
+
+	public DTDEditorPreferencePage(String title, int style) {
+		super(title, style);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors
+	 * ()
+	 */
+	protected void createFieldEditors() {
+		addField(new BooleanFieldEditor(DTDUIPreferenceNames.ACTIVATE_PROPERTIES, DTDUIMessages.ShowProperties, getFieldEditorParent()));
+	}
+
+	protected Control createContents(Composite parent) {
+		setPreferenceStore(DTDUIPlugin.getDefault().getPreferenceStore());
+		new PreferenceLinkArea(parent, SWT.WRAP | SWT.MULTI, "org.eclipse.wst.sse.ui.preferences.editor", DTDUIMessages._UI_STRUCTURED_TEXT_EDITOR_PREFS_LINK, (IWorkbenchPreferenceContainer) getContainer(), null).getControl().setLayoutData(GridDataFactory.fillDefaults().hint(150, SWT.DEFAULT).grab(true, false).create());//$NON-NLS-1$
+		new Label(parent, SWT.NONE).setLayoutData(GridDataFactory.swtDefaults().create());
+		return super.createContents(parent);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
+	 */
+	public void init(IWorkbench workbench) {
+	}
+}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/preferences/DTDFilesPreferencePage.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/preferences/DTDFilesPreferencePage.java
index 7bff14c..8603cfb 100644
--- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/preferences/DTDFilesPreferencePage.java
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/preferences/DTDFilesPreferencePage.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2001, 2006 IBM Corporation and others.
+ * Copyright (c) 2001, 2010 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -20,18 +20,13 @@
 import org.eclipse.core.runtime.Platform;
 import org.eclipse.core.runtime.Preferences;
 import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jface.layout.GridDataFactory;
 import org.eclipse.jface.preference.IPreferenceStore;
 import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
 import org.eclipse.swt.widgets.Combo;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Control;
 import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
 import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.PreferenceLinkArea;
-import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer;
 import org.eclipse.wst.dtd.core.internal.DTDCorePlugin;
 import org.eclipse.wst.dtd.core.internal.preferences.DTDCorePreferenceNames;
 import org.eclipse.wst.dtd.core.internal.provisional.contenttype.ContentTypeIdForDTD;
@@ -49,11 +44,6 @@
 		Composite composite = super.createComposite(parent, 1);
 		PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, IHelpContextIds.DTD_PREFWEBX_FILES_HELPID);
 
-		new PreferenceLinkArea(composite, SWT.WRAP | SWT.MULTI, "org.eclipse.wst.sse.ui.preferences.editor", DTDUIMessages._UI_STRUCTURED_TEXT_EDITOR_PREFS_LINK,//$NON-NLS-1$
-					(IWorkbenchPreferenceContainer) getContainer(), null).getControl().setLayoutData(GridDataFactory.fillDefaults().hint(150, SWT.DEFAULT).create());
-		new Label(composite, SWT.NONE).setLayoutData(GridDataFactory.swtDefaults().create());
-
-
 		Group creatingGroup = createGroup(composite, 2);
 		creatingGroup.setText(DTDUIMessages.Creating_files);
 
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/preferences/DTDUIPreferenceInitializer.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/preferences/DTDUIPreferenceInitializer.java
index 3f6f2c6..c80d990 100644
--- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/preferences/DTDUIPreferenceInitializer.java
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/preferences/DTDUIPreferenceInitializer.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2005, 2009 IBM Corporation and others.
+ * Copyright (c) 2005, 2010 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -73,5 +73,7 @@
 		if (template != null)
 			templateName = template.getName();
 		store.setDefault(DTDUIPreferenceNames.NEW_FILE_TEMPLATE_NAME, templateName);
+		
+		store.setDefault(DTDUIPreferenceNames.ACTIVATE_PROPERTIES, true);
 	}
 }
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/preferences/DTDUIPreferenceNames.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/preferences/DTDUIPreferenceNames.java
index 73f2f71..64d5ec6 100644
--- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/preferences/DTDUIPreferenceNames.java
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/preferences/DTDUIPreferenceNames.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
+ * Copyright (c) 2005, 2010 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -34,4 +34,6 @@
 	 * </p>
 	 */
 	public static final String NEW_FILE_TEMPLATE_NAME = "newFileTemplateName"; //$NON-NLS-1$
+
+	public static final String ACTIVATE_PROPERTIES = "activateProperties"; //$NON-NLS-1$
 }