diff options
Diffstat (limited to 'bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst')
42 files changed, 0 insertions, 5457 deletions
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDAnyElementAction.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDAnyElementAction.java deleted file mode 100644 index 56e41d8a4c..0000000000 --- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDAnyElementAction.java +++ /dev/null @@ -1,84 +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.common.actions; - -import java.util.Iterator; - -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.wst.xsd.ui.internal.adapters.XSDBaseAdapter; -import org.eclipse.wst.xsd.ui.internal.common.commands.AddXSDAnyElementCommand; -import org.eclipse.wst.xsd.ui.internal.common.util.Messages; -import org.eclipse.xsd.XSDModelGroup; -import org.eclipse.xsd.XSDParticle; -import org.eclipse.xsd.XSDWildcard; - -public class AddXSDAnyElementAction extends XSDBaseAction -{ - public static String ID = "org.eclipse.wst.xsd.ui.AddXSDAnyElementAction"; //$NON-NLS-1$ - - public AddXSDAnyElementAction(IWorkbenchPart part) - { - super(part); - setText(Messages._UI_ACTION_ADD_ANY_ELEMENT); - setId(ID); - } - - public void run() - { - XSDModelGroup modelGroup = getModelGroup(); - if (modelGroup != null) - { - AddXSDAnyElementCommand command = new AddXSDAnyElementCommand(getText(), modelGroup); - getCommandStack().execute(command); - } - } - - private XSDModelGroup getModelGroup() - { - Object selection = ((IStructuredSelection) getSelection()).getFirstElement(); - - if (selection instanceof XSDBaseAdapter) - { - selection = ((XSDBaseAdapter) selection).getTarget(); - } - if (selection instanceof XSDModelGroup) - { - return (XSDModelGroup) selection; - } - return null; - } - - protected boolean calculateEnabled() - { - boolean rc = super.calculateEnabled(); - if (rc) - { - XSDModelGroup modelGroup = getModelGroup(); - if (modelGroup != null) - { - boolean hasAnyElement = false; - for (Iterator i = modelGroup.getContents().iterator(); i.hasNext();) - { - XSDParticle obj = (XSDParticle) i.next(); - if (obj.getContent() instanceof XSDWildcard) - { - hasAnyElement = true; - break; - } - } - return !hasAnyElement; - } - } - return rc; - } - -} diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDModelGroupAction.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDModelGroupAction.java deleted file mode 100644 index 826334e1d4..0000000000 --- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDModelGroupAction.java +++ /dev/null @@ -1,95 +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.common.actions; - -import org.eclipse.emf.common.notify.Adapter; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.wst.xsd.ui.internal.adapters.XSDAdapterFactory; -import org.eclipse.wst.xsd.ui.internal.adapters.XSDBaseAdapter; -import org.eclipse.wst.xsd.ui.internal.common.commands.AddXSDModelGroupCommand; -import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin; -import org.eclipse.xsd.XSDComplexTypeDefinition; -import org.eclipse.xsd.XSDCompositor; -import org.eclipse.xsd.XSDConcreteComponent; -import org.eclipse.xsd.XSDElementDeclaration; -import org.eclipse.xsd.XSDModelGroup; - -public class AddXSDModelGroupAction extends XSDBaseAction -{ - public static String SEQUENCE_ID = "AddXSDSequenceModelGroupAction"; //$NON-NLS-1$ - public static String CHOICE_ID = "AddXSDChoiceModelGroupAction"; //$NON-NLS-1$ - public static String ALL_ID = "AddXSDAllModelGroupAction"; //$NON-NLS-1$ - XSDCompositor xsdCompositor; - - public AddXSDModelGroupAction(IWorkbenchPart part, XSDCompositor compositor, String ID) - { - super(part); - setText(getLabel(compositor)); - setId(ID); - this.xsdCompositor = compositor; - } - - public void run() - { - Object selection = ((IStructuredSelection) getSelection()).getFirstElement(); - if (selection instanceof XSDBaseAdapter) - { - XSDConcreteComponent xsdComponent = (XSDConcreteComponent) ((XSDBaseAdapter) selection).getTarget(); - AddXSDModelGroupCommand command = null; - if (xsdComponent instanceof XSDElementDeclaration) - { - XSDElementDeclaration xsdElementDeclaration = (XSDElementDeclaration) xsdComponent; - - command = new AddXSDModelGroupCommand(getLabel(xsdCompositor), xsdElementDeclaration, xsdCompositor); - getCommandStack().execute(command); - } - else if (xsdComponent instanceof XSDModelGroup) - { - XSDModelGroup xsdModelGroup = (XSDModelGroup) xsdComponent; - - command = new AddXSDModelGroupCommand(getLabel(xsdCompositor), xsdModelGroup, xsdCompositor); - getCommandStack().execute(command); - } - else if (xsdComponent instanceof XSDComplexTypeDefinition) - { - command = new AddXSDModelGroupCommand(getLabel(xsdCompositor), xsdComponent, xsdCompositor); - getCommandStack().execute(command); - } - - if (command != null) - { - Adapter adapter = XSDAdapterFactory.getInstance().adapt(command.getAddedComponent()); - if (adapter != null) - provider.setSelection(new StructuredSelection(adapter)); - } - - } - } - - private String getLabel(XSDCompositor compositor) - { - String result = XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_SEQUENCE"); //$NON-NLS-1$ - if (compositor != null) - { - if (compositor == XSDCompositor.CHOICE_LITERAL) - { - result = XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_CHOICE"); //$NON-NLS-1$ - } - else if (compositor == XSDCompositor.ALL_LITERAL) - { - result = XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ALL");//$NON-NLS-1$ - } - } - return result; - } -} diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDSchemaDirectiveAction.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDSchemaDirectiveAction.java deleted file mode 100644 index a9d833ace2..0000000000 --- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDSchemaDirectiveAction.java +++ /dev/null @@ -1,75 +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.common.actions; - -import org.eclipse.emf.common.notify.Adapter; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.wst.xsd.ui.internal.adapters.XSDAdapterFactory; -import org.eclipse.wst.xsd.ui.internal.adapters.XSDBaseAdapter; -import org.eclipse.wst.xsd.ui.internal.common.commands.AddXSDImportCommand; -import org.eclipse.wst.xsd.ui.internal.common.commands.AddXSDIncludeCommand; -import org.eclipse.wst.xsd.ui.internal.common.commands.AddXSDRedefineCommand; -import org.eclipse.wst.xsd.ui.internal.common.commands.BaseCommand; -import org.eclipse.xsd.XSDSchema; - -public class AddXSDSchemaDirectiveAction extends XSDBaseAction -{ - public static String INCLUDE_ID = "org.eclipse.wst.xsd.ui.internal.common.actions.AddXSDIncludeAction"; //$NON-NLS-1$ - public static String IMPORT_ID = "org.eclipse.wst.xsd.ui.internal.common.actions.AddXSDImportAction"; //$NON-NLS-1$ - public static String REDEFINE_ID = "org.eclipse.wst.xsd.ui.internal.common.actions.AddXSDRedefineAction"; //$NON-NLS-1$ - String label; - - public AddXSDSchemaDirectiveAction(IWorkbenchPart part, String ID, String label) - { - super(part); - setText(label); - setId(ID); - this.label = label; - } - - public void run() - { - Object selection = ((IStructuredSelection) getSelection()).getFirstElement(); - - if (selection instanceof XSDBaseAdapter) - { - selection = ((XSDBaseAdapter) selection).getTarget(); - } - - BaseCommand command = null; - if (selection instanceof XSDSchema) - { - if (INCLUDE_ID.equals(getId())) - { - command = new AddXSDIncludeCommand(label, (XSDSchema) selection); - } - else if (IMPORT_ID.equals(getId())) - { - command = new AddXSDImportCommand(label, (XSDSchema) selection); - } - else if (REDEFINE_ID.equals(getId())) - { - command = new AddXSDRedefineCommand(label, (XSDSchema) selection); - } - getCommandStack().execute(command); - } - - if (command != null) - { - Adapter adapter = XSDAdapterFactory.getInstance().adapt(command.getAddedComponent()); - if (adapter != null) - provider.setSelection(new StructuredSelection(adapter)); - } - - } -} diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/DeleteXSDConcreteComponentAction.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/DeleteXSDConcreteComponentAction.java deleted file mode 100644 index ef66379880..0000000000 --- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/DeleteXSDConcreteComponentAction.java +++ /dev/null @@ -1,53 +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.common.actions; - -import java.util.Iterator; - -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.wst.xsd.ui.internal.adapters.XSDBaseAdapter; -import org.eclipse.wst.xsd.ui.internal.common.commands.DeleteCommand; -import org.eclipse.wst.xsd.ui.internal.common.util.Messages; -import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin; -import org.eclipse.xsd.XSDConcreteComponent; - -public class DeleteXSDConcreteComponentAction extends XSDBaseAction -{ - public static final String DELETE_XSD_COMPONENT_ID = "org.eclipse.wst.xsd.ui.internal.common.actions.DeleteXSDConcreteComponentAction"; //$NON-NLS-1$ - - public DeleteXSDConcreteComponentAction(IWorkbenchPart part) - { - super(part); - setText(Messages._UI_ACTION_DELETE); - setId(DELETE_XSD_COMPONENT_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(); - - if (selection instanceof XSDBaseAdapter) - { - selection = ((XSDBaseAdapter) selection).getTarget(); - } - - if (selection instanceof XSDConcreteComponent) - { - DeleteCommand command = new DeleteCommand(getText(), (XSDConcreteComponent) selection); - getCommandStack().execute(command); - } - } - } -} diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/OpenInNewEditor.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/OpenInNewEditor.java deleted file mode 100644 index 3fc2aecc35..0000000000 --- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/OpenInNewEditor.java +++ /dev/null @@ -1,112 +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.common.actions; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.ui.IEditorPart; -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.part.FileEditorInput; -import org.eclipse.wst.common.uriresolver.internal.util.URIHelper; -import org.eclipse.wst.xsd.ui.internal.adapters.XSDComplexTypeDefinitionAdapter; -import org.eclipse.wst.xsd.ui.internal.adapters.XSDSchemaDirectiveAdapter; -import org.eclipse.wst.xsd.ui.internal.adt.actions.BaseSelectionAction; -import org.eclipse.wst.xsd.ui.internal.common.util.Messages; -import org.eclipse.wst.xsd.ui.internal.editor.InternalXSDMultiPageEditor; -import org.eclipse.wst.xsd.ui.internal.utils.OpenOnSelectionHelper; -import org.eclipse.xsd.XSDComplexTypeDefinition; -import org.eclipse.xsd.XSDSchemaDirective; -import org.eclipse.xsd.impl.XSDImportImpl; - -public class OpenInNewEditor extends BaseSelectionAction -{ - public static final String ID = "OpenInNewEditor"; //$NON-NLS-1$ - - public OpenInNewEditor(IWorkbenchPart part) - { - super(part); - setText(Messages._UI_ACTION_OPEN_IN_NEW_EDITOR); //$NON-NLS-1$ - setId(ID); - } - - protected boolean calculateEnabled() - { - return true; - } - - public void run() - { - Object selection = ((IStructuredSelection) getSelection()).getFirstElement(); - - if (selection instanceof XSDComplexTypeDefinitionAdapter) - { - XSDComplexTypeDefinitionAdapter xsdAdapter = (XSDComplexTypeDefinitionAdapter) selection; - XSDComplexTypeDefinition fComponent = (XSDComplexTypeDefinition) xsdAdapter.getTarget(); - - if (fComponent.getSchema() != null) - { - String schemaLocation = URIHelper.removePlatformResourceProtocol(fComponent.getSchema().getSchemaLocation()); - IPath schemaPath = new Path(schemaLocation); - IFile schemaFile = ResourcesPlugin.getWorkspace().getRoot().getFile(schemaPath); - if (schemaFile != null && schemaFile.exists()) - { - IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); - if (workbenchWindow != null) - { - IWorkbenchPage page = workbenchWindow.getActivePage(); - try - { - // TODO: Should use this to open in default editor - // IEditorPart editorPart = IDE.openEditor(page, schemaFile, true); - IEditorPart editorPart = page.openEditor(new FileEditorInput(schemaFile), "org.eclipse.wst.xsd.ui.internal.editor.InternalXSDMultiPageEditor", true); //$NON-NLS-1$ - - if (editorPart instanceof InternalXSDMultiPageEditor) - { - InternalXSDMultiPageEditor xsdEditor = (InternalXSDMultiPageEditor) editorPart; - - xsdEditor.openOnGlobalReference(fComponent); - } - - } - catch (PartInitException pie) - { - } - } - } - } - } - else if (selection instanceof XSDSchemaDirectiveAdapter) - { - XSDSchemaDirective dir = (XSDSchemaDirective)((XSDSchemaDirectiveAdapter)selection).getTarget(); - String schemaLocation = ""; - // force load of imported schema - if (dir instanceof XSDImportImpl) - { - ((XSDImportImpl)dir).importSchema(); - } - if (dir.getResolvedSchema() != null) - { - schemaLocation = URIHelper.removePlatformResourceProtocol(dir.getResolvedSchema().getSchemaLocation()); - if (schemaLocation != null) - { - OpenOnSelectionHelper.openXSDEditor(schemaLocation); - } - } - } - } -} diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/SetMultiplicityAction.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/SetMultiplicityAction.java deleted file mode 100644 index a33996a005..0000000000 --- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/SetMultiplicityAction.java +++ /dev/null @@ -1,88 +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.common.actions; - -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.wst.xsd.ui.internal.adapters.XSDBaseAdapter; -import org.eclipse.wst.xsd.ui.internal.common.commands.SetMultiplicityCommand; -import org.eclipse.xsd.XSDConcreteComponent; -import org.eclipse.xsd.XSDElementDeclaration; -import org.eclipse.xsd.XSDModelGroup; -import org.eclipse.xsd.XSDModelGroupDefinition; - -public class SetMultiplicityAction extends XSDBaseAction -{ - public static String REQUIRED_ID = "org.eclipse.wst.xsd.ui.internal.common.actions.SetMultiplicity.REQUIRED_ID"; //$NON-NLS-1$ - public static String ZERO_OR_ONE_ID = "org.eclipse.wst.xsd.ui.internal.common.actions.SetMultiplicity.ZERO_OR_ONE_ID"; //$NON-NLS-1$ - public static String ZERO_OR_MORE_ID = "org.eclipse.wst.xsd.ui.internal.common.actions.SetMultiplicity.ZERO_OR_MORE_ID"; //$NON-NLS-1$ - public static String ONE_OR_MORE_ID = "org.eclipse.wst.xsd.ui.internal.common.actions.SetMultiplicity.ONE_OR_MORE_ID"; //$NON-NLS-1$ - - SetMultiplicityCommand command; - - public SetMultiplicityAction(IWorkbenchPart part, String label, String ID) - { - super(part); - setText(label); - setId(ID); - command = new SetMultiplicityCommand(label); - } - - public void setMaxOccurs(int i) - { - command.setMaxOccurs(i); - } - - public void setMinOccurs(int i) - { - command.setMinOccurs(i); - } - - protected boolean calculateEnabled() - { - boolean state = super.calculateEnabled(); - if (state) - { - XSDConcreteComponent xsdConcreteComponent = getXSDInput(); - if (xsdConcreteComponent instanceof XSDElementDeclaration) - { - return !((XSDElementDeclaration)xsdConcreteComponent).isGlobal(); - } - else if (xsdConcreteComponent instanceof XSDModelGroup) - { - return !(((XSDModelGroup)xsdConcreteComponent).eContainer() instanceof XSDModelGroupDefinition); - } - } - return state; - } - - private XSDConcreteComponent getXSDInput() - { - Object selection = ((IStructuredSelection) getSelection()).getFirstElement(); - - XSDConcreteComponent xsdConcreteComponent = null; - if (selection instanceof XSDBaseAdapter) - { - xsdConcreteComponent = (XSDConcreteComponent)((XSDBaseAdapter) selection).getTarget(); - } - return xsdConcreteComponent; - } - - public void run() - { - XSDConcreteComponent xsdConcreteComponent = getXSDInput(); - if (xsdConcreteComponent != null) - { - command.setXSDConcreteComponent(xsdConcreteComponent); - getCommandStack().execute(command); - } - } -} diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/SetTypeAction.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/SetTypeAction.java deleted file mode 100644 index 6b879ad2b5..0000000000 --- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/SetTypeAction.java +++ /dev/null @@ -1,49 +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.common.actions; - -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.wst.xsd.ui.internal.adapters.XSDBaseAdapter; -import org.eclipse.wst.xsd.ui.internal.common.commands.SetTypeCommand; -import org.eclipse.xsd.XSDConcreteComponent; - -public class SetTypeAction extends XSDBaseAction -{ - public static final String SET_NEW_TYPE_ID = "SetTypeAction_AddType"; //$NON-NLS-1$ - public static final String SELECT_EXISTING_TYPE_ID = "SetTypeAction_ExistingType"; //$NON-NLS-1$ - - SetTypeCommand command; - - public SetTypeAction(String label, String ID, IWorkbenchPart part) - { - super(part); - setText(label); - setId(ID); - } - - public void run() - { - Object selection = ((IStructuredSelection) getSelection()).getFirstElement(); - - if (selection instanceof XSDBaseAdapter) - { - Object target = ((XSDBaseAdapter) selection).getTarget(); - - if (target instanceof XSDConcreteComponent) - { - command = new SetTypeCommand(getText(), getId(), (XSDConcreteComponent) target); - command.setAdapter((XSDBaseAdapter) selection); - getCommandStack().execute(command); - } - } - } -} diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddExtensionCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddExtensionCommand.java deleted file mode 100644 index 5672104048..0000000000 --- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddExtensionCommand.java +++ /dev/null @@ -1,48 +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.common.commands; - -import org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo.SpecificationForExtensionsSchema; -import org.eclipse.xsd.XSDConcreteComponent; -import org.eclipse.xsd.XSDSchema; - -public class AddExtensionCommand extends BaseCommand -{ - protected SpecificationForExtensionsSchema extensionsSchemaSpec; - protected XSDConcreteComponent component; - - protected AddExtensionCommand(String label) - { - super(label); - } - - public void setSchemaProperties(SpecificationForExtensionsSchema appInfoSchemaSpec) - { - this.extensionsSchemaSpec = appInfoSchemaSpec; - } - - public Object getNewObject() - { - return null; - } - - public void execute() - { - if (component instanceof XSDSchema) - { - ensureSchemaElement((XSDSchema)component); - } - - super.execute(); - } - - -} diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddXSDSchemaDirectiveCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddXSDSchemaDirectiveCommand.java deleted file mode 100644 index a4f9008868..0000000000 --- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddXSDSchemaDirectiveCommand.java +++ /dev/null @@ -1,60 +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.common.commands; - -import java.util.Iterator; - -import org.eclipse.xsd.XSDConcreteComponent; -import org.eclipse.xsd.XSDSchema; -import org.eclipse.xsd.XSDSchemaDirective; - -public abstract class AddXSDSchemaDirectiveCommand extends BaseCommand -{ - protected XSDSchema xsdSchema; - - public AddXSDSchemaDirectiveCommand(String label) - { - super(label); - } - - public void undo() - { - super.undo(); - } - - protected boolean adopt(XSDConcreteComponent model) - { - return false; - } - - protected int findNextPositionToInsert() - { - int index = 0; - for (Iterator i = xsdSchema.getContents().iterator(); i.hasNext(); ) - { - Object o = i.next(); - if (o instanceof XSDSchemaDirective) - { - index ++; - } - else - { - break; - } - } - return index; - } - - public void execute() - { - ensureSchemaElement(xsdSchema); - } -} diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/RemoveExtensionAttributerCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/RemoveExtensionAttributerCommand.java deleted file mode 100644 index a173a43def..0000000000 --- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/RemoveExtensionAttributerCommand.java +++ /dev/null @@ -1,43 +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.common.commands; - -import org.eclipse.gef.commands.Command; -import org.w3c.dom.Attr; -import org.w3c.dom.Element; - -/** - * @deprecated - */ -public class RemoveExtensionAttributerCommand extends Command -{ - Element hostElement; - Attr attr; - - public RemoveExtensionAttributerCommand(String label, Element hostElement, Attr attr) - { - super(label); - this.hostElement = hostElement; - this.attr = attr; - } - - public void execute() - { - super.execute(); - hostElement.removeAttributeNode(attr); - } - - public void undo() - { - super.undo(); - //TODO implement me - } -} diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/RemoveExtensionElementCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/RemoveExtensionElementCommand.java deleted file mode 100644 index d33c756093..0000000000 --- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/RemoveExtensionElementCommand.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.common.commands; - -import org.eclipse.gef.commands.Command; -import org.eclipse.xsd.XSDAnnotation; -import org.w3c.dom.Node; - -/** - * @deprecated - */ -public class RemoveExtensionElementCommand extends Command -{ - XSDAnnotation xsdAnnotation; - Node appInfo; - - public RemoveExtensionElementCommand(String label, XSDAnnotation xsdAnnotation, Node appInfo) - { - super(label); - this.xsdAnnotation = xsdAnnotation; - this.appInfo = appInfo; - } - - public void execute() - { - super.execute(); - xsdAnnotation.getApplicationInformation().remove(appInfo); - xsdAnnotation.getElement().removeChild(appInfo); - xsdAnnotation.updateElement(); - } - - public void undo() - { - super.undo(); - xsdAnnotation.getApplicationInformation().add(appInfo); - xsdAnnotation.getElement().appendChild(appInfo); - } -} diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/AbstractSection.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/AbstractSection.java deleted file mode 100644 index c90c0a99fa..0000000000 --- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/AbstractSection.java +++ /dev/null @@ -1,365 +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.common.properties.sections; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.gef.commands.CommandStack; -import org.eclipse.jface.action.IStatusLineManager; -import org.eclipse.jface.action.SubContributionManager; -import org.eclipse.jface.action.SubStatusLineManager; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.swt.SWT; -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.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Listener; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IEditorSite; -import org.eclipse.ui.ISharedImages; -import org.eclipse.ui.IViewSite; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.forms.FormColors; -import org.eclipse.ui.views.properties.tabbed.AbstractPropertySection; -import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage; -import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin; -import org.eclipse.xsd.XSDComponent; -import org.eclipse.xsd.XSDConcreteComponent; -import org.eclipse.xsd.XSDSchema; - -public abstract class AbstractSection extends AbstractPropertySection implements SelectionListener, Listener -{ - protected Composite composite; - protected PaintListener painter; - protected XSDSchema xsdSchema; - protected Object input; - protected boolean isReadOnly; - protected boolean listenerEnabled = true; - protected boolean isSimple; - protected CustomListener customListener = new CustomListener(); - protected IEditorPart owningEditor; - private IStatusLineManager statusLine; - - public static final Image ICON_ERROR = XSDEditorPlugin.getDefault().getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_ERROR_TSK); - - public AbstractSection() - { - super(); - } - - public void createControls(Composite parent, TabbedPropertySheetPage aTabbedPropertySheetPage) - { - super.createControls(parent, aTabbedPropertySheetPage); - isSimple = getIsSimple(); - createContents(parent); - } - - protected abstract void createContents(Composite parent); - - protected PaintListener createPainter() { - return new PaintListener() { - - public void paintControl(PaintEvent e) { -// Rectangle bounds = composite.getClientArea(); - GC gc = e.gc; - - gc.setForeground(gc.getBackground()); - gc.setBackground(getWidgetFactory().getColors().getColor( - FormColors.TB_BG)); - -// gc.fillGradientRectangle(4 + bounds.width / 2, 0, -// bounds.width / 2 - 9, bounds.height, false); - - gc.setForeground(getWidgetFactory().getColors().getColor( - FormColors.TB_BORDER)); -// gc.drawLine(bounds.width - 5, 0, bounds.width - 5, -// bounds.height); - } - - }; - - } - - public void dispose() - { - if (composite != null && ! composite.isDisposed() && painter != null) - composite.removePaintListener(painter); - - super.dispose(); - } - - public void setInput(IWorkbenchPart part, ISelection selection) { - super.setInput(part, selection); - isSimple = getIsSimple(); - Object input = ((IStructuredSelection)selection).getFirstElement(); - this.input = input; - - if (input instanceof XSDConcreteComponent) - { - xsdSchema = ((XSDConcreteComponent)input).getSchema(); - } - - // set owning editor of this section - if (part!=null) - { - if (part instanceof IEditorPart) - { - owningEditor = (IEditorPart)part; - } - else - { - owningEditor = part.getSite().getWorkbenchWindow().getActivePage().getActiveEditor(); - } - } - if (xsdSchema == owningEditor.getAdapter(XSDSchema.class)) - { - isReadOnly = false; - } - else - { - isReadOnly = true; - } - - } - - public void refresh() - { - super.refresh(); - - if (isReadOnly) - { - composite.setEnabled(false); - } - else - { - composite.setEnabled(true); - } - } - - public void applyAllListeners(Control control) - { - control.addListener(SWT.Modify, customListener); - control.addListener(SWT.FocusOut, customListener); - control.addListener(SWT.KeyDown, customListener); - } - - public void applyModifyListeners(Control control) - { - control.addListener(SWT.Modify, customListener); - control.addListener(SWT.FocusOut, customListener); - } - - public void applyKeyListener(Control control) - { - control.addListener(SWT.KeyDown, customListener); - } - - public void removeListeners(Control control) - { - control.removeListener(SWT.Modify, customListener); - control.removeListener(SWT.FocusOut, customListener); - control.removeListener(SWT.KeyDown, customListener); - } - - public void doWidgetDefaultSelected(SelectionEvent e) - {} - - public void doWidgetSelected(SelectionEvent e) - {} - - public void widgetSelected(SelectionEvent e) - { - if (isListenerEnabled() && - input != null && - !isReadOnly) - { - doWidgetSelected(e); - } - } - - public void widgetDefaultSelected(SelectionEvent e) - { - if (isListenerEnabled() && - input != null && - !isReadOnly) - { - doWidgetDefaultSelected(e); - } - } - - /** - * Get the value of listenerEnabled. - * @return value of listenerEnabled. - */ - public boolean isListenerEnabled() - { - return listenerEnabled; - } - - /** - * Set the value of listenerEnabled. - * @param v Value to assign to listenerEnabled. - */ - public void setListenerEnabled(boolean v) - { - this.listenerEnabled = v; - } - - /** - * Sent when an event that the receiver has registered for occurs. - * - * @param event the event which occurred - */ - public void handleEvent(Event event) - { - if (isListenerEnabled() && !isReadOnly) - { - doHandleEvent(event); - } - } - - /** - * Subclasses should override - * @param event - */ - protected void doHandleEvent(Event event) - { - } - - protected IEditorPart getActiveEditor() - { - IWorkbench workbench = PlatformUI.getWorkbench(); - IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow(); - IEditorPart editorPart = workbenchWindow.getActivePage().getActiveEditor(); - this.owningEditor = editorPart; - return editorPart; - } - - public CommandStack getCommandStack() - { - Object commandStack = owningEditor.getAdapter(CommandStack.class); - - if (commandStack==null) - return null; - else - return (CommandStack)commandStack; - } - - public boolean getIsSimple() - { - return false; - } - - - - /** - * Intended to display error messages. - * @return - */ - private IStatusLineManager getStatusLineManager() - { - if (statusLine==null && getPart()!=null) - { - if(getPart().getSite() instanceof IEditorSite) - statusLine = ((IEditorSite)getPart().getSite()).getActionBars().getStatusLineManager(); - else if (getPart().getSite() instanceof IViewSite) - statusLine = ((IViewSite)getPart().getSite()).getActionBars().getStatusLineManager(); - - /* - * We must manually set the visibility of the status line since the action bars are from the editor - * which means the status line only shows up when the editor is in focus (by default). - * Note only a SubStatusLineManager can set the visibility. - */ - if (statusLine instanceof SubStatusLineManager) - ((SubStatusLineManager)statusLine).setVisible(true); - } - - return statusLine; - } - - /** - * Display an error message in the status line. - * Call setErrorMessage(null) to clear the status line. - * @param text - */ - public void setErrorMessage(String text) - { - IStatusLineManager statusLine = getStatusLineManager(); - - if (statusLine!=null) - { - if (text==null || text.length()<1) - statusLine.setErrorMessage(null); - else - statusLine.setErrorMessage(ICON_ERROR, text); - - // ensure our message gets displayed - if (statusLine instanceof SubContributionManager) - ((SubContributionManager)statusLine).setVisible(true); - - statusLine.update(true); - } - } - - - protected EObject getModel() - { - return (XSDComponent)input; - } - - - class CustomListener implements Listener - { - boolean handlingEvent = false; - public void handleEvent(Event event) - { - if (isListenerEnabled() && !isReadOnly) - { - switch (event.type) - { - case SWT.KeyDown : - { - if (event.character == SWT.CR) - { - if (!handlingEvent) - { - handlingEvent = true; - doHandleEvent(event); - handlingEvent = false; - } - } - break; - } - case SWT.FocusOut : - { - if (!handlingEvent) - { - handlingEvent = true; - doHandleEvent(event); - handlingEvent = false; - } - break; - } - } - } - } - } - -} diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/AbstractSectionDescriptor.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/AbstractSectionDescriptor.java deleted file mode 100644 index e0b33bb5c0..0000000000 --- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/AbstractSectionDescriptor.java +++ /dev/null @@ -1,108 +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.common.properties.sections; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.jface.viewers.IFilter; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.views.properties.tabbed.ISection; -import org.eclipse.ui.views.properties.tabbed.ISectionDescriptor; -import org.eclipse.xsd.XSDConcreteComponent; -import org.w3c.dom.Element; - -public class AbstractSectionDescriptor implements ISectionDescriptor -{ - /** - * - */ - public AbstractSectionDescriptor() - { - super(); - } - - /* (non-Javadoc) - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getId() - */ - public String getId() - { - return ""; //$NON-NLS-1$ - } - - /* (non-Javadoc) - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getFilter() - */ - public IFilter getFilter() - { - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getInputTypes() - */ - public List getInputTypes() - { - List list = new ArrayList(); - list.add(XSDConcreteComponent.class); - return list; - } - - /* (non-Javadoc) - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getSectionClass() - */ - public ISection getSectionClass() - { - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getTargetTab() - */ - public String getTargetTab() - { - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#appliesTo(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection) - */ - public boolean appliesTo(IWorkbenchPart part, ISelection selection) - { - Object object = null; - if (selection instanceof StructuredSelection) - { - StructuredSelection structuredSelection = (StructuredSelection)selection; - object = structuredSelection.getFirstElement(); - if (object instanceof XSDConcreteComponent || object instanceof Element) - { - return true; - } - } - return false; - } - - /* (non-Javadoc) - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getAfterSection() - */ - public String getAfterSection() - { - return ""; //$NON-NLS-1$ - } - - - public int getEnablesFor() - { - return ENABLES_FOR_ANY; - } -} diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/CommonDirectivesSection.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/CommonDirectivesSection.java deleted file mode 100644 index e9ddefe5fa..0000000000 --- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/CommonDirectivesSection.java +++ /dev/null @@ -1,155 +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.common.properties.sections; - -import org.eclipse.core.resources.IFile; -import org.eclipse.emf.common.util.URI; -import org.eclipse.swt.custom.StyleRange; -import org.eclipse.swt.custom.StyledText; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.IFileEditorInput; -import org.eclipse.wst.common.uriresolver.internal.util.URIHelper; -import org.eclipse.wst.xsd.ui.internal.common.util.Messages; -import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin; -import org.eclipse.xsd.XSDInclude; -import org.eclipse.xsd.XSDRedefine; -import org.eclipse.xsd.XSDSchema; -import org.eclipse.xsd.util.XSDParser; - -public abstract class CommonDirectivesSection extends AbstractSection -{ - Text schemaLocationText; - Button wizardButton; - StyledText errorText; - Color red; - - // TODO: common up code with XSDSelectIncludeFileWizard - public void doHandleEvent(Event event) - { - errorText.setText(""); //$NON-NLS-1$ - - if (event.widget == schemaLocationText) - { - String errorMessage = ""; //$NON-NLS-1$ - boolean isValidSchemaLocation = true; - String xsdModelFile = schemaLocationText.getText(); - String namespace = ""; //$NON-NLS-1$ - XSDSchema externalSchema = null; - - if (xsdModelFile.length() == 0) - { - handleSchemaLocationChange(xsdModelFile, "", null); //$NON-NLS-1$ - return; - } - - try - { - IFile currentIFile = ((IFileEditorInput)getActiveEditor().getEditorInput()).getFile(); - - URI newURI = URI.createURI(xsdModelFile); - String xsdFile = URIHelper.getRelativeURI(newURI.toString(), currentIFile.getFullPath().toString()); - final String normalizedXSDFile = URIHelper.normalize(xsdFile, currentIFile.getLocation().toString(), ""); //$NON-NLS-1$ - - XSDParser parser = new XSDParser(); - parser.parse(normalizedXSDFile); - - externalSchema = parser.getSchema(); - - if (externalSchema != null) - { - String extNamespace = externalSchema.getTargetNamespace(); - if (extNamespace == null) extNamespace = ""; //$NON-NLS-1$ - namespace = extNamespace; - - if (externalSchema.getDiagnostics() != null && - externalSchema.getDiagnostics().size() > 0) - { - isValidSchemaLocation = false; - errorMessage = XSDEditorPlugin.getResourceString("_UI_INCORRECT_XML_SCHEMA", xsdModelFile); //$NON-NLS-1$ - } - else - { - String currentNameSpace = xsdSchema.getTargetNamespace(); - if (input instanceof XSDInclude || input instanceof XSDRedefine) - { - // Check the namespace to make sure they are the same as current file - if (extNamespace != null) - { - if (currentNameSpace != null && !extNamespace.equals(currentNameSpace)) - { - errorMessage = XSDEditorPlugin.getResourceString("_UI_DIFFERENT_NAME_SPACE", xsdModelFile); //$NON-NLS-1$ - isValidSchemaLocation = false; - } - } - } - else - { - // Check the namespace to make sure they are different from the current file - if (extNamespace != null) - { - if (currentNameSpace != null && extNamespace.equals(currentNameSpace)) - { - errorMessage = XSDEditorPlugin.getResourceString("_UI_SAME_NAME_SPACE", xsdModelFile); //$NON-NLS-1$ - isValidSchemaLocation = false; - } - } - } - } - } - else - { - errorMessage = Messages._UI_ERROR_INVALID_FILE; - isValidSchemaLocation = false; - } - } - catch(Exception e) - { - errorMessage = Messages._UI_ERROR_INVALID_FILE; - isValidSchemaLocation = false; - } - finally - { - if (!isValidSchemaLocation) - { - errorText.setText(errorMessage); - int length = errorText.getText().length(); - red = new Color(null, 255, 0, 0); - StyleRange style = new StyleRange(0, length, red, schemaLocationText.getBackground()); - errorText.setStyleRange(style); - } - else - { - handleSchemaLocationChange(xsdModelFile, namespace, externalSchema); - } - } - } - } - - protected void handleSchemaLocationChange(String schemaFileString, String namespace, XSDSchema externalSchema) - { - - } - - - public void dispose() - { - super.dispose(); - if (red != null) - { - red.dispose(); - red = null; - } - } - -} diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/EnumerationsSection.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/EnumerationsSection.java deleted file mode 100644 index e33e4a18ac..0000000000 --- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/EnumerationsSection.java +++ /dev/null @@ -1,405 +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.common.properties.sections; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import com.ibm.icu.util.StringTokenizer; - -import org.eclipse.gef.commands.CompoundCommand; -import org.eclipse.jface.viewers.CellEditor; -import org.eclipse.jface.viewers.ColumnWeightData; -import org.eclipse.jface.viewers.ICellModifier; -import org.eclipse.jface.viewers.IStructuredContentProvider; -import org.eclipse.jface.viewers.ITableLabelProvider; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TableLayout; -import org.eclipse.jface.viewers.TextCellEditor; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.window.Window; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.FormAttachment; -import org.eclipse.swt.layout.FormData; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.TableColumn; -import org.eclipse.swt.widgets.TableItem; -import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory; -import org.eclipse.wst.common.ui.internal.viewers.NavigableTableViewer; -import org.eclipse.wst.xsd.ui.internal.common.commands.AddEnumerationsCommand; -import org.eclipse.wst.xsd.ui.internal.common.commands.DeleteCommand; -import org.eclipse.wst.xsd.ui.internal.common.commands.SetXSDFacetValueCommand; -import org.eclipse.wst.xsd.ui.internal.common.util.Messages; -import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin; -import org.eclipse.wst.xsd.ui.internal.widgets.EnumerationsDialog; -import org.eclipse.xsd.XSDEnumerationFacet; -import org.eclipse.xsd.XSDSimpleTypeDefinition; -import org.eclipse.xsd.util.XSDConstants; - -public class EnumerationsSection extends AbstractSection -{ - private EnumerationsTableViewer enumerationsTable; - private Button addButton; - private Button addManyButton; - private Button deleteButton; - - /** - * - */ - public EnumerationsSection() - { - super(); - } - - public void widgetSelected(SelectionEvent e) - { - XSDSimpleTypeDefinition st = (XSDSimpleTypeDefinition) input; - - if (e.widget == addButton) - { - List enumList = st.getEnumerationFacets(); - StringBuffer newName = new StringBuffer("value1"); //$NON-NLS-1$ - int suffix = 1; - for (Iterator i = enumList.iterator(); i.hasNext();) - { - XSDEnumerationFacet enumFacet = (XSDEnumerationFacet) i.next(); - String value = enumFacet.getLexicalValue(); - if (value != null) - { - if (value.equals(newName.toString())) - { - suffix++; - newName = new StringBuffer("value" + String.valueOf(suffix)); //$NON-NLS-1$ - } - } - } - - AddEnumerationsCommand command = new AddEnumerationsCommand(Messages._UI_ACTION_ADD_ENUMERATION, (XSDSimpleTypeDefinition) input); - command.setValue(newName.toString()); - getCommandStack().execute(command); - - enumerationsTable.refresh(); - int newItemIndex = enumerationsTable.getTable().getItemCount() - 1; - enumerationsTable.editElement(enumerationsTable.getElementAt(newItemIndex), 0); - } - else if (e.widget == addManyButton) - { - Display display = Display.getCurrent(); - // if it is null, get the default one - display = display == null ? Display.getDefault() : display; - Shell parentShell = display.getActiveShell(); - EnumerationsDialog dialog = new EnumerationsDialog(parentShell); - dialog.setBlockOnOpen(true); - int result = dialog.open(); - - if (result == Window.OK) - { - String text = dialog.getText(); - String delimiter = dialog.getDelimiter(); - StringTokenizer tokenizer = new StringTokenizer(text, delimiter); - CompoundCommand compoundCommand = new CompoundCommand(Messages._UI_ACTION_ADD_ENUMERATIONS); - while (tokenizer.hasMoreTokens()) - { - String token = tokenizer.nextToken(); - if (dialog.isPreserveWhitespace() == false) - { - token = token.trim(); - } - AddEnumerationsCommand command = new AddEnumerationsCommand(Messages._UI_ACTION_ADD_ENUMERATIONS, (XSDSimpleTypeDefinition) input); - command.setValue(token); - compoundCommand.add(command); - } - getCommandStack().execute(compoundCommand); - } - enumerationsTable.refresh(); - } - else if (e.widget == deleteButton) - { - StructuredSelection selection = (StructuredSelection) enumerationsTable.getSelection(); - if (selection != null) - { - Iterator i = selection.iterator(); - CompoundCommand compoundCommand = new CompoundCommand(Messages._UI_ACTION_DELETE_ENUMERATION); - while (i.hasNext()) - { - Object obj = i.next(); - if (obj != null) - { - if (obj instanceof XSDEnumerationFacet) - { - XSDEnumerationFacet enumFacet = (XSDEnumerationFacet) obj; - - DeleteCommand deleteCommand = new DeleteCommand(Messages._UI_ACTION_DELETE_ENUMERATION, enumFacet); - compoundCommand.add(deleteCommand); - } - } - } - getCommandStack().execute(compoundCommand); - enumerationsTable.refresh(); - } - } - else if (e.widget == enumerationsTable.getTable()) - { - StructuredSelection selection = (StructuredSelection) enumerationsTable.getSelection(); - if (selection.getFirstElement() != null) - { - deleteButton.setEnabled(true); - } - else - { - deleteButton.setEnabled(false); - } - } - - } - - public void widgetDefaultSelected(SelectionEvent e) - { - - } - - public void createContents(Composite parent) - { - TabbedPropertySheetWidgetFactory factory = getWidgetFactory(); - composite = factory.createFlatFormComposite(parent); - - enumerationsTable = new EnumerationsTableViewer(getWidgetFactory().createTable(composite, SWT.MULTI | SWT.FULL_SELECTION)); - enumerationsTable.setInput(input); - Table table = enumerationsTable.getTable(); - table.addSelectionListener(this); - - addButton = getWidgetFactory().createButton(composite, XSDEditorPlugin.getXSDString("_UI_REGEX_WIZARD_ADD_BUTTON_LABEL"), SWT.PUSH); //$NON-NLS-1$ - addManyButton = getWidgetFactory().createButton(composite, XSDEditorPlugin.getXSDString("_UI_REGEX_WIZARD_ADD_BUTTON_LABEL") + "...", SWT.PUSH); //$NON-NLS-1$ //$NON-NLS-2$ - deleteButton = getWidgetFactory().createButton(composite, XSDEditorPlugin.getXSDString("_UI_ACTION_DELETE_INCLUDE"), SWT.PUSH); //$NON-NLS-1$ - - FormData data2 = new FormData(); - data2.top = new FormAttachment(0, 0); - data2.left = new FormAttachment(100, -100); - data2.right = new FormAttachment(100, 0); - // data2.width = 50; - addButton.setLayoutData(data2); - addButton.addSelectionListener(this); - - FormData data = new FormData(); - data.left = new FormAttachment(addButton, 0, SWT.LEFT); - data.right = new FormAttachment(100, 0); - data.top = new FormAttachment(addButton, 0); - addManyButton.setLayoutData(data); - addManyButton.addSelectionListener(this); - - data = new FormData(); - data.left = new FormAttachment(addButton, 0, SWT.LEFT); - data.right = new FormAttachment(100, 0); - data.top = new FormAttachment(addManyButton, 0); - deleteButton.setLayoutData(data); - deleteButton.setEnabled(false); - deleteButton.addSelectionListener(this); - - data = new FormData(); - data.top = new FormAttachment(0, 0); - data.left = new FormAttachment(0, 0); - data.right = new FormAttachment(addButton, 0); - data.bottom = new FormAttachment(100, 0); - data.width = 50; - table.setLayoutData(data); - table.addListener(SWT.Resize, this); - } - - /* - * @see org.eclipse.wst.common.ui.properties.internal.provisional.view.ITabbedPropertySection#refresh() - */ - public void refresh() - { - if (isReadOnly) - { - composite.setEnabled(false); - } - else - { - composite.setEnabled(true); - } - XSDSimpleTypeDefinition st = (XSDSimpleTypeDefinition) input; - - Iterator validFacets = st.getValidFacets().iterator(); - - boolean isApplicable = false; - while (validFacets.hasNext()) - { - String aValidFacet = (String) validFacets.next(); - if (aValidFacet.equals(XSDConstants.ENUMERATION_ELEMENT_TAG)) - { - isApplicable = true; - } - } - - if (isApplicable) - { - addButton.setEnabled(true); - addManyButton.setEnabled(true); - } - else - { - addButton.setEnabled(false); - addManyButton.setEnabled(false); - } - enumerationsTable.setInput(input); - } - - public void handleEvent(Event event) - { - Table table = enumerationsTable.getTable(); - if (event.type == SWT.Resize && event.widget == table) - { - TableColumn tableColumn = table.getColumn(0); - tableColumn.setWidth(table.getSize().x); - } - } - - public void dispose() - { - } - - public boolean shouldUseExtraSpace() - { - return true; - } - - class EnumerationsTableViewer extends NavigableTableViewer implements ICellModifier - { - protected String[] columnProperties = { XSDConstants.ENUMERATION_ELEMENT_TAG }; - - protected CellEditor[] cellEditors; - - Table table; - - public EnumerationsTableViewer(Table table) - { - super(table); - table = getTable(); - - table.setLinesVisible(true); - - setContentProvider(new EnumerationsTableContentProvider()); - setLabelProvider(new EnumerationsTableLabelProvider()); - setColumnProperties(columnProperties); - - setCellModifier(this); - - TableColumn column = new TableColumn(table, SWT.NONE, 0); - column.setText(columnProperties[0]); - column.setAlignment(SWT.LEFT); - column.setResizable(true); - - cellEditors = new CellEditor[1]; - - TableLayout layout = new TableLayout(); - ColumnWeightData data = new ColumnWeightData(100); - - layout.addColumnData(data); - cellEditors[0] = new TextCellEditor(table); - - getTable().setLayout(layout); - setCellEditors(cellEditors); - } - - public boolean canModify(Object element, String property) - { - return true; - } - - public void modify(Object element, String property, Object value) - { - if (element instanceof TableItem && (value != null)) - { - TableItem item = (TableItem) element; - - XSDEnumerationFacet enumFacet = (XSDEnumerationFacet) item.getData(); - SetXSDFacetValueCommand command = new SetXSDFacetValueCommand(Messages._UI_ACTION_SET_ENUMERATION_VALUE, enumFacet); - command.setValue((String) value); - getCommandStack().execute(command); - item.setData(enumFacet); - item.setText((String) value); - } - } - - public Object getValue(Object element, String property) - { - if (element instanceof XSDEnumerationFacet) - { - XSDEnumerationFacet enumFacet = (XSDEnumerationFacet) element; - String value = enumFacet.getLexicalValue(); - if (value == null) - value = ""; //$NON-NLS-1$ - return value; - } - return ""; //$NON-NLS-1$ - } - - } - - class EnumerationsTableContentProvider implements IStructuredContentProvider - { - public void inputChanged(Viewer viewer, Object oldInput, Object newInput) - { - } - - public java.lang.Object[] getElements(java.lang.Object inputElement) - { - java.util.List list = new ArrayList(); - if (inputElement instanceof XSDSimpleTypeDefinition) - { - XSDSimpleTypeDefinition st = (XSDSimpleTypeDefinition) inputElement; - return st.getEnumerationFacets().toArray(); - } - return list.toArray(); - } - - public void dispose() - { - } - } - - class EnumerationsTableLabelProvider extends LabelProvider implements ITableLabelProvider - { - public EnumerationsTableLabelProvider() - { - - } - - public Image getColumnImage(Object element, int columnIndex) - { - return XSDEditorPlugin.getXSDImage("icons/XSDSimpleEnum.gif"); //$NON-NLS-1$ - } - - public String getColumnText(Object element, int columnIndex) - { - if (element instanceof XSDEnumerationFacet) - { - XSDEnumerationFacet enumFacet = (XSDEnumerationFacet) element; - String value = enumFacet.getLexicalValue(); - if (value == null) - value = ""; //$NON-NLS-1$ - return value; - } - return ""; //$NON-NLS-1$ - } - - } - -} diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/FacetViewer.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/FacetViewer.java deleted file mode 100644 index e13d74d745..0000000000 --- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/FacetViewer.java +++ /dev/null @@ -1,559 +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.common.properties.sections; - -//import java.util.ArrayList; -//import java.util.Iterator; -//import java.util.List; -// -//import org.eclipse.jface.viewers.CellEditor; -//import org.eclipse.jface.viewers.ColumnWeightData; -//import org.eclipse.jface.viewers.ICellModifier; -//import org.eclipse.jface.viewers.ISelectionChangedListener; -//import org.eclipse.jface.viewers.IStructuredContentProvider; -//import org.eclipse.jface.viewers.ITableLabelProvider; -//import org.eclipse.jface.viewers.LabelProvider; -//import org.eclipse.jface.viewers.SelectionChangedEvent; -//import org.eclipse.jface.viewers.StructuredSelection; -//import org.eclipse.jface.viewers.TableLayout; -//import org.eclipse.jface.viewers.TextCellEditor; -//import org.eclipse.jface.viewers.Viewer; -//import org.eclipse.swt.SWT; -//import org.eclipse.swt.events.MouseEvent; -//import org.eclipse.swt.events.MouseTrackAdapter; -//import org.eclipse.swt.graphics.Image; -//import org.eclipse.swt.graphics.Point; -//import org.eclipse.swt.widgets.Composite; -//import org.eclipse.swt.widgets.Table; -//import org.eclipse.swt.widgets.TableColumn; -//import org.eclipse.swt.widgets.TableItem; -//import org.eclipse.wst.common.ui.internal.viewers.NavigableTableViewer; -//import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin; -//import org.eclipse.wst.xsd.ui.internal.actions.DOMAttribute; -//import org.eclipse.wst.xsd.ui.internal.properties.XSDComboBoxPropertyDescriptor; -//import org.eclipse.wst.xsd.ui.internal.util.XSDDOMHelper; -//import org.eclipse.xsd.XSDConstrainingFacet; -//import org.eclipse.xsd.XSDFactory; -//import org.eclipse.xsd.XSDMaxExclusiveFacet; -//import org.eclipse.xsd.XSDMaxFacet; -//import org.eclipse.xsd.XSDMaxInclusiveFacet; -//import org.eclipse.xsd.XSDMinExclusiveFacet; -//import org.eclipse.xsd.XSDMinFacet; -//import org.eclipse.xsd.XSDMinInclusiveFacet; -//import org.eclipse.xsd.XSDSimpleTypeDefinition; -//import org.eclipse.xsd.util.XSDConstants; -//import org.eclipse.xsd.util.XSDSchemaBuildingTools; -//import org.w3c.dom.Element; - -public class FacetViewer //extends NavigableTableViewer implements ICellModifier -{ -// public static final String FACET_NAME = XSDEditorPlugin.getXSDString("_UI_FACET_NAME"); // "Name"; -// public static final String FACET_VALUE = XSDEditorPlugin.getXSDString("_UI_FACET_VALUE"); // "Value"; -// public static final String FACET_OTHER = XSDEditorPlugin.getXSDString("_UI_FACET_FIXED"); // "Fixed"; -// -// protected FacetsTableLabelProvider facetsTableLabelProvider = new FacetsTableLabelProvider(); -// protected FacetsTableContentProvider facetsTableContentProvider = new FacetsTableContentProvider(); -// protected String[] columnProperties = { FACET_NAME, FACET_VALUE, FACET_OTHER }; -// protected CellEditor[] cellEditors; // these cellEditors are used when -// // non-whitespace facet is selected -// protected CellEditor[] altCellEditors; // these cellEditors are used when -// // whitespace facet is selected -// -// protected String[] whiteSpaceValues = new String[] { "", "preserve", "replace", "collapse" }; -// protected String[] trueFalseValues = new String[] { "", "false", "true" }; -// -// /** -// * @param parent -// */ -// public FacetViewer(Composite parent) -// { -// super(new Table(parent, SWT.FULL_SELECTION | SWT.SINGLE)); -// -// getTable().setLinesVisible(true); -// getTable().setHeaderVisible(true); -// -// addSelectionChangedListener(new SelectionChangedListener()); -// getTable().addMouseTrackListener(new MyMouseTrackListener()); -// -// setContentProvider(facetsTableContentProvider); -// setLabelProvider(facetsTableLabelProvider); -// setColumnProperties(columnProperties); -// -// setCellModifier(this); -// -// for (int i = 0; i < 3; i++) -// { -// TableColumn column = new TableColumn(getTable(), SWT.NONE, i); -// column.setText(columnProperties[i]); -// column.setAlignment(SWT.LEFT); -// column.setResizable(true); -// } -// -// cellEditors = new CellEditor[3]; -// altCellEditors = new CellEditor[3]; -// -// TableLayout layout = new TableLayout(); -// ColumnWeightData data = new ColumnWeightData(60, 80, true); -// layout.addColumnData(data); -// cellEditors[0] = null; -// -// ColumnWeightData data2 = new ColumnWeightData(120, 80, true); -// layout.addColumnData(data2); -// -// cellEditors[1] = new TextCellEditor(getTable()); -// XSDComboBoxPropertyDescriptor pd = new XSDComboBoxPropertyDescriptor("combo", "whitespace", whiteSpaceValues); -// altCellEditors[1] = pd.createPropertyEditor(getTable()); -// -// ColumnWeightData data3 = new ColumnWeightData(60, 60, true); -// layout.addColumnData(data3); -// -// XSDComboBoxPropertyDescriptor pd2 = new XSDComboBoxPropertyDescriptor("combo", "other", trueFalseValues); -// cellEditors[2] = pd2.createPropertyEditor(getTable()); -// altCellEditors[2] = pd2.createPropertyEditor(getTable()); -// -// getTable().setLayout(layout); -// setCellEditors(cellEditors); -// -// } -// -// /* -// * (non-Javadoc) -// * -// * @see org.eclipse.jface.viewers.ICellModifier#canModify(java.lang.Object, -// * java.lang.String) -// */ -// public boolean canModify(Object element, String property) -// { -// return property.equals(FACET_VALUE) || property.equals(FACET_OTHER); -// } -// -// /* -// * (non-Javadoc) -// * -// * @see org.eclipse.jface.viewers.ICellModifier#getValue(java.lang.Object, -// * java.lang.String) -// */ -// public Object getValue(Object element, String property) -// { -// int column = 0; -// if (property.equals(columnProperties[0])) -// { -// column = 0; -// } -// else if (property.equals(columnProperties[1])) -// { -// column = 1; -// } -// else if (property.equals(columnProperties[2])) -// { -// column = 2; -// } -// -// return facetsTableLabelProvider.getColumnText(element, column); -// } -// -// /* -// * (non-Javadoc) -// * -// * @see org.eclipse.jface.viewers.ICellModifier#modify(java.lang.Object, -// * java.lang.String, java.lang.Object) -// */ -// public void modify(Object element, String property, Object value) -// { -// XSDSimpleTypeDefinition xsdSimpleType = (XSDSimpleTypeDefinition) getInput(); -// TableItem item = (TableItem) element; -// if (item != null) -// { -// Object o = item.getData(); -// if (o != null) -// { -// if (o instanceof String) -// { -// String facet = (String) o; -// -// Element simpleTypeElement = xsdSimpleType.getElement(); -// XSDDOMHelper xsdDOMHelper = new XSDDOMHelper(); -// Element derivedByElement = xsdDOMHelper.getDerivedByElement(simpleTypeElement); -// -// String prefix = simpleTypeElement.getPrefix(); -// prefix = (prefix == null) ? "" : (prefix + ":"); -// -// Element childNodeElement = null; -// DOMAttribute valueAttr = null; -// -// XSDConstrainingFacet targetFacet = getXSDConstrainingFacet(facet); -// -// String newValue = ""; -// if (value != null && value instanceof String) -// { -// newValue = (String) value; -// } -// -// if (property.equals(columnProperties[1])) -// { -// if (targetFacet == null && newValue.length() > 0) -// { -// targetFacet = createFacet(facet); -// childNodeElement = (derivedByElement.getOwnerDocument()).createElementNS(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001, prefix + facet); -// valueAttr = new DOMAttribute(XSDConstants.VALUE_ATTRIBUTE, newValue); -// childNodeElement.setAttribute(valueAttr.getName(), valueAttr.getValue()); -// // add and format child -// derivedByElement.appendChild(childNodeElement); -// targetFacet.setElement(childNodeElement); -// XSDDOMHelper.formatChild(childNodeElement); -// -// // XSDSchemaHelper.updateElement(xsdSimpleType); -// } -// if (targetFacet == null) -// { -// return; -// } -// -// if (newValue.length() > 0) -// { -// targetFacet.setLexicalValue(newValue); -// -// if (targetFacet instanceof XSDMaxFacet || targetFacet instanceof XSDMinFacet) -// { -// if (targetFacet instanceof XSDMaxFacet) -// { -// if (targetFacet instanceof XSDMaxExclusiveFacet) -// { -// XSDMaxInclusiveFacet xsdMaxInclusiveFacet = xsdSimpleType.getMaxInclusiveFacet(); -// if (xsdMaxInclusiveFacet != null) -// { -// Element xsdMaxInclusiveFacetElement = xsdMaxInclusiveFacet.getElement(); -// XSDDOMHelper.removeNodeAndWhitespace(xsdMaxInclusiveFacetElement); -// } -// } -// else if (targetFacet instanceof XSDMaxInclusiveFacet) -// { -// XSDMaxExclusiveFacet xsdMaxExclusiveFacet = xsdSimpleType.getMaxExclusiveFacet(); -// if (xsdMaxExclusiveFacet != null) -// { -// Element xsdMaxExclusiveFacetElement = xsdMaxExclusiveFacet.getElement(); -// XSDDOMHelper.removeNodeAndWhitespace(xsdMaxExclusiveFacetElement); -// } -// } -// } -// else if (targetFacet instanceof XSDMinFacet) -// { -// if (targetFacet instanceof XSDMinExclusiveFacet) -// { -// XSDMinInclusiveFacet xsdMinInclusiveFacet = xsdSimpleType.getMinInclusiveFacet(); -// if (xsdMinInclusiveFacet != null) -// { -// Element xsdMinInclusiveFacetElement = xsdMinInclusiveFacet.getElement(); -// XSDDOMHelper.removeNodeAndWhitespace(xsdMinInclusiveFacetElement); -// } -// } -// else if (targetFacet instanceof XSDMinInclusiveFacet) -// { -// XSDMinExclusiveFacet xsdMinExclusiveFacet = xsdSimpleType.getMinExclusiveFacet(); -// if (xsdMinExclusiveFacet != null) -// { -// Element xsdMinExclusiveFacetElement = xsdMinExclusiveFacet.getElement(); -// XSDDOMHelper.removeNodeAndWhitespace(xsdMinExclusiveFacetElement); -// } -// } -// } -// } -// } -// else -// // newValue.length == 0 -// { -// Element targetFacetElement = targetFacet.getElement(); -// XSDDOMHelper.removeNodeAndWhitespace(targetFacetElement); -// } -// } -// else if (property.equals(columnProperties[2])) -// { -// if (targetFacet != null) -// { -// if (newValue.length() > 0) -// { -// targetFacet.getElement().setAttribute(XSDConstants.FIXED_ATTRIBUTE, newValue); -// } -// else -// { -// targetFacet.getElement().removeAttribute(XSDConstants.FIXED_ATTRIBUTE); -// } -// } -// } -// xsdSimpleType.setElement(simpleTypeElement); -// // xsdSimpleType.updateElement(); -// refresh(); -// } -// } -// } -// } -// -// private XSDConstrainingFacet getXSDConstrainingFacet(String facetString) -// { -// XSDSimpleTypeDefinition xsdSimpleType = (XSDSimpleTypeDefinition) getInput(); -// List list = xsdSimpleType.getFacetContents(); -// if (list == null) -// { -// return null; -// } -// Iterator iter = list.iterator(); -// XSDConstrainingFacet targetFacet = null; -// -// while (iter.hasNext()) -// { -// XSDConstrainingFacet xsdConstrainingFacet = (XSDConstrainingFacet) iter.next(); -// if (xsdConstrainingFacet.getFacetName().equals(facetString)) -// { -// targetFacet = xsdConstrainingFacet; -// break; -// } -// } -// return targetFacet; -// } -// -// private XSDConstrainingFacet createFacet(String facet) -// { -// XSDFactory factory = XSDSchemaBuildingTools.getXSDFactory(); -// XSDConstrainingFacet xsdFacet = null; -// if (facet.equals("length")) -// { -// xsdFacet = factory.createXSDLengthFacet(); -// } -// else if (facet.equals("minLength")) -// { -// xsdFacet = factory.createXSDMinLengthFacet(); -// } -// else if (facet.equals("maxLength")) -// { -// xsdFacet = factory.createXSDMaxLengthFacet(); -// } -// else if (facet.equals("minInclusive")) -// { -// xsdFacet = factory.createXSDMinInclusiveFacet(); -// } -// else if (facet.equals("minExclusive")) -// { -// xsdFacet = factory.createXSDMinExclusiveFacet(); -// } -// else if (facet.equals("maxInclusive")) -// { -// xsdFacet = factory.createXSDMaxInclusiveFacet(); -// } -// else if (facet.equals("maxExclusive")) -// { -// xsdFacet = factory.createXSDMaxExclusiveFacet(); -// } -// -// else if (facet.equals("totalDigits")) -// { -// xsdFacet = factory.createXSDTotalDigitsFacet(); -// } -// else if (facet.equals("fractionDigits")) -// { -// xsdFacet = factory.createXSDFractionDigitsFacet(); -// } -// else if (facet.equals("whiteSpace")) -// { -// xsdFacet = factory.createXSDWhiteSpaceFacet(); -// } -// return xsdFacet; -// } -// -// /** -// * Get the tooltip for the facet -// */ -// public String getToolTip(String facet) -// { -// String key = ""; -// if (facet.equals("length")) -// { -// key = "_UI_TOOLTIP_LENGTH"; -// } -// else if (facet.equals("minLength")) -// { -// key = "_UI_TOOLTIP_MIN_LEN"; -// } -// else if (facet.equals("maxLength")) -// { -// key = "_UI_TOOLTIP_MAX_LEN"; -// } -// -// else if (facet.equals("minInclusive")) -// { -// key = "_UI_TOOLTIP_MIN_INCLUSIVE"; -// } -// else if (facet.equals("minExclusive")) -// { -// key = "_UI_TOOLTIP_MIN_EXCLUSIVE"; -// } -// -// else if (facet.equals("maxInclusive")) -// { -// key = "_UI_TOOLTIP_MAX_INCLUSIVE"; -// } -// else if (facet.equals("maxExclusive")) -// { -// key = "_UI_TOOLTIP_MAX_EXCLUSIVE"; -// } -// -// else if (facet.equals("totalDigits")) -// { -// key = "_UI_TOOLTIP_TOTAL_DIGITS"; -// } -// else if (facet.equals("fractionDigits")) -// { -// key = "_UI_TOOLTIP_FRACTION_DIGITS"; -// } -// -// else if (facet.equals("whiteSpace")) -// { -// key = "_UI_TOOLTIP_WHITE_SPACE"; -// } -// -// return (key != null) ? XSDEditorPlugin.getXSDString(key) : ""; -// } -// -// /** -// * This listener detects which row is selected and add a tool tip for that row -// */ -// public class MyMouseTrackListener extends MouseTrackAdapter -// { -// public void mouseHover(MouseEvent e) -// { -// TableItem item = getTable().getItem(new Point(e.x, e.y)); -// if (item != null) -// { -// Object o = item.getData(); -// if (o != null) -// { -// String facetName = (String) o; -// getTable().setToolTipText(getToolTip(facetName)); -// } -// } -// } -// } -// -// /** -// * Based on the selection, detects if it is a white space or not, and add the -// * corresponding cell editors -// */ -// public class SelectionChangedListener implements ISelectionChangedListener -// { -// public void selectionChanged(SelectionChangedEvent event) -// { -// Object selection = event.getSelection(); -// if (selection instanceof StructuredSelection) -// { -// Object o = ((StructuredSelection) selection).getFirstElement(); -// if (o != null) -// { -// String facet = (String) o; -// if (facet.equals("whiteSpace")) -// { -// setCellEditors(altCellEditors); -// } -// else -// { -// setCellEditors(cellEditors); -// } -// } -// } -// } -// } -// -// class FacetsTableContentProvider implements IStructuredContentProvider -// { -// protected String facet; -// -// public void inputChanged(Viewer viewer, Object oldInput, Object newInput) -// { -// } -// -// public java.lang.Object[] getElements(java.lang.Object inputElement) -// { -// List v = new ArrayList(); -// XSDSimpleTypeDefinition inputXSDSimpleType = (XSDSimpleTypeDefinition) inputElement; -// XSDSimpleTypeDefinition base = inputXSDSimpleType.getPrimitiveTypeDefinition(); -// -// if (base != null) -// { -// Iterator validFacets = inputXSDSimpleType.getValidFacets().iterator(); -// while (validFacets.hasNext()) -// { -// String aValidFacet = (String) validFacets.next(); -// if (!(aValidFacet.equals("pattern") || aValidFacet.equals("enumeration"))) -// { -// v.add(aValidFacet); -// } -// } -// } -// return v.toArray(); -// } -// -// public void dispose() -// { -// } -// } -// -// class FacetsTableLabelProvider extends LabelProvider implements ITableLabelProvider -// { -// public Image getColumnImage(Object element, int columnIndex) -// { -// return null; -// } -// -// public String getColumnText(Object element, int columnIndex) -// { -// if (element instanceof String) -// { -// String value = null; -// XSDConstrainingFacet targetFacet = getXSDConstrainingFacet((String) element); -// switch (columnIndex) -// { -// case 0: -// { -// value = (String) element; -// break; -// } -// case 1: -// { -// if (targetFacet == null) -// { -// value = ""; -// } -// else -// { -// value = targetFacet.getLexicalValue(); -// } -// -// break; -// } -// case 2: -// { -// if (targetFacet == null) -// { -// value = ""; -// } -// else -// { -// Element elem = targetFacet.getElement(); -// value = elem.getAttribute(XSDConstants.FIXED_ATTRIBUTE); -// if (value == null) -// value = ""; -// } -// } -// } -// return value; -// } -// return ""; -// } -// } -} diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/IDocumentChangedNotifier.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/IDocumentChangedNotifier.java deleted file mode 100644 index a72e632f4e..0000000000 --- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/IDocumentChangedNotifier.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.common.properties.sections; - -import org.eclipse.wst.sse.core.internal.provisional.INodeAdapter; - -public interface IDocumentChangedNotifier -{ - public void addListener(INodeAdapter adapter); - public void removeListener(INodeAdapter adapter); -} diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/MultiplicitySection.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/MultiplicitySection.java deleted file mode 100644 index 94593d4068..0000000000 --- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/MultiplicitySection.java +++ /dev/null @@ -1,216 +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.common.properties.sections; - -import org.eclipse.swt.custom.CCombo; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Event; -import org.eclipse.wst.xsd.ui.internal.common.commands.UpdateMaxOccursCommand; -import org.eclipse.wst.xsd.ui.internal.common.commands.UpdateMinOccursCommand; -import org.eclipse.wst.xsd.ui.internal.common.util.Messages; -import org.eclipse.xsd.XSDConcreteComponent; -import org.eclipse.xsd.XSDParticle; -import org.eclipse.xsd.XSDParticleContent; -import org.eclipse.xsd.util.XSDConstants; -import org.w3c.dom.Element; - - -public class MultiplicitySection extends RefactoringSection -{ - protected CCombo minCombo, maxCombo; - - public MultiplicitySection() - { - super(); - } - - protected void createContents(Composite parent) - { - } - - - public void doHandleEvent(Event event) - { - if (event.widget == minCombo) - { - updateMinAttribute(); - } - else if (event.widget == maxCombo) - { - updateMaxAttribute(); - } - } - - public void doWidgetSelected(SelectionEvent e) - { - if (e.widget == minCombo) - { - updateMinAttribute(); - } - else if (e.widget == maxCombo) - { - updateMaxAttribute(); - } - super.doWidgetSelected(e); - } - - protected void updateMaxAttribute() - { - setErrorMessage(null); - XSDParticle particle = null; - - if (input instanceof XSDParticleContent) - { - particle = getAssociatedParticle((XSDParticleContent) input); - } - if (particle != null) - { - String newValue = maxCombo.getText().trim(); - - if (newValue.length() == 0) - { - particle.unsetMaxOccurs(); - return; - } - try - { - int newMax = 1; - if (newValue.equals("unbounded") || newValue.equals("*")) //$NON-NLS-1$ //$NON-NLS-2$ - { - newMax = XSDParticle.UNBOUNDED; - } - else - { - if (newValue.length() > 0) - { - newMax = Integer.parseInt(newValue); - } - } - setListenerEnabled(false); - UpdateMaxOccursCommand command = new UpdateMaxOccursCommand(Messages._UI_ACTION_CHANGE_MAXIMUM_OCCURRENCE, particle, newMax); - getCommandStack().execute(command); - setListenerEnabled(true); - - } - catch (NumberFormatException e) - { - setErrorMessage(Messages._UI_ERROR_INVALID_VALUE_FOR_MAXIMUM_OCCURRENCE); - } - } - } - - protected void updateMinAttribute() - { - setErrorMessage(null); - XSDParticle particle = null; - - if (input instanceof XSDParticleContent) - { - particle = getAssociatedParticle((XSDParticleContent) input); - } - if (particle != null) - { - String newValue = minCombo.getText(); - if (newValue.length() == 0) - { - particle.unsetMinOccurs(); - } - try - { - int newMin = 1; - if (newValue.equals("unbounded") || newValue.equals("*")) //$NON-NLS-1$ //$NON-NLS-2$ - { - newMin = XSDParticle.UNBOUNDED; - } - else - { - newMin = Integer.parseInt(newValue); - } - UpdateMinOccursCommand command = new UpdateMinOccursCommand(Messages._UI_ACTION_CHANGE_MINIMUM_OCCURRENCE, particle, newMin); - getCommandStack().execute(command); - } - catch (NumberFormatException e) - { - - } - } - } - - protected void refreshMinMax() - { - boolean refreshMinText = true; - boolean refreshMaxText = true; - if (minCombo.isFocusControl()) - { - refreshMinText = false; - } - if (maxCombo.isFocusControl()) - { - refreshMaxText = false; - } - if (refreshMinText) - { - minCombo.setText(""); //$NON-NLS-1$ - } - if (refreshMaxText) - { - maxCombo.setText(""); //$NON-NLS-1$ - } - - if (input != null) - { - if (input instanceof XSDParticleContent) - { - XSDParticle particle = getAssociatedParticle((XSDParticleContent) input); - if (particle != null) - { - // minText.setText(String.valueOf(particle.getMinOccurs())); - // maxText.setText(String.valueOf(particle.getMaxOccurs())); - Element element = particle.getElement(); - if (element != null) - { - String min = element.getAttribute(XSDConstants.MINOCCURS_ATTRIBUTE); - String max = element.getAttribute(XSDConstants.MAXOCCURS_ATTRIBUTE); - if (min != null && refreshMinText) - { - minCombo.setText(min); - } - if (max != null && refreshMaxText) - { - maxCombo.setText(max); - } - } - } - } - } - } - - protected XSDParticle getAssociatedParticle(XSDParticleContent particleContent) - { - XSDConcreteComponent xsdComp = particleContent.getContainer(); - if (xsdComp instanceof XSDParticle) - { - return (XSDParticle) xsdComp; - } - return null; - } - - public void dispose() - { - if (minCombo != null && !minCombo.isDisposed()) - removeListeners(minCombo); - if (maxCombo != null && !maxCombo.isDisposed()) - removeListeners(maxCombo); - super.dispose(); - } - -} diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/RefactoringSection.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/RefactoringSection.java deleted file mode 100644 index a209eb0a06..0000000000 --- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/RefactoringSection.java +++ /dev/null @@ -1,93 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.wst.xsd.ui.internal.common.properties.sections; - -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.forms.events.HyperlinkEvent; -import org.eclipse.ui.forms.events.IHyperlinkListener; -import org.eclipse.ui.forms.widgets.ImageHyperlink; -import org.eclipse.wst.xsd.ui.internal.common.util.Messages; -import org.eclipse.wst.xsd.ui.internal.editor.ISelectionMapper; -import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin; -import org.eclipse.wst.xsd.ui.internal.refactor.actions.RenameComponentAction; -import org.eclipse.xsd.XSDSchema; - -public abstract class RefactoringSection extends AbstractSection implements IHyperlinkListener -{ - /** - * Clicking on it invokes the refactor->rename action. - */ - private ImageHyperlink renameHyperlink; - - /** - * Invokes the refactor->rename action on the current selection. - */ - private void invokeRenameRefactoring() - { - IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor(); - XSDSchema schema = (XSDSchema) editor.getAdapter(XSDSchema.class); - ISelection selection = editor.getSite().getSelectionProvider().getSelection(); - ISelectionMapper mapper = (ISelectionMapper) editor.getAdapter(ISelectionMapper.class); - selection = mapper != null ? mapper.mapSelection(selection) : selection; - RenameComponentAction action = new RenameComponentAction(selection, schema); - action.update(selection); - action.run(); - } - - /** - * Creates the refactor/rename hyperlink shown beside a component name. - * Clicking on the hyperlink invokes the refactor/rename action. - * - * @param parent - * the parent composite. Must not be null. - */ - protected void createRenameHyperlink(Composite parent) - { - renameHyperlink = getWidgetFactory().createImageHyperlink(parent, SWT.NONE); - - renameHyperlink.setImage(XSDEditorPlugin.getXSDImage("icons/quickassist.gif")); //$NON-NLS-1$ - renameHyperlink.setToolTipText(Messages._UI_TOOLTIP_RENAME_REFACTOR); - renameHyperlink.addHyperlinkListener(this); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.forms.events.IHyperlinkListener#linkActivated(org.eclipse.ui.forms.events.HyperlinkEvent) - */ - public void linkActivated(HyperlinkEvent e) - { - invokeRenameRefactoring(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.forms.events.IHyperlinkListener#linkEntered(org.eclipse.ui.forms.events.HyperlinkEvent) - */ - public void linkEntered(HyperlinkEvent e) - { - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.forms.events.IHyperlinkListener#linkExited(org.eclipse.ui.forms.events.HyperlinkEvent) - */ - public void linkExited(HyperlinkEvent e) - { - } -} diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/SimpleContentUnionMemberTypesDialog.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/SimpleContentUnionMemberTypesDialog.java deleted file mode 100644 index a090be1f09..0000000000 --- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/SimpleContentUnionMemberTypesDialog.java +++ /dev/null @@ -1,312 +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.common.properties.sections; - -import java.util.Iterator; -import java.util.List; - -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.window.Window; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.TableColumn; -import org.eclipse.swt.widgets.TableItem; -import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin; -import org.eclipse.wst.xsd.ui.internal.util.TypesHelper; -import org.eclipse.wst.xsd.ui.internal.util.ViewUtility; -import org.eclipse.wst.xsd.ui.internal.widgets.TypeSection; -import org.eclipse.xsd.XSDSchema; -import org.eclipse.xsd.XSDSimpleTypeDefinition; -import org.eclipse.xsd.util.XSDConstants; - - -public class SimpleContentUnionMemberTypesDialog extends Dialog implements SelectionListener -{ - XSDSimpleTypeDefinition simpleType; - /** - * @param parentShell - */ - public SimpleContentUnionMemberTypesDialog(Shell parentShell, XSDSimpleTypeDefinition simpleType) - { - super(parentShell); - this.simpleType = simpleType; - } - - Table table; - TypeSection typeSection; - Button addButton, removeButton; - org.eclipse.swt.widgets.List memberTypesList; - - private String result; - - protected void configureShell(Shell shell) - { - super.configureShell(shell); - } - - protected void buttonPressed(int buttonId) - { - if (buttonId == Window.OK) - { - StringBuffer sb = new StringBuffer(); - int length = memberTypesList.getItemCount(); - for (int i=0 ; i < length; i++) - { - sb.append(memberTypesList.getItem(i)); - if (i < length - 1) - { - sb.append(" "); //$NON-NLS-1$ - } - } - result = sb.toString(); - } - super.buttonPressed(buttonId); - } - - public String getResult() { return result; } - - // - // Create the controls - // - public Control createDialogArea(Composite parent) - { - Composite client = (Composite)super.createDialogArea(parent); - getShell().setText("Union " + XSDConstants.MEMBERTYPES_ATTRIBUTE); //$NON-NLS-1$ - - Label instructions = new Label(client, SWT.LEFT | SWT.WRAP); - instructions.setText(XSDEditorPlugin.getXSDString("_UI_LABEL_SELECT_MEMBERTYPES")); //$NON-NLS-1$ - - Composite columnsComposite = new Composite(client, SWT.NONE); - GridLayout ccGL = new GridLayout(); - ccGL.verticalSpacing = 0; - ccGL.horizontalSpacing = 0; - ccGL.marginHeight = 0; - ccGL.marginWidth = 0; - ccGL.makeColumnsEqualWidth = true; - ccGL.numColumns = 3; - columnsComposite.setLayout(ccGL); - - GridData ccGD = new GridData(); - ccGD.grabExcessHorizontalSpace = true; - ccGD.horizontalAlignment = GridData.FILL; - columnsComposite.setLayoutData(ccGD); - - typeSection = new TypeSection(columnsComposite); - typeSection.setShowUserComplexType(false); - - typeSection.createClient(columnsComposite); - typeSection.getSimpleType().setSelection(false); - typeSection.getSimpleType().addSelectionListener(this); - typeSection.getUserSimpleType().addSelectionListener(this); - - ViewUtility.createHorizontalFiller(columnsComposite, 1); - - Label memberListLabel = new Label(columnsComposite, SWT.LEFT); - memberListLabel.setText(XSDEditorPlugin.getXSDString("_UI_LABEL_MEMBERTYPES_VALUE")); //$NON-NLS-1$ - - Composite dataComposite = new Composite(client, SWT.NONE); - GridLayout dcGL = new GridLayout(); - dcGL.verticalSpacing = 0; - dcGL.marginHeight = 0; - dcGL.marginWidth = 0; - dcGL.numColumns = 3; - dataComposite.setLayout(dcGL); - - GridData dcGD = new GridData(); - dcGD.grabExcessHorizontalSpace = true; - dcGD.grabExcessVerticalSpace = true; - dataComposite.setLayoutData(dcGD); - - table = new Table(dataComposite, - SWT.SINGLE | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); - table.setHeaderVisible(false); - table.setLinesVisible(true); - GridData gd2 = new GridData(); - gd2.grabExcessHorizontalSpace = true; - gd2.grabExcessVerticalSpace = true; - gd2.horizontalAlignment = GridData.FILL; - gd2.verticalAlignment = GridData.FILL; - gd2.heightHint = 200; - gd2.widthHint = 200; - table.setLayoutData(gd2); - - // Fill table - handleSetInput(); - table.getItemCount(); - - TableColumn tc = new TableColumn(table, SWT.LEFT); - tc.setWidth(200); - tc.setResizable(true); - - Composite buttonComposite = new Composite(dataComposite, SWT.NONE); - GridLayout bcGL = new GridLayout(); - bcGL.numColumns = 1; - buttonComposite.setLayout(bcGL); - addButton = new Button(buttonComposite, SWT.PUSH); - addButton.setText(">"); //$NON-NLS-1$ - addButton.addSelectionListener(this); - removeButton = new Button(buttonComposite, SWT.PUSH); - removeButton.setText("<"); //$NON-NLS-1$ - removeButton.addSelectionListener(this); - - Composite listComposite = new Composite(dataComposite, SWT.NONE); - GridLayout mtGL = new GridLayout(); - mtGL.numColumns = 1; - mtGL.marginHeight = 0; - mtGL.marginWidth = 0; - mtGL.horizontalSpacing = 0; - mtGL.verticalSpacing = 0; - listComposite.setLayout(mtGL); - - GridData mtGD = new GridData(); - mtGD.grabExcessHorizontalSpace = true; - mtGD.grabExcessVerticalSpace = true; - mtGD.verticalAlignment = GridData.FILL; - mtGD.horizontalAlignment = GridData.FILL; - listComposite.setLayoutData(mtGD); - - memberTypesList = new org.eclipse.swt.widgets.List(listComposite, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); - GridData mtlGD = new GridData(); - mtlGD.grabExcessHorizontalSpace = true; - mtlGD.grabExcessVerticalSpace = true; - mtlGD.verticalAlignment = GridData.FILL; - mtlGD.horizontalAlignment = GridData.FILL; - mtlGD.heightHint = 200; - mtlGD.widthHint = 200; - memberTypesList.setLayoutData(mtlGD); - - initializeMemberListContent(); - return client; - } - - private void initializeMemberListContent() - { -// String result = element.getAttribute(XSDConstants.MEMBERTYPES_ATTRIBUTE); -// if (result == null) -// { -// return; -// } -// StringTokenizer token = new StringTokenizer(result); -// while (token.hasMoreTokens()) -// { -// memberTypesList.add(token.nextToken()); -// } - XSDSchema schema = simpleType.getSchema(); - for (Iterator i = simpleType.getMemberTypeDefinitions().iterator(); i.hasNext(); ) - { - String name = ((XSDSimpleTypeDefinition)i.next()).getQName(schema); - if (name != null) - memberTypesList.add(name); - } - } - - /* (non-Javadoc) - * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent) - */ - public void widgetSelected(SelectionEvent e) - { - if (e.widget == typeSection.getSimpleType() && typeSection.getSimpleType().getSelection()) - { - populateBuiltInType(); - } - else if (e.widget == typeSection.getUserSimpleType() && typeSection.getUserSimpleType().getSelection()) - { - populateUserSimpleType(false); - } - else if (e.widget == addButton) - { - TableItem[] items = table.getItems(); - int selection = table.getSelectionIndex(); - if (items != null && items.length > 0 && selection >= 0) - { - String typeToAdd = items[selection].getData().toString(); - if (memberTypesList.indexOf(typeToAdd) < 0) - { - memberTypesList.add(items[selection].getData().toString()); - } - } - } - else if (e.widget == removeButton) - { - String[] typesToRemove = memberTypesList.getSelection(); - for (int i=0; i < typesToRemove.length; i++) - { - memberTypesList.remove(typesToRemove[i]); - } - } - } - - /* (non-Javadoc) - * @see org.eclipse.swt.events.SelectionListener#widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) - */ - public void widgetDefaultSelected(SelectionEvent e) - { - } - - public void handleSetInput() - { - populateBuiltInType(); - } - - public void populateBuiltInType() - { - table.removeAll(); - List items = getBuiltInTypeNamesList(); - for (int i = 0; i < items.size(); i++) - { - TableItem item = new TableItem(table, SWT.NONE); - item.setText(items.get(i).toString()); - item.setImage(XSDEditorPlugin.getXSDImage("icons/XSDSimpleType.gif")); //$NON-NLS-1$ - item.setData(items.get(i)); - } - } - - public void populateUserSimpleType(boolean showAnonymous) - { - table.removeAll(); - if (showAnonymous) - { - TableItem anonymousItem = new TableItem(table, SWT.NONE); - anonymousItem.setText("**anonymous**"); //$NON-NLS-1$ - anonymousItem.setData("**anonymous**"); //$NON-NLS-1$ - } - List items = getUserSimpleTypeNamesList(); - for (int i = 0; i < items.size(); i++) - { - TableItem item = new TableItem(table, SWT.NONE); - item.setText(items.get(i).toString()); - item.setImage(XSDEditorPlugin.getXSDImage("icons/XSDSimpleType.gif")); //$NON-NLS-1$ - item.setData(items.get(i)); - } - } - - public java.util.List getBuiltInTypeNamesList() - { - TypesHelper helper = new TypesHelper(simpleType.getSchema()); - return helper.getBuiltInTypeNamesList(); - } - - public java.util.List getUserSimpleTypeNamesList() - { - TypesHelper helper = new TypesHelper(simpleType.getSchema()); - return helper.getUserSimpleTypeNamesList(); - } - -} diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/SpecificConstraintsWidget.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/SpecificConstraintsWidget.java deleted file mode 100644 index 4d9baa0d41..0000000000 --- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/SpecificConstraintsWidget.java +++ /dev/null @@ -1,692 +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.common.properties.sections; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import com.ibm.icu.util.StringTokenizer; - -import org.eclipse.gef.commands.CommandStack; -import org.eclipse.gef.commands.CompoundCommand; -import org.eclipse.jface.viewers.CellEditor; -import org.eclipse.jface.viewers.ColumnWeightData; -import org.eclipse.jface.viewers.ICellModifier; -import org.eclipse.jface.viewers.IStructuredContentProvider; -import org.eclipse.jface.viewers.ITableLabelProvider; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TableLayout; -import org.eclipse.jface.viewers.TextCellEditor; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.window.Window; -import org.eclipse.jface.wizard.WizardDialog; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -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.Listener; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.TableColumn; -import org.eclipse.swt.widgets.TableItem; -import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory; -import org.eclipse.wst.common.ui.internal.viewers.NavigableTableViewer; -import org.eclipse.wst.xsd.ui.internal.common.commands.AddEnumerationsCommand; -import org.eclipse.wst.xsd.ui.internal.common.commands.ChangeToLocalSimpleTypeCommand; -import org.eclipse.wst.xsd.ui.internal.common.commands.DeleteCommand; -import org.eclipse.wst.xsd.ui.internal.common.commands.SetXSDFacetValueCommand; -import org.eclipse.wst.xsd.ui.internal.common.commands.UpdateXSDPatternFacetCommand; -import org.eclipse.wst.xsd.ui.internal.common.util.Messages; -import org.eclipse.wst.xsd.ui.internal.common.util.XSDCommonUIUtils; -import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin; -import org.eclipse.wst.xsd.ui.internal.widgets.EnumerationsDialog; -import org.eclipse.wst.xsd.ui.internal.wizards.RegexWizard; -import org.eclipse.xsd.XSDEnumerationFacet; -import org.eclipse.xsd.XSDFacet; -import org.eclipse.xsd.XSDFactory; -import org.eclipse.xsd.XSDFeature; -import org.eclipse.xsd.XSDPatternFacet; -import org.eclipse.xsd.XSDSimpleTypeDefinition; -import org.eclipse.xsd.util.XSDConstants; -import org.w3c.dom.Element; - -public class SpecificConstraintsWidget implements SelectionListener, Listener -{ - public static int ENUMERATION = 0; - public static int PATTERN = 1; - - int kind; - ConstraintsTableViewer constraintsTableViewer; - Button addButton; - Button addUsingDialogButton; - Button deleteButton; - Button editButton; - Composite composite; - boolean isEnabled; - TabbedPropertySheetWidgetFactory factory; - XSDSimpleTypeDefinition input; - XSDFeature feature; - boolean isReadOnly; - CommandStack commandStack; - XSDFacetSection facetSection; - - public SpecificConstraintsWidget(Composite composite, TabbedPropertySheetWidgetFactory factory, XSDFeature feature, XSDSimpleTypeDefinition input, XSDFacetSection facetSection) - { - this.factory = factory; - this.input = input; - this.composite = composite; - this.feature = feature; - this.facetSection = facetSection; - createControl(composite); - } - - public void setCommandStack(CommandStack commandStack) - { - this.commandStack = commandStack; - } - - public void setIsReadOnly(boolean isReadOnly) - { - this.isReadOnly = isReadOnly; - } - - public TabbedPropertySheetWidgetFactory getWidgetFactory() - { - return factory; - } - - public Control getControl() - { - return composite; - } - - public void setEnabled(boolean isEnabled) - { - this.isEnabled = isEnabled; - addButton.setEnabled(isEnabled); - addUsingDialogButton.setEnabled(isEnabled); - editButton.setEnabled(isEnabled); - constraintsTableViewer.getTable().setEnabled(isEnabled); - composite.setEnabled(isEnabled); - } - - public Control createControl(Composite parent) - { - composite = factory.createFlatFormComposite(parent); - GridData data = new GridData(); - - GridLayout gridLayout = new GridLayout(); - gridLayout.marginTop = 0; - gridLayout.marginBottom = 0; - gridLayout.numColumns = 2; - composite.setLayout(gridLayout); - - constraintsTableViewer = new ConstraintsTableViewer(getWidgetFactory().createTable(composite, SWT.MULTI | SWT.FULL_SELECTION)); - constraintsTableViewer.setInput(input); - Table table = constraintsTableViewer.getTable(); - table.addSelectionListener(this); - data.horizontalAlignment = GridData.FILL; - data.verticalAlignment = GridData.FILL; - data.grabExcessHorizontalSpace = true; - data.widthHint = 150; - data.grabExcessVerticalSpace = true; - table.setLayoutData(data); - table.addListener(SWT.Resize, this); - - Composite buttonComposite = getWidgetFactory().createComposite(composite, SWT.FLAT); - GridLayout buttonCompositeLayout = new GridLayout(); - buttonCompositeLayout.marginTop = 0; - buttonCompositeLayout.marginBottom = 0; - buttonCompositeLayout.numColumns = 1; - buttonComposite.setLayout(buttonCompositeLayout); - data = new GridData(); - data.horizontalAlignment = GridData.FILL; - data.grabExcessHorizontalSpace = false; - buttonComposite.setLayoutData(data); - - - addButton = getWidgetFactory().createButton(buttonComposite, Messages._UI_ACTION_ADD, SWT.PUSH); - data = new GridData(); - data.grabExcessHorizontalSpace = true; - data.horizontalAlignment = GridData.FILL; - data.verticalAlignment = GridData.BEGINNING; - addButton.setLayoutData(data); - addButton.addSelectionListener(this); - - addUsingDialogButton = getWidgetFactory().createButton(buttonComposite, Messages._UI_ACTION_ADD_WITH_DOTS, SWT.PUSH); - data = new GridData(); - data.grabExcessHorizontalSpace = true; - data.horizontalAlignment = GridData.FILL; - data.verticalAlignment = GridData.BEGINNING; - addUsingDialogButton.setLayoutData(data); - addUsingDialogButton.addSelectionListener(this); - - editButton = getWidgetFactory().createButton(buttonComposite, Messages._UI_ACTION_EDIT_WITH_DOTS, SWT.PUSH); - data = new GridData(); - data.grabExcessHorizontalSpace = true; - data.horizontalAlignment = GridData.FILL; - editButton.setLayoutData(data); - editButton.setEnabled(false); - editButton.addSelectionListener(this); - - - deleteButton = getWidgetFactory().createButton(buttonComposite, Messages._UI_ACTION_DELETE, SWT.PUSH); - - data = new GridData(); - data.grabExcessHorizontalSpace = true; - data.horizontalAlignment = GridData.FILL; - deleteButton.setLayoutData(data); - deleteButton.setEnabled(false); - deleteButton.addSelectionListener(this); - - - return composite; - } - - public void handleEvent(Event event) - { - Table table = constraintsTableViewer.getTable(); - if (event.type == SWT.Resize && event.widget == table) - { - TableColumn tableColumn = table.getColumn(0); - tableColumn.setWidth(table.getSize().x); - } - } - - public void setInput(Object input) - { - constraintsTableViewer.setInput(input); - if (isReadOnly) - { - composite.setEnabled(false); - } - else - { - composite.setEnabled(true); - } -// constraintsTableViewer.refresh(); - } - - public void widgetSelected(SelectionEvent e) - { - XSDSimpleTypeDefinition st = input; - Element element = st.getElement(); - - if (e.widget == addButton) - { - List enumList = st.getEnumerationFacets(); - StringBuffer newName = new StringBuffer("value1"); //$NON-NLS-1$ - int suffix = 1; - for (Iterator i = enumList.iterator(); i.hasNext();) - { - XSDEnumerationFacet enumFacet = (XSDEnumerationFacet) i.next(); - String value = enumFacet.getLexicalValue(); - if (value != null) - { - if (value.equals(newName.toString())) - { - suffix++; - newName = new StringBuffer("value" + String.valueOf(suffix)); //$NON-NLS-1$ - } - } - } - - if (kind == ENUMERATION) - { - CompoundCommand compoundCommand = new CompoundCommand(); - XSDSimpleTypeDefinition targetSimpleType = null; - if (feature != null) - { - XSDSimpleTypeDefinition anonymousSimpleType = XSDCommonUIUtils.getAnonymousSimpleType(feature, input); - if (anonymousSimpleType == null) - { - anonymousSimpleType = XSDFactory.eINSTANCE.createXSDSimpleTypeDefinition(); - anonymousSimpleType.setBaseTypeDefinition(input); - - ChangeToLocalSimpleTypeCommand changeToAnonymousCommand = new ChangeToLocalSimpleTypeCommand(Messages._UI_ACTION_CHANGE_PATTERN, feature); - changeToAnonymousCommand.setAnonymousSimpleType(anonymousSimpleType); - compoundCommand.add(changeToAnonymousCommand); - input = anonymousSimpleType; - } - targetSimpleType = anonymousSimpleType; - } - else - { - targetSimpleType = input; - } - - AddEnumerationsCommand command = new AddEnumerationsCommand(Messages._UI_ACTION_ADD_ENUMERATION, targetSimpleType); - command.setValue(newName.toString()); - compoundCommand.add(command); - commandStack.execute(compoundCommand); - setInput(input); - constraintsTableViewer.refresh(); - int newItemIndex = constraintsTableViewer.getTable().getItemCount() - 1; - constraintsTableViewer.editElement(constraintsTableViewer.getElementAt(newItemIndex), 0); - } - } - else if (e.widget == addUsingDialogButton) - { - Display display = Display.getCurrent(); - // if it is null, get the default one - display = display == null ? Display.getDefault() : display; - Shell shell = display.getActiveShell(); - - if (kind == PATTERN) - { - String initialValue = ""; //$NON-NLS-1$ - RegexWizard wizard = new RegexWizard(initialValue); - - WizardDialog wizardDialog = new WizardDialog(shell, wizard); - wizardDialog.setBlockOnOpen(true); - wizardDialog.create(); - - int result = wizardDialog.open(); - - if (result == Window.OK) - { - String newPattern = wizard.getPattern(); - CompoundCommand compoundCommand = new CompoundCommand(); - XSDSimpleTypeDefinition targetSimpleType = null; - if (feature != null) - { - XSDSimpleTypeDefinition anonymousSimpleType = XSDCommonUIUtils.getAnonymousSimpleType(feature, input); - if (anonymousSimpleType == null) - { - anonymousSimpleType = XSDFactory.eINSTANCE.createXSDSimpleTypeDefinition(); - anonymousSimpleType.setBaseTypeDefinition(input); - - ChangeToLocalSimpleTypeCommand changeToAnonymousCommand = new ChangeToLocalSimpleTypeCommand(Messages._UI_ACTION_CHANGE_PATTERN, feature); - changeToAnonymousCommand.setAnonymousSimpleType(anonymousSimpleType); - compoundCommand.add(changeToAnonymousCommand); - input = anonymousSimpleType; - } - targetSimpleType = anonymousSimpleType; - } - else - { - targetSimpleType = input; - } - - UpdateXSDPatternFacetCommand command = new UpdateXSDPatternFacetCommand(Messages._UI_ACTION_ADD_PATTERN, targetSimpleType, UpdateXSDPatternFacetCommand.ADD); - command.setValue(newPattern); - setInput(input); - compoundCommand.add(command); - commandStack.execute(compoundCommand); - facetSection.doSetInput(); - } - constraintsTableViewer.refresh(); - } - else - { - EnumerationsDialog dialog = new EnumerationsDialog(shell); - dialog.setBlockOnOpen(true); - int result = dialog.open(); - - if (result == Window.OK) - { - String text = dialog.getText(); - String delimiter = dialog.getDelimiter(); - StringTokenizer tokenizer = new StringTokenizer(text, delimiter); - CompoundCommand compoundCommand = new CompoundCommand(Messages._UI_ACTION_ADD_ENUMERATIONS); - - XSDSimpleTypeDefinition targetSimpleType = null; - if (feature != null) - { - XSDSimpleTypeDefinition anonymousSimpleType = XSDCommonUIUtils.getAnonymousSimpleType(feature, input); - if (anonymousSimpleType == null) - { - anonymousSimpleType = XSDFactory.eINSTANCE.createXSDSimpleTypeDefinition(); - anonymousSimpleType.setBaseTypeDefinition(input); - - ChangeToLocalSimpleTypeCommand changeToAnonymousCommand = new ChangeToLocalSimpleTypeCommand("", feature); //$NON-NLS-1$ - changeToAnonymousCommand.setAnonymousSimpleType(anonymousSimpleType); - compoundCommand.add(changeToAnonymousCommand); - input = anonymousSimpleType; - } - targetSimpleType = anonymousSimpleType; - } - else - { - targetSimpleType = input; - } - - while (tokenizer.hasMoreTokens()) - { - String token = tokenizer.nextToken(); - if (dialog.isPreserveWhitespace() == false) - { - token = token.trim(); - } - AddEnumerationsCommand command = new AddEnumerationsCommand(Messages._UI_ACTION_ADD_ENUMERATIONS, targetSimpleType); - command.setValue(token); - compoundCommand.add(command); - } - commandStack.execute(compoundCommand); - } - //setInput(input); - facetSection.doSetInput(); - constraintsTableViewer.refresh(); - } - } - else if (e.widget == deleteButton) - { - StructuredSelection selection = (StructuredSelection) constraintsTableViewer.getSelection(); - CompoundCommand compoundCommand = new CompoundCommand(); - if (selection != null) - { - Iterator i = selection.iterator(); - if (selection.size() > 0) - { - compoundCommand.setLabel(Messages._UI_ACTION_DELETE_CONSTRAINTS); - } - else - { - compoundCommand.setLabel(Messages._UI_ACTION_DELETE_PATTERN); - } - while (i.hasNext()) - { - Object obj = i.next(); - if (obj != null) - { - if (obj instanceof XSDPatternFacet) - { - UpdateXSDPatternFacetCommand command = new UpdateXSDPatternFacetCommand("", input, UpdateXSDPatternFacetCommand.DELETE); //$NON-NLS-1$ - command.setPatternToEdit((XSDPatternFacet)obj); - compoundCommand.add(command); - } - else if (obj instanceof XSDEnumerationFacet) - { - XSDEnumerationFacet enumFacet = (XSDEnumerationFacet) obj; - DeleteCommand deleteCommand = new DeleteCommand(Messages._UI_ACTION_DELETE_ENUMERATION, enumFacet); - compoundCommand.add(deleteCommand); - } - } - } - commandStack.execute(compoundCommand); - constraintsTableViewer.refresh(); - - if (constraintsTableViewer.getTable().getItemCount() == 0) - { - editButton.setEnabled(false); - deleteButton.setEnabled(false); - } - } - } - else if (e.widget == editButton) - { - StructuredSelection selection = (StructuredSelection) constraintsTableViewer.getSelection(); - if (selection != null) - { - Object obj = selection.getFirstElement(); - if (obj instanceof XSDPatternFacet) - { - XSDPatternFacet pattern = (XSDPatternFacet) obj; - String initialValue = pattern.getLexicalValue(); - if (initialValue == null) - { - initialValue = ""; //$NON-NLS-1$ - } - - Shell shell = Display.getCurrent().getActiveShell(); - - RegexWizard wizard = new RegexWizard(initialValue); - - WizardDialog wizardDialog = new WizardDialog(shell, wizard); - wizardDialog.setBlockOnOpen(true); - wizardDialog.create(); - - int result = wizardDialog.open(); - - if (result == Window.OK) - { - String newPattern = wizard.getPattern(); - element.setAttribute(XSDConstants.VALUE_ATTRIBUTE, newPattern); - pattern.setLexicalValue(newPattern); - constraintsTableViewer.refresh(); - } - } - } - } - else if (e.widget == constraintsTableViewer.getTable()) - { - StructuredSelection selection = (StructuredSelection) constraintsTableViewer.getSelection(); - if (selection.getFirstElement() != null) - { - editButton.setEnabled(true); - deleteButton.setEnabled(true); - } - else - { - editButton.setEnabled(false); - deleteButton.setEnabled(false); - } - } - } - - public void widgetDefaultSelected(SelectionEvent e) - { - - } - - - public void setConstraintKind(int kind) - { - this.kind = kind; - constraintsTableViewer.setInput(input); - constraintsTableViewer.refresh(); - } - - public void doModify(Object element, String property, Object value) - { - if (element instanceof TableItem && (value != null)) - { - TableItem item = (TableItem) element; - - if (item.getData() instanceof XSDPatternFacet) - { - XSDPatternFacet patternFacet = (XSDPatternFacet) item.getData(); - patternFacet.setLexicalValue((String) value); - - item.setData(patternFacet); - item.setText((String) value); - } - else if (item.getData() instanceof XSDEnumerationFacet) - { - XSDEnumerationFacet enumFacet = (XSDEnumerationFacet) item.getData(); - SetXSDFacetValueCommand command = new SetXSDFacetValueCommand(Messages._UI_ACTION_SET_ENUMERATION_VALUE, enumFacet); - command.setValue((String) value); - commandStack.execute(command); - item.setData(enumFacet); - item.setText((String) value); - } - } - } - - public Object doGetValue(Object element, String property) - { - if (element instanceof XSDPatternFacet) - { - XSDPatternFacet patternFacet = (XSDPatternFacet) element; - String value = patternFacet.getLexicalValue(); - if (value == null) - value = ""; //$NON-NLS-1$ - return value; - } - else if (element instanceof XSDEnumerationFacet) - { - XSDEnumerationFacet enumFacet = (XSDEnumerationFacet) element; - String value = enumFacet.getLexicalValue(); - if (value == null) - value = ""; //$NON-NLS-1$ - return value; - } - - return ""; //$NON-NLS-1$ - } - - class ConstraintsTableViewer extends NavigableTableViewer implements ICellModifier - { - protected String[] columnProperties = { Messages._UI_LABEL_PATTERN }; - - protected CellEditor[] cellEditors; - - Table table; - - public ConstraintsTableViewer(Table table) - { - super(table); - table = getTable(); - - table.setLinesVisible(true); - - setContentProvider(new ConstraintsContentProvider()); - setLabelProvider(new ConstraintsTableLabelProvider()); - setColumnProperties(columnProperties); - - setCellModifier(this); - - TableColumn column = new TableColumn(table, SWT.NONE, 0); - column.setText(columnProperties[0]); - column.setAlignment(SWT.LEFT); - column.setResizable(true); - - cellEditors = new CellEditor[1]; - - TableLayout layout = new TableLayout(); - ColumnWeightData data = new ColumnWeightData(100); - - layout.addColumnData(data); - cellEditors[0] = new TextCellEditor(table); - - getTable().setLayout(layout); - setCellEditors(cellEditors); - } - - public boolean canModify(Object element, String property) - { - return true; - } - - public void modify(Object element, String property, Object value) - { - doModify(element, property, value); - } - - public Object getValue(Object element, String property) - { - return doGetValue(element, property); - } - - } - - class ConstraintsContentProvider implements IStructuredContentProvider - { - public void inputChanged(Viewer viewer, Object oldInput, Object newInput) - { - } - - public java.lang.Object[] getElements(java.lang.Object inputElement) - { - java.util.List list = new ArrayList(); - if (inputElement instanceof XSDSimpleTypeDefinition) - { - XSDSimpleTypeDefinition st = (XSDSimpleTypeDefinition) inputElement; - boolean isDefined = false; - Iterator iter; - if (kind == PATTERN) - { - iter = st.getPatternFacets().iterator(); - } - else - { - iter = st.getEnumerationFacets().iterator(); - } - - while (iter.hasNext()) - { - XSDFacet facet = (XSDFacet) iter.next(); - isDefined = (facet.getRootContainer() == facetSection.xsdSchema); - } - - if (kind == PATTERN) - { - if (isDefined) - { - return st.getPatternFacets().toArray(); - } - } - else - { - if (isDefined) - { - return st.getEnumerationFacets().toArray(); - } - } - } - return list.toArray(); - } - - public void dispose() - { - } - } - - class ConstraintsTableLabelProvider extends LabelProvider implements ITableLabelProvider - { - public ConstraintsTableLabelProvider() - { - - } - - public Image getColumnImage(Object element, int columnIndex) - { - if (kind == PATTERN) - { - return XSDEditorPlugin.getXSDImage("icons/XSDSimplePattern.gif"); //$NON-NLS-1$ - } - else - { - return XSDEditorPlugin.getXSDImage("icons/XSDSimpleEnum.gif"); //$NON-NLS-1$ - } - } - - public String getColumnText(Object element, int columnIndex) - { - if (element instanceof XSDPatternFacet) - { - XSDPatternFacet pattern = (XSDPatternFacet) element; - String value = pattern.getLexicalValue(); - if (value == null) - value = ""; //$NON-NLS-1$ - return value; - } - else if (element instanceof XSDEnumerationFacet) - { - XSDEnumerationFacet enumFacet = (XSDEnumerationFacet) element; - String value = enumFacet.getLexicalValue(); - if (value == null) - value = ""; //$NON-NLS-1$ - return value; - } - return ""; //$NON-NLS-1$ - } - } - -} diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDActionManager.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDActionManager.java deleted file mode 100644 index b31fa6c429..0000000000 --- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDActionManager.java +++ /dev/null @@ -1,148 +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.common.properties.sections; - -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.commands.CommandStack; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel; -import org.eclipse.wst.xml.core.internal.contentmodel.CMAttributeDeclaration; -import org.eclipse.wst.xml.core.internal.contentmodel.CMDataType; -import org.eclipse.wst.xml.core.internal.contentmodel.CMElementDeclaration; -import org.eclipse.wst.xml.ui.internal.XMLUIMessages; -import org.eclipse.wst.xml.ui.internal.actions.EditAttributeAction; -import org.eclipse.wst.xml.ui.internal.contentoutline.XMLNodeActionManager; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; - -public class XSDActionManager extends XMLNodeActionManager { - - private CommandStack commandStack; - - public XSDActionManager(IStructuredModel model, Viewer viewer) { - super(model, viewer); - } - - public void setCommandStack(CommandStack commandStack) { - this.commandStack = commandStack; - } - - protected Action createAddCDataSectionAction(Node parent, int index) - { - return null; - } - - protected Action createAddPCDataAction(Node parent, CMDataType dataType, int index) { - return null; - } - - - protected void contributeAddDocumentChildActions(IMenuManager menu, Document document, int ic, int vc) { - } - - protected void contributeEditGrammarInformationActions(IMenuManager menu, Node node) { - } - - protected void contributePIAndCommentActions(IMenuManager menu, Document document, int index) { - } - - protected void contributePIAndCommentActions(IMenuManager menu, Element parentElement, CMElementDeclaration parentEd, int index) { - } - - protected void contributeTextNodeActions(IMenuManager menu, Element parentElement, CMElementDeclaration parentEd, int index) { - super.contributeTextNodeActions(menu, parentElement, parentEd, index); - } - - protected Action createAddAttributeAction(Element parent, CMAttributeDeclaration ad) { - Action action = null; - if (ad == null) { - action = new EditAttributeAction(this, parent, null, XMLUIMessages._UI_MENU_NEW_ATTRIBUTE, XMLUIMessages._UI_MENU_NEW_ATTRIBUTE_TITLE); //$NON-NLS-1$ //$NON-NLS-2$ - } else { - action = new AddNodeAction(ad, parent, -1); - } - - WrapperCommand command = new WrapperCommand(action, parent, ad); - WrapperAction wrapperAction = new WrapperAction(command); - return wrapperAction; - } - - class WrapperAction extends Action - { - WrapperCommand command; - - public WrapperAction(WrapperCommand command) - { - super(); - this.command = command; - } - - public String getText() - { - return command.getAction().getText(); - } - - public void run() - { - // Some editors may not use a command stack - if (commandStack != null) - { - commandStack.execute(command); - } - else - { - command.execute(); - } - } - } - - class WrapperCommand extends Command - { - Action action; - Element parent; - CMAttributeDeclaration ad; - public WrapperCommand(Action action, Element parent, CMAttributeDeclaration ad) - { - super(); - this.action = action; - this.parent = parent; - this.ad = ad; - } - - public String getLabel() - { - return action.getText(); - } - - public Action getAction() - { - return action; - } - - public void execute() - { - action.run(); - } - - public void undo() { - -// ((Element)parent).removeAttribute(ad.getAttrName()); - - getModel().getUndoManager().undo(); - - } - - - } - -} diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDFacetSectionFilter.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDFacetSectionFilter.java deleted file mode 100644 index bdc57c5a8d..0000000000 --- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDFacetSectionFilter.java +++ /dev/null @@ -1,42 +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.common.properties.sections; - -import org.eclipse.jface.viewers.IFilter; -import org.eclipse.xsd.XSDFeature; -import org.eclipse.xsd.XSDSchema; -import org.eclipse.xsd.XSDSimpleTypeDefinition; -import org.eclipse.xsd.XSDTypeDefinition; - -public class XSDFacetSectionFilter implements IFilter -{ - public boolean select(Object toTest) - { - if (toTest instanceof XSDFeature) - { - XSDTypeDefinition type = ((XSDFeature)toTest).getResolvedFeature().getType(); - if (type instanceof XSDSimpleTypeDefinition) - { - return true; - } - } - else if (toTest instanceof XSDSimpleTypeDefinition) - { - XSDSimpleTypeDefinition st = (XSDSimpleTypeDefinition)toTest; - if (st.eContainer() instanceof XSDSchema || - st.eContainer() instanceof XSDFeature) - { - return true; - } - } - return false; - } -} diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDTableTreeViewer.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDTableTreeViewer.java deleted file mode 100644 index 0b04e7b5aa..0000000000 --- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDTableTreeViewer.java +++ /dev/null @@ -1,126 +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.common.properties.sections; - -import org.eclipse.jface.action.IMenuListener; -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.action.MenuManager; -import org.eclipse.jface.action.Separator; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Menu; -import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument; -import org.eclipse.wst.xml.ui.internal.tabletree.XMLTableTreeContentProvider; -import org.eclipse.wst.xml.ui.internal.tabletree.XMLTableTreeViewer; -import org.w3c.dom.Element; - -public class XSDTableTreeViewer extends XMLTableTreeViewer -{ - - String filter = ""; //$NON-NLS-1$ - - class XSDActionMenuListener implements IMenuListener - { - public void menuAboutToShow(IMenuManager menuManager) - { - // used to disable NodeSelection listening while running NodeAction - // XSDActionManager nodeActionManager = new XSDActionManager(fModel, - // XSDTableTreeViewer.this); - // nodeActionManager.setCommandStack(commandStack); - // nodeActionManager.fillContextMenu(menuManager, getSelection()); - - // used to disable NodeSelection listening while running NodeAction - // XMLNodeActionManager nodeActionManager = new - // XMLNodeActionManager(((IDOMDocument) getInput()).getModel(), - // XMLTableTreeViewer.this) { - if (getInput() != null) - { - XSDActionManager nodeActionManager = new XSDActionManager(((IDOMDocument) (((Element) getInput()).getOwnerDocument())).getModel(), XSDTableTreeViewer.this); - // nodeActionManager.setCommandStack(commandStack); - nodeActionManager.fillContextMenu(menuManager, getSelection()); - } - - } - } - - public XSDTableTreeViewer(Composite parent) - { - super(parent); - // treeExtension.setCellModifier(null); - getTree().setLinesVisible(true); - - // treeExtension = new XMLTreeExtension(getTree()); - - // Reassign the content provider - XMLTableTreeContentProvider provider = new MyContentProvider(); - // provider.addViewer(this); - - setContentProvider(provider); - setLabelProvider(provider); - - // setViewerSelectionManager(new ViewerSelectionManagerImpl(null)); - } - - protected Object getRoot() - { - return super.getRoot(); - } - - public void setFilter(String filter) - { - this.filter = filter; - } - - protected void createContextMenu() - { - // TODO Verify if this is okay to override the MenuManager - MenuManager contextMenu = new MenuManager("#PopUp"); //$NON-NLS-1$ - contextMenu.add(new Separator("additions")); //$NON-NLS-1$ - contextMenu.setRemoveAllWhenShown(true); - - // This is the line we have to modify - contextMenu.addMenuListener(new XSDActionMenuListener()); - Menu menu = contextMenu.createContextMenu(getControl()); - getControl().setMenu(menu); - } - - boolean added = false; - - class MyContentProvider extends XMLTableTreeContentProvider - { - - // public Object[] getChildren(Object element) { - // - // if (!added) { - // if (element instanceof Element) { - // added = true; - // Element elem = (Element)element; - // if (elem instanceof INodeNotifier) { - // viewerNotifyingAdapterFactory.adapt((INodeNotifier) elem); - // } - // // return new Object[] {elem}; - // } - // } - // return super.getChildren(element); - // } - - public void inputChanged(Viewer viewer, Object oldInput, Object newInput) - { - added = false; - if (oldInput instanceof Element) - oldInput = ((Element) oldInput).getOwnerDocument(); - - if (newInput instanceof Element) - newInput = ((Element) newInput).getOwnerDocument(); - super.inputChanged(viewer, oldInput, newInput); - } - } -} diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/DOMExtensionDetailsContentProvider.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/DOMExtensionDetailsContentProvider.java deleted file mode 100644 index c759d927ee..0000000000 --- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/DOMExtensionDetailsContentProvider.java +++ /dev/null @@ -1,201 +0,0 @@ -package org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo; - -import java.text.Collator; -import java.util.Arrays; -import java.util.Collection; -import java.util.Comparator; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import org.eclipse.wst.xml.core.internal.contentmodel.CMAttributeDeclaration; -import org.eclipse.wst.xml.core.internal.contentmodel.CMElementDeclaration; -import org.eclipse.wst.xml.core.internal.contentmodel.modelquery.ModelQuery; -import org.eclipse.wst.xml.core.internal.modelquery.ModelQueryUtil; -import org.eclipse.wst.xml.ui.internal.tabletree.TreeContentHelper; -import org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo.custom.DefaultListNodeEditorConfiguration; -import org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo.custom.NodeCustomizationRegistry; -import org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo.custom.NodeEditorConfiguration; -import org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo.custom.NodeEditorProvider; -import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin; -import org.w3c.dom.Attr; -import org.w3c.dom.Element; -import org.w3c.dom.NamedNodeMap; - -public class DOMExtensionDetailsContentProvider implements ExtensionDetailsContentProvider -{ - private static final Object[] EMPTY_ARRAY = {}; - private static final String[] EMPTY_STRING_ARRAY = {}; - private static final String XMLNS = "xmlns"; //$NON-NLS - private static final String TEXT_NODE_KEY = "text()"; //$NON-NLS - - public Object[] getItems(Object input) - { - HashMap resultMap = new HashMap(); - if (input instanceof Element) - { - Element element = (Element) input; - - // here we compute items for the attributes that physically in the document - // - NamedNodeMap attributes = element.getAttributes(); - for (int i = 0; i < attributes.getLength(); i++) - { - Attr attr = (Attr) attributes.item(i); - if (!XMLNS.equals(attr.getName()) && !XMLNS.equals(attr.getPrefix())) //$NON-NLS-1$ //$NON-NLS-2$ - { - resultMap.put(attr.getName(), DOMExtensionItem.createItemForElementAttribute(element, attr)); - } - } - - // here we compute an item for the text node that is physically in the document - // - String textNodeValue = new TreeContentHelper().getNodeValue(element); - if (textNodeValue != null) - { - resultMap.put(TEXT_NODE_KEY, DOMExtensionItem.createItemForElementText(element)); - } - - ModelQuery modelQuery = ModelQueryUtil.getModelQuery(element.getOwnerDocument()); - if (modelQuery != null) - { - CMElementDeclaration ed = modelQuery.getCMElementDeclaration(element); - if (ed != null) - { - // here we compute items for the attributes that may be added to the document according to the grammar - // - List list = modelQuery.getAvailableContent(element, ed, ModelQuery.INCLUDE_ATTRIBUTES); - for (Iterator i = list.iterator(); i.hasNext(); ) - { - CMAttributeDeclaration ad = (CMAttributeDeclaration)i.next(); - if (ad != null && resultMap.get(ad.getNodeName()) == null) - { - resultMap.put(ad.getNodeName(), DOMExtensionItem.createItemForElementAttribute(element, ad)); - } - } - if (resultMap.get(TEXT_NODE_KEY) == null) - { - // here we compute an item for the text node that may be added to the document according to the grammar - // - int contentType = ed.getContentType(); - if (contentType == CMElementDeclaration.PCDATA || contentType == CMElementDeclaration.MIXED) - { - resultMap.put(TEXT_NODE_KEY, DOMExtensionItem.createItemForElementText(element)); - } - } - } - } - Collection collection = resultMap.values(); - // initialize the editor information for each item - // - for (Iterator i = collection.iterator(); i.hasNext();) - { - initPropertyEditorConfiguration((DOMExtensionItem) i.next()); - } - DOMExtensionItem[] items = new DOMExtensionItem[collection.size()]; - resultMap.values().toArray(items); - - // here we sort the list alphabetically - // - if (items.length > 0) - { - Comparator comparator = new Comparator() - { - public int compare(Object arg0, Object arg1) - { - DOMExtensionItem a = (DOMExtensionItem)arg0; - DOMExtensionItem b = (DOMExtensionItem)arg1; - - // begin special case to ensure 'text nodes' come last - if (a.isTextValue() && !b.isTextValue()) - { - return 1; - } - else if (b.isTextValue() && !a.isTextValue()) - { - return -1; - } - // end special case - else - { - return Collator.getInstance().compare(a.getName(), b.getName()); - } - } - }; - Arrays.sort(items, comparator); - } - return items; - } - else if (input instanceof Attr) - { - Attr attr = (Attr) input; - DOMExtensionItem item = DOMExtensionItem.createItemForAttributeText(attr.getOwnerElement(), attr); - DOMExtensionItem[] items = {item}; - return items; - } - return EMPTY_ARRAY; - } - - public String getName(Object item) - { - if (item instanceof DOMExtensionItem) - { - return ((DOMExtensionItem) item).getName(); - } - return ""; //$NON-NLS-1$ - } - - public String getValue(Object item) - { - if (item instanceof DOMExtensionItem) - { - return ((DOMExtensionItem) item).getValue(); - } - return ""; //$NON-NLS-1$ - } - - public String[] getPossibleValues(Object item) - { - if (item instanceof DOMExtensionItem) - { - return ((DOMExtensionItem) item).getPossibleValues(); - } - return EMPTY_STRING_ARRAY; - } - - protected void initPropertyEditorConfiguration(DOMExtensionItem item) - { - String namespace = item.getNamespace(); - String name = item.getName(); - String parentName = item.getParentName(); - NodeEditorConfiguration configuration = null; - if (namespace != null) - { - // TODO (cs) remove reference to XSDEditorPlugin... make generic - // perhaps push down the xml.ui ? - // - NodeCustomizationRegistry registry = XSDEditorPlugin.getDefault().getNodeCustomizationRegistry(); - NodeEditorProvider provider= registry.getNodeEditorProvider(namespace); - if (provider != null) - { - configuration = provider.getNodeEditorConfiguration(parentName, name); - if (configuration != null) - { - configuration.setParentNode(item.getParentNode()); - if (item.getNode() != null) - { - configuration.setNode(item.getNode()); - } - } - } - } - String[] values = item.getPossibleValues(); - if (values != null && values.length > 1) - { - configuration = new DefaultListNodeEditorConfiguration(values); - } - - // Note that it IS expected that the configaration may be null - // - item.setPropertyEditorConfiguration(configuration); - } -} diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/DOMExtensionItemEditManager.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/DOMExtensionItemEditManager.java deleted file mode 100644 index d069b8f838..0000000000 --- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/DOMExtensionItemEditManager.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Widget; - - -/** - * @deprecated - */ -public class DOMExtensionItemEditManager implements ExtensionItemEditManager -{ - public void handleEdit(Object item, Widget widget) - { - } - - public Control createCustomButtonControl(Composite composite, Object item) - { - Button button = new Button(composite, SWT.NONE); - button.setText("..."); //$NON-NLS-1$ - return button; - } - - public Control createCustomTextControl(Composite composite, Object item) - { - return null; - } - - public String getButtonControlStyle(Object object) - { - return ExtensionItemEditManager.STYLE_NONE; - } - - public String getTextControlStyle(Object object) - { - return ExtensionItemEditManager.STYLE_NONE; - } -} diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/DOMExtensionItemMenuListener.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/DOMExtensionItemMenuListener.java deleted file mode 100644 index 1c8bcf55d9..0000000000 --- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/DOMExtensionItemMenuListener.java +++ /dev/null @@ -1,117 +0,0 @@ -package org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo; - -import java.util.ArrayList; -import java.util.List; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.action.IMenuListener; -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel; -import org.eclipse.wst.xml.core.internal.contentmodel.CMElementDeclaration; -import org.eclipse.wst.xml.core.internal.contentmodel.modelquery.ModelQuery; -import org.eclipse.wst.xml.core.internal.document.ElementImpl; -import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument; -import org.eclipse.wst.xml.ui.internal.contentoutline.XMLNodeActionManager; -import org.w3c.dom.Element; -import org.w3c.dom.Node; - -public class DOMExtensionItemMenuListener implements IMenuListener -{ - TreeViewer treeViewer; - - public DOMExtensionItemMenuListener(TreeViewer treeViewer) - { - this.treeViewer = treeViewer; - } - - public void menuAboutToShow(IMenuManager manager) - { - manager.removeAll(); - ISelection selection = treeViewer.getSelection(); - if (selection instanceof IStructuredSelection) - { - IStructuredSelection structuredSelection = (IStructuredSelection) selection; - if (structuredSelection.getFirstElement() instanceof ElementImpl) - { - ElementImpl elementImpl = (ElementImpl) structuredSelection.getFirstElement(); - IDOMDocument domDocument = (IDOMDocument) elementImpl.getOwnerDocument(); - InternalNodeActionManager actionManager = new InternalNodeActionManager(domDocument.getModel(), treeViewer); - actionManager.fillContextMenu(manager, structuredSelection); - } - } - } - - - class InternalNodeActionManager extends XMLNodeActionManager - { - public InternalNodeActionManager(IStructuredModel model, Viewer viewer) - { - super(model, viewer); - } - - public void contributeActions(IMenuManager menu, List selection) - { - //menu.add(new Action("there"){}); - try - { - int editMode = modelQuery.getEditMode(); - int ic = ModelQuery.INCLUDE_CHILD_NODES; - int vc = (editMode == ModelQuery.EDIT_MODE_CONSTRAINED_STRICT) ? ModelQuery.VALIDITY_STRICT : ModelQuery.VALIDITY_NONE; - List implicitlySelectedNodeList = null; - - if (selection.size() == 1) - { - Node node = (Node) selection.get(0); - // contribute add child actions - contributeAddChildActions(menu, node, ic, vc); - } - if (selection.size() > 0) - { - implicitlySelectedNodeList = getSelectedNodes(selection, true); - // contribute delete actions - contributeDeleteActions(menu, implicitlySelectedNodeList, ic, vc); - } - } - catch(Exception e) - { - menu.add(new Action(e.getMessage()){}); - } - /* - if (selection.size() > 0) - { - // contribute replace actions - contributeReplaceActions(menu, implicitlySelectedNodeList, ic, vc); - }*/ - } - - protected void contributeAddChildActions(IMenuManager menu, Node node, int ic, int vc) - { - int nodeType = node.getNodeType(); - if (nodeType == Node.ELEMENT_NODE) - { - // 'Add Child...' and 'Add Attribute...' actions - // - Element element = (Element) node; - MyMenuManager newMenu = new MyMenuManager("New"){ - public boolean isVisible() { return true; } - };//$NON-NLS-1$ - newMenu.setVisible(true); - menu.add(newMenu); - - CMElementDeclaration ed = modelQuery.getCMElementDeclaration(element); - if (ed != null) - { - List modelQueryActionList = new ArrayList(); - // add insert child node actions - // - modelQueryActionList = new ArrayList(); - modelQuery.getInsertActions(element, ed, -1, ic, vc, modelQueryActionList); - addActionHelper(newMenu, modelQueryActionList); - } - } - } - } -} diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/DOMExtensionTreeContentProvider.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/DOMExtensionTreeContentProvider.java deleted file mode 100644 index 4f2d62c1c4..0000000000 --- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/DOMExtensionTreeContentProvider.java +++ /dev/null @@ -1,73 +0,0 @@ -package org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo; - -import java.util.ArrayList; -import java.util.Collections; -import org.eclipse.jface.viewers.ITreeContentProvider; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.wst.sse.core.internal.provisional.INodeAdapter; -import org.eclipse.wst.sse.core.internal.provisional.INodeNotifier; -import org.w3c.dom.Element; -import org.w3c.dom.Node; - -public class DOMExtensionTreeContentProvider implements ITreeContentProvider, INodeAdapter -{ - protected String facet; - protected Viewer viewer; - - public void inputChanged(Viewer viewer, Object oldInput, Object newInput) - { - this.viewer = viewer; - } - - public Object[] getChildren(Object parentElement) - { - if (parentElement instanceof Element) - { - Element element = (Element)parentElement; - ArrayList list = new ArrayList(); - for (Node node = element.getFirstChild(); node != null; node = node.getNextSibling()) - { - if (node.getNodeType() == Node.ELEMENT_NODE) - { - list.add(node); - } - } - return list.toArray(); - } - return Collections.EMPTY_LIST.toArray(); - } - - public boolean hasChildren(Object element) - { - Object[] children = getChildren(element); - return children.length > 0; - } - - public Object getParent(Object element) - { - return null; - } - - public java.lang.Object[] getElements(java.lang.Object inputElement) - { - return getChildren(inputElement); - } - - public void dispose() - { - } - - public void notifyChanged(INodeNotifier notifier, int eventType, Object changedFeature, Object oldValue, Object newValue, int pos) - { - if (viewer != null) - { - viewer.refresh(); - } - } - - public boolean isAdapterForType(Object type) - { - // this method is not used - return false; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/DOMExtensionTreeLabelProvider.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/DOMExtensionTreeLabelProvider.java deleted file mode 100644 index cec15bdeea..0000000000 --- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/DOMExtensionTreeLabelProvider.java +++ /dev/null @@ -1,56 +0,0 @@ -package org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo; - -import org.eclipse.jface.viewers.ILabelProvider; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.swt.graphics.Image; -import org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo.custom.NodeCustomizationRegistry; -import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin; -import org.w3c.dom.Attr; -import org.w3c.dom.Element; - -public class DOMExtensionTreeLabelProvider extends LabelProvider -{ - protected static final Image DEFAULT_ELEMENT_ICON = XSDEditorPlugin.getXSDImage("icons/XSDElement.gif"); //$NON-NLS-1$ - protected static final Image DEFAULT_ATTR_ICON = XSDEditorPlugin.getXSDImage("icons/XSDAttribute.gif"); //$NON-NLS-1$ - - public DOMExtensionTreeLabelProvider() - { - } - - public Image getImage(Object element) - { - NodeCustomizationRegistry registry = XSDEditorPlugin.getDefault().getNodeCustomizationRegistry(); - if (element instanceof Element) - { - Element domElement = (Element) element; - String namespace = domElement.getNamespaceURI(); - if (namespace != null) - { - ILabelProvider lp = registry.getLabelProvider(namespace); - if (lp != null) - { - Image img = lp.getImage(domElement); - if (img != null) - return img; - } - } - return DEFAULT_ELEMENT_ICON; - } - if (element instanceof Attr) - return DEFAULT_ATTR_ICON; - return null; - } - - public String getText(Object input) - { - if (input instanceof Element) - { - Element domElement = (Element) input; - return domElement.getLocalName(); - } - if ( input instanceof Attr){ - return ((Attr) input).getLocalName(); - } - return ""; //$NON-NLS-1$ - } -} diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/ExtensionDetailsContentProvider.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/ExtensionDetailsContentProvider.java deleted file mode 100644 index 254d105ce4..0000000000 --- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/ExtensionDetailsContentProvider.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo; - -public interface ExtensionDetailsContentProvider -{ - Object[] getItems(Object input); - String getName(Object item); - String getValue(Object item); - String[] getPossibleValues(Object item); -} diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/ExtensionDetailsViewer.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/ExtensionDetailsViewer.java deleted file mode 100644 index e352bf0d10..0000000000 --- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/ExtensionDetailsViewer.java +++ /dev/null @@ -1,269 +0,0 @@ -package org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo; - -import org.eclipse.draw2d.ColorConstants; -import org.eclipse.gef.commands.Command; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CCombo; -import org.eclipse.swt.events.FocusEvent; -import org.eclipse.swt.events.FocusListener; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; -import org.eclipse.swt.widgets.Widget; -import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory; -import org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo.custom.DialogNodeEditorConfiguration; -import org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo.custom.ListNodeEditorConfiguration; -import org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo.custom.NodeEditorConfiguration; - -public class ExtensionDetailsViewer extends Viewer -{ - private final static String ITEM_DATA = "ITEM_DATA"; //$NON-NLS-1$ - private final static String EDITOR_CONFIGURATION_DATA = "EDITOR_CONFIGURATION_DATA"; //$NON-NLS-1$ - - Composite control; - Composite composite; - ExtensionDetailsContentProvider contentProvider; - TabbedPropertySheetWidgetFactory widgetFactory; - InternalControlListener internalControlListener; - - public ExtensionDetailsViewer(Composite parent, TabbedPropertySheetWidgetFactory widgetFactory) - { - this.widgetFactory = widgetFactory; - control = widgetFactory.createComposite(parent); - internalControlListener = new InternalControlListener(); - control.setLayout(new GridLayout()); - } - public Control getControl() - { - return control; - } - - - public Object getInput() - { - // TODO Auto-generated method stub - return null; - } - - public ISelection getSelection() - { - // TODO Auto-generated method stub - return null; - } - - public void refresh() - { - Control[] children = composite.getChildren(); - for (int i = 0; i < children.length; i++) - { - Control control = children[i]; - if (control instanceof Text) - { - ExtensionItem item = (ExtensionItem)control.getData(ITEM_DATA); - String value = contentProvider.getValue(item); - ((Text)control).setText(value); - } - } - } - - private void createTextOrComboControl(ExtensionItem item, Composite composite) - { - Control control = null; - String value = contentProvider.getValue(item); - NodeEditorConfiguration editorConfiguration = item.getPropertyEditorConfiguration(); - - if (editorConfiguration != null && hasStyle(editorConfiguration, NodeEditorConfiguration.STYLE_COMBO)) - { - ListNodeEditorConfiguration configuration = (ListNodeEditorConfiguration)editorConfiguration; - CCombo combo = widgetFactory.createCCombo(composite); - combo.setText(value); - Object[] values = configuration.getValues(item); - LabelProvider labelProvider = configuration.getLabelProvider(); - for (int j = 0; j < values.length; j++) - { - Object o = values[j]; - String displayName = labelProvider != null ? - labelProvider.getText(o) : - o.toString(); - combo.add(displayName); - } - control = combo; - } - if (control == null) - { - Text text = widgetFactory.createText(composite,value); - control = text; - } - control.setData(ITEM_DATA, item); - control.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - control.addFocusListener(internalControlListener); - } - - private void createButtonControl(ExtensionItem item, Composite composite) - { - NodeEditorConfiguration editorConfiguration = item.getPropertyEditorConfiguration(); - if (editorConfiguration != null && hasStyle(editorConfiguration, NodeEditorConfiguration.STYLE_DIALOG)) - { - DialogNodeEditorConfiguration configuration = (DialogNodeEditorConfiguration)editorConfiguration; - Button button = new Button(composite, SWT.NONE); - GridData gridData = new GridData(); - gridData.heightHint = 17; - button.setLayoutData(gridData); - button.addSelectionListener(internalControlListener); - button.setData(ITEM_DATA, item); - button.setData(EDITOR_CONFIGURATION_DATA, configuration); - String text = configuration.getButonText(); - if (text != null) - { - button.setText(text); //$NON-NLS-1$ - } - button.setImage(configuration.getButtonImage()); - } - else - { - Control placeHolder = new Label(composite, SWT.NONE); - placeHolder.setVisible(false); - placeHolder.setEnabled(false); - placeHolder.setLayoutData(new GridData()); - } - } - - public void setInput(Object input) - { - // TODO (cs) add assertions - // - if (contentProvider == null) - return; - - if (composite != null) - {/* - for (Iterator i = controlsThatWeAreListeningTo.iterator(); i.hasNext(); ) - { - Control control = (Control)i.next(); - if (control != null) - { - control.removeFocusListener(internalFocusListener); - } - } */ - composite.dispose(); - } - - composite = widgetFactory.createComposite(control); - composite.setBackground(ColorConstants.white); - GridLayout gridLayout = new GridLayout(); - gridLayout.numColumns = 3; - composite.setLayout(gridLayout); - composite.setLayoutData(new GridData(GridData.FILL_BOTH)); - - Object[] items = contentProvider.getItems(input); - - for (int i = 0; i < items.length; i++) - { - ExtensionItem item = (ExtensionItem)items[i]; - String name = contentProvider.getName(item); - Label label = widgetFactory.createLabel(composite, name + ":"); //$NON-NLS-1$ - label.setLayoutData(new GridData()); - createTextOrComboControl(item, composite); - createButtonControl(item, composite); - } - control.layout(true); - } - - private boolean hasStyle(NodeEditorConfiguration configuration, int style) - { - return (configuration.getStyle() & style) != 0; - } - - - public void setSelection(ISelection selection, boolean reveal) - { - // TODO Auto-generated method stub - - } - public ExtensionDetailsContentProvider getContentProvider() - { - return contentProvider; - } - public void setContentProvider(ExtensionDetailsContentProvider contentProvider) - { - this.contentProvider = contentProvider; - } - - private void applyEdit(ExtensionItem item, Widget widget) - { - if (item != null) - { - String value = null; - if (widget instanceof Text) - { - Text text = (Text)widget; - value = text.getText(); - } - else if (widget instanceof CCombo) - { - CCombo combo = (CCombo)widget; - int index = combo.getSelectionIndex(); - if (index != -1) - { - value = combo.getItem(index); - } - } - if (value != null) - { - Command command = item.getUpdateValueCommand(value); - if (command != null) - { - // TODO (cs) add command stack handling stuff - command.execute(); - } - } - } - } - - class InternalControlListener implements FocusListener, SelectionListener - { - public void widgetSelected(SelectionEvent e) - { - // for button controls we handle selection events - // - Object item = e.widget.getData(EDITOR_CONFIGURATION_DATA); - if (item instanceof DialogNodeEditorConfiguration) - { - DialogNodeEditorConfiguration dialogNodeEditorConfiguration = (DialogNodeEditorConfiguration)item; - dialogNodeEditorConfiguration.invokeDialog(); - //applyEdit((ExtensionItem)item, e.widget); - } - } - - public void widgetDefaultSelected(SelectionEvent e) - { - // do nothing - } - - public void focusGained(FocusEvent e) - { - } - - public void focusLost(FocusEvent e) - { - // apply edits for text and combo box controls - // via the focusLost event - // TODO (cs) handle explict ENTER key - // - Object item = e.widget.getData(ITEM_DATA); - if (item instanceof ExtensionItem) - { - applyEdit((ExtensionItem)item, e.widget); - } - } - } -} diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/ExtensionItem.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/ExtensionItem.java deleted file mode 100644 index 2b4d880de3..0000000000 --- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/ExtensionItem.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo; - -import org.eclipse.gef.commands.Command; -import org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo.custom.NodeEditorConfiguration; - -public abstract class ExtensionItem -{ - NodeEditorConfiguration propertyEditorConfiguration; - - public NodeEditorConfiguration getPropertyEditorConfiguration() - { - return propertyEditorConfiguration; - } - - public void setPropertyEditorConfiguration(NodeEditorConfiguration propertyEditorConfiguration) - { - this.propertyEditorConfiguration = propertyEditorConfiguration; - } - - public abstract Command getUpdateValueCommand(String newValue); -} diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/ExtensionItemEditManager.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/ExtensionItemEditManager.java deleted file mode 100644 index 7c03187184..0000000000 --- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/ExtensionItemEditManager.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo; - -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Widget; - -/** - * @deprecated - */ -public interface ExtensionItemEditManager -{ - public final static String STYLE_NONE = "none"; //$NON-NLS-1$ - public final static String STYLE_TEXT = "text"; //$NON-NLS-1$ - public final static String STYLE_COMBO = "combo"; //$NON-NLS-1$ - public final static String STYLE_CUSTOM = "custom"; //$NON-NLS-1$ - - void handleEdit(Object item, Widget widget); - String getTextControlStyle(Object item); - String getButtonControlStyle(Object item); - Control createCustomTextControl(Composite composite, Object item); - Control createCustomButtonControl(Composite composite, Object item); -} diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/SelectFromCatalogDialog.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/SelectFromCatalogDialog.java deleted file mode 100644 index 1f2737a523..0000000000 --- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/SelectFromCatalogDialog.java +++ /dev/null @@ -1,212 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo; - -import org.eclipse.jface.dialogs.Dialog; -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.Viewer; -import org.eclipse.jface.viewers.ViewerFilter; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Group; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.wst.xml.core.internal.XMLCorePlugin; -import org.eclipse.wst.xml.core.internal.catalog.CatalogSet; -import org.eclipse.wst.xml.core.internal.catalog.provisional.ICatalog; -import org.eclipse.wst.xml.core.internal.catalog.provisional.ICatalogEntry; -import org.eclipse.wst.xml.core.internal.catalog.provisional.INextCatalog; -import org.eclipse.wst.xml.ui.internal.catalog.XMLCatalogEntriesView; -import org.eclipse.wst.xml.ui.internal.catalog.XMLCatalogEntryDetailsView; -import org.eclipse.wst.xml.ui.internal.catalog.XMLCatalogMessages; -import org.eclipse.wst.xml.ui.internal.catalog.XMLCatalogTreeViewer; - -public class SelectFromCatalogDialog extends Dialog -{ - - private ICatalog workingUserCatalog; - private ICatalog userCatalog; - private ICatalog defaultCatalog; - private XMLCatalogEntriesView catalogEntriesView; - private ICatalog systemCatalog; - - private String currentSelectionLocation; - private String currentSelectionNamespace; - - public SelectFromCatalogDialog(Shell parentShell) - { - super(parentShell); - - defaultCatalog = XMLCorePlugin.getDefault().getDefaultXMLCatalog(); - INextCatalog[] nextCatalogs = defaultCatalog.getNextCatalogs(); - for (int i = 0; i < nextCatalogs.length; i++) - { - INextCatalog catalog = nextCatalogs[i]; - ICatalog referencedCatalog = catalog.getReferencedCatalog(); - if (referencedCatalog != null) - { - if (XMLCorePlugin.SYSTEM_CATALOG_ID.equals(referencedCatalog.getId())) - { - systemCatalog = referencedCatalog; - } - else if (XMLCorePlugin.USER_CATALOG_ID.equals(referencedCatalog.getId())) - { - userCatalog = referencedCatalog; - } - } - } - } - - protected Control createDialogArea(Composite parent) - { - // we create a working copy of the 'User Settings' for the Catalog - // that we can modify - CatalogSet tempCatalogSet = new CatalogSet(); - workingUserCatalog = tempCatalogSet.lookupOrCreateCatalog("working", ""); //$NON-NLS-1$ //$NON-NLS-2$ - - // TODO: add entries from the nested catalogs as well - workingUserCatalog.addEntriesFromCatalog(userCatalog); - - Composite composite = new Composite(parent, SWT.NULL); - composite.setLayout(new GridLayout()); - GridData gridData = new GridData(GridData.FILL_BOTH); - gridData.heightHint = 500; - composite.setLayoutData(gridData); - createCatalogEntriesView(composite); - createCatalogDetailsView(composite); - - return composite; - } - - protected void createCatalogEntriesView(Composite parent) - { - Group group = new Group(parent, SWT.NONE); - group.setLayout(new GridLayout()); - GridData gridData = new GridData(GridData.FILL_BOTH); - gridData.widthHint = 370; - group.setLayoutData(gridData); - group.setText(XMLCatalogMessages.UI_LABEL_USER_ENTRIES); - group.setToolTipText(XMLCatalogMessages.UI_LABEL_USER_ENTRIES_TOOL_TIP); - - /* - * create a subclass of XMLCatalogEntriesView which suppresses - the - * creation of 'Add', 'Edit', 'Delete' buttons - any method involving the - * above buttons - */ - catalogEntriesView = new XMLCatalogEntriesView(group, workingUserCatalog, systemCatalog) - { - protected void createButtons(Composite parent) - { - } - - protected void updateWidgetEnabledState() - { - } - - }; - - // Only XML Schema entry is selectable - catalogEntriesView.setLayoutData(gridData); - XMLCatalogTreeViewer catalogTreeViewer = ((XMLCatalogTreeViewer) catalogEntriesView.getViewer()); - catalogTreeViewer.resetFilters(); - - catalogTreeViewer.addFilter(new XMLCatalogTableViewerFilter(new String[] { ".xsd" })); - } - - // Bug in the filter of the XML plugin, have to give a correct version here - // TODO: Waiting for the fix to be commited to XML plugin and - // be used by constellation - private class XMLCatalogTableViewerFilter extends ViewerFilter - { - private static final String W3_XMLSCHEMA_NAMESPACE = "http://www.w3.org/2001/"; - protected String[] extensions; - - public XMLCatalogTableViewerFilter(String[] extensions1) - { - this.extensions = extensions1; - } - - public boolean isFilterProperty(Object element, Object property) - { - return false; - } - - public boolean select(Viewer viewer, Object parent, Object element) - { - boolean result = false; - if (element instanceof ICatalogEntry) - { - ICatalogEntry catalogEntry = (ICatalogEntry) element; - for (int i = 0; i < extensions.length; i++) - { - // if the extension is correct and the namespace indicates - // that this entry is not the W3 XML Schema - if (catalogEntry.getURI().endsWith(extensions[i]) && !catalogEntry.getKey().startsWith(W3_XMLSCHEMA_NAMESPACE)) - { - result = true; - break; - } - } - } - else if (element.equals(XMLCatalogTreeViewer.PLUGIN_SPECIFIED_ENTRIES_OBJECT) || element.equals(XMLCatalogTreeViewer.USER_SPECIFIED_ENTRIES_OBJECT)) - { - return true; - } - return result; - } - } - - protected void createCatalogDetailsView(Composite parent) - { - Group detailsGroup = new Group(parent, SWT.NONE); - detailsGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - detailsGroup.setLayout(new GridLayout()); - detailsGroup.setText(XMLCatalogMessages.UI_LABEL_DETAILS); - final XMLCatalogEntryDetailsView detailsView = new XMLCatalogEntryDetailsView(detailsGroup); - ISelectionChangedListener listener = new ISelectionChangedListener() - { - public void selectionChanged(SelectionChangedEvent event) - { - ISelection selection = event.getSelection(); - Object selectedObject = (selection instanceof IStructuredSelection) ? ((IStructuredSelection) selection).getFirstElement() : null; - if (selectedObject instanceof ICatalogEntry) - { - ICatalogEntry entry = (ICatalogEntry) selectedObject; - detailsView.setCatalogElement(entry); - currentSelectionLocation = entry.getURI(); - currentSelectionNamespace = entry.getKey(); - } - else - { - detailsView.setCatalogElement((ICatalogEntry) null); - currentSelectionLocation = ""; - currentSelectionNamespace = ""; - } - } - }; - catalogEntriesView.getViewer().addSelectionChangedListener(listener); - } - - public String getCurrentSelectionLocation() - { - return currentSelectionLocation; - } - - public String getCurrentSelectionNamespace() - { - return currentSelectionNamespace; - } -} diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/custom/DefaultListNodeEditorConfiguration.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/custom/DefaultListNodeEditorConfiguration.java deleted file mode 100644 index ce45be897f..0000000000 --- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/custom/DefaultListNodeEditorConfiguration.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo.custom; - - -public class DefaultListNodeEditorConfiguration extends ListNodeEditorConfiguration -{ - private String[] values; - - public DefaultListNodeEditorConfiguration(String[] values) - { - this.values = values; - } - - public Object[] getValues(Object propertyObject) - { - return values; - } -} diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/custom/DialogNodeEditorConfiguration.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/custom/DialogNodeEditorConfiguration.java deleted file mode 100644 index 675c274729..0000000000 --- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/custom/DialogNodeEditorConfiguration.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo.custom; - -import org.eclipse.swt.graphics.Image; - -public abstract class DialogNodeEditorConfiguration extends NodeEditorConfiguration -{ - public int getStyle() - { - return STYLE_DIALOG; - } - - public String getButonText() - { - return null; - } - - public Image getButtonImage() - { - return null; - } - - public abstract void invokeDialog(); -} diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/custom/ListNodeEditorConfiguration.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/custom/ListNodeEditorConfiguration.java deleted file mode 100644 index 613396ee74..0000000000 --- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/custom/ListNodeEditorConfiguration.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo.custom; - -import org.eclipse.jface.viewers.LabelProvider; - -public abstract class ListNodeEditorConfiguration extends NodeEditorConfiguration -{ - private LabelProvider labelProvider; - - public LabelProvider getLabelProvider() - { - return labelProvider; - } - - public int getStyle() - { - return STYLE_COMBO; - } - - public void setLabelProvider(LabelProvider labelProvider) - { - this.labelProvider = labelProvider; - } - - public abstract Object[] getValues(Object propertyObject); -} diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/custom/NodeCustomizationRegistry.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/custom/NodeCustomizationRegistry.java deleted file mode 100644 index 1189a4a9a6..0000000000 --- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/custom/NodeCustomizationRegistry.java +++ /dev/null @@ -1,129 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo.custom; - -import java.util.HashMap; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.Platform; -import org.eclipse.jface.viewers.ILabelProvider; - -public class NodeCustomizationRegistry -{ - private static final String NAMESPACE = "namespace"; //$NON-NLS-1$ - private static final String LABEL_PROVIDER_CLASS_ATTRIBUTE_NAME = "labelProviderClass"; - private static final String NODE_EDITOR_PROVIDER_CLASS_ATTRIBUTE_NAME = "nodeEditorProviderClass"; //$NON-NLS-1$ - - - protected String extensionId; - protected HashMap map; - - public NodeCustomizationRegistry(String propertyEditorExtensionId) - { - extensionId = "org.eclipse.wst.xsd.ui.extensibilityNodeCustomizations";//propertyEditorExtensionId; - } - - private class Descriptor - { - IConfigurationElement configurationElement; - - NodeEditorProvider nodeEditorProvider; - boolean nodeEditorProviderFailedToLoad = false; - boolean labelProviderFailedToLoad = false; - - Descriptor(IConfigurationElement element) - { - this.configurationElement = element; - } - - NodeEditorProvider lookupOrCreateNodeEditorProvider() - { - if (nodeEditorProvider == null && !nodeEditorProviderFailedToLoad) - { - try - { - nodeEditorProvider = (NodeEditorProvider)configurationElement.createExecutableExtension(NODE_EDITOR_PROVIDER_CLASS_ATTRIBUTE_NAME); - } - catch (Exception e) - { - nodeEditorProviderFailedToLoad = true; - } - } - return nodeEditorProvider; - } - - ILabelProvider createLabelProvider() - { - if (!labelProviderFailedToLoad) - { - try - { - return (ILabelProvider)configurationElement.createExecutableExtension(LABEL_PROVIDER_CLASS_ATTRIBUTE_NAME); - } - catch (Exception e) - { - labelProviderFailedToLoad = true; - } - } - return null; - } - } - - - private HashMap initMap() - { - HashMap theMap = new HashMap(); - IConfigurationElement[] extensions = Platform.getExtensionRegistry().getConfigurationElementsFor("org.eclipse.wst.xsd.ui.extensibilityNodeCustomizations"); - for (int i = 0; i < extensions.length; i++) - { - IConfigurationElement configurationElement = extensions[i]; - String namespace = configurationElement.getAttribute(NAMESPACE); - if (namespace != null) - { - theMap.put(namespace, new Descriptor(configurationElement)); - } - } - return theMap; - } - - private Descriptor getDescriptor(String namespace) - { - map = null; - if (namespace != null) - { - if (map == null) - { - map = initMap(); - } - return (Descriptor)map.get(namespace); - } - return null; - } - - public NodeEditorProvider getNodeEditorProvider(String namespace) - { - Descriptor descriptor = getDescriptor(namespace); - if (descriptor != null) - { - return descriptor.lookupOrCreateNodeEditorProvider(); - } - return null; - } - - public ILabelProvider getLabelProvider(String namespace) - { - Descriptor descriptor = getDescriptor(namespace); - if (descriptor != null) - { - return descriptor.createLabelProvider(); - } - return null; - } -} diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/custom/NodeEditorConfiguration.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/custom/NodeEditorConfiguration.java deleted file mode 100644 index 114565b8a6..0000000000 --- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/custom/NodeEditorConfiguration.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo.custom; - -import org.w3c.dom.Node; - -public abstract class NodeEditorConfiguration -{ - public final static int STYLE_NONE = 0; - public final static int STYLE_TEXT = 1; - public final static int STYLE_COMBO = 2; - public final static int STYLE_DIALOG = 4; - - public abstract int getStyle(); - - private Node node; - private Node parentNode; - - public Node getNode() - { - return node; - } - public void setNode(Node node) - { - this.node = node; - } - public Node getParentNode() - { - return parentNode; - } - public void setParentNode(Node parentNode) - { - this.parentNode = parentNode; - } -} diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/custom/NodeEditorProvider.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/custom/NodeEditorProvider.java deleted file mode 100644 index f34bcfac31..0000000000 --- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/custom/NodeEditorProvider.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo.custom; - - -public abstract class NodeEditorProvider -{ - public abstract NodeEditorConfiguration getNodeEditorConfiguration(String parentName, String nodeName); - //public abstract NodeEditorConfiguration getNodeEditorConfiguration(Node node); -} diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/util/Messages.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/util/Messages.java deleted file mode 100644 index b91c7784c7..0000000000 --- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/util/Messages.java +++ /dev/null @@ -1,113 +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.common.util; - -import org.eclipse.osgi.util.NLS; - -public class Messages extends NLS -{ - static - { - NLS.initializeMessages("org.eclipse.wst.xsd.ui.internal.common.util.messages", Messages.class); //$NON-NLS-1$ - } - - public Messages() - { - super(); - } - - public static String _UI_ACTION_OPEN_IN_NEW_EDITOR; - public static String _UI_ACTION_ADD_ATTRIBUTE_GROUP; - public static String _UI_ACTION_ADD_ATTRIBUTE_GROUP_REF; - public static String _UI_ACTION_ADD_ATTRIBUTE_GROUP_DEFINITION; - public static String _UI_ACTION_ADD_GROUP_REF; - public static String _UI_ACTION_ADD_GROUP; - public static String _UI_ACTION_DELETE; - public static String _UI_ACTION_ADD_COMPLEX_TYPE; - public static String _UI_ACTION_ADD_ATTRIBUTE; - public static String _UI_ACTION_ADD_SIMPLE_TYPE; - public static String _UI_ACTION_UPDATE_ELEMENT_REFERENCE; - public static String _UI_LABEL_NO_ITEMS_SELECTED; - public static String _UI_ACTION_ADD; - public static String _UI_ACTION_ADD_WITH_DOTS; - public static String _UI_ACTION_EDIT_WITH_DOTS; - public static String _UI_ACTION_CHANGE_PATTERN; - public static String _UI_ACTION_ADD_ENUMERATION; - public static String _UI_ACTION_ADD_PATTERN; - public static String _UI_ACTION_ADD_ENUMERATIONS; - public static String _UI_ACTION_DELETE_CONSTRAINTS; - public static String _UI_ACTION_DELETE_PATTERN; - public static String _UI_ACTION_DELETE_ENUMERATION; - public static String _UI_ACTION_SET_ENUMERATION_VALUE; - public static String _UI_LABEL_PATTERN; - public static String _UI_ACTION_CHANGE_MAXIMUM_OCCURRENCE; - public static String _UI_ERROR_INVALID_VALUE_FOR_MAXIMUM_OCCURRENCE; - public static String _UI_ACTION_CHANGE_MINIMUM_OCCURRENCE; - public static String _UI_ACTION_ADD_APPINFO_ELEMENT; - public static String _UI_ACTION_ADD_APPINFO_ATTRIBUTE; - public static String _UI_ACTION_DELETE_APPINFO_ELEMENT; - public static String _UI_ACTION_DELETE_APPINFO_ATTRIBUTE; - public static String _UI_ACTION_CHANGE_CONTENT_MODEL; - public static String _UI_ACTION_RENAME; - public static String _UI_ERROR_INVALID_NAME; - public static String _UI_LABEL_NAME; - public static String _UI_LABEL_REFERENCE; - public static String _UI_ACTION_UPDATE_MAXIMUM_OCCURRENCE; - public static String _UI_ACTION_UPDATE_MINIMUM_OCCURRENCE; - public static String _UI_LABEL_READONLY; - public static String _UI_LABEL_INCLUSIVE; - public static String _UI_LABEL_COLLAPSE_WHITESPACE; - public static String _UI_LABEL_SPECIFIC_CONSTRAINT_VALUES; - public static String _UI_LABEL_RESTRICT_VALUES_BY; - public static String _UI_LABEL_ENUMERATIONS; - public static String _UI_LABEL_PATTERNS; - public static String _UI_LABEL_MINIMUM_LENGTH; - public static String _UI_LABEL_MAXIMUM_LENGTH; - public static String _UI_LABEL_CONSTRAINTS_ON_LENGTH_OF; - public static String _UI_LABEL_CONSTRAINTS_ON_VALUE_OF; - public static String _UI_LABEL_MINIMUM_VALUE; - public static String _UI_LABEL_MAXIMUM_VALUE; - public static String _UI_LABEL_CONTRAINTS_ON; - public static String _UI_LABEL_TYPE; - public static String _UI_ACTION_CONSTRAIN_LENGTH; - public static String _UI_ACTION_UPDATE_BOUNDS; - public static String _UI_ACTION_COLLAPSE_WHITESPACE; - public static String _UI_LABEL_BASE; - public static String _UI_ERROR_INVALID_FILE; - public static String _UI_LABEL_EXTENSIONS; - public static String _UI_ACTION_ADD_EXTENSION_COMPONENT; - public static String _UI_ACTION_DELETE_EXTENSION_COMPONENT; - public static String _UI_LABEL_UP; - public static String _UI_LABEL_DOWN; - public static String _UI_LABEL_EXTENSION_DETAILS; - public static String _UI_ACTION_ADD_DOCUMENTATION; - public static String _UI_ACTION_ADD_EXTENSION_COMPONENTS; - public static String _UI_LABEL_EXTENSION_CATEGORIES; - public static String _UI_LABEL_ADD_WITH_DOTS; - public static String _UI_LABEL_DELETE; - public static String _UI_LABEL_EDIT; - public static String _UI_LABEL_AVAILABLE_COMPONENTS_TO_ADD; - public static String _UI_LABEL_EDIT_CATEGORY; - public static String _UI_ERROR_INVALID_CATEGORY; - public static String _UI_ERROR_FILE_CANNOT_BE_PARSED; - public static String _UI_ERROR_VALIDATE_THE_FILE; - public static String _UI_LABEL_SCHEMA; - public static String _UI_LABEL_ADD_CATEGORY; - public static String _UI_ERROR_NAME_ALREADY_USED; - public static String _UI_ACTION_BROWSE_WORKSPACE; - public static String _UI_LABEL_SELECT_XSD_FILE; - public static String _UI_DESCRIPTION_CHOOSE_XSD_FILE; - public static String _UI_ACTION_BROWSE_CATALOG; - public static String _UI_ACTION_ADD_ANY_ELEMENT; - public static String _UI_ACTION_ADD_ANY_ATTRIBUTE; - public static String _UI_ACTION_SET_BASE_TYPE; - public static String _UI_TOOLTIP_RENAME_REFACTOR; -} diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/util/messages.properties b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/util/messages.properties deleted file mode 100644 index 7dc29a6523..0000000000 --- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/util/messages.properties +++ /dev/null @@ -1,96 +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 -############################################################################### -_UI_ACTION_OPEN_IN_NEW_EDITOR=Open In New Editor -_UI_ACTION_DELETE_CONSTRAINTS=Delete Constraints -_UI_ACTION_DELETE_ENUMERATION=Delete Enumeration -_UI_ACTION_DELETE_APPINFO_ELEMENT=Delete AppInfo Element -_UI_ACTION_DELETE_APPINFO_ATTRIBUTE=Delete AppInfo Attribute -_UI_ACTION_DELETE_EXTENSION_COMPONENT=Delete Extension Component -_UI_ACTION_ADD_ATTRIBUTE_GROUP=Add Attribute Group -_UI_ACTION_ADD_APPINFO_ELEMENT=Add AppInfo Element -_UI_ACTION_ADD_ATTRIBUTE=Add Attribute -_UI_ACTION_ADD_GROUP_REF=Add Group Ref -_UI_ACTION_ADD_ANY_ELEMENT=Add An&y -_UI_ACTION_ADD_ANY_ATTRIBUTE=Add Any Attribute -_UI_ACTION_ADD_WITH_DOTS=Add... -_UI_ACTION_UPDATE_BOUNDS=Update bounds -_UI_ACTION_ADD_COMPLEX_TYPE=Add Complex Type -_UI_ACTION_ADD_ENUMERATIONS=Add Enumerations -_UI_ACTION_ADD_DOCUMENTATION=Add Documentation -_UI_ACTION_CONSTRAIN_LENGTH=Constrain length -_UI_ACTION_BROWSE_WORKSPACE=Workspace -_UI_LABEL_NO_ITEMS_SELECTED=No items selected -_UI_LABEL_EXTENSION_DETAILS=Extension Details -_UI_LABEL_EXTENSION_CATEGORIES=Extension Categories: -_UI_LABEL_COLLAPSE_WHITESPACE=Collapse whitespace -_UI_LABEL_RESTRICT_VALUES_BY=Restrict values by: -_UI_LABEL_MINIMUM_LENGTH=Minimum length: -_UI_LABEL_MAXIMUM_LENGTH=Maximum length: -_UI_LABEL_SELECT_XSD_FILE=Select XSD file -_UI_LABEL_CONSTRAINTS_ON_VALUE_OF=Constraints on value of -_UI_ACTION_ADD_SIMPLE_TYPE=Add Simple Type -_UI_ACTION_EDIT_WITH_DOTS=Edit... -_UI_ACTION_CHANGE_PATTERN=Change pattern -_UI_ACTION_ADD_ENUMERATION=Add Enumeration -_UI_ACTION_DELETE_PATTERN=Delete Pattern -_UI_ACTION_BROWSE_CATALOG=Catalog -_UI_ACTION_ADD_GROUP=Add Group -_UI_ACTION_ADD_PATTERN=Add pattern -_UI_ACTION_SET_BASE_TYPE=Set Base Type -_UI_ERROR_INVALID_NAME=Invalid name -_UI_ERROR_INVALID_FILE=Invalid file -_UI_ERROR_INVALID_CATEGORY=Invalid Category -_UI_ACTION_DELETE=Delete -_UI_ACTION_ADD=Add -_UI_ACTION_RENAME=Rename -_UI_LABEL_PATTERN=Pattern -_UI_LABEL_PATTERNS=Patterns -_UI_LABEL_NAME=Name: -_UI_LABEL_TYPE=Type: -_UI_LABEL_BASE=Base -_UI_LABEL_UP=Up -_UI_LABEL_DOWN=Down -_UI_LABEL_DELETE=Delete -_UI_LABEL_SCHEMA=Schema: -_UI_LABEL_EDIT=Edit -_UI_LABEL_REFERENCE=Reference: -_UI_LABEL_READONLY=ReadOnly -_UI_LABEL_INCLUSIVE=Inclusive -_UI_LABEL_ENUMERATIONS=Enumerations -_UI_LABEL_EXTENSIONS=Extensions -_UI_LABEL_MINIMUM_VALUE=Minimum value: -_UI_LABEL_MAXIMUM_VALUE=Maximum value: -_UI_LABEL_CONTRAINTS_ON=Constraints on -_UI_LABEL_ADD_WITH_DOTS=Add... -_UI_LABEL_ADD_CATEGORY=Add Category -_UI_LABEL_EDIT_CATEGORY=Edit Category -_UI_ACTION_ADD_ATTRIBUTE_GROUP_REF=Add Attribute Group Ref -_UI_ACTION_ADD_EXTENSION_COMPONENT=Add Extension Component -_UI_ACTION_ADD_EXTENSION_COMPONENTS=Add Extension Components -_UI_LABEL_CONSTRAINTS_ON_LENGTH_OF=Constraints on length of -_UI_ACTION_ADD_APPINFO_ATTRIBUTE=Add AppInfo Attribute -_UI_ACTION_SET_ENUMERATION_VALUE=Set Enumeration Value -_UI_ACTION_UPDATE_ELEMENT_REFERENCE=Update Element Reference -_UI_ACTION_UPDATE_MAXIMUM_OCCURRENCE=Update Maximum Occurrence -_UI_ACTION_UPDATE_MINIMUM_OCCURRENCE=Update Minimum Occurrence -_UI_ACTION_CHANGE_MAXIMUM_OCCURRENCE=Change Maximum Occurrence -_UI_ACTION_CHANGE_MINIMUM_OCCURRENCE=Change Minimum Occurrence -_UI_LABEL_SPECIFIC_CONSTRAINT_VALUES=Specific constraint values -_UI_LABEL_AVAILABLE_COMPONENTS_TO_ADD=Available components to Add: -_UI_ACTION_CHANGE_CONTENT_MODEL=Change Content Model -_UI_ERROR_FILE_CANNOT_BE_PARSED=The xsd file of the selected category cannot be parsed. -_UI_DESCRIPTION_CHOOSE_XSD_FILE=Choose an XSD file containing schema for your extensible components -_UI_ERROR_VALIDATE_THE_FILE=Please validate the file. -_UI_ERROR_NAME_ALREADY_USED=The name is already being used. -_UI_ACTION_COLLAPSE_WHITESPACE=Collapse whitespace -_UI_ACTION_ADD_ATTRIBUTE_GROUP_DEFINITION=Add Attribute Group Definition -_UI_ERROR_INVALID_VALUE_FOR_MAXIMUM_OCCURRENCE=Invalid value for maximum occurrence -_UI_TOOLTIP_RENAME_REFACTOR=Click here to invoke the Rename refactoring. |