diff options
Diffstat (limited to 'plugins/org.eclipse.wst.common.frameworks.ui')
77 files changed, 0 insertions, 8939 deletions
diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/.classpath b/plugins/org.eclipse.wst.common.frameworks.ui/.classpath deleted file mode 100644 index 014fb18f6..000000000 --- a/plugins/org.eclipse.wst.common.frameworks.ui/.classpath +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry kind="src" path="wtp_ui/"/> - <classpathentry kind="src" path="property_files"/> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> - <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> - <classpathentry kind="output" path="bin"/> -</classpath> diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/.cvsignore b/plugins/org.eclipse.wst.common.frameworks.ui/.cvsignore deleted file mode 100644 index 65cee0b83..000000000 --- a/plugins/org.eclipse.wst.common.frameworks.ui/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -bin -temp.folder -build.xml -wtp_ui.jar -@dot -src.zip diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/.project b/plugins/org.eclipse.wst.common.frameworks.ui/.project deleted file mode 100644 index 47885fd4e..000000000 --- a/plugins/org.eclipse.wst.common.frameworks.ui/.project +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>org.eclipse.wst.common.frameworks.ui</name> - <comment></comment> - <projects> - </projects> - <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.jdt.core.javanature</nature> - <nature>org.eclipse.pde.PluginNature</nature> - </natures> -</projectDescription> diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.wst.common.frameworks.ui/META-INF/MANIFEST.MF deleted file mode 100644 index f921c1482..000000000 --- a/plugins/org.eclipse.wst.common.frameworks.ui/META-INF/MANIFEST.MF +++ /dev/null @@ -1,21 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: WTP UI Plug-in -Bundle-Vendor: %providerName -Bundle-SymbolicName: org.eclipse.wst.common.frameworks.ui; singleton:=true -Bundle-Version: 1.0.100.qualifier -Bundle-Activator: org.eclipse.wst.common.frameworks.internal.ui.WTPUIPlugin -Bundle-Localization: plugin -Export-Package: org.eclipse.wst.common.frameworks.internal.datamodel.ui;x-internal:=true, - org.eclipse.wst.common.frameworks.internal.dialog.ui;x-internal:=true, - org.eclipse.wst.common.frameworks.internal.eclipse.ui;x-internal:=true, - org.eclipse.wst.common.frameworks.internal.operation.extensionui;x-internal:=true, - org.eclipse.wst.common.frameworks.internal.ui;x-internal:=true -Require-Bundle: org.eclipse.ui.ide, - org.eclipse.core.resources, - org.eclipse.ui, - org.eclipse.wst.common.frameworks;visibility:=reexport, - org.eclipse.core.runtime, - org.eclipse.jem.util, - org.eclipse.wst.common.environment -Eclipse-AutoStart: true diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/about.html b/plugins/org.eclipse.wst.common.frameworks.ui/about.html deleted file mode 100644 index 6f6b96c4c..000000000 --- a/plugins/org.eclipse.wst.common.frameworks.ui/about.html +++ /dev/null @@ -1,22 +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"> -<h2>About This Content</h2> - -<p>February 24, 2005</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/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</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.</p> - -</body> -</html>
\ No newline at end of file diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/build.properties b/plugins/org.eclipse.wst.common.frameworks.ui/build.properties deleted file mode 100644 index feb73fb87..000000000 --- a/plugins/org.eclipse.wst.common.frameworks.ui/build.properties +++ /dev/null @@ -1,20 +0,0 @@ -############################################################################### -# Copyright (c) 2003, 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 -############################################################################### -output.. = bin/ -bin.includes = plugin.xml,\ - .,\ - META-INF/,\ - plugin.properties,\ - about.html -source.. = wtp_ui/,\ - property_files/ -src.includes = schema/,\ - plugin.properties diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/plugin.properties b/plugins/org.eclipse.wst.common.frameworks.ui/plugin.properties deleted file mode 100644 index 9f8022015..000000000 --- a/plugins/org.eclipse.wst.common.frameworks.ui/plugin.properties +++ /dev/null @@ -1,18 +0,0 @@ -############################################################################### -# Copyright (c) 2003, 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 -############################################################################### -Cut=Cut -FLEXIBLE_PROJECT_PREFERENCE=J2EE Project Modules -providerName=Eclipse.org -WTP_UI_Action=WTP UI Action -Extended_Viewers=Extended Viewers -Extendable_Wizard=Extendable Wizard -Extendable_Wizard_Page=Extendable Wizard Page -DataModelWizard=DataModelWizard diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/plugin.xml b/plugins/org.eclipse.wst.common.frameworks.ui/plugin.xml deleted file mode 100644 index e98a3bc9a..000000000 --- a/plugins/org.eclipse.wst.common.frameworks.ui/plugin.xml +++ /dev/null @@ -1,53 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<?eclipse version="3.0"?> -<plugin> - - <extension-point id="wtpuiAction" name="%WTP_UI_Action" schema="schema/wtpuiAction.exsd"/> - <extension-point id="extendedViewer" name="%Extended_Viewers" schema="schema/extendedViewer.exsd"/> - <extension-point id="extendableWizard" name="%Extendable_Wizard" schema="schema/extendableWizard.exsd"/> - <extension-point id="wizardPageGroup" name="%Extendable_Wizard_Page" schema="schema/extendableWizardPage.exsd"/> - <extension-point id="DataModelWizardExtension" name="%DataModelWizard" schema="schema/DataModelWizardExtension.exsd"/> - - <extension - id="UITester" - point="org.eclipse.jem.util.uiTester"> - <uiTester - className="org.eclipse.wst.common.frameworks.internal.ui.UITesterImpl"> - </uiTester> - </extension> - <extension - id="context.Sensitive.Class.saveHandler" - name="Save Handler - Headless Context Class" - point="org.eclipse.jem.util.uiContextSensitiveClass"> - <uiContextSensitiveClass - key="saveHandler" - context="UI" - className="org.eclipse.wst.common.frameworks.internal.ui.SaveHandlerUI"> - </uiContextSensitiveClass> - </extension> - <extension - id="org.eclipse.wst.common.frameworks.internal.ui.EnablementDetermination" - name="UI Enablement Determination" - point="org.eclipse.jem.util.uiContextSensitiveClass"> - <uiContextSensitiveClass - key="org.eclipse.wst.common.frameworks.internal.EnablementDetermination" - context="UI" - className="org.eclipse.wst.common.frameworks.internal.ui.UIEnablementManager"> - </uiContextSensitiveClass> - </extension> - <extension - point="org.eclipse.wst.common.frameworks.WTPActivityBridgeHelper"> - <WTPActivityBridgeHelper - class="org.eclipse.wst.common.frameworks.internal.ui.WTPActivityBridgeHelperImpl"> - </WTPActivityBridgeHelper> - </extension> - <!-- - <extension - point="org.eclipse.wst.common.frameworks.internals.OperationExtension"> - <operationExtension - postOperationClass="org.eclipse.wst.common.frameworks.internal.operation.extension.ui.PostPasteActionOperation" - id="org.eclipse.wst.common.frameworks.internal.operation.extension.ui.PasteActionOperation"/> - </extension> - --> - -</plugin> diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/prepareforpii.xml b/plugins/org.eclipse.wst.common.frameworks.ui/prepareforpii.xml deleted file mode 100644 index d2dca48db..000000000 --- a/plugins/org.eclipse.wst.common.frameworks.ui/prepareforpii.xml +++ /dev/null @@ -1,38 +0,0 @@ -<project name="PrepareForPII" default="main" basedir="."> - - <!-- Setup temp variables --> - <target name="init"> - <property name="nlsDir" value="d:/NLS/Corona/0526"/> - <property name="plugin" value="com.ibm.wtp.common.ui"/> - <property name="plugindir" value="d:/workspaceCorona/${plugin}"/> - <property name="outputDir" value="${nlsDir}/${plugin}"/> - - - </target> - - <!-- Create the destination dir --> - <target name="nlsDir" depends="init"> - <mkdir dir="${nlsDir}"/> - </target> - - <!-- Create the destination dir --> - <target name="plugindir" depends="nlsDir"> - <delete dir="${outputDir}"/> - <mkdir dir="${outputDir}"/> - </target> - - <!-- Move the files to the correct locations in the workspace. --> - <target name="main" depends="plugindir"> - - <messageIdGen folderPath = "${plugindir}" componentId = "E" /> - - <copy todir = "${outputDir}/property_files" > - <fileset dir="${plugindir}/property_files"> - <include name="**/*.properties"/> - </fileset> - </copy> - - <copy file="${plugindir}/plugin.properties" todir="${outputDir}"/> - - </target> -</project> diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/property_files/wtpcommonui.properties b/plugins/org.eclipse.wst.common.frameworks.ui/property_files/wtpcommonui.properties deleted file mode 100644 index ca89d483a..000000000 --- a/plugins/org.eclipse.wst.common.frameworks.ui/property_files/wtpcommonui.properties +++ /dev/null @@ -1,36 +0,0 @@ -############################################################################### -# Copyright (c) 2003, 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 -############################################################################### -IActionWTPOperation_UI_0=No action available for execution. -WTPActionDialog_UI_0=Select the optional dependent actions you would like to execute. -WTPOptionalOperationDataModel_UI_0=Root tree can not be selected. -WTPOptionalOperationDataModel_UI_1=No operations are selected. -MasterDescriptor_ERROR_2=IWAE0005E WTPUIOperation elements require exactly one <selectionEnablement />. -WTPOperationAction_UI_0=Operation Status -WTPOperationAction_UI_1=Problem executing operation. -TimerQueue_ERROR_0=IWAE0006E Can't start a TimerQueue that is already running -ExtendedWizardPage_ERROR_0=IWAE0007E Cannot modify id after it has already been set. -ExtendedWizardPage_ERROR_1=IWAE0008E The id cannot be null -MasterDescriptor_UI_1=No \" {0} \" attribute defined -Timer_UI_0=Invalid delay: {0} -Timer_UI_1=Invalid initial delay: {0} -WTPWizard_UI_0=Wizard Error: {0} -WTPWizard_UI_1=An error has occurred when {0} finished. -ExtendableWizard_UI_0=Wizard page failed to be created in {0} {1} -WizardPageExtensionManager_UI_0=Element: {0} does not allow page insertion after. -WizardPageExtensionManager_UI_1={0} will not be created -WizardPageExtensionManager_UI_2=Circular dependancy, element: {0} check: {1} -WizardPageExtensionManager_UI_3=Editor does not allow page insertions -WizardPageExtensionManager_UI_4=Parent Class Not Found Error: {0} \r\n for attribute: {1} in plugin {2} \r\nPage not created -Delete_UI_0=Delete -Name_=Project name: -Browse_=Browse... -Project_location_=Project Location: -MULTIPLE_MODULE_PREF_TEXT=Allow Multiple modules per project diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/schema/DataModelWizardExtension.exsd b/plugins/org.eclipse.wst.common.frameworks.ui/schema/DataModelWizardExtension.exsd deleted file mode 100644 index ca5341c77..000000000 --- a/plugins/org.eclipse.wst.common.frameworks.ui/schema/DataModelWizardExtension.exsd +++ /dev/null @@ -1,113 +0,0 @@ -<?xml version='1.0' encoding='UTF-8'?> -<!-- Schema file written by PDE --> -<schema targetNamespace="org.eclipse.wst.common.frameworks.ui"> -<annotation> - <appInfo> - <meta.schema plugin="org.eclipse.wst.common.frameworks.ui" id="DataModelWizardExtension" name="Data Model Wizard Extension"/> - </appInfo> - <documentation> - - </documentation> - </annotation> - - <element name="extension"> - <complexType> - <sequence> - <element ref="DataModelWizard"/> - </sequence> - <attribute name="point" type="string" use="required"> - <annotation> - <documentation> - a fully qualified identifier of the target extension point - </documentation> - </annotation> - </attribute> - <attribute name="id" type="string"> - <annotation> - <documentation> - an optional identifier of the extension instance - </documentation> - </annotation> - </attribute> - <attribute name="name" type="string"> - <annotation> - <documentation> - an optional name of the extension instance - </documentation> - <appInfo> - <meta.attribute translatable="true"/> - </appInfo> - </annotation> - </attribute> - </complexType> - </element> - - <element name="DataModelWizard"> - <complexType> - <attribute name="id" type="string"> - <annotation> - <documentation> - - </documentation> - </annotation> - </attribute> - <attribute name="class" type="string"> - <annotation> - <documentation> - - </documentation> - </annotation> - </attribute> - </complexType> - </element> - - <annotation> - <appInfo> - <meta.section type="since"/> - </appInfo> - <documentation> - <b>This extension point is part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.</b> - </documentation> - </annotation> - - <annotation> - <appInfo> - <meta.section type="examples"/> - </appInfo> - <documentation> - - </documentation> - </annotation> - - <annotation> - <appInfo> - <meta.section type="apiInfo"/> - </appInfo> - <documentation> - - </documentation> - </annotation> - - <annotation> - <appInfo> - <meta.section type="implementation"/> - </appInfo> - <documentation> - - </documentation> - </annotation> - - <annotation> - <appInfo> - <meta.section type="copyright"/> - </appInfo> - <documentation> - Copyright (c) 2005 IBM Corporation and others.<br> -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 <a -href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a> - </documentation> - </annotation> - -</schema> diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/schema/extendableWizard.exsd b/plugins/org.eclipse.wst.common.frameworks.ui/schema/extendableWizard.exsd deleted file mode 100644 index 60b35aaea..000000000 --- a/plugins/org.eclipse.wst.common.frameworks.ui/schema/extendableWizard.exsd +++ /dev/null @@ -1,103 +0,0 @@ -<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.wst.common.frameworks.ui">
-<annotation>
- <appInfo>
- <meta.schema plugin="org.eclipse.wst.common.frameworks.ui" id="extendableWizard" name="Extendable Wizard"/>
- </appInfo>
- <documentation>
- Edit model editors represent the multi page editors that can be used to edit a collection of EMF resources. By declaring an edit model editor, the plugin provider allows the framework to generically obtain the edit model used by the editor.
- </documentation>
- </annotation>
-
- <element name="extension">
- <complexType>
- <sequence>
- <element ref="extendableWizard" minOccurs="1" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="point" type="string" use="required">
- <annotation>
- <documentation>
- a fully qualified identifier of the target extension point
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
- an optional identifier of the extension instance
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
- an optional name of the extension instance
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="extendableWizard">
- <complexType>
- <attribute name="id" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appInfo>
- <meta.section type="since"/>
- </appInfo>
- <documentation>
- 1.0
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="examples"/>
- </appInfo>
- <documentation>
-
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="apiInfo"/>
- </appInfo>
- <documentation>
-
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="implementation"/>
- </appInfo>
- <documentation>
-
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="copyright"/>
- </appInfo>
- <documentation>
- Copyright (c) 2005 IBM Corporation and others.<br>
-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 <a
-href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>
- </documentation>
- </annotation>
-
-</schema>
diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/schema/extendableWizardPage.exsd b/plugins/org.eclipse.wst.common.frameworks.ui/schema/extendableWizardPage.exsd deleted file mode 100644 index e94ffa164..000000000 --- a/plugins/org.eclipse.wst.common.frameworks.ui/schema/extendableWizardPage.exsd +++ /dev/null @@ -1,143 +0,0 @@ -<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.wst.common.frameworks.ui">
-<annotation>
- <appInfo>
- <meta.schema plugin="org.eclipse.wst.common.frameworks.ui" id="wizardPageGroup" name="Extendable Wizard Page"/>
- </appInfo>
- <documentation>
- Edit model editors represent the multi page editors that can be used to edit a collection of EMF resources. By declaring an edit model editor, the plugin provider allows the framework to generically obtain the edit model used by the editor.
- </documentation>
- </annotation>
-
- <element name="extension">
- <complexType>
- <sequence>
- <choice>
- <element ref="wizardPageGroup"/>
- </choice>
- </sequence>
- <attribute name="point" type="string" use="required">
- <annotation>
- <documentation>
- a fully qualified identifier of the target extension point
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
- an optional identifier of the extension instance
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
- an optional name of the extension instance
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="wizardPageGroup">
- <complexType>
- <sequence>
- <choice>
- <element ref="factory"/>
- </choice>
- </sequence>
- <attribute name="wizardID" type="string" use="required">
- <annotation>
- <documentation>
- This must match the id defined in the extendableWizard element in the extendableWizard extension point
- </documentation>
- </annotation>
- </attribute>
- <attribute name="allowsExtendedPagesAfter" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="pageGroupInsertionID" type="string">
- <annotation>
- <documentation>
- If this page is to immediately after another page, this must match the pageID of the page to insert after.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="pageGroupID" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="factory">
- <complexType>
- <attribute name="className" type="string" use="required">
- <annotation>
- <documentation>
- This class is an instancof com.ibm.wtp.common.ui.wizard.extensions.WizardExtensionFactory
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appInfo>
- <meta.section type="since"/>
- </appInfo>
- <documentation>
- 1.0
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="examples"/>
- </appInfo>
- <documentation>
-
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="apiInfo"/>
- </appInfo>
- <documentation>
-
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="implementation"/>
- </appInfo>
- <documentation>
-
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="copyright"/>
- </appInfo>
- <documentation>
- Copyright (c) 2005 IBM Corporation and others.<br>
-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 <a
-href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>
- </documentation>
- </annotation>
-
-</schema>
diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/schema/extendedViewer.exsd b/plugins/org.eclipse.wst.common.frameworks.ui/schema/extendedViewer.exsd deleted file mode 100644 index eca886238..000000000 --- a/plugins/org.eclipse.wst.common.frameworks.ui/schema/extendedViewer.exsd +++ /dev/null @@ -1,138 +0,0 @@ -<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.wst.common.frameworks.ui">
-<annotation>
- <appInfo>
- <meta.schema plugin="org.eclipse.wst.common.frameworks.ui" id="extendedViewer" name="Extended Viewers"/>
- </appInfo>
- <documentation>
- The extendedViewer Extension point allows the contribution of new function
- </documentation>
- </annotation>
-
- <element name="extension">
- <complexType>
- <sequence>
- <element ref="extendedViewer"/>
- </sequence>
- <attribute name="point" type="string" use="required">
- <annotation>
- <documentation>
- a fully qualified identifier of the target extension point
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
- an optional identifier of the extension instance
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
- an optional name of the extension instance
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="extendedViewer">
- <complexType>
- <attribute name="viewerID" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="parentViewerID" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="factoryClass" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="icon" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="label" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="functionGroupID" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appInfo>
- <meta.section type="since"/>
- </appInfo>
- <documentation>
- <b>This extension point is part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.</b>
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="examples"/>
- </appInfo>
- <documentation>
-
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="apiInfo"/>
- </appInfo>
- <documentation>
-
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="implementation"/>
- </appInfo>
- <documentation>
-
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="copyright"/>
- </appInfo>
- <documentation>
- Copyright (c) 2005 IBM Corporation and others.<br>
-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 <a
-href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>
- </documentation>
- </annotation>
-
-</schema>
diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/schema/wtpuiAction.exsd b/plugins/org.eclipse.wst.common.frameworks.ui/schema/wtpuiAction.exsd deleted file mode 100644 index baf2a87fa..000000000 --- a/plugins/org.eclipse.wst.common.frameworks.ui/schema/wtpuiAction.exsd +++ /dev/null @@ -1,367 +0,0 @@ -<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.wst.common.frameworks.ui">
-<annotation>
- <appInfo>
- <meta.schema plugin="org.eclipse.wst.common.frameworks.ui" id="wtpuiAction" name="WTP UI Action"/>
- </appInfo>
- <documentation>
- This extension point is for WTP Operations which need to be tied to a generic UI action, such as CUT, COPY, PASTE, DELETE, and RENAME.
- </documentation>
- </annotation>
-
- <element name="extension">
- <complexType>
- <sequence>
- <choice>
- <element ref="masterOperation"/>
- <element ref="slaveOperation"/>
- </choice>
- </sequence>
- <attribute name="point" type="string" use="required">
- <annotation>
- <documentation>
- a fully qualified identifier of the target extension point
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
- an optional identifier of the extension instance
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
- an optional name of the extension instance
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="masterOperation">
- <annotation>
- <documentation>
- A masterOperation enables an existing WTP Operation to be used in a UI action. Generic Ids aggregate a set of masterOperations for the same Abstract action (like a "CUT" operation). WTP Operations are themselves extendible, so for any masterOperation defined, there may be any number of pre|post operations. These pre|post operation can have slaveOperation elements defined which indicate the pre|post operation may be run independently.
- </documentation>
- </annotation>
- <complexType>
- <sequence>
- <element ref="selectionEnablement"/>
- </sequence>
- <attribute name="extendedGenericId" type="string" use="required">
- <annotation>
- <documentation>
- The ID of the Generic Action you would like to contribute to. (e.g. The id for CUT, COPY, PASTE, DELETE, RENAME).
- </documentation>
- </annotation>
- </attribute>
- <attribute name="operationClass" type="string">
- <annotation>
- <documentation>
- The fully qualified class of your operation. Your operation must be a WTPOperation and must provide a no-arguments default constructor. If this attribute is not provided, the getDefaultOperation() returned by the dataModel will be used.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string" use="required">
- <annotation>
- <documentation>
- A name to display in the dialog for your action (if the operation is optional). You can use the standard "%key" for translatable text stored in plugin.properties.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="description" type="string">
- <annotation>
- <documentation>
- A description to display in the dialog for your action (if the operation is optional). You can use the standard "%key" for translatable text stored in plugin.properties.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="populatorClass" type="string" use="required">
- <annotation>
- <documentation>
- The populatorClass knows how to provide a WTP Operation Data Model based on a given selection. The getDefaultOperation() method of the data model will be ignored if the operationClass is provided.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="alwaysExecute" type="boolean">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="overrideId" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="selectionEnablement">
- <annotation>
- <documentation>
- The selectionEnablement element allows you to filter which kinds of selection your object is applicable to using Standard Eclipse Action Expresions.
- </documentation>
- </annotation>
- <complexType>
- <choice>
- <element ref="objectClass"/>
- <element ref="or"/>
- </choice>
- </complexType>
- </element>
-
- <element name="slaveOperation">
- <annotation>
- <documentation>
- The slaveOperation element defines display information for operations which extend a declared master operation. If a pre|post operation of a master does not have a corresponding slaveOperation element, then the pre|post operation will be consider required, and not be displayed to the user.
- </documentation>
- </annotation>
- <complexType>
- <attribute name="operationClass" type="string" use="required">
- <annotation>
- <documentation>
- The fully qualified class of your operation. Your operation must be a WTPOperation and must provide a no-arguments default constructor. For slave operations, the data model of the master operation will be provided. Therefore, slaves cannot override the data model using a seperate populatorClass.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string" use="required">
- <annotation>
- <documentation>
- A name to display in the dialog for your action (if the operation is optional). You can use the standard "%key" for translatable text stored in plugin.properties.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="description" type="string">
- <annotation>
- <documentation>
- A description to display in the dialog for your action (if the operation is optional). You can use the standard "%key" for translatable text stored in plugin.properties.
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="or">
- <complexType>
- <choice>
- <element ref="objectClass"/>
- <element ref="and"/>
- <element ref="objectState"/>
- </choice>
- </complexType>
- </element>
-
- <element name="objectClass">
- <complexType>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="adaptable" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="and">
- <complexType>
- <choice>
- <element ref="objectClass"/>
- <element ref="or"/>
- </choice>
- </complexType>
- </element>
-
- <element name="objectState">
- <complexType>
- <attribute name="value" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appInfo>
- <meta.section type="since"/>
- </appInfo>
- <documentation>
- 1.0
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="examples"/>
- </appInfo>
- <documentation>
- <!-- The examples in this section have been commented out because they reference only extension point IDs. These examples must be corrected before being included in the documentation. -->
-<!--
-The following example declares two Master Operations (<code>com.acme.ui.operation.MasterOperationA</code> and <code>com.acme.ui.operation.MasterOperationB</code>) which are attached to the Generic ID <code>com.acme.ui.WTPOptionalOperationTest</code>.
-The scenario has Master A which has as a pre-operation of Slave A and a post-operation of Slave C. Slave A is made optional by the <code>slaveOperation</code> element, while Slave C will always be run (no <code>slaveOperation</code> is given to run it seperately). Slave A further has an optional pre-operation (Slave B) that can be executed indepently of either Slave A or Master A.
--->
-<!--
-<pre>
- <extension
- point="org.eclipse.wst.common.frameworks.ui.wtpuiAction">
- <masterOperation
- populatorClass="com.acme.ui.operation.AcmeOperationPopulator"
- name="%master_a_name"
- operationClass="com.acme.ui.operation.MasterOperationA"
- extendedGenericId="com.acme.ui.WTPOptionalOperationTest"
- description="%master_a_description">
- </masterOperation>
- <slaveOperation
- name="Slave A"
- operationClass="com.acme.ui.operation.SlaveOperationA">
- </slaveOperation>
- <slaveOperation
- name="Slave B"
- operationClass="com.acme.ui.operation.SlaveOperationB">
- </slaveOperation>
- <masterOperation
- populatorClass="com.acme.ui.operation.AcmeOperationPopulator"
- name="EAR Project Action"
- operationClass="com.acme.ui.operation.MasterOperationB"
- extendedGenericId="com.acme.ui.WTPOptionalOperationTest">
- <selectionEnablement>
- <objectState name="projectNature" value="org.eclipse.jst.j2ee.EARNature" />
- </selectionEnablement>
- </masterOperation>
- </extension>
-</pre>
--->
-<!--
-For each of the slaveOperations referenced above, you must have a corresponding WTP Operation Extension declared similar to the following:
--->
-<!--
-<pre>
- <extension
- id="wtpuiAciton.Acme.Extensions"
- point="org.eclipse.wst.common.frameworks.ExtendableOperation">
- <extendableOperation
- class="com.acme.ui.operation.MasterOperationA"
- id="com.acme.ui.operation.MasterOperationA">
- </extendableOperation>
- <extendableOperation
- class="com.acme.ui.operation.SlaveOperationA"
- id="com.acme.ui.operation.SlaveOperationA">
- </extendableOperation>
- </extension>
- <extension
- point="org.eclipse.wst.common.frameworks.OperationExtension">-->
- <!-- Made optional by the above declaration -->
- <!--<operationExtension
- preOperationClass="com.acme.ui.operation.SlaveOperationA"
- id="com.acme.ui.operation.MasterOperationA">
- </operationExtension>-->
- <!-- Made optional by the above declaration -->
- <!--<operationExtension
- postOperationClass="com.acme.ui.operation.SlaveOperationB"
- id="com.acme.ui.operation.SlaveOperationA">
- </operationExtension>-->
- <!-- Non-optional operation, will always run -->
- <!--<operationExtension
- postOperationClass="com.acme.ui.operation.SlaveOperationC"
- id="com.acme.ui.operation.MasterOperationA">
- </operationExtension>
- </extension>
-</pre>
--->
-<!--
-In general, users extending existing actions only need to declare the following:
--->
-<!--
-<pre>
- <extension
- point="org.eclipse.wst.common.frameworks.OperationExtension">-->
- <!-- The action referenced must be declared as extensible by the org.eclipse.wst.common.frameworks.ExtendableOperation extension point -->
- <!--<operationExtension
- preOperationClass="...YOUR CLASS..."
- id="...ID OF EXISTING OPERATION...">
- </operationExtension>
- </extension>
-</pre>
--->
-<!--
-And if your operation is optional declare the slaveOperation:
--->
-<!--
-<pre>
- <extension
- point="org.eclipse.wst.common.frameworks.ui.wtpuiAction">
- <slaveOperation
- name="..NAME OF YOUR OPERATION..."
- description="...DESCRIPTION OF YOUR ACTION..."
- operationClass="...YOUR CLASS...">
- </slaveOperation>
- </extension>
-</pre>
--->
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="apiInfo"/>
- </appInfo>
- <documentation>
-
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="implementation"/>
- </appInfo>
- <documentation>
-
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="copyright"/>
- </appInfo>
- <documentation>
- Copyright (c) 2005 IBM Corporation and others.<br>
-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 <a
-href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>
- </documentation>
- </annotation>
-
-</schema>
diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/datamodel/ui/AddablePageGroup.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/datamodel/ui/AddablePageGroup.java deleted file mode 100644 index 53c3360b3..000000000 --- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/datamodel/ui/AddablePageGroup.java +++ /dev/null @@ -1,16 +0,0 @@ -/*************************************************************************************************** - * Copyright (c) 2003, 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.common.frameworks.internal.datamodel.ui; - -import org.eclipse.jface.wizard.IWizardPage; - -public interface AddablePageGroup extends IDMPageGroup -{ - public void addPage( IWizardPage page ); -} diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/datamodel/ui/DataModelSynchHelper.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/datamodel/ui/DataModelSynchHelper.java deleted file mode 100644 index 679d95c29..000000000 --- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/datamodel/ui/DataModelSynchHelper.java +++ /dev/null @@ -1,564 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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.common.frameworks.internal.datamodel.ui; - -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.util.Arrays; -import java.util.Collection; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; - -import org.eclipse.jface.viewers.CheckStateChangedEvent; -import org.eclipse.jface.viewers.CheckboxTableViewer; -import org.eclipse.jface.viewers.CheckboxTreeViewer; -import org.eclipse.jface.viewers.ICheckStateListener; -import org.eclipse.jface.viewers.StructuredViewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.List; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.TableItem; -import org.eclipse.swt.widgets.Text; -import org.eclipse.swt.widgets.Tree; -import org.eclipse.swt.widgets.TreeItem; -import org.eclipse.swt.widgets.Widget; -import org.eclipse.wst.common.frameworks.datamodel.DataModelEvent; -import org.eclipse.wst.common.frameworks.datamodel.DataModelPropertyDescriptor; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; -import org.eclipse.wst.common.frameworks.datamodel.IDataModelListener; -import org.eclipse.wst.common.frameworks.internal.ui.TimedModifyListener; - -/** - * This class is EXPERIMENTAL and is subject to substantial changes. - */ -public class DataModelSynchHelper implements IDataModelListener { - protected static final boolean isLinux = System.getProperty("os.name").equals("Linux"); //$NON-NLS-1$ //$NON-NLS-2$ - - protected IDataModel dataModel; - protected Map widgetToPropertyHash; - protected Map propertyToWidgetHash; - protected Map widgetToDepControls; - - protected String currentProperty; - protected Widget currentWidget; - protected Widget currentWidgetFromEvent; // TODO M4 see if this should be set with for - // listeners - protected boolean ignoreModifyEvent = false; - - private class ModifyTextListener implements ModifyListener { - public void modifyText(ModifyEvent e) { - if (ignoreModifyEvent) - return; - Text text = (Text) e.getSource(); - if (currentWidget == text) - return; - String propertyName = (String) widgetToPropertyHash.get(text); - setProperty(propertyName, text.getText()); - } - } - - private ModifyTextListener modifyTextListener; - private TimedModifyListener timedModifyListener; - - private class ComboListener implements SelectionListener, ModifyListener { - - public void modifyText(ModifyEvent e) { - if (ignoreModifyEvent) - return; - Combo combo = (Combo) e.getSource(); - if (currentWidget == combo) - return; - - try { - currentWidgetFromEvent = combo; - String propertyName = (String) widgetToPropertyHash.get(combo); - DataModelPropertyDescriptor[] descriptors = dataModel.getValidPropertyDescriptors(propertyName); - String description = combo.getText(); - // On a combo selection linux fires 2 events; - // the first clears the value which needs to be ignored when the type is not String - // the second sets the new value - if (isLinux && description.length() == 0 && descriptors.length != 0 && !(descriptors[0].getPropertyValue() instanceof String)) { - return; - } - for (int i = 0; i < descriptors.length; i++) { - if (description.equals(descriptors[i].getPropertyDescription())) { - setProperty(propertyName, descriptors[i].getPropertyValue()); - return; - } - } - setProperty(propertyName, combo.getText()); - } finally { - currentWidgetFromEvent = null; - } - } - - public void widgetSelected(SelectionEvent e) { - Combo combo = (Combo) e.getSource(); - if (currentWidget == combo) - return; - String propertyName = (String) widgetToPropertyHash.get(combo); - if (combo.getSelectionIndex() >= 0) { - DataModelPropertyDescriptor[] descriptors = dataModel.getValidPropertyDescriptors(propertyName); - String description = combo.getItem(combo.getSelectionIndex()); - for (int i = 0; i < descriptors.length; i++) { - if (description.equals(descriptors[i].getPropertyDescription())) { - setProperty(propertyName, descriptors[i].getPropertyValue()); - return; - } - } - setProperty(propertyName, combo.getItem(combo.getSelectionIndex())); - } - } - - public void widgetDefaultSelected(SelectionEvent e) { - } - } - - private ComboListener comboListener; - - private class CheckboxSelectionListener implements SelectionListener { - public void widgetSelected(SelectionEvent e) { - Button button = (Button) e.getSource(); - if (currentWidget == button) - return; - String propertyName = (String) widgetToPropertyHash.get(button); - setProperty(propertyName, new Boolean(button.getSelection())); - } - - public void widgetDefaultSelected(SelectionEvent e) { - } - } - - private CheckboxSelectionListener checkboxSelectionListener; - - public DataModelSynchHelper(IDataModel model) { - this.dataModel = model; - dataModel.addListener(this); - } - - private CheckBoxViewerListener checkBoxViewerStateListener; - - private class CheckBoxViewerListener implements ICheckStateListener { - public void checkStateChanged(CheckStateChangedEvent event) { - StructuredViewer viewer = (StructuredViewer) event.getSource(); - CheckboxTableViewer checkBoxTableViewer; - CheckboxTreeViewer checkBoxTreeViewer; - Object[] items = null; - if (viewer instanceof CheckboxTableViewer) { - checkBoxTableViewer = (CheckboxTableViewer) viewer; - items = checkBoxTableViewer.getCheckedElements(); - } else if (viewer instanceof CheckboxTreeViewer) { - checkBoxTreeViewer = (CheckboxTreeViewer) viewer; - items = checkBoxTreeViewer.getCheckedElements(); - } - String propertyName = (String) widgetToPropertyHash.get(viewer.getControl()); - setPropertyItems(propertyName, items); - } - } - - public void propertyChanged(DataModelEvent event) { - String propertyName = event.getPropertyName(); - int flag = event.getFlag(); - if (flag == DataModelEvent.ENABLE_CHG) - setEnablement(propertyName, event.isPropertyEnabled()); - else - synchUIWithModel(propertyName, flag); - } - - protected void setProperty(String propertyName, Object value) { - currentProperty = propertyName; - try { - dataModel.setProperty(propertyName, value); - } finally { - currentProperty = null; - } - } - - protected void setPropertyItems(String propertyName, Object[] items) { - currentProperty = propertyName; - try { - dataModel.setProperty(propertyName, items); - } finally { - currentProperty = null; - } - } - - /** - * Sets the UI to have the property value defined in the model - * - * @param propertyName - * @link IDataModelListener for the flag values. - */ - public void synchUIWithModel(final String propertyName, final int flag) { - if (null != propertyToWidgetHash && propertyToWidgetHash.containsKey(propertyName)) { - Display.getDefault().syncExec(new Runnable() { - public void run() { - try { - currentWidget = (Widget) propertyToWidgetHash.get(propertyName); - if (currentWidget != null && currentWidget != currentWidgetFromEvent) { - try { - if (currentWidget instanceof Text) - setWidgetValue(propertyName, flag, (Text) currentWidget); - else if (currentWidget instanceof Combo) { - setWidgetValue(propertyName, flag, (Combo) currentWidget); - } else if (currentWidget instanceof Button) - setWidgetValue(propertyName, flag, (Button) currentWidget); - else if (currentWidget instanceof Label) - setWidgetValue(propertyName, flag, (Label) currentWidget); - else if (currentWidget instanceof List) - setWidgetValue(propertyName, flag, (List) currentWidget); - else if (currentWidget instanceof Table) - setWidgetValue(propertyName, flag, (Table) currentWidget); - else if (currentWidget instanceof Tree) - setWidgetValue(propertyName, flag, (Tree) currentWidget); - } finally { - ignoreModifyEvent = false; - } - setEnablement((Control) currentWidget, dataModel.isPropertyEnabled(propertyName)); - } - } finally { - currentWidget = null; - } - } - }); - } - } - - /** - * @param control - * @param enabled - */ - protected void setEnablement(Control control, boolean enabled) { - if (control.isEnabled() != enabled) - control.setEnabled(enabled); - setDependentControlEnablement(control, enabled); - } - - private void setEnablement(final String propertyName, final boolean enabled) { - if (propertyToWidgetHash != null) { - Display.getDefault().syncExec(new Runnable() { - public void run() { - Control control = (Control) propertyToWidgetHash.get(propertyName); - if (control != null) { - setEnablement(control, enabled); - } - } - }); - } - } - - /** - * @param control - * @param enabled - */ - private void setDependentControlEnablement(Control control, boolean enabled) { - if (widgetToDepControls != null) { - Control[] dependents = (Control[]) widgetToDepControls.get(control); - if (dependents != null) { - Control dep = null; - for (int i = 0; i < dependents.length; i++) { - dep = dependents[i]; - if (dep.isEnabled() != enabled) - dep.setEnabled(enabled); - } - } - } - } - - protected void setWidgetValue(String propertyName, int flag, Button button) { - if ((button.getStyle() & SWT.CHECK) == SWT.CHECK || (button.getStyle() & SWT.RADIO) == SWT.RADIO) { - boolean checked = dataModel.getBooleanProperty(propertyName); - if (button.getSelection() != checked) { - button.setSelection(checked); - } - } - } - - protected void setWidgetValue(String propertyName, int flag, Combo combo) { - if (flag == DataModelEvent.VALID_VALUES_CHG || combo.getItemCount() == 0) { - // Display properties should only fire if the contents change. - DataModelPropertyDescriptor[] descriptors = dataModel.getValidPropertyDescriptors(propertyName); - String[] items = new String[descriptors.length]; - for (int i = 0; i < descriptors.length; i++) { - items[i] = descriptors[i].getPropertyDescription(); - } - combo.setItems(items); - } - String newText = dataModel.getPropertyDescriptor(propertyName).getPropertyDescription(); - int selIndex = combo.getSelectionIndex(); - if (selIndex < 0 || !newText.equals(combo.getItem(selIndex))) { - String[] items = combo.getItems(); - for (int i = 0; i < items.length; i++) { - if (items[i].equals(newText)) { - combo.select(i); - return; - } - } - } - combo.setText(newText); - } - - protected void setWidgetValue(String propertyName, int flag, Text text) { - String newText = dataModel.getStringProperty(propertyName); - if (!newText.equals(text.getText())) { - text.setText(newText); - } - } - - protected void setWidgetValue(String propertyName, int flag, Table table) { - Object[] elements = (Object[]) dataModel.getProperty(propertyName); - if (elements == null || elements.length == 0) { - setTableItemsChecked(table.getItems(), false); - return; - } - java.util.List elementList = Arrays.asList(elements); - TableItem[] tableItems = table.getItems(); - for (int i = 0; i < tableItems.length; i++) { - TableItem item = tableItems[i]; - if (elementList.contains(item.getData())) - item.setChecked(true); - else - item.setChecked(false); - } - } - - protected void setTableItemsChecked(TableItem[] tableItems, boolean b) { - for (int i = 0; i < tableItems.length; i++) - tableItems[i].setChecked(b); - } - - protected void setWidgetValue(String propertyName, int flag, Tree tree) { - Object[] elements = (Object[]) dataModel.getProperty(propertyName); - if (elements == null) - return; - java.util.List elementList = Arrays.asList(elements); - TreeItem[] treeItems = tree.getItems(); - if (elementList.size() == 0) { - setTreeItemsGrey(treeItems, false); - return; - } - if (treeItems.length > 0) - setTreeItemChecked(treeItems, elementList); - } - - public void setTreeItemsGrey(TreeItem[] treeItems, boolean b) { - for (int i = 0; i < treeItems.length; i++) { - TreeItem item = treeItems[i]; - item.setGrayed(b); - setTreeItemsGrey(treeItems[i].getItems(), b); - } - } - - protected void setTreeItemChecked(TreeItem[] treeItems, java.util.List items) { - for (int i = 0; i < treeItems.length; i++) { - if (items.contains(treeItems[i].getData())){ - treeItems[i].setChecked(true); - treeItems[i].setGrayed(false); - }else{ - treeItems[i].setGrayed(true); - } - TreeItem[] childernItems = treeItems[i].getItems(); - if (childernItems.length > 0) { - treeItems[i].setExpanded(true); - setTreeItemChecked(childernItems, items); - } - } - } - - protected void setWidgetValue(String propertyName, int flag, Label label) { - String newText = dataModel.getStringProperty(propertyName); - if (!newText.equals(label.getText())) { - label.setText(newText); - } - } - - protected void setWidgetValue(String propertyName, int flag, List list) { - Object newContents = dataModel.getProperty(propertyName); - if (newContents == null) { - list.setItems(new String[0]); - return; - } - if (newContents instanceof java.util.List) { - java.util.List modelContents = (java.util.List) newContents; - String[] items = new String[modelContents.size()]; - for (int i = 0; i < modelContents.size(); i++) { - items[i] = modelContents.get(i).toString(); - } - list.setItems(items); - } else if (newContents instanceof String[]) { - list.setItems((String[]) newContents); - } - } - - public void synchAllUIWithModel() { - if (null != propertyToWidgetHash) { - Collection keys = propertyToWidgetHash.keySet(); - if (!keys.isEmpty()) { - Iterator propertyNames = keys.iterator(); - String propertyName = null; - while (propertyNames.hasNext()) { - propertyName = (String) propertyNames.next(); - synchUIWithModel(propertyName, DataModelEvent.VALUE_CHG); - } - } - } - } - - protected void synchComposite(Widget widget, String propertyName, Control[] depControls) { - if (null == widgetToPropertyHash) - widgetToPropertyHash = new HashMap(); - if (propertyToWidgetHash == null) - propertyToWidgetHash = new HashMap(); - widgetToPropertyHash.put(widget, propertyName); - propertyToWidgetHash.put(propertyName, widget); - if (depControls != null) { - if (widgetToDepControls == null) - widgetToDepControls = new HashMap(); - widgetToDepControls.put(widget, depControls); - } - synchUIWithModel(propertyName, DataModelEvent.VALUE_CHG); - } - - public void synchText(Text text, String propertyName, Control[] dependentControls) { - synchText(text, propertyName, false, dependentControls); - } - - public void synchText(Text text, String propertyName, boolean isTimeModified, Control[] dependentControls) { - synchComposite(text, propertyName, dependentControls); - if (isTimeModified) - text.addModifyListener(getTimedListener()); - else - text.addModifyListener(getModifyTextListener()); - } - - public void synchLabel(Label label, String propertyName, Control[] dependentControls) { - synchComposite(label, propertyName, dependentControls); - } - - /** - * Use this to synch the contents of the <code>list</code> to the List elements returned from - * the <code>propertyName</code>. - */ - public void synchList(List list, String propertyName, Control[] dependentControls) { - synchComposite(list, propertyName, dependentControls); - } - - /** - * Use this to synch the value of the specified Combo with the specified propertyName. The - * possible values displayed to the user are determined by return of - * IDataModel.getValidPropertyDescriptors(String). - * - * @param combo - * @param propertyName - * @param dependentControls - */ - public void synchCombo(Combo combo, String propertyName, Control[] dependentControls) { - synchComposite(combo, propertyName, dependentControls); - if (null == comboListener) { - comboListener = new ComboListener(); - } - combo.addSelectionListener(comboListener); - combo.addModifyListener(comboListener); - } - - /** - * Use this to sync the state of the specified checkbox with the value of the specified - * propertyName. The specified propertyName must contain a java.lang.Boolean typed Object. - * - * @param checkbox - * @param propertyName - * @param dependentControls - */ - public void synchCheckbox(Button checkbox, String propertyName, Control[] dependentControls) { - synchComposite(checkbox, propertyName, dependentControls); - if (null == checkboxSelectionListener) { - checkboxSelectionListener = new CheckboxSelectionListener(); - } - checkbox.addSelectionListener(checkboxSelectionListener); - } - - public void synchCheckBoxTableViewer(CheckboxTableViewer tableViewer, String propertyName, Control[] dependentControls) { - synchComposite(tableViewer.getControl(), propertyName, dependentControls); - if (null == checkBoxViewerStateListener) { - checkBoxViewerStateListener = new CheckBoxViewerListener(); - } - tableViewer.addCheckStateListener(checkBoxViewerStateListener); - } - - public void synchCheckBoxTreeViewer(CheckboxTreeViewer treeViewer, String propertyName, Control[] dependentControls) { - treeViewer.expandAll(); - synchComposite(treeViewer.getControl(), propertyName, dependentControls); - if (null == checkBoxViewerStateListener) { - checkBoxViewerStateListener = new CheckBoxViewerListener(); - } - treeViewer.addCheckStateListener(checkBoxViewerStateListener); - } - - public void synchRadio(Button radio, String propertyName, Control[] dependentControls) { - // Uses checkbox syncher - synchCheckbox(radio, propertyName, dependentControls); - } - - private TimedModifyListener getTimedListener() { - if (timedModifyListener == null) - timedModifyListener = new TimedModifyListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - Widget w = (Widget) e.getSource(); - if (currentWidget == w || w.isDisposed()) - return; - String propertyName = (String) widgetToPropertyHash.get(w); - setTextProperty(propertyName, (Text) w); - } - }) { - public void modifyText(ModifyEvent e) { - if (ignoreModifyEvent) - return; - super.modifyText(e); - } - }; - return timedModifyListener; - } - - protected void setTextProperty(String propertyName, Text text) { - setProperty(propertyName, text.getText()); - } - - private ModifyTextListener getModifyTextListener() { - if (null == modifyTextListener) - modifyTextListener = new ModifyTextListener(); - return modifyTextListener; - } - - public IDataModel getDataModel() { - return dataModel; - } - - public void dispose() { - dataModel.removeListener(this); - checkboxSelectionListener = null; - currentWidget = null; - modifyTextListener = null; - propertyToWidgetHash = null; - timedModifyListener = null; - widgetToDepControls = null; - widgetToPropertyHash = null; - } -} diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/datamodel/ui/DataModelWizard.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/datamodel/ui/DataModelWizard.java deleted file mode 100644 index cac3ab5c8..000000000 --- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/datamodel/ui/DataModelWizard.java +++ /dev/null @@ -1,367 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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.common.frameworks.internal.datamodel.ui; - -import java.lang.reflect.InvocationTargetException; - -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jem.util.logger.proxy.Logger; -import org.eclipse.jface.operation.IRunnableWithProgress; -import org.eclipse.jface.wizard.IWizardPage; -import org.eclipse.jface.wizard.Wizard; -import org.eclipse.wst.common.environment.IEnvironment; -import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; -import org.eclipse.wst.common.frameworks.datamodel.IDataModelPausibleOperation; -import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation; -import org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider; -import org.eclipse.wst.common.frameworks.internal.datamodel.DataModelImpl; -import org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl; -import org.eclipse.wst.common.frameworks.internal.eclipse.ui.EclipseEnvironment; -import org.eclipse.wst.common.frameworks.internal.ui.ErrorDialog; -import org.eclipse.wst.common.frameworks.internal.ui.PageGroupManager; -import org.eclipse.wst.common.frameworks.internal.ui.WTPCommonUIResourceHandler; -import org.eclipse.wst.common.frameworks.internal.ui.WTPUIPlugin; - - -/** - * This class is EXPERIMENTAL and is subject to substantial changes. - */ -public abstract class DataModelWizard extends Wizard implements IDMPageHandler { - private PageGroupManager pageGroupManager; - private IDataModel dataModel; - private AddablePageGroup rootPageGroup; - private IDataModelPausibleOperation rootOperation; - - // private IWizardPage firstpage; - - public DataModelWizard(IDataModel dataModel) { - this.dataModel = dataModel; - } - - public DataModelWizard() { - } - - protected abstract IDataModelProvider getDefaultProvider(); - - /** - * @return the wizard ID that clients should extend to add to this wizard - */ - public final String getWizardID() { - return getDataModel().getID(); - } - - /** - * - * @return returns the root operation for this wizard. - */ - protected IDataModelPausibleOperation getRootOperation() { - return new WizardDataModelManagerOperationImpl(((DataModelImpl)getDataModel()).getRawOperation()); - } - - /** - * This is finalized to handle the adding of extended pages. Clients should override - * doAddPages() to add their pages. - */ - public final void addPages() { - init(); - doAddPages(); - } - - /** - * Subclasses should override this method to add pages. - */ - protected void doAddPages() { - } - - // TODO make this final - public IWizardPage getStartingPage() { - pageGroupManager.reset(); - return getNextPage(null); - } - - /** - * Subclasses wishing to control the page ordering should do so by overriding - * getNextPage(String, String) and getPreviousPage(String, String) - * - * @link #getNextPage(String, String) - * @link #getPreviousPage(String, String) - */ - // TODO make this final - public IWizardPage getNextPage(IWizardPage page) { - - IWizardPage currentPage = pageGroupManager.getCurrentPage(); - - pageGroupManager.moveForwardOnePage(); - - IWizardPage nextPage = pageGroupManager.getCurrentPage(); - - // If an error occured then the current page and the next page will be the same. - if (currentPage != nextPage && nextPage != null) { - nextPage.setWizard(this); - nextPage.setPreviousPage(currentPage); - } - - return currentPage == nextPage ? null : nextPage; - } - - public String getNextPage(String currentPageName, String expectedNextPageName) { - return expectedNextPageName; - } - - /** - * Subclasses wishing to control the page ordering should do so by overriding - * getNextPage(String, String) and getPreviousPage(String, String) - * - * @link #getNextPage(String, String) - * @link #getPreviousPage(String, String) - */ - // TODO make this final - public IWizardPage getPreviousPage(IWizardPage page) { - return page != null ? page.getPreviousPage() : null; - } - - public String getPreviousPage(String currentPageName, String expectedPreviousPageName) { - return expectedPreviousPageName; - } - - public boolean canFinish() { - if (!super.canFinish() || !getDataModel().isValid()) { - return false; - } - - return true; - } - - public PageGroupManager getPageGroupManager() { - return pageGroupManager; - } - - // TODO need to implement this. Perhaps in the PageGroupManager - // - protected void resetAfterFinishError() { - // IWizardPage[] pages = getPages(); - // for (int i = 0; i < pages.length; i++) { - // DataModelWizardPage wtpPage = (DataModelWizardPage) pages[i]; - // wtpPage.validatePage(true); - // } - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.wizard.IWizard#performFinish() - */ - public final boolean performFinish() { - try { - if (prePerformFinish()) { - storeDefaultSettings(); - - final IStatus st = runOperations(); - - if (st.getSeverity() == IStatus.ERROR) { - WTPUIPlugin.log(st); - ErrorDialog.openError(getShell(), WTPCommonUIResourceHandler.getString(WTPCommonUIResourceHandler.WTPWizard_UI_0, new Object[]{getWindowTitle()}), WTPCommonUIResourceHandler.getString(WTPCommonUIResourceHandler.WTPWizard_UI_1, new Object[]{getWindowTitle()}), new CoreException(st), 0, false); //$NON-NLS-1$ //$NON-NLS-2$ - } - - postPerformFinish(); - } - } catch (Throwable exc) { - WTPUIPlugin.log(exc); - ErrorDialog.openError(getShell(), WTPCommonUIResourceHandler.getString(WTPCommonUIResourceHandler.WTPWizard_UI_0, new Object[]{getWindowTitle()}), WTPCommonUIResourceHandler.getString(WTPCommonUIResourceHandler.WTPWizard_UI_1, new Object[]{getWindowTitle()}), exc, 0, false); //$NON-NLS-1$ //$NON-NLS-2$ - } - - return true; - } - - private IStatus runOperations() { - final IStatus[] status = new IStatus[1]; - IRunnableWithProgress runnable = new IRunnableWithProgress() { - public void run(IProgressMonitor monitor) { - try { - status[0] = rootOperation.execute(monitor, null); - } catch (ExecutionException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - }; - try { - getContainer().run(runForked(), isCancelable(), runnable); - } catch (Throwable exc) { - WTPUIPlugin.log(exc); - ErrorDialog.openError(getShell(), WTPCommonUIResourceHandler.getString(WTPCommonUIResourceHandler.WTPWizard_UI_0, new Object[]{getWindowTitle()}), WTPCommonUIResourceHandler.getString(WTPCommonUIResourceHandler.WTPWizard_UI_1, new Object[]{getWindowTitle()}), exc, 0, false); //$NON-NLS-1$ //$NON-NLS-2$ - status[0] = new Status(IStatus.ERROR, "id", 0, exc.getMessage(), exc); //$NON-NLS-1$ - } - - return status[0]; - } - - public boolean performCancel() { - pageGroupManager.undoAllCurrentOperations(); - - return true; - } - - /** - * Subclass can override to perform any tasks prior to running the operation. Return true to - * have the operation run and false to stop the execution of the operation. - * - * @return - */ - protected boolean prePerformFinish() { - return true; - } - - /** - * Subclasses should override to perform any actions necessary after performing Finish. - */ - protected void postPerformFinish() throws InvocationTargetException { - } - - protected void storeDefaultSettings() { - pageGroupManager.storeDefaultSettings(this); - } - - public void storeDefaultSettings(IWizardPage page) { - if (page instanceof DataModelWizardPage) - ((DataModelWizardPage) page).storeDefaultSettings(); - } - - - /** - * Subclasses may override if they need to do something special when storing the default - * settings for a particular page. - * - * @param page - * @param pageIndex - */ - protected void storeDefaultSettings(IWizardPage page, int pageIndex) { - storeDefaultSettings(page); - } - - /** - * Subclasses should override if the running operation is allowed to be cancelled. The default - * is false. - * - * @return - */ - protected boolean isCancelable() { - return false; - } - - /** - * Subclasses should override to return false if the running operation cannot be run forked. - * - * @return - */ - protected boolean runForked() { - return false; - } - - public void setDataModel(IDataModel model) { - this.dataModel = model; - } - - /** - * @return Returns the model. - */ - public IDataModel getDataModel() { - if (null == dataModel) { - dataModel = DataModelFactory.createDataModel(getDefaultProvider()); - } - - return dataModel; - } - - public void dispose() { - super.dispose(); - if (null != dataModel) { - dataModel.dispose(); - } - } - - /** - * The default is to return a SimplePageGroup. Subclasses may want to overrided this method to - * return a different root page group for the wizard. - * - * @return - */ - protected AddablePageGroup createRootPageGroup() { - String id = getWizardID(); - // For the root page group the wizard id and the group id are the same. - SimplePageGroup pageGroup = new SimplePageGroup(id, id); - pageGroup.setPageHandler(this); - return pageGroup; - } - - /** - * Creates the default environment for this wizard. - * - * @return - */ - protected IEnvironment createEnvironment() { - return new EclipseEnvironment(); - } - - public void addPage(IWizardPage page) { - rootPageGroup.addPage(page); - } - - private void init() { - rootOperation = getRootOperation(); - rootPageGroup = createRootPageGroup(); - pageGroupManager = new PageGroupManager(rootOperation, rootPageGroup); - } - - private class WizardDataModelManagerOperationImpl extends DataModelPausibleOperationImpl { - WizardDataModelManagerOperationImpl(IDataModelOperation rootOperation) { - super(rootOperation); - } - - public IStatus execute(IProgressMonitor monitor, final IAdaptable info) throws ExecutionException { - final IStatus[] status = new IStatus[1]; - class CatchThrowableRunnableWithProgress implements IRunnableWithProgress { - public Throwable caught = null; - - public void run(IProgressMonitor monitor) { - try { - status[0] = WizardDataModelManagerOperationImpl.super.execute(monitor, info); - } catch (Throwable e) { - caught = e; - } - } - } - CatchThrowableRunnableWithProgress runnable = new CatchThrowableRunnableWithProgress(); - try { - getContainer().run(runForked(), isCancelable(), runnable); - } catch (Throwable e) { - runnable.caught = e; - } - if (runnable.caught != null) { - Logger.getLogger().logError(runnable.caught); - ErrorDialog.openError(getShell(), WTPCommonUIResourceHandler.getString(WTPCommonUIResourceHandler.WTPWizard_UI_0, new Object[]{getWindowTitle()}), WTPCommonUIResourceHandler.getString(WTPCommonUIResourceHandler.WTPWizard_UI_1, new Object[]{getWindowTitle()}), runnable.caught, 0, false); //$NON-NLS-1$ //$NON-NLS-2$ - status[0] = new Status(IStatus.ERROR, "id", 0, runnable.caught.getMessage(), runnable.caught); //$NON-NLS-1$ - } - return status[0]; - } - } - - public boolean needsPreviousAndNextButtons() { - return super.needsPreviousAndNextButtons() || getPageGroupManager().hasMultiplePages(); - } - -} diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/datamodel/ui/DataModelWizardFactory.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/datamodel/ui/DataModelWizardFactory.java deleted file mode 100644 index eec76f64d..000000000 --- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/datamodel/ui/DataModelWizardFactory.java +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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.common.frameworks.internal.datamodel.ui; - -import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; -import org.eclipse.wst.common.frameworks.internal.operation.extensionui.DataModelWizardExtensionReader; - -public class DataModelWizardFactory { - - private static DataModelWizardExtensionReader reader; - - /** - * Looks up the appropriate DataModelWizard by the specified id and - * constructs a new DataModelWizard using a new instance of the IDataModel - * looked up with the same id. If the DataModelWizard is not found then a - * RuntimeException is thrown. - * - * @param id - * the id of the DataModelWizard - * @return a new DataModelWizard - */ - public static DataModelWizard createWizard(String id) { - return createWizard(DataModelFactory.createDataModel(id)); - } - - /** - * Looks up the appropriate DataModelWizard using the id retured from - * <code>dataModel.getID()</code>. - * - * @param dataModel - * @return a new DataModelWizard - */ - public static DataModelWizard createWizard(IDataModel dataModel) { - return loadWizard(dataModel); - } - - private static DataModelWizard loadWizard(IDataModel dataModel) { - if (null == reader) { - reader = new DataModelWizardExtensionReader(); - } - return reader.getWizard(dataModel); - } - - /** - * Looks up the appropriate DataModelWizard using the name of the specified - * class as the id. This method is equavalent to - * <code>createWizard(classID.getName())</code>. - * - * @param classID - * the class whose name is the id of the DataModelWizard - * @return a new DataModelWizard - */ - public static DataModelWizard createWizard(Class dataModelProviderID) { - return createWizard(dataModelProviderID.getName()); - } -} diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/datamodel/ui/DataModelWizardPage.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/datamodel/ui/DataModelWizardPage.java deleted file mode 100644 index 87b39437c..000000000 --- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/datamodel/ui/DataModelWizardPage.java +++ /dev/null @@ -1,430 +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 - *******************************************************************************/ - -package org.eclipse.wst.common.frameworks.internal.datamodel.ui; - -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jface.dialogs.IMessageProvider; -import org.eclipse.jface.wizard.IWizard; -import org.eclipse.jface.wizard.IWizardPage; -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Listener; -import org.eclipse.ui.PlatformUI; -import org.eclipse.wst.common.frameworks.datamodel.DataModelEvent; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; -import org.eclipse.wst.common.frameworks.datamodel.IDataModelListener; -import org.eclipse.wst.common.frameworks.internal.ui.ValidationStatus; - -/** - * This class is EXPERIMENTAL and is subject to substantial changes. - */ -public abstract class DataModelWizardPage extends WizardPage implements Listener, IDataModelListener { - protected static final int NEXT = 1; - protected static final int PREVIOUS = 2; - protected static final int COMPOSITE_BORDER = SWT.NULL; - private ValidationStatus status = new ValidationStatus(); - private boolean isValidating = false; - protected boolean isFirstTimeToPage = true; - protected IDataModel model; - private Map validationMap; - private String[] validationPropertyNames; - protected DataModelSynchHelper synchHelper; - private String infopopID; - private DataModelWizard wizard; - private IWizardPage previousPage; - - /** - * J2EEWizardPage constructor comment. - * - * @param pageName - * java.lang.String - */ - protected DataModelWizardPage(IDataModel model, String pageName) { - super(pageName); - this.model = model; - model.addListener(this); - synchHelper = initializeSynchHelper(model); - } - - /** - * @return - */ - public DataModelSynchHelper initializeSynchHelper(IDataModel dm) { - return new DataModelSynchHelper(dm); - } - - /** - * J2EEWizardPage constructor comment. - * - * @param pageName - * java.lang.String - * @param title - * java.lang.String - * @param titleImage - * org.eclipse.jface.resource.ImageDescriptor - */ - protected DataModelWizardPage(IDataModel model, String pageName, String title, org.eclipse.jface.resource.ImageDescriptor titleImage) { - super(pageName, title, titleImage); - this.model = model; - model.addListener(this); - synchHelper = initializeSynchHelper(model); - } - - /** - * Creates the top level control for this dialog page under the given parent composite. This - * method has been abstract and it uses the template pattern to get the correct items setup in - * the correct order. See the set of methods below that are called in this method. - * <p> - * Implementors are responsible for ensuring that the created control can be accessed via - * <code>getControl</code> - * </p> - * - * @param parent - * the parent composite - */ - public final void createControl(org.eclipse.swt.widgets.Composite parent) { - Composite top = createTopLevelComposite(parent); - setControl(top); - setupInfopop(top); - setDefaults(); - addListeners(); - initializeValidationProperties(); - } - - private void initializeValidationProperties() { - validationPropertyNames = getValidationPropertyNames(); - if (validationPropertyNames == null || validationPropertyNames.length == 0) - validationMap = Collections.EMPTY_MAP; - else { - validationMap = new HashMap(validationPropertyNames.length); - for (int i = 0; i < validationPropertyNames.length; i++) - validationMap.put(validationPropertyNames[i], new Integer(i)); - } - } - - public boolean canFlipToNextPage() { - //TODO why is that last getNextPage() call here??? - return isPageComplete() && ((null != wizard && wizard.getPageGroupManager().hasNextPage() || null != getNextPage())); - } - - /* - * (non-Javadoc) Method declared on IWizardPage. - */ - public void setWizard(IWizard newWizard) { - super.setWizard(newWizard); - if(newWizard instanceof DataModelWizard){ - wizard = (DataModelWizard) newWizard; - } - } - - public IWizardPage getPreviousPage() { - return previousPage; - } - - public void setPreviousPage(IWizardPage page) { - super.setPreviousPage(page); - previousPage = page; - } - - /** - * Subclass should return the model property names that need to be validated on this page in the - * order that they should present their messages. - * - * @return - */ - protected abstract String[] getValidationPropertyNames(); - - /** - * Return the top level Composite for this page. - */ - protected abstract Composite createTopLevelComposite(Composite parent); - - /** - * Set up info pop hooks if set. - */ - protected void setupInfopop(Control parent) { - if (getInfopopID() != null) - PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, getInfopopID()); - } - - /** - * Setup the default values for this page. Subclasses should override to provide appropriate - * defaults. - */ - protected void setDefaults() { - restoreDefaultSettings(); - } - - /** - * Subclasses should implement this method if they have default settings that have been stored - * and need to be restored. - * - * @see storeDefaultSettings() - */ - protected void restoreDefaultSettings() { - } - - /** - * Add Listeners to controls at this point to avoid unnecessary events. Subclasses should - * override to add listeners to its controls. - */ - protected void addListeners() { - } - - /** - * The page is being made current and visible. Subclasses may extend. - */ - protected void enter() { - try { - // Check to see if we are moving back one page. - if (null != wizard && wizard.getPreviousPage(wizard.getPageGroupManager().getCurrentPage()) == this) { - wizard.getPageGroupManager().moveBackOnePage(); - } - - validatePage(showValidationErrorsOnEnter()); - } finally { - isFirstTimeToPage = false; - } - } - - /** - * The default behavior is to return true unless it is the first time entering this page in - * which case we check to see if there is a previous page and return true if there is not. - * Subclasses should override if they do not want this default behavior. - */ - protected boolean showValidationErrorsOnEnter() { - return !isFirstTimeToPage(); - } - - /** - * The default behavior is to return true unless it is the first time entering this page in - * which case we check to see if there is a previous page and return true if there is not. - * Subclasses should override if they do not want this default behavior. - * - * @deprecated - use showValidatoinErrorsOnEnter instead - */ - protected boolean shouldValidateOnEnter() { - return showValidationErrorsOnEnter(); - } - - /** - * Exiting the page. Subclasses may extend. - */ - protected void exit() { - } - - protected boolean getStatus(Integer key) { - return status.hasError(key); - } - - /** - * Sent when an event that the receiver has registered for occurs. If a subclass overrides this - * method, it must call super. - * - * @param event - * the event which occurred - */ - public void handleEvent(org.eclipse.swt.widgets.Event event) { - } - - /** - * Set the error message for this page based on the last error in the ValidationStatus. - */ - protected void setErrorMessage() { - String error = status.getLastErrMsg(); - if (error == null) { - if (getErrorMessage() != null) - setErrorMessage((String) null); - String warning = status.getLastWarningMsg(); - if (warning == null) { - if (getMessage() != null && getMessageType() == IMessageProvider.WARNING) - setMessage(null, IMessageProvider.WARNING); - } else if (!warning.equals(getMessage())) - setMessage(warning, IMessageProvider.WARNING); - } else if (!error.equals(getErrorMessage())) - setErrorMessage(error); - } - - protected void setErrorStatus(Integer key, String errorMessage) { - status.setErrorStatus(key, errorMessage); - } - - protected void setWarningStatus(Integer key, String warningMessage) { - status.setWarningStatus(key, warningMessage); - } - - protected void setOKStatus(Integer key) { - status.setOKStatus(key); - } - - /** - * The <code>DialogPage</code> implementation of this <code>IDialogPage</code> method sets - * the control to the given visibility state. Subclasses may extend. - */ - - public void setVisible(boolean visible) { - super.setVisible(visible); - if (visible) { - enter(); - } else - exit(); - } - - /** - * This should be called by the Wizard just prior to running the performFinish operation. - * Subclasses should override to store their default settings. - */ - public void storeDefaultSettings() { - } - - /** - * The page is now being validated. At this time, each control is validated and then the - * controls are updated based on the results in the ValidationStatus which was updated during - * <code>validateControls()</code>. Finally, it will display the last error message and it - * will set the page complete. Subclasses will not typically override this method. - */ - protected void validatePage() { - validatePage(true); - } - - protected void validatePage(boolean showMessage) { - if (!isValidating) { - isValidating = true; - try { - validateControlsBase(); - updateControls(); - if (showMessage) - setErrorMessage(); - setPageComplete(status.getLastErrMsg() == null); - } finally { - isValidating = false; - } - } - } - - /** - * Validate individual controls. Use validation keys to keep track of errors. - * - * @see setOKStatus(Integer) and setErrorMessage(Integer, String) - */ - protected final String validateControlsBase() { - if (!validationMap.isEmpty()) { - String propName; - for (int i = 0; i < validationPropertyNames.length; i++) { - propName = validationPropertyNames[i]; - Integer valKey = (Integer) validationMap.get(propName); - if (valKey != null) - validateProperty(propName, valKey); - if (!getStatus(valKey)) - return propName; - } - } - return null; - } - - /** - * @param propertyName - * @param validationkey - */ - private void validateProperty(String propertyName, Integer validationKey) { - setOKStatus(validationKey); - IStatus status1 = model.validateProperty(propertyName); - if (!status1.isOK()) { - String message = status1.isMultiStatus() ? status1.getChildren()[0].getMessage() : status1.getMessage(); - switch (status1.getSeverity()) { - case IStatus.ERROR : - setErrorStatus(validationKey, message); - break; - case IStatus.WARNING : - setWarningStatus(validationKey, message); - break; - } - } - } - - /** - * Update the enablement of controls after validation. Sublcasses should check the status of - * validation keys to determine enablement. - */ - protected void updateControls() { - } - - /** - * Gets the isFirstTimeToPage. - * - * @return Returns a boolean - */ - protected boolean isFirstTimeToPage() { - return isFirstTimeToPage; - } - - // protected void setJavaStatusMessage(IStatus javaStatus, Integer statusKey, String message) { - // if (javaStatus.getSeverity() == IStatus.WARNING) - // setWarningStatus(statusKey, message); - // else - // setErrorStatus(statusKey, message); - // } - - /** - * @param b - */ - public void setFirstTimeToPage(boolean b) { - isFirstTimeToPage = b; - } - - /* - * If a property changes that we want to validate, force validation on this page. - * - * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModelListener#propertyChanged(java.lang.String, - * java.lang.Object, java.lang.Object) - */ - public void propertyChanged(DataModelEvent event) { - String propertyName = event.getPropertyName(); - if (validationPropertyNames != null && (event.getFlag() == DataModelEvent.VALUE_CHG || (!isPageComplete() && event.getFlag() == DataModelEvent.VALID_VALUES_CHG))) { - for (int i = 0; i < validationPropertyNames.length; i++) { - if (validationPropertyNames[i].equals(propertyName)) { - validatePage(); - break; - } - } - } - } - - /** - * @return Returns the model. - */ - protected IDataModel getDataModel() { - return model; - } - - public void dispose() { - super.dispose(); - if (synchHelper != null) { - synchHelper.dispose(); - synchHelper = null; - } - } - - protected String getInfopopID() { - return infopopID; - } - - public void setInfopopID(String infopopID) { - this.infopopID = infopopID; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/datamodel/ui/IDMPageGroup.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/datamodel/ui/IDMPageGroup.java deleted file mode 100644 index 8f2f4123c..000000000 --- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/datamodel/ui/IDMPageGroup.java +++ /dev/null @@ -1,32 +0,0 @@ -/*************************************************************************************************** - * Copyright (c) 2003, 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.common.frameworks.internal.datamodel.ui; - -import java.util.List; - -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; - -public interface IDMPageGroup -{ - public String getWizardID(); - - public String getPageGroupID(); - - public String getPageGroupInsertionID(); - - public boolean getAllowsExtendedPages(); - - public String getRequiredDataOperationToRun(); - - public List getPages(IDataModel dataModel); - - public IDMPageHandler getPageHandler( IDataModel dataModel ); - - public IDMPageGroupHandler getPageGroupHandler( IDataModel dataModel ); -} diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/datamodel/ui/IDMPageGroupHandler.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/datamodel/ui/IDMPageGroupHandler.java deleted file mode 100644 index c170e5cdf..000000000 --- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/datamodel/ui/IDMPageGroupHandler.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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.common.frameworks.internal.datamodel.ui; - -/** - * - * The wizard framework allows page groups to be inserted after other page group. - * If more than one page group inserts itself after a particular page group it may - * not be deterministic which page group should follow each other. This class - * allows a particular page group to determine the order in which subsequent page - * groups should be ordered. - * - * For example: A page group T has three page groups X, Y, and Z that have registered - * via the wizardPageGroup extension point to follow it. - * The wizard framework will call getNextGroup with: - * - * T.getNextGroup( null, { "X", "Y", "Z" } ) - * - * This method should return either "X", "Y", "Z", or null if no page group - * should follow. If "Y" was returned then a subequent call - * will be made by the framework with: - * - * T.getNextGroup( "Y", { "X", "Y", "Z" } ) - * - * Again this method should return either "X", "Y", "Z", or null if no page - * group should follow this page group "Y". - * - * Note: any page group can have a page group handler associated with it so this method - * call is recursive in nature. For example: the page group Y might have page - * groups Y1, Y2, and Y3 following it. This would result in the following calls: - * - * T.getNextGroup( null, { "X", "Y", "Z" } ) // "Y" is selected using Ts handler. - * Y.getNextGroup( null, { "Y1", "Y2", "Y3" } ) // "Y1" is selected using Ys handler. - * - * For this example Y1 has no page groups following it. - * - * T.getNextGroup( "Y", { "X", "Y", "Z" } ) // null is selected using Ts handler. - * - * For this example, the T handler decided that no page group followed Y not even X or Z. - * - */ -public interface IDMPageGroupHandler -{ - /** - * - * @param currentPageGroupID the current page group ID. This value will be null the first time - * this method is called. - * @param pageGroupIDs a list of page group IDs that follow the page group for this handler. - * @return returns the page group id that should follow currentPageGroupID, or it - * should return null if no page group follows currentPageGroupID. - * - */ - public String getNextPageGroup( String currentPageGroupID, String[] pageGroupIDs ); -} diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/datamodel/ui/IDMPageHandler.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/datamodel/ui/IDMPageHandler.java deleted file mode 100644 index a4419a315..000000000 --- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/datamodel/ui/IDMPageHandler.java +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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.common.frameworks.internal.datamodel.ui; - -/** - * This interface is EXPERIMENTAL and is subject to substantial changes. - */ -public interface IDMPageHandler { - - /** - * return this as the page name if the expectedNextPageName or expectedPreviousPageName should - * be skipped - */ - public static final String SKIP_PAGE = "IDMExtendedPageHandler.SKIP_PAGE"; //$NON-NLS-1$ - - /** - * prefix this string with the name of the page which occurs before the page that should be - * returned. E.G. suppose your page contributions know about pages A, B and C, and you want the - * to skip pages B and C, when going to the next page from A. To do this, return PAGE_AFTER+C. - * The framework will then ask the wizard for the page that normally comes after page C. - * PAGE_BEFORE works similarly. - */ - public static final String PAGE_AFTER = "IDMExtendedPageHandler.PAGE_AFTER"; //$NON-NLS-1$ - - /** - * same as PAGE_AFTER, except for returing the page before. - */ - public static final String PAGE_BEFORE = "IDMExtendedPageHandler.PAGE_BEFORE"; //$NON-NLS-1$ - - /** - * Return the name of the page that should be next - * - * @param currentPageName - * the page the wizard is currently on - * @param expectedNextPageName - * the page that would normally be next - * @return - */ - public String getNextPage(String currentPageName, String expectedNextPageName); - - /** - * Return the name of the page that should be previous - * - * @param currentPageName - * the page the wizard is currently on - * @param expectedNextPageName - * the page that would normally be previous - * @return - */ - public String getPreviousPage(String currentPageName, String expectedPreviousPageName); -} diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/datamodel/ui/SimplePageGroup.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/datamodel/ui/SimplePageGroup.java deleted file mode 100644 index 0e936efef..000000000 --- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/datamodel/ui/SimplePageGroup.java +++ /dev/null @@ -1,102 +0,0 @@ -/*************************************************************************************************** - * Copyright (c) 2003, 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.common.frameworks.internal.datamodel.ui; - -import java.util.List; -import java.util.Set; -import java.util.Vector; - -import org.eclipse.jface.wizard.IWizardPage; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; - -public class SimplePageGroup implements AddablePageGroup { - private String groupID; - private String wizardID; - private boolean allowExtendedPages; - private String requiredDataOperation; - private Set dataModelIDs; - - private IDMPageHandler pageHandler; - private IDMPageGroupHandler pageGroupHandler; - private Vector pages; - - public SimplePageGroup(String groupID, String wizardID, boolean allowExtendedPages, String requireDataOperation) { - this.groupID = groupID; - this.wizardID = wizardID; - this.allowExtendedPages = allowExtendedPages; - this.requiredDataOperation = requireDataOperation; - pages = new Vector(); - } - - public SimplePageGroup(String groupID, String wizardID) { - this(groupID, wizardID, true, null); - } - - public void addPage(IWizardPage page) { - pages.add(page); - } - - public void addPages(IWizardPage[] newPages) { - for (int index = 0; index < newPages.length; index++) { - pages.add(newPages[index]); - } - } - - public boolean getAllowsExtendedPages() { - return allowExtendedPages; - } - - public void setPageGroupHandler(IDMPageGroupHandler handler) { - pageGroupHandler = handler; - } - - public IDMPageGroupHandler getPageGroupHandler(IDataModel dataModel) { - return pageGroupHandler; - } - - public void setPageHandler(IDMPageHandler handler) { - pageHandler = handler; - } - - public IDMPageHandler getPageHandler(IDataModel dataModel) { - return pageHandler; - } - - public List getPages(IDataModel dataModel) { - return pages; - } - - public IWizardPage[] getExtendedPages(IDataModel dataModel) { - return (IWizardPage[]) pages.toArray(new IWizardPage[0]); - } - - public String getPageGroupID() { - return groupID; - } - - public String getPageGroupInsertionID() { - return null; - } - - public String getRequiredDataOperationToRun() { - return requiredDataOperation; - } - - public String getWizardID() { - return wizardID; - } - - public Set getDataModelIDs() { - return dataModelIDs; - } - - public void setDataModelIDs(Set dataModelIDs) { - this.dataModelIDs = dataModelIDs; - } -} diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/dialog/ui/ErrorDialog.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/dialog/ui/ErrorDialog.java deleted file mode 100644 index 620d1364b..000000000 --- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/dialog/ui/ErrorDialog.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 - *******************************************************************************/ -package org.eclipse.wst.common.frameworks.internal.dialog.ui; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.PlatformUI; - - -/** - * A dialog to display one or more errors to the user, as contained in an - * <code>Status</code> object. If an error contains additional detailed - * information then a Details button is automatically supplied, which shows or - * hides an error details viewer when pressed by the user. - * - */ -public class ErrorDialog extends MessageDialog -{ - - /** - * Creates an error dialog. Note that the dialog will have no visual - * representation (no widgets) until it is told to open. - * <p> - * Normally one should use <code>openError</code> to create and open one of - * these. This constructor is useful only if the error object being displayed - * contains child items <it>and</it> you need to specify a mask which will - * be used to filter the displaying of these children. - * </p> - * - * @param parentShell - * the shell under which to create this dialog - * @param dialogTitle - * the title to use for this dialog, or <code>null</code> to - * indicate that the default title should be used - * @param message - * the message to show in this dialog, or <code>null</code> to - * indicate that the error's message should be shown as the - * primary message - * @param status - * the error to show to the user - * @param displayMask - * the mask to use to filter the displaying of child items, as per - * <code>Status.matches</code> - */ - public ErrorDialog( - Shell parentShell, - String dialogTitle, - String message, - IStatus status, - int displayMask) - { - super(parentShell, dialogTitle, message, status, displayMask); - } - - /* - * (non-Javadoc) This should also be overwritten Method declared on Dialog. - */ - protected void createButtonsForButtonBar(Composite parent) - { - // create OK and Details buttons - createButton( - parent, - StatusDialogConstants.OK_ID, - IDialogConstants.OK_LABEL, - true); - if (status.isMultiStatus() || status.getException() != null ) - { - detailsButton = - createButton( - parent, - StatusDialogConstants.DETAILS_ID, - IDialogConstants.SHOW_DETAILS_LABEL, - false); - } - } - - /* - * This is one of the few methods that needs to be overwritten by the - * subclasses. The image names can be found in the Dialog class - */ - protected Image getDialogImage() - { - // create image - return PlatformUI.getWorkbench().getDisplay().getSystemImage(SWT.ICON_ERROR); - } - -} diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/dialog/ui/InfoDialog.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/dialog/ui/InfoDialog.java deleted file mode 100644 index cfc565ad3..000000000 --- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/dialog/ui/InfoDialog.java +++ /dev/null @@ -1,98 +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 - *******************************************************************************/ -package org.eclipse.wst.common.frameworks.internal.dialog.ui; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.PlatformUI; - - -/** - * A dialog to display one or more errors to the user, as contained in an - * <code>Status</code> object. If an error contains additional detailed - * information then a Details button is automatically supplied, which shows or - * hides an error details viewer when pressed by the user. - * - */ -public class InfoDialog extends MessageDialog -{ - /** - * Creates an error dialog. Note that the dialog will have no visual - * representation (no widgets) until it is told to open. - * <p> - * Normally one should use <code>openError</code> to create and open one of - * these. This constructor is useful only if the error object being displayed - * contains child items <it>and</it> you need to specify a mask which will - * be used to filter the displaying of these children. - * </p> - * - * @param parentShell - * the shell under which to create this dialog - * @param dialogTitle - * the title to use for this dialog, or <code>null</code> to - * indicate that the default title should be used - * @param message - * the message to show in this dialog, or <code>null</code> to - * indicate that the error's message should be shown as the - * primary message - * @param status - * the error to show to the user - * @param displayMask - * the mask to use to filter the displaying of child items, as per - * <code>Status.matches</code> - */ - public InfoDialog( - Shell parentShell, - String dialogTitle, - String message, - IStatus status, - int displayMask) - { - super(parentShell, dialogTitle, message, status, displayMask); - } - - /* - * (non-Javadoc) This should also be overwritten Method declared on Dialog. - */ - protected void createButtonsForButtonBar(Composite parent) - { - // create OK and Details buttons - createButton( - parent, - StatusDialogConstants.OK_ID, - IDialogConstants.OK_LABEL, - true); - if (status.isMultiStatus() ) - { - detailsButton = - createButton( - parent, - StatusDialogConstants.DETAILS_ID, - IDialogConstants.SHOW_DETAILS_LABEL, - false); - } - } - - /* - * This is one of the few methods that needs to be overwritten by the - * subclasses. The image names can be found in the Dialog class - */ - protected Image getDialogImage() - { - // create image - return PlatformUI.getWorkbench().getDisplay().getSystemImage(SWT.ICON_INFORMATION); - } - -} diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/dialog/ui/MessageDialog.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/dialog/ui/MessageDialog.java deleted file mode 100644 index 5dc282ada..000000000 --- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/dialog/ui/MessageDialog.java +++ /dev/null @@ -1,636 +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 - *******************************************************************************/ -package org.eclipse.wst.common.frameworks.internal.dialog.ui; - -import java.io.BufferedReader; -import java.io.PrintWriter; -import java.io.StringReader; -import java.io.StringWriter; -import java.util.Arrays; -import java.util.Iterator; -import java.util.Vector; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.jface.resource.JFaceResources; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.graphics.Point; -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.List; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.PlatformUI; -import org.eclipse.wst.common.environment.Choice; - - -/** - * A dialog to display one or more errors to the user, as contained in an - * <code>Status</code> object. If an error contains additional detailed - * information then a Details button is automatically supplied, which shows or - * hides an error details viewer when pressed by the user. - * - */ -public class MessageDialog extends Dialog -{ - protected Composite parent; - - /** - * Reserve room for this many list items. - */ - protected static final int LIST_ITEM_COUNT = 7; - - /** - * The Details button. - */ - protected Button detailsButton; - - /** - * The title of the dialog. - */ - protected String title; - - /** - * The message to display. - */ - protected String message; - - /** - * The SWT list control that displays the error details. - */ - protected List list; - protected Text details; - - /** - * Indicates whether the error details viewer is currently created. - */ - protected boolean listCreated = false; - protected boolean detailsCreated = false; - - /** - * Filter mask for determining which status items to display. - */ - protected int displayMask = 0xFFFF; - - /** - * The main status object. - */ - protected IStatus status; - - private Point savedSize = null; - - /** - * List of the main error object's detailed errors (element type: <code>Status</code>). - */ - protected java.util.List statusList; - /** - * Creates an error dialog. Note that the dialog will have no visual - * representation (no widgets) until it is told to open. - * <p> - * Normally one should use <code>openError</code> to create and open one of - * these. This constructor is useful only if the error object being displayed - * contains child items <it>and</it> you need to specify a mask which will - * be used to filter the displaying of these children. - * </p> - * - * @param parentShell - * the shell under which to create this dialog - * @param dialogTitle - * the title to use for this dialog, or <code>null</code> to - * indicate that the default title should be used - * @param message - * the message to show in this dialog, or <code>null</code> to - * indicate that the error's message should be shown as the - * primary message - * @param status - * the error to show to the user - * @param displayMask - * the mask to use to filter the displaying of child items, as per - * <code>Status.matches</code> - */ - public MessageDialog( - Shell parentShell, - String dialogTitle, - String message, - IStatus status, - int displayMask) - { - super(parentShell); - this.title = dialogTitle == null ? JFaceResources.getString("Problem_Occurred") : //$NON-NLS-1$ - dialogTitle; - this.message = message == null ? status.getMessage() : JFaceResources.format("Reason", new Object[] { message, status.getMessage()}); //$NON-NLS-1$ - this.status = status; - statusList = Arrays.asList(status.getChildren()); - this.displayMask = displayMask; - setShellStyle(SWT.DIALOG_TRIM | SWT.RESIZE | SWT.APPLICATION_MODAL); - } - /* - * (non-Javadoc) Method declared on Dialog. Handles the pressing of the Ok or - * Details button in this dialog. If the Ok button was pressed then close - * this dialog. If the Details button was pressed then toggle the displaying - * of the error details area. Note that the Details button will only be - * visible if the error being displayed specifies child details. - */ - protected void buttonPressed(int id) - { - if (id == StatusDialogConstants.DETAILS_ID) - { // was the details button pressed? - toggleDetailsArea(); - } - else - { - super.buttonPressed(id); - } - } - /* - * (non-Javadoc) Method declared in Window. - */ - protected void configureShell(Shell shell) - { - super.configureShell(shell); - shell.setText(title); - } - /* - * (non-Javadoc) This should also be overwritten Method declared on Dialog. - */ - protected void createButtonsForButtonBar(Composite parent) - { - // create OK and Details buttons - createButton( - parent, - StatusDialogConstants.OK_ID, - IDialogConstants.OK_LABEL, - true); - if (status.isMultiStatus() || status.getException() != null ) - { - detailsButton = - createButton( - parent, - StatusDialogConstants.DETAILS_ID, - IDialogConstants.SHOW_DETAILS_LABEL, - false); - } - - parent.setLayoutData( new GridData( GridData.FILL_HORIZONTAL )); - } - - /* - * This is one of the few methods that needs to be overwritten by the - * subclasses. The image names can be found in the Dialog class - */ - protected Image getDialogImage() - { - // create image - return PlatformUI.getWorkbench().getDisplay().getSystemImage(SWT.ICON_INFORMATION); - } - - /* - * (non-Javadoc) Method declared on Dialog. Creates and returns the contents - * of the upper part of the dialog (above the button bar). - */ - protected Control createDialogArea(Composite parent) - { - this.parent = parent; - - // create composite - Composite composite = (Composite) super.createDialogArea(parent); - Composite imageAndLabel = new Composite(composite, SWT.NONE); - GridLayout gl = new GridLayout(); - gl.numColumns = 2; - imageAndLabel.setLayout(gl); - composite.setLayoutData( new GridData( GridData.FILL_HORIZONTAL )); - - // create image - Image image = getDialogImage(); - if (image != null) - { - Label label = new Label(imageAndLabel, 0); - image.setBackground(label.getBackground()); - label.setImage(image); - label.setLayoutData( - new GridData( - GridData.HORIZONTAL_ALIGN_CENTER - | GridData.VERTICAL_ALIGN_BEGINNING)); - } - - // create message - if (message != null) - { - Text text = new Text(imageAndLabel, SWT.READ_ONLY|SWT.WRAP); - text.setText(message); - GridData data = - new GridData( - GridData.GRAB_HORIZONTAL - | GridData.GRAB_VERTICAL - | GridData.HORIZONTAL_ALIGN_FILL - | GridData.VERTICAL_ALIGN_CENTER); - data.widthHint = - convertHorizontalDLUsToPixels( - IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH); - - text.setLayoutData(data); - text.setFont(parent.getFont()); - } - - return composite; - } - - protected List createDropDownList(Composite parent) - { - // create the list - list = new List(parent, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL); - - // fill the list - populateList(list); - - GridData data = - new GridData( - GridData.HORIZONTAL_ALIGN_FILL - | GridData.GRAB_HORIZONTAL - | GridData.VERTICAL_ALIGN_FILL - | GridData.GRAB_VERTICAL); - data.heightHint = list.getItemHeight() * LIST_ITEM_COUNT; - list.setLayoutData(data); - listCreated = true; - return list; - } - protected Text createDropDownDetails(Composite parent) - { - details = new Text(parent, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.READ_ONLY); - //details.setEditable(false); - Color color = new Color(parent.getShell().getDisplay(), 255, 255, 255); - details.setBackground(color); - populateDetails(details, status, 0); - GridData data = - new GridData( - GridData.HORIZONTAL_ALIGN_FILL - | GridData.GRAB_HORIZONTAL - | GridData.VERTICAL_ALIGN_FILL - | GridData.GRAB_VERTICAL); - details.setLayoutData(data); - details.setSelection(0); - detailsCreated = true; - return details; - } - /* - * (non-Javadoc) Method declared on Window. - */ - /** - * Extends <code>Window.open()</code>. Opens an error dialog to display - * the error. If you specified a mask to filter the displaying of these - * children, the error dialog will only be displayed if there is at least one - * child status matching the mask. - */ - public int open() - { - if (shouldDisplay(status, displayMask)) - { - return super.open(); - } - return 0; - } - /** - * This essentially does the work of a factory Opens an error dialog to - * display the given error. Use this method if the error object being - * displayed does not contain child items, or if you wish to display all such - * items without filtering. - * - * @param parent - * the parent shell of the dialog, or <code>null</code> if none - * @param dialogTitle - * the title to use for this dialog, or <code>null</code> to - * indicate that the default title should be used - * @param message - * the message to show in this dialog, or <code>null</code> to - * indicate that the error's message should be shown as the - * primary message - * @param status - * the error to show to the user - * @return the code of the button that was pressed that resulted in this - * dialog closing. This will be <code>Dialog.OK</code> if the OK - * button was pressed, or <code>Dialog.CANCEL</code> if this - * dialog's close window decoration or the ESC key was used. - */ - public static int openMessage( - Shell parent, - String dialogTitle, - String message, - IStatus status) - { - - switch (status.getSeverity()) - { - case IStatus.INFO : - return openInfo( - parent, - dialogTitle, - message, - status, - IStatus.OK | IStatus.INFO | IStatus.WARNING | IStatus.ERROR); - case IStatus.WARNING : - return openWarning( - parent, - dialogTitle, - message, - status, - IStatus.OK | IStatus.INFO | IStatus.WARNING | IStatus.ERROR); - default : - return openError( - parent, - dialogTitle, - message, - status, - IStatus.OK | IStatus.INFO | IStatus.WARNING | IStatus.ERROR); - } - - } - - public static int openMessage( - Shell parent, - String dialogTitle, - String message, - IStatus status, - Choice[] options) - { - - return openOptions( - parent, - dialogTitle, - message, - status, - IStatus.OK | IStatus.INFO | IStatus.WARNING | IStatus.ERROR, - options); - } - - /** - * Opens an error dialog to display the given error. Use this method if the - * error object being displayed contains child items <it>and</it> you wish - * to specify a mask which will be used to filter the displaying of these - * children. The error dialog will only be displayed if there is at least one - * child status matching the mask. - * - * @param parentShell - * the parent shell of the dialog, or <code>null</code> if none - * @param dialogTitle - * the title to use for this dialog, or <code>null</code> to - * indicate that the default title should be used - * @param message - * the message to show in this dialog, or <code>null</code> to - * indicate that the error's message should be shown as the - * primary message - * @param status - * the error to show to the user - * @param displayMask - * the mask to use to filter the displaying of child items, as per - * <code>Status.matches</code> - * @return the code of the button that was pressed that resulted in this - * dialog closing. This will be <code>Dialog.OK</code> if the OK - * button was pressed, or <code>Dialog.CANCEL</code> if this - * dialog's close window decoration or the ESC key was used. - */ - public static int openError( - Shell parentShell, - String title, - String message, - IStatus status, - int displayMask) - { - ErrorDialog dialog = - new ErrorDialog(parentShell, title, message, status, displayMask); - return dialog.open(); - } - - public static int openInfo( - Shell parentShell, - String title, - String message, - IStatus status, - int displayMask) - { - InfoDialog dialog = - new InfoDialog(parentShell, title, message, status, displayMask); - return dialog.open(); - } - - public static int openWarning( - Shell parentShell, - String title, - String message, - IStatus status, - int displayMask) - { - WarningDialog dialog = - new WarningDialog(parentShell, title, message, status, displayMask); - return dialog.open(); - } - - public static int openOptions( - Shell parentShell, - String title, - String message, - IStatus status, - int displayMask, - Choice[] options) - { - OptionsDialog dialog = - new OptionsDialog( - parentShell, - title, - message, - status, - displayMask, - options); - dialog.open(); - return dialog.getReturnCode(); - } - - /** - * Populates the list using this error dialog's status object. This walks the - * child stati of the status object and displays them in a list. The format - * for each entry is status_path : status_message If the status's path was - * null then it (and the colon) are omitted. - */ - private void populateList(List list) - { - Iterator enumeration = statusList.iterator(); - while (enumeration.hasNext()) - { - IStatus childStatus = (IStatus) enumeration.next(); - populateList(list, childStatus, 0); - } - } - private void populateList(List list, IStatus status, int nesting) - { - if (!status.matches(displayMask)) - { - return; - } - StringBuffer sb = new StringBuffer(); - for (int i = 0; i < nesting; i++) - { - sb.append(" "); - } - sb.append(status.getMessage()); - list.add(sb.toString()); - IStatus[] children = status.getChildren(); - for (int i = 0; i < children.length; i++) - { - populateList(list, children[i], nesting + 1); - } - } - private void populateDetails(Text text, IStatus status, int nesting) - { - if (!status.matches(displayMask)) - { - return; - } - - String tabChars = repeat( ' ', nesting * 2 ); - String messageLine = tabChars + status.getMessage() + System.getProperty("line.separator"); - Throwable except = status.getException(); - - text.append( messageLine ); - - if( except != null ) - { - String[] trace = getStackTrace( except ); - - for( int index = 0; index < trace.length; index++ ) - { - text.append( tabChars + " " + trace[index] + System.getProperty("line.separator") ); - } - } - - IStatus[] children = status.getChildren(); - for (int i = 0; i < children.length; i++) - { - populateDetails(text, children[i], nesting + 1); - } - } - /** - * Returns whether the given status object should be displayed. - * - * @param status - * a status object - * @param mask - * a mask as per <code>Status.matches</code> - * @return <code>true</code> if the given status should be displayed, and - * <code>false</code> otherwise - */ - protected static boolean shouldDisplay(IStatus status, int mask) - { - IStatus[] children = status.getChildren(); - if (children == null || children.length == 0) - { - return status.matches(mask); - } - for (int i = 0; i < children.length; i++) - { - if (children[i].matches(mask)) - return true; - } - return false; - } - /** - * Toggles the unfolding of the details area. This is triggered by the user - * pressing the details button. - */ - private void toggleDetailsArea() - { - Point windowSize = getShell().getSize(); - int newHeight = -1; - - if (detailsCreated) - { - details.dispose(); - detailsCreated = false; - detailsButton.setText(IDialogConstants.SHOW_DETAILS_LABEL); - - // Without the following computeSize call the setSize call below throws an array out of bounds exception. - // Very weird. - getContents().computeSize(SWT.DEFAULT, SWT.DEFAULT); - - newHeight = savedSize.y; - } - else - { - if( savedSize == null ) savedSize = windowSize; - - details = createDropDownDetails((Composite) getContents()); - detailsButton.setText(IDialogConstants.HIDE_DETAILS_LABEL); - newHeight = getContents().computeSize(SWT.DEFAULT, SWT.DEFAULT).y; - } - - - newHeight = newHeight > 400 ? 400 : newHeight; - - getShell().setSize( new Point(windowSize.x, newHeight) ); - } - - private String[] getStackTrace( Throwable exc ) - { - Vector lines = new Vector(); - StringWriter stringWriter = new StringWriter(); - PrintWriter printWriter = new PrintWriter( stringWriter ); - - exc.printStackTrace( printWriter ); - - try - { - printWriter.close(); - stringWriter.close(); - } - catch( Exception nestedExc ) - { - return new String[0]; - } - - StringReader stringReader = new StringReader( stringWriter.toString() ); - BufferedReader reader = new BufferedReader( stringReader ); - String line = null; - - try - { - line = reader.readLine(); - - while( line != null ) - { - lines.add( line.trim() ); - line = reader.readLine(); - } - } - catch( Exception nestedExc ) - { - return new String[0]; - } - - return (String[])lines.toArray( new String[0] ); - } - - private String repeat( char the_char, int count ) - { - StringBuffer buf = new StringBuffer( count ); - - for( int index = 0; index < count; index++ ) - { - buf.append( the_char ); - } - - return buf.toString(); - } - -} diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/dialog/ui/OptionsDialog.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/dialog/ui/OptionsDialog.java deleted file mode 100644 index 21869b239..000000000 --- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/dialog/ui/OptionsDialog.java +++ /dev/null @@ -1,107 +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 - *******************************************************************************/ -package org.eclipse.wst.common.frameworks.internal.dialog.ui; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.PlatformUI; -import org.eclipse.wst.common.environment.Choice; - - -/** - * A dialog to display one or more errors to the user, as contained in an - * <code>Status</code> object. If an error contains additional detailed - * information then a Details button is automatically supplied, which shows or - * hides an error details viewer when pressed by the user. - * - */ -public class OptionsDialog extends MessageDialog -{ - private Choice[] choices; - private int returnCode_; - - public OptionsDialog( - Shell parentShell, - String dialogTitle, - String message, - IStatus status, - int displayMask, - Choice[] choices) - { - super(parentShell, dialogTitle, message, status, displayMask); - this.choices = choices; - } - - /* - * (non-Javadoc) This should also be overwritten Method declared on Dialog. - */ - protected void createButtonsForButtonBar(Composite parent) - { - // create a button for each options - for (int i = 0; i < choices.length; i++) - { - createButton(parent, choices[i].getShortcut(), choices[i].getLabel(), true); - } - if (status.isMultiStatus() ) - { - detailsButton = - createButton( - parent, - StatusDialogConstants.DETAILS_ID, - IDialogConstants.SHOW_DETAILS_LABEL, - false); - } - } - - protected void buttonPressed(int id) - { - if (id == StatusDialogConstants.DETAILS_ID) - // was the Details button pressed? - super.buttonPressed(id); - else - { - setReturnCode(id); - close(); - } - } - - protected void setReturnCode(int id) - { - returnCode_ = id; - } - - public int getReturnCode() - { - return returnCode_; - } - /* - * This is one of the few methods that needs to be overwritten by the - * subclasses. The image names can be found in the Dialog class - */ - protected Image getDialogImage() - { - // create image - switch (status.getSeverity()) - { - case IStatus.INFO : - return PlatformUI.getWorkbench().getDisplay().getSystemImage(SWT.ICON_INFORMATION); - case IStatus.WARNING : - return PlatformUI.getWorkbench().getDisplay().getSystemImage(SWT.ICON_WARNING); - default : - return PlatformUI.getWorkbench().getDisplay().getSystemImage(SWT.ICON_ERROR); - } - } - -} diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/dialog/ui/StatusDialogConstants.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/dialog/ui/StatusDialogConstants.java deleted file mode 100644 index e3ca36bc2..000000000 --- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/dialog/ui/StatusDialogConstants.java +++ /dev/null @@ -1,51 +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 - *******************************************************************************/ -package org.eclipse.wst.common.frameworks.internal.dialog.ui; - -/** -* Constants for status dialogs -*/ -public interface StatusDialogConstants { - - /* - * Button ID for the "Yes" button - */ - public static final int YES_ID = 2; - /* - * Button ID for the "Yes to all" button - */ - public static final int YES_TO_ALL_ID = 4; - /* - * Button ID for the "Cancel" button - */ - public static final int CANCEL_ID = 1; - /* - * Button ID for the "OK" button - */ - public static final int OK_ID = 0; - /* - * Button ID for the "Details" button - */ - public static final int DETAILS_ID = 13; - - /* - * Button label for the "Yes" button - */ - // public static final String YES_LABEL = EnvironmentPlugin.getInstance().getMessage("%STATUS_DIALOG_YES_LABEL"); - /* - * Button label for the "Yes to all" button - */ - // public static final String YES_TO_ALL_LABEL = EnvironmentPlugin.getInstance().getMessage("%STATUS_DIALOG_YES_TO_ALL_LABEL"); - /* - * Button label for the "Cancel" button - */ - // public static final String CANCEL_LABEL = EnvironmentPlugin.getInstance().getMessage("%STATUS_DIALOG_CANCEL_LABEL"); -} diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/dialog/ui/WarningDialog.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/dialog/ui/WarningDialog.java deleted file mode 100644 index 6c66d8249..000000000 --- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/dialog/ui/WarningDialog.java +++ /dev/null @@ -1,103 +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 - *******************************************************************************/ -package org.eclipse.wst.common.frameworks.internal.dialog.ui; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.PlatformUI; - - -/** - * A dialog to display one or more errors to the user, as contained in an - * <code>Status</code> object. If an error contains additional detailed - * information then a Details button is automatically supplied, which shows or - * hides an error details viewer when pressed by the user. - * - */ -public class WarningDialog extends MessageDialog -{ - /** - * Creates an error dialog. Note that the dialog will have no visual - * representation (no widgets) until it is told to open. - * <p> - * Normally one should use <code>openError</code> to create and open one of - * these. This constructor is useful only if the error object being displayed - * contains child items <it>and</it> you need to specify a mask which will - * be used to filter the displaying of these children. - * </p> - * - * @param parentShell - * the shell under which to create this dialog - * @param dialogTitle - * the title to use for this dialog, or <code>null</code> to - * indicate that the default title should be used - * @param message - * the message to show in this dialog, or <code>null</code> to - * indicate that the error's message should be shown as the - * primary message - * @param status - * the error to show to the user - * @param displayMask - * the mask to use to filter the displaying of child items, as per - * <code>Status.matches</code> - */ - public WarningDialog( - Shell parentShell, - String dialogTitle, - String message, - IStatus status, - int displayMask) - { - super(parentShell, dialogTitle, message, status, displayMask); - } - - /* - * (non-Javadoc) This should also be overwritten Method declared on Dialog. - */ - protected void createButtonsForButtonBar(Composite parent) - { - // create OK, Cancel and Details buttons - createButton( - parent, - StatusDialogConstants.OK_ID, - IDialogConstants.OK_LABEL, - true); - createButton( - parent, - StatusDialogConstants.CANCEL_ID, - IDialogConstants.CANCEL_LABEL, - false); - if (status.isMultiStatus()) - { - detailsButton = - createButton( - parent, - StatusDialogConstants.DETAILS_ID, - IDialogConstants.SHOW_DETAILS_LABEL, - false); - } - } - - /* - * This is one of the few methods that needs to be overwritten by the - * subclasses. The image names can be found in the Dialog class - */ - protected Image getDialogImage() - { - // create image - return PlatformUI.getWorkbench().getDisplay().getSystemImage(SWT.ICON_WARNING); - } - -} diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/eclipse/ui/EclipseEnvironment.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/eclipse/ui/EclipseEnvironment.java deleted file mode 100644 index 42f20ec7c..000000000 --- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/eclipse/ui/EclipseEnvironment.java +++ /dev/null @@ -1,79 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 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.common.frameworks.internal.eclipse.ui; - -import org.eclipse.wst.common.environment.EnvironmentService; -import org.eclipse.wst.common.environment.IEnvironment; -import org.eclipse.wst.common.environment.ILog; -import org.eclipse.wst.common.environment.IStatusHandler; -import org.eclipse.wst.common.environment.uri.IURIFactory; -import org.eclipse.wst.common.environment.uri.IURIScheme; -import org.eclipse.wst.common.environment.uri.SimpleURIFactory; - - -/** - * This class implements an IEnvironment class for the Eclipse IEnvironment. - * This IEnvironment currently supports the "platform" protocol and the "file" - * protocol. - * - */ -public class EclipseEnvironment implements IEnvironment -{ - private SimpleURIFactory uriFactory_ = null; - private IStatusHandler statusHandler_ = null; - private ILog logger_ = null; - - public EclipseEnvironment() - { - this( new EclipseStatusHandler() ); - } - - public EclipseEnvironment( IStatusHandler statusHandler ) - { - IURIScheme eclipseScheme = EnvironmentService.getEclipseScheme(); - IURIScheme fileScheme = EnvironmentService.getFileScheme(); - - uriFactory_ = new SimpleURIFactory(); - statusHandler_ = statusHandler; - - uriFactory_.registerScheme( "platform", eclipseScheme ); - uriFactory_.registerScheme( "file", fileScheme ); - } - - /** - * @see org.eclipse.wst.common.environment.IEnvironment#getLog() - */ - public ILog getLog() - { - if( logger_ == null ) - { - logger_ = EnvironmentService.getEclipseLog(); - }; - - return logger_; - } - - /** - * @see org.eclipse.wst.common.environment.IEnvironment#getStatusHandler() - */ - public IStatusHandler getStatusHandler() - { - return statusHandler_; - } - - /** (non-Javadoc) - * @see org.eclipse.wst.common.environment.IEnvironment#getURIFactory() - */ - public IURIFactory getURIFactory() - { - return uriFactory_; - } -} diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/eclipse/ui/EclipseStatusHandler.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/eclipse/ui/EclipseStatusHandler.java deleted file mode 100644 index a8dc82e28..000000000 --- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/eclipse/ui/EclipseStatusHandler.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 - *******************************************************************************/ -package org.eclipse.wst.common.frameworks.internal.eclipse.ui; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.wst.common.environment.Choice; -import org.eclipse.wst.common.environment.StatusException; -import org.eclipse.wst.common.environment.IStatusHandler; -import org.eclipse.wst.common.frameworks.internal.dialog.ui.MessageDialog; -import org.eclipse.wst.common.frameworks.internal.dialog.ui.StatusDialogConstants; - - -/** - * This is the Eclipse UI version of the IStatusHandler - */ -public class EclipseStatusHandler implements IStatusHandler -{ - private Shell shell_; - - public EclipseStatusHandler() - { - this( new Shell() ); - } - - public EclipseStatusHandler(Shell shell) - { - shell_ = shell; - } - - /** - * @see org.eclipse.env.common.IStatusHandler#report(org.eclipse.env.common.Status, org.eclipse.env.common.Choice[]) - */ - public Choice report(IStatus status, Choice[] choices) - { - int result = - MessageDialog.openMessage( - shell_, - Messages.TITLE_WARNING, - null, - status, - choices); - for (int i = 0; i < choices.length; i++) - { - if (choices[i].getShortcut() == result) - return choices[i]; - } - - return null; - } - - /** - * @see org.eclipse.env.common.IStatusHandler#report(org.eclipse.env.common.Status) - */ - public void report(IStatus status) throws StatusException - { - boolean userOk = false; - - switch (status.getSeverity()) - { - // an error has been reported and we need to stop executing the comming - // commands - case Status.ERROR : - { - userOk = reportErrorStatus(status); - break; - } - case Status.WARNING : - { - userOk = reportWarning(status); - break; - } - case Status.INFO : - { - userOk = true; - reportInfo(status); - break; - } - } - - if( !userOk ) throw new StatusException( status ); - } - - private boolean reportWarning(IStatus status) - { - int userResponse = - MessageDialog.openMessage( - shell_, - Messages.TITLE_WARNING, - null, - status); - return (userResponse == StatusDialogConstants.OK_ID); - } - - private boolean reportErrorStatus(IStatus status) - { - MessageDialog.openMessage( - shell_, - Messages.TITLE_ERROR, - null, - status); - return false; - } - - /** - * @see org.eclipse.wst.common.environment.IStatusHandler#reportError(org.eclipse.core.runtime.IStatus) - */ - public void reportError(IStatus status) - { - reportErrorStatus( status ); - } - - /** - * @see org.eclipse.wst.common.environment.IStatusHandler#reportInfo(org.eclipse.core.runtime.IStatus) - */ - public void reportInfo(IStatus status) - { - MessageDialog.openMessage( - shell_, - Messages.TITLE_INFO, - null, - status); - } -} diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/eclipse/ui/Messages.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/eclipse/ui/Messages.java deleted file mode 100644 index 09b2188ec..000000000 --- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/eclipse/ui/Messages.java +++ /dev/null @@ -1,25 +0,0 @@ -/*************************************************************************************************** - * Copyright (c) 2003, 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.common.frameworks.internal.eclipse.ui; - -import org.eclipse.osgi.util.NLS; - -public class Messages extends NLS -{ - private static final String BUNDLE_NAME = "org.eclipse.wst.common.frameworks.internal.eclipse.ui.environment"; - - public static String TITLE_WARNING; - public static String TITLE_ERROR; - public static String TITLE_INFO; - - static - { - NLS.initializeMessages( BUNDLE_NAME, Messages.class ); - } -} diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/eclipse/ui/environment.properties b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/eclipse/ui/environment.properties deleted file mode 100644 index eefde94e3..000000000 --- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/eclipse/ui/environment.properties +++ /dev/null @@ -1,17 +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 -############################################################################### - -TITLE_WARNING=Warning: -TITLE_ERROR=Error: -TITLE_INFO=Info: - - - diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/operation/extensionui/CommonUIPluginConstants.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/operation/extensionui/CommonUIPluginConstants.java deleted file mode 100644 index 60b55eb58..000000000 --- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/operation/extensionui/CommonUIPluginConstants.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on Jan 16, 2004 - * - * To change the template for this generated file go to - * Window - Preferences - Java - Code Generation - Code and Comments - */ -package org.eclipse.wst.common.frameworks.internal.operation.extensionui; - -/** - * @author blancett - * - * To change the template for this generated type comment go to Window - Preferences - Java - Code - * Generation - Code and Comments - */ -public interface CommonUIPluginConstants { - public static final String PLUGIN_ID = "org.eclipse.wst.common.frameworks.ui"; //$NON-NLS-1$ - -} diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/operation/extensionui/DMWizardExtensionFactory.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/operation/extensionui/DMWizardExtensionFactory.java deleted file mode 100644 index b9f0cff3a..000000000 --- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/operation/extensionui/DMWizardExtensionFactory.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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.common.frameworks.internal.operation.extensionui; - -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; -import org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelWizardPage; -import org.eclipse.wst.common.frameworks.internal.datamodel.ui.IDMPageGroupHandler; -import org.eclipse.wst.common.frameworks.internal.datamodel.ui.IDMPageHandler; - -/** - * This interface is EXPERIMENTAL and is subject to substantial changes. - */ -public abstract class DMWizardExtensionFactory { - - public DMWizardExtensionFactory() { - super(); - } - - public abstract DataModelWizardPage[] createPageGroup(IDataModel dataModel, String pageGroupID); - - /* - * this is optional - */ - public IDMPageHandler createPageHandler(IDataModel dataModel, String pageGroupID) - { - return null; - } - - /** - * This page group handler can be optionally overriden. - */ - public IDMPageGroupHandler createPageGroupHandler( IDataModel dataModel, String pageGroupID ) - { - return null; - } -} diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/operation/extensionui/DMWizardPageElement.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/operation/extensionui/DMWizardPageElement.java deleted file mode 100644 index ca112b253..000000000 --- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/operation/extensionui/DMWizardPageElement.java +++ /dev/null @@ -1,270 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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.common.frameworks.internal.operation.extensionui; - -import java.util.HashSet; -import java.util.Set; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.jem.util.logger.proxy.Logger; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; -import org.eclipse.wst.common.frameworks.internal.AbstractRegistryDescriptor; -import org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelWizardPage; -import org.eclipse.wst.common.frameworks.internal.datamodel.ui.IDMPageGroupHandler; -import org.eclipse.wst.common.frameworks.internal.datamodel.ui.IDMPageHandler; -import org.eclipse.wst.common.frameworks.internal.enablement.IdentifiableComparator; - -public class DMWizardPageElement extends AbstractRegistryDescriptor implements Comparable { - static final String ELEMENT_PAGE_GROUP = "wizardPageGroup"; //$NON-NLS-1$ - static final String ATT_PAGE_ID = "pageGroupID"; //$NON-NLS-1$ - static final String ATT_WIZARD_ID = "wizardID"; //$NON-NLS-1$ - static final String ATT_REQUIRES_DATA_OPERATION_ID = "requiresDataOperationId"; //$NON-NLS-1$ - static final String ATT_DATA_MODEL_IDS = "dataModelIds"; //$NON-NLS-1$ - static final String ATT_ALLOWS_EXTENDED_PAGES_AFTER = "allowsExtendedPagesAfter"; //$NON-NLS-1$ - static final String ATT_PAGE_INSERTION_ID = "pageGroupInsertionID"; //$NON-NLS-1$ - static final String ELEMENT_FACTORY = "factory"; //$NON-NLS-1$ - - protected DMWizardPageFactoryElement wizardPageFactoryElement; - protected String pluginID; - protected String wizardID; - public String pageGroupID; - protected String wizardFactoryElement; - protected boolean allowsExtendedPagesAfter; - protected String requiresDataOperationId; - protected Set dataModelIDs; - protected String pageInsertionID; - private int loadOrder; - private static int loadOrderCounter; - - - private int type; - - public DMWizardPageElement(IConfigurationElement element1) { - super(element1); - pluginID = element1.getDeclaringExtension().getNamespace(); - wizardID = element1.getAttribute(ATT_WIZARD_ID); - pageGroupID = element1.getAttribute(ATT_PAGE_ID); - requiresDataOperationId = element1.getAttribute(ATT_REQUIRES_DATA_OPERATION_ID); - dataModelIDs = getDataModelIds( element1 ); - readAllowsExtendedPageAfter(element1); - pageInsertionID = element1.getAttribute(ATT_PAGE_INSERTION_ID); - readFactory(element1); - validateSettings(); - loadOrder = loadOrderCounter++; - } - - private Set getDataModelIds(IConfigurationElement element ) - { - HashSet ids = new HashSet(); - String idList = element.getAttribute(ATT_DATA_MODEL_IDS); - - if( idList != null ) - { - String[] dataModelIDs = idList.split( " *"); - - for( int index = 0; index < dataModelIDs.length; index++ ) - { - ids.add( dataModelIDs[index] ); - } - } - - return ids; - } - - private void validateSettings() { - if (wizardID == null || wizardPageFactoryElement == null) { - Logger.getLogger().logError("Incomplete page extension specification."); //$NON-NLS-1$ - } - } - - - private void readAllowsExtendedPageAfter(IConfigurationElement element1) { - String allowsPageAfterValue = element1.getAttribute(ATT_ALLOWS_EXTENDED_PAGES_AFTER); - allowsExtendedPagesAfter = allowsPageAfterValue == null ? false : Boolean.valueOf(allowsPageAfterValue).booleanValue(); - } - - private void readFactory(IConfigurationElement element1) { - IConfigurationElement[] factories = element1.getChildren(ELEMENT_FACTORY); - if (factories != null && factories.length > 0) { - wizardPageFactoryElement = new DMWizardPageFactoryElement(factories[0], pageGroupID); - } - } - - public IDMPageHandler createPageHandler(IDataModel dataModel) { - if (wizardPageFactoryElement != null) - return wizardPageFactoryElement.createPageHandler(dataModel); - return null; - } - - public DataModelWizardPage[] createPageGroup(IDataModel dataModel) { - if (wizardPageFactoryElement != null) - return wizardPageFactoryElement.createPageGroup(dataModel); - return null; - } - - public IDMPageGroupHandler createPageGroupHandler(IDataModel dataModel) { - return wizardPageFactoryElement == null ? null : wizardPageFactoryElement.createPageGroupHandler(dataModel); - } - - public int compareTo(Object o) { - return IdentifiableComparator.getInstance().compare(this, o); - /* - * if (o == null) return GREATER_THAN; WizardPageElement element = (WizardPageElement) o; if - * (getID() == null && element.getID() == null) return compareLoadOrder(element); if - * (getID() == null) return GREATER_THAN; else if (element.getID() == null) return - * LESS_THAN; - * - * int priority = getPriority(); int elementPriority =element.getPriority(); - * - * if (priority == elementPriority) return compareLoadOrder(element); if (priority < - * elementPriority) return GREATER_THAN; if (priority > elementPriority) return LESS_THAN; - * return EQUAL; - */ - } - - /** - * @return - */ - public boolean allowsExtendedPagesAfter() { - return allowsExtendedPagesAfter; - } - - /** - * @return - */ - public String getPluginID() { - return pluginID; - } - - /** - * @return - */ - public String getPageID() { - return pageGroupID; - } - - /** - * @return - */ - public String getPageInsertionID() { - return pageInsertionID; - } - - /** - * @return - */ - public int getType() { - return type; - } - - /** - * @return - */ - public int getLoadOrder() { - return loadOrder; - } - - - /** - * @return Returns the allowsExtendedPagesAfter. - */ - public boolean isAllowsExtendedPagesAfter() { - return allowsExtendedPagesAfter; - } - - /** - * @param allowsExtendedPagesAfter - * The allowsExtendedPagesAfter to set. - */ - public void setAllowsExtendedPagesAfter(boolean allowsExtendedPagesAfter) { - this.allowsExtendedPagesAfter = allowsExtendedPagesAfter; - } - - public String getRequiresDataOperationId() { - return requiresDataOperationId; - } - - - public void setRequiresDataOperationId(String dataOperationId) { - requiresDataOperationId = dataOperationId; - } - - public Set getDataModelIDs() { - return dataModelIDs; - } - - public void setDataModelID(Set newDataModelIDs) { - dataModelIDs = newDataModelIDs; - } - - /** - * @return Returns the wizardFactoryElement. - */ - public String getWizardFactoryElement() { - return wizardFactoryElement; - } - - /** - * @param wizardFactoryElement - * The wizardFactoryElement to set. - */ - public void setWizardFactoryElement(String wizardFactoryElement) { - this.wizardFactoryElement = wizardFactoryElement; - } - - /** - * @return Returns the wizardID. - */ - public String getWizardID() { - return wizardID; - } - - /** - * @param wizardID - * The wizardID to set. - */ - public void setWizardID(String wizardID) { - this.wizardID = wizardID; - } - - /** - * @return Returns the wizardPageFactoryElement. - */ - public DMWizardPageFactoryElement getWizardPageFactoryElement() { - return wizardPageFactoryElement; - } - - /** - * @param wizardPageFactoryElement - * The wizardPageFactoryElement to set. - */ - public void setWizardPageFactoryElement(DMWizardPageFactoryElement wizardPageFactoryElement) { - this.wizardPageFactoryElement = wizardPageFactoryElement; - } - - - /** - * @param pageID - * The pageID to set. - */ - public void setPageID(String pageID) { - this.pageGroupID = pageID; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.frameworks.internal.AbstractRegistryDescriptor#getID() - */ - public String getID() { - return getPageID(); - } - -} diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/operation/extensionui/DMWizardPageExtensionManager.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/operation/extensionui/DMWizardPageExtensionManager.java deleted file mode 100644 index e8908af90..000000000 --- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/operation/extensionui/DMWizardPageExtensionManager.java +++ /dev/null @@ -1,279 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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.common.frameworks.internal.operation.extensionui; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Set; -import java.util.TreeMap; -import java.util.TreeSet; - -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IExtensionPoint; -import org.eclipse.core.runtime.Platform; -import org.eclipse.jem.util.RegistryReader; -import org.eclipse.jem.util.logger.proxy.Logger; -import org.eclipse.wst.common.frameworks.internal.enablement.EnablementManager; -import org.eclipse.wst.common.frameworks.internal.ui.WTPCommonUIResourceHandler; - -public class DMWizardPageExtensionManager { - - public static final String ORG_ECLIPSE_UI = "org.eclipse.ui"; //$NON-NLS-1$ - - protected static DMWizardPageExtensionManager instance = null; - - HashMap wizardPluginIDMap = null; - - TreeMap wizardPageElements = null; - - // private TreeSet wizardExtPageElements = null; - List nonSyncedPageElementList = null; - - private WizardPageExtensionReader reader = null; - - private DMWizardPageExtensionManager() { - setupWizardPluginIDMap(); - readFromRegistry(); - postReadFromRegistry(); - } - - private void setupWizardPluginIDMap() { - wizardPluginIDMap = new HashMap(); - // get editor plugin and save it to a hash map - // Note: editors extension id is different from editor id - - IExtensionPoint[] point = new IExtensionPoint[]{Platform.getExtensionRegistry().getExtensionPoint(ORG_ECLIPSE_UI, "exportWizards"), //$NON-NLS-1$ - Platform.getExtensionRegistry().getExtensionPoint(ORG_ECLIPSE_UI, "importWizards"), //$NON-NLS-1$ - Platform.getExtensionRegistry().getExtensionPoint(ORG_ECLIPSE_UI, "newWizards"), //$NON-NLS-1$ - Platform.getExtensionRegistry().getExtensionPoint("org.eclipse.wst.common.frameworks.ui", "extendableWizard")}; //$NON-NLS-1$ //$NON-NLS-2$ - - for (int x = 0; x < point.length; x++) { - IConfigurationElement[] elements = point[x].getConfigurationElements(); - for (int i = 0; i < elements.length; i++) { - String wizardID = elements[i].getAttribute("id"); //$NON-NLS-1$ - String pluginID = elements[i].getDeclaringExtension().getNamespace(); - wizardPluginIDMap.put(wizardID, pluginID); - } - } - } - - private void readFromRegistry() { - wizardPageElements = new TreeMap(); - // wizardExtPageElements = new TreeSet(); - nonSyncedPageElementList = new ArrayList(); - // Read all page extensions into editorPageElements - reader = new WizardPageExtensionReader(); - reader.readRegistry(); - - } - - protected class WizardPageExtensionReader extends RegistryReader { - - public WizardPageExtensionReader() { - super(CommonUIPluginConstants.PLUGIN_ID, DMWizardPageElement.ELEMENT_PAGE_GROUP); - } - - public boolean readElement(IConfigurationElement element) { - if (!DMWizardPageElement.ELEMENT_PAGE_GROUP.equals(element.getName())) - return false; - DMWizardPageElement newElement = new DMWizardPageElement(element); - - // put the element into a hashmap, wizardID as key, - // list of page elements as object - String wizardID = newElement.getWizardID(); - if (!wizardPageElements.containsKey(wizardID)) { - wizardPageElements.put(wizardID, createPageMapEntry(newElement)); - } else { - TreeMap pageMap = (TreeMap) wizardPageElements.get(wizardID); - insertPageElement(pageMap, newElement); - } - - return true; - } - - public void insertPageElement(TreeMap pageMap, DMWizardPageElement newElement) { - if (newElement.pageInsertionID == null) { - pageMap.put(newElement, new TreeSet()); - } else { - String elementName = newElement.pageInsertionID; - DMWizardPageElement parentElement = getPageElement(elementName, pageMap); - insertExtPageElement(pageMap, parentElement, newElement); - } - - newElement.getPageInsertionID(); - - } - - private void insertExtPageElement(TreeMap pageMap, DMWizardPageElement parentElement, DMWizardPageElement newElement) { - if (parentElement == null) { - nonSyncedPageElementList.add(newElement); - return; - } - if (!parentElement.allowsExtendedPagesAfter()) { - Logger.getLogger().logError(WTPCommonUIResourceHandler.getString(WTPCommonUIResourceHandler.WizardPageExtensionManager_UI_0, new Object[]{parentElement.getPageID()})); //$NON-NLS-1$ - Logger.getLogger().logError(WTPCommonUIResourceHandler.getString(WTPCommonUIResourceHandler.WizardPageExtensionManager_UI_1, new Object[]{newElement.getPageID()})); //$NON-NLS-1$ - return; - } - TreeSet set = (TreeSet) pageMap.get(parentElement); - set.add(newElement); - - if (newElement.allowsExtendedPagesAfter) - pageMap.put(newElement, new TreeSet()); - - if (nonSyncedPageElementList.contains(newElement)) - nonSyncedPageElementList.remove(newElement); - } - - private DMWizardPageElement getPageElement(String elementName, TreeMap map) { - Set keySet = map.keySet(); - for (Iterator iter = keySet.iterator(); iter.hasNext();) { - DMWizardPageElement element = (DMWizardPageElement) iter.next(); - if (element.getPageID().equals(elementName)) - return element; - } - return null; - - } - - private TreeMap createPageMapEntry(DMWizardPageElement newElement) { - TreeMap pageMap = new TreeMap(); - TreeSet pageExtensionSet = new TreeSet(); - pageMap.put(newElement, pageExtensionSet); - return pageMap; - - } - - } - - public boolean hasExtensionElements(String wizardID) { - TreeMap treeMap = (TreeMap) wizardPageElements.get(wizardID); - return treeMap.isEmpty(); - } - - public DMWizardPageElement[] getPageElements(String wizardID) { - TreeMap elementMap = (TreeMap) wizardPageElements.get(wizardID); - if (elementMap == null || elementMap.isEmpty()) { - return new DMWizardPageElement[0]; - } - ArrayList alreadyVistedList = new ArrayList(elementMap.size()); - Set allPageElementsList = elementMap.keySet(); - ArrayList orderedPageList = new ArrayList(elementMap.size()); - - for (Iterator iter = allPageElementsList.iterator(); iter.hasNext();) { - DMWizardPageElement element = (DMWizardPageElement) iter.next(); - if (alreadyVistedList.contains(element)) - continue; - if (EnablementManager.INSTANCE.getIdentifier(element.getID(), null).isEnabled()) { - orderedPageList.add(element); - TreeSet treeSet = (TreeSet) elementMap.get(element); - if (treeSet != null && !treeSet.isEmpty()) - flatenTreeSet(treeSet, allPageElementsList, alreadyVistedList, orderedPageList, elementMap); - } - } - return getPageArray(orderedPageList); - - } - - private DMWizardPageElement[] getPageArray(ArrayList orderedPageList) { - DMWizardPageElement[] pageElements = new DMWizardPageElement[orderedPageList.size()]; - for (int i = 0; i < orderedPageList.size(); i++) { - pageElements[i] = (DMWizardPageElement) orderedPageList.get(i); - } - return pageElements; - } - - private void flatenTreeSet(TreeSet treeSet, Set allPageElementsList, ArrayList alreadyVistedList, ArrayList orderedPageList, TreeMap elementMap) { - for (Iterator iter = treeSet.iterator(); iter.hasNext();) { - DMWizardPageElement element = (DMWizardPageElement) iter.next(); - if (alreadyVistedList.contains(element)) { - Logger.getLogger().logError(WTPCommonUIResourceHandler.getString(WTPCommonUIResourceHandler.WizardPageExtensionManager_UI_2, new Object[]{element.getPageID(), DMWizardPageElement.ATT_PAGE_INSERTION_ID})); //$NON-NLS-1$ - return; - } - if (allPageElementsList.contains(element)) { - TreeSet set = (TreeSet) elementMap.get(element); - orderedPageList.add(element); - alreadyVistedList.add(element); - flatenTreeSet(set, allPageElementsList, alreadyVistedList, orderedPageList, elementMap); - } else { - orderedPageList.add(element); - alreadyVistedList.add(element); - } - - } - - } - - // if child elements are read in before parent element. Do post read. - protected ArrayList listRemoveObjects; - - private void postReadFromRegistry() { - listRemoveObjects = new ArrayList(nonSyncedPageElementList.size()); - for (int i = 0; i < nonSyncedPageElementList.size(); i++) { - DMWizardPageElement element = (DMWizardPageElement) nonSyncedPageElementList.get(i); - TreeMap pageMap = (TreeMap) wizardPageElements.get(element.wizardID); - if (element.pageInsertionID == null) { - addToFirstAvialiable(pageMap, element); - } else if (reader != null && pageMap != null) - reader.insertPageElement(pageMap, element); - } - nonSyncedPageElementList.removeAll(listRemoveObjects); - if (!nonSyncedPageElementList.isEmpty()) - logMissingClassError(); - nonSyncedPageElementList.clear(); - - } - - /** - * @param pageMap - * @param element - */ - private void addToFirstAvialiable(TreeMap pageMap, DMWizardPageElement newElement) { - boolean insertNotFound = true; - for (Iterator iter = pageMap.keySet().iterator(); iter.hasNext();) { - DMWizardPageElement element = (DMWizardPageElement) iter.next(); - if (element.allowsExtendedPagesAfter) { - TreeSet set = (TreeSet) pageMap.get(element); - set.add(newElement); - listRemoveObjects.add(newElement); - return; - } - } - if (insertNotFound) { - Logger logger = Logger.getLogger(); - logger.logError(WTPCommonUIResourceHandler.WizardPageExtensionManager_UI_3); //$NON-NLS-1$ - } - - } - - private void logMissingClassError() { - Logger logger = Logger.getLogger(); - for (int i = 0; i < nonSyncedPageElementList.size(); i++) { - DMWizardPageElement element = (DMWizardPageElement) nonSyncedPageElementList.get(i); - logger.logError(WTPCommonUIResourceHandler.getString(WTPCommonUIResourceHandler.WizardPageExtensionManager_UI_4, new Object[]{element.pageInsertionID, element.getPageID(), element.pluginID})); //$NON-NLS-1$ - } - nonSyncedPageElementList.clear(); - - } - - /** - * Gets the instance. - * - * @return Returns a EjbPageExtensionRegistry - */ - public static DMWizardPageExtensionManager getInstance() { - if (instance == null) { - instance = new DMWizardPageExtensionManager(); - } - return instance; - } -} diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/operation/extensionui/DMWizardPageFactoryElement.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/operation/extensionui/DMWizardPageFactoryElement.java deleted file mode 100644 index 17a766cbd..000000000 --- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/operation/extensionui/DMWizardPageFactoryElement.java +++ /dev/null @@ -1,96 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on Oct 20, 2003 - * - * To change the template for this generated file go to - * Window>Preferences>Java>Code Generation>Code and Comments - */ -package org.eclipse.wst.common.frameworks.internal.operation.extensionui; - - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.jem.util.logger.proxy.Logger; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; -import org.eclipse.wst.common.frameworks.internal.ConfigurationElementWrapper; -import org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelWizardPage; -import org.eclipse.wst.common.frameworks.internal.datamodel.ui.IDMPageGroupHandler; -import org.eclipse.wst.common.frameworks.internal.datamodel.ui.IDMPageHandler; - -/** - * @author schacher - * - * To change the template for this generated type comment go to Window>Preferences>Java>Code - * Generation>Code and Comments - */ -public class DMWizardPageFactoryElement extends ConfigurationElementWrapper { - - static final String ATT_CLASS_NAME = "className"; //$NON-NLS-1$ - - protected String className; - protected DMWizardExtensionFactory wizardPageFactory; - protected boolean isPageFactoryInitialized; - protected String pageGroupID; - - /** - * @param element - */ - public DMWizardPageFactoryElement(IConfigurationElement element, String pageGroupID) { - super(element); - className = element.getAttribute(ATT_CLASS_NAME); - this.pageGroupID = pageGroupID; - } - - public IDMPageHandler createPageHandler(IDataModel dataModel) { - if (!isPageFactoryInitialized) - initPageFactory(); - if (wizardPageFactory == null) - return null; - - IDMPageHandler handler = wizardPageFactory.createPageHandler(dataModel, pageGroupID); - return handler; - } - - public DataModelWizardPage[] createPageGroup(IDataModel dataModel) { - if (!isPageFactoryInitialized) - initPageFactory(); - - if (wizardPageFactory == null) - return null; - - DataModelWizardPage[] pages = wizardPageFactory.createPageGroup(dataModel, pageGroupID); - - return pages; - } - - public IDMPageGroupHandler createPageGroupHandler( IDataModel dataModel ) - { - if (!isPageFactoryInitialized) initPageFactory(); - - if( wizardPageFactory == null ) return null; - - return wizardPageFactory.createPageGroupHandler( dataModel, pageGroupID ); - } - - private void initPageFactory() { - try { - wizardPageFactory = (DMWizardExtensionFactory) element.createExecutableExtension(ATT_CLASS_NAME); - } catch (CoreException e) { - Logger.getLogger().logError("Error getting page factory: " + className); //$NON-NLS-1$ - Logger.getLogger().logError(e); - } finally { - isPageFactoryInitialized = true; - } - } - - -} diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/operation/extensionui/DataModelWizardExtensionReader.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/operation/extensionui/DataModelWizardExtensionReader.java deleted file mode 100644 index 5ce7b7394..000000000 --- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/operation/extensionui/DataModelWizardExtensionReader.java +++ /dev/null @@ -1,84 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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.common.frameworks.internal.operation.extensionui; - -import java.util.HashMap; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.jem.util.RegistryReader; -import org.eclipse.jem.util.logger.proxy.Logger; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; -import org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelWizard; -import org.eclipse.wst.common.frameworks.internal.ui.WTPUIPlugin; - -public class DataModelWizardExtensionReader extends RegistryReader { - - private static final String EXTENSION = "DataModelWizardExtension"; //$NON-NLS-1$ - private static final String ELEMENT = "DataModelWizard"; //$NON-NLS-1$ - private static final String ATTRIBUTE_ID = "id"; //$NON-NLS-1$ - private static final String ATTRIBUTE_CLASS = "class"; //$NON-NLS-1$ - - private HashMap extensions; - - public DataModelWizardExtensionReader() { - super(WTPUIPlugin.PLUGIN_ID, EXTENSION); - } - - public boolean readElement(IConfigurationElement element) { - if (!element.getName().equals(ELEMENT)) - return false; - String id = element.getAttribute(ATTRIBUTE_ID); - if (null == id || id.trim().length() == 0) { - Logger.getLogger().logError(new RuntimeException("Extension:" + EXTENSION + " Element:" + ELEMENT + " is missing " + ATTRIBUTE_ID)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - } - String className = element.getAttribute(ATTRIBUTE_CLASS); - if (null == className || className.trim().length() == 0) { - Logger.getLogger().logError(new RuntimeException("Extension:" + EXTENSION + " Element:" + ELEMENT + " is missing " + ATTRIBUTE_CLASS)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - } - addExtension(id, element); - return true; - } - - private void addExtension(String id, IConfigurationElement element) { - if (extensions.containsKey(id)) { - Logger.getLogger().logError(new RuntimeException("Duplicate " + ELEMENT + " " + ATTRIBUTE_ID + " " + id)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - } - extensions.put(id, element); - } - - protected IConfigurationElement getExtension(String id) { - if (extensions == null) { - extensions = new HashMap(); - readRegistry(); - } - IConfigurationElement element = (IConfigurationElement) extensions.get(id); - if (null == element) { - throw new RuntimeException("Extension:" + EXTENSION + " Element:" + ELEMENT + " not found for " + ATTRIBUTE_ID + ": " + id); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - } - return element; - } - - public DataModelWizard getWizard(IDataModel dataModel) { - DataModelWizard wizard = null; - IConfigurationElement element = getExtension(dataModel.getID()); - - try { - wizard = (DataModelWizard) element.createExecutableExtension(ATTRIBUTE_CLASS); - wizard.setDataModel(dataModel); - } catch (CoreException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - return wizard; - } -} diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/operation/extensionui/ExtensibleViewRegistry.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/operation/extensionui/ExtensibleViewRegistry.java deleted file mode 100644 index c6aee2c37..000000000 --- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/operation/extensionui/ExtensibleViewRegistry.java +++ /dev/null @@ -1,177 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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.common.frameworks.internal.operation.extensionui; - -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.jem.util.RegistryReader; -import org.eclipse.wst.common.frameworks.internal.ui.WTPUIPlugin; - - -/** - * @author mdelder - */ -public class ExtensibleViewRegistry extends RegistryReader { - - private static ExtensibleViewRegistry INSTANCE = null; - private Map extendedViewerMap = null; - private Map descriptorMap = null; - - protected interface Elements { - public static final String EXTENDED_VIEWER = "extendedViewer"; //$NON-NLS-1$ - public static final String VIEWER_ID = "viewerID"; //$NON-NLS-1$ - public static final String PARENT_VIEWER_ID = "parentViewerID"; //$NON-NLS-1$ - public static final String FACTORY_CLASS = "factoryClass"; //$NON-NLS-1$ - public static final String ICON = "icon"; //$NON-NLS-1$ - public static final String LABEL = "label"; //$NON-NLS-1$ - public static final String FUNCTION_GROUP_ID = "functionGroupID"; //$NON-NLS-1$ - } - - /** - * - */ - private ExtensibleViewRegistry() { - super(WTPUIPlugin.PLUGIN_ID, WTPUIPlugin.EXTENDED_VIEWER_REGISTRY_EXTENSION_POINT); - } - - public static ExtensibleViewRegistry getInstance() { - if (INSTANCE == null) { - INSTANCE = new ExtensibleViewRegistry(); - INSTANCE.readRegistry(); - } - return INSTANCE; - } - - public Descriptor getDescriptor(String viewerID) { - return (Descriptor) getDescriptorMap().get(viewerID); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.internal.registry.RegistryReader#readElement(org.eclipse.core.runtime.IConfigurationElement) - */ - public boolean readElement(IConfigurationElement element) { - if (element.getName().equals(Elements.EXTENDED_VIEWER)) { - Descriptor descriptor = new Descriptor(element); - getDescriptorMap().put(descriptor.getViewerID(), descriptor); - return true; - } - return false; - } - - /** - * @return Returns the extendedViewerMap. - */ - protected Map getExtendedViewerMap() { - if (extendedViewerMap == null) - extendedViewerMap = new HashMap(); - return extendedViewerMap; - } - - /** - * @return Returns the descriptorMap. - */ - protected Map getDescriptorMap() { - if (descriptorMap == null) - descriptorMap = new HashMap(); - return descriptorMap; - } - - public class Descriptor { - - private String viewerID = null; - private String parentViewerID = null; - private String factoryClass = null; - private String icon = null; - private String label = null; - private String functionGroupID = null; - - private String toStringCache = null; - private IConfigurationElement element = null; - - /** - * - */ - public Descriptor(IConfigurationElement element) { - this.element = element; - - this.viewerID = this.element.getAttribute(ExtensibleViewRegistry.Elements.VIEWER_ID); - this.parentViewerID = this.element.getAttribute(ExtensibleViewRegistry.Elements.PARENT_VIEWER_ID); - this.factoryClass = this.element.getAttribute(ExtensibleViewRegistry.Elements.FACTORY_CLASS); - this.icon = this.element.getAttribute(ExtensibleViewRegistry.Elements.ICON); - this.label = this.element.getAttribute(ExtensibleViewRegistry.Elements.LABEL); - this.functionGroupID = this.element.getAttribute(ExtensibleViewRegistry.Elements.FUNCTION_GROUP_ID); - } - - public IExtensibleViewFactory createFactoryInstance() { - IExtensibleViewFactory factoryInstance = null; - try { - factoryInstance = (IExtensibleViewFactory) this.element.createExecutableExtension(getFactoryClass()); - } catch (CoreException e) { - WTPUIPlugin.getLogger().logError(e); - } - return factoryInstance; - } - - /** - * @return Returns the factoryClass. - */ - public String getFactoryClass() { - return factoryClass; - } - - /** - * @return Returns the functionGroupID. - */ - public String getFunctionGroupID() { - return functionGroupID; - } - - /** - * @return Returns the icon. - */ - public String getIcon() { - return icon; - } - - /** - * @return Returns the label. - */ - public String getLabel() { - return label; - } - - /** - * @return Returns the parentViewerID. - */ - public String getParentViewerID() { - return parentViewerID; - } - - /** - * @return Returns the viewerID. - */ - public String getViewerID() { - return viewerID; - } - - public String toString() { - if (toStringCache == null) - toStringCache = "ExtensibleViewRegistry.Info [viewerID=\"" + getViewerID() + "\",parentViewerID=\"" + getParentViewerID() + "\",factoryClass=" + getFactoryClass() + "\",functionGroupID=\"" + getFunctionGroupID() + "\"]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ - return toStringCache; - } - } - -} diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/operation/extensionui/IExtensibleViewFactory.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/operation/extensionui/IExtensibleViewFactory.java deleted file mode 100644 index 261938ba4..000000000 --- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/operation/extensionui/IExtensibleViewFactory.java +++ /dev/null @@ -1,21 +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 - *******************************************************************************/ - -package org.eclipse.wst.common.frameworks.internal.operation.extensionui; - -/** - * @author mdelder - */ -public interface IExtensibleViewFactory { - - - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/operation/extensionui/IOperationNode.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/operation/extensionui/IOperationNode.java deleted file mode 100644 index 747b5ca80..000000000 --- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/operation/extensionui/IOperationNode.java +++ /dev/null @@ -1,48 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2004 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 - *******************************************************************************/ -/* - * Created on May 5, 2004 - * - * TODO To change the template for this generated file go to Window - - * Preferences - Java - Code Generation - Code and Comments - */ -package org.eclipse.wst.common.frameworks.internal.operation.extensionui; - -/** - * @author mdelder - * - * TODO To change the template for this generated type comment go to Window - Preferences - Java - - * Code Generation - Code and Comments - */ -public interface IOperationNode { - - public IOperationNode[] getChildren(); - - public boolean isChecked(); - - /** - * Same as calling setChecked(checked, true) - * - * @param checked - */ - public void setChecked(boolean checked); - - public String getName(); - - public String getDescription(); - - public IOperationNode getParent(); - - /** - * @return - */ - public boolean isAlwaysExecute(); -}
\ No newline at end of file diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/AbstractWTPUIPlugin.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/AbstractWTPUIPlugin.java deleted file mode 100644 index 583f298b0..000000000 --- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/AbstractWTPUIPlugin.java +++ /dev/null @@ -1,66 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on Dec 10, 2003 - * - * To change the template for this generated file go to Window - Preferences - Java - Code - * Generation - Code and Comments - */ -package org.eclipse.wst.common.frameworks.internal.ui; - -import java.util.ResourceBundle; - -import org.eclipse.jem.util.logger.proxy.Logger; -import org.eclipse.jem.util.logger.proxyrender.DefaultPluginTraceRenderer; -import org.eclipse.jem.util.logger.proxyrender.IMsgLogger; -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.osgi.framework.BundleContext; - -public abstract class AbstractWTPUIPlugin extends AbstractUIPlugin implements IMsgLogger { - protected static Logger logger = null; - public ResourceBundle resourceBundle; - protected static AbstractWTPUIPlugin instance = null; - - /** - * @param descriptor - */ - public AbstractWTPUIPlugin() { - super(); - instance = this; - } - - public Logger getMsgLogger() { - if (logger == null) { - logger = Logger.getLogger(getPluginID()); - setRenderer(logger); - } - return logger; - } - - public abstract String getPluginID(); - - /** - * @param aLogger - */ - protected void setRenderer(Logger aLogger) { - new DefaultPluginTraceRenderer(aLogger); - } - - - /* - * (non-Javadoc) - * - * @see org.eclipse.core.runtime.Plugin#startup() - */ - public void start(BundleContext context) throws Exception { - super.start(context); - } -} diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/ClosableWizardDialog.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/ClosableWizardDialog.java deleted file mode 100644 index 7316c8b64..000000000 --- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/ClosableWizardDialog.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2004 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 - *******************************************************************************/ -/* - * Created on Mar 24, 2004 - * - * To change the template for this generated file go to - * Window>Preferences>Java>Code Generation>Code and Comments - */ -package org.eclipse.wst.common.frameworks.internal.ui; - -import org.eclipse.jface.wizard.IWizard; -import org.eclipse.jface.wizard.WizardDialog; -import org.eclipse.swt.widgets.Shell; - -/** - * @author DABERG - * - * To change the template for this generated type comment go to Window>Preferences>Java>Code - * Generation>Code and Comments - */ -public class ClosableWizardDialog extends WizardDialog { - /** - * @param parentShell - * @param newWizard - */ - public ClosableWizardDialog(Shell parentShell, IWizard newWizard) { - super(parentShell, newWizard); - } - - public void finishAndClose() { - super.finishPressed(); - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/DMPageGroupElementImpl.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/DMPageGroupElementImpl.java deleted file mode 100644 index 22caa6d55..000000000 --- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/DMPageGroupElementImpl.java +++ /dev/null @@ -1,67 +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.common.frameworks.internal.ui; - -import java.util.Arrays; -import java.util.List; -import java.util.Set; - -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; -import org.eclipse.wst.common.frameworks.internal.datamodel.ui.IDMPageGroup; -import org.eclipse.wst.common.frameworks.internal.datamodel.ui.IDMPageGroupHandler; -import org.eclipse.wst.common.frameworks.internal.datamodel.ui.IDMPageHandler; -import org.eclipse.wst.common.frameworks.internal.operation.extensionui.DMWizardPageElement; - -public class DMPageGroupElementImpl implements IDMPageGroup { - private DMWizardPageElement pageElement; - - public DMPageGroupElementImpl(IConfigurationElement element) { - pageElement = new DMWizardPageElement(element); - } - - public boolean getAllowsExtendedPages() { - return pageElement.allowsExtendedPagesAfter(); - } - - public String getRequiredDataOperationToRun() { - return pageElement.getRequiresDataOperationId(); - } - - public Set getDataModelIDs() { - return pageElement.getDataModelIDs(); - } - - public IDMPageGroupHandler getPageGroupHandler(IDataModel dataModel) { - return pageElement.createPageGroupHandler(dataModel); - } - - public List getPages(IDataModel dataModel){ - return Arrays.asList(pageElement.createPageGroup(dataModel)); - } - - public IDMPageHandler getPageHandler(IDataModel dataModel) { - return pageElement.createPageHandler(dataModel); - } - - public String getPageGroupID() { - return pageElement.getPageID(); - } - - public String getPageGroupInsertionID() { - return pageElement.getPageInsertionID(); - } - - public String getWizardID() { - return pageElement.getWizardID(); - } - -} diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/DisplayUtility.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/DisplayUtility.java deleted file mode 100644 index 647f58e59..000000000 --- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/DisplayUtility.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2004 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 - *******************************************************************************/ -/* - * Created on Apr 19, 2004 - * - * TODO To change the template for this generated file go to - * Window - Preferences - Java - Code Generation - Code and Comments - */ -package org.eclipse.wst.common.frameworks.internal.ui; - -import org.eclipse.swt.widgets.Display; - -/** - * @author mdelder - */ -public class DisplayUtility { - - public static void asyncExec(Runnable runnable) { - - Display d = Display.getCurrent(); - if (d == null) - Display.getDefault().asyncExec(runnable); - else - runnable.run(); - - } - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/ErrorDialog.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/ErrorDialog.java deleted file mode 100644 index 6c24426e0..000000000 --- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/ErrorDialog.java +++ /dev/null @@ -1,191 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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.common.frameworks.internal.ui; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.PrintStream; - -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.swt.SWT; -import org.eclipse.swt.SWTError; -import org.eclipse.swt.SWTException; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; - -/** - * Added a Details button to the MessageDialog to show the exception stack trace. - * - * Borrowed from an eclipse InternalErrorDialog - */ -public class ErrorDialog extends MessageDialog { - protected static final String[] LABELS_OK = {IDialogConstants.OK_LABEL}; - protected static final String[] LABELS_OK_CANCEL = {IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL}; - protected static final String[] LABELS_OK_DETAILS = {IDialogConstants.OK_LABEL, IDialogConstants.SHOW_DETAILS_LABEL}; - protected static final String[] LABELS_OK_CANCEL_DETAILS = {IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL, IDialogConstants.SHOW_DETAILS_LABEL}; - private Throwable detail; - private int detailButtonID = -1; - private Text text; - private String message; - //Workaround. SWT does not seem to set the default button if - //there is not control with focus. Bug: 14668 - private int defaultButtonIndex = 0; - /** - * Size of the text in lines. - */ - private static final int TEXT_LINE_COUNT = 15; - - public ErrorDialog(Shell parentShell, String dialogTitle, Image dialogTitleImage, String dialogMessage, Throwable detail, int dialogImageType, String[] dialogButtonLabels, int defaultIndex) { - super(parentShell, dialogTitle, dialogTitleImage, dialogMessage, dialogImageType, dialogButtonLabels, defaultIndex); - defaultButtonIndex = defaultIndex; - this.detail = detail; - message = dialogMessage; - setShellStyle(getShellStyle() | SWT.APPLICATION_MODAL | SWT.RESIZE); - } - - //Workaround. SWT does not seem to set rigth the default button if - //there is not control with focus. Bug: 14668 - public int open() { - create(); - Button b = getButton(defaultButtonIndex); - b.setFocus(); - b.getShell().setDefaultButton(b); - return super.open(); - } - - /** - * Set the detail button; - */ - public void setDetailButton(int index) { - detailButtonID = index; - } - - /* - * (non-Javadoc) Method declared on Dialog. - */ - protected void buttonPressed(int buttonId) { - if (buttonId == detailButtonID) { - toggleDetailsArea(); - } else { - setReturnCode(buttonId); - close(); - } - } - - /** - * Toggles the unfolding of the details area. This is triggered by the user pressing the details - * button. - */ - private void toggleDetailsArea() { - Point windowSize = getShell().getSize(); - Point oldSize = getContents().computeSize(SWT.DEFAULT, SWT.DEFAULT); - if (text != null) { - text.dispose(); - text = null; - getButton(detailButtonID).setText(IDialogConstants.SHOW_DETAILS_LABEL); - } else { - createDropDownText((Composite) getContents()); - getButton(detailButtonID).setText(IDialogConstants.HIDE_DETAILS_LABEL); - } - Point newSize = getContents().computeSize(SWT.DEFAULT, SWT.DEFAULT); - getShell().setSize(new Point(windowSize.x, windowSize.y + (newSize.y - oldSize.y))); - } - - /** - * Create this dialog's drop-down list component. - * - * @param parent - * the parent composite - * @return the drop-down list component - */ - protected void createDropDownText(Composite parent) { - // create the list - text = new Text(parent, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL); - // print the stacktrace in the text field - try { - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - PrintStream ps = new PrintStream(baos); - detail.printStackTrace(ps); - if ((detail instanceof SWTError) && (((SWTError) detail).throwable != null)) { - ps.println("\n*** Stack trace of contained exception ***"); //$NON-NLS-1$ - ((SWTError) detail).throwable.printStackTrace(ps); - } else if ((detail instanceof SWTException) && (((SWTException) detail).throwable != null)) { - ps.println("\n*** Stack trace of contained exception ***"); //$NON-NLS-1$ - ((SWTException) detail).throwable.printStackTrace(ps); - } - ps.flush(); - baos.flush(); - text.setText(baos.toString()); - } catch (IOException e) { - } - GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL | GridData.GRAB_VERTICAL); - data.heightHint = text.getLineHeight() * TEXT_LINE_COUNT; - text.setLayoutData(data); - } - - public static boolean openError(Shell parent, String title, String message, Throwable detail, int defaultIndex, boolean showCancel) { - String[] labels; - if (detail == null) - labels = showCancel ? LABELS_OK_CANCEL : LABELS_OK; - else - labels = showCancel ? LABELS_OK_CANCEL_DETAILS : LABELS_OK_DETAILS; - ErrorDialog dialog = new ErrorDialog(parent, title, null, // accept - // the - // default - // window - // icon - message, detail, ERROR, labels, defaultIndex); - if (detail != null) - dialog.setDetailButton(labels.length - 1); - return dialog.open() == 0; - } - - protected Control createDialogArea(Composite parent) { - // create a composite with standard margins and spacing - Composite composite = new Composite(parent, SWT.NONE); - GridLayout layout = new GridLayout(); - layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); - layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); - layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); - layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); - composite.setLayout(layout); - composite.setLayoutData(new GridData(GridData.FILL_BOTH)); - composite.setFont(parent.getFont()); - ((GridLayout) composite.getLayout()).numColumns = 2; - // create image - Image image = composite.getDisplay().getSystemImage(SWT.ICON_ERROR); - if (image != null) { - Label label = new Label(composite, 0); - image.setBackground(label.getBackground()); - label.setImage(image); - label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER | GridData.VERTICAL_ALIGN_BEGINNING)); - } - // create message - if (message != null) { - Label label = new Label(composite, SWT.WRAP); - label.setText(message); - GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER); - data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH); - label.setLayoutData(data); - label.setFont(parent.getFont()); - } - return composite; - } -} diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/ExecutionListener.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/ExecutionListener.java deleted file mode 100644 index 2cc778a48..000000000 --- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/ExecutionListener.java +++ /dev/null @@ -1,18 +0,0 @@ -/*************************************************************************************************** - * Copyright (c) 2003, 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.common.frameworks.internal.ui; - -import org.eclipse.core.runtime.IStatus; - -public interface ExecutionListener -{ - public IStatus execute(); - - public void undoExecute(); -} diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/GenericWizardNode.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/GenericWizardNode.java deleted file mode 100644 index 60769c2ec..000000000 --- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/GenericWizardNode.java +++ /dev/null @@ -1,73 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 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.common.frameworks.internal.ui; - -import org.eclipse.jface.wizard.IWizard; -import org.eclipse.jface.wizard.IWizardNode; -import org.eclipse.swt.graphics.Point; - -/** - * @version 1.0 - * @author - */ -public abstract class GenericWizardNode implements IWizardNode { - - protected IWizard wizard; - - /** - * Constructor for GenericWizardNode. - */ - public GenericWizardNode() { - super(); - } - - /* - * @see IWizardNode#dispose() - */ - public void dispose() { - if (wizard != null) - wizard.dispose(); - } - - /* - * @see IWizardNode#getContents() - */ - public Point getContents() { - return null; - } - - public final IWizard getWizard() { - if (wizard == null) - wizard = createWizard(); - return wizard; - } - - /** - * Subclasses must override to create the wizard - */ - protected abstract IWizard createWizard(); - - /* - * @see IWizardNode#isContentCreated() - */ - public boolean isContentCreated() { - return wizard != null; - } - - /** - * @see org.eclipse.jface.wizard.IWizardNode#getExtent() - */ - public Point getExtent() { - return null; - } - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/ListMessageDialog.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/ListMessageDialog.java deleted file mode 100644 index aed38af51..000000000 --- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/ListMessageDialog.java +++ /dev/null @@ -1,217 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2004 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 - *******************************************************************************/ -/* - * Created on Aug 5, 2004 - * - * TODO To change the template for this generated file go to - * Window - Preferences - Java - Code Generation - Code and Comments - */ -package org.eclipse.wst.common.frameworks.internal.ui; - -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.List; -import org.eclipse.swt.widgets.Shell; - -/** - * @author dfholt - * - * TODO To change the template for this generated type comment go to Window - Preferences - Java - - * Code Generation - Code and Comments - */ -public class ListMessageDialog extends MessageDialog { - protected String[] listItems; - protected List list; - - /** - * EJBSelectiveImportDialog constructor comment. - * - * @param parentShell - * org.eclipse.swt.widgets.Shell - * @param dialogTitle - * java.lang.String - * @param dialogTitleImage - * org.eclipse.swt.graphics.Image - * @param dialogMessage - * java.lang.String - * @param dialogImageType - * int - * @param dialogButtonLabels - * java.lang.String[] - * @param defaultIndex - * int - */ - public ListMessageDialog(org.eclipse.swt.widgets.Shell parentShell, String dialogTitle, org.eclipse.swt.graphics.Image dialogTitleImage, String dialogMessage, int dialogImageType, java.lang.String[] dialogButtonLabels, int defaultIndex) { - super(parentShell, dialogTitle, dialogTitleImage, dialogMessage, dialogImageType, dialogButtonLabels, defaultIndex); - } - - /** - * ListMessageDialog constructor comment. - * - * @param parentShell - * org.eclipse.swt.widgets.Shell - * @param dialogTitle - * java.lang.String - * @param dialogTitleImage - * org.eclipse.swt.graphics.Image - * @param dialogMessage - * java.lang.String - * @param dialogImageType - * int - * @param dialogButtonLabels - * java.lang.String[] - * @param defaultIndex - * int - */ - public ListMessageDialog(org.eclipse.swt.widgets.Shell parentShell, String dialogTitle, org.eclipse.swt.graphics.Image dialogTitleImage, String dialogMessage, int dialogImageType, java.lang.String[] dialogButtonLabels, int defaultIndex, String[] names) { - super(parentShell, dialogTitle, dialogTitleImage, dialogMessage, dialogImageType, dialogButtonLabels, defaultIndex); - listItems = names; - } - - /** - * Creates and returns the contents of an area of the dialog which appears below the message and - * above the button bar. - * <p> - * The default implementation of this framework method returns <code>null</code>. Subclasses - * may override. - * </p> - * - * @param the - * parent composite to contain the custom area - * @return the custom area control, or <code>null</code> - */ - protected Control createCustomArea(Composite parent) { - - Composite composite = new Composite(parent, 0); - GridLayout layout = new GridLayout(); - layout.numColumns = 1; - layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); - layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); - layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); - composite.setLayout(layout); - composite.setLayoutData(new GridData(GridData.FILL_BOTH)); - - if (listItems != null) { - list = new List(composite, SWT.BORDER); - GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER); - list.setLayoutData(data); - list.setItems(listItems); - } - - return composite; - - } - - /** - * Convenience method to open a simple confirm (OK/Cancel) dialog. - * - * @param parent - * the parent shell of the dialog, or <code>null</code> if none - * @param title - * the dialog's title, or <code>null</code> if none - * @param message - * the message - * @return <code>true</code> if the user presses the OK button, <code>false</code> otherwise - */ - public static boolean openConfirm(Shell parent, String title, String message, String[] items) { - ListMessageDialog dialog = new ListMessageDialog(parent, title, null, // accept the default - // window icon - message, QUESTION, new String[]{IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL}, 0, items); // OK - // is - // the - // default - return dialog.open() == 0; - } - - /** - * Convenience method to open a standard error dialog. - * - * @param parent - * the parent shell of the dialog, or <code>null</code> if none - * @param title - * the dialog's title, or <code>null</code> if none - * @param message - * the message - */ - public static void openError(Shell parent, String title, String message, String[] items) { - ListMessageDialog dialog = new ListMessageDialog(parent, title, null, // accept the default - // window icon - message, ERROR, new String[]{IDialogConstants.OK_LABEL}, 0, items); // ok is the - // default - dialog.open(); - return; - } - - /** - * Convenience method to open a standard information dialog. - * - * @param parent - * the parent shell of the dialog, or <code>null</code> if none - * @param title - * the dialog's title, or <code>null</code> if none - * @param message - * the message - */ - public static void openInformation(Shell parent, String title, String message, String[] items) { - ListMessageDialog dialog = new ListMessageDialog(parent, title, null, // accept the default - // window icon - message, INFORMATION, new String[]{IDialogConstants.OK_LABEL}, 0, items); - // ok is the default - dialog.open(); - return; - } - - /** - * Convenience method to open a simple Yes/No question dialog. - * - * @param parent - * the parent shell of the dialog, or <code>null</code> if none - * @param title - * the dialog's title, or <code>null</code> if none - * @param message - * the message - * @return <code>true</code> if the user presses the OK button, <code>false</code> otherwise - */ - public static boolean openQuestion(Shell parent, String title, String message, String[] items) { - ListMessageDialog dialog = new ListMessageDialog(parent, title, null, // accept the default - // window icon - message, QUESTION, new String[]{IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL}, 0, items); // yes - // is - // the - // default - return dialog.open() == 0; - } - - /** - * Convenience method to open a standard warning dialog. - * - * @param parent - * the parent shell of the dialog, or <code>null</code> if none - * @param title - * the dialog's title, or <code>null</code> if none - * @param message - * the message - */ - public static void openWarning(Shell parent, String title, String message, String[] items) { - ListMessageDialog dialog = new ListMessageDialog(parent, title, null, // accept the default - // window icon - message, WARNING, new String[]{IDialogConstants.OK_LABEL}, 0, items); // ok is - // the - // default - dialog.open(); - return; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/ListenerList.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/ListenerList.java deleted file mode 100644 index db72ea550..000000000 --- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/ListenerList.java +++ /dev/null @@ -1,81 +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 - *******************************************************************************/ - -package org.eclipse.wst.common.frameworks.internal.ui; - -import java.awt.event.ActionListener; - -public class ListenerList { - private final static ActionListener[] NULL_ARRAY = new ActionListener[0]; - protected transient ActionListener[] listenerList = NULL_ARRAY; - - /** - * Add the listener as a listener of the specified type. - * - * @param t - * the type of the listener to be added - * @param l - * the listener to be added - */ - public synchronized void add(ActionListener l) { - if (l == null) - return; - if (listenerList == NULL_ARRAY) { - // if this is the first listener added, - // initialize the lists - listenerList = new ActionListener[]{l}; - } else { - // Otherwise copy the array and add the new listener - int i = listenerList.length; - ActionListener[] tmp = new ActionListener[i + 1]; - System.arraycopy(listenerList, 0, tmp, 0, i); - - tmp[i + 1] = l; - - listenerList = tmp; - } - } - - /** - * Return the total number of listeners for this listenerlist - */ - public int getListenerCount() { - return listenerList.length; - } - - public ActionListener[] getListenerList() { - return listenerList; - } - - public synchronized void remove(ActionListener l) { - if (l == null) - return; - int index = -1; - for (int i = listenerList.length - 1; i >= 0; i -= 1) { - if (listenerList[i].equals(l)) { - index = i; - break; - } - } - if (index != -1) { - ActionListener[] tmp = new ActionListener[listenerList.length - 1]; - // Copy the list up to index - System.arraycopy(listenerList, 0, tmp, 0, index); - // Copy from two past the index, up to - // the end of tmp (which is two elements - // shorter than the old list) - if (index < tmp.length) - System.arraycopy(listenerList, index + 1, tmp, index, tmp.length - index); - // set the listener array to the new array or null - listenerList = (tmp.length == 0) ? NULL_ARRAY : tmp; - } - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/NewProjectGroup.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/NewProjectGroup.java deleted file mode 100644 index 0296b41e7..000000000 --- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/NewProjectGroup.java +++ /dev/null @@ -1,215 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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.common.frameworks.internal.ui; - -import java.io.File; - -import org.eclipse.core.runtime.Path; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Font; -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.DirectoryDialog; -import org.eclipse.swt.widgets.Group; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.internal.ide.IDEWorkbenchMessages; -import org.eclipse.wst.common.frameworks.datamodel.DataModelEvent; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; -import org.eclipse.wst.common.frameworks.datamodel.IDataModelListener; -import org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelSynchHelper; -import org.eclipse.wst.common.frameworks.internal.operations.IProjectCreationPropertiesNew; - -public class NewProjectGroup implements IProjectCreationPropertiesNew { - private IDataModel model; - public Text projectNameField = null; - protected Text locationPathField = null; - protected Button browseButton = null; - // constants - private static final int SIZING_TEXT_FIELD_WIDTH = 305; - // default values - private String defProjectNameLabel = WTPCommonUIResourceHandler.Name_; //$NON-NLS-1$ - private String defBrowseButtonLabel = WTPCommonUIResourceHandler.Browse_;//$NON-NLS-1$ - private static final String defDirDialogLabel = "Directory"; //$NON-NLS-1$ - - private DataModelSynchHelper synchHelper; - - public NewProjectGroup(Composite parent, IDataModel model) { - this.model = model; - synchHelper = new DataModelSynchHelper(model); - buildComposites(parent); - } - - /** - * Create the controls within this composite - */ - public void buildComposites(Composite parent) { - createProjectNameGroup(parent); - createProjectLocationGroup(parent); - projectNameField.setFocus(); - } - - private final void createProjectNameGroup(Composite parent) { - Font font = parent.getFont(); - // project specification group - Composite projectGroup = new Composite(parent, SWT.NONE); - GridLayout layout = new GridLayout(); - layout.numColumns = 2; - projectGroup.setLayout(layout); - projectGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - // new project label - Label projectLabel = new Label(projectGroup, SWT.NONE); - projectLabel.setFont(font); - projectLabel.setText(defProjectNameLabel); - - // new project name entry field - projectNameField = new Text(projectGroup, SWT.BORDER); - GridData data = new GridData(GridData.FILL_HORIZONTAL); - data.widthHint = SIZING_TEXT_FIELD_WIDTH; - projectNameField.setLayoutData(data); - projectNameField.setFont(font); - synchHelper.synchText(projectNameField, PROJECT_NAME, new Control[]{projectLabel}); - } - - /** - * Creates the project location specification controls. - * - * @param parent - * the parent composite - */ - private final void createProjectLocationGroup(Composite parent) { - - Font font = parent.getFont(); - // project specification group - Group projectGroup = new Group(parent, SWT.NONE); - GridLayout layout = new GridLayout(); - layout.numColumns = 3; - projectGroup.setLayout(layout); - projectGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - projectGroup.setFont(font); - projectGroup.setText(IDEWorkbenchMessages.WizardNewProjectCreationPage_projectContentsLabel); - - final Button useDefaultsButton = new Button(projectGroup, SWT.CHECK | SWT.RIGHT); - useDefaultsButton.setText(IDEWorkbenchMessages.WizardNewProjectCreationPage_useDefaultLabel); - useDefaultsButton.setFont(font); - synchHelper.synchCheckbox(useDefaultsButton, USE_DEFAULT_LOCATION, null); - - GridData buttonData = new GridData(); - buttonData.horizontalSpan = 3; - useDefaultsButton.setLayoutData(buttonData); - - createUserSpecifiedProjectLocationGroup(projectGroup); - } - - private void createUserSpecifiedProjectLocationGroup(Composite projectGroup) { - Font font = projectGroup.getFont(); - // location label - final Label locationLabel = new Label(projectGroup, SWT.NONE); - locationLabel.setFont(font); - locationLabel.setText(IDEWorkbenchMessages.WizardNewProjectCreationPage_locationLabel); - - // project location entry field - locationPathField = new Text(projectGroup, SWT.BORDER); - GridData data = new GridData(GridData.FILL_HORIZONTAL); - data.widthHint = SIZING_TEXT_FIELD_WIDTH; - locationPathField.setLayoutData(data); - locationPathField.setFont(font); - - // browse button - browseButton = new Button(projectGroup, SWT.PUSH); - browseButton.setFont(font); - browseButton.setText(defBrowseButtonLabel); - browseButton.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent event) { - handleLocationBrowseButtonPressed(); - } - }); - - final IDataModel localModel = model; - - class LocationListener implements ModifyListener, IDataModelListener { - private boolean typing = false; - - public void modifyText(ModifyEvent e) { - if (!localModel.getBooleanProperty(USE_DEFAULT_LOCATION)) { - try { - typing = true; - localModel.setProperty(USER_DEFINED_LOCATION, locationPathField.getText()); - } finally { - typing = false; - } - } - } - - public void propertyChanged(DataModelEvent event) { - boolean useDefault = localModel.getBooleanProperty(USE_DEFAULT_LOCATION); - if (USE_DEFAULT_LOCATION.equals(event.getPropertyName())) { - locationLabel.setEnabled(!useDefault); - locationPathField.setEnabled(!useDefault); - browseButton.setEnabled(!useDefault); - if (useDefault) { - locationPathField.setText(localModel.getStringProperty(DEFAULT_LOCATION)); - } else { - locationPathField.setText(localModel.getStringProperty(USER_DEFINED_LOCATION)); - } - } else if (!typing) { - if ((useDefault && DEFAULT_LOCATION.equals(event.getPropertyName())) || (!useDefault && USER_DEFINED_LOCATION.equals(event.getPropertyName()))) { - locationPathField.setText((String) event.getProperty()); - } - } - } - } - - LocationListener listener = new LocationListener(); - - listener.propertyChanged(new DataModelEvent(model, USE_DEFAULT_LOCATION, IDataModel.VALUE_CHG)); - - locationPathField.addModifyListener(listener); - model.addListener(listener); - } - - /** - * Open an appropriate directory browser - */ - protected void handleLocationBrowseButtonPressed() { - DirectoryDialog dialog = new DirectoryDialog(locationPathField.getShell()); - dialog.setMessage(defDirDialogLabel); - String dirName = model.getStringProperty(USER_DEFINED_LOCATION); - if (dirName.trim().length() == 0) { - dirName = new Path(model.getStringProperty(DEFAULT_LOCATION)).removeLastSegments(1).toOSString(); - } - - if ((dirName != null) && (dirName.length() != 0)) { - File path = new File(dirName); - if (path.exists()) { - dialog.setFilterPath(dirName); - } - } - String selectedDirectory = dialog.open(); - if (selectedDirectory != null) { - model.setProperty(USER_DEFINED_LOCATION, selectedDirectory); - } - } - - public void dispose() { - model.removeListener(synchHelper); - synchHelper.dispose(); - model = null; - } -} diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/OverlayIcon.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/OverlayIcon.java deleted file mode 100644 index 8ff7b0a06..000000000 --- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/OverlayIcon.java +++ /dev/null @@ -1,121 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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.common.frameworks.internal.ui; - - - -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.swt.graphics.ImageData; -import org.eclipse.swt.graphics.Point; - -public class OverlayIcon extends org.eclipse.jface.resource.CompositeImageDescriptor { - // //$NON-NLS-1$ - static final int DEFAULT_WIDTH = 16; - static final int DEFAULT_HEIGHT = 16; - private Point fSize = null; - private ImageDescriptor fBase; - private ImageDescriptor fOverlays[][]; - - public OverlayIcon(ImageDescriptor base, ImageDescriptor[][] overlays) { - fBase = base; - if (fBase == null) - fBase = ImageDescriptor.getMissingImageDescriptor(); - fOverlays = overlays; - fSize = new Point(DEFAULT_WIDTH, DEFAULT_HEIGHT); - } - - public OverlayIcon(ImageDescriptor base, ImageDescriptor[][] overlays, Point size) { - fBase = base; - if (fBase == null) - fBase = ImageDescriptor.getMissingImageDescriptor(); - fOverlays = overlays; - fSize = size; - } - - protected void drawBottomLeft(ImageDescriptor[] overlays) { - if (overlays == null) - return; - int length = overlays.length; - int x = 0; - for (int i = 0; i < 3; i++) { - if (i < length && overlays[i] != null) { - ImageData id = overlays[i].getImageData(); - drawImage(id, x, getSize().y - id.height); - x += id.width; - } - } - } - - protected void drawBottomRight(ImageDescriptor[] overlays) { - if (overlays == null) - return; - int length = overlays.length; - int x = getSize().x; - for (int i = 2; i >= 0; i--) { - if (i < length && overlays[i] != null) { - ImageData id = overlays[i].getImageData(); - x -= id.width; - drawImage(id, x, getSize().y - id.height); - } - } - } - - protected void drawCompositeImage(int width, int height) { - ImageData bg = fBase.getImageData(); - drawImage(bg, 0, 0); - - if (fOverlays != null) { - if (fOverlays.length > 0) - drawTopRight(fOverlays[0]); - - if (fOverlays.length > 1) - drawBottomRight(fOverlays[1]); - - if (fOverlays.length > 2) - drawBottomLeft(fOverlays[2]); - - if (fOverlays.length > 3) - drawTopLeft(fOverlays[3]); - } - } - - protected void drawTopLeft(ImageDescriptor[] overlays) { - if (overlays == null) - return; - int length = overlays.length; - int x = 0; - for (int i = 0; i < 3; i++) { - if (i < length && overlays[i] != null) { - ImageData id = overlays[i].getImageData(); - drawImage(id, x, 0); - x += id.width; - } - } - } - - protected void drawTopRight(ImageDescriptor[] overlays) { - if (overlays == null) - return; - int length = overlays.length; - int x = getSize().x; - for (int i = 2; i >= 0; i--) { - if (i < length && overlays[i] != null) { - ImageData id = overlays[i].getImageData(); - x -= id.width; - drawImage(id, x, 0); - } - } - } - - protected Point getSize() { - return fSize; - } -} diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/PageGroupManager.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/PageGroupManager.java deleted file mode 100644 index eb8a6f8dc..000000000 --- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/PageGroupManager.java +++ /dev/null @@ -1,562 +0,0 @@ -/*************************************************************************************************** - * Copyright (c) 2003, 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.common.frameworks.internal.ui; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Stack; -import java.util.Vector; - -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IExtensionPoint; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Platform; -import org.eclipse.jem.util.logger.proxy.Logger; -import org.eclipse.jface.wizard.IWizardPage; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; -import org.eclipse.wst.common.frameworks.datamodel.IDataModelPausibleOperation; -import org.eclipse.wst.common.frameworks.datamodel.IDataModelPausibleOperationEvent; -import org.eclipse.wst.common.frameworks.datamodel.IDataModelPausibleOperationListener; -import org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelWizard; -import org.eclipse.wst.common.frameworks.internal.datamodel.ui.IDMPageGroup; -import org.eclipse.wst.common.frameworks.internal.datamodel.ui.IDMPageGroupHandler; -import org.eclipse.wst.common.frameworks.internal.datamodel.ui.IDMPageHandler; -import org.eclipse.wst.common.frameworks.internal.operation.extensionui.CommonUIPluginConstants; - -public class PageGroupManager { - private IDataModelPausibleOperation rootOperation; - private IDMPageGroup rootPageGroup; - private HashMap groupTable; - private HashSet operationsRun; - private Stack pageGroupStack; - private IDataModel dataModel; - private StackEntry savedTopEntry; - private int savedStackSize; - - private IConfigurationElement[] elements; - - private final String ELEMENT_PAGE_GROUP = "wizardPageGroup"; //$NON-NLS-1$ - - private String pauseAfterExecution = null; - - public PageGroupManager(IDataModelPausibleOperation rootOperation, IDMPageGroup rootPageGroup) { - this.rootOperation = rootOperation; - dataModel = rootOperation.getDataModel(); - groupTable = new HashMap(); - operationsRun = new HashSet(); - pageGroupStack = new Stack(); - this.rootPageGroup = rootPageGroup; - - - PageGroupEntry rootPageGroupEntry = new PageGroupEntry(rootPageGroup); - IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(CommonUIPluginConstants.PLUGIN_ID, ELEMENT_PAGE_GROUP); - elements = point.getConfigurationElements(); - groupTable.put(this.rootPageGroup.getPageGroupID(), rootPageGroupEntry); - - if (this.rootPageGroup.getAllowsExtendedPages()) { - // Find all the page groups that follow this root page group. - loadExtendedPages(rootPageGroup); - } - - rootOperation.addOperationListener(new IDataModelPausibleOperationListener() { - public int notify(IDataModelPausibleOperationEvent event) { - switch (event.getExecutionType()) { - case IDataModelPausibleOperationEvent.ROLLBACK : - if (event.getOperationType() == IDataModelPausibleOperationEvent.MAIN_FINISHED) { - operationsRun.remove(event.getOperation().getID()); - } - break; - case IDataModelPausibleOperationEvent.EXECUTE : - if (event.getOperationType() == IDataModelPausibleOperationEvent.MAIN_FINISHED) { - operationsRun.add(event.getOperation().getID()); - if (null != pauseAfterExecution && event.getOperation().getID().equals(pauseAfterExecution)) { - return IDataModelPausibleOperationListener.PAUSE; - } - } - - break; - - } - return IDataModelPausibleOperationListener.CONTINUE; - } - }); - - } - - public void addGroupAfter(String pageGroupID, IDMPageGroup pageInsertGroup) { - PageGroupEntry pageGroupEntry = (PageGroupEntry) groupTable.get(pageGroupID); - - if (pageGroupEntry.pageGroup.getAllowsExtendedPages()) { - addPageGroup(pageGroupEntry.pageGroup, pageInsertGroup); - } - } - - public void moveForwardOnePage() { - boolean pageFound = false; - - if (pageGroupStack.empty()) { - PageGroupEntry rootEntry = (PageGroupEntry) groupTable.get(rootPageGroup.getPageGroupID()); - pageGroupStack.push(new StackEntry(rootEntry, -1)); - } - - saveStackInfo(); - - try { - pageFound = findNextPage(true); - } catch (Throwable exc) { - Logger.getLogger().logError(exc); - try { - rootOperation.rollBack(null, null); - } catch (ExecutionException e) { - Logger.getLogger().logError(e); - } - pageFound = false; - } - - if (pageFound == false) { - // If we moved forward and there wasn't a page then we will restore the stack. - // Normally, this wouldn't happen since a call to hasNextPage would have indicated - // that there wasn't a page. - restoreStackInfo(); - } - } - - public void moveBackOnePage() { - if (pageGroupStack.empty()) - return; - - StackEntry topEntry = (StackEntry) pageGroupStack.peek(); - - // Pop the last page. - if (!topEntry.pagesReturned.empty()) - topEntry.pagesReturned.pop(); - - // Now find the previous page. - boolean foundPreviousPage = findPreviousPageInGroup(); - - while (!foundPreviousPage && !pageGroupStack.empty()) { - if (topEntry.ranOperations) { - try { - rootOperation.rollBack(null, null); - } catch (ExecutionException e) { - Logger.getLogger().logError(e); - } - } - - pageGroupStack.pop(); - - if (!pageGroupStack.empty()) { - foundPreviousPage = findPreviousPageInGroup(); - topEntry = (StackEntry) pageGroupStack.peek(); - } - } - } - - public void reset() { - pageGroupStack.clear(); - } - - public IWizardPage getCurrentPage() { - IWizardPage page = null; - - if (!pageGroupStack.empty()) { - StackEntry topEntry = (StackEntry) pageGroupStack.peek(); - int pageIndex = topEntry.getTopPageIndex(); - - page = pageIndex == -1 ? null : (IWizardPage) topEntry.pageGroupEntry.getPages().get(pageIndex); - } - - return page; - } - - private Boolean hasMulitplePages; - - public boolean hasMultiplePages() { - if (null == hasMulitplePages) { - int pageCount = 0; - PageGroupEntry rootEntry = (PageGroupEntry) groupTable.get(rootPageGroup.getPageGroupID()); - pageCount += rootEntry.getPages().size(); - for (int i = 0; pageCount < 2 && i < rootEntry.groupsThatFollow.size(); i++) { - pageCount += ((PageGroupEntry) rootEntry.groupsThatFollow.get(i)).getPages().size(); - } - hasMulitplePages = pageCount > 1 ? Boolean.TRUE : Boolean.FALSE; - } - return hasMulitplePages.booleanValue(); - } - - public boolean hasNextPage() { - boolean pageFound = false; - - saveStackInfo(); - - if (pageGroupStack.empty()) { - PageGroupEntry rootEntry = (PageGroupEntry) groupTable.get(rootPageGroup.getPageGroupID()); - pageGroupStack.push(new StackEntry(rootEntry, -1)); - } - - pageFound = findNextPage(false); - restoreStackInfo(); - - return pageFound; - } - - public void undoAllCurrentOperations() { - while (!pageGroupStack.empty()) { - moveBackOnePage(); - } - } - - private boolean findPreviousPageInGroup() { - StackEntry topEntry = (StackEntry) pageGroupStack.peek(); - boolean pageFound = false; - - if (!topEntry.pagesReturned.empty()) { - topEntry.pagesComplete = false; - pageFound = true; - } - - return pageFound; - } - - private boolean findNextPage(boolean runOperations) { - StackEntry topEntry = (StackEntry) pageGroupStack.peek(); - int newPageIndex = topEntry.findNextPageIndex(); - boolean pageFound = false; - - if (newPageIndex == -1) { - // Our page handler didn't find a page so we will see if there is a page group that - // follows this page group that can find a page. - topEntry.pagesComplete = true; - - StackEntry nextStackEntry = findNextPageGroup(pageGroupStack); - - if (nextStackEntry != null) { - IDMPageGroup pageGroup = nextStackEntry.pageGroupEntry.pageGroup; - String requiresOperationsId = pageGroup.getRequiredDataOperationToRun(); - - // If this group requires an operation and it has not already been run - // then we need to run it. - if (runOperations && requiresOperationsId != null && !operationsRun.contains(requiresOperationsId)) { - pauseAfterExecution = requiresOperationsId; - IStatus status = null; - - try { - status = rootOperation.resume(null, null); - } catch (ExecutionException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - nextStackEntry.ranOperations = true; - if (status.getSeverity() == IStatus.ERROR) { - // TODO need a better error feedback mechanism here. - throw new IllegalArgumentException(status.getMessage()); - } - } - - pageGroupStack.push(nextStackEntry); - pageFound = findNextPage(runOperations); - } - } else { - // We found a new page in the page handler. - pageFound = true; - topEntry.pagesReturned.push(new Integer(newPageIndex)); - } - - return pageFound; - } - - - - private void saveStackInfo() { - if (!pageGroupStack.empty()) { - savedTopEntry = new StackEntry((StackEntry) pageGroupStack.peek()); - } - - savedStackSize = pageGroupStack.size(); - } - - private void restoreStackInfo() { - if (savedStackSize == 0) { - pageGroupStack.removeAllElements(); - } else { - pageGroupStack.setSize(savedStackSize - 1); - pageGroupStack.push(savedTopEntry); - } - } - - private void loadExtendedPages(IDMPageGroup pageGroup) { - String wizardId = rootPageGroup.getWizardID(); - String pageGroupId = pageGroup.getPageGroupID(); - int length = elements.length; - - for (int index = 0; index < length; index++) { - DMPageGroupElementImpl pageInsertGroup = new DMPageGroupElementImpl(elements[index]); - String pageInsertGroupId = pageInsertGroup.getPageGroupInsertionID(); - if (pageInsertGroup.getWizardID().equals(wizardId) && (null == pageInsertGroupId || pageInsertGroupId.equals(pageGroupId))) { - addPageGroup(pageGroup, pageInsertGroup); - - // If this page group has page then add them - if (pageInsertGroup.getAllowsExtendedPages()) { - loadExtendedPages(pageInsertGroup); - } - } - } - } - - private void addPageGroup(IDMPageGroup pageGroup, IDMPageGroup insertedPageGroup) { - PageGroupEntry pageGroupEntry = (PageGroupEntry) groupTable.get(pageGroup.getPageGroupID()); - PageGroupEntry nextGroupEntry = (PageGroupEntry) groupTable.get(insertedPageGroup.getPageGroupID()); - - if (pageGroupEntry == null) { - pageGroupEntry = new PageGroupEntry(pageGroup); - groupTable.put(pageGroup.getPageGroupID(), pageGroupEntry); - } - - if (nextGroupEntry == null) { - nextGroupEntry = new PageGroupEntry(insertedPageGroup); - groupTable.put(insertedPageGroup.getPageGroupID(), nextGroupEntry); - } - - pageGroupEntry.groupsThatFollow.add(nextGroupEntry); - } - - public StackEntry findNextPageGroup(Stack stack) { - StackEntry topEntry = (StackEntry) stack.peek(); - PageGroupEntry nextPageGroup = topEntry.getNextPageGroup(null); - int parentIndex = topEntry.parentGroupIndex; - int prevParentIndex = stack.size() - 1; - - // Recurse up through the parents to find the next group if needed. - while (parentIndex != -1 && nextPageGroup == null) { - StackEntry parentStackEntry = (StackEntry) stack.elementAt(parentIndex); - - nextPageGroup = parentStackEntry.getNextPageGroup(topEntry.getId()); - prevParentIndex = parentIndex; - parentIndex = parentStackEntry.parentGroupIndex; - topEntry = parentStackEntry; - } - - return nextPageGroup == null ? null : new StackEntry(nextPageGroup, prevParentIndex); - } - - private class StackEntry { - public PageGroupEntry pageGroupEntry; - public Stack pagesReturned; // Element = Interger of page indexes. - public boolean pagesComplete; - public int parentGroupIndex; - public boolean ranOperations; - - public StackEntry(PageGroupEntry newPageGroupEntry, int parentIndex) { - pageGroupEntry = newPageGroupEntry; - pagesReturned = new Stack(); - pagesComplete = false; - parentGroupIndex = parentIndex; - ranOperations = false; - } - - public StackEntry(StackEntry stackEntry) { - pageGroupEntry = stackEntry.pageGroupEntry; - pagesReturned = new Stack(); - pagesComplete = stackEntry.pagesComplete; - parentGroupIndex = stackEntry.parentGroupIndex; - ranOperations = stackEntry.ranOperations; - pagesReturned.addAll(stackEntry.pagesReturned); - } - - public String getId() { - return pageGroupEntry.pageGroup.getPageGroupID(); - } - - public int findNextPageIndex() { - int result = -1; - - if (!pagesComplete) { - List pages = pageGroupEntry.getPages(); - - int pageIndex = getTopPageIndex(); - String pageId = pageIndex == -1 ? null : ((IWizardPage) pages.get(pageIndex)).getName(); - String expectedId = pageIndex + 1 >= pages.size() ? null : ((IWizardPage) pages.get(pageIndex + 1)).getName(); - String newPageId = null; - - try { - newPageId = pageGroupEntry.getPageHandler().getNextPage(pageId, expectedId); - } catch (Throwable exc) { - Logger.getLogger().logError(exc); - } - - if (newPageId != null && newPageId.equals(IDMPageHandler.SKIP_PAGE) && pageIndex >= 0 && pageIndex < pages.size() - 2) { - result = pageIndex + 2; - } else { - result = pageGroupEntry.checkForSpecialIds(newPageId); - } - } - - return result; - } - - public PageGroupEntry getNextPageGroup(String afterId) { - PageGroupEntry result = null; - String nextGroupID = null; - String[] groupIDList = getGroupIDList(); - - try { - nextGroupID = pageGroupEntry.getPageGroupHandler().getNextPageGroup(afterId, groupIDList); - } catch (Throwable exc) { - Logger.getLogger().logError(exc); - } - - if (nextGroupID != null) { - // Find this string in the list. - for (int index = 0; index < groupIDList.length; index++) { - if (groupIDList[index].equals(nextGroupID)) { - result = (PageGroupEntry) pageGroupEntry.groupsThatFollow.elementAt(index); - break; - } - } - } - - return result; - } - - private String[] getGroupIDList() { - String[] result = new String[pageGroupEntry.groupsThatFollow.size()]; - - for (int index = 0; index < pageGroupEntry.groupsThatFollow.size(); index++) { - PageGroupEntry entry = (PageGroupEntry) pageGroupEntry.groupsThatFollow.elementAt(index); - - result[index] = entry.pageGroup.getPageGroupID(); - } - - return result; - } - - private int getTopPageIndex() { - return pagesReturned.empty() ? -1 : ((Integer) pagesReturned.peek()).intValue(); - } - } - - private class PageGroupEntry { - public IDMPageGroup pageGroup; - public Vector groupsThatFollow; - private IDMPageHandler pageHandler; - private IDMPageGroupHandler pageGroupHandler; - private boolean initialized; - - public PageGroupEntry(IDMPageGroup newPageGroup) { - pageGroup = newPageGroup; - groupsThatFollow = new Vector(); - initialized = false; - } - - public IDMPageHandler getPageHandler() { - if (!initialized) - init(); - - return pageHandler; - } - - public IDMPageGroupHandler getPageGroupHandler() { - if (!initialized) - init(); - - return pageGroupHandler; - } - - public List getPages() { - if (!initialized) - init(); - - return pageGroup.getPages(dataModel); - } - - public PageGroupEntry(PageGroupEntry originalEntry) { - pageGroup = originalEntry.pageGroup; - groupsThatFollow = originalEntry.groupsThatFollow; - pageHandler = originalEntry.pageHandler; - pageGroupHandler = originalEntry.pageGroupHandler; - } - - private void init() { - try { - pageHandler = pageGroup.getPageHandler(dataModel); - pageGroupHandler = pageGroup.getPageGroupHandler(dataModel); - } catch (Throwable exc) { - Logger.getLogger().logError(exc); - } - - if (pageHandler == null) - pageHandler = new SimplePageHandler(); - - if (pageGroupHandler == null) - pageGroupHandler = new SimplePageGroupHandler(); - - initialized = true; - } - - private int checkForSpecialIds(String pageId) { - int result = -1; - - List pages = getPages(); - - if (pages.isEmpty() || pageId == null) - return -1; - - if (pageId.startsWith(IDMPageHandler.PAGE_AFTER)) { - String afterID = pageId.substring(IDMPageHandler.PAGE_AFTER.length(), pageId.length()); - result = getIndexOf(afterID); - result = result >= 0 && result < pages.size() - 1 ? result + 1 : -1; - } else if (pageId.startsWith(IDMPageHandler.PAGE_BEFORE)) { - String beforeID = pageId.substring(IDMPageHandler.PAGE_BEFORE.length(), pageId.length()); - result = getIndexOf(beforeID); - result = result >= 1 && result < pages.size() ? result - 1 : -1; - } else { - result = getIndexOf(pageId); - } - - return result; - } - - private int getIndexOf(String pageId) { - int result = -1; - - List pages = getPages(); - for (int index = 0; index < pages.size(); index++) { - if (((IWizardPage) pages.get(index)).getName().equals(pageId)) { - result = index; - break; - } - } - - return result; - } - - public boolean isInitialized() { - return initialized; - } - } - - public void storeDefaultSettings(DataModelWizard wizard) { - Iterator pageGroups = groupTable.values().iterator(); - while (pageGroups.hasNext()) { - PageGroupEntry pageGroup = (PageGroupEntry) pageGroups.next(); - if (pageGroup.isInitialized()) { - Iterator pages = pageGroup.getPages().iterator(); - while (pages.hasNext()) { - IWizardPage page = (IWizardPage) pages.next(); - wizard.storeDefaultSettings(page); - } - } - } - - } -} diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/RunnableOperationWrapper.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/RunnableOperationWrapper.java deleted file mode 100644 index 4b26000c8..000000000 --- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/RunnableOperationWrapper.java +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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.common.frameworks.internal.ui; - -import java.lang.reflect.InvocationTargetException; - -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.commands.operations.IUndoableOperation; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jface.operation.IRunnableWithProgress; - -public class RunnableOperationWrapper implements IRunnableWithProgress { - - private IUndoableOperation undoableOperation; - private IStatus status; - - public RunnableOperationWrapper(IUndoableOperation undoableOperation) { - this.undoableOperation = undoableOperation; - } - - public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { - try { - status = undoableOperation.execute(monitor, null); - if(status.getSeverity() == IStatus.ERROR){ - throw new InvocationTargetException(status.getException()); - } - } catch (ExecutionException e) { - throw new InvocationTargetException(e); - } - } - - public IStatus getStatus() { - return status; - } - -} diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/RunnableWithProgressWrapper.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/RunnableWithProgressWrapper.java deleted file mode 100644 index 3df3904db..000000000 --- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/RunnableWithProgressWrapper.java +++ /dev/null @@ -1,79 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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.common.frameworks.internal.ui; - - -import org.eclipse.wst.common.frameworks.internal.operations.IHeadlessRunnableWithProgress; - -/** - * This is a wrapper for our IHeadlessRunnableWithProgress to the IRunnableWithProgress. This class - * needs to be used when running the operation from a IRunnableContext. - * - * @see IRunnableContext - * @see JavaUIPlugin#getRunnableWithProgress Creation date: (5/8/2001 1:28:45 PM) - * @author: Administrator - */ -public class RunnableWithProgressWrapper implements org.eclipse.jface.operation.IRunnableWithProgress { - // //$NON-NLS-1$ - private IHeadlessRunnableWithProgress headlessRunnable; - - /** - * RunnableWithProgressWrapper constructor comment. - */ - public RunnableWithProgressWrapper(IHeadlessRunnableWithProgress aHeadlessRunnableWithProgress) { - setHeadlessRunnable(aHeadlessRunnableWithProgress); - } - - /** - * Insert the method's description here. Creation date: (5/8/2001 1:29:52 PM) - * - * @return com.ibm.etools.j2ee.operations.IHeadlessRunnableWithProgress - */ - protected org.eclipse.wst.common.frameworks.internal.operations.IHeadlessRunnableWithProgress getHeadlessRunnable() { - return headlessRunnable; - } - - /** - * Runs this operation. Progress should be reported to the given progress monitor. This method - * is usually invoked by an <code>IRunnableContext</code>'s<code>run</code> method, which - * supplies the progress monitor. A request to cancel the operation should be honored and - * acknowledged by throwing <code>InterruptedException</code>. - * - * @param monitor - * the progress monitor to use to display progress and receive requests for - * cancelation - * @exception InvocationTargetException - * if the run method must propagate a checked exception, it should wrap it inside - * an <code>InvocationTargetException</code>; runtime exceptions are - * automatically wrapped in an <code>InvocationTargetException</code> by the - * calling context - * @exception InterruptedException - * if the operation detects a request to cancel, using - * <code>IProgressMonitor.isCanceled()</code>, it should exit by throwing - * <code>InterruptedException</code> - * - * @see IRunnableContext#run - */ - public void run(org.eclipse.core.runtime.IProgressMonitor monitor) throws java.lang.reflect.InvocationTargetException, java.lang.InterruptedException { - getHeadlessRunnable().run(monitor); - } - - /** - * Insert the method's description here. Creation date: (5/8/2001 1:29:52 PM) - * - * @param newHeadlessRunnable - * com.ibm.etools.j2ee.operations.IHeadlessRunnableWithProgress - */ - protected void setHeadlessRunnable(org.eclipse.wst.common.frameworks.internal.operations.IHeadlessRunnableWithProgress newHeadlessRunnable) { - headlessRunnable = newHeadlessRunnable; - } -} diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/SaveHandlerUI.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/SaveHandlerUI.java deleted file mode 100644 index e316218d9..000000000 --- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/SaveHandlerUI.java +++ /dev/null @@ -1,128 +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 - *******************************************************************************/ - -package org.eclipse.wst.common.frameworks.internal.ui; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.wst.common.frameworks.internal.ISaveHandler; -import org.eclipse.wst.common.frameworks.internal.SaveFailedException; -import org.eclipse.wst.common.frameworks.internal.plugin.WTPCommonPlugin; - - -public class SaveHandlerUI implements ISaveHandler { - public static final String SAVE_FAILED = WTPCommonPlugin.getResourceString("16"); //$NON-NLS-1$ - public static final String BEGINNING_MESSAGE = WTPCommonPlugin.getResourceString("17"); //$NON-NLS-1$ - protected boolean isYesToAll = false; - protected int referenceCount = 0; - - /** - * SaveHandlerUI constructor comment. - */ - public SaveHandlerUI() { - super(); - } - - /** - * access method comment. - */ - public void access() { - referenceCount++; - } - - protected Shell getParentShellForDialog() { - if (Display.getCurrent() != null) - return Display.getCurrent().getActiveShell(); - - return null; - } - - protected Display getDisplay() { - Display result = Display.getCurrent(); - return result == null ? Display.getDefault() : result; - } - - public void handleSaveFailed(SaveFailedException ex, IProgressMonitor monitor) { - if (referenceCount > 1) - //Let the outermost reference handle it - throw ex; - String exMsg = ex.getInnerMostNestedException() == null ? ex.getMessage() : ex.getInnerMostNestedException().getMessage(); - final String message = BEGINNING_MESSAGE + ":\n" + exMsg;//$NON-NLS-1$ - getDisplay().syncExec(new Runnable() { - public void run() { - MessageDialog.openError(getParentShellForDialog(), SAVE_FAILED, message); - } - }); - if (monitor != null) - monitor.setCanceled(true); - else - throw ex; - } - - protected boolean promptUserToSaveReadOnly(IFile aFile) { - - String[] buttonStrings = {WTPCommonPlugin.getResourceString("Yes_UI_"), WTPCommonPlugin.getResourceString("Yes_To_All_UI_"), WTPCommonPlugin.getResourceString("No_UI_")}; //$NON-NLS-3$ = "No" //$NON-NLS-2$ = "Yes To All" //$NON-NLS-1$ = "Yes" - String title = WTPCommonPlugin.getResourceString("Saving_Read-Only_File_UI_"); //$NON-NLS-1$ = "Saving Read-Only File" - String message = WTPCommonPlugin.getResourceString("2concat_INFO_", (new Object[]{aFile.getFullPath()})); //$NON-NLS-1$ = "The file {0} is read-only and cannot be saved. Would you like to make it editable and save anyway?" - - final MessageDialog dialog = new MessageDialog(getParentShellForDialog(), title, null, // accept - // the - // default - // window - // icon - message, MessageDialog.QUESTION, buttonStrings, 0); // Yes is the default - - final int[] ret = new int[1]; - getDisplay().syncExec(new Runnable() { - public void run() { - dialog.setBlockOnOpen(true); - ret[0] = dialog.open(); - } - }); - - switch (ret[0]) { - case 0 : { - return true; - } - case 1 : { - isYesToAll = true; - return true; - } - case 2 : { - return false; - } - } - return false; - } - - /** - * release method comment. - */ - public void release() { - referenceCount--; - if (referenceCount == 0) - isYesToAll = false; - - } - - /** - * shouldContinueAndMakeFileEditable method comment. - */ - public boolean shouldContinueAndMakeFileEditable(IFile aFile) { - boolean yes = isYesToAll || promptUserToSaveReadOnly(aFile); - if (yes) - aFile.getResourceAttributes().setReadOnly(false); - return yes; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/SimplePageGroupHandler.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/SimplePageGroupHandler.java deleted file mode 100644 index c68ee57ba..000000000 --- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/SimplePageGroupHandler.java +++ /dev/null @@ -1,39 +0,0 @@ -/*************************************************************************************************** - * Copyright (c) 2003, 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.common.frameworks.internal.ui; - -import org.eclipse.wst.common.frameworks.internal.datamodel.ui.IDMPageGroupHandler; - -public class SimplePageGroupHandler implements IDMPageGroupHandler { - public String getNextPageGroup(String currentPageGroupID, String[] pageGroupIDs) { - if (pageGroupIDs == null || pageGroupIDs.length == 0) - return null; - - if (currentPageGroupID == null) - return pageGroupIDs[0]; - - String result = null; - - for (int index = 0; index < pageGroupIDs.length; index++) { - if (pageGroupIDs[index].equals(currentPageGroupID)) { - // We found the currentPageGroupID, so we want to return the next one in the - // array if there is one. - if (index + 1 < pageGroupIDs.length) { - result = pageGroupIDs[index + 1]; - } else { - result = null; - } - - break; - } - } - - return result; - } -} diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/SimplePageHandler.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/SimplePageHandler.java deleted file mode 100644 index 44db38f30..000000000 --- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/SimplePageHandler.java +++ /dev/null @@ -1,24 +0,0 @@ -/*************************************************************************************************** - * Copyright (c) 2003, 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.common.frameworks.internal.ui; - -import org.eclipse.wst.common.frameworks.internal.datamodel.ui.IDMPageHandler; - -public class SimplePageHandler implements IDMPageHandler -{ - public String getNextPage(String currentPageName, String expectedNextPageName) - { - return expectedNextPageName; - } - - public String getPreviousPage(String currentPageName, String expectedPreviousPageName) - { - return expectedPreviousPageName; - } -} diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/TimedKeyListener.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/TimedKeyListener.java deleted file mode 100644 index 7f3c7b469..000000000 --- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/TimedKeyListener.java +++ /dev/null @@ -1,135 +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 - *******************************************************************************/ - -package org.eclipse.wst.common.frameworks.internal.ui; - -import java.awt.event.ActionListener; - -import org.eclipse.swt.events.KeyListener; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.MouseEvent; -import org.eclipse.swt.events.MouseListener; -import org.eclipse.swt.events.MouseTrackListener; -import org.eclipse.swt.widgets.Widget; - -/** - * Insert the type's description here. Creation date: (8/30/2001 4:00:28 PM) - * - * @author: Administrator - */ -public class TimedKeyListener extends Timer implements KeyListener, MouseListener, MouseTrackListener, ModifyListener { - - protected Widget monitoringTarget; - - private final static int TIME_LIMIT = 200; - - /** - * J2EETimedKeyListener constructor comment. - * - * @param delay - * int - * @param listener - * java.awt.event.ActionListener - */ - public TimedKeyListener(int delay, ActionListener listener) { - super(delay, listener); - setRepeats(false); - } - - /** - * Insert the method's description here. Creation date: (8/30/2001 4:43:33 PM) - * - * @param a - * java.awt.event.ActionListener - */ - public TimedKeyListener(ActionListener listener) { - this(TIME_LIMIT, listener); - } - - /** - * Sent when a key is pressed on the system keyboard. - * - * @param e - * an event containing information about the key press - */ - public void keyPressed(org.eclipse.swt.events.KeyEvent e) { - } - - /** - * Sent when a key is released on the system keyboard. - * - * @param e - * an event containing information about the key release - */ - public void keyReleased(org.eclipse.swt.events.KeyEvent e) { - // Replaced with SWT.Modify -- see modifyText() in this class - // monitoringTarget = (Widget) e.getSource(); - // restart(); - } - - /** - * @see org.eclipse.swt.events.MouseListener#mouseDoubleClick(MouseEvent) - */ - public void mouseDoubleClick(MouseEvent e) { - } - - /** - * @see org.eclipse.swt.events.MouseListener#mouseDown(MouseEvent) - */ - public void mouseDown(MouseEvent e) { - } - - /** - * @see org.eclipse.swt.events.MouseListener#mouseUp(MouseEvent) - */ - public void mouseUp(MouseEvent e) { - monitoringTarget = (Widget) e.getSource(); - restart(); - } - - /** - * @see org.eclipse.swt.events.MouseTrackListener#mouseEnter(MouseEvent) - */ - public void mouseEnter(MouseEvent e) { - } - - /** - * @see org.eclipse.swt.events.MouseTrackListener#mouseExit(MouseEvent) - */ - public void mouseExit(MouseEvent e) { - } - - /** - * @see org.eclipse.swt.events.MouseTrackListener#mouseHover(MouseEvent) - */ - public void mouseHover(MouseEvent e) { - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.frameworks.internal.ui.util.Timer#getSource() - */ - protected Object getSource() { - return monitoringTarget; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent) - */ - public void modifyText(ModifyEvent e) { - monitoringTarget = (Widget) e.getSource(); - restart(); - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/TimedModifyListener.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/TimedModifyListener.java deleted file mode 100644 index 98045fe0c..000000000 --- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/TimedModifyListener.java +++ /dev/null @@ -1,55 +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 - *******************************************************************************/ - -package org.eclipse.wst.common.frameworks.internal.ui; - -/** - * This class perform the same function as the J2EETimedKeyListener but using the Modify SWT event - * instead of the KeyUp. Creation date: (9/10/2001 11:46:51 AM) - * - * @author: Administrator - */ -import java.awt.event.ActionListener; - -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.widgets.Widget; - -public class TimedModifyListener extends TimedKeyListener implements ModifyListener { - /** - * J2EETimedModefyListener constructor comment. - * - * @param delay - * int - * @param listener - * java.awt.event.ActionListener - */ - public TimedModifyListener(int delay, ActionListener listener) { - super(delay, listener); - } - - /** - * J2EETimedModefyListener constructor comment. - * - * @param listener - * java.awt.event.ActionListener - */ - public TimedModifyListener(ActionListener listener) { - super(listener); - } - - /* - * Re/Start the timer - */ - public void modifyText(org.eclipse.swt.events.ModifyEvent e) { - monitoringTarget = (Widget) e.getSource(); - restart(); - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/Timer.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/Timer.java deleted file mode 100644 index 85836eaff..000000000 --- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/Timer.java +++ /dev/null @@ -1,253 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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.common.frameworks.internal.ui; - -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; - - -public class Timer { - /** - * DoPostEvent is a runnable class that fires actionEvents to the listeners on the - * EventDispatchThread, via invokeLater. - * - * @see #post - */ - class DoPostEvent implements Runnable { - public void run() { - if (eventQueued) { - fireActionPerformed(new ActionEvent(getSource(), 0, null)); - cancelEvent(); - } - } - - Timer getTimer() { - return Timer.this; - } - } - - protected ListenerList listenerList = new ListenerList(); - boolean eventQueued = false; - int initialDelay, delay; - boolean repeats = true, coalesce = true; - private Runnable doPostEvent; - // These fields are maintained by TimerQueue. - // eventQueued can also be reset by the TimerQueue, but will only ever - // happen in applet case when TimerQueues thread is destroyed. - long expirationTime; - Timer nextTimer; - boolean running; - - /** - * Creates a Timer that will notify its listeners every <i>delay </i> milliseconds. - * - * @param delay - * The number of milliseconds between listener notification - * @param listener - * An initial listener - * @see #setInitialDelay - * @see #setRepeats - */ - public Timer(int delay, ActionListener listener) { - super(); - this.delay = delay; - this.initialDelay = delay; - - doPostEvent = new DoPostEvent(); - - if (listener != null) { - addActionListener(listener); - } - } - - /** - * Adds an actionListener to the Timer - */ - public void addActionListener(ActionListener listener) { - listenerList.add(listener); - } - - synchronized void cancelEvent() { - eventQueued = false; - } - - /** - * Notify all listeners that have registered interest for notification on this event type. The - * event instance is lazily created using the parameters passed into the fire method. - * - * @see EventListenerList - */ - protected void fireActionPerformed(ActionEvent e) { - // Guaranteed to return a non-null array - ActionListener[] listeners = listenerList.getListenerList(); - - // Process the listeners last to first, notifying - // those that are interested in this event - for (int i = listeners.length - 1; i >= 0; i -= 1) { - listeners[i].actionPerformed(e); - } - } - - /** - * Returns the Timer's delay. - * - * @see #setDelay - */ - public int getDelay() { - return delay; - } - - /** - * Returns the Timer's initial delay. - * - * @see #setDelay - */ - public int getInitialDelay() { - return initialDelay; - } - - /** - * Returns <b>true </b> if the Timer coalesces multiple pending <b>performCommand() </b> - * messages. - * - * @see #setCoalesce - */ - public boolean isCoalesce() { - return coalesce; - } - - /** - * Returns <b>true </b> if the Timer will send a <b>actionPerformed() </b> message to its - * listeners multiple times. - * - * @see #setRepeats - */ - public boolean isRepeats() { - return repeats; - } - - /** - * Returns <b>true </b> if the Timer is running. - * - * @see #start - */ - public boolean isRunning() { - return timerQueue().containsTimer(this); - } - - synchronized void post() { - if (!eventQueued) { - eventQueued = true; - org.eclipse.swt.widgets.Display.getDefault().asyncExec(doPostEvent); - } - } - - /** - * Removes an ActionListener from the Timer. - */ - public void removeActionListener(ActionListener listener) { - listenerList.remove(listener); - } - - /** - * Restarts a Timer, canceling any pending firings, and causing it to fire with its initial - * dely. - */ - public void restart() { - stop(); - start(); - } - - /** - * Sets whether the Timer coalesces multiple pending ActionEvent firings. A busy application may - * not be able to keep up with a Timer's message generation, causing multiple - * <b>actionPerformed() </b> message sends to be queued. When processed, the application sends - * these messages one after the other, causing the Timer's listeners to receive a sequence of - * <b>actionPerformed() </b> messages with no delay between them. Coalescing avoids this - * situation by reducing multiple pending messages to a single message send. Timers coalesce - * their message sends by default. - */ - public void setCoalesce(boolean flag) { - coalesce = flag; - } - - /** - * Sets the Timer's delay, the number of milliseconds between successive <b>actionPerfomed() - * </b> messages to its listeners - * - * @see #setInitialDelay - */ - public void setDelay(int delay) { - if (delay < 0) { - String msg = WTPCommonUIResourceHandler.getString(WTPCommonUIResourceHandler.Timer_UI_0, new Object[]{Integer.toString(delay)}); //$NON-NLS-1$ - throw new IllegalArgumentException(msg); - } - this.delay = delay; - } - - /** - * Sets the Timer's initial delay. This will be used for the first "ringing" of the Timer only. - * Subsequent ringings will be spaced using the delay property. - * - * @see #setDelay - */ - public void setInitialDelay(int initialDelay) { - if (initialDelay < 0) { - String msg = WTPCommonUIResourceHandler.getString(WTPCommonUIResourceHandler.Timer_UI_1, new Object[]{Integer.toString(initialDelay)}); //$NON-NLS-1$ - throw new IllegalArgumentException(msg); - } - this.initialDelay = initialDelay; - } - - /** - * If <b>flag </b> is <b>false </b>, instructs the Timer to send <b>actionPerformed() </b> to - * its listeners only once, and then stop. - */ - public void setRepeats(boolean flag) { - repeats = flag; - } - - /** - * Starts the Timer, causing it to send <b>actionPerformed() </b> messages to its listeners. - * - * @see #stop - */ - public void start() { - timerQueue().addTimer(this, System.currentTimeMillis() + getInitialDelay()); - } - - /** - * Stops a Timer, causing it to stop sending <b>actionPerformed() </b> messages to its Target. - * - * @see #start - */ - public void stop() { - timerQueue().removeTimer(this); - cancelEvent(); - } - - /** - * Returns the timer queue. - */ - TimerQueue timerQueue() { - return TimerQueue.singleton(); - } - - /** - * Return the source for the ActionEvent that is fired. - * - * @return - */ - protected Object getSource() { - return this; - } -} diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/TimerQueue.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/TimerQueue.java deleted file mode 100644 index 7b54f0393..000000000 --- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/TimerQueue.java +++ /dev/null @@ -1,231 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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.common.frameworks.internal.ui; - - - - -class TimerQueue implements Runnable { - private static TimerQueue singleton; - Timer firstTimer; - boolean running; - private static final Object classLock = new Object(); - - /** - * Constructor for TimerQueue. - */ - public TimerQueue() { - super(); - - // Now start the TimerQueue thread. - start(); - } - - synchronized void addTimer(Timer timer, long expirationTime) { - Timer previousTimer; - Timer nextTimer; - - // If the Timer is already in the queue, then ignore the add. - if (timer.running) { - return; - } - - previousTimer = null; - nextTimer = firstTimer; - - // Insert the Timer into the linked list in the order they will - // expire. If two timers expire at the same time, put the newer entry - // later so they expire in the order they came in. - - while (nextTimer != null) { - if (nextTimer.expirationTime > expirationTime) - break; - - previousTimer = nextTimer; - nextTimer = nextTimer.nextTimer; - } - - if (previousTimer == null) { - firstTimer = timer; - } else { - previousTimer.nextTimer = timer; - } - - timer.expirationTime = expirationTime; - timer.nextTimer = nextTimer; - timer.running = true; - notify(); - } - - synchronized boolean containsTimer(Timer timer) { - return timer.running; - } - - /** - * If there are a ton of timers, this method may never return. It loops checking to see if the - * head of the Timer list has expired. If it has, it posts the Timer and reschedules it if - * necessary. - */ - synchronized long postExpiredTimers() { - Timer timer; - long currentTime; - long timeToWait; - - // The timeToWait we return should never be negative and only be zero - // when we have no Timers to wait for. - - do { - timer = firstTimer; - if (timer == null) - return 0; - - currentTime = System.currentTimeMillis(); - timeToWait = timer.expirationTime - currentTime; - - if (timeToWait <= 0) { - try { - timer.post(); // have timer post an event - } catch (SecurityException e) { - } - - // Remove the timer from the queue - removeTimer(timer); - - // This tries to keep the interval uniform at - // the cost of drift. - if (timer.isRepeats()) { - addTimer(timer, currentTime + timer.getDelay()); - } - } - - // Allow other threads to call addTimer() and removeTimer() - // even when we are posting Timers like mad. Since the wait() - // releases the lock, be sure not to maintain any state - // between iterations of the loop. - - try { - wait(1); - } catch (InterruptedException e) { - } - } while (timeToWait <= 0); - - return timeToWait; - } - - synchronized void removeTimer(Timer timer) { - Timer previousTimer; - Timer nextTimer; - boolean found; - - if (!timer.running) - return; - - previousTimer = null; - nextTimer = firstTimer; - found = false; - - while (nextTimer != null) { - if (nextTimer == timer) { - found = true; - break; - } - - previousTimer = nextTimer; - nextTimer = nextTimer.nextTimer; - } - - if (!found) - return; - - if (previousTimer == null) { - firstTimer = timer.nextTimer; - } else { - previousTimer.nextTimer = timer.nextTimer; - } - - timer.expirationTime = 0; - timer.nextTimer = null; - timer.running = false; - } - - public synchronized void run() { - long timeToWait; - - try { - while (running) { - timeToWait = postExpiredTimers(); - try { - wait(timeToWait); - } catch (InterruptedException e) { - } - } - } catch (ThreadDeath td) { - running = false; - // Mark all the timers we contain as not being queued. - Timer timer = firstTimer; - while (timer != null) { - timer.eventQueued = false; - timer = timer.nextTimer; - } - synchronized (this) { - if (!this.running) - start(); - } - throw td; - } - } - - public static TimerQueue singleton() { - if (singleton == null) - synchronized (classLock) { - singleton = new TimerQueue(); - } - return singleton; - } - - synchronized void start() { - if (running) { - throw new RuntimeException(WTPCommonUIResourceHandler.TimerQueue_ERROR_0); //$NON-NLS-1$ - } - Thread timerThread = new Thread(this, "TimerQueue");//$NON-NLS-1$ - try { - timerThread.setDaemon(true); - } catch (SecurityException e) { - } - timerThread.start(); - running = true; - } - - synchronized void stop() { - running = false; - notify(); - } - - public synchronized String toString() { - StringBuffer buf; - Timer nextTimer; - - buf = new StringBuffer(); - buf.append("TimerQueue (");//$NON-NLS-1$ - - nextTimer = firstTimer; - while (nextTimer != null) { - buf.append(nextTimer.toString()); - - nextTimer = nextTimer.nextTimer; - if (nextTimer != null) - buf.append(", ");//$NON-NLS-1$ - } - - buf.append(")");//$NON-NLS-1$ - return buf.toString(); - } -} diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/UIEnablementIdentifier.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/UIEnablementIdentifier.java deleted file mode 100644 index 675dc5558..000000000 --- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/UIEnablementIdentifier.java +++ /dev/null @@ -1,75 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on Feb 12, 2004 - * - * To change the template for this generated file go to - * Window>Preferences>Java>Code Generation>Code and Comments - */ -package org.eclipse.wst.common.frameworks.internal.ui; - -import org.eclipse.core.resources.IProject; -import org.eclipse.ui.activities.IActivityManager; -import org.eclipse.ui.activities.IIdentifier; -import org.eclipse.ui.activities.IIdentifierListener; -import org.eclipse.ui.activities.IdentifierEvent; -import org.eclipse.wst.common.frameworks.internal.enablement.EnablementIdentifier; -import org.eclipse.wst.common.frameworks.internal.enablement.EnablementIdentifierEvent; -import org.eclipse.wst.common.frameworks.internal.enablement.IEnablementManager; - - -/** - * @author schacher - * - * To change the template for this generated type comment go to - * Window>Preferences>Java>Code Generation>Code and Comments - */ -class UIEnablementIdentifier extends EnablementIdentifier implements IIdentifierListener { - - private IIdentifier activityIdentifier; - - /** - * @param id - * @param project - */ - public UIEnablementIdentifier(String id, IProject project) { - super(id, project); - activityIdentifier = getActivityManager().getIdentifier(id); - activityIdentifier.addIdentifierListener(this); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.activities.IIdentifierListener#identifierChanged(org.eclipse.ui.activities.IdentifierEvent) - */ - public void identifierChanged(IdentifierEvent identifierEvent) { - boolean enabledChanged = resetEnabled(); - EnablementIdentifierEvent evt = new EnablementIdentifierEvent(this, false, enabledChanged); - fireIdentifierChanged(evt); - } - - protected IActivityManager getActivityManager() { - return ((UIEnablementManager) IEnablementManager.INSTANCE).getActivityManager(); - } - - /* - * (non-Javadoc) - * - * @see org.eclispe.wst.common.frameworks.internal.enablement.EnablementIdentifier#getNewEnabled() - */ - protected boolean getNewEnabled() { - return activityIdentifier.isEnabled() && super.getNewEnabled(); - } - - - -} diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/UIEnablementManager.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/UIEnablementManager.java deleted file mode 100644 index 44014e2dc..000000000 --- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/UIEnablementManager.java +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on Feb 3, 2004 - * - * To change the template for this generated file go to - * Window - Preferences - Java - Code Generation - Code and Comments - */ -package org.eclipse.wst.common.frameworks.internal.ui; - -import org.eclipse.core.resources.IProject; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.activities.IActivityManager; -import org.eclipse.ui.activities.IWorkbenchActivitySupport; -import org.eclipse.wst.common.frameworks.internal.enablement.EnablementIdentifier; -import org.eclipse.wst.common.frameworks.internal.enablement.EnablementManager; - -/** - * @author mdelder - */ -public class UIEnablementManager extends EnablementManager { - - private IWorkbenchActivitySupport activitySupport = null; - - public UIEnablementManager() { - super(); - } - - protected IActivityManager getActivityManager() { - return getActivitySupport().getActivityManager(); - } - - /** - * @return Returns the activitySupport. - */ - protected IWorkbenchActivitySupport getActivitySupport() { - if (activitySupport == null) - activitySupport = PlatformUI.getWorkbench().getActivitySupport(); - return activitySupport; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.frameworks.internal.enablement.EnablementManager#createIdentifier(java.lang.String, - * org.eclipse.core.resources.IProject) - */ - protected EnablementIdentifier createIdentifier(String identifierId, IProject project) { - return new UIEnablementIdentifier(identifierId, project); - } -} diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/UIOperationHandler.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/UIOperationHandler.java deleted file mode 100644 index 53ccd5396..000000000 --- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/UIOperationHandler.java +++ /dev/null @@ -1,187 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on Aug 5, 2004 - * - * TODO To change the template for this generated file go to - * Window - Preferences - Java - Code Generation - Code and Comments - */ -package org.eclipse.wst.common.frameworks.internal.ui; - -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.wst.common.frameworks.internal.operations.IOperationHandler; - - -/** - * @author dfholt - * - * TODO To change the template for this generated type comment go to Window - Preferences - Java - - * Code Generation - Code and Comments - */ -public class UIOperationHandler implements IOperationHandler { - protected Shell parentShell; - final public static String DEFAULT_INFORMATION = "Information"; //$NON-NLS-1$ - final public static String DEFAULT_ERROR = "Error"; //$NON-NLS-1$ - final public static String DEFAULT_CONFIRM = "Confirm"; //$NON-NLS-1$ - protected String informationTitle = DEFAULT_INFORMATION; - protected String confirmTitle = DEFAULT_CONFIRM; - protected String errorTitle = DEFAULT_ERROR; - - /** - * UIOperationHandler constructor comment. - */ - public UIOperationHandler() { - super(); - } - - /** - * UIOperationHandler constructor comment. - */ - public UIOperationHandler(Shell parent) { - super(); - parentShell = parent; - } - - /** - * A decision needs to made as to whether an action/operation can continue - */ - public boolean canContinue(String message) { - return MessageDialog.openQuestion(getParentShell(), getConfirmTitle(), message); - } - - /** - * A decision needs to made as to whether an action/operation can continue - */ - public boolean canContinue(String message, String[] items) { - return ListMessageDialog.openQuestion(getParentShell(), getConfirmTitle(), message, items); - } - - /** - * A decision needs to made as to whether an action/operation can continue. The boolean array - * will return two booleans. The first indicates their response to the original question and the - * second indicates if they selected the apply to all check box. - * - * Return the return code for the dialog. 0 = Yes, 1 = Yes to all, 2 = No - */ - public int canContinueWithAllCheck(String message) { - MessageDialog dialog = new MessageDialog(getParentShell(), getConfirmTitle(), null, // accept - // the - // default - // window - // icon - message, MessageDialog.QUESTION, new String[]{IDialogConstants.YES_LABEL, IDialogConstants.YES_TO_ALL_LABEL, IDialogConstants.NO_LABEL}, 1); // yes - // is - // the - // default - return dialog.open(); - } - - /* - * (non-Javadoc) - * - * @see com.ibm.etools.j2ee.operations.IOperationHandler#canContinueWithAllCheckAllowCancel(java.lang.String) - */ - public int canContinueWithAllCheckAllowCancel(String message) { - MessageDialog dialog = new MessageDialog(getParentShell(), getConfirmTitle(), null, // accept - // the - // default - // window - // icon - message, MessageDialog.QUESTION, new String[]{IDialogConstants.YES_LABEL, IDialogConstants.YES_TO_ALL_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL}, 1); // yes - // is - // the - // default - return dialog.open(); - } - - /** - * An error has occurred - */ - public void error(String message) { - MessageDialog.openError(getParentShell(), getErrorTitle(), message); - } - - /** - * The dialog title to be used for confirmations - */ - public java.lang.String getConfirmTitle() { - return confirmTitle; - } - - /** - * The dialog title to be used for errors - */ - public java.lang.String getErrorTitle() { - return errorTitle; - } - - /** - * The dialog title to be used for information - */ - public java.lang.String getInformationTitle() { - return informationTitle; - } - - public Shell getParentShell() { - if (parentShell == null) - parentShell = WTPUIPlugin.getPluginWorkbench().getActiveWorkbenchWindow().getShell(); - - return parentShell; - } - - /** - * An informational message needs to be presented - */ - public void inform(String message) { - MessageDialog.openInformation(getParentShell(), getInformationTitle(), message); - } - - /** - * Insert the method's description here. Creation date: (8/9/2001 11:51:36 AM) - * - * @param newConfirmTitle - * java.lang.String - */ - public void setConfirmTitle(java.lang.String newConfirmTitle) { - confirmTitle = newConfirmTitle; - } - - /** - * Insert the method's description here. Creation date: (8/9/2001 11:51:36 AM) - * - * @param newErrorTitle - * java.lang.String - */ - public void setErrorTitle(java.lang.String newErrorTitle) { - errorTitle = newErrorTitle; - } - - /** - * Insert the method's description here. Creation date: (8/9/2001 11:51:36 AM) - * - * @param newInformationTitle - * java.lang.String - */ - public void setInformationTitle(java.lang.String newInformationTitle) { - informationTitle = newInformationTitle; - } - - /** - * @see com.ibm.etools.j2ee.operations.IOperationHandler#getContext() - */ - public Object getContext() { - return getParentShell(); - } - - -} diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/UITesterImpl.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/UITesterImpl.java deleted file mode 100644 index 3e8025698..000000000 --- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/UITesterImpl.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on Oct 27, 2003 - * - * To change the template for this generated file go to - * Window>Preferences>Java>Code Generation>Code and Comments - */ -package org.eclipse.wst.common.frameworks.internal.ui; - -import org.eclipse.jem.util.UITester; -import org.eclipse.ui.PlatformUI; - - -/** - * @author schacher - * - * To change the template for this generated type comment go to - * Window>Preferences>Java>Code Generation>Code and Comments - */ -public class UITesterImpl implements UITester { - - /** - * - */ - public UITesterImpl() { - super(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.frameworks.internal.UITester#isCurrentContextUI() - */ - public boolean isCurrentContextUI() { - try { - return PlatformUI.isWorkbenchRunning() || PlatformUI.getWorkbench().isClosing(); - } catch (RuntimeException e) { - return false; - } - } - -} diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/ValidationStatus.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/ValidationStatus.java deleted file mode 100644 index e3204e868..000000000 --- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/ValidationStatus.java +++ /dev/null @@ -1,166 +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 - *******************************************************************************/ - -package org.eclipse.wst.common.frameworks.internal.ui; - -import java.util.Enumeration; -import java.util.HashMap; -import java.util.Hashtable; -import java.util.Iterator; -import java.util.Map; - -import org.eclipse.swt.widgets.Control; - -/** - * This object encompas a set of Validation status Creation date: (9/10/2001 5:35:12 PM) - * - * @author: Administrator - */ -public class ValidationStatus { - Hashtable errMsgs = new Hashtable(); - Hashtable errStatus = new Hashtable(); - Hashtable tControls = new Hashtable(); - Map warnMsgs; - Map warnStatus; - - /** - * ValidationStatus constructor comment. - */ - public ValidationStatus() { - super(); - } - - /* - * Look for any error. If there is more than one, return errors according to their key. i.e., - * lower key errors will be returned first. - */ - public String getLastErrMsg() { - - Enumeration e = errStatus.keys(); - String[] errs = new String[errStatus.size()]; - for (int i = 0; i < errs.length; i++) - errs[i] = null; - boolean foundOne = false; - while (e.hasMoreElements()) { - Integer key = (Integer) e.nextElement(); - if (!((Boolean) errStatus.get(key)).booleanValue()) { - errs[key.intValue() % errs.length] = (String) errMsgs.get(key); - foundOne = true; - } - } - if (foundOne) - for (int i = 0; i < errs.length; i++) - if (errs[i] != null) - return errs[i]; - return null; - } - - private Map getWarningMsgs() { - if (warnMsgs == null) - warnMsgs = new HashMap(); - return warnMsgs; - } - - private Map getWarningStatusMap() { - if (warnStatus == null) - warnStatus = new HashMap(); - return warnStatus; - } - - /* - * Look for any warning. If there is more than one, return warnings according to their key. - * i.e., lower key errors will be returned first. - */ - public String getLastWarningMsg() { - if (warnStatus == null) - return null; - Iterator e = warnStatus.keySet().iterator(); - String[] warns = new String[warnStatus.size()]; - for (int i = 0; i < warns.length; i++) - warns[i] = null; - boolean foundOne = false; - while (e.hasNext()) { - Integer key = (Integer) e.next(); - if (!((Boolean) warnStatus.get(key)).booleanValue()) { - warns[key.intValue() % warns.length] = (String) warnMsgs.get(key); - foundOne = true; - } - } - if (foundOne) - for (int i = 0; i < warns.length; i++) - if (warns[i] != null) - return warns[i]; - return null; - } - - public String getLastErrMsgAndFocus() { - - Enumeration e = errStatus.keys(); - - Integer theOne = null; - while (e.hasMoreElements()) { - Integer key = (Integer) e.nextElement(); - if (!((Boolean) errStatus.get(key)).booleanValue()) { - if (theOne == null || key.intValue() < theOne.intValue()) { - theOne = key; - } - } - } - if (theOne != null) { - Control control = (Control) tControls.get(theOne); - if (control != null) { - control.setFocus(); - } - return ((String) errMsgs.get(theOne)); - } - return null; - } - - public boolean hasError(Integer key) { - Boolean stat = (Boolean) errStatus.get(key); - if (stat != null) - return stat.booleanValue(); - return true; - } - - public void setControl(Integer key, Control control) { - tControls.put(key, control); - } - - public void setErrorStatus(Integer key, Boolean status, String msg) { - errMsgs.put(key, msg); - errStatus.put(key, status); - } - - public void setErrorStatus(Integer key, String msg) { - errMsgs.put(key, msg); - errStatus.put(key, new Boolean(false)); - } - - public void setWarningStatus(Integer key, String msg) { - getWarningMsgs().put(key, msg); - getWarningStatusMap().put(key, new Boolean(false)); - } - - public void setOKStatus(Integer key) { - errMsgs.put(key, ""); //$NON-NLS-1$ - errStatus.put(key, new Boolean(true)); - if (warnMsgs != null) - warnMsgs.put(key, ""); //$NON-NLS-1$ - if (warnStatus != null) - warnStatus.put(key, new Boolean(true)); - } - - public void setStatus(Integer key, boolean ok, String msg) { - errMsgs.put(key, msg); - errStatus.put(key, new Boolean(ok)); - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/WTPActivityBridgeHelperImpl.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/WTPActivityBridgeHelperImpl.java deleted file mode 100644 index a8440ebed..000000000 --- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/WTPActivityBridgeHelperImpl.java +++ /dev/null @@ -1,81 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2004 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 - *******************************************************************************/ -/* - * Created on May 4, 2004 - * - */ -package org.eclipse.wst.common.frameworks.internal.ui; - -import java.util.HashSet; -import java.util.Set; - -import org.eclipse.ui.IPluginContribution; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.activities.IActivityManager; -import org.eclipse.ui.activities.IIdentifier; -import org.eclipse.ui.activities.IWorkbenchActivitySupport; -import org.eclipse.ui.activities.WorkbenchActivityHelper; -import org.eclipse.wst.common.frameworks.internal.activities.WTPActivityBridgeHelper; - - -/** - * @author jsholl - * - */ -public class WTPActivityBridgeHelperImpl implements WTPActivityBridgeHelper { - - private IWorkbenchActivitySupport workbenchActivitySupport = null; - private IActivityManager activityManager = null; - - public WTPActivityBridgeHelperImpl() { - workbenchActivitySupport = PlatformUI.getWorkbench().getActivitySupport(); - activityManager = workbenchActivitySupport.getActivityManager(); - } - - public void enableActivity(String activityID, boolean enabled) { - Set enabledActivities = activityManager.getEnabledActivityIds(); - Set newEnabledActivities = null; - if (enabled && !enabledActivities.contains(activityID)) { - newEnabledActivities = new HashSet(); - newEnabledActivities.addAll(enabledActivities); - newEnabledActivities.add(activityID); - } - if (!enabled && enabledActivities.contains(activityID)) { - newEnabledActivities = new HashSet(); - newEnabledActivities.addAll(enabledActivities); - newEnabledActivities.remove(activityID); - } - if (null != newEnabledActivities) { - workbenchActivitySupport.setEnabledActivityIds(newEnabledActivities); - } - } - - public Set getEnabledActivityIds() { - return activityManager.getEnabledActivityIds(); - } - - public void setEnabledActivityIds(Set activityIDs) { - workbenchActivitySupport.setEnabledActivityIds(activityIDs); - } - - public Set getActivityIDsFromContribution(final String localID, final String pluginID) { - IIdentifier identifier = activityManager.getIdentifier(WorkbenchActivityHelper.createUnifiedId(new IPluginContribution() { - public String getLocalId() { - return localID; - } - - public String getPluginId() { - return pluginID; - } - })); - return identifier.getActivityIds(); - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/WTPActivityHelper.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/WTPActivityHelper.java deleted file mode 100644 index 37a0221a9..000000000 --- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/WTPActivityHelper.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2004 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 - *******************************************************************************/ -/* - * Created on Apr 9, 2004 - * - * To change the template for this generated file go to - * Window - Preferences - Java - Code Generation - Code and Comments - */ -package org.eclipse.wst.common.frameworks.internal.ui; - -import org.eclipse.ui.IPluginContribution; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.activities.IIdentifier; -import org.eclipse.ui.activities.IWorkbenchActivitySupport; - -/** - * @author jsholl - * - * To change the template for this generated type comment go to Window - Preferences - Java - Code - * Generation - Code and Comments - */ -public class WTPActivityHelper { - - /** - * @return whether the UI is set up to filter contributions (has defined activity categories). - */ - public static final boolean isFiltering() { - return !PlatformUI.getWorkbench().getActivitySupport().getActivityManager().getDefinedActivityIds().isEmpty(); - } - - public static boolean allowUseOf(Object object) { - if (!isFiltering()) - return true; - if (object instanceof IPluginContribution) { - IPluginContribution contribution = (IPluginContribution) object; - if (contribution.getPluginId() != null) { - IWorkbenchActivitySupport workbenchActivitySupport = PlatformUI.getWorkbench().getActivitySupport(); - IIdentifier identifier = workbenchActivitySupport.getActivityManager().getIdentifier(createUnifiedId(contribution)); - return identifier.isEnabled(); - } - } - return true; - } - - - public static final String createUnifiedId(IPluginContribution contribution) { - if (contribution.getPluginId() != null) - return contribution.getPluginId() + '/' + contribution.getLocalId(); - return contribution.getLocalId(); - } - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/WTPCommonUIResourceHandler.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/WTPCommonUIResourceHandler.java deleted file mode 100644 index 6b250ff68..000000000 --- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/WTPCommonUIResourceHandler.java +++ /dev/null @@ -1,68 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on May 23, 2004 - * - * TODO To change the template for this generated file go to - * Window - Preferences - Java - Code Style - Code Templates - */ -package org.eclipse.wst.common.frameworks.internal.ui; - -import org.eclipse.osgi.util.NLS; - -/** - * @author vijayb - * - * TODO To change the template for this generated type comment go to Window - Preferences - Java - - * Code Style - Code Templates - */ -public class WTPCommonUIResourceHandler extends NLS { - private static final String BUNDLE_NAME = "wtpcommonui";//$NON-NLS-1$ - - private WTPCommonUIResourceHandler() { - // Do not instantiate - } - - public static String Project_location_; - public static String WTPOperationAction_UI_1; - public static String MasterDescriptor_UI_1; - public static String WTPOptionalOperationDataModel_UI_1; - public static String WTPOperationAction_UI_0; - public static String WTPOptionalOperationDataModel_UI_0; - public static String MULTIPLE_MODULE_PREF_TEXT; - public static String IActionWTPOperation_UI_0; - public static String MasterDescriptor_ERROR_2; - public static String Name_; - public static String WTPWizard_UI_1; - public static String WTPWizard_UI_0; - public static String Browse_; - public static String ExtendableWizard_UI_0; - public static String ExtendedWizardPage_ERROR_1; - public static String ExtendedWizardPage_ERROR_0; - public static String WTPActionDialog_UI_0; - public static String TimerQueue_ERROR_0; - public static String Timer_UI_1; - public static String Timer_UI_0; - public static String WizardPageExtensionManager_UI_4; - public static String WizardPageExtensionManager_UI_3; - public static String WizardPageExtensionManager_UI_2; - public static String WizardPageExtensionManager_UI_1; - public static String WizardPageExtensionManager_UI_0; - public static String Delete_UI_0; - - static { - NLS.initializeMessages(BUNDLE_NAME, WTPCommonUIResourceHandler.class); - } - - public static String getString(String key, Object[] args) { - return NLS.bind(key, args); - } -} diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/WTPGenericActionIds.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/WTPGenericActionIds.java deleted file mode 100644 index faaa4537c..000000000 --- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/WTPGenericActionIds.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2004 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 - *******************************************************************************/ -/* - * Created on Jun 16, 2004 - * - * TODO To change the template for this generated file go to - * Window - Preferences - Java - Code Style - Code Templates - */ -package org.eclipse.wst.common.frameworks.internal.ui; - -/** - * @author mdelder - * - * TODO To change the template for this generated type comment go to Window - Preferences - Java - - * Code Style - Code Templates - */ -public interface WTPGenericActionIds { - - String CUT = "org.eclipse.wst.common.generic.Cut"; //$NON-NLS-1$ - String COPY = "org.eclipse.wst.common.generic.Copy"; //$NON-NLS-1$ - String PASTE = "org.eclipse.wst.common.generic.Paste"; //$NON-NLS-1$ - String RENAME = "org.eclipse.wst.common.generic.Rename"; //$NON-NLS-1$ - String DELETE = "org.eclipse.wst.common.generic.Delete"; //$NON-NLS-1$ -}
\ No newline at end of file diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/WTPUIPlugin.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/WTPUIPlugin.java deleted file mode 100644 index f8cf1d68d..000000000 --- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/WTPUIPlugin.java +++ /dev/null @@ -1,140 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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.common.frameworks.internal.ui; - -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -import org.eclipse.core.commands.operations.IUndoableOperation; -import org.eclipse.core.resources.IWorkspace; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jem.util.logger.proxy.Logger; -import org.eclipse.jface.operation.IRunnableWithProgress; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.eclipse.wst.common.frameworks.internal.operations.IHeadlessRunnableWithProgress; - -/** - * The main plugin class to be used in the desktop. - */ -public class WTPUIPlugin extends AbstractUIPlugin { - - public static final String PLUGIN_ID = "org.eclipse.wst.common.frameworks.ui"; //$NON-NLS-1$ - public static final String EXTENDED_VIEWER_REGISTRY_EXTENSION_POINT = "extendedViewer"; //$NON-NLS-1$ - // The shared instance. - private static WTPUIPlugin plugin; - // Resource bundle. - private ResourceBundle resourceBundle; - - /** - * The constructor. - */ - public WTPUIPlugin() { - super(); - plugin = this; - try { - resourceBundle = ResourceBundle.getBundle("org.eclipse.wst.common.frameworks.internal.ui.WTPUIPluginResources"); //$NON-NLS-1$ - } catch (MissingResourceException x) { - resourceBundle = null; - } - } - - /** - * @param string - * @return - */ - public static IStatus createErrorStatus(String message) { - return createErrorStatus(message, null); - } - - /** - * @param string - * @return - */ - public static IStatus createErrorStatus(String message, Throwable exception) { - return new Status(IStatus.ERROR, PLUGIN_ID, -1, message, exception); - } - - /** - * Returns the shared instance. - */ - public static WTPUIPlugin getDefault() { - return plugin; - } - - public static Logger getLogger() { - return Logger.getLogger(PLUGIN_ID); - } - - /** - * Returns the workspace instance. - */ - public static IWorkspace getWorkspace() { - return ResourcesPlugin.getWorkspace(); - } - - /** - * Return the workbench - * - * This method is internal to the j2ee plugin and must not be called by any other plugins. - */ - - public static IWorkbench getPluginWorkbench() { - return getDefault().getWorkbench(); - - } - - public static RunnableOperationWrapper getRunnableWithProgress(final IUndoableOperation operation) { - return new RunnableOperationWrapper(operation); - } - - public static IRunnableWithProgress getRunnableWithProgress(IHeadlessRunnableWithProgress aHeadlessRunnableWithProgress) { - return new RunnableWithProgressWrapper(aHeadlessRunnableWithProgress); - } - - /** - * Returns the string from the plugin's resource bundle, or 'key' if not found. - */ - public static String getResourceString(String key) { - ResourceBundle bundle = WTPUIPlugin.getDefault().getResourceBundle(); - try { - return (bundle != null ? bundle.getString(key) : key); - } catch (MissingResourceException e) { - return key; - } - } - - /** - * Returns the plugin's resource bundle, - */ - public ResourceBundle getResourceBundle() { - return resourceBundle; - } - - public static void log( final Throwable e ) - { - final String msg = e.getMessage() + ""; - log( new Status( IStatus.ERROR, PLUGIN_ID, IStatus.OK, msg, e ) ); - } - - public static void log( final IStatus status ) - { - getDefault().getLog().log( status ); - } - - public static void log( final String msg ) - { - log( new Status( IStatus.ERROR, PLUGIN_ID, IStatus.OK, msg, null ) ); - } - -} diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/WorkspaceModifyComposedOperation.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/WorkspaceModifyComposedOperation.java deleted file mode 100644 index fed29fcf9..000000000 --- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/WorkspaceModifyComposedOperation.java +++ /dev/null @@ -1,82 +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 - *******************************************************************************/ - -package org.eclipse.wst.common.frameworks.internal.ui; - -import java.lang.reflect.InvocationTargetException; -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.SubProgressMonitor; -import org.eclipse.core.runtime.jobs.ISchedulingRule; -import org.eclipse.jface.operation.IRunnableWithProgress; - -/** - * An operation which delegates its work to a runnable that modifies the workspace. - * <p> - * This class may be instantiated; it is not intended to be subclassed. - * </p> - */ -public class WorkspaceModifyComposedOperation extends org.eclipse.ui.actions.WorkspaceModifyOperation { - protected List fRunnables; - - public WorkspaceModifyComposedOperation(ISchedulingRule rule) { - super(rule); - } - - /** - * Creates a new operation which will delegate its work to the given runnable. - */ - public WorkspaceModifyComposedOperation() { - super(); - } - - public WorkspaceModifyComposedOperation(ISchedulingRule rule, List nestedRunnablesWithProgress) { - super(rule); - fRunnables = nestedRunnablesWithProgress; - } - - public WorkspaceModifyComposedOperation(List nestedRunnablesWithProgress) { - super(); - fRunnables = nestedRunnablesWithProgress; - } - - /** - * Creates a new operation which will delegate its work to the given runnable. - * - * @param content - * the runnable to delegate to when this operation is executed - */ - public WorkspaceModifyComposedOperation(IRunnableWithProgress nestedOp) { - super(); - getRunnables().add(nestedOp); - } - - public boolean addRunnable(IRunnableWithProgress nestedOp) { - return getRunnables().add(nestedOp); - } - - protected void execute(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { - int size = fRunnables.size(); - monitor.beginTask("", size);//$NON-NLS-1$ - for (int i = 0; i < fRunnables.size(); i++) { - IRunnableWithProgress op = (IRunnableWithProgress) fRunnables.get(i); - op.run(new SubProgressMonitor(monitor, 1, SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK)); - } - } - - protected List getRunnables() { - if (fRunnables == null) - fRunnables = new ArrayList(3); - return fRunnables; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/package.html b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/package.html deleted file mode 100644 index fb8fe10ee..000000000 --- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/package.html +++ /dev/null @@ -1,36 +0,0 @@ -<html> -<head> -<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> -<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -<link rel="stylesheet" href="../../../../../..//apistyles.css" type="text/css"> -<title>wtp operation api overview</title> -</head> -<body> -<p> - The WTP Wizard API allows clients to build wizards in conjunction with - the WTP Operation Framework quickly and with minimal effort. - </p> -<table width="500"> -<tr> -<td> -<p>Under Construction.</p> -</td> -</tr> -</table> -<table cellpadding="10" cellspacing="10"> -<tr> -<td> -<p> -<img src="escape_out_to_source_folder level/overview/your_image.jpg"></p> -</td> -</tr> -<tr> -<td> -<p> -<i>Figure 1: Image description</i> -</p> -</td> -</tr> -</table> -</body> -</html> diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/package.xml b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/package.xml deleted file mode 100644 index e217a53f2..000000000 --- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/package.xml +++ /dev/null @@ -1,18 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<html> - <head> - <meta - name="root" - content="../../../../../../" /> - <title>wtp operation api overview</title> - </head> - - <body> - <abstract> - The WTP Wizard API allows clients to build wizards in conjunction with - the WTP Operation Framework quickly and with minimal effort. - </abstract> - <p>Under Construction.</p> - <img src="escape_out_to_source_folder level/overview/your_image.jpg" caption="Image description" /> - </body> -</html> |