Skip to main content

This CGIT instance is deprecated, and repositories have been moved to Gitlab or Github. See the repository descriptions for specific locations.

summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornitind2005-11-19 23:07:36 +0000
committernitind2005-11-19 23:07:36 +0000
commit10ab9433209134759cd80cd8e4521f654be80390 (patch)
tree14cebe0f703a103de8915b1b6010e1a8376a1b02 /bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/commands/SetTypeCommand.java
parentc040dc54a41a25b2d69976e2890c668ea891d9fd (diff)
downloadwebtools.sourceediting-20051120_2000.tar.gz
webtools.sourceediting-20051120_2000.tar.xz
webtools.sourceediting-20051120_2000.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.java93
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;
- }
-
-}

Back to the top