diff options
Diffstat (limited to 'bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section')
33 files changed, 0 insertions, 3639 deletions
diff --git a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/AbstractSection.java b/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/AbstractSection.java deleted file mode 100644 index e9c09e6830..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/AbstractSection.java +++ /dev/null @@ -1,334 +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.dtd.ui.internal.properties.section; - -import org.eclipse.jface.action.IStatusLineManager; -import org.eclipse.jface.util.Assert; -import org.eclipse.jface.util.IPropertyChangeListener; -import org.eclipse.jface.util.PropertyChangeEvent; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.graphics.GC; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Listener; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.part.EditorActionBarContributor; -import org.eclipse.wst.common.ui.properties.internal.provisional.ISection; -import org.eclipse.wst.common.ui.properties.internal.provisional.TabbedPropertySheetPage; -import org.eclipse.wst.common.ui.properties.internal.provisional.TabbedPropertySheetWidgetFactory; -import org.eclipse.wst.dtd.ui.internal.DTDUIPlugin; -import org.eclipse.wst.xml.core.internal.document.DocumentImpl; -import org.w3c.dom.Element; - -public class AbstractSection implements ISection, IPropertyChangeListener, Listener, SelectionListener { - private TabbedPropertySheetWidgetFactory factory; - protected IWorkbenchPart fWorkbenchPart; - protected ISelection fSelection; - protected Object fInput; - protected int rightMarginSpace; - - public void createControls(Composite parent, TabbedPropertySheetPage tabbedPropertySheetPage) { - createControls(parent, tabbedPropertySheetPage.getWidgetFactory()); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISection#createControls(org.eclipse.swt.widgets.Composite, - * org.eclipse.wst.common.ui.properties.internal.provisional.TabbedPropertySheetWidgetFactory) - */ - public void createControls(Composite parent, TabbedPropertySheetWidgetFactory aFactory) { - this.factory = aFactory; - GC gc = new GC(parent); - Point extent = gc.textExtent(" ... "); //$NON-NLS-1$ - rightMarginSpace = extent.x; - gc.dispose(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISection#setInput(org.eclipse.ui.IWorkbenchPart, - * org.eclipse.jface.viewers.ISelection) - */ - public void setInput(IWorkbenchPart part, ISelection sel) { - Assert.isTrue(sel instanceof IStructuredSelection, "selection " + sel.getClass() + "is not structured"); //$NON-NLS-1$ //$NON-NLS-2$ - this.fWorkbenchPart = part; - this.fSelection = sel; - this.fInput = ((IStructuredSelection) fSelection).getFirstElement(); - /* - * if (fInput instanceof XSDConcreteComponent) { xsdSchema = - * ((XSDConcreteComponent)fInput).getSchema(); } - */ - - // refresh(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISection#aboutToBeShown() - */ - public void aboutToBeShown() { - refresh(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISection#aboutToBeHidden() - */ - public void aboutToBeHidden() { - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISection#dispose() - */ - public void dispose() { - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISection#getMinimumHeight() - */ - public int getMinimumHeight() { - return SWT.DEFAULT; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISection#shouldUseExtraSpace() - */ - public boolean shouldUseExtraSpace() { - return false; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISection#refresh() - */ - public void refresh() { - // TODO Auto-generated method stub - } - - public Object getInput() { - if (fInput instanceof Element) { - // fInput = xsdSchema.getCorrespondingComponent((Element)fInput); - } - return fInput; - } - - /** - * Get the widget factory. - * - * @return the widget factory. - */ - public TabbedPropertySheetWidgetFactory getWidgetFactory() { - return factory; - } - - public void propertyChange(PropertyChangeEvent event) { - refresh(); - } - - public void doWidgetDefaultSelected(SelectionEvent e) { - } - - public void doWidgetSelected(SelectionEvent e) { - } - - /** - * @see org.eclipse.swt.events.SelectionListener#widgetDefaultSelected(SelectionEvent) - */ - public void widgetDefaultSelected(SelectionEvent e) { - if (isListenerEnabled() && getInput() != null && !isInDoHandle) { - isInDoHandle = true; - doWidgetDefaultSelected(e); - isInDoHandle = false; - } - - } - - /** - * @see org.eclipse.swt.events.SelectionListener#widgetSelected(SelectionEvent) - */ - public void widgetSelected(SelectionEvent e) { - if (isListenerEnabled() && getInput() != null && !isInDoHandle) { - isInDoHandle = true; - doWidgetSelected(e); - isInDoHandle = false; - } - - } - - boolean listenerEnabled = true; - - /** - * Get the value of listenerEnabled. - * - * @return value of listenerEnabled. - */ - public boolean isListenerEnabled() { - return listenerEnabled; - } - - /** - * Set the value of listenerEnabled. - * - * @param v - * Value to assign to listenerEnabled. - */ - public void setListenerEnabled(boolean v) { - this.listenerEnabled = v; - } - - public void handleEvent(Event event) { - if (isListenerEnabled() && !isInDoHandle) { - isInDoHandle = true; - startDelayedEvent(event); - isInDoHandle = false; - } // end of if () - } - - public void doHandleEvent(Event event) { - - } - - protected DelayedEvent delayedTask; - - protected void startDelayedEvent(Event e) { - if (delayedTask == null || delayedTask.getEvent() == null) { - delayedTask = new DelayedEvent(); - delayedTask.setEvent(e); - Display.getDefault().timerExec(500, delayedTask); - } - else { - Event delayedEvent = delayedTask.getEvent(); - - if (e.widget == delayedEvent.widget && e.type == delayedEvent.type) { - // same event, just different data, delay new event - delayedTask.setEvent(null); - } - delayedTask = new DelayedEvent(); - delayedTask.setEvent(e); - Display.getDefault().timerExec(500, delayedTask); - } - } - - class DelayedEvent implements Runnable { - protected Event event; - - /* - * @see Runnable#run() - */ - public void run() { - if (event != null) { - isInDoHandle = true; - doHandleEvent(event); - isInDoHandle = false; - event = null; - } - } - - /** - * Gets the event. - * - * @return Returns a Event - */ - public Event getEvent() { - return event; - } - - /** - * Sets the event. - * - * @param event - * The event to set - */ - public void setEvent(Event e) { - this.event = e; - } - - } - - boolean isInDoHandle; - - /** - * Get the value of isInDoHandle. - * - * @return value of isInDoHandle. - */ - public boolean isInDoHandle() { - return isInDoHandle; - } - - static protected IEditorPart getActiveEditor() { - IWorkbench workbench = DTDUIPlugin.getDefault().getWorkbench(); - IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow(); - IEditorPart editorPart = workbenchWindow.getActivePage().getActiveEditor(); - - return editorPart; - } - - static protected IStatusLineManager getStatusLineManager(IEditorPart editorPart) { - IStatusLineManager result = null; - try { - EditorActionBarContributor contributor = (EditorActionBarContributor) editorPart.getEditorSite().getActionBarContributor(); - result = contributor.getActionBars().getStatusLineManager(); - } - catch (Exception e) { - } - return result; - } - - DocumentImpl getDocument(Element element) { - return (DocumentImpl) element.getOwnerDocument(); - } - - public void beginRecording(String description, Element element) { - DocumentImpl doc = getDocument(element); - doc.getModel().beginRecording(this, description); - } - - public void endRecording(Element element) { - DocumentImpl doc = getDocument(element); - - doc.getModel().endRecording(this); - } - - protected boolean validateName(String name) { - return true; - } - - protected boolean validateLanguage(String lang) { - return true; - } - - protected boolean validatePrefix(String prefix) { - return true; - } - -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/AbstractSectionDescriptor.java b/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/AbstractSectionDescriptor.java deleted file mode 100644 index 526677682b..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/AbstractSectionDescriptor.java +++ /dev/null @@ -1,110 +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.dtd.ui.internal.properties.section; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.wst.common.ui.properties.internal.provisional.ISection; -import org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor; -import org.eclipse.wst.common.ui.properties.internal.provisional.ITypeMapper; -import org.w3c.dom.Element; - -public class AbstractSectionDescriptor implements ISectionDescriptor { - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getId() - */ - public String getId() { - return ""; //$NON-NLS-1$ - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getFilter() - */ - public ITypeMapper getFilter() { - return null; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getInputTypes() - */ - public List getInputTypes() { - List list = new ArrayList(); - // list.add(XSDConcreteComponent.class); - return list; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getSectionClass() - */ - public ISection getSectionClass() { - // TODO Auto-generated method stub - return null; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getTargetTab() - */ - public String getTargetTab() { - // TODO Auto-generated method stub - return null; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#appliesTo(org.eclipse.ui.IWorkbenchPart, - * org.eclipse.jface.viewers.ISelection) - */ - public boolean appliesTo(IWorkbenchPart part, ISelection selection) { - Object object = null; - if (selection instanceof StructuredSelection) { - StructuredSelection structuredSelection = (StructuredSelection) selection; - object = structuredSelection.getFirstElement(); - // System.out.println("fSelection is: " + object); - if (object instanceof Element) { - return true; - } - } - return false; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getAfterSection() - */ - public String getAfterSection() { - return ""; //$NON-NLS-1$ - } - - protected boolean inputEquals(Object input, String tagname, boolean isRef) { - return false; - } - - public int getEnablesFor() { - return ENABLES_FOR_ANY; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/AttributeDefaultSection.java b/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/AttributeDefaultSection.java deleted file mode 100644 index 41859e846f..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/AttributeDefaultSection.java +++ /dev/null @@ -1,141 +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.dtd.ui.internal.properties.section; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CCombo; -import org.eclipse.swt.custom.CLabel; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.layout.FormAttachment; -import org.eclipse.swt.layout.FormData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Text; -import org.eclipse.wst.common.ui.properties.internal.provisional.ITabbedPropertyConstants; -import org.eclipse.wst.common.ui.properties.internal.provisional.TabbedPropertySheetWidgetFactory; -import org.eclipse.wst.dtd.core.internal.Attribute; -import org.eclipse.wst.dtd.ui.internal.DTDPropertiesMessages; - -public class AttributeDefaultSection extends AbstractSection { - - private final String IMPLIED = Attribute.IMPLIED; - private final String REQUIRED = Attribute.REQUIRED; - private final String FIXED = Attribute.FIXED; - - private CCombo usageCombo; - private String[] usageComboValues = {IMPLIED, REQUIRED, FIXED, DTDPropertiesMessages._UI_DEFAULT}; - private Text defaultValueText; - private CLabel defaultValueLabel; - - /** - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ITabbedPropertySection#createControls(org.eclipse.swt.widgets.Composite, - * org.eclipse.wst.common.ui.properties.internal.provisional.TabbedPropertySheetWidgetFactory) - */ - public void createControls(Composite parent, TabbedPropertySheetWidgetFactory factory) { - super.createControls(parent, factory); - Composite composite = getWidgetFactory().createFlatFormComposite(parent); - - usageCombo = getWidgetFactory().createCCombo(composite, SWT.FLAT); - FormData data = new FormData(); - data.left = new FormAttachment(0, 100); - data.right = new FormAttachment(100, 0); - data.top = new FormAttachment(0, 0); - usageCombo.setLayoutData(data); - usageCombo.addSelectionListener(this); - usageCombo.setItems(usageComboValues); - - CLabel usageLabel = getWidgetFactory().createCLabel(composite, DTDPropertiesMessages._UI_LABEL_USAGE); - data = new FormData(); - data.left = new FormAttachment(0, 0); - data.right = new FormAttachment(usageCombo, -ITabbedPropertyConstants.HSPACE); - data.top = new FormAttachment(usageCombo, 0, SWT.CENTER); - usageLabel.setLayoutData(data); - - defaultValueText = getWidgetFactory().createText(composite, ""); //$NON-NLS-1$ - data = new FormData(); - data.left = new FormAttachment(0, 100); - data.right = new FormAttachment(100, 0); - data.top = new FormAttachment(usageCombo, +ITabbedPropertyConstants.VSPACE); - defaultValueText.setLayoutData(data); - defaultValueText.addListener(SWT.Modify, this); - - defaultValueLabel = getWidgetFactory().createCLabel(composite, DTDPropertiesMessages._UI_LABEL_DEFAULT_VALUE); - data = new FormData(); - data.left = new FormAttachment(0, 0); - data.right = new FormAttachment(defaultValueText, -ITabbedPropertyConstants.HSPACE); - data.top = new FormAttachment(defaultValueText, 0, SWT.CENTER); - defaultValueLabel.setLayoutData(data); - } - - /* - * @see org.eclipse.wst.common.ui.properties.internal.provisional.view.ITabbedPropertySection#refresh() - */ - public void refresh() { - setListenerEnabled(false); - Object input = getInput(); - if (input != null) { - if (input instanceof Attribute) { - String kind = ((Attribute) input).getDefaultKind(); - if ("".equals(kind)) //$NON-NLS-1$ - usageCombo.setText(DTDPropertiesMessages._UI_DEFAULT); - else - usageCombo.setText(kind); - - if ("".equals(kind) || FIXED.equals(kind)) { //$NON-NLS-1$ - defaultValueLabel.setVisible(true); - defaultValueText.setEnabled(true); - defaultValueText.setText(((Attribute) input).getDefaultValue()); - } - else { - defaultValueText.setText(""); //$NON-NLS-1$ - defaultValueLabel.setVisible(false); - defaultValueText.setEnabled(false); - } - } - } - setListenerEnabled(true); - } - - public void widgetSelected(SelectionEvent e) { - if (e.widget == usageCombo) { - Object input = getInput(); - if (input instanceof Attribute) { - String usage = usageCombo.getText(); - Attribute attribute = (Attribute) input; - if (usage.equals(DTDPropertiesMessages._UI_DEFAULT)) - attribute.setDefaultKind(""); //$NON-NLS-1$ - else - attribute.setDefaultKind(usage); - - if (DTDPropertiesMessages._UI_DEFAULT.equals(usage) || FIXED.equals(usage)) { - defaultValueLabel.setVisible(true); - defaultValueText.setEnabled(true); - } - else { - defaultValueLabel.setVisible(false); - defaultValueText.setEnabled(false); - } - } - } - } - - public void doHandleEvent(Event event) { - Object input = getInput(); - if (input instanceof Attribute) { - if (event.widget == defaultValueText) { - String newValue = defaultValueText.getText(); - ((Attribute) input).setDefaultValue(newValue, usageCombo.getText().equals(FIXED)); - } - } - } - -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/AttributeDefaultSectionDescriptor.java b/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/AttributeDefaultSectionDescriptor.java deleted file mode 100644 index bd220fb958..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/AttributeDefaultSectionDescriptor.java +++ /dev/null @@ -1,87 +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.dtd.ui.internal.properties.section; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.wst.common.ui.properties.internal.provisional.ISection; -import org.eclipse.wst.dtd.core.internal.Attribute; - -public class AttributeDefaultSectionDescriptor extends AbstractSectionDescriptor { - private AttributeDefaultSection attributeDefaultSection; - - public AttributeDefaultSectionDescriptor() { - super(); - attributeDefaultSection = new AttributeDefaultSection(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getId() - */ - public String getId() { - return "org.eclipse.wst.dtd.ui.internal.section.attributedefault"; //$NON-NLS-1$ - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getInputTypes() - */ - public List getInputTypes() { - List list = new ArrayList(); - return list; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getSectionClass() - */ - public ISection getSectionClass() { - return attributeDefaultSection; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getTargetTab() - */ - public String getTargetTab() { - return "org.eclipse.wst.dtd.ui.internal.general"; //$NON-NLS-1$ - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#appliesTo(org.eclipse.ui.IWorkbenchPart, - * org.eclipse.jface.viewers.ISelection) - */ - public boolean appliesTo(IWorkbenchPart part, ISelection selection) { - Object object = null; - if (selection instanceof IStructuredSelection) { - IStructuredSelection structuredSelection = (IStructuredSelection) selection; - object = structuredSelection.getFirstElement(); - if (object instanceof Attribute) - return true; - else - return false; - } - return false; - } - -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/CommentSection.java b/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/CommentSection.java deleted file mode 100644 index b6e5900e45..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/CommentSection.java +++ /dev/null @@ -1,76 +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.dtd.ui.internal.properties.section; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.FormAttachment; -import org.eclipse.swt.layout.FormData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Text; -import org.eclipse.wst.common.ui.properties.internal.provisional.TabbedPropertySheetWidgetFactory; -import org.eclipse.wst.dtd.core.internal.Comment; - -public class CommentSection extends AbstractSection { - private Text commentText; - - /** - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ITabbedPropertySection#createControls(org.eclipse.swt.widgets.Composite, - * org.eclipse.wst.common.ui.properties.internal.provisional.TabbedPropertySheetWidgetFactory) - */ - public void createControls(Composite parent, TabbedPropertySheetWidgetFactory factory) { - super.createControls(parent, factory); - - Composite composite = getWidgetFactory().createFlatFormComposite(parent); - commentText = getWidgetFactory().createText(composite, "", SWT.MULTI | SWT.NONE); //$NON-NLS-1$ - commentText.addListener(SWT.Modify, CommentSection.this); - - FormData data = new FormData(); - data.left = new FormAttachment(0, 0); - data.right = new FormAttachment(100, 0); - data.top = new FormAttachment(0, 0); - data.bottom = new FormAttachment(100, 0); - commentText.setLayoutData(data); - } - - /* - * @see org.eclipse.wst.common.ui.properties.internal.provisional.view.ITabbedPropertySection#refresh() - */ - public void refresh() { - setListenerEnabled(false); - commentText.setEnabled(true); - Object input = getInput(); - commentText.setText(""); //$NON-NLS-1$ - if (input != null) { - if (input instanceof Comment) - commentText.setText(((Comment) input).getText()); - } - setListenerEnabled(true); - } - - - public void doHandleEvent(Event event) { - Object input = getInput(); - if (input != null) { - String newValue = commentText.getText(); - if (newValue.length() > 0 && input instanceof Comment) { - Comment comment = (Comment) input; - comment.setText(newValue); - } - } - - } - - public boolean shouldUseExtraSpace() { - return true; - } -} diff --git a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/CommentSectionDescriptor.java b/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/CommentSectionDescriptor.java deleted file mode 100644 index cde6eeafd0..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/CommentSectionDescriptor.java +++ /dev/null @@ -1,84 +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.dtd.ui.internal.properties.section; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.wst.common.ui.properties.internal.provisional.ISection; -import org.eclipse.wst.dtd.core.internal.Comment; - -public class CommentSectionDescriptor extends AbstractSectionDescriptor { - /** - * - */ - public CommentSectionDescriptor() { - super(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getId() - */ - public String getId() { - return "org.eclipse.wst.dtd.ui.internal.section.comment"; //$NON-NLS-1$ - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getInputTypes() - */ - public List getInputTypes() { - List list = new ArrayList(); - return list; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getSectionClass() - */ - public ISection getSectionClass() { - return new CommentSection(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getTargetTab() - */ - public String getTargetTab() { - return "org.eclipse.wst.dtd.ui.internal.general"; //$NON-NLS-1$ - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#appliesTo(org.eclipse.ui.IWorkbenchPart, - * org.eclipse.jface.viewers.ISelection) - */ - public boolean appliesTo(IWorkbenchPart part, ISelection selection) { - Object object = null; - if (selection instanceof IStructuredSelection) { - IStructuredSelection structuredSelection = (IStructuredSelection) selection; - object = structuredSelection.getFirstElement(); - if (object instanceof Comment) - return true; - } - return false; - } -} diff --git a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/ContentModelGroupSection.java b/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/ContentModelGroupSection.java deleted file mode 100644 index 8aaff7ab70..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/ContentModelGroupSection.java +++ /dev/null @@ -1,92 +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.dtd.ui.internal.properties.section; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CCombo; -import org.eclipse.swt.custom.CLabel; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.layout.FormAttachment; -import org.eclipse.swt.layout.FormData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.wst.common.ui.properties.internal.provisional.ITabbedPropertyConstants; -import org.eclipse.wst.common.ui.properties.internal.provisional.TabbedPropertySheetWidgetFactory; -import org.eclipse.wst.dtd.core.internal.CMGroupNode; -import org.eclipse.wst.dtd.ui.internal.DTDPropertiesMessages; - -public class ContentModelGroupSection extends AbstractSection { - private final String SEQUENCE = DTDPropertiesMessages._UI_SEQUENCE; - private final String CHOICE = DTDPropertiesMessages._UI_CHOICE; - private final String MODEL_GROUP = DTDPropertiesMessages._UI_LABEL_MODEL_GROUP; - - private CCombo modelGroupCombo; - private String[] modelGroupComboValues = {SEQUENCE, CHOICE}; - - /** - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ITabbedPropertySection#createControls(org.eclipse.swt.widgets.Composite, - * org.eclipse.wst.common.ui.properties.internal.provisional.TabbedPropertySheetWidgetFactory) - */ - public void createControls(Composite parent, TabbedPropertySheetWidgetFactory factory) { - super.createControls(parent, factory); - Composite composite = getWidgetFactory().createFlatFormComposite(parent); - - modelGroupCombo = getWidgetFactory().createCCombo(composite, SWT.FLAT); - FormData data = new FormData(); - data.left = new FormAttachment(0, 100); - data.right = new FormAttachment(100, 0); - data.top = new FormAttachment(0, 0); - modelGroupCombo.setLayoutData(data); - modelGroupCombo.addSelectionListener(this); - modelGroupCombo.setItems(modelGroupComboValues); - - CLabel cLabel = getWidgetFactory().createCLabel(composite, MODEL_GROUP); - data = new FormData(); - data.left = new FormAttachment(0, 0); - data.right = new FormAttachment(modelGroupCombo, -ITabbedPropertyConstants.HSPACE); - data.top = new FormAttachment(modelGroupCombo, 0, SWT.CENTER); - cLabel.setLayoutData(data); - - } - - /* - * @see org.eclipse.wst.common.ui.properties.internal.provisional.view.ITabbedPropertySection#refresh() - */ - public void refresh() { - setListenerEnabled(false); - Object input = getInput(); - if (input != null) { - if (input instanceof CMGroupNode) { - CMGroupNode node = (CMGroupNode) input; - char modelType = node.getConnector(); - if (CMGroupNode.CHOICE == modelType) - modelGroupCombo.setText(CHOICE); - else if (CMGroupNode.SEQUENCE == modelType) - modelGroupCombo.setText(SEQUENCE); - } - } - setListenerEnabled(true); - } - - public void widgetSelected(SelectionEvent e) { - if (e.widget == modelGroupCombo) { - Object input = getInput(); - if (input instanceof CMGroupNode) { - CMGroupNode node = (CMGroupNode) input; - if (CHOICE.equals(modelGroupCombo.getText())) - node.setConnector(CMGroupNode.CHOICE); - else if (SEQUENCE.equals(modelGroupCombo.getText())) - node.setConnector(CMGroupNode.SEQUENCE); - } - } - } - -} diff --git a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/ContentModelGroupSectionDescriptor.java b/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/ContentModelGroupSectionDescriptor.java deleted file mode 100644 index 089acf340f..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/ContentModelGroupSectionDescriptor.java +++ /dev/null @@ -1,78 +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.dtd.ui.internal.properties.section; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.wst.common.ui.properties.internal.provisional.ISection; -import org.eclipse.wst.dtd.core.internal.CMGroupNode; - -public class ContentModelGroupSectionDescriptor extends AbstractSectionDescriptor { - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getId() - */ - public String getId() { - return "org.eclipse.wst.dtd.ui.internal.section.modelgroup"; //$NON-NLS-1$ - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getInputTypes() - */ - public List getInputTypes() { - List list = new ArrayList(); - return list; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getSectionClass() - */ - public ISection getSectionClass() { - return new ContentModelGroupSection(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getTargetTab() - */ - public String getTargetTab() { - return "org.eclipse.wst.dtd.ui.internal.general"; //$NON-NLS-1$ - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#appliesTo(org.eclipse.ui.IWorkbenchPart, - * org.eclipse.jface.viewers.ISelection) - */ - public boolean appliesTo(IWorkbenchPart part, ISelection selection) { - Object object = null; - if (selection instanceof IStructuredSelection) { - IStructuredSelection structuredSelection = (IStructuredSelection) selection; - object = structuredSelection.getFirstElement(); - if (object instanceof CMGroupNode) - return true; - } - return false; - } - -} diff --git a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/ContentModelNameSection.java b/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/ContentModelNameSection.java deleted file mode 100644 index e96b8d6ba8..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/ContentModelNameSection.java +++ /dev/null @@ -1,106 +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.dtd.ui.internal.properties.section; - -import java.util.Iterator; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CCombo; -import org.eclipse.swt.custom.CLabel; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.layout.FormAttachment; -import org.eclipse.swt.layout.FormData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.wst.common.ui.properties.internal.provisional.ITabbedPropertyConstants; -import org.eclipse.wst.common.ui.properties.internal.provisional.TabbedPropertySheetWidgetFactory; -import org.eclipse.wst.dtd.core.internal.CMBasicNode; -import org.eclipse.wst.dtd.core.internal.CMNode; -import org.eclipse.wst.dtd.core.internal.DTDNode; -import org.eclipse.wst.dtd.core.internal.Element; -import org.eclipse.wst.dtd.core.internal.Entity; -import org.eclipse.wst.dtd.ui.internal.DTDPropertiesMessages; - -public class ContentModelNameSection extends AbstractSection { - private final String CONTENT_MODEL = DTDPropertiesMessages._UI_LABEL_CONTENT_MODEL; - - private CCombo typeCombo; - private String[] typeComboValues = {CMNode.PCDATA}; - - /** - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ITabbedPropertySection#createControls(org.eclipse.swt.widgets.Composite, - * org.eclipse.wst.common.ui.properties.internal.provisional.TabbedPropertySheetWidgetFactory) - */ - public void createControls(Composite parent, TabbedPropertySheetWidgetFactory factory) { - super.createControls(parent, factory); - Composite composite = getWidgetFactory().createFlatFormComposite(parent); - - typeCombo = getWidgetFactory().createCCombo(composite, SWT.FLAT | SWT.READ_ONLY); - FormData data = new FormData(); - data.left = new FormAttachment(0, 100); - data.right = new FormAttachment(100, 0); - data.top = new FormAttachment(0, 0); - typeCombo.setLayoutData(data); - typeCombo.addSelectionListener(this); - typeCombo.setItems(typeComboValues); - - CLabel cLabel = getWidgetFactory().createCLabel(composite, CONTENT_MODEL); - data = new FormData(); - data.left = new FormAttachment(0, 0); - data.right = new FormAttachment(typeCombo, -ITabbedPropertyConstants.HSPACE); - data.top = new FormAttachment(typeCombo, 0, SWT.CENTER); - cLabel.setLayoutData(data); - - } - - /* - * @see org.eclipse.wst.common.ui.properties.internal.provisional.view.ITabbedPropertySection#refresh() - */ - public void refresh() { - Object input = getInput(); - - if (input != null) { - if (input instanceof CMBasicNode) { - typeCombo.removeAll(); - typeCombo.add(CMNode.PCDATA); - // NodeList list = - // ((CMBasicNode)fInput).getDTDFile().getElementsAndParameterEntityReferences(); - Iterator iterator = ((CMBasicNode) input).getDTDFile().getNodes().iterator(); - boolean isForRootContent = ((CMBasicNode) input).isRootElementContent(); - while (iterator.hasNext()) { - DTDNode node = (DTDNode) iterator.next(); - if (!isForRootContent && node instanceof Element) - typeCombo.add(node.getName()); - if (node instanceof Entity && ((Entity) node).isParameterEntity()) - typeCombo.add("%" + node.getName() + ";"); //$NON-NLS-1$ //$NON-NLS-2$ - } - - typeCombo.setText(((CMBasicNode) input).getName()); - } - } - } - - public void widgetSelected(SelectionEvent e) { - if (e.widget == typeCombo) { - Object input = getInput(); - if (input instanceof CMBasicNode) { - CMBasicNode node = (CMBasicNode) input; - String selected = typeCombo.getText(); - // if (CMNode.PCDATA.equals(selected)) - node.setName(selected); - } - } - } - - public boolean shouldUseExtraSpace() { - return false; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/ContentModelNameSectionDescriptor.java b/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/ContentModelNameSectionDescriptor.java deleted file mode 100644 index fb6803566d..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/ContentModelNameSectionDescriptor.java +++ /dev/null @@ -1,87 +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.dtd.ui.internal.properties.section; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.wst.common.ui.properties.internal.provisional.ISection; -import org.eclipse.wst.dtd.core.internal.CMBasicNode; - -public class ContentModelNameSectionDescriptor extends AbstractSectionDescriptor { - private ContentModelNameSection contentModelNameSection; - - public ContentModelNameSectionDescriptor() { - super(); - contentModelNameSection = new ContentModelNameSection(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getId() - */ - public String getId() { - return "org.eclipse.wst.dtd.ui.internal.section.contentmodelname"; //$NON-NLS-1$ - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getInputTypes() - */ - public List getInputTypes() { - List list = new ArrayList(); - return list; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getSectionClass() - */ - public ISection getSectionClass() { - return contentModelNameSection; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getTargetTab() - */ - public String getTargetTab() { - return "org.eclipse.wst.dtd.ui.internal.general"; //$NON-NLS-1$ - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#appliesTo(org.eclipse.ui.IWorkbenchPart, - * org.eclipse.jface.viewers.ISelection) - */ - public boolean appliesTo(IWorkbenchPart part, ISelection selection) { - Object object = null; - if (selection instanceof IStructuredSelection) { - IStructuredSelection structuredSelection = (IStructuredSelection) selection; - object = structuredSelection.getFirstElement(); - if (object instanceof CMBasicNode && !((CMBasicNode) object).isRootElementContent()) - return true; - else - return false; - } - return false; - } - -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/ContentModelTypeSection.java b/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/ContentModelTypeSection.java deleted file mode 100644 index ede6580a11..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/ContentModelTypeSection.java +++ /dev/null @@ -1,124 +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.dtd.ui.internal.properties.section; - -import java.util.Iterator; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CCombo; -import org.eclipse.swt.custom.CLabel; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.layout.FormAttachment; -import org.eclipse.swt.layout.FormData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.wst.common.ui.properties.internal.provisional.ITabbedPropertyConstants; -import org.eclipse.wst.common.ui.properties.internal.provisional.TabbedPropertySheetWidgetFactory; -import org.eclipse.wst.dtd.core.internal.CMBasicNode; -import org.eclipse.wst.dtd.core.internal.CMGroupNode; -import org.eclipse.wst.dtd.core.internal.CMNode; -import org.eclipse.wst.dtd.core.internal.DTDNode; -import org.eclipse.wst.dtd.core.internal.Element; -import org.eclipse.wst.dtd.core.internal.Entity; -import org.eclipse.wst.dtd.ui.internal.DTDPropertiesMessages; - -public class ContentModelTypeSection extends AbstractSection { - private final String CONTENT_TYPE = DTDPropertiesMessages._UI_LABEL_CONTENT_TYPE; - - private CCombo typeCombo; - private String[] typeComboValues = {CMNode.ANY, CMNode.EMPTY, CMNode.PCDATA, CMNode.CHILDREN, CMNode.MIXED}; - - /** - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ITabbedPropertySection#createControls(org.eclipse.swt.widgets.Composite, - * org.eclipse.wst.common.ui.properties.internal.provisional.TabbedPropertySheetWidgetFactory) - */ - public void createControls(Composite parent, TabbedPropertySheetWidgetFactory factory) { - super.createControls(parent, factory); - Composite composite = getWidgetFactory().createFlatFormComposite(parent); - FormData data = new FormData(); - data.left = new FormAttachment(0, 0); - data.right = new FormAttachment(100, 0); - data.top = new FormAttachment(0, 0); - data.bottom = new FormAttachment(100, 0); - - typeCombo = getWidgetFactory().createCCombo(composite, SWT.FLAT); - data = new FormData(); - data.left = new FormAttachment(0, 100); - data.right = new FormAttachment(100, 0); - data.top = new FormAttachment(0, 0); - typeCombo.setLayoutData(data); - typeCombo.addSelectionListener(this); - typeCombo.setItems(typeComboValues); - - CLabel cLabel = getWidgetFactory().createCLabel(composite, CONTENT_TYPE); - data = new FormData(); - data.left = new FormAttachment(0, 0); - data.right = new FormAttachment(typeCombo, -ITabbedPropertyConstants.HSPACE); - data.top = new FormAttachment(typeCombo, 0, SWT.CENTER); - cLabel.setLayoutData(data); - - } - - /* - * @see org.eclipse.wst.common.ui.properties.internal.provisional.view.ITabbedPropertySection#refresh() - */ - public void refresh() { - Object input = getInput(); - - if (input != null) { - if (input instanceof CMNode) { - typeCombo.removeAll(); - typeCombo.add(CMNode.ANY); - typeCombo.add(CMNode.EMPTY); - typeCombo.add(CMNode.PCDATA); - typeCombo.add(CMNode.CHILDREN); - typeCombo.add(CMNode.MIXED); - - Iterator iterator = ((CMNode) input).getDTDFile().getNodes().iterator(); - String nodeName = null; - while (iterator.hasNext()) { - DTDNode node = (DTDNode) iterator.next(); - nodeName = node.getName(); - if (node instanceof Element && typeCombo.indexOf(nodeName) == -1) - typeCombo.add(nodeName); - else if (node instanceof Entity && ((Entity) node).isParameterEntity() && typeCombo.indexOf(nodeName) == -1) - typeCombo.add("%" + nodeName + ";"); //$NON-NLS-1$ //$NON-NLS-2$ - } - if (input instanceof CMGroupNode) - typeCombo.setText(((CMGroupNode) input).getType()); - else if (input instanceof CMBasicNode) - typeCombo.setText(((CMBasicNode) input).getType()); - } - } // end if (fInput != null) - } - - public void widgetSelected(SelectionEvent e) { - if (e.widget == typeCombo) { - Object input = getInput(); - if (input instanceof CMGroupNode || input instanceof CMBasicNode) { - CMNode node = (CMNode) input; - String selected = typeCombo.getText(); - if (CMNode.MIXED.equals(selected)) - node.setMixedContent(); - else if (CMNode.CHILDREN.equals(selected)) - node.setChildrenContent(""); //$NON-NLS-1$ - else if (CMNode.EMPTY.equals(selected) || CMNode.ANY.equals(selected) || CMNode.PCDATA.equals(selected)) - node.setContent(selected); - else - node.setChildrenContent(selected); - } - } - } - - public boolean shouldUseExtraSpace() { - return false; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/ContentModelTypeSectionDescriptor.java b/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/ContentModelTypeSectionDescriptor.java deleted file mode 100644 index 5c2ac1cef7..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/ContentModelTypeSectionDescriptor.java +++ /dev/null @@ -1,92 +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.dtd.ui.internal.properties.section; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.wst.common.ui.properties.internal.provisional.ISection; -import org.eclipse.wst.dtd.core.internal.CMBasicNode; -import org.eclipse.wst.dtd.core.internal.CMGroupNode; - -public class ContentModelTypeSectionDescriptor extends AbstractSectionDescriptor { - private ContentModelTypeSection contentModelTypeSection; - - public ContentModelTypeSectionDescriptor() { - super(); - contentModelTypeSection = new ContentModelTypeSection(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getId() - */ - public String getId() { - return "org.eclipse.wst.dtd.ui.internal.section.contentmodeltype"; //$NON-NLS-1$ - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getInputTypes() - */ - public List getInputTypes() { - List list = new ArrayList(); - return list; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getSectionClass() - */ - public ISection getSectionClass() { - return contentModelTypeSection; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getTargetTab() - */ - public String getTargetTab() { - return "org.eclipse.wst.dtd.ui.internal.general"; //$NON-NLS-1$ - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#appliesTo(org.eclipse.ui.IWorkbenchPart, - * org.eclipse.jface.viewers.ISelection) - */ - public boolean appliesTo(IWorkbenchPart part, ISelection selection) { - Object object = null; - if (selection instanceof IStructuredSelection) { - IStructuredSelection structuredSelection = (IStructuredSelection) selection; - object = structuredSelection.getFirstElement(); - if (object instanceof CMGroupNode && ((CMGroupNode) object).isRootElementContent()) - return true; - else if (object instanceof CMBasicNode && ((CMBasicNode) object).isRootElementContent()) // ANY, - // EMPTY, - // PCDATA - return true; - else - return false; - } - return false; - } - -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/DTDSectionDescriptorProvider.java b/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/DTDSectionDescriptorProvider.java deleted file mode 100644 index d838230012..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/DTDSectionDescriptorProvider.java +++ /dev/null @@ -1,44 +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.dtd.ui.internal.properties.section; - -import org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor; -import org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptorProvider; - -public class DTDSectionDescriptorProvider implements ISectionDescriptorProvider { - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptorProvider#getSectionDescriptors() - */ - public ISectionDescriptor[] getSectionDescriptors() { - ISectionDescriptor[] descriptors = new ISectionDescriptor[11]; - - descriptors[0] = new NameSectionDescriptor(); - descriptors[1] = new ContentModelTypeSectionDescriptor(); - descriptors[2] = new TypeSectionDescriptor(); - descriptors[3] = new AttributeDefaultSectionDescriptor(); - descriptors[4] = new ContentModelGroupSectionDescriptor(); - descriptors[5] = new ContentModelNameSectionDescriptor(); - descriptors[6] = new OccurrenceSectionDescriptor(); - descriptors[7] = new CommentSectionDescriptor(); - descriptors[8] = new DocumentSectionDescriptor(); - // descriptors[9] = new EntityTypeSectionDescriptor(); - // descriptors[10]= new EntityValueSectionDescriptor(); - descriptors[9] = new NotationSectionDescriptor(); - descriptors[10] = new NewEntitySectionDescriptor(); - // descriptors[11]= new EmptySectionDescriptor(); - return descriptors; - } - -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/DTDSectionLabelProvider.java b/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/DTDSectionLabelProvider.java deleted file mode 100644 index 1583e3a124..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/DTDSectionLabelProvider.java +++ /dev/null @@ -1,136 +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.dtd.ui.internal.properties.section; - -import org.eclipse.jface.text.TextSelection; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.swt.graphics.Image; -import org.eclipse.wst.dtd.core.internal.Attribute; -import org.eclipse.wst.dtd.core.internal.AttributeList; -import org.eclipse.wst.dtd.core.internal.CMBasicNode; -import org.eclipse.wst.dtd.core.internal.CMGroupNode; -import org.eclipse.wst.dtd.core.internal.CMRepeatableNode; -import org.eclipse.wst.dtd.core.internal.Comment; -import org.eclipse.wst.dtd.core.internal.DTDFile; -import org.eclipse.wst.dtd.core.internal.DTDNode; -import org.eclipse.wst.dtd.core.internal.Element; -import org.eclipse.wst.dtd.core.internal.Entity; -import org.eclipse.wst.dtd.core.internal.Notation; -import org.eclipse.wst.dtd.core.internal.ParameterEntityReference; -import org.eclipse.wst.dtd.ui.internal.DTDPropertiesMessages; - -public class DTDSectionLabelProvider extends LabelProvider { - - /** - * @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object) - */ - public Image getImage(Object object) { - if (object == null || object.equals(StructuredSelection.EMPTY)) { - return null; - } - - Image result = null; - if (object instanceof StructuredSelection) { - Object selected = ((StructuredSelection) object).getFirstElement(); - if (selected instanceof DTDFile) { - return null; // ((DTDFile) selected).getImage(); - } - else if (selected instanceof DTDNode) { - if (selected instanceof ParameterEntityReference) - return null; - return ((DTDNode) selected).getImage(); - } - else if (selected instanceof org.w3c.dom.Element) { - return null; - } - } - return result; - } - - /** - * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object) - */ - public String getText(Object object) { - if (object == null || object.equals(StructuredSelection.EMPTY)) { - return null; - } - - if (object instanceof StructuredSelection) { - Object selected = ((StructuredSelection) object).getFirstElement(); - if (selected instanceof DTDFile) { - return null; // ((DTDFile) selected).getName(); - } - else if (selected instanceof CMBasicNode) { - if (((CMBasicNode) selected).isReference()) - return DTDPropertiesMessages._UI_PROPERTIES_VIEW_TITLE_ELEMENT_REF; - else - return ((CMBasicNode) selected).getName(); - } - else if (selected instanceof CMRepeatableNode) { - CMRepeatableNode node = (CMRepeatableNode) selected; - String name = node.getName(); - if (node instanceof CMGroupNode) { - if (((CMGroupNode) node).getConnector() == CMGroupNode.CHOICE) - name = DTDPropertiesMessages.DTDSectionLabelProvider_0; - else - name = DTDPropertiesMessages.DTDSectionLabelProvider_1; - } - char occurrence = node.getOccurrence(); - switch (occurrence) { - case CMRepeatableNode.ONCE : - name += " [1..1]"; //$NON-NLS-1$ - break; - case CMRepeatableNode.OPTIONAL : - name += " [0..1]"; //$NON-NLS-1$ - break; - case CMRepeatableNode.ONE_OR_MORE : - name += " [1..*]"; //$NON-NLS-1$ - break; - case CMRepeatableNode.ZERO_OR_MORE : - name += " [0..*]"; //$NON-NLS-1$ - break; - } - return name; - } - else if (selected instanceof DTDNode) { - if (selected instanceof Element) - return DTDPropertiesMessages.DTDSectionLabelProvider_6; - else if (selected instanceof Attribute) - return DTDPropertiesMessages.DTDSectionLabelProvider_7; - else if (selected instanceof AttributeList) - return DTDPropertiesMessages.DTDSectionLabelProvider_8; - else if (selected instanceof Comment) - return DTDPropertiesMessages.DTDSectionLabelProvider_9; - else if (selected instanceof Entity) - return DTDPropertiesMessages.DTDSectionLabelProvider_10; - else if (selected instanceof Notation) - return DTDPropertiesMessages.DTDSectionLabelProvider_11; - else if (selected instanceof ParameterEntityReference) - // return "parameter entity reference"; - return null; - else - return ((DTDNode) selected).getName(); - } - else if (selected instanceof org.w3c.dom.Element) { - return ((org.w3c.dom.Element) selected).getLocalName(); - } - else - return ""; //$NON-NLS-1$ - } - else if (object instanceof TextSelection) { - return ""; //$NON-NLS-1$ - } - else - return object.toString(); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/DTDSelectIncludeFileWizard.java b/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/DTDSelectIncludeFileWizard.java deleted file mode 100644 index f315313be4..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/DTDSelectIncludeFileWizard.java +++ /dev/null @@ -1,79 +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.dtd.ui.internal.properties.section; - -import org.eclipse.core.resources.IFile; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.ViewerFilter; -import org.eclipse.jface.wizard.Wizard; -import org.eclipse.ui.INewWizard; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.eclipse.wst.common.ui.internal.viewers.SelectSingleFilePage; -import org.eclipse.wst.dtd.core.internal.emf.DTDResource; -import org.eclipse.wst.dtd.ui.internal.DTDUIPlugin; - -/** - * Extend the base wizard to select a file from the project or outside the - * workbench and add error handling - */ -class DTDSelectIncludeFileWizard extends Wizard implements INewWizard { - DTDSelectSingleFilePage filePage; - - IFile resultFile; - - public DTDSelectIncludeFileWizard(String title, String desc, ViewerFilter filter, IStructuredSelection selection) { - super(); - setWindowTitle(title); - setDefaultPageImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(DTDUIPlugin.getDefault().getBundle().getSymbolicName(), DTDResource.NEWDTD)); - - // Select File Page - filePage = new DTDSelectSingleFilePage(PlatformUI.getWorkbench(), selection, true); - filePage.setTitle(title); - filePage.setDescription(desc); - filePage.addFilter(filter); - } - - public void init(IWorkbench aWorkbench, IStructuredSelection aSelection) { - } - - public void addPages() { - addPage(filePage); - } - - public boolean canFinish() { - return filePage.isPageComplete(); - } - - public boolean performFinish() { - resultFile = filePage.getFile(); - return true; - } - - public IFile getResultFile() { - return resultFile; - } - - /** - * Select DTD File - */ - class DTDSelectSingleFilePage extends SelectSingleFilePage { - public DTDSelectSingleFilePage(IWorkbench w, IStructuredSelection selection, boolean isFileMandatory) { - super(w, selection, isFileMandatory); - } - - public boolean isPageComplete() { - return super.isPageComplete(); - } - } -} diff --git a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/DocumentSection.java b/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/DocumentSection.java deleted file mode 100644 index f913043074..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/DocumentSection.java +++ /dev/null @@ -1,101 +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.dtd.ui.internal.properties.section; - -import java.util.Iterator; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.FormAttachment; -import org.eclipse.swt.layout.FormData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Text; -import org.eclipse.wst.common.ui.properties.internal.provisional.TabbedPropertySheetWidgetFactory; -import org.eclipse.wst.dtd.core.internal.Comment; -import org.eclipse.wst.dtd.core.internal.DTDNode; - -public class DocumentSection extends AbstractSection { - private Text commentText; - - /** - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ITabbedPropertySection#createControls(org.eclipse.swt.widgets.Composite, - * org.eclipse.wst.common.ui.properties.internal.provisional.TabbedPropertySheetWidgetFactory) - */ - public void createControls(Composite parent, TabbedPropertySheetWidgetFactory factory) { - super.createControls(parent, factory); - - Composite composite = getWidgetFactory().createFlatFormComposite(parent); - commentText = getWidgetFactory().createText(composite, "", SWT.MULTI | SWT.NONE); //$NON-NLS-1$ - commentText.addListener(SWT.Modify, this); - - FormData data = new FormData(); - data.left = new FormAttachment(0, 0); - data.right = new FormAttachment(100, 0); - data.top = new FormAttachment(0, 0); - data.bottom = new FormAttachment(100, 0); - commentText.setLayoutData(data); - } - - /* - * @see org.eclipse.wst.common.ui.properties.internal.provisional.view.ITabbedPropertySection#refresh() - */ - public void refresh() { - setListenerEnabled(false); - commentText.setEnabled(true); - Object input = getInput(); - commentText.setText(""); //$NON-NLS-1$ - if (input != null) { - if (input instanceof DTDNode) { - Comment comment = getCommentNode((DTDNode) input); - if (comment != null) - commentText.setText(comment.getText()); - } - } - setListenerEnabled(true); - } - - public void doHandleEvent(Event event) { - Object input = getInput(); - if (input != null) { - String newValue = commentText.getText(); - if (input instanceof DTDNode) { - Comment comment = getCommentNode((DTDNode) input); - if (comment != null) - comment.setText(newValue); - else { - // Create a new comment node. - ((DTDNode) input).getDTDFile().createComment((DTDNode) input, newValue, false); - } - } - } - - } - - private Comment getCommentNode(DTDNode node) { - Iterator iterator = node.getDTDFile().getNodes().iterator(); - DTDNode currentNode = null; - DTDNode prevNode = null; - while (iterator.hasNext()) { - currentNode = (DTDNode) iterator.next(); - if (node == currentNode && prevNode != null && prevNode instanceof Comment) - return (Comment) prevNode; - else - prevNode = currentNode; - } - return null; - } - - public boolean shouldUseExtraSpace() { - return true; - } - -} diff --git a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/DocumentSectionDescriptor.java b/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/DocumentSectionDescriptor.java deleted file mode 100644 index 9f37afbdee..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/DocumentSectionDescriptor.java +++ /dev/null @@ -1,100 +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.dtd.ui.internal.properties.section; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.wst.common.ui.properties.internal.provisional.ISection; -import org.eclipse.wst.dtd.core.internal.AttributeList; -import org.eclipse.wst.dtd.core.internal.Element; -import org.eclipse.wst.dtd.core.internal.Entity; -import org.eclipse.wst.dtd.core.internal.Notation; - -public class DocumentSectionDescriptor extends AbstractSectionDescriptor { - /** - * - */ - public DocumentSectionDescriptor() { - super(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getId() - */ - public String getId() { - return "org.eclipse.wst.dtd.ui.internal.section.document"; //$NON-NLS-1$ - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getInputTypes() - */ - public List getInputTypes() { - List list = new ArrayList(); - return list; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getSectionClass() - */ - public ISection getSectionClass() { - return new DocumentSection(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getTargetTab() - */ - public String getTargetTab() { - return "org.eclipse.wst.dtd.ui.internal.documentation"; //$NON-NLS-1$ - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#appliesTo(org.eclipse.ui.IWorkbenchPart, - * org.eclipse.jface.viewers.ISelection) - */ - public boolean appliesTo(IWorkbenchPart part, ISelection selection) { - Object object = null; - if (selection instanceof IStructuredSelection) { - IStructuredSelection structuredSelection = (IStructuredSelection) selection; - object = structuredSelection.getFirstElement(); - /* - * if (object instanceof DTDNode) { DTDNode node = - * (DTDNode)object; Iterator iterator = - * node.getDTDFile().getNodes().iterator(); DTDNode currentNode = - * null; DTDNode prevNode = null; while (iterator.hasNext()) { - * currentNode = (DTDNode)iterator.next(); if (node == currentNode && - * prevNode != null && prevNode instanceof Comment) return true; - * else prevNode = currentNode; } - * - * return false; } - */ - if (object instanceof Element || object instanceof Entity || object instanceof AttributeList || object instanceof Notation) - return true; - else - return false; - } - return false; - } -} diff --git a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/EmptySection.java b/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/EmptySection.java deleted file mode 100644 index a3d661a87d..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/EmptySection.java +++ /dev/null @@ -1,46 +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.dtd.ui.internal.properties.section; - -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Event; -import org.eclipse.wst.common.ui.properties.internal.provisional.TabbedPropertySheetWidgetFactory; - -public class EmptySection extends AbstractSection { - public void doHandleEvent(Event event) { - super.doHandleEvent(event); - } - - /** - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ITabbedPropertySection#createControls(org.eclipse.swt.widgets.Composite, - * org.eclipse.wst.common.ui.properties.internal.provisional.TabbedPropertySheetWidgetFactory) - */ - public void createControls(Composite parent, TabbedPropertySheetWidgetFactory factory) { - super.createControls(parent, factory); - } - - /* - * @see org.eclipse.wst.common.ui.properties.internal.provisional.view.ITabbedPropertySection#refresh() - */ - public void refresh() { - super.refresh(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISection#shouldUseExtraSpace() - */ - public boolean shouldUseExtraSpace() { - return false; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/EmptySectionDescriptor.java b/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/EmptySectionDescriptor.java deleted file mode 100644 index 594ca8eb1a..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/EmptySectionDescriptor.java +++ /dev/null @@ -1,70 +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.dtd.ui.internal.properties.section; - -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.wst.common.ui.properties.internal.provisional.ISection; -import org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor; -import org.eclipse.wst.dtd.core.internal.DTDFile; -import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion; - -public class EmptySectionDescriptor extends AbstractSectionDescriptor implements ISectionDescriptor { - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getId() - */ - public String getId() { - return "org.eclipse.wst.dtd.ui.internal.section.emptySection"; //$NON-NLS-1$ - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getSectionClass() - */ - public ISection getSectionClass() { - return new EmptySection(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getTargetTab() - */ - public String getTargetTab() { - return "org.eclipse.wst.dtd.ui.internal.general"; //$NON-NLS-1$ - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#appliesTo(org.eclipse.ui.IWorkbenchPart, - * org.eclipse.jface.viewers.ISelection) - */ - public boolean appliesTo(IWorkbenchPart part, ISelection selection) { - Object object = null; - if (selection instanceof IStructuredSelection) { - IStructuredSelection structuredSelection = (IStructuredSelection) selection; - object = structuredSelection.getFirstElement(); - if (object instanceof DTDFile || object instanceof IndexedRegion) - return true; - else - return false; - } - return false; - } - -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/EntityTypeSection.java b/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/EntityTypeSection.java deleted file mode 100644 index e90262ceb1..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/EntityTypeSection.java +++ /dev/null @@ -1,132 +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.dtd.ui.internal.properties.section; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CCombo; -import org.eclipse.swt.custom.CLabel; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.layout.FormAttachment; -import org.eclipse.swt.layout.FormData; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.wst.common.ui.properties.internal.provisional.ITabbedPropertyConstants; -import org.eclipse.wst.common.ui.properties.internal.provisional.TabbedPropertySheetWidgetFactory; -import org.eclipse.wst.dtd.core.internal.Entity; -import org.eclipse.wst.dtd.ui.internal.DTDPropertiesMessages; - -public class EntityTypeSection extends AbstractSection { - private final String ENTITY_TYPE = DTDPropertiesMessages._UI_LABEL_ENTITY_TYPE; - private final String EXTERNAL_ENTITY = DTDPropertiesMessages._UI_LABEL_EXTERNAL_ENTITY; - private final String PARAMETER = DTDPropertiesMessages._UI_LABEL_PARAMETER_ENTITY; - private final String GENERAL = DTDPropertiesMessages._UI_LABEL_GENERAL_ENTITY; - - private CCombo typeCombo; - private String[] typeComboValues = {PARAMETER, GENERAL}; - private Button checkBox; - - public static boolean isExternalEntity = false; - - /** - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ITabbedPropertySection#createControls(org.eclipse.swt.widgets.Composite, - * org.eclipse.wst.common.ui.properties.internal.provisional.TabbedPropertySheetWidgetFactory) - */ - public void createControls(Composite parent, TabbedPropertySheetWidgetFactory factory) { - super.createControls(parent, factory); - Composite composite = getWidgetFactory().createFlatFormComposite(parent); - - typeCombo = getWidgetFactory().createCCombo(composite, SWT.FLAT); - FormData data = new FormData(); - data.left = new FormAttachment(0, 100); - data.right = new FormAttachment(100, 0); - data.top = new FormAttachment(0, 0); - typeCombo.setLayoutData(data); - typeCombo.addSelectionListener(this); - typeCombo.setItems(typeComboValues); - - CLabel cLabel = getWidgetFactory().createCLabel(composite, ENTITY_TYPE); - data = new FormData(); - data.left = new FormAttachment(0, 0); - data.right = new FormAttachment(typeCombo, -ITabbedPropertyConstants.HSPACE); - data.top = new FormAttachment(typeCombo, 0, SWT.CENTER); - cLabel.setLayoutData(data); - - checkBox = getWidgetFactory().createButton(composite, EXTERNAL_ENTITY, SWT.CHECK); - data = new FormData(); - data.left = new FormAttachment(0, 100); - data.right = new FormAttachment(95, 0); - data.top = new FormAttachment(typeCombo, +ITabbedPropertyConstants.VSPACE); - checkBox.setLayoutData(data); - checkBox.addSelectionListener(this); - } - - /* - * @see org.eclipse.wst.common.ui.properties.internal.provisional.view.ITabbedPropertySection#refresh() - */ - public void refresh() { - setListenerEnabled(false); - Object input = getInput(); - - if (input != null) { - if (input instanceof Entity) { - Entity entity = (Entity) input; - if (entity.isParameterEntity()) - typeCombo.setText(PARAMETER); - else - typeCombo.setText(GENERAL); - - if (entity.isExternalEntity()) { - checkBox.setSelection(true); - isExternalEntity = true; - } - else { - checkBox.setSelection(false); - isExternalEntity = false; - } - } - } - setListenerEnabled(true); - } - - public void widgetSelected(SelectionEvent e) { - if (e.widget == typeCombo) { - Object input = getInput(); - if (input instanceof Entity) { - Entity node = (Entity) input; - String selected = typeCombo.getText(); - if (PARAMETER.equals(selected)) - node.setParameterEntity(true); - else - node.setParameterEntity(false); - } - } - else if (e.widget == checkBox) { - Object input = getInput(); - if (input instanceof Entity) { - Entity node = (Entity) input; - boolean selected = checkBox.getSelection(); - if (selected) { - node.setExternalEntity(true); - isExternalEntity = true; - } - else { - node.setExternalEntity(false); - isExternalEntity = false; - } - } - } - } - - public boolean shouldUseExtraSpace() { - return false; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/EntityTypeSectionDescriptor.java b/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/EntityTypeSectionDescriptor.java deleted file mode 100644 index cdd4e96c78..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/EntityTypeSectionDescriptor.java +++ /dev/null @@ -1,87 +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.dtd.ui.internal.properties.section; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.wst.common.ui.properties.internal.provisional.ISection; -import org.eclipse.wst.dtd.core.internal.Entity; - -public class EntityTypeSectionDescriptor extends AbstractSectionDescriptor { - private EntityTypeSection entityTypeSection; - - public EntityTypeSectionDescriptor() { - super(); - entityTypeSection = new EntityTypeSection(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getId() - */ - public String getId() { - return "org.eclipse.wst.dtd.ui.internal.section.entitytype"; //$NON-NLS-1$ - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getInputTypes() - */ - public List getInputTypes() { - List list = new ArrayList(); - return list; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getSectionClass() - */ - public ISection getSectionClass() { - return entityTypeSection; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getTargetTab() - */ - public String getTargetTab() { - return "org.eclipse.wst.dtd.ui.internal.general"; //$NON-NLS-1$ - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#appliesTo(org.eclipse.ui.IWorkbenchPart, - * org.eclipse.jface.viewers.ISelection) - */ - public boolean appliesTo(IWorkbenchPart part, ISelection selection) { - Object object = null; - if (selection instanceof IStructuredSelection) { - IStructuredSelection structuredSelection = (IStructuredSelection) selection; - object = structuredSelection.getFirstElement(); - if (object instanceof Entity) - return true; - else - return false; - } - return false; - } - -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/EntityValueSection.java b/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/EntityValueSection.java deleted file mode 100644 index b65f61bdb1..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/EntityValueSection.java +++ /dev/null @@ -1,173 +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.dtd.ui.internal.properties.section; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CLabel; -import org.eclipse.swt.layout.FormAttachment; -import org.eclipse.swt.layout.FormData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Text; -import org.eclipse.wst.common.ui.properties.internal.provisional.ITabbedPropertyConstants; -import org.eclipse.wst.common.ui.properties.internal.provisional.TabbedPropertySheetWidgetFactory; -import org.eclipse.wst.dtd.core.internal.Entity; -import org.eclipse.wst.dtd.ui.internal.DTDPropertiesMessages; - -public class EntityValueSection extends AbstractSection { - private final String VALUE = DTDPropertiesMessages._UI_LABEL_ENTITY_VALUE; - private final String PUBLIC_ID = DTDPropertiesMessages._UI_LABEL_PUBLIC_ID; - private final String SYSTEM_ID = DTDPropertiesMessages._UI_LABEL_SYSTEM_ID; - - private Text valueText; - private Text publicIdText; - private Text systemIdText; - - private CLabel valueLabel; - private CLabel publicIdLabel; - private CLabel systemIdLabel; - - public void doHandleEvent(Event event) { - if (event.widget == valueText) { - Object input = getInput(); - String newValue = valueText.getText(); - if (input instanceof Entity) { - Entity entity = (Entity) input; - entity.setValue(newValue); - } - } - else if (event.widget == publicIdText) { - Object input = getInput(); - String newValue = publicIdText.getText(); - if (input instanceof Entity) { - Entity entity = (Entity) input; - entity.setPublicID(newValue); - } - } - else if (event.widget == systemIdText) { - Object input = getInput(); - String newValue = systemIdText.getText(); - if (input instanceof Entity) { - Entity entity = (Entity) input; - entity.setSystemID(newValue); - } - } - } - - /** - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ITabbedPropertySection#createControls(org.eclipse.swt.widgets.Composite, - * org.eclipse.wst.common.ui.properties.internal.provisional.TabbedPropertySheetWidgetFactory) - */ - public void createControls(Composite parent, TabbedPropertySheetWidgetFactory factory) { - super.createControls(parent, factory); - Composite composite = getWidgetFactory().createFlatFormComposite(parent); - FormData data; - - // Entity Value - valueText = getWidgetFactory().createText(composite, ""); //$NON-NLS-1$ - data = new FormData(); - data.left = new FormAttachment(0, 100); - data.right = new FormAttachment(100, 0); - data.top = new FormAttachment(0, 0); - valueText.setLayoutData(data); - valueText.addListener(SWT.Modify, this); - - valueLabel = getWidgetFactory().createCLabel(composite, VALUE); - data = new FormData(); - data.left = new FormAttachment(0, 0); - data.right = new FormAttachment(valueText, -ITabbedPropertyConstants.HSPACE); - data.top = new FormAttachment(valueText, 0, SWT.CENTER); - valueLabel.setLayoutData(data); - - // Public ID - publicIdText = getWidgetFactory().createText(composite, ""); //$NON-NLS-1$ - data = new FormData(); - data.left = new FormAttachment(0, 100); - data.right = new FormAttachment(100, 0); - data.top = new FormAttachment(valueText, +ITabbedPropertyConstants.VSPACE); - publicIdText.setLayoutData(data); - publicIdText.addListener(SWT.Modify, this); - - publicIdLabel = getWidgetFactory().createCLabel(composite, PUBLIC_ID); - data = new FormData(); - data.left = new FormAttachment(0, 0); - data.right = new FormAttachment(publicIdText, -ITabbedPropertyConstants.HSPACE); - data.top = new FormAttachment(publicIdText, 0, SWT.CENTER); - publicIdLabel.setLayoutData(data); - - // System ID - systemIdText = getWidgetFactory().createText(composite, ""); //$NON-NLS-1$ - data = new FormData(); - data.left = new FormAttachment(0, 100); - data.right = new FormAttachment(100, 0); - data.top = new FormAttachment(publicIdText, +ITabbedPropertyConstants.VSPACE); - systemIdText.setLayoutData(data); - systemIdText.addListener(SWT.Modify, this); - - systemIdLabel = getWidgetFactory().createCLabel(composite, SYSTEM_ID); - data = new FormData(); - data.left = new FormAttachment(0, 0); - data.right = new FormAttachment(systemIdText, -ITabbedPropertyConstants.HSPACE); - data.top = new FormAttachment(systemIdText, 0, SWT.CENTER); - systemIdLabel.setLayoutData(data); - } - - /* - * @see org.eclipse.wst.common.ui.properties.internal.provisional.view.ITabbedPropertySection#refresh() - */ - public void refresh() { - setListenerEnabled(false); - Object input = getInput(); - if (isExternalEntity()) { - valueLabel.setVisible(false); - valueText.setVisible(false); - publicIdLabel.setVisible(true); - publicIdText.setVisible(true); - systemIdLabel.setVisible(true); - systemIdText.setVisible(true); - - publicIdText.setText(""); //$NON-NLS-1$ - systemIdText.setText(""); //$NON-NLS-1$ - if (input != null && input instanceof Entity) { - Entity entity = (Entity) input; - publicIdText.setText((entity).getPublicID()); - systemIdText.setText((entity).getSystemID()); - } - } - else { - valueLabel.setVisible(true); - valueText.setVisible(true); - publicIdLabel.setVisible(false); - publicIdText.setVisible(false); - systemIdLabel.setVisible(false); - systemIdText.setVisible(false); - - valueText.setText(""); //$NON-NLS-1$ - if (input != null && input instanceof Entity) - valueText.setText(((Entity) input).getValue()); - } - setListenerEnabled(true); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISection#shouldUseExtraSpace() - */ - public boolean shouldUseExtraSpace() { - return false; - } - - private boolean isExternalEntity() { - return EntityTypeSection.isExternalEntity; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/EntityValueSectionDescriptor.java b/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/EntityValueSectionDescriptor.java deleted file mode 100644 index de2b6088a6..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/EntityValueSectionDescriptor.java +++ /dev/null @@ -1,69 +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.dtd.ui.internal.properties.section; - -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.wst.common.ui.properties.internal.provisional.ISection; -import org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor; -import org.eclipse.wst.dtd.core.internal.Entity; - -public class EntityValueSectionDescriptor extends AbstractSectionDescriptor implements ISectionDescriptor { - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getId() - */ - public String getId() { - return "org.eclipse.wst.dtd.ui.internal.section.entityValue"; //$NON-NLS-1$ - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getSectionClass() - */ - public ISection getSectionClass() { - return new EntityValueSection(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getTargetTab() - */ - public String getTargetTab() { - return "org.eclipse.wst.dtd.ui.internal.other"; //$NON-NLS-1$ - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#appliesTo(org.eclipse.ui.IWorkbenchPart, - * org.eclipse.jface.viewers.ISelection) - */ - public boolean appliesTo(IWorkbenchPart part, ISelection selection) { - Object object = null; - if (selection instanceof IStructuredSelection) { - IStructuredSelection structuredSelection = (IStructuredSelection) selection; - object = structuredSelection.getFirstElement(); - if (object instanceof Entity) - return true; - else - return false; - } - return false; - } - -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/NameSection.java b/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/NameSection.java deleted file mode 100644 index 0506fe8298..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/NameSection.java +++ /dev/null @@ -1,92 +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.dtd.ui.internal.properties.section; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CLabel; -import org.eclipse.swt.layout.FormAttachment; -import org.eclipse.swt.layout.FormData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Text; -import org.eclipse.wst.common.ui.properties.internal.provisional.ITabbedPropertyConstants; -import org.eclipse.wst.common.ui.properties.internal.provisional.TabbedPropertySheetWidgetFactory; -import org.eclipse.wst.dtd.core.internal.DTDNode; -import org.eclipse.wst.dtd.ui.internal.DTDPropertiesMessages; - -public class NameSection extends AbstractSection { - private final String NAME = DTDPropertiesMessages._UI_LABEL_NAME; - private Text nameText; - - public void doHandleEvent(Event event) { - if (event.widget == nameText) { - Object input = getInput(); - String newValue = nameText.getText(); - if (newValue.length() > 0 && input instanceof DTDNode) { - DTDNode dtdNode = (DTDNode) input; - dtdNode.setName(newValue); - } - } - } - - /** - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ITabbedPropertySection#createControls(org.eclipse.swt.widgets.Composite, - * org.eclipse.wst.common.ui.properties.internal.provisional.TabbedPropertySheetWidgetFactory) - */ - public void createControls(Composite parent, TabbedPropertySheetWidgetFactory factory) { - super.createControls(parent, factory); - Composite composite = getWidgetFactory().createFlatFormComposite(parent); - FormData data; - - nameText = getWidgetFactory().createText(composite, ""); //$NON-NLS-1$ - data = new FormData(); - data.left = new FormAttachment(0, 100); - data.right = new FormAttachment(100, 0); - data.top = new FormAttachment(0, 0); - nameText.setLayoutData(data); - nameText.addListener(SWT.Modify, this); - - CLabel nameLabel = getWidgetFactory().createCLabel(composite, NAME); - data = new FormData(); - data.left = new FormAttachment(0, 0); - data.right = new FormAttachment(nameText, -ITabbedPropertyConstants.HSPACE); - data.top = new FormAttachment(nameText, 0, SWT.CENTER); - nameLabel.setLayoutData(data); - - // listener.startListeningForEnter(nameText); - // listener.startListeningTo(nameText); - } - - /* - * @see org.eclipse.wst.common.ui.properties.internal.provisional.view.ITabbedPropertySection#refresh() - */ - public void refresh() { - setListenerEnabled(false); - nameText.setEnabled(true); - Object input = getInput(); - nameText.setText(""); //$NON-NLS-1$ - if (input != null) { - if (input instanceof DTDNode) - nameText.setText(((DTDNode) input).getName()); - } - setListenerEnabled(true); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISection#shouldUseExtraSpace() - */ - public boolean shouldUseExtraSpace() { - return false; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/NameSectionDescriptor.java b/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/NameSectionDescriptor.java deleted file mode 100644 index 6c16a63a8e..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/NameSectionDescriptor.java +++ /dev/null @@ -1,84 +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.dtd.ui.internal.properties.section; - -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.wst.common.ui.properties.internal.provisional.ISection; -import org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor; -import org.eclipse.wst.dtd.core.internal.Attribute; -import org.eclipse.wst.dtd.core.internal.AttributeList; -import org.eclipse.wst.dtd.core.internal.Element; -import org.eclipse.wst.dtd.core.internal.Notation; - -public class NameSectionDescriptor extends AbstractSectionDescriptor implements ISectionDescriptor { - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getId() - */ - public String getId() { - return "org.eclipse.wst.dtd.ui.internal.section.name"; //$NON-NLS-1$ - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getInputTypes() - */ - /* - * public List getInputTypes() { List list = new ArrayList(); - * list.add(DTDNode.class); return list; } - */ - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getSectionClass() - */ - public ISection getSectionClass() { - return new NameSection(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getTargetTab() - */ - public String getTargetTab() { - return "org.eclipse.wst.dtd.ui.internal.general"; //$NON-NLS-1$ - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#appliesTo(org.eclipse.ui.IWorkbenchPart, - * org.eclipse.jface.viewers.ISelection) - */ - public boolean appliesTo(IWorkbenchPart part, ISelection selection) { - Object object = null; - if (selection instanceof IStructuredSelection) { - IStructuredSelection structuredSelection = (IStructuredSelection) selection; - object = structuredSelection.getFirstElement(); - if (object instanceof Element - // || object instanceof Entity - || object instanceof Attribute || object instanceof AttributeList || object instanceof Notation) - return true; - else - return false; - } - return false; - } - -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/NewEntitySection.java b/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/NewEntitySection.java deleted file mode 100644 index a6e8a1e956..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/NewEntitySection.java +++ /dev/null @@ -1,365 +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.dtd.ui.internal.properties.section; - -import org.eclipse.core.resources.IFile; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.ViewerFilter; -import org.eclipse.jface.window.Window; -import org.eclipse.jface.wizard.WizardDialog; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CCombo; -import org.eclipse.swt.custom.CLabel; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.layout.FormAttachment; -import org.eclipse.swt.layout.FormData; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.IFileEditorInput; -import org.eclipse.ui.part.PageBook; -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.eclipse.wst.common.ui.internal.viewers.ResourceFilter; -import org.eclipse.wst.common.ui.properties.internal.provisional.ITabbedPropertyConstants; -import org.eclipse.wst.common.ui.properties.internal.provisional.TabbedPropertySheetWidgetFactory; -import org.eclipse.wst.common.uriresolver.internal.util.URIHelper; -import org.eclipse.wst.dtd.core.internal.Entity; -import org.eclipse.wst.dtd.ui.internal.DTDPropertiesMessages; -import org.eclipse.wst.dtd.ui.internal.DTDUIPlugin; - -public class NewEntitySection extends AbstractSection { - private final String NAME = DTDPropertiesMessages._UI_LABEL_NAME; - private final String ENTITY_TYPE = DTDPropertiesMessages._UI_LABEL_ENTITY_TYPE; - private final String EXTERNAL_ENTITY = DTDPropertiesMessages._UI_LABEL_EXTERNAL_ENTITY; - private final String PARAMETER = DTDPropertiesMessages._UI_LABEL_PARAMETER_ENTITY; - private final String GENERAL = DTDPropertiesMessages._UI_LABEL_GENERAL_ENTITY; - private final String VALUE = DTDPropertiesMessages._UI_LABEL_ENTITY_VALUE; - private final String PUBLIC_ID = DTDPropertiesMessages._UI_LABEL_PUBLIC_ID; - private final String SYSTEM_ID = DTDPropertiesMessages._UI_LABEL_SYSTEM_ID; - - private Text systemIdText; - private Text publicIdText; - private Text nameText; - private Button wizardButton; - - private Text entityValueText; - private Button checkBox; - - private CCombo typeCombo; - private String[] typeComboValues = {PARAMETER, GENERAL}; - private PageBook pageBook; - - /** - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ITabbedPropertySection#createControls(org.eclipse.swt.widgets.Composite, - * org.eclipse.wst.common.ui.properties.internal.provisional.TabbedPropertySheetWidgetFactory) - */ - public void createControls(Composite parent, TabbedPropertySheetWidgetFactory factory) { - super.createControls(parent, factory); - Composite composite = getWidgetFactory().createFlatFormComposite(parent); - - createEntityCommonComposite(composite); - - pageBook = new PageBook(composite, SWT.FLAT); - FormData data = new FormData(); - data.left = new FormAttachment(0, 0); - data.right = new FormAttachment(100, 0); - data.top = new FormAttachment(entityCommonComposite, 0); - data.bottom = new FormAttachment(100, 0); - pageBook.setLayoutData(data); - - createExternalEntityComposite(pageBook); - createInternalEntityComposite(pageBook); - - pageBook.showPage(externalEntityComposite); - } - - private Composite entityCommonComposite; - - private Composite createEntityCommonComposite(Composite parent) { - entityCommonComposite = getWidgetFactory().createFlatFormComposite(parent); - FormData data = new FormData(); - data.left = new FormAttachment(0, 0); - data.right = new FormAttachment(100, 0); - data.top = new FormAttachment(0, 0); - entityCommonComposite.setLayoutData(data); - - nameText = getWidgetFactory().createText(entityCommonComposite, "", SWT.NONE); //$NON-NLS-1$ - data = new FormData(); - data.left = new FormAttachment(0, 100); - data.right = new FormAttachment(100, -rightMarginSpace - ITabbedPropertyConstants.HSPACE); - data.top = new FormAttachment(0, 0); - nameText.setLayoutData(data); - nameText.addListener(SWT.Modify, this); - - CLabel nameLabel = getWidgetFactory().createCLabel(entityCommonComposite, NAME); //$NON-NLS-1$ - data = new FormData(); - data.left = new FormAttachment(0, 0); - data.right = new FormAttachment(nameText, +ITabbedPropertyConstants.HSPACE); - data.top = new FormAttachment(nameText, 0, SWT.CENTER); - nameLabel.setLayoutData(data); - - // Create Checkbox - checkBox = getWidgetFactory().createButton(entityCommonComposite, EXTERNAL_ENTITY, SWT.CHECK); //$NON-NLS-1$ - checkBox.addSelectionListener(this); - - // Create CCombo - typeCombo = getWidgetFactory().createCCombo(entityCommonComposite, SWT.FLAT | SWT.READ_ONLY); - typeCombo.addSelectionListener(this); - typeCombo.setItems(typeComboValues); - typeCombo.setText(PARAMETER); - - FormData checkBoxFormData = new FormData(); - checkBoxFormData.left = new FormAttachment(90, -rightMarginSpace + 2); - checkBoxFormData.right = new FormAttachment(100, 0); - checkBoxFormData.top = new FormAttachment(typeCombo, 0, SWT.CENTER); - checkBox.setLayoutData(checkBoxFormData); - - FormData typeComboFormData = new FormData(); - typeComboFormData.left = new FormAttachment(0, 100); - typeComboFormData.right = new FormAttachment(checkBox, 0); - typeComboFormData.top = new FormAttachment(nameText, +ITabbedPropertyConstants.VSPACE); - typeCombo.setLayoutData(typeComboFormData); - - CLabel cLabel = getWidgetFactory().createCLabel(entityCommonComposite, ENTITY_TYPE); - data = new FormData(); - data.left = new FormAttachment(0, 0); - data.right = new FormAttachment(typeCombo, -ITabbedPropertyConstants.HSPACE); - data.top = new FormAttachment(typeCombo, 0, SWT.CENTER); - cLabel.setLayoutData(data); - - return entityCommonComposite; - } - - private Composite internalEntityComposite; - - private Composite createInternalEntityComposite(Composite parent) { - internalEntityComposite = getWidgetFactory().createFlatFormComposite(parent); - FormData data = new FormData(); - data.left = new FormAttachment(0, 0); - data.right = new FormAttachment(100, 0); - data.top = new FormAttachment(entityCommonComposite, +ITabbedPropertyConstants.VSPACE); - // data.bottom = new FormAttachment(100,0); - internalEntityComposite.setLayoutData(data); - - entityValueText = getWidgetFactory().createText(internalEntityComposite, "", SWT.NONE); //$NON-NLS-1$ - entityValueText.setEditable(true); - entityValueText.addListener(SWT.Modify, this); - data = new FormData(); - data.left = new FormAttachment(0, 100); - data.right = new FormAttachment(100, -rightMarginSpace - ITabbedPropertyConstants.HSPACE); - data.top = new FormAttachment(0, 0); - entityValueText.setLayoutData(data); - - CLabel entityValueLabel = getWidgetFactory().createCLabel(internalEntityComposite, VALUE); //$NON-NLS-1$ - data = new FormData(); - data.left = new FormAttachment(0, 0); - data.right = new FormAttachment(entityValueText, 0); - data.top = new FormAttachment(entityValueText, 0, SWT.CENTER); - entityValueLabel.setLayoutData(data); - - return internalEntityComposite; - } - - private Composite externalEntityComposite; - - private Composite createExternalEntityComposite(Composite parent) { - externalEntityComposite = getWidgetFactory().createFlatFormComposite(parent); - FormData data = new FormData(); - data.left = new FormAttachment(0, 0); - data.right = new FormAttachment(100, 0); - data.top = new FormAttachment(entityCommonComposite, +ITabbedPropertyConstants.VSPACE); - // data.bottom = new FormAttachment(100,0); - externalEntityComposite.setLayoutData(data); - - publicIdText = getWidgetFactory().createText(externalEntityComposite, "", SWT.NONE); //$NON-NLS-1$ - publicIdText.setEditable(true); - publicIdText.addListener(SWT.Modify, this); - data = new FormData(); - data.left = new FormAttachment(0, 100); - data.right = new FormAttachment(100, -rightMarginSpace - ITabbedPropertyConstants.HSPACE); - // data.top = new FormAttachment(nameText, - // +ITabbedPropertyConstants.VSPACE); - data.top = new FormAttachment(0, 0); - publicIdText.setLayoutData(data); - - CLabel publicIdLabel = getWidgetFactory().createCLabel(externalEntityComposite, PUBLIC_ID); //$NON-NLS-1$ - data = new FormData(); - data.left = new FormAttachment(0, 0); - data.right = new FormAttachment(publicIdText, 0); - data.top = new FormAttachment(publicIdText, 0, SWT.CENTER); - publicIdLabel.setLayoutData(data); - - // Create Wizard Button - wizardButton = getWidgetFactory().createButton(externalEntityComposite, "", SWT.NONE); //$NON-NLS-1$ - wizardButton.setImage(AbstractUIPlugin.imageDescriptorFromPlugin(DTDUIPlugin.getDefault().getBundle().getSymbolicName(), "icons/browsebutton.gif").createImage()); //$NON-NLS-1$ - - // Create System ID Text - systemIdText = getWidgetFactory().createText(externalEntityComposite, "", SWT.NONE); //$NON-NLS-1$ - // systemIdText.setEditable(false); - - FormData buttonFormData = new FormData(); - buttonFormData.left = new FormAttachment(100, -rightMarginSpace + 2); - buttonFormData.right = new FormAttachment(100, 0); - buttonFormData.top = new FormAttachment(systemIdText, 0, SWT.CENTER); - wizardButton.setLayoutData(buttonFormData); - wizardButton.addSelectionListener(this); - - FormData systemIdData = new FormData(); - systemIdData.left = new FormAttachment(0, 100); - systemIdData.right = new FormAttachment(wizardButton, 0); - systemIdData.top = new FormAttachment(publicIdText, +ITabbedPropertyConstants.VSPACE); - systemIdText.setLayoutData(systemIdData); - systemIdText.addListener(SWT.Modify, this); - - // Create System ID Label - CLabel systemIdLabel = getWidgetFactory().createCLabel(externalEntityComposite, SYSTEM_ID); //$NON-NLS-1$ - data = new FormData(); - data.left = new FormAttachment(0, 0); - data.right = new FormAttachment(systemIdText, 0); - data.top = new FormAttachment(systemIdText, 0, SWT.CENTER); - systemIdLabel.setLayoutData(data); - - return externalEntityComposite; - } - - public void widgetSelected(SelectionEvent e) { - if (e.widget == typeCombo) { - Object input = getInput(); - if (input instanceof Entity) { - Entity node = (Entity) input; - String selected = typeCombo.getText(); - if (PARAMETER.equals(selected)) - node.setParameterEntity(true); - else - node.setParameterEntity(false); - } - } - else if (e.widget == checkBox) { - Object input = getInput(); - if (input instanceof Entity) { - Entity node = (Entity) input; - boolean selected = checkBox.getSelection(); - if (selected) { - node.setExternalEntity(true); - pageBook.showPage(externalEntityComposite); - } - else { - node.setExternalEntity(false); - pageBook.showPage(internalEntityComposite); - } - } - } - else if (e.widget == wizardButton) { - Shell shell = Display.getCurrent().getActiveShell(); - IFile currentIFile = ((IFileEditorInput) getActiveEditor().getEditorInput()).getFile(); - ViewerFilter filter = new ResourceFilter(new String[]{".dtd"}, new IFile[]{currentIFile}, null); //$NON-NLS-1$ - - DTDSelectIncludeFileWizard fileSelectWizard = new DTDSelectIncludeFileWizard(DTDPropertiesMessages._UI_FILEDIALOG_SELECT_DTD, DTDPropertiesMessages._UI_FILEDIALOG_SELECT_DTD_DESC, filter, (IStructuredSelection) fSelection); - - WizardDialog wizardDialog = new WizardDialog(shell, fileSelectWizard); - wizardDialog.create(); - wizardDialog.setBlockOnOpen(true); - int result = wizardDialog.open(); - if (result == Window.OK) { - String value = systemIdText.getText(); - IFile selectedIFile = fileSelectWizard.getResultFile(); - String dtdFileString = value; - if (selectedIFile != null) { - dtdFileString = URIHelper.getRelativeURI(selectedIFile.getFullPath(), currentIFile.getFullPath()); - } - systemIdText.setText(dtdFileString); - } - } - - } - - /** - * @see org.eclipse.wst.common.ui.properties.internal.provisional.view.ITabbedPropertySection#refresh() - */ - public void refresh() { - setListenerEnabled(false); - Object input = getInput(); - nameText.setText(""); //$NON-NLS-1$ - if (input != null) { - if (input instanceof Entity) { - Entity entity = (Entity) input; - nameText.setText(entity.getName()); - - if (entity.isParameterEntity()) - typeCombo.setText(PARAMETER); - else - typeCombo.setText(GENERAL); - - if (entity.isExternalEntity()) { - checkBox.setSelection(true); - pageBook.showPage(externalEntityComposite); - publicIdText.setText(entity.getPublicID()); - systemIdText.setText(entity.getSystemID()); - } - else { - checkBox.setSelection(false); - pageBook.showPage(internalEntityComposite); - entityValueText.setText(entity.getValue()); - } - } - } - setListenerEnabled(true); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISection#shouldUseExtraSpace() - */ - public boolean shouldUseExtraSpace() { - return true; - } - - public void doHandleEvent(Event event) { - if (event.widget == nameText) { - Object input = getInput(); - String newValue = nameText.getText(); - if (newValue.length() > 0 && input instanceof Entity) { - Entity entity = (Entity) input; - entity.setName(newValue); - } - } - else if (event.widget == entityValueText) { - Object input = getInput(); - String newValue = entityValueText.getText(); - if (input instanceof Entity) { - Entity entity = (Entity) input; - entity.setValue(newValue); - } - } - else if (event.widget == publicIdText) { - Object input = getInput(); - String newValue = publicIdText.getText(); - if (input instanceof Entity) { - Entity entity = (Entity) input; - entity.setPublicID(newValue); - } - } - else if (event.widget == systemIdText) { - Object input = getInput(); - String newValue = systemIdText.getText(); - if (input instanceof Entity) { - Entity entity = (Entity) input; - entity.setSystemID(newValue); - } - } - - } -} diff --git a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/NewEntitySectionDescriptor.java b/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/NewEntitySectionDescriptor.java deleted file mode 100644 index a6770774eb..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/NewEntitySectionDescriptor.java +++ /dev/null @@ -1,91 +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.dtd.ui.internal.properties.section; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.wst.common.ui.properties.internal.provisional.ISection; -import org.eclipse.wst.dtd.core.internal.Entity; - -public class NewEntitySectionDescriptor extends AbstractSectionDescriptor { - NewEntitySection entitySection; - - /** - * - */ - public NewEntitySectionDescriptor() { - super(); - entitySection = new NewEntitySection(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getId() - */ - public String getId() { - return "org.eclipse.wst.dtd.ui.internal.section.newEntitySection"; //$NON-NLS-1$ - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getInputTypes() - */ - public List getInputTypes() { - List list = new ArrayList(); - return list; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getSectionClass() - */ - public ISection getSectionClass() { - return entitySection; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getTargetTab() - */ - public String getTargetTab() { - return "org.eclipse.wst.dtd.ui.internal.general"; //$NON-NLS-1$ - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#appliesTo(org.eclipse.ui.IWorkbenchPart, - * org.eclipse.jface.viewers.ISelection) - */ - public boolean appliesTo(IWorkbenchPart part, ISelection selection) { - Object object = null; - - if (selection instanceof IStructuredSelection) { - IStructuredSelection structuredSelection = (IStructuredSelection) selection; - object = structuredSelection.getFirstElement(); - if (object instanceof Entity) - return true; - else - return false; - } - - return false; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/NotationSection.java b/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/NotationSection.java deleted file mode 100644 index 83c3d80821..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/NotationSection.java +++ /dev/null @@ -1,124 +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.dtd.ui.internal.properties.section; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CLabel; -import org.eclipse.swt.layout.FormAttachment; -import org.eclipse.swt.layout.FormData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Text; -import org.eclipse.wst.common.ui.properties.internal.provisional.ITabbedPropertyConstants; -import org.eclipse.wst.common.ui.properties.internal.provisional.TabbedPropertySheetWidgetFactory; -import org.eclipse.wst.dtd.core.internal.Notation; -import org.eclipse.wst.dtd.ui.internal.DTDPropertiesMessages; - -public class NotationSection extends AbstractSection { - private final String PUBLIC_ID = DTDPropertiesMessages._UI_LABEL_PUBLIC_ID; - private final String SYSTEM_ID = DTDPropertiesMessages._UI_LABEL_SYSTEM_ID; - - private Text publicIdText; - private Text systemIdText; - - private CLabel publicIdLabel; - private CLabel systemIdLabel; - - public void doHandleEvent(Event event) { - if (event.widget == publicIdText) { - Object input = getInput(); - String newValue = publicIdText.getText(); - if (input instanceof Notation) { - Notation notation = (Notation) input; - notation.setPublicID(newValue); - } - } - else if (event.widget == systemIdText) { - Object input = getInput(); - String newValue = systemIdText.getText(); - if (input instanceof Notation) { - Notation notation = (Notation) input; - notation.setSystemID(newValue); - } - } - } - - /** - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ITabbedPropertySection#createControls(org.eclipse.swt.widgets.Composite, - * org.eclipse.wst.common.ui.properties.internal.provisional.TabbedPropertySheetWidgetFactory) - */ - public void createControls(Composite parent, TabbedPropertySheetWidgetFactory factory) { - super.createControls(parent, factory); - Composite composite = getWidgetFactory().createFlatFormComposite(parent); - FormData data; - - // Public ID - publicIdText = getWidgetFactory().createText(composite, ""); //$NON-NLS-1$ - data = new FormData(); - data.left = new FormAttachment(0, 100); - data.right = new FormAttachment(100, 0); - data.top = new FormAttachment(0, 0); - publicIdText.setLayoutData(data); - publicIdText.addListener(SWT.Modify, this); - - publicIdLabel = getWidgetFactory().createCLabel(composite, PUBLIC_ID); - data = new FormData(); - data.left = new FormAttachment(0, 0); - data.right = new FormAttachment(publicIdText, -ITabbedPropertyConstants.HSPACE); - data.top = new FormAttachment(publicIdText, 0, SWT.CENTER); - publicIdLabel.setLayoutData(data); - - // System ID - systemIdText = getWidgetFactory().createText(composite, ""); //$NON-NLS-1$ - data = new FormData(); - data.left = new FormAttachment(0, 100); - data.right = new FormAttachment(100, 0); - data.top = new FormAttachment(publicIdText, +ITabbedPropertyConstants.VSPACE); - systemIdText.setLayoutData(data); - systemIdText.addListener(SWT.Modify, this); - - systemIdLabel = getWidgetFactory().createCLabel(composite, SYSTEM_ID); - data = new FormData(); - data.left = new FormAttachment(0, 0); - data.right = new FormAttachment(systemIdText, -ITabbedPropertyConstants.HSPACE); - data.top = new FormAttachment(systemIdText, 0, SWT.CENTER); - systemIdLabel.setLayoutData(data); - } - - /* - * @see org.eclipse.wst.common.ui.properties.internal.provisional.view.ITabbedPropertySection#refresh() - */ - public void refresh() { - setListenerEnabled(false); - Object input = getInput(); - publicIdText.setText(""); //$NON-NLS-1$ - systemIdText.setText(""); //$NON-NLS-1$ - - if (input != null && input instanceof Notation) { - Notation notation = (Notation) input; - publicIdText.setText((notation).getPublicID()); - systemIdText.setText((notation).getSystemID()); - } - - setListenerEnabled(true); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISection#shouldUseExtraSpace() - */ - public boolean shouldUseExtraSpace() { - return false; - } - -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/NotationSectionDescriptor.java b/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/NotationSectionDescriptor.java deleted file mode 100644 index b381e34022..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/NotationSectionDescriptor.java +++ /dev/null @@ -1,69 +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.dtd.ui.internal.properties.section; - -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.wst.common.ui.properties.internal.provisional.ISection; -import org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor; -import org.eclipse.wst.dtd.core.internal.Notation; - -public class NotationSectionDescriptor extends AbstractSectionDescriptor implements ISectionDescriptor { - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getId() - */ - public String getId() { - return "org.eclipse.wst.dtd.ui.internal.section.notation"; //$NON-NLS-1$ - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getSectionClass() - */ - public ISection getSectionClass() { - return new NotationSection(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getTargetTab() - */ - public String getTargetTab() { - return "org.eclipse.wst.dtd.ui.internal.general"; //$NON-NLS-1$ - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#appliesTo(org.eclipse.ui.IWorkbenchPart, - * org.eclipse.jface.viewers.ISelection) - */ - public boolean appliesTo(IWorkbenchPart part, ISelection selection) { - Object object = null; - if (selection instanceof IStructuredSelection) { - IStructuredSelection structuredSelection = (IStructuredSelection) selection; - object = structuredSelection.getFirstElement(); - if (object instanceof Notation) - return true; - else - return false; - } - return false; - } - -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/OccurrenceSection.java b/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/OccurrenceSection.java deleted file mode 100644 index 68f677e914..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/OccurrenceSection.java +++ /dev/null @@ -1,101 +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.dtd.ui.internal.properties.section; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CCombo; -import org.eclipse.swt.custom.CLabel; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.layout.FormAttachment; -import org.eclipse.swt.layout.FormData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.wst.common.ui.properties.internal.provisional.ITabbedPropertyConstants; -import org.eclipse.wst.common.ui.properties.internal.provisional.TabbedPropertySheetWidgetFactory; -import org.eclipse.wst.dtd.core.internal.CMRepeatableNode; -import org.eclipse.wst.dtd.ui.internal.DTDPropertiesMessages; - -public class OccurrenceSection extends AbstractSection { - private final String ONCE = DTDPropertiesMessages._UI_ONCE; - private final String ONE_OR_MORE = DTDPropertiesMessages._UI_ONE_OR_MORE; - private final String OPTIONAL = DTDPropertiesMessages._UI_OPTIONAL; - private final String ZERO_OR_MORE = DTDPropertiesMessages._UI_ZERO_OR_MORE; - private final String OCCURENCE = DTDPropertiesMessages._UI_LABEL_OCCURRENCE; - - private CCombo occurrenceCombo; - private String[] occurrenceComboValues = {ONCE, ONE_OR_MORE, OPTIONAL, ZERO_OR_MORE}; - - /** - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ITabbedPropertySection#createControls(org.eclipse.swt.widgets.Composite, - * org.eclipse.wst.common.ui.properties.internal.provisional.TabbedPropertySheetWidgetFactory) - */ - public void createControls(Composite parent, TabbedPropertySheetWidgetFactory factory) { - super.createControls(parent, factory); - Composite composite = getWidgetFactory().createFlatFormComposite(parent); - - occurrenceCombo = getWidgetFactory().createCCombo(composite, SWT.FLAT); - FormData data = new FormData(); - data.left = new FormAttachment(0, 100); - data.right = new FormAttachment(100, 0); - data.top = new FormAttachment(0, 0); - occurrenceCombo.setLayoutData(data); - occurrenceCombo.addSelectionListener(this); - occurrenceCombo.setItems(occurrenceComboValues); - - CLabel usageLabel = getWidgetFactory().createCLabel(composite, OCCURENCE); - data = new FormData(); - data.left = new FormAttachment(0, 0); - data.right = new FormAttachment(occurrenceCombo, -ITabbedPropertyConstants.HSPACE); - data.top = new FormAttachment(occurrenceCombo, 0, SWT.CENTER); - usageLabel.setLayoutData(data); - } - - /* - * @see org.eclipse.wst.common.ui.properties.internal.provisional.view.ITabbedPropertySection#refresh() - */ - public void refresh() { - setListenerEnabled(false); - Object input = getInput(); - if (input instanceof CMRepeatableNode) { - char occurence = ((CMRepeatableNode) input).getOccurrence(); - if (CMRepeatableNode.ONCE == occurence) - occurrenceCombo.setText(ONCE); - else if (CMRepeatableNode.ONE_OR_MORE == occurence) - occurrenceCombo.setText(ONE_OR_MORE); - else if (CMRepeatableNode.OPTIONAL == occurence) - occurrenceCombo.setText(OPTIONAL); - else if (CMRepeatableNode.ZERO_OR_MORE == occurence) - occurrenceCombo.setText(ZERO_OR_MORE); - else - occurrenceCombo.setText(ONCE); - } - setListenerEnabled(true); - } - - public void widgetSelected(SelectionEvent e) { - Object input = getInput(); - if (input instanceof CMRepeatableNode) { - setListenerEnabled(false); - CMRepeatableNode node = (CMRepeatableNode) input; - String occurrence = occurrenceCombo.getText(); - if (ONCE.equals(occurrence)) - node.setOccurrence(CMRepeatableNode.ONCE); - else if (ONE_OR_MORE.equals(occurrence)) - node.setOccurrence(CMRepeatableNode.ONE_OR_MORE); - else if (OPTIONAL.equals(occurrence)) - node.setOccurrence(CMRepeatableNode.OPTIONAL); - else if (ZERO_OR_MORE.equals(occurrence)) - node.setOccurrence(CMRepeatableNode.ZERO_OR_MORE); - setListenerEnabled(true); - } - } - -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/OccurrenceSectionDescriptor.java b/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/OccurrenceSectionDescriptor.java deleted file mode 100644 index ed334698dc..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/OccurrenceSectionDescriptor.java +++ /dev/null @@ -1,90 +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.dtd.ui.internal.properties.section; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.wst.common.ui.properties.internal.provisional.ISection; -import org.eclipse.wst.dtd.core.internal.CMBasicNode; -import org.eclipse.wst.dtd.core.internal.CMRepeatableNode; - -public class OccurrenceSectionDescriptor extends AbstractSectionDescriptor { - private OccurrenceSection occurenceSection; - - public OccurrenceSectionDescriptor() { - super(); - occurenceSection = new OccurrenceSection(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getId() - */ - public String getId() { - return "org.eclipse.wst.dtd.ui.internal.section.occurence"; //$NON-NLS-1$ - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getInputTypes() - */ - public List getInputTypes() { - List list = new ArrayList(); - return list; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getSectionClass() - */ - public ISection getSectionClass() { - return occurenceSection; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getTargetTab() - */ - public String getTargetTab() { - return "org.eclipse.wst.dtd.ui.internal.general"; //$NON-NLS-1$ - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#appliesTo(org.eclipse.ui.IWorkbenchPart, - * org.eclipse.jface.viewers.ISelection) - */ - public boolean appliesTo(IWorkbenchPart part, ISelection selection) { - Object object = null; - if (selection instanceof IStructuredSelection) { - IStructuredSelection structuredSelection = (IStructuredSelection) selection; - object = structuredSelection.getFirstElement(); - if (object instanceof CMBasicNode && ((CMBasicNode) object).isEmptyAnyOrPCData()) - return false; - else if (object instanceof CMRepeatableNode) - return true; - else - return false; - } - return false; - } - -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/TypeSection.java b/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/TypeSection.java deleted file mode 100644 index 4d436474e1..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/TypeSection.java +++ /dev/null @@ -1,93 +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.dtd.ui.internal.properties.section; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CCombo; -import org.eclipse.swt.custom.CLabel; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.layout.FormAttachment; -import org.eclipse.swt.layout.FormData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.wst.common.ui.properties.internal.provisional.ITabbedPropertyConstants; -import org.eclipse.wst.common.ui.properties.internal.provisional.TabbedPropertySheetWidgetFactory; -import org.eclipse.wst.dtd.core.internal.Attribute; -import org.eclipse.wst.dtd.ui.internal.DTDPropertiesMessages; - -public class TypeSection extends AbstractSection { - private final String TYPE = DTDPropertiesMessages._UI_LABEL_TYPE; - - private CCombo typeCombo; - private String[] typeComboValues = {Attribute.CDATA, Attribute.ID, Attribute.IDREF, Attribute.IDREFS, Attribute.ENTITY, Attribute.ENTITIES, Attribute.NMTOKEN, Attribute.NMTOKENS, Attribute.ENUMERATED_NAME, Attribute.ENUMERATED_NOTATION}; - - /** - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ITabbedPropertySection#createControls(org.eclipse.swt.widgets.Composite, - * org.eclipse.wst.common.ui.properties.internal.provisional.TabbedPropertySheetWidgetFactory) - */ - public void createControls(Composite parent, TabbedPropertySheetWidgetFactory factory) { - super.createControls(parent, factory); - Composite composite = getWidgetFactory().createFlatFormComposite(parent); - FormData data = new FormData(); - data.left = new FormAttachment(0, 0); - data.right = new FormAttachment(100, 0); - data.top = new FormAttachment(0, 0); - data.bottom = new FormAttachment(100, 0); - - typeCombo = getWidgetFactory().createCCombo(composite, SWT.FLAT); - data = new FormData(); - data.left = new FormAttachment(0, 100); - data.right = new FormAttachment(100, 0); - data.top = new FormAttachment(0, 0); - typeCombo.setLayoutData(data); - typeCombo.addSelectionListener(this); - typeCombo.setItems(typeComboValues); - - CLabel cLabel = getWidgetFactory().createCLabel(composite, TYPE); - data = new FormData(); - data.left = new FormAttachment(0, 0); - data.right = new FormAttachment(typeCombo, -ITabbedPropertyConstants.HSPACE); - data.top = new FormAttachment(typeCombo, 0, SWT.CENTER); - cLabel.setLayoutData(data); - - } - - /* - * @see org.eclipse.wst.common.ui.properties.internal.provisional.view.ITabbedPropertySection#refresh() - */ - public void refresh() { - Object input = getInput(); - - if (input != null) { - if (input instanceof Attribute) - typeCombo.setText(((Attribute) input).getType()); - } - - } - - /** - * @see org.eclipse.swt.events.SelectionListener#widgetSelected(SelectionEvent) - */ - public void widgetSelected(SelectionEvent e) { - if (e.widget == typeCombo) { - Object input = getInput(); - if (input instanceof Attribute) { - Attribute attribute = (Attribute) input; - attribute.setType(typeCombo.getText()); - } - } - } - - public boolean shouldUseExtraSpace() { - return false; - } - -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/TypeSectionDescriptor.java b/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/TypeSectionDescriptor.java deleted file mode 100644 index 836d3efc20..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/TypeSectionDescriptor.java +++ /dev/null @@ -1,82 +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.dtd.ui.internal.properties.section; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.wst.common.ui.properties.internal.provisional.ISection; -import org.eclipse.wst.dtd.core.internal.Attribute; - -public class TypeSectionDescriptor extends AbstractSectionDescriptor { - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getId() - */ - public String getId() { - return "org.eclipse.wst.dtd.ui.internal.section.type"; //$NON-NLS-1$ - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getInputTypes() - */ - public List getInputTypes() { - List list = new ArrayList(); - return list; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getSectionClass() - */ - public ISection getSectionClass() { - return new TypeSection(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getTargetTab() - */ - public String getTargetTab() { - return "org.eclipse.wst.dtd.ui.internal.general"; //$NON-NLS-1$ - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#appliesTo(org.eclipse.ui.IWorkbenchPart, - * org.eclipse.jface.viewers.ISelection) - */ - public boolean appliesTo(IWorkbenchPart part, ISelection selection) { - Object object = null; - if (selection instanceof IStructuredSelection) { - IStructuredSelection structuredSelection = (IStructuredSelection) selection; - object = structuredSelection.getFirstElement(); - - if (object instanceof Attribute) - return true; - else - return false; - } - return false; - } - -}
\ No newline at end of file |