diff options
Diffstat (limited to 'bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/contentproperties')
10 files changed, 0 insertions, 1309 deletions
diff --git a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/contentproperties/ui/AbstractDeviceProfileEntry.java b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/contentproperties/ui/AbstractDeviceProfileEntry.java deleted file mode 100644 index b5d028d59e..0000000000 --- a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/contentproperties/ui/AbstractDeviceProfileEntry.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.html.ui.internal.contentproperties.ui; - -/** - * @deprecated Not needed. See BUG118359 - */ -public class AbstractDeviceProfileEntry implements DeviceProfileEntry { - - public AbstractDeviceProfileEntry() { - super(); - } - - public String getEntryId() { - return null; - } - - public String getEntryName() { - return null; - } - - public void release() { - } - -} diff --git a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/contentproperties/ui/AbstractDeviceProfileEntryProvider.java b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/contentproperties/ui/AbstractDeviceProfileEntryProvider.java deleted file mode 100644 index 44f0bc560b..0000000000 --- a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/contentproperties/ui/AbstractDeviceProfileEntryProvider.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.html.ui.internal.contentproperties.ui; - -import java.util.Iterator; - -/** - * @deprecated Not needed. See BUG118359 - */ -public class AbstractDeviceProfileEntryProvider implements - DeviceProfileEntryProvider { - - public AbstractDeviceProfileEntryProvider() { - super(); - } - - public Iterator getDeviceProfileEntries() { - return null; - } - - public void release() { - } - -} diff --git a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/contentproperties/ui/ContentSettingsRegistry.java b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/contentproperties/ui/ContentSettingsRegistry.java deleted file mode 100644 index 375ad6b95e..0000000000 --- a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/contentproperties/ui/ContentSettingsRegistry.java +++ /dev/null @@ -1,173 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.html.ui.internal.contentproperties.ui; - -import java.util.Enumeration; -import java.util.Iterator; - -import org.eclipse.wst.css.core.internal.metamodel.CSSProfile; -import org.eclipse.wst.css.core.internal.metamodel.CSSProfileRegistry; -import org.eclipse.wst.html.core.internal.document.HTMLDocumentTypeEntry; -import org.eclipse.wst.html.core.internal.document.HTMLDocumentTypeRegistry; -import org.eclipse.wst.html.ui.internal.HTMLUIMessages; -import org.eclipse.wst.sse.core.internal.encoding.CommonCharsetNames; -import org.eclipse.wst.sse.ui.internal.contentproperties.ui.ComboList; - -/** - * @deprecated This class only contains helper methods that you should - * actually implement yourself. - */ -public final class ContentSettingsRegistry { - - private static final String NONE = HTMLUIMessages.UI_none; - - public static String maxLengthStringInHTMLDocumentTypeRegistry = ""; //$NON-NLS-1$ - public static String maxLengthStringInCharacterCodeRegistry = ""; //$NON-NLS-1$ - - private ContentSettingsRegistry() { - } - - public static void setHTMLDocumentTypeRegistryInto(ComboList combo) { - combo.add(NONE, ""); //$NON-NLS-1$ - HTMLDocumentTypeRegistry reg = HTMLDocumentTypeRegistry.getInstance(); - Enumeration e = reg.getEntries(); - while (e.hasMoreElements()) { - HTMLDocumentTypeEntry entry = (HTMLDocumentTypeEntry) e.nextElement(); - String publicId = entry.getPublicId(); - String displayName = entry.getDisplayName(); - if (displayName != null) { - combo.add(displayName, publicId); - if (displayName.length() > maxLengthStringInHTMLDocumentTypeRegistry.length()) - maxLengthStringInHTMLDocumentTypeRegistry = displayName; - } - else - combo.add(publicId, publicId); - if (publicId.length() > maxLengthStringInHTMLDocumentTypeRegistry.length()) - maxLengthStringInHTMLDocumentTypeRegistry = publicId; - if (entry.getSystemId() == null) - continue; // if HTML entry - if (entry.getSystemId().length() > maxLengthStringInHTMLDocumentTypeRegistry.length()) - maxLengthStringInHTMLDocumentTypeRegistry = entry.getSystemId(); - } - - combo.sortByKey(1); - } - - public static void setCSSMetaModelRegistryInto(ComboList combo) { - combo.add(NONE, ""); //$NON-NLS-1$ - CSSProfileRegistry reg = CSSProfileRegistry.getInstance(); - Iterator i = reg.getProfiles(); - while (i.hasNext()) { - CSSProfile profile = (CSSProfile) i.next(); - String id = profile.getProfileID(); - String name = profile.getProfileName(); - combo.add(name, id); - } - combo.sortByKey(1); - } - - public static void setDeviceProfileRegistryInto(ComboList combo) { - combo.add(NONE, ""); //$NON-NLS-1$ - DeviceProfileEntryProvider reg = DeviceProfileEntryProviderBuilder.getEntryProvider(); - if (reg == null) { - return; - } - Iterator profiles = reg.getDeviceProfileEntries(); - if (profiles == null) { - reg.release(); - return; - } - DeviceProfileEntry entry; - while (profiles.hasNext()) { - entry = (DeviceProfileEntry) profiles.next(); - combo.add(entry.getEntryName(), entry.getEntryId()); - entry.release(); - } - reg.release(); - combo.sortByKey(1); - } - - public static String getSystemIdFrom(String publicId) { - if (publicId == null || publicId.length() == 0) - return null; - HTMLDocumentTypeRegistry reg = HTMLDocumentTypeRegistry.getInstance(); - Enumeration e = reg.getEntries(); - while (e.hasMoreElements()) { - HTMLDocumentTypeEntry entry = (HTMLDocumentTypeEntry) e.nextElement(); - if (entry.getPublicId().equals(publicId)) - return entry.getSystemId(); - } - return null; - } - - public static void setContentTypeInto(ComboList combo) { - String[] type = {"", //$NON-NLS-1$ - "application/xhtml+xml", //$NON-NLS-1$ - "application/xml", //$NON-NLS-1$ - "text/html", //$NON-NLS-1$ - "text/xml",}; //$NON-NLS-1$ - String[] displayName = {NONE, "application/xhtml+xml", //$NON-NLS-1$ - //$NON-NLS-1$ - "application/xml", //$NON-NLS-1$ - "text/html", //$NON-NLS-1$ - "text/xml",}; //$NON-NLS-1$ - for (int i = 0; i < type.length; i++) { - if (displayName[i] != null && displayName[i].length() != 0) - combo.add(displayName[i], type[i]); - else - combo.add(type[i], type[i]); - } - - } - - public static void setCharacterCodeInto(ComboList combo) { - combo.add(NONE, ""); //$NON-NLS-1$ - String max = ""; //$NON-NLS-1$ - // CommonCharsetNames encoding = new CommonCharsetNames(); - String[] charCode = CommonCharsetNames.getCommonCharsetNames(); - for (int i = 0; i < charCode.length; i++) { - String displayName = CommonCharsetNames.getDisplayString(charCode[i]); - if (displayName != null && displayName.length() != 0) { - combo.add(displayName, charCode[i]); - int n_byte = displayName.getBytes().length; - if (max.getBytes().length < n_byte) - max = displayName; - } - else - combo.add(charCode[i], charCode[i]); - } - /* - * charCode = encoding.getSupportedJavaEncodings(); for(int i=0;i<charCode.length;i++){ - * String displayName = encoding.getDisplayString(charCode[i]); if - * (displayName!=null && displayName.length()!=0) - * combo.add(displayName,charCode[i]); else - * combo.add(charCode[i],charCode[i]); } - */ - // combo.sortByKey(1); - maxLengthStringInCharacterCodeRegistry = max; - } - - public static void setLanguageInto(ComboList combo) { - String[] lang = {"", //$NON-NLS-1$ - "java", //$NON-NLS-1$ - "javascript",}; //$NON-NLS-1$ - String[] displayName = {NONE, "java", //$NON-NLS-1$ - //$NON-NLS-1$ - "javascript",}; //$NON-NLS-1$ - for (int i = 0; i < lang.length; i++) { - if (displayName[i] != null && displayName[i].length() != 0) - combo.add(displayName[i], lang[i]); - else - combo.add(lang[i], lang[i]); - } - } - -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/contentproperties/ui/DeviceProfileEntry.java b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/contentproperties/ui/DeviceProfileEntry.java deleted file mode 100644 index 0be791b4e0..0000000000 --- a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/contentproperties/ui/DeviceProfileEntry.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.html.ui.internal.contentproperties.ui; - -/** - * <p> - * This interface is not intended to be implemented by clients directly. - * Instead, please use abstract class(AbstractDeviceProfileEntry) instead. - * </p> - * - * @deprecated Not needed. See BUG118359 - */ -public interface DeviceProfileEntry { - public String getEntryId(); - - public String getEntryName(); - - public void release(); -} diff --git a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/contentproperties/ui/DeviceProfileEntryProvider.java b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/contentproperties/ui/DeviceProfileEntryProvider.java deleted file mode 100644 index 8e7260b1cf..0000000000 --- a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/contentproperties/ui/DeviceProfileEntryProvider.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.html.ui.internal.contentproperties.ui; - -import java.util.Iterator; - -/** - * <p> - * This interface is not intended to be implemented by clients directly. - * Instead, please use abstract class(AbstractDeviceProfileEntryProvider) - * instead. - * </p> - * - * @deprecated Not needed. See BUG118359 - */ -public interface DeviceProfileEntryProvider { - public Iterator getDeviceProfileEntries(); - - public void release(); -} diff --git a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/contentproperties/ui/DeviceProfileEntryProviderBuilder.java b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/contentproperties/ui/DeviceProfileEntryProviderBuilder.java deleted file mode 100644 index 6e5ad050f2..0000000000 --- a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/contentproperties/ui/DeviceProfileEntryProviderBuilder.java +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.html.ui.internal.contentproperties.ui; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IExtension; -import org.eclipse.core.runtime.IExtensionPoint; -import org.eclipse.core.runtime.Platform; - -/** - * @deprecated Not needed. See BUG118359 - */ -public class DeviceProfileEntryProviderBuilder { - private static final String EXTENSION_POINT_PLUGINID = "org.eclipse.wst.html.ui"; //$NON-NLS-1$ - private static final String EXTENSION_POINT_NAME = "deviceProfileEntryProvider"; //$NON-NLS-1$ - private static final String ATTR_CLASS = "class"; //$NON-NLS-1$ - - public DeviceProfileEntryProviderBuilder() { - super(); - } - static public DeviceProfileEntryProvider getEntryProvider() { - IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(EXTENSION_POINT_PLUGINID, EXTENSION_POINT_NAME); - if (point != null) { - IExtension extensions[] = point.getExtensions(); - if ((extensions != null) && (extensions.length > 0)) { - for (int i = 0; i < extensions.length; i++) { - IConfigurationElement elements[] = extensions[i].getConfigurationElements(); - if ((elements != null) && (elements.length > 0)) { - for (int j = 0; j < elements.length; j++) { - IConfigurationElement config = elements[j]; - if ((config != null) && (config.getName().equals(EXTENSION_POINT_NAME) == true)) { - String className = config.getAttribute(ATTR_CLASS); - if (className != null) { - try { - DeviceProfileEntryProvider provider = (DeviceProfileEntryProvider)config.createExecutableExtension(ATTR_CLASS); - if (provider != null) { - return provider; - } - } catch (CoreException ignored) { - } - } - } - } - } - } - } - } - return null; - } -} diff --git a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/contentproperties/ui/HTMLContentSettingsPropertyPage.java b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/contentproperties/ui/HTMLContentSettingsPropertyPage.java deleted file mode 100644 index ec1fb0097a..0000000000 --- a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/contentproperties/ui/HTMLContentSettingsPropertyPage.java +++ /dev/null @@ -1,280 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.html.ui.internal.contentproperties.ui; - -import java.util.Map; - -import org.eclipse.core.resources.IResource; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; -import org.eclipse.swt.widgets.Widget; -import org.eclipse.ui.PlatformUI; -import org.eclipse.wst.html.ui.internal.HTMLUIMessages; -import org.eclipse.wst.html.ui.internal.Logger; -import org.eclipse.wst.html.ui.internal.editor.IHelpContextIds; -import org.eclipse.wst.sse.internal.contentproperties.IContentSettings; -import org.eclipse.wst.sse.ui.internal.contentproperties.ui.ComboListOnPropertyPage; -import org.eclipse.wst.sse.ui.internal.contentproperties.ui.ContentSettingsPropertyPage; - -/** - * @deprecated Use WebContentSettingsPropertyPage instead - */ -public final class HTMLContentSettingsPropertyPage extends ContentSettingsPropertyPage implements org.eclipse.swt.events.SelectionListener { - - - private final int N_DOCUMENT_TYPE = 0; - private final int N_CSS_PROFILE = 1; - private final int N_TARGET_DEVICE = 2; - - private Text publicIdText; - private Text systemIdText; - - public HTMLContentSettingsPropertyPage() { - super(); - numberOfCombo = 3; - numCols = 2; - numRows = 8; - combo = new ComboListOnPropertyPage[super.numberOfCombo]; - - } - - - - protected void createDocumentTypeComboBox() { - - // create description of implecit DOCTYPE - Label label = new Label(propertyPage, SWT.LEFT); - label.setText(HTMLUIMessages.UI_Description_of_role_of_following_DOCTYPE); - GridData data = new GridData(); - data.horizontalAlignment = GridData.FILL; - data.horizontalSpan = numCols; - label.setLayoutData(data); - - // create combobox - super.combo[N_DOCUMENT_TYPE] = super.createComboBoxOf(DOCUMENT_LABEL); - super.combo[this.N_DOCUMENT_TYPE].addSelectionListener(this); - // set entry list into Combo - ContentSettingsRegistry.setHTMLDocumentTypeRegistryInto(combo[N_DOCUMENT_TYPE]); - // create TextField - createIDTextField(); - if (combo[N_DOCUMENT_TYPE].getItemCount() <= 0) - return; - - String initValue = contentSettings.getProperty((IResource) super.getElement(), IContentSettings.HTML_DOCUMENT_TYPE); - // when either .contentsettings or element doesn't exist - // when attribute doesn't exists,getProperty returns empty string. - if (initValue == null) - initValue = ""; //$NON-NLS-1$ - // set init selectionItem in Combo - super.setSelectionItem(combo[N_DOCUMENT_TYPE], initValue); - this.publicIdText.setText(initValue); - if (!initValue.equals("")) {//$NON-NLS-1$ - // toro D210260 - if (ContentSettingsRegistry.getSystemIdFrom(initValue) != null) - this.systemIdText.setText(ContentSettingsRegistry.getSystemIdFrom(initValue)); - else - this.systemIdText.setText("");//$NON-NLS-1$ - } - else - this.systemIdText.setText("");//$NON-NLS-1$ - - // create separator - label = new Label(propertyPage, SWT.SEPARATOR | SWT.HORIZONTAL); - data = new GridData(); - data.horizontalAlignment = GridData.FILL; - data.horizontalSpan = numCols; - data.verticalSpan = 8; - label.setLayoutData(data); - - } - - - - protected void createCSSComboBox() { - super.combo[N_CSS_PROFILE] = super.createComboBoxOf(CSS_LABEL); - - ContentSettingsRegistry.setCSSMetaModelRegistryInto(combo[N_CSS_PROFILE]); - if (combo[N_CSS_PROFILE].getItemCount() <= 0) - return; - String initValue = contentSettings.getProperty((IResource) super.getElement(), IContentSettings.CSS_PROFILE); - // when either .contentsettings or element doesn't exist - // when attribute doesn't exists,getProperty returns empty string. - if (initValue == null) - initValue = ""; //$NON-NLS-1$ - // set init selectionItem in Combo - super.setSelectionItem(combo[N_CSS_PROFILE], initValue); - } - - - - protected void createDeviceComboBox() { - super.combo[N_TARGET_DEVICE] = super.createComboBoxOf(DEVICE_LABEL); - - ContentSettingsRegistry.setDeviceProfileRegistryInto(combo[N_TARGET_DEVICE]); - if (combo[N_TARGET_DEVICE].getItemCount() <= 0) - return; - String initValue = contentSettings.getProperty((IResource) super.getElement(), IContentSettings.DEVICE_PROFILE); - // when either .contentsettings or element doesn't exist - // when attribute doesn't exists,getProperty returns empty string. - if (initValue == null) - initValue = ""; //$NON-NLS-1$ - // set init selectionItem in Combo - super.setSelectionItem(combo[N_TARGET_DEVICE], initValue); - } - - - protected void createSettingsPageGUI() { - int type = ((IResource) getElement()).getType(); - switch (type) { - case IResource.FILE : - // composite = createComposite(propertyPage,numCols,numRows); - createDocumentTypeComboBox(); - createCSSComboBox(); - createDeviceComboBox(); - computeMaxWidthHint(); - PlatformUI.getWorkbench().getHelpSystem().setHelp(propertyPage, IHelpContextIds.WEB_CONTENT_SETTINGS_HELPID); - break; - - default : - Logger.log(Logger.WARNING, "HTMLContentSettingsPropertyPage is instantiated by resource except FILE");//$NON-NLS-1$ - break; - } - - } - - - - protected void putSelectedPropertyInto(Map properties, String valueInCombo, int index) { - - switch (index) { - case N_DOCUMENT_TYPE : - // doc type - properties.put(IContentSettings.HTML_DOCUMENT_TYPE, valueInCombo); - break; - case N_CSS_PROFILE : - // css - properties.put(IContentSettings.CSS_PROFILE, valueInCombo); - break; - case N_TARGET_DEVICE : - // device - properties.put(IContentSettings.DEVICE_PROFILE, valueInCombo); - break; - default : - Logger.log(Logger.ERROR, "Index is out of range in putSelectedPropertyInto() in class HTMLContentSettingsPropertyPage");//$NON-NLS-1$ - break; - } - - } - - protected void deleteNoneProperty(int index) { - switch (index) { - case N_DOCUMENT_TYPE : - // doc type - contentSettings.deleteProperty((IResource) super.getElement(), IContentSettings.HTML_DOCUMENT_TYPE); - break; - case N_CSS_PROFILE : - // css - contentSettings.deleteProperty((IResource) super.getElement(), IContentSettings.CSS_PROFILE); - break; - case N_TARGET_DEVICE : - // device - contentSettings.deleteProperty((IResource) super.getElement(), IContentSettings.DEVICE_PROFILE); - break; - default : - Logger.log(Logger.ERROR, "Index is out of range in deleteNoneProperty() in class HTMLContentSettingsPropertyPage");//$NON-NLS-1$ - break; - } - } - - private void createIDTextField() { - // public ID & System ID - Label publicLabel = new Label(super.propertyPage, SWT.NONE); - GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL); - data.horizontalIndent = 10; - publicLabel.setLayoutData(data); - publicLabel.setText(HTMLUIMessages.UI_Public_ID); - publicIdText = new Text(super.propertyPage, SWT.BORDER | SWT.READ_ONLY); - data = new GridData(); - - publicIdText.setLayoutData(data); - - Label systemLabel = new Label(super.propertyPage, SWT.NONE); - data = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL); - data.horizontalIndent = 10; - systemLabel.setLayoutData(data); - systemLabel.setText(HTMLUIMessages.UI_System_ID); - systemIdText = new Text(super.propertyPage, SWT.BORDER | SWT.READ_ONLY); - data = new GridData(); - - systemIdText.setLayoutData(data); - } - - - - private void computeMaxWidthHint() { - // maxLengthString was set when HTMLDocumentTypeEntry was set in class ContentSettingsRegistry. - String maxLengthString = ContentSettingsRegistry.maxLengthStringInHTMLDocumentTypeRegistry; - String backup = this.systemIdText.getText(); - this.systemIdText.setText(maxLengthString); - int maxWidthHint = this.systemIdText.computeSize(SWT.DEFAULT, SWT.DEFAULT).x; - this.systemIdText.setText(backup); - - if (this.combo[this.N_DOCUMENT_TYPE].getLayoutData() != null) - ((GridData) this.combo[this.N_DOCUMENT_TYPE].getLayoutData()).widthHint = maxWidthHint; - if (this.publicIdText.getLayoutData() != null) - ((GridData) this.publicIdText.getLayoutData()).widthHint = maxWidthHint; - if (this.systemIdText.getLayoutData() != null) - ((GridData) this.systemIdText.getLayoutData()).widthHint = maxWidthHint; - if (this.combo[this.N_CSS_PROFILE].getLayoutData() != null) - ((GridData) this.combo[this.N_CSS_PROFILE].getLayoutData()).widthHint = maxWidthHint; - if (this.combo[this.N_TARGET_DEVICE].getLayoutData() != null) - ((GridData) this.combo[this.N_TARGET_DEVICE].getLayoutData()).widthHint = maxWidthHint; - - } - - - public void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent e) { - } - - public void widgetSelected(org.eclipse.swt.events.SelectionEvent event) { - Widget source = event.widget; - - if (this.combo[this.N_DOCUMENT_TYPE].equals(source)) { - ComboListOnPropertyPage combo = this.combo[this.N_DOCUMENT_TYPE]; - if (combo.getSelectionIndex() < 0) - return; - if (!combo.getSelectedValue().equals("")) {//$NON-NLS-1$ - this.publicIdText.setText(combo.getSelectedValue()); - if (ContentSettingsRegistry.getSystemIdFrom(combo.getSelectedValue()) != null) - this.systemIdText.setText(ContentSettingsRegistry.getSystemIdFrom(combo.getSelectedValue())); - else - this.systemIdText.setText("");//$NON-NLS-1$ - } - else { - this.publicIdText.setText("");//$NON-NLS-1$ - this.systemIdText.setText(""); //$NON-NLS-1$ - } - - } - } - - protected void performDefaults() { - super.performDefaults(); - this.publicIdText.setText("");//$NON-NLS-1$ - this.systemIdText.setText(""); //$NON-NLS-1$ - - } - - -} - diff --git a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/contentproperties/ui/ProjectContentSettingsPropertyPage.java b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/contentproperties/ui/ProjectContentSettingsPropertyPage.java deleted file mode 100644 index 5188e0572d..0000000000 --- a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/contentproperties/ui/ProjectContentSettingsPropertyPage.java +++ /dev/null @@ -1,282 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.html.ui.internal.contentproperties.ui; - -import java.util.Map; - -import org.eclipse.core.resources.IResource; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; -import org.eclipse.swt.widgets.Widget; -import org.eclipse.ui.PlatformUI; -import org.eclipse.wst.html.ui.internal.HTMLUIMessages; -import org.eclipse.wst.html.ui.internal.Logger; -import org.eclipse.wst.html.ui.internal.editor.IHelpContextIds; -import org.eclipse.wst.sse.internal.contentproperties.IContentSettings; -import org.eclipse.wst.sse.ui.internal.contentproperties.ui.ComboListOnPropertyPage; -import org.eclipse.wst.sse.ui.internal.contentproperties.ui.ContentSettingsPropertyPage; - -/** - * @deprecated Use ProjectHTMLContentSettingsPropertyPage instead - */ -public final class ProjectContentSettingsPropertyPage extends ContentSettingsPropertyPage implements org.eclipse.swt.events.SelectionListener { - - - private final int N_DOCUMENT_TYPE = 0; - private final int N_CSS_PROFILE = 1; - private final int N_TARGET_DEVICE = 2; - - private Text publicIdText; - private Text systemIdText; - - public ProjectContentSettingsPropertyPage() { - super(); - numberOfCombo = 3; - numCols = 2; - numRows = 8; - combo = new ComboListOnPropertyPage[super.numberOfCombo]; - - } - - - - protected void createDocumentTypeComboBox() { - - // create description of implecit DOCTYPE - Label label = new Label(propertyPage, SWT.LEFT); - label.setText(HTMLUIMessages.UI_Description_of_role_of_following_DOCTYPE); - GridData data = new GridData(); - data.horizontalAlignment = GridData.FILL; - data.horizontalSpan = numCols; - label.setLayoutData(data); - - // create combobox - super.combo[N_DOCUMENT_TYPE] = super.createComboBoxOf(DOCUMENT_LABEL); - super.combo[this.N_DOCUMENT_TYPE].addSelectionListener(this); - // set entry list into Combo - ContentSettingsRegistry.setHTMLDocumentTypeRegistryInto(combo[N_DOCUMENT_TYPE]); - // create TextField - createIDTextField(); - if (combo[N_DOCUMENT_TYPE].getItemCount() <= 0) - return; - - String initValue = contentSettings.getProperty((IResource) super.getElement(), IContentSettings.HTML_DOCUMENT_TYPE); - // when either .contentsettings or element doesn't exist - // when attribute doesn't exists,getProperty returns empty string. - if (initValue == null) - initValue = ""; //$NON-NLS-1$ - // set init selectionItem in Combo - super.setSelectionItem(combo[N_DOCUMENT_TYPE], initValue); - this.publicIdText.setText(initValue); - if (!initValue.equals("")) {//$NON-NLS-1$ - // toro D210260 - if (ContentSettingsRegistry.getSystemIdFrom(initValue) != null) - this.systemIdText.setText(ContentSettingsRegistry.getSystemIdFrom(initValue)); - else - this.systemIdText.setText("");//$NON-NLS-1$ - } - else - this.systemIdText.setText("");//$NON-NLS-1$ - - // create separator - label = new Label(propertyPage, SWT.SEPARATOR | SWT.HORIZONTAL); - data = new GridData(); - data.horizontalAlignment = GridData.FILL; - data.horizontalSpan = numCols; - data.verticalSpan = 8; - label.setLayoutData(data); - - } - - - - protected void createCSSComboBox() { - super.combo[N_CSS_PROFILE] = super.createComboBoxOf(CSS_LABEL); - - ContentSettingsRegistry.setCSSMetaModelRegistryInto(combo[N_CSS_PROFILE]); - if (combo[N_CSS_PROFILE].getItemCount() <= 0) - return; - String initValue = contentSettings.getProperty((IResource) super.getElement(), IContentSettings.CSS_PROFILE); - // when either .contentsettings or element doesn't exist - // when attribute doesn't exists,getProperty returns empty string. - if (initValue == null) - initValue = ""; //$NON-NLS-1$ - // set init selectionItem in Combo - super.setSelectionItem(combo[N_CSS_PROFILE], initValue); - } - - - - protected void createDeviceComboBox() { - super.combo[N_TARGET_DEVICE] = super.createComboBoxOf(DEVICE_LABEL); - - ContentSettingsRegistry.setDeviceProfileRegistryInto(combo[N_TARGET_DEVICE]); - if (combo[N_TARGET_DEVICE].getItemCount() <= 0) - return; - String initValue = contentSettings.getProperty((IResource) super.getElement(), IContentSettings.DEVICE_PROFILE); - // when either .contentsettings or element doesn't exist - // when attribute doesn't exists,getProperty returns empty string. - if (initValue == null) - initValue = ""; //$NON-NLS-1$ - // set init selectionItem in Combo - super.setSelectionItem(combo[N_TARGET_DEVICE], initValue); - } - - - protected void createSettingsPageGUI() { - int type = ((IResource) getElement()).getType(); - switch (type) { - case IResource.PROJECT : - // composite = createComposite(propertyPage,numCols,numRows); - createDocumentTypeComboBox(); - createCSSComboBox(); - createDeviceComboBox(); - computeMaxWidthHint(); - PlatformUI.getWorkbench().getHelpSystem().setHelp(propertyPage, IHelpContextIds.WEB_CONTENT_SETTINGS_HELPID); - break; - - default : - Logger.log(Logger.WARNING, "ProjectContentSettingsPropertyPage is instantiated by resource except PROJECT");//$NON-NLS-1$ - break; - } - - } - - - - protected void putSelectedPropertyInto(Map properties, String valueInCombo, int index) { - - switch (index) { - case N_DOCUMENT_TYPE : - // doc type - properties.put(IContentSettings.HTML_DOCUMENT_TYPE, valueInCombo); - break; - case N_CSS_PROFILE : - // css - properties.put(IContentSettings.CSS_PROFILE, valueInCombo); - break; - case N_TARGET_DEVICE : - // device - properties.put(IContentSettings.DEVICE_PROFILE, valueInCombo); - break; - default : - Logger.log(Logger.ERROR, "Index is out of range in putSelectedPropertyInto() in class ProjectContentSettingsPropertyPage");//$NON-NLS-1$ - break; - } - - } - - protected void deleteNoneProperty(int index) { - switch (index) { - case N_DOCUMENT_TYPE : - // doc type - contentSettings.deleteProperty((IResource) super.getElement(), IContentSettings.HTML_DOCUMENT_TYPE); - break; - - case N_CSS_PROFILE : - // css - contentSettings.deleteProperty((IResource) super.getElement(), IContentSettings.CSS_PROFILE); - break; - - case N_TARGET_DEVICE : - // device - contentSettings.deleteProperty((IResource) super.getElement(), IContentSettings.DEVICE_PROFILE); - break; - - default : - Logger.log(Logger.ERROR, "Index is out of range in deleteNoneProperty() in class ProjectContentSettingsPropertyPage");//$NON-NLS-1$ - break; - } - } - - private void createIDTextField() { - // public ID & System ID - Label publicLabel = new Label(super.propertyPage, SWT.NONE); - GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL); - data.horizontalIndent = 10; - publicLabel.setLayoutData(data); - publicLabel.setText(HTMLUIMessages.UI_Public_ID); - publicIdText = new Text(super.propertyPage, SWT.BORDER | SWT.READ_ONLY); - data = new GridData(); - - publicIdText.setLayoutData(data); - - Label systemLabel = new Label(super.propertyPage, SWT.NONE); - data = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL); - data.horizontalIndent = 10; - systemLabel.setLayoutData(data); - systemLabel.setText(HTMLUIMessages.UI_System_ID); - systemIdText = new Text(super.propertyPage, SWT.BORDER | SWT.READ_ONLY); - data = new GridData(); - - systemIdText.setLayoutData(data); - } - - - - private void computeMaxWidthHint() { - // maxLengthString was set when HTMLDocumentTypeEntry was set in class - // ContentSettingsRegistry. - String maxLengthString = ContentSettingsRegistry.maxLengthStringInHTMLDocumentTypeRegistry; - String backup = this.systemIdText.getText(); - this.systemIdText.setText(maxLengthString); - int maxWidthHint = this.systemIdText.computeSize(SWT.DEFAULT, SWT.DEFAULT).x; - this.systemIdText.setText(backup); - - if (this.combo[this.N_DOCUMENT_TYPE].getLayoutData() != null) - ((GridData) this.combo[this.N_DOCUMENT_TYPE].getLayoutData()).widthHint = maxWidthHint; - if (this.publicIdText.getLayoutData() != null) - ((GridData) this.publicIdText.getLayoutData()).widthHint = maxWidthHint; - if (this.systemIdText.getLayoutData() != null) - ((GridData) this.systemIdText.getLayoutData()).widthHint = maxWidthHint; - if (this.combo[this.N_CSS_PROFILE].getLayoutData() != null) - ((GridData) this.combo[this.N_CSS_PROFILE].getLayoutData()).widthHint = maxWidthHint; - if (this.combo[this.N_TARGET_DEVICE].getLayoutData() != null) - ((GridData) this.combo[this.N_TARGET_DEVICE].getLayoutData()).widthHint = maxWidthHint; - - } - - - public void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent e) { - } - - public void widgetSelected(org.eclipse.swt.events.SelectionEvent event) { - Widget source = event.widget; - - if (this.combo[this.N_DOCUMENT_TYPE].equals(source)) { - ComboListOnPropertyPage combo = this.combo[this.N_DOCUMENT_TYPE]; - if (combo.getSelectionIndex() < 0) - return; - if (!combo.getSelectedValue().equals("")) {//$NON-NLS-1$ - this.publicIdText.setText(combo.getSelectedValue()); - if (ContentSettingsRegistry.getSystemIdFrom(combo.getSelectedValue()) != null) - this.systemIdText.setText(ContentSettingsRegistry.getSystemIdFrom(combo.getSelectedValue())); - else - this.systemIdText.setText("");//$NON-NLS-1$ - } - else { - this.publicIdText.setText("");//$NON-NLS-1$ - this.systemIdText.setText(""); //$NON-NLS-1$ - } - - } - } - - protected void performDefaults() { - super.performDefaults(); - this.publicIdText.setText("");//$NON-NLS-1$ - this.systemIdText.setText(""); //$NON-NLS-1$ - - } - -} diff --git a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/contentproperties/ui/ProjectWebContentSettingsPropertyPage.java b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/contentproperties/ui/ProjectWebContentSettingsPropertyPage.java deleted file mode 100644 index 6ccbe4cec4..0000000000 --- a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/contentproperties/ui/ProjectWebContentSettingsPropertyPage.java +++ /dev/null @@ -1,19 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.html.ui.internal.contentproperties.ui; - -import org.eclipse.wst.html.ui.internal.HTMLUIMessages; - -public class ProjectWebContentSettingsPropertyPage extends WebContentSettingsPropertyPage { - public ProjectWebContentSettingsPropertyPage() { - setDescription(HTMLUIMessages.ProjectWebContentSettingsPropertyPage_0); - } -} diff --git a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/contentproperties/ui/WebContentSettingsPropertyPage.java b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/contentproperties/ui/WebContentSettingsPropertyPage.java deleted file mode 100644 index 1c07baa1eb..0000000000 --- a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/contentproperties/ui/WebContentSettingsPropertyPage.java +++ /dev/null @@ -1,376 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * David Schneider, david.schneider@unisys.com - [142500] WTP properties pages fonts don't follow Eclipse preferences - *******************************************************************************/ -package org.eclipse.wst.html.ui.internal.contentproperties.ui; - -import java.util.ArrayList; -import java.util.Enumeration; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.dialogs.PropertyPage; -import org.eclipse.wst.css.core.internal.contentproperties.CSSContentProperties; -import org.eclipse.wst.css.core.internal.metamodel.CSSProfile; -import org.eclipse.wst.css.core.internal.metamodel.CSSProfileRegistry; -import org.eclipse.wst.html.core.internal.contentproperties.HTMLContentProperties; -import org.eclipse.wst.html.core.internal.document.HTMLDocumentTypeEntry; -import org.eclipse.wst.html.core.internal.document.HTMLDocumentTypeRegistry; -import org.eclipse.wst.html.ui.internal.HTMLUIMessages; -import org.eclipse.wst.html.ui.internal.Logger; -import org.eclipse.wst.html.ui.internal.editor.IHelpContextIds; - -public class WebContentSettingsPropertyPage extends PropertyPage { - private static final String SELECT_NONE = HTMLUIMessages.UI_none; - private String maxLengthStringInHTMLDocumentTypeRegistry = ""; //$NON-NLS-1$ - - private class ComboSelectionListener implements SelectionListener { - public void widgetDefaultSelected(SelectionEvent e) { - // do nothing - } - - public void widgetSelected(SelectionEvent e) { - int index = fDocumentTypeCombo.getSelectionIndex(); - String doctype = (String) fDocumentTypeIds.get(index); - updateDoctypeText(index, doctype); - } - } - - Combo fDocumentTypeCombo; - List fDocumentTypeIds; - private Text fPublicIdText; - private Text fSystemIdText; - private Combo fProfileCombo; - private List fProfileIds; - private SelectionListener fListener; - - public WebContentSettingsPropertyPage() { - super(); - setDescription(HTMLUIMessages.WebContentSettingsPropertyPage_0); - } - - private Composite createComposite(Composite parent, int numColumns) { - Composite composite = new Composite(parent, SWT.NULL); - - // GridLayout - GridLayout layout = new GridLayout(); - layout.numColumns = numColumns; - composite.setLayout(layout); - - // GridData - GridData data = new GridData(GridData.FILL, GridData.FILL, true, false); - data.horizontalIndent = 0; - composite.setLayoutData(data); - - return composite; - } - - protected Control createContents(Composite parent) { - Composite propertyPage = createComposite(parent, 2); - - createDoctypeContents(propertyPage); - createCSSProfileContents(propertyPage); - - populateValues(); - initializeValues(); - computeMaxWidthHint(); - - fListener = new ComboSelectionListener(); - fDocumentTypeCombo.addSelectionListener(fListener); - - PlatformUI.getWorkbench().getHelpSystem().setHelp(propertyPage, IHelpContextIds.WEB_CONTENT_SETTINGS_HELPID); - Dialog.applyDialogFont(parent); - return propertyPage; - } - - private void createCSSProfileContents(Composite parent) { - // CSS Profile - Text languageLabel = new Text(parent, SWT.READ_ONLY); - languageLabel.setText(HTMLUIMessages.UI_CSS_profile___2); - fProfileCombo = new Combo(parent, SWT.READ_ONLY); - GridData data = new GridData(GridData.FILL, GridData.FILL, true, false); - data.horizontalIndent = 0; - fProfileCombo.setLayoutData(data); - } - - private void createDoctypeContents(Composite parent) { - // create description of implicit DOCTYPE - Text doctypeLabel = new Text(parent, SWT.READ_ONLY); - doctypeLabel.setText(HTMLUIMessages.UI_Description_of_role_of_following_DOCTYPE); - GridData data = new GridData(GridData.FILL, GridData.FILL, true, false); - data.horizontalIndent = 0; - data.horizontalSpan = 2; - doctypeLabel.setLayoutData(data); - - // document type - Text languageLabel = new Text(parent, SWT.READ_ONLY); - languageLabel.setText(HTMLUIMessages.UI_Default_HTML_DOCTYPE_ID___1); - fDocumentTypeCombo = new Combo(parent, SWT.READ_ONLY); - data = new GridData(GridData.FILL, GridData.FILL, true, false); - data.horizontalIndent = 0; - fDocumentTypeCombo.setLayoutData(data); - - // public ID - Text publicIdLabel = new Text(parent, SWT.READ_ONLY); - publicIdLabel.setText(HTMLUIMessages.UI_Public_ID); - fPublicIdText = new Text(parent, SWT.READ_ONLY | SWT.BORDER); - data = new GridData(GridData.FILL, GridData.FILL, true, false); - data.horizontalIndent = 0; - fPublicIdText.setLayoutData(data); - - // system ID - Text systemIdLabel = new Text(parent, SWT.READ_ONLY); - systemIdLabel.setText(HTMLUIMessages.UI_System_ID); - fSystemIdText = new Text(parent, SWT.READ_ONLY | SWT.BORDER); - data = new GridData(GridData.FILL, GridData.FILL, true, false); - data.horizontalIndent = 0; - fSystemIdText.setLayoutData(data); - - // create separator - Label label = new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL); - data = new GridData(); - data.horizontalAlignment = GridData.FILL; - data.horizontalSpan = 2; - data.verticalSpan = 8; - label.setLayoutData(data); - } - - /** - * Get the resource this properties page is for - * - * @return IResource for this properties page or null if there is no - * IResource - */ - private IResource getResource() { - IResource resource = null; - if (getElement() instanceof IResource) { - resource = (IResource) getElement(); - } - return resource; - } - - private String getSystemIdFrom(String publicId) { - if (publicId == null || publicId.length() == 0) - return null; - HTMLDocumentTypeRegistry reg = HTMLDocumentTypeRegistry.getInstance(); - Enumeration e = reg.getEntries(); - while (e.hasMoreElements()) { - HTMLDocumentTypeEntry entry = (HTMLDocumentTypeEntry) e.nextElement(); - if (entry.getPublicId().equals(publicId)) - return entry.getSystemId(); - } - return null; - } - - private void initializeValues() { - initializeDoctypeValues(); - initializeCSSProfileValues(); - } - - private void initializeCSSProfileValues() { - int index = 0; - String profile = CSSContentProperties.getProperty(CSSContentProperties.CSS_PROFILE, getResource(), false); - if (profile != null && profile.length() > 0) { - /* - * If item is already part of combo, select it. Otherwise, select - * none. - */ - index = fProfileIds.indexOf(profile); - } - index = index >= 0 ? index : 0; - fProfileCombo.select(index); - } - - private void initializeDoctypeValues() { - int index = 0; - String doctype = HTMLContentProperties.getProperty(HTMLContentProperties.DOCUMENT_TYPE, getResource(), false); - if (doctype != null && doctype.length() > 0) { - /* - * If item is already part of combo, select it. Otherwise, select - * none. - */ - index = fDocumentTypeIds.indexOf(doctype); - } - - // set combobox - index = index >= 0 ? index : 0; - fDocumentTypeCombo.select(index); - - updateDoctypeText(index, doctype); - } - - void updateDoctypeText(int index, String doctype) { - if (index > 0) { - // set public/system id text - fPublicIdText.setText(doctype); - String systemId = getSystemIdFrom(doctype); - if (systemId != null) - fSystemIdText.setText(systemId); - else - fSystemIdText.setText(""); //$NON-NLS-1$ - } - else { - // set public/system id text - fPublicIdText.setText(""); //$NON-NLS-1$ - fSystemIdText.setText(""); //$NON-NLS-1$ - } - } - - private void populateValues() { - populateDoctypeValues(); - populateCSSProfileValues(); - } - - private void populateCSSProfileValues() { - fProfileIds = new ArrayList(); - // add none first - fProfileCombo.add(SELECT_NONE); - fProfileIds.add(null); - - CSSProfileRegistry reg = CSSProfileRegistry.getInstance(); - Iterator i = reg.getProfiles(); - while (i.hasNext()) { - CSSProfile profile = (CSSProfile) i.next(); - String id = profile.getProfileID(); - String name = profile.getProfileName(); - fProfileCombo.add(name); - fProfileIds.add(id); - } - } - - private void populateDoctypeValues() { - fDocumentTypeIds = new ArrayList(); - // add none first - fDocumentTypeCombo.add(SELECT_NONE); - fDocumentTypeIds.add(null); - - HTMLDocumentTypeRegistry reg = HTMLDocumentTypeRegistry.getInstance(); - Enumeration e = reg.getEntries(); - while (e.hasMoreElements()) { - HTMLDocumentTypeEntry entry = (HTMLDocumentTypeEntry) e.nextElement(); - String publicId = entry.getPublicId(); - String displayName = entry.getDisplayName(); - displayName = displayName != null ? displayName : publicId; - - fDocumentTypeCombo.add(displayName); - fDocumentTypeIds.add(publicId); - - if (displayName.length() > maxLengthStringInHTMLDocumentTypeRegistry.length()) { - maxLengthStringInHTMLDocumentTypeRegistry = displayName; - } - - if (entry.getSystemId() == null) - continue; // if HTML entry - - - if (entry.getSystemId().length() > maxLengthStringInHTMLDocumentTypeRegistry.length()) - maxLengthStringInHTMLDocumentTypeRegistry = entry.getSystemId(); - } - } - - private void computeMaxWidthHint() { - // maxLengthString was set populateDoctypeValues was called - String maxLengthString = maxLengthStringInHTMLDocumentTypeRegistry; - String backup = fSystemIdText.getText(); - fSystemIdText.setText(maxLengthString); - int maxWidthHint = fSystemIdText.computeSize(SWT.DEFAULT, SWT.DEFAULT).x; - fSystemIdText.setText(backup); - - if (fDocumentTypeCombo.getLayoutData() != null) - ((GridData) fDocumentTypeCombo.getLayoutData()).widthHint = maxWidthHint; - if (fPublicIdText.getLayoutData() != null) - ((GridData) fPublicIdText.getLayoutData()).widthHint = maxWidthHint; - if (fSystemIdText.getLayoutData() != null) - ((GridData) fSystemIdText.getLayoutData()).widthHint = maxWidthHint; - if (fProfileCombo.getLayoutData() != null) - ((GridData) fProfileCombo.getLayoutData()).widthHint = maxWidthHint; - } - - private void performCSSProfileDefaults() { - int index = fProfileCombo.indexOf(SELECT_NONE); - if (index > -1) - fProfileCombo.select(index); - - super.performDefaults(); - } - - private boolean performCSSProfileOk() { - int index = fProfileCombo.getSelectionIndex(); - if (index > -1) { - String id = (String) fProfileIds.get(index); - if (id == null || id.length() == 0 || id.equalsIgnoreCase(SELECT_NONE)) { - // if none, use null - id = null; - } - try { - CSSContentProperties.setProperty(CSSContentProperties.CSS_PROFILE, getResource(), id); - } - catch (CoreException e) { - // maybe in future, let user know there was a problem saving - // file - Logger.log(Logger.WARNING_DEBUG, e.getMessage(), e); - } - } - return true; - } - - protected void performDefaults() { - super.performDefaults(); - - performDoctypeDefaults(); - performCSSProfileDefaults(); - } - - private void performDoctypeDefaults() { - fPublicIdText.setText("");//$NON-NLS-1$ - fSystemIdText.setText(""); //$NON-NLS-1$ - } - - private boolean performDoctypeOk() { - int index = fDocumentTypeCombo.getSelectionIndex(); - if (index > -1) { - String id = (String) fDocumentTypeIds.get(index); - if (id == null || id.length() == 0 || id.equalsIgnoreCase(SELECT_NONE)) { - // if none, use null - id = null; - } - try { - HTMLContentProperties.setProperty(HTMLContentProperties.DOCUMENT_TYPE, getResource(), id); - } - catch (CoreException e) { - // maybe in future, let user know there was a problem saving - // file - Logger.log(Logger.WARNING_DEBUG, e.getMessage(), e); - } - } - return true; - } - - public boolean performOk() { - performDoctypeOk(); - performCSSProfileOk(); - - return super.performOk(); - } -} |