diff options
author | nitind | 2008-10-22 03:40:52 +0000 |
---|---|---|
committer | nitind | 2008-10-22 03:40:52 +0000 |
commit | 4878c62d9d3ce454897379c8d2bf133e9ec32b68 (patch) | |
tree | b62ad063e449deceaf21e6a239f99d8b702ce09e /bundles/org.eclipse.wst.dtd.ui | |
parent | 54a3d563c583a3766f9e3d11d3a5d2109877de2a (diff) | |
download | webtools.sourceediting-200810220345.tar.gz webtools.sourceediting-200810220345.tar.xz webtools.sourceediting-200810220345.zip |
This commit was manufactured by cvs2svn to create tag 'v200810220345'.v200810220345
Diffstat (limited to 'bundles/org.eclipse.wst.dtd.ui')
119 files changed, 0 insertions, 9860 deletions
diff --git a/bundles/org.eclipse.wst.dtd.ui/.classpath b/bundles/org.eclipse.wst.dtd.ui/.classpath deleted file mode 100644 index 95e5f5e6c3..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/.classpath +++ /dev/null @@ -1,12 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry kind="src" path="src"/> - <classpathentry kind="src" path="src-properties"/> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/> - <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"> - <accessrules> - <accessrule kind="accessible" pattern="org/eclipse/wst/**"/> - </accessrules> - </classpathentry> - <classpathentry kind="output" path="bin"/> -</classpath> diff --git a/bundles/org.eclipse.wst.dtd.ui/.cvsignore b/bundles/org.eclipse.wst.dtd.ui/.cvsignore deleted file mode 100644 index 4d45660218..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/.cvsignore +++ /dev/null @@ -1,8 +0,0 @@ -bin -runtime -dtdui.jar -*.zip -build.xml -temp.folder -@dot -javaCompiler...args diff --git a/bundles/org.eclipse.wst.dtd.ui/.options b/bundles/org.eclipse.wst.dtd.ui/.options deleted file mode 100644 index 35173eb372..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/.options +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.wst.dtd.ui/projectionperf=false diff --git a/bundles/org.eclipse.wst.dtd.ui/.project b/bundles/org.eclipse.wst.dtd.ui/.project deleted file mode 100644 index 16b209c4e8..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/.project +++ /dev/null @@ -1,26 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>org.eclipse.wst.dtd.ui</name> - <comment></comment> - <buildSpec> - <buildCommand> - <name>org.eclipse.jdt.core.javabuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.ManifestBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.SchemaBuilder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.pde.PluginNature</nature> - <nature>org.eclipse.jdt.core.javanature</nature> - </natures> -</projectDescription> diff --git a/bundles/org.eclipse.wst.dtd.ui/.settings/org.eclipse.core.resources.prefs b/bundles/org.eclipse.wst.dtd.ui/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index afa5c91352..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,3 +0,0 @@ -#Tue Apr 04 03:36:32 EDT 2006 -eclipse.preferences.version=1 -encoding/<project>=ISO-8859-1 diff --git a/bundles/org.eclipse.wst.dtd.ui/.settings/org.eclipse.core.runtime.prefs b/bundles/org.eclipse.wst.dtd.ui/.settings/org.eclipse.core.runtime.prefs deleted file mode 100644 index 7ec5750225..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/.settings/org.eclipse.core.runtime.prefs +++ /dev/null @@ -1,3 +0,0 @@ -#Mon Apr 17 01:48:39 EDT 2006 -eclipse.preferences.version=1 -line.separator=\r\n diff --git a/bundles/org.eclipse.wst.dtd.ui/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.wst.dtd.ui/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 4792166435..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,79 +0,0 @@ -#Sat Mar 24 02:57:35 EDT 2007 -eclipse.preferences.version=1 -org.eclipse.jdt.core.builder.cleanOutputFolder=clean -org.eclipse.jdt.core.builder.duplicateResourceTask=warning -org.eclipse.jdt.core.builder.invalidClasspath=ignore -org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch -org.eclipse.jdt.core.circularClasspath=error -org.eclipse.jdt.core.classpath.exclusionPatterns=enabled -org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.4 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.doc.comment.support=enabled -org.eclipse.jdt.core.compiler.maxProblemPerUnit=100 -org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning -org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning -org.eclipse.jdt.core.compiler.problem.autoboxing=ignore -org.eclipse.jdt.core.compiler.problem.deprecation=ignore -org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled -org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled -org.eclipse.jdt.core.compiler.problem.discouragedReference=warning -org.eclipse.jdt.core.compiler.problem.emptyStatement=warning -org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning -org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore -org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore -org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=error -org.eclipse.jdt.core.compiler.problem.forbiddenReference=error -org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning -org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning -org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore -org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=error -org.eclipse.jdt.core.compiler.problem.invalidJavadoc=ignore -org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=enabled -org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled -org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private -org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore -org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error -org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore -org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore -org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=enabled -org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public -org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore -org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=enabled -org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=private -org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore -org.eclipse.jdt.core.compiler.problem.missingSerialVersion=error -org.eclipse.jdt.core.compiler.problem.noEffectAssignment=error -org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning -org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore -org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning -org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error -org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=enabled -org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=error -org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled -org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore -org.eclipse.jdt.core.compiler.problem.typeParameterHiding=ignore -org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning -org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore -org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning -org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore -org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error -org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled -org.eclipse.jdt.core.compiler.problem.unusedImport=error -org.eclipse.jdt.core.compiler.problem.unusedLabel=error -org.eclipse.jdt.core.compiler.problem.unusedLocal=error -org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled -org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error -org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning -org.eclipse.jdt.core.compiler.source=1.3 -org.eclipse.jdt.core.incompatibleJDKLevel=ignore -org.eclipse.jdt.core.incompleteClasspath=error diff --git a/bundles/org.eclipse.wst.dtd.ui/.settings/org.eclipse.jdt.ui.prefs b/bundles/org.eclipse.wst.dtd.ui/.settings/org.eclipse.jdt.ui.prefs deleted file mode 100644 index 301c7adde6..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/.settings/org.eclipse.jdt.ui.prefs +++ /dev/null @@ -1,4 +0,0 @@ -#Mon Apr 17 01:48:39 EDT 2006 -eclipse.preferences.version=1 -internal.default.compliance=default -org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8"?>\r\n<templates/> diff --git a/bundles/org.eclipse.wst.dtd.ui/.settings/org.eclipse.ltk.core.refactoring.prefs b/bundles/org.eclipse.wst.dtd.ui/.settings/org.eclipse.ltk.core.refactoring.prefs deleted file mode 100644 index c59368c5e1..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/.settings/org.eclipse.ltk.core.refactoring.prefs +++ /dev/null @@ -1,3 +0,0 @@ -#Tue Apr 04 03:36:32 EDT 2006 -eclipse.preferences.version=1 -org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false diff --git a/bundles/org.eclipse.wst.dtd.ui/.settings/org.eclipse.pde.prefs b/bundles/org.eclipse.wst.dtd.ui/.settings/org.eclipse.pde.prefs deleted file mode 100644 index fc522bba76..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/.settings/org.eclipse.pde.prefs +++ /dev/null @@ -1,16 +0,0 @@ -#Mon Apr 17 02:01:33 EDT 2006 -compilers.incompatible-environment=0 -compilers.p.build=0 -compilers.p.deprecated=1 -compilers.p.illegal-att-value=0 -compilers.p.no-required-att=0 -compilers.p.not-externalized-att=0 -compilers.p.unknown-attribute=0 -compilers.p.unknown-class=0 -compilers.p.unknown-element=0 -compilers.p.unknown-resource=0 -compilers.p.unresolved-ex-points=0 -compilers.p.unresolved-import=0 -compilers.p.unused-element-or-attribute=0 -compilers.use-project=true -eclipse.preferences.version=1 diff --git a/bundles/org.eclipse.wst.dtd.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.wst.dtd.ui/META-INF/MANIFEST.MF deleted file mode 100644 index 6d74f27101..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/META-INF/MANIFEST.MF +++ /dev/null @@ -1,40 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: %pluginName -Bundle-SymbolicName: org.eclipse.wst.dtd.ui; singleton:=true -Bundle-Version: 1.0.301.qualifier -Bundle-Activator: org.eclipse.wst.dtd.ui.internal.DTDUIPlugin -Bundle-Vendor: %providerName -Bundle-Localization: plugin -Export-Package: org.eclipse.wst.dtd.ui, - org.eclipse.wst.dtd.ui.internal;x-internal:=true, - org.eclipse.wst.dtd.ui.internal.dnd;x-internal:=true, - org.eclipse.wst.dtd.ui.internal.editor;x-internal:=true, - org.eclipse.wst.dtd.ui.internal.preferences;x-internal:=true, - org.eclipse.wst.dtd.ui.internal.projection;x-internal:=true, - org.eclipse.wst.dtd.ui.internal.properties.section;x-internal:=true, - org.eclipse.wst.dtd.ui.internal.registry;x-internal:=true, - org.eclipse.wst.dtd.ui.internal.style;x-internal:=true, - org.eclipse.wst.dtd.ui.internal.templates;x-internal:=true, - org.eclipse.wst.dtd.ui.internal.text;x-internal:=true, - org.eclipse.wst.dtd.ui.internal.views.contentoutline.actions;x-internal:=true, - org.eclipse.wst.dtd.ui.internal.views.properties;x-internal:=true, - org.eclipse.wst.dtd.ui.internal.wizard;x-internal:=true, - org.eclipse.wst.dtd.ui.views.contentoutline -Require-Bundle: org.eclipse.core.resources;bundle-version="[3.4.0,4.0.0)", - org.eclipse.core.runtime;bundle-version="[3.4.0,4.0.0)", - org.eclipse.jface.text;bundle-version="[3.4.0,4.0.0)", - org.eclipse.ui.ide;bundle-version="[3.4.0,4.0.0)", - org.eclipse.ui.workbench.texteditor;bundle-version="[3.4.0,4.0.0)", - org.eclipse.wst.common.ui;bundle-version="[1.1.301,1.2.0)", - org.eclipse.wst.dtd.core;bundle-version="[1.1.200,1.2.0)", - org.eclipse.wst.sse.core;bundle-version="[1.1.300,1.2.0)", - org.eclipse.wst.sse.ui;bundle-version="[1.1.0,1.2.0)", - org.eclipse.wst.xml.core;bundle-version="[1.1.300,1.2.0)", - org.eclipse.wst.xml.ui;bundle-version="[1.0.400,1.1.0)", - org.eclipse.wst.common.ui;bundle-version="[1.1.301,1.2.0)", - org.eclipse.wst.common.uriresolver;bundle-version="[1.1.301,1.2.0)", - org.eclipse.ui.views.properties.tabbed;bundle-version="[3.4.0,4.0.0)", - com.ibm.icu;bundle-version="[3.8.1,4.0.0)" -Bundle-ActivationPolicy: lazy -Bundle-RequiredExecutionEnvironment: J2SE-1.4 diff --git a/bundles/org.eclipse.wst.dtd.ui/about.html b/bundles/org.eclipse.wst.dtd.ui/about.html deleted file mode 100644 index 2199df3f05..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/about.html +++ /dev/null @@ -1,34 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"> -<HTML> - -<head> -<title>About</title> -<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1"> -</head> - -<BODY lang="EN-US"> - -<H3>About This Content</H3> - -<P>June, 2008</P> - -<H3>License</H3> - -<P>The Eclipse Foundation makes available all content in this plug-in -("Content"). Unless otherwise indicated below, the Content is provided to you -under the terms and conditions of the Eclipse Public License Version 1.0 -("EPL"). A copy of the EPL is available at -<A href="http://www.eclipse.org/org/documents/epl-v10.php">http://www.eclipse.org/org/documents/epl-v10.php</A>. -For purposes of the EPL, "Program" will mean the Content.</P> - -<P>If you did not receive this Content directly from the Eclipse Foundation, the -Content is being redistributed by another party ("Redistributor") and different -terms and conditions may apply to your use of any object code in the Content. -Check the Redistributor’s license that was provided with the Content. If no such -license exists, contact the Redistributor. Unless otherwise indicated below, the -terms and conditions of the EPL still apply to any source code in the Content -and such source code may be obtained at -<A href="http://www.eclipse.org/">http://www.eclipse.org/</A>.</P> - -</BODY> -</HTML> diff --git a/bundles/org.eclipse.wst.dtd.ui/build.properties b/bundles/org.eclipse.wst.dtd.ui/build.properties deleted file mode 100644 index 0579e83909..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/build.properties +++ /dev/null @@ -1,27 +0,0 @@ -############################################################################### -# Copyright (c) 2001, 2007 IBM Corporation and others. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# IBM Corporation - initial API and implementation -# Jens Lukowski/Innoopract - initial renaming/restructuring -# David Carver, STAR - add new dtd file templates, bug 162321 -# -############################################################################### -bin.includes = plugin.xml,\ - icons/,\ - plugin.properties,\ - templates/,\ - META-INF/,\ - .options,\ - .,\ - about.html -bin.excludes = bin/**,\ - @dot/**,\ - temp.folder/** -source.. = src/,\ - src-properties/ -src.includes = build.properties diff --git a/bundles/org.eclipse.wst.dtd.ui/icons/DTDFile.gif b/bundles/org.eclipse.wst.dtd.ui/icons/DTDFile.gif Binary files differdeleted file mode 100644 index 64ee536107..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/icons/DTDFile.gif +++ /dev/null diff --git a/bundles/org.eclipse.wst.dtd.ui/icons/browsebutton.gif b/bundles/org.eclipse.wst.dtd.ui/icons/browsebutton.gif Binary files differdeleted file mode 100644 index 13dae59bea..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/icons/browsebutton.gif +++ /dev/null diff --git a/bundles/org.eclipse.wst.dtd.ui/icons/full/ctool16/ADD_Attribute.gif b/bundles/org.eclipse.wst.dtd.ui/icons/full/ctool16/ADD_Attribute.gif Binary files differdeleted file mode 100644 index 00bb7b475d..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/icons/full/ctool16/ADD_Attribute.gif +++ /dev/null diff --git a/bundles/org.eclipse.wst.dtd.ui/icons/full/ctool16/ADD_Element.gif b/bundles/org.eclipse.wst.dtd.ui/icons/full/ctool16/ADD_Element.gif Binary files differdeleted file mode 100644 index 01f4889869..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/icons/full/ctool16/ADD_Element.gif +++ /dev/null diff --git a/bundles/org.eclipse.wst.dtd.ui/icons/full/ctool16/ADD_ElementToConModel.gif b/bundles/org.eclipse.wst.dtd.ui/icons/full/ctool16/ADD_ElementToConModel.gif Binary files differdeleted file mode 100644 index 1a8236b8d7..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/icons/full/ctool16/ADD_ElementToConModel.gif +++ /dev/null diff --git a/bundles/org.eclipse.wst.dtd.ui/icons/full/ctool16/ADD_GroupToConModel.gif b/bundles/org.eclipse.wst.dtd.ui/icons/full/ctool16/ADD_GroupToConModel.gif Binary files differdeleted file mode 100644 index 8168fb34f6..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/icons/full/ctool16/ADD_GroupToConModel.gif +++ /dev/null diff --git a/bundles/org.eclipse.wst.dtd.ui/icons/full/dtool16/ADD_Attribute.gif b/bundles/org.eclipse.wst.dtd.ui/icons/full/dtool16/ADD_Attribute.gif Binary files differdeleted file mode 100644 index a7fb780c77..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/icons/full/dtool16/ADD_Attribute.gif +++ /dev/null diff --git a/bundles/org.eclipse.wst.dtd.ui/icons/full/dtool16/ADD_Element.gif b/bundles/org.eclipse.wst.dtd.ui/icons/full/dtool16/ADD_Element.gif Binary files differdeleted file mode 100644 index 3755e5e42e..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/icons/full/dtool16/ADD_Element.gif +++ /dev/null diff --git a/bundles/org.eclipse.wst.dtd.ui/icons/full/dtool16/ADD_ElementToConModel.gif b/bundles/org.eclipse.wst.dtd.ui/icons/full/dtool16/ADD_ElementToConModel.gif Binary files differdeleted file mode 100644 index 1a58e11192..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/icons/full/dtool16/ADD_ElementToConModel.gif +++ /dev/null diff --git a/bundles/org.eclipse.wst.dtd.ui/icons/full/dtool16/ADD_GroupToConModel.gif b/bundles/org.eclipse.wst.dtd.ui/icons/full/dtool16/ADD_GroupToConModel.gif Binary files differdeleted file mode 100644 index d525a21e73..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/icons/full/dtool16/ADD_GroupToConModel.gif +++ /dev/null diff --git a/bundles/org.eclipse.wst.dtd.ui/icons/full/dtool16/newdtd_wiz.gif b/bundles/org.eclipse.wst.dtd.ui/icons/full/dtool16/newdtd_wiz.gif Binary files differdeleted file mode 100644 index 33f634f274..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/icons/full/dtool16/newdtd_wiz.gif +++ /dev/null diff --git a/bundles/org.eclipse.wst.dtd.ui/icons/full/etool16/ADD_Attribute.gif b/bundles/org.eclipse.wst.dtd.ui/icons/full/etool16/ADD_Attribute.gif Binary files differdeleted file mode 100644 index 00bb7b475d..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/icons/full/etool16/ADD_Attribute.gif +++ /dev/null diff --git a/bundles/org.eclipse.wst.dtd.ui/icons/full/etool16/ADD_Element.gif b/bundles/org.eclipse.wst.dtd.ui/icons/full/etool16/ADD_Element.gif Binary files differdeleted file mode 100644 index 01f4889869..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/icons/full/etool16/ADD_Element.gif +++ /dev/null diff --git a/bundles/org.eclipse.wst.dtd.ui/icons/full/etool16/ADD_ElementToConModel.gif b/bundles/org.eclipse.wst.dtd.ui/icons/full/etool16/ADD_ElementToConModel.gif Binary files differdeleted file mode 100644 index 1a8236b8d7..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/icons/full/etool16/ADD_ElementToConModel.gif +++ /dev/null diff --git a/bundles/org.eclipse.wst.dtd.ui/icons/full/etool16/ADD_GroupToConModel.gif b/bundles/org.eclipse.wst.dtd.ui/icons/full/etool16/ADD_GroupToConModel.gif Binary files differdeleted file mode 100644 index 8168fb34f6..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/icons/full/etool16/ADD_GroupToConModel.gif +++ /dev/null diff --git a/bundles/org.eclipse.wst.dtd.ui/icons/full/etool16/generate_xml.gif b/bundles/org.eclipse.wst.dtd.ui/icons/full/etool16/generate_xml.gif Binary files differdeleted file mode 100644 index 0fd5dd8913..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/icons/full/etool16/generate_xml.gif +++ /dev/null diff --git a/bundles/org.eclipse.wst.dtd.ui/icons/full/etool16/newdtd_wiz.gif b/bundles/org.eclipse.wst.dtd.ui/icons/full/etool16/newdtd_wiz.gif Binary files differdeleted file mode 100644 index 10b1a77cda..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/icons/full/etool16/newdtd_wiz.gif +++ /dev/null diff --git a/bundles/org.eclipse.wst.dtd.ui/icons/full/obj16/ADD_Comment.gif b/bundles/org.eclipse.wst.dtd.ui/icons/full/obj16/ADD_Comment.gif Binary files differdeleted file mode 100644 index 39611d6c63..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/icons/full/obj16/ADD_Comment.gif +++ /dev/null diff --git a/bundles/org.eclipse.wst.dtd.ui/icons/full/obj16/ADD_Entity.gif b/bundles/org.eclipse.wst.dtd.ui/icons/full/obj16/ADD_Entity.gif Binary files differdeleted file mode 100644 index cb415064e0..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/icons/full/obj16/ADD_Entity.gif +++ /dev/null diff --git a/bundles/org.eclipse.wst.dtd.ui/icons/full/obj16/ADD_Entity_Reference.gif b/bundles/org.eclipse.wst.dtd.ui/icons/full/obj16/ADD_Entity_Reference.gif Binary files differdeleted file mode 100644 index 5efa9b905e..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/icons/full/obj16/ADD_Entity_Reference.gif +++ /dev/null diff --git a/bundles/org.eclipse.wst.dtd.ui/icons/full/obj16/ADD_Notation.gif b/bundles/org.eclipse.wst.dtd.ui/icons/full/obj16/ADD_Notation.gif Binary files differdeleted file mode 100644 index 57ad089a69..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/icons/full/obj16/ADD_Notation.gif +++ /dev/null diff --git a/bundles/org.eclipse.wst.dtd.ui/icons/full/obj16/DTDFile.gif b/bundles/org.eclipse.wst.dtd.ui/icons/full/obj16/DTDFile.gif Binary files differdeleted file mode 100644 index 211c437fa9..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/icons/full/obj16/DTDFile.gif +++ /dev/null diff --git a/bundles/org.eclipse.wst.dtd.ui/icons/full/obj16/newdtd_wiz.gif b/bundles/org.eclipse.wst.dtd.ui/icons/full/obj16/newdtd_wiz.gif Binary files differdeleted file mode 100644 index 2c115ff961..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/icons/full/obj16/newdtd_wiz.gif +++ /dev/null diff --git a/bundles/org.eclipse.wst.dtd.ui/icons/full/obj16/organize_dtd_logically.gif b/bundles/org.eclipse.wst.dtd.ui/icons/full/obj16/organize_dtd_logically.gif Binary files differdeleted file mode 100644 index 093c6bad04..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/icons/full/obj16/organize_dtd_logically.gif +++ /dev/null diff --git a/bundles/org.eclipse.wst.dtd.ui/icons/full/obj16/sort.gif b/bundles/org.eclipse.wst.dtd.ui/icons/full/obj16/sort.gif Binary files differdeleted file mode 100644 index 23c5d0b11c..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/icons/full/obj16/sort.gif +++ /dev/null diff --git a/bundles/org.eclipse.wst.dtd.ui/icons/full/obj16/sourceEditor.gif b/bundles/org.eclipse.wst.dtd.ui/icons/full/obj16/sourceEditor.gif Binary files differdeleted file mode 100644 index 75ebdb8586..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/icons/full/obj16/sourceEditor.gif +++ /dev/null diff --git a/bundles/org.eclipse.wst.dtd.ui/icons/full/obj16/validate.gif b/bundles/org.eclipse.wst.dtd.ui/icons/full/obj16/validate.gif Binary files differdeleted file mode 100644 index 86196e996f..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/icons/full/obj16/validate.gif +++ /dev/null diff --git a/bundles/org.eclipse.wst.dtd.ui/icons/full/wizban/newdtdfile_wiz.png b/bundles/org.eclipse.wst.dtd.ui/icons/full/wizban/newdtdfile_wiz.png Binary files differdeleted file mode 100644 index 636d79261f..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/icons/full/wizban/newdtdfile_wiz.png +++ /dev/null diff --git a/bundles/org.eclipse.wst.dtd.ui/plugin.properties b/bundles/org.eclipse.wst.dtd.ui/plugin.properties deleted file mode 100644 index 3f5b50c3cd..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/plugin.properties +++ /dev/null @@ -1,62 +0,0 @@ -############################################################################### -# Copyright (c) 2001, 2007 IBM Corporation and others. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# IBM Corporation - initial API and implementation -# Jens Lukowski/Innoopract - initial renaming/restructuring -# -############################################################################### -! Properties file for component: XMDTD - XML Tools DTD Editor -! Packaged for translation in: xml.zip - -providerName=Eclipse.org -pluginName=SSE DTD Source Editor - -DTD_Source_Page_Editor.name=DTD Editor -_UI_LABEL_DTD_FILES=DTD Files -DTD_Templates.name=Templates -_UI_LABEL_DTD_STYLES=Styles -DTD_Syntax_Coloring=Syntax Coloring -_UI_WIZARD_NEW_DTD=DTD -_UI_CREATE_NEW_DTD_FILE=Create a new DTD file -## -StructureSelectEnclosing_label=Enclosing Element -StructureSelectEnclosing_tooltip=Expand selection to include enclosing element -StructureSelectNext_label=Next Element -StructureSelectNext_tooltip=Expand selection to include next sibling -StructureSelectPrevious_label=Previous Element -StructureSelectPrevious_tooltip=Expand selection to include previous sibling -StructureSelectHistory_label=Restore Last Selection -StructureSelectHistory_tooltip=Restore last selection -## -AddTask.label=Add &Task... -AddTask.tooltip=Add Task... -AddBookmark.label=Add Boo&kmark... -AddBookmark.tooltip=Add Bookmark... -SelectRuler.label=Select Ruler -## -_UI_MENU_VALIDATE_DTD = &Validate DTD File - -DTD_New_context_type_Extension_Element.name=New DTD -_UI_LABEL_GENERAL=General -_UI_LABEL_OTHER=Other -_UI_LABEL_ATTRIBUTES=Attributes -_UI_LABEL_DOCUMENTATION=Documentation -## -preferenceKeywords.files=editor dtd creating files suffix specified -preferenceKeywords.templates=editor dtd templates snippet macros -preferenceKeywords.styles=editor dtd style customize syntax highlighting type text content foreground background bold color - -Colors.dtdDefault=DTD Default -Colors.dtdTag=DTD Tag -Colors.dtdTagName=DTD Tag Name -Colors.dtdComment=DTD Comment -Colors.dtdKeyword=DTD Keyword -Colors.dtdString=DTD String -Colors.dtdData=DTD Data -Colors.dtdSymbol=DTD Symbol -
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.dtd.ui/plugin.xml b/bundles/org.eclipse.wst.dtd.ui/plugin.xml deleted file mode 100644 index 415c252dc6..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/plugin.xml +++ /dev/null @@ -1,475 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<?eclipse version="3.0"?> -<plugin> - - <extension point="org.eclipse.ui.editors"> - <!-- class="org.eclipse.wst.sse.ui.StructuredTextEditor" --> - <editor - name="%DTD_Source_Page_Editor.name" - icon="$nl$/icons/full/obj16/DTDFile.gif" - contributorClass="org.eclipse.wst.dtd.ui.internal.editor.ActionContributorDTD" - class="org.eclipse.wst.dtd.ui.internal.DTDEditor" - symbolicFontName="org.eclipse.wst.sse.ui.textfont" - id="org.eclipse.wst.dtd.core.dtdsource.source"> - <contentTypeBinding - contentTypeId="org.eclipse.wst.dtd.core.dtdsource" /> - </editor> - </extension> - - <extension point="org.eclipse.wst.sse.ui.editorConfiguration"> - <contentOutlineConfiguration - class="org.eclipse.wst.dtd.ui.views.contentoutline.DTDContentOutlineConfiguration" - target="org.eclipse.wst.dtd.core.dtdsource" /> - <sourceViewerConfiguration - class="org.eclipse.wst.dtd.ui.StructuredTextViewerConfigurationDTD" - target="org.eclipse.wst.dtd.core.dtdsource" /> - <provisionalConfiguration - type="characterpairmatcher" - class="org.eclipse.wst.dtd.ui.internal.text.DTDDocumentRegionEdgeMatcher" - target="org.eclipse.wst.dtd.core.dtdsource" /> - <!-- comment out till able to improve dtd folding - <provisionalConfiguration - type="structuredtextfoldingprovider" - class="org.eclipse.wst.dtd.ui.internal.projection.StructuredTextFoldingProviderDTD" - target="org.eclipse.wst.dtd.core.dtdsource" /> - --> - <provisionalDefinition - type="preferencepages" - value="org.eclipse.wst.dtd.ui.preferences.dtd, org.eclipse.wst.sse.ui.preferences.dtd.templates, org.eclipse.wst.sse.ui.preferences.dtd.styles" - target="org.eclipse.wst.dtd.core.dtdsource" /> - <!-- provide syntax highlighting for DTD subset within XML --> - <provisionalConfiguration - type="linestyleprovider" - class="org.eclipse.wst.dtd.ui.internal.style.LineStyleProviderForDTDSubSet" - target="org.eclipse.wst.xml.dtd.internal_subset" /> - <provisionalDefinition - type="spellingregions" - value="org.eclipse.wst.dtd.core.internal.util.parser.DTDRegionTypes.COMMENT_CONTENT" - target="org.eclipse.wst.dtd.core.dtdsource" /> - </extension> - - <extension point="org.eclipse.ui.editorActions"> - <editorContribution - id="org.eclipse.wst.dtd.core.dtdsource.source.editorActions" - targetID="org.eclipse.wst.dtd.core.dtdsource.source"> - <action - id="StructureSelectEnclosing" - label="%StructureSelectEnclosing_label" - definitionId="org.eclipse.wst.sse.ui.structure.select.enclosing" - tooltip="%StructureSelectEnclosing_tooltip" - class="org.eclipse.wst.xml.ui.internal.selection.StructuredSelectEnclosingXMLActionDelegate" - actionID="StructureSelectEnclosing"> - </action> - <action - id="StructureSelectNext" - label="%StructureSelectNext_label" - definitionId="org.eclipse.wst.sse.ui.structure.select.next" - tooltip="%StructureSelectNext_tooltip" - class="org.eclipse.wst.xml.ui.internal.selection.StructuredSelectNextXMLActionDelegate" - actionID="StructureSelectNext"> - </action> - <action - id="StructureSelectPrevious" - label="%StructureSelectPrevious_label" - definitionId="org.eclipse.wst.sse.ui.structure.select.previous" - tooltip="%StructureSelectPrevious_tooltip" - class="org.eclipse.wst.xml.ui.internal.selection.StructuredSelectPreviousXMLActionDelegate" - actionID="StructureSelectPrevious"> - </action> - <action - id="StructureSelectHistory" - label="%StructureSelectHistory_label" - definitionId="org.eclipse.wst.sse.ui.structure.select.last" - tooltip="%StructureSelectHistory_tooltip" - class="org.eclipse.wst.sse.ui.internal.selection.StructuredSelectHistoryActionDelegate" - actionID="StructureSelectHistory"> - </action> - </editorContribution> - <editorContribution - targetID="org.eclipse.wst.dtd.core.dtdsource.source" - id="org.eclipse.wst.dtd.core.dtdsource.ruler.actions"> - <action - label="%AddBookmark.label" - helpContextId="org.eclipse.ui.bookmark_action_context" - class="org.eclipse.ui.texteditor.BookmarkRulerAction" - actionID="RulerDoubleClick" - id="org.eclipse.ui.texteditor.BookmarkRulerAction"/> - <action - label="%SelectRuler.label" - class="org.eclipse.ui.texteditor.SelectRulerAction" - actionID="RulerClick" - id="org.eclipse.ui.texteditor.SelectRulerAction"/> - </editorContribution> - </extension> - - <!-- use a specific annotation model with FileBuffers --> - <extension - point="org.eclipse.core.filebuffers.annotationModelCreation"> - <factory - contentTypeId="org.eclipse.wst.dtd.core.dtdsource" - class="org.eclipse.wst.sse.ui.internal.StructuredResourceMarkerAnnotationModelFactory" /> - </extension> - - <!-- Register the UI adapter factory provider --> - <extension - point="org.eclipse.wst.sse.ui.adapterFactoryDescription"> - <adapterFactoryDescription - class="org.eclipse.wst.dtd.ui.internal.registry.AdapterFactoryProviderForDTD"> - <contentType id="org.eclipse.wst.dtd.core.dtdsource" /> - </adapterFactoryDescription> - </extension> - - <!-- Editor actionsets --> - <extension point="org.eclipse.ui.actionSetPartAssociations"> - <actionSetPartAssociation - targetID="org.eclipse.ui.edit.text.actionSet.annotationNavigation"> - <part id="org.eclipse.wst.dtd.core.dtdsource.source" /> - </actionSetPartAssociation> - <actionSetPartAssociation - targetID="org.eclipse.ui.NavigateActionSet"> - <part id="org.eclipse.wst.dtd.core.dtdsource.source" /> - </actionSetPartAssociation> - </extension> - - <extension point="org.eclipse.ui.preferencePages"> - <page - name="%_UI_LABEL_DTD_FILES" - category="org.eclipse.wst.xml.ui.preferences.xml" - class="org.eclipse.wst.dtd.ui.internal.preferences.DTDFilesPreferencePage" - id="org.eclipse.wst.dtd.ui.preferences.dtd"> - <keywordReference id="org.eclipse.wst.dtd.ui.files"/> - </page> - <page - name="%DTD_Templates.name" - category="org.eclipse.wst.dtd.ui.preferences.dtd" - class="org.eclipse.wst.dtd.ui.internal.preferences.DTDTemplatePreferencePage" - id="org.eclipse.wst.sse.ui.preferences.dtd.templates"> - <keywordReference id="org.eclipse.wst.dtd.ui.templates"/> - </page> - <page - name="%DTD_Syntax_Coloring" - category="org.eclipse.wst.dtd.ui.preferences.dtd" - class="org.eclipse.wst.dtd.ui.internal.preferences.DTDSyntaxColoringPage" - id="org.eclipse.wst.sse.ui.preferences.dtd.styles"> - <keywordReference id="org.eclipse.wst.dtd.ui.styles"/> - </page> - </extension> - - <!-- Keywords for preference and properties pages --> - <extension point="org.eclipse.ui.keywords"> - <keyword - label="%preferenceKeywords.files" - id="org.eclipse.wst.dtd.ui.files"/> - <keyword - label="%preferenceKeywords.templates" - id="org.eclipse.wst.dtd.ui.templates"/> - <keyword - label="%preferenceKeywords.styles" - id="org.eclipse.wst.dtd.ui.styles"/> - </extension> - - <!-- New DTD wizard --> - <extension point="org.eclipse.ui.newWizards"> - <wizard - id="org.eclipse.wst.dtd.ui.internal.wizard.NewDTDWizard" - name="%_UI_WIZARD_NEW_DTD" - class="org.eclipse.wst.dtd.ui.internal.wizard.NewDTDWizard" - category="org.eclipse.wst.XMLCategory" - icon="$nl$/icons/full/etool16/newdtd_wiz.gif"> - <description>%_UI_CREATE_NEW_DTD_FILE</description> - <selection class="org.eclipse.core.resources.IResource" /> - </wizard> - </extension> - - <!-- initialize DTD ui preferences --> - <extension point="org.eclipse.core.runtime.preferences"> - <initializer - class="org.eclipse.wst.dtd.ui.internal.preferences.DTDUIPreferenceInitializer" /> - </extension> - - <extension point="org.eclipse.ui.popupMenus"> - <viewerContribution - targetID="org.eclipse.wst.dtd.core.dtdsource.source.RulerContext" - id="org.eclipse.ui.texteditor.ruler.context.actions"> - <action - label="%AddTask.label" - helpContextId="org.eclipse.ui.AddTask_action_context" - class="org.eclipse.ui.texteditor.TaskRulerAction" - tooltip="%AddTask.tooltip" - menubarPath="additions" - id="org.eclipse.ui.texteditor.TaskRulerAction"> - </action> - <action - label="%AddBookmark.label" - helpContextId="org.eclipse.ui.bookmark_action_context" - class="org.eclipse.ui.texteditor.BookmarkRulerAction" - tooltip="%AddBookmark.tooltip" - menubarPath="additions" - id="org.eclipse.ui.texteditor.BookmarkRulerAction"> - </action> - </viewerContribution> - </extension> - - <!-- Templates --> - <extension point="org.eclipse.ui.editors.templates"> - <contextType - name="%DTD_New_context_type_Extension_Element.name" - class="org.eclipse.wst.dtd.ui.internal.templates.TemplateContextTypeDTD" - id="dtd_new"> - </contextType> - <include - file="templates/dtddefault-templates.xml" - translations="$nl$/templates/dtddefault-templates.properties"> - </include> - </extension> - - <extension - id="org.eclipse.wst.dtd.ui.propertyContributor" - point="org.eclipse.ui.views.properties.tabbed.propertyContributor"> - <propertyContributor - contributorId="org.eclipse.wst.dtd.core.dtdsource.source" - labelProvider="org.eclipse.wst.dtd.ui.internal.properties.section.DTDSectionLabelProvider" - typeMapper="org.eclipse.wst.dtd.ui.internal.properties.section.DTDTypeMapper"> - <propertyCategory - category="dtd.ui.general"/> - <propertyCategory - category="dtd.ui.other"/> - <propertyCategory - category="dtd.ui.attributes"/> - <propertyCategory - category="dtd.ui.documentation"/> - </propertyContributor> - </extension> - - <extension - point="org.eclipse.ui.views.properties.tabbed.propertyTabs"> - <propertyTabs - contributorId="org.eclipse.wst.dtd.core.dtdsource.source"> - <propertyTab - label="%_UI_LABEL_GENERAL" - category="dtd.ui.general" - id="org.eclipse.wst.dtd.ui.general"/> - <propertyTab - afterTab="org.eclipse.wst.dtd.ui.general" - category="dtd.ui.attributes" - id="org.eclipse.wst.dtd.ui.attributes" - label="%_UI_LABEL_ATTRIBUTES"/> - <propertyTab - afterTab="org.eclipse.wst.dtd.ui.attributes" - category="dtd.ui.other" - id="org.eclipse.wst.dtd.ui.other" - label="%_UI_LABEL_OTHER"/> - <propertyTab - afterTab="org.eclipse.wst.dtd.ui.attributes" - category="dtd.ui.documentation" - id="org.eclipse.wst.dtd.ui.documentation" - label="%_UI_LABEL_DOCUMENTATION"/> - </propertyTabs> - </extension> - -<extension point="org.eclipse.ui.views.properties.tabbed.propertySections"> - <propertySections contributorId="org.eclipse.wst.dtd.core.dtdsource.source"> - <propertySection - class="org.eclipse.wst.dtd.ui.internal.properties.section.NameSection" - enablesFor="1" - id="org.eclipse.wst.dtd.ui.internal.properties.section.NameSection" - tab="org.eclipse.wst.dtd.ui.general"> - <input type="org.eclipse.wst.dtd.core.internal.Element"/> - <input type="org.eclipse.wst.dtd.core.internal.Attribute"/> - <input type="org.eclipse.wst.dtd.core.internal.AttributeList"/> - <input type="org.eclipse.wst.dtd.core.internal.Notation"/> - </propertySection> - - <propertySection tab="org.eclipse.wst.dtd.ui.general" - enablesFor="1" - class="org.eclipse.wst.dtd.ui.internal.properties.section.AttributeDefaultSection" - id="org.eclipse.wst.dtd.ui.internal.properties.section.AttributeDefaultSection"> - <input type="org.eclipse.wst.dtd.core.internal.Attribute"/> - </propertySection> - - <propertySection tab="org.eclipse.wst.dtd.ui.general" - enablesFor="1" - class="org.eclipse.wst.dtd.ui.internal.properties.section.CommentSection" - id="org.eclipse.wst.dtd.ui.internal.properties.section.CommentSection"> - <input type="org.eclipse.wst.dtd.core.internal.Comment"/> - </propertySection> - - <propertySection tab="org.eclipse.wst.dtd.ui.general" - enablesFor="1" - class="org.eclipse.wst.dtd.ui.internal.properties.section.ContentModelGroupSection" - id="org.eclipse.wst.dtd.ui.internal.properties.section.ContentModelGroupSection"> - <input type="org.eclipse.wst.dtd.core.internal.CMGroupNode"/> - </propertySection> - - <propertySection - class="org.eclipse.wst.dtd.ui.internal.properties.section.ContentModelNameSection" - filter="org.eclipse.wst.dtd.ui.internal.properties.section.ContentModelNameFilter" - id="org.eclipse.wst.dtd.ui.internal.properties.section.ContentModelNameSection" - enablesFor="1" - tab="org.eclipse.wst.dtd.ui.general"> - <input type="org.eclipse.wst.dtd.core.internal.CMBasicNode"/> - </propertySection> - - <propertySection tab="org.eclipse.wst.dtd.ui.other" - enablesFor="1" - class="org.eclipse.wst.dtd.ui.internal.properties.section.ContentModelTypeSection" - id="org.eclipse.wst.dtd.ui.internal.properties.section.ContentModelTypeSection"> - <input type="org.eclipse.wst.dtd.core.internal.CMBasicNode"/> - <input type="org.eclipse.wst.dtd.core.internal.CMGroupNode"/> - </propertySection> - - <propertySection tab="org.eclipse.wst.dtd.ui.documentation" - enablesFor="1" - class="org.eclipse.wst.dtd.ui.internal.properties.section.DocumentSection" - id="org.eclipse.wst.dtd.ui.internal.properties.section.DocumentSection"> - <input type="org.eclipse.wst.dtd.core.internal.Element"/> - <input type="org.eclipse.wst.dtd.core.internal.Entity"/> - <input type="org.eclipse.wst.dtd.core.internal.AttributeList"/> - <input type="org.eclipse.wst.dtd.core.internal.Notation"/> - </propertySection> - - <propertySection tab="org.eclipse.wst.dtd.ui.general" - enablesFor="1" - class="org.eclipse.wst.dtd.ui.internal.properties.section.EmptySection" - id="org.eclipse.wst.dtd.ui.internal.properties.section.EmptySection"> - <input type="org.eclipse.wst.dtd.core.internal.ParameterEntityReference"/> - <input type="org.eclipse.wst.sse.core.internal.provisional.IndexedRegion"/> - </propertySection> - - <!-- - <propertySection tab="org.eclipse.wst.dtd.ui.other" - enablesFor="1" - class="org.eclipse.wst.dtd.ui.internal.properties.section.EntityTypeSection" - id="org.eclipse.wst.dtd.ui.internal.properties.section.EntityTypeSection"> - <input type="org.eclipse.wst.dtd.core.internal.Entity"/> - </propertySection> - - <propertySection tab="org.eclipse.wst.dtd.ui.attributes" - enablesFor="1" - class="org.eclipse.wst.dtd.ui.internal.properties.section.EntityValueSection" - id="org.eclipse.wst.dtd.ui.internal.properties.section.EntityValueSection"> - <input type="org.eclipse.wst.dtd.core.internal.Entity"/> - </propertySection> - --> - - <propertySection tab="org.eclipse.wst.dtd.ui.general" - enablesFor="1" - class="org.eclipse.wst.dtd.ui.internal.properties.section.NewEntitySection" - id="org.eclipse.wst.dtd.ui.internal.properties.section.NewEntitySection"> - <input type="org.eclipse.wst.dtd.core.internal.DTDFile"/> - <input type="org.eclipse.wst.dtd.core.internal.Entity"/> - </propertySection> - - <propertySection tab="org.eclipse.wst.dtd.ui.general" - enablesFor="1" - class="org.eclipse.wst.dtd.ui.internal.properties.section.NotationSection" - id="org.eclipse.wst.dtd.ui.internal.properties.section.NotationSection"> - <input type="org.eclipse.wst.dtd.core.internal.Notation"/> - </propertySection> - - <propertySection tab="org.eclipse.wst.dtd.ui.attributes" - enablesFor="1" - class="org.eclipse.wst.dtd.ui.internal.properties.section.OccurrenceSection" - filter="org.eclipse.wst.dtd.ui.internal.properties.section.OccurrenceFilter" - id="org.eclipse.wst.dtd.ui.internal.properties.section.OccurrenceSection"> - <input type="org.eclipse.wst.dtd.core.internal.CMBasicNode"/> - <input type="org.eclipse.wst.dtd.core.internal.CMRepeatableNode"/> - </propertySection> - - <propertySection tab="org.eclipse.wst.dtd.ui.attributes" - class="org.eclipse.wst.dtd.ui.internal.properties.section.TypeSection" - enablesFor="1" - id="org.eclipse.wst.dtd.ui.internal.properties.section.TypeSection"> - <input type="org.eclipse.wst.dtd.core.internal.Attribute"/> - </propertySection> - </propertySections> -</extension> - - <!-- Define theme --> - <extension - point="org.eclipse.ui.themes"> - <theme - id="org.eclipse.ui.ide.systemDefault"> - <colorOverride - id="dtdDefault" - value="COLOR_LIST_FOREGROUND"> - </colorOverride> - <colorOverride - id="dtdTag" - value="COLOR_LIST_FOREGROUND"> - </colorOverride> - <colorOverride - id="dtdTagName" - value="COLOR_LIST_FOREGROUND"> - </colorOverride> - <colorOverride - id="dtdComment" - value="COLOR_LIST_SELECTION"> - </colorOverride> - <colorOverride - id="dtdKeyword" - value="COLOR_LIST_FOREGROUND"> - </colorOverride> - <colorOverride - id="dtdString" - value="COLOR_LIST_FOREGROUND"> - </colorOverride> - <colorOverride - id="dtdData" - value="COLOR_LIST_FOREGROUND"> - </colorOverride> - <colorOverride - id="dtdSymbol" - value="COLOR_LIST_FOREGROUND"> - </colorOverride> - </theme> - <colorDefinition - id="dtdDefault" - isEditable="false" - label="%Colors.dtdDefault" - value="0, 0, 0"> - </colorDefinition> - <colorDefinition - id="dtdTag" - isEditable="false" - label="%Colors.dtdTag" - value="63, 63, 191"> - </colorDefinition> - <colorDefinition - id="dtdTagName" - isEditable="false" - label="%Colors.dtdTagName" - value="63, 63, 191"> - </colorDefinition> - <colorDefinition - id="dtdComment" - isEditable="false" - label="%Colors.dtdComment" - value="127, 127, 127"> - </colorDefinition> - <colorDefinition - id="dtdKeyword" - isEditable="false" - label="%Colors.dtdKeyword" - value="128, 0, 0"> - </colorDefinition> - <colorDefinition - id="dtdString" - isEditable="false" - label="%Colors.dtdString" - value="63, 159, 95"> - </colorDefinition> - <colorDefinition - id="dtdData" - isEditable="false" - label="%Colors.dtdData" - value="191, 95, 95"> - </colorDefinition> - <colorDefinition - id="dtdSymbol" - isEditable="false" - label="%Colors.dtdSymbol" - value="128, 0, 0"> - </colorDefinition> - </extension> -</plugin> diff --git a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/DTDEditor.java b/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/DTDEditor.java deleted file mode 100644 index 9dad7fb04b..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/DTDEditor.java +++ /dev/null @@ -1,102 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * - *******************************************************************************/ -package org.eclipse.wst.dtd.ui.internal; - -import org.eclipse.jface.viewers.IPostSelectionProvider; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.ui.IEditorInput; -import org.eclipse.ui.IEditorSite; -import org.eclipse.ui.IPageLayout; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.views.properties.IPropertySheetPage; -import org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor; -import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage; -import org.eclipse.wst.sse.ui.StructuredTextEditor; - -/** - * A DTD Editor subclass StructuredTextEditor, required to supply a complete - * replacement for the property sheet page. When a better solution is found, - * this class will be removed. - */ -public class DTDEditor extends StructuredTextEditor { - class DTDPropertySheetPageContributor implements ITabbedPropertySheetPageContributor { - DTDPropertySheetPageContributor() { - super(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor#getContributorId() - */ - public String getContributorId() { - return getEditorSite().getId(); - } - } - - TabbedPropertySheetPage fPropertySheetPage; - - public DTDEditor() { - super(); - } - - /* - * @see IAdaptable#getAdapter(Class) - */ - public Object getAdapter(Class required) { - if (IPropertySheetPage.class.equals(required)) { - if (fPropertySheetPage == null) { - fPropertySheetPage = new DTDTabbedPropertySheetPage(new DTDPropertySheetPageContributor()); - /* - * Add the property sheet page as a direct post selection - * listener so standard cursor navigation triggers a selection - * notification. The default tabbed property sheet does not - * listen to post selection. - */ - ((IPostSelectionProvider) getSelectionProvider()).addPostSelectionChangedListener(new ISelectionChangedListener() { - public void selectionChanged(SelectionChangedEvent event) { - if (fPropertySheetPage != null && !fPropertySheetPage.getControl().isDisposed()) { - fPropertySheetPage.selectionChanged(DTDEditor.this, getSelectionProvider().getSelection()); - } - } - }); - } - return fPropertySheetPage; - } - return super.getAdapter(required); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.sse.ui.StructuredTextEditor#init(org.eclipse.ui.IEditorSite, - * org.eclipse.ui.IEditorInput) - */ - public void init(IEditorSite site, IEditorInput editorInput) throws PartInitException { - super.init(site, editorInput); - - IWorkbenchWindow dw = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); - IWorkbenchPage page = dw.getActivePage(); - try { - if (page != null) { - page.showView(IPageLayout.ID_PROP_SHEET); - } - } - catch (PartInitException e) { - Logger.logException(e); - } - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/DTDPropertiesMessages.java b/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/DTDPropertiesMessages.java deleted file mode 100644 index eb8f90c80e..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/DTDPropertiesMessages.java +++ /dev/null @@ -1,117 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * - *******************************************************************************/ -package org.eclipse.wst.dtd.ui.internal; - -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -import org.eclipse.osgi.util.NLS; - -public class DTDPropertiesMessages extends NLS { - - private static final String BUNDLE_NAME = "org.eclipse.wst.dtd.ui.internal.DTDPropertiesMessages"; //$NON-NLS-1$ - - // org.eclipse.wst.dtd.ui.internal.properties.section.OccurrenceSection.java - public static String _UI_ONCE; - public static String _UI_ONE_OR_MORE; - public static String _UI_OPTIONAL; - public static String _UI_ZERO_OR_MORE; - public static String _UI_LABEL_OCCURRENCE; - // org.eclipse.wst.dtd.ui.internal.properties.section.AttribueDefaultSection.java - public static String _UI_DEFAULT; - public static String _UI_LABEL_USAGE; - public static String _UI_LABEL_DEFAULT_VALUE; - - // org.eclipse.wst.dtd.ui.internal.properties.section.ContentModelGroupSection.java - public static String _UI_SEQUENCE; - public static String _UI_CHOICE; - public static String _UI_LABEL_MODEL_GROUP; - - // org.eclipse.wst.dtd.ui.internal.properties.section.ContentModelNameSection.java - public static String _UI_LABEL_CONTENT_MODEL; - - // org.eclipse.wst.dtd.ui.internal.properties.section.ContentModelTypeSection.java - public static String _UI_LABEL_CONTENT_TYPE; - - // org.eclipse.wst.dtd.ui.internal.properties.section.NameSection.java - public static String _UI_LABEL_NAME; - - // org.eclipse.wst.dtd.ui.internal.properties.section.TypeSection.java - public static String _UI_LABEL_TYPE; - - // org.eclipse.wst.dtd.ui.internal.properties.section.EntityTypeSection.java - public static String _UI_LABEL_ENTITY_TYPE; - public static String _UI_LABEL_EXTERNAL_ENTITY; - public static String _UI_LABEL_PARAMETER_ENTITY; - public static String _UI_LABEL_GENERAL_ENTITY; - - // org.eclipse.wst.dtd.ui.internal.properties.section.EntityValueSection.java - public static String _UI_LABEL_ENTITY_VALUE; - public static String _UI_LABEL_PUBLIC_ID; - public static String _UI_LABEL_SYSTEM_ID; - - // org.eclipse.wst.dtd.ui.internal.properties.section.DTDSectionLabelProvider - public static String _UI_PROPERTIES_VIEW_TITLE_ELEMENT; - public static String _UI_PROPERTIES_VIEW_TITLE_ELEMENT_REF; - public static String _UI_PROPERTIES_VIEW_TITLE_CHOICE; - public static String _UI_PROPERTIES_VIEW_TITLE_SEQUENCE; - public static String _UI_PROPERTIES_VIEW_TITLE_ATTRIBUTE; - public static String _UI_PROPERTIES_VIEW_TITLE_ATTLIST; - public static String _UI_PROPERTIES_VIEW_TITLE_COMMENT; - public static String _UI_PROPERTIES_VIEW_TITLE_ENTITY; - public static String _UI_PROPERTIES_VIEW_TITLE_NOTATION; - - // org.eclipse.wst.dtd.ui.internal.properties.section.NewEntitySection - public static String _UI_FILEDIALOG_SELECT_DTD; - public static String _UI_FILEDIALOG_SELECT_DTD_DESC; - - // New property tabs - public static String _UI_LABEL_GENERAL; - public static String _UI_LABEL_OTHER; - public static String _UI_LABEL_ATTRIBUTES; - public static String _UI_LABEL_DOCUMENTATION; - public static String DTDEditor_0; - public static String DTDEditor_1; - public static String DTDEditor_2; - public static String DTDEditor_3; - public static String DTDSectionLabelProvider_0; - public static String DTDSectionLabelProvider_1; - public static String DTDSectionLabelProvider_10; - public static String DTDSectionLabelProvider_11; - public static String DTDSectionLabelProvider_6; - public static String DTDSectionLabelProvider_7; - public static String DTDSectionLabelProvider_8; - public static String DTDSectionLabelProvider_9; - - private static ResourceBundle fResourceBundle; - - static { - // load message values from bundle file - NLS.initializeMessages(BUNDLE_NAME, DTDPropertiesMessages.class); - } - - public static ResourceBundle getResourceBundle() { - try { - if (fResourceBundle == null) - fResourceBundle = ResourceBundle.getBundle(BUNDLE_NAME); - } - catch (MissingResourceException x) { - fResourceBundle = null; - } - return fResourceBundle; - } - - private DTDPropertiesMessages() { - super(); - } - -} diff --git a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/DTDPropertiesMessages.properties b/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/DTDPropertiesMessages.properties deleted file mode 100644 index dd19ba9c32..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/DTDPropertiesMessages.properties +++ /dev/null @@ -1,86 +0,0 @@ -############################################################################### -# Copyright (c) 2005, 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 -############################################################################### -! Properties file for component: XML tools DTD Editor -! Packaged for translation in: xml.zip - -! org.eclipse.wst.dtd.ui.internal.properties.section.OccurrenceSection.java -_UI_ONCE = Just once (1) -_UI_ONE_OR_MORE = One or more (+) -_UI_OPTIONAL = Optional (?) -_UI_ZERO_OR_MORE = Zero or more (*) -_UI_LABEL_OCCURRENCE = Occurrence - -! org.eclipse.wst.dtd.ui.internal.properties.section.AttributeDefaultSection.java -_UI_DEFAULT = Default -_UI_LABEL_USAGE = Usage -_UI_LABEL_DEFAULT_VALUE = Default Value - -! org.eclipse.wst.dtd.ui.internal.properties.section.ContentModelGroupSection.java -_UI_SEQUENCE = Sequence (,) -_UI_CHOICE = Choice (|) -_UI_LABEL_MODEL_GROUP = Model Group - -! org.eclipse.wst.dtd.ui.internal.properties.section.ContentModelNameSection.java -_UI_LABEL_CONTENT_MODEL = Content Model - -! org.eclipse.wst.dtd.ui.internal.properties.section.ContentModelTypeSection.java -_UI_LABEL_CONTENT_TYPE = Content Type - -! org.eclipse.wst.dtd.ui.internal.properties.section.NameSection.java -_UI_LABEL_NAME = Name - -! org.eclipse.wst.dtd.ui.internal.properties.section.TypeSection.java -_UI_LABEL_TYPE = Type - -! org.eclipse.wst.dtd.ui.internal.properties.section.EntityTypeSection.java -_UI_LABEL_ENTITY_TYPE = Entity Type -_UI_LABEL_EXTERNAL_ENTITY = External -_UI_LABEL_PARAMETER_ENTITY = Parameter -_UI_LABEL_GENERAL_ENTITY = General - -! org.eclipse.wst.dtd.ui.internal.properties.section.EntityValueSection.java -_UI_LABEL_ENTITY_VALUE = Entity Value -_UI_LABEL_PUBLIC_ID = Public ID -_UI_LABEL_SYSTEM_ID = System ID - -! org.eclipse.wst.dtd.ui.internal.properties.section.DTDSectionLabelProvider -_UI_PROPERTIES_VIEW_TITLE_ELEMENT = element -_UI_PROPERTIES_VIEW_TITLE_ELEMENT_REF = element reference -_UI_PROPERTIES_VIEW_TITLE_CHOICE = choice -_UI_PROPERTIES_VIEW_TITLE_SEQUENCE = sequence -_UI_PROPERTIES_VIEW_TITLE_ATTRIBUTE = attribute -_UI_PROPERTIES_VIEW_TITLE_ATTLIST = attribute list -_UI_PROPERTIES_VIEW_TITLE_COMMENT = comment -_UI_PROPERTIES_VIEW_TITLE_ENTITY = entity -_UI_PROPERTIES_VIEW_TITLE_NOTATION = notation - -! org.eclipse.wst.dtd.ui.internal.properties.section.NewEntitySection -_UI_FILEDIALOG_SELECT_DTD = Select DTD file -_UI_FILEDIALOG_SELECT_DTD_DESC = Select a DTD file from the Workbench projects - -! New property tabs -_UI_LABEL_GENERAL = General -_UI_LABEL_OTHER = Other -_UI_LABEL_ATTRIBUTES = Attributes -_UI_LABEL_DOCUMENTATION = Documentation -! end -DTDEditor_0=general -DTDEditor_1=other -DTDEditor_2=attributes -DTDEditor_3=documentation -DTDSectionLabelProvider_0=choice -DTDSectionLabelProvider_1=sequence -DTDSectionLabelProvider_6=element -DTDSectionLabelProvider_7=attribute -DTDSectionLabelProvider_8=attribute list -DTDSectionLabelProvider_9=comment -DTDSectionLabelProvider_10=entity -DTDSectionLabelProvider_11=notation diff --git a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/DTDTabbedPropertySheetPage.java b/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/DTDTabbedPropertySheetPage.java deleted file mode 100644 index 10ca85e64c..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/DTDTabbedPropertySheetPage.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * - *******************************************************************************/ -package org.eclipse.wst.dtd.ui.internal; - -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.views.properties.IPropertySheetPage; -import org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor; -import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage; - -class DTDTabbedPropertySheetPage extends TabbedPropertySheetPage { - - private ISelection oldSelection = null; - - public DTDTabbedPropertySheetPage(ITabbedPropertySheetPageContributor tabbedPropertySheetPageContributor) { - super(tabbedPropertySheetPageContributor); - } - - public void selectionChanged(IWorkbenchPart part, ISelection selection) { - IWorkbenchWindow workbenchWindow = getSite().getWorkbenchWindow(); - if (workbenchWindow != null) { - IWorkbenchPage activePage = workbenchWindow.getActivePage(); - if (activePage != null) { - IEditorPart activeEditor = activePage.getActiveEditor(); - if (activeEditor != null) { - // make sure the correct editor is active - if (activeEditor.getAdapter(IPropertySheetPage.class) == DTDTabbedPropertySheetPage.this) { - if (oldSelection == null || !oldSelection.equals(selection)) { - oldSelection = selection; - super.selectionChanged(part, selection); - } - } - } - } - } - } -} diff --git a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/AbstractSection.java b/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/AbstractSection.java deleted file mode 100644 index 26747413e9..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/AbstractSection.java +++ /dev/null @@ -1,334 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * - *******************************************************************************/ -package org.eclipse.wst.dtd.ui.internal.properties.section; - -import org.eclipse.jface.action.IStatusLineManager; -import org.eclipse.jface.util.Assert; -import org.eclipse.jface.util.IPropertyChangeListener; -import org.eclipse.jface.util.PropertyChangeEvent; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.graphics.GC; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Listener; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.part.EditorActionBarContributor; -import org.eclipse.ui.views.properties.tabbed.ISection; -import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage; -import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory; -import org.eclipse.wst.dtd.ui.internal.DTDUIPlugin; -import org.eclipse.wst.xml.core.internal.document.DocumentImpl; -import org.w3c.dom.Element; - -public class AbstractSection implements ISection, IPropertyChangeListener, Listener, SelectionListener { - private TabbedPropertySheetWidgetFactory factory; - protected IWorkbenchPart fWorkbenchPart; - protected ISelection fSelection; - protected Object fInput; - protected int rightMarginSpace; - - public void createControls(Composite parent, TabbedPropertySheetPage tabbedPropertySheetPage) { - createControls(parent, tabbedPropertySheetPage.getWidgetFactory()); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISection#createControls(org.eclipse.swt.widgets.Composite, - * org.eclipse.wst.common.ui.properties.internal.provisional.TabbedPropertySheetWidgetFactory) - */ - public void createControls(Composite parent, TabbedPropertySheetWidgetFactory aFactory) { - this.factory = aFactory; - GC gc = new GC(parent); - Point extent = gc.textExtent(" ... "); //$NON-NLS-1$ - rightMarginSpace = extent.x; - gc.dispose(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISection#setInput(org.eclipse.ui.IWorkbenchPart, - * org.eclipse.jface.viewers.ISelection) - */ - public void setInput(IWorkbenchPart part, ISelection sel) { - Assert.isTrue(sel instanceof IStructuredSelection, "selection " + sel.getClass() + "is not structured"); //$NON-NLS-1$ //$NON-NLS-2$ - this.fWorkbenchPart = part; - this.fSelection = sel; - this.fInput = ((IStructuredSelection) fSelection).getFirstElement(); - /* - * if (fInput instanceof XSDConcreteComponent) { xsdSchema = - * ((XSDConcreteComponent)fInput).getSchema(); } - */ - - // refresh(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISection#aboutToBeShown() - */ - public void aboutToBeShown() { - refresh(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISection#aboutToBeHidden() - */ - public void aboutToBeHidden() { - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISection#dispose() - */ - public void dispose() { - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISection#getMinimumHeight() - */ - public int getMinimumHeight() { - return SWT.DEFAULT; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISection#shouldUseExtraSpace() - */ - public boolean shouldUseExtraSpace() { - return false; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISection#refresh() - */ - public void refresh() { - // TODO Auto-generated method stub - } - - public Object getInput() { - if (fInput instanceof Element) { - // fInput = xsdSchema.getCorrespondingComponent((Element)fInput); - } - return fInput; - } - - /** - * Get the widget factory. - * - * @return the widget factory. - */ - public TabbedPropertySheetWidgetFactory getWidgetFactory() { - return factory; - } - - public void propertyChange(PropertyChangeEvent event) { - refresh(); - } - - public void doWidgetDefaultSelected(SelectionEvent e) { - } - - public void doWidgetSelected(SelectionEvent e) { - } - - /** - * @see org.eclipse.swt.events.SelectionListener#widgetDefaultSelected(SelectionEvent) - */ - public void widgetDefaultSelected(SelectionEvent e) { - if (isListenerEnabled() && getInput() != null && !isInDoHandle) { - isInDoHandle = true; - doWidgetDefaultSelected(e); - isInDoHandle = false; - } - - } - - /** - * @see org.eclipse.swt.events.SelectionListener#widgetSelected(SelectionEvent) - */ - public void widgetSelected(SelectionEvent e) { - if (isListenerEnabled() && getInput() != null && !isInDoHandle) { - isInDoHandle = true; - doWidgetSelected(e); - isInDoHandle = false; - } - - } - - boolean listenerEnabled = true; - - /** - * Get the value of listenerEnabled. - * - * @return value of listenerEnabled. - */ - public boolean isListenerEnabled() { - return listenerEnabled; - } - - /** - * Set the value of listenerEnabled. - * - * @param v - * Value to assign to listenerEnabled. - */ - public void setListenerEnabled(boolean v) { - this.listenerEnabled = v; - } - - public void handleEvent(Event event) { - if (isListenerEnabled() && !isInDoHandle) { - isInDoHandle = true; - startDelayedEvent(event); - isInDoHandle = false; - } // end of if () - } - - public void doHandleEvent(Event event) { - - } - - protected DelayedEvent delayedTask; - - protected void startDelayedEvent(Event e) { - if (delayedTask == null || delayedTask.getEvent() == null) { - delayedTask = new DelayedEvent(); - delayedTask.setEvent(e); - Display.getDefault().timerExec(500, delayedTask); - } - else { - Event delayedEvent = delayedTask.getEvent(); - - if (e.widget == delayedEvent.widget && e.type == delayedEvent.type) { - // same event, just different data, delay new event - delayedTask.setEvent(null); - } - delayedTask = new DelayedEvent(); - delayedTask.setEvent(e); - Display.getDefault().timerExec(500, delayedTask); - } - } - - class DelayedEvent implements Runnable { - protected Event event; - - /* - * @see Runnable#run() - */ - public void run() { - if (event != null) { - isInDoHandle = true; - doHandleEvent(event); - isInDoHandle = false; - event = null; - } - } - - /** - * Gets the event. - * - * @return Returns a Event - */ - public Event getEvent() { - return event; - } - - /** - * Sets the event. - * - * @param event - * The event to set - */ - public void setEvent(Event e) { - this.event = e; - } - - } - - boolean isInDoHandle; - - /** - * Get the value of isInDoHandle. - * - * @return value of isInDoHandle. - */ - public boolean isInDoHandle() { - return isInDoHandle; - } - - static protected IEditorPart getActiveEditor() { - IWorkbench workbench = DTDUIPlugin.getDefault().getWorkbench(); - IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow(); - IEditorPart editorPart = workbenchWindow.getActivePage().getActiveEditor(); - - return editorPart; - } - - static protected IStatusLineManager getStatusLineManager(IEditorPart editorPart) { - IStatusLineManager result = null; - try { - EditorActionBarContributor contributor = (EditorActionBarContributor) editorPart.getEditorSite().getActionBarContributor(); - result = contributor.getActionBars().getStatusLineManager(); - } - catch (Exception e) { - } - return result; - } - - DocumentImpl getDocument(Element element) { - return (DocumentImpl) element.getOwnerDocument(); - } - - public void beginRecording(String description, Element element) { - DocumentImpl doc = getDocument(element); - doc.getModel().beginRecording(this, description); - } - - public void endRecording(Element element) { - DocumentImpl doc = getDocument(element); - - doc.getModel().endRecording(this); - } - - protected boolean validateName(String name) { - return true; - } - - protected boolean validateLanguage(String lang) { - return true; - } - - protected boolean validatePrefix(String prefix) { - return true; - } - -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/AttributeDefaultSection.java b/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/AttributeDefaultSection.java deleted file mode 100644 index 224b1856f8..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/AttributeDefaultSection.java +++ /dev/null @@ -1,152 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * - *******************************************************************************/ -package org.eclipse.wst.dtd.ui.internal.properties.section; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CCombo; -import org.eclipse.swt.custom.CLabel; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.layout.FormAttachment; -import org.eclipse.swt.layout.FormData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants; -import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory; -import org.eclipse.wst.dtd.core.internal.Attribute; -import org.eclipse.wst.dtd.ui.internal.DTDPropertiesMessages; - -public class AttributeDefaultSection extends AbstractSection { - - private final String IMPLIED = Attribute.IMPLIED; - private final String REQUIRED = Attribute.REQUIRED; - private final String FIXED = Attribute.FIXED; - - private CCombo usageCombo; - private String[] usageComboValues = {IMPLIED, REQUIRED, FIXED, DTDPropertiesMessages._UI_DEFAULT}; - private Text defaultValueText; - private CLabel defaultValueLabel; - - /** - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ITabbedPropertySection#createControls(org.eclipse.swt.widgets.Composite, - * org.eclipse.wst.common.ui.properties.internal.provisional.TabbedPropertySheetWidgetFactory) - */ - public void createControls(Composite parent, TabbedPropertySheetWidgetFactory factory) { - super.createControls(parent, factory); - Composite composite = getWidgetFactory().createFlatFormComposite(parent); - - // Create label first then attach other control to it - CLabel usageLabel = getWidgetFactory().createCLabel(composite, DTDPropertiesMessages._UI_LABEL_USAGE); - // https://bugs.eclipse.org/bugs/show_bug.cgi?id=141106 - Point p = usageLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT, false); - int labelWidth = Math.max(p.x, 98); - FormData data = new FormData(labelWidth, SWT.DEFAULT); - data.left = new FormAttachment(0, 0); - data.top = new FormAttachment(0, 0); - usageLabel.setLayoutData(data); - - usageCombo = getWidgetFactory().createCCombo(composite, SWT.FLAT); - data = new FormData(); - data.left = new FormAttachment(usageLabel, -ITabbedPropertyConstants.HSPACE); - data.right = new FormAttachment(100, 0); - data.top = new FormAttachment(usageLabel, 0, SWT.CENTER); - usageCombo.setLayoutData(data); - usageCombo.addSelectionListener(this); - usageCombo.setItems(usageComboValues); - - // Create label first then attach other control to it - defaultValueLabel = getWidgetFactory().createCLabel(composite, DTDPropertiesMessages._UI_LABEL_DEFAULT_VALUE); - - // https://bugs.eclipse.org/bugs/show_bug.cgi?id=141106 - p = defaultValueLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT, false); - labelWidth = Math.max(p.x, 98); - data = new FormData(labelWidth, SWT.DEFAULT); - data.left = new FormAttachment(0, 0); - data.top = new FormAttachment(usageLabel, +ITabbedPropertyConstants.VSPACE); - defaultValueLabel.setLayoutData(data); - - defaultValueText = getWidgetFactory().createText(composite, ""); //$NON-NLS-1$ - data = new FormData(); - data.left = new FormAttachment(defaultValueLabel, -ITabbedPropertyConstants.HSPACE); - data.right = new FormAttachment(100, 0); - data.top = new FormAttachment(defaultValueLabel, 0, SWT.CENTER); - defaultValueText.setLayoutData(data); - defaultValueText.addListener(SWT.Modify, this); - } - - /* - * @see org.eclipse.wst.common.ui.properties.internal.provisional.view.ITabbedPropertySection#refresh() - */ - public void refresh() { - setListenerEnabled(false); - Object input = getInput(); - if (input != null) { - if (input instanceof Attribute) { - String kind = ((Attribute) input).getDefaultKind(); - if ("".equals(kind)) //$NON-NLS-1$ - usageCombo.setText(DTDPropertiesMessages._UI_DEFAULT); - else - usageCombo.setText(kind); - - if ("".equals(kind) || FIXED.equals(kind)) { //$NON-NLS-1$ - defaultValueLabel.setVisible(true); - defaultValueText.setVisible(true); - defaultValueText.setEnabled(true); - defaultValueText.setText(((Attribute) input).getDefaultValue()); - } - else { - defaultValueText.setText(""); //$NON-NLS-1$ - defaultValueLabel.setVisible(false); - defaultValueText.setVisible(false); - defaultValueText.setEnabled(false); - } - } - } - setListenerEnabled(true); - } - - public void widgetSelected(SelectionEvent e) { - if (e.widget == usageCombo) { - Object input = getInput(); - if (input instanceof Attribute) { - String usage = usageCombo.getText(); - Attribute attribute = (Attribute) input; - if (usage.equals(DTDPropertiesMessages._UI_DEFAULT)) - attribute.setDefaultKind(""); //$NON-NLS-1$ - else - attribute.setDefaultKind(usage); - - if (DTDPropertiesMessages._UI_DEFAULT.equals(usage) || FIXED.equals(usage)) { - defaultValueLabel.setVisible(true); - defaultValueText.setVisible(true); - defaultValueText.setEnabled(true); - } - else { - defaultValueLabel.setVisible(false); - defaultValueText.setVisible(false); - defaultValueText.setEnabled(false); - } - } - } - } - - public void doHandleEvent(Event event) { - Object input = getInput(); - if (input instanceof Attribute) { - if (event.widget == defaultValueText) { - String newValue = defaultValueText.getText(); - ((Attribute) input).setDefaultValue(newValue, usageCombo.getText().equals(FIXED)); - } - } - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/CommentSection.java b/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/CommentSection.java deleted file mode 100644 index 1c9f2dff2a..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/CommentSection.java +++ /dev/null @@ -1,76 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * - *******************************************************************************/ -package org.eclipse.wst.dtd.ui.internal.properties.section; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.FormAttachment; -import org.eclipse.swt.layout.FormData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory; -import org.eclipse.wst.dtd.core.internal.Comment; - -public class CommentSection extends AbstractSection { - private Text commentText; - - /** - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ITabbedPropertySection#createControls(org.eclipse.swt.widgets.Composite, - * org.eclipse.wst.common.ui.properties.internal.provisional.TabbedPropertySheetWidgetFactory) - */ - public void createControls(Composite parent, TabbedPropertySheetWidgetFactory factory) { - super.createControls(parent, factory); - - Composite composite = getWidgetFactory().createFlatFormComposite(parent); - commentText = getWidgetFactory().createText(composite, "", SWT.MULTI | SWT.NONE); //$NON-NLS-1$ - commentText.addListener(SWT.Modify, CommentSection.this); - - FormData data = new FormData(); - data.left = new FormAttachment(0, 0); - data.right = new FormAttachment(100, 0); - data.top = new FormAttachment(0, 0); - data.bottom = new FormAttachment(100, 0); - commentText.setLayoutData(data); - } - - /* - * @see org.eclipse.wst.common.ui.properties.internal.provisional.view.ITabbedPropertySection#refresh() - */ - public void refresh() { - setListenerEnabled(false); - commentText.setEnabled(true); - Object input = getInput(); - commentText.setText(""); //$NON-NLS-1$ - if (input != null) { - if (input instanceof Comment) - commentText.setText(((Comment) input).getText()); - } - setListenerEnabled(true); - } - - - public void doHandleEvent(Event event) { - Object input = getInput(); - if (input != null) { - String newValue = commentText.getText(); - if (newValue.length() > 0 && input instanceof Comment) { - Comment comment = (Comment) input; - comment.setText(newValue); - } - } - - } - - public boolean shouldUseExtraSpace() { - return true; - } -} diff --git a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/ContentModelGroupSection.java b/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/ContentModelGroupSection.java deleted file mode 100644 index 575185a093..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/ContentModelGroupSection.java +++ /dev/null @@ -1,95 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * - *******************************************************************************/ -package org.eclipse.wst.dtd.ui.internal.properties.section; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CCombo; -import org.eclipse.swt.custom.CLabel; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.layout.FormAttachment; -import org.eclipse.swt.layout.FormData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants; -import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory; -import org.eclipse.wst.dtd.core.internal.CMGroupNode; -import org.eclipse.wst.dtd.ui.internal.DTDPropertiesMessages; - -public class ContentModelGroupSection extends AbstractSection { - private final String SEQUENCE = DTDPropertiesMessages._UI_SEQUENCE; - private final String CHOICE = DTDPropertiesMessages._UI_CHOICE; - private final String MODEL_GROUP = DTDPropertiesMessages._UI_LABEL_MODEL_GROUP; - - private CCombo modelGroupCombo; - private String[] modelGroupComboValues = {SEQUENCE, CHOICE}; - - /** - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ITabbedPropertySection#createControls(org.eclipse.swt.widgets.Composite, - * org.eclipse.wst.common.ui.properties.internal.provisional.TabbedPropertySheetWidgetFactory) - */ - public void createControls(Composite parent, TabbedPropertySheetWidgetFactory factory) { - super.createControls(parent, factory); - Composite composite = getWidgetFactory().createFlatFormComposite(parent); - - // Create label first then attach other control to it - CLabel cLabel = getWidgetFactory().createCLabel(composite, MODEL_GROUP); - - // https://bugs.eclipse.org/bugs/show_bug.cgi?id=141106 - Point p = cLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT, false); - int labelWidth = Math.max(p.x, 98); - FormData data = new FormData(labelWidth, SWT.DEFAULT); - data.left = new FormAttachment(0, 0); - data.top = new FormAttachment(0, 0); - cLabel.setLayoutData(data); - - modelGroupCombo = getWidgetFactory().createCCombo(composite, SWT.FLAT); - data = new FormData(); - data.left = new FormAttachment(cLabel, -ITabbedPropertyConstants.HSPACE); - data.right = new FormAttachment(100); - data.top = new FormAttachment(cLabel, 0, SWT.CENTER); - modelGroupCombo.setLayoutData(data); - modelGroupCombo.addSelectionListener(this); - modelGroupCombo.setItems(modelGroupComboValues); - } - - /* - * @see org.eclipse.wst.common.ui.properties.internal.provisional.view.ITabbedPropertySection#refresh() - */ - public void refresh() { - setListenerEnabled(false); - Object input = getInput(); - if (input != null) { - if (input instanceof CMGroupNode) { - CMGroupNode node = (CMGroupNode) input; - char modelType = node.getConnector(); - if (CMGroupNode.CHOICE == modelType) - modelGroupCombo.setText(CHOICE); - else if (CMGroupNode.SEQUENCE == modelType) - modelGroupCombo.setText(SEQUENCE); - } - } - setListenerEnabled(true); - } - - public void widgetSelected(SelectionEvent e) { - if (e.widget == modelGroupCombo) { - Object input = getInput(); - if (input instanceof CMGroupNode) { - CMGroupNode node = (CMGroupNode) input; - if (CHOICE.equals(modelGroupCombo.getText())) - node.setConnector(CMGroupNode.CHOICE); - else if (SEQUENCE.equals(modelGroupCombo.getText())) - node.setConnector(CMGroupNode.SEQUENCE); - } - } - } -} diff --git a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/ContentModelNameFilter.java b/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/ContentModelNameFilter.java deleted file mode 100644 index 7150bff71c..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/ContentModelNameFilter.java +++ /dev/null @@ -1,21 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * - *******************************************************************************/ -package org.eclipse.wst.dtd.ui.internal.properties.section; - -import org.eclipse.jface.viewers.IFilter; -import org.eclipse.wst.dtd.core.internal.CMBasicNode; - -public class ContentModelNameFilter implements IFilter { - public boolean select(Object toTest) { - return toTest instanceof CMBasicNode && !((CMBasicNode) toTest).isRootElementContent(); - } -} diff --git a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/ContentModelNameSection.java b/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/ContentModelNameSection.java deleted file mode 100644 index dfb1ecf3ef..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/ContentModelNameSection.java +++ /dev/null @@ -1,110 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * - *******************************************************************************/ -package org.eclipse.wst.dtd.ui.internal.properties.section; - -import java.util.Iterator; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CCombo; -import org.eclipse.swt.custom.CLabel; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.layout.FormAttachment; -import org.eclipse.swt.layout.FormData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants; -import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory; -import org.eclipse.wst.dtd.core.internal.CMBasicNode; -import org.eclipse.wst.dtd.core.internal.CMNode; -import org.eclipse.wst.dtd.core.internal.DTDNode; -import org.eclipse.wst.dtd.core.internal.Element; -import org.eclipse.wst.dtd.core.internal.Entity; -import org.eclipse.wst.dtd.ui.internal.DTDPropertiesMessages; - -public class ContentModelNameSection extends AbstractSection { - private final String CONTENT_MODEL = DTDPropertiesMessages._UI_LABEL_CONTENT_MODEL; - - private CCombo typeCombo; - private String[] typeComboValues = {CMNode.PCDATA}; - - /** - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ITabbedPropertySection#createControls(org.eclipse.swt.widgets.Composite, - * org.eclipse.wst.common.ui.properties.internal.provisional.TabbedPropertySheetWidgetFactory) - */ - public void createControls(Composite parent, TabbedPropertySheetWidgetFactory factory) { - super.createControls(parent, factory); - Composite composite = getWidgetFactory().createFlatFormComposite(parent); - - // Create label first then attach other control to it - CLabel cLabel = getWidgetFactory().createCLabel(composite, CONTENT_MODEL); - - // https://bugs.eclipse.org/bugs/show_bug.cgi?id=141106 - Point p = cLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT, false); - int labelWidth = Math.max(p.x, 98); - FormData data = new FormData(labelWidth, SWT.DEFAULT); - data.left = new FormAttachment(0, 0); - data.top = new FormAttachment(0, 0); - cLabel.setLayoutData(data); - - typeCombo = getWidgetFactory().createCCombo(composite, SWT.FLAT | SWT.READ_ONLY); - data = new FormData(); - data.left = new FormAttachment(cLabel, -ITabbedPropertyConstants.HSPACE); - data.right = new FormAttachment(100); - data.top = new FormAttachment(cLabel, 0, SWT.CENTER); - typeCombo.setLayoutData(data); - typeCombo.addSelectionListener(this); - typeCombo.setItems(typeComboValues); - } - - /* - * @see org.eclipse.wst.common.ui.properties.internal.provisional.view.ITabbedPropertySection#refresh() - */ - public void refresh() { - Object input = getInput(); - - if (input != null) { - if (input instanceof CMBasicNode) { - typeCombo.removeAll(); - typeCombo.add(CMNode.PCDATA); - // NodeList list = - // ((CMBasicNode)fInput).getDTDFile().getElementsAndParameterEntityReferences(); - Iterator iterator = ((CMBasicNode) input).getDTDFile().getNodes().iterator(); - boolean isForRootContent = ((CMBasicNode) input).isRootElementContent(); - while (iterator.hasNext()) { - DTDNode node = (DTDNode) iterator.next(); - if (!isForRootContent && node instanceof Element) - typeCombo.add(node.getName()); - if (node instanceof Entity && ((Entity) node).isParameterEntity()) - typeCombo.add("%" + node.getName() + ";"); //$NON-NLS-1$ //$NON-NLS-2$ - } - - typeCombo.setText(((CMBasicNode) input).getName()); - } - } - } - - public void widgetSelected(SelectionEvent e) { - if (e.widget == typeCombo) { - Object input = getInput(); - if (input instanceof CMBasicNode) { - CMBasicNode node = (CMBasicNode) input; - String selected = typeCombo.getText(); - // if (CMNode.PCDATA.equals(selected)) - node.setName(selected); - } - } - } - - public boolean shouldUseExtraSpace() { - return false; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/ContentModelTypeFilter.java b/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/ContentModelTypeFilter.java deleted file mode 100644 index 3fdac83095..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/ContentModelTypeFilter.java +++ /dev/null @@ -1,26 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * - *******************************************************************************/ -package org.eclipse.wst.dtd.ui.internal.properties.section; - -import org.eclipse.jface.viewers.IFilter; -import org.eclipse.wst.dtd.core.internal.CMBasicNode; -import org.eclipse.wst.dtd.core.internal.CMGroupNode; - -public class ContentModelTypeFilter implements IFilter { - public boolean select(Object toTest) { - if (toTest instanceof CMBasicNode && !((CMBasicNode) toTest).isRootElementContent()) - return true; - if (toTest instanceof CMGroupNode && ((CMGroupNode) toTest).isRootElementContent()) - return true; - return false; - } -} diff --git a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/ContentModelTypeSection.java b/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/ContentModelTypeSection.java deleted file mode 100644 index e64a895e02..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/ContentModelTypeSection.java +++ /dev/null @@ -1,123 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * - *******************************************************************************/ -package org.eclipse.wst.dtd.ui.internal.properties.section; - -import java.util.Iterator; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CCombo; -import org.eclipse.swt.custom.CLabel; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.layout.FormAttachment; -import org.eclipse.swt.layout.FormData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants; -import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory; -import org.eclipse.wst.dtd.core.internal.CMBasicNode; -import org.eclipse.wst.dtd.core.internal.CMGroupNode; -import org.eclipse.wst.dtd.core.internal.CMNode; -import org.eclipse.wst.dtd.core.internal.DTDNode; -import org.eclipse.wst.dtd.core.internal.Element; -import org.eclipse.wst.dtd.core.internal.Entity; -import org.eclipse.wst.dtd.ui.internal.DTDPropertiesMessages; - -public class ContentModelTypeSection extends AbstractSection { - private final String CONTENT_TYPE = DTDPropertiesMessages._UI_LABEL_CONTENT_TYPE; - - private CCombo typeCombo; - private String[] typeComboValues = {CMNode.ANY, CMNode.EMPTY, CMNode.PCDATA, CMNode.CHILDREN, CMNode.MIXED}; - - /** - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ITabbedPropertySection#createControls(org.eclipse.swt.widgets.Composite, - * org.eclipse.wst.common.ui.properties.internal.provisional.TabbedPropertySheetWidgetFactory) - */ - public void createControls(Composite parent, TabbedPropertySheetWidgetFactory factory) { - super.createControls(parent, factory); - Composite composite = getWidgetFactory().createFlatFormComposite(parent); - - // Create label first then attach other control to it - CLabel cLabel = getWidgetFactory().createCLabel(composite, CONTENT_TYPE); - - // https://bugs.eclipse.org/bugs/show_bug.cgi?id=141106 - Point p = cLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT, false); - int labelWidth = Math.max(p.x, 98); - FormData data = new FormData(labelWidth, SWT.DEFAULT); - data.left = new FormAttachment(0, 0); - data.top = new FormAttachment(0, 0); - cLabel.setLayoutData(data); - - typeCombo = getWidgetFactory().createCCombo(composite, SWT.FLAT); - data = new FormData(); - data.left = new FormAttachment(cLabel, -ITabbedPropertyConstants.HSPACE); - data.right = new FormAttachment(100); - data.top = new FormAttachment(cLabel, 0, SWT.CENTER); - typeCombo.setLayoutData(data); - typeCombo.addSelectionListener(this); - typeCombo.setItems(typeComboValues); - } - - /* - * @see org.eclipse.wst.common.ui.properties.internal.provisional.view.ITabbedPropertySection#refresh() - */ - public void refresh() { - Object input = getInput(); - - if (input != null) { - if (input instanceof CMNode) { - typeCombo.removeAll(); - typeCombo.add(CMNode.ANY); - typeCombo.add(CMNode.EMPTY); - typeCombo.add(CMNode.PCDATA); - typeCombo.add(CMNode.CHILDREN); - typeCombo.add(CMNode.MIXED); - - Iterator iterator = ((CMNode) input).getDTDFile().getNodes().iterator(); - String nodeName = null; - while (iterator.hasNext()) { - DTDNode node = (DTDNode) iterator.next(); - nodeName = node.getName(); - if (node instanceof Element && typeCombo.indexOf(nodeName) == -1) - typeCombo.add(nodeName); - else if (node instanceof Entity && ((Entity) node).isParameterEntity() && typeCombo.indexOf(nodeName) == -1) - typeCombo.add("%" + nodeName + ";"); //$NON-NLS-1$ //$NON-NLS-2$ - } - if (input instanceof CMGroupNode) - typeCombo.setText(((CMGroupNode) input).getType()); - else if (input instanceof CMBasicNode) - typeCombo.setText(((CMBasicNode) input).getType()); - } - } // end if (fInput != null) - } - - public void widgetSelected(SelectionEvent e) { - if (e.widget == typeCombo) { - Object input = getInput(); - if (input instanceof CMGroupNode || input instanceof CMBasicNode) { - CMNode node = (CMNode) input; - String selected = typeCombo.getText(); - if (CMNode.MIXED.equals(selected)) - node.setMixedContent(); - else if (CMNode.CHILDREN.equals(selected)) - node.setChildrenContent(""); //$NON-NLS-1$ - else if (CMNode.EMPTY.equals(selected) || CMNode.ANY.equals(selected) || CMNode.PCDATA.equals(selected)) - node.setContent(selected); - else - node.setChildrenContent(selected); - } - } - } - - public boolean shouldUseExtraSpace() { - return false; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/DTDSectionLabelProvider.java b/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/DTDSectionLabelProvider.java deleted file mode 100644 index 4bd37ac145..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/DTDSectionLabelProvider.java +++ /dev/null @@ -1,139 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * - *******************************************************************************/ -package org.eclipse.wst.dtd.ui.internal.properties.section; - -import org.eclipse.jface.text.ITextSelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.swt.graphics.Image; -import org.eclipse.wst.dtd.core.internal.Attribute; -import org.eclipse.wst.dtd.core.internal.AttributeList; -import org.eclipse.wst.dtd.core.internal.CMBasicNode; -import org.eclipse.wst.dtd.core.internal.CMGroupNode; -import org.eclipse.wst.dtd.core.internal.CMRepeatableNode; -import org.eclipse.wst.dtd.core.internal.Comment; -import org.eclipse.wst.dtd.core.internal.DTDFile; -import org.eclipse.wst.dtd.core.internal.DTDNode; -import org.eclipse.wst.dtd.core.internal.Element; -import org.eclipse.wst.dtd.core.internal.Entity; -import org.eclipse.wst.dtd.core.internal.Notation; -import org.eclipse.wst.dtd.core.internal.ParameterEntityReference; -import org.eclipse.wst.dtd.ui.internal.DTDPropertiesMessages; - -public class DTDSectionLabelProvider extends LabelProvider { - - /** - * @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object) - */ - public Image getImage(Object object) { - if (object == null || object.equals(StructuredSelection.EMPTY)) { - return null; - } - - Image result = null; - - Object selected = object; - if (object instanceof IStructuredSelection) { - selected = ((IStructuredSelection) object).getFirstElement(); - } - if (selected instanceof DTDFile) { - return null; // ((DTDFile) selected).getImage(); - } - else if (selected instanceof DTDNode) { - if (selected instanceof ParameterEntityReference) - return null; - return ((DTDNode) selected).getImage(); - } - else if (selected instanceof org.w3c.dom.Element) { - return null; - } - return result; - } - - /** - * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object) - */ - public String getText(Object object) { - if (object == null || object.equals(StructuredSelection.EMPTY)) { - return null; - } - - Object selected = object; - if (object instanceof IStructuredSelection) { - selected = ((IStructuredSelection) object).getFirstElement(); - } - - if (selected instanceof DTDFile) { - return ((DTDFile) selected).getName(); - } - else if (selected instanceof CMBasicNode) { - if (((CMBasicNode) selected).isReference()) - return DTDPropertiesMessages._UI_PROPERTIES_VIEW_TITLE_ELEMENT_REF; - else - return ((CMBasicNode) selected).getName(); - } - else if (selected instanceof CMRepeatableNode) { - CMRepeatableNode node = (CMRepeatableNode) selected; - String name = node.getName(); - if (node instanceof CMGroupNode) { - if (((CMGroupNode) node).getConnector() == CMGroupNode.CHOICE) - name = DTDPropertiesMessages.DTDSectionLabelProvider_0; - else - name = DTDPropertiesMessages.DTDSectionLabelProvider_1; - } - char occurrence = node.getOccurrence(); - switch (occurrence) { - case CMRepeatableNode.ONCE : - name += " [1..1]"; //$NON-NLS-1$ - break; - case CMRepeatableNode.OPTIONAL : - name += " [0..1]"; //$NON-NLS-1$ - break; - case CMRepeatableNode.ONE_OR_MORE : - name += " [1..*]"; //$NON-NLS-1$ - break; - case CMRepeatableNode.ZERO_OR_MORE : - name += " [0..*]"; //$NON-NLS-1$ - break; - } - return name; - } - else if (selected instanceof DTDNode) { - if (selected instanceof Element) - return DTDPropertiesMessages.DTDSectionLabelProvider_6; - else if (selected instanceof Attribute) - return DTDPropertiesMessages.DTDSectionLabelProvider_7; - else if (selected instanceof AttributeList) - return DTDPropertiesMessages.DTDSectionLabelProvider_8; - else if (selected instanceof Comment) - return DTDPropertiesMessages.DTDSectionLabelProvider_9; - else if (selected instanceof Entity) - return DTDPropertiesMessages.DTDSectionLabelProvider_10; - else if (selected instanceof Notation) - return DTDPropertiesMessages.DTDSectionLabelProvider_11; - else if (selected instanceof ParameterEntityReference) - // return "parameter entity reference"; - return null; - else - return ((DTDNode) selected).getName(); - } - else if (selected instanceof org.w3c.dom.Element) { - return ((org.w3c.dom.Element) selected).getLocalName(); - } - else if (object instanceof ITextSelection) { - return ""; //$NON-NLS-1$ - } - else - return object.toString(); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/DTDSelectIncludeFileWizard.java b/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/DTDSelectIncludeFileWizard.java deleted file mode 100644 index f315313be4..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/DTDSelectIncludeFileWizard.java +++ /dev/null @@ -1,79 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * - *******************************************************************************/ -package org.eclipse.wst.dtd.ui.internal.properties.section; - -import org.eclipse.core.resources.IFile; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.ViewerFilter; -import org.eclipse.jface.wizard.Wizard; -import org.eclipse.ui.INewWizard; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.eclipse.wst.common.ui.internal.viewers.SelectSingleFilePage; -import org.eclipse.wst.dtd.core.internal.emf.DTDResource; -import org.eclipse.wst.dtd.ui.internal.DTDUIPlugin; - -/** - * Extend the base wizard to select a file from the project or outside the - * workbench and add error handling - */ -class DTDSelectIncludeFileWizard extends Wizard implements INewWizard { - DTDSelectSingleFilePage filePage; - - IFile resultFile; - - public DTDSelectIncludeFileWizard(String title, String desc, ViewerFilter filter, IStructuredSelection selection) { - super(); - setWindowTitle(title); - setDefaultPageImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(DTDUIPlugin.getDefault().getBundle().getSymbolicName(), DTDResource.NEWDTD)); - - // Select File Page - filePage = new DTDSelectSingleFilePage(PlatformUI.getWorkbench(), selection, true); - filePage.setTitle(title); - filePage.setDescription(desc); - filePage.addFilter(filter); - } - - public void init(IWorkbench aWorkbench, IStructuredSelection aSelection) { - } - - public void addPages() { - addPage(filePage); - } - - public boolean canFinish() { - return filePage.isPageComplete(); - } - - public boolean performFinish() { - resultFile = filePage.getFile(); - return true; - } - - public IFile getResultFile() { - return resultFile; - } - - /** - * Select DTD File - */ - class DTDSelectSingleFilePage extends SelectSingleFilePage { - public DTDSelectSingleFilePage(IWorkbench w, IStructuredSelection selection, boolean isFileMandatory) { - super(w, selection, isFileMandatory); - } - - public boolean isPageComplete() { - return super.isPageComplete(); - } - } -} diff --git a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/DTDTypeMapper.java b/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/DTDTypeMapper.java deleted file mode 100644 index 04e35d8500..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/DTDTypeMapper.java +++ /dev/null @@ -1,24 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * - *******************************************************************************/ -package org.eclipse.wst.dtd.ui.internal.properties.section; - -import org.eclipse.ui.views.properties.tabbed.ITypeMapper; - -public class DTDTypeMapper implements ITypeMapper { - public DTDTypeMapper() { - super(); - } - - public Class mapType(Object object) { - return object.getClass(); - } -} diff --git a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/DocumentSection.java b/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/DocumentSection.java deleted file mode 100644 index 4f720eb49e..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/DocumentSection.java +++ /dev/null @@ -1,101 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * - *******************************************************************************/ -package org.eclipse.wst.dtd.ui.internal.properties.section; - -import java.util.Iterator; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.FormAttachment; -import org.eclipse.swt.layout.FormData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory; -import org.eclipse.wst.dtd.core.internal.Comment; -import org.eclipse.wst.dtd.core.internal.DTDNode; - -public class DocumentSection extends AbstractSection { - private Text commentText; - - /** - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ITabbedPropertySection#createControls(org.eclipse.swt.widgets.Composite, - * org.eclipse.wst.common.ui.properties.internal.provisional.TabbedPropertySheetWidgetFactory) - */ - public void createControls(Composite parent, TabbedPropertySheetWidgetFactory factory) { - super.createControls(parent, factory); - - Composite composite = getWidgetFactory().createFlatFormComposite(parent); - commentText = getWidgetFactory().createText(composite, "", SWT.MULTI | SWT.NONE); //$NON-NLS-1$ - commentText.addListener(SWT.Modify, this); - - FormData data = new FormData(); - data.left = new FormAttachment(0, 0); - data.right = new FormAttachment(100, 0); - data.top = new FormAttachment(0, 0); - data.bottom = new FormAttachment(100, 0); - commentText.setLayoutData(data); - } - - /* - * @see org.eclipse.wst.common.ui.properties.internal.provisional.view.ITabbedPropertySection#refresh() - */ - public void refresh() { - setListenerEnabled(false); - commentText.setEnabled(true); - Object input = getInput(); - commentText.setText(""); //$NON-NLS-1$ - if (input != null) { - if (input instanceof DTDNode) { - Comment comment = getCommentNode((DTDNode) input); - if (comment != null) - commentText.setText(comment.getText()); - } - } - setListenerEnabled(true); - } - - public void doHandleEvent(Event event) { - Object input = getInput(); - if (input != null) { - String newValue = commentText.getText(); - if (input instanceof DTDNode) { - Comment comment = getCommentNode((DTDNode) input); - if (comment != null) - comment.setText(newValue); - else { - // Create a new comment node. - ((DTDNode) input).getDTDFile().createComment((DTDNode) input, newValue, false); - } - } - } - - } - - private Comment getCommentNode(DTDNode node) { - Iterator iterator = node.getDTDFile().getNodes().iterator(); - DTDNode currentNode = null; - DTDNode prevNode = null; - while (iterator.hasNext()) { - currentNode = (DTDNode) iterator.next(); - if (node == currentNode && prevNode != null && prevNode instanceof Comment) - return (Comment) prevNode; - else - prevNode = currentNode; - } - return null; - } - - public boolean shouldUseExtraSpace() { - return true; - } - -} diff --git a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/EmptySection.java b/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/EmptySection.java deleted file mode 100644 index 78f42939ca..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/EmptySection.java +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * - *******************************************************************************/ -package org.eclipse.wst.dtd.ui.internal.properties.section; - -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Event; -import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory; - -public class EmptySection extends AbstractSection { - public void doHandleEvent(Event event) { - super.doHandleEvent(event); - } - - /** - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ITabbedPropertySection#createControls(org.eclipse.swt.widgets.Composite, - * org.eclipse.wst.common.ui.properties.internal.provisional.TabbedPropertySheetWidgetFactory) - */ - public void createControls(Composite parent, TabbedPropertySheetWidgetFactory factory) { - super.createControls(parent, factory); - } - - /* - * @see org.eclipse.wst.common.ui.properties.internal.provisional.view.ITabbedPropertySection#refresh() - */ - public void refresh() { - super.refresh(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISection#shouldUseExtraSpace() - */ - public boolean shouldUseExtraSpace() { - return false; - } - - public int getMinimumHeight() { - return 0; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/EntityTypeSection.java b/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/EntityTypeSection.java deleted file mode 100644 index 3f634baf4a..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/EntityTypeSection.java +++ /dev/null @@ -1,141 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * - *******************************************************************************/ -package org.eclipse.wst.dtd.ui.internal.properties.section; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CCombo; -import org.eclipse.swt.custom.CLabel; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Point; -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.ui.views.properties.tabbed.ITabbedPropertyConstants; -import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory; -import org.eclipse.wst.dtd.core.internal.Entity; -import org.eclipse.wst.dtd.ui.internal.DTDPropertiesMessages; - -public class EntityTypeSection extends AbstractSection { - private final String ENTITY_TYPE = DTDPropertiesMessages._UI_LABEL_ENTITY_TYPE; - private final String EXTERNAL_ENTITY = DTDPropertiesMessages._UI_LABEL_EXTERNAL_ENTITY; - private final String PARAMETER = DTDPropertiesMessages._UI_LABEL_PARAMETER_ENTITY; - private final String GENERAL = DTDPropertiesMessages._UI_LABEL_GENERAL_ENTITY; - - private CCombo typeCombo; - private String[] typeComboValues = {PARAMETER, GENERAL}; - private Button checkBox; - - public static boolean isExternalEntity = false; - - /** - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ITabbedPropertySection#createControls(org.eclipse.swt.widgets.Composite, - * org.eclipse.wst.common.ui.properties.internal.provisional.TabbedPropertySheetWidgetFactory) - */ - public void createControls(Composite parent, TabbedPropertySheetWidgetFactory factory) { - super.createControls(parent, factory); - Composite composite = getWidgetFactory().createFlatFormComposite(parent); - - // Create label first then attach other control to it - CLabel cLabel = getWidgetFactory().createCLabel(composite, ENTITY_TYPE); - - // https://bugs.eclipse.org/bugs/show_bug.cgi?id=141106 - Point p = cLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT, false); - int labelWidth = Math.max(p.x, 98); - FormData data = new FormData(labelWidth, SWT.DEFAULT); - data.left = new FormAttachment(0, 0); - data.top = new FormAttachment(0, 0); - cLabel.setLayoutData(data); - - typeCombo = getWidgetFactory().createCCombo(composite, SWT.FLAT); - data = new FormData(); - data.left = new FormAttachment(cLabel, -ITabbedPropertyConstants.HSPACE); - data.right = new FormAttachment(100, 0); - data.top = new FormAttachment(cLabel, 0, SWT.CENTER); - typeCombo.setLayoutData(data); - typeCombo.addSelectionListener(this); - typeCombo.setItems(typeComboValues); - - checkBox = getWidgetFactory().createButton(composite, EXTERNAL_ENTITY, SWT.CHECK); - - // https://bugs.eclipse.org/bugs/show_bug.cgi?id=141106 - p = checkBox.computeSize(SWT.DEFAULT, SWT.DEFAULT, false); - labelWidth = Math.max(p.x, 98); - data = new FormData(labelWidth, SWT.DEFAULT); - data.left = new FormAttachment(0, 0); - data.right = new FormAttachment(95, 0); - data.top = new FormAttachment(cLabel, +ITabbedPropertyConstants.VSPACE); - checkBox.setLayoutData(data); - checkBox.addSelectionListener(this); - } - - /* - * @see org.eclipse.wst.common.ui.properties.internal.provisional.view.ITabbedPropertySection#refresh() - */ - public void refresh() { - setListenerEnabled(false); - Object input = getInput(); - - if (input != null) { - if (input instanceof Entity) { - Entity entity = (Entity) input; - if (entity.isParameterEntity()) - typeCombo.setText(PARAMETER); - else - typeCombo.setText(GENERAL); - - if (entity.isExternalEntity()) { - checkBox.setSelection(true); - isExternalEntity = true; - } - else { - checkBox.setSelection(false); - isExternalEntity = false; - } - } - } - setListenerEnabled(true); - } - - public void widgetSelected(SelectionEvent e) { - if (e.widget == typeCombo) { - Object input = getInput(); - if (input instanceof Entity) { - Entity node = (Entity) input; - String selected = typeCombo.getText(); - if (PARAMETER.equals(selected)) - node.setParameterEntity(true); - else - node.setParameterEntity(false); - } - } - else if (e.widget == checkBox) { - Object input = getInput(); - if (input instanceof Entity) { - Entity node = (Entity) input; - boolean selected = checkBox.getSelection(); - if (selected) { - node.setExternalEntity(true); - isExternalEntity = true; - } - else { - node.setExternalEntity(false); - isExternalEntity = false; - } - } - } - } - - public boolean shouldUseExtraSpace() { - return false; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/EntityValueSection.java b/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/EntityValueSection.java deleted file mode 100644 index abf35698d1..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/EntityValueSection.java +++ /dev/null @@ -1,185 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * - *******************************************************************************/ -package org.eclipse.wst.dtd.ui.internal.properties.section; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CLabel; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.layout.FormAttachment; -import org.eclipse.swt.layout.FormData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants; -import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory; -import org.eclipse.wst.dtd.core.internal.Entity; -import org.eclipse.wst.dtd.ui.internal.DTDPropertiesMessages; - -public class EntityValueSection extends AbstractSection { - private final String VALUE = DTDPropertiesMessages._UI_LABEL_ENTITY_VALUE; - private final String PUBLIC_ID = DTDPropertiesMessages._UI_LABEL_PUBLIC_ID; - private final String SYSTEM_ID = DTDPropertiesMessages._UI_LABEL_SYSTEM_ID; - - private Text valueText; - private Text publicIdText; - private Text systemIdText; - - private CLabel valueLabel; - private CLabel publicIdLabel; - private CLabel systemIdLabel; - - public void doHandleEvent(Event event) { - if (event.widget == valueText) { - Object input = getInput(); - String newValue = valueText.getText(); - if (input instanceof Entity) { - Entity entity = (Entity) input; - entity.setValue(newValue); - } - } - else if (event.widget == publicIdText) { - Object input = getInput(); - String newValue = publicIdText.getText(); - if (input instanceof Entity) { - Entity entity = (Entity) input; - entity.setPublicID(newValue); - } - } - else if (event.widget == systemIdText) { - Object input = getInput(); - String newValue = systemIdText.getText(); - if (input instanceof Entity) { - Entity entity = (Entity) input; - entity.setSystemID(newValue); - } - } - } - - /** - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ITabbedPropertySection#createControls(org.eclipse.swt.widgets.Composite, - * org.eclipse.wst.common.ui.properties.internal.provisional.TabbedPropertySheetWidgetFactory) - */ - public void createControls(Composite parent, TabbedPropertySheetWidgetFactory factory) { - super.createControls(parent, factory); - Composite composite = getWidgetFactory().createFlatFormComposite(parent); - - // Create label first then attach other control to it - valueLabel = getWidgetFactory().createCLabel(composite, VALUE); - - // https://bugs.eclipse.org/bugs/show_bug.cgi?id=141106 - Point p = valueLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT, false); - int labelWidth = Math.max(p.x, 98); - FormData data = new FormData(labelWidth, SWT.DEFAULT); - data.left = new FormAttachment(0, 0); - data.top = new FormAttachment(0, 0); - valueLabel.setLayoutData(data); - - // Entity Value - valueText = getWidgetFactory().createText(composite, ""); //$NON-NLS-1$ - data = new FormData(); - data.left = new FormAttachment(valueLabel, -ITabbedPropertyConstants.HSPACE); - data.right = new FormAttachment(100, 0); - data.top = new FormAttachment(valueLabel, 0, SWT.CENTER); - valueText.setLayoutData(data); - valueText.addListener(SWT.Modify, this); - - // Create label first then attach other control to it - publicIdLabel = getWidgetFactory().createCLabel(composite, PUBLIC_ID); - - // https://bugs.eclipse.org/bugs/show_bug.cgi?id=141106 - p = publicIdLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT, false); - labelWidth = Math.max(p.x, 98); - data = new FormData(labelWidth, SWT.DEFAULT); - data.left = new FormAttachment(0, 0); - data.top = new FormAttachment(valueLabel, +ITabbedPropertyConstants.VSPACE); - publicIdLabel.setLayoutData(data); - - // Public ID - publicIdText = getWidgetFactory().createText(composite, ""); //$NON-NLS-1$ - data = new FormData(); - data.left = new FormAttachment(publicIdLabel, -ITabbedPropertyConstants.HSPACE); - data.right = new FormAttachment(100, 0); - data.top = new FormAttachment(publicIdLabel, 0, SWT.CENTER); - publicIdText.setLayoutData(data); - publicIdText.addListener(SWT.Modify, this); - - // Create label first then attach other control to it - systemIdLabel = getWidgetFactory().createCLabel(composite, SYSTEM_ID); - - // https://bugs.eclipse.org/bugs/show_bug.cgi?id=141106 - p = systemIdLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT, false); - labelWidth = Math.max(p.x, 98); - data = new FormData(labelWidth, SWT.DEFAULT); - data.left = new FormAttachment(0, 0); - data.top = new FormAttachment(publicIdLabel, +ITabbedPropertyConstants.VSPACE); - systemIdLabel.setLayoutData(data); - - // System ID - systemIdText = getWidgetFactory().createText(composite, ""); //$NON-NLS-1$ - data = new FormData(); - data.left = new FormAttachment(systemIdLabel, -ITabbedPropertyConstants.HSPACE); - data.right = new FormAttachment(100, 0); - data.top = new FormAttachment(systemIdLabel, 0, SWT.CENTER); - systemIdText.setLayoutData(data); - systemIdText.addListener(SWT.Modify, this); - } - - /* - * @see org.eclipse.wst.common.ui.properties.internal.provisional.view.ITabbedPropertySection#refresh() - */ - public void refresh() { - setListenerEnabled(false); - Object input = getInput(); - if (isExternalEntity()) { - valueLabel.setVisible(false); - valueText.setVisible(false); - publicIdLabel.setVisible(true); - publicIdText.setVisible(true); - systemIdLabel.setVisible(true); - systemIdText.setVisible(true); - - publicIdText.setText(""); //$NON-NLS-1$ - systemIdText.setText(""); //$NON-NLS-1$ - if (input != null && input instanceof Entity) { - Entity entity = (Entity) input; - publicIdText.setText((entity).getPublicID()); - systemIdText.setText((entity).getSystemID()); - } - } - else { - valueLabel.setVisible(true); - valueText.setVisible(true); - publicIdLabel.setVisible(false); - publicIdText.setVisible(false); - systemIdLabel.setVisible(false); - systemIdText.setVisible(false); - - valueText.setText(""); //$NON-NLS-1$ - if (input != null && input instanceof Entity) - valueText.setText(((Entity) input).getValue()); - } - setListenerEnabled(true); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISection#shouldUseExtraSpace() - */ - public boolean shouldUseExtraSpace() { - return false; - } - - private boolean isExternalEntity() { - return EntityTypeSection.isExternalEntity; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/NameSection.java b/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/NameSection.java deleted file mode 100644 index 0014c6779f..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/NameSection.java +++ /dev/null @@ -1,96 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * - *******************************************************************************/ -package org.eclipse.wst.dtd.ui.internal.properties.section; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CLabel; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.layout.FormAttachment; -import org.eclipse.swt.layout.FormData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants; -import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory; -import org.eclipse.wst.dtd.core.internal.DTDNode; -import org.eclipse.wst.dtd.ui.internal.DTDPropertiesMessages; - -public class NameSection extends AbstractSection { - private final String NAME = DTDPropertiesMessages._UI_LABEL_NAME; - private Text nameText; - - public void doHandleEvent(Event event) { - if (event.widget == nameText) { - Object input = getInput(); - String newValue = nameText.getText(); - if (newValue.length() > 0 && input instanceof DTDNode) { - DTDNode dtdNode = (DTDNode) input; - dtdNode.setName(newValue); - } - } - } - - /** - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ITabbedPropertySection#createControls(org.eclipse.swt.widgets.Composite, - * org.eclipse.wst.common.ui.properties.internal.provisional.TabbedPropertySheetWidgetFactory) - */ - public void createControls(Composite parent, TabbedPropertySheetWidgetFactory factory) { - super.createControls(parent, factory); - Composite composite = getWidgetFactory().createFlatFormComposite(parent); - - // Create label first then attach other control to it - CLabel nameLabel = getWidgetFactory().createCLabel(composite, NAME); - - // https://bugs.eclipse.org/bugs/show_bug.cgi?id=141106 - Point p = nameLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT, false); - int labelWidth = Math.max(p.x, 98); - FormData data = new FormData(labelWidth, SWT.DEFAULT); - data.left = new FormAttachment(0, 0); - data.top = new FormAttachment(0, 0); - nameLabel.setLayoutData(data); - - nameText = getWidgetFactory().createText(composite, ""); //$NON-NLS-1$ - data = new FormData(); - data.left = new FormAttachment(nameLabel, -ITabbedPropertyConstants.HSPACE); - data.right = new FormAttachment(100); - data.top = new FormAttachment(nameLabel, 0, SWT.CENTER); - nameText.setLayoutData(data); - nameText.addListener(SWT.Modify, this); - - // listener.startListeningForEnter(nameText); - // listener.startListeningTo(nameText); - } - - /* - * @see org.eclipse.wst.common.ui.properties.internal.provisional.view.ITabbedPropertySection#refresh() - */ - public void refresh() { - setListenerEnabled(false); - nameText.setEnabled(true); - Object input = getInput(); - nameText.setText(""); //$NON-NLS-1$ - if (input != null) { - if (input instanceof DTDNode) - nameText.setText(((DTDNode) input).getName()); - } - setListenerEnabled(true); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISection#shouldUseExtraSpace() - */ - public boolean shouldUseExtraSpace() { - return false; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/NewEntitySection.java b/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/NewEntitySection.java deleted file mode 100644 index 64492227e7..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/NewEntitySection.java +++ /dev/null @@ -1,376 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * - *******************************************************************************/ -package org.eclipse.wst.dtd.ui.internal.properties.section; - -import org.eclipse.core.resources.IFile; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.ViewerFilter; -import org.eclipse.jface.window.Window; -import org.eclipse.jface.wizard.WizardDialog; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CCombo; -import org.eclipse.swt.custom.CLabel; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.layout.FormAttachment; -import org.eclipse.swt.layout.FormData; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.IFileEditorInput; -import org.eclipse.ui.part.PageBook; -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants; -import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory; -import org.eclipse.wst.common.ui.internal.viewers.ResourceFilter; -import org.eclipse.wst.common.uriresolver.internal.util.URIHelper; -import org.eclipse.wst.dtd.core.internal.Entity; -import org.eclipse.wst.dtd.ui.internal.DTDPropertiesMessages; -import org.eclipse.wst.dtd.ui.internal.DTDUIPlugin; - -public class NewEntitySection extends AbstractSection { - private final String NAME = DTDPropertiesMessages._UI_LABEL_NAME; - private final String ENTITY_TYPE = DTDPropertiesMessages._UI_LABEL_ENTITY_TYPE; - private final String EXTERNAL_ENTITY = DTDPropertiesMessages._UI_LABEL_EXTERNAL_ENTITY; - private final String PARAMETER = DTDPropertiesMessages._UI_LABEL_PARAMETER_ENTITY; - private final String GENERAL = DTDPropertiesMessages._UI_LABEL_GENERAL_ENTITY; - private final String VALUE = DTDPropertiesMessages._UI_LABEL_ENTITY_VALUE; - private final String PUBLIC_ID = DTDPropertiesMessages._UI_LABEL_PUBLIC_ID; - private final String SYSTEM_ID = DTDPropertiesMessages._UI_LABEL_SYSTEM_ID; - - private Text systemIdText; - private Text publicIdText; - private Text nameText; - private Button wizardButton; - - private Text entityValueText; - private Button checkBox; - - private CCombo typeCombo; - private String[] typeComboValues = {PARAMETER, GENERAL}; - private PageBook pageBook; - - /** - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ITabbedPropertySection#createControls(org.eclipse.swt.widgets.Composite, - * org.eclipse.wst.common.ui.properties.internal.provisional.TabbedPropertySheetWidgetFactory) - */ - public void createControls(Composite parent, TabbedPropertySheetWidgetFactory factory) { - super.createControls(parent, factory); - Composite composite = getWidgetFactory().createFlatFormComposite(parent); - - createEntityCommonComposite(composite); - - pageBook = new PageBook(composite, SWT.FLAT); - FormData data = new FormData(); - data.left = new FormAttachment(0, 0); - data.right = new FormAttachment(100, 0); - data.top = new FormAttachment(entityCommonComposite, 0); - data.bottom = new FormAttachment(100, 0); - pageBook.setLayoutData(data); - - createExternalEntityComposite(pageBook); - createInternalEntityComposite(pageBook); - - pageBook.showPage(externalEntityComposite); - } - - private Composite entityCommonComposite; - - private Composite createEntityCommonComposite(Composite parent) { - entityCommonComposite = getWidgetFactory().createFlatFormComposite(parent); - FormData data = new FormData(); - data.left = new FormAttachment(0, 0); - data.right = new FormAttachment(100, 0); - data.top = new FormAttachment(0, 0); - entityCommonComposite.setLayoutData(data); - - // Create label first then attach other control to it - CLabel nameLabel = getWidgetFactory().createCLabel(entityCommonComposite, NAME); //$NON-NLS-1$ - - // https://bugs.eclipse.org/bugs/show_bug.cgi?id=141106 - Point p = nameLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT, false); - int labelWidth = Math.max(p.x, 98); - data = new FormData(labelWidth, SWT.DEFAULT); - data.left = new FormAttachment(0, 0); - data.top = new FormAttachment(0, 0); - nameLabel.setLayoutData(data); - - nameText = getWidgetFactory().createText(entityCommonComposite, "", SWT.NONE); //$NON-NLS-1$ - data = new FormData(); - data.left = new FormAttachment(nameLabel, -ITabbedPropertyConstants.HSPACE); - data.right = new FormAttachment(100, 0); - data.top = new FormAttachment(nameLabel, 0, SWT.CENTER); - nameText.setLayoutData(data); - nameText.addListener(SWT.Modify, this); - - // Create label first then attach other control to it - CLabel cLabel = getWidgetFactory().createCLabel(entityCommonComposite, ENTITY_TYPE); - - // https://bugs.eclipse.org/bugs/show_bug.cgi?id=141106 - p = cLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT, false); - labelWidth = Math.max(p.x, 98); - data = new FormData(labelWidth, SWT.DEFAULT); - data.left = new FormAttachment(0, 0); - data.top = new FormAttachment(nameLabel, +ITabbedPropertyConstants.VSPACE); - cLabel.setLayoutData(data); - - // Create Checkbox - checkBox = getWidgetFactory().createButton(entityCommonComposite, EXTERNAL_ENTITY, SWT.CHECK); //$NON-NLS-1$ - data = new FormData(); - data.right = new FormAttachment(100, 0); - data.top = new FormAttachment(cLabel, 0, SWT.CENTER); - checkBox.setLayoutData(data); - checkBox.addSelectionListener(this); - - // Create CCombo - typeCombo = getWidgetFactory().createCCombo(entityCommonComposite, SWT.FLAT | SWT.READ_ONLY); - data = new FormData(); - data.left = new FormAttachment(cLabel, -ITabbedPropertyConstants.HSPACE - 2); - data.right = new FormAttachment(checkBox, -ITabbedPropertyConstants.HSPACE); - data.top = new FormAttachment(cLabel, 0, SWT.CENTER); - typeCombo.setLayoutData(data); - typeCombo.addSelectionListener(this); - typeCombo.setItems(typeComboValues); - typeCombo.setText(PARAMETER); - - return entityCommonComposite; - } - - private Composite internalEntityComposite; - - private Composite createInternalEntityComposite(Composite parent) { - internalEntityComposite = getWidgetFactory().createFlatFormComposite(parent); - FormData data = new FormData(); - data.left = new FormAttachment(0, 0); - data.right = new FormAttachment(100, 0); - data.top = new FormAttachment(entityCommonComposite, -ITabbedPropertyConstants.VSPACE); - internalEntityComposite.setLayoutData(data); - - // Create label first then attach other control to it - CLabel entityValueLabel = getWidgetFactory().createCLabel(internalEntityComposite, VALUE); //$NON-NLS-1$ - - // https://bugs.eclipse.org/bugs/show_bug.cgi?id=141106 - Point p = entityValueLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT, false); - int labelWidth = Math.max(p.x, 98); - data = new FormData(labelWidth, SWT.DEFAULT); - data.left = new FormAttachment(0, 0); - data.top = new FormAttachment(0, 0); - entityValueLabel.setLayoutData(data); - - entityValueText = getWidgetFactory().createText(internalEntityComposite, "", SWT.NONE); //$NON-NLS-1$ - data = new FormData(); - data.left = new FormAttachment(entityValueLabel, -ITabbedPropertyConstants.HSPACE); - data.right = new FormAttachment(100, 0); - data.top = new FormAttachment(entityValueLabel, 0, SWT.CENTER); - entityValueText.setLayoutData(data); - entityValueText.setEditable(true); - entityValueText.addListener(SWT.Modify, this); - - return internalEntityComposite; - } - - private Composite externalEntityComposite; - - private Composite createExternalEntityComposite(Composite parent) { - externalEntityComposite = getWidgetFactory().createFlatFormComposite(parent); - FormData data = new FormData(); - data.left = new FormAttachment(0, 0); - data.right = new FormAttachment(100, 0); - data.top = new FormAttachment(entityCommonComposite, -ITabbedPropertyConstants.VSPACE); - externalEntityComposite.setLayoutData(data); - - // Create label first then attach other control to it - CLabel publicIdLabel = getWidgetFactory().createCLabel(externalEntityComposite, PUBLIC_ID); //$NON-NLS-1$ - - // https://bugs.eclipse.org/bugs/show_bug.cgi?id=141106 - Point p = publicIdLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT, false); - int labelWidth = Math.max(p.x, 98); - data = new FormData(labelWidth, SWT.DEFAULT); - data.left = new FormAttachment(0, 0); - data.top = new FormAttachment(0, 0); - publicIdLabel.setLayoutData(data); - - publicIdText = getWidgetFactory().createText(externalEntityComposite, "", SWT.NONE); //$NON-NLS-1$ - publicIdText.setEditable(true); - data = new FormData(); - data.left = new FormAttachment(publicIdLabel, -ITabbedPropertyConstants.HSPACE); - data.right = new FormAttachment(100, 0); - data.top = new FormAttachment(publicIdLabel, 0, SWT.CENTER); - publicIdText.setLayoutData(data); - publicIdText.addListener(SWT.Modify, this); - - // Create label first then attach other control to it - // Create System ID Label - CLabel systemIdLabel = getWidgetFactory().createCLabel(externalEntityComposite, SYSTEM_ID); //$NON-NLS-1$ - - // https://bugs.eclipse.org/bugs/show_bug.cgi?id=141106 - p = systemIdLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT, false); - labelWidth = Math.max(p.x, 98); - data = new FormData(labelWidth, SWT.DEFAULT); - data.left = new FormAttachment(0, 0); - data.top = new FormAttachment(publicIdLabel, +ITabbedPropertyConstants.VSPACE); - systemIdLabel.setLayoutData(data); - - // Create Wizard Button - wizardButton = getWidgetFactory().createButton(externalEntityComposite, "", SWT.NONE); //$NON-NLS-1$ - wizardButton.setImage(AbstractUIPlugin.imageDescriptorFromPlugin(DTDUIPlugin.getDefault().getBundle().getSymbolicName(), "icons/browsebutton.gif").createImage()); //$NON-NLS-1$ - data = new FormData(); - data.right = new FormAttachment(100, 0); - data.top = new FormAttachment(systemIdLabel, 0, SWT.CENTER); - wizardButton.setLayoutData(data); - wizardButton.addSelectionListener(this); - - // Create System ID Text - systemIdText = getWidgetFactory().createText(externalEntityComposite, "", SWT.NONE); //$NON-NLS-1$ - // systemIdText.setEditable(false); - data = new FormData(); - data.left = new FormAttachment(systemIdLabel, -ITabbedPropertyConstants.HSPACE); - data.right = new FormAttachment(wizardButton, -ITabbedPropertyConstants.HSPACE); - data.top = new FormAttachment(systemIdLabel, 0, SWT.CENTER); - systemIdText.setLayoutData(data); - systemIdText.addListener(SWT.Modify, this); - - return externalEntityComposite; - } - - public void widgetSelected(SelectionEvent e) { - if (e.widget == typeCombo) { - Object input = getInput(); - if (input instanceof Entity) { - Entity node = (Entity) input; - String selected = typeCombo.getText(); - if (PARAMETER.equals(selected)) - node.setParameterEntity(true); - else - node.setParameterEntity(false); - } - } - else if (e.widget == checkBox) { - Object input = getInput(); - if (input instanceof Entity) { - Entity node = (Entity) input; - boolean selected = checkBox.getSelection(); - if (selected) { - node.setExternalEntity(true); - pageBook.showPage(externalEntityComposite); - } - else { - node.setExternalEntity(false); - pageBook.showPage(internalEntityComposite); - } - } - } - else if (e.widget == wizardButton) { - Shell shell = Display.getCurrent().getActiveShell(); - IFile currentIFile = ((IFileEditorInput) getActiveEditor().getEditorInput()).getFile(); - ViewerFilter filter = new ResourceFilter(new String[]{".dtd"}, new IFile[]{currentIFile}, null); //$NON-NLS-1$ - - DTDSelectIncludeFileWizard fileSelectWizard = new DTDSelectIncludeFileWizard(DTDPropertiesMessages._UI_FILEDIALOG_SELECT_DTD, DTDPropertiesMessages._UI_FILEDIALOG_SELECT_DTD_DESC, filter, (IStructuredSelection) fSelection); - - WizardDialog wizardDialog = new WizardDialog(shell, fileSelectWizard); - wizardDialog.create(); - wizardDialog.setBlockOnOpen(true); - int result = wizardDialog.open(); - if (result == Window.OK) { - String value = systemIdText.getText(); - IFile selectedIFile = fileSelectWizard.getResultFile(); - String dtdFileString = value; - if (selectedIFile != null) { - dtdFileString = URIHelper.getRelativeURI(selectedIFile.getFullPath(), currentIFile.getFullPath()); - } - systemIdText.setText(dtdFileString); - } - } - - } - - /** - * @see org.eclipse.wst.common.ui.properties.internal.provisional.view.ITabbedPropertySection#refresh() - */ - public void refresh() { - setListenerEnabled(false); - Object input = getInput(); - nameText.setText(""); //$NON-NLS-1$ - if (input != null) { - if (input instanceof Entity) { - Entity entity = (Entity) input; - nameText.setText(entity.getName()); - - if (entity.isParameterEntity()) - typeCombo.setText(PARAMETER); - else - typeCombo.setText(GENERAL); - - if (entity.isExternalEntity()) { - checkBox.setSelection(true); - pageBook.showPage(externalEntityComposite); - publicIdText.setText(entity.getPublicID()); - systemIdText.setText(entity.getSystemID()); - } - else { - checkBox.setSelection(false); - pageBook.showPage(internalEntityComposite); - entityValueText.setText(entity.getValue()); - } - } - } - setListenerEnabled(true); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISection#shouldUseExtraSpace() - */ - public boolean shouldUseExtraSpace() { - return true; - } - - public void doHandleEvent(Event event) { - if (event.widget == nameText) { - Object input = getInput(); - String newValue = nameText.getText(); - if (newValue.length() > 0 && input instanceof Entity) { - Entity entity = (Entity) input; - entity.setName(newValue); - } - } - else if (event.widget == entityValueText) { - Object input = getInput(); - String newValue = entityValueText.getText(); - if (input instanceof Entity) { - Entity entity = (Entity) input; - entity.setValue(newValue); - } - } - else if (event.widget == publicIdText) { - Object input = getInput(); - String newValue = publicIdText.getText(); - if (input instanceof Entity) { - Entity entity = (Entity) input; - entity.setPublicID(newValue); - } - } - else if (event.widget == systemIdText) { - Object input = getInput(); - String newValue = systemIdText.getText(); - if (input instanceof Entity) { - Entity entity = (Entity) input; - entity.setSystemID(newValue); - } - } - - } -} diff --git a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/NotationSection.java b/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/NotationSection.java deleted file mode 100644 index 2e960e77fc..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/NotationSection.java +++ /dev/null @@ -1,131 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * - *******************************************************************************/ -package org.eclipse.wst.dtd.ui.internal.properties.section; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CLabel; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.layout.FormAttachment; -import org.eclipse.swt.layout.FormData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants; -import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory; -import org.eclipse.wst.dtd.core.internal.Notation; -import org.eclipse.wst.dtd.ui.internal.DTDPropertiesMessages; - -public class NotationSection extends AbstractSection { - private final String PUBLIC_ID = DTDPropertiesMessages._UI_LABEL_PUBLIC_ID; - private final String SYSTEM_ID = DTDPropertiesMessages._UI_LABEL_SYSTEM_ID; - - private Text publicIdText; - private Text systemIdText; - - private CLabel publicIdLabel; - private CLabel systemIdLabel; - - public void doHandleEvent(Event event) { - if (event.widget == publicIdText) { - Object input = getInput(); - String newValue = publicIdText.getText(); - if (input instanceof Notation) { - Notation notation = (Notation) input; - notation.setPublicID(newValue); - } - } - else if (event.widget == systemIdText) { - Object input = getInput(); - String newValue = systemIdText.getText(); - if (input instanceof Notation) { - Notation notation = (Notation) input; - notation.setSystemID(newValue); - } - } - } - - /** - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ITabbedPropertySection#createControls(org.eclipse.swt.widgets.Composite, - * org.eclipse.wst.common.ui.properties.internal.provisional.TabbedPropertySheetWidgetFactory) - */ - public void createControls(Composite parent, TabbedPropertySheetWidgetFactory factory) { - super.createControls(parent, factory); - Composite composite = getWidgetFactory().createFlatFormComposite(parent); - - // Create label first then attach other control to it - publicIdLabel = getWidgetFactory().createCLabel(composite, PUBLIC_ID); - - // https://bugs.eclipse.org/bugs/show_bug.cgi?id=141106 - Point p = publicIdLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT, false); - int labelWidth = Math.max(p.x, 98); - FormData data = new FormData(labelWidth, SWT.DEFAULT); - data.left = new FormAttachment(0, 0); - data.top = new FormAttachment(0, 0); - publicIdLabel.setLayoutData(data); - - // Public ID - publicIdText = getWidgetFactory().createText(composite, ""); //$NON-NLS-1$ - data = new FormData(); - data.left = new FormAttachment(publicIdLabel, -ITabbedPropertyConstants.HSPACE); - data.right = new FormAttachment(100, 0); - data.top = new FormAttachment(publicIdLabel, 0, SWT.CENTER); - publicIdText.setLayoutData(data); - publicIdText.addListener(SWT.Modify, this); - - // Create label first then attach other control to it - systemIdLabel = getWidgetFactory().createCLabel(composite, SYSTEM_ID); - - // https://bugs.eclipse.org/bugs/show_bug.cgi?id=141106 - p = systemIdLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT, false); - labelWidth = Math.max(p.x, 98); - data = new FormData(labelWidth, SWT.DEFAULT); - data.left = new FormAttachment(0, 0); - data.top = new FormAttachment(publicIdLabel, +ITabbedPropertyConstants.VSPACE); - systemIdLabel.setLayoutData(data); - - // System ID - systemIdText = getWidgetFactory().createText(composite, ""); //$NON-NLS-1$ - data = new FormData(); - data.left = new FormAttachment(systemIdLabel, -ITabbedPropertyConstants.HSPACE); - data.right = new FormAttachment(100, 0); - data.top = new FormAttachment(systemIdLabel, 0, SWT.CENTER); - systemIdText.setLayoutData(data); - systemIdText.addListener(SWT.Modify, this); - } - - /* - * @see org.eclipse.wst.common.ui.properties.internal.provisional.view.ITabbedPropertySection#refresh() - */ - public void refresh() { - setListenerEnabled(false); - Object input = getInput(); - publicIdText.setText(""); //$NON-NLS-1$ - systemIdText.setText(""); //$NON-NLS-1$ - - if (input != null && input instanceof Notation) { - Notation notation = (Notation) input; - publicIdText.setText((notation).getPublicID()); - systemIdText.setText((notation).getSystemID()); - } - - setListenerEnabled(true); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISection#shouldUseExtraSpace() - */ - public boolean shouldUseExtraSpace() { - return false; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/OccurrenceFilter.java b/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/OccurrenceFilter.java deleted file mode 100644 index eb57e01655..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/OccurrenceFilter.java +++ /dev/null @@ -1,26 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * - *******************************************************************************/ -package org.eclipse.wst.dtd.ui.internal.properties.section; - -import org.eclipse.jface.viewers.IFilter; -import org.eclipse.wst.dtd.core.internal.CMBasicNode; -import org.eclipse.wst.dtd.core.internal.CMRepeatableNode; - -public class OccurrenceFilter implements IFilter { - public boolean select(Object toTest) { - if (toTest instanceof CMBasicNode && ((CMBasicNode) toTest).isEmptyAnyOrPCData()) - return false; - else if (toTest instanceof CMRepeatableNode) - return true; - return false; - } -} diff --git a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/OccurrenceSection.java b/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/OccurrenceSection.java deleted file mode 100644 index 90f5ffa5a5..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/OccurrenceSection.java +++ /dev/null @@ -1,105 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * - *******************************************************************************/ -package org.eclipse.wst.dtd.ui.internal.properties.section; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CCombo; -import org.eclipse.swt.custom.CLabel; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.layout.FormAttachment; -import org.eclipse.swt.layout.FormData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants; -import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory; -import org.eclipse.wst.dtd.core.internal.CMRepeatableNode; -import org.eclipse.wst.dtd.ui.internal.DTDPropertiesMessages; - -public class OccurrenceSection extends AbstractSection { - private final String ONCE = DTDPropertiesMessages._UI_ONCE; - private final String ONE_OR_MORE = DTDPropertiesMessages._UI_ONE_OR_MORE; - private final String OPTIONAL = DTDPropertiesMessages._UI_OPTIONAL; - private final String ZERO_OR_MORE = DTDPropertiesMessages._UI_ZERO_OR_MORE; - private final String OCCURENCE = DTDPropertiesMessages._UI_LABEL_OCCURRENCE; - - private CCombo occurrenceCombo; - private String[] occurrenceComboValues = {ONCE, ONE_OR_MORE, OPTIONAL, ZERO_OR_MORE}; - - /** - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ITabbedPropertySection#createControls(org.eclipse.swt.widgets.Composite, - * org.eclipse.wst.common.ui.properties.internal.provisional.TabbedPropertySheetWidgetFactory) - */ - public void createControls(Composite parent, TabbedPropertySheetWidgetFactory factory) { - super.createControls(parent, factory); - Composite composite = getWidgetFactory().createFlatFormComposite(parent); - - // Create label first then attach other control to it - CLabel usageLabel = getWidgetFactory().createCLabel(composite, OCCURENCE); - - // https://bugs.eclipse.org/bugs/show_bug.cgi?id=141106 - Point p = usageLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT, false); - int labelWidth = Math.max(p.x, 98); - FormData data = new FormData(labelWidth, SWT.DEFAULT); - data.left = new FormAttachment(0, 0); - data.top = new FormAttachment(0, 0); - usageLabel.setLayoutData(data); - - occurrenceCombo = getWidgetFactory().createCCombo(composite, SWT.FLAT); - data = new FormData(); - data.left = new FormAttachment(usageLabel, -ITabbedPropertyConstants.HSPACE); - data.right = new FormAttachment(100, 0); - data.top = new FormAttachment(usageLabel, 0, SWT.CENTER); - occurrenceCombo.setLayoutData(data); - occurrenceCombo.addSelectionListener(this); - occurrenceCombo.setItems(occurrenceComboValues); - } - - /* - * @see org.eclipse.wst.common.ui.properties.internal.provisional.view.ITabbedPropertySection#refresh() - */ - public void refresh() { - setListenerEnabled(false); - Object input = getInput(); - if (input instanceof CMRepeatableNode) { - char occurence = ((CMRepeatableNode) input).getOccurrence(); - if (CMRepeatableNode.ONCE == occurence) - occurrenceCombo.setText(ONCE); - else if (CMRepeatableNode.ONE_OR_MORE == occurence) - occurrenceCombo.setText(ONE_OR_MORE); - else if (CMRepeatableNode.OPTIONAL == occurence) - occurrenceCombo.setText(OPTIONAL); - else if (CMRepeatableNode.ZERO_OR_MORE == occurence) - occurrenceCombo.setText(ZERO_OR_MORE); - else - occurrenceCombo.setText(ONCE); - } - setListenerEnabled(true); - } - - public void widgetSelected(SelectionEvent e) { - Object input = getInput(); - if (input instanceof CMRepeatableNode) { - setListenerEnabled(false); - CMRepeatableNode node = (CMRepeatableNode) input; - String occurrence = occurrenceCombo.getText(); - if (ONCE.equals(occurrence)) - node.setOccurrence(CMRepeatableNode.ONCE); - else if (ONE_OR_MORE.equals(occurrence)) - node.setOccurrence(CMRepeatableNode.ONE_OR_MORE); - else if (OPTIONAL.equals(occurrence)) - node.setOccurrence(CMRepeatableNode.OPTIONAL); - else if (ZERO_OR_MORE.equals(occurrence)) - node.setOccurrence(CMRepeatableNode.ZERO_OR_MORE); - setListenerEnabled(true); - } - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/TypeSection.java b/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/TypeSection.java deleted file mode 100644 index d18795c46a..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/TypeSection.java +++ /dev/null @@ -1,92 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * - *******************************************************************************/ -package org.eclipse.wst.dtd.ui.internal.properties.section; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CCombo; -import org.eclipse.swt.custom.CLabel; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.layout.FormAttachment; -import org.eclipse.swt.layout.FormData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants; -import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory; -import org.eclipse.wst.dtd.core.internal.Attribute; -import org.eclipse.wst.dtd.ui.internal.DTDPropertiesMessages; - -public class TypeSection extends AbstractSection { - private final String TYPE = DTDPropertiesMessages._UI_LABEL_TYPE; - - private CCombo typeCombo; - private String[] typeComboValues = {Attribute.CDATA, Attribute.ID, Attribute.IDREF, Attribute.IDREFS, Attribute.ENTITY, Attribute.ENTITIES, Attribute.NMTOKEN, Attribute.NMTOKENS, Attribute.ENUMERATED_NAME, Attribute.ENUMERATED_NOTATION}; - - /** - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ITabbedPropertySection#createControls(org.eclipse.swt.widgets.Composite, - * org.eclipse.wst.common.ui.properties.internal.provisional.TabbedPropertySheetWidgetFactory) - */ - public void createControls(Composite parent, TabbedPropertySheetWidgetFactory factory) { - super.createControls(parent, factory); - Composite composite = getWidgetFactory().createFlatFormComposite(parent); - - // Create label first then attach other control to it - CLabel cLabel = getWidgetFactory().createCLabel(composite, TYPE); - - // https://bugs.eclipse.org/bugs/show_bug.cgi?id=141106 - Point p = cLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT, false); - int labelWidth = Math.max(p.x, 98); - FormData data = new FormData(labelWidth, SWT.DEFAULT); - data = new FormData(labelWidth, SWT.DEFAULT); - data.left = new FormAttachment(0, 0); - data.top = new FormAttachment(0, 0); - cLabel.setLayoutData(data); - - typeCombo = getWidgetFactory().createCCombo(composite, SWT.FLAT); - data = new FormData(); - data.left = new FormAttachment(cLabel, -ITabbedPropertyConstants.HSPACE); - data.right = new FormAttachment(100, 0); - data.top = new FormAttachment(cLabel, 0, SWT.CENTER); - typeCombo.setLayoutData(data); - typeCombo.addSelectionListener(this); - typeCombo.setItems(typeComboValues); - } - - /* - * @see org.eclipse.wst.common.ui.properties.internal.provisional.view.ITabbedPropertySection#refresh() - */ - public void refresh() { - Object input = getInput(); - - if (input != null) { - if (input instanceof Attribute) - typeCombo.setText(((Attribute) input).getType()); - } - - } - - /** - * @see org.eclipse.swt.events.SelectionListener#widgetSelected(SelectionEvent) - */ - public void widgetSelected(SelectionEvent e) { - if (e.widget == typeCombo) { - Object input = getInput(); - if (input instanceof Attribute) { - Attribute attribute = (Attribute) input; - attribute.setType(typeCombo.getText()); - } - } - } - - public boolean shouldUseExtraSpace() { - return false; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/StructuredTextViewerConfigurationDTD.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/StructuredTextViewerConfigurationDTD.java deleted file mode 100644 index 80a5dd1f2d..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/StructuredTextViewerConfigurationDTD.java +++ /dev/null @@ -1,70 +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 - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ -package org.eclipse.wst.dtd.ui; - -import org.eclipse.jface.text.source.ISourceViewer; -import org.eclipse.wst.dtd.core.text.IDTDPartitions; -import org.eclipse.wst.dtd.ui.internal.style.LineStyleProviderForDTD; -import org.eclipse.wst.sse.core.text.IStructuredPartitions; -import org.eclipse.wst.sse.ui.StructuredTextViewerConfiguration; -import org.eclipse.wst.sse.ui.internal.provisional.style.LineStyleProvider; - - -/** - * Configuration for a source viewer which shows DTD content. - * <p> - * Clients can subclass and override just those methods which must be specific - * to their needs. - * </p> - * - * @see org.eclipse.wst.sse.ui.StructuredTextViewerConfiguration - * @since 1.0 - */ -public class StructuredTextViewerConfigurationDTD extends StructuredTextViewerConfiguration { - /* - * One instance per configuration because not sourceviewer-specific and - * it's a String array - */ - private String[] fConfiguredContentTypes; - /* - * One instance per configuration - */ - private LineStyleProvider[] fLineStyleProviders; - - /** - * Create new instance of StructuredTextViewerConfigurationDTD - */ - public StructuredTextViewerConfigurationDTD() { - // Must have empty constructor to createExecutableExtension - super(); - } - - public String[] getConfiguredContentTypes(ISourceViewer sourceViewer) { - if (fConfiguredContentTypes == null) { - fConfiguredContentTypes = new String[]{IDTDPartitions.DTD_DEFAULT, IStructuredPartitions.DEFAULT_PARTITION, IStructuredPartitions.UNKNOWN_PARTITION}; - } - return fConfiguredContentTypes; - } - - public LineStyleProvider[] getLineStyleProviders(ISourceViewer sourceViewer, String partitionType) { - if (fLineStyleProviders == null) { - fLineStyleProviders = new LineStyleProvider[]{createLineStyleProviderForDTD()}; - } - return fLineStyleProviders; - } - - private LineStyleProvider createLineStyleProviderForDTD() { - return new LineStyleProviderForDTD(); - } - -} diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/DTDUIMessages.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/DTDUIMessages.java deleted file mode 100644 index fc77591b3e..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/DTDUIMessages.java +++ /dev/null @@ -1,80 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM - Initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.dtd.ui.internal; - -import org.eclipse.osgi.util.NLS; - -/** - * Strings used by DTD UI - * - * @plannedfor 1.0 - */ -public class DTDUIMessages extends NLS { - private static final String BUNDLE_NAME = "org.eclipse.wst.dtd.ui.internal.DTDUIPluginResources";//$NON-NLS-1$ - - public static String _UI_ACTION_ADD_ATTRIBUTELIST; - public static String _UI_ACTION_ADD_DTD_NOTATION; - public static String _UI_ACTION_ADD_DTD_ENTITY; - public static String _UI_ACTION_ADD_DTD_ELEMENT; - public static String _UI_ACTION_ADD_DTD_COMMENT; - public static String _UI_ACTION_DTD_DELETE; - public static String _UI_ACTION_ADD_ATTRIBUTE; - public static String _UI_ACTION_GROUP_ADD_GROUP; - public static String _UI_ACTION_ADD_ELEMENT; - public static String _UI_BUTTON_GROUP_ITEMS_LOGICALLY; - public static String _UI_BUTTON_SORT_ITEMS; - public static String _UI_ACTION_ADD_PARAM_ENTITY_REF; - public static String _UI_MOVE_ATTRIBUTE; - public static String _UI_MOVE_CONTENT; - public static String _UI_MOVE_NODE; - public static String _UI_MOVE_NODES; - public static String _ERROR_FILENAME_MUST_END_DTD; - public static String Creating_files; - public static String DTDFilesPreferencePage_ExtensionLabel; - public static String DTDFilesPreferencePage_ExtensionError; - public static String DTDColorPage_0; - public static String DTDColorPage_1; - public static String DTDColorPage_2; - public static String DTDColorPage_3; - public static String DTDColorPage_4; - public static String DTDColorPage_5; - public static String DTDColorPage_6; - public static String DTDColorPage_7; - public static String DTDColorPage_8; - public static String DTDPropertySourceAdapter_0; - public static String DTDPropertySourceAdapter_1; - public static String DTDPropertySourceAdapter_2; - public static String SourceMenu_label; - public static String _UI_CREATE_NEW_DTD_FILE; - public static String _UI_WIZARD_NEW_DTD_TITLE; - public static String _UI_WIZARD_NEW_DTD_EXPL; - public static String _UI_LABEL_DTD_FILE_DELETE; - public static String ResourceGroup_nameExists; - public static String NewDTDTemplatesWizardPage_0; - public static String NewDTDTemplatesWizardPage_1; - public static String NewDTDTemplatesWizardPage_2; - public static String NewDTDTemplatesWizardPage_3; - public static String NewDTDTemplatesWizardPage_4; - public static String NewDTDTemplatesWizardPage_5; - public static String NewDTDTemplatesWizardPage_6; - public static String SyntaxColoringPage_0; - public static String SyntaxColoringPage_2; - public static String SyntaxColoringPage_3; - public static String SyntaxColoringPage_4; - public static String SyntaxColoringPage_5; - public static String SyntaxColoringPage_6; - public static String _UI_STRUCTURED_TEXT_EDITOR_PREFS_LINK; - - static { - // load message values from bundle file - NLS.initializeMessages(BUNDLE_NAME, DTDUIMessages.class); - } -} diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/DTDUIPlugin.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/DTDUIPlugin.java deleted file mode 100644 index e76e6db423..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/DTDUIPlugin.java +++ /dev/null @@ -1,99 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 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 - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ -package org.eclipse.wst.dtd.ui.internal; - -import java.io.IOException; - -import org.eclipse.core.resources.IWorkspace; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.jface.text.templates.ContextTypeRegistry; -import org.eclipse.jface.text.templates.persistence.TemplateStore; -import org.eclipse.ui.editors.text.templates.ContributionContextTypeRegistry; -import org.eclipse.ui.editors.text.templates.ContributionTemplateStore; -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.eclipse.wst.dtd.ui.internal.preferences.DTDUIPreferenceNames; -import org.eclipse.wst.dtd.ui.internal.templates.TemplateContextTypeIdsDTD; - -/** - * The main plugin class to be used in the desktop. - */ -public class DTDUIPlugin extends AbstractUIPlugin { - // The shared instance. - private static DTDUIPlugin plugin; - - /** - * The template store for the dtd ui. - */ - private TemplateStore fTemplateStore; - - /** - * The template context type registry for dtd ui. - */ - private ContextTypeRegistry fContextTypeRegistry; - - /** - * Returns the shared instance. - */ - public static DTDUIPlugin getDefault() { - return plugin; - } - - /** - * Returns the workspace instance. - */ - public static IWorkspace getWorkspace() { - return ResourcesPlugin.getWorkspace(); - } - - /** - * The constructor. - */ - public DTDUIPlugin() { - super(); - plugin = this; - } - - /** - * Returns the template store for the dtd editor templates. - * - * @return the template store for the dtd editor templates - */ - public TemplateStore getTemplateStore() { - if (fTemplateStore == null) { - fTemplateStore = new ContributionTemplateStore(getTemplateContextRegistry(), getPreferenceStore(), DTDUIPreferenceNames.TEMPLATES_KEY); - - try { - fTemplateStore.load(); - } catch (IOException e) { - Logger.logException(e); - } - } - return fTemplateStore; - } - - /** - * Returns the template context type registry for the dtd plugin. - * - * @return the template context type registry for the dtd plugin - */ - public ContextTypeRegistry getTemplateContextRegistry() { - if (fContextTypeRegistry == null) { - ContributionContextTypeRegistry registry = new ContributionContextTypeRegistry(); - registry.addContextType(TemplateContextTypeIdsDTD.NEW); - - fContextTypeRegistry = registry; - } - - return fContextTypeRegistry; - } -} diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/DTDUIPluginResources.properties b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/DTDUIPluginResources.properties deleted file mode 100644 index d4ae96cfc3..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/DTDUIPluginResources.properties +++ /dev/null @@ -1,89 +0,0 @@ -############################################################################### -# Copyright (c) 2005, 2008 IBM Corporation and others. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# IBM Corporation - initial API and implementation -############################################################################### - -_UI_ACTION_ADD_ATTRIBUTELIST=Add Attribute &List - -!DTDOutliner -_UI_ACTION_ADD_DTD_NOTATION=Add &Notation -_UI_ACTION_ADD_DTD_ENTITY=Add &Entity -_UI_ACTION_ADD_DTD_ELEMENT=Add Ele&ment -_UI_ACTION_ADD_DTD_COMMENT=Add &Comment -_UI_ACTION_DTD_DELETE=&Delete -_UI_ACTION_ADD_ATTRIBUTE=Add &Attribute -_UI_ACTION_GROUP_ADD_GROUP=Add Group to Con&tent Model -_UI_ACTION_ADD_ELEMENT=Add Element to C&ontent Model - -!DTDContentOutlinePage -_UI_BUTTON_GROUP_ITEMS_LOGICALLY=Group items logically. -_UI_BUTTON_SORT_ITEMS=Sort items alphabetically. - -!DTDContextContributer -_UI_ACTION_ADD_PARAM_ENTITY_REF=Add &Parameter Entity Reference - -!DragAttributeCommand -_UI_MOVE_ATTRIBUTE=Move Attribute - -!DragContentModelCommand -_UI_MOVE_CONTENT=Move Content - -!DragTopLevelNodesCommand -_UI_MOVE_NODE=Move Node -_UI_MOVE_NODES=Move Nodes - -_ERROR_FILENAME_MUST_END_DTD=The file name must end in one of the following extensions {0}. - -#DTD File page -Creating_files=Creating files -DTDFilesPreferencePage_ExtensionLabel=Add this suffix (if not specified): -DTDFilesPreferencePage_ExtensionError=Suffix must be one of the following {0}. - -#DTD Style page -DTDColorPage_0=<!ELEMENT Main (One,Two+)>\r\n<!ELEMENT One (Three,Four)>\r\n<!ATTLIST One\r\n oneone CDATA #REQUIRED\r\n>\r\n<!-- You need this -->\r\n<!ELEMENT Two (moremore*)>\r\n<!ATTLIST Two\r\n twotwo CDATA #REQUIRED\r\n twothree (aaa | bbb) "aaa"\r\n>\r\n -DTDColorPage_1=Comments -DTDColorPage_2=Data -DTDColorPage_3=Default -DTDColorPage_4=Keywords -DTDColorPage_5=Strings -DTDColorPage_6=Symbols -DTDColorPage_7=Tag Delimiters -DTDColorPage_8=Tag Names -DTDPropertySourceAdapter_0=Name -DTDPropertySourceAdapter_1=Contents -DTDPropertySourceAdapter_2=Attributes - -! NewDTDWizard.java -_UI_CREATE_NEW_DTD_FILE = Create a new DTD file. -_UI_WIZARD_NEW_DTD_TITLE = Create DTD -_UI_WIZARD_NEW_DTD_EXPL = Create a new DTD file. Specify the folder and name for the file. - -# copied from dtd core -_UI_LABEL_DTD_FILE_DELETE=Delete -## -ResourceGroup_nameExists = The same name already exists. -NewDTDTemplatesWizardPage_0=Select DTD Template -NewDTDTemplatesWizardPage_1=Select a template as initial content in the DTD page. -NewDTDTemplatesWizardPage_2=Name -NewDTDTemplatesWizardPage_3=Description -NewDTDTemplatesWizardPage_4=Use DTD Template -NewDTDTemplatesWizardPage_5=Preview: -NewDTDTemplatesWizardPage_6=Templates are 'New DTD' templates found in the <a>DTD Templates</a> preference page. - -SourceMenu_label=Source - -SyntaxColoringPage_0=Syntax Element: -SyntaxColoringPage_2=Enable -SyntaxColoringPage_3=&Bold -SyntaxColoringPage_4=&Italic -SyntaxColoringPage_5=&Strikethrough -SyntaxColoringPage_6=&Underline - -_UI_STRUCTURED_TEXT_EDITOR_PREFS_LINK=DTD preferences. Note that some preferences may be set on the <a>{0}</a> preference page. - diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/Logger.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/Logger.java deleted file mode 100644 index d224ef26f2..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/Logger.java +++ /dev/null @@ -1,143 +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 - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ -package org.eclipse.wst.dtd.ui.internal; - -import com.ibm.icu.util.StringTokenizer; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.Status; -import org.osgi.framework.Bundle; - -/** - * Small convenience class to log messages to plugin's log file and also, if - * desired, the console. This class should only be used by classes in this - * plugin. Other plugins should make their own copy, with appropriate ID. - */ -public class Logger { - private static final String PLUGIN_ID = "org.eclipse.wst.dtd.ui"; //$NON-NLS-1$ - - public static final int ERROR = IStatus.ERROR; // 4 - public static final int ERROR_DEBUG = 200 + ERROR; - public static final int INFO = IStatus.INFO; // 1 - public static final int INFO_DEBUG = 200 + INFO; - - public static final int OK = IStatus.OK; // 0 - - public static final int OK_DEBUG = 200 + OK; - - private static final String TRACEFILTER_LOCATION = "/debug/tracefilter"; //$NON-NLS-1$ - public static final int WARNING = IStatus.WARNING; // 2 - public static final int WARNING_DEBUG = 200 + WARNING; - - /** - * Adds message to log. - * - * @param level - * severity level of the message (OK, INFO, WARNING, ERROR, - * OK_DEBUG, INFO_DEBUG, WARNING_DEBUG, ERROR_DEBUG) - * @param message - * text to add to the log - * @param exception - * exception thrown - */ - protected static void _log(int level, String message, Throwable exception) { - if (level == OK_DEBUG || level == INFO_DEBUG || level == WARNING_DEBUG || level == ERROR_DEBUG) { - if (!isDebugging()) - return; - } - - int severity = IStatus.OK; - switch (level) { - case INFO_DEBUG : - case INFO : - severity = IStatus.INFO; - break; - case WARNING_DEBUG : - case WARNING : - severity = IStatus.WARNING; - break; - case ERROR_DEBUG : - case ERROR : - severity = IStatus.ERROR; - } - Status statusObj = new Status(severity, PLUGIN_ID, severity, message, exception); - Bundle bundle = Platform.getBundle(PLUGIN_ID); - if (bundle != null) - Platform.getLog(bundle).log(statusObj); - } - - /** - * Prints message to log if category matches /debug/tracefilter option. - * - * @param message - * text to print - * @param category - * category of the message, to be compared with - * /debug/tracefilter - */ - protected static void _trace(String category, String message, Throwable exception) { - if (!isDebugging()) - return; - - String traceFilter = Platform.getDebugOption(PLUGIN_ID + TRACEFILTER_LOCATION); - if (traceFilter != null) { - StringTokenizer tokenizer = new StringTokenizer(traceFilter, ","); //$NON-NLS-1$ - while (tokenizer.hasMoreTokens()) { - String cat = tokenizer.nextToken().trim(); - if (category.equals(cat)) { - Status statusObj = new Status(IStatus.OK, PLUGIN_ID, IStatus.OK, message, exception); - Bundle bundle = Platform.getBundle(PLUGIN_ID); - if (bundle != null) - Platform.getLog(bundle).log(statusObj); - return; - } - } - } - } - - /** - * @return true if the platform is debugging - */ - public static boolean isDebugging() { - return Platform.inDebugMode(); - } - - public static void log(int level, String message) { - _log(level, message, null); - } - - public static void log(int level, String message, Throwable exception) { - _log(level, message, exception); - } - - public static void logException(String message, Throwable exception) { - _log(ERROR, message, exception); - } - - public static void logException(Throwable exception) { - _log(ERROR, exception.getMessage(), exception); - } - - public static void trace(String category, String message) { - _trace(category, message, null); - } - - public static void traceException(String category, String message, Throwable exception) { - _trace(category, message, exception); - } - - public static void traceException(String category, Throwable exception) { - _trace(category, exception.getMessage(), exception); - } -} diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/dnd/DTDDragAndDropManager.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/dnd/DTDDragAndDropManager.java deleted file mode 100644 index a95050d6a7..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/dnd/DTDDragAndDropManager.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 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 - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ - - -package org.eclipse.wst.dtd.ui.internal.dnd; - -import java.util.Collection; - -import org.eclipse.wst.common.ui.internal.dnd.DragAndDropCommand; -import org.eclipse.wst.common.ui.internal.dnd.DragAndDropManager; -import org.eclipse.wst.dtd.core.internal.Attribute; -import org.eclipse.wst.dtd.core.internal.CMNode; -import org.eclipse.wst.dtd.core.internal.DTDNode; -import org.eclipse.wst.dtd.core.internal.TopLevelNode; - -public class DTDDragAndDropManager implements DragAndDropManager { - - public DragAndDropCommand createCommand(Object target, float location, int operations, int operation, Collection source) { - if (target instanceof DTDNode) { - DTDNode node = (DTDNode) target; - - if (node instanceof TopLevelNode) { - return new DragTopLevelNodesCommand(target, location, operations, operation, source); - } - if (node instanceof Attribute) { - return new DragAttributeCommand(target, location, operations, operation, source); - } - if (node instanceof CMNode) { - return new DragContentModelCommand(target, location, operations, operation, source); - } - - } - return null; - } - -} diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/dnd/DragAttributeCommand.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/dnd/DragAttributeCommand.java deleted file mode 100644 index 45511c1cf3..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/dnd/DragAttributeCommand.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 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 - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ -package org.eclipse.wst.dtd.ui.internal.dnd; - -import java.util.Collection; -import java.util.Iterator; - -import org.eclipse.wst.common.ui.internal.dnd.DefaultDragAndDropCommand; -import org.eclipse.wst.dtd.core.internal.Attribute; -import org.eclipse.wst.dtd.core.internal.AttributeList; -import org.eclipse.wst.dtd.core.internal.DTDFile; -import org.eclipse.wst.dtd.core.internal.DTDNode; -import org.eclipse.wst.dtd.ui.internal.DTDUIMessages; - - - -public class DragAttributeCommand extends DefaultDragAndDropCommand { - - public DragAttributeCommand(Object target, float location, int operations, int operation, Collection sources) { - super(target, location, operations, operation, sources); - } - - public boolean canExecute() { - Iterator iter = sources.iterator(); - while (iter.hasNext()) { - Object source = iter.next(); - if (!(source instanceof Attribute)) { - return false; - } - } - return true; - } - - public void execute() { - DTDNode referenceNode = (DTDNode) target; - DTDFile dtdFile = referenceNode.getDTDFile(); - if (referenceNode instanceof Attribute) { - dtdFile.getDTDModel().beginRecording(this, DTDUIMessages._UI_MOVE_ATTRIBUTE); //$NON-NLS-1$ - AttributeList attList = (AttributeList) referenceNode.getParentNode(); - Iterator iter = sources.iterator(); - while (iter.hasNext()) { - DTDNode node = (DTDNode) iter.next(); - if (node instanceof Attribute) { - attList.insertIntoModel(this, (Attribute) referenceNode, (Attribute) node, isAfter()); - dtdFile.deleteNode(this, node); - } - } - dtdFile.getDTDModel().endRecording(this); - } - } -} diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/dnd/DragContentModelCommand.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/dnd/DragContentModelCommand.java deleted file mode 100644 index 51cdb8735f..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/dnd/DragContentModelCommand.java +++ /dev/null @@ -1,113 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 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 - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ - - -package org.eclipse.wst.dtd.ui.internal.dnd; - -import java.util.Collection; -import java.util.Iterator; - -import org.eclipse.swt.dnd.DND; -import org.eclipse.wst.common.ui.internal.dnd.DefaultDragAndDropCommand; -import org.eclipse.wst.dtd.core.internal.CMBasicNode; -import org.eclipse.wst.dtd.core.internal.CMGroupNode; -import org.eclipse.wst.dtd.core.internal.CMNode; -import org.eclipse.wst.dtd.core.internal.DTDFile; -import org.eclipse.wst.dtd.core.internal.DTDNode; -import org.eclipse.wst.dtd.core.internal.Element; -import org.eclipse.wst.dtd.ui.internal.DTDUIMessages; - - -public class DragContentModelCommand extends DefaultDragAndDropCommand { - - public DragContentModelCommand(Object target, float location, int operations, int operation, Collection sources) { - super(target, location, operations, operation, sources); - } - - public boolean canExecute() { - if (!(target instanceof CMNode)) { - return false; - } - - Iterator iter = sources.iterator(); - while (iter.hasNext()) { - Object source = iter.next(); - if (!(source instanceof CMNode)) { - return false; - } - } - return true; - } - - public void execute() { - DTDNode referenceNode = (DTDNode) target; - - if (referenceNode instanceof CMNode) { - DTDFile dtdFile = referenceNode.getDTDFile(); - - DTDNode parent = (DTDNode) referenceNode.getParentNode(); - dtdFile.getDTDModel().beginRecording(this, DTDUIMessages._UI_MOVE_CONTENT); //$NON-NLS-1$ - boolean parentIsElement = false; - Element element = null; - CMGroupNode group = null; - if (parent instanceof Element) { - parentIsElement = true; - element = (Element) parent; - } - else { - group = (CMGroupNode) parent; - } - - if (element == null && group == null) { - // no parent to add to - return; - } - - Iterator iter = sources.iterator(); - while (iter.hasNext()) { - DTDNode node = (DTDNode) iter.next(); - if (node instanceof CMNode) { - if (parentIsElement) { - if (element.getContentModel() == node) { - continue; - } - element.replaceContentModel(this, (CMNode) node); - } - else { - if (referenceNode == node || (isAfter() && referenceNode.getNextSibling() == node) || (!isAfter() && node.getNextSibling() == referenceNode)) { - continue; - } - - group.insertIntoModel(this, (CMNode) referenceNode, (CMNode) node, isAfter()); - - } - DTDNode nodeParent = (DTDNode) node.getParentNode(); - nodeParent.delete(this, node); - } - } - dtdFile.getDTDModel().endRecording(this); - } - } - - public int getFeedback() { - DTDNode referenceNode = (DTDNode) target; - if (referenceNode instanceof CMNode) { - CMNode cmNode = (CMNode) referenceNode; - if (cmNode.isRootElementContent() && cmNode instanceof CMBasicNode) { - return DND.FEEDBACK_SELECT; - } - } - - return super.getFeedback(); - } -} diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/dnd/DragTopLevelNodesCommand.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/dnd/DragTopLevelNodesCommand.java deleted file mode 100644 index 59b872eff9..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/dnd/DragTopLevelNodesCommand.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 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 - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ - - -package org.eclipse.wst.dtd.ui.internal.dnd; - -import java.util.Collection; -import java.util.Iterator; - -import org.eclipse.wst.common.ui.internal.dnd.DefaultDragAndDropCommand; -import org.eclipse.wst.dtd.core.internal.DTDFile; -import org.eclipse.wst.dtd.core.internal.DTDNode; -import org.eclipse.wst.dtd.core.internal.TopLevelNode; -import org.eclipse.wst.dtd.ui.internal.DTDUIMessages; - -public class DragTopLevelNodesCommand extends DefaultDragAndDropCommand { - - static private final String moveNode = DTDUIMessages._UI_MOVE_NODE; //$NON-NLS-1$ - static private final String moveNodes = DTDUIMessages._UI_MOVE_NODES; //$NON-NLS-1$ - - public DragTopLevelNodesCommand(Object target, float location, int operations, int operation, Collection sources) { - super(target, location, operations, operation, sources); - } - - public boolean canExecute() { - if (!(target instanceof TopLevelNode)) { - return false; - } - - Iterator iter = sources.iterator(); - while (iter.hasNext()) { - Object source = iter.next(); - if (!(source instanceof TopLevelNode)) { - return false; - } - } - return true; - } - - public void execute() { - DTDNode referenceNode = (DTDNode) target; - - DTDFile dtdFile = referenceNode.getDTDFile(); - dtdFile.getDTDModel().beginRecording(this, sources.size() > 1 ? moveNodes : moveNode); - Iterator iter = sources.iterator(); - while (iter.hasNext()) { - DTDNode node = (DTDNode) iter.next(); - if (node instanceof TopLevelNode) { - dtdFile.moveNode(this, referenceNode, node, isAfter()); - } - } - dtdFile.getDTDModel().endRecording(this); - } -} diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/editor/ActionContributorDTD.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/editor/ActionContributorDTD.java deleted file mode 100644 index a624936ea5..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/editor/ActionContributorDTD.java +++ /dev/null @@ -1,77 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ -package org.eclipse.wst.dtd.ui.internal.editor; - -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.action.MenuManager; -import org.eclipse.ui.IWorkbenchActionConstants; -import org.eclipse.wst.dtd.ui.internal.DTDUIMessages; -import org.eclipse.wst.sse.ui.internal.actions.ActionContributor; - -/** - * XMLEditorActionContributor - * - * This class should not be used inside multi page editor's - * ActionBarContributor, since cascaded init() call from the - * ActionBarContributor will causes exception and it leads to lose whole - * toolbars. - * - * Instead, use SourcePageActionContributor for source page contributor of - * multi page editor. - * - * Note that this class is still valid for single page editor. - */ -public class ActionContributorDTD extends ActionContributor { - protected static final String[] EDITOR_IDS = {"org.eclipse.wst.dtd.core.dtdsource.source", "org.eclipse.wst.sse.ui.StructuredTextEditor"}; //$NON-NLS-1$ //$NON-NLS-2$ - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.sse.ui.edit.util.ActionContributor#getExtensionIDs() - */ - protected String[] getExtensionIDs() { - return EDITOR_IDS; - } - - protected void addToMenu(IMenuManager menu) { - // edit commands - IMenuManager editMenu = menu.findMenuUsingPath(IWorkbenchActionConstants.M_EDIT); - if (editMenu != null) { - editMenu.add(fCommandsSeparator); - editMenu.add(fToggleInsertModeAction); - editMenu.add(fCommandsSeparator); - editMenu.add(fExpandSelectionToMenu); - editMenu.add(fCommandsSeparator); - editMenu.add(fMenuAdditionsGroupMarker); - } - - // source commands - String sourceMenuLabel = DTDUIMessages.SourceMenu_label; - String sourceMenuId = "sourceMenuId"; //$NON-NLS-1$ - IMenuManager sourceMenu = new MenuManager(sourceMenuLabel, sourceMenuId); - menu.insertAfter(IWorkbenchActionConstants.M_EDIT, sourceMenu); - if (sourceMenu != null) { - sourceMenu.add(fCommandsSeparator); - sourceMenu.add(fShiftRight); - sourceMenu.add(fShiftLeft); - sourceMenu.add(fCommandsSeparator); - } - IMenuManager navigateMenu = menu.findMenuUsingPath(IWorkbenchActionConstants.M_NAVIGATE); - if (navigateMenu != null) { - IMenuManager gotoGroup = navigateMenu.findMenuUsingPath(IWorkbenchActionConstants.GO_TO); - if (gotoGroup != null) { - gotoGroup.add(fGotoMatchingBracketAction); - } - } - } -} diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/editor/DTDEditorPluginImageHelper.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/editor/DTDEditorPluginImageHelper.java deleted file mode 100644 index 70d949d4cb..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/editor/DTDEditorPluginImageHelper.java +++ /dev/null @@ -1,157 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 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 - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ -package org.eclipse.wst.dtd.ui.internal.editor; - -import java.util.HashMap; - -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.resource.ImageRegistry; -import org.eclipse.jface.resource.JFaceResources; -import org.eclipse.swt.graphics.Image; -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.eclipse.wst.dtd.ui.internal.DTDUIPlugin; - - -/** - * Helper class to handle images provided by this plug-in. - * - * NOTE: For internal use only. For images used externally, please use the - * Shared***ImageHelper class instead. - * - * @author amywu - */ -public class DTDEditorPluginImageHelper { - private static DTDEditorPluginImageHelper instance = null; - - /** - * Gets the instance. - * - * @return Returns a DTDEditorPluginImageHelper - */ - public synchronized static DTDEditorPluginImageHelper getInstance() { - if (instance == null) - instance = new DTDEditorPluginImageHelper(); - return instance; - } - - // save a descriptor for each image - private HashMap fImageDescRegistry = null; - private final String PLUGINID = DTDUIPlugin.getDefault().getBundle().getSymbolicName(); - - /** - * Creates an image from the given resource and adds the image to the - * image registry. - * - * @param resource - * @return Image - */ - private Image createImage(String resource) { - ImageDescriptor desc = getImageDescriptor(resource); - Image image = null; - - if (desc != null) { - image = desc.createImage(); - // dont add the missing image descriptor image to the image - // registry - if (!desc.equals(ImageDescriptor.getMissingImageDescriptor())) - getImageRegistry().put(resource, image); - } - return image; - } - - /** - * Creates an image descriptor from the given imageFilePath and adds the - * image descriptor to the image descriptor registry. If an image - * descriptor could not be created, the default "missing" image descriptor - * is returned but not added to the image descriptor registry. - * - * @param imageFilePath - * @return ImageDescriptor image descriptor for imageFilePath or default - * "missing" image descriptor if resource could not be found - */ - private ImageDescriptor createImageDescriptor(String imageFilePath) { - ImageDescriptor imageDescriptor = AbstractUIPlugin.imageDescriptorFromPlugin(PLUGINID, imageFilePath); - if (imageDescriptor != null) { - getImageDescriptorRegistry().put(imageFilePath, imageDescriptor); - } - else { - imageDescriptor = ImageDescriptor.getMissingImageDescriptor(); - } - - return imageDescriptor; - } - - /** - * Retrieves the image associated with resource from the image registry. - * If the image cannot be retrieved, attempt to find and load the image at - * the location specified in resource. - * - * @param resource - * the image to retrieve - * @return Image the image associated with resource or null if one could - * not be found - */ - public Image getImage(String resource) { - Image image = getImageRegistry().get(resource); - if (image == null) { - // create an image - image = createImage(resource); - } - return image; - } - - /** - * Retrieves the image descriptor associated with resource from the image - * descriptor registry. If the image descriptor cannot be retrieved, - * attempt to find and load the image descriptor at the location specified - * in resource. - * - * @param resource - * the image descriptor to retrieve - * @return ImageDescriptor the image descriptor assocated with resource or - * the default "missing" image descriptor if one could not be - * found - */ - public ImageDescriptor getImageDescriptor(String resource) { - ImageDescriptor imageDescriptor = null; - Object o = getImageDescriptorRegistry().get(resource); - if (o == null) { - // create a descriptor - imageDescriptor = createImageDescriptor(resource); - } - else { - imageDescriptor = (ImageDescriptor) o; - } - return imageDescriptor; - } - - /** - * Returns the image descriptor registry for this plugin. - * - * @return HashMap - image descriptor registry for this plugin - */ - private HashMap getImageDescriptorRegistry() { - if (fImageDescRegistry == null) - fImageDescRegistry = new HashMap(); - return fImageDescRegistry; - } - - /** - * Returns the image registry for this plugin. - * - * @return ImageRegistry - image registry for this plugin - */ - private ImageRegistry getImageRegistry() { - return JFaceResources.getImageRegistry(); - } -} diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/editor/DTDEditorPluginImages.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/editor/DTDEditorPluginImages.java deleted file mode 100644 index bb2befbabb..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/editor/DTDEditorPluginImages.java +++ /dev/null @@ -1,44 +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 - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ -package org.eclipse.wst.dtd.ui.internal.editor; - -/** - * Bundle of most images used by the DTD Source Editor plug-in. - */ -public class DTDEditorPluginImages { - public static final String IMG_CTOOL_ADD_ATTRIBUTE = "icons/full/ctool16/ADD_Attribute.gif"; //$NON-NLS-1$ - - public static final String IMG_CTOOL_ADD_ELEMENT = "icons/full/ctool16/ADD_Element.gif"; //$NON-NLS-1$ - - public static final String IMG_CTOOL_ADD_ELEMENTTOCONMODEL = "icons/full/ctool16/ADD_ElementToConModel.gif"; //$NON-NLS-1$ - - public static final String IMG_CTOOL_ADD_GROUPTOCONMODEL = "icons/full/ctool16/ADD_GroupToConModel.gif"; //$NON-NLS-1$ - public static final String IMG_DTOOL_ADD_ATTRIBUTE = "icons/full/dtool16/ADD_Attribute.gif"; //$NON-NLS-1$ - public static final String IMG_DTOOL_ADD_ELEMENT = "icons/full/dtool16/ADD_Element.gif"; //$NON-NLS-1$ - public static final String IMG_DTOOL_ADD_ELEMENTTOCONMODEL = "icons/full/dtool16/ADD_ElementToConModel.gif"; //$NON-NLS-1$ - public static final String IMG_DTOOL_ADD_GROUPTOCONMODEL = "icons/full/dtool16/ADD_GroupToConModel.gif"; //$NON-NLS-1$ - public static final String IMG_ETOOL_ADD_ATTRIBUTE = "icons/full/etool16/ADD_Attribute.gif"; //$NON-NLS-1$ - public static final String IMG_ETOOL_ADD_ELEMENT = "icons/full/etool16/ADD_Element.gif"; //$NON-NLS-1$ - public static final String IMG_ETOOL_ADD_ELEMENTTOCONMODEL = "icons/full/etool16/ADD_ElementToConModel.gif"; //$NON-NLS-1$ - public static final String IMG_ETOOL_ADD_GROUPTOCONMODEL = "icons/full/etool16/ADD_GroupToConModel.gif"; //$NON-NLS-1$ - - public static final String IMG_OBJ_ADD_COMMENT = "icons/full/obj16/ADD_Comment.gif"; //$NON-NLS-1$ - public static final String IMG_OBJ_ADD_ENTITY = "icons/full/obj16/ADD_Entity.gif"; //$NON-NLS-1$ - public static final String IMG_OBJ_ADD_ENTITY_REFERENCE = "icons/full/obj16/ADD_Entity_Reference.gif"; //$NON-NLS-1$ - public static final String IMG_OBJ_ADD_NOTATION = "icons/full/obj16/ADD_Notation.gif"; //$NON-NLS-1$ - public static final String IMG_OBJ_ORGANIZE_DTD_LOGICALLY = "icons/full/obj16/organize_dtd_logically.gif"; //$NON-NLS-1$ - public static final String IMG_OBJ_SORT = "icons/full/obj16/sort.gif"; //$NON-NLS-1$ - public static final String IMG_OBJ_VALIDATE = "icons/full/obj16/validate.gif"; //$NON-NLS-1$ - - public static final String IMG_WIZBAN_NEWDTDFILE = "icons/full/wizban/newdtdfile_wiz.png"; //$NON-NLS-1$ -} diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/editor/IHelpContextIds.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/editor/IHelpContextIds.java deleted file mode 100644 index e0ce21090d..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/editor/IHelpContextIds.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 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 - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ -package org.eclipse.wst.dtd.ui.internal.editor; - -import org.eclipse.wst.dtd.ui.internal.DTDUIPlugin; - -/** - * Help context ids for the DTD Source Editor. - * <p> - * This interface contains constants only; it is not intended to be - * implemented. - * </p> - * - */ -public interface IHelpContextIds { - - // org.eclipse.wst.dtd.ui. - public static final String PREFIX = DTDUIPlugin.getDefault().getBundle().getSymbolicName() + "."; //$NON-NLS-1$ - // DTD Files Preference page - public static final String DTD_PREFWEBX_FILES_HELPID = PREFIX + "webx0020"; //$NON-NLS-1$ - // DTD Styles Preference page - public static final String DTD_PREFWEBX_STYLES_HELPID = PREFIX + "webx0021"; //$NON-NLS-1$ - // DTD Template Preference page (no id for this yet) - public static final String DTD_PREFWEBX_TEMPLATES_HELPID = PREFIX + "webx0022"; //$NON-NLS-1$ - - // // figured out on the fly - // // DTD Source page editor - // public static final String DTD_SOURCEVIEW_HELPID = - // ContentTypeIdForDTD.ContentTypeID_DTD + "_source_HelpId"; //$NON-NLS-1$ - - // DTD New File Wizard - Template Page - public static final String DTD_NEWWIZARD_TEMPLATE_HELPID = PREFIX + "dtdw0010"; //$NON-NLS-1$ -} diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/preferences/DTDColorPage.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/preferences/DTDColorPage.java deleted file mode 100644 index ed1855d55d..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/preferences/DTDColorPage.java +++ /dev/null @@ -1,171 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ -package org.eclipse.wst.dtd.ui.internal.preferences; - -import java.util.ArrayList; -import java.util.Dictionary; -import java.util.Hashtable; -import java.util.Iterator; - -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.ui.PlatformUI; -import org.eclipse.wst.dtd.core.internal.parser.DTDRegionTypes; -import org.eclipse.wst.dtd.core.internal.provisional.contenttype.ContentTypeIdForDTD; -import org.eclipse.wst.dtd.ui.internal.DTDUIMessages; -import org.eclipse.wst.dtd.ui.internal.DTDUIPlugin; -import org.eclipse.wst.dtd.ui.internal.editor.IHelpContextIds; -import org.eclipse.wst.dtd.ui.internal.style.IStyleConstantsDTD; -import org.eclipse.wst.sse.core.StructuredModelManager; -import org.eclipse.wst.sse.core.internal.provisional.IModelManager; -import org.eclipse.wst.sse.ui.internal.preferences.OverlayPreferenceStore; -import org.eclipse.wst.sse.ui.internal.preferences.OverlayPreferenceStore.OverlayKey; -import org.eclipse.wst.sse.ui.internal.preferences.ui.AbstractColorPage; -import org.eclipse.wst.sse.ui.internal.preferences.ui.StyledTextColorPicker; - -/** - * @deprecated - */ -public class DTDColorPage extends AbstractColorPage { - - protected Control createContents(Composite parent) { - Composite pageComponent = createComposite(parent, 1); - ((GridData) pageComponent.getLayoutData()).horizontalAlignment = GridData.HORIZONTAL_ALIGN_FILL; - - super.createContents(pageComponent); - PlatformUI.getWorkbench().getHelpSystem().setHelp(pageComponent, IHelpContextIds.DTD_PREFWEBX_STYLES_HELPID); - - return pageComponent; - } - - /** - * Set up all the style preference keys in the overlay store - */ - protected OverlayKey[] createOverlayStoreKeys() { - ArrayList overlayKeys = new ArrayList(); - - ArrayList styleList = new ArrayList(); - initStyleList(styleList); - Iterator i = styleList.iterator(); - while (i.hasNext()) { - overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, (String) i.next())); - } - - OverlayPreferenceStore.OverlayKey[] keys = new OverlayPreferenceStore.OverlayKey[overlayKeys.size()]; - overlayKeys.toArray(keys); - return keys; - } - - protected IPreferenceStore doGetPreferenceStore() { - return DTDUIPlugin.getDefault().getPreferenceStore(); - } - - public String getSampleText() { - return DTDUIMessages.DTDColorPage_0; //$NON-NLS-1$ - } - - protected void initContextStyleMap(Dictionary contextStyleMap) { - contextStyleMap.put(DTDRegionTypes.CONTENT_EMPTY, IStyleConstantsDTD.DTD_DATA); - contextStyleMap.put(DTDRegionTypes.CONTENT_ANY, IStyleConstantsDTD.DTD_DATA); - contextStyleMap.put(DTDRegionTypes.CONTENT_PCDATA, IStyleConstantsDTD.DTD_DATA); - contextStyleMap.put(DTDRegionTypes.NDATA_VALUE, IStyleConstantsDTD.DTD_DATA); - contextStyleMap.put(DTDRegionTypes.NAME, IStyleConstantsDTD.DTD_DATA); - contextStyleMap.put(DTDRegionTypes.ENTITY_PARM, IStyleConstantsDTD.DTD_DATA); - - contextStyleMap.put(DTDRegionTypes.ELEMENT_TAG, IStyleConstantsDTD.DTD_TAGNAME); - contextStyleMap.put(DTDRegionTypes.ENTITY_TAG, IStyleConstantsDTD.DTD_TAGNAME); - contextStyleMap.put(DTDRegionTypes.ATTLIST_TAG, IStyleConstantsDTD.DTD_TAGNAME); - contextStyleMap.put(DTDRegionTypes.NOTATION_TAG, IStyleConstantsDTD.DTD_TAGNAME); - - contextStyleMap.put(DTDRegionTypes.CONNECTOR, IStyleConstantsDTD.DTD_SYMBOL); - contextStyleMap.put(DTDRegionTypes.OCCUR_TYPE, IStyleConstantsDTD.DTD_SYMBOL); - - contextStyleMap.put(DTDRegionTypes.START_TAG, IStyleConstantsDTD.DTD_TAG); - contextStyleMap.put(DTDRegionTypes.END_TAG, IStyleConstantsDTD.DTD_TAG); - contextStyleMap.put(DTDRegionTypes.EXCLAMATION, IStyleConstantsDTD.DTD_TAG); - - contextStyleMap.put(DTDRegionTypes.COMMENT_START, IStyleConstantsDTD.DTD_COMMENT); - contextStyleMap.put(DTDRegionTypes.COMMENT_CONTENT, IStyleConstantsDTD.DTD_COMMENT); - contextStyleMap.put(DTDRegionTypes.COMMENT_END, IStyleConstantsDTD.DTD_COMMENT); - - contextStyleMap.put(DTDRegionTypes.SINGLEQUOTED_LITERAL, IStyleConstantsDTD.DTD_STRING); - contextStyleMap.put(DTDRegionTypes.DOUBLEQUOTED_LITERAL, IStyleConstantsDTD.DTD_STRING); - - contextStyleMap.put(DTDRegionTypes.SYSTEM_KEYWORD, IStyleConstantsDTD.DTD_KEYWORD); - contextStyleMap.put(DTDRegionTypes.PUBLIC_KEYWORD, IStyleConstantsDTD.DTD_KEYWORD); - contextStyleMap.put(DTDRegionTypes.NDATA_KEYWORD, IStyleConstantsDTD.DTD_KEYWORD); - contextStyleMap.put(DTDRegionTypes.CDATA_KEYWORD, IStyleConstantsDTD.DTD_KEYWORD); - contextStyleMap.put(DTDRegionTypes.ID_KEYWORD, IStyleConstantsDTD.DTD_KEYWORD); - contextStyleMap.put(DTDRegionTypes.IDREF_KEYWORD, IStyleConstantsDTD.DTD_KEYWORD); - contextStyleMap.put(DTDRegionTypes.IDREFS_KEYWORD, IStyleConstantsDTD.DTD_KEYWORD); - contextStyleMap.put(DTDRegionTypes.ENTITY_KEYWORD, IStyleConstantsDTD.DTD_KEYWORD); - contextStyleMap.put(DTDRegionTypes.ENTITIES_KEYWORD, IStyleConstantsDTD.DTD_KEYWORD); - contextStyleMap.put(DTDRegionTypes.NMTOKEN_KEYWORD, IStyleConstantsDTD.DTD_KEYWORD); - contextStyleMap.put(DTDRegionTypes.NMTOKENS_KEYWORD, IStyleConstantsDTD.DTD_KEYWORD); - contextStyleMap.put(DTDRegionTypes.NOTATION_KEYWORD, IStyleConstantsDTD.DTD_KEYWORD); - contextStyleMap.put(DTDRegionTypes.REQUIRED_KEYWORD, IStyleConstantsDTD.DTD_KEYWORD); - contextStyleMap.put(DTDRegionTypes.IMPLIED_KEYWORD, IStyleConstantsDTD.DTD_KEYWORD); - contextStyleMap.put(DTDRegionTypes.FIXED_KEYWORD, IStyleConstantsDTD.DTD_KEYWORD); - } - - protected void initDescriptions(Dictionary descriptions) { - descriptions.put(IStyleConstantsDTD.DTD_COMMENT, DTDUIMessages.DTDColorPage_1); //$NON-NLS-1$ - descriptions.put(IStyleConstantsDTD.DTD_DATA, DTDUIMessages.DTDColorPage_2); //$NON-NLS-1$ - descriptions.put(IStyleConstantsDTD.DTD_DEFAULT, DTDUIMessages.DTDColorPage_3); //$NON-NLS-1$ - descriptions.put(IStyleConstantsDTD.DTD_KEYWORD, DTDUIMessages.DTDColorPage_4); //$NON-NLS-1$ - descriptions.put(IStyleConstantsDTD.DTD_STRING, DTDUIMessages.DTDColorPage_5); //$NON-NLS-1$ - descriptions.put(IStyleConstantsDTD.DTD_SYMBOL, DTDUIMessages.DTDColorPage_6); //$NON-NLS-1$ - descriptions.put(IStyleConstantsDTD.DTD_TAG, DTDUIMessages.DTDColorPage_7); //$NON-NLS-1$ - descriptions.put(IStyleConstantsDTD.DTD_TAGNAME, DTDUIMessages.DTDColorPage_8); //$NON-NLS-1$ - } - - protected void initStyleList(ArrayList list) { - list.add(IStyleConstantsDTD.DTD_COMMENT); - list.add(IStyleConstantsDTD.DTD_DATA); - list.add(IStyleConstantsDTD.DTD_DEFAULT); - list.add(IStyleConstantsDTD.DTD_KEYWORD); - list.add(IStyleConstantsDTD.DTD_STRING); - list.add(IStyleConstantsDTD.DTD_SYMBOL); - list.add(IStyleConstantsDTD.DTD_TAG); - list.add(IStyleConstantsDTD.DTD_TAGNAME); - } - - protected void setupPicker(StyledTextColorPicker picker) { - IModelManager mmanager = StructuredModelManager.getModelManager(); - picker.setParser(mmanager.createStructuredDocumentFor(ContentTypeIdForDTD.ContentTypeID_DTD).getParser()); - - Dictionary descriptions = new Hashtable(); - initDescriptions(descriptions); - - Dictionary contextStyleMap = new Hashtable(); - initContextStyleMap(contextStyleMap); - - ArrayList styleList = new ArrayList(); - initStyleList(styleList); - - picker.setContextStyleMap(contextStyleMap); - picker.setDescriptions(descriptions); - picker.setStyleList(styleList); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.sse.ui.preferences.ui.AbstractColorPage#savePreferences() - */ - protected void savePreferences() { - DTDUIPlugin.getDefault().savePluginPreferences(); - } -} diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/preferences/DTDFilesPreferencePage.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/preferences/DTDFilesPreferencePage.java deleted file mode 100644 index 7bff14c6cc..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/preferences/DTDFilesPreferencePage.java +++ /dev/null @@ -1,160 +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 - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ -package org.eclipse.wst.dtd.ui.internal.preferences; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.Preferences; -import org.eclipse.core.runtime.content.IContentType; -import org.eclipse.jface.layout.GridDataFactory; -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.osgi.util.NLS; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Group; -import org.eclipse.swt.widgets.Label; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.dialogs.PreferenceLinkArea; -import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer; -import org.eclipse.wst.dtd.core.internal.DTDCorePlugin; -import org.eclipse.wst.dtd.core.internal.preferences.DTDCorePreferenceNames; -import org.eclipse.wst.dtd.core.internal.provisional.contenttype.ContentTypeIdForDTD; -import org.eclipse.wst.dtd.ui.internal.DTDUIMessages; -import org.eclipse.wst.dtd.ui.internal.DTDUIPlugin; -import org.eclipse.wst.dtd.ui.internal.editor.IHelpContextIds; -import org.eclipse.wst.sse.ui.internal.preferences.ui.AbstractPreferencePage; - - -public class DTDFilesPreferencePage extends AbstractPreferencePage { - private Combo fDefaultSuffix = null; - private List fValidExtensions = null; - - protected Control createContents(final Composite parent) { - Composite composite = super.createComposite(parent, 1); - PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, IHelpContextIds.DTD_PREFWEBX_FILES_HELPID); - - new PreferenceLinkArea(composite, SWT.WRAP | SWT.MULTI, "org.eclipse.wst.sse.ui.preferences.editor", DTDUIMessages._UI_STRUCTURED_TEXT_EDITOR_PREFS_LINK,//$NON-NLS-1$ - (IWorkbenchPreferenceContainer) getContainer(), null).getControl().setLayoutData(GridDataFactory.fillDefaults().hint(150, SWT.DEFAULT).create()); - new Label(composite, SWT.NONE).setLayoutData(GridDataFactory.swtDefaults().create()); - - - Group creatingGroup = createGroup(composite, 2); - creatingGroup.setText(DTDUIMessages.Creating_files); - - // Default extension for New file Wizard - createLabel(creatingGroup, DTDUIMessages.DTDFilesPreferencePage_ExtensionLabel); - fDefaultSuffix = createDropDownBox(creatingGroup); - String[] validExtensions = (String[]) getValidExtensions().toArray(new String[0]); - Arrays.sort(validExtensions); - fDefaultSuffix.setItems(validExtensions); - fDefaultSuffix.addSelectionListener(this); - - setSize(composite); - loadPreferences(); - - return composite; - } - - public void dispose() { - fDefaultSuffix.removeModifyListener(this); - super.dispose(); - } - - protected IPreferenceStore doGetPreferenceStore() { - return DTDUIPlugin.getDefault().getPreferenceStore(); - } - - protected void doSavePreferenceStore() { - DTDCorePlugin.getInstance().savePluginPreferences(); // model - } - - /** - * Get content type associated with this new file wizard - * - * @return IContentType - */ - private IContentType getContentType() { - return Platform.getContentTypeManager().getContentType(ContentTypeIdForDTD.ContentTypeID_DTD); - } - - /** - * Get list of valid extensions - * - * @return List - */ - private List getValidExtensions() { - if (fValidExtensions == null) { - IContentType type = getContentType(); - fValidExtensions = new ArrayList(Arrays.asList(type.getFileSpecs(IContentType.FILE_EXTENSION_SPEC))); - } - return fValidExtensions; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.sse.ui.preferences.ui.AbstractPreferencePage#getModelPreferences() - */ - protected Preferences getModelPreferences() { - return DTDCorePlugin.getInstance().getPluginPreferences(); - } - - protected void initializeValues() { - String suffix = getModelPreferences().getString(DTDCorePreferenceNames.DEFAULT_EXTENSION); - fDefaultSuffix.setText(suffix); - } - - protected void performDefaults() { - String suffix = getModelPreferences().getDefaultString(DTDCorePreferenceNames.DEFAULT_EXTENSION); - fDefaultSuffix.setText(suffix); - - super.performDefaults(); - } - - public boolean performOk() { - boolean result = super.performOk(); - - doSavePreferenceStore(); - - return result; - } - - protected void storeValues() { - String suffix = fDefaultSuffix.getText(); - getModelPreferences().setValue(DTDCorePreferenceNames.DEFAULT_EXTENSION, suffix); - } - - protected void validateValues() { - boolean isValid = false; - Iterator i = getValidExtensions().iterator(); - while (i.hasNext() && !isValid) { - String extension = (String) i.next(); - isValid = extension.equalsIgnoreCase(fDefaultSuffix.getText()); - } - - if (!isValid) { - setErrorMessage(NLS.bind(DTDUIMessages.DTDFilesPreferencePage_ExtensionError, getValidExtensions().toString())); - setValid(false); - } - else { - setErrorMessage(null); - setValid(true); - } - } -} diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/preferences/DTDSyntaxColoringPage.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/preferences/DTDSyntaxColoringPage.java deleted file mode 100644 index a675cbd575..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/preferences/DTDSyntaxColoringPage.java +++ /dev/null @@ -1,855 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * - *******************************************************************************/ -package org.eclipse.wst.dtd.ui.internal.preferences; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import org.eclipse.jface.preference.ColorSelector; -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.jface.preference.PreferencePage; -import org.eclipse.jface.resource.JFaceResources; -import org.eclipse.jface.text.TextAttribute; -import org.eclipse.jface.text.source.SourceViewer; -import org.eclipse.jface.util.IPropertyChangeListener; -import org.eclipse.jface.util.PropertyChangeEvent; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.ITreeContentProvider; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.ListViewer; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.StructuredViewer; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerComparator; -import org.eclipse.swt.SWT; -import org.eclipse.swt.accessibility.ACC; -import org.eclipse.swt.accessibility.AccessibleAdapter; -import org.eclipse.swt.accessibility.AccessibleEvent; -import org.eclipse.swt.custom.SashForm; -import org.eclipse.swt.custom.StyleRange; -import org.eclipse.swt.custom.StyledText; -import org.eclipse.swt.events.KeyEvent; -import org.eclipse.swt.events.KeyListener; -import org.eclipse.swt.events.MouseEvent; -import org.eclipse.swt.events.MouseListener; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.events.TraverseEvent; -import org.eclipse.swt.events.TraverseListener; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.RGB; -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.Link; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPreferencePage; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.dialogs.PreferencesUtil; -import org.eclipse.wst.dtd.core.internal.parser.DTDRegionTypes; -import org.eclipse.wst.dtd.core.internal.provisional.contenttype.ContentTypeIdForDTD; -import org.eclipse.wst.dtd.ui.internal.DTDUIMessages; -import org.eclipse.wst.dtd.ui.internal.DTDUIPlugin; -import org.eclipse.wst.dtd.ui.internal.editor.IHelpContextIds; -import org.eclipse.wst.dtd.ui.internal.style.IStyleConstantsDTD; -import org.eclipse.wst.sse.core.StructuredModelManager; -import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument; -import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion; -import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion; -import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegionList; -import org.eclipse.wst.sse.ui.internal.SSEUIMessages; -import org.eclipse.wst.sse.ui.internal.SSEUIPlugin; -import org.eclipse.wst.sse.ui.internal.preferences.OverlayPreferenceStore; -import org.eclipse.wst.sse.ui.internal.preferences.OverlayPreferenceStore.OverlayKey; -import org.eclipse.wst.sse.ui.internal.preferences.ui.ColorHelper; -import org.eclipse.wst.sse.ui.internal.util.EditorUtility; - -import com.ibm.icu.text.Collator; - -/** - * A preference page to configure our XML syntax color. It resembles the JDT - * and CDT pages far more than our original color page while retaining the - * extra "click-to-find" functionality. - */ -public final class DTDSyntaxColoringPage extends PreferencePage implements IWorkbenchPreferencePage { - - private Button fBold; - private Label fForegroundLabel; - private Label fBackgroundLabel; - private Button fClearStyle; - private Map fContextToStyleMap; - private Color fDefaultForeground = null; - private Color fDefaultBackground = null; - private IStructuredDocument fDocument; - private ColorSelector fForegroundColorEditor; - private ColorSelector fBackgroundColorEditor; - private Button fItalic; - private OverlayPreferenceStore fOverlayStore; - private Button fStrike; - private Collection fStylePreferenceKeys; - private StructuredViewer fStylesViewer = null; - private Map fStyleToDescriptionMap; - private StyledText fText; - private Button fUnderline; - - // activate controls based on the given local color type - private void activate(String namedStyle) { - Color foreground = fDefaultForeground; - Color background = fDefaultBackground; - if (namedStyle == null) { - fClearStyle.setEnabled(false); - fBold.setEnabled(false); - fItalic.setEnabled(false); - fStrike.setEnabled(false); - fUnderline.setEnabled(false); - fForegroundLabel.setEnabled(false); - fBackgroundLabel.setEnabled(false); - fForegroundColorEditor.setEnabled(false); - fBackgroundColorEditor.setEnabled(false); - fBold.setSelection(false); - fItalic.setSelection(false); - fStrike.setSelection(false); - fUnderline.setSelection(false); - } - else { - TextAttribute attribute = getAttributeFor(namedStyle); - fClearStyle.setEnabled(true); - fBold.setEnabled(true); - fItalic.setEnabled(true); - fStrike.setEnabled(true); - fUnderline.setEnabled(true); - fForegroundLabel.setEnabled(true); - fBackgroundLabel.setEnabled(true); - fForegroundColorEditor.setEnabled(true); - fBackgroundColorEditor.setEnabled(true); - fBold.setSelection((attribute.getStyle() & SWT.BOLD) != 0); - fItalic.setSelection((attribute.getStyle() & SWT.ITALIC) != 0); - fStrike.setSelection((attribute.getStyle() & TextAttribute.STRIKETHROUGH) != 0); - fUnderline.setSelection((attribute.getStyle() & TextAttribute.UNDERLINE) != 0); - if (attribute.getForeground() != null) { - foreground = attribute.getForeground(); - } - if (attribute.getBackground() != null) { - background = attribute.getBackground(); - } - } - - fForegroundColorEditor.setColorValue(foreground.getRGB()); - fBackgroundColorEditor.setColorValue(background.getRGB()); - } - - /** - * Color the text in the sample area according to the current preferences - */ - void applyStyles() { - if (fText == null || fText.isDisposed()) - return; - IStructuredDocumentRegion documentRegion = fDocument.getFirstStructuredDocumentRegion(); - while (documentRegion != null) { - ITextRegionList regions = documentRegion.getRegions(); - for (int i = 0; i < regions.size(); i++) { - ITextRegion currentRegion = regions.get(i); - // lookup the local coloring type and apply it - String namedStyle = (String) fContextToStyleMap.get(currentRegion.getType()); - if (namedStyle == null) - continue; - TextAttribute attribute = getAttributeFor(namedStyle); - if (attribute == null) - continue; - StyleRange style = new StyleRange(documentRegion.getStartOffset(currentRegion), currentRegion.getTextLength(), attribute.getForeground(), attribute.getBackground(), attribute.getStyle()); - style.strikeout = (attribute.getStyle() & TextAttribute.STRIKETHROUGH) != 0; - style.underline = (attribute.getStyle() & TextAttribute.UNDERLINE) != 0; - fText.setStyleRange(style); - } - documentRegion = documentRegion.getNext(); - } - } - - Button createCheckbox(Composite parent, String label) { - Button button = new Button(parent, SWT.CHECK); - button.setText(label); - button.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); - return button; - } - - /** - * Creates composite control and sets the default layout data. - */ - private Composite createComposite(Composite parent, int numColumns) { - Composite composite = new Composite(parent, SWT.NULL); - - // GridLayout - GridLayout layout = new GridLayout(); - layout.numColumns = numColumns; - layout.makeColumnsEqualWidth = false; - layout.marginHeight = 0; - layout.marginWidth = 0; - composite.setLayout(layout); - - // GridData - GridData data = new GridData(SWT.FILL, SWT.FILL, true, false); - composite.setLayoutData(data); - return composite; - } - - protected Control createContents(final Composite parent) { - initializeDialogUnits(parent); - - fDefaultForeground = parent.getDisplay().getSystemColor(SWT.COLOR_LIST_FOREGROUND); - fDefaultBackground = parent.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND); - Composite pageComponent = createComposite(parent, 2); - PlatformUI.getWorkbench().getHelpSystem().setHelp(pageComponent, IHelpContextIds.DTD_PREFWEBX_STYLES_HELPID); - - Link link = new Link(pageComponent, SWT.WRAP); - link.setText(SSEUIMessages.SyntaxColoring_Link); - link.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - PreferencesUtil.createPreferenceDialogOn(parent.getShell(), e.text, null, null); - } - }); - - GridData linkData= new GridData(SWT.FILL, SWT.BEGINNING, true, false, 2, 1); - linkData.widthHint= 150; // only expand further if anyone else requires it - link.setLayoutData(linkData); - - new Label(pageComponent, SWT.NONE).setLayoutData(new GridData()); - new Label(pageComponent, SWT.NONE).setLayoutData(new GridData()); - - SashForm editor = new SashForm(pageComponent, SWT.VERTICAL); - GridData gridData2 = new GridData(SWT.FILL, SWT.FILL, true, true); - gridData2.horizontalSpan = 2; - editor.setLayoutData(gridData2); - SashForm top = new SashForm(editor, SWT.HORIZONTAL); - Composite styleEditor = createComposite(top, 1); - ((GridLayout) styleEditor.getLayout()).marginRight = 5; - ((GridLayout) styleEditor.getLayout()).marginLeft = 0; - createLabel(styleEditor, DTDUIMessages.SyntaxColoringPage_0); - fStylesViewer = createStylesViewer(styleEditor); - GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true); - gridData.horizontalIndent = 0; - Iterator iterator = fStyleToDescriptionMap.values().iterator(); - while (iterator.hasNext()) { - gridData.widthHint = Math.max(gridData.widthHint, convertWidthInCharsToPixels(iterator.next().toString().length())); - } - gridData.heightHint = convertHeightInCharsToPixels(5); - fStylesViewer.getControl().setLayoutData(gridData); - - Composite editingComposite = createComposite(top, 1); - ((GridLayout) styleEditor.getLayout()).marginLeft = 5; - createLabel(editingComposite, ""); //$NON-NLS-1$ - Button enabler = createCheckbox(editingComposite, DTDUIMessages.SyntaxColoringPage_2); - enabler.setEnabled(false); - enabler.setSelection(true); - Composite editControls = createComposite(editingComposite, 2); - ((GridLayout) editControls.getLayout()).marginLeft = 20; - - fForegroundLabel = createLabel(editControls, SSEUIMessages.Foreground_UI_); - ((GridData) fForegroundLabel.getLayoutData()).verticalAlignment = SWT.CENTER; - fForegroundLabel.setEnabled(false); - - fForegroundColorEditor = new ColorSelector(editControls); - Button fForegroundColor = fForegroundColorEditor.getButton(); - GridData gd = new GridData(SWT.BEGINNING, SWT.FILL, false, false); - fForegroundColor.setLayoutData(gd); - fForegroundColorEditor.setEnabled(false); - - fBackgroundLabel = createLabel(editControls, SSEUIMessages.Background_UI_); - ((GridData) fBackgroundLabel.getLayoutData()).verticalAlignment = SWT.CENTER; - fBackgroundLabel.setEnabled(false); - - fBackgroundColorEditor = new ColorSelector(editControls); - Button fBackgroundColor = fBackgroundColorEditor.getButton(); - gd = new GridData(SWT.BEGINNING, SWT.FILL, false, false); - fBackgroundColor.setLayoutData(gd); - fBackgroundColorEditor.setEnabled(false); - - fBold = createCheckbox(editControls, DTDUIMessages.SyntaxColoringPage_3); - fBold.setEnabled(false); - ((GridData) fBold.getLayoutData()).horizontalSpan = 2; - fItalic = createCheckbox(editControls, DTDUIMessages.SyntaxColoringPage_4); - fItalic.setEnabled(false); - ((GridData) fItalic.getLayoutData()).horizontalSpan = 2; - fStrike = createCheckbox(editControls, DTDUIMessages.SyntaxColoringPage_5); - fStrike.setEnabled(false); - ((GridData) fStrike.getLayoutData()).horizontalSpan = 2; - fUnderline = createCheckbox(editControls, DTDUIMessages.SyntaxColoringPage_6); - fUnderline.setEnabled(false); - ((GridData) fUnderline.getLayoutData()).horizontalSpan = 2; - fClearStyle = new Button(editingComposite, SWT.PUSH); - fClearStyle.setText(SSEUIMessages.Restore_Default_UI_); //$NON-NLS-1$ = "Restore Default" - fClearStyle.setLayoutData(new GridData(SWT.BEGINNING)); - ((GridData)fClearStyle.getLayoutData()).horizontalIndent = 20; - fClearStyle.setEnabled(false); - - Composite sampleArea = createComposite(editor, 1); - - ((GridLayout) sampleArea.getLayout()).marginLeft = 5; - ((GridLayout) sampleArea.getLayout()).marginTop = 5; - createLabel(sampleArea, SSEUIMessages.Sample_text__UI_); //$NON-NLS-1$ = "&Sample text:" - SourceViewer viewer = new SourceViewer(sampleArea, null, SWT.BORDER | SWT.LEFT_TO_RIGHT | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL | SWT.READ_ONLY); - fText = viewer.getTextWidget(); - GridData gridData3 = new GridData(SWT.FILL, SWT.FILL, true, true); - gridData3.widthHint = convertWidthInCharsToPixels(20); - gridData3.heightHint = convertHeightInCharsToPixels(5); - gridData3.horizontalSpan = 2; - fText.setLayoutData(gridData3); - fText.setEditable(false); - fText.setFont(JFaceResources.getFont("org.eclipse.wst.sse.ui.textfont"));//$NON-NLS-1$ - fText.addKeyListener(getTextKeyListener()); - fText.addSelectionListener(getTextSelectionListener()); - fText.addMouseListener(getTextMouseListener()); - fText.addTraverseListener(getTraverseListener()); - setAccessible(fText, SSEUIMessages.Sample_text__UI_); - fDocument = StructuredModelManager.getModelManager().createStructuredDocumentFor(ContentTypeIdForDTD.ContentTypeID_DTD); - fDocument.set(getExampleText()); - viewer.setDocument(fDocument); - - top.setWeights(new int[]{1, 1}); - editor.setWeights(new int[]{1, 1}); - PlatformUI.getWorkbench().getHelpSystem().setHelp(pageComponent, IHelpContextIds.DTD_PREFWEBX_STYLES_HELPID); - - fStylesViewer.setInput(getStylePreferenceKeys()); - - applyStyles(); - - fStylesViewer.addSelectionChangedListener(new ISelectionChangedListener() { - public void selectionChanged(SelectionChangedEvent event) { - if (!event.getSelection().isEmpty()) { - Object o = ((IStructuredSelection) event.getSelection()).getFirstElement(); - String namedStyle = o.toString(); - activate(namedStyle); - if (namedStyle == null) - return; - } - } - }); - - fForegroundColorEditor.addListener(new IPropertyChangeListener() { - public void propertyChange(PropertyChangeEvent event) { - if (event.getProperty().equals(ColorSelector.PROP_COLORCHANGE)) { - Object o = ((IStructuredSelection) fStylesViewer.getSelection()).getFirstElement(); - String namedStyle = o.toString(); - String prefString = getOverlayStore().getString(namedStyle); - String[] stylePrefs = ColorHelper.unpackStylePreferences(prefString); - if (stylePrefs != null) { - String oldValue = stylePrefs[0]; - // open color dialog to get new color - String newValue = ColorHelper.toRGBString(fForegroundColorEditor.getColorValue()); - - if (!newValue.equals(oldValue)) { - stylePrefs[0] = newValue; - String newPrefString = ColorHelper.packStylePreferences(stylePrefs); - getOverlayStore().setValue(namedStyle, newPrefString); - applyStyles(); - fText.redraw(); - } - } - } - } - }); - - fBackgroundColorEditor.addListener(new IPropertyChangeListener() { - public void propertyChange(PropertyChangeEvent event) { - if (event.getProperty().equals(ColorSelector.PROP_COLORCHANGE)) { - Object o = ((IStructuredSelection) fStylesViewer.getSelection()).getFirstElement(); - String namedStyle = o.toString(); - String prefString = getOverlayStore().getString(namedStyle); - String[] stylePrefs = ColorHelper.unpackStylePreferences(prefString); - if (stylePrefs != null) { - String oldValue = stylePrefs[1]; - // open color dialog to get new color - String newValue = ColorHelper.toRGBString(fBackgroundColorEditor.getColorValue()); - - if (!newValue.equals(oldValue)) { - stylePrefs[1] = newValue; - String newPrefString = ColorHelper.packStylePreferences(stylePrefs); - getOverlayStore().setValue(namedStyle, newPrefString); - applyStyles(); - fText.redraw(); - activate(namedStyle); - } - } - } - } - }); - - fBold.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - super.widgetSelected(e); - // get current (newly old) style - Object o = ((IStructuredSelection) fStylesViewer.getSelection()).getFirstElement(); - String namedStyle = o.toString(); - String prefString = getOverlayStore().getString(namedStyle); - String[] stylePrefs = ColorHelper.unpackStylePreferences(prefString); - if (stylePrefs != null) { - String oldValue = stylePrefs[2]; - String newValue = String.valueOf(fBold.getSelection()); - if (!newValue.equals(oldValue)) { - stylePrefs[2] = newValue; - String newPrefString = ColorHelper.packStylePreferences(stylePrefs); - getOverlayStore().setValue(namedStyle, newPrefString); - applyStyles(); - fText.redraw(); - } - } - } - }); - - fItalic.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - super.widgetSelected(e); - // get current (newly old) style - Object o = ((IStructuredSelection) fStylesViewer.getSelection()).getFirstElement(); - String namedStyle = o.toString(); - String prefString = getOverlayStore().getString(namedStyle); - String[] stylePrefs = ColorHelper.unpackStylePreferences(prefString); - if (stylePrefs != null) { - String oldValue = stylePrefs[3]; - String newValue = String.valueOf(fItalic.getSelection()); - if (!newValue.equals(oldValue)) { - stylePrefs[3] = newValue; - String newPrefString = ColorHelper.packStylePreferences(stylePrefs); - getOverlayStore().setValue(namedStyle, newPrefString); - applyStyles(); - fText.redraw(); - } - } - } - }); - - fStrike.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - super.widgetSelected(e); - // get current (newly old) style - Object o = ((IStructuredSelection) fStylesViewer.getSelection()).getFirstElement(); - String namedStyle = o.toString(); - String prefString = getOverlayStore().getString(namedStyle); - String[] stylePrefs = ColorHelper.unpackStylePreferences(prefString); - if (stylePrefs != null) { - String oldValue = stylePrefs[4]; - String newValue = String.valueOf(fStrike.getSelection()); - if (!newValue.equals(oldValue)) { - stylePrefs[4] = newValue; - String newPrefString = ColorHelper.packStylePreferences(stylePrefs); - getOverlayStore().setValue(namedStyle, newPrefString); - applyStyles(); - fText.redraw(); - } - } - } - }); - - fUnderline.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - super.widgetSelected(e); - // get current (newly old) style - Object o = ((IStructuredSelection) fStylesViewer.getSelection()).getFirstElement(); - String namedStyle = o.toString(); - String prefString = getOverlayStore().getString(namedStyle); - String[] stylePrefs = ColorHelper.unpackStylePreferences(prefString); - if (stylePrefs != null) { - String oldValue = stylePrefs[5]; - String newValue = String.valueOf(fUnderline.getSelection()); - if (!newValue.equals(oldValue)) { - stylePrefs[5] = newValue; - String newPrefString = ColorHelper.packStylePreferences(stylePrefs); - getOverlayStore().setValue(namedStyle, newPrefString); - applyStyles(); - fText.redraw(); - } - } - } - }); - - fClearStyle.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - if (fStylesViewer.getSelection().isEmpty()) - return; - String namedStyle = ((IStructuredSelection) fStylesViewer.getSelection()).getFirstElement().toString(); - getOverlayStore().setToDefault(namedStyle); - applyStyles(); - fText.redraw(); - activate(namedStyle); - } - }); - - return pageComponent; - } - - private Label createLabel(Composite parent, String text) { - Label label = new Label(parent, SWT.WRAP); - label.setText(text); - GridData data = new GridData(SWT.FILL, SWT.FILL, false, false); - label.setLayoutData(data); - label.setBackground(parent.getBackground()); - return label; - } - - // protected Label createDescriptionLabel(Composite parent) { - // return null; - // } - - /** - * Set up all the style preference keys in the overlay store - */ - private OverlayKey[] createOverlayStoreKeys() { - List overlayKeys = new ArrayList(); - - Iterator i = getStylePreferenceKeys().iterator(); - while (i.hasNext()) { - overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, (String) i.next())); - } - - OverlayPreferenceStore.OverlayKey[] keys = new OverlayPreferenceStore.OverlayKey[overlayKeys.size()]; - overlayKeys.toArray(keys); - return keys; - } - - /** - * Creates the List viewer where we see the various syntax element display - * names--would it ever be a Tree like JDT's? - * - * @param parent - * @return - */ - private StructuredViewer createStylesViewer(Composite parent) { - StructuredViewer stylesViewer = new ListViewer(parent, SWT.SINGLE | SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER); - stylesViewer.setComparator(new ViewerComparator(Collator.getInstance())); - stylesViewer.setLabelProvider(new LabelProvider() { - public String getText(Object element) { - Object description = fStyleToDescriptionMap.get(element); - if (description != null) - return description.toString(); - return super.getText(element); - } - }); - stylesViewer.setContentProvider(new ITreeContentProvider() { - public void dispose() { - } - - public Object[] getChildren(Object parentElement) { - return getStylePreferenceKeys().toArray(); - } - - public Object[] getElements(Object inputElement) { - return getChildren(inputElement); - } - - public Object getParent(Object element) { - return getStylePreferenceKeys(); - } - - public boolean hasChildren(Object element) { - return false; - } - - public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { - } - }); - return stylesViewer; - } - - public void dispose() { - if (fOverlayStore != null) { - fOverlayStore.stop(); - } - super.dispose(); - } - - protected IPreferenceStore doGetPreferenceStore() { - return DTDUIPlugin.getDefault().getPreferenceStore(); - } - - private TextAttribute getAttributeFor(String namedStyle) { - TextAttribute ta = new TextAttribute(fDefaultForeground, fDefaultBackground, SWT.NORMAL); - - if (namedStyle != null && fOverlayStore != null) { - // note: "namedStyle" *is* the preference key - String prefString = getOverlayStore().getString(namedStyle); - String[] stylePrefs = ColorHelper.unpackStylePreferences(prefString); - if (stylePrefs != null) { - RGB foreground = ColorHelper.toRGB(stylePrefs[0]); - RGB background = ColorHelper.toRGB(stylePrefs[1]); - - int fontModifier = SWT.NORMAL; - - if (stylePrefs.length > 2) { - boolean on = Boolean.valueOf(stylePrefs[2]).booleanValue(); - if (on) - fontModifier = fontModifier | SWT.BOLD; - } - if (stylePrefs.length > 3) { - boolean on = Boolean.valueOf(stylePrefs[3]).booleanValue(); - if (on) - fontModifier = fontModifier | SWT.ITALIC; - } - if (stylePrefs.length > 4) { - boolean on = Boolean.valueOf(stylePrefs[4]).booleanValue(); - if (on) - fontModifier = fontModifier | TextAttribute.STRIKETHROUGH; - } - if (stylePrefs.length > 5) { - boolean on = Boolean.valueOf(stylePrefs[5]).booleanValue(); - if (on) - fontModifier = fontModifier | TextAttribute.UNDERLINE; - } - - ta = new TextAttribute((foreground != null) ? EditorUtility.getColor(foreground) : null, (background != null) ? EditorUtility.getColor(background) : null, fontModifier); - } - } - return ta; - } - - private String getExampleText() { - return DTDUIMessages.DTDColorPage_0; - } - - private String getNamedStyleAtOffset(int offset) { - // ensure the offset is clean - if (offset >= fDocument.getLength()) - return getNamedStyleAtOffset(fDocument.getLength() - 1); - else if (offset < 0) - return getNamedStyleAtOffset(0); - IStructuredDocumentRegion documentRegion = fDocument.getFirstStructuredDocumentRegion(); - while (documentRegion != null && !documentRegion.containsOffset(offset)) { - documentRegion = documentRegion.getNext(); - } - if (documentRegion != null) { - // find the ITextRegion's Context at this offset - ITextRegion interest = documentRegion.getRegionAtCharacterOffset(offset); - if (interest == null) - return null; - if (offset > documentRegion.getTextEndOffset(interest)) - return null; - String regionContext = interest.getType(); - if (regionContext == null) - return null; - // find the named style (internal/selectable name) for that - // context - String namedStyle = (String) fContextToStyleMap.get(regionContext); - if (namedStyle != null) { - return namedStyle; - } - } - return null; - } - - private OverlayPreferenceStore getOverlayStore() { - return fOverlayStore; - } - - private Collection getStylePreferenceKeys() { - if (fStylePreferenceKeys == null) { - List styles = new ArrayList(); - styles.add(IStyleConstantsDTD.DTD_COMMENT); //$NON-NLS-1$ - styles.add(IStyleConstantsDTD.DTD_DATA); //$NON-NLS-1$ - styles.add(IStyleConstantsDTD.DTD_DEFAULT); //$NON-NLS-1$ - styles.add(IStyleConstantsDTD.DTD_KEYWORD); //$NON-NLS-1$ - styles.add(IStyleConstantsDTD.DTD_STRING); //$NON-NLS-1$ - styles.add(IStyleConstantsDTD.DTD_SYMBOL); //$NON-NLS-1$ - styles.add(IStyleConstantsDTD.DTD_TAG); //$NON-NLS-1$ - styles.add(IStyleConstantsDTD.DTD_TAGNAME); //$NON-NLS-1$ - fStylePreferenceKeys = styles; - } - return fStylePreferenceKeys; - } - - private KeyListener getTextKeyListener() { - return new KeyListener() { - public void keyPressed(KeyEvent e) { - if (e.widget instanceof StyledText) { - int x = ((StyledText) e.widget).getCaretOffset(); - selectColorAtOffset(x); - } - } - - public void keyReleased(KeyEvent e) { - if (e.widget instanceof StyledText) { - int x = ((StyledText) e.widget).getCaretOffset(); - selectColorAtOffset(x); - } - } - }; - } - - private MouseListener getTextMouseListener() { - return new MouseListener() { - public void mouseDoubleClick(MouseEvent e) { - } - - public void mouseDown(MouseEvent e) { - } - - public void mouseUp(MouseEvent e) { - if (e.widget instanceof StyledText) { - int x = ((StyledText) e.widget).getCaretOffset(); - selectColorAtOffset(x); - } - } - }; - } - - private SelectionListener getTextSelectionListener() { - return new SelectionListener() { - public void widgetDefaultSelected(SelectionEvent e) { - selectColorAtOffset(e.x); - if (e.widget instanceof StyledText) { - ((StyledText) e.widget).setSelection(e.x); - } - } - - public void widgetSelected(SelectionEvent e) { - selectColorAtOffset(e.x); - if (e.widget instanceof StyledText) { - ((StyledText) e.widget).setSelection(e.x); - } - } - }; - } - - private TraverseListener getTraverseListener() { - return new TraverseListener() { - /** - * @see org.eclipse.swt.events.TraverseListener#keyTraversed(TraverseEvent) - */ - public void keyTraversed(TraverseEvent e) { - if (e.widget instanceof StyledText) { - if ((e.detail == SWT.TRAVERSE_TAB_NEXT) || (e.detail == SWT.TRAVERSE_TAB_PREVIOUS)) - e.doit = true; - } - } - }; - } - - public void init(IWorkbench workbench) { - setDescription(SSEUIMessages.SyntaxColoring_Description); - - fStyleToDescriptionMap = new HashMap(); - fContextToStyleMap = new HashMap(); - - initStyleToDescriptionMap(); - initRegionContextToStyleMap(); - - fOverlayStore = new OverlayPreferenceStore(getPreferenceStore(), createOverlayStoreKeys()); - fOverlayStore.load(); - fOverlayStore.start(); - } - - private void initRegionContextToStyleMap() { - fContextToStyleMap.put(DTDRegionTypes.CONTENT_EMPTY, IStyleConstantsDTD.DTD_DATA); - fContextToStyleMap.put(DTDRegionTypes.CONTENT_ANY, IStyleConstantsDTD.DTD_DATA); - fContextToStyleMap.put(DTDRegionTypes.CONTENT_PCDATA, IStyleConstantsDTD.DTD_DATA); - fContextToStyleMap.put(DTDRegionTypes.NDATA_VALUE, IStyleConstantsDTD.DTD_DATA); - fContextToStyleMap.put(DTDRegionTypes.NAME, IStyleConstantsDTD.DTD_DATA); - fContextToStyleMap.put(DTDRegionTypes.ENTITY_PARM, IStyleConstantsDTD.DTD_DATA); - - fContextToStyleMap.put(DTDRegionTypes.ELEMENT_TAG, IStyleConstantsDTD.DTD_TAGNAME); - fContextToStyleMap.put(DTDRegionTypes.ENTITY_TAG, IStyleConstantsDTD.DTD_TAGNAME); - fContextToStyleMap.put(DTDRegionTypes.ATTLIST_TAG, IStyleConstantsDTD.DTD_TAGNAME); - fContextToStyleMap.put(DTDRegionTypes.NOTATION_TAG, IStyleConstantsDTD.DTD_TAGNAME); - - fContextToStyleMap.put(DTDRegionTypes.CONNECTOR, IStyleConstantsDTD.DTD_SYMBOL); - fContextToStyleMap.put(DTDRegionTypes.OCCUR_TYPE, IStyleConstantsDTD.DTD_SYMBOL); - - fContextToStyleMap.put(DTDRegionTypes.START_TAG, IStyleConstantsDTD.DTD_TAG); - fContextToStyleMap.put(DTDRegionTypes.END_TAG, IStyleConstantsDTD.DTD_TAG); - fContextToStyleMap.put(DTDRegionTypes.EXCLAMATION, IStyleConstantsDTD.DTD_TAG); - - fContextToStyleMap.put(DTDRegionTypes.COMMENT_START, IStyleConstantsDTD.DTD_COMMENT); - fContextToStyleMap.put(DTDRegionTypes.COMMENT_CONTENT, IStyleConstantsDTD.DTD_COMMENT); - fContextToStyleMap.put(DTDRegionTypes.COMMENT_END, IStyleConstantsDTD.DTD_COMMENT); - - fContextToStyleMap.put(DTDRegionTypes.SINGLEQUOTED_LITERAL, IStyleConstantsDTD.DTD_STRING); - fContextToStyleMap.put(DTDRegionTypes.DOUBLEQUOTED_LITERAL, IStyleConstantsDTD.DTD_STRING); - - fContextToStyleMap.put(DTDRegionTypes.SYSTEM_KEYWORD, IStyleConstantsDTD.DTD_KEYWORD); - fContextToStyleMap.put(DTDRegionTypes.PUBLIC_KEYWORD, IStyleConstantsDTD.DTD_KEYWORD); - fContextToStyleMap.put(DTDRegionTypes.NDATA_KEYWORD, IStyleConstantsDTD.DTD_KEYWORD); - fContextToStyleMap.put(DTDRegionTypes.CDATA_KEYWORD, IStyleConstantsDTD.DTD_KEYWORD); - fContextToStyleMap.put(DTDRegionTypes.ID_KEYWORD, IStyleConstantsDTD.DTD_KEYWORD); - fContextToStyleMap.put(DTDRegionTypes.IDREF_KEYWORD, IStyleConstantsDTD.DTD_KEYWORD); - fContextToStyleMap.put(DTDRegionTypes.IDREFS_KEYWORD, IStyleConstantsDTD.DTD_KEYWORD); - fContextToStyleMap.put(DTDRegionTypes.ENTITY_KEYWORD, IStyleConstantsDTD.DTD_KEYWORD); - fContextToStyleMap.put(DTDRegionTypes.ENTITIES_KEYWORD, IStyleConstantsDTD.DTD_KEYWORD); - fContextToStyleMap.put(DTDRegionTypes.NMTOKEN_KEYWORD, IStyleConstantsDTD.DTD_KEYWORD); - fContextToStyleMap.put(DTDRegionTypes.NMTOKENS_KEYWORD, IStyleConstantsDTD.DTD_KEYWORD); - fContextToStyleMap.put(DTDRegionTypes.NOTATION_KEYWORD, IStyleConstantsDTD.DTD_KEYWORD); - fContextToStyleMap.put(DTDRegionTypes.REQUIRED_KEYWORD, IStyleConstantsDTD.DTD_KEYWORD); - fContextToStyleMap.put(DTDRegionTypes.IMPLIED_KEYWORD, IStyleConstantsDTD.DTD_KEYWORD); - fContextToStyleMap.put(DTDRegionTypes.FIXED_KEYWORD, IStyleConstantsDTD.DTD_KEYWORD); - } - - private void initStyleToDescriptionMap() { - fStyleToDescriptionMap.put(IStyleConstantsDTD.DTD_COMMENT, DTDUIMessages.DTDColorPage_1); //$NON-NLS-1$ - fStyleToDescriptionMap.put(IStyleConstantsDTD.DTD_DATA, DTDUIMessages.DTDColorPage_2); //$NON-NLS-1$ - fStyleToDescriptionMap.put(IStyleConstantsDTD.DTD_DEFAULT, DTDUIMessages.DTDColorPage_3); //$NON-NLS-1$ - fStyleToDescriptionMap.put(IStyleConstantsDTD.DTD_KEYWORD, DTDUIMessages.DTDColorPage_4); //$NON-NLS-1$ - fStyleToDescriptionMap.put(IStyleConstantsDTD.DTD_STRING, DTDUIMessages.DTDColorPage_5); //$NON-NLS-1$ - fStyleToDescriptionMap.put(IStyleConstantsDTD.DTD_SYMBOL, DTDUIMessages.DTDColorPage_6); //$NON-NLS-1$ - fStyleToDescriptionMap.put(IStyleConstantsDTD.DTD_TAG, DTDUIMessages.DTDColorPage_7); //$NON-NLS-1$ - fStyleToDescriptionMap.put(IStyleConstantsDTD.DTD_TAGNAME, DTDUIMessages.DTDColorPage_8); //$NON-NLS-1$ - } - - protected void performDefaults() { - super.performDefaults(); - getOverlayStore().loadDefaults(); - applyStyles(); - fStylesViewer.setSelection(StructuredSelection.EMPTY); - activate(null); - fText.redraw(); - } - - public boolean performOk() { - getOverlayStore().propagate(); - - DTDUIPlugin.getDefault().savePluginPreferences(); - SSEUIPlugin.getDefault().savePluginPreferences(); - return true; - } - - private void selectColorAtOffset(int offset) { - String namedStyle = getNamedStyleAtOffset(offset); - if (namedStyle != null) { - fStylesViewer.setSelection(new StructuredSelection(namedStyle)); - fStylesViewer.reveal(namedStyle); - } - else { - fStylesViewer.setSelection(StructuredSelection.EMPTY); - } - activate(namedStyle); - } - - /** - * Specifically set the reporting name of a control for accessibility - */ - private void setAccessible(Control control, String name) { - if (control == null) - return; - final String n = name; - control.getAccessible().addAccessibleListener(new AccessibleAdapter() { - public void getName(AccessibleEvent e) { - if (e.childID == ACC.CHILDID_SELF) - e.result = n; - } - }); - } -} diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/preferences/DTDTemplatePreferencePage.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/preferences/DTDTemplatePreferencePage.java deleted file mode 100644 index 8cca3874aa..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/preferences/DTDTemplatePreferencePage.java +++ /dev/null @@ -1,167 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * - *******************************************************************************/ -package org.eclipse.wst.dtd.ui.internal.preferences; - -import org.eclipse.jface.resource.JFaceResources; -import org.eclipse.jface.text.IDocument; -import org.eclipse.jface.text.contentassist.ContentAssistant; -import org.eclipse.jface.text.contentassist.IContentAssistant; -import org.eclipse.jface.text.source.ISourceViewer; -import org.eclipse.jface.text.source.SourceViewer; -import org.eclipse.jface.text.source.SourceViewerConfiguration; -import org.eclipse.jface.text.templates.ContextTypeRegistry; -import org.eclipse.jface.text.templates.Template; -import org.eclipse.jface.window.Window; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.texteditor.templates.TemplatePreferencePage; -import org.eclipse.wst.dtd.core.internal.provisional.contenttype.ContentTypeIdForDTD; -import org.eclipse.wst.dtd.ui.StructuredTextViewerConfigurationDTD; -import org.eclipse.wst.dtd.ui.internal.DTDUIPlugin; -import org.eclipse.wst.dtd.ui.internal.editor.IHelpContextIds; -import org.eclipse.wst.sse.core.StructuredModelManager; -import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel; -import org.eclipse.wst.sse.ui.StructuredTextViewerConfiguration; -import org.eclipse.wst.sse.ui.internal.StructuredTextViewer; -import org.eclipse.wst.sse.ui.internal.provisional.style.LineStyleProvider; - -/** - * Preference page for DTD templates - */ -public class DTDTemplatePreferencePage extends TemplatePreferencePage { - - class DTDEditTemplateDialog extends EditTemplateDialog { - public DTDEditTemplateDialog(Shell parent, Template template, boolean edit, boolean isNameModifiable, ContextTypeRegistry registry) { - super(parent, template, edit, isNameModifiable, registry); - } - - protected SourceViewer createViewer(Composite parent) { - SourceViewerConfiguration sourceViewerConfiguration = new StructuredTextViewerConfiguration() { - StructuredTextViewerConfiguration baseConfiguration = new StructuredTextViewerConfigurationDTD(); - - public String[] getConfiguredContentTypes(ISourceViewer sourceViewer) { - return baseConfiguration.getConfiguredContentTypes(sourceViewer); - } - - public LineStyleProvider[] getLineStyleProviders(ISourceViewer sourceViewer, String partitionType) { - return baseConfiguration.getLineStyleProviders(sourceViewer, partitionType); - } - - public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) { - ContentAssistant assistant = new ContentAssistant(); - assistant.enableAutoActivation(true); - assistant.enableAutoInsert(true); - assistant.setContentAssistProcessor(getTemplateProcessor(), IDocument.DEFAULT_CONTENT_TYPE); - return assistant; - } - }; - return doCreateViewer(parent, sourceViewerConfiguration); - } - } - - public DTDTemplatePreferencePage() { - DTDUIPlugin dtdUIPlugin = DTDUIPlugin.getDefault(); - - setPreferenceStore(dtdUIPlugin.getPreferenceStore()); - setTemplateStore(dtdUIPlugin.getTemplateStore()); - setContextTypeRegistry(dtdUIPlugin.getTemplateContextRegistry()); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.preference.IPreferencePage#performOk() - */ - public boolean performOk() { - boolean ok = super.performOk(); - DTDUIPlugin.getDefault().savePluginPreferences(); - return ok; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.texteditor.templates.TemplatePreferencePage#isShowFormatterSetting() - */ - protected boolean isShowFormatterSetting() { - // template formatting has not been implemented - return false; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite) - */ - protected Control createContents(Composite ancestor) { - Control c = super.createContents(ancestor); - PlatformUI.getWorkbench().getHelpSystem().setHelp(c, IHelpContextIds.DTD_PREFWEBX_TEMPLATES_HELPID); - return c; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.texteditor.templates.TemplatePreferencePage#createViewer(org.eclipse.swt.widgets.Composite) - */ - protected SourceViewer createViewer(Composite parent) { - SourceViewerConfiguration sourceViewerConfiguration = new StructuredTextViewerConfiguration() { - StructuredTextViewerConfiguration baseConfiguration = new StructuredTextViewerConfigurationDTD(); - - public String[] getConfiguredContentTypes(ISourceViewer sourceViewer) { - return baseConfiguration.getConfiguredContentTypes(sourceViewer); - } - - public LineStyleProvider[] getLineStyleProviders(ISourceViewer sourceViewer, String partitionType) { - return baseConfiguration.getLineStyleProviders(sourceViewer, partitionType); - } - }; - return doCreateViewer(parent, sourceViewerConfiguration); - } - - SourceViewer doCreateViewer(Composite parent, SourceViewerConfiguration viewerConfiguration) { - SourceViewer viewer = null; - String contentTypeID = ContentTypeIdForDTD.ContentTypeID_DTD; - viewer = new StructuredTextViewer(parent, null, null, false, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL); - ((StructuredTextViewer) viewer).getTextWidget().setFont(JFaceResources.getFont("org.eclipse.wst.sse.ui.textfont")); //$NON-NLS-1$ - IStructuredModel scratchModel = StructuredModelManager.getModelManager().createUnManagedStructuredModelFor(contentTypeID); - IDocument document = scratchModel.getStructuredDocument(); - viewer.configure(viewerConfiguration); - viewer.setDocument(document); - return viewer; - } - - /** - * Creates the edit dialog. Subclasses may override this method to provide - * a custom dialog. - * - * @param template - * the template being edited - * @param edit - * whether the dialog should be editable - * @param isNameModifiable - * whether the template name may be modified - * @return the created or modified template, or <code>null</code> if the - * edition failed - * @since 3.1 - */ - protected Template editTemplate(Template template, boolean edit, boolean isNameModifiable) { - EditTemplateDialog dialog = new DTDEditTemplateDialog(getShell(), template, edit, isNameModifiable, getContextTypeRegistry()); - if (dialog.open() == Window.OK) { - return dialog.getTemplate(); - } - return null; - } -} diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/preferences/DTDUIPreferenceInitializer.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/preferences/DTDUIPreferenceInitializer.java deleted file mode 100644 index 34d558db4f..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/preferences/DTDUIPreferenceInitializer.java +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * - *******************************************************************************/ -package org.eclipse.wst.dtd.ui.internal.preferences; - -import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.jface.resource.ColorRegistry; -import org.eclipse.ui.PlatformUI; -import org.eclipse.wst.dtd.ui.internal.DTDUIPlugin; -import org.eclipse.wst.dtd.ui.internal.style.IStyleConstantsDTD; -import org.eclipse.wst.sse.ui.internal.preferences.ui.ColorHelper; - -/** - * Sets default values for DTD UI preferences - */ -public class DTDUIPreferenceInitializer extends AbstractPreferenceInitializer { - - /* - * (non-Javadoc) - * - * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences() - */ - public void initializeDefaultPreferences() { - IPreferenceStore store = DTDUIPlugin.getDefault().getPreferenceStore(); - ColorRegistry registry = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme().getColorRegistry(); - - // DTD Style Preferences - String NOBACKGROUNDBOLD = " | null | false"; //$NON-NLS-1$ - String JUSTITALIC = " | null | false | true"; //$NON-NLS-1$ - String styleValue = ColorHelper.findRGBString(registry, IStyleConstantsDTD.DTD_DEFAULT, 0, 0, 0) + NOBACKGROUNDBOLD; - store.setDefault(IStyleConstantsDTD.DTD_DEFAULT, styleValue); // black - - styleValue = ColorHelper.findRGBString(registry, IStyleConstantsDTD.DTD_TAG, 63, 63, 191) + NOBACKGROUNDBOLD; - store.setDefault(IStyleConstantsDTD.DTD_TAG, styleValue); // blue - styleValue = ColorHelper.findRGBString(registry, IStyleConstantsDTD.DTD_TAGNAME, 63, 63, 191) + NOBACKGROUNDBOLD; - store.setDefault(IStyleConstantsDTD.DTD_TAGNAME, styleValue); // blue - - styleValue = ColorHelper.findRGBString(registry, IStyleConstantsDTD.DTD_COMMENT, 127, 127, 127) + NOBACKGROUNDBOLD; - store.setDefault(IStyleConstantsDTD.DTD_COMMENT, styleValue); // grey - - styleValue = ColorHelper.findRGBString(registry, IStyleConstantsDTD.DTD_KEYWORD, 128, 0, 0) + NOBACKGROUNDBOLD; - store.setDefault(IStyleConstantsDTD.DTD_KEYWORD, styleValue); // dark - // red - - styleValue = ColorHelper.findRGBString(registry, IStyleConstantsDTD.DTD_STRING, 63, 159, 95) + JUSTITALIC; - store.setDefault(IStyleConstantsDTD.DTD_STRING, styleValue); // green - - styleValue = ColorHelper.findRGBString(registry, IStyleConstantsDTD.DTD_DATA, 191, 95, 95) + NOBACKGROUNDBOLD; - store.setDefault(IStyleConstantsDTD.DTD_DATA, styleValue); // light - // red - - styleValue = ColorHelper.findRGBString(registry, IStyleConstantsDTD.DTD_SYMBOL, 128, 0, 0) + NOBACKGROUNDBOLD; - store.setDefault(IStyleConstantsDTD.DTD_SYMBOL, styleValue); // dark - // red - } -} diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/preferences/DTDUIPreferenceNames.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/preferences/DTDUIPreferenceNames.java deleted file mode 100644 index 73f2f71d8f..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/preferences/DTDUIPreferenceNames.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.dtd.ui.internal.preferences; - -/** - * Preference keys for DTD UI - */ -public class DTDUIPreferenceNames { - private DTDUIPreferenceNames() { - // cannot create instance - } - /** - * The key to store customized templates. - * <p> - * Value is of type <code>String</code>. - * </p> - */ - public static final String TEMPLATES_KEY = "org.eclipse.wst.sse.ui.custom_templates"; //$NON-NLS-1$ - - /** - * The key to store the last template name used in new DTD file wizard. - * Template name is stored instead of template id because user-created - * templates do not have template ids. - * <p> - * Value is of type <code>String</code>. - * </p> - */ - public static final String NEW_FILE_TEMPLATE_NAME = "newFileTemplateName"; //$NON-NLS-1$ -} diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/projection/StructuredTextFoldingProviderDTD.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/projection/StructuredTextFoldingProviderDTD.java deleted file mode 100644 index fddd13acfc..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/projection/StructuredTextFoldingProviderDTD.java +++ /dev/null @@ -1,563 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * - *******************************************************************************/ -package org.eclipse.wst.dtd.ui.internal.projection; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.core.runtime.Platform; -import org.eclipse.jface.text.DocumentEvent; -import org.eclipse.jface.text.IDocument; -import org.eclipse.jface.text.IDocumentExtension; -import org.eclipse.jface.text.IDocumentListener; -import org.eclipse.jface.text.ITextInputListener; -import org.eclipse.jface.text.Position; -import org.eclipse.jface.text.source.projection.IProjectionListener; -import org.eclipse.jface.text.source.projection.ProjectionAnnotation; -import org.eclipse.jface.text.source.projection.ProjectionAnnotationModel; -import org.eclipse.jface.text.source.projection.ProjectionViewer; -import org.eclipse.swt.graphics.FontMetrics; -import org.eclipse.swt.graphics.GC; -import org.eclipse.swt.graphics.Rectangle; -import org.eclipse.swt.widgets.Canvas; -import org.eclipse.wst.dtd.core.internal.DTDFile; -import org.eclipse.wst.dtd.core.internal.DTDNode; -import org.eclipse.wst.dtd.core.internal.TopLevelNode; -import org.eclipse.wst.dtd.core.internal.document.DTDModelImpl; -import org.eclipse.wst.dtd.core.internal.event.IDTDFileListener; -import org.eclipse.wst.dtd.core.internal.event.NodesEvent; -import org.eclipse.wst.dtd.ui.internal.Logger; -import org.eclipse.wst.sse.core.StructuredModelManager; -import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel; -import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion; -import org.eclipse.wst.sse.ui.internal.projection.IStructuredTextFoldingProvider; -import org.w3c.dom.Node; - -/** - * Updates the projection model of a structured model for DTD. - */ -public class StructuredTextFoldingProviderDTD implements IStructuredTextFoldingProvider, IProjectionListener, IDTDFileListener, ITextInputListener { - private final static boolean debugProjectionPerf = "true".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.wst.dtd.ui/projectionperf")); //$NON-NLS-1$ //$NON-NLS-2$ - - private class TagProjectionAnnotation extends ProjectionAnnotation { - private boolean fIsVisible = false; /* workaround for BUG85874 */ - private Node fNode; - - public TagProjectionAnnotation(Node node, boolean isCollapsed) { - super(isCollapsed); - fNode = node; - } - - public Node getNode() { - return fNode; - } - - public void setNode(Node node) { - fNode = node; - } - - /** - * Does not paint hidden annotations. Annotations are hidden when they - * only span one line. - * - * @see ProjectionAnnotation#paint(org.eclipse.swt.graphics.GC, - * org.eclipse.swt.widgets.Canvas, - * org.eclipse.swt.graphics.Rectangle) - */ - public void paint(GC gc, Canvas canvas, Rectangle rectangle) { - /* workaround for BUG85874 */ - /* - * only need to check annotations that are expanded because hidden - * annotations should never have been given the chance to - * collapse. - */ - if (!isCollapsed()) { - // working with rectangle, so line height - FontMetrics metrics = gc.getFontMetrics(); - if (metrics != null) { - // do not draw annotations that only span one line and - // mark them as not visible - if ((rectangle.height / metrics.getHeight()) <= 1) { - fIsVisible = false; - return; - } - } - } - fIsVisible = true; - super.paint(gc, canvas, rectangle); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.text.source.projection.ProjectionAnnotation#markCollapsed() - */ - public void markCollapsed() { - /* workaround for BUG85874 */ - // do not mark collapsed if annotation is not visible - if (fIsVisible) - super.markCollapsed(); - } - } - - /** - * Listens to document to be aware of when to update the projection - * annotation model. - */ - class DocumentListener implements IDocumentListener { - public void documentAboutToBeChanged(DocumentEvent event) { - if (fDocument == event.getDocument()) - fIsDocumentChanging = true; - } - - public void documentChanged(DocumentEvent event) { - // register a post notification replace so that projection - // annotation model will be updated after all documentChanged - // listeners have been notified - IDocument document = event.getDocument(); - if (document instanceof IDocumentExtension && fDocument == document) { - if (fViewer != null && fQueuedNodeChanges != null && !fQueuedNodeChanges.isEmpty()) { - ((IDocumentExtension) document).registerPostNotificationReplace(this, new PostDocumentChangedListener()); - } - } - } - } - - /** - * Essentially a post document changed listener because it is called after - * documentchanged has been fired. - */ - class PostDocumentChangedListener implements IDocumentExtension.IReplace { - public void perform(IDocument document, IDocumentListener owner) { - applyAnnotationModelChanges(); - fIsDocumentChanging = false; - } - } - - /** - * Contains node and an indication on how it changed - */ - class NodeChange { - static final int ADD = 1; - static final int REMOVE = 2; - - private Node fNode; - private int fChangeType; - - public NodeChange(Node node, int changeType) { - fNode = node; - fChangeType = changeType; - } - - public Node getNode() { - return fNode; - } - - public int getChangeType() { - return fChangeType; - } - } - - IDocument fDocument; - ProjectionViewer fViewer; - private boolean fProjectionNeedsToBeEnabled = false; - /** - * Listener to fProjectionViewer's document - */ - private IDocumentListener fDocumentListener; - /** - * Indicates whether or not document is in the middle of changing - */ - boolean fIsDocumentChanging = false; - /** - * List of changed nodes that need to be recalculated - */ - List fQueuedNodeChanges = null; - - /** - * Processes all the queued node changes and updates projection annotation - * model. - */ - void applyAnnotationModelChanges() { - if (fViewer != null && fQueuedNodeChanges != null && !fQueuedNodeChanges.isEmpty()) { - ProjectionAnnotationModel annotationModel = fViewer.getProjectionAnnotationModel(); - - // go through all the pending annotation changes and apply them to - // the projection annotation model - while (!fQueuedNodeChanges.isEmpty()) { - NodeChange changes = (NodeChange) fQueuedNodeChanges.remove(0); - if (changes.getChangeType() == NodeChange.ADD) { - // add - Node node = changes.getNode(); - Position newPos = createProjectionPosition(node); - if (newPos != null) { - TagProjectionAnnotation newAnnotation = new TagProjectionAnnotation(node, false); - // add to map containing annotations to add - try { - annotationModel.addAnnotation(newAnnotation, newPos); - } - catch (Exception e) { - // if anything goes wrong, log it and continue - Logger.log(Logger.WARNING_DEBUG, e.getMessage(), e); - } - } - } - else if (changes.getChangeType() == NodeChange.REMOVE) { - // remove - Node node = changes.getNode(); - TagProjectionAnnotation anno = findExistingAnnotation(node); - if (anno != null) { - try { - annotationModel.removeAnnotation(anno); - } - catch (Exception e) { - // if anything goes wrong, log it and continue - Logger.log(Logger.WARNING_DEBUG, e.getMessage(), e); - } - } - } - } - fQueuedNodeChanges = null; - } - } - - /** - * Goes through every node creates projection annotation if needed - * - * @param DTDFile - * assumes file is not null - */ - private void addAllAnnotations(DTDFile file) { - long start = System.currentTimeMillis(); - - List nodes = file.getNodes(); - Iterator it = nodes.iterator(); - while (it.hasNext()) { - DTDNode node = (DTDNode) it.next(); - Position newPos = createProjectionPosition(node); - if (newPos != null) { - TagProjectionAnnotation newAnnotation = new TagProjectionAnnotation(node, false); - // add to map containing annotations to add - fViewer.getProjectionAnnotationModel().addAnnotation(newAnnotation, newPos); - } - } - - if (debugProjectionPerf) { - long end = System.currentTimeMillis(); - System.out.println("StructuredTextFoldingProviderDTD.addAllAnnotations: " + (end - start)); //$NON-NLS-1$ - } - } - - /** - * Create a projection position from the given node. Able to get - * projection position if node isNodeProjectable. - * - * @param node - * @return null if no projection position possible, a Position otherwise - */ - private Position createProjectionPosition(Node node) { - Position pos = null; - if (isNodeProjectable(node) && node instanceof IndexedRegion) { - IDocument document = fViewer.getDocument(); - if (document != null) { - IndexedRegion inode = (IndexedRegion) node; - int start = inode.getStartOffset(); - int end = inode.getEndOffset(); - if (start >= 0 && start < end) { - pos = new Position(start, end - start); - } - } - } - return pos; - } - - /** - * Searches through projection annotation model and retrieves - * TagProjectionAnnotation for node - * - * @param node - * @return TagProjectionAnnotation for node or null if could not be found - */ - private TagProjectionAnnotation findExistingAnnotation(Node node) { - TagProjectionAnnotation anno = null; - - if (node != null) { - Iterator it = fViewer.getProjectionAnnotationModel().getAnnotationIterator(); - while (it.hasNext() && anno == null) { - TagProjectionAnnotation a = (TagProjectionAnnotation) it.next(); - if (node.equals(a.getNode())) - anno = a; - } - } - return anno; - } - - /** - * Get the dtd file for the fDocument - * - * @return DTDFile if it exists, null otherwise - */ - private DTDFile getDTDFile() { - DTDFile dtdFile = null; - - if (fDocument != null) { - IStructuredModel sModel = null; - try { - sModel = StructuredModelManager.getModelManager().getExistingModelForRead(fDocument); - if (sModel instanceof DTDModelImpl) { - dtdFile = ((DTDModelImpl) sModel).getDTDFile(); - } - } - finally { - if (sModel != null) { - sModel.releaseFromRead(); - } - } - } - return dtdFile; - } - - /** - * Initialize this provider with the correct document. Assumes projection - * is enabled. (otherwise, only install would have been called) - */ - public void initialize() { - if (!isInstalled()) - return; - - long start = System.currentTimeMillis(); - // remove old info - projectionDisabled(); - - fDocument = fViewer.getDocument(); - DTDFile file = getDTDFile(); - - if (fDocument != null && file != null && fViewer.getProjectionAnnotationModel() != null) { - if (fDocumentListener == null) - fDocumentListener = new DocumentListener(); - - fDocument.addDocumentListener(fDocumentListener); - - // add dtd file listener to new dtd file - file.addDTDFileListener(this); - - try { - // https://bugs.eclipse.org/bugs/show_bug.cgi?id=198304 - // disable redraw while adding all adapters - fViewer.setRedraw(false); - addAllAnnotations(file); - } - finally { - fViewer.setRedraw(true); - } - } - fProjectionNeedsToBeEnabled = false; - - if (debugProjectionPerf) { - long end = System.currentTimeMillis(); - System.out.println("StructuredTextFoldingProviderDTD.initialize: " + (end - start)); //$NON-NLS-1$ - } - } - - /** - * Associate a ProjectionViewer with this IStructuredTextFoldingProvider - * - * @param viewer - */ - public void install(ProjectionViewer viewer) { - // uninstall before trying to install new viewer - if (isInstalled()) { - uninstall(); - } - fViewer = viewer; - fViewer.addProjectionListener(this); - fViewer.addTextInputListener(this); - } - - private boolean isInstalled() { - return fViewer != null; - } - - /** - * Returns true if node is a node type able to fold - * - * @param node - * @return boolean true if node is projectable, false otherwise - */ - private boolean isNodeProjectable(Node node) { - if (node != null) { - if (node instanceof TopLevelNode) - return true; - } - return false; - } - - public void nodeChanged(DTDNode node) { - /* - * Don't believe this is necessary (used to need it to only add - * projection annotations to elements that span more than one line, - * but now just always add projection annotation) - */ - // long start = System.currentTimeMillis(); - // // recalculate projection annotations for node - // // check if this was even a projectable node to start with - // if (isNodeProjectable(node)) { - // // find the existing annotation - // TagProjectionAnnotation anno = findExistingAnnotation(node); - // // if able to project node see if projection annotation was - // // already created and create new if needed - // Position newPos = createProjectionPosition(node); - // if (newPos != null && anno == null) { - // TagProjectionAnnotation newAnnotation = new - // TagProjectionAnnotation(node, false); - // // add to map containing annotations to add - // fViewer.getProjectionAnnotationModel().addAnnotation(newAnnotation, - // newPos); - // } - // // if not able to project node see if projection annotation was - // // already created and remove it - // if (newPos == null && anno != null) { - // fViewer.getProjectionAnnotationModel().removeAnnotation(anno); - // } - // } - // - // long end = System.currentTimeMillis(); - // if (debugProjectionPerf) { - // String nodeName = node != null ? node.getNodeName() : "null"; - // //$NON-NLS-1$ - // System.out.println("StructuredTextFoldingProviderDTD.nodeChanged (" - // + nodeName + "):" + (end - start)); //$NON-NLS-1$ //$NON-NLS-2$ - // } - } - - public void nodesAdded(NodesEvent event) { - long start = System.currentTimeMillis(); - - processNodesEvent(event, NodeChange.ADD); - - if (debugProjectionPerf) { - long end = System.currentTimeMillis(); - System.out.println("StructuredTextFoldingProviderDTD.nodesAdded: " + (end - start)); //$NON-NLS-1$ - } - } - - /** - * Goes through every changed node in event and add to queue of node - * changes that will be recalculated for projection annotation model. - * - * @param event - * @param changeType - */ - private void processNodesEvent(NodesEvent event, int changeType) { - List nodes = event.getNodes(); - Iterator it = nodes.iterator(); - while (it.hasNext()) { - DTDNode node = (DTDNode) it.next(); - if (isNodeProjectable(node)) { - if (fQueuedNodeChanges == null) { - fQueuedNodeChanges = new ArrayList(); - } - - int existingIndex = fQueuedNodeChanges.indexOf(node); - if (existingIndex > -1) { - // node is already queued up - NodeChange existingChange = (NodeChange) fQueuedNodeChanges.remove(existingIndex); - // don't add if added then removed node or vice versa - if (existingChange.getChangeType() == changeType) { - NodeChange newChange = new NodeChange(node, changeType); - fQueuedNodeChanges.add(newChange); - } - } - else { - // not queued up yet, so queue node - NodeChange newChange = new NodeChange(node, changeType); - fQueuedNodeChanges.add(newChange); - } - } - } - // if document isn't changing, go ahead and apply it - if (!fIsDocumentChanging) { - applyAnnotationModelChanges(); - } - } - - public void nodesRemoved(NodesEvent event) { - long start = System.currentTimeMillis(); - - processNodesEvent(event, NodeChange.REMOVE); - - if (debugProjectionPerf) { - long end = System.currentTimeMillis(); - System.out.println("StructuredTextFoldingProviderDTD.nodesRemoved: " + (end - start)); //$NON-NLS-1$ - } - } - - public void projectionDisabled() { - DTDFile file = getDTDFile(); - if (file != null) { - file.removeDTDFileListener(this); - } - - // remove document listener - if (fDocumentListener != null && fDocument != null) { - fDocument.removeDocumentListener(fDocumentListener); - fDocument = null; - - // clear out list of queued changes since it may no longer be - // accurate - if (fQueuedNodeChanges != null) { - fQueuedNodeChanges.clear(); - fQueuedNodeChanges = null; - } - } - - fDocument = null; - fProjectionNeedsToBeEnabled = false; - } - - public void projectionEnabled() { - initialize(); - } - - public void inputDocumentAboutToBeChanged(IDocument oldInput, IDocument newInput) { - // if folding is enabled and new document is going to be a totally - // different document, disable projection - if (fDocument != null && fDocument != newInput) { - // disable projection and disconnect everything - projectionDisabled(); - fProjectionNeedsToBeEnabled = true; - } - } - - public void inputDocumentChanged(IDocument oldInput, IDocument newInput) { - // if projection was previously enabled before input document changed - // and new document is different than old document - if (fProjectionNeedsToBeEnabled && fDocument == null && newInput != null) { - projectionEnabled(); - fProjectionNeedsToBeEnabled = false; - } - } - - /** - * Disconnect this IStructuredTextFoldingProvider from projection viewer - */ - public void uninstall() { - if (isInstalled()) { - projectionDisabled(); - - fViewer.removeProjectionListener(this); - fViewer.addTextInputListener(this); - fViewer = null; - } - } -} diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/registry/AdapterFactoryProviderForDTD.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/registry/AdapterFactoryProviderForDTD.java deleted file mode 100644 index 61a22f19c7..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/registry/AdapterFactoryProviderForDTD.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 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 - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ -package org.eclipse.wst.dtd.ui.internal.registry; - -import org.eclipse.wst.dtd.core.internal.modelhandler.ModelHandlerForDTD; -import org.eclipse.wst.sse.core.internal.ltk.modelhandler.IDocumentTypeHandler; -import org.eclipse.wst.sse.core.internal.model.FactoryRegistry; -import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel; -import org.eclipse.wst.sse.ui.internal.provisional.registry.AdapterFactoryProvider; -import org.eclipse.wst.sse.ui.internal.util.Assert; - - -/** - * @author nitin - * - * To change the template for this generated type comment go to - * Window>Preferences>Java>Code Generation>Code and Comments - */ -public class AdapterFactoryProviderForDTD implements AdapterFactoryProvider { - - /** - * - */ - public AdapterFactoryProviderForDTD() { - super(); - } - - /* - * @see AdapterFactoryProvider#addAdapterFactories(IStructuredModel) - */ - public void addAdapterFactories(IStructuredModel structuredModel) { - FactoryRegistry factoryRegistry = structuredModel.getFactoryRegistry(); - Assert.isNotNull(factoryRegistry, "Program Error: client caller must ensure model has factory registry"); //$NON-NLS-1$ - } - - public boolean isFor(IDocumentTypeHandler contentTypeDescription) { - return (contentTypeDescription instanceof ModelHandlerForDTD); - } - - public void reinitializeFactories(IStructuredModel structuredModel) { - // nothing to do, since no embedded type - } -} diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/style/IStyleConstantsDTD.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/style/IStyleConstantsDTD.java deleted file mode 100644 index 68bdb5e870..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/style/IStyleConstantsDTD.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 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 - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ -package org.eclipse.wst.dtd.ui.internal.style; - -/** - * Contains the symbolic name of styles used by LineStyleProvider, - * ColorManager, and any others who may be interested - */ -public interface IStyleConstantsDTD { - - public static final String DTD_COMMENT = "dtdComment"; //$NON-NLS-1$ - - // Data are variables - public static final String DTD_DATA = "dtdData"; //$NON-NLS-1$ - public static final String DTD_DEFAULT = "dtdDefault"; //$NON-NLS-1$ - - // keywords are constants like IMPLIED or PCDATA - public static final String DTD_KEYWORD = "dtdKeyword"; //$NON-NLS-1$ - - // strings are anything in quotes - public static final String DTD_STRING = "dtdString"; //$NON-NLS-1$ - - // All the remaining symbols - public static final String DTD_SYMBOL = "dtdSymbol"; //$NON-NLS-1$ - - // tags are '<', '!', or '>' - public static final String DTD_TAG = "dtdTag"; //$NON-NLS-1$ - - // tagnames are like ELEMENT, ATTLIST, etc. - public static final String DTD_TAGNAME = "dtdTagName"; //$NON-NLS-1$ -} diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/style/LineStyleProviderForDTD.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/style/LineStyleProviderForDTD.java deleted file mode 100644 index 443a940ae1..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/style/LineStyleProviderForDTD.java +++ /dev/null @@ -1,133 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 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 - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ -package org.eclipse.wst.dtd.ui.internal.style; - -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.jface.text.TextAttribute; -import org.eclipse.jface.util.PropertyChangeEvent; -import org.eclipse.wst.dtd.core.internal.parser.DTDRegionTypes; -import org.eclipse.wst.dtd.ui.internal.DTDUIPlugin; -import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion; -import org.eclipse.wst.sse.ui.internal.provisional.style.AbstractLineStyleProvider; -import org.eclipse.wst.sse.ui.internal.provisional.style.LineStyleProvider; - -public class LineStyleProviderForDTD extends AbstractLineStyleProvider implements LineStyleProvider { - public LineStyleProviderForDTD() { - super(); - } - - protected TextAttribute getAttributeFor(ITextRegion region) { - /** - * a method to centralize all the "format rules" for regions - * specifically associated for how to "open" the region. - */ - // not sure why this is coming through null, but just to catch it - if (region == null) { - return (TextAttribute) getTextAttributes().get(IStyleConstantsDTD.DTD_DEFAULT); - } - String type = region.getType(); - if (type == DTDRegionTypes.CONTENT_EMPTY || type == DTDRegionTypes.CONTENT_ANY || type == DTDRegionTypes.CONTENT_PCDATA) { - return (TextAttribute) getTextAttributes().get(IStyleConstantsDTD.DTD_DATA); - } - else if (type == DTDRegionTypes.ELEMENT_TAG || type == DTDRegionTypes.ENTITY_TAG || type == DTDRegionTypes.ATTLIST_TAG || type == DTDRegionTypes.NOTATION_TAG) { - return (TextAttribute) getTextAttributes().get(IStyleConstantsDTD.DTD_TAGNAME); - } - else if (type == DTDRegionTypes.CONNECTOR || type == DTDRegionTypes.OCCUR_TYPE) { - return (TextAttribute) getTextAttributes().get(IStyleConstantsDTD.DTD_SYMBOL); - } - else if (type == DTDRegionTypes.NDATA_VALUE) { - return (TextAttribute) getTextAttributes().get(IStyleConstantsDTD.DTD_DATA); - } - else if (type == DTDRegionTypes.START_TAG || type == DTDRegionTypes.END_TAG || type == DTDRegionTypes.EXCLAMATION) { - return (TextAttribute) getTextAttributes().get(IStyleConstantsDTD.DTD_TAG); - } - else if (type == DTDRegionTypes.COMMENT_START || type == DTDRegionTypes.COMMENT_CONTENT || type == DTDRegionTypes.COMMENT_END) { - return (TextAttribute) getTextAttributes().get(IStyleConstantsDTD.DTD_COMMENT); - } - else if (type == DTDRegionTypes.SINGLEQUOTED_LITERAL || type == DTDRegionTypes.DOUBLEQUOTED_LITERAL) { - return (TextAttribute) getTextAttributes().get(IStyleConstantsDTD.DTD_STRING); - } - else if (type == DTDRegionTypes.SYSTEM_KEYWORD || type == DTDRegionTypes.PUBLIC_KEYWORD || type == DTDRegionTypes.NDATA_KEYWORD || type == DTDRegionTypes.CDATA_KEYWORD || type == DTDRegionTypes.ID_KEYWORD || type == DTDRegionTypes.IDREF_KEYWORD || type == DTDRegionTypes.IDREFS_KEYWORD || type == DTDRegionTypes.ENTITY_KEYWORD || type == DTDRegionTypes.ENTITIES_KEYWORD || type == DTDRegionTypes.NMTOKEN_KEYWORD || type == DTDRegionTypes.NMTOKENS_KEYWORD || type == DTDRegionTypes.NOTATION_KEYWORD || type == DTDRegionTypes.REQUIRED_KEYWORD || type == DTDRegionTypes.IMPLIED_KEYWORD || type == DTDRegionTypes.FIXED_KEYWORD) { - return (TextAttribute) getTextAttributes().get(IStyleConstantsDTD.DTD_KEYWORD); - } - else if (type == DTDRegionTypes.NAME || type == DTDRegionTypes.ENTITY_PARM) { - // if (region instanceof DTDRegion) { - // DTDRegion dtdRegion = (DTDRegion) region; - // IStructuredDocumentRegion flatNode = dtdRegion.getParent(); - // String regionText = flatNode.getText(dtdRegion); - // if (regionText.equals("ANY") || regionText.equals("EMPTY")) { - // return new TextAttribute(DTDColors.DTD_KEYWORD); - // } - // } - return (TextAttribute) getTextAttributes().get(IStyleConstantsDTD.DTD_DATA); - } - - // default, return null to signal "not handled" - // in which case, other factories should be tried - return null; - } - - protected IPreferenceStore getColorPreferences() { - return DTDUIPlugin.getDefault().getPreferenceStore(); - } - - protected void handlePropertyChange(PropertyChangeEvent event) { - String styleKey = null; - - if (event != null) { - String prefKey = event.getProperty(); - // check if preference changed is a style preference - if (IStyleConstantsDTD.DTD_DEFAULT.equals(prefKey)) { - styleKey = IStyleConstantsDTD.DTD_DEFAULT; - } - else if (IStyleConstantsDTD.DTD_TAG.equals(prefKey)) { - styleKey = IStyleConstantsDTD.DTD_TAG; - } - else if (IStyleConstantsDTD.DTD_TAGNAME.equals(prefKey)) { - styleKey = IStyleConstantsDTD.DTD_TAGNAME; - } - else if (IStyleConstantsDTD.DTD_COMMENT.equals(prefKey)) { - styleKey = IStyleConstantsDTD.DTD_COMMENT; - } - else if (IStyleConstantsDTD.DTD_KEYWORD.equals(prefKey)) { - styleKey = IStyleConstantsDTD.DTD_KEYWORD; - } - else if (IStyleConstantsDTD.DTD_STRING.equals(prefKey)) { - styleKey = IStyleConstantsDTD.DTD_STRING; - } - else if (IStyleConstantsDTD.DTD_DATA.equals(prefKey)) { - styleKey = IStyleConstantsDTD.DTD_DATA; - } - else if (IStyleConstantsDTD.DTD_SYMBOL.equals(prefKey)) { - styleKey = IStyleConstantsDTD.DTD_SYMBOL; - } - } - - if (styleKey != null) { - // overwrite style preference with new value - addTextAttribute(styleKey); - super.handlePropertyChange(event); - } - } - - protected void loadColors() { - addTextAttribute(IStyleConstantsDTD.DTD_DEFAULT); - addTextAttribute(IStyleConstantsDTD.DTD_TAG); - addTextAttribute(IStyleConstantsDTD.DTD_TAGNAME); - addTextAttribute(IStyleConstantsDTD.DTD_COMMENT); - addTextAttribute(IStyleConstantsDTD.DTD_KEYWORD); - addTextAttribute(IStyleConstantsDTD.DTD_STRING); - addTextAttribute(IStyleConstantsDTD.DTD_DATA); - addTextAttribute(IStyleConstantsDTD.DTD_SYMBOL); - } -} diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/style/LineStyleProviderForDTDSubSet.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/style/LineStyleProviderForDTDSubSet.java deleted file mode 100644 index 0f25b7e633..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/style/LineStyleProviderForDTDSubSet.java +++ /dev/null @@ -1,159 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ -package org.eclipse.wst.dtd.ui.internal.style; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.jface.text.BadLocationException; -import org.eclipse.jface.text.ITypedRegion; -import org.eclipse.jface.text.TextAttribute; -import org.eclipse.jface.text.TextUtilities; -import org.eclipse.swt.custom.StyleRange; -import org.eclipse.swt.graphics.RGB; -import org.eclipse.wst.dtd.core.internal.provisional.contenttype.ContentTypeIdForDTD; -import org.eclipse.wst.dtd.core.text.IDTDPartitions; -import org.eclipse.wst.dtd.ui.internal.DTDUIPlugin; -import org.eclipse.wst.sse.core.StructuredModelManager; -import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel; -import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument; -import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion; -import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredPartitioning; -import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion; -import org.eclipse.wst.sse.ui.internal.preferences.ui.ColorHelper; -import org.eclipse.wst.sse.ui.internal.provisional.style.AbstractLineStyleProvider; -import org.eclipse.wst.sse.ui.internal.provisional.style.LineStyleProvider; - -public class LineStyleProviderForDTDSubSet extends AbstractLineStyleProvider implements LineStyleProvider { - private IStructuredModel fInternalModel = null; - private LineStyleProviderForDTD fInternalProvider = null; - private StyleRange[] fInternalRanges; - private String fPartitioning = null; - - public LineStyleProviderForDTDSubSet() { - super(); - fInternalProvider = new LineStyleProviderForDTD(); - fInternalRanges = new StyleRange[0]; - fPartitioning = IStructuredPartitioning.DEFAULT_STRUCTURED_PARTITIONING; - } - - - /** - * @param lineRequestStart - * @param lineRequestLength - * @param holdResults - */ - private void addStyleRanges(int lineRequestStart, int lineRequestLength, Collection holdResults, int adjustment) { - int lineRequestEnd = lineRequestStart + lineRequestLength; - for (int i = 0; i < fInternalRanges.length; i++) { - int adjustedStyleRangeStart = adjustment + fInternalRanges[i].start; - int adjustedStyleRangeEnd = adjustedStyleRangeStart + fInternalRanges[i].length; - if (adjustedStyleRangeEnd < lineRequestStart || lineRequestEnd < adjustedStyleRangeStart) - continue; - int end = Math.min(adjustedStyleRangeEnd, lineRequestEnd); - StyleRange range = new StyleRange(); - range.start = Math.max(adjustedStyleRangeStart, lineRequestStart); - range.length = end - range.start; - range.fontStyle = fInternalRanges[i].fontStyle; - range.foreground = fInternalRanges[i].foreground; - range.background = fInternalRanges[i].background; - holdResults.add(range); - } - } - - protected TextAttribute getAttributeFor(ITextRegion region) { - TextAttribute ta = null; - - String prefString = getColorPreferences().getString(IStyleConstantsDTD.DTD_DEFAULT); - String[] stylePrefs = ColorHelper.unpackStylePreferences(prefString); - if (stylePrefs != null) { - RGB foreground = ColorHelper.toRGB(stylePrefs[0]); - RGB background = ColorHelper.toRGB(stylePrefs[1]); - boolean bold = Boolean.valueOf(stylePrefs[2]).booleanValue(); - ta = createTextAttribute(foreground, background, bold); - } - return ta; - } - - protected IPreferenceStore getColorPreferences() { - return DTDUIPlugin.getDefault().getPreferenceStore(); - } - - /** - * @return - */ - private IStructuredDocument getInternalDocument() { - if (fInternalModel == null) { - fInternalModel = StructuredModelManager.getModelManager().createUnManagedStructuredModelFor(ContentTypeIdForDTD.ContentTypeID_DTD); - } - return fInternalModel.getStructuredDocument(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.sse.ui.structured.style.AbstractLineStyleProvider#prepareRegions(org.eclipse.jface.text.ITypedRegion, - * int, int, java.util.Collection) - */ - public boolean prepareRegions(ITypedRegion typedRegion, int lineRequestStart, int lineRequestLength, Collection holdResults) { - if (!IDTDPartitions.DTD_DEFAULT.equals(typedRegion.getType())) { - // compute an internal DTD model and return linestyles for it - ITextRegion dtdContentRegion = null; - IStructuredDocumentRegion doctype = fDocument.getRegionAtCharacterOffset(typedRegion.getOffset()); - if (doctype != null) - dtdContentRegion = doctype.getRegionAtCharacterOffset(typedRegion.getOffset()); - String contents = dtdContentRegion != null ? doctype.getFullText(dtdContentRegion) : null; - IStructuredDocument document = getInternalDocument(); - if (document == null) - return false; - - updateStyleRanges(document, contents); - - addStyleRanges(lineRequestStart, lineRequestLength, holdResults, doctype.getStartOffset(dtdContentRegion)); - return true; - } - return false; - } - - public void release() { - super.release(); - if (fInternalProvider != null) { - fInternalProvider.release(); - } - } - - private void updateStyleRanges(IStructuredDocument document, String contents) { - if (!document.get().equals(contents)) { - document.set(contents); - try { - ITypedRegion regions[] = TextUtilities.computePartitioning(getInternalDocument(), fPartitioning, 0, document.getLength(), false); - List ranges = new ArrayList(); - fInternalProvider.init(getInternalDocument(), fRecHighlighter); - for (int i = 0; i < regions.length; i++) { - fInternalProvider.prepareRegions(regions[i], regions[i].getOffset(), regions[i].getLength(), ranges); - } - fInternalRanges = (StyleRange[]) ranges.toArray(new StyleRange[0]); - } - catch (BadLocationException e) { - fInternalRanges = new StyleRange[0]; - } - } - } - - - protected void loadColors() { - fInternalProvider.loadColors(); - } -} diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/templates/TemplateContextTypeDTD.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/templates/TemplateContextTypeDTD.java deleted file mode 100644 index c63d5933ce..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/templates/TemplateContextTypeDTD.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * David Carver, STAR - added Encoding Content Resolver, bug 162321 - *******************************************************************************/ -package org.eclipse.wst.dtd.ui.internal.templates; - -import org.eclipse.jface.text.templates.GlobalTemplateVariables; -import org.eclipse.jface.text.templates.TemplateContextType; -import org.eclipse.wst.xml.ui.internal.templates.EncodingTemplateVariableResolverXML; - -/** - * Base class for DTD template context types. Templates of this context type - * apply to any place within DTD content type. - */ -public class TemplateContextTypeDTD extends TemplateContextType { - - public TemplateContextTypeDTD() { - super(); - addResolver(new GlobalTemplateVariables.Cursor()); - addResolver(new GlobalTemplateVariables.Date()); - addResolver(new GlobalTemplateVariables.Dollar()); - addResolver(new GlobalTemplateVariables.LineSelection()); - addResolver(new GlobalTemplateVariables.Time()); - addResolver(new GlobalTemplateVariables.User()); - addResolver(new GlobalTemplateVariables.WordSelection()); - addResolver(new GlobalTemplateVariables.Year()); - addResolver(new EncodingTemplateVariableResolverXML()); - } -} diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/templates/TemplateContextTypeIdsDTD.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/templates/TemplateContextTypeIdsDTD.java deleted file mode 100644 index 0aa4ee0ee5..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/templates/TemplateContextTypeIdsDTD.java +++ /dev/null @@ -1,17 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * - *******************************************************************************/ -package org.eclipse.wst.dtd.ui.internal.templates; - - -public class TemplateContextTypeIdsDTD { - public static final String NEW = "dtd_new"; //$NON-NLS-1$ -} diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/text/DTDDocumentRegionEdgeMatcher.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/text/DTDDocumentRegionEdgeMatcher.java deleted file mode 100644 index 5cf9a66050..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/text/DTDDocumentRegionEdgeMatcher.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 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 - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ -package org.eclipse.wst.dtd.ui.internal.text; - -import org.eclipse.wst.dtd.core.internal.parser.DTDRegionTypes; -import org.eclipse.wst.sse.ui.internal.text.DocumentRegionEdgeMatcher; - - -public class DTDDocumentRegionEdgeMatcher extends DocumentRegionEdgeMatcher { - - /** - * @param validContexts - * @param nextMatcher - */ - public DTDDocumentRegionEdgeMatcher() { - super(new String[]{DTDRegionTypes.START_TAG, DTDRegionTypes.COMMENT_START}, null); - } -} diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/contentoutline/actions/AddAttributeAction.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/contentoutline/actions/AddAttributeAction.java deleted file mode 100644 index ed94bc9f58..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/contentoutline/actions/AddAttributeAction.java +++ /dev/null @@ -1,56 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 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 - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ - - -package org.eclipse.wst.dtd.ui.internal.views.contentoutline.actions; - -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.wst.dtd.core.internal.AttributeList; -import org.eclipse.wst.dtd.core.internal.DTDNode; -import org.eclipse.wst.dtd.core.internal.Element; -import org.eclipse.wst.dtd.core.internal.document.DTDModelImpl; - - -public class AddAttributeAction extends BaseAction { - - public AddAttributeAction(DTDModelImpl model, String label) { - super(model, label); - } - - public void run() { - DTDNode selectedNode = getFirstNodeSelected(); - String newName = "NewAttribute"; //$NON-NLS-1$ - if (selectedNode instanceof AttributeList) { - ((AttributeList) selectedNode).addAttribute(newName); - } - else if (selectedNode instanceof Element) { - ((Element) selectedNode).addAttribute(newName); - } - } - - protected boolean updateSelection(IStructuredSelection selection) { - boolean rc = super.updateSelection(selection); - DTDNode node = getFirstNodeSelected(selection); - if (node instanceof Element) { - // System.out.println("attribute set to true"); - setEnabled(true); - } - else { - // System.out.println("attribute set to false"); - setEnabled(false); - } - - return rc; - } - -} diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/contentoutline/actions/AddAttributeListAction.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/contentoutline/actions/AddAttributeListAction.java deleted file mode 100644 index 1bcc5a1c75..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/contentoutline/actions/AddAttributeListAction.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 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 - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ - - -package org.eclipse.wst.dtd.ui.internal.views.contentoutline.actions; - -import org.eclipse.wst.dtd.core.internal.DTDFile; -import org.eclipse.wst.dtd.core.internal.DTDNode; -import org.eclipse.wst.dtd.core.internal.Element; -import org.eclipse.wst.dtd.core.internal.document.DTDModelImpl; - - -public class AddAttributeListAction extends BaseAction { - - public AddAttributeListAction(DTDModelImpl model, String label) { - super(model, label); - } - - public void run() { - DTDNode selectedNode = getFirstNodeSelected(); - DTDFile dtdFile = getModel().getDTDFile(); - String attListName = "NewAttList"; //$NON-NLS-1$ - if (selectedNode != null) { - DTDNode topLevelNode = dtdFile.getTopLevelNodeAt(selectedNode.getStartOffset()); - if (topLevelNode instanceof Element) { - attListName = ((Element) topLevelNode).getName(); - } - } - - getModel().getDTDFile().createAttributeList(selectedNode, attListName, true); - // newElement.setName(DTDUniqueNameHelper.getUniqueElementName(dtdFile)); - - } -} diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/contentoutline/actions/AddCommentAction.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/contentoutline/actions/AddCommentAction.java deleted file mode 100644 index bdd9630ce5..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/contentoutline/actions/AddCommentAction.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 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 - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ - - -package org.eclipse.wst.dtd.ui.internal.views.contentoutline.actions; - - -import org.eclipse.wst.dtd.core.internal.DTDNode; -import org.eclipse.wst.dtd.core.internal.document.DTDModelImpl; - - -public class AddCommentAction extends BaseAction { - - public AddCommentAction(DTDModelImpl model, String label) { - super(model, label); - } - - public void run() { - DTDNode selectedNode = getFirstNodeSelected(); - getModel().getDTDFile().createComment(selectedNode, "NewComment", true); //$NON-NLS-1$ - } -} diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/contentoutline/actions/AddElementAction.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/contentoutline/actions/AddElementAction.java deleted file mode 100644 index 6b00a259ac..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/contentoutline/actions/AddElementAction.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 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 - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ -package org.eclipse.wst.dtd.ui.internal.views.contentoutline.actions; - -import org.eclipse.wst.dtd.core.internal.DTDFile; -import org.eclipse.wst.dtd.core.internal.DTDNode; -import org.eclipse.wst.dtd.core.internal.document.DTDModelImpl; -import org.eclipse.wst.dtd.core.internal.util.DTDUniqueNameHelper; - - -public class AddElementAction extends BaseAction { - - public AddElementAction(DTDModelImpl model, String label) { - super(model, label); - } - - public void run() { - DTDNode selectedNode = getFirstNodeSelected(); - DTDFile dtdFile = getModel().getDTDFile(); - String elementName = DTDUniqueNameHelper.getUniqueElementName(dtdFile); - dtdFile.createElement(selectedNode, elementName, true); //$NON-NLS-1$ - } -} diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/contentoutline/actions/AddElementToContentModelAction.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/contentoutline/actions/AddElementToContentModelAction.java deleted file mode 100644 index c398cf9fb2..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/contentoutline/actions/AddElementToContentModelAction.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 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 - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ - - -package org.eclipse.wst.dtd.ui.internal.views.contentoutline.actions; - -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.wst.dtd.core.internal.CMGroupNode; -import org.eclipse.wst.dtd.core.internal.DTDNode; -import org.eclipse.wst.dtd.core.internal.Element; -import org.eclipse.wst.dtd.core.internal.document.DTDModelImpl; - - -public class AddElementToContentModelAction extends BaseAction { - - public AddElementToContentModelAction(DTDModelImpl model, String label) { - super(model, label); - } - - public void run() { - DTDNode node = getFirstNodeSelected(); - - if (node instanceof CMGroupNode) { - ((CMGroupNode) node).addChild(); - } - else if (node instanceof Element) { - ((Element) node).addChild(); - } - } - - protected boolean updateSelection(IStructuredSelection selection) { - boolean rc = super.updateSelection(selection); - DTDNode node = getFirstNodeSelected(selection); - if (node instanceof CMGroupNode) { - setEnabled(true); - } - else { - setEnabled(false); - } - return rc; - } -} diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/contentoutline/actions/AddEntityAction.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/contentoutline/actions/AddEntityAction.java deleted file mode 100644 index c51669ec2e..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/contentoutline/actions/AddEntityAction.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 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 - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ - - -package org.eclipse.wst.dtd.ui.internal.views.contentoutline.actions; - - -import org.eclipse.wst.dtd.core.internal.DTDNode; -import org.eclipse.wst.dtd.core.internal.document.DTDModelImpl; - - -public class AddEntityAction extends BaseAction { - - public AddEntityAction(DTDModelImpl model, String label) { - super(model, label); - } - - public void run() { - DTDNode selectedNode = getFirstNodeSelected(); - - getModel().getDTDFile().createEntity(selectedNode, "NewEntity", true); //$NON-NLS-1$ - // newElement.setName(DTDUniqueNameHelper.getUniqueElementName(dtdFile)); - - } -} diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/contentoutline/actions/AddGroupToContentModelAction.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/contentoutline/actions/AddGroupToContentModelAction.java deleted file mode 100644 index 866e1c9168..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/contentoutline/actions/AddGroupToContentModelAction.java +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 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 - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ - - -package org.eclipse.wst.dtd.ui.internal.views.contentoutline.actions; - -import org.eclipse.wst.dtd.core.internal.CMGroupNode; -import org.eclipse.wst.dtd.core.internal.DTDNode; -import org.eclipse.wst.dtd.core.internal.Element; -import org.eclipse.wst.dtd.core.internal.document.DTDModelImpl; - - -public class AddGroupToContentModelAction extends BaseAction { - - public AddGroupToContentModelAction(DTDModelImpl model, String label) { - super(model, label); - } - - public void run() { - DTDNode node = getFirstNodeSelected(); - - if (node instanceof CMGroupNode) { - ((CMGroupNode) node).addGroup(); - } - else if (node instanceof Element) { - ((Element) node).addGroup(); - } - } -} diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/contentoutline/actions/AddNotationAction.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/contentoutline/actions/AddNotationAction.java deleted file mode 100644 index b11f82df70..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/contentoutline/actions/AddNotationAction.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 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 - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ - - -package org.eclipse.wst.dtd.ui.internal.views.contentoutline.actions; - -import org.eclipse.wst.dtd.core.internal.DTDNode; -import org.eclipse.wst.dtd.core.internal.document.DTDModelImpl; - - -public class AddNotationAction extends BaseAction { - - public AddNotationAction(DTDModelImpl model, String label) { - super(model, label); - } - - public void run() { - DTDNode selectedNode = getFirstNodeSelected(); - - getModel().getDTDFile().createNotation(selectedNode, "NewNotation", true); //$NON-NLS-1$ - - // newNotation.setName(DTDUniqueNameHelper.getUniqueNotationName(dtdFile)); - } -} diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/contentoutline/actions/AddParameterEntityReferenceAction.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/contentoutline/actions/AddParameterEntityReferenceAction.java deleted file mode 100644 index 05ebced519..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/contentoutline/actions/AddParameterEntityReferenceAction.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 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 - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ - - -package org.eclipse.wst.dtd.ui.internal.views.contentoutline.actions; - -import org.eclipse.wst.dtd.core.internal.DTDFile; -import org.eclipse.wst.dtd.core.internal.DTDNode; -import org.eclipse.wst.dtd.core.internal.document.DTDModelImpl; -import org.eclipse.wst.dtd.core.internal.util.LabelValuePair; - - -public class AddParameterEntityReferenceAction extends BaseAction { - public AddParameterEntityReferenceAction(DTDModelImpl model, String label) { - super(model, label); - } - - public String getFirstExternalParameterEntity(DTDFile dtdFile) { - LabelValuePair[] freeExternalEntities = dtdFile.getDTDModel().createParmEntityContentItems(null); - - if (freeExternalEntities.length > 0) { - return (String) freeExternalEntities[0].fValue; - // return (Entity) freeExternalEntities[0].fValue; - } - return null; - } - - public void run() { - DTDFile dtdFile = getModel().getDTDFile(); - String extEntity = getFirstExternalParameterEntity(dtdFile); - DTDNode selectedNode = getFirstNodeSelected(); - if (extEntity != null) { - dtdFile.createParameterEntityReference(selectedNode, extEntity, true); - } - else { - dtdFile.createParameterEntityReference(selectedNode, "%NewEntityReference;", true); //$NON-NLS-1$ - } - } -} diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/contentoutline/actions/BaseAction.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/contentoutline/actions/BaseAction.java deleted file mode 100644 index 411e9c3e91..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/contentoutline/actions/BaseAction.java +++ /dev/null @@ -1,67 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 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 - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ - - -package org.eclipse.wst.dtd.ui.internal.views.contentoutline.actions; - -import java.util.Iterator; - -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.ui.IEditorActionBarContributor; -import org.eclipse.ui.actions.SelectionListenerAction; -import org.eclipse.wst.dtd.core.internal.DTDNode; -import org.eclipse.wst.dtd.core.internal.document.DTDModelImpl; -import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel; - - -abstract public class BaseAction extends SelectionListenerAction { - - protected IEditorActionBarContributor contextContributor; - private IStructuredModel fModel; - - public BaseAction(IStructuredModel model, String text) { - this(model, text, null); - } - - public BaseAction(IStructuredModel model, String text, ImageDescriptor imageDesc) { - super(text); - fModel = model; - setImageDescriptor(imageDesc); - } - - protected DTDNode getFirstNodeSelected() { - return getFirstNodeSelected(getStructuredSelection()); - } - - protected DTDNode getFirstNodeSelected(IStructuredSelection selection) { - Iterator iter = selection.iterator(); - // DTDNode referencePoint = null; - while (iter.hasNext()) { - Object element = iter.next(); - if (element instanceof DTDNode) { - return (DTDNode) element; - } - } - return null; - } - - protected DTDModelImpl getModel() { - return (DTDModelImpl) fModel; - } - - public void setContextContributor(IEditorActionBarContributor contributor) { - contextContributor = contributor; - } - -} diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/contentoutline/actions/DeleteAction.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/contentoutline/actions/DeleteAction.java deleted file mode 100644 index 679c1dce9b..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/contentoutline/actions/DeleteAction.java +++ /dev/null @@ -1,70 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 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 - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ - - -package org.eclipse.wst.dtd.ui.internal.views.contentoutline.actions; - -import java.util.Iterator; - -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.ui.actions.SelectionListenerAction; -import org.eclipse.wst.dtd.core.internal.CMNode; -import org.eclipse.wst.dtd.core.internal.DTDFile; -import org.eclipse.wst.dtd.core.internal.DTDNode; -import org.eclipse.wst.dtd.core.internal.util.DTDBatchNodeDelete; -import org.eclipse.wst.dtd.ui.internal.DTDUIMessages; - - -public class DeleteAction extends SelectionListenerAction { - - public DeleteAction(String label) { - super(label); - } - - public void run() { - IStructuredSelection selection = getStructuredSelection(); - - Iterator iter = selection.iterator(); - DTDBatchNodeDelete batchDelete = null; - DTDFile dtdFile = null; - while (iter.hasNext()) { - Object element = iter.next(); - if (element instanceof DTDNode) { - DTDNode node = (DTDNode) element; - dtdFile = node.getDTDFile(); - if (batchDelete == null) { - batchDelete = new DTDBatchNodeDelete(dtdFile); - } - batchDelete.addNode((DTDNode) element); - } - } - dtdFile.getDTDModel().beginRecording(this, DTDUIMessages._UI_LABEL_DTD_FILE_DELETE); //$NON-NLS-1$ - batchDelete.deleteNodes(this); - dtdFile.getDTDModel().endRecording(this); - } - - public boolean updateSelection(IStructuredSelection sel) { - if (!super.updateSelection(sel)) - return false; - - Object selectedObject = sel.getFirstElement(); - if (selectedObject instanceof DTDNode && !(selectedObject instanceof CMNode && ((CMNode) selectedObject).isRootElementContent())) { - setEnabled(true); - return true; // enable delete menu item - } - else { - setEnabled(false); - return false; // disable it - grey out - } - } -} diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/contentoutline/actions/ReplaceEmptyContentModelWithGroupAction.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/contentoutline/actions/ReplaceEmptyContentModelWithGroupAction.java deleted file mode 100644 index 5523965513..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/contentoutline/actions/ReplaceEmptyContentModelWithGroupAction.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * - *******************************************************************************/ -package org.eclipse.wst.dtd.ui.internal.views.contentoutline.actions; - -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.wst.dtd.core.internal.CMNode; -import org.eclipse.wst.dtd.core.internal.DTDNode; -import org.eclipse.wst.dtd.core.internal.Element; -import org.eclipse.wst.dtd.core.internal.document.DTDModelImpl; - -public class ReplaceEmptyContentModelWithGroupAction extends BaseAction { - - public ReplaceEmptyContentModelWithGroupAction(DTDModelImpl model, String label) { - super(model, label); - } - - public void run() { - DTDNode node = getFirstNodeSelected(); - if (node instanceof Element) { - CMNode contentModel = ((Element) node).getContentModel(); - if (CMNode.EMPTY.equals(contentModel.getType())) { - getModel().beginRecording(this, getText()); - ((Element) node).replaceContentModel(this, "()"); //$NON-NLS-1$ - getModel().endRecording(this); - } - } - } - - protected boolean updateSelection(IStructuredSelection selection) { - boolean rc = super.updateSelection(selection); - DTDNode node = getFirstNodeSelected(selection); - setEnabled(node instanceof Element); - return rc; - } -} diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/properties/DTDPropertySourceAdapter.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/properties/DTDPropertySourceAdapter.java deleted file mode 100644 index cc90289ae0..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/properties/DTDPropertySourceAdapter.java +++ /dev/null @@ -1,130 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 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 - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ -package org.eclipse.wst.dtd.ui.internal.views.properties; - -import java.util.Stack; - -import org.eclipse.ui.views.properties.IPropertyDescriptor; -import org.eclipse.ui.views.properties.IPropertySource; -import org.eclipse.wst.dtd.core.internal.DTDNode; -import org.eclipse.wst.dtd.ui.internal.DTDUIMessages; -import org.eclipse.wst.sse.core.internal.provisional.INodeAdapter; -import org.eclipse.wst.sse.core.internal.provisional.INodeNotifier; -import org.eclipse.wst.sse.ui.internal.properties.CustomPropertyDescriptor; - - -/** - * An IPropertySource implementation for a JFace viewer used to display - * properties of DOM nodes. Requires an adapter factory to create JFace - * adapters for the nodes in the tree. - */ -public class DTDPropertySourceAdapter implements INodeAdapter, IPropertySource { - protected final static String CATEGORY_ATTRIBUTES = "Attributes"; //$NON-NLS-1$ - - private static final String ID_NAME = DTDUIMessages.DTDPropertySourceAdapter_0; //$NON-NLS-1$ - private static final String ID_TEXT = DTDUIMessages.DTDPropertySourceAdapter_1; //$NON-NLS-1$ - - protected IPropertyDescriptor[] fDescriptors = null; - protected INodeNotifier fNode = null; - - protected Stack fValuesBeingSet = new Stack(); - - public DTDPropertySourceAdapter(INodeNotifier target) { - super(); - fNode = target; - } - - /** - * @return - */ - private IPropertyDescriptor[] createPropertyDescriptors() { - CustomPropertyDescriptor nameDescriptor = new CustomPropertyDescriptor(ID_NAME, ID_NAME, null); - nameDescriptor.setCategory(DTDUIMessages.DTDPropertySourceAdapter_2); //$NON-NLS-1$ - // CustomPropertyDescriptor contentDescriptor = new - // CustomPropertyDescriptor(ID_TEXT, ID_TEXT, null); - // contentDescriptor.setCategory("Attributes"); - return new IPropertyDescriptor[]{nameDescriptor}; - } - - /** - * Returns a value for this Node that can be editted in a property sheet. - * - * @return a value that can be editted - */ - public Object getEditableValue() { - return null; - } - - /** - * Returns the current collection of property descriptors. - * - * @return all valid descriptors. - */ - public IPropertyDescriptor[] getPropertyDescriptors() { - if (fDescriptors == null || fDescriptors.length == 0) { - fDescriptors = createPropertyDescriptors(); - } - else { - updatePropertyDescriptors(); - } - return fDescriptors; - } - - /** - * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyValue(java.lang.Object) - */ - public Object getPropertyValue(Object id) { - Object value = null; - if (id.equals(ID_NAME) && fNode instanceof DTDNode) { - value = ((DTDNode) fNode).getName(); - } - if (id.equals(ID_TEXT) && fNode instanceof DTDNode) { - value = ((DTDNode) fNode).getFullNodeText(); - } - return value; - } - - /** - * Allowing the INodeAdapter to compare itself against the type allows it - * to return true in more than one case. - */ - public boolean isAdapterForType(Object type) { - return type == IPropertySource.class; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.views.properties.IPropertySource#isPropertySet(java.lang.Object) - */ - public boolean isPropertySet(Object id) { - return false; - } - - public void notifyChanged(INodeNotifier notifier, int eventType, Object changedFeature, Object oldValue, Object newValue, int pos) { - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.views.properties.IPropertySource#resetPropertyValue(java.lang.Object) - */ - public void resetPropertyValue(Object id) { - } - - public void setPropertyValue(Object nameObject, Object value) { - } - - protected void updatePropertyDescriptors() { - } -} diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/properties/DTDPropertySourceAdapterFactory.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/properties/DTDPropertySourceAdapterFactory.java deleted file mode 100644 index 59606bbb6f..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/properties/DTDPropertySourceAdapterFactory.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 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 - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ -package org.eclipse.wst.dtd.ui.internal.views.properties; - - - -import org.eclipse.ui.views.properties.IPropertySource; -import org.eclipse.wst.sse.core.internal.provisional.AbstractAdapterFactory; -import org.eclipse.wst.sse.core.internal.provisional.INodeAdapter; -import org.eclipse.wst.sse.core.internal.provisional.INodeAdapterFactory; -import org.eclipse.wst.sse.core.internal.provisional.INodeNotifier; - - -public class DTDPropertySourceAdapterFactory extends AbstractAdapterFactory { - - public DTDPropertySourceAdapterFactory() { - super(IPropertySource.class, true); - } - - public DTDPropertySourceAdapterFactory(Object adapterKey, boolean registerAdapters) { - super(adapterKey, registerAdapters); - } - - public INodeAdapterFactory copy() { - return new DTDPropertySourceAdapterFactory(getAdapterKey(), isShouldRegisterAdapter()); - } - - protected INodeAdapter createAdapter(INodeNotifier target) { - // at the moment, only one implementation exists - return new DTDPropertySourceAdapter(target); - } -} diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/wizard/NewDTDTemplatesWizardPage.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/wizard/NewDTDTemplatesWizardPage.java deleted file mode 100644 index 63a52f3cbb..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/wizard/NewDTDTemplatesWizardPage.java +++ /dev/null @@ -1,506 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * - *******************************************************************************/ -package org.eclipse.wst.dtd.ui.internal.wizard; - -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.preference.PreferenceDialog; -import org.eclipse.jface.resource.JFaceResources; -import org.eclipse.jface.text.Document; -import org.eclipse.jface.text.IDocument; -import org.eclipse.jface.text.source.ISourceViewer; -import org.eclipse.jface.text.source.SourceViewer; -import org.eclipse.jface.text.source.SourceViewerConfiguration; -import org.eclipse.jface.text.templates.DocumentTemplateContext; -import org.eclipse.jface.text.templates.Template; -import org.eclipse.jface.text.templates.TemplateBuffer; -import org.eclipse.jface.text.templates.TemplateContext; -import org.eclipse.jface.text.templates.TemplateContextType; -import org.eclipse.jface.text.templates.persistence.TemplateStore; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.IStructuredContentProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -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.TableViewer; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerSorter; -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ControlAdapter; -import org.eclipse.swt.events.ControlEvent; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.graphics.Rectangle; -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.Link; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.TableColumn; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.dialogs.PreferencesUtil; -import org.eclipse.wst.dtd.core.internal.provisional.contenttype.ContentTypeIdForDTD; -import org.eclipse.wst.dtd.ui.StructuredTextViewerConfigurationDTD; -import org.eclipse.wst.dtd.ui.internal.DTDUIMessages; -import org.eclipse.wst.dtd.ui.internal.DTDUIPlugin; -import org.eclipse.wst.dtd.ui.internal.Logger; -import org.eclipse.wst.dtd.ui.internal.editor.IHelpContextIds; -import org.eclipse.wst.dtd.ui.internal.preferences.DTDUIPreferenceNames; -import org.eclipse.wst.dtd.ui.internal.templates.TemplateContextTypeIdsDTD; -import org.eclipse.wst.sse.core.StructuredModelManager; -import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel; -import org.eclipse.wst.sse.ui.StructuredTextViewerConfiguration; -import org.eclipse.wst.sse.ui.internal.StructuredTextViewer; -import org.eclipse.wst.sse.ui.internal.provisional.style.LineStyleProvider; - -/** - * Templates page in new file wizard. Allows users to select a new file - * template to be applied in new file. - * - */ -public class NewDTDTemplatesWizardPage extends WizardPage { - - /** - * Content provider for templates - */ - private class TemplateContentProvider implements IStructuredContentProvider { - /** The template store. */ - private TemplateStore fStore; - - /* - * @see IContentProvider#dispose() - */ - public void dispose() { - fStore = null; - } - - /* - * @see IStructuredContentProvider#getElements(Object) - */ - public Object[] getElements(Object input) { - return fStore.getTemplates(TemplateContextTypeIdsDTD.NEW); - } - - /* - * @see IContentProvider#inputChanged(Viewer, Object, Object) - */ - public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { - fStore = (TemplateStore) newInput; - } - } - - /** - * Label provider for templates. - */ - private class TemplateLabelProvider extends LabelProvider implements ITableLabelProvider { - - /* - * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, - * int) - */ - public Image getColumnImage(Object element, int columnIndex) { - return null; - } - - /* - * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, - * int) - */ - public String getColumnText(Object element, int columnIndex) { - Template template = (Template) element; - - switch (columnIndex) { - case 0 : - return template.getName(); - case 1 : - return template.getDescription(); - default : - return ""; //$NON-NLS-1$ - } - } - } - - /** Last selected template name */ - private String fLastSelectedTemplateName; - /** The viewer displays the pattern of selected template. */ - private SourceViewer fPatternViewer; - /** The table presenting the templates. */ - private TableViewer fTableViewer; - /** Template store used by this wizard page */ - private TemplateStore fTemplateStore; - /** Checkbox for using templates. */ - private Button fUseTemplateButton; - - public NewDTDTemplatesWizardPage() { - super("NewDTDTemplatesWizardPage", DTDUIMessages.NewDTDTemplatesWizardPage_0, null); //$NON-NLS-1$ - setDescription(DTDUIMessages.NewDTDTemplatesWizardPage_1); - } - - /** - * Correctly resizes the table so no phantom columns appear - * - * @param parent - * the parent control - * @param buttons - * the buttons - * @param table - * the table - * @param column1 - * the first column - * @param column2 - * the second column - * @param column3 - * the third column - */ - private void configureTableResizing(final Composite parent, final Table table, final TableColumn column1, final TableColumn column2) { - parent.addControlListener(new ControlAdapter() { - public void controlResized(ControlEvent e) { - Rectangle area = parent.getClientArea(); - Point preferredSize = table.computeSize(SWT.DEFAULT, SWT.DEFAULT); - int width = area.width - 2 * table.getBorderWidth(); - if (preferredSize.y > area.height) { - // Subtract the scrollbar width from the total column - // width - // if a vertical scrollbar will be required - Point vBarSize = table.getVerticalBar().getSize(); - width -= vBarSize.x; - } - - Point oldSize = table.getSize(); - if (oldSize.x > width) { - // table is getting smaller so make the columns - // smaller first and then resize the table to - // match the client area width - column1.setWidth(width / 2); - column2.setWidth(width / 2); - table.setSize(width, area.height); - } - else { - // table is getting bigger so make the table - // bigger first and then make the columns wider - // to match the client area width - table.setSize(width, area.height); - column1.setWidth(width / 2); - column2.setWidth(width / 2); - } - } - }); - } - - public void createControl(Composite ancestor) { - Composite parent = new Composite(ancestor, SWT.NONE); - GridLayout layout = new GridLayout(); - layout.numColumns = 2; - parent.setLayout(layout); - - // create checkbox for user to use DTD Template - fUseTemplateButton = new Button(parent, SWT.CHECK); - fUseTemplateButton.setText(DTDUIMessages.NewDTDTemplatesWizardPage_4); - GridData data = new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1); - fUseTemplateButton.setLayoutData(data); - fUseTemplateButton.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - enableTemplates(); - } - }); - - // create composite for Templates table - Composite innerParent = new Composite(parent, SWT.NONE); - GridLayout innerLayout = new GridLayout(); - innerLayout.numColumns = 2; - innerLayout.marginHeight = 0; - innerLayout.marginWidth = 0; - innerParent.setLayout(innerLayout); - GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1); - innerParent.setLayoutData(gd); - - // Create linked text to just to templates preference page - Link link = new Link(innerParent, SWT.NONE); - link.setText(DTDUIMessages.NewDTDTemplatesWizardPage_6); - data = new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1); - link.setLayoutData(data); - link.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - linkClicked(); - } - }); - - // create table that displays templates - Table table = new Table(innerParent, SWT.BORDER | SWT.FULL_SELECTION); - - data = new GridData(GridData.FILL_BOTH); - data.widthHint = convertWidthInCharsToPixels(2); - data.heightHint = convertHeightInCharsToPixels(10); - data.horizontalSpan = 2; - table.setLayoutData(data); - table.setHeaderVisible(true); - table.setLinesVisible(true); - TableLayout tableLayout = new TableLayout(); - table.setLayout(tableLayout); - - TableColumn column1 = new TableColumn(table, SWT.NONE); - column1.setText(DTDUIMessages.NewDTDTemplatesWizardPage_2); - - TableColumn column2 = new TableColumn(table, SWT.NONE); - column2.setText(DTDUIMessages.NewDTDTemplatesWizardPage_3); - - fTableViewer = new TableViewer(table); - fTableViewer.setLabelProvider(new TemplateLabelProvider()); - fTableViewer.setContentProvider(new TemplateContentProvider()); - - fTableViewer.setSorter(new ViewerSorter() { - public int compare(Viewer viewer, Object object1, Object object2) { - if ((object1 instanceof Template) && (object2 instanceof Template)) { - Template left = (Template) object1; - Template right = (Template) object2; - int result = left.getName().compareToIgnoreCase(right.getName()); - if (result != 0) - return result; - return left.getDescription().compareToIgnoreCase(right.getDescription()); - } - return super.compare(viewer, object1, object2); - } - - public boolean isSorterProperty(Object element, String property) { - return true; - } - }); - - fTableViewer.addSelectionChangedListener(new ISelectionChangedListener() { - public void selectionChanged(SelectionChangedEvent e) { - updateViewerInput(); - } - }); - - // create viewer that displays currently selected template's contents - fPatternViewer = doCreateViewer(parent); - - fTemplateStore = DTDUIPlugin.getDefault().getTemplateStore(); - fTableViewer.setInput(fTemplateStore); - - configureTableResizing(innerParent, table, column1, column2); - loadLastSavedPreferences(); - - PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, IHelpContextIds.DTD_NEWWIZARD_TEMPLATE_HELPID); - Dialog.applyDialogFont(parent); - setControl(parent); - } - - /** - * Creates, configures and returns a source viewer to present the template - * pattern on the preference page. Clients may override to provide a - * custom source viewer featuring e.g. syntax coloring. - * - * @param parent - * the parent control - * @return a configured source viewer - */ - private SourceViewer createViewer(Composite parent) { - SourceViewerConfiguration sourceViewerConfiguration = new StructuredTextViewerConfiguration() { - StructuredTextViewerConfiguration baseConfiguration = new StructuredTextViewerConfigurationDTD(); - - public String[] getConfiguredContentTypes(ISourceViewer sourceViewer) { - return baseConfiguration.getConfiguredContentTypes(sourceViewer); - } - - public LineStyleProvider[] getLineStyleProviders(ISourceViewer sourceViewer, String partitionType) { - return baseConfiguration.getLineStyleProviders(sourceViewer, partitionType); - } - }; - SourceViewer viewer = new StructuredTextViewer(parent, null, null, false, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL); - ((StructuredTextViewer) viewer).getTextWidget().setFont(JFaceResources.getFont("org.eclipse.wst.sse.ui.textfont")); //$NON-NLS-1$ - IStructuredModel scratchModel = StructuredModelManager.getModelManager().createUnManagedStructuredModelFor(ContentTypeIdForDTD.ContentTypeID_DTD); - IDocument document = scratchModel.getStructuredDocument(); - viewer.configure(sourceViewerConfiguration); - viewer.setDocument(document); - return viewer; - } - - private SourceViewer doCreateViewer(Composite parent) { - Label label = new Label(parent, SWT.NONE); - label.setText(DTDUIMessages.NewDTDTemplatesWizardPage_5); - GridData data = new GridData(); - data.horizontalSpan = 2; - label.setLayoutData(data); - - SourceViewer viewer = createViewer(parent); - viewer.setEditable(false); - - Control control = viewer.getControl(); - data = new GridData(GridData.FILL_BOTH); - data.horizontalSpan = 2; - data.heightHint = convertHeightInCharsToPixels(5); - control.setLayoutData(data); - - return viewer; - } - - /** - * Enable/disable controls in page based on fUseTemplateButton's current - * state. - */ - void enableTemplates() { - boolean enabled = fUseTemplateButton.getSelection(); - - if (!enabled) { - // save last selected template - Template template = getSelectedTemplate(); - if (template != null) - fLastSelectedTemplateName = template.getName(); - else - fLastSelectedTemplateName = ""; //$NON-NLS-1$ - - fTableViewer.setSelection(null); - } - else { - setSelectedTemplate(fLastSelectedTemplateName); - } - - fTableViewer.getControl().setEnabled(enabled); - fPatternViewer.getControl().setEnabled(enabled); - } - - /** - * Return the template preference page id - * - * @return - */ - private String getPreferencePageId() { - return "org.eclipse.wst.sse.ui.preferences.dtd.templates"; //$NON-NLS-1$ - } - - /** - * Get the currently selected template. - * - * @return - */ - private Template getSelectedTemplate() { - Template template = null; - IStructuredSelection selection = (IStructuredSelection) fTableViewer.getSelection(); - - if (selection.size() == 1) { - template = (Template) selection.getFirstElement(); - } - return template; - } - - /** - * Returns template string to insert. - * - * @return String to insert or null if none is to be inserted - */ - String getTemplateString() { - String templateString = null; - - Template template = getSelectedTemplate(); - if (template != null) { - TemplateContextType contextType = DTDUIPlugin.getDefault().getTemplateContextRegistry().getContextType(TemplateContextTypeIdsDTD.NEW); - IDocument document = new Document(); - TemplateContext context = new DocumentTemplateContext(contextType, document, 0, 0); - try { - TemplateBuffer buffer = context.evaluate(template); - templateString = buffer.getString(); - } - catch (Exception e) { - Logger.log(Logger.WARNING_DEBUG, "Could not create template for new dtd", e); //$NON-NLS-1$ - } - } - - return templateString; - } - - void linkClicked() { - String pageId = getPreferencePageId(); - PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(getShell(), pageId, new String[]{pageId}, null); - dialog.open(); - fTableViewer.refresh(); - } - - /** - * Load the last template name used in New DTD File wizard. - */ - private void loadLastSavedPreferences() { - String templateName = DTDUIPlugin.getDefault().getPreferenceStore().getString(DTDUIPreferenceNames.NEW_FILE_TEMPLATE_NAME); - if (templateName == null || templateName.length() == 0) { - fLastSelectedTemplateName = ""; //$NON-NLS-1$ - fUseTemplateButton.setSelection(false); - } - else { - fLastSelectedTemplateName = templateName; - fUseTemplateButton.setSelection(true); - } - enableTemplates(); - } - - /** - * Save template name used for next call to New DTD File wizard. - */ - void saveLastSavedPreferences() { - String templateName = ""; //$NON-NLS-1$ - - Template template = getSelectedTemplate(); - if (template != null) { - templateName = template.getName(); - } - - DTDUIPlugin.getDefault().getPreferenceStore().setValue(DTDUIPreferenceNames.NEW_FILE_TEMPLATE_NAME, templateName); - DTDUIPlugin.getDefault().savePluginPreferences(); - } - - /** - * Select a template in the table viewer given the template name. If - * template name cannot be found or templateName is null, just select - * first item in table. If no items in table select nothing. - * - * @param templateName - */ - private void setSelectedTemplate(String templateName) { - Object template = null; - - if (templateName != null && templateName.length() > 0) { - // pick the last used template - template = fTemplateStore.findTemplate(templateName, TemplateContextTypeIdsDTD.NEW); - } - - // no record of last used template so just pick first element - if (template == null) { - // just pick first element - template = fTableViewer.getElementAt(0); - } - - if (template != null) { - IStructuredSelection selection = new StructuredSelection(template); - fTableViewer.setSelection(selection, true); - } - } - - /** - * Updates the pattern viewer. - */ - void updateViewerInput() { - Template template = getSelectedTemplate(); - if (template != null) { - fPatternViewer.getDocument().set(template.getPattern()); - } - else { - fPatternViewer.getDocument().set(""); //$NON-NLS-1$ - } - } -} diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/wizard/NewDTDWizard.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/wizard/NewDTDWizard.java deleted file mode 100644 index ad7a35c259..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/wizard/NewDTDWizard.java +++ /dev/null @@ -1,277 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * - *******************************************************************************/ -package org.eclipse.wst.dtd.ui.internal.wizard; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.OutputStreamWriter; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IWorkspace; -import org.eclipse.core.resources.ProjectScope; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.Preferences; -import org.eclipse.core.runtime.content.IContentType; -import org.eclipse.core.runtime.preferences.IScopeContext; -import org.eclipse.core.runtime.preferences.InstanceScope; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.wizard.Wizard; -import org.eclipse.osgi.util.NLS; -import org.eclipse.ui.INewWizard; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.dialogs.WizardNewFileCreationPage; -import org.eclipse.ui.ide.IDE; -import org.eclipse.wst.dtd.core.internal.DTDCorePlugin; -import org.eclipse.wst.dtd.core.internal.preferences.DTDCorePreferenceNames; -import org.eclipse.wst.dtd.core.internal.provisional.contenttype.ContentTypeIdForDTD; -import org.eclipse.wst.dtd.ui.internal.DTDUIMessages; -import org.eclipse.wst.dtd.ui.internal.Logger; -import org.eclipse.wst.dtd.ui.internal.editor.DTDEditorPluginImageHelper; -import org.eclipse.wst.dtd.ui.internal.editor.DTDEditorPluginImages; -import org.eclipse.wst.sse.core.internal.encoding.CommonEncodingPreferenceNames; -import org.eclipse.wst.sse.core.utils.StringUtils; -import org.eclipse.wst.xml.core.internal.XMLCorePlugin; - -public class NewDTDWizard extends Wizard implements INewWizard { - private WizardNewFileCreationPage fNewFilePage; - private NewDTDTemplatesWizardPage fNewFileTemplatesPage; - private IStructuredSelection fSelection; - private IContentType fContentType; - private List fValidExtensions = null; - - /** - * Adds default extension to the filename - * - * @param filename - * @return - */ - String addDefaultExtension(String filename) { - StringBuffer newFileName = new StringBuffer(filename); - - Preferences preference = DTDCorePlugin.getInstance().getPluginPreferences(); - String ext = preference.getString(DTDCorePreferenceNames.DEFAULT_EXTENSION); - - newFileName.append("."); //$NON-NLS-1$ - newFileName.append(ext); - - return newFileName.toString(); - } - - /** - * Get content type associated with this new file wizard - * - * @return IContentType - */ - IContentType getContentType() { - if (fContentType == null) - fContentType = Platform.getContentTypeManager().getContentType(ContentTypeIdForDTD.ContentTypeID_DTD); - return fContentType; - } - - /** - * Get list of valid extensions for DTD Content type - * - * @return - */ - List getValidExtensions() { - if (fValidExtensions == null) { - IContentType type = getContentType(); - fValidExtensions = new ArrayList(Arrays.asList(type.getFileSpecs(IContentType.FILE_EXTENSION_SPEC))); - } - return fValidExtensions; - } - - private String applyLineDelimiter(IFile file, String text) { - String lineDelimiter = Platform.getPreferencesService().getString(Platform.PI_RUNTIME, Platform.PREF_LINE_SEPARATOR, System.getProperty("line.separator"), new IScopeContext[] {new ProjectScope(file.getProject()), new InstanceScope() });//$NON-NLS-1$ - String convertedText = StringUtils.replace(text, "\r\n", "\n"); - convertedText = StringUtils.replace(convertedText, "\r", "\n"); - convertedText = StringUtils.replace(convertedText, "\n", lineDelimiter); - return convertedText; - } - - /** - * Verifies if fileName is valid name for content type. Takes base content - * type into consideration. - * - * @param fileName - * @return true if extension is valid for this content type - */ - boolean extensionValidForContentType(String fileName) { - boolean valid = false; - - IContentType type = getContentType(); - // there is currently an extension - if (fileName.lastIndexOf('.') != -1) { - // check what content types are associated with current extension - IContentType[] types = Platform.getContentTypeManager().findContentTypesFor(fileName); - int i = 0; - while (i < types.length && !valid) { - valid = types[i].isKindOf(type); - ++i; - } - } - else - valid = true; // no extension so valid - return valid; - } - - public void addPages() { - fNewFilePage = new WizardNewFileCreationPage("DTDWizardNewFileCreationPage", new StructuredSelection(IDE.computeSelectedResources(fSelection))) { //$NON-NLS-1$ - protected boolean validatePage() { - String fileName = getFileName(); - IPath fullPath = getContainerFullPath(); - if ((fullPath != null) && (fullPath.isEmpty() == false) && (fileName != null)) { - // check that filename does not contain invalid extension - if (!extensionValidForContentType(fileName)) { - setErrorMessage(NLS.bind(DTDUIMessages._ERROR_FILENAME_MUST_END_DTD, getValidExtensions().toString())); - return false; - } - // no file extension specified so check adding default - // extension doesn't equal a file that already exists - if (fileName.lastIndexOf('.') == -1) { - String newFileName = addDefaultExtension(fileName); - IPath resourcePath = fullPath.append(newFileName); - - IWorkspace workspace = ResourcesPlugin.getWorkspace(); - IStatus result = workspace.validatePath(resourcePath.toString(), IResource.FOLDER); - if (!result.isOK()) { - // path invalid - setErrorMessage(result.getMessage()); - return false; - } - - if ((workspace.getRoot().getFolder(resourcePath).exists() || workspace.getRoot().getFile(resourcePath).exists())) { - setErrorMessage(DTDUIMessages.ResourceGroup_nameExists); - return false; - } - } - } - setErrorMessage(null); - return super.validatePage(); - } - }; - fNewFilePage.setTitle(DTDUIMessages._UI_CREATE_NEW_DTD_FILE); - fNewFilePage.setDescription(DTDUIMessages._UI_WIZARD_NEW_DTD_EXPL); - - addPage(fNewFilePage); - - fNewFileTemplatesPage = new NewDTDTemplatesWizardPage(); - addPage(fNewFileTemplatesPage); - } - - public void init(IWorkbench aWorkbench, IStructuredSelection aSelection) { - fSelection = aSelection; - setWindowTitle(DTDUIMessages._UI_WIZARD_NEW_DTD_TITLE); //$NON-NLS-1$ - - ImageDescriptor descriptor = DTDEditorPluginImageHelper.getInstance().getImageDescriptor(DTDEditorPluginImages.IMG_WIZBAN_NEWDTDFILE); - setDefaultPageImageDescriptor(descriptor); - } - - private void openEditor(final IFile file) { - if (file != null) { - getShell().getDisplay().asyncExec(new Runnable() { - public void run() { - try { - IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); - IDE.openEditor(page, file, true); - } - catch (PartInitException e) { - Logger.log(Logger.WARNING_DEBUG, e.getMessage(), e); - } - } - }); - } - } - - public boolean performFinish() { - boolean performedOK = false; - - // save user options for next use - fNewFileTemplatesPage.saveLastSavedPreferences(); - - // no file extension specified so add default extension - String fileName = fNewFilePage.getFileName(); - if (fileName.lastIndexOf('.') == -1) { - String newFileName = addDefaultExtension(fileName); - fNewFilePage.setFileName(newFileName); - } - - // create a new empty file - IFile file = fNewFilePage.createNewFile(); - - // if there was problem with creating file, it will be null, so make - // sure to check - if (file != null) { - // put template contents into file - String templateString = fNewFileTemplatesPage.getTemplateString(); - if (templateString != null) { - templateString = applyLineDelimiter(file, templateString); - // determine the encoding for the new file - String charSet = getAppropriateCharset(); - - try { - ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); - OutputStreamWriter outputStreamWriter = null; - if (charSet == null || charSet.trim().equals("")) { //$NON-NLS-1$ - // just use default encoding - outputStreamWriter = new OutputStreamWriter(outputStream); - } - else { - outputStreamWriter = new OutputStreamWriter(outputStream, charSet); - } - outputStreamWriter.write(templateString); - outputStreamWriter.flush(); - outputStreamWriter.close(); - ByteArrayInputStream inputStream = new ByteArrayInputStream(outputStream.toByteArray()); - file.setContents(inputStream, true, false, null); - inputStream.close(); - } - catch (Exception e) { - Logger.log(Logger.WARNING_DEBUG, "Could not create contents for new DTD file", e); //$NON-NLS-1$ - } - } - - // open the file in editor - openEditor(file); - - // everything's fine - performedOK = true; - } - return performedOK; - } - - /** - * If the DTD preference identifies a charset, use that. If not, revert to the XML - * charset preference - * - * @return charset based on DTD preferences if defined, if not, from the XML preferences - */ - private String getAppropriateCharset() { - String charset = DTDCorePlugin.getInstance().getPluginPreferences().getString(CommonEncodingPreferenceNames.OUTPUT_CODESET); - if(charset == null || charset.trim().equals("")) - charset = XMLCorePlugin.getDefault().getPluginPreferences().getString(CommonEncodingPreferenceNames.OUTPUT_CODESET); - return charset; - } - -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/DTDContentOutlineConfiguration.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/DTDContentOutlineConfiguration.java deleted file mode 100644 index e42869c7cf..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/DTDContentOutlineConfiguration.java +++ /dev/null @@ -1,282 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ -package org.eclipse.wst.dtd.ui.views.contentoutline; - -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.jface.action.IContributionItem; -import org.eclipse.jface.action.IMenuListener; -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.jface.util.LocalSelectionTransfer; -import org.eclipse.jface.util.SafeRunnable; -import org.eclipse.jface.util.TransferDragSourceListener; -import org.eclipse.jface.util.TransferDropTargetListener; -import org.eclipse.jface.viewers.IContentProvider; -import org.eclipse.jface.viewers.ILabelProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.swt.dnd.DND; -import org.eclipse.swt.dnd.DragSourceEvent; -import org.eclipse.swt.dnd.DropTargetEvent; -import org.eclipse.swt.dnd.Transfer; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.graphics.Rectangle; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.TableItem; -import org.eclipse.swt.widgets.TreeItem; -import org.eclipse.wst.common.ui.internal.dnd.DragAndDropCommand; -import org.eclipse.wst.dtd.core.internal.document.DTDModelImpl; -import org.eclipse.wst.dtd.ui.internal.DTDUIPlugin; -import org.eclipse.wst.dtd.ui.internal.dnd.DTDDragAndDropManager; -import org.eclipse.wst.sse.ui.internal.contentoutline.PropertyChangeUpdateActionContributionItem; -import org.eclipse.wst.sse.ui.internal.util.Assert; -import org.eclipse.wst.sse.ui.views.contentoutline.ContentOutlineConfiguration; - -/** - * Configuration for outline view page which shows DTD content. - * - * @see org.eclipse.wst.sse.ui.views.contentoutline.ContentOutlineConfiguration - * @since 1.0 - */ -public class DTDContentOutlineConfiguration extends ContentOutlineConfiguration { - private IContentProvider fContentProvider = null; - private ILabelProvider fLabelProvider = null; - - private DTDContextMenuHelper fMenuHelper; - private TransferDragSourceListener[] fTransferDragSourceListeners; - private TransferDropTargetListener[] fTransferDropTargetListeners; - private Map fViewerContributions; - private final String OUTLINE_ORDER_PREF = "outline-order"; //$NON-NLS-1$ - private final String OUTLINE_SORT_PREF = "outline-sort"; //$NON-NLS-1$ - - /** - * Default constructor for DTDContentOutlineConfiguration. - */ - public DTDContentOutlineConfiguration() { - // Must have empty constructor to createExecutableExtension - super(); - fViewerContributions = new HashMap(2); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.sse.ui.views.contentoutline.ContentOutlineConfiguration#createToolbarContributions(org.eclipse.jface.viewers.TreeViewer) - */ - public IContributionItem[] createToolbarContributions(TreeViewer viewer) { - Assert.isTrue(getContentProvider(viewer) instanceof DTDTreeContentProvider, "invalid content provider on viewer"); //$NON-NLS-1$ - IContributionItem[] items = super.createToolbarContributions(viewer); - - SortAction sortAction = new SortAction(viewer, DTDUIPlugin.getDefault().getPreferenceStore(), OUTLINE_SORT_PREF); - OrderAction orderAction = new OrderAction(viewer, (DTDTreeContentProvider) getContentProvider(viewer), DTDUIPlugin.getDefault().getPreferenceStore(), OUTLINE_ORDER_PREF); - IContributionItem sortItem = new PropertyChangeUpdateActionContributionItem(sortAction); - IContributionItem orderItem = new PropertyChangeUpdateActionContributionItem(orderAction); - - if (items == null) { - items = new IContributionItem[2]; - items[0] = sortItem; - items[1] = orderItem; - } - else { - IContributionItem[] combinedItems = new IContributionItem[items.length + 2]; - combinedItems[0] = sortItem; - combinedItems[1] = orderItem; - System.arraycopy(items, 0, combinedItems, 2, items.length); - items = combinedItems; - } - return items; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.sse.ui.views.contentoutline.ContentOutlineConfiguration#getContentProvider(org.eclipse.jface.viewers.TreeViewer) - */ - public IContentProvider getContentProvider(TreeViewer viewer) { - if (fContentProvider == null) { - fContentProvider = new DTDTreeContentProvider(); - } - // return super.getContentProvider(viewer); - return fContentProvider; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.sse.ui.views.contentoutline.ContentOutlineConfiguration#getLabelProvider(org.eclipse.jface.viewers.TreeViewer) - */ - public ILabelProvider getLabelProvider(TreeViewer viewer) { - if (fLabelProvider == null) { - fLabelProvider = new DTDLabelProvider(); - } - // return super.getLabelProvider(viewer); - return fLabelProvider; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.sse.ui.views.contentoutline.ContentOutlineConfiguration#getMenuListener(org.eclipse.jface.viewers.TreeViewer) - */ - public IMenuListener getMenuListener(TreeViewer viewer) { - IMenuListener listener = null; - if (fMenuHelper == null && viewer.getInput() instanceof DTDModelImpl) { - fMenuHelper = new DTDContextMenuHelper((DTDModelImpl) viewer.getInput()); - fMenuHelper.createMenuListenersFor(viewer); - } - if (fMenuHelper != null) { - listener = fMenuHelper.getMenuListener(); - } - return listener; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.sse.ui.views.contentoutline.ContentOutlineConfiguration#getPreferenceStore() - */ - protected IPreferenceStore getPreferenceStore() { - return DTDUIPlugin.getDefault().getPreferenceStore(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.sse.ui.views.contentoutline.ContentOutlineConfiguration#getTransferDragSourceListeners(org.eclipse.jface.viewers.TreeViewer) - */ - public TransferDragSourceListener[] getTransferDragSourceListeners(final TreeViewer treeViewer) { - if (fTransferDragSourceListeners == null) { - fTransferDragSourceListeners = new TransferDragSourceListener[]{new TransferDragSourceListener() { - public void dragFinished(DragSourceEvent event) { - LocalSelectionTransfer.getTransfer().setSelection(null); - } - - public void dragSetData(DragSourceEvent event) { - } - - public void dragStart(DragSourceEvent event) { - LocalSelectionTransfer.getTransfer().setSelection(treeViewer.getSelection()); - } - - public Transfer getTransfer() { - return LocalSelectionTransfer.getTransfer(); - } - }}; - } - - return fTransferDragSourceListeners; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.sse.ui.views.contentoutline.ContentOutlineConfiguration#getTransferDropTargetListeners(org.eclipse.jface.viewers.TreeViewer) - */ - public TransferDropTargetListener[] getTransferDropTargetListeners(final TreeViewer treeViewer) { - if (fTransferDropTargetListeners == null) { - fTransferDropTargetListeners = new TransferDropTargetListener[]{new TransferDropTargetListener() { - public void dragEnter(DropTargetEvent event) { - } - - public void dragLeave(DropTargetEvent event) { - } - - public void dragOperationChanged(DropTargetEvent event) { - } - - public void dragOver(DropTargetEvent event) { - event.feedback = DND.FEEDBACK_SELECT; - float feedbackFloat = getHeightInItem(event); - if (feedbackFloat > 0.75) { - event.feedback = DND.FEEDBACK_INSERT_AFTER; - } - else if (feedbackFloat < 0.25) { - event.feedback = DND.FEEDBACK_INSERT_BEFORE; - } - event.feedback |= DND.FEEDBACK_EXPAND | DND.FEEDBACK_SCROLL; - } - - public void drop(DropTargetEvent event) { - if (event.operations != DND.DROP_NONE && LocalSelectionTransfer.getTransfer().getSelection() instanceof IStructuredSelection) { - IStructuredSelection selection = (IStructuredSelection) LocalSelectionTransfer.getTransfer().getSelection(); - if (selection != null && !selection.isEmpty() && event.item != null && event.item.getData() != null) { - /* - * the command uses these numbers instead of the - * feedback constants (even though it converts in - * the other direction as well) - */ - float feedbackFloat = getHeightInItem(event); - - final DragAndDropCommand command = new DTDDragAndDropManager().createCommand(event.item.getData(), feedbackFloat, event.operations, event.detail, selection.toList()); - if (command != null && command.canExecute()) { - SafeRunnable.run(new SafeRunnable() { - public void run() throws Exception { - command.execute(); - } - }); - } - } - } - } - - public void dropAccept(DropTargetEvent event) { - } - - private float getHeightInItem(DropTargetEvent event) { - if(event.item == null) return .5f; - if (event.item instanceof TreeItem) { - TreeItem treeItem = (TreeItem) event.item; - Control control = treeItem.getParent(); - Point point = control.toControl(new Point(event.x, event.y)); - Rectangle bounds = treeItem.getBounds(); - return (float) (point.y - bounds.y) / (float) bounds.height; - } - else if (event.item instanceof TableItem) { - TableItem tableItem = (TableItem) event.item; - Control control = tableItem.getParent(); - Point point = control.toControl(new Point(event.x, event.y)); - Rectangle bounds = tableItem.getBounds(0); - return (float) (point.y - bounds.y) / (float) bounds.height; - } - else { - return 0.0F; - } - } - - public Transfer getTransfer() { - return LocalSelectionTransfer.getTransfer(); - } - - public boolean isEnabled(DropTargetEvent event) { - return getTransfer().isSupportedType(event.currentDataType); - } - }}; - } - return fTransferDropTargetListeners; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.sse.ui.views.contentoutline.ContentOutlineConfiguration#unconfigure(org.eclipse.jface.viewers.TreeViewer) - */ - public void unconfigure(TreeViewer viewer) { - super.unconfigure(viewer); - fViewerContributions.remove(viewer); - if (fMenuHelper != null) { - fMenuHelper.removeMenuListenersFor(viewer); - fMenuHelper = null; - } - } -} diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/DTDContextMenuHelper.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/DTDContextMenuHelper.java deleted file mode 100644 index 272a9a452f..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/DTDContextMenuHelper.java +++ /dev/null @@ -1,284 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 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 - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ - -package org.eclipse.wst.dtd.ui.views.contentoutline; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.jface.action.IMenuListener; -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.action.Separator; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.wst.dtd.core.internal.AttributeList; -import org.eclipse.wst.dtd.core.internal.CMGroupNode; -import org.eclipse.wst.dtd.core.internal.CMNode; -import org.eclipse.wst.dtd.core.internal.DTDFile; -import org.eclipse.wst.dtd.core.internal.DTDNode; -import org.eclipse.wst.dtd.core.internal.Element; -import org.eclipse.wst.dtd.core.internal.NodeList; -import org.eclipse.wst.dtd.core.internal.document.DTDModelImpl; -import org.eclipse.wst.dtd.core.internal.parser.DTDRegionTypes; -import org.eclipse.wst.dtd.core.internal.util.LabelValuePair; -import org.eclipse.wst.dtd.ui.internal.DTDUIMessages; -import org.eclipse.wst.dtd.ui.internal.editor.DTDEditorPluginImageHelper; -import org.eclipse.wst.dtd.ui.internal.editor.DTDEditorPluginImages; -import org.eclipse.wst.dtd.ui.internal.views.contentoutline.actions.AddAttributeAction; -import org.eclipse.wst.dtd.ui.internal.views.contentoutline.actions.AddAttributeListAction; -import org.eclipse.wst.dtd.ui.internal.views.contentoutline.actions.AddCommentAction; -import org.eclipse.wst.dtd.ui.internal.views.contentoutline.actions.AddElementAction; -import org.eclipse.wst.dtd.ui.internal.views.contentoutline.actions.AddElementToContentModelAction; -import org.eclipse.wst.dtd.ui.internal.views.contentoutline.actions.AddEntityAction; -import org.eclipse.wst.dtd.ui.internal.views.contentoutline.actions.AddGroupToContentModelAction; -import org.eclipse.wst.dtd.ui.internal.views.contentoutline.actions.AddNotationAction; -import org.eclipse.wst.dtd.ui.internal.views.contentoutline.actions.AddParameterEntityReferenceAction; -import org.eclipse.wst.dtd.ui.internal.views.contentoutline.actions.DeleteAction; -import org.eclipse.wst.dtd.ui.internal.views.contentoutline.actions.ReplaceEmptyContentModelWithGroupAction; - -/** - * Menu helper for Content Outline page. This should not be used elsewhere. - */ -class DTDContextMenuHelper { - class DTDMenuListener implements IMenuListener { - public void menuAboutToShow(IMenuManager manager) { - // update the action selection now - addNotationAction.selectionChanged(fViewerSelection); - addEntityAction.selectionChanged(fViewerSelection); - addElementAction.selectionChanged(fViewerSelection); - addCommentAction.selectionChanged(fViewerSelection); - addParameterEntityReferenceAction.selectionChanged(fViewerSelection); - deleteAction.selectionChanged(fViewerSelection); - addAttributeAction.selectionChanged(fViewerSelection); - addAttributeListAction.selectionChanged(fViewerSelection); - addGroupToContentModelAction.selectionChanged(fViewerSelection); - addElementToContentModelAction.selectionChanged(fViewerSelection); - replaceEmptyContentModelWithGroupAction.selectionChanged(fViewerSelection); - - - if (!fViewerSelection.isEmpty()) { - addActionItemsForSelection(fViewerSelection.getFirstElement(), manager); - } - } - } - - class ViewerSelectionChangeListener implements ISelectionChangedListener { - public void selectionChanged(SelectionChangedEvent event) { - _selectionChanged(event); - } - } - - AddAttributeAction addAttributeAction; - - AddAttributeListAction addAttributeListAction; - AddCommentAction addCommentAction; - AddElementAction addElementAction; - AddElementToContentModelAction addElementToContentModelAction; - AddEntityAction addEntityAction; - AddGroupToContentModelAction addGroupToContentModelAction; - AddNotationAction addNotationAction; - AddParameterEntityReferenceAction addParameterEntityReferenceAction; - DeleteAction deleteAction; - private ISelectionChangedListener fInternalSelectionChangedListener = new ViewerSelectionChangeListener(); - - private IMenuListener fMenuListener; - private DTDModelImpl fModel; - private List fViewerList; - - IStructuredSelection fViewerSelection = StructuredSelection.EMPTY; - - ReplaceEmptyContentModelWithGroupAction replaceEmptyContentModelWithGroupAction; - - public DTDContextMenuHelper(DTDModelImpl model) { - fModel = model; - fViewerList = new ArrayList(1); - fMenuListener = new DTDMenuListener(); - - addNotationAction = new AddNotationAction(model, DTDUIMessages._UI_ACTION_ADD_DTD_NOTATION); //$NON-NLS-1$ - addEntityAction = new AddEntityAction(model, DTDUIMessages._UI_ACTION_ADD_DTD_ENTITY); //$NON-NLS-1$ - addElementAction = new AddElementAction(model, DTDUIMessages._UI_ACTION_ADD_DTD_ELEMENT); //$NON-NLS-1$ - addCommentAction = new AddCommentAction(model, DTDUIMessages._UI_ACTION_ADD_DTD_COMMENT); //$NON-NLS-1$ - - addParameterEntityReferenceAction = new AddParameterEntityReferenceAction(model, DTDUIMessages._UI_ACTION_ADD_PARAM_ENTITY_REF); //$NON-NLS-1$ - deleteAction = new DeleteAction(DTDUIMessages._UI_ACTION_DTD_DELETE); //$NON-NLS-1$ - addAttributeAction = new AddAttributeAction(model, DTDUIMessages._UI_ACTION_ADD_ATTRIBUTE); //$NON-NLS-1$ - addAttributeListAction = new AddAttributeListAction(model, DTDUIMessages._UI_ACTION_ADD_ATTRIBUTELIST); //$NON-NLS-1$ - - addGroupToContentModelAction = new AddGroupToContentModelAction(model, DTDUIMessages._UI_ACTION_GROUP_ADD_GROUP); //$NON-NLS-1$ - addElementToContentModelAction = new AddElementToContentModelAction(model, DTDUIMessages._UI_ACTION_ADD_ELEMENT); //$NON-NLS-1$ - - replaceEmptyContentModelWithGroupAction = new ReplaceEmptyContentModelWithGroupAction(model, DTDUIMessages._UI_ACTION_GROUP_ADD_GROUP); //$NON-NLS-1$ - - addNotationAction.setImageDescriptor(DTDEditorPluginImageHelper.getInstance().getImageDescriptor(DTDEditorPluginImages.IMG_OBJ_ADD_NOTATION)); - addEntityAction.setImageDescriptor(DTDEditorPluginImageHelper.getInstance().getImageDescriptor(DTDEditorPluginImages.IMG_OBJ_ADD_ENTITY)); - addCommentAction.setImageDescriptor(DTDEditorPluginImageHelper.getInstance().getImageDescriptor(DTDEditorPluginImages.IMG_OBJ_ADD_COMMENT)); - addParameterEntityReferenceAction.setImageDescriptor(DTDEditorPluginImageHelper.getInstance().getImageDescriptor(DTDEditorPluginImages.IMG_OBJ_ADD_ENTITY_REFERENCE)); - - // Tri-state images - addElementAction.setImageDescriptor(DTDEditorPluginImageHelper.getInstance().getImageDescriptor(DTDEditorPluginImages.IMG_ETOOL_ADD_ELEMENT)); - addElementAction.setHoverImageDescriptor(DTDEditorPluginImageHelper.getInstance().getImageDescriptor(DTDEditorPluginImages.IMG_CTOOL_ADD_ELEMENT)); - addElementAction.setDisabledImageDescriptor(DTDEditorPluginImageHelper.getInstance().getImageDescriptor(DTDEditorPluginImages.IMG_DTOOL_ADD_ELEMENT)); - - addAttributeAction.setImageDescriptor(DTDEditorPluginImageHelper.getInstance().getImageDescriptor(DTDEditorPluginImages.IMG_ETOOL_ADD_ATTRIBUTE)); - addAttributeAction.setHoverImageDescriptor(DTDEditorPluginImageHelper.getInstance().getImageDescriptor(DTDEditorPluginImages.IMG_CTOOL_ADD_ATTRIBUTE)); - addAttributeAction.setDisabledImageDescriptor(DTDEditorPluginImageHelper.getInstance().getImageDescriptor(DTDEditorPluginImages.IMG_DTOOL_ADD_ATTRIBUTE)); - - addAttributeListAction.setImageDescriptor(DTDEditorPluginImageHelper.getInstance().getImageDescriptor(DTDEditorPluginImages.IMG_ETOOL_ADD_ATTRIBUTE)); - addAttributeListAction.setHoverImageDescriptor(DTDEditorPluginImageHelper.getInstance().getImageDescriptor(DTDEditorPluginImages.IMG_CTOOL_ADD_ATTRIBUTE)); - addAttributeListAction.setDisabledImageDescriptor(DTDEditorPluginImageHelper.getInstance().getImageDescriptor(DTDEditorPluginImages.IMG_DTOOL_ADD_ATTRIBUTE)); - - addGroupToContentModelAction.setImageDescriptor(DTDEditorPluginImageHelper.getInstance().getImageDescriptor(DTDEditorPluginImages.IMG_ETOOL_ADD_GROUPTOCONMODEL)); - addGroupToContentModelAction.setHoverImageDescriptor(DTDEditorPluginImageHelper.getInstance().getImageDescriptor(DTDEditorPluginImages.IMG_CTOOL_ADD_GROUPTOCONMODEL)); - addGroupToContentModelAction.setDisabledImageDescriptor(DTDEditorPluginImageHelper.getInstance().getImageDescriptor(DTDEditorPluginImages.IMG_DTOOL_ADD_GROUPTOCONMODEL)); - - addElementToContentModelAction.setImageDescriptor(DTDEditorPluginImageHelper.getInstance().getImageDescriptor(DTDEditorPluginImages.IMG_ETOOL_ADD_ELEMENTTOCONMODEL)); - addElementToContentModelAction.setHoverImageDescriptor(DTDEditorPluginImageHelper.getInstance().getImageDescriptor(DTDEditorPluginImages.IMG_CTOOL_ADD_ELEMENTTOCONMODEL)); - addElementToContentModelAction.setDisabledImageDescriptor(DTDEditorPluginImageHelper.getInstance().getImageDescriptor(DTDEditorPluginImages.IMG_DTOOL_ADD_ELEMENTTOCONMODEL)); - - // use the same images as addGroupToContentModelAction - replaceEmptyContentModelWithGroupAction.setImageDescriptor(DTDEditorPluginImageHelper.getInstance().getImageDescriptor(DTDEditorPluginImages.IMG_ETOOL_ADD_GROUPTOCONMODEL)); - replaceEmptyContentModelWithGroupAction.setHoverImageDescriptor(DTDEditorPluginImageHelper.getInstance().getImageDescriptor(DTDEditorPluginImages.IMG_CTOOL_ADD_GROUPTOCONMODEL)); - replaceEmptyContentModelWithGroupAction.setDisabledImageDescriptor(DTDEditorPluginImageHelper.getInstance().getImageDescriptor(DTDEditorPluginImages.IMG_DTOOL_ADD_GROUPTOCONMODEL)); - } - - void _selectionChanged(SelectionChangedEvent event) { - /* - * Save the selection so we only notify the actions when the menu is - * shown - */ - ISelection selection = event.getSelection(); - if (selection instanceof IStructuredSelection) { - fViewerSelection = (IStructuredSelection) selection; - } - else { - fViewerSelection = StructuredSelection.EMPTY; - } - } - - void addActionItemsForSelection(Object selectedObject, IMenuManager menu) { - if (selectedObject instanceof NodeList) { - // add appropriate menu to logical view - NodeList folder = (NodeList) selectedObject; - if (folder.getListType().equals(DTDRegionTypes.NOTATION_TAG)) { - menu.add(addNotationAction); - } - else if (folder.getListType().equals(DTDRegionTypes.ENTITY_TAG)) { - menu.add(addEntityAction); - } - else if (folder.getListType().equals(DTDRegionTypes.ELEMENT_TAG)) { - LabelValuePair[] availableEntities = fModel.createParmEntityContentItems(null); - addParameterEntityReferenceAction.setEnabled(availableEntities.length > 0); - - menu.add(addElementAction); - menu.add(addParameterEntityReferenceAction); - } - else if (folder.getListType().equals(DTDRegionTypes.ATTLIST_TAG)) { - menu.add(addAttributeAction); - } - } - if (selectedObject instanceof DTDFile || selectedObject == null) { - LabelValuePair[] availableEntities = fModel.createParmEntityContentItems(null); - addParameterEntityReferenceAction.setEnabled(availableEntities.length > 0); - - menu.add(addElementAction); - menu.add(addEntityAction); - menu.add(addNotationAction); - menu.add(addParameterEntityReferenceAction); - menu.add(addCommentAction); - menu.add(addAttributeListAction); - menu.add(new Separator()); - } - - if (selectedObject instanceof Element) { - Element dtdElement = (Element) selectedObject; - - CMNode contentModel = dtdElement.getContentModel(); - if (contentModel == null) { - menu.add(addGroupToContentModelAction); - menu.add(addElementToContentModelAction); - } - else if (contentModel != null && CMNode.EMPTY.equals(contentModel.getType())) { - menu.add(replaceEmptyContentModelWithGroupAction); - } - // if (!(((Element)selectedObject).getContentModel() instanceof - // CMGroupNode)) - // { - // menu.add(addGroupToContentModelAction); - // } - // addAttributeAction.setElement(selectedObject); - menu.add(addAttributeAction); - } - else if (selectedObject instanceof CMGroupNode) { - // addElementToContentModelAction.setElement(selectedObject); - // addGroupToContentModelAction.setElement(selectedObject); - menu.add(addElementToContentModelAction); - menu.add(addGroupToContentModelAction); - } - else if (selectedObject instanceof AttributeList) { - menu.add(addAttributeAction); - } - - menu.add(new Separator()); - addEditActions(menu); - menu.add(new Separator()); - - if (selectedObject instanceof DTDNode && !(selectedObject instanceof CMNode && ((CMNode) selectedObject).isRootElementContent())) { - menu.add(deleteAction); - deleteAction.setEnabled(true); - // if (selectedObject instanceof DTDElementContent) - // { - // DTDElementContent content = (DTDElementContent) selectedObject; - // if (content.getElement() != null && (content instanceof - // DTDPCDataContent || content instanceof DTDEmptyContent)) - // { - // deleteAction.setEnabled(false); - // } // end of if () - // } // end of if () - } - } - - void addEditActions(IMenuManager menu) { - // menu.add(undoAction); - // menu.add(redoAction); - // menu.add(new Separator()); - // menu.add(cutAction); - // menu.add(copyAction); - // menu.add(pasteAction); - } - - public void createMenuListenersFor(Viewer viewer) { - viewer.addSelectionChangedListener(fInternalSelectionChangedListener); - ISelection selection = viewer.getSelection(); - if (selection instanceof IStructuredSelection) { - fViewerSelection = (IStructuredSelection) selection; - } - else { - fViewerSelection = StructuredSelection.EMPTY; - } - - fViewerList.add(viewer); - } - - public IMenuListener getMenuListener() { - return fMenuListener; - } - - public void removeMenuListenersFor(Viewer viewer) { - viewer.removeSelectionChangedListener(fInternalSelectionChangedListener); - fViewerList.remove(viewer); - } -} diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/DTDLabelProvider.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/DTDLabelProvider.java deleted file mode 100644 index 6c7fb1f3ef..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/DTDLabelProvider.java +++ /dev/null @@ -1,94 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 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 - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ -package org.eclipse.wst.dtd.ui.views.contentoutline; - -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.swt.graphics.Image; -import org.eclipse.wst.dtd.core.internal.DTDFile; -import org.eclipse.wst.dtd.core.internal.DTDNode; -import org.eclipse.wst.dtd.core.internal.NodeList; - -class DTDLabelProvider extends LabelProvider { - - public DTDLabelProvider() { - super(); - } - - /** - * Returns the image for the label of the given element. - * - * @param element - * the element for which to provide the label image - * @return the image used to label the element, or <code>null</code> if - * these is no image for the given object - */ - public Image getImage(Object element) { - Image image = null; - if (element instanceof DTDNode) { - image = ((DTDNode) element).getImage(); - } - else if (element instanceof NodeList) { - image = ((NodeList) element).getImage(); - } - else if (element instanceof DTDFile) { - image = ((DTDFile) element).getImage(); - } - else { - image = super.getImage(element); - } - return image; - } - - /** - * Returns the text for the label of the given element. - * - * @param element - * the element for which to provide the label text - * @return the text string used to label the element, or <code>null</code> - * if these is no text label for the given object - */ - public String getText(Object element) { - if (element instanceof DTDNode) { - String name = ((DTDNode) element).getName(); - - // strip leading whitespace (useful for multi-line comments) - int firstSignificantCharacter = 0; - int lastVisibleCharacter = name.length() - 1; - for (firstSignificantCharacter = 0; firstSignificantCharacter < name.length(); firstSignificantCharacter++) { - if (!Character.isWhitespace(name.charAt(firstSignificantCharacter))) - break; - } - // keep only the first line of text in a multi-line name - if (firstSignificantCharacter < lastVisibleCharacter) { - for (lastVisibleCharacter = firstSignificantCharacter + 1; lastVisibleCharacter < name.length(); lastVisibleCharacter++) { - char character = name.charAt(lastVisibleCharacter); - if (character == '\r' || character == '\n') - break; - } - } - if (firstSignificantCharacter > 0 && firstSignificantCharacter < name.length() - 1) { - name = name.substring(firstSignificantCharacter, lastVisibleCharacter); - } - - return name; - } - else if (element instanceof NodeList) { - // return ((NodeList) element).getListType(); - return ((NodeList) element).getName(); - } - else if (element instanceof DTDFile) { - return ((DTDFile) element).getName(); - } - return super.getText(element); - } -} diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/DTDTreeContentProvider.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/DTDTreeContentProvider.java deleted file mode 100644 index f3bf54fd2f..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/DTDTreeContentProvider.java +++ /dev/null @@ -1,349 +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 - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ -package org.eclipse.wst.dtd.ui.views.contentoutline; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.jface.viewers.AbstractTreeViewer; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.ITreeContentProvider; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.StructuredViewer; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.wst.dtd.core.internal.Attribute; -import org.eclipse.wst.dtd.core.internal.AttributeList; -import org.eclipse.wst.dtd.core.internal.Comment; -import org.eclipse.wst.dtd.core.internal.DTDFile; -import org.eclipse.wst.dtd.core.internal.DTDNode; -import org.eclipse.wst.dtd.core.internal.Element; -import org.eclipse.wst.dtd.core.internal.Entity; -import org.eclipse.wst.dtd.core.internal.NodeList; -import org.eclipse.wst.dtd.core.internal.Notation; -import org.eclipse.wst.dtd.core.internal.ParameterEntityReference; -import org.eclipse.wst.dtd.core.internal.document.DTDModelImpl; -import org.eclipse.wst.dtd.core.internal.event.IDTDFileListener; -import org.eclipse.wst.dtd.core.internal.event.NodesEvent; - -class DTDTreeContentProvider implements ITreeContentProvider, IDTDFileListener { - - private Object fInputObject; - protected Viewer fViewer; - - // A cached set of IndexedNodeLists, required for getParent to return the - // correct instances mapping to TreeItems - protected Object[] logicalNodeLists = null; - - private boolean showLogicalOrder = false; - - public DTDTreeContentProvider() { - super(); - } - - public void dispose() { - fViewer = null; - } - - private void expandToNode(DTDNode node) { - DTDFile dtdFile = node.getDTDFile(); - // first expand the root - AbstractTreeViewer viewer = (AbstractTreeViewer) fViewer; - viewer.expandToLevel(dtdFile, 1); - NodeList listToExpand = null; - if (node instanceof Element || node instanceof ParameterEntityReference) { - listToExpand = dtdFile.getElementsAndParameterEntityReferences(); - } - else if (node instanceof Notation) { - listToExpand = dtdFile.getNotations(); - } - else if (node instanceof Entity) { - listToExpand = dtdFile.getEntities(); - } - else if (node instanceof Comment) { - listToExpand = dtdFile.getComments(); - } - if (listToExpand != null) { - viewer.expandToLevel(listToExpand, 1); - } - viewer.expandToLevel(node, 0); - } - - public Object[] getChildren(Object parentElement) { - // return the lists of nodes when in logical order mode, all the Nodes - // otherwise - if (parentElement instanceof DTDFile) { - if (isShowLogicalOrder()) { - // return the visible node lists - if (logicalNodeLists == null) { - Iterator nodeLists = ((DTDFile) parentElement).getNodeLists().iterator(); - List visibleLists = new ArrayList(7); - while (nodeLists.hasNext()) { - NodeList list = (NodeList) nodeLists.next(); - if (isVisibleNodeList(list)) { - visibleLists.add(list); - } - } - logicalNodeLists = visibleLists.toArray(); - } - return logicalNodeLists; - } - else { - // return the visible nodes - List allNodes = ((DTDFile) parentElement).getNodes(); - List visibleNodes = new ArrayList(allNodes.size()); - for (int i = 0; i < allNodes.size(); i++) { - Object o = allNodes.get(i); - if (isVisibleNode(o)) { - visibleNodes.add(o); - } - } - return visibleNodes.toArray(); - } - } - else if (parentElement instanceof NodeList) { - return ((NodeList) parentElement).getNodes().toArray(); - } - else if (parentElement instanceof Element) { - // always group the attributes directly under the element - Object[] children = ((DTDNode) parentElement).getChildren(); - List attributes = ((Element) parentElement).getElementAttributes(); - Object[] logicalChildren = new Object[children.length + attributes.size()]; - int index = 0; - for (index = 0; index < children.length; index++) { - logicalChildren[index] = children[index]; - } - for (Iterator iter = attributes.iterator(); iter.hasNext();) { - logicalChildren[index++] = iter.next(); - } - return logicalChildren; - } - else if (parentElement instanceof DTDNode) { - return ((DTDNode) parentElement).getChildren(); - } - return Collections.EMPTY_LIST.toArray(); - } - - public Object[] getElements(java.lang.Object inputElement) { - Object[] elements = null; - // Always show the DTDFile "node" - if (inputElement instanceof DTDModelImpl) { - elements = new Object[]{((DTDModelImpl) inputElement).getDTDFile()}; - } - if (elements == null) { - elements = new Object[0]; - } - return elements; - } - - public Object getParent(Object element) { - Object parent = null; - if (element instanceof DTDNode) { - DTDNode node = (DTDNode) element; - if (element instanceof Attribute) { - // then we must say that the element with the same name - // as our attribute's parent attributelist is our parent - parent = node.getParentNode(); - if (parent != null && parent instanceof AttributeList) { - return getParent(parent); - } - } - if (element instanceof AttributeList) { - // then we must say that the element with the same name - // as our attributelist is our parent - String attListName = ((AttributeList) element).getName(); - Iterator iter = node.getDTDFile().getElementsAndParameterEntityReferences().getNodes().iterator(); - while (iter.hasNext() && parent == null) { - DTDNode currentNode = (DTDNode) iter.next(); - if (currentNode instanceof Element && currentNode.getName().equals(attListName)) { - parent = currentNode; - } - } - } - - if (parent == null) { - parent = ((DTDNode) element).getParentNode(); - } - - // if showing in the logical order, return the IndexedNodeList - // acting as the parent in the tree - if (parent == null) { - if (isShowLogicalOrder()) { - Object[] indexedNodeLists = getChildren(((DTDModelImpl) fInputObject).getDTDFile()); - for (int i = 0; i < indexedNodeLists.length && parent == null; i++) { - if (indexedNodeLists[i] instanceof NodeList) { - if (((NodeList) indexedNodeLists[i]).getNodes().contains(element)) - parent = indexedNodeLists[i]; - } - } - } - else { - parent = ((DTDModelImpl) fInputObject).getDTDFile(); - } - } - } - else if (element instanceof NodeList && fInputObject instanceof DTDModelImpl) { - parent = ((DTDModelImpl) fInputObject).getDTDFile(); - } - return parent; - } - - public boolean hasChildren(Object element) { - Object[] children = getChildren(element); - return children.length > 0; - } - - public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { - fViewer = viewer; - - if (fInputObject instanceof DTDModelImpl) { - ((DTDModelImpl) fInputObject).getDTDFile().removeDTDFileListener(this); - } - fInputObject = newInput; - if (fInputObject instanceof DTDModelImpl) { - ((DTDModelImpl) fInputObject).getDTDFile().addDTDFileListener(this); - } - } - - /** - * Get the value of showLogicalOrder. - * - * @return value of showLogicalOrder. - */ - public boolean isShowLogicalOrder() { - return showLogicalOrder; - } - - private boolean isVisibleNode(Object o) { - if (o instanceof AttributeList) { - return false; - } - return true; - } - - private boolean isVisibleNodeList(NodeList nodeList) { - /* - * All NodesLists should be visible because you can momentarily have - * an ATTLIST (for example) without a corresponding ELEMENT - * declaration - */ - return true;// !nodeList.getListType().equals(DTDRegionTypes.ATTLIST_TAG); - } - - public void nodeChanged(DTDNode node) { - if (fViewer instanceof StructuredViewer) { - // System.out.println("node changed notified"); - // System.out.println("selection before = " + - // ((StructuredViewer)view).getSelection()); - if (node instanceof AttributeList && isShowLogicalOrder()) { - // in this case, we are showing attributes under the element. - // refresh the element object instead - Iterator iter = node.getDTDFile().getNodes().iterator(); - while (iter.hasNext()) { - DTDNode currentNode = (DTDNode) iter.next(); - if (currentNode.getName().equals(node.getName()) && currentNode instanceof Element) { - ((StructuredViewer) fViewer).refresh(currentNode); - } - } // end of while () - } - else { - // do standard stuff - ((StructuredViewer) fViewer).refresh(node); - } - // System.out.println("selection after = " + - // ((StructuredViewer)view).getSelection()); - } - } - - public void nodesAdded(NodesEvent event) { - if (fViewer instanceof AbstractTreeViewer) { - StructuredViewer viewer = (StructuredViewer) fViewer; - ISelection selection = viewer.getSelection(); - - Object firstObj = (!selection.isEmpty() && selection instanceof IStructuredSelection) ? ((IStructuredSelection) selection).getFirstElement() : null; - DTDNode oldSelectedNode = null; - if (firstObj instanceof DTDNode) { - oldSelectedNode = (DTDNode) firstObj; - } - - AbstractTreeViewer abstractTreeViewer = (AbstractTreeViewer) fViewer; - for (Iterator it = event.getNodes().iterator(); it.hasNext();) { - Object node = it.next(); - Object parent = getParent(node); - // Bug 111100 - If it is a top level node (ie. parent is a - // DTDFile), - // insert the node directly to improve performance - if (parent instanceof DTDFile) { - Object[] objs = getChildren(parent); - for (int i = 0; i < objs.length; i++) { - if (objs[i] == node) { - abstractTreeViewer.insert(parent, node, i); - break; - } - } - } - // If the parent node is not a DTDFile, just refresh the - // parent for now - else if (parent != null) { - abstractTreeViewer.refresh(parent); - } - // You should never reach this block, if you do, just refresh - // the whole tree - else { - abstractTreeViewer.refresh(); - } - } - - Iterator iter = event.getNodes().iterator(); - List newSelection = new ArrayList(); - while (iter.hasNext()) { - DTDNode node = (DTDNode) iter.next(); - if (oldSelectedNode == null || node.getStructuredDTDDocumentRegion() != oldSelectedNode.getStructuredDTDDocumentRegion() || node.getStartOffset() != oldSelectedNode.getStartOffset() || node.getEndOffset() != oldSelectedNode.getEndOffset()) { - // add to selection - newSelection.add(node); - expandToNode(node); - } - } - if (newSelection.size() > 0) { - viewer.setSelection(new StructuredSelection(newSelection)); - } - - } - } - - public void nodesRemoved(NodesEvent event) { - if (fViewer instanceof AbstractTreeViewer) { - AbstractTreeViewer abstractTreeViewer = (AbstractTreeViewer) fViewer; - for (Iterator iter = event.getNodes().iterator(); iter.hasNext();) { - abstractTreeViewer.remove(iter.next()); - } - } - - } - - /** - * Set the value of showLogicalOrder. - * - * @param value - * Value to assign to showLogicalOrder. - */ - public void setShowLogicalOrder(boolean value) { - this.showLogicalOrder = value; - if (!value) { - // if not using logical order, lose the cached lists - logicalNodeLists = null; - } - } -} diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/OrderAction.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/OrderAction.java deleted file mode 100644 index 227bc77269..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/OrderAction.java +++ /dev/null @@ -1,57 +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 - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ -/* - * Created on Jan 22, 2004 - * - * To change the template for this generated file go to - * Window - Preferences - Java - Code Generation - Code and Comments - */ -package org.eclipse.wst.dtd.ui.views.contentoutline; - -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.wst.dtd.ui.internal.DTDUIMessages; -import org.eclipse.wst.dtd.ui.internal.editor.DTDEditorPluginImageHelper; -import org.eclipse.wst.dtd.ui.internal.editor.DTDEditorPluginImages; -import org.eclipse.wst.sse.ui.internal.contentoutline.PropertyChangeUpdateAction; - -class OrderAction extends PropertyChangeUpdateAction { - private DTDTreeContentProvider contentProvider; - private TreeViewer treeViewer; - - public OrderAction(TreeViewer viewer, DTDTreeContentProvider provider, IPreferenceStore store, String preferenceKey) { - super(DTDUIMessages._UI_BUTTON_GROUP_ITEMS_LOGICALLY, store, preferenceKey, false); //$NON-NLS-1$ - setImageDescriptor(DTDEditorPluginImageHelper.getInstance().getImageDescriptor(DTDEditorPluginImages.IMG_OBJ_ORGANIZE_DTD_LOGICALLY)); - treeViewer = viewer; - contentProvider = provider; - setToolTipText(getText()); - contentProvider.setShowLogicalOrder(isChecked()); - } - - public void update() { - super.update(); - treeViewer.getControl().setRedraw(false); - setChecked(getPreferenceStore().getBoolean(getPreferenceKey())); - Object[] expandedElements = treeViewer.getExpandedElements(); - ISelection selection = treeViewer.getSelection(); - contentProvider.setShowLogicalOrder(isChecked()); - - // treeViewer.setInput(treeViewer.getInput()); - treeViewer.refresh(treeViewer.getInput()); - - treeViewer.setExpandedElements(expandedElements); - treeViewer.getControl().setRedraw(true); - treeViewer.setSelection(selection); - } -} diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/SortAction.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/SortAction.java deleted file mode 100644 index 482a1f629c..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/SortAction.java +++ /dev/null @@ -1,55 +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 - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ -package org.eclipse.wst.dtd.ui.views.contentoutline; - -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.jface.viewers.ViewerComparator; -import org.eclipse.wst.dtd.ui.internal.DTDUIMessages; -import org.eclipse.wst.dtd.ui.internal.editor.DTDEditorPluginImageHelper; -import org.eclipse.wst.dtd.ui.internal.editor.DTDEditorPluginImages; -import org.eclipse.wst.sse.ui.internal.contentoutline.PropertyChangeUpdateAction; - -class SortAction extends PropertyChangeUpdateAction { - private TreeViewer treeViewer; - - public SortAction(TreeViewer viewer, IPreferenceStore store, String preferenceKey) { - super(DTDUIMessages._UI_BUTTON_SORT_ITEMS, store, preferenceKey, false); //$NON-NLS-1$ - setImageDescriptor(DTDEditorPluginImageHelper.getInstance().getImageDescriptor(DTDEditorPluginImages.IMG_OBJ_SORT)); - setToolTipText(getText()); - treeViewer = viewer; - if (isChecked()) { - treeViewer.setComparator(new ViewerComparator()); - } - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.texteditor.IUpdate#update() - */ - public void update() { - super.update(); - treeViewer.getControl().setRedraw(false); - Object[] expandedElements = treeViewer.getExpandedElements(); - if (isChecked()) { - treeViewer.setComparator(new ViewerComparator()); - } - else { - treeViewer.setComparator(null); - } - treeViewer.setInput(treeViewer.getInput()); - treeViewer.setExpandedElements(expandedElements); - treeViewer.getControl().setRedraw(true); - } -} diff --git a/bundles/org.eclipse.wst.dtd.ui/templates/dtddefault-templates.properties b/bundles/org.eclipse.wst.dtd.ui/templates/dtddefault-templates.properties deleted file mode 100644 index 89682b9d95..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/templates/dtddefault-templates.properties +++ /dev/null @@ -1,13 +0,0 @@ -############################################################################### -# Copyright (c) 2007 STAR Standards for Technology in Automotive Retail -# 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: -# David Carver, STAR - initial API and implementation, bug 162321 -# -############################################################################### -Templates.xmldeclaration.name=xml declaration -Templates.xmldeclaration.desc=xml declaration diff --git a/bundles/org.eclipse.wst.dtd.ui/templates/dtddefault-templates.xml b/bundles/org.eclipse.wst.dtd.ui/templates/dtddefault-templates.xml deleted file mode 100644 index b2c642283c..0000000000 --- a/bundles/org.eclipse.wst.dtd.ui/templates/dtddefault-templates.xml +++ /dev/null @@ -1,16 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- -/******************************************************************************* - * Copyright (c) 2007 Standards for Technology in Automotive Retail 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: - * David Carver - STAR - initial contribution, bug 162321 - *******************************************************************************/ - --> -<templates> - <template name="%Templates.xmldeclaration.name" description="%Templates.xmldeclaration.desc" id="org.eclipse.wst.dtd.ui.internal.templates.xmldeclaration" context="dtd_new" enabled="true"><?xml version="1.0" encoding="${encoding}"?></template> -</templates> |