Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.wst.xsd.ui/src-adt')
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/actions/AddFieldAction.java77
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/actions/BaseDirectEditAction.java90
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/actions/BaseSelectionAction.java132
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/actions/CaptureScreenAction.java263
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/actions/DeleteAction.java117
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/actions/DesignSelectAll.java75
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/actions/SetInputToGraphView.java74
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/actions/ShowPropertiesViewAction.java56
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/ADTFloatingToolbar.java79
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/BaseGraphicalViewerKeyHandler.java168
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/DesignViewContextMenuProvider.java161
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/DesignViewGraphicalViewer.java449
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/DesignViewerGraphicConstants.java21
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/FlatCCombo.java1490
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/IAnnotationProvider.java17
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/IKeyboardDrag.java19
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/ImageOverlayDescriptor.java60
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/directedit/ADTComboBoxCellEditor.java268
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/directedit/AttributeReferenceDirectEditManager.java38
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/directedit/ComboBoxCellEditorManager.java224
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/directedit/ElementReferenceDirectEditManager.java37
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/directedit/LabelCellEditorLocator.java90
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/directedit/LabelEditManager.java150
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/directedit/ReferenceDirectEditManager.java180
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/directedit/TypeReferenceDirectEditManager.java43
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/ADTEditPartFactory.java102
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/ADTFloatingToolbarEditPart.java227
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/BackToSchemaEditPart.java134
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/BaseEditPart.java300
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/BaseFieldEditPart.java535
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/BaseTypeConnectingEditPart.java207
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/BoxEditPart.java92
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/CenteredConnectionAnchor.java115
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/ColumnEditPart.java127
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/CompartmentEditPart.java217
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/ComplexTypeEditPart.java121
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/EditPartNavigationHandlerUtil.java72
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/FieldEditPart.java21
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/IAutoDirectEdit.java20
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/IConnectionContainer.java16
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/IHolderEditPart.java16
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/INamedEditPart.java21
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/RootContentEditPart.java165
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/RootEditPart.java115
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/RootHolderEditPart.java62
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/SectionEditPart.java38
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/StructureEditPart.java249
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/TopLevelFieldEditPart.java135
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/TypeReferenceConnection.java105
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/AbstractModelCollection.java65
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/Annotation.java37
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/Compartment.java73
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/FocusTypeColumn.java60
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/IActionProvider.java18
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/IFeedbackHandler.java17
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/IGraphElement.java24
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/IModelProxy.java18
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/ReferencedTypeColumn.java138
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/RootHolder.java28
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editpolicies/ADTDirectEditPolicy.java46
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editpolicies/ADTSelectionFeedbackEditPolicy.java52
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editpolicies/DirectEditPolicyDelegate.java18
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editpolicies/IADTUpdateCommand.java18
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editpolicies/KeyBoardAccessibilityEditPolicy.java28
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editpolicies/SimpleDirectEditPolicy.java58
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/figures/IADTFigure.java22
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/figures/ICompartmentFigure.java19
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/figures/IFieldFigure.java23
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/figures/IFigureFactory.java18
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/figures/IStructureFigure.java22
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/edit/ComponentReferenceEditManager.java26
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/edit/ComponentReferenceEditManager2.java19
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/edit/IComponentDialog.java31
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/ADTExternalResourceVariant.java153
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/ADTFileStoreEditorInput.java60
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/ADTMultiPageEditor.java373
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/ADTReadOnlyFileEditorInput.java135
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/CommonMultiPageEditor.java942
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/CommonSelectionManager.java111
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/ContextMenuParticipant.java25
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/EditorMode.java37
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/EditorModeManager.java136
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/IADTEditorInput.java19
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/IEditorModeListener.java16
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/Messages.java54
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/ProductCustomizationProvider.java47
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/messages.properties37
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/facade/IADTObject.java18
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/facade/IADTObjectListener.java16
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/facade/IComplexType.java19
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/facade/IField.java35
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/facade/IModel.java18
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/facade/IStructure.java23
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/facade/IType.java24
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/outline/ADTContentOutlinePage.java339
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/outline/ADTContentOutlineProvider.java149
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/outline/ADTContentOutlineRefreshJob.java143
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/outline/ADTLabelProvider.java79
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/outline/ExtensibleContentOutlinePage.java147
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/outline/ITreeElement.java23
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/properties/ADTTabbedPropertySheetPage.java42
101 files changed, 0 insertions, 11688 deletions
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/actions/AddFieldAction.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/actions/AddFieldAction.java
deleted file mode 100644
index d41124077a..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/actions/AddFieldAction.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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.xsd.ui.internal.adt.actions;
-
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.views.contentoutline.ContentOutline;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDAdapterFactory;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.BaseFieldEditPart;
-import org.eclipse.wst.xsd.ui.internal.adt.editor.Messages;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IComplexType;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IField;
-import org.eclipse.wst.xsd.ui.internal.common.commands.BaseCommand;
-
-
-public class AddFieldAction extends BaseSelectionAction
-{
- public static String ID = "AddFieldAction"; //$NON-NLS-1$
-
- public AddFieldAction(IWorkbenchPart part)
- {
- super(part);
- setId(ID);
- setText(Messages._UI_ACTION_ADD_FIELD);
- }
-
- public void run()
- {
- if (getSelectedObjects().size() > 0)
- {
- Object o = getSelectedObjects().get(0);
- IComplexType type = null;
-
- if (o instanceof IComplexType)
- {
- type = (IComplexType)o;
- }
- else if (o instanceof IField)
- {
- IField field = (IField)o;
- type = field.getContainerType();
- }
- if (type != null)
- {
- Command command = type.getAddNewFieldCommand(""); //$NON-NLS-1$
- if (command != null)
- {
- getCommandStack().execute(command);
- Adapter adapter = XSDAdapterFactory.getInstance().adapt(((BaseCommand)command).getAddedComponent());
- selectAddedComponent(adapter);
- }
- else
- {
- //TODO ... pop up a command not implemented message
- }
- }
- }
- }
-
- protected void doEdit(Object obj, IWorkbenchPart part)
- {
- if (obj instanceof BaseFieldEditPart)
- {
- BaseFieldEditPart editPart = (BaseFieldEditPart)obj;
- editPart.doEditName(!(part instanceof ContentOutline));
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/actions/BaseDirectEditAction.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/actions/BaseDirectEditAction.java
deleted file mode 100644
index 70141bec15..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/actions/BaseDirectEditAction.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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.xsd.ui.internal.adt.actions;
-
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.GraphicalViewer;
-import org.eclipse.gef.ui.actions.DirectEditAction;
-import org.eclipse.gef.ui.parts.AbstractEditPartViewer;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDBaseAdapter;
-
-
-public class BaseDirectEditAction extends DirectEditAction {
- protected ISelectionProvider provider;
-
- /**
- * Same as {@link #DirectEditAction(IWorkbenchPart)}.
- * @param editor the editor
- */
- public BaseDirectEditAction(IEditorPart editor) {
- super((IWorkbenchPart)editor);
- }
-
- /**
- * Constructs a DirectEditAction using the specified part.
- * @param part the workbench part
- */
- public BaseDirectEditAction(IWorkbenchPart part) {
- super(part);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.gef.ui.actions.SelectionAction#getSelection()
- */
- protected ISelection getSelection()
- {
- // always get selection from selection provider first
- if (provider!=null) {
- Object selection = provider.getSelection();
- if (selection instanceof StructuredSelection) {
- Object object = ((StructuredSelection) selection).getFirstElement();
- if (object instanceof XSDBaseAdapter) {
- // We need to return an EditPart as the selection.
- IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
- Object graphicalViewer = editor.getAdapter(GraphicalViewer.class);
- if (graphicalViewer instanceof AbstractEditPartViewer) {
- AbstractEditPartViewer viewer = (AbstractEditPartViewer) graphicalViewer;
- EditPart editPart = (EditPart)viewer.getEditPartRegistry().get(object);
- return new StructuredSelection(editPart);
- }
- }
- }
- }
-
- return super.getSelection();
- }
-
- protected boolean calculateEnabled() {
- Object selection = ((IStructuredSelection) getSelection()).getFirstElement();
-
- if (selection instanceof XSDBaseAdapter) {
- return !((XSDBaseAdapter) selection).isReadOnly();
- }
-
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.gef.ui.actions.SelectionAction#setSelectionProvider(org.eclipse.jface.viewers.ISelectionProvider)
- */
- public void setSelectionProvider(ISelectionProvider provider)
- {
- super.setSelectionProvider(provider);
- this.provider = provider;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/actions/BaseSelectionAction.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/actions/BaseSelectionAction.java
deleted file mode 100644
index e52ea3a1a5..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/actions/BaseSelectionAction.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 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.xsd.ui.internal.adt.actions;
-
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.gef.GraphicalViewer;
-import org.eclipse.gef.ui.actions.SelectionAction;
-import org.eclipse.gef.ui.parts.AbstractEditPartViewer;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.IGraphElement;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IComplexType;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IField;
-
-public abstract class BaseSelectionAction extends SelectionAction
-{
- public static final String SEPARATOR_ID = "org.eclipse.jface.action.Separator"; //$NON-NLS-1$
- public static final String SUBMENU_START_ID = "SUBMENU_START_ID: "; //$NON-NLS-1$
- public static final String SUBMENU_END_ID = "SUBMENU_END_ID: "; //$NON-NLS-1$
-
- protected ISelectionProvider provider;
- protected boolean doDirectEdit = true;
-
- public BaseSelectionAction(IWorkbenchPart part)
- {
- super(part);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.gef.ui.actions.SelectionAction#getSelection()
- */
- protected ISelection getSelection()
- {
- // always get selection from selection provider first
- if (provider!=null)
- return provider.getSelection();
-
- return super.getSelection();
- }
- /* (non-Javadoc)
- * @see org.eclipse.gef.ui.actions.SelectionAction#setSelectionProvider(org.eclipse.jface.viewers.ISelectionProvider)
- */
- public void setSelectionProvider(ISelectionProvider provider)
- {
- super.setSelectionProvider(provider);
- this.provider = provider;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.wst.xsd.ui.internal.adt.actions.BaseSelectionAction#calculateEnabled()
- */
- protected boolean calculateEnabled()
- {
- if (getSelectedObjects().size() > 0)
- {
- Object o = getSelectedObjects().get(0);
- if (o instanceof IComplexType)
- {
- return !((IComplexType)o).isReadOnly();
- }
- else if (o instanceof IField)
- {
- return !((IField)o).isReadOnly();
- }
- else if (o instanceof IGraphElement)
- {
- return !((IGraphElement)o).isReadOnly();
- }
- }
- return true;
- }
-
- protected void selectAddedComponent(final Adapter adapter)
- {
- Runnable runnable = new Runnable()
- {
- public void run()
- {
- if (adapter != null)
- {
- provider.setSelection(new StructuredSelection(adapter));
- if (doDirectEdit)
- activateDirectEdit();
- }
- }
- };
- Display.getCurrent().asyncExec(runnable);
- }
-
- protected void activateDirectEdit()
- {
- if (getWorkbenchPart() instanceof IEditorPart)
- {
- try
- {
- IEditorPart owningEditor = (IEditorPart)getWorkbenchPart();
- IWorkbench workbench = PlatformUI.getWorkbench();
- IWorkbenchPart part = workbench.getActiveWorkbenchWindow().getActivePage().getActivePart();
- Object object = owningEditor.getAdapter(GraphicalViewer.class);
- if (object instanceof AbstractEditPartViewer)
- {
- AbstractEditPartViewer viewer = (AbstractEditPartViewer)object;
- Object obj = viewer.getSelectedEditParts().get(0);
- doEdit(obj, part);
- }
- }
- catch (Exception e)
- {
-
- }
- }
- }
-
- protected void doEdit(Object obj, IWorkbenchPart part)
- {
-
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/actions/CaptureScreenAction.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/actions/CaptureScreenAction.java
deleted file mode 100644
index c0d0430814..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/actions/CaptureScreenAction.java
+++ /dev/null
@@ -1,263 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.xsd.ui.internal.adt.actions;
-
-import java.io.File;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.LayoutManager;
-import org.eclipse.draw2d.SWTGraphics;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.gef.GraphicalViewer;
-import org.eclipse.gef.LayerConstants;
-import org.eclipse.gef.editparts.AbstractGraphicalEditPart;
-import org.eclipse.gef.editparts.LayerManager;
-import org.eclipse.gef.editparts.ScalableRootEditPart;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.ImageData;
-import org.eclipse.swt.graphics.ImageLoader;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.FileDialog;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.wst.xsd.ui.internal.adt.editor.Messages;
-import org.eclipse.wst.xsd.ui.internal.design.layouts.FillLayout;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin;
-
-public class CaptureScreenAction extends Action
-{
-
- private static String LAST_SCREEN_CAPTURE_PATH = System.getProperty("user.home"); //$NON-NLS-1$
- private static String LAST_SCREEN_CAPTURE_FILE_NAME = Messages._UI_ACTION_CAPTURE_SCREEN_DEFAULT_FILE_NAME;
- private static String LAST_SCREEN_CAPTURE_FILE_EXTENSION = ".jpg"; //$NON-NLS-1$
-
- public CaptureScreenAction()
- {
- setText(Messages._UI_CAPTURE_SCREEN_ACTION_TEXT);
- setToolTipText(Messages._UI_CAPTURE_SCREEN_ACTION_TOOLTIPTEXT);
- setImageDescriptor(XSDEditorPlugin.getImageDescriptor("icons/etool16/capturescreen.gif")); //$NON-NLS-1$
- setDisabledImageDescriptor(XSDEditorPlugin.getImageDescriptor("icons/dtool16/capturescreen.gif")); //$NON-NLS-1$
- setAccelerator(SWT.CTRL | SWT.SHIFT | 'X'); //$NON-NLS-1$
- }
-
- public void run()
- {
- ImageExporter imageExporter = new ImageExporter();
- imageExporter.save(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor(), (GraphicalViewer) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor().getAdapter(GraphicalViewer.class));
- }
-
- public class ImageExporter
- {
- private static final String FILE_FORMATS = "*.jpeg;*.jfif;*.jpg;*.jpe;*.png;*.bmp;*.ico"; //$NON-NLS-1$
- private static final String FILE_SEPARATOR = "file.separator"; //$NON-NLS-1$
-
- public boolean save(IEditorPart editorPart, GraphicalViewer viewer, String saveFilePath, int format)
- {
- Assert.isNotNull(editorPart, "null editorPart passed to ImageExporter.save"); //$NON-NLS-1$
- Assert.isNotNull(viewer, "null viewer passed to ImageExporter.save"); //$NON-NLS-1$
- Assert.isNotNull(saveFilePath, "null saveFilePath passed to ImageExporter.save"); //$NON-NLS-1$
-
- if (format != SWT.IMAGE_BMP && format != SWT.IMAGE_JPEG && format != SWT.IMAGE_ICO && format != SWT.IMAGE_PNG)
- throw new IllegalArgumentException(Messages._UI_ACTION_CAPTURE_SCREEN_FORMAT_NOT_SUPPORTED);
-
- try
- {
- saveEditorContentsAsImage(editorPart, viewer, saveFilePath, format);
- }
- catch (Exception ex)
- {
- MessageDialog.openError(editorPart.getEditorSite().getShell(), Messages._UI_ACTION_CAPTURE_SCREEN_ERROR_TITLE, Messages._UI_ACTION_CAPTURE_SCREEN_ERROR_DESCRIPTION);
- return false;
- }
-
- return true;
- }
-
- public boolean save(IEditorPart editorPart, GraphicalViewer viewer)
- {
- Assert.isNotNull(editorPart, "null editorPart passed to ImageExporter.save"); //$NON-NLS-1$
- Assert.isNotNull(viewer, "null viewer passed to ImageExporter.save"); //$NON-NLS-1$
-
- String saveFilePath = getSaveFilePath(editorPart, viewer);
- if (saveFilePath == null)
- return false;
-
- File file = new File(saveFilePath);
- if (file.exists() && file.isFile())
- {
- if (!MessageDialog.openQuestion(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), Messages._UI_ACTION_CAPTURE_SCREEN_OVERWRITE_CONFIRMATION_QUESTION, Messages._UI_ACTION_CAPTURE_SCREEN_OVERWRITE_CONFIRMATION.replace("{0}", saveFilePath))) //$NON-NLS-1$
- {
- return false;
- }
- }
-
- int format = -1;
- String saveFilePathLowerCase = saveFilePath.toLowerCase();
- if (saveFilePathLowerCase.endsWith(".jpeg") || saveFilePathLowerCase.endsWith(".jpg") || saveFilePathLowerCase.endsWith(".jpe") || saveFilePathLowerCase.endsWith(".jfif")) //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- format = SWT.IMAGE_JPEG;
- else if (saveFilePathLowerCase.endsWith(".bmp")) //$NON-NLS-1$
- format = SWT.IMAGE_BMP;
- else if (saveFilePathLowerCase.endsWith(".ico")) //$NON-NLS-1$
- format = SWT.IMAGE_ICO;
- else if (saveFilePathLowerCase.endsWith(".png")) //$NON-NLS-1$
- format = SWT.IMAGE_PNG;
- else if (saveFilePathLowerCase.endsWith(".gif")) //$NON-NLS-1$
- format = SWT.IMAGE_GIF;
-
- if(format != -1) {
- return save(editorPart, viewer, saveFilePath, format);
- } else {
- return false;
- }
-
- }
-
- private String getSaveFilePath(IEditorPart editorPart, GraphicalViewer viewer)
- {
- String filePath;
-
- FileDialog fileDialog = new FileDialog(editorPart.getEditorSite().getShell(), SWT.SAVE);
-
- String[] filterExtensions = new String[] {FILE_FORMATS}; //$NON-NLS-1$
-
- fileDialog.setFileName(obtainNextFileName());
- fileDialog.setFilterExtensions(filterExtensions);
- fileDialog.setFilterNames(new String[] {FILE_FORMATS});
- fileDialog.setText(Messages._UI_ACTION_CAPTURE_SCREEN_FILE_SAVE_DIALOG_TITLE);
-
- filePath = fileDialog.open();
-
- if (filePath != null)
- {
- LAST_SCREEN_CAPTURE_PATH = fileDialog.getFilterPath();
- String fileName = fileDialog.getFileName();
- if (fileName.indexOf('.') > 0) {
- LAST_SCREEN_CAPTURE_FILE_NAME = fileName.substring(0, fileName.indexOf('.'));
- LAST_SCREEN_CAPTURE_FILE_EXTENSION = fileName.substring(fileName.indexOf('.'));
- }
- else
- {
- LAST_SCREEN_CAPTURE_FILE_NAME = fileName;
- LAST_SCREEN_CAPTURE_FILE_EXTENSION = ""; //$NON-NLS-1$
- }
- }
- return filePath;
- }
-
- private void saveEditorContentsAsImage(IEditorPart editorPart, GraphicalViewer viewer, String saveFilePath, int format)
- {
- /*
- * 1. First get the figure whose visuals we want to save as image. So we
- * would like to save the rooteditpart which actually hosts all the
- * printable layers.
- *
- * NOTE: ScalableRootEditPart manages layers and is registered
- * graphicalviewer's editpartregistry with the key LayerManager.ID ...
- * well that is because ScalableRootEditPart manages all layers that are
- * hosted on a FigureCanvas. Many layers exist for doing different things
- */
- ScalableRootEditPart rootEditPart = (ScalableRootEditPart) viewer.getEditPartRegistry().get(LayerManager.ID);
- IFigure rootFigure = ((LayerManager) rootEditPart).getLayer(LayerConstants.PRINTABLE_LAYERS);// rootEditPart.getFigure();
-
- Rectangle rootFigureBounds = new Rectangle(new Point(0,0),rootFigure.getPreferredSize());
- List rootEditPartChildren = rootEditPart.getChildren();
- Iterator rootEditPartChildrenIterator = rootEditPartChildren.iterator();
- while(rootEditPartChildrenIterator.hasNext()) {
- Object object = rootEditPartChildrenIterator.next();
- if(object instanceof AbstractGraphicalEditPart) {
- AbstractGraphicalEditPart childAbstractGraphicalEditPart = (AbstractGraphicalEditPart)object;
- List grandChildren = childAbstractGraphicalEditPart.getChildren();
- Iterator grandChildrenIterator = grandChildren.iterator();
- while(grandChildrenIterator.hasNext()) {
- AbstractGraphicalEditPart grandChildAbstractGraphicalEditPart = (AbstractGraphicalEditPart)grandChildrenIterator.next();
- IFigure figure = grandChildAbstractGraphicalEditPart.getFigure();
- LayoutManager layoutManager = figure.getLayoutManager();
- if(layoutManager instanceof FillLayout) {
- rootFigureBounds = rootFigure.getBounds();
- }
- }
- }
- }
-
- /*
- * 2. Now we want to get the GC associated with the control on which all
- * figures are painted by SWTGraphics. For that first get the SWT Control
- * associated with the viewer on which the rooteditpart is set as contents
- */
- Control figureCanvas = viewer.getControl();
- GC figureCanvasGC = new GC(figureCanvas);
-
- /*
- * 3. Create a new Graphics for an Image onto which we want to paint
- * rootFigure
- */
- Image img = new Image(null, rootFigureBounds.width, rootFigureBounds.height);
- GC imageGC = new GC(img);
- imageGC.setBackground(figureCanvasGC.getBackground());
- imageGC.setForeground(figureCanvasGC.getForeground());
- imageGC.setFont(figureCanvasGC.getFont());
- imageGC.setLineStyle(figureCanvasGC.getLineStyle());
- imageGC.setLineWidth(figureCanvasGC.getLineWidth());
- imageGC.setXORMode(figureCanvasGC.getXORMode());
- Graphics imgGraphics = new SWTGraphics(imageGC);
-
- /* 4. Draw rootFigure onto image. After that image will be ready for save */
- rootFigure.paint(imgGraphics);
-
- /* 5. Save image */
- ImageData[] imgData = new ImageData[1];
- imgData[0] = img.getImageData();
-
- ImageLoader imgLoader = new ImageLoader();
- imgLoader.data = imgData;
- imgLoader.save(saveFilePath, format);
-
- /* release OS resources */
- figureCanvasGC.dispose();
- imageGC.dispose();
- img.dispose();
-
- }
-
- String obtainNextFileName()
- {
-
- int aux = LAST_SCREEN_CAPTURE_FILE_NAME.length() - 1;
- while (Character.isDigit(LAST_SCREEN_CAPTURE_FILE_NAME.charAt(aux)))
- {
- aux--;
- }
-
- String nonNumeratedfileName = LAST_SCREEN_CAPTURE_FILE_NAME.substring(0, aux + 1);
- String filePath = LAST_SCREEN_CAPTURE_PATH + System.getProperty(FILE_SEPARATOR) + nonNumeratedfileName + LAST_SCREEN_CAPTURE_FILE_EXTENSION; //$NON-NLS-1$
-
- int counter = 1;
- File file = new File(filePath);
- while (file.exists())
- {
- filePath = LAST_SCREEN_CAPTURE_PATH + System.getProperty(FILE_SEPARATOR) + nonNumeratedfileName + counter++ + LAST_SCREEN_CAPTURE_FILE_EXTENSION; //$NON-NLS-1$
- file = new File(filePath);
- }
-
- return filePath;
- }
-
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/actions/DeleteAction.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/actions/DeleteAction.java
deleted file mode 100644
index 9a634c1775..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/actions/DeleteAction.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2009 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.xsd.ui.internal.adt.actions;
-
-import java.util.Iterator;
-
-import org.eclipse.gef.GraphicalViewer;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDBaseAdapter;
-import org.eclipse.wst.xsd.ui.internal.adt.design.DesignViewGraphicalViewer;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.IGraphElement;
-import org.eclipse.wst.xsd.ui.internal.adt.editor.Messages;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IModel;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin;
-
-public class DeleteAction extends BaseSelectionAction
-{
- public final static String ID = "org.eclipse.wst.xsd.ui.internal.editor.DeleteAction"; //$NON-NLS-1$
- public DeleteAction(IWorkbenchPart part)
- {
- super(part);
- setText(Messages._UI_ACTION_DELETE);
- setId(ID);
- setImageDescriptor(XSDEditorPlugin.getImageDescriptor("icons/delete_obj.gif") ); //$NON-NLS-1$
- }
-
- public void run()
- {
- for (Iterator i = ((IStructuredSelection) getSelection()).iterator(); i.hasNext(); )
- {
- Object selection = i.next();
- Command command = null;
- boolean doSetInput = false;
- boolean doSetModelAsInput = false;
- IADTObject topLevelContainer = null;
- IModel model = null;
-
- if (selection instanceof IGraphElement)
- {
- IGraphElement xsdObj = (IGraphElement)selection;
-
- if (xsdObj instanceof XSDBaseAdapter)
- {
- XSDBaseAdapter baseAdapter = (XSDBaseAdapter)xsdObj;
-
- // Do not delete selected item if it is read-only, or if the item selected
- // is null and the read only check cannot be completed
- if (baseAdapter == null || baseAdapter.isReadOnly())
- {
- continue;
- }
-
- topLevelContainer = xsdObj.getTopContainer();
- if (topLevelContainer == selection)
- {
- doSetInput = true;
- doSetModelAsInput = true;
- }
- command = xsdObj.getDeleteCommand();
- model = xsdObj.getModel();
- }
- }
-
- if (command != null)
- {
- IWorkbench workbench = PlatformUI.getWorkbench();
- if (workbench != null)
- {
- IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
- if (workbenchWindow != null && workbenchWindow.getActivePage() != null)
- {
- IEditorPart editorPart = workbenchWindow.getActivePage().getActiveEditor();
- if (editorPart != null)
- {
- Object viewer = editorPart.getAdapter(GraphicalViewer.class);
- if (viewer instanceof DesignViewGraphicalViewer)
- {
- Object input = ((DesignViewGraphicalViewer)viewer).getInput();
- if (input != selection)
- {
- // Bug 86218 : Don't switch to top level view if the object we're deleting
- // is not the input to the viewer
- doSetInput = false;
- }
- }
- }
- }
- }
- command.execute();
- if (doSetInput)
- {
- if (model != null && doSetModelAsInput)
- provider.setSelection(new StructuredSelection(model));
- else if (topLevelContainer != null && !doSetModelAsInput)
- provider.setSelection(new StructuredSelection(topLevelContainer));
- }
- }
- }
-
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/actions/DesignSelectAll.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/actions/DesignSelectAll.java
deleted file mode 100644
index 61da6b4ac7..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/actions/DesignSelectAll.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.xsd.ui.internal.adt.actions;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.GraphicalEditPart;
-import org.eclipse.gef.GraphicalViewer;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.actions.ActionFactory;
-import org.eclipse.wst.xsd.ui.internal.adt.editor.CommonMultiPageEditor;
-import org.eclipse.wst.xsd.ui.internal.adt.editor.Messages;
-import org.eclipse.wst.xsd.ui.internal.design.editparts.CategoryEditPart;
-import org.eclipse.wst.xsd.ui.internal.design.editparts.XSDSchemaEditPart;
-
-public class DesignSelectAll extends BaseSelectionAction
-{
- private GraphicalViewer graphicalViewer;
- private List selected;
-
- public DesignSelectAll(IWorkbenchPart part)
- {
- super(part);
- setId(ActionFactory.SELECT_ALL.getId());
- setText(Messages._UI_ACTION_SELECT_ALL);
- }
-
- public void run()
- {
- super.run();
-
- IWorkbenchPart part = getWorkbenchPart();
- selected = new ArrayList();
- if (part instanceof CommonMultiPageEditor)
- {
- graphicalViewer = (GraphicalViewer) ((CommonMultiPageEditor) part).getAdapter(GraphicalViewer.class);
- if (graphicalViewer != null)
- {
- EditPart editPart = graphicalViewer.getContents();
- doSelectChildren(editPart);
-
- graphicalViewer.setSelection(new StructuredSelection(selected));
- }
- }
- }
-
- private void doSelectChildren(EditPart editPart)
- {
- List list = editPart.getChildren();
- for (Iterator i = list.iterator(); i.hasNext();)
- {
- Object o = i.next();
- if (o instanceof GraphicalEditPart)
- {
- if (!(o instanceof XSDSchemaEditPart) && !(o instanceof CategoryEditPart))
- {
- selected.add(o);
- }
- doSelectChildren((GraphicalEditPart) o);
- }
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/actions/SetInputToGraphView.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/actions/SetInputToGraphView.java
deleted file mode 100644
index c5f9301298..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/actions/SetInputToGraphView.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 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.xsd.ui.internal.adt.actions;
-
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.GraphicalViewer;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.wst.xsd.ui.internal.adt.design.DesignViewGraphicalViewer;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.RootContentEditPart;
-import org.eclipse.wst.xsd.ui.internal.adt.editor.Messages;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject;
-
-public class SetInputToGraphView extends BaseSelectionAction
-{
- public static String ID = "SetAsFocus"; //$NON-NLS-1$
- protected IEditorPart editorPart;
- protected Object input;
-
- public SetInputToGraphView(IWorkbenchPart part)
- {
- this(part, null);
- }
-
- public SetInputToGraphView(IWorkbenchPart part, Object input)
- {
- super(part);
- this.input = input;
- setId(ID);
- setText(Messages._UI_ACTION_SET_AS_FOCUS);
- if (part instanceof IEditorPart)
- {
- editorPart = (IEditorPart)part;
- }
- }
-
- protected boolean calculateEnabled()
- {
- return true;
- }
-
- public void run()
- {
- Object selection = input;
- if (selection == null)
- {
- selection = ((IStructuredSelection) getSelection()).getFirstElement();
- }
- Object adapter = getWorkbenchPart().getAdapter(GraphicalViewer.class);
-
- if (selection instanceof IADTObject)
- {
- IADTObject obj = (IADTObject) selection;
- if (adapter instanceof DesignViewGraphicalViewer)
- {
- DesignViewGraphicalViewer graphicalViewer = (DesignViewGraphicalViewer) adapter;
- EditPart editPart = graphicalViewer.getInputEditPart();
- if (editPart instanceof RootContentEditPart)
- {
- graphicalViewer.setInputAndMarkLocation(obj);
- }
- }
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/actions/ShowPropertiesViewAction.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/actions/ShowPropertiesViewAction.java
deleted file mode 100644
index e3d232f072..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/actions/ShowPropertiesViewAction.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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.xsd.ui.internal.adt.actions;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.wst.xsd.ui.internal.adt.editor.Messages;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin;
-
-
-/**
- * Show the properties view in the current perspective.
- */
-public class ShowPropertiesViewAction extends BaseSelectionAction
-{
- public static final String ID = "org.eclipse.wst.xsd.ui.internal.adt.actions.ShowPropertiesViewAction"; //$NON-NLS-1$
- public static final String PROPERTIES_VIEW_ID = "org.eclipse.ui.views.PropertySheet"; //$NON-NLS-1$
-
- protected static ImageDescriptor enabledImage, disabledImage;
-
- public ShowPropertiesViewAction(IWorkbenchPart part)
- {
- super(part);
- setId(ID);
- setText(Messages._UI_ACTION_SHOW_PROPERTIES);
- setToolTipText(getText());
- setImageDescriptor(XSDEditorPlugin.getImageDescriptor("icons/elcl16/showproperties_obj.gif") ); //$NON-NLS-1$
- setDisabledImageDescriptor(XSDEditorPlugin.getImageDescriptor("icons/dlcl16/showproperties_obj.gif") ); //$NON-NLS-1$
- }
-
- protected boolean calculateEnabled()
- {
- return true;
- }
-
- public void run()
- {
- try
- {
- getWorkbenchPart().getSite().getPage().showView(PROPERTIES_VIEW_ID);
- }
- catch (PartInitException pie)
- {
-
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/ADTFloatingToolbar.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/ADTFloatingToolbar.java
deleted file mode 100644
index b827ca52e7..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/ADTFloatingToolbar.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.adt.design;
-
-import org.eclipse.draw2d.ColorConstants;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.ui.parts.GraphicalViewerImpl;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Canvas;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.ADTFloatingToolbarEditPart;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IModel;
-
-public class ADTFloatingToolbar extends GraphicalViewerImpl
-{
- protected IModel model;
- protected boolean isDrilledDown;
- protected ADTFloatingToolbarEditPart editPart;
-
- public ADTFloatingToolbar(IModel model)
- {
- this.model = model;
- }
-
- public void setModel(IModel model)
- {
- this.model = model;
- editPart = (ADTFloatingToolbarEditPart)getEditPartFactory().createEditPart(null, new ADTFloatingToolbarModel(model));
- if (editPart == null)
- {
- editPart = new ADTFloatingToolbarEditPart(model);
- }
- editPart.setModel(model);
- setContents(editPart);
- }
-
- public Control createControl(Composite composite)
- {
- Canvas canvas = new Canvas(composite, SWT.NONE);
- canvas.setBackground(ColorConstants.white);
- setControl(canvas);
- return getControl();
- }
-
- public void refresh(boolean isDrilledDown)
- {
- this.isDrilledDown = isDrilledDown;
- if (editPart != null) {
- editPart.setIsDrilledDown(isDrilledDown);
- }
- EditPart contents = getContents();
- if (contents != null) {
- contents.refresh();
- }
- }
-
- public class ADTFloatingToolbarModel
- {
- IModel model;
- public ADTFloatingToolbarModel(IModel model)
- {
- this.model = model;
- }
-
- public IModel getModel()
- {
- return model;
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/BaseGraphicalViewerKeyHandler.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/BaseGraphicalViewerKeyHandler.java
deleted file mode 100644
index dfc4e82478..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/BaseGraphicalViewerKeyHandler.java
+++ /dev/null
@@ -1,168 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 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.xsd.ui.internal.adt.design;
-
-import org.eclipse.draw2d.FigureCanvas;
-import org.eclipse.draw2d.PositionConstants;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.GraphicalEditPart;
-import org.eclipse.gef.GraphicalViewer;
-import org.eclipse.gef.ui.actions.ActionRegistry;
-import org.eclipse.gef.ui.parts.GraphicalViewerKeyHandler;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editpolicies.KeyBoardAccessibilityEditPolicy;
-import org.eclipse.wst.xsd.ui.internal.common.actions.OpenInNewEditor;
-
-/**
- * This key handler is designed to be re-used by both the WSDL and XSD editor
- */
-public class BaseGraphicalViewerKeyHandler extends GraphicalViewerKeyHandler
-{
- public BaseGraphicalViewerKeyHandler(GraphicalViewer viewer)
- {
- super(viewer);
- }
-
- public boolean keyPressed(KeyEvent event)
- {
- int direction = -1;
- boolean isAltDown = (event.stateMask & SWT.ALT) != 0;
- boolean isCtrlDown = (event.stateMask & SWT.CTRL) != 0;
- switch (event.keyCode)
- {
- case SWT.ARROW_LEFT : {
- direction = PositionConstants.WEST;
- break;
- }
- case SWT.ARROW_RIGHT : {
- direction = PositionConstants.EAST;
- break;
- }
- case SWT.ARROW_UP : {
- direction = isAltDown ? KeyBoardAccessibilityEditPolicy.OUT_TO_PARENT : PositionConstants.NORTH;
- break;
- }
- case SWT.ARROW_DOWN : {
- direction = isAltDown ? KeyBoardAccessibilityEditPolicy.IN_TO_FIRST_CHILD : PositionConstants.SOUTH;
- break;
- }
- }
-
- if (direction != -1)
- {
- GraphicalEditPart focusEditPart = getFocusEditPart();
- KeyBoardAccessibilityEditPolicy policy = (KeyBoardAccessibilityEditPolicy)focusEditPart.getEditPolicy(KeyBoardAccessibilityEditPolicy.KEY);
-
- if (policy != null)
- {
- EditPart target = policy.getRelativeEditPart(focusEditPart, direction);
- if (target != null)
- {
- if(isCtrlDown) {
-
- IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
- Object keyboardDrag = editor.getAdapter(IKeyboardDrag.class);
- if (keyboardDrag instanceof IKeyboardDrag) {
- ((IKeyboardDrag) keyboardDrag).performKeyboardDrag(focusEditPart, direction);
- return true;
- }
- }
- else {
- navigateTo(target, event);
- return true;
- }
- }
- }
- }
-
- switch (event.keyCode)
- {
- case SWT.PAGE_DOWN :
- {
- if (scrollPage(event, PositionConstants.SOUTH))
- return true;
- }
- case SWT.PAGE_UP :
- {
- if (scrollPage(event, PositionConstants.NORTH))
- return true;
- }
- case SWT.F3 :
- case SWT.CR :
- {
- IWorkbench workbench = PlatformUI.getWorkbench();
- IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
- IEditorPart editorPart = workbenchWindow.getActivePage().getActiveEditor();
- ActionRegistry registry = (ActionRegistry) editorPart.getAdapter(ActionRegistry.class);
- if (registry != null)
- {
- IAction action = registry.getAction(OpenInNewEditor.ID);
- if (action != null)
- action.run();
- }
- }
- /*
- case SWT.F5 :
- {
- IEditorPart part = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
- if (part != null)
- {
- EditorModeManager manager = (EditorModeManager)part.getAdapter(EditorModeManager.class);
- EditorMode[] modes = manager.getModes();
- EditorMode mode = manager.getCurrentMode();
- List list = Arrays.asList(modes);
- int index = list.indexOf(mode);
- int nextIndex = index + 1;
- if (nextIndex < modes.length)
- {
- mode = (EditorMode)list.get(nextIndex);
- }
- else
- {
- mode = (EditorMode)list.get(0);
- }
- if (mode != manager.getCurrentMode())
- {
- manager.setCurrentMode(mode);
- }
- }
- return true;
- }*/
- }
- return super.keyPressed(event);
- }
-
- private boolean scrollPage(KeyEvent event, int direction)
- {
- if (!(getViewer().getControl() instanceof FigureCanvas))
- return false;
- FigureCanvas figCanvas = (FigureCanvas) getViewer().getControl();
- Point loc = figCanvas.getViewport().getViewLocation();
- Rectangle area = figCanvas.getViewport().getClientArea(Rectangle.SINGLETON).scale(.8);
- if (direction == PositionConstants.NORTH)
- {
- figCanvas.scrollToY(loc.y - area.height);
- }
- else
- {
- figCanvas.scrollToY(loc.y + area.height);
- }
- return true;
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/DesignViewContextMenuProvider.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/DesignViewContextMenuProvider.java
deleted file mode 100644
index a13e440666..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/DesignViewContextMenuProvider.java
+++ /dev/null
@@ -1,161 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.adt.design;
-
-import org.eclipse.gef.ContextMenuProvider;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.EditPartViewer;
-import org.eclipse.gef.commands.CommandStack;
-import org.eclipse.gef.ui.actions.ActionRegistry;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IContributionItem;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.wst.xsd.ui.internal.adt.actions.BaseSelectionAction;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.IActionProvider;
-import org.eclipse.wst.xsd.ui.internal.adt.editor.ContextMenuParticipant;
-import org.eclipse.wst.xsd.ui.internal.adt.editor.EditorModeManager;
-import org.eclipse.wst.xsd.ui.internal.adt.editor.Messages;
-import org.eclipse.wst.xsd.ui.internal.refactor.IXSDRefactorConstants;
-
-
-public class DesignViewContextMenuProvider extends ContextMenuProvider
-{
- IEditorPart editor;
- ISelectionProvider selectionProvider;
-
- /**
- * Constructor for GraphContextMenuProvider.
- *
- * @param selectionProvider
- * @param editor
- */
- public DesignViewContextMenuProvider(IEditorPart editor, EditPartViewer viewer, ISelectionProvider selectionProvider)
- {
- super(viewer);
- this.editor = editor;
- this.selectionProvider = selectionProvider;
- }
-
- /**
- * @see org.eclipse.gef.ui.parts.ContextMenuProvider#buildContextMenu(org.eclipse.jface.action.IMenuManager,
- * org.eclipse.gef.EditPartViewer)
- */
- public void buildContextMenu(IMenuManager menu)
- {
- IMenuManager currentMenu = menu;
-
- EditorModeManager manager = (EditorModeManager)editor.getAdapter(EditorModeManager.class);
- ContextMenuParticipant contextMenuParticipant = manager != null ? manager.getCurrentMode().getContextMenuParticipant() : null;
-
- menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
- ActionRegistry registry = getEditorActionRegistry();
- ISelection selection = selectionProvider.getSelection();
-
- if (selection != null)
- {
- Object selectedObject = ((StructuredSelection) selection).getFirstElement();
-
- // Convert editparts to model objects as selections
- if (selectedObject instanceof EditPart)
- {
- selectedObject = ((EditPart)selectedObject).getModel();
- }
-
- if (selectedObject instanceof IActionProvider)
- {
- IActionProvider actionProvider = (IActionProvider) selectedObject;
-
- String[] actions = actionProvider.getActions(null);
- for (int i = 0; i < actions.length; i++)
- {
- String id = actions[i];
- if (contextMenuParticipant == null || contextMenuParticipant.isApplicable(selectedObject, id))
- {
- if (id.startsWith(BaseSelectionAction.SUBMENU_START_ID))
- {
- String text = id.substring(BaseSelectionAction.SUBMENU_START_ID.length());
- IMenuManager subMenu = new MenuManager(text);
- currentMenu.add(subMenu);
- currentMenu = subMenu;
- }
- else if (id.startsWith(BaseSelectionAction.SUBMENU_END_ID))
- {
- currentMenu = getParentMenu(menu, currentMenu);
- }
- else if (id.equals(BaseSelectionAction.SEPARATOR_ID))
- {
- currentMenu.add(new Separator());
- }
- else
- {
- IAction action = registry.getAction(id);
- if (action != null)
- {
- action.isEnabled();
- currentMenu.add(action);
- }
- }
- }
- }
- menu.add(new Separator());
- IMenuManager subMenu = new MenuManager(Messages._UI_REFACTOR_CONTEXT_MENU, IXSDRefactorConstants.REFACTOR_CONTEXT_MENU_ID); //$NON-NLS-1$
- menu.add(subMenu);
- menu.add(new Separator());
- menu.add(new Separator("search-slot")); //$NON-NLS-1$
- menu.add(new Separator());
- menu.add(new Separator("endDesignMenu-slot")); // $NON-NLS-1$
- menu.add(new Separator());
- }
- }
- menu.add(new Separator());
- }
-
- protected IMenuManager getParentMenu(IMenuManager root, IMenuManager child) {
- IMenuManager parent = null;
-
- IContributionItem[] kids = root.getItems();
- int index = 0;
- while (index < kids.length && parent == null) {
- IContributionItem item = kids[index];
- if (item.equals(child)) {
- parent = root;
- }
- else {
- if (item instanceof IMenuManager) {
- parent = getParentMenu((IMenuManager) item, child);
- }
- }
- index++;
- }
-
- return parent;
- }
-
- protected ActionRegistry getEditorActionRegistry()
- {
- return (ActionRegistry) editor.getAdapter(ActionRegistry.class);
- }
- protected CommandStack commandStack;
-
- protected CommandStack getCommandStack()
- {
- if (commandStack == null)
- commandStack = getViewer().getEditDomain().getCommandStack();
- return commandStack;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/DesignViewGraphicalViewer.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/DesignViewGraphicalViewer.java
deleted file mode 100644
index 381415ca8c..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/DesignViewGraphicalViewer.java
+++ /dev/null
@@ -1,449 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2009 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.xsd.ui.internal.adt.design;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.ui.parts.ScrollingGraphicalViewer;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.INavigationHistory;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.wst.xsd.ui.internal.adapters.RedefineCategoryAdapter;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDRedefineAdapter;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.IHolderEditPart;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.RootContentEditPart;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.StructureEditPart;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.IGraphElement;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.IModelProxy;
-import org.eclipse.wst.xsd.ui.internal.adt.editor.CommonSelectionManager;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IField;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IModel;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IStructure;
-import org.eclipse.wst.xsd.ui.internal.adt.outline.ADTContentOutlinePage;
-
-public class DesignViewGraphicalViewer extends ScrollingGraphicalViewer implements ISelectionChangedListener
-{
- protected ADTSelectionChangedListener internalSelectionProvider = new ADTSelectionChangedListener();
- protected InputChangeManager inputChangeManager = new InputChangeManager();
- private IEditorPart editorPart;
-
- public DesignViewGraphicalViewer(IEditorPart editor, CommonSelectionManager manager)
- {
- super();
- this.editorPart = editor;
- setContextMenu(new DesignViewContextMenuProvider(editor, this, this));
- editor.getEditorSite().registerContextMenu("org.eclipse.wst.xsd.ui.popup.graph", getContextMenu(), internalSelectionProvider, false); //$NON-NLS-1$
-
- // make the internalSelectionProvider listen to graph view selection changes
- addSelectionChangedListener(internalSelectionProvider);
- internalSelectionProvider.addSelectionChangedListener(manager);
- manager.addSelectionChangedListener(this);
-
- setKeyHandler(new BaseGraphicalViewerKeyHandler(this));
- }
-
-
- // this method is called when something changes in the selection manager
- // (e.g. a selection occured from another view)
- public void selectionChanged(SelectionChangedEvent event)
- {
- Object selectedObject = null;
- ISelection eventSelection = event.getSelection();
- if (eventSelection instanceof StructuredSelection)
- {
- selectedObject = ((StructuredSelection) eventSelection).getFirstElement();
- }
- // TODO (cs) It seems like there's way more selection going on than there
- // should
- // be!! There's at least 2 selections getting fired when something is
- // selected in the
- // outline view. Are we listening to too many things?
- //
- // if (event.getSource() instanceof ADTContentOutlinePage)
- if (selectedObject != null)
- {
- if (event.getSource() != internalSelectionProvider)
- {
- if (selectedObject instanceof IStructure)
- {
- if (((getInput() instanceof IModel) && (event.getSource() instanceof ADTContentOutlinePage)) ||
- (!(getInput() instanceof IModel)))
- {
- if ((selectedObject instanceof IGraphElement) && ((IGraphElement)selectedObject).isFocusAllowed())
- {
- if (!(event.getSource() instanceof org.eclipse.jface.viewers.IPostSelectionProvider))
- {
- setInputAndMarkLocation((IStructure)selectedObject);
- }
- }
- }
- }
- else if (selectedObject instanceof IGraphElement)
- {
- if (((IGraphElement)selectedObject).isFocusAllowed() && ((event.getSource() instanceof ADTContentOutlinePage)))
- {
- setInputAndMarkLocation((IADTObject)selectedObject);
- }
- else if (!((IGraphElement)selectedObject).isFocusAllowed())
- {
- // We encountered an object that is not a valid input to the graph viewer
- // Now find the top container that can be a valid input
- IADTObject obj = ((IGraphElement)selectedObject).getTopContainer();
- if (event.getSource() instanceof ADTContentOutlinePage)
- {
- // In this case, if the selection is originated from the outline, we should
- // change the inputs
- if (obj != null && getInput() != obj) // Don't change inputs if the obj is already the input
- setInputAndMarkLocation(obj);
- }
- else if (event.getSource() instanceof CommonSelectionManager)
- {
- // In this case, if the selection is originated from some action, ie. adding
- // a new element, we should change the input only if the current input is the model
- // otherwise, inputs will change unexpectedly!!
- if (getInput() instanceof IModel)
- {
- if (obj != null)
- setInput (obj);
- }
- }
- else if (event.getSource() instanceof org.eclipse.jface.viewers.IPostSelectionProvider )
- {
- // In this case, if the selection is originated from the source viewer
- // we should change the input regardless. Test is for multiple levels
- // of anonymous types
- if (obj != null)
- setInput (obj);
- }
- else
- {
- if (obj != null && getInput() instanceof IModel)
- setInputAndMarkLocation(obj);
- }
- }
- if (selectedObject instanceof IField)
- {
- IField field = (IField)selectedObject;
- if ( (!field.isGlobal() && getInput() instanceof IModel) ||
- (!field.isGlobal() && !(event.getSource() instanceof CommonSelectionManager)))
- {
- IADTObject obj = ((IGraphElement)selectedObject).getTopContainer();
- if (obj != null)
- setInputAndMarkLocation(obj);
- }
- else if (field.isGlobal() && !(getInput() instanceof IModel))
- {
- if (event.getSource() instanceof org.eclipse.jface.viewers.IPostSelectionProvider )
- setInput(field);
- else
- setInputAndMarkLocation(field);
- }
- }
- }
- else if (selectedObject instanceof IField)
- {
- IField field = (IField)selectedObject;
- if ( (field.isGlobal() && (getInput() instanceof IModel) && (event.getSource() instanceof ADTContentOutlinePage)) ||
- ( (field.isGlobal() && !(getInput() instanceof IModel))))
- {
- setInputAndMarkLocation(field);
- }
- }
- else if (selectedObject instanceof IModelProxy)
- {
- IModelProxy adapter = (IModelProxy)selectedObject;
- if (selectedObject instanceof RedefineCategoryAdapter)
- {
- RedefineCategoryAdapter selectionAdapter = (RedefineCategoryAdapter)selectedObject;
- XSDRedefineAdapter selectionParentAdapter = selectionAdapter.getXsdRedefineAdapter();
- setInputAndMarkLocation(selectionParentAdapter);
- }
- else if (getInput() != adapter.getModel())
- setInput(adapter.getModel());
- }
- else if (selectedObject instanceof IModel)
- {
- if (getInput() != selectedObject)
- setInput((IModel)selectedObject);
- }
-
- EditPart editPart = getEditPart(getRootEditPart(), selectedObject);
- if (editPart != null)
- {
- setSelection(new StructuredSelection(editPart));
- setFocus(editPart);
- }
- }
- }
- }
-
- /*
- * We need to convert from edit part selections to model object selections
- */
- class ADTSelectionChangedListener implements ISelectionProvider, ISelectionChangedListener
- {
- protected List listenerList = new ArrayList();
- protected ISelection selection = new StructuredSelection();
-
- public void addSelectionChangedListener(ISelectionChangedListener listener)
- {
- listenerList.add(listener);
- }
-
- public void removeSelectionChangedListener(ISelectionChangedListener listener)
- {
- listenerList.remove(listener);
- }
-
- public ISelection getSelection()
- {
- return selection;
- }
-
- protected void notifyListeners(SelectionChangedEvent event)
- {
- for (Iterator i = listenerList.iterator(); i.hasNext();)
- {
- ISelectionChangedListener listener = (ISelectionChangedListener) i.next();
- listener.selectionChanged(event);
- }
- }
-
- public StructuredSelection convertSelectionFromEditPartToModel(ISelection editPartSelection)
- {
- List selectedModelObjectList = new ArrayList();
- if (editPartSelection instanceof IStructuredSelection)
- {
- for (Iterator i = ((IStructuredSelection) editPartSelection).iterator(); i.hasNext();)
- {
- Object obj = i.next();
- Object model = null;
- if (obj instanceof EditPart)
- {
- EditPart editPart = (EditPart) obj;
- model = editPart.getModel();
- }
- if (model != null)
- {
- selectedModelObjectList.add(model);
- }
- }
- }
- return new StructuredSelection(selectedModelObjectList);
- }
-
- public void setSelection(ISelection selection)
- {
- this.selection = selection;
- }
-
- public void selectionChanged(SelectionChangedEvent event)
- {
- ISelection newSelection = convertSelectionFromEditPartToModel(event.getSelection());
- this.selection = newSelection;
- SelectionChangedEvent newEvent = new SelectionChangedEvent(this, newSelection);
- notifyListeners(newEvent);
- }
- }
-
- protected EditPart getEditPart(EditPart parent, Object object)
- {
- EditPart result = null;
- for (Iterator i = parent.getChildren().iterator(); i.hasNext(); )
- {
- EditPart editPart = (EditPart)i.next();
- if (editPart.getModel() == object && !(editPart instanceof IHolderEditPart) && !(editPart instanceof RootContentEditPart))
- {
- result = editPart;
- break;
- }
- }
-
- if (result == null)
- {
- for (Iterator i = parent.getChildren().iterator(); i.hasNext(); )
- {
- EditPart editPart = getEditPart((EditPart)i.next(), object);
- if (editPart != null)
- {
- // First check to see if there is a selection
- ISelection currentSelection = getSelection();
-
- // If there is a selection then we will try to select
- // the target edit part that is one of its children
- // This is handy when you add an element to a structured edit part
- // then you want to select the element immediately and put it in
- // direct edit mode
- if (currentSelection != null)
- {
- if (currentSelection instanceof StructuredSelection)
- {
- EditPart targetStructureEditPart = (EditPart)((StructuredSelection)currentSelection).getFirstElement();
- if (targetStructureEditPart != null)
- {
- while (targetStructureEditPart != null)
- {
- if (targetStructureEditPart instanceof StructureEditPart)
- {
- break;
- }
- targetStructureEditPart = targetStructureEditPart.getParent();
- }
- }
- EditPart potentialEditPartToSelect = editPart;
-
- while (potentialEditPartToSelect != null)
- {
- if (potentialEditPartToSelect instanceof StructureEditPart)
- {
- break;
- }
- potentialEditPartToSelect = potentialEditPartToSelect.getParent();
- }
-
- // If we found a potential edit part to select then return it
- // OR, if there is no target found, then we should just return
- // the edit part we found
- if (potentialEditPartToSelect == targetStructureEditPart || potentialEditPartToSelect == null || targetStructureEditPart == null)
- {
- result = editPart;
- break;
- }
- }
- }
- else // Otherwise just find the first one and return
- {
- result = editPart;
- break;
- }
- }
- }
- }
-
- return result;
- }
-
- public void setInputAndMarkLocation(IADTObject object)
- {
- IADTObject oldInput = getInput();
- INavigationHistory navigationHistory = null;
- IWorkbench workbench = PlatformUI.getWorkbench();
- if(workbench != null)
- {
- IWorkbenchWindow activeWorkbenchWindow = workbench.getActiveWorkbenchWindow();
- if(activeWorkbenchWindow != null)
- {
- IWorkbenchPage activePage = activeWorkbenchWindow.getActivePage();
- if(activePage != null)
- {
- navigationHistory = activePage.getNavigationHistory();
- }
- }
- }
-
- setInput(object);
-
- if (editorPart != null && oldInput != object)
- {
- navigationHistory.markLocation(editorPart);
- }
- }
-
- public void setInput(IADTObject object)
- {
- RootContentEditPart rootContentEditPart = (RootContentEditPart)getRootEditPart().getContents();
- rootContentEditPart.setModel(object);
- rootContentEditPart.refresh();
-
- if (object != null)
- {
- inputChangeManager.setSelection(new StructuredSelection(object));
- }
- // Select the editpart when it is set as input
- EditPart editPart = getEditPart(rootContentEditPart, object);
- if (editPart != null)
- select(editPart);
- }
-
- public IADTObject getInput()
- {
- RootContentEditPart rootContentEditPart = (RootContentEditPart)getRootEditPart().getContents();
- return (IADTObject)rootContentEditPart.getModel();
- }
-
- public EditPart getInputEditPart()
- {
- return getRootEditPart().getContents();
- }
-
- public void addInputChangdListener(ISelectionChangedListener listener)
- {
- inputChangeManager.addSelectionChangedListener(listener);
- }
-
- public void removeInputChangdListener(ISelectionChangedListener listener)
- {
- inputChangeManager.removeSelectionChangedListener(listener);
- }
-
-
- private class InputChangeManager implements ISelectionProvider
- {
- List listeners = new ArrayList();
-
- public void addSelectionChangedListener(ISelectionChangedListener listener)
- {
- if (!listeners.contains(listener))
- {
- listeners.add(listener);
- }
- }
-
- public ISelection getSelection()
- {
- // no one should be calling this method
- return null;
- }
-
- public void removeSelectionChangedListener(ISelectionChangedListener listener)
- {
- listeners.remove(listener);
- }
-
- public void setSelection(ISelection selection)
- {
- notifyListeners(selection);
- }
-
- void notifyListeners(ISelection selection)
- {
- List list = new ArrayList(listeners);
- for (Iterator i = list.iterator(); i.hasNext(); )
- {
- ISelectionChangedListener listener = (ISelectionChangedListener)i.next();
- listener.selectionChanged(new SelectionChangedEvent(this, selection));
- }
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/DesignViewerGraphicConstants.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/DesignViewerGraphicConstants.java
deleted file mode 100644
index 434e0d7f75..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/DesignViewerGraphicConstants.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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.xsd.ui.internal.adt.design;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.widgets.Display;
-
-public interface DesignViewerGraphicConstants
-{
- public static final String SCALED_HANDLE_LAYER = "Scaled Handle Layer"; //$NON-NLS-1$
- public final static Font smallFont = new Font(Display.getCurrent(), "Tahoma", 6, SWT.NONE); //$NON-NLS-1$
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/FlatCCombo.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/FlatCCombo.java
deleted file mode 100644
index 116d51550e..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/FlatCCombo.java
+++ /dev/null
@@ -1,1490 +0,0 @@
-package org.eclipse.wst.xsd.ui.internal.adt.design;
-
-/*******************************************************************************
- * Copyright (c) 2000, 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
- *******************************************************************************/
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.ACC;
-import org.eclipse.swt.accessibility.AccessibleAdapter;
-import org.eclipse.swt.accessibility.AccessibleControlAdapter;
-import org.eclipse.swt.accessibility.AccessibleControlEvent;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.accessibility.AccessibleTextAdapter;
-import org.eclipse.swt.accessibility.AccessibleTextEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Layout;
-import org.eclipse.swt.widgets.List;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.swt.widgets.TypedListener;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin;
-
-/**
- * The CCombo class represents a selectable user interface object
- * that combines a text field and a list and issues notification
- * when an item is selected from the list.
- * <p>
- * Note that although this class is a subclass of <code>Composite</code>,
- * it does not make sense to add children to it, or set a layout on it.
- * </p>
- * <dl>
- * <dt><b>Styles:</b>
- * <dd>BORDER, READ_ONLY, FLAT</dd>
- * <dt><b>Events:</b>
- * <dd>Selection</dd>
- * </dl>
- */
-public final class FlatCCombo extends Composite {
-
- Text text;
- List list;
- int visibleItemCount = 5;
- Shell popup;
- Label arrow;
- boolean hasFocus;
- Listener listener, filter;
- Color foreground, background;
- Font font;
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * lists the style constants that are applicable to the class.
- * Style bits are also inherited from superclasses.
- * </p>
- *
- * @param parent a widget which will be the parent of the new instance (cannot be null)
- * @param style the style of widget to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception org.eclipse.swt.SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * </ul>
- *
- * @see SWT#BORDER
- * @see SWT#READ_ONLY
- * @see SWT#FLAT
- * @see org.eclipse.swt.widgets.Widget#getStyle()
- */
-public FlatCCombo (Composite parent, int style) {
- super (parent, style = checkStyle (style));
-
- int textStyle = SWT.SINGLE;
- if ((style & SWT.READ_ONLY) != 0) textStyle |= SWT.READ_ONLY;
- if ((style & SWT.FLAT) != 0) textStyle |= SWT.FLAT;
- text = new Text (this, textStyle);
- int arrowStyle = SWT.ARROW | SWT.DOWN;
- if ((style & SWT.FLAT) != 0) arrowStyle |= SWT.FLAT;
- arrow = new Label(this, SWT.FLAT);
- arrow.setImage(XSDEditorPlugin.getXSDImage("icons/TriangleToolBar.gif")); //$NON-NLS-1$
-
- listener = new Listener () {
- public void handleEvent (Event event) {
- if (popup == event.widget) {
- popupEvent (event);
- return;
- }
- if (text == event.widget) {
- textEvent (event);
- return;
- }
- if (list == event.widget) {
- listEvent (event);
- return;
- }
- if (arrow == event.widget) {
- arrowEvent (event);
- return;
- }
- if (FlatCCombo.this == event.widget) {
- comboEvent (event);
- return;
- }
- if (getShell () == event.widget) {
- handleFocus (SWT.FocusOut);
- }
- }
- };
- filter = new Listener() {
- public void handleEvent(Event event) {
- Shell shell = ((Control)event.widget).getShell ();
- if (shell == FlatCCombo.this.getShell ()) {
- handleFocus (SWT.FocusOut);
- }
- }
- };
-
- int [] comboEvents = {SWT.Dispose, SWT.Move, SWT.Resize};
- for (int i=0; i<comboEvents.length; i++) this.addListener (comboEvents [i], listener);
-
- int [] textEvents = {SWT.KeyDown, SWT.KeyUp, SWT.MenuDetect, SWT.Modify, SWT.MouseDown, SWT.MouseUp, SWT.Traverse, SWT.FocusIn};
- for (int i=0; i<textEvents.length; i++) text.addListener (textEvents [i], listener);
-
- int [] arrowEvents = {SWT.MouseDown, SWT.Selection, SWT.FocusIn};
- for (int i=0; i<arrowEvents.length; i++) arrow.addListener (arrowEvents [i], listener);
-
- createPopup(null, -1);
- initAccessible();
-}
-static int checkStyle (int style) {
- int mask = SWT.BORDER | SWT.READ_ONLY | SWT.FLAT | SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT;
- return style & mask;
-}
-/**
- * Adds the argument to the end of the receiver's list.
- *
- * @param string the new item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception org.eclipse.swt.SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #add(String,int)
- */
-public void add (String string) {
- checkWidget();
- if (string == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- list.add (string);
-}
-/**
- * Adds the argument to the receiver's list at the given
- * zero-relative index.
- * <p>
- * Note: To add an item at the end of the list, use the
- * result of calling <code>getItemCount()</code> as the
- * index or use <code>add(String)</code>.
- * </p>
- *
- * @param string the new item
- * @param index the index for the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list (inclusive)</li>
- * </ul>
- * @exception org.eclipse.swt.SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #add(String)
- */
-public void add (String string, int index) {
- checkWidget();
- if (string == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- list.add (string, index);
-}
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the receiver's text is modified, by sending
- * it one of the messages defined in the <code>ModifyListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception org.eclipse.swt.SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ModifyListener
- * @see #removeModifyListener
- */
-public void addModifyListener (ModifyListener listener) {
- checkWidget();
- if (listener == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Modify, typedListener);
-}
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the receiver's selection changes, by sending
- * it one of the messages defined in the <code>SelectionListener</code>
- * interface.
- * <p>
- * <code>widgetSelected</code> is called when the combo's list selection changes.
- * <code>widgetDefaultSelected</code> is typically called when ENTER is pressed the combo's text area.
- * </p>
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception org.eclipse.swt.SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #removeSelectionListener
- * @see org.eclipse.swt.events.SelectionEvent
- */
-public void addSelectionListener(SelectionListener listener) {
- checkWidget();
- if (listener == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Selection,typedListener);
- addListener (SWT.DefaultSelection,typedListener);
-}
-void arrowEvent (Event event) {
- switch (event.type) {
- case SWT.FocusIn: {
- handleFocus (SWT.FocusIn);
- break;
- }
- case SWT.Selection: {
- dropDown (!isDropped ());
- break;
- }
- case SWT.MouseDown: {
- dropDown (!isDropped ());
- break;
- }
- }
-}
-/**
- * Sets the selection in the receiver's text field to an empty
- * selection starting just before the first character. If the
- * text field is editable, this has the effect of placing the
- * i-beam at the start of the text.
- * <p>
- * Note: To clear the selected items in the receiver's list,
- * use <code>deselectAll()</code>.
- * </p>
- *
- * @exception org.eclipse.swt.SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #deselectAll
- */
-public void clearSelection () {
- checkWidget ();
- text.clearSelection ();
- list.deselectAll ();
-}
-void comboEvent (Event event) {
- switch (event.type) {
- case SWT.Dispose:
- if (popup != null && !popup.isDisposed ()) {
- list.removeListener (SWT.Dispose, listener);
- popup.dispose ();
- }
- Shell shell = getShell ();
- shell.removeListener (SWT.Deactivate, listener);
- Display display = getDisplay ();
- display.removeFilter (SWT.FocusIn, filter);
- popup = null;
- text = null;
- list = null;
- arrow = null;
- break;
- case SWT.Move:
- dropDown (false);
- break;
- case SWT.Resize:
- internalLayout (false);
- break;
- }
-}
-
-public Point computeSize (int wHint, int hHint, boolean changed) {
- checkWidget ();
- int width = 0, height = 0;
- String[] items = list.getItems ();
- int textWidth = 0;
- GC gc = new GC (text);
- int spacer = gc.stringExtent (" ").x; //$NON-NLS-1$
- for (int i = 0; i < items.length; i++) {
- textWidth = Math.max (gc.stringExtent (items[i]).x, textWidth);
- }
- gc.dispose();
- Point textSize = text.computeSize (SWT.DEFAULT, SWT.DEFAULT, changed);
- // Point arrowSize = arrow.computeSize (SWT.DEFAULT, SWT.DEFAULT, changed);
- Point arrowSize = new Point(16, 16);
- Point listSize = list.computeSize (SWT.DEFAULT, SWT.DEFAULT, changed);
- int borderWidth = getBorderWidth ();
-
- height = Math.max (textSize.y, arrowSize.y);
- width = Math.max (textWidth + 2*spacer + arrowSize.x + 2*borderWidth, listSize.x);
- if (wHint != SWT.DEFAULT) width = wHint;
- if (hHint != SWT.DEFAULT) height = hHint;
- return new Point (width + 2*borderWidth, height + 2*borderWidth);
-}
-void createPopup(String[] items, int selectionIndex) {
- // create shell and list
- popup = new Shell (getShell (), SWT.NO_TRIM | SWT.ON_TOP);
- int style = getStyle ();
- int listStyle = SWT.SINGLE | SWT.V_SCROLL;
- if ((style & SWT.FLAT) != 0) listStyle |= SWT.FLAT;
- if ((style & SWT.RIGHT_TO_LEFT) != 0) listStyle |= SWT.RIGHT_TO_LEFT;
- if ((style & SWT.LEFT_TO_RIGHT) != 0) listStyle |= SWT.LEFT_TO_RIGHT;
- list = new List (popup, listStyle);
- if (font != null) list.setFont (font);
- if (foreground != null) list.setForeground (foreground);
- if (background != null) list.setBackground (background);
-
- int [] popupEvents = {SWT.Close, SWT.Paint, SWT.Deactivate};
- for (int i=0; i<popupEvents.length; i++) popup.addListener (popupEvents [i], listener);
- int [] listEvents = {SWT.MouseUp, SWT.Selection, SWT.Traverse, SWT.KeyDown, SWT.KeyUp, SWT.FocusIn, SWT.Dispose};
- for (int i=0; i<listEvents.length; i++) list.addListener (listEvents [i], listener);
-
- if (items != null) list.setItems (items);
- if (selectionIndex != -1) list.setSelection (selectionIndex);
-}
-/**
- * Deselects the item at the given zero-relative index in the receiver's
- * list. If the item at the index was already deselected, it remains
- * deselected. Indices that are out of range are ignored.
- *
- * @param index the index of the item to deselect
- *
- * @exception org.eclipse.swt.SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void deselect (int index) {
- checkWidget ();
- list.deselect (index);
-}
-/**
- * Deselects all selected items in the receiver's list.
- * <p>
- * Note: To clear the selection in the receiver's text field,
- * use <code>clearSelection()</code>.
- * </p>
- *
- * @exception org.eclipse.swt.SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #clearSelection
- */
-public void deselectAll () {
- checkWidget ();
- list.deselectAll ();
-}
-void dropDown (boolean drop) {
- if (drop == isDropped ()) return;
- if (!drop) {
- popup.setVisible (false);
- if (!isDisposed ()&& arrow.isFocusControl()) {
- text.setFocus();
- }
- return;
- }
-
- if (getShell() != popup.getParent ()) {
- String[] items = list.getItems ();
- int selectionIndex = list.getSelectionIndex ();
- list.removeListener (SWT.Dispose, listener);
- popup.dispose();
- popup = null;
- list = null;
- createPopup (items, selectionIndex);
- }
-
- Point size = getSize ();
- int itemCount = list.getItemCount ();
- itemCount = (itemCount == 0) ? visibleItemCount : Math.min(visibleItemCount, itemCount);
- int itemHeight = list.getItemHeight () * itemCount;
- Point listSize = list.computeSize (SWT.DEFAULT, itemHeight, false);
- list.setBounds (1, 1, Math.max (size.x - 2, listSize.x), listSize.y);
-
- int index = list.getSelectionIndex ();
- if (index != -1) list.setTopIndex (index);
- Display display = getDisplay ();
- Rectangle listRect = list.getBounds ();
- Rectangle parentRect = display.map (getParent (), null, getBounds ());
- Point comboSize = getSize ();
- Rectangle displayRect = getMonitor ().getClientArea ();
- int width = Math.max (comboSize.x, listRect.width + 2);
- int height = listRect.height + 2;
- int x = parentRect.x;
- int y = parentRect.y + comboSize.y;
- if (y + height > displayRect.y + displayRect.height) y = parentRect.y - height;
- if (x + width > displayRect.x + displayRect.width) x = displayRect.x + displayRect.width - listRect.width;
- popup.setBounds (x, y, width, height);
- popup.setVisible (true);
- list.setFocus ();
-}
-/*
- * Return the lowercase of the first non-'&' character following
- * an '&' character in the given string. If there are no '&'
- * characters in the given string, return '\0'.
- */
-char _findMnemonic (String string) {
- if (string == null) return '\0';
- int index = 0;
- int length = string.length ();
- do {
- while (index < length && string.charAt (index) != '&') index++;
- if (++index >= length) return '\0';
- if (string.charAt (index) != '&') return Character.toLowerCase (string.charAt (index));
- index++;
- } while (index < length);
- return '\0';
-}
-/*
- * Return the Label immediately preceding the receiver in the z-order,
- * or null if none.
- */
-Label getAssociatedLabel () {
- Control[] siblings = getParent ().getChildren ();
- for (int i = 0; i < siblings.length; i++) {
- if (siblings [i] == this) {
- if (i > 0 && siblings [i-1] instanceof Label) {
- return (Label) siblings [i-1];
- }
- }
- }
- return null;
-}
-public Control [] getChildren () {
- return super.getChildren();
-}
-/**
- * Gets the editable state.
- *
- * @return whether or not the receiver is editable
- *
- * @exception org.eclipse.swt.SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @since 3.0
- */
-public boolean getEditable () {
- checkWidget ();
- return text.getEditable();
-}
-/**
- * Returns the item at the given, zero-relative index in the
- * receiver's list. Throws an exception if the index is out
- * of range.
- *
- * @param index the index of the item to return
- * @return the item at the given index
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception org.eclipse.swt.SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public String getItem (int index) {
- checkWidget();
- return list.getItem (index);
-}
-/**
- * Returns the number of items contained in the receiver's list.
- *
- * @return the number of items
- *
- * @exception org.eclipse.swt.SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getItemCount () {
- checkWidget ();
- return list.getItemCount ();
-}
-/**
- * Returns the height of the area which would be used to
- * display <em>one</em> of the items in the receiver's list.
- *
- * @return the height of one item
- *
- * @exception org.eclipse.swt.SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getItemHeight () {
- checkWidget ();
- return list.getItemHeight ();
-}
-/**
- * Returns an array of <code>String</code>s which are the items
- * in the receiver's list.
- * <p>
- * Note: This is not the actual structure used by the receiver
- * to maintain its list of items, so modifying the array will
- * not affect the receiver.
- * </p>
- *
- * @return the items in the receiver's list
- *
- * @exception org.eclipse.swt.SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public String [] getItems () {
- checkWidget ();
- return list.getItems ();
-}
-public Menu getMenu() {
- return text.getMenu();
-}
-/**
- * Returns a <code>Point</code> whose x coordinate is the start
- * of the selection in the receiver's text field, and whose y
- * coordinate is the end of the selection. The returned values
- * are zero-relative. An "empty" selection as indicated by
- * the the x and y coordinates having the same value.
- *
- * @return a point representing the selection start and end
- *
- * @exception org.eclipse.swt.SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Point getSelection () {
- checkWidget ();
- return text.getSelection ();
-}
-/**
- * Returns the zero-relative index of the item which is currently
- * selected in the receiver's list, or -1 if no item is selected.
- *
- * @return the index of the selected item
- *
- * @exception org.eclipse.swt.SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getSelectionIndex () {
- checkWidget ();
- return list.getSelectionIndex ();
-}
-public int getStyle () {
- int style = super.getStyle ();
- style &= ~SWT.READ_ONLY;
- if (!text.getEditable()) style |= SWT.READ_ONLY;
- return style;
-}
-/**
- * Returns a string containing a copy of the contents of the
- * receiver's text field.
- *
- * @return the receiver's text
- *
- * @exception org.eclipse.swt.SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public String getText () {
- checkWidget ();
- return text.getText ();
-}
-/**
- * Returns the height of the receivers's text field.
- *
- * @return the text height
- *
- * @exception org.eclipse.swt.SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getTextHeight () {
- checkWidget ();
- return text.getLineHeight ();
-}
-/**
- * Returns the maximum number of characters that the receiver's
- * text field is capable of holding. If this has not been changed
- * by <code>setTextLimit()</code>, it will be the constant
- * <code>Combo.LIMIT</code>.
- *
- * @return the text limit
- *
- * @exception org.eclipse.swt.SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getTextLimit () {
- checkWidget ();
- return text.getTextLimit ();
-}
-/**
- * Gets the number of items that are visible in the drop
- * down portion of the receiver's list.
- *
- * @return the number of items that are visible
- *
- * @exception org.eclipse.swt.SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @since 3.0
- */
-public int getVisibleItemCount () {
- checkWidget ();
- return visibleItemCount;
-}
-void handleFocus (int type) {
- if (isDisposed ()) return;
- switch (type) {
- case SWT.FocusIn: {
- if (hasFocus) return;
- if (getEditable ()) text.selectAll ();
- hasFocus = true;
- Shell shell = getShell ();
- shell.removeListener (SWT.Deactivate, listener);
- shell.addListener (SWT.Deactivate, listener);
- Display display = getDisplay ();
- display.removeFilter (SWT.FocusIn, filter);
- display.addFilter (SWT.FocusIn, filter);
- Event e = new Event ();
- notifyListeners (SWT.FocusIn, e);
- break;
- }
- case SWT.FocusOut: {
- if (!hasFocus) return;
- Control focusControl = getDisplay ().getFocusControl ();
- if (focusControl == arrow || focusControl == list || focusControl == text) return;
- hasFocus = false;
- Shell shell = getShell ();
- shell.removeListener(SWT.Deactivate, listener);
- Display display = getDisplay ();
- display.removeFilter (SWT.FocusIn, filter);
- Event e = new Event ();
- notifyListeners (SWT.FocusOut, e);
- break;
- }
- }
-}
-/**
- * Searches the receiver's list starting at the first item
- * (index 0) until an item is found that is equal to the
- * argument, and returns the index of that item. If no item
- * is found, returns -1.
- *
- * @param string the search item
- * @return the index of the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception org.eclipse.swt.SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int indexOf (String string) {
- checkWidget ();
- if (string == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- return list.indexOf (string);
-}
-/**
- * Searches the receiver's list starting at the given,
- * zero-relative index until an item is found that is equal
- * to the argument, and returns the index of that item. If
- * no item is found or the starting index is out of range,
- * returns -1.
- *
- * @param string the search item
- * @param start the zero-relative index at which to begin the search
- * @return the index of the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception org.eclipse.swt.SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int indexOf (String string, int start) {
- checkWidget ();
- if (string == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- return list.indexOf (string, start);
-}
-
-void initAccessible() {
- AccessibleAdapter accessibleAdapter = new AccessibleAdapter () {
- public void getName (AccessibleEvent e) {
- String name = null;
- Label label = getAssociatedLabel ();
- if (label != null) {
- name = stripMnemonic (label.getText());
- }
- e.result = name;
- }
- public void getKeyboardShortcut(AccessibleEvent e) {
- String shortcut = null;
- Label label = getAssociatedLabel ();
- if (label != null) {
- String text = label.getText ();
- if (text != null) {
- char mnemonic = _findMnemonic (text);
- if (mnemonic != '\0') {
- shortcut = "Alt+"+mnemonic; //$NON-NLS-1$
- }
- }
- }
- e.result = shortcut;
- }
- public void getHelp (AccessibleEvent e) {
- e.result = getToolTipText ();
- }
- };
- getAccessible ().addAccessibleListener (accessibleAdapter);
- text.getAccessible ().addAccessibleListener (accessibleAdapter);
- list.getAccessible ().addAccessibleListener (accessibleAdapter);
-
- arrow.getAccessible ().addAccessibleListener (new AccessibleAdapter() {
- public void getName (AccessibleEvent e) {
- e.result = isDropped () ? SWT.getMessage ("SWT_Close") : SWT.getMessage ("SWT_Open"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- public void getKeyboardShortcut (AccessibleEvent e) {
- e.result = "Alt+Down Arrow"; //$NON-NLS-1$
- }
- public void getHelp (AccessibleEvent e) {
- e.result = getToolTipText ();
- }
- });
-
- getAccessible().addAccessibleTextListener (new AccessibleTextAdapter() {
- public void getCaretOffset (AccessibleTextEvent e) {
- e.offset = text.getCaretPosition ();
- }
- public void getSelectionRange(AccessibleTextEvent e) {
- Point sel = text.getSelection();
- e.offset = sel.x;
- e.length = sel.y - sel.x;
- }
- });
-
- getAccessible().addAccessibleControlListener (new AccessibleControlAdapter() {
- public void getChildAtPoint (AccessibleControlEvent e) {
- Point testPoint = toControl (e.x, e.y);
- if (getBounds ().contains (testPoint)) {
- e.childID = ACC.CHILDID_SELF;
- }
- }
-
- public void getLocation (AccessibleControlEvent e) {
- Rectangle location = getBounds ();
- Point pt = toDisplay (location.x, location.y);
- e.x = pt.x;
- e.y = pt.y;
- e.width = location.width;
- e.height = location.height;
- }
-
- public void getChildCount (AccessibleControlEvent e) {
- e.detail = 0;
- }
-
- public void getRole (AccessibleControlEvent e) {
- e.detail = ACC.ROLE_COMBOBOX;
- }
-
- public void getState (AccessibleControlEvent e) {
- e.detail = ACC.STATE_NORMAL;
- }
-
- public void getValue (AccessibleControlEvent e) {
- e.result = getText ();
- }
- });
-
- text.getAccessible ().addAccessibleControlListener (new AccessibleControlAdapter () {
- public void getRole (AccessibleControlEvent e) {
- e.detail = text.getEditable () ? ACC.ROLE_TEXT : ACC.ROLE_LABEL;
- }
- });
-
- arrow.getAccessible ().addAccessibleControlListener (new AccessibleControlAdapter() {
- public void getDefaultAction (AccessibleControlEvent e) {
- e.result = isDropped () ? SWT.getMessage ("SWT_Close") : SWT.getMessage ("SWT_Open"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- });
-}
-boolean isDropped () {
- return popup.getVisible ();
-}
-public boolean isFocusControl () {
- checkWidget();
- if (text.isFocusControl () || arrow.isFocusControl () || list.isFocusControl () || popup.isFocusControl ()) {
- return true;
- }
- return super.isFocusControl ();
-}
-void internalLayout (boolean changed) {
- if (isDropped ()) dropDown (false);
- Rectangle rect = getClientArea ();
- int width = rect.width;
- int height = rect.height;
- // Point arrowSize = arrow.computeSize (SWT.DEFAULT, height, changed);
- // text.setBounds (0, 0, width - arrowSize.x, height);
- text.setBounds (0, 0, width - 16, height);
- // arrow.setBounds (width - arrowSize.x, 0, arrowSize.x, arrowSize.y);
- arrow.setBounds (width - 16, 0, 16, 16);
-}
-void listEvent (Event event) {
- switch (event.type) {
- case SWT.Dispose:
- if (getShell () != popup.getParent ()) {
- String[] items = list.getItems ();
- int selectionIndex = list.getSelectionIndex ();
- popup = null;
- list = null;
- createPopup (items, selectionIndex);
- }
- break;
- case SWT.FocusIn: {
- handleFocus (SWT.FocusIn);
- break;
- }
- case SWT.MouseUp: {
- if (event.button != 1) return;
- dropDown (false);
- break;
- }
- case SWT.Selection: {
- int index = list.getSelectionIndex ();
- if (index == -1) return;
- text.setText (list.getItem (index));
- text.selectAll ();
- list.setSelection (index);
- Event e = new Event ();
- e.time = event.time;
- e.stateMask = event.stateMask;
- e.doit = event.doit;
- notifyListeners (SWT.Selection, e);
- event.doit = e.doit;
- break;
- }
- case SWT.Traverse: {
- switch (event.detail) {
- case SWT.TRAVERSE_RETURN:
- case SWT.TRAVERSE_ESCAPE:
- case SWT.TRAVERSE_ARROW_PREVIOUS:
- case SWT.TRAVERSE_ARROW_NEXT:
- event.doit = false;
- break;
- }
- Event e = new Event ();
- e.time = event.time;
- e.detail = event.detail;
- e.doit = event.doit;
- e.character = event.character;
- e.keyCode = event.keyCode;
- notifyListeners (SWT.Traverse, e);
- event.doit = e.doit;
- event.detail = e.detail;
- break;
- }
- case SWT.KeyUp: {
- Event e = new Event ();
- e.time = event.time;
- e.character = event.character;
- e.keyCode = event.keyCode;
- e.stateMask = event.stateMask;
- notifyListeners (SWT.KeyUp, e);
- break;
- }
- case SWT.KeyDown: {
- if (event.character == SWT.ESC) {
- // Escape key cancels popup list
- dropDown (false);
- }
- if ((event.stateMask & SWT.ALT) != 0 && (event.keyCode == SWT.ARROW_UP || event.keyCode == SWT.ARROW_DOWN)) {
- dropDown (false);
- }
- if (event.character == SWT.CR) {
- // Enter causes default selection
- dropDown (false);
- Event e = new Event ();
- e.time = event.time;
- e.stateMask = event.stateMask;
- notifyListeners (SWT.DefaultSelection, e);
- }
- // At this point the widget may have been disposed.
- // If so, do not continue.
- if (isDisposed ()) break;
- Event e = new Event();
- e.time = event.time;
- e.character = event.character;
- e.keyCode = event.keyCode;
- e.stateMask = event.stateMask;
- notifyListeners(SWT.KeyDown, e);
- break;
-
- }
- }
-}
-
-void popupEvent(Event event) {
- switch (event.type) {
- case SWT.Paint:
- // draw black rectangle around list
- Rectangle listRect = list.getBounds();
- Color black = getDisplay().getSystemColor(SWT.COLOR_BLACK);
- event.gc.setForeground(black);
- event.gc.drawRectangle(0, 0, listRect.width + 1, listRect.height + 1);
- break;
- case SWT.Close:
- event.doit = false;
- dropDown (false);
- break;
- case SWT.Deactivate:
- dropDown (false);
- break;
- }
-}
-public void redraw () {
- super.redraw();
- text.redraw();
- arrow.redraw();
- if (popup.isVisible()) list.redraw();
-}
-public void redraw (int x, int y, int width, int height, boolean all) {
- super.redraw(x, y, width, height, true);
-}
-
-/**
- * Removes the item from the receiver's list at the given
- * zero-relative index.
- *
- * @param index the index for the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception org.eclipse.swt.SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void remove (int index) {
- checkWidget();
- list.remove (index);
-}
-/**
- * Removes the items from the receiver's list which are
- * between the given zero-relative start and end
- * indices (inclusive).
- *
- * @param start the start of the range
- * @param end the end of the range
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if either the start or end are not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception org.eclipse.swt.SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void remove (int start, int end) {
- checkWidget();
- list.remove (start, end);
-}
-/**
- * Searches the receiver's list starting at the first item
- * until an item is found that is equal to the argument,
- * and removes that item from the list.
- *
- * @param string the item to remove
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the string is not found in the list</li>
- * </ul>
- * @exception org.eclipse.swt.SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void remove (String string) {
- checkWidget();
- if (string == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- list.remove (string);
-}
-/**
- * Removes all of the items from the receiver's list and clear the
- * contents of receiver's text field.
- * <p>
- * @exception org.eclipse.swt.SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void removeAll () {
- checkWidget();
- text.setText (""); //$NON-NLS-1$
- list.removeAll ();
-}
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the receiver's text is modified.
- *
- * @param listener the listener which should no longer be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception org.eclipse.swt.SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ModifyListener
- * @see #addModifyListener
- */
-public void removeModifyListener (ModifyListener listener) {
- checkWidget();
- if (listener == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- removeListener(SWT.Modify, listener);
-}
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the receiver's selection changes.
- *
- * @param listener the listener which should no longer be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception org.eclipse.swt.SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #addSelectionListener
- */
-public void removeSelectionListener (SelectionListener listener) {
- checkWidget();
- if (listener == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- removeListener(SWT.Selection, listener);
- removeListener(SWT.DefaultSelection,listener);
-}
-/**
- * Selects the item at the given zero-relative index in the receiver's
- * list. If the item at the index was already selected, it remains
- * selected. Indices that are out of range are ignored.
- *
- * @param index the index of the item to select
- *
- * @exception org.eclipse.swt.SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void select (int index) {
- checkWidget();
- if (index == -1) {
- list.deselectAll ();
- text.setText (""); //$NON-NLS-1$
- return;
- }
- if (0 <= index && index < list.getItemCount()) {
- if (index != getSelectionIndex()) {
- text.setText (list.getItem (index));
- text.selectAll ();
- list.select (index);
- list.showSelection ();
- }
- }
-}
-public void setBackground (Color color) {
- super.setBackground(color);
- background = color;
- if (text != null) text.setBackground(color);
- if (list != null) list.setBackground(color);
- if (arrow != null) arrow.setBackground(color);
-}
-/**
- * Sets the editable state.
- *
- * @param editable the new editable state
- *
- * @exception org.eclipse.swt.SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @since 3.0
- */
-public void setEditable (boolean editable) {
- checkWidget ();
- text.setEditable(editable);
-}
-public void setEnabled (boolean enabled) {
- super.setEnabled(enabled);
- if (popup != null) popup.setVisible (false);
- if (text != null) text.setEnabled(enabled);
- if (arrow != null) arrow.setEnabled(enabled);
-}
-public boolean setFocus () {
- checkWidget();
- return text.setFocus ();
-}
-public void setFont (Font font) {
- super.setFont (font);
- this.font = font;
- text.setFont (font);
- list.setFont (font);
- internalLayout (true);
-}
-public void setForeground (Color color) {
- super.setForeground(color);
- foreground = color;
- if (text != null) text.setForeground(color);
- if (list != null) list.setForeground(color);
- if (arrow != null) arrow.setForeground(color);
-}
-/**
- * Sets the text of the item in the receiver's list at the given
- * zero-relative index to the string argument. This is equivalent
- * to <code>remove</code>'ing the old item at the index, and then
- * <code>add</code>'ing the new item at that index.
- *
- * @param index the index for the item
- * @param string the new text for the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception org.eclipse.swt.SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setItem (int index, String string) {
- checkWidget();
- list.setItem (index, string);
-}
-/**
- * Sets the receiver's list to be the given array of items.
- *
- * @param items the array of items
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the items array is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if an item in the items array is null</li>
- * </ul>
- * @exception org.eclipse.swt.SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setItems (String [] items) {
- checkWidget ();
- list.setItems (items);
- if (!text.getEditable ()) text.setText (""); //$NON-NLS-1$
-}
-/**
- * Sets the layout which is associated with the receiver to be
- * the argument which may be null.
- * <p>
- * Note: No Layout can be set on this Control because it already
- * manages the size and position of its children.
- * </p>
- *
- * @param layout the receiver's new layout or null
- *
- * @exception org.eclipse.swt.SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setLayout (Layout layout) {
- checkWidget ();
- return;
-}
-public void setMenu(Menu menu) {
- text.setMenu(menu);
-}
-/**
- * Sets the selection in the receiver's text field to the
- * range specified by the argument whose x coordinate is the
- * start of the selection and whose y coordinate is the end
- * of the selection.
- *
- * @param selection a point representing the new selection start and end
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the point is null</li>
- * </ul>
- * @exception org.eclipse.swt.SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSelection (Point selection) {
- checkWidget();
- if (selection == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- text.setSelection (selection.x, selection.y);
-}
-
-/**
- * Sets the contents of the receiver's text field to the
- * given string.
- * <p>
- * Note: The text field in a <code>Combo</code> is typically
- * only capable of displaying a single line of text. Thus,
- * setting the text to a string containing line breaks or
- * other special characters will probably cause it to
- * display incorrectly.
- * </p>
- *
- * @param string the new text
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception org.eclipse.swt.SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setText (String string) {
- checkWidget();
- if (string == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- int index = list.indexOf (string);
- if (index == -1) {
- list.deselectAll ();
- text.setText (string);
- return;
- }
- text.setText (string);
- text.selectAll ();
- list.setSelection (index);
- list.showSelection ();
-}
-/**
- * Sets the maximum number of characters that the receiver's
- * text field is capable of holding to be the argument.
- *
- * @param limit new text limit
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_CANNOT_BE_ZERO - if the limit is zero</li>
- * </ul>
- * @exception org.eclipse.swt.SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setTextLimit (int limit) {
- checkWidget();
- text.setTextLimit (limit);
-}
-
-public void setToolTipText (String string) {
- checkWidget();
- super.setToolTipText(string);
- arrow.setToolTipText (string);
- text.setToolTipText (string);
-}
-
-public void setVisible (boolean visible) {
- super.setVisible(visible);
- if (!visible) popup.setVisible(false);
-}
-/**
- * Sets the number of items that are visible in the drop
- * down portion of the receiver's list.
- *
- * @param count the new number of items to be visible
- *
- * @exception org.eclipse.swt.SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @since 3.0
- */
-public void setVisibleItemCount (int count) {
- checkWidget ();
- if (count < 0) return;
- visibleItemCount = count;
-}
-String stripMnemonic (String string) {
- int index = 0;
- int length = string.length ();
- do {
- while ((index < length) && (string.charAt (index) != '&')) index++;
- if (++index >= length) return string;
- if (string.charAt (index) != '&') {
- return string.substring(0, index-1) + string.substring(index, length);
- }
- index++;
- } while (index < length);
- return string;
-}
-void textEvent (Event event) {
- switch (event.type) {
- case SWT.FocusIn: {
- handleFocus (SWT.FocusIn);
- break;
- }
- case SWT.KeyDown: {
- if (event.character == SWT.CR) {
- dropDown (false);
- Event e = new Event ();
- e.time = event.time;
- e.stateMask = event.stateMask;
- notifyListeners (SWT.DefaultSelection, e);
- }
- //At this point the widget may have been disposed.
- // If so, do not continue.
- if (isDisposed ()) break;
-
- if (event.keyCode == SWT.ARROW_UP || event.keyCode == SWT.ARROW_DOWN) {
- event.doit = false;
- if ((event.stateMask & SWT.ALT) != 0) {
- boolean dropped = isDropped ();
- text.selectAll ();
- if (!dropped) setFocus ();
- dropDown (!dropped);
- break;
- }
-
- int oldIndex = getSelectionIndex ();
- if (event.keyCode == SWT.ARROW_UP) {
- select (Math.max (oldIndex - 1, 0));
- } else {
- select (Math.min (oldIndex + 1, getItemCount () - 1));
- }
- if (oldIndex != getSelectionIndex ()) {
- Event e = new Event();
- e.time = event.time;
- e.stateMask = event.stateMask;
- notifyListeners (SWT.Selection, e);
- }
- //At this point the widget may have been disposed.
- // If so, do not continue.
- if (isDisposed ()) break;
- }
-
- // Further work : Need to add support for incremental search in
- // pop up list as characters typed in text widget
-
- Event e = new Event ();
- e.time = event.time;
- e.character = event.character;
- e.keyCode = event.keyCode;
- e.stateMask = event.stateMask;
- notifyListeners (SWT.KeyDown, e);
- break;
- }
- case SWT.KeyUp: {
- Event e = new Event ();
- e.time = event.time;
- e.character = event.character;
- e.keyCode = event.keyCode;
- e.stateMask = event.stateMask;
- notifyListeners (SWT.KeyUp, e);
- break;
- }
- case SWT.MenuDetect: {
- Event e = new Event ();
- e.time = event.time;
- notifyListeners (SWT.MenuDetect, e);
- break;
- }
- case SWT.Modify: {
- list.deselectAll ();
- Event e = new Event ();
- e.time = event.time;
- notifyListeners (SWT.Modify, e);
- break;
- }
- case SWT.MouseDown: {
- if (event.button != 1) return;
- if (text.getEditable ()) return;
- boolean dropped = isDropped ();
- text.selectAll ();
- if (!dropped) setFocus ();
- dropDown (!dropped);
- break;
- }
- case SWT.MouseUp: {
- if (event.button != 1) return;
- if (text.getEditable ()) return;
- text.selectAll ();
- break;
- }
- case SWT.Traverse: {
- switch (event.detail) {
- case SWT.TRAVERSE_RETURN:
- case SWT.TRAVERSE_ARROW_PREVIOUS:
- case SWT.TRAVERSE_ARROW_NEXT:
- // The enter causes default selection and
- // the arrow keys are used to manipulate the list contents so
- // do not use them for traversal.
- event.doit = false;
- break;
- }
-
- Event e = new Event ();
- e.time = event.time;
- e.detail = event.detail;
- e.doit = event.doit;
- e.character = event.character;
- e.keyCode = event.keyCode;
- notifyListeners (SWT.Traverse, e);
- event.doit = e.doit;
- event.detail = e.detail;
- break;
- }
- }
-}
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/IAnnotationProvider.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/IAnnotationProvider.java
deleted file mode 100644
index 226d4357d8..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/IAnnotationProvider.java
+++ /dev/null
@@ -1,17 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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.xsd.ui.internal.adt.design;
-
-public interface IAnnotationProvider
-{
- String getNameAnnotationString();
- String getNameAnnotationToolTipString();
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/IKeyboardDrag.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/IKeyboardDrag.java
deleted file mode 100644
index fe069207d2..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/IKeyboardDrag.java
+++ /dev/null
@@ -1,19 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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.xsd.ui.internal.adt.design;
-
-import org.eclipse.gef.GraphicalEditPart;
-
-public interface IKeyboardDrag {
-
- public void performKeyboardDrag (GraphicalEditPart source, int direction);
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/ImageOverlayDescriptor.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/ImageOverlayDescriptor.java
deleted file mode 100644
index 0f2a674073..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/ImageOverlayDescriptor.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.xsd.ui.internal.adt.design;
-
-import org.eclipse.jface.resource.CompositeImageDescriptor;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.ImageData;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin;
-
-public class ImageOverlayDescriptor extends CompositeImageDescriptor
-{
- protected Image baseImage;
- protected Image extensionOverlay, disabledExtensionOverlay;
- protected Point imageSize;
- protected boolean isReadOnly;
-
- public ImageOverlayDescriptor(Image baseImage, boolean isReadOnly)
- {
- super();
- this.baseImage = baseImage;
- this.isReadOnly = isReadOnly;
- imageSize = new Point(baseImage.getBounds().width, baseImage.getBounds().height);
- extensionOverlay = XSDEditorPlugin.getPlugin().getIcon("ovr16/extnsn_ovr.gif"); //$NON-NLS-1$
- disabledExtensionOverlay = XSDEditorPlugin.getPlugin().getIcon("ovr16/extnsndis_ovr.gif"); //$NON-NLS-1$
- }
-
- public Image getImage()
- {
- return createImage();
- }
-
- protected void drawCompositeImage(int width, int height)
- {
- drawImage(baseImage.getImageData(), 0, 0);
- ImageData extensionImageData;
- if (isReadOnly)
- {
- extensionImageData = disabledExtensionOverlay.getImageData();
- }
- else
- {
- extensionImageData = extensionOverlay.getImageData();
- }
- drawImage (extensionImageData, imageSize.x - extensionImageData.width, 0); // Top Right corner
- }
-
- protected Point getSize()
- {
- return imageSize;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/directedit/ADTComboBoxCellEditor.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/directedit/ADTComboBoxCellEditor.java
deleted file mode 100644
index 717c7aec22..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/directedit/ADTComboBoxCellEditor.java
+++ /dev/null
@@ -1,268 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.adt.design.directedit;
-
-import java.text.MessageFormat;
-
-import org.eclipse.jface.viewers.ComboBoxCellEditor;
-import org.eclipse.jface.window.Window;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CCombo;
-import org.eclipse.swt.events.FocusAdapter;
-import org.eclipse.swt.events.FocusEvent;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.TraverseEvent;
-import org.eclipse.swt.events.TraverseListener;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.TypedListener;
-import org.eclipse.wst.xsd.ui.internal.adt.edit.ComponentReferenceEditManager;
-import org.eclipse.wst.xsd.ui.internal.adt.edit.IComponentDialog;
-import org.eclipse.wst.xsd.ui.internal.editor.Messages;
-
-/*
- * This wraps the ComboBoxCellEditor.
- * We need to apply and deactivate the combo on a single click (not on a double click like
- * the ComboBoxCellEditor).
- */
-public class ADTComboBoxCellEditor extends ComboBoxCellEditor
-{
- private static final int adtDefaultStyle = SWT.NONE;
-
- /**
- * Used to determine if the value should be applied to the cell.
- */
- private boolean continueApply;
- private boolean isTraversing = false;
- private Object selectedValue;
- private ComponentReferenceEditManager componentReferenceEditManager;
-
- // This prevents the cell editor from being deactivated while handling the New or Browse selection.
- private boolean isHandlingSelection = false;
-
- /**
- * Creates a new cell editor with a combo containing the given list of choices
- * and parented under the given control. The cell editor value is the
- * zero-based index of the selected item. Initially, the cell editor has no
- * cell validator and the first item in the list is selected.
- *
- * @param parent
- * the parent control
- * @param items
- * the list of strings for the combo box
- */
- public ADTComboBoxCellEditor(Composite parent, String[] items, ComponentReferenceEditManager editManager)
- {
- super(parent, items, adtDefaultStyle | SWT.READ_ONLY);
- setItems(items);
- componentReferenceEditManager = editManager;
- }
-
- private void removeListeners(CCombo comboBox, int event)
- {
- Listener [] listeners = comboBox.getListeners(event);
- int length = listeners.length;
- for (int i = 0; i < length; i++)
- {
- Listener l = listeners[i];
- if (l instanceof TypedListener)
- {
- TypedListener typedListener = (TypedListener)l;
- String className = typedListener.getEventListener().getClass().getCanonicalName();
- // It's possible that there are other typed listeners added to the CCombo.
- // Currently there are none, but as an extra check, I want to ensure
- // I'm removing the ones added from the inherited class.
- // I've tested this and I know it removes the following:
- // org.eclipse.jface.viewers.ComboBoxCellEditor$2
- // org.eclipse.jface.viewers.ComboBoxCellEditor$4
- // which are indeed the ones I'm customizing
- if (className != null && className.contains("org.eclipse.jface.viewers.ComboBoxCellEditor"))
- {
- comboBox.removeListener(event, l);
- }
- }
- }
- }
-
- /*
- * (non-Javadoc) Method declared on CellEditor.
- */
- protected Control createControl(Composite parent)
- {
- CCombo comboBox = (CCombo)super.createControl(parent);
-
- comboBox.setFont(parent.getFont());
-
- // Need to remove the listeners added from ComboBoxCellEditor
- removeListeners(comboBox, SWT.Selection);
- removeListeners(comboBox, SWT.DefaultSelection);
- removeListeners(comboBox, SWT.FocusIn);
- removeListeners(comboBox, SWT.FocusOut);
-
- // Now add our custom listeners
- comboBox.addSelectionListener(new SelectionAdapter()
- {
- public void widgetDefaultSelected(SelectionEvent event)
- {
- // Want the same behaviour since hitting return on Browse or New should launch the dialogs,
- // and not immediately apply the value
-// applyEditorValueAndDeactivate();
- widgetSelected(event);
- }
-
- public void widgetSelected(SelectionEvent event)
- {
- continueApply = true;
- CCombo comboBox = getCCombo();
- isHandlingSelection = true;
- Object newValue = null;
-
- try
- {
- int selection = comboBox.getSelectionIndex();
- if (isTraversing)
- {
- isTraversing = false;
- return;
- }
-
- String[] items = getItems();
- String stringSelection = items[selection];
-
- if (stringSelection.equals(Messages._UI_COMBO_BROWSE))
- {
- continueApply = true;
- newValue = invokeDialog(componentReferenceEditManager.getBrowseDialog());
- }
- else if (stringSelection.equals(Messages._UI_COMBO_NEW))
- {
- continueApply = true;
- newValue = invokeDialog(componentReferenceEditManager.getNewDialog());
- }
- }
- finally
- {
- isHandlingSelection = false;
- }
-
- if (continueApply)
- {
- if (newValue == null)
- {
- int index = comboBox.getSelectionIndex();
- if (index != -1)
- {
- selectedValue = comboBox.getItem(index);
- }
- }
- else
- {
- selectedValue = newValue;
- }
-
- applyEditorValueAndDeactivate();
- focusLost();
- }
- }
- });
-
- comboBox.addTraverseListener(new TraverseListener()
- {
- public void keyTraversed(TraverseEvent e)
- {
- if (e.detail == SWT.TRAVERSE_ARROW_NEXT || e.detail == SWT.TRAVERSE_ARROW_PREVIOUS)
- {
- isTraversing = true;
- }
- }
- });
-
- comboBox.addFocusListener(new FocusAdapter()
- {
- public void focusLost(FocusEvent e)
- {
- if (!isHandlingSelection)
- ADTComboBoxCellEditor.this.focusLost();
- }
- });
- return comboBox;
- }
-
- private Object invokeDialog(IComponentDialog dialog)
- {
- Object newValue = null;
-
- if (dialog == null)
- {
- return null;
- }
-
- //dialog.setInitialComponent(setObject);
- if (dialog.createAndOpen() == Window.OK)
- {
- newValue = dialog.getSelectedComponent();
- }
- else
- {
- continueApply = false;
- focusLost();
- }
-
- return newValue;
- }
-
- public Object getSelectedValue()
- {
- return selectedValue;
- }
-
- protected CCombo getCCombo()
- {
- return (CCombo)getControl();
- }
-
-///////// ComboBox cell editor
-
- void applyEditorValueAndDeactivate()
- {
- // must set the selection before getting value
- CCombo comboBox = getCCombo();
- String[] items = getItems();
-
- int selection = comboBox.getSelectionIndex();
- Object newValue = doGetValue();
- markDirty();
- boolean isValid = isCorrect(newValue);
- setValueValid(isValid);
-
- if (!isValid)
- {
- // Only format if the 'index' is valid
- if (items.length > 0 && selection >= 0 && selection < items.length)
- {
- // try to insert the current value into the error message.
- setErrorMessage(MessageFormat.format(getErrorMessage(), new Object[] { items[selection] }));
- }
- else
- {
- // Since we don't have a valid index, assume we're using an
- // 'edit'
- // combo so format using its text value
- setErrorMessage(MessageFormat.format(getErrorMessage(), new Object[] { comboBox.getText() }));
- }
- }
-
- fireApplyEditorValue();
- deactivate();
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/directedit/AttributeReferenceDirectEditManager.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/directedit/AttributeReferenceDirectEditManager.java
deleted file mode 100644
index 2b5e2722b3..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/directedit/AttributeReferenceDirectEditManager.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.xsd.ui.internal.adt.design.directedit;
-
-import org.eclipse.draw2d.Label;
-import org.eclipse.gef.editparts.AbstractGraphicalEditPart;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.wst.xsd.ui.internal.adt.edit.ComponentReferenceEditManager;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IField;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDAttributeReferenceEditManager;
-
-public class AttributeReferenceDirectEditManager extends ReferenceDirectEditManager
-{
- public AttributeReferenceDirectEditManager(IField parameter, AbstractGraphicalEditPart source, Label label)
- {
- super(parameter, source, label);
- }
-
- protected ComponentReferenceEditManager getComponentReferenceEditManager()
- {
- ComponentReferenceEditManager result = null;
- IEditorPart editor = getActiveEditor();
- if (editor != null)
- {
- result = (ComponentReferenceEditManager)editor.getAdapter(XSDAttributeReferenceEditManager.class);
- }
- return result;
- }
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/directedit/ComboBoxCellEditorManager.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/directedit/ComboBoxCellEditorManager.java
deleted file mode 100644
index c840f2199e..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/directedit/ComboBoxCellEditorManager.java
+++ /dev/null
@@ -1,224 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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.xsd.ui.internal.adt.design.directedit;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.gef.GraphicalEditPart;
-import org.eclipse.gef.tools.CellEditorLocator;
-import org.eclipse.gef.tools.DirectEditManager;
-import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.jface.viewers.ComboBoxCellEditor;
-import org.eclipse.jface.viewers.ICellEditorListener;
-import org.eclipse.swt.custom.CCombo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-
-public abstract class ComboBoxCellEditorManager extends DirectEditManager// implements
- // DirectEditPolicyDelegate
-{
- protected Label label;
-
- public ComboBoxCellEditorManager(GraphicalEditPart source, Label label)
- {
- super(source, ComboBoxCellEditor.class, new InternalCellEditorLocator(label));
- this.label = label;
- }
-
- protected void initCellEditor()
- {
- String initialLabelText = label.getText();
-
- CCombo combo = (CCombo) getCellEditor().getControl();
- combo.setFont(label.getFont());
- combo.setForeground(label.getForegroundColor());
- combo.setBackground(label.getBackgroundColor());
- combo.setVisibleItemCount(20);
-
- /*
- * combo.addKeyListener(new KeyAdapter() { // hook key pressed - see PR
- * 14201 public void keyPressed(KeyEvent keyEvent) { if (keyEvent.character ==
- * 'z') { getCellEditor().applyEditorValue(); } } });
- */
- ICellEditorListener cellEditorListener = new ICellEditorListener()
- {
- public void cancelEditor()
- {
- }
-
- public void applyEditorValue()
- {
- }
-
- public void editorValueChanged(boolean old, boolean newState)
- {
- }
- };
- getCellEditor().addListener(cellEditorListener);
-
- String[] item = combo.getItems();
- for (int i = 0; i < item.length; i++)
- {
- if (item[i].equals(initialLabelText))
- {
- getCellEditor().setValue(new Integer(i));
- break;
- }
- }
- }
-
- // hack... for some reason the ComboBoxCellEditor does't fire an
- // editorValueChanged to set the dirty flag
- // unless we overide this method to return true, the manager is not notified
- // of changes made in the cell editor
- protected boolean isDirty()
- {
- return true;
- }
-
- protected CellEditor createCellEditorOn(Composite composite)
- {
- boolean isLabelTextInList = false;
- List list = computeComboContent();
- for (Iterator i = list.iterator(); i.hasNext();)
- {
- String string = (String) i.next();
- if (string.equals(label.getText()))
- {
- isLabelTextInList = true;
- break;
- }
- }
-
- if (!isLabelTextInList)
- {
- list.add(label.getText());
- }
-
- List sortedList = computeSortedList(list);
- String[] stringArray = new String[sortedList.size()];
- for (int i = 0; i < stringArray.length; i++)
- {
- stringArray[i] = (String) sortedList.get(i);
- }
- return createCellEditor(composite, stringArray);
- }
-
- protected CellEditor createCellEditor(Composite composite, String[] stringArray)
- {
- return new ComboBoxCellEditor(composite, stringArray);
- }
-
- protected List computeSortedList(List list)
- {
- return list;
- }
-
- protected abstract List computeComboContent();
-
- protected abstract void performModify(Object value);
-
- public static class InternalCellEditorLocator implements CellEditorLocator
- {
- protected Label label;
-
- public InternalCellEditorLocator(Label label)
- {
- this.label = label;
- }
-
- public void relocate(CellEditor celleditor)
- {
- CCombo combo = (CCombo) celleditor.getControl();
-
- // TODO: We're pulling a fast one here..... This is assuming we're using a
- // CCombo as our widget
- // Our eventual 'Combo' may not even use CCombo so this will most likely
- // get replaced.
- // int dropDownButtonSizeX = 16;
-
- Rectangle labelParentBounds = label.getBounds().getCopy();
- label.translateToAbsolute(labelParentBounds);
-
- int x = labelParentBounds.x;
- int y = labelParentBounds.y;
- int widthK = labelParentBounds.width;
- int height = labelParentBounds.height;
- combo.setBounds(x, y + 1, widthK, height - 2);
- }
- }
-
- // implements DirectEditPolicyDelegate
- //
- public void performEdit(CellEditor cellEditor)
- {
- ADTComboBoxCellEditor comboCellEditor = (ADTComboBoxCellEditor) cellEditor;
- CCombo combo = (CCombo) getCellEditor().getControl();
- int index = combo.getSelectionIndex();
- if (index != -1)
- {
- Object value = combo.getItem(index);
- if (comboCellEditor.getSelectedValue() != null)
- {
- value = comboCellEditor.getSelectedValue();
- }
-
- performModify(value);
- }
- else
- {
- String typedValue = combo.getText();
- if (combo.indexOf(typedValue) != -1)
- {
- performModify(typedValue);
- }
- else
- {
- String closeMatch = getCloseMatch(typedValue, combo.getItems());
- if (closeMatch != null)
- {
- performModify(closeMatch);
- }
- else
- {
- Display.getCurrent().beep();
- }
- }
- }
- }
-
- protected String getCloseMatch(String value, String[] items)
- {
- int matchIndex = -1;
-
- for (int i = 0; i < items.length; i++)
- {
- String item = items[i];
- String a = getLocalName(value);
- String b = getLocalName(item);
- if (a.equalsIgnoreCase(b))
- {
- matchIndex = i;
- break;
- }
- }
- return matchIndex != -1 ? items[matchIndex] : null;
- }
-
- protected String getLocalName(String string)
- {
- int index = string.indexOf(":"); //$NON-NLS-1$
- return (index != -1) ? string.substring(index + 1) : string;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/directedit/ElementReferenceDirectEditManager.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/directedit/ElementReferenceDirectEditManager.java
deleted file mode 100644
index 54117a2b10..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/directedit/ElementReferenceDirectEditManager.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 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.xsd.ui.internal.adt.design.directedit;
-
-import org.eclipse.draw2d.Label;
-import org.eclipse.gef.editparts.AbstractGraphicalEditPart;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.wst.xsd.ui.internal.adt.edit.ComponentReferenceEditManager;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IField;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDElementReferenceEditManager;
-
-public class ElementReferenceDirectEditManager extends ReferenceDirectEditManager
-{
- public ElementReferenceDirectEditManager(IField parameter, AbstractGraphicalEditPart source, Label label)
- {
- super(parameter, source, label);
- }
-
- protected ComponentReferenceEditManager getComponentReferenceEditManager()
- {
- ComponentReferenceEditManager result = null;
- IEditorPart editor = getActiveEditor();
- if (editor != null)
- {
- result = (ComponentReferenceEditManager)editor.getAdapter(XSDElementReferenceEditManager.class);
- }
- return result;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/directedit/LabelCellEditorLocator.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/directedit/LabelCellEditorLocator.java
deleted file mode 100644
index 0b34f8e404..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/directedit/LabelCellEditorLocator.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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.xsd.ui.internal.adt.design.directedit;
-
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.gef.tools.CellEditorLocator;
-import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.BaseFieldEditPart;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.INamedEditPart;
-import org.eclipse.wst.xsd.ui.internal.adt.design.figures.IFieldFigure;
-
-public class LabelCellEditorLocator implements CellEditorLocator
-{
- protected INamedEditPart namedEditPart;
- protected Point cursorLocation;
-
- public LabelCellEditorLocator(INamedEditPart namedEditPart, Point cursorLocation)
- {
- this.namedEditPart = namedEditPart;
- this.cursorLocation = cursorLocation;
- }
-
- public void relocate(CellEditor celleditor)
- {
- Text text = (Text) celleditor.getControl();
-
- Label label = namedEditPart.getNameLabelFigure();
- if (text.getBounds().x <= 0)
- {
- int widthToRemove = 0;
- // HACK
- if (namedEditPart instanceof BaseFieldEditPart)
- {
- BaseFieldEditPart field = (BaseFieldEditPart)namedEditPart;
- IFieldFigure fieldFigure = field.getFieldFigure();
- widthToRemove = fieldFigure.getTypeLabel().getBounds().width;
- //TODO: !! perhaps the IFieldFigure should just have a method to compute this?
- //Label typeAnnotationLabel = ((FieldFigure) field.getFigure()).getTypeAnnotationLabel();
- //Label nameAnnotationLabel = ((FieldFigure) field.getFigure()).getNameAnnotationLabel();
- //widthToRemove = typeLabel.getBounds().width + typeAnnotationLabel.getBounds().width + nameAnnotationLabel.getBounds().width;
- }
-
- Rectangle boundingRect = label.getTextBounds();
-
- // Reduce the width by the amount we shifted along the x-axis
- int delta = Math.abs(boundingRect.x - label.getParent().getBounds().x);
-
- label.getParent().translateToAbsolute(boundingRect);
- org.eclipse.swt.graphics.Rectangle trim = text.computeTrim(0, 0, 0, 0);
- boundingRect.translate(trim.x, trim.y);
- boundingRect.height = boundingRect.height - trim.y;
-
- boundingRect.width = label.getParent().getBounds().width - delta - widthToRemove;
- text.setBounds(boundingRect.x, boundingRect.y, boundingRect.width, boundingRect.height);
-
- // Translate point
- if (cursorLocation != null) {
- Point translatedPoint = new Point(cursorLocation.x - boundingRect.x, cursorLocation.y - boundingRect.y);
-
- // Calculate text offset corresponding to the translated point
- text.setSelection(0, 0);
- int xCaret = text.getCaretLocation().x;
- int offset = text.getCaretPosition();
- while (xCaret < translatedPoint.x)
- {
- text.setSelection(offset + 1, offset + 1);
- xCaret = text.getCaretLocation().x;
- int newOffset = text.getCaretPosition();
- if (newOffset == offset)
- {
- break;
- }
- offset++;
- }
- text.setSelection(offset, offset);
- }
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/directedit/LabelEditManager.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/directedit/LabelEditManager.java
deleted file mode 100644
index 884341acae..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/directedit/LabelEditManager.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 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.xsd.ui.internal.adt.design.directedit;
-
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.gef.GraphicalEditPart;
-import org.eclipse.gef.tools.CellEditorLocator;
-import org.eclipse.gef.tools.DirectEditManager;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.jface.viewers.TextCellEditor;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.actions.ActionFactory;
-import org.eclipse.ui.part.CellEditorActionHandler;
-import org.eclipse.wst.xsd.ui.internal.adt.actions.BaseSelectionAction;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.INamedEditPart;
-
-public class LabelEditManager extends DirectEditManager {
-
- private IActionBars actionBars;
- private CellEditorActionHandler actionHandler;
- private IAction copy, cut, paste, undo, redo, find, selectAll, delete;
- private Font scaledFont;
-
- public LabelEditManager(GraphicalEditPart source, CellEditorLocator locator) {
- super(source, null, locator);
- }
-
- /**
- * @see org.eclipse.gef.tools.DirectEditManager#bringDown()
- */
- protected void bringDown() {
- if (actionHandler != null) {
- actionHandler.dispose();
- actionHandler = null;
- }
- if (actionBars != null) {
- restoreSavedActions(actionBars);
- actionBars.updateActionBars();
- actionBars = null;
- }
-
- Font disposeFont = scaledFont;
- scaledFont = null;
- super.bringDown();
- if (disposeFont != null)
- disposeFont.dispose();
- }
-
- public void showFeedback() {
-// super.showFeedback();
- getEditPart().showSourceFeedback(getDirectEditRequest());
- }
-
- protected CellEditor createCellEditorOn(Composite composite) {
- return new TextCellEditor(composite, SWT.SINGLE | SWT.WRAP);
- }
-
- protected void initCellEditor() {
- Text text = (Text)getCellEditor().getControl();
- Label label = ((INamedEditPart) getEditPart()).getNameLabelFigure();
-
- if (label != null) {
- scaledFont = label.getFont();
-
- Color color = label.getBackgroundColor();
- text.setBackground(color);
-
- String initialLabelText = label.getText();
- getCellEditor().setValue(initialLabelText);
- }
- else {
- scaledFont = label.getParent().getFont();
- text.setBackground(label.getParent().getBackgroundColor());
- }
-
- FontData data = scaledFont.getFontData()[0];
- Dimension fontSize = new Dimension(0, data.getHeight());
- label.getParent().translateToAbsolute(fontSize);
- data.setHeight(fontSize.height);
- scaledFont = new Font(null, data);
-
- text.setFont(scaledFont);
-// text.selectAll();
-
- // Hook the cell editor's copy/paste actions to the actionBars so that they can
- // be invoked via keyboard shortcuts.
- actionBars = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
- .getActiveEditor().getEditorSite().getActionBars();
- saveCurrentActions(actionBars);
- actionHandler = new CellEditorActionHandler(actionBars);
- actionHandler.addCellEditor(getCellEditor());
- actionBars.updateActionBars();
- }
-
- private void restoreSavedActions(IActionBars actionBars){
- actionBars.setGlobalActionHandler(ActionFactory.COPY.getId(), copy);
- actionBars.setGlobalActionHandler(ActionFactory.PASTE.getId(), paste);
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=252509
- // Delete action (key) doesn't always work. The saved action could be the
- // CellEditorActionHandler's DeleteActionHandler...due to timing issues.
- // We'll only restore the delete action if it is indeed the one for the Design view.
- // We should update the other actions too, but currently, none are applicable.
- if (delete instanceof BaseSelectionAction)
- {
- actionBars.setGlobalActionHandler(ActionFactory.DELETE.getId(), delete);
- }
- actionBars.setGlobalActionHandler(ActionFactory.SELECT_ALL.getId(), selectAll);
- actionBars.setGlobalActionHandler(ActionFactory.CUT.getId(), cut);
- actionBars.setGlobalActionHandler(ActionFactory.FIND.getId(), find);
- actionBars.setGlobalActionHandler(ActionFactory.UNDO.getId(), undo);
- actionBars.setGlobalActionHandler(ActionFactory.REDO.getId(), redo);
- }
-
- private void saveCurrentActions(IActionBars actionBars) {
- copy = actionBars.getGlobalActionHandler(ActionFactory.COPY.getId());
- paste = actionBars.getGlobalActionHandler(ActionFactory.PASTE.getId());
- IAction currentDeleteAction = actionBars.getGlobalActionHandler(ActionFactory.DELETE.getId());
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=252509
- // Delete action (key) doesn't always work. The saved action could be the
- // CellEditorActionHandler's DeleteActionHandler...due to timing issues.
- // We'll only restore the delete action if it is indeed the one for the Design view.
- // We should update the other actions too, but currently, none are applicable.
- if (currentDeleteAction instanceof BaseSelectionAction)
- {
- delete = currentDeleteAction;
- }
- selectAll = actionBars.getGlobalActionHandler(ActionFactory.SELECT_ALL.getId());
- cut = actionBars.getGlobalActionHandler(ActionFactory.CUT.getId());
- find = actionBars.getGlobalActionHandler(ActionFactory.FIND.getId());
- undo = actionBars.getGlobalActionHandler(ActionFactory.UNDO.getId());
- redo = actionBars.getGlobalActionHandler(ActionFactory.REDO.getId());
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/directedit/ReferenceDirectEditManager.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/directedit/ReferenceDirectEditManager.java
deleted file mode 100644
index 7ced90db3c..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/directedit/ReferenceDirectEditManager.java
+++ /dev/null
@@ -1,180 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.adt.design.directedit;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.draw2d.Label;
-import org.eclipse.gef.editparts.AbstractGraphicalEditPart;
-import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSpecification;
-import org.eclipse.wst.xsd.ui.internal.adt.edit.ComponentReferenceEditManager;
-import org.eclipse.wst.xsd.ui.internal.editor.Messages;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IField;
-
-public abstract class ReferenceDirectEditManager extends ComboBoxCellEditorManager
-{
- protected AbstractGraphicalEditPart editPart;
- protected IField setObject;
-
- public ReferenceDirectEditManager(IField parameter, AbstractGraphicalEditPart source, Label label)
- {
- super(source, label);
- editPart = source;
- setObject = parameter;
- }
-
- protected CellEditor createCellEditorOn(Composite composite)
- {
- return super.createCellEditorOn(composite);
- }
-
- protected List computeComboContent()
- {
- List list = new ArrayList();
- ComponentReferenceEditManager editManager = getComponentReferenceEditManager();
- if (editManager != null)
- {
- list.add(Messages._UI_COMBO_BROWSE);
- list.add(Messages._UI_COMBO_NEW);
- ComponentSpecification[] quickPicks = editManager.getQuickPicks();
- if (quickPicks != null)
- {
- for (int i=0; i < quickPicks.length; i++)
- {
- ComponentSpecification componentSpecification = quickPicks[i];
- list.add(componentSpecification.getName());
- }
- }
- ComponentSpecification[] history = editManager.getHistory();
- if (history != null)
- {
- for (int i=0; i < history.length; i++)
- {
- ComponentSpecification componentSpecification = history[i];
- list.add(componentSpecification.getName());
- }
- }
- }
- return list;
- }
-
- protected ComponentSpecification getComponentSpecificationForValue(String value)
- {
- ComponentReferenceEditManager editManager = getComponentReferenceEditManager();
- if (editManager != null)
- {
- ComponentSpecification[] quickPicks = editManager.getQuickPicks();
- if (quickPicks != null)
- {
- for (int i=0; i < quickPicks.length; i++)
- {
- ComponentSpecification componentSpecification = quickPicks[i];
- if (value.equals(componentSpecification.getName()))
- {
- return componentSpecification;
- }
- }
- }
- ComponentSpecification[] history = editManager.getHistory();
- if (history != null)
- {
- for (int i=0; i < history.length; i++)
- {
- ComponentSpecification componentSpecification = history[i];
- if (value.equals(componentSpecification.getName()))
- {
- return componentSpecification;
- }
- }
- }
- }
- return null;
- }
-
- public void performModify(Object value)
- {
- ComponentReferenceEditManager editManager = getComponentReferenceEditManager();
- if (editManager == null)
- {
- return;
- }
-
- // our crude combo box can only work with 'String' objects
- // if we get a String back we need to do some clever mapping to get the ComponentSpecification
- //
- if (value instanceof String)
- {
- value = getComponentSpecificationForValue((String)value);
- }
- // we assume the selected value is always of the form of a ComponentSpecification
- //
- if (value instanceof ComponentSpecification)
- {
- // we need to perform an asyncExec here since the 'host' editpart may be
- // removed as a side effect of performing the action
- DelayedSetReferenceRunnable runnable = new DelayedSetReferenceRunnable(editManager, setObject, (ComponentSpecification)value);
- //runnable.run();
- Display.getCurrent().asyncExec(runnable);
- }
- }
-
- protected List computeSortedList(List list)
- {
- // return TypesHelper.sortList(list);
- return list;
- }
-
- protected CellEditor createCellEditor(Composite composite, String[] stringArray)
- {
- ADTComboBoxCellEditor cellEditor = new ADTComboBoxCellEditor(composite, stringArray, getComponentReferenceEditManager());
- //((ADTComboBoxCellEditor) cellEditor).setObjectToModify(setObject);
- return cellEditor;
- }
-
- protected abstract ComponentReferenceEditManager getComponentReferenceEditManager();
-
- protected IEditorPart getActiveEditor()
- {
- IWorkbench workbench = PlatformUI.getWorkbench();
- IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
- IEditorPart editorPart = workbenchWindow.getActivePage().getActiveEditor();
- return editorPart;
- }
-
- protected class DelayedSetReferenceRunnable implements Runnable
- {
- protected ComponentReferenceEditManager componentReferenceEditManager;
- protected ComponentSpecification newValue;
- protected IField field;
-
- public DelayedSetReferenceRunnable(ComponentReferenceEditManager componentReferenceEditManager,
- IField setObject, ComponentSpecification selectedValue)
- {
- this.componentReferenceEditManager = componentReferenceEditManager;
- newValue = selectedValue;
- field = setObject;
- }
-
- public void run()
- {
- componentReferenceEditManager.modifyComponentReference(field, newValue);
- }
- }
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/directedit/TypeReferenceDirectEditManager.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/directedit/TypeReferenceDirectEditManager.java
deleted file mode 100644
index dbebae1ddb..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/directedit/TypeReferenceDirectEditManager.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 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.xsd.ui.internal.adt.design.directedit;
-
-import org.eclipse.draw2d.Label;
-import org.eclipse.gef.editparts.AbstractGraphicalEditPart;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.wst.xsd.ui.internal.adt.edit.ComponentReferenceEditManager;
-import org.eclipse.wst.xsd.ui.internal.adt.edit.ComponentReferenceEditManager2;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IField;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDTypeReferenceEditManager;
-
-public class TypeReferenceDirectEditManager extends ReferenceDirectEditManager //ComboBoxCellEditorManager
-{
- public TypeReferenceDirectEditManager(IField parameter, AbstractGraphicalEditPart source, Label label)
- {
- super(parameter, source, label);
- }
-
- protected ComponentReferenceEditManager getComponentReferenceEditManager()
- {
- ComponentReferenceEditManager result = null;
- IEditorPart editor = getActiveEditor();
- if (editor != null)
- {
- result = (ComponentReferenceEditManager)editor.getAdapter(XSDTypeReferenceEditManager.class);
- if (result instanceof ComponentReferenceEditManager2)
- {
- ComponentReferenceEditManager2 manager = (ComponentReferenceEditManager2)result;
- manager.setReferencer(setObject);
- }
- }
- return result;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/ADTEditPartFactory.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/ADTEditPartFactory.java
deleted file mode 100644
index 26426048ab..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/ADTEditPartFactory.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 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.xsd.ui.internal.adt.design.editparts;
-
-import org.eclipse.draw2d.ToolbarLayout;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.EditPartFactory;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.wst.xsd.ui.internal.adt.design.ADTFloatingToolbar.ADTFloatingToolbarModel;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.AbstractModelCollection;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.Compartment;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.FocusTypeColumn;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.RootHolder;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IComplexType;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IField;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IModel;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IStructure;
-
-public class ADTEditPartFactory implements EditPartFactory
-{
- public EditPart createEditPart(EditPart context, Object model)
- {
- EditPart child = doCreateEditPart(context, model);
- checkChild(child, model);
- return child;
- }
-
- protected EditPart doCreateEditPart(EditPart context, Object model)
- {
- EditPart child = null;
- if (model instanceof Compartment)
- {
- child = new CompartmentEditPart();
- }
- else if (model instanceof RootHolder)
- {
- child = new RootHolderEditPart();
- }
- else if (model instanceof ADTFloatingToolbarModel)
- {
- child = new ADTFloatingToolbarEditPart(((ADTFloatingToolbarModel)model).getModel());
- }
- else if (model instanceof AbstractModelCollection)
- {
- child = new ColumnEditPart();
- if (model instanceof FocusTypeColumn)
- {
- ColumnEditPart columnEditPart = (ColumnEditPart)child;
- columnEditPart.setSpacing(60);
- columnEditPart.setMinorAlignment(ToolbarLayout.ALIGN_CENTER);
- }
- }
- else if (model instanceof IComplexType)
- {
- child = new ComplexTypeEditPart();
- }
- else if (model instanceof IStructure)
- {
- child = new StructureEditPart();
- }
- else if (model instanceof IField)
- {
- if (context instanceof CompartmentEditPart)
- {
- child = new FieldEditPart();
- }
- else
- {
- child = new TopLevelFieldEditPart();
- }
- }
- else if (model instanceof IModel)
- {
- child = new RootContentEditPart();
- }
- return child;
- }
-
- /**
- * Subclasses can override and not check for null
- *
- * @param child
- * @param model
- */
- protected void checkChild(EditPart child, Object model)
- {
- if (child == null)
- {
- // Thread.dumpStack();
- }
- Assert.isNotNull(child);
- child.setModel(model);
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/ADTFloatingToolbarEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/ADTFloatingToolbarEditPart.java
deleted file mode 100644
index 46b8be98cd..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/ADTFloatingToolbarEditPart.java
+++ /dev/null
@@ -1,227 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.xsd.ui.internal.adt.design.editparts;
-
-import java.awt.event.KeyEvent;
-
-import org.eclipse.draw2d.ColorConstants;
-import org.eclipse.draw2d.Figure;
-import org.eclipse.draw2d.FocusEvent;
-import org.eclipse.draw2d.FocusListener;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.KeyListener;
-import org.eclipse.draw2d.MouseEvent;
-import org.eclipse.draw2d.MouseListener;
-import org.eclipse.draw2d.MouseMotionListener;
-import org.eclipse.draw2d.ToolbarLayout;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.wst.xsd.ui.internal.adt.actions.SetInputToGraphView;
-import org.eclipse.wst.xsd.ui.internal.adt.editor.Messages;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IModel;
-import org.eclipse.wst.xsd.ui.internal.design.figures.CenteredIconFigure;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin;
-
-public class ADTFloatingToolbarEditPart extends BaseEditPart
-{
- protected IModel model;
- protected boolean isDrilledDown;
- protected ADTToolbarButton backToSchema;
-
- public ADTFloatingToolbarEditPart(IModel model)
- {
- this.model = model;
- }
-
- protected IFigure createFigure()
- {
- Figure figure = new Figure();
- ToolbarLayout tb = new ToolbarLayout(true);
- tb.setStretchMinorAxis(false);
- tb.setSpacing(3);
- figure.setLayoutManager(tb);
-
- backToSchema = new ADTToolbarButton(XSDEditorPlugin.getPlugin().getIcon("elcl16/schemaview_co.gif"));
- backToSchema.setToolTipText(Messages._UI_HOVER_BACK_TO_SCHEMA);
- backToSchema.setBackgroundColor(ColorConstants.white);
- backToSchema.setFocusTraversable(true);
- figure.add(backToSchema);
- figure.setBounds(new Rectangle(0,0,24,24));
- addToToolbar(figure);
- return figure;
- }
-
- protected void addToToolbar(IFigure figure)
- {
-
- }
-
- public void setIsDrilledDown(boolean isDrilledDown)
- {
- this.isDrilledDown = isDrilledDown;
- }
-
- protected void refreshVisuals()
- {
- super.refreshVisuals();
- backToSchema.isEnabled = isDrilledDown;
- if (isDrilledDown)
- {
- backToSchema.image = XSDEditorPlugin.getPlugin().getIcon("elcl16/schemaview_co.gif");
- }
- else
- {
- backToSchema.image = XSDEditorPlugin.getPlugin().getIcon("dlcl16/schemaview_co.gif");
- }
- backToSchema.refresh();
- }
-
- protected void doAction(MouseEvent me)
- {
- IEditorPart editorPart = getActionEditorPart();
-
- if (backToSchema.getBounds().contains(me.getLocation()))
- {
- SetInputToGraphView action = new SetInputToGraphView(editorPart, model);
- action.run();
- }
- }
-
- protected void doAction(org.eclipse.draw2d.KeyEvent ke)
- {
- IEditorPart editorPart = getActionEditorPart();
- SetInputToGraphView action = new SetInputToGraphView(editorPart, model);
- action.run();
- }
-
- private IEditorPart getActionEditorPart()
- {
- IWorkbench workbench = PlatformUI.getWorkbench();
- IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
- IEditorPart editorPart = workbenchWindow.getActivePage().getActiveEditor();
- return editorPart;
- }
-
-
- protected class ADTToolbarButton extends CenteredIconFigure
- {
- protected MouseListener mouseListener;
- protected org.eclipse.draw2d.KeyListener keyListener;
- protected FocusListener focusListener;
- public boolean isEnabled;
-
- public ADTToolbarButton(Image img)
- {
- super();
- this.image = img;
-
- mouseListener = new MouseListener.Stub()
- {
- public void mousePressed(org.eclipse.draw2d.MouseEvent me)
- {
- if (isEnabled)
- {
- addFeedback();
- }
- }
-
- public void mouseReleased(org.eclipse.draw2d.MouseEvent me)
- {
- if (isEnabled)
- {
- removeFeedback();
- doAction(me);
- }
- }
- };
- addMouseListener(mouseListener);
- addMouseMotionListener(new MouseMotionListener.Stub()
- {
- public void mouseExited(MouseEvent me)
- {
- removeFeedback();
- }
- });
-
- keyListener = new KeyListener.Stub()
- {
- public void keyPressed(org.eclipse.draw2d.KeyEvent ke)
- {
- boolean isValidKey = (ke.keycode == KeyEvent.VK_SPACE);
- isValidKey = isValidKey || (ke.character == SWT.CR || ke.character == SWT.LF);
- if (isEnabled && isValidKey)
- {
- addFeedback();
- }
- }
-
- public void keyReleased(org.eclipse.draw2d.KeyEvent ke)
- {
- boolean isValidKey = (ke.keycode == KeyEvent.VK_SPACE);
- isValidKey = isValidKey || (ke.character == SWT.CR || ke.character == SWT.LF);
- if (isEnabled && isValidKey)
- {
- removeFeedback();
- doAction(ke);
- }
- }
- };
- addKeyListener(keyListener);
-
- focusListener = new FocusListener(){
-
- public void focusGained(FocusEvent fe) {
- setMode(CenteredIconFigure.HOVER);
- refresh();
- }
-
- public void focusLost(FocusEvent fe) {
- setMode(CenteredIconFigure.NORMAL);
- refresh();
- }
- };
-
- addFocusListener(focusListener);
- }
-
- public void addFeedback()
- {
- setMode(CenteredIconFigure.SELECTED);
- refresh();
- }
-
- public void removeFeedback()
- {
- setMode(CenteredIconFigure.NORMAL);
- refresh();
- }
-
- public Rectangle getBounds()
- {
- Rectangle r = super.getBounds();
- org.eclipse.swt.graphics.Rectangle rect = image.getBounds();
- return new Rectangle(r.x, r.y, rect.width + 8, rect.height + 8);
- }
-
- public Dimension getPreferredSize(int hint, int hint2)
- {
- org.eclipse.swt.graphics.Rectangle rect = image.getBounds();
- return new Dimension(rect.width + 8, rect.height + 8);
- }
- }
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/BackToSchemaEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/BackToSchemaEditPart.java
deleted file mode 100644
index f79ed6ce9a..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/BackToSchemaEditPart.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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.xsd.ui.internal.adt.design.editparts;
-
-import org.eclipse.draw2d.ColorConstants;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.MouseListener;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.RequestConstants;
-import org.eclipse.ui.part.MultiPageEditorPart;
-import org.eclipse.wst.xsd.ui.internal.adt.actions.SetInputToGraphView;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.IFeedbackHandler;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editpolicies.ADTDirectEditPolicy;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editpolicies.ADTSelectionFeedbackEditPolicy;
-import org.eclipse.wst.xsd.ui.internal.adt.editor.ADTMultiPageEditor;
-import org.eclipse.wst.xsd.ui.internal.design.figures.CenteredIconFigure;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin;
-
-public class BackToSchemaEditPart extends BaseEditPart implements IFeedbackHandler
-{
- protected MultiPageEditorPart multipageEditor;
- protected ADTDirectEditPolicy adtDirectEditPolicy = new ADTDirectEditPolicy();
- protected boolean isEnabled;
- protected CenteredIconFigure backToSchema;
- protected MouseListener mouseListener;
-
- public BackToSchemaEditPart(ADTMultiPageEditor multipageEditor)
- {
- super();
- this.multipageEditor = multipageEditor;
- }
-
- protected IFigure createFigure()
- {
- backToSchema = new CenteredIconFigure();
- backToSchema.setBackgroundColor(ColorConstants.white);
- backToSchema.image = XSDEditorPlugin.getPlugin().getIcon("elcl16/schemaview_co.gif");
- // TODO, look at why the editpolicy doesn't work
- mouseListener = new MouseListener()
- {
- public void mouseDoubleClicked(org.eclipse.draw2d.MouseEvent me)
- {
-
- }
-
- public void mousePressed(org.eclipse.draw2d.MouseEvent me)
- {
- if (isEnabled)
- {
- addFeedback();
- }
- }
-
- public void mouseReleased(org.eclipse.draw2d.MouseEvent me)
- {
- if (isEnabled)
- {
- removeFeedback();
- SetInputToGraphView action = new SetInputToGraphView(multipageEditor, getModel());
- action.run();
- }
- }
- };
- backToSchema.addMouseListener(mouseListener);
- return backToSchema;
- }
-
-
- public void setEnabled(boolean isEnabled)
- {
- this.isEnabled = isEnabled;
- refreshVisuals();
- }
-
- protected void createEditPolicies()
- {
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, adtDirectEditPolicy);
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new ADTSelectionFeedbackEditPolicy());
- }
-
- public void performRequest(Request request)
- {
- if (request.getType() == RequestConstants.REQ_DIRECT_EDIT || request.getType() == RequestConstants.REQ_OPEN)
- {
- SetInputToGraphView action = new SetInputToGraphView(multipageEditor, getModel());
- action.run();
- }
- }
-
- protected void refreshVisuals()
- {
- super.refreshVisuals();
- CenteredIconFigure figure = (CenteredIconFigure) getFigure();
- if (isEnabled)
- {
- backToSchema.image = XSDEditorPlugin.getPlugin().getIcon("elcl16/schemaview_co.gif");
- }
- else
- {
- backToSchema.image = XSDEditorPlugin.getPlugin().getIcon("dlcl16/schemaview_co.gif");
- }
- figure.refresh();
- }
-
- public void addFeedback()
- {
- CenteredIconFigure figure = (CenteredIconFigure) getFigure();
- figure.setMode(CenteredIconFigure.SELECTED);
- figure.refresh();
- }
-
- public void removeFeedback()
- {
- CenteredIconFigure figure = (CenteredIconFigure) getFigure();
- figure.setMode(CenteredIconFigure.NORMAL);
- figure.refresh();
- }
-
- public void deactivate()
- {
- backToSchema.removeMouseListener(mouseListener);
- super.deactivate();
- }
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/BaseEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/BaseEditPart.java
deleted file mode 100644
index 357e63489f..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/BaseEditPart.java
+++ /dev/null
@@ -1,300 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.adt.design.editparts;
-
-import java.util.List;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.gef.AccessibleEditPart;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.EditPartFactory;
-import org.eclipse.gef.GraphicalViewer;
-import org.eclipse.gef.editparts.AbstractGraphicalEditPart;
-import org.eclipse.gef.editparts.ScalableRootEditPart;
-import org.eclipse.gef.editparts.ZoomListener;
-import org.eclipse.gef.editparts.ZoomManager;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.ide.FileStoreEditorInput;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.IActionProvider;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.IFeedbackHandler;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editpolicies.KeyBoardAccessibilityEditPolicy;
-import org.eclipse.wst.xsd.ui.internal.adt.design.figures.IFigureFactory;
-import org.eclipse.wst.xsd.ui.internal.adt.editor.CommonMultiPageEditor;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObjectListener;
-
-public abstract class BaseEditPart extends AbstractGraphicalEditPart implements IActionProvider, IADTObjectListener, IFeedbackHandler
-{
- protected static final String[] EMPTY_ACTION_ARRAY = {};
- protected boolean isSelected = false;
- protected boolean hasFocus = false;
- protected static boolean isHighContrast = Display.getDefault().getHighContrast();
- protected AccessibleEditPart accessiblePart;
-
- public IFigureFactory getFigureFactory()
- {
- EditPartFactory factory = getViewer().getEditPartFactory();
- Assert.isTrue(factory instanceof IFigureFactory, "EditPartFactory must be an instanceof of IFigureFactory"); //$NON-NLS-1$
- return (IFigureFactory)factory;
- }
-
- public String[] getActions(Object object)
- {
- Object model = getModel();
- if (model instanceof IActionProvider)
- {
- return ((IActionProvider)model).getActions(object);
- }
- return EMPTY_ACTION_ARRAY;
- }
-
- protected void addActionsToList(List list, IAction[] actions)
- {
- for (int i = 0; i < actions.length; i++)
- {
- list.add(actions[i]);
- }
- }
-
- public void activate()
- {
- super.activate();
- Object model = getModel();
- if (model instanceof IADTObject)
- {
- IADTObject object = (IADTObject)model;
- object.registerListener(this);
- }
-
- if (getZoomManager() != null)
- getZoomManager().addZoomListener(zoomListener);
-
- }
-
- public void deactivate()
- {
- try
- {
- Object model = getModel();
- if (model instanceof IADTObject)
- {
- IADTObject object = (IADTObject)model;
- object.unregisterListener(this);
- }
-
- if (getZoomManager() != null)
- getZoomManager().removeZoomListener(zoomListener);
- }
- finally
- {
- super.deactivate();
- }
- }
-
- public void propertyChanged(Object object, String property)
- {
- refresh();
- }
-
- public void refresh() {
-
- boolean doUpdateDesign = doUpdateDesign();
- if (doUpdateDesign)
- {
- super.refresh();
- }
- }
-
- public void addFeedback()
- {
- isSelected = true;
- refreshVisuals();
- }
-
- public void removeFeedback()
- {
- isSelected = false;
- refreshVisuals();
- }
-
- public ZoomManager getZoomManager()
- {
- return ((ScalableRootEditPart)getRoot()).getZoomManager();
- }
-
- public Rectangle getZoomedBounds(Rectangle r)
- {
- double factor = getZoomManager().getZoom();
- int x = (int)Math.round(r.x * factor);
- int y = (int)Math.round(r.y * factor);
- int width = (int)Math.round(r.width * factor);
- int height = (int)Math.round(r.height * factor);
-
- return new Rectangle(x, y, width, height);
- }
-
- private ZoomListener zoomListener = new ZoomListener()
- {
- public void zoomChanged(double zoom)
- {
- handleZoomChanged();
- }
- };
-
- protected void handleZoomChanged()
- {
- refreshVisuals();
- }
-
- public IEditorPart getEditorPart()
- {
- IEditorPart editorPart = null;
- IWorkbench workbench = PlatformUI.getWorkbench();
- if (workbench != null)
- {
- IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
- if (workbenchWindow != null)
- {
- if (workbenchWindow.getActivePage() != null)
- {
- editorPart = workbenchWindow.getActivePage().getActiveEditor();
- }
- }
- }
-// Assert.isNotNull(editorPart);
- return editorPart;
- }
-
- protected void createEditPolicies()
- {
- installEditPolicy(KeyBoardAccessibilityEditPolicy.KEY, new KeyBoardAccessibilityEditPolicy()
- {
- public EditPart getRelativeEditPart(EditPart editPart, int direction)
- {
- return doGetRelativeEditPart(editPart, direction);
- }
- });
- }
-
-
- public EditPart doGetRelativeEditPart(EditPart editPart, int direction)
- {
- return null;
- }
-
- protected boolean isFileReadOnly()
- {
- IWorkbench workbench = PlatformUI.getWorkbench();
- if (workbench != null)
- {
- IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
- if (workbenchWindow != null)
- {
- IWorkbenchPage page = workbenchWindow.getActivePage();
- if (page != null)
- {
- IEditorPart editor = page.getActiveEditor();
- if (editor != null)
- {
- IEditorInput editorInput = editor.getEditorInput();
- if (!(editorInput instanceof IFileEditorInput || editorInput instanceof FileStoreEditorInput))
- {
- return true;
- }
- }
- }
- }
- }
- return false;
- }
-
- // For https://bugs.eclipse.org/bugs/show_bug.cgi?id=218281
- // Don't want to refresh the design when changes are made in the source view.
- protected boolean doUpdateDesign()
- {
- IWorkbench workbench = PlatformUI.getWorkbench();
- if (workbench != null)
- {
- IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
- if (workbenchWindow != null)
- {
- IWorkbenchPage page = workbenchWindow.getActivePage();
- if (page != null)
- {
- IEditorPart editorPart = page.getActiveEditor();
- if (editorPart instanceof CommonMultiPageEditor)
- {
- CommonMultiPageEditor editor = (CommonMultiPageEditor) editorPart;
- GraphicalViewer viewer = (GraphicalViewer)editor.getAdapter(GraphicalViewer.class);
- // Need to ensure this is the same editor we are working with since the active editor may not be
- // the current, eg. at startup, there can be another XSD Editor open on the source page, so we could end
- // up not populating the design view initally
- if (getViewer() == viewer)
- {
- // If source page is active, don't update the design
- return !editor.isSourcePageActive();
- }
- }
- }
- }
- }
- return true;
- }
-
- /**
- * Try to get the italic font for the current font
- * @param font
- * @return
- */
- protected Font getItalicFont(Font font)
- {
- if (font != null && !font.isDisposed())
- {
- FontData[] fd = font.getFontData();
- if (fd.length > 0)
- {
- fd[0].setStyle(fd[0].getStyle() | SWT.ITALIC);
- return new Font(font.getDevice(), fd);
- }
- }
- return font;
- }
- protected AccessibleEditPart getAccessibleEditPart() {
-
- if (accessiblePart ==null)
- {
- accessiblePart = new AccessibleGraphicalEditPart(){
-
- public void getName(AccessibleEvent e) {
- e.result = getReaderText();
- }
- };
- }
- return accessiblePart;
- }
-public String getReaderText()
-{
- return "";
-}
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/BaseFieldEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/BaseFieldEditPart.java
deleted file mode 100644
index e40978037d..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/BaseFieldEditPart.java
+++ /dev/null
@@ -1,535 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2009 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.xsd.ui.internal.adt.design.editparts;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.draw2d.ColorConstants;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.PositionConstants;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.gef.DragTracker;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.GraphicalEditPart;
-import org.eclipse.gef.LayerConstants;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.RequestConstants;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.editparts.AbstractGraphicalEditPart;
-import org.eclipse.gef.requests.DirectEditRequest;
-import org.eclipse.gef.requests.LocationRequest;
-import org.eclipse.swt.custom.CCombo;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDBaseAdapter;
-import org.eclipse.wst.xsd.ui.internal.adt.design.directedit.ComboBoxCellEditorManager;
-import org.eclipse.wst.xsd.ui.internal.adt.design.directedit.ElementReferenceDirectEditManager;
-import org.eclipse.wst.xsd.ui.internal.adt.design.directedit.LabelCellEditorLocator;
-import org.eclipse.wst.xsd.ui.internal.adt.design.directedit.LabelEditManager;
-import org.eclipse.wst.xsd.ui.internal.adt.design.directedit.TypeReferenceDirectEditManager;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.FocusTypeColumn;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editpolicies.ADTDirectEditPolicy;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editpolicies.ADTSelectionFeedbackEditPolicy;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editpolicies.IADTUpdateCommand;
-import org.eclipse.wst.xsd.ui.internal.adt.design.figures.IFieldFigure;
-import org.eclipse.wst.xsd.ui.internal.adt.editor.Messages;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IField;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IType;
-import org.eclipse.wst.xsd.ui.internal.design.editparts.ConnectableEditPart;
-import org.eclipse.wst.xsd.ui.internal.design.editparts.TargetConnectionSpacingFigureEditPart;
-import org.eclipse.wst.xsd.ui.internal.design.editparts.model.TargetConnectionSpaceFiller;
-import org.eclipse.wst.xsd.ui.internal.design.editpolicies.GraphNodeDragTracker;
-import org.eclipse.xsd.XSDNamedComponent;
-
-public class BaseFieldEditPart extends BaseTypeConnectingEditPart implements INamedEditPart, IAutoDirectEdit
-{
- protected TypeReferenceConnection connectionFigure;
- protected ADTDirectEditPolicy adtDirectEditPolicy = new ADTDirectEditPolicy();
- protected TypeReferenceConnection connectionFeedbackFigure;
-
- protected IFigure createFigure()
- {
- IFieldFigure figure = getFigureFactory().createFieldFigure(getModel());
- figure.setForegroundColor(ColorConstants.black);
- return figure;
- }
-
- public IFieldFigure getFieldFigure()
- {
- return (IFieldFigure)figure;
- }
-
-
- protected boolean shouldDrawConnection()
- {
- boolean result = false;
-
- // For now we only want to produce outbound lines from a Field to a Type
- // when the field in contained in the 'focus' edit part
- for (EditPart parent = getParent(); parent != null; parent = parent.getParent())
- {
- if (parent.getModel() instanceof FocusTypeColumn)
- {
- result = true;
- break;
- }
- }
- return result;
- }
-
- private EditPart getTargetEditPart(IType type)
- {
- ColumnEditPart columnEditPart = null;
- for (EditPart editPart = this; editPart != null; editPart = editPart.getParent())
- {
- if (editPart instanceof ColumnEditPart)
- {
- columnEditPart = (ColumnEditPart)editPart;
- break;
- }
- }
- if (columnEditPart != null)
- {
- // get the next column
- EditPart parent = columnEditPart.getParent();
- List columns = parent.getChildren();
- int index = columns.indexOf(columnEditPart);
- if (index + 1 < columns.size())
- {
- EditPart nextColumn = (EditPart)columns.get(index + 1);
- for (Iterator i = nextColumn.getChildren().iterator(); i.hasNext(); )
- {
- EditPart child = (EditPart)i.next();
- if (child.getModel() == type)
- {
- return child;
- }
- }
- }
- }
- return null;
- }
-
- private EditPart getTargetConnectionEditPart()
- {
- EditPart result = null;
- IField field = (IField)getModel();
- IType type = field.getType();
- if (type != null)
- {
- result = getTargetEP(type); //getTargetEditPart(type);
- }
- return result;
- }
-
- /**
- * Do not override
- * @param type
- * @return
- */
- protected EditPart getTargetEP(IType type)
- {
- return getTargetEditPart(type);
- }
-
- public TypeReferenceConnection createConnectionFigure()
- {
- connectionFigure = null;
- AbstractGraphicalEditPart referenceTypePart = (AbstractGraphicalEditPart)getTargetConnectionEditPart();
- if (referenceTypePart != null)
- {
- connectionFigure = new TypeReferenceConnection();
-
- if (getFigure().getParent() == referenceTypePart.getFigure())
- {
- connectionFigure.setSourceAnchor(new CenteredConnectionAnchor(getFigure(), CenteredConnectionAnchor.LEFT, 1));
- }
- else
- {
- connectionFigure.setSourceAnchor(new CenteredConnectionAnchor(getFigure(), CenteredConnectionAnchor.RIGHT, 5));
- }
- int targetAnchorYOffset = 8;
-
- connectionFigure.setTargetAnchor(new CenteredConnectionAnchor(referenceTypePart.getFigure(), CenteredConnectionAnchor.HEADER_LEFT, 0, targetAnchorYOffset));
- connectionFigure.setHighlight(false);
- }
-
- return connectionFigure;
- }
-
- protected void createEditPolicies()
- {
- super.createEditPolicies();
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, adtDirectEditPolicy);
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new ADTSelectionFeedbackEditPolicy());
- }
-
- public EditPart doGetRelativeEditPart(EditPart editPart, int direction)
- {
- EditPart result = null;
- if (direction == PositionConstants.EAST)
- {
- result = getTargetConnectionEditPart();
- }
- else if (direction == PositionConstants.WEST)
- {
- for (Iterator iter = getParent().getChildren().iterator(); iter.hasNext(); )
- {
- Object child = iter.next();
- if (child instanceof SectionEditPart)
- {
- SectionEditPart groups = (SectionEditPart) child;
- for (Iterator i = groups.getChildren().iterator(); i.hasNext(); )
- {
- Object groupChild = i.next();
- EditPart connectable = getParentConnectableEditPart((EditPart)groupChild);
- if (connectable != null)
- {
- result = connectable;
- }
- }
- }
- }
- if (result == null)
- {
- result = this;
- }
- }
- else
- {
- result = super.doGetRelativeEditPart(editPart, direction);
- if (result == null)
- {
- result = ((BaseEditPart)getParent()).doGetRelativeEditPart(editPart, direction);
- }
- }
- return result;
- }
-
- protected ConnectableEditPart getParentConnectableEditPart(EditPart connectable)
- {
- if (connectable instanceof TargetConnectionSpacingFigureEditPart)
- {
- TargetConnectionSpaceFiller space = (TargetConnectionSpaceFiller) ((TargetConnectionSpacingFigureEditPart)connectable).getModel();
- if (space.getAdapter() == this.getModel())
- {
- return (ConnectableEditPart)connectable;
- }
- }
-
- for (Iterator i = connectable.getChildren().iterator(); i.hasNext(); )
- {
- Object child = i.next();
- if (child instanceof ConnectableEditPart)
- {
- ConnectableEditPart r = getParentConnectableEditPart((EditPart)child);
- if (r != null) return r;
- }
- else if (child instanceof TargetConnectionSpacingFigureEditPart)
- {
- TargetConnectionSpaceFiller space = (TargetConnectionSpaceFiller) ((TargetConnectionSpacingFigureEditPart)child).getModel();
- if (space.getAdapter() == this.getModel() && connectable instanceof ConnectableEditPart)
- {
- return (ConnectableEditPart)connectable;
- }
- }
- }
- return null;
- }
-
- protected void refreshVisuals()
- {
- super.refreshVisuals();
- IFieldFigure figure = getFieldFigure();
- IField field = (IField) getModel();
-
- figure.getNameLabel().setText(field.getName());
- figure.getTypeLabel().setText(field.getTypeName());
- figure.refreshVisuals(getModel());
-
- figure.recomputeLayout();
-
- ((GraphicalEditPart)getRoot()).getFigure().invalidateTree();
- }
-
- public DragTracker getDragTracker(Request request)
- {
- return new GraphNodeDragTracker(this);
- }
-
- /*
- public IAction[] getActions(Object object)
- {
- // when a FieldEditPart is selected it provides it's own actions
- // as well as those of it's parent 'type' edit part
- List list = new ArrayList();
- EditPart compartment = getParent();
- if (compartment != null)
- {
- EditPart type = compartment.getParent();
- if (type != null && type instanceof IActionProvider)
- {
- IActionProvider provider = (IActionProvider)type;
- addActionsToList(list, provider.getActions(object));
- }
- }
- addActionsToList(list, super.getActions(object));
- IAction[] result = new IAction[list.size()];
- list.toArray(result);
- return result;
- }*/
-
- public Label getNameLabelFigure()
- {
- return getFieldFigure().getNameLabel();
- }
-
- public void performDirectEdit(Point cursorLocation)
- {
-
- }
-
- public void performRequest(Request request)
- {
- if (((IADTObject)getModel()).isReadOnly() || isFileReadOnly())
- {
- return;
- }
- if (request.getType() == RequestConstants.REQ_DIRECT_EDIT||
- request.getType() == RequestConstants.REQ_OPEN)
- {
- IFieldFigure fieldFigure = getFieldFigure();
- Object model = getModel();
- if (request instanceof LocationRequest)
- {
- LocationRequest locationRequest = (LocationRequest)request;
- Point p = locationRequest.getLocation();
-
- if (hitTest(fieldFigure.getTypeLabel(), p))
- {
- TypeReferenceDirectEditManager manager = new TypeReferenceDirectEditManager((IField)model, this, fieldFigure.getTypeLabel());
- TypeUpdateCommand typeUpdateCommand = new TypeUpdateCommand();
- typeUpdateCommand.setDelegate(manager);
- adtDirectEditPolicy.setUpdateCommand(typeUpdateCommand);
- manager.show();
- }
- else if (hitTest(fieldFigure.getNameLabel(), p))
- {
- directEditNameField();
- }
- }
- else {
- directEditNameField();
- }
- }
- }
-
- protected void directEditNameField()
- {
- if (isFileReadOnly()) return;
- Object model = getModel();
- IFieldFigure fieldFigure = getFieldFigure();
- if ( model instanceof IField)
- {
- IField field = (IField) model;
- if (field.isReference())
- {
- ElementReferenceDirectEditManager manager = new ElementReferenceDirectEditManager((IField) model, this, fieldFigure.getNameLabel());
- ReferenceUpdateCommand elementUpdateCommand = new ReferenceUpdateCommand();
- elementUpdateCommand.setDelegate(manager);
- adtDirectEditPolicy.setUpdateCommand(elementUpdateCommand);
- manager.show();
- }
- else
- {
- LabelEditManager manager = new LabelEditManager(this, new LabelCellEditorLocator(this, null));
- NameUpdateCommandWrapper wrapper = new NameUpdateCommandWrapper();
- adtDirectEditPolicy.setUpdateCommand(wrapper);
- manager.show();
- }
- }
- }
-
- public void doEditName(boolean addFromDesign)
- {
- if (!addFromDesign) return;
-
-// removeFeedback();
-
- Runnable runnable = new Runnable()
- {
- public void run()
- {
- Object object = ((XSDBaseAdapter)getModel()).getTarget();
- if (object instanceof XSDNamedComponent)
- {
- Point p = getNameLabelFigure().getLocation();
- LabelEditManager manager = new LabelEditManager(BaseFieldEditPart.this, new LabelCellEditorLocator(BaseFieldEditPart.this, p));
- NameUpdateCommandWrapper wrapper = new NameUpdateCommandWrapper();
- adtDirectEditPolicy.setUpdateCommand(wrapper);
- manager.show();
- }
- }
- };
- Display.getCurrent().asyncExec(runnable);
-
- }
-
- protected class NameUpdateCommandWrapper extends Command implements IADTUpdateCommand
- {
- Command command;
- protected DirectEditRequest request;
-
- public NameUpdateCommandWrapper()
- {
- super(Messages._UI_ACTION_UPDATE_NAME);
- }
-
- public void setRequest(DirectEditRequest request)
- {
- this.request = request;
- }
-
- public void execute()
- {
- IField field = (IField)getModel();
- Object newValue = request.getCellEditor().getValue();
- if (newValue instanceof String)
- {
- command = field.getUpdateNameCommand((String)newValue);
- }
- if (command != null)
- command.execute();
- }
- }
-
- class TypeUpdateCommand extends Command implements IADTUpdateCommand
- {
- protected ComboBoxCellEditorManager delegate;
- protected DirectEditRequest request;
-
- public TypeUpdateCommand()
- {
- super(Messages._UI_ACTION_UPDATE_TYPE);
- }
-
- public void setDelegate(ComboBoxCellEditorManager delegate)
- {
- this.delegate = delegate;
- }
-
- public void setRequest(DirectEditRequest request)
- {
- this.request = request;
- }
-
- public void execute()
- {
- if (delegate != null)
- {
- delegate.performEdit(request.getCellEditor());
- }
- }
-
- public boolean canExecute()
- {
- IField field = (IField)getModel();
- Object newValue = ((CCombo)request.getCellEditor().getControl()).getText();
- if (newValue instanceof String)
- {
- return !newValue.equals(field.getTypeName());
- }
- return true;
- }
- }
-
- protected class ReferenceUpdateCommand extends Command implements IADTUpdateCommand
- {
- protected ComboBoxCellEditorManager delegate;
- protected DirectEditRequest request;
-
- public ReferenceUpdateCommand()
- {
- super(Messages._UI_ACTION_UPDATE_ELEMENT_REFERENCE);
- }
-
- public void setDelegate(ComboBoxCellEditorManager delegate)
- {
- this.delegate = delegate;
- }
-
- public void setRequest(DirectEditRequest request)
- {
- this.request = request;
- }
-
- public void execute()
- {
- if (delegate != null)
- {
- delegate.performEdit(request.getCellEditor());
- }
- }
-
- public boolean canExecute()
- {
- return true;
- }
- }
-
-
- public void addFeedback()
- {
- // Put back connection figure so it won't get overlayed by other non highlighted connections
- if (connectionFigure != null && !isSelected)
- {
- connectionFeedbackFigure = new TypeReferenceConnection();
- connectionFeedbackFigure.setSourceAnchor(connectionFigure.getSourceAnchor());
- connectionFeedbackFigure.setTargetAnchor(connectionFigure.getTargetAnchor());
- connectionFeedbackFigure.setHighlight(true);
- getLayer(LayerConstants.FEEDBACK_LAYER).add(connectionFeedbackFigure);
- }
- super.addFeedback();
- getFieldFigure().addSelectionFeedback();
- }
-
- public void removeFeedback()
- {
- if (connectionFeedbackFigure != null)
- {
- connectionFeedbackFigure.setHighlight(false);
- getLayer(LayerConstants.FEEDBACK_LAYER).remove(connectionFeedbackFigure);
- }
- connectionFeedbackFigure = null;
- super.removeFeedback();
- getFieldFigure().removeSelectionFeedback();
- }
- public String getReaderText()
- {
- IFieldFigure fieldFigure = getFieldFigure();
-
- String name="";
- if (fieldFigure.getNameLabel() !=null&& fieldFigure.getNameLabel().getText().trim().length() > 0)
- name +=fieldFigure.getNameLabel().getText();
- if (fieldFigure.getNameAnnotationLabel() !=null && fieldFigure.getNameAnnotationLabel().getText().trim().length() > 0)
- name += " "+fieldFigure.getNameAnnotationLabel().getText();
- if (fieldFigure.getTypeLabel() !=null && fieldFigure.getTypeLabel().getText().trim().length() > 0)
- name += " type "+fieldFigure.getTypeLabel().getText();
- if (fieldFigure.getTypeAnnotationLabel() !=null && fieldFigure.getTypeAnnotationLabel().getText().trim().length() >0)
- name += " "+fieldFigure.getTypeAnnotationLabel().getText();
- return name;
-
- }
-}
-
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/BaseTypeConnectingEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/BaseTypeConnectingEditPart.java
deleted file mode 100644
index eebb8e6036..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/BaseTypeConnectingEditPart.java
+++ /dev/null
@@ -1,207 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2009 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.xsd.ui.internal.adt.design.editparts;
-
-import java.util.Iterator;
-import org.eclipse.draw2d.ConnectionAnchor;
-import org.eclipse.draw2d.Figure;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.PositionConstants;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.LayerConstants;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.requests.DirectEditRequest;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.IFeedbackHandler;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editpolicies.IADTUpdateCommand;
-import org.eclipse.wst.xsd.ui.internal.adt.editor.Messages;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IType;
-
-/**
- * This class provides some base function to enable drawing connections to a referenced type
- *
- */
-public abstract class BaseTypeConnectingEditPart extends BaseEditPart implements IFeedbackHandler, IConnectionContainer
-{
- private TypeReferenceConnection connectionFigure;
-
- public void activate()
- {
- super.activate();
- }
-
- public void deactivate()
- {
- deactivateConnection();
- super.deactivate();
- }
-
- public void refreshConnections()
- {
- deactivateConnection();
- activateConnection();
- }
-
- protected void activateConnection()
- {
- // If appropriate, create our connectionFigure and add it to the appropriate layer
- if (connectionFigure == null && shouldDrawConnection())
- {
- //System.out.println("activateeConnection()-pre:" + getClass().getName());
- connectionFigure = createConnectionFigure();
- if (connectionFigure != null)
- {
- // Add our editpolicy as a listener on the connection, so it can stay in synch
- //connectionFigure.addPropertyChangeListener((AttributeSelectionFeedbackPolicy) getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE));
- //connectionFigure.addMouseListener(this);
- getLayer(LayerConstants.CONNECTION_LAYER).add(connectionFigure);
- }
- }
- }
-
- protected void deactivateConnection()
- {
- // if we have a connection, remove it
- if (connectionFigure != null)
- {
- getLayer(LayerConstants.CONNECTION_LAYER).remove(connectionFigure);
- // Remove our editpolicy listener(s)
- //connectionFigure.removePropertyChangeListener((AttributeSelectionFeedbackPolicy) getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE));
- //connectionFigure.removeMouseListener(this);
- connectionFigure = null;
- }
- }
-
- protected boolean shouldDrawConnection()
- {
- return true;
- }
-
- public abstract TypeReferenceConnection createConnectionFigure();
-
- public void addFeedback()
- {
- if (connectionFigure != null)
- {
- connectionFigure.setHighlight(true);
- }
- super.addFeedback();
- }
-
- public void removeFeedback()
- {
- if (connectionFigure != null)
- {
- connectionFigure.setHighlight(false);
- }
- super.removeFeedback();
- }
-
- protected class NameUpdateCommandWrapper extends Command implements IADTUpdateCommand
- {
- Command command;
- protected DirectEditRequest request;
-
- public NameUpdateCommandWrapper()
- {
- super(Messages._UI_ACTION_UPDATE_NAME);
- }
-
- public void setRequest(DirectEditRequest request)
- {
- this.request = request;
- }
-
- public void execute()
- {
- IType iType = (IType)getModel();
- Object newValue = request.getCellEditor().getValue();
- if (newValue instanceof String)
- {
- command = iType.getUpdateNameCommand((String)newValue);
- }
- if (command != null)
- command.execute();
- }
- }
-
- public boolean hitTest(IFigure target, Point location)
- {
- Rectangle b = target.getBounds().getCopy();
- target.translateToAbsolute(b);
- return b.contains(location);
- }
-
- public EditPart doGetRelativeEditPart(EditPart editPart, int direction)
- {
- EditPart result = null;
- if (direction == PositionConstants.WEST)
- {
- result = getConnectionEditPart(PositionConstants.WEST);
- }
- else if (direction == PositionConstants.EAST)
- {
- result = getConnectionEditPart(PositionConstants.EAST);
- }
- return result;
- }
-
- private EditPart getConnectionEditPart(int direction)
- {
- // find the first connection that targets this editPart
- // navigate backward along the connection (to the left) to find the source edit part
- EditPart result = null;
- for (Iterator i = getLayer(LayerConstants.CONNECTION_LAYER).getChildren().iterator(); i.hasNext(); )
- {
- Figure figure = (Figure)i.next();
- if (figure instanceof TypeReferenceConnection)
- {
- TypeReferenceConnection typeReferenceConnection = (TypeReferenceConnection)figure;
- ConnectionAnchor thisAnchor = null;
- if (direction == PositionConstants.EAST)
- {
- thisAnchor = typeReferenceConnection.getSourceAnchor();
- }
- else if (direction == PositionConstants.WEST)
- {
- thisAnchor = typeReferenceConnection.getTargetAnchor();
- }
- if (thisAnchor != null && thisAnchor.getOwner() == getFigure())
- {
- ConnectionAnchor outAnchor = null;
- if (direction == PositionConstants.EAST)
- {
- outAnchor = typeReferenceConnection.getTargetAnchor();
- }
- else if (direction == PositionConstants.WEST)
- {
- outAnchor = typeReferenceConnection.getSourceAnchor();
- }
-
- if (outAnchor != null)
- {
- IFigure sourceFigure = outAnchor.getOwner();
- EditPart part = null;
- while (part == null && sourceFigure != null)
- {
- part = (EditPart)getViewer().getVisualPartMap().get(sourceFigure);
- sourceFigure = sourceFigure.getParent();
- }
- result = part;
- break;
- }
- }
- }
- }
- return result;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/BoxEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/BoxEditPart.java
deleted file mode 100644
index 89a85deaae..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/BoxEditPart.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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.xsd.ui.internal.adt.design.editparts;
-
-import java.util.List;
-import org.eclipse.draw2d.ColorConstants;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.LineBorder;
-import org.eclipse.draw2d.ToolbarLayout;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.ui.actions.ActionRegistry;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.Compartment;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editpolicies.ADTSelectionFeedbackEditPolicy;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editpolicies.SimpleDirectEditPolicy;
-import org.eclipse.wst.xsd.ui.internal.adt.outline.ITreeElement;
-import org.eclipse.wst.xsd.ui.internal.adt.typeviz.design.figures.BoxFigure;
-
-public abstract class BoxEditPart extends BaseTypeConnectingEditPart //IFeedbackHandler
-{
- protected List compartmentList = null;
- protected SimpleDirectEditPolicy simpleDirectEditPolicy = new SimpleDirectEditPolicy();
-
- protected Compartment[] getCompartments()
- {
- return null;
- }
-
- protected IFigure createFigure()
- {
- BoxFigure figure = new BoxFigure();
- LineBorder boxLineBorder = new LineBorder(1);
- figure.setBorder(boxLineBorder);
- ToolbarLayout toolbarLayout = new ToolbarLayout();
- toolbarLayout.setStretchMinorAxis(true);
- figure.setLayoutManager(toolbarLayout);
- // we should organize ITreeElement and integrate it with the facade
- if (getModel() instanceof ITreeElement)
- {
- figure.getNameLabel().setIcon(((ITreeElement)getModel()).getImage());
- }
- return figure;
- }
-
- public IFigure getContentPane()
- {
- return ((BoxFigure)getFigure()).getContentPane();
- }
-
- protected void createEditPolicies()
- {
- super.createEditPolicies();
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new ADTSelectionFeedbackEditPolicy());
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, simpleDirectEditPolicy);
- }
-
-
- public void addFeedback()
- {
- BoxFigure boxFigure = (BoxFigure)figure;
- LineBorder boxFigureLineBorder = (LineBorder)boxFigure.getBorder();
- boxFigureLineBorder.setWidth(2);
- boxFigureLineBorder.setColor(ColorConstants.darkBlue);
- boxFigure.getHeadingFigure().setSelected(true);
- figure.repaint();
- super.addFeedback();
- }
-
- public void removeFeedback()
- {
- BoxFigure boxFigure = (BoxFigure)figure;
- LineBorder boxFigureLineBorder = (LineBorder)boxFigure.getBorder();
- boxFigureLineBorder.setWidth(1);
- boxFigureLineBorder.setColor(ColorConstants.black);
- boxFigure.getHeadingFigure().setSelected(false);
- figure.repaint();
- super.removeFeedback();
- }
-
- protected ActionRegistry getEditorActionRegistry(IEditorPart editor)
- {
- return (ActionRegistry) editor.getAdapter(ActionRegistry.class);
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/CenteredConnectionAnchor.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/CenteredConnectionAnchor.java
deleted file mode 100644
index 0c93b9d691..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/CenteredConnectionAnchor.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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.xsd.ui.internal.adt.design.editparts;
-
-import org.eclipse.draw2d.AbstractConnectionAnchor;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.wst.xsd.ui.internal.design.figures.CenteredIconFigure;
-
-public class CenteredConnectionAnchor extends AbstractConnectionAnchor
-{
- public static final int TOP = 0;
- public static final int BOTTOM = 1;
- public static final int LEFT = 2;
- public static final int RIGHT = 3;
-
- public static final int HEADER_LEFT = 4;
- public static final int HEADER_RIGHT = 5;
-
- private int location;
- private int inset;
- private int offset = 0;
- private CenteredConnectionAnchor other;
-
- public CenteredConnectionAnchor(IFigure owner, int location, int inset)
- {
- super(owner);
- this.location = location;
- this.inset = inset;
- }
-
- public CenteredConnectionAnchor(IFigure owner, int location, int inset, int offset)
- {
- this(owner, location, inset);
- this.offset = offset;
- }
-
- public Point getLocation(Point reference)
- {
- Rectangle r = getOwner().getBounds();
- int x, y;
- switch (location)
- {
- case TOP:
- x = r.right() - r.width / 2 + offset;
- y = r.y + inset;
- break;
- case BOTTOM:
- x = r.right() - r.width / 2 + offset;
- y = r.bottom() - inset;
- break;
- case LEFT:
- x = r.x + inset;
- y = r.bottom() - r.height / 2 + offset;
- break;
- case RIGHT:
- x = r.right() - inset;
- y = r.bottom() - r.height / 2 + offset;
- break;
- case HEADER_LEFT:
- x = r.x + inset;
- y = r.y + offset;
- break;
- case HEADER_RIGHT:
- x = r.right() - inset;
- y = r.y + offset;
- break;
-
- default:
- x = r.right() - r.width / 2;
- y = r.bottom() - r.height / 2;
- }
- Point p = new Point(x, y);
-
- if (!(getOwner() instanceof CenteredIconFigure))
- {
- getOwner().translateToAbsolute(p);
- }
- else
- {
- getOwner().translateToAbsolute(p);
- }
-
- if (other != null)
- {
- // if within only one pixel of being vertical, we straighten up the line
- Point p2 = other.getLocation(null);
- if (Math.abs(p2.x - p.x) <= 1)
- {
- p.x = p2.x;
- }
- }
- return p;
- }
-
- public Point getReferencePoint()
- {
- return getLocation(null);
- }
-
- public void setOther(CenteredConnectionAnchor other)
- {
- this.other = other;
- }
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/ColumnEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/ColumnEditPart.java
deleted file mode 100644
index 8eb4090fbc..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/ColumnEditPart.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 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.xsd.ui.internal.adt.design.editparts;
-
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.draw2d.Figure;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.ToolbarLayout;
-import org.eclipse.gef.EditPart;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.AbstractModelCollection;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.ReferencedTypeColumn;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IComplexType;
-
-public class ColumnEditPart extends BaseEditPart
-{
- protected int spacing = 20;
- protected int minorAlignment = -1;
- protected boolean isHorizontal = false;
-
- public ColumnEditPart()
- {
- }
-
- public ColumnEditPart(boolean isHorizontal)
- {
- this.isHorizontal = isHorizontal;
- }
-
- protected IFigure createFigure()
- {
- Figure figure = new Figure();
- ToolbarLayout layout = new ToolbarLayout(isHorizontal);
-
- if (minorAlignment != -1)
- {
- layout.setMinorAlignment(minorAlignment);
- }
- layout.setStretchMinorAxis(false);
- layout.setSpacing(spacing);
- figure.setLayoutManager(layout);
- return figure;
- }
-
- public void setSpacing(int spacing)
- {
- this.spacing = spacing;
- if (figure != null)
- {
- ((ToolbarLayout)figure.getLayoutManager()).setSpacing(spacing);
- }
- }
-
- public IComplexType getComplexType()
- {
- return (IComplexType)getModel();
- }
-
- protected void createEditPolicies()
- {
- // TODO Auto-generated method stub
- }
-
- protected List getModelChildren()
- {
- AbstractModelCollection collection = (AbstractModelCollection)getModel();
- return collection.getChildren();
- }
-
- public int getMinorAlignment()
- {
- return minorAlignment;
- }
-
- public void setMinorAlignment(int minorAlignment)
- {
- this.minorAlignment = minorAlignment;
- }
-
- protected void refreshChildren()
- {
- super.refreshChildren();
- if (getModel() instanceof ReferencedTypeColumn)
- {
- if (getParent().getChildren().size() > 0)
- {
- EditPart editPart = (EditPart)getParent().getChildren().get(0);
- refreshConnections(editPart);
- }
- }
- else
- {
- refreshConnections(this);
- }
- }
-
-
- public void refreshConnections(EditPart parent)
- {
- for (Iterator i = parent.getChildren().iterator(); i.hasNext(); )
- {
- EditPart editPart = (EditPart)i.next();
- if (editPart instanceof BaseTypeConnectingEditPart)
- {
- BaseTypeConnectingEditPart connectingEditPart = (BaseTypeConnectingEditPart)editPart;
- connectingEditPart.refreshConnections();
- }
- refreshConnections(editPart);
- }
- }
-
- public boolean isSelectable()
- {
- return false;
- }
-}
-
-
-
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/CompartmentEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/CompartmentEditPart.java
deleted file mode 100644
index 15f56e892e..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/CompartmentEditPart.java
+++ /dev/null
@@ -1,217 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 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.xsd.ui.internal.adt.design.editparts;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.PositionConstants;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.GraphicalEditPart;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.Annotation;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.Compartment;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editpolicies.KeyBoardAccessibilityEditPolicy;
-import org.eclipse.wst.xsd.ui.internal.adt.design.figures.ICompartmentFigure;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IField;
-
-// TODO (cs) common-up with BoxEditPart (?)
-public class CompartmentEditPart extends BaseEditPart // implements
- // IFeedbackHandler
-{
- protected Annotation annotation = new Annotation();
-
- protected IFigure createFigure()
- {
- ICompartmentFigure figure = getFigureFactory().createCompartmentFigure(getModel());
- return figure;
- }
-
- public IFigure getContentPane()
- {
- return getCompartmentFigure().getContentPane();
- }
-
- public boolean hasContent()
- {
- // since the annotation always takes up 1 child, here's a convenience method to figure out if
- return getChildren().size() > 1;
- }
-
- List getChildrenSansAnnotation()
- {
- List children = new ArrayList();
- children.addAll(getChildren());
- for (Iterator i = children.iterator(); i.hasNext(); )
- {
- EditPart child = (EditPart)i.next();
- if (child.getModel() == annotation)
- {
- i.remove();
- break;
- }
- }
- return children;
- }
-
- public EditPart doGetRelativeEditPart(EditPart editPart, int direction)
- {
- EditPart result = null;
-
- // we compute the children sans the annotation EditPart
- // since the annotation EditPart confuses our up/down key handling
- List children = getChildrenSansAnnotation();
- if (children.contains(editPart))
- {
- if (direction == KeyBoardAccessibilityEditPolicy.OUT_TO_PARENT)
- {
- Compartment compartment = (Compartment)getModel();
- for (EditPart parent = editPart.getParent(); parent != null; parent = parent.getParent())
- {
- if (parent.getModel() == compartment.getOwner())
- {
- result = parent;
- break;
- }
- }
- }
- else if (direction == PositionConstants.SOUTH)
- {
- int size = children.size();
- if (size > 0)
- {
- if (children.get(size - 1) == editPart)
- {
- CompartmentEditPart nextCompartment = (CompartmentEditPart)EditPartNavigationHandlerUtil.getNextSibling(CompartmentEditPart.this);
- if (nextCompartment != null && nextCompartment.getChildrenSansAnnotation().size() > 0)
- {
- result = EditPartNavigationHandlerUtil.getFirstChild(nextCompartment);
- }
- else
- {
- result = editPart;
- }
- }
- }
- if (result == null) result = EditPartNavigationHandlerUtil.getNextSibling(editPart);
- }
- else if (direction == PositionConstants.NORTH)
- {
- if (EditPartNavigationHandlerUtil.getFirstChild(CompartmentEditPart.this) == editPart)
- {
- EditPart prevCompartment = EditPartNavigationHandlerUtil.getPrevSibling(CompartmentEditPart.this);
- if (prevCompartment instanceof CompartmentEditPart)
- {
- List prevCompListChildren = ((CompartmentEditPart)prevCompartment).getChildrenSansAnnotation();
- int size = prevCompListChildren.size();
- if (size > 0)
- {
- result = (EditPart)prevCompartment.getChildren().get(size - 1);
- }
- }
- }
- if (result == null) result = EditPartNavigationHandlerUtil.getPrevSibling(editPart);
- }
- }
- return result;
- }
-
- protected void addChildVisual(EditPart childEditPart, int index)
- {
- Object model = childEditPart.getModel();
-
- IFigure child = ((GraphicalEditPart) childEditPart).getFigure();
-
- if (model instanceof IField)
- {
- getCompartmentFigure().getContentPane().add(child, index);
- return;
- }
- else if (model instanceof Annotation)
- {
- getCompartmentFigure().getAnnotationPane().add(child);
- return;
- }
- super.addChildVisual(childEditPart, index);
- }
-
- protected void removeChildVisual(EditPart childEditPart)
- {
- Object model = childEditPart.getModel();
- IFigure child = ((GraphicalEditPart) childEditPart).getFigure();
-
- if (model instanceof IField)
- {
- getCompartmentFigure().getContentPane().remove(child);
- return;
- }
- else if (model instanceof Annotation)
- {
- getCompartmentFigure().getAnnotationPane().remove(child);
- return;
- }
- super.removeChildVisual(childEditPart);
- }
-
- protected Compartment getCompartment()
- {
- return (Compartment) getModel();
- }
-
- protected List getModelChildren()
- {
- List children = getCompartment().getChildren();
- children.add(annotation);
- return children;
- }
-
- public void setModel(Object model)
- {
- super.setModel(model);
- annotation.setCompartment(getCompartment());
- }
-
- protected void refreshChildren()
- {
- super.refreshChildren();
- // ((AbstractGraphicalEditPart)getParent()).getContentPane().invalidate();
- }
-
- protected void refreshVisuals()
- {
- super.refreshVisuals();
- }
-
- public void addFeedback()
- {
- // getFigure().setBackgroundColor(ColorConstants.blue);
- // ((CompartmentFigure)getFigure()).setBorderColor(ColorConstants.black);
- getFigure().repaint();
- }
-
- public void removeFeedback()
- {
- // getFigure().setBackgroundColor(ColorConstants.lightBlue);
- // ((CompartmentFigure)getFigure()).setBorderColor(ColorConstants.lightGray);
- getFigure().repaint();
- }
-
- public ICompartmentFigure getCompartmentFigure()
- {
- return (ICompartmentFigure)figure;
- }
-
- public void addNotify()
- {
- super.addNotify();
- getCompartmentFigure().editPartAttached(this);
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/ComplexTypeEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/ComplexTypeEditPart.java
deleted file mode 100644
index 0eceb08ac1..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/ComplexTypeEditPart.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2009 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.xsd.ui.internal.adt.design.editparts;
-
-import java.util.Iterator;
-
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.ManhattanConnectionRouter;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.editparts.AbstractGraphicalEditPart;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.FocusTypeColumn;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IComplexType;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IType;
-
-public class ComplexTypeEditPart extends StructureEditPart
-{
- private Font italicFont;
-
- protected boolean shouldDrawConnection()
- {
- if (getParent().getModel() instanceof FocusTypeColumn)
- {
- IComplexType complexType = (IComplexType)getModel();
- return complexType.getSuperType() != null;
- }
- return false;
- }
-
-
- private EditPart getTargetEditPart(IType type)
- {
- ColumnEditPart columnEditPart = null;
- for (EditPart editPart = this; editPart != null; editPart = editPart.getParent())
- {
- if (editPart instanceof ColumnEditPart)
- {
- columnEditPart = (ColumnEditPart)editPart;
- break;
- }
- }
- if (columnEditPart != null)
- {
- for (Iterator i = columnEditPart.getChildren().iterator(); i.hasNext(); )
- {
- EditPart child = (EditPart)i.next();
- if (child.getModel() == type)
- {
- return child;
- }
- }
- }
- return null;
- }
-
- public TypeReferenceConnection createConnectionFigure()
- {
- connectionFigure = null;
- IComplexType complexType = (IComplexType)getModel();
- IType type = complexType.getSuperType();
- if (type != null)
- {
- AbstractGraphicalEditPart referenceTypePart = (AbstractGraphicalEditPart)getTargetEditPart(type);
- if (referenceTypePart != null)
- {
- connectionFigure = new TypeReferenceConnection(true);
- // draw a line out from the top
- connectionFigure.setSourceAnchor(new CenteredConnectionAnchor(getFigure(), CenteredConnectionAnchor.TOP, 1));
-
- // TODO (cs) need to draw the target anchor to look like a UML inheritance relationship
- // adding a label to the connection would help to
- connectionFigure.setTargetAnchor(new CenteredConnectionAnchor(referenceTypePart.getFigure(), CenteredConnectionAnchor.BOTTOM, 0, 0));
- connectionFigure.setConnectionRouter(new ManhattanConnectionRouter());
- ((CenteredConnectionAnchor)connectionFigure.getSourceAnchor()).setOther((CenteredConnectionAnchor)connectionFigure.getTargetAnchor());
- connectionFigure.setHighlight(false);
- }
- }
- return connectionFigure;
- }
-
- protected void refreshVisuals()
- {
- super.refreshVisuals();
- Label label = getNameLabelFigure();
- IComplexType complexType = (IComplexType)getModel();
- if (complexType.isAbstract())
- {
- if (italicFont == null)
- {
- Font font = label.getFont();
- italicFont = getItalicFont(font);
- }
- if (italicFont != null)
- {
- label.setFont(italicFont);
- }
- }
- else
- {
- label.setFont(label.getParent().getFont());
- }
- }
-
- public void deactivate()
- {
- if (italicFont != null)
- {
- italicFont.dispose();
- italicFont = null;
- }
- super.deactivate();
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/EditPartNavigationHandlerUtil.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/EditPartNavigationHandlerUtil.java
deleted file mode 100644
index c234b65f5c..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/EditPartNavigationHandlerUtil.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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.xsd.ui.internal.adt.design.editparts;
-import java.util.List;
-import org.eclipse.gef.EditPart;
-
-
-public class EditPartNavigationHandlerUtil
-{
- public static EditPart getFirstChild(EditPart editPart)
- {
- EditPart result = null;
- if (editPart.getChildren().size() > 0)
- {
- result = (EditPart)editPart.getChildren().get(0);
- }
- return result;
- }
-
- public static EditPart getLastChild(EditPart editPart)
- {
- EditPart result = null;
- int size = editPart.getChildren().size();
- if (size > 0)
- {
- result = (EditPart)editPart.getChildren().get(size - 1);
- }
- return result;
- }
-
- public static EditPart getNextSibling(EditPart editPart)
- {
- EditPart result = null;
- EditPart parent = editPart.getParent();
- if (parent != null)
- {
- List children = parent.getChildren();
- int index = children.indexOf(editPart);
- if (index + 1 < children.size())
- {
- result = (EditPart)children.get(index + 1);
- }
- }
- return result;
- }
-
- public static EditPart getPrevSibling(EditPart editPart)
- {
- EditPart result = null;
- EditPart parent = editPart.getParent();
- if (parent != null)
- {
- List children = parent.getChildren();
- int index = children.indexOf(editPart);
- if (index - 1 >= 0)
- {
- // if this is the first child
- //
- result = (EditPart)children.get(index - 1);
- }
- }
- return result;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/FieldEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/FieldEditPart.java
deleted file mode 100644
index f17dd39853..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/FieldEditPart.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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.xsd.ui.internal.adt.design.editparts;
-
-
-public class FieldEditPart extends BaseFieldEditPart
-{
- public void addNotify()
- {
- super.addNotify();
- getFieldFigure().editPartAttached(this);
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/IAutoDirectEdit.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/IAutoDirectEdit.java
deleted file mode 100644
index bcd3186980..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/IAutoDirectEdit.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.xsd.ui.internal.adt.design.editparts;
-
-/**
- * Edit parts that can be direct editable
- *
- */
-public interface IAutoDirectEdit
-{
- public void doEditName(boolean addFromDesign);
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/IConnectionContainer.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/IConnectionContainer.java
deleted file mode 100644
index 176125351a..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/IConnectionContainer.java
+++ /dev/null
@@ -1,16 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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.xsd.ui.internal.adt.design.editparts;
-
-public interface IConnectionContainer
-{
- public void refreshConnections();
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/IHolderEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/IHolderEditPart.java
deleted file mode 100644
index 7f7a5ae74c..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/IHolderEditPart.java
+++ /dev/null
@@ -1,16 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.xsd.ui.internal.adt.design.editparts;
-
-public interface IHolderEditPart
-{
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/INamedEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/INamedEditPart.java
deleted file mode 100644
index b186c28124..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/INamedEditPart.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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.xsd.ui.internal.adt.design.editparts;
-
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.geometry.Point;
-
-public interface INamedEditPart
-{
- public Label getNameLabelFigure();
-
- public void performDirectEdit(Point cursorLocation);
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/RootContentEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/RootContentEditPart.java
deleted file mode 100644
index d2677d4a12..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/RootContentEditPart.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.adt.design.editparts;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.draw2d.Figure;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.MarginBorder;
-import org.eclipse.draw2d.Panel;
-import org.eclipse.draw2d.ToolbarLayout;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.IGraphElement;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.RootHolder;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IComplexType;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IField;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IModel;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IStructure;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IType;
-
-public class RootContentEditPart extends BaseEditPart
-{
- List collections = null;
- Figure contentPane;
-
- protected IFigure createFigure()
- {
- Panel panel = new Panel();
- panel.setBorder(new MarginBorder(60));
-
- ToolbarLayout panelLayout = new ToolbarLayout(false);
- panelLayout.setStretchMinorAxis(true);
- panel.setLayoutManager(panelLayout);
-
- contentPane = new Figure();
- panel.add(contentPane);
-
- ToolbarLayout tb = new ToolbarLayout(false);
- tb.setMinorAlignment(ToolbarLayout.ALIGN_CENTER);
- tb.setStretchMinorAxis(true);
- tb.setSpacing(40);
- contentPane.setLayoutManager(tb);
-
- return panel;
- }
-
- public IFigure getContentPane()
- {
- return contentPane;
- }
-
-
- public IComplexType getSelectedComplexType()
- {
- IComplexType result = null;
- IModel model = (IModel)getModel();
- List types = model.getTypes();
- if (types.size() > 0)
- {
- if (types.get(0) instanceof IComplexType)
- result = (IComplexType)types.get(0);
- }
- return result;
- }
-
- protected void createEditPolicies()
- {
- // TODO Auto-generated method stub
- }
-
- protected List getModelChildren()
- {
- collections = new ArrayList();
- if (getModel() != null)
- {
- Object obj = getModel();
- IADTObject focusObject = null;
- if (obj instanceof IStructure)
- {
- if (obj instanceof IGraphElement)
- {
- if (((IGraphElement)obj).isFocusAllowed())
- focusObject = (IStructure)obj;
- }
- }
- else if (obj instanceof IField)
- {
- focusObject = (IField)obj;
- }
- else if (obj instanceof IModel)
- {
- focusObject = (IModel)obj;
- collections.add(focusObject);
- return collections;
- }
- else if (obj instanceof IType)
- {
- if (obj instanceof IGraphElement)
- {
- if (((IGraphElement)obj).isFocusAllowed())
- {
- focusObject = (IType)obj;
- }
- }
- }
- else if (obj instanceof IGraphElement)
- {
- if (((IGraphElement)obj).isFocusAllowed())
- {
- focusObject = (IADTObject)obj;
- collections.add(focusObject);
- return collections;
- }
- }
- if (focusObject != null)
- {
- RootHolder holder = new RootHolder(focusObject);
- collections.add(holder);
- return collections;
- }
- }
- return collections;
- }
-
-
- /**
- * @deprecated Don't call this method. Use DesignViewGraphicalViewer.setInput() instead.
- */
- public void setInput(Object component)
- {
- setModel(component);
- refresh();
- }
-
- /**
- * @deprecated Don't call this method. Use DesignViewGraphicalViewer.getInput() instead.
- */
- public Object getInput()
- {
- return getModel();
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=252589
- public void activate()
- {
- super.activate();
- Object model = getModel();
- // The schema adapter doesn't have to notify the RootContentEditPart of it changes
- if (model instanceof IADTObject)
- {
- IADTObject object = (IADTObject)model;
- object.unregisterListener(this);
- }
- }
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/RootEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/RootEditPart.java
deleted file mode 100644
index fd8758129f..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/RootEditPart.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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.xsd.ui.internal.adt.design.editparts;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import org.eclipse.draw2d.BendpointConnectionRouter;
-import org.eclipse.draw2d.ConnectionLayer;
-import org.eclipse.draw2d.Figure;
-import org.eclipse.draw2d.FigureCanvas;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Layer;
-import org.eclipse.draw2d.LayeredPane;
-import org.eclipse.draw2d.RectangleFigure;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.LayerConstants;
-import org.eclipse.gef.editparts.ScalableRootEditPart;
-import org.eclipse.gef.ui.parts.ScrollingGraphicalViewer;
-import org.eclipse.wst.xsd.ui.internal.adt.design.DesignViewerGraphicConstants;
-
-public class RootEditPart extends ScalableRootEditPart implements org.eclipse.gef.RootEditPart
-{
- public void activate()
- {
- super.activate();
- // Set up Connection layer with a router, if it doesn't already have one
- ConnectionLayer connectionLayer = (ConnectionLayer) getLayer(LayerConstants.CONNECTION_LAYER);
- if (connectionLayer != null)
- {
- connectionLayer.setConnectionRouter(new BendpointConnectionRouter());
- }
-
- Figure figure = (Figure)getLayer(LayerConstants.FEEDBACK_LAYER);
- if (figure != null)
- {
- if (getViewer() instanceof ScrollingGraphicalViewer)
- {
- //ScrollingGraphicalViewer sgv = (ScrollingGraphicalViewer)getViewer();
- //IndexFigure indexFigure = new IndexFigure(sgv);
- //figure.add(indexFigure);
- //getViewer().addPropertyChangeListener(indexFigure);
- }
- }
- refresh();
- }
-
- protected LayeredPane createPrintableLayers()
- {
- LayeredPane pane = super.createPrintableLayers();
- Layer layer = new ScaledHandleLayer();
- layer.setPreferredSize(new Dimension(5, 5));
- pane.add(layer, DesignViewerGraphicConstants.SCALED_HANDLE_LAYER);
- return pane;
- }
-
-
- class ScaledHandleLayer extends Layer
- {
- ScaledHandleLayer()
- {
- setEnabled(true);
- }
- /**
- * @see org.eclipse.draw2d.Figure#getPreferredSize(int, int)
- */
- public Dimension getPreferredSize(int wHint, int hHint)
- {
- Rectangle rect = new Rectangle();
- for (int i = 0; i < getChildren().size(); i++)
- rect.union(((IFigure)getChildren().get(i)).getBounds());
- return rect.getSize();
- }
- }
-
- class IndexFigure extends RectangleFigure implements PropertyChangeListener
- {
- EditPart editPart;
- ScrollingGraphicalViewer sgv;
- public IndexFigure(ScrollingGraphicalViewer sgv)
- {
- this.sgv = sgv;
- ((FigureCanvas)sgv.getControl()).getViewport().getHorizontalRangeModel().addPropertyChangeListener(this);
- ((FigureCanvas)sgv.getControl()).getViewport().getVerticalRangeModel().addPropertyChangeListener(this);
- Rectangle bounds = new Rectangle(0, 0, 40, 40);
- translateToAbsolute(bounds);
- setBounds(bounds);
- }
- public void propertyChange(PropertyChangeEvent evt)
- {
- System.out.println("scroll-change");
- Rectangle bounds = new Rectangle(0, 0, 40, 40);
- Point p = ((FigureCanvas)sgv.getControl()).getViewport().getViewLocation();
- bounds.translate(p);
- setBounds(bounds);
- }
-
- public Rectangle getBounds()
- {
- Point p = ((FigureCanvas)sgv.getControl()).getViewport().getViewLocation();
- bounds.translate(p);
- return super.getBounds().getCopy().translate(p);
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/RootHolderEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/RootHolderEditPart.java
deleted file mode 100644
index a4ad059af0..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/RootHolderEditPart.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.xsd.ui.internal.adt.design.editparts;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Panel;
-import org.eclipse.draw2d.ToolbarLayout;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.FocusTypeColumn;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.ReferencedTypeColumn;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.RootHolder;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject;
-
-public class RootHolderEditPart extends BaseEditPart implements IHolderEditPart
-{
- protected Panel panel;
-
- public RootHolderEditPart()
- {
- }
-
- protected IFigure createFigure()
- {
- panel = new Panel();
- ToolbarLayout layout = new ToolbarLayout(true);
- layout.setStretchMinorAxis(false);
- layout.setSpacing(100);
- panel.setLayoutManager(layout);
-
- return panel;
- }
-
- protected List getModelChildren()
- {
- List collections = new ArrayList();
- RootHolder holder = (RootHolder)getModel();
- IADTObject focusObject = holder.getModel();
- collections.add(new FocusTypeColumn(focusObject));
- collections.add(new ReferencedTypeColumn(focusObject));
- return collections;
- }
-
- protected void createEditPolicies()
- {
- super.createEditPolicies();
- }
-
- public boolean isSelectable()
- {
- return false;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/SectionEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/SectionEditPart.java
deleted file mode 100644
index a25af476be..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/SectionEditPart.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.xsd.ui.internal.adt.design.editparts;
-
-import org.eclipse.draw2d.Figure;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.ToolbarLayout;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IComplexType;
-
-public class SectionEditPart extends BaseEditPart
-{
- protected IComplexType complexType;
-
- protected IFigure createFigure()
- {
- Figure fig = new Figure();
- fig.setLayoutManager(new ToolbarLayout());
- return fig;
- }
-
- protected void createEditPolicies()
- {
-
- }
-
- public boolean isSelectable()
- {
- return false;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/StructureEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/StructureEditPart.java
deleted file mode 100644
index 167bfcfc8a..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/StructureEditPart.java
+++ /dev/null
@@ -1,249 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2009 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.xsd.ui.internal.adt.design.editparts;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.RequestConstants;
-import org.eclipse.gef.requests.LocationRequest;
-import org.eclipse.gef.ui.actions.ActionRegistry;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDComplexTypeDefinitionAdapter;
-import org.eclipse.wst.xsd.ui.internal.adt.actions.SetInputToGraphView;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.Compartment;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editpolicies.ADTDirectEditPolicy;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editpolicies.ADTSelectionFeedbackEditPolicy;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editpolicies.KeyBoardAccessibilityEditPolicy;
-import org.eclipse.wst.xsd.ui.internal.adt.design.figures.IStructureFigure;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IStructure;
-import org.eclipse.wst.xsd.ui.internal.common.actions.OpenInNewEditor;
-import org.eclipse.wst.xsd.ui.internal.design.editparts.SpaceFillerForFieldEditPart;
-import org.eclipse.xsd.XSDComplexTypeDefinition;
-import org.eclipse.xsd.XSDSchema;
-
-public class StructureEditPart extends BaseTypeConnectingEditPart implements INamedEditPart
-{
- protected List compartmentList = null;
- protected ADTDirectEditPolicy adtDirectEditPolicy = new ADTDirectEditPolicy();
- protected TypeReferenceConnection connectionFigure;
- protected TypeReferenceConnection connectionFeedbackFigure;
-
- /**
- * TODO cs... I'm sure this has something to do with the way we wanted to rework compartment creation
- * I suppose we could have subclasses override this method instead of getModelChildren()
- *
- * @deprecated
- */
- protected Compartment[] getCompartments()
- {
- return null;
- }
-
- protected IFigure createFigure()
- {
- IStructureFigure figure = getFigureFactory().createStructureFigure(getModel());
- return figure;
- }
-
- public IStructureFigure getStructureFigure()
- {
- return (IStructureFigure)getFigure();
- }
-
- public IFigure getContentPane()
- {
- return getStructureFigure().getContentPane();
- }
-
-
- public EditPart doGetRelativeEditPart(EditPart editPart, int direction)
- {
- EditPart result = null;
- if (direction == KeyBoardAccessibilityEditPolicy.IN_TO_FIRST_CHILD)
- {
- for (Iterator i = getChildren().iterator(); i.hasNext();)
- {
- CompartmentEditPart compartment = (CompartmentEditPart)i.next();
- if (compartment.hasContent())
- {
- for (Iterator contentChildren = compartment.getChildren().iterator(); contentChildren.hasNext(); )
- {
- Object child = contentChildren.next();
- if (child instanceof SectionEditPart)
- {
- SectionEditPart part = (SectionEditPart) child;
- result = (EditPart)part.getChildren().get(0);
- return result;
- }
- else if (child instanceof BaseFieldEditPart && (!(child instanceof SpaceFillerForFieldEditPart)))
- {
- result = (EditPart)child;
- return result;
- }
- }
- }
- }
- }
- else
- {
- return super.doGetRelativeEditPart(editPart, direction);
- }
- return result;
- }
-
- protected void createEditPolicies()
- {
- super.createEditPolicies();
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new ADTSelectionFeedbackEditPolicy());
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, adtDirectEditPolicy);
- }
-
- protected IStructure getStructure()
- {
- return (IStructure)getModel();
- }
-
- protected List getModelChildren()
- {
- if (compartmentList == null)
- {
- compartmentList = new ArrayList();
-
- // TODO.. this needs to be moved to the xsd specific version of this class
- compartmentList.add(new Compartment(getStructure(), "attribute")); //$NON-NLS-1$
- compartmentList.add(new Compartment(getStructure(), "element")); //$NON-NLS-1$
- }
- return compartmentList;
- }
-
- protected void refreshChildren()
- {
- super.refreshChildren();
- //getFigure().invalidateTree();
- }
-
- protected void refreshVisuals()
- {
- super.refreshVisuals();
- getStructureFigure().refreshVisuals(getModel());
- }
-
- public void addFeedback()
- {
- getStructureFigure().addSelectionFeedback();
- super.addFeedback();
- }
-
- public void removeFeedback()
- {
- getStructureFigure().removeSelectionFeedback();
- super.removeFeedback();
- }
-
- public Label getNameLabelFigure()
- {
- return getStructureFigure().getNameLabel();
- }
-
- public void performDirectEdit(Point cursorLocation)
- {
-
- }
-
- public void performRequest(Request request)
- {
- if (request.getType() == RequestConstants.REQ_DIRECT_EDIT)
- {
- if (request instanceof LocationRequest)
- {
- // uncomment for direct edit of name (add else)
-// LocationRequest locationRequest = (LocationRequest)request;
-// Point p = locationRequest.getLocation();
-// if (hitTest(getNameLabelFigure(), p))
-// {
-// LabelEditManager manager = new LabelEditManager(this, new LabelCellEditorLocator(this, p));
-// NameUpdateCommandWrapper wrapper = new NameUpdateCommandWrapper();
-// adtDirectEditPolicy.setUpdateCommand(wrapper);
-// manager.show();
-// }
- }
- }
- else if (request.getType() == RequestConstants.REQ_OPEN)
- {
- Object model = getModel();
- if (request instanceof LocationRequest)
- {
- LocationRequest locationRequest = (LocationRequest)request;
- Point p = locationRequest.getLocation();
-
- if (getStructureFigure().hitTestHeader(p))
- {
- // TODO: !!! This should be moved to the adt-xsd package
- //
- if (model instanceof XSDComplexTypeDefinitionAdapter)
- {
- XSDComplexTypeDefinitionAdapter adapter = (XSDComplexTypeDefinitionAdapter)model;
- XSDComplexTypeDefinition ct = (XSDComplexTypeDefinition)adapter.getTarget();
- IWorkbench workbench = PlatformUI.getWorkbench();
- IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
- IEditorPart editorPart = workbenchWindow.getActivePage().getActiveEditor();
- Object schema = editorPart.getAdapter(XSDSchema.class);
- ActionRegistry registry = getEditorActionRegistry(editorPart);
- if (registry != null)
- {
- if (schema == ct.getSchema())
- {
- IAction action = registry.getAction(SetInputToGraphView.ID);
- action.run();
- }
- else
- {
- IAction action = registry.getAction(OpenInNewEditor.ID);
- action.run();
- }
- }
- }
- }
- }
- }
- }
-
- protected ActionRegistry getEditorActionRegistry(IEditorPart editor)
- {
- return (ActionRegistry) editor.getAdapter(ActionRegistry.class);
- }
-
- protected boolean shouldDrawConnection()
- {
- return false;
- }
-
- public TypeReferenceConnection createConnectionFigure()
- {
- return null;
- }
- public String getReaderText()
- {
- // return getStructureFigure().getNameLabel().getText();
- return getNameLabelFigure().getText();
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/TopLevelFieldEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/TopLevelFieldEditPart.java
deleted file mode 100644
index 1ad0195f3f..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/TopLevelFieldEditPart.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2009 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.xsd.ui.internal.adt.design.editparts;
-
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.RequestConstants;
-import org.eclipse.gef.editparts.AbstractGraphicalEditPart;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editpolicies.ADTDirectEditPolicy;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editpolicies.ADTSelectionFeedbackEditPolicy;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IField;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IType;
-import org.eclipse.wst.xsd.ui.internal.adt.typeviz.design.figures.BoxFigure;
-
-public class TopLevelFieldEditPart extends BoxEditPart implements INamedEditPart
-{
- protected ADTDirectEditPolicy adtDirectEditPolicy = new ADTDirectEditPolicy();
- private Font italicFont;
-
- protected boolean shouldDrawConnection()
- {
- IField field = (IField)getModel();
- IType type = field.getType();
- return (type != null);
- }
-
- public TypeReferenceConnection createConnectionFigure()
- {
- TypeReferenceConnection connectionFigure = null;
- IField field = (IField)getModel();
- IType type = field.getType();
- if (type != null)
- {
- AbstractGraphicalEditPart referenceTypePart = (AbstractGraphicalEditPart)getViewer().getEditPartRegistry().get(type);
- if (referenceTypePart != null)
- {
- connectionFigure = new TypeReferenceConnection();
- connectionFigure.setSourceAnchor(new CenteredConnectionAnchor(getFigure(), CenteredConnectionAnchor.RIGHT, 0));
- int targetAnchorYOffset = 12;
- connectionFigure.setTargetAnchor(new CenteredConnectionAnchor(referenceTypePart.getFigure(), CenteredConnectionAnchor.HEADER_LEFT, 0, targetAnchorYOffset));
- connectionFigure.setHighlight(false);
- }
- }
- return connectionFigure;
- }
-
- protected void createEditPolicies()
- {
- super.createEditPolicies();
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, adtDirectEditPolicy);
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new ADTSelectionFeedbackEditPolicy());
- }
-
- protected void refreshVisuals()
- {
- IField field = (IField)getModel();
- BoxFigure boxFigure = (BoxFigure)getFigure();
- Label label = boxFigure.getNameLabel();
- label.setText(field.getName());
- if (field.isAbstract())
- {
- if (italicFont == null)
- {
- Font font = label.getFont();
- italicFont = getItalicFont(font);
- }
- if (italicFont != null)
- {
- label.setFont(italicFont);
- }
- }
- else
- {
- label.setFont(label.getParent().getFont());
- }
- super.refreshVisuals();
- }
-
- public void deactivate()
- {
- if (italicFont != null)
- {
- italicFont.dispose();
- italicFont = null;
- }
- super.deactivate();
- }
-
- public Label getNameLabelFigure()
- {
- BoxFigure boxFigure = (BoxFigure)getFigure();
- return boxFigure.getNameLabel();
- }
-
- public void performDirectEdit(Point cursorLocation)
- {
-
- }
- public String getReaderText()
- {
- return getNameLabelFigure().getText();
- }
-
- public void performRequest(Request request)
- {
- if (request.getType() == RequestConstants.REQ_DIRECT_EDIT||
- request.getType() == RequestConstants.REQ_OPEN)
- {
-// if (request instanceof LocationRequest)
-// {
-// LocationRequest locationRequest = (LocationRequest)request;
-// Point p = locationRequest.getLocation();
-//
-// if (hitTest(getNameLabelFigure(), p))
-// {
-// LabelEditManager manager = new LabelEditManager(this, new LabelCellEditorLocator(this, p));
-// NameUpdateCommandWrapper wrapper = new NameUpdateCommandWrapper();
-// adtDirectEditPolicy.setUpdateCommand(wrapper);
-// manager.show();
-// }
-// }
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/TypeReferenceConnection.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/TypeReferenceConnection.java
deleted file mode 100644
index 0d7da4aba0..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/TypeReferenceConnection.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 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.xsd.ui.internal.adt.design.editparts;
-
-import org.eclipse.draw2d.ColorConstants;
-import org.eclipse.draw2d.ConnectionRouter;
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.draw2d.ManhattanConnectionRouter;
-import org.eclipse.draw2d.PolygonDecoration;
-import org.eclipse.draw2d.PolylineConnection;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.widgets.Display;
-
-public class TypeReferenceConnection extends PolylineConnection
-{
- protected boolean highlight = false;
- protected static final Color activeConnection = ColorConstants.black;
- protected static final Color inactiveConnection = new Color(null, 198, 195, 198);
-
- /**
- * Default constructor
- */
- public TypeReferenceConnection()
- {
- super();
- setTargetDecoration(new PolygonDecoration());
- }
-
- public TypeReferenceConnection(boolean fill)
- {
- super();
- PolygonDecoration dec = new PolygonDecoration()
- {
- protected void fillShape(Graphics g)
- {
- try
- {
- g.pushState();
- g.setBackgroundColor(ColorConstants.white);
- super.fillShape(g);
- }
- finally
- {
- g.popState();
- }
- }
-
- };
- dec.setFill(fill);
- dec.setTemplate(PolygonDecoration.TRIANGLE_TIP);
- dec.setScale(14,6);
- setTargetDecoration(dec);
- }
-
-
- public void setConnectionRouter(ConnectionRouter cr)
- {
- if (cr != null && getConnectionRouter() != null && !(getConnectionRouter() instanceof ManhattanConnectionRouter))
- super.setConnectionRouter(cr);
- }
-
- /**
- * @return Returns the current highlight status.
- */
- public boolean isHighlighted()
- {
- return highlight;
- }
-
- /**
- * @param highlight
- * The highlight to set.
- */
- public void setHighlight(boolean highlight)
- {
- this.highlight = highlight;
- // Update our connection to use the correct colouring
- boolean highContrast = false;
- try
- {
- highContrast = Display.getDefault().getHighContrast();
- }
- catch (Exception e)
- {
- }
- if (highContrast)
- {
- setForegroundColor(highlight ? Display.getDefault().getSystemColor(SWT.COLOR_WIDGET_FOREGROUND) : ColorConstants.lightGray);
- }
- else
- {
- setForegroundColor(highlight ? activeConnection : inactiveConnection);
- }
- setOpaque(highlight);
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/AbstractModelCollection.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/AbstractModelCollection.java
deleted file mode 100644
index dbeb88e177..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/AbstractModelCollection.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 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.xsd.ui.internal.adt.design.editparts.model;
-
-import java.util.List;
-
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObjectListener;
-
-public abstract class AbstractModelCollection implements IADTObject
-{
- protected IADTObject model;
- protected String kind;
-
- public AbstractModelCollection(IADTObject model, String kind)
- {
- this.model = model;
- this.kind = kind;
- }
-
- public Object getModel()
- {
- return model;
- }
-
- public void setModel(IADTObject model)
- {
- this.model = model;
- }
-
- public String getKind()
- {
- return kind;
- }
-
- public void setKind(String kind)
- {
- this.kind = kind;
- }
-
- public abstract List getChildren();
-
- public void registerListener(IADTObjectListener listener)
- {
- model.registerListener(listener);
- }
-
- public void unregisterListener(IADTObjectListener listener)
- {
- model.unregisterListener(listener);
- }
-
- public boolean isReadOnly()
- {
- return false;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/Annotation.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/Annotation.java
deleted file mode 100644
index 1f67a7fdd8..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/Annotation.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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.xsd.ui.internal.adt.design.editparts.model;
-
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IStructure;
-
-public class Annotation
-{
- Compartment compartment;
- public Annotation()
- {
- super();
- }
-
- public void setCompartment(Compartment compartment)
- {
- this.compartment = compartment;
- }
-
- public Compartment getCompartment()
- {
- return compartment;
- }
-
- public IStructure getOwner()
- {
- return compartment.getOwner();
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/Compartment.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/Compartment.java
deleted file mode 100644
index 628cd4f8ef..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/Compartment.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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.xsd.ui.internal.adt.design.editparts.model;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObjectListener;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IField;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IStructure;
-
-public class Compartment implements IADTObject
-{
- String kind;
- IStructure owner;
-
- public Compartment(IStructure owner, String kind)
- {
- this.kind = kind;
- this.owner = owner;
- }
-
- public List getChildren()
- {
- List list = new ArrayList();
- for (Iterator i = owner.getFields().iterator(); i.hasNext();)
- {
- IField field = (IField) i.next();
- if (kind == null || kind.equals(field.getKind()))
- {
- list.add(field);
- }
- }
- return list;
- }
-
- public String getKind()
- {
- return kind;
- }
-
- public IStructure getOwner()
- {
- return owner;
- }
-
- public void registerListener(IADTObjectListener listener)
- {
- // really we want to listen to the owner
- owner.registerListener(listener);
- }
-
- public void unregisterListener(IADTObjectListener listener)
- {
- // really we want to listen to the owner
- owner.unregisterListener(listener);
- }
-
- public boolean isReadOnly()
- {
- return false;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/FocusTypeColumn.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/FocusTypeColumn.java
deleted file mode 100644
index 60a6fc19c2..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/FocusTypeColumn.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 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.xsd.ui.internal.adt.design.editparts.model;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IField;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IStructure;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IType;
-
-public class FocusTypeColumn extends AbstractModelCollection
-{
- protected boolean isFocusObject = false;
-
- public FocusTypeColumn(IADTObject model)
- {
- super(model, "FocusTypeColumn"); //$NON-NLS-1$
- }
-
- public FocusTypeColumn(IADTObject model, boolean isFocusObject)
- {
- super(model, "FocusTypeColumn"); //$NON-NLS-1$
- this.isFocusObject = isFocusObject;
- }
-
- public List getChildren()
- {
- List result = new ArrayList();
- if (model instanceof IType)
- {
- IType type = (IType)model;
- if (type.getSuperType() != null)
- {
- result.add(type.getSuperType());
- }
- result.add(type);
- }
- else if (model instanceof IField ||
- model instanceof IStructure)
- {
- result.add(model);
- }
- return result;
- }
-
- public boolean isFocusObject()
- {
- return isFocusObject;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/IActionProvider.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/IActionProvider.java
deleted file mode 100644
index d8443fa552..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/IActionProvider.java
+++ /dev/null
@@ -1,18 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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.xsd.ui.internal.adt.design.editparts.model;
-
-
-
-public interface IActionProvider
-{
- public String[] getActions(Object object);
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/IFeedbackHandler.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/IFeedbackHandler.java
deleted file mode 100644
index 18e860b330..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/IFeedbackHandler.java
+++ /dev/null
@@ -1,17 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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.xsd.ui.internal.adt.design.editparts.model;
-
-public interface IFeedbackHandler
-{
- public void addFeedback();
- public void removeFeedback();
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/IGraphElement.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/IGraphElement.java
deleted file mode 100644
index 9b2f5cba55..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/IGraphElement.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2009 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.xsd.ui.internal.adt.design.editparts.model;
-
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IModel;
-import org.eclipse.gef.commands.Command;
-
-public interface IGraphElement
-{
- boolean isFocusAllowed();
- IADTObject getTopContainer();
- Command getDeleteCommand();
- IModel getModel();
- boolean isReadOnly();
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/IModelProxy.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/IModelProxy.java
deleted file mode 100644
index f263c38dd6..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/IModelProxy.java
+++ /dev/null
@@ -1,18 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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.xsd.ui.internal.adt.design.editparts.model;
-
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IModel;
-
-public interface IModelProxy
-{
- IModel getModel();
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/ReferencedTypeColumn.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/ReferencedTypeColumn.java
deleted file mode 100644
index 95f8970e0a..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/ReferencedTypeColumn.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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.xsd.ui.internal.adt.design.editparts.model;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObjectListener;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IField;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IStructure;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IType;
-
-public class ReferencedTypeColumn extends AbstractModelCollection
-{
- List listenerList = new ArrayList();
- InternalListener internalListener = new InternalListener();
-
- // todo... really this this model object should listen
- // to the parent of the IType
- //
- public ReferencedTypeColumn(IADTObject model)
- {
- super(model, "ReferencedTypeColumn"); //$NON-NLS-1$
- model.registerListener(internalListener);
- internalListener.recomputeSubListeners();
- }
-
- public List getChildren()
- {
- List result = new ArrayList();
- if (model instanceof IStructure)
- {
- IStructure structure = (IStructure)model;
- for (Iterator i = structure.getFields().iterator(); i.hasNext(); )
- {
- IField field = (IField)i.next();
- IType type = field.getType();
- if (type != null) // && type.isComplexType())
- {
- if (!result.contains(type))
- {
- if (type instanceof IGraphElement)
- {
- if (((IGraphElement)type).isFocusAllowed())
- result.add(type);
- }
- }
- }
- }
- }
- else if (model instanceof IField)
- {
- IField field = (IField)model;
- IType type = field.getType();
- if (type != null) // && type.isComplexType())
- {
- if (type instanceof IGraphElement)
- {
- if (((IGraphElement)type).isFocusAllowed())
- result.add(type);
- }
- }
- }
- return result;
- }
-
- public void registerListener(IADTObjectListener listener)
- {
- listenerList.add(listener);
- }
-
- public void unregisterListener(IADTObjectListener listener)
- {
- listenerList.remove(listener);
- }
-
- protected void notifyListeners(Object changedObject, String property)
- {
- List clonedListenerList = new ArrayList();
- clonedListenerList.addAll(listenerList);
- for (Iterator i = clonedListenerList.iterator(); i.hasNext(); )
- {
- IADTObjectListener listener = (IADTObjectListener)i.next();
- listener.propertyChanged(this, null);
- }
- }
-
- protected class InternalListener implements IADTObjectListener
- {
- List fields = new ArrayList();
-
- void recomputeSubListeners()
- {
- if (model instanceof IStructure)
- {
- // remove old ones
- for (Iterator i = fields.iterator(); i.hasNext();)
- {
- IField field = (IField) i.next();
- field.unregisterListener(this);
- }
- // add new ones
- fields.clear();
- IStructure complexType = (IStructure) model;
- for (Iterator i = complexType.getFields().iterator(); i.hasNext();)
- {
- IField field = (IField) i.next();
- fields.add(field);
- field.registerListener(this);
- }
- }
- }
-
- public void propertyChanged(Object object, String property)
- {
- if (object == model)
- {
- // we need to update the fields we're listening too
- // since these may have changed
- recomputeSubListeners();
- }
- else if (object instanceof IField)
- {
- }
- notifyListeners(object, property);
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/RootHolder.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/RootHolder.java
deleted file mode 100644
index ca7b3a6225..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/RootHolder.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 22007 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.xsd.ui.internal.adt.design.editparts.model;
-
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject;
-
-public class RootHolder
-{
- IADTObject model;
-
- public RootHolder(IADTObject model)
- {
- this.model = model;
- }
-
- public IADTObject getModel()
- {
- return model;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editpolicies/ADTDirectEditPolicy.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editpolicies/ADTDirectEditPolicy.java
deleted file mode 100644
index b7f22b30a5..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editpolicies/ADTDirectEditPolicy.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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.xsd.ui.internal.adt.design.editpolicies;
-
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.editpolicies.DirectEditPolicy;
-import org.eclipse.gef.requests.DirectEditRequest;
-import org.eclipse.wst.xsd.ui.internal.adt.design.directedit.ComboBoxCellEditorManager;
-
-public class ADTDirectEditPolicy extends DirectEditPolicy
-{
- protected ComboBoxCellEditorManager delegate;
- protected IADTUpdateCommand command;
-
- public ADTDirectEditPolicy()
- {
- super();
- }
-
-
- public void setUpdateCommand(IADTUpdateCommand command)
- {
- this.command = command;
- }
-
- protected void showCurrentEditValue(DirectEditRequest request)
- {
- getHostFigure().getUpdateManager().performUpdate();
- }
-
- protected Command getDirectEditCommand(DirectEditRequest request)
- {
- command.setRequest(request);
- return (Command)command;
- }
-
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editpolicies/ADTSelectionFeedbackEditPolicy.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editpolicies/ADTSelectionFeedbackEditPolicy.java
deleted file mode 100644
index 0747165e75..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editpolicies/ADTSelectionFeedbackEditPolicy.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 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.xsd.ui.internal.adt.design.editpolicies;
-
-import org.eclipse.gef.editpolicies.SelectionEditPolicy;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.IFeedbackHandler;
-
-public class ADTSelectionFeedbackEditPolicy extends SelectionEditPolicy
-{
-
- public ADTSelectionFeedbackEditPolicy()
- {
- super();
- }
-
- protected void hideSelection()
- {
- if (getHost() instanceof IFeedbackHandler)
- {
- ((IFeedbackHandler) getHost()).removeFeedback();
- }
- }
-
- protected void showSelection()
- {
- if (getHost() instanceof IFeedbackHandler)
- {
- ((IFeedbackHandler) getHost()).addFeedback();
- }
- }
-
- protected void showFocus()
- {
- super.showFocus();
- getHost().setFocus(true);
- }
-
- protected void hideFocus()
- {
- super.hideFocus();
- getHost().setFocus(false);
- }
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editpolicies/DirectEditPolicyDelegate.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editpolicies/DirectEditPolicyDelegate.java
deleted file mode 100644
index 151b493512..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editpolicies/DirectEditPolicyDelegate.java
+++ /dev/null
@@ -1,18 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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.xsd.ui.internal.adt.design.editpolicies;
-
-import org.eclipse.jface.viewers.CellEditor;
-
-public interface DirectEditPolicyDelegate
-{
- public void performEdit(CellEditor cellEditor);
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editpolicies/IADTUpdateCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editpolicies/IADTUpdateCommand.java
deleted file mode 100644
index a4c4eb50bb..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editpolicies/IADTUpdateCommand.java
+++ /dev/null
@@ -1,18 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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.xsd.ui.internal.adt.design.editpolicies;
-
-import org.eclipse.gef.requests.DirectEditRequest;
-
-public interface IADTUpdateCommand
-{
- void setRequest(DirectEditRequest request);
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editpolicies/KeyBoardAccessibilityEditPolicy.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editpolicies/KeyBoardAccessibilityEditPolicy.java
deleted file mode 100644
index dd0ee63e22..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editpolicies/KeyBoardAccessibilityEditPolicy.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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.xsd.ui.internal.adt.design.editpolicies;
-
-import org.eclipse.draw2d.PositionConstants;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.editpolicies.GraphicalEditPolicy;
-
-public class KeyBoardAccessibilityEditPolicy extends GraphicalEditPolicy
-{
- public static String KEY = "KeyBoardAccessibilityEditPolicy";
-
- public static int OUT_TO_PARENT = PositionConstants.ALWAYS_LEFT;
- public static int IN_TO_FIRST_CHILD = PositionConstants.ALWAYS_RIGHT;
-
- public EditPart getRelativeEditPart(EditPart editPart, int direction)
- {
- return null;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editpolicies/SimpleDirectEditPolicy.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editpolicies/SimpleDirectEditPolicy.java
deleted file mode 100644
index 4e38e39f6e..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editpolicies/SimpleDirectEditPolicy.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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.xsd.ui.internal.adt.design.editpolicies;
-
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.editpolicies.DirectEditPolicy;
-import org.eclipse.gef.requests.DirectEditRequest;
-
-public class SimpleDirectEditPolicy extends DirectEditPolicy
-{
- protected DirectEditPolicyDelegate delegate;
-
- public void setDelegate(DirectEditPolicyDelegate delegate)
- {
- this.delegate = delegate;
- }
-
- protected org.eclipse.gef.commands.Command getDirectEditCommand(final DirectEditRequest request)
- {
- return new Command() //AbstractCommand()
- {
- public void execute()
- {
- if (delegate != null)
- {
- delegate.performEdit(request.getCellEditor());
- }
- }
-
- public void redo()
- {
- }
-
- public void undo()
- {
- }
-
- public boolean canExecute()
- {
- return true;
- }
- };
- }
-
- protected void showCurrentEditValue(DirectEditRequest request)
- {
- //hack to prevent async layout from placing the cell editor twice.
- getHostFigure().getUpdateManager().performUpdate();
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/figures/IADTFigure.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/figures/IADTFigure.java
deleted file mode 100644
index 284a26043b..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/figures/IADTFigure.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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.xsd.ui.internal.adt.design.figures;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.gef.EditPart;
-
-public interface IADTFigure extends IFigure
-{
- void editPartAttached(EditPart owner);
- void addSelectionFeedback();
- void removeSelectionFeedback();
- void refreshVisuals(Object model);
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/figures/ICompartmentFigure.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/figures/ICompartmentFigure.java
deleted file mode 100644
index 3e25deff34..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/figures/ICompartmentFigure.java
+++ /dev/null
@@ -1,19 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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.xsd.ui.internal.adt.design.figures;
-
-import org.eclipse.draw2d.IFigure;
-
-public interface ICompartmentFigure extends IADTFigure
-{
- IFigure getContentPane();
- IFigure getAnnotationPane();
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/figures/IFieldFigure.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/figures/IFieldFigure.java
deleted file mode 100644
index efabeb0e68..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/figures/IFieldFigure.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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.xsd.ui.internal.adt.design.figures;
-
-import org.eclipse.draw2d.Label;
-
-
-public interface IFieldFigure extends IADTFigure
-{
- Label getTypeLabel();
- Label getNameLabel();
- Label getNameAnnotationLabel();
- Label getTypeAnnotationLabel();
- void recomputeLayout();
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/figures/IFigureFactory.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/figures/IFigureFactory.java
deleted file mode 100644
index d6efe614c4..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/figures/IFigureFactory.java
+++ /dev/null
@@ -1,18 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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.xsd.ui.internal.adt.design.figures;
-
-public interface IFigureFactory
-{
- IFieldFigure createFieldFigure(Object model);
- IStructureFigure createStructureFigure(Object model);
- ICompartmentFigure createCompartmentFigure(Object model);
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/figures/IStructureFigure.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/figures/IStructureFigure.java
deleted file mode 100644
index 5a96af2019..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/figures/IStructureFigure.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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.xsd.ui.internal.adt.design.figures;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.geometry.Point;
-
-public interface IStructureFigure extends IADTFigure
-{
- IFigure getContentPane();
- Label getNameLabel();
- boolean hitTestHeader(Point point);
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/edit/ComponentReferenceEditManager.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/edit/ComponentReferenceEditManager.java
deleted file mode 100644
index 46ac99a38a..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/edit/ComponentReferenceEditManager.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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.xsd.ui.internal.adt.edit;
-
-import org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSpecification;
-import org.eclipse.wst.common.ui.internal.search.dialogs.IComponentDescriptionProvider;
-
-public interface ComponentReferenceEditManager
-{
- public IComponentDialog getBrowseDialog();
- public IComponentDialog getNewDialog();
- public void modifyComponentReference(Object referencingObject, ComponentSpecification referencedComponent);
- public IComponentDescriptionProvider getComponentDescriptionProvider();
-
- public ComponentSpecification[] getQuickPicks();
- public ComponentSpecification[] getHistory();
- public void addToHistory(ComponentSpecification component);
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/edit/ComponentReferenceEditManager2.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/edit/ComponentReferenceEditManager2.java
deleted file mode 100644
index c01312da73..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/edit/ComponentReferenceEditManager2.java
+++ /dev/null
@@ -1,19 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.xsd.ui.internal.adt.edit;
-
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject;
-
-public interface ComponentReferenceEditManager2 extends ComponentReferenceEditManager
-{
- void setReferencer(IADTObject field);
- IADTObject getReferencer();
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/edit/IComponentDialog.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/edit/IComponentDialog.java
deleted file mode 100644
index 4194f9b5b4..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/edit/IComponentDialog.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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.xsd.ui.internal.adt.edit;
-
-import org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSpecification;
-
-public interface IComponentDialog {
-
- /*
- * Set the Object being set
- */
- public void setInitialSelection(ComponentSpecification componentSpecification);
-
- /*
- * Return the Object which should be used as the type.
- */
- public ComponentSpecification getSelectedComponent();
-
- /*
- * Used to open the Dialog
- */
- public int createAndOpen();
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/ADTExternalResourceVariant.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/ADTExternalResourceVariant.java
deleted file mode 100644
index 96bf76a6d5..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/ADTExternalResourceVariant.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Jesper Steen Moller - added resolver lookups
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.adt.editor;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.SocketTimeoutException;
-import java.net.URL;
-import java.net.URLConnection;
-
-import org.eclipse.core.resources.IEncodedStorage;
-import org.eclipse.core.resources.IResourceStatus;
-import org.eclipse.core.resources.IStorage;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.PlatformObject;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.content.IContentDescription;
-import org.eclipse.core.runtime.content.IContentTypeManager;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.wst.common.uriresolver.internal.provisional.URIResolverPlugin;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin;
-
-public class ADTExternalResourceVariant extends PlatformObject
-{
- private IStorage storage;
- private String urlString;
-
- public static String getCharset(String name, InputStream stream) throws IOException
- {
- IContentDescription description = getContentDescription(name, stream);
- return description == null ? null : description.getCharset();
- }
-
- public static IContentDescription getContentDescription(String name, InputStream stream) throws IOException
- {
- IContentTypeManager contentTypeManager = Platform.getContentTypeManager();
- try
- {
- return contentTypeManager.getDescriptionFor(stream, name, IContentDescription.ALL);
- }
- finally
- {
- if (stream != null)
- {
- try
- {
- stream.close();
- }
- catch (IOException e)
- {
-
- }
- }
- }
- }
-
- public ADTExternalResourceVariant(String urlString)
- {
- this.urlString = urlString;
- }
-
- class XSDResourceVariantStorage implements IEncodedStorage
- {
-
- public InputStream getContents() throws CoreException
- {
- try
- {
- String physicalUrlString = URIResolverPlugin.createResolver().resolvePhysicalLocation(null, null, urlString);
- URL url = new URL(physicalUrlString);
- URLConnection urlConnection = url.openConnection();
- return urlConnection.getInputStream();
- }
- catch (SocketTimeoutException toException)
- {
- // handle
- }
- catch (IOException e)
- {
-
- }
- return new ByteArrayInputStream(new byte[0]);
- }
-
- public IPath getFullPath()
- {
- // Since this is loaded from an URL, this should never be interpreted as a path
- return null;
- }
-
- public String getName()
- {
- return urlString;
- }
-
- public boolean isReadOnly()
- {
- return true;
- }
-
- public Object getAdapter(Class adapter)
- {
- return ADTExternalResourceVariant.this.getAdapter(adapter);
- }
-
- public String getCharset() throws CoreException
- {
- InputStream contents = getContents();
- try
- {
- String charSet = ADTExternalResourceVariant.getCharset(getName(), contents);
- return charSet;
- }
- catch (IOException e)
- {
- throw new CoreException(new Status(IStatus.ERROR, XSDEditorPlugin.PLUGIN_ID, IResourceStatus.FAILED_DESCRIBING_CONTENTS, NLS.bind("", new String[] { getFullPath().toString() }), e));
- }
- finally
- {
- try
- {
- contents.close();
- }
- catch (IOException ioException)
- {
-
- }
- }
- }
- }
-
- public IStorage getStorage()
- {
- if (storage == null)
- {
- storage = new XSDResourceVariantStorage();
- }
- return storage;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/ADTFileStoreEditorInput.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/ADTFileStoreEditorInput.java
deleted file mode 100644
index d9fc877296..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/ADTFileStoreEditorInput.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.xsd.ui.internal.adt.editor;
-
-import org.eclipse.core.filesystem.IFileStore;
-import org.eclipse.ui.ide.FileStoreEditorInput;
-import org.eclipse.wst.xsd.ui.internal.editor.Messages;
-import org.eclipse.xsd.XSDSchema;
-
-public class ADTFileStoreEditorInput extends FileStoreEditorInput implements IADTEditorInput
-{
- private XSDSchema schema;
- private String editorName;
-
- public ADTFileStoreEditorInput(IFileStore fileStore, XSDSchema xsdSchema)
- {
- super(fileStore);
- this.schema = xsdSchema;
- }
-
- public XSDSchema getSchema()
- {
- return schema;
- }
-
- public void setEditorName(String name)
- {
- editorName = name;
- }
-
- public String getName()
- {
- if (editorName != null)
- {
- return editorName;
- }
- return super.getName();
- }
-
- public String getToolTipText()
- {
- if (schema != null)
- {
- String ns = schema.getTargetNamespace();
- if (ns != null && ns.length() > 0)
- return Messages._UI_LABEL_TARGET_NAMESPACE + ns;
- else
- return Messages._UI_LABEL_NO_NAMESPACE;
- }
- return super.getToolTipText();
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/ADTMultiPageEditor.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/ADTMultiPageEditor.java
deleted file mode 100644
index dbd3b7ce24..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/ADTMultiPageEditor.java
+++ /dev/null
@@ -1,373 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.adt.editor;
-
-import java.util.List;
-
-import org.eclipse.draw2d.ColorConstants;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.EditPartFactory;
-import org.eclipse.gef.GraphicalEditPart;
-import org.eclipse.gef.GraphicalViewer;
-import org.eclipse.gef.SelectionManager;
-import org.eclipse.gef.editparts.ZoomManager;
-import org.eclipse.gef.ui.actions.ActionRegistry;
-import org.eclipse.gef.ui.parts.ScrollingGraphicalViewer;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.StackLayout;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.contexts.IContextActivation;
-import org.eclipse.ui.contexts.IContextService;
-import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
-import org.eclipse.wst.xsd.ui.internal.adt.actions.BaseSelectionAction;
-import org.eclipse.wst.xsd.ui.internal.adt.actions.SetInputToGraphView;
-import org.eclipse.wst.xsd.ui.internal.adt.design.ADTFloatingToolbar;
-import org.eclipse.wst.xsd.ui.internal.adt.design.DesignViewGraphicalViewer;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.ADTEditPartFactory;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IModel;
-import org.eclipse.wst.xsd.ui.internal.adt.outline.ADTContentOutlinePage;
-import org.eclipse.wst.xsd.ui.internal.adt.outline.ADTLabelProvider;
-import org.eclipse.wst.xsd.ui.internal.adt.outline.ExtensibleContentOutlinePage;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin;
-
-public abstract class ADTMultiPageEditor extends CommonMultiPageEditor
-{
- protected IModel model;
- private int currentPage = -1;
- protected Button tableOfContentsButton;
- protected ADTFloatingToolbar floatingToolbar;
- private IContextActivation contextActivation;
- public final static String DESIGN_VIEW_CONTEXT = "org.eclipse.wst.xsd.ui.editor.designView"; //$NON-NLS-1$
- public final static String SOURCE_VIEW_CONTEXT = "org.eclipse.wst.xsd.ui.editor.sourceView"; //$NON-NLS-1$
-
- /**
- * Creates a multi-page editor example.
- */
- public ADTMultiPageEditor()
- {
- super();
- }
-
-
- private class InternalLayout extends StackLayout
- {
- public InternalLayout()
- {
- super();
- }
-
- protected void layout(Composite composite, boolean flushCache)
- {
- Control children[] = composite.getChildren();
- Rectangle rect = composite.getClientArea();
- rect.x += marginWidth;
- rect.y += marginHeight;
- rect.width -= 2 * marginWidth;
- rect.height -= 2 * marginHeight;
-
- for (int i = 0; i < children.length; i++)
- {
- if (i == 0) // For the back to schema button
- {
- org.eclipse.draw2d.geometry.Rectangle r = ((GraphicalEditPart)floatingToolbar.getContents()).getFigure().getBounds();
- children[i].setBounds(rect.x + 10, rect.y + 10, r.width, Math.max(24, r.height));
- }
- else if (i == 1 && modeCombo != null) // For the drop down toolbar
- {
- children[i].setBounds(rect.x + rect.width - 90 - maxLength, rect.y + 10, maxLength + 60, 26);
- }
- else // For the main graph viewer
- {
- children[i].setBounds(rect);
- }
- }
- }
- }
-
- protected Composite createGraphPageComposite()
- {
- Composite parent = new Composite(getContainer(), SWT.FLAT);
- parent.setBackground(ColorConstants.white);
-
- parent.setLayout(new InternalLayout());
-
- floatingToolbar = new ADTFloatingToolbar(getModel());
- floatingToolbar.createControl(parent);
- floatingToolbar.getControl().setVisible(true);
- EditPartFactory editPartFactory = getEditorModeManager().getCurrentMode().getEditPartFactory();
- floatingToolbar.setEditPartFactory(editPartFactory);
-
- createViewModeToolbar(parent);
-
- return parent;
- }
-
- protected void createGraphPage()
- {
- super.createGraphPage();
-// toolbarViewer.getControl().moveAbove(graphicalViewer.getControl());
-// graphicalViewer.getControl().moveBelow(toolbarViewer.getControl());
- }
-
- public String getContributorId()
- {
- return "org.eclipse.wst.xsd.ui.internal.editor"; //$NON-NLS-1$
- }
-
- public IContentOutlinePage getContentOutlinePage()
- {
- if (fOutlinePage == null || fOutlinePage.getControl() == null || fOutlinePage.getControl().isDisposed())
- {
- final ProductCustomizationProvider productCustomizationProvider = (ProductCustomizationProvider)getAdapter(ProductCustomizationProvider.class);
- ExtensibleContentOutlinePage outlinePage = null;
- if (productCustomizationProvider != null)
- {
- outlinePage = productCustomizationProvider.getProductContentOutlinePage();
- }
-
- if (outlinePage == null)
- {
- outlinePage = new ADTContentOutlinePage();
- }
- outlinePage.setEditor(this);
- ITreeContentProvider provider = (ITreeContentProvider)getEditorModeManager().getCurrentMode().getOutlineProvider();
- outlinePage.setContentProvider(provider);
- ADTLabelProvider adtLabelProvider = new ADTLabelProvider();
- outlinePage.setLabelProvider(adtLabelProvider);
- outlinePage.setModel(getModel());
- fOutlinePage = outlinePage;
- }
- return fOutlinePage;
- }
-
- /**
- * Creates the pages of the multi-page editor.
- */
- protected void createPages()
- {
- selectionProvider = getSelectionManager();
-
- createGraphPage();
- createSourcePage();
-
- getEditorSite().setSelectionProvider(selectionProvider);
-
- model = buildModel(); // (IFileEditorInput)getEditorInput());
-
- initializeGraphicalViewer();
- floatingToolbar.setModel(model);
-
- int pageIndexToShow = getDefaultPageTypeIndex();
- setActivePage(pageIndexToShow);
- }
-
- protected int getDefaultPageTypeIndex() {
- int pageIndex = SOURCE_PAGE_INDEX;
- if (XSDEditorPlugin.getPlugin().getDefaultPage().equals(XSDEditorPlugin.DESIGN_PAGE)) {
- pageIndex = DESIGN_PAGE_INDEX;
- }
-
- return pageIndex;
- }
-
- /**
- * @see org.eclipse.ui.IWorkbenchPart#setFocus()
- */
- public void setFocus()
- {
- super.setFocus();
- if (getActivePage() == DESIGN_PAGE_INDEX)
- {
- if (graphicalViewer != null && graphicalViewer.getControl() != null)
- {
- List selected = graphicalViewer.getSelectedEditParts();
- if (selected.size() > 0)
- {
- graphicalViewer.setFocus((EditPart)selected.get(0));
- }
- graphicalViewer.getControl().setFocus();
-
- }
- }
- else
- {
- graphicalViewer.setFocus(null);
- }
- }
-
- protected void pageChange(int newPageIndex)
- {
- deactivateContext(contextActivation);
- currentPage = newPageIndex;
- super.pageChange(newPageIndex);
-
- String context = getContext(currentPage);
- contextActivation = activateContext(context);
-
- if (newPageIndex == DESIGN_PAGE_INDEX)
- {
- ISelection selection = graphicalViewer.getSelectionManager().getSelection();
- Object model = null;
- if (selection instanceof StructuredSelection)
- {
- StructuredSelection structuredSelection = (StructuredSelection)selection;
- // While in the source view, selection could have changed.
- // Will try to select the first item when switching back to the design view.
- // We currently do not multi-select figures if multiple elements are selected in the source view.
- // For example, if multiple global elements are selected, the graph view will be in the details view
- // of the first one.
- Object elem = structuredSelection.getFirstElement();
- if (elem instanceof EditPart)
- model = ((EditPart)elem).getModel();
- }
- // Refresh the design page upon page change
- graphicalViewer.getContents().refresh();
- // Need to use the adapter, since after refresh, the old edit part will have been replaced
- // Maintain previous selection:
- if (model != null)
- {
- getSelectionManager().setSelection(new StructuredSelection(model));
- }
- }
- setFocus();
- }
-
- private boolean isTableOfContentsApplicable(Object graphViewInput)
- {
- return !(graphViewInput instanceof IModel);
- }
-
- protected ScrollingGraphicalViewer getGraphicalViewer()
- {
- DesignViewGraphicalViewer viewer = new DesignViewGraphicalViewer(this, getSelectionManager());
- viewer.addInputChangdListener(new ISelectionChangedListener()
- {
- public void selectionChanged(SelectionChangedEvent event)
- {
- IStructuredSelection input = (IStructuredSelection)event.getSelection();
- floatingToolbar.refresh(isTableOfContentsApplicable(input.getFirstElement()));
- }
- });
- // Workaround bug 227687 An edit part's focus state is not updated properly
- // Once this is bug is fixed, we can remove custom selection manager
- viewer.setSelectionManager(new CustomSelectionManager());
- return viewer;
- }
-
- // Workaround bug 227687 An edit part's focus state is not updated properly
- // Once this is bug is fixed, we can remove this class
- private class CustomSelectionManager extends SelectionManager
- {
- public void appendSelection(EditPart editpart)
- {
- if (editpart != getFocus())
- getViewer().setFocus(editpart);
- super.appendSelection(editpart);
- }
- }
-
- abstract public IModel buildModel(); // (IFileEditorInput editorInput);
-
- protected void createActions()
- {
- ActionRegistry registry = getActionRegistry();
-
- BaseSelectionAction action = new SetInputToGraphView(this);
- action.setSelectionProvider(getSelectionManager());
- registry.registerAction(action);
- }
-
-
- public IModel getModel()
- {
- return model;
- }
-
- public Object getAdapter(Class type)
- {
- if (type == ZoomManager.class)
- return graphicalViewer.getProperty(ZoomManager.class.toString());
-
- if (type == GraphicalViewer.class)
- return graphicalViewer;
- if (type == EditPart.class && graphicalViewer != null)
- return graphicalViewer.getRootEditPart();
- if (type == IFigure.class && graphicalViewer != null)
- return ((GraphicalEditPart) graphicalViewer.getRootEditPart()).getFigure();
-
- if (type == IContentOutlinePage.class)
- {
- return getContentOutlinePage();
- }
-
- return super.getAdapter(type);
- }
-
- protected EditPartFactory getEditPartFactory() {
- return new ADTEditPartFactory();
- }
-
- protected void initializeGraphicalViewer()
- {
- graphicalViewer.setContents(model);
- }
-
- public void dispose()
- {
- if (currentPage == SOURCE_PAGE_INDEX)
- {
- XSDEditorPlugin.getPlugin().setSourcePageAsDefault();
- }
- else
- {
- XSDEditorPlugin.getPlugin().setDesignPageAsDefault();
- }
- floatingToolbar = null;
- deactivateContext(contextActivation);
- super.dispose();
- }
- protected String getContext(int pageIndex) {
- if (pageIndex == DESIGN_PAGE_INDEX) {
- return DESIGN_VIEW_CONTEXT;
- } else if (pageIndex == SOURCE_PAGE_INDEX) {
- return SOURCE_VIEW_CONTEXT;
- }
-
- return null;
- }
- private IContextActivation activateContext(String context) {
- IContextService contextService = (IContextService) getSite().getService(IContextService.class);
-
- if (contextService != null && context != null) {
- return contextActivation = contextService.activateContext(context);
- }
- return null;
- }
-
- private void deactivateContext(IContextActivation contextActivation) {
- IContextService contextService = (IContextService) getSite().getService(IContextService.class);
-
- if (contextService != null && contextActivation != null) {
- contextService.deactivateContext(contextActivation);
- }
- }
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/ADTReadOnlyFileEditorInput.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/ADTReadOnlyFileEditorInput.java
deleted file mode 100644
index b5fd8d2c51..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/ADTReadOnlyFileEditorInput.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.xsd.ui.internal.adt.editor;
-
-import org.eclipse.core.resources.IStorage;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.ui.IPersistableElement;
-import org.eclipse.ui.IStorageEditorInput;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-import org.eclipse.wst.common.uriresolver.internal.URI;
-import org.eclipse.xsd.XSDSchema;
-
-/**
- *
- * Used for any read-only files, ie. HTTP files.
- *
- */
-public class ADTReadOnlyFileEditorInput implements IStorageEditorInput, IADTEditorInput
-{
- protected String urlString;
- protected IStorage storage;
- protected ADTExternalResourceVariant variant;
- protected XSDSchema xsdSchema;
- protected String editorName;
- protected String editorID = "";
-
- public ADTReadOnlyFileEditorInput(String urlString)
- {
- this.urlString = urlString;
- variant = new ADTExternalResourceVariant(urlString);
- }
-
- /*
- * @see java.lang.Object#equals(java.lang.Object)
- */
- public boolean equals(Object o)
- {
- if (o == this)
- return true;
-
- if (o instanceof ADTReadOnlyFileEditorInput)
- {
- ADTReadOnlyFileEditorInput input = (ADTReadOnlyFileEditorInput) o;
-
- return urlString.equals(input.getUrlString()) && input.getEditorID().equals(editorID);
- }
-
- return false;
- }
-
- public String getUrlString()
- {
- return urlString;
- }
-
- public IStorage getStorage() throws CoreException
- {
- storage = variant.getStorage();
- return storage;
- }
-
- public boolean exists()
- {
- return false;
- }
-
- public ImageDescriptor getImageDescriptor()
- {
- return null;
- }
-
- public String getName()
- {
- if (editorName == null)
- {
- URI uri = URI.createURI(urlString);
- return uri.lastSegment();
- }
- return editorName;
- }
-
- public IPersistableElement getPersistable()
- {
- // http files cannot persist
- return null;
- }
-
- public String getToolTipText()
- {
- return urlString;
- }
-
- public Object getAdapter(Class adapter)
- {
- if (adapter == IWorkbenchAdapter.class)
- return this;
- if (adapter == IStorage.class)
- return storage;
- return null;
- }
-
- public void setSchema(XSDSchema xsdSchema)
- {
- this.xsdSchema = xsdSchema;
- }
-
- public XSDSchema getSchema()
- {
- return xsdSchema;
- }
-
- public void setEditorName(String name)
- {
- editorName = name;
- }
-
- public void setEditorID(String editorID)
- {
- this.editorID = editorID;
- }
-
- public String getEditorID()
- {
- return editorID;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/CommonMultiPageEditor.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/CommonMultiPageEditor.java
deleted file mode 100644
index 148cc02b3f..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/CommonMultiPageEditor.java
+++ /dev/null
@@ -1,942 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2009 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.xsd.ui.internal.adt.editor;
-
-import java.text.Collator;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Comparator;
-import java.util.EventObject;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResourceChangeEvent;
-import org.eclipse.core.resources.IResourceChangeListener;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.draw2d.ColorConstants;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.gef.DefaultEditDomain;
-import org.eclipse.gef.EditPartFactory;
-import org.eclipse.gef.EditPartViewer;
-import org.eclipse.gef.MouseWheelHandler;
-import org.eclipse.gef.MouseWheelZoomHandler;
-import org.eclipse.gef.commands.CommandStack;
-import org.eclipse.gef.commands.CommandStackListener;
-import org.eclipse.gef.editparts.LayerManager;
-import org.eclipse.gef.editparts.ZoomManager;
-import org.eclipse.gef.ui.actions.ActionRegistry;
-import org.eclipse.gef.ui.actions.UpdateAction;
-import org.eclipse.gef.ui.actions.ZoomInAction;
-import org.eclipse.gef.ui.actions.ZoomOutAction;
-import org.eclipse.gef.ui.parts.ScrollingGraphicalViewer;
-import org.eclipse.gef.ui.parts.SelectionSynchronizer;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.MouseAdapter;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.PaintEvent;
-import org.eclipse.swt.events.PaintListener;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IEditorSite;
-import org.eclipse.ui.IPartListener;
-import org.eclipse.ui.IPartService;
-import org.eclipse.ui.IPropertyListener;
-import org.eclipse.ui.IWindowListener;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.forms.widgets.ImageHyperlink;
-import org.eclipse.ui.ide.IDE;
-import org.eclipse.ui.ide.IGotoMarker;
-import org.eclipse.ui.part.FileEditorInput;
-import org.eclipse.ui.part.MultiPageEditorPart;
-import org.eclipse.ui.part.MultiPageEditorSite;
-import org.eclipse.ui.texteditor.ITextEditor;
-import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
-import org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor;
-import org.eclipse.wst.sse.ui.StructuredTextEditor;
-import org.eclipse.wst.xml.core.internal.provisional.contenttype.ContentTypeIdForXML;
-import org.eclipse.wst.xsd.ui.internal.adt.design.DesignViewerGraphicConstants;
-import org.eclipse.wst.xsd.ui.internal.adt.design.FlatCCombo;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.RootEditPart;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin;
-
-public abstract class CommonMultiPageEditor extends MultiPageEditorPart implements IResourceChangeListener, CommandStackListener, ITabbedPropertySheetPageContributor, IPropertyListener, IEditorModeListener
-{
- public static int SOURCE_PAGE_INDEX = 1, DESIGN_PAGE_INDEX = 0;
-
- protected IContentOutlinePage fOutlinePage;
- protected DefaultEditDomain editDomain;
- protected SelectionSynchronizer synchronizer;
- protected ActionRegistry actionRegistry;
- protected StructuredTextEditor structuredTextEditor;
- protected CommonSelectionManager selectionProvider;
- protected ScrollingGraphicalViewer graphicalViewer;
- protected EditorModeManager editorModeManager;
- protected FlatCCombo modeCombo;
- private EditorModeAndCustomizedName[] editorModeAndCustomizedNames;
- protected Composite toolbar;
- protected ModeComboListener modeComboListener;
- protected int maxLength = 0;
- protected CommonActivationListener fActivationListener;
-
- public CommonMultiPageEditor()
- {
- super();
- editDomain = new DefaultEditDomain(this)
- {
- public void mouseDown(MouseEvent mouseEvent, EditPartViewer viewer)
- {
- boolean eatTheEvent = false;
- LayerManager manager = (LayerManager)viewer.getEditPartRegistry().get(LayerManager.ID);
- IFigure layer = manager.getLayer(DesignViewerGraphicConstants.SCALED_HANDLE_LAYER);
- if (layer != null)
- {
- Point p = new Point(mouseEvent.x, mouseEvent.y);
- layer.translateToRelative(p);
- IFigure figure = layer.findFigureAt(p);
- if (figure != null && figure != layer)
- {
- // we eat this selection event!
- eatTheEvent = true;
- }
- }
- if (!eatTheEvent)
- {
- super.mouseDown(mouseEvent, viewer);
- }
- }
- };
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor#getContributorId()
- */
- public abstract String getContributorId();
-
-
- /**
- *
- */
- protected abstract void createActions();
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.MultiPageEditorPart#createPages()
- */
- protected void createPages()
- {
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.EditorPart#doSave(org.eclipse.core.runtime.IProgressMonitor)
- */
- public void doSave(IProgressMonitor monitor)
- {
-// getEditor(1).doSave(monitor);
- structuredTextEditor.doSave(monitor);
- getCommandStack().markSaveLocation();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.EditorPart#doSaveAs()
- */
- public void doSaveAs()
- {
- IEditorPart editor = getEditor(1);
-// editor.doSaveAs();
- structuredTextEditor.doSaveAs();
- setInput(structuredTextEditor.getEditorInput());
- setPartName(editor.getTitle());
- getCommandStack().markSaveLocation();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.EditorPart#isSaveAsAllowed()
- */
- public boolean isSaveAsAllowed()
- {
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.resources.IResourceChangeListener#resourceChanged(org.eclipse.core.resources.IResourceChangeEvent)
- *
- * Closes all project files on project close.
- */
- public void resourceChanged(final IResourceChangeEvent event)
- {
- if (event.getType() == IResourceChangeEvent.PRE_CLOSE)
- {
- Display.getDefault().asyncExec(new Runnable()
- {
- public void run()
- {
- IWorkbenchPage[] pages = getSite().getWorkbenchWindow().getPages();
- for (int i = 0; i < pages.length; i++)
- {
- if (((FileEditorInput) structuredTextEditor.getEditorInput()).getFile().getProject().equals(event.getResource()))
- {
- IEditorPart editorPart = pages[i].findEditor(structuredTextEditor.getEditorInput());
- pages[i].closeEditor(editorPart, true);
- }
- }
- }
- });
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.gef.commands.CommandStackListener#commandStackChanged(java.util.EventObject)
- */
- public void commandStackChanged(EventObject event)
- {
- firePropertyChange(PROP_DIRTY);
- }
-
- /**
- * Indicates that a property has changed.
- *
- * @param source
- * the object whose property has changed
- * @param propId
- * the id of the property which has changed; property ids are
- * generally defined as constants on the source class
- */
- public void propertyChanged(Object source, int propId)
- {
- switch (propId)
- {
- // had to implement input changed "listener" so that
- // strucutedText could tell it containing editor that
- // the input has change, when a 'resource moved' event is
- // found.
- case IEditorPart.PROP_INPUT :
- case IEditorPart.PROP_DIRTY : {
- if (source == structuredTextEditor)
- {
- if (structuredTextEditor.getEditorInput() != getEditorInput())
- {
- setInput(structuredTextEditor.getEditorInput());
- // title should always change when input changes.
- // create runnable for following post call
- Runnable runnable = new Runnable()
- {
- public void run()
- {
- _firePropertyChange(IWorkbenchPart.PROP_TITLE);
- }
- };
- // Update is just to post things on the display queue
- // (thread). We have to do this to get the dirty
- // property to get updated after other things on the
- // queue are executed.
- postOnDisplayQue(runnable);
- }
- }
- break;
- }
- case IWorkbenchPart.PROP_TITLE : {
- // update the input if the title is changed
- if (source == structuredTextEditor)
- {
- if (structuredTextEditor.getEditorInput() != getEditorInput())
- {
- setInput(structuredTextEditor.getEditorInput());
- }
- }
- break;
- }
- default : {
- // propagate changes. Is this needed? Answer: Yes.
- if (source == structuredTextEditor)
- {
- firePropertyChange(propId);
- }
- break;
- }
- }
- }
-
- // Should override to set the input to the design viewer for a new document change
- // ie. when doing a saveAs
- protected void setInputToGraphicalViewer(IDocument newInput)
- {
- }
-
- protected void setInput(IEditorInput input)
- {
- super.setInput(input);
- if (graphicalViewer != null)
- {
- setInputToGraphicalViewer(getDocument());
- }
- }
-
- protected IDocument getDocument()
- {
- IDocument document = null;
- if (structuredTextEditor != null)
- {
- document = structuredTextEditor.getDocumentProvider().getDocument(structuredTextEditor.getEditorInput());
- }
- return document;
- }
-
- /**
- * @return
- */
- protected SelectionSynchronizer getSelectionSynchronizer()
- {
- if (synchronizer == null)
- synchronizer = new SelectionSynchronizer();
- return synchronizer;
- }
-
- public CommonSelectionManager getSelectionManager()
- {
- if (selectionProvider == null)
- {
- selectionProvider = new CommonSelectionManager(this);
- }
- return selectionProvider;
- }
-
- /*
- * This method is just to make firePropertyChanged accessbible from some
- * (anonomous) inner classes.
- */
- protected void _firePropertyChange(int property)
- {
- super.firePropertyChange(property);
- }
-
- /**
- * Posts the update code "behind" the running operation.
- */
- protected void postOnDisplayQue(Runnable runnable)
- {
- IWorkbench workbench = PlatformUI.getWorkbench();
- IWorkbenchWindow[] windows = workbench.getWorkbenchWindows();
- if (windows != null && windows.length > 0)
- {
- Display display = windows[0].getShell().getDisplay();
- display.asyncExec(runnable);
- }
- else
- runnable.run();
- }
-
- /**
- * The <code>MultiPageEditorPart</code> implementation of this
- * <code>IWorkbenchPart</code> method disposes all nested editors.
- * Subclasses may extend.
- */
- public void dispose()
- {
- getCommandStack().removeCommandStackListener(this);
- ResourcesPlugin.getWorkspace().removeResourceChangeListener(this);
- actionRegistry.dispose();
-
- if (structuredTextEditor != null) {
- structuredTextEditor.removePropertyListener(this);
- }
- structuredTextEditor = null;
- editDomain = null;
- fOutlinePage = null;
- synchronizer = null;
- actionRegistry = null;
- selectionProvider = null;
- graphicalViewer = null;
- if (modeCombo != null && !modeCombo.isDisposed())
- {
- modeCombo.removeSelectionListener(modeComboListener);
- modeComboListener = null;
- }
-
- if (fActivationListener != null) {
- fActivationListener.dispose();
- fActivationListener = null;
- }
-
- super.dispose();
- }
-
- protected CommandStack getCommandStack()
- {
- return editDomain.getCommandStack();
- }
-
- /*
- * (non-Javadoc) Method declared on IEditorPart
- */
- public void gotoMarker(IMarker marker)
- {
- setActivePage(SOURCE_PAGE_INDEX);
- IDE.gotoMarker(structuredTextEditor, marker);
- }
-
- /**
- * The <code>MultiPageEditorExample</code> implementation of this method
- * checks that the input is an instance of <code>IFileEditorInput</code>.
- */
- public void init(IEditorSite site, IEditorInput editorInput) throws PartInitException
- {
- super.init(site, editorInput);
-
- getCommandStack().addCommandStackListener(this);
-
- initializeActionRegistry();
-
- String title = null;
- if (getEditorInput() != null) {
- title = getEditorInput().getName();
- }
- setPartName(title);
-
- fActivationListener = new CommonActivationListener(site.getWorkbenchWindow().getPartService());
- }
-
- protected void initializeActionRegistry()
- {
- createActions();
- }
-
- protected ActionRegistry getActionRegistry()
- {
- if (actionRegistry == null)
- actionRegistry = new ActionRegistry();
- return actionRegistry;
- }
-
- public Object getAdapter(Class type)
- {
- if (type == CommandStack.class)
- return getCommandStack();
- if (type == ActionRegistry.class)
- return getActionRegistry();
- if (type == EditorModeManager.class)
- return getEditorModeManager();
- if (type == IGotoMarker.class) {
- return new IGotoMarker() {
- public void gotoMarker(IMarker marker) {
- CommonMultiPageEditor.this.gotoMarker(marker);
- }
- };
- }
- if (type == ITextEditor.class)
- return getTextEditor();
-
- return super.getAdapter(type);
- }
-
- protected DefaultEditDomain getEditDomain()
- {
- return editDomain;
- }
-
- /**
- * From GEF GraphicalEditor A convenience method for updating a set of actions
- * defined by the given List of action IDs. The actions are found by looking
- * up the ID in the {@link #getActionRegistry() action registry}. If the
- * corresponding action is an {@link UpdateAction}, it will have its
- * <code>update()</code> method called.
- *
- * @param actionIds
- * the list of IDs to update
- */
- protected void updateActions(List actionIds)
- {
- ActionRegistry registry = getActionRegistry();
- Iterator iter = actionIds.iterator();
- while (iter.hasNext())
- {
- IAction action = registry.getAction(iter.next());
- if (action instanceof UpdateAction)
- ((UpdateAction) action).update();
- }
- }
-
- public StructuredTextEditor getTextEditor()
- {
- return structuredTextEditor;
- }
-
- protected Composite createGraphPageComposite()
- {
- Composite parent = new Composite(getContainer(), SWT.NONE);
- parent.setLayout(new FillLayout());
- return parent;
- }
-
- protected void createGraphPage()
- {
- Composite parent = createGraphPageComposite();
-
- graphicalViewer = getGraphicalViewer();
- graphicalViewer.createControl(parent);
-
- getEditDomain().addViewer(graphicalViewer);
-
- configureGraphicalViewer();
- hookGraphicalViewer();
- int index = addPage(parent);
- setPageText(index, Messages._UI_LABEL_DESIGN);
- }
-
- /**
- * @see org.eclipse.ui.part.MultiPageEditorPart#createSite(org.eclipse.ui.IEditorPart)
- */
- protected IEditorSite createSite(IEditorPart editor) {
- IEditorSite site = null;
- if (editor == structuredTextEditor) {
- site = new MultiPageEditorSite(this, editor) {
- public String getId() {
- // sets this id so nested editor is considered xml source
- // page
- return ContentTypeIdForXML.ContentTypeID_XML + ".source"; //$NON-NLS-1$;
- }
- };
- }
- else {
- site = super.createSite(editor);
- }
- return site;
- }
-
- protected void createSourcePage()
- {
- structuredTextEditor = new StructuredTextEditor();
- try
- {
- int index = addPage(structuredTextEditor, getEditorInput());
- setPageText(index, Messages._UI_LABEL_SOURCE);
- structuredTextEditor.update();
- structuredTextEditor.setEditorPart(this);
- structuredTextEditor.addPropertyListener(this);
- firePropertyChange(PROP_TITLE);
- }
- catch (PartInitException e)
- {
- ErrorDialog.openError(getSite().getShell(), "Error creating nested text editor", null, e.getStatus()); //$NON-NLS-1$
- }
- }
-
- protected void configureGraphicalViewer()
- {
- graphicalViewer.getControl().setBackground(ColorConstants.listBackground);
-
- // Set the root edit part
- // ScalableFreeformRootEditPart root = new ScalableFreeformRootEditPart();
- RootEditPart root = new RootEditPart();
- ZoomManager zoomManager = root.getZoomManager();
-
- List zoomLevelContributions = new ArrayList(3);
- zoomLevelContributions.add(ZoomManager.FIT_ALL);
- zoomLevelContributions.add(ZoomManager.FIT_WIDTH);
- zoomLevelContributions.add(ZoomManager.FIT_HEIGHT);
- zoomManager.setZoomLevelContributions(zoomLevelContributions);
-
- double[] zoomLevels = {.10, .25, .5, .75, 1.0, 1.25, 1.5, 2.0, 2.5, 3, 4, 5};
- zoomManager.setZoomLevels(zoomLevels);
-
- IAction zoomIn = new ZoomInAction(zoomManager);
- IAction zoomOut = new ZoomOutAction(zoomManager);
- getActionRegistry().registerAction(zoomIn);
- getActionRegistry().registerAction(zoomOut);
-
- getSite().getKeyBindingService().registerAction(zoomIn);
- getSite().getKeyBindingService().registerAction(zoomOut);
-
- //ConnectionLayer connectionLayer = (ConnectionLayer) root.getLayer(LayerConstants.CONNECTION_LAYER);
- //connectionLayer.setConnectionRouter(new BendpointConnectionRouter());
-
- //connectionLayer.setConnectionRouter(new ShortestPathConnectionRouter(connectionLayer));
- // connectionLayer.setVisible(false);
-
- // Zoom
- zoomManager.setZoom(1.0);
- // Scroll-wheel Zoom
- graphicalViewer.setProperty(MouseWheelHandler.KeyGenerator.getKey(SWT.CTRL), MouseWheelZoomHandler.SINGLETON);
- graphicalViewer.setRootEditPart(root);
- graphicalViewer.setEditPartFactory(getEditPartFactory());
- }
-
- protected void hookGraphicalViewer()
- {
- getSelectionSynchronizer().addViewer(graphicalViewer);
- }
-
- protected abstract ScrollingGraphicalViewer getGraphicalViewer();
- protected abstract EditPartFactory getEditPartFactory();
- protected abstract void initializeGraphicalViewer();
-
- protected EditorModeManager getEditorModeManager()
- {
- if (editorModeManager == null)
- {
- editorModeManager = createEditorModeManager();
- editorModeManager.addListener(this);
- editorModeManager.init();
- }
- return editorModeManager;
- }
-
- protected abstract EditorModeManager createEditorModeManager();
-
-
- private String getEditModeName(EditorMode editorMode, ProductCustomizationProvider productCustomizationProvider)
- {
- String result = editorMode.getDisplayName();
- if (productCustomizationProvider != null)
- {
- String customizedName = productCustomizationProvider.getEditorModeDisplayName(editorMode.getId());
- if (customizedName != null)
- {
- result = customizedName;
- }
- }
- return result;
- }
-
- class EditorModeAndCustomizedName
- {
- EditorMode mode;
- String name;
- }
-
- protected void createViewModeToolbar(Composite parent)
- {
- EditorModeManager manager = (EditorModeManager)getAdapter(EditorModeManager.class);
- final ProductCustomizationProvider productCustomizationProvider = (ProductCustomizationProvider)getAdapter(ProductCustomizationProvider.class);
- EditorMode [] modeList = manager.getModes();
-
- int modeListLength = modeList.length;
- boolean showToolBar = modeListLength > 1;
-
- if (showToolBar)
- {
- toolbar = new Composite(parent, SWT.FLAT | SWT.DRAW_TRANSPARENT);
- toolbar.setBackground(ColorConstants.listBackground);
- toolbar.addPaintListener(new PaintListener() {
-
- public void paintControl(PaintEvent e)
- {
- Rectangle clientArea = toolbar.getClientArea();
- e.gc.setForeground(ColorConstants.lightGray);
- e.gc.drawRectangle(clientArea.x, clientArea.y, clientArea.width - 1, clientArea.height - 1);
- }
- });
-
- GridLayout gridLayout = new GridLayout(3, false);
- toolbar.setLayout(gridLayout);
-
- Label label = new Label(toolbar, SWT.FLAT | SWT.HORIZONTAL);
- label.setBackground(ColorConstants.listBackground);
- label.setText(Messages._UI_LABEL_VIEW);
- label.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_CENTER));
-
- modeCombo = new FlatCCombo(toolbar, SWT.FLAT);
- modeCombo.setEditable(false);
- modeCombo.setText(getEditModeName(manager.getCurrentMode(), productCustomizationProvider));
- GC gc = new GC(modeCombo);
- int textWidth = 0;
- maxLength = 0;
-
- // populate combo with modes
- editorModeAndCustomizedNames = new EditorModeAndCustomizedName[modeListLength];
- for (int i = 0; i < modeListLength; i++)
- {
- EditorModeAndCustomizedName entry = new EditorModeAndCustomizedName();
- editorModeAndCustomizedNames[i] = entry;
- entry.name = getEditModeName(modeList[i], productCustomizationProvider);
- entry.mode = modeList[i];
- }
- Arrays.sort(editorModeAndCustomizedNames, new Comparator()
- {
- public int compare(Object arg0, Object arg1)
- {
- EditorModeAndCustomizedName a = (EditorModeAndCustomizedName)arg0;
- EditorModeAndCustomizedName b = (EditorModeAndCustomizedName)arg1;
- return Collator.getInstance().compare(a.name, b.name);
- }
- });
- for (int i = 0; i < editorModeAndCustomizedNames.length; i++ )
- {
- EditorModeAndCustomizedName entry = editorModeAndCustomizedNames[i];
- modeCombo.add(entry.name);
- maxLength = Math.max (gc.stringExtent(entry.name).x, maxLength);
- int approxWidthOfStrings = Math.max (gc.stringExtent(entry.name).x, textWidth);
- if (approxWidthOfStrings > maxLength)
- maxLength = approxWidthOfStrings;
- }
-
- maxLength += gc.stringExtent(Messages._UI_LABEL_VIEW).x;
- gc.dispose();
-
- modeComboListener = new ModeComboListener();
- modeCombo.addSelectionListener(modeComboListener);
- modeCombo.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_END));
- modeCombo.setBackground(toolbar.getBackground());
-
- ImageHyperlink hyperlink = new ImageHyperlink(toolbar, SWT.FLAT);
- hyperlink.setBackground(ColorConstants.white);
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=154457
- Image image = XSDEditorPlugin.getDefault().getIconImage("etool16/help_contents");
- hyperlink.setImage(image);
- hyperlink.setToolTipText(Messages._UI_HOVER_VIEW_MODE_DESCRIPTION);
- hyperlink.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_CENTER));
- hyperlink.addMouseListener(new MouseAdapter()
- {
- public void mouseDown(MouseEvent e)
- {
- if (productCustomizationProvider != null)
- {
- productCustomizationProvider.handleAction("showEditorModeHelp");
- }
- }
- });
- }
- }
-
-
- protected class ModeComboListener implements SelectionListener
- {
- public ModeComboListener()
- {
- }
-
- public void widgetDefaultSelected(SelectionEvent e)
- {
- }
-
- public void widgetSelected(SelectionEvent e)
- {
- if (e.widget == modeCombo)
- {
- EditorModeManager manager = (EditorModeManager)getAdapter(EditorModeManager.class);
- EditorMode [] modeList = manager.getModes();
- if (modeList.length >= 1)
- {
- EditorModeAndCustomizedName entry = editorModeAndCustomizedNames[modeCombo.getSelectionIndex()];
- if (manager.getCurrentMode() != entry.mode)
- {
- manager.setCurrentMode(entry.mode);
- storeCurrentModePreference(entry.mode.getId());
- ProductCustomizationProvider productCustomizationProvider = (ProductCustomizationProvider) getAdapter(ProductCustomizationProvider.class);
- if (productCustomizationProvider != null)
- {
- productCustomizationProvider.handleAction("editorModeChanged");
- }
- }
- }
- }
- }
- }
-
- protected void storeCurrentModePreference(String id)
- {
- // Don't do anything as default. Allow extenders to implement.
- }
-
-
- protected class CommonActivationListener implements IPartListener, IWindowListener
- {
-
- /** Cache of the active workbench part. */
- private IWorkbenchPart fActivePart;
- /** Indicates whether activation handling is currently be done. */
- private boolean fIsHandlingActivation = false;
- /**
- * The part service.
- *
- * @since 3.1
- */
- private IPartService fPartService;
-
- /**
- * Creates this activation listener.
- *
- * @param partService
- * the part service on which to add the part listener
- * @since 3.1
- */
- public CommonActivationListener(IPartService partService)
- {
- fPartService = partService;
- fPartService.addPartListener(this);
- PlatformUI.getWorkbench().addWindowListener(this);
- }
-
- /**
- * Disposes this activation listener.
- *
- * @since 3.1
- */
- public void dispose()
- {
- fPartService.removePartListener(this);
- PlatformUI.getWorkbench().removeWindowListener(this);
- fPartService = null;
- }
-
- /*
- * @see IPartListener#partActivated(org.eclipse.ui.IWorkbenchPart)
- */
- public void partActivated(IWorkbenchPart part)
- {
- fActivePart = part;
- handleActivation();
- }
-
- /*
- * @see IPartListener#partBroughtToTop(org.eclipse.ui.IWorkbenchPart)
- */
- public void partBroughtToTop(IWorkbenchPart part)
- {
- // do nothing
- }
-
- /*
- * @see IPartListener#partClosed(org.eclipse.ui.IWorkbenchPart)
- */
- public void partClosed(IWorkbenchPart part)
- {
- // do nothing
- }
-
- /*
- * @see IPartListener#partDeactivated(org.eclipse.ui.IWorkbenchPart)
- */
- public void partDeactivated(IWorkbenchPart part)
- {
- fActivePart = null;
- }
-
- /*
- * @see IPartListener#partOpened(org.eclipse.ui.IWorkbenchPart)
- */
- public void partOpened(IWorkbenchPart part)
- {
- if (CommonMultiPageEditor.this.equals(part))
- {
- doPostEditorOpenTasks();
- }
- }
-
- /**
- * Handles the activation triggering a element state check in the editor.
- */
- void handleActivation()
- {
- if (fIsHandlingActivation || (getTextEditor() == null))
- {
- return;
- }
-
- if (fActivePart == CommonMultiPageEditor.this)
- {
- fIsHandlingActivation = true;
- try
- {
- getTextEditor().safelySanityCheckState(getEditorInput());
- }
- finally
- {
- fIsHandlingActivation = false;
- }
- }
- }
-
- /*
- * @see org.eclipse.ui.IWindowListener#windowActivated(org.eclipse.ui.IWorkbenchWindow)
- * @since 3.1
- */
- public void windowActivated(IWorkbenchWindow window)
- {
- if (window == getEditorSite().getWorkbenchWindow())
- {
- /*
- * Workaround for problem described in
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=11731 Will be removed
- * when SWT has solved the problem.
- */
- window.getShell().getDisplay().asyncExec(new Runnable()
- {
- public void run()
- {
- handleActivation();
- }
- });
- }
- }
-
- /*
- * @see org.eclipse.ui.IWindowListener#windowDeactivated(org.eclipse.ui.IWorkbenchWindow)
- * @since 3.1
- */
- public void windowDeactivated(IWorkbenchWindow window)
- {
- // do nothing
- }
-
- /*
- * @see org.eclipse.ui.IWindowListener#windowClosed(org.eclipse.ui.IWorkbenchWindow)
- * @since 3.1
- */
- public void windowClosed(IWorkbenchWindow window)
- {
- // do nothing
- }
-
- /*
- * @see org.eclipse.ui.IWindowListener#windowOpened(org.eclipse.ui.IWorkbenchWindow)
- * @since 3.1
- */
- public void windowOpened(IWorkbenchWindow window)
- {
- // do nothing
- }
- }
-
- public boolean isSourcePageActive()
- {
- return getActivePage() == SOURCE_PAGE_INDEX;
- }
-
- /**
- * Invoked during IPartListener#partOpened. Derived classes can override
- * to provide specialized behaviour.
- */
- protected void doPostEditorOpenTasks() {
- // Nothing to do in the base class.
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/CommonSelectionManager.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/CommonSelectionManager.java
deleted file mode 100644
index 56ead67336..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/CommonSelectionManager.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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.xsd.ui.internal.adt.editor;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.ui.part.MultiPageEditorPart;
-import org.eclipse.ui.part.MultiPageSelectionProvider;
-
-public class CommonSelectionManager extends MultiPageSelectionProvider implements ISelectionProvider, ISelectionChangedListener
-{
-
- public CommonSelectionManager(MultiPageEditorPart multiPageEditor)
- {
- super(multiPageEditor);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ISelectionProvider#addSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener)
- */
- public void addSelectionChangedListener(ISelectionChangedListener listener)
- {
- listenerList.add(listener);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ISelectionProvider#getSelection()
- */
- public ISelection getSelection()
- {
- return currentSelection;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ISelectionProvider#removeSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener)
- */
- public void removeSelectionChangedListener(ISelectionChangedListener listener)
- {
- listenerList.remove(listener);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ISelectionProvider#setSelection(org.eclipse.jface.viewers.ISelection)
- */
- public void setSelection(ISelection selection)
- {
- setSelection(selection, this);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
- */
- public void selectionChanged(SelectionChangedEvent event)
- {
- if (enableNotify)
- {
- setSelection(event.getSelection(), event.getSelectionProvider());
- }
- }
-
-
- protected List listenerList = new ArrayList();
- protected ISelection currentSelection;
- protected boolean enableNotify = true;
-
- public boolean getEnableNotify()
- {
- return enableNotify;
- }
-
- public void setSelection(ISelection selection, ISelectionProvider source)
- {
- if (enableNotify)
- {
- currentSelection = selection;
- enableNotify = false;
- try
- {
- SelectionChangedEvent event = new SelectionChangedEvent(source, selection);
- List copyOfListenerList = new ArrayList(listenerList);
- for (Iterator i = copyOfListenerList.iterator(); i.hasNext(); )
- {
- ISelectionChangedListener listener = (ISelectionChangedListener)i.next();
- listener.selectionChanged(event);
- }
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- finally
- {
- enableNotify = true;
- }
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/ContextMenuParticipant.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/ContextMenuParticipant.java
deleted file mode 100644
index 09d424f5e0..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/ContextMenuParticipant.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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.xsd.ui.internal.adt.editor;
-
-import org.eclipse.jface.action.IMenuManager;
-
-public class ContextMenuParticipant
-{
- public boolean isApplicable(Object object, String actionId)
- {
- return true;
- }
-
- public void contributeActions(Object object, IMenuManager menu)
- {
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/EditorMode.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/EditorMode.java
deleted file mode 100644
index 56ef845811..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/EditorMode.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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.xsd.ui.internal.adt.editor;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.gef.EditPartFactory;
-import org.eclipse.jface.viewers.IContentProvider;
-
-public abstract class EditorMode implements IAdaptable
-{
- public abstract String getId();
-
- public abstract String getDisplayName();
-
- public abstract EditPartFactory getEditPartFactory();
-
- // TODO (cs) this should return ITreeContentProvider
- public abstract IContentProvider getOutlineProvider();
-
- public ContextMenuParticipant getContextMenuParticipant()
- {
- return null;
- }
-
- public Object getAdapter(Class adapter)
- {
- return null;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/EditorModeManager.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/EditorModeManager.java
deleted file mode 100644
index 92bef66c30..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/EditorModeManager.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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.xsd.ui.internal.adt.editor;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.Platform;
-
-public class EditorModeManager implements IAdaptable
-{
- private List modeList = new ArrayList();
- private EditorMode currentMode = null;
- private List listeners = new ArrayList();
- private String extensionPointId;
- private ProductCustomizationProvider productCustomizationProvider;
-
- public EditorModeManager(String extensionPointId)
- {
- this.extensionPointId = extensionPointId;
- }
-
- public void init()
- {
- readRegistry(extensionPointId);
- currentMode = getDefaultMode();
- }
-
- protected EditorMode getDefaultMode()
- {
- return (EditorMode)modeList.get(0);
- }
-
- protected void addMode(EditorMode mode)
- {
- modeList.add(mode);
- }
-
- public EditorMode getEditorMode(String editorModeId)
- {
- for (Iterator i = modeList.iterator(); i.hasNext(); )
- {
- EditorMode editorMode = (EditorMode)i.next();
- if (editorModeId.equals(editorMode.getId()))
- {
- return editorMode;
- }
- }
- return null;
- }
-
- public void setCurrentMode(EditorMode mode)
- {
- if (modeList.contains(mode))
- {
- currentMode = mode;
- List clonedList = new ArrayList();
- clonedList.addAll(listeners);
- for (Iterator i = clonedList.iterator(); i.hasNext(); )
- {
- IEditorModeListener listener = (IEditorModeListener)i.next();
- listener.editorModeChanged(mode);
- }
- }
- }
-
- public EditorMode getCurrentMode()
- {
- return currentMode;
- }
-
- public EditorMode[] getModes()
- {
- EditorMode[] modes = new EditorMode[modeList.size()];
- modeList.toArray(modes);
- return modes;
- }
-
- public void addListener(IEditorModeListener listener)
- {
- if (!listeners.contains(listener))
- {
- listeners.add(listener);
- }
- }
-
- public void removeListener(IEditorModeListener listener)
- {
- listeners.remove(listener);
- }
-
- private void readRegistry(String id)
- {
- IConfigurationElement[] elements = Platform.getExtensionRegistry().getConfigurationElementsFor(id);
- for (int i = 0; i < elements.length; i++)
- {
- IConfigurationElement element = elements[i];
- String editorModeId = element.getAttribute("id"); //$NON-NLS-1$
- if (editorModeId != null &&
- productCustomizationProvider != null &&
- !productCustomizationProvider.isEditorModeApplicable(editorModeId))
- {
- continue;
- }
- try
- {
- EditorMode mode = (EditorMode)element.createExecutableExtension("class");
- modeList.add(mode);
- }
- catch (Exception e)
- {
- }
- }
- }
-
- public Object getAdapter(Class adapter)
- {
- return null;
- }
-
-
- public void setProductCustomizationProvider(ProductCustomizationProvider productCustomizationProvider)
- {
- this.productCustomizationProvider = productCustomizationProvider;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/IADTEditorInput.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/IADTEditorInput.java
deleted file mode 100644
index a364d66c3f..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/IADTEditorInput.java
+++ /dev/null
@@ -1,19 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.xsd.ui.internal.adt.editor;
-
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.xsd.XSDSchema;
-
-public interface IADTEditorInput extends IEditorInput
-{
- public XSDSchema getSchema();
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/IEditorModeListener.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/IEditorModeListener.java
deleted file mode 100644
index 7e98bde4f9..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/IEditorModeListener.java
+++ /dev/null
@@ -1,16 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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.xsd.ui.internal.adt.editor;
-
-public interface IEditorModeListener
-{
- void editorModeChanged(EditorMode newEditorMode);
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/Messages.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/Messages.java
deleted file mode 100644
index cb7de70269..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/Messages.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.adt.editor;
-
-import org.eclipse.osgi.util.NLS;
-
-public class Messages extends NLS
-{
- private static final String BUNDLE_NAME = "org.eclipse.wst.xsd.ui.internal.adt.editor.messages"; //$NON-NLS-1$
-
- private Messages()
- {
- }
-
- static
- {
- // initialize resource bundle
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
- public static String _UI_ACTION_SHOW_PROPERTIES;
- public static String _UI_ACTION_SET_AS_FOCUS;
- public static String _UI_ACTION_DELETE;
- public static String _UI_ACTION_ADD_FIELD;
- public static String _UI_ACTION_BROWSE;
- public static String _UI_ACTION_NEW;
- public static String _UI_ACTION_UPDATE_NAME;
- public static String _UI_ACTION_UPDATE_TYPE;
- public static String _UI_ACTION_UPDATE_ELEMENT_REFERENCE;
- public static String _UI_ACTION_SELECT_ALL;
- public static String _UI_LABEL_DESIGN;
- public static String _UI_LABEL_SOURCE;
- public static String _UI_LABEL_VIEW;
- public static String _UI_HOVER_VIEW_MODE_DESCRIPTION;
- public static String _UI_ACTION_CAPTURE_SCREEN_OVERWRITE_CONFIRMATION_QUESTION;
- public static String _UI_ACTION_CAPTURE_SCREEN_OVERWRITE_CONFIRMATION;
- public static String _UI_ACTION_CAPTURE_SCREEN_ERROR_TITLE;
- public static String _UI_ACTION_CAPTURE_SCREEN_ERROR_DESCRIPTION;
- public static String _UI_ACTION_CAPTURE_SCREEN_FORMAT_NOT_SUPPORTED;
- public static String _UI_CAPTURE_SCREEN_ACTION_TEXT;
- public static String _UI_CAPTURE_SCREEN_ACTION_TOOLTIPTEXT;
- public static String _UI_ACTION_CAPTURE_SCREEN_DEFAULT_FILE_NAME;
- public static String _UI_ACTION_CAPTURE_SCREEN_FILE_SAVE_DIALOG_TITLE;
- public static String _UI_HOVER_BACK_TO_SCHEMA;
- public static String _UI_REFACTOR_CONTEXT_MENU;
- public static String _UI_HYPERLINK_TEXT;
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/ProductCustomizationProvider.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/ProductCustomizationProvider.java
deleted file mode 100644
index bece06041f..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/ProductCustomizationProvider.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 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.xsd.ui.internal.adt.editor;
-
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.NavigationLocation;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.BaseEditPart;
-import org.eclipse.wst.xsd.ui.internal.adt.outline.ExtensibleContentOutlinePage;
-import org.eclipse.xsd.XSDConcreteComponent;
-
-public abstract class ProductCustomizationProvider
-{
- public abstract boolean isEditorModeApplicable(String id);
- public abstract String getEditorModeDisplayName(String id);
-
- public String getProductString(String id)
- {
- return "";
- }
-
- public String getProductString(String id, Object[] args)
- {
- return "";
- }
-
- public void handleAction(String actionId)
- {
- }
-
- public NavigationLocation getNavigationLocation(IEditorPart part, XSDConcreteComponent component, BaseEditPart editPart)
- {
- return null;
- }
-
- public ExtensibleContentOutlinePage getProductContentOutlinePage()
- {
- return null;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/messages.properties b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/messages.properties
deleted file mode 100644
index c110e4d825..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/messages.properties
+++ /dev/null
@@ -1,37 +0,0 @@
-###############################################################################
-# Copyright (c) 2001, 2010 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-
-_UI_ACTION_SHOW_PROPERTIES=Sho&w properties
-_UI_ACTION_SET_AS_FOCUS=&Set As Focus
-_UI_ACTION_UPDATE_NAME=Update Name
-_UI_ACTION_UPDATE_TYPE=Update type
-_UI_ACTION_UPDATE_ELEMENT_REFERENCE=Update element reference
-_UI_ACTION_DELETE=&Delete
-_UI_ACTION_BROWSE=&Browse...
-_UI_LABEL_DESIGN=Design
-_UI_LABEL_SOURCE=Source
-_UI_ACTION_NEW=&New...
-_UI_ACTION_ADD_FIELD=Add Field
-_UI_LABEL_VIEW=View:
-_UI_HOVER_VIEW_MODE_DESCRIPTION=Change the view mode of the editor
-_UI_ACTION_CAPTURE_SCREEN_OVERWRITE_CONFIRMATION_QUESTION=Question
-_UI_ACTION_CAPTURE_SCREEN_OVERWRITE_CONFIRMATION=The file {0} already exists. Do you want to replace the existing file?
-_UI_ACTION_CAPTURE_SCREEN_ERROR_TITLE=Error
-_UI_ACTION_CAPTURE_SCREEN_ERROR_DESCRIPTION=Could not save editor contents
-_UI_ACTION_CAPTURE_SCREEN_FORMAT_NOT_SUPPORTED=Format not supported
-_UI_CAPTURE_SCREEN_ACTION_TEXT = &Export Diagram as Image...
-_UI_CAPTURE_SCREEN_ACTION_TOOLTIPTEXT = Export Diagram as Image
-_UI_ACTION_CAPTURE_SCREEN_DEFAULT_FILE_NAME = Diagram
-_UI_ACTION_CAPTURE_SCREEN_FILE_SAVE_DIALOG_TITLE=Export Diagram as Image
-_UI_HOVER_BACK_TO_SCHEMA=Show schema index view
-_UI_ACTION_SELECT_ALL=Select &All
-_UI_REFACTOR_CONTEXT_MENU=Refac&tor
-_UI_HYPERLINK_TEXT = Open {0} with the XML Schema editor
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/facade/IADTObject.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/facade/IADTObject.java
deleted file mode 100644
index bea4a836d9..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/facade/IADTObject.java
+++ /dev/null
@@ -1,18 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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.xsd.ui.internal.adt.facade;
-
-public interface IADTObject
-{
- public void registerListener(IADTObjectListener listener);
- public void unregisterListener(IADTObjectListener listener);
- boolean isReadOnly();
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/facade/IADTObjectListener.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/facade/IADTObjectListener.java
deleted file mode 100644
index afc8efb4fb..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/facade/IADTObjectListener.java
+++ /dev/null
@@ -1,16 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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.xsd.ui.internal.adt.facade;
-
-public interface IADTObjectListener
-{
- public void propertyChanged(Object object, String property);
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/facade/IComplexType.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/facade/IComplexType.java
deleted file mode 100644
index c97adc4f62..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/facade/IComplexType.java
+++ /dev/null
@@ -1,19 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2009 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.xsd.ui.internal.adt.facade;
-
-
-
-public interface IComplexType extends IType, IStructure
-{
- boolean isAbstract();
- Object getContentType();
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/facade/IField.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/facade/IField.java
deleted file mode 100644
index 7e31d32453..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/facade/IField.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2009 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.xsd.ui.internal.adt.facade;
-
-import org.eclipse.gef.commands.Command;
-
-public interface IField extends IADTObject
-{
- String getKind();
- String getName();
- String getTypeName();
- String getTypeNameQualifier();
- IModel getModel();
- IType getType();
- IComplexType getContainerType();
- int getMinOccurs();
- int getMaxOccurs();
- boolean isGlobal();
- boolean isReference();
- boolean isAbstract();
-
- Command getUpdateMinOccursCommand(int minOccurs);
- Command getUpdateMaxOccursCommand(int maxOccurs);
- Command getUpdateTypeNameCommand(String typeName, String quailifier);
- Command getUpdateNameCommand(String name);
- Command getDeleteCommand();
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/facade/IModel.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/facade/IModel.java
deleted file mode 100644
index 4e42451d9a..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/facade/IModel.java
+++ /dev/null
@@ -1,18 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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.xsd.ui.internal.adt.facade;
-
-import java.util.List;
-
-public interface IModel extends IADTObject
-{
- List getTypes();
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/facade/IStructure.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/facade/IStructure.java
deleted file mode 100644
index 0c0d16e383..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/facade/IStructure.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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.xsd.ui.internal.adt.facade;
-
-import java.util.List;
-import org.eclipse.gef.commands.Command;
-
-public interface IStructure extends IADTObject
-{
- String getName();
- List getFields();
- IModel getModel();
- Command getAddNewFieldCommand(String fieldKind);
- Command getDeleteCommand();
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/facade/IType.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/facade/IType.java
deleted file mode 100644
index cfd1adc99e..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/facade/IType.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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.xsd.ui.internal.adt.facade;
-
-import org.eclipse.gef.commands.Command;
-
-public interface IType extends IADTObject
-{
- IType getSuperType();
- String getName();
- String getQualifier();
- boolean isComplexType();
- boolean isAnonymous();
-
- Command getUpdateNameCommand(String newName);
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/outline/ADTContentOutlinePage.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/outline/ADTContentOutlinePage.java
deleted file mode 100644
index 48fb01e9c4..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/outline/ADTContentOutlinePage.java
+++ /dev/null
@@ -1,339 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.adt.outline;
-
-import java.util.List;
-import java.util.Stack;
-
-import org.eclipse.emf.common.notify.Notifier;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.jface.action.IStatusLineManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.swt.events.KeyAdapter;
-import org.eclipse.swt.events.MouseAdapter;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.ui.part.MultiPageSelectionProvider;
-import org.eclipse.wst.xml.ui.internal.contentoutline.JFaceNodeLabelProvider;
-import org.eclipse.wst.xsd.ui.internal.adapters.CategoryAdapter;
-import org.eclipse.wst.xsd.ui.internal.adapters.RedefineCategoryAdapter;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDAttributeDeclarationAdapter;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDAttributeGroupDefinitionAdapter;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDComplexTypeDefinitionAdapter;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDElementDeclarationAdapter;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDModelGroupDefinitionAdapter;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDRedefineAdapter;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDSchemaAdapter;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDSchemaDirectiveAdapter;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDSimpleTypeDefinitionAdapter;
-import org.eclipse.wst.xsd.ui.internal.adt.design.DesignViewContextMenuProvider;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.IModelProxy;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IModel;
-import org.eclipse.xsd.XSDConcreteComponent;
-import org.eclipse.xsd.XSDSchema;
-
-public class ADTContentOutlinePage extends ExtensibleContentOutlinePage
-{
- protected int level = 0;
- protected MultiPageSelectionProvider selectionManager;
- protected SelectionManagerSelectionChangeListener selectionManagerSelectionChangeListener = new SelectionManagerSelectionChangeListener();
-
- public ADTContentOutlinePage()
- {
- super();
- }
-
- public void createControl(Composite parent)
- {
- super.createControl(parent);
- getTreeViewer().setContentProvider(contentProvider);
- getTreeViewer().setLabelProvider(labelProvider);
- getTreeViewer().setInput(model);
- getTreeViewer().addSelectionChangedListener(this);
- MenuManager menuManager = new MenuManager("#popup");//$NON-NLS-1$
- menuManager.setRemoveAllWhenShown(true);
- Menu menu = menuManager.createContextMenu(getTreeViewer().getControl());
- getTreeViewer().getControl().setMenu(menu);
- setSelectionManager(editor.getSelectionManager());
-
- // Create menu...for now reuse graph's. Note edit part viewer = null
- DesignViewContextMenuProvider menuProvider = new DesignViewContextMenuProvider(editor, null, editor.getSelectionManager());
- menuManager.addMenuListener(menuProvider);
- getSite().registerContextMenu("org.eclipse.wst.xsd.ui.popup.outline", menuManager, editor.getSelectionManager()); //$NON-NLS-1$
-
- // enable popupMenus extension
- // getSite().registerContextMenu("org.eclipse.wst.xsdeditor.ui.popup.outline",
- // menuManager, xsdEditor.getSelectionManager());
-
- // drill down from outline view
- getTreeViewer().getControl().addMouseListener(new MouseAdapter()
- {
- public void mouseDoubleClick(MouseEvent e)
- {
- ISelection iSelection = getTreeViewer().getSelection();
- if (iSelection instanceof StructuredSelection)
- {
- StructuredSelection selection = (StructuredSelection) iSelection;
- Object obj = selection.getFirstElement();
- if (obj instanceof XSDConcreteComponent)
- {
- XSDConcreteComponent comp = (XSDConcreteComponent) obj;
- if (comp.getContainer() instanceof XSDSchema)
- {
- // getXSDEditor().getGraphViewer().setInput(obj);
- }
- }
- }
-
- }
- });
- }
-
- class XSDKeyListener extends KeyAdapter
- {
- }
-
- public void dispose()
- {
- contentProvider.dispose();
- super.dispose();
- }
-
- public void setExpandToLevel(int i)
- {
- level = i;
- }
-
- public void setInput(Object value)
- {
- getTreeViewer().setInput(value);
- getTreeViewer().expandToLevel(level);
- }
-
- // public ISelection getSelection()
- // {
- // if (getTreeViewer() == null)
- // return StructuredSelection.EMPTY;
- // return getTreeViewer().getSelection();
- // }
- public void setSelectionManager(MultiPageSelectionProvider newSelectionManager)
- {
- // disconnect from old one
- if (selectionManager != null)
- {
- selectionManager.removeSelectionChangedListener(selectionManagerSelectionChangeListener);
- }
- selectionManager = newSelectionManager;
- // connect to new one
- if (selectionManager != null)
- {
- selectionManager.addSelectionChangedListener(selectionManagerSelectionChangeListener);
- }
- }
-
- protected class SelectionManagerSelectionChangeListener implements ISelectionChangedListener
- {
- public void selectionChanged(SelectionChangedEvent event)
- {
- updateStatusLine(getSite().getActionBars().getStatusLineManager(), event.getSelection());
- if (event.getSelectionProvider() != ADTContentOutlinePage.this) //getTreeViewer())
- {
- StructuredSelection selection = (StructuredSelection)event.getSelection();
- StructuredSelection currentSelection = (StructuredSelection) getTreeViewer().getSelection();
-
- Object selectionFirstElement = selection.getFirstElement();
- Object currentFirstElement = currentSelection.getFirstElement();
-
- // TODO: Hack to prevent losing a selection when the schema is selected in the
- // source. Fix is to prevent the source from firing off selection changes when
- // the selection source is not the source view.
-
- if (selectionFirstElement instanceof IModel)
- {
- if (!(currentFirstElement instanceof IModelProxy) || currentFirstElement instanceof RedefineCategoryAdapter)
- {
- getTreeViewer().setSelection(event.getSelection(), true);
- }
- }
- else if (selectionFirstElement instanceof XSDSchemaDirectiveAdapter)
- {
- if (!(currentFirstElement instanceof RedefineCategoryAdapter))
- {
- getTreeViewer().setSelection(event.getSelection(), true);
- }
- }
- else
- {
- IStructuredSelection structuredSelection = (IStructuredSelection) event.getSelection();
- List list = structuredSelection.toList();
- int selectionLength = list.size();
- if (selectionLength > 0)
- {
- for (int i = 0; i < selectionLength; i++)
- {
- Object item = list.get(i);
-
- if (item instanceof AdapterImpl)
- {
- Notifier target = ((AdapterImpl) item).getTarget();
-
- if (!(target instanceof XSDConcreteComponent))
- continue;
-
- XSDConcreteComponent xsdConcreteComponent = (XSDConcreteComponent) target;
-
- // need to expand parent before child, thus a stack is required
- Stack componentStack = new Stack();
- while (xsdConcreteComponent != null)
- {
- componentStack.push(xsdConcreteComponent);
- xsdConcreteComponent = xsdConcreteComponent.getContainer();
- }
-
- // At this point the stack must have the XSDSchemaAdapter and
- // at least one component
- if (componentStack.size() < 2)
- continue;
-
- // Pop off the top node, since it is the XSDSchemaAdapter, which
- // isn't
- // used as part of finding the outline view hierarchy
- componentStack.pop();
-
- if (((XSDConcreteComponent) componentStack.peek()).eAdapters().size() <= 0)
- continue;
-
- Object object = ((XSDConcreteComponent) componentStack.peek()).eAdapters().get(0);
-
- // Find out which category the selected item is contained in
- int categoryIndex = -1;
- if (object instanceof XSDSchemaDirectiveAdapter)
- {
- categoryIndex = CategoryAdapter.DIRECTIVES;
- }
- else if (object instanceof XSDElementDeclarationAdapter)
- {
- categoryIndex = CategoryAdapter.ELEMENTS;
- }
- else if (object instanceof XSDAttributeDeclarationAdapter)
- {
- categoryIndex = CategoryAdapter.ATTRIBUTES;
- }
- else if (object instanceof XSDAttributeGroupDefinitionAdapter)
- {
- categoryIndex = CategoryAdapter.ATTRIBUTES;
- }
- else if (object instanceof XSDComplexTypeDefinitionAdapter || object instanceof XSDSimpleTypeDefinitionAdapter)
- {
- categoryIndex = CategoryAdapter.TYPES;
- }
- else if (object instanceof XSDModelGroupDefinitionAdapter)
- {
- categoryIndex = CategoryAdapter.GROUPS;
- }
-
- // Expand the category
- if (categoryIndex == -1)
- continue;
- CategoryAdapter category = ((XSDSchemaAdapter) model).getCategory(categoryIndex);
- treeViewer.setExpandedState(category, true);
-
- // Do not expand current node of interest, just its parents
- while (componentStack.size() > 1)
- {
- object = componentStack.pop();
- if (object instanceof XSDConcreteComponent)
- {
- XSDConcreteComponent component = (XSDConcreteComponent) object;
- if (component.eAdapters().size() > 0)
- {
- // expand
- getTreeViewer().setExpandedState(component.eAdapters().get(0), true);
- }
- }
- }
- }
- }
- }
- // Bug 251474 - We will restrict selection to only one item
- if (selectionLength == 1)
- {
- getTreeViewer().setSelection(event.getSelection(), true);
- }
- else
- {
- if(structuredSelection.getFirstElement() !=null)
- getTreeViewer().setSelection(new StructuredSelection(structuredSelection.getFirstElement()), true);
- }
- }
- }
- }
- }
-
- protected void updateStatusLine(IStatusLineManager mgr, ISelection selection)
- {
- String text = null;
- Image image = null;
- ILabelProvider statusLineLabelProvider = new StatusLineLabelProvider(getTreeViewer());
- if (statusLineLabelProvider != null && selection instanceof IStructuredSelection && !selection.isEmpty())
- {
- Object firstElement = ((IStructuredSelection) selection).getFirstElement();
- if (firstElement instanceof XSDRedefineAdapter)
- return;
- text = statusLineLabelProvider.getText(firstElement);
- image = statusLineLabelProvider.getImage(firstElement);
- }
- if (image == null)
- {
- mgr.setMessage(text);
- }
- else
- {
- mgr.setMessage(image, text);
- }
- }
-
- protected class StatusLineLabelProvider extends JFaceNodeLabelProvider
- {
- TreeViewer treeViewer = null;
-
- public StatusLineLabelProvider(TreeViewer viewer)
- {
- treeViewer = viewer;
- }
-
- public String getText(Object element)
- {
- if (element == null)
- return null;
-
- StringBuffer s = new StringBuffer();
- s.append(labelProvider.getText(element));
- return s.toString();
- }
-
- public Image getImage(Object element)
- {
- return labelProvider.getImage(element);
- }
- }
-
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/outline/ADTContentOutlineProvider.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/outline/ADTContentOutlineProvider.java
deleted file mode 100644
index ac6e76f24e..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/outline/ADTContentOutlineProvider.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2009 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.xsd.ui.internal.adt.outline;
-
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObjectListener;
-
-public class ADTContentOutlineProvider implements ITreeContentProvider, IADTObjectListener
-{
- protected Viewer viewer = null;
- protected Object oldInput, newInput;
- protected ADTContentOutlineRefreshJob refreshJob;
-
- public ADTContentOutlineProvider()
- {
- super();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)
- */
- public Object[] getChildren(Object parentElement)
- {
- if (parentElement instanceof ITreeElement)
- {
- Object[] children = ((ITreeElement) parentElement).getChildren();
- if (children != null)
- {
- int length = children.length;
- for (int i = 0; i < length; i++)
- {
- Object child = children[i];
- if (child instanceof IADTObject)
- {
- ((IADTObject) child).registerListener(this);
- }
- }
- }
- return children;
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object)
- */
- public Object getParent(Object element)
- {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object)
- */
- public boolean hasChildren(Object element)
- {
- if (element instanceof ITreeElement)
- {
- return ((ITreeElement) element).hasChildren();
- }
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
- */
- public Object[] getElements(Object inputElement)
- {
- return getChildren(inputElement);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.IContentProvider#dispose()
- */
- public void dispose()
- {
- Object input = viewer.getInput();
- if (input instanceof IADTObject)
- {
- removeListener((IADTObject) input);
- }
- if (refreshJob != null)
- {
- refreshJob.cancel();
- refreshJob = null;
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
- */
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput)
- {
- this.viewer = viewer;
- this.oldInput = oldInput;
- this.newInput = newInput;
- if (refreshJob != null)
- {
- refreshJob.cancel();
- }
- refreshJob = new ADTContentOutlineRefreshJob(viewer);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObjectListener#propertyChanged(java.lang.Object, java.lang.String)
- */
- public void propertyChanged(Object object, String property)
- {
- refreshJob.refresh((IADTObject)object);
- }
-
- /**
- * @param model
- */
- private void removeListener(IADTObject model)
- {
- model.unregisterListener(this);
- Object[] children = null;
-
- if (model instanceof ITreeElement)
- {
- children = ((ITreeElement) model).getChildren();
- }
-
- if (children != null)
- {
- int length = children.length;
- for (int i = 0; i < length; i++)
- {
- Object child = children[i];
- if (child instanceof IADTObject && model != child)
- {
- removeListener((IADTObject) child);
- }
- }
- }
- }
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/outline/ADTContentOutlineRefreshJob.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/outline/ADTContentOutlineRefreshJob.java
deleted file mode 100644
index bf04cf473a..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/outline/ADTContentOutlineRefreshJob.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.xsd.ui.internal.adt.outline;
-
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.wst.xsd.ui.internal.adapters.CategoryAdapter;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject;
-
-
-/**
- * This job holds a queue of updates (affected nodes) for the XSD editor's
- * outline view. When a new request comes in, the current run is cancelled,
- * the new request is added to the queue, then the job is re-scheduled.
- * This class is loosely based on RefreshStructureJob.
- */
-class ADTContentOutlineRefreshJob extends Job
-{
- /**
- * The delay time in milliseconds.
- */
- private static final long UPDATE_DELAY = 300;
-
- private final List nodesToRefresh = new ArrayList(5);
-
- private final TreeViewer viewer;
-
- public ADTContentOutlineRefreshJob(Viewer viewer)
- {
- super("Refreshing XSD outline"); //$NON-NLS-1$
- setPriority(Job.LONG);
- setSystem(true);
- this.viewer = (TreeViewer)viewer;
- }
-
- private synchronized void addRefreshRequest(IADTObject adtObject)
- {
- if (nodesToRefresh.contains(adtObject))
- {
- return;
- }
-
- nodesToRefresh.add(adtObject);
- }
-
- protected void canceling()
- {
- nodesToRefresh.clear();
- super.canceling();
- }
-
- private void doRefresh(final IADTObject adtObject)
- {
- final Display display = PlatformUI.getWorkbench().getDisplay();
- display.asyncExec(new Runnable()
- {
- public void run()
- {
- boolean isValidViewer = viewer != null && !viewer.getControl().isDisposed();
- if (isValidViewer)
- {
- viewer.refresh(adtObject);
-
- // Needlessly revealing the category nodes causes a lot of UI flicker.
-
- if (!(adtObject instanceof CategoryAdapter))
- {
- viewer.reveal(adtObject);
- }
- }
- }
- });
- }
-
- private synchronized IADTObject[] getNodesToRefresh()
- {
- IADTObject[] toRefresh = new IADTObject [nodesToRefresh.size()];
- nodesToRefresh.toArray(toRefresh);
- nodesToRefresh.clear();
-
- return toRefresh;
- }
-
- public void refresh(IADTObject adtObject)
- {
- if (adtObject == null)
- {
- return;
- }
-
- addRefreshRequest(adtObject);
-
- schedule(UPDATE_DELAY);
- }
-
- protected IStatus run(IProgressMonitor monitor)
- {
- IStatus status = Status.OK_STATUS;
- try
- {
- performRefreshes(monitor);
- }
- finally
- {
- monitor.done();
- }
- return status;
- }
-
- private void performRefreshes(IProgressMonitor monitor)
- {
- IADTObject[] nodes = getNodesToRefresh();
-
- for (int index = 0; index < nodes.length; index++)
- {
- if (monitor.isCanceled())
- {
- throw new OperationCanceledException();
- }
- IADTObject node = nodes[index];
- doRefresh(node);
- }
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/outline/ADTLabelProvider.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/outline/ADTLabelProvider.java
deleted file mode 100644
index 14a6d4d845..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/outline/ADTLabelProvider.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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.xsd.ui.internal.adt.outline;
-
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.swt.graphics.Image;
-
-public class ADTLabelProvider implements ILabelProvider
-{
-
- public ADTLabelProvider()
- {
- super();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object)
- */
- public Image getImage(Object element)
- {
- if (element instanceof ITreeElement)
- {
- return ((ITreeElement)element).getImage();
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object)
- */
- public String getText(Object element)
- {
- if (element instanceof ITreeElement)
- {
- return ((ITreeElement)element).getText();
- }
- return ""; //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.IBaseLabelProvider#addListener(org.eclipse.jface.viewers.ILabelProviderListener)
- */
- public void addListener(ILabelProviderListener listener)
- {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose()
- */
- public void dispose()
- {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.IBaseLabelProvider#isLabelProperty(java.lang.Object, java.lang.String)
- */
- public boolean isLabelProperty(Object element, String property)
- {
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.IBaseLabelProvider#removeListener(org.eclipse.jface.viewers.ILabelProviderListener)
- */
- public void removeListener(ILabelProviderListener listener)
- {
-
- }
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/outline/ExtensibleContentOutlinePage.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/outline/ExtensibleContentOutlinePage.java
deleted file mode 100644
index 4e19a5667b..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/outline/ExtensibleContentOutlinePage.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 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.xsd.ui.internal.adt.outline;
-
-import org.eclipse.core.runtime.ListenerList;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.util.SafeRunnable;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.part.IPageSite;
-import org.eclipse.ui.part.Page;
-import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
-import org.eclipse.wst.xsd.ui.internal.adt.editor.ADTMultiPageEditor;
-
-public class ExtensibleContentOutlinePage extends Page implements IContentOutlinePage, ISelectionChangedListener
-{
- protected ListenerList selectionChangedListeners = new ListenerList();
- protected TreeViewer treeViewer;
- protected Object model;
- protected ITreeContentProvider contentProvider;
- protected ILabelProvider labelProvider;
- protected ADTMultiPageEditor editor;
-
- protected ExtensibleContentOutlinePage()
- {
- super();
- }
-
- public void createControl(Composite parent)
- {
- treeViewer = new TreeViewer(parent, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL);
- treeViewer.addSelectionChangedListener(this);
- }
-
- public void setEditor(ADTMultiPageEditor editor)
- {
- this.editor = editor;
- }
-
- public void setModel(Object newModel)
- {
- model = newModel;
- }
-
- public void setContentProvider(ITreeContentProvider contentProvider)
- {
- this.contentProvider = contentProvider;
- }
-
- public void setLabelProvider(ILabelProvider labelProvider)
- {
- this.labelProvider = labelProvider;
- }
-
- public void setFocus()
- {
- treeViewer.getControl().setFocus();
- }
-
- public void setSelection(ISelection selection)
- {
- if (treeViewer != null)
- {
- treeViewer.setSelection(selection);
- }
- }
-
- public void addSelectionChangedListener(ISelectionChangedListener listener)
- {
- selectionChangedListeners.add(listener);
- }
-
- protected void fireSelectionChanged(ISelection selection)
- {
- // create an event
- final SelectionChangedEvent event = new SelectionChangedEvent(this, selection);
-
- // fire the event
- Object[] listeners = selectionChangedListeners.getListeners();
- for (int i = 0; i < listeners.length; ++i)
- {
- final ISelectionChangedListener l = (ISelectionChangedListener) listeners[i];
- Platform.run(new SafeRunnable()
- {
- public void run()
- {
- l.selectionChanged(event);
- }
- });
- }
- }
-
- public Control getControl()
- {
- if (treeViewer == null)
- {
- return null;
- }
- return treeViewer.getControl();
- }
-
- public ISelection getSelection()
- {
- if (treeViewer == null)
- {
- return StructuredSelection.EMPTY;
- }
- return treeViewer.getSelection();
- }
-
- public TreeViewer getTreeViewer()
- {
- return treeViewer;
- }
-
- public void init(IPageSite pageSite)
- {
- super.init(pageSite);
- pageSite.setSelectionProvider(this);
- }
-
- public void removeSelectionChangedListener(ISelectionChangedListener listener)
- {
- selectionChangedListeners.remove(listener);
- }
-
- public void selectionChanged(SelectionChangedEvent event)
- {
- fireSelectionChanged(event.getSelection());
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/outline/ITreeElement.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/outline/ITreeElement.java
deleted file mode 100644
index a660d9a30b..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/outline/ITreeElement.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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.xsd.ui.internal.adt.outline;
-
-import org.eclipse.swt.graphics.Image;
-
-public interface ITreeElement
-{
- public final static ITreeElement[] EMPTY_LIST = {};
- ITreeElement[] getChildren();
- ITreeElement getParent();
- boolean hasChildren();
- String getText();
- Image getImage();
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/properties/ADTTabbedPropertySheetPage.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/properties/ADTTabbedPropertySheetPage.java
deleted file mode 100644
index 5c1343f4f6..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/properties/ADTTabbedPropertySheetPage.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 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.xsd.ui.internal.adt.properties;
-
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
-
-/**
- * @deprecated. Extenders should specialize...ie. XSDTabbedPropertySheetPage
- */
-public class ADTTabbedPropertySheetPage extends TabbedPropertySheetPage
-{
- public ADTTabbedPropertySheetPage(ITabbedPropertySheetPageContributor tabbedPropertySheetPageContributor)
- {
- super(tabbedPropertySheetPageContributor);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.ISelectionListener#selectionChanged(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
- */
- public void selectionChanged(IWorkbenchPart part, ISelection selection) {
-
-// Object selected = ((StructuredSelection)selection).getFirstElement();
-// if (selected instanceof EditPart)
-// {
-// Object model = ((EditPart)selected).getModel();
-// selection = new StructuredSelection(model);
-// }
- super.selectionChanged(part, selection);
- }
-
-}

Back to the top