diff options
author | nitind | 2005-11-19 23:07:36 +0000 |
---|---|---|
committer | nitind | 2005-11-19 23:07:36 +0000 |
commit | 10ab9433209134759cd80cd8e4521f654be80390 (patch) | |
tree | 14cebe0f703a103de8915b1b6010e1a8376a1b02 /bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/commands/SetTypeCommand.java | |
parent | c040dc54a41a25b2d69976e2890c668ea891d9fd (diff) | |
download | webtools.sourceediting-10ab9433209134759cd80cd8e4521f654be80390.tar.gz webtools.sourceediting-10ab9433209134759cd80cd8e4521f654be80390.tar.xz webtools.sourceediting-10ab9433209134759cd80cd8e4521f654be80390.zip |
This commit was manufactured by cvs2svn to create tag 'v20051120_2000'.v20051120_2000
Diffstat (limited to 'bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/commands/SetTypeCommand.java')
-rw-r--r-- | bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/commands/SetTypeCommand.java | 93 |
1 files changed, 0 insertions, 93 deletions
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/commands/SetTypeCommand.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/commands/SetTypeCommand.java deleted file mode 100644 index c736d4591d..0000000000 --- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/commands/SetTypeCommand.java +++ /dev/null @@ -1,93 +0,0 @@ -package org.eclipse.wst.xsd.ui.internal.commands; - -import org.eclipse.core.resources.IFile; -import org.eclipse.jface.window.Window; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IFileEditorInput; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.wst.xsd.ui.internal.XSDEditorPlugin; -import org.eclipse.wst.xsd.ui.internal.dialogs.types.xsd.XSDComponentSelectionDialog; -import org.eclipse.wst.xsd.ui.internal.dialogs.types.xsd.XSDComponentSelectionProvider; -import org.eclipse.wst.xsd.ui.internal.dialogs.types.xsd.XSDSetTypeHelper; -import org.eclipse.xsd.XSDCompositor; -import org.eclipse.xsd.XSDConcreteComponent; -import org.eclipse.xsd.XSDElementDeclaration; -import org.eclipse.xsd.XSDSchema; -import org.eclipse.xsd.XSDSimpleTypeDefinition; -import org.eclipse.xsd.util.XSDConstants; - -public class SetTypeCommand extends AbstractCommand -{ - protected int typeKind = XSDConstants.COMPLEXTYPE_ELEMENT; - - public SetTypeCommand(XSDConcreteComponent parent) - { - super(parent); - } - - public void setTypeKind(int type) - { - this.typeKind = type; - } - - public void run() - { - XSDConcreteComponent parent = getParent(); - if (parent instanceof XSDElementDeclaration) - { - XSDElementDeclaration element = (XSDElementDeclaration)parent; - XSDSchema schema = element.getSchema(); - if (typeKind == XSDConstants.COMPLEXTYPE_ELEMENT) - { - AddModelGroupCommand sequenceCommand = new AddModelGroupCommand(element, XSDCompositor.SEQUENCE_LITERAL); - sequenceCommand.run(); - } - else if (typeKind == XSDConstants.SIMPLETYPE_ELEMENT) - { - AddSimpleTypeDefinitionCommand stCommand = new AddSimpleTypeDefinitionCommand(element, null); - stCommand.run(); - XSDSimpleTypeDefinition st = (XSDSimpleTypeDefinition)stCommand.getModelObject(); - XSDSimpleTypeDefinition base = schema.resolveSimpleTypeDefinition(schema.getSchemaForSchemaNamespace(), "string"); - st.setBaseTypeDefinition(base); - } - else - { - Shell shell = Display.getCurrent().getActiveShell(); - IFile currentIFile = ((IFileEditorInput)getActiveEditor().getEditorInput()).getFile(); - - XSDComponentSelectionProvider provider = new XSDComponentSelectionProvider(currentIFile, schema); - XSDComponentSelectionDialog dialog = new XSDComponentSelectionDialog(shell, XSDEditorPlugin.getXSDString("_UI_LABEL_SET_TYPE"), provider); - provider.setDialog(dialog); - - dialog.setBlockOnOpen(true); - dialog.create(); - - if (dialog.open() == Window.OK) { - XSDSetTypeHelper helper = new XSDSetTypeHelper(currentIFile, schema); - helper.setType(element.getElement(), "type", dialog.getSelection()); - } - } - formatChild(element.getElement()); - } - - } - - private IEditorPart getActiveEditor() - { - IWorkbench workbench = XSDEditorPlugin.getPlugin().getWorkbench(); - IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow(); - IEditorPart editorPart = workbenchWindow.getActivePage().getActiveEditor(); -// IEditorPart editorPart = part.getSite().getWorkbenchWindow().getActivePage().getActiveEditor(); - - return editorPart; - } - - protected boolean adopt(XSDConcreteComponent model) - { - return false; - } - -} |