Skip to main content

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

summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.wst.validation.ui')
-rw-r--r--plugins/org.eclipse.wst.validation.ui/.classpath8
-rw-r--r--plugins/org.eclipse.wst.validation.ui/.cvsignore6
-rw-r--r--plugins/org.eclipse.wst.validation.ui/.project26
-rw-r--r--plugins/org.eclipse.wst.validation.ui/META-INF/MANIFEST.MF21
-rw-r--r--plugins/org.eclipse.wst.validation.ui/about.html22
-rw-r--r--plugins/org.eclipse.wst.validation.ui/build.properties18
-rw-r--r--plugins/org.eclipse.wst.validation.ui/build/buildcontrol.properties16
-rw-r--r--plugins/org.eclipse.wst.validation.ui/build/package.xml18
-rw-r--r--plugins/org.eclipse.wst.validation.ui/build/sourcejar.txt1
-rw-r--r--plugins/org.eclipse.wst.validation.ui/build/wsBuild.xml17
-rw-r--r--plugins/org.eclipse.wst.validation.ui/plugin.properties16
-rw-r--r--plugins/org.eclipse.wst.validation.ui/plugin.xml53
-rw-r--r--plugins/org.eclipse.wst.validation.ui/prepareforpii.xml38
-rw-r--r--plugins/org.eclipse.wst.validation.ui/property_files/validate_ui.properties113
-rw-r--r--plugins/org.eclipse.wst.validation.ui/validateui/org/eclipse/wst/validation/internal/ui/ContextIds.java46
-rw-r--r--plugins/org.eclipse.wst.validation.ui/validateui/org/eclipse/wst/validation/internal/ui/ProgressAndTextDialog.java160
-rw-r--r--plugins/org.eclipse.wst.validation.ui/validateui/org/eclipse/wst/validation/internal/ui/ResourceConstants.java89
-rw-r--r--plugins/org.eclipse.wst.validation.ui/validateui/org/eclipse/wst/validation/internal/ui/ResourceHandler.java110
-rw-r--r--plugins/org.eclipse.wst.validation.ui/validateui/org/eclipse/wst/validation/internal/ui/ValidateAction.java66
-rw-r--r--plugins/org.eclipse.wst.validation.ui/validateui/org/eclipse/wst/validation/internal/ui/ValidationMenuAction.java568
-rw-r--r--plugins/org.eclipse.wst.validation.ui/validateui/org/eclipse/wst/validation/internal/ui/ValidationPreferencePage.java946
-rw-r--r--plugins/org.eclipse.wst.validation.ui/validateui/org/eclipse/wst/validation/internal/ui/ValidationPropertiesPage.java1033
-rw-r--r--plugins/org.eclipse.wst.validation.ui/validateui/org/eclipse/wst/validation/internal/ui/ValidationUIConstants.java19
-rw-r--r--plugins/org.eclipse.wst.validation.ui/validateui/org/eclipse/wst/validation/internal/ui/plugin/RunnableWithProgressWrapper.java97
-rw-r--r--plugins/org.eclipse.wst.validation.ui/validateui/org/eclipse/wst/validation/internal/ui/plugin/ValidationUIPlugin.java98
25 files changed, 0 insertions, 3605 deletions
diff --git a/plugins/org.eclipse.wst.validation.ui/.classpath b/plugins/org.eclipse.wst.validation.ui/.classpath
deleted file mode 100644
index 1c68a63f9..000000000
--- a/plugins/org.eclipse.wst.validation.ui/.classpath
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="validateui/"/>
- <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.validation.ui/.cvsignore b/plugins/org.eclipse.wst.validation.ui/.cvsignore
deleted file mode 100644
index 994d5a267..000000000
--- a/plugins/org.eclipse.wst.validation.ui/.cvsignore
+++ /dev/null
@@ -1,6 +0,0 @@
-bin
-temp.folder
-build.xml
-runtime
-@dot
-src.zip
diff --git a/plugins/org.eclipse.wst.validation.ui/.project b/plugins/org.eclipse.wst.validation.ui/.project
deleted file mode 100644
index 32471f6b5..000000000
--- a/plugins/org.eclipse.wst.validation.ui/.project
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.wst.validation.ui</name>
- <comment></comment>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.pde.PluginNature</nature>
- </natures>
-</projectDescription>
diff --git a/plugins/org.eclipse.wst.validation.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.wst.validation.ui/META-INF/MANIFEST.MF
deleted file mode 100644
index abc57729e..000000000
--- a/plugins/org.eclipse.wst.validation.ui/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,21 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: Validation Framework UI
-Bundle-SymbolicName: org.eclipse.wst.validation.ui; singleton:=true
-Bundle-Version: 1.0.1.qualifier
-Bundle-Activator: org.eclipse.wst.validation.internal.ui.plugin.ValidationUIPlugin
-Bundle-Vendor: Eclipse.org
-Bundle-Localization: plugin
-Export-Package: .,
- org.eclipse.wst.validation.internal.ui,
- org.eclipse.wst.validation.internal.ui.plugin
-Require-Bundle: org.eclipse.ui.ide,
- org.eclipse.core.resources,
- org.eclipse.ui,
- org.eclipse.swt,
- org.eclipse.wst.common.frameworks.ui,
- org.eclipse.core.runtime,
- org.eclipse.wst.common.frameworks,
- org.eclipse.wst.validation,
- org.eclipse.jem.util
-Eclipse-AutoStart: true
diff --git a/plugins/org.eclipse.wst.validation.ui/about.html b/plugins/org.eclipse.wst.validation.ui/about.html
deleted file mode 100644
index 6f6b96c4c..000000000
--- a/plugins/org.eclipse.wst.validation.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 (&quot;Content&quot;). Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the
-Eclipse Public License Version 1.0 (&quot;EPL&quot;). 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, &quot;Program&quot; 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 (&quot;Redistributor&quot;) 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.validation.ui/build.properties b/plugins/org.eclipse.wst.validation.ui/build.properties
deleted file mode 100644
index caced1137..000000000
--- a/plugins/org.eclipse.wst.validation.ui/build.properties
+++ /dev/null
@@ -1,18 +0,0 @@
-###############################################################################
-# Copyright (c) 2001, 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
-###############################################################################
-bin.includes = .,\
- plugin.xml,\
- plugin.properties,\
- META-INF/,\
- about.html
-source.. = validateui/,\
- property_files/
-output.. = bin/
diff --git a/plugins/org.eclipse.wst.validation.ui/build/buildcontrol.properties b/plugins/org.eclipse.wst.validation.ui/build/buildcontrol.properties
deleted file mode 100644
index 5938f6c69..000000000
--- a/plugins/org.eclipse.wst.validation.ui/build/buildcontrol.properties
+++ /dev/null
@@ -1,16 +0,0 @@
-###############################################################################
-# Copyright (c) 2001, 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
-###############################################################################
-CONTACT=ruthdaly@ca.ibm.com
-ComponentShortName=validationui
-ComponentFullName=Validation Framework UI
-ComponentCompetency=Validation
-JavaCompile.1=srcjar
-BuildVerification.1=dir \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.validation.ui/build/package.xml b/plugins/org.eclipse.wst.validation.ui/build/package.xml
deleted file mode 100644
index 0ae0c3158..000000000
--- a/plugins/org.eclipse.wst.validation.ui/build/package.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-<project name="com.ibm.etools.validation.ui" default="packagingPlugin" basedir="./..">
- <target name="init">
- <property name="packageDir" value=""/>
- <property name="plugin.directory" value="${basedir}"/>
- <property name="plugin.id" value="com.ibm.etools.validation.ui"/>
- <property name="plugin.version" value=""/>
- </target>
- <target name="packagingPlugin" depends="init">
- <echo message="${plugin.id}"/>
- <copy todir="${packageDir}/plugins/${plugin.id}_${plugin.version}">
- <fileset dir="${plugin.directory}">
- <include name="plugin.properties"/>
- <include name="plugin.xml"/>
- <include name="runtime/validateui.jar"/>
- </fileset>
- </copy>
- </target>
-</project>
diff --git a/plugins/org.eclipse.wst.validation.ui/build/sourcejar.txt b/plugins/org.eclipse.wst.validation.ui/build/sourcejar.txt
deleted file mode 100644
index b96f41cbb..000000000
--- a/plugins/org.eclipse.wst.validation.ui/build/sourcejar.txt
+++ /dev/null
@@ -1 +0,0 @@
-validateui
diff --git a/plugins/org.eclipse.wst.validation.ui/build/wsBuild.xml b/plugins/org.eclipse.wst.validation.ui/build/wsBuild.xml
deleted file mode 100644
index 77c0b82d1..000000000
--- a/plugins/org.eclipse.wst.validation.ui/build/wsBuild.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE project [
- <!ENTITY baseBuild SYSTEM "file:../../wsBuildDef.xml">
-]>
-
-<project name="buildPlugin" default="build" basedir="./..">
-
-<!-- include the common xml build file -->
-&baseBuild;
-
-<target name="build" depends="prepare" if="plugin.id">
- <antcall target="buildjar">
- <param name="jarname" value="${defaultjarname}"/>
- <param name="jarclasspath" value="${plugin.classpath}"/>
- </antcall>
-</target>
-</project>
diff --git a/plugins/org.eclipse.wst.validation.ui/plugin.properties b/plugins/org.eclipse.wst.validation.ui/plugin.properties
deleted file mode 100644
index 5002309a4..000000000
--- a/plugins/org.eclipse.wst.validation.ui/plugin.properties
+++ /dev/null
@@ -1,16 +0,0 @@
-###############################################################################
-# Copyright (c) 2001, 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
-###############################################################################
-#
-# Version 1.3
-#
-VBF_TITLE_PROPERTIES=Validation
-VBF_UI_POPUP_RUNVALIDATION=&Run Validation
-VBF_TITLE_PREFERENCE=Validation
diff --git a/plugins/org.eclipse.wst.validation.ui/plugin.xml b/plugins/org.eclipse.wst.validation.ui/plugin.xml
deleted file mode 100644
index eedab8f64..000000000
--- a/plugins/org.eclipse.wst.validation.ui/plugin.xml
+++ /dev/null
@@ -1,53 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<plugin>
-
-
-<!-- ============================================== -->
-<!-- Popup Contributions -->
-<!-- ============================================== -->
-<!-- By saying "adaptable=true", this item will appear on both IProject and IJavaProject -->
- <extension
- point="org.eclipse.ui.popupMenus">
- <viewerContribution
- targetID="#CommonNavigatorPopupMenu"
- id="ValidationMenuAction">
- <action
- label="%VBF_UI_POPUP_RUNVALIDATION"
- class="org.eclipse.wst.validation.internal.ui.ValidationMenuAction"
- menubarPath="additions"
- enablesFor="+"
- id="ValidationAction">
- </action>
- </viewerContribution>
- </extension>
-
-
-<!-- ====================================================== -->
-<!-- Validation preference page -->
-<!-- ====================================================== -->
- <extension
- point="org.eclipse.ui.preferencePages">
- <page
- name="%VBF_TITLE_PREFERENCE"
- class="org.eclipse.wst.validation.internal.ui.ValidationPreferencePage"
- id="ValidationPreferencePage">
- </page>
- </extension>
-
-<!-- ====================================================== -->
-<!-- Validation properties page -->
-<!-- ====================================================== -->
-<!-- By saying "adaptable=true", this item will appear on both IProject and IJavaProject -->
- <extension
- point="org.eclipse.ui.propertyPages">
- <page
- adaptable="true"
- objectClass="org.eclipse.core.resources.IProject"
- name="%VBF_TITLE_PROPERTIES"
- class="org.eclipse.wst.validation.internal.ui.ValidationPropertiesPage"
- id="ValidationPropertiesPage">
- </page>
- </extension>
-
-</plugin>
diff --git a/plugins/org.eclipse.wst.validation.ui/prepareforpii.xml b/plugins/org.eclipse.wst.validation.ui/prepareforpii.xml
deleted file mode 100644
index 1c3e2789b..000000000
--- a/plugins/org.eclipse.wst.validation.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.etools.validation.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.validation.ui/property_files/validate_ui.properties b/plugins/org.eclipse.wst.validation.ui/property_files/validate_ui.properties
deleted file mode 100644
index 36173e092..000000000
--- a/plugins/org.eclipse.wst.validation.ui/property_files/validate_ui.properties
+++ /dev/null
@@ -1,113 +0,0 @@
-###############################################################################
-# Copyright (c) 2001, 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
-###############################################################################
-# *************************************************************************
-# * Code oriented instructions:
-# *
-# * In the string, you may see the following special sequences:
-# * a) {n} where n is a number. These are replaceable parameters.
-# * b) '' In .properties files, in order to see one apostrophe (') in the final
-# * string, sometimes two apostrophes must be entered in the string. In the translated
-# * string, if there is at least one {n} in the string, then to show one apostrophe
-# * to the user, put two apostrophes in the string. If there are no {n} in the string,
-# * then put one apostrophe.
-# * For example, say that you want the user to read "George's file".
-# * GEORGE=George's file was on the desk.
-# * GEORGE2=George''s file and {0} were on the desk.
-# * GEORGE uses one apostrophe because there are no {n} and GEORGE2
-# * uses two apostrophes because there is a {n}.
-# * c) '' text '' where text can be any word(s). The text between the double
-# * apostrophes should not be translated.
-# * d) <text> where text can be any word(s). The text between the angle
-# * brackets should NOT be translated.
-# * e) "text" where text can be any word(s). The text between the quotation
-# * marks should NOT be translated.
-# *
-# *************************************************************************
-# * Other instructions
-# * a) Do not translate any text that is on a line which begins with a comment
-# * symbol (#).
-# * b) Do not translate these words:
-# * schema, EJB, RDB, JAR, RMI, BMP, CMP, OOSQL
-# * c) Please return the .properties files using the same directory structure.
-# * This is necessary because two of the files have the same name.
-# *
-# *************************************************************************
-# Any other comments to the translators are on lines which start like this: # 2TC:
-#
-# Version 1.12
-#
-#
-# ID:
-# VBF - Validation Builder Framework
-#
-
-#
-# Begin Validation Builder Framework UI Strings
-#
-# IDs:
-# VBF_EXC=Exception or error text
-# VBF_UI=UI label
-#
-PREF_BUTTON_OVERRIDE=Allow projects to override these preference settings
-PREF_BUTTON_FULL=Run validation when you manually build a project
-PREF_BUTTON_AUTO=Run validation automatically when you save changes to a resource
-PREF_BUTTON_SELECTALL=Select All
-PREF_BUTTON_DESELECTALL=Deselect All
-PREF_VALLIST_TITLE=The selected validators will run when validation is performed:
-PREF_LBL_MAXMSGS=Maximum number of validation messages on a project
-PREF_ERROR_INT=IWAE0001E The number of validation messages must be a positive integer.
-PREF_BUTTON_ASYNC=Run validation in a background thread
-
-PROP_BUTTON_OVERRIDE=Override validation preferences
-PROP_BUTTON_FULL=Run validation when you manually build {0}
-VBF_UI_LBL_AUTO_VALIDATE=Run validation automatically when you save changes to {0} resources.
-PROP_BUTTON_SELECTALL=Select All
-PROP_BUTTON_DESELECTALL=Deselect All
-VBF_UI_LBL_DESC=The selected validators will run when {0} is validated:
-PROP_LBL_MAXMSSGS=Maximum number of validation messages on {0}
-PROP_ERROR_INT=IWAE0002E The number of validation messages must be a positive integer.
-PROP_LBL_CANNOTOVERRIDE=To enable the "Override validation preferences" checkbox, select the "Allow projects to override these preference settings" checkbox in the workbench Preferences dialog.
-PROP_BUTTON_ASYNC=Run validation in a background thread on {0}
-
-VBF_EXC_INTERNAL=IWAE0003E An unexpected error occurred during validation. Read the log file.
-VBF_EXC_INTERNAL_PROJECT=IWAE0004E An unexpected error occurred during validation of project {0}. Read the log file.
-VBF_EXC_INTERNAL_TITLE=IWAE0005E Internal error
-VBF_EXC_INTERNAL_PAGE=IWAE0006E An unexpected error occured; click Cancel to close the wizard.
-
-VBF_EXC_INVALID_REGISTER=IWAE0007E Validators can run only on open resources.
-
-VBF_UI_NO_VALIDATORS_INSTALLED=No validators are installed.
-
-VBF_UI_LBL_NOVALIDATORS_DESC=It is not possible to run any Validators, at the project level, for this type of project.
-
-VBF_UI_NO_VALIDATORS_ENABLED=Enable at least one validator on {0}. To select the validators that you want to run, open this project''s Properties wizard, turn to the Validation section, and select one or more validators in the list.
-
-VBF_UI_CHECKBOXGROUP_TITLE=Validators
-
-VBF_UI_CLOSED_PROJECT=Validation cannot run on a closed project. Open project {0} and try again.
-VBF_UI_MSSGBOX_TITLE_NONINC=Some of the Validators Do Not Support Automatic Validation
-VBF_UI_AUTO_ON_NONINC=Although automatic validation has been selected, some of the validators will not be invoked during the automatic processing. The following validators do not support automatic validation: {0}
-
-VBF_UI_PRJNEEDINPUT=Project {0} and its children were not validated because none of the enabled validators validates that type of project.
-VBF_UI_RESNEEDINPUT=Resource {0} was not validated because none of the enabled validators validates that type of resource.
-
-VBF_UI_MAX_REPORTED=Validation was terminated on {0} because the maximum number of messages were reported.
-VBF_UI_PRJVALIDATED=Validation of project {0} is complete.
-VBF_UI_RESVALIDATED=Validation of resource {0} is complete.
-VBF_UI_CANCELLED=Validation cancelled.
-VBF_UI_COMPLETE=Validation completed.
-VBF_UI_CLOSE=Close
-VBF_UI_STATUS=Status
-VBF_UI_RESCANCELLED=Validation was cancelled on {0}.
-#
-# End Validation Builder Framework UI Strings
-#
-
diff --git a/plugins/org.eclipse.wst.validation.ui/validateui/org/eclipse/wst/validation/internal/ui/ContextIds.java b/plugins/org.eclipse.wst.validation.ui/validateui/org/eclipse/wst/validation/internal/ui/ContextIds.java
deleted file mode 100644
index ab3e3379f..000000000
--- a/plugins/org.eclipse.wst.validation.ui/validateui/org/eclipse/wst/validation/internal/ui/ContextIds.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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
- *******************************************************************************/
-package org.eclipse.wst.validation.internal.ui;
-
-import org.eclipse.wst.common.frameworks.internal.ui.WTPUIPlugin;
-
-public interface ContextIds {
- static final String PREFIX = WTPUIPlugin.PLUGIN_ID;
-
- // context ids for the Validation Properties Page
- public static final String VALIDATION_PROPERTIES_PAGE = PREFIX + ".jvpp0000"; //$NON-NLS-1$
- public static final String VALIDATION_PROPERTIES_PAGE_DISABLED_OVERRIDE = PREFIX + ".jvpp0001"; //$NON-NLS-1$
- public static final String VALIDATION_PROPERTIES_PAGE_DISABLED_BUILD_NOVALSELECTED = PREFIX + ".jvpp0003"; //$NON-NLS-1$
- public static final String VALIDATION_PROPERTIES_PAGE_DISABLED_AUTO_AUTOBUILD = PREFIX + ".jvpp0004"; //$NON-NLS-1$
- public static final String VALIDATION_PROPERTIES_PAGE_DISABLED_AUTO_NOINCVALSELECTED = PREFIX + ".jvpp0005"; //$NON-NLS-1$
- public static final String VALIDATION_PROPERTIES_PAGE_DISABLED_AUTO_NOINCVALCONFIG = PREFIX + ".jvpp0006"; //$NON-NLS-1$
- public static final String VALIDATION_PROPERTIES_PAGE_AUTO_ENABLED = PREFIX + ".jvpp0020"; //$NON-NLS-1$
- public static final String VALIDATION_PROPERTIES_PAGE_OVERRIDE_ENABLED = PREFIX + ".jvpp0030"; //$NON-NLS-1$
- public static final String VALIDATION_PROPERTIES_PAGE_OVERRIDE_ENABLED_CANNOT_HONOUR_BOTH = PREFIX + ".jvpp0031"; //$NON-NLS-1$
- public static final String VALIDATION_PROPERTIES_PAGE_OVERRIDE_ENABLED_CANNOT_HONOUR_AUTO = PREFIX + ".jvpp0032"; //$NON-NLS-1$
- public static final String VALIDATION_PROPERTIES_PAGE_OVERRIDE_ENABLED_CANNOT_HONOUR_MANUAL = PREFIX + ".jvpp0033"; //$NON-NLS-1$
- public static final String VALIDATION_PROPERTIES_PAGE_REBUILD_ENABLED = PREFIX + ".jvpp0040"; //$NON-NLS-1$
- public static final String VALIDATION_PROPERTIES_PAGE_MAX_MESSAGES = PREFIX + ".jvpp0050"; //$NON-NLS-1$
-
- public static final String VALIDATION_PREFERENCE_PAGE = PREFIX + ".jvgp0000"; //$NON-NLS-1$
- public static final String VALIDATION_PREFERENCE_PAGE_OVERRIDE = PREFIX + ".jvgp0005"; //$NON-NLS-1$
- public static final String VALIDATION_PREFERENCE_PAGE_REBUILD_ENABLED = PREFIX + ".jvgp0010"; //$NON-NLS-1$
- // public static final String VALIDATION_PREFERENCE_PAGE_REBUILD_DISABLED = PREFIX +
- // ".jvgp0011"; //$NON-NLS-1$
- public static final String VALIDATION_PREFERENCE_PAGE_AUTO_ENABLED = PREFIX + ".jvgp0020"; //$NON-NLS-1$
- // public static final String VALIDATION_PREFERENCE_PAGE_AUTO_DISABLED_AUTOBUILD = PREFIX +
- // ".jvgp0021"; //$NON-NLS-1$
- // public static final String VALIDATION_PREFERENCE_PAGE_AUTO_DISABLED_NOINCVALSELECTED = PREFIX
- // + ".jvgp0022"; //$NON-NLS-1$
- // public static final String VALIDATION_PREFERENCE_PAGE_AUTO_DISABLED_NOINCVALCONFIG = PREFIX +
- // ".jvgp0023"; //$NON-NLS-1$
- public static final String VALIDATION_PREFERENCE_PAGE_MAX_MESSAGES = PREFIX + ".jvgp0030"; //$NON-NLS-1$
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.validation.ui/validateui/org/eclipse/wst/validation/internal/ui/ProgressAndTextDialog.java b/plugins/org.eclipse.wst.validation.ui/validateui/org/eclipse/wst/validation/internal/ui/ProgressAndTextDialog.java
deleted file mode 100644
index 63af6e3f5..000000000
--- a/plugins/org.eclipse.wst.validation.ui/validateui/org/eclipse/wst/validation/internal/ui/ProgressAndTextDialog.java
+++ /dev/null
@@ -1,160 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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
- *******************************************************************************/
-package org.eclipse.wst.validation.internal.ui;
-
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Cursor;
-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.Event;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-
-
-/**
- * Display both progress status and cumulative status (text) to the user.
- */
-public class ProgressAndTextDialog extends ProgressMonitorDialog {
- protected static final String NEWLINE = System.getProperty("line.separator"); //$NON-NLS-1$
- protected Text text = null;
- protected boolean cancelPressed = false; // Has the "Cancel" button been clicked?
- protected boolean closePressed = false; // Has the "Close" button been clicked?
- protected boolean operationDone = false; // Has the operation completed?
- protected Cursor arrowCursor; // The cursor used in the cancel button.
-
-
- public ProgressAndTextDialog(Shell parent) {
- super(parent);
- setShellStyle(SWT.BORDER | SWT.TITLE | SWT.RESIZE); // do not make this dialog modal
- setBlockOnOpen(false); // do not force the user to close this dialog before using eclipse
- }
-
- public Control createDialogArea(Composite parent) {
- super.createDialogArea(parent);
-
- final int hHint = 100;
- final int wHint = 250;
-
- Composite composite = new Composite(parent, SWT.NONE);
- Label textLabel = new Label(composite, SWT.LEFT | SWT.WRAP);
- textLabel.setText(ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_UI_STATUS));
- GridData labelData = new GridData();
- labelData.horizontalSpan = 2;
- textLabel.setLayoutData(labelData);
-
- composite.setLayout(new GridLayout()); // use the layout's default preferences
- GridData data = new GridData(GridData.FILL_BOTH);
- data.heightHint = hHint;
- data.widthHint = wHint;
- data.horizontalSpan = 2;
- composite.setLayoutData(data);
-
- text = new Text(composite, SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL | SWT.READ_ONLY | SWT.BORDER);
- GridData d = new GridData(GridData.FILL_BOTH);
- text.setLayoutData(d);
-
- return composite;
- }
-
- public void addText(final String messageString) {
- if (getShell() != null) {
- getShell().getDisplay().asyncExec(new Runnable() {
- public void run() {
- text.append(messageString);
- text.append(NEWLINE);
- }
- });
- }
- }
-
- /**
- * Do not dismiss the dialog until the user presses the Close button.
- */
- public boolean close() {
- if (closePressed) {
- // Cancel button converted to "Close" button, and user clicked the "Close" button
- return super.close();
- }
-
- // Turn the "cancel" button into a "Close" button and keep the window open until
- // the user clicks the "Close" button.
- progressIndicator.setVisible(false);
- if (arrowCursor == null)
- arrowCursor = new Cursor(cancel.getDisplay(), SWT.CURSOR_ARROW);
- getShell().setCursor(arrowCursor);
- if (cancelPressed) {
- messageLabel.setText(ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_UI_CANCELLED));
- } else {
- messageLabel.setText(ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_UI_COMPLETE));
- }
- cancel.setText(ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_UI_CLOSE));
- cancel.setEnabled(true);
- return false;
- }
-
- protected void internalCancelPressed() {
- // Has this method been called because "Cancel" has been clicked or
- // because "Close" has been clicked?
- if (operationDone) {
- // "Close" was clicked.
- closePressed = true;
- close();
- } else {
- // "Cancel" was clicked.
- cancelPressed = true;
- }
- }
-
- /**
- * @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(Composite)
- */
- protected void createButtonsForButtonBar(Composite parent) {
- super.createButtonsForButtonBar(parent);
-
- // Cannot override cancelPressed() because of the way that
- // ProgressMonitorDialog is coded.
- // The ProgressMonitorDialog parent, instead of overriding the
- // cancelPressed() method, added an anonymous Listener to the
- // cancel button. When the button's Listener is invoked, if
- // close() has been called by cancelPressed(), then an
- // exception is thrown (SWTException - "Widget is disposed').
- // Work around this by adding an anonymous
- // cancel listener, which will be called after the parent's
- // cancel listener, and this class' listener will call close().
- cancel.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event e) {
- internalCancelPressed();
- }
- });
- }
-
- /**
- * @see org.eclipse.jface.operation.IRunnableContext#run(boolean, boolean,
- * IRunnableWithProgress)
- */
- public void run(boolean fork, boolean cancelable, IRunnableWithProgress runnable) throws InvocationTargetException, InterruptedException {
- try {
- super.run(fork, cancelable, runnable);
- } finally {
- operationDone = true;
- }
- }
-
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.validation.ui/validateui/org/eclipse/wst/validation/internal/ui/ResourceConstants.java b/plugins/org.eclipse.wst.validation.ui/validateui/org/eclipse/wst/validation/internal/ui/ResourceConstants.java
deleted file mode 100644
index ac4b2442f..000000000
--- a/plugins/org.eclipse.wst.validation.ui/validateui/org/eclipse/wst/validation/internal/ui/ResourceConstants.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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
- *******************************************************************************/
-package org.eclipse.wst.validation.internal.ui;
-
-
-/**
- * This interface contains the constants used as keys into the ResourceBundle.
- */
-public interface ResourceConstants {
- // Internal error has occurred.
- public static final String VBF_EXC_INTERNAL = "VBF_EXC_INTERNAL"; //$NON-NLS-1$
-
- // Internal error occurred while constructing or running the Properties or Preference page.
- public static final String VBF_EXC_INTERNAL_PAGE = "VBF_EXC_INTERNAL_PAGE"; //$NON-NLS-1$
-
- // Internal error has occurred.
- public static final String VBF_EXC_INTERNAL_PROJECT = "VBF_EXC_INTERNAL_PROJECT"; //$NON-NLS-1$
- public static final String VBF_EXC_INTERNAL_TITLE = "VBF_EXC_INTERNAL_TITLE"; //$NON-NLS-1$
-
- // Should never happen, since plugin.xml specifies an IProject objectClass filter, but if the
- // ValidationPropertiesPage is shown on a non-IProject resource, this message will be what's
- // shown.
- public static final String VBF_EXC_INVALID_REGISTER = "VBF_EXC_INVALID_REGISTER"; //$NON-NLS-1$
-
- // On the Properties Page, this is the string which explains to the user what to do. The string
- // is
- // displayed in a label.
- public static final String VBF_UI_LBL_DESC = "VBF_UI_LBL_DESC"; //$NON-NLS-1$
-
- // On the Properties Page, this is the string which explains to the user what to do. The string
- // is
- // displayed in a label.
- public static final String VBF_UI_LBL_NOVALIDATORS_DESC = "VBF_UI_LBL_NOVALIDATORS_DESC"; //$NON-NLS-1$
-
- // Label on the checkbox button of the validator page
- public static final String VBF_UI_LBL_AUTO_VALIDATE = "VBF_UI_LBL_AUTO_VALIDATE"; //$NON-NLS-1$
-
- // If the user has selected "Validate this project" from the popupMenu, but has no validators
- // enabled, tell them that nothing will run.
- public static final String VBF_UI_NO_VALIDATORS_ENABLED = "VBF_UI_NO_VALIDATORS_ENABLED"; //$NON-NLS-1$
-
- // On the Properties Page, this is the title of the group which encloses the CheckboxTableViewer
- // (the list of configured validators).
- public static final String VBF_UI_CHECKBOXGROUP_TITLE = "VBF_UI_CHECKBOXGROUP_TITLE"; //$NON-NLS-1$
- public static final String VBF_UI_AUTO_ON_NONINC = "VBF_UI_AUTO_ON_NONINC"; //$NON-NLS-1$
- public static final String VBF_UI_MSSGBOX_TITLE_NONINC = "VBF_UI_MSSGBOX_TITLE_NONINC"; //$NON-NLS-1$
- public static final String VBF_UI_AUTO_NOTE = "VBF_UI_AUTO_NOTE"; //$NON-NLS-1$
- public static final String VBF_UI_AUTO_NOTE_TEXT = "VBF_UI_AUTO_NOTE_TEXT"; //$NON-NLS-1$
- public static final String VBF_UI_MENUITEM_TEXT = "VBF_UI_MENUITEM_TEXT"; //$NON-NLS-1$
- public static final String VBF_UI_MENUITEM_TEXT_DEFAULT = "VBF_UI_MENUITEM_TEXT_DEFAULT"; //$NON-NLS-1$
- public static final String VBF_UI_CLOSED_PROJECT = "VBF_UI_CLOSED_PROJECT"; //$NON-NLS-1$
- public static final String VBF_UI_NO_VALIDATORS_INSTALLED = "VBF_UI_NO_VALIDATORS_INSTALLED"; //$NON-NLS-1$
-
- public static final String VBF_UI_POPUP_RUNVALIDATION = "%VBF_UI_POPUP_RUNVALIDATION"; //$NON-NLS-1$
-
- /* package */static final String PREF_BUTTON_SELECTALL = "PREF_BUTTON_SELECTALL"; //$NON-NLS-1$
- /* package */static final String PREF_BUTTON_DESELECTALL = "PREF_BUTTON_DESELECTALL"; //$NON-NLS-1$
- /* package */static final String PREF_VALLIST_TITLE = "PREF_VALLIST_TITLE"; //$NON-NLS-1$
- /* package */static final String PREF_BUTTON_AUTO = "PREF_BUTTON_AUTO"; //$NON-NLS-1$
- /* package */static final String PREF_BUTTON_OVERRIDE = "PREF_BUTTON_OVERRIDE"; //$NON-NLS-1$
- /* package */static final String PREF_BUTTON_FULL = "PREF_BUTTON_FULL"; //$NON-NLS-1$
- /* package */static final String PREF_LBL_MAXMSGS = "PREF_LBL_MAXMSGS"; //$NON-NLS-1$
- /* package */static final String PROP_BUTTON_OVERRIDE = "PROP_BUTTON_OVERRIDE"; //$NON-NLS-1$
- /* package */static final String PROP_BUTTON_FULL = "PROP_BUTTON_FULL"; //$NON-NLS-1$
- /* package */static final String PROP_BUTTON_SELECTALL = "PROP_BUTTON_SELECTALL"; //$NON-NLS-1$
- /* package */static final String PROP_BUTTON_DESELECTALL = "PROP_BUTTON_DESELECTALL"; //$NON-NLS-1$
- /* package */static final String PROP_LBL_MAXMSSGS = "PROP_LBL_MAXMSSGS"; //$NON-NLS-1$
- /* package */static final String PREF_ERROR_INT = "PREF_ERROR_INT"; //$NON-NLS-1$
- /* package */static final String PROP_ERROR_INT = "PROP_ERROR_INT"; //$NON-NLS-1$
-
- /* package */static final String VBF_UI_PRJNEEDINPUT = "VBF_UI_PRJNEEDINPUT"; //$NON-NLS-1$
- /* package */static final String VBF_UI_RESNEEDINPUT = "VBF_UI_RESNEEDINPUT"; //$NON-NLS-1$
- /* package */static final String VBF_UI_MAX_REPORTED = "VBF_UI_MAX_REPORTED"; //$NON-NLS-1$
- /* package */static final String VBF_UI_PRJVALIDATED = "VBF_UI_PRJVALIDATED"; //$NON-NLS-1$
- /* package */static final String VBF_UI_RESVALIDATED = "VBF_UI_RESVALIDATED"; //$NON-NLS-1$
- /* package */static final String VBF_UI_CANCELLED = "VBF_UI_CANCELLED"; //$NON-NLS-1$
- /* package */static final String VBF_UI_COMPLETE = "VBF_UI_COMPLETE"; //$NON-NLS-1$
- /* package */static final String VBF_UI_CLOSE = "VBF_UI_CLOSE"; //$NON-NLS-1$
- /* package */static final String VBF_UI_STATUS = "VBF_UI_STATUS"; //$NON-NLS-1$
- /* package */static final String VBF_UI_RESCANCELLED = "VBF_UI_RESCANCELLED"; //$NON-NLS-1$
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.validation.ui/validateui/org/eclipse/wst/validation/internal/ui/ResourceHandler.java b/plugins/org.eclipse.wst.validation.ui/validateui/org/eclipse/wst/validation/internal/ui/ResourceHandler.java
deleted file mode 100644
index 531ff42bb..000000000
--- a/plugins/org.eclipse.wst.validation.ui/validateui/org/eclipse/wst/validation/internal/ui/ResourceHandler.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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
- *******************************************************************************/
-package org.eclipse.wst.validation.internal.ui;
-
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-import java.util.logging.Level;
-
-import org.eclipse.jem.util.logger.LogEntry;
-import org.eclipse.jem.util.logger.proxy.Logger;
-import org.eclipse.wst.common.frameworks.internal.ui.WTPUIPlugin;
-import org.eclipse.wst.validation.internal.ui.plugin.ValidationUIPlugin;
-
-
-/**
- * This class retrieves the Strings from the .properties file appropriate for the machine's Locale.
- */
-public class ResourceHandler {
- //TODO Make this class final once the public ResourceHandler has been deleted.
- private static ResourceBundle _bundle = null;
-
- protected ResourceHandler() {
- //TODO Make this method private once the public ResourceHandler has been deleted.
- super();
- }
-
- /**
- * Return the resource bundle which contains the messages, as identified by
- */
- public static ResourceBundle getBundle() {
- if (_bundle == null) {
- try {
- _bundle = ResourceBundle.getBundle(ValidationUIPlugin.getBundleName());
- } catch (MissingResourceException exc) {
- _bundle = null;
- Logger logger = WTPUIPlugin.getLogger();
- if (logger.isLoggingLevel(Level.FINE)) {
- LogEntry entry = ValidationUIPlugin.getLogEntry();
- entry.setSourceID("org.eclipse.wst.validation.internal.operations.ui.ResourceHandler.getBundle()"); //$NON-NLS-1$
- entry.setText("Cannot find bundle " + ValidationUIPlugin.getBundleName()); //$NON-NLS-1$
- entry.setTargetException(exc);
- logger.write(Level.FINE, entry);
- }
- }
- }
- return _bundle;
- }
-
- public static String getExternalizedMessage(String key) {
- try {
- ResourceBundle bundle = getBundle();
- if (bundle == null) {
- Logger logger = WTPUIPlugin.getLogger();
- if (logger.isLoggingLevel(Level.FINE)) {
- LogEntry entry = ValidationUIPlugin.getLogEntry();
- entry.setSourceID("org.eclipse.wst.validation.internal.operations.ui.ResourceHandler.getExternalizedMessage(String)"); //$NON-NLS-1$
- entry.setText("Resource bundle is null"); //$NON-NLS-1$
- logger.write(Level.FINE, entry);
- }
- return key;
- }
-
- return bundle.getString(key);
- } catch (NullPointerException exc) {
- Logger logger = WTPUIPlugin.getLogger();
- if (logger.isLoggingLevel(Level.FINE)) {
- LogEntry entry = ValidationUIPlugin.getLogEntry();
- entry.setSourceID("org.eclipse.wst.validation.internal.operations.ui.ResourceHandler.getExternalizedMessage(String)"); //$NON-NLS-1$
- entry.setText("Cannot find message id " + key); //$NON-NLS-1$
- entry.setTargetException(exc);
- logger.write(Level.FINE, entry);
- }
- }
- return key;
- }
-
- public static String getExternalizedMessage(String key, String[] parms) {
- String res = ""; //$NON-NLS-1$
- try {
- res = java.text.MessageFormat.format(getExternalizedMessage(key), parms);
- } catch (MissingResourceException exc) {
- Logger logger = WTPUIPlugin.getLogger();
- if (logger.isLoggingLevel(Level.FINE)) {
- LogEntry entry = ValidationUIPlugin.getLogEntry();
- entry.setSourceID("org.eclipse.wst.validation.internal.operations.ui.ResourceHandler.getExternalizedMessage(String, String[])"); //$NON-NLS-1$
- entry.setText("Cannot find message id " + key); //$NON-NLS-1$
- entry.setTargetException(exc);
- logger.write(Level.FINE, entry);
- }
- } catch (NullPointerException exc) {
- Logger logger = WTPUIPlugin.getLogger();
- if (logger.isLoggingLevel(Level.FINE)) {
- LogEntry entry = ValidationUIPlugin.getLogEntry();
- entry.setSourceID("org.eclipse.wst.validation.internal.operations.ui.ResourceHandler.getExternalizedMessage(String, String[])"); //$NON-NLS-1$
- entry.setText("Cannot format message id " + key + " with " + parms.length + " parameters."); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- entry.setTargetException(exc);
- logger.write(Level.FINE, entry);
- }
- }
- return res;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.validation.ui/validateui/org/eclipse/wst/validation/internal/ui/ValidateAction.java b/plugins/org.eclipse.wst.validation.ui/validateui/org/eclipse/wst/validation/internal/ui/ValidateAction.java
deleted file mode 100644
index d52b12d3d..000000000
--- a/plugins/org.eclipse.wst.validation.ui/validateui/org/eclipse/wst/validation/internal/ui/ValidateAction.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2001, 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
- **************************************************************************************************/
-package org.eclipse.wst.validation.internal.ui;
-
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.actions.SelectionListenerAction;
-import org.eclipse.wst.validation.internal.ui.plugin.ValidationUIPlugin;
-
-
-public class ValidateAction extends SelectionListenerAction {
- protected ValidationMenuAction delegate;
-
- public ValidateAction() {
- super(ValidationUIPlugin.getResourceString(ResourceConstants.VBF_UI_POPUP_RUNVALIDATION));
- delegate = new ValidationMenuAction();
- }
-
- /**
- * Implementation of method defined on <code>IAction</code>.
- */
- public void run() {
- delegate.run(this);
- }
-
- /**
- * Updates this action in response to the given selection.
- * <p>
- * The <code>SelectionListenerAction</code> implementation of this method returns
- * <code>true</code>. Subclasses may extend to react to selection changes; however, if the
- * super method returns <code>false</code>, the overriding method must also return
- * <code>false</code>.
- * </p>
- *
- * @param selection
- * the new selection
- * @return <code>true</code> if the action should be enabled for this selection, and
- * <code>false</code> otherwise
- */
- protected boolean updateSelection(IStructuredSelection selection) {
- if (!super.updateSelection(selection))
- return false;
-
- delegate.selectionChanged(this, selection);
-
- return isEnabled(); // "Enabled" is set by the delegate.
- }
-
- /**
- * If a subclass of ValidateAction enables this menu action on a type that is not an IResource,
- * this method returns the IResource[] that represent that object. If null is returned, the
- * object will be ignored and the user will not be notified that the object was not validated.
- * This method will be called when updateSelection and run are called. (The result of this
- * method is used to determine which resources will be validated)
- */
- protected IResource[] getResource(Object selected) {
- return null;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.validation.ui/validateui/org/eclipse/wst/validation/internal/ui/ValidationMenuAction.java b/plugins/org.eclipse.wst.validation.ui/validateui/org/eclipse/wst/validation/internal/ui/ValidationMenuAction.java
deleted file mode 100644
index 035a21876..000000000
--- a/plugins/org.eclipse.wst.validation.ui/validateui/org/eclipse/wst/validation/internal/ui/ValidationMenuAction.java
+++ /dev/null
@@ -1,568 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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
- *******************************************************************************/
-package org.eclipse.wst.validation.internal.ui;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.logging.Level;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceVisitor;
-import org.eclipse.core.resources.IWorkspaceRunnable;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.jem.util.logger.LogEntry;
-import org.eclipse.jem.util.logger.proxy.Logger;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IViewActionDelegate;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.wst.common.frameworks.internal.ui.WTPUIPlugin;
-import org.eclipse.wst.validation.internal.ConfigurationManager;
-import org.eclipse.wst.validation.internal.ProjectConfiguration;
-import org.eclipse.wst.validation.internal.ValidationRegistryReader;
-import org.eclipse.wst.validation.internal.ValidationSelectionHandlerRegistryReader;
-import org.eclipse.wst.validation.internal.operations.EnabledIncrementalValidatorsOperation;
-import org.eclipse.wst.validation.internal.operations.EnabledValidatorsOperation;
-import org.eclipse.wst.validation.internal.operations.ValidatorManager;
-import org.eclipse.wst.validation.internal.plugin.ValidationPlugin;
-import org.eclipse.wst.validation.internal.ui.plugin.ValidationUIPlugin;
-
-/**
- * This class implements the pop-up menu item "Run Validation" When the item is selected, this
- * action triggers a validation of the project, using all configured, enabled validators.
- */
-public class ValidationMenuAction implements IViewActionDelegate {
- private ISelection _currentSelection = null;
- protected static final String SEP = "/"; //$NON-NLS-1$
- private Display _currentDisplay = null;
- private IResourceVisitor _folderVisitor = null;
- private Map _selectedResources = null;
- //protected IWorkbenchContext workbenchContext;
-
- public ValidationMenuAction() {
- super();
- _currentDisplay = Display.getCurrent(); // cache the display before
- // this action is forked. After
- // the action is forked,
- // Display.getCurrent() returns
- // null.
- _selectedResources = new HashMap();
- }
-
- private Display getDisplay() {
- return (_currentDisplay == null) ? Display.getCurrent() : _currentDisplay;
- }
-
- /**
- * Return the wizard's shell.
- */
- Shell getShell() {
- Display display = getDisplay();
- Shell shell = (display == null) ? null : display.getActiveShell();
- if (shell == null && display != null) {
- Shell[] shells = display.getShells();
- if (shells.length > 0)
- shell = shells[0];
- }
- return shell;
- }
-
- private ISelection getCurrentSelection() {
- return _currentSelection;
- }
-
- /**
- * Return a map of the selected elements. Each key of the map is an IProject, and the value is a
- * Set of the selected resources in that project. If a project is selected, and nothing else in
- * the project is selected, a full validation (null value) will be done on the project. If a
- * project is selected, and some files/folders in the project are also selected, only the
- * files/folders will be validated. If a folder is selected, all of its contents are also
- * validated.
- */
- private Map loadSelected(ValidateAction action, boolean refresh) {
- if (refresh) {
- // selectionChanged(IAction, ISelection) has been called. Flush the
- // existing cache of resources and
- // add just the currently selected ones.
- _selectedResources.clear();
- }
- ISelection selection = getCurrentSelection();
- if ((selection == null) || selection.isEmpty() || !(selection instanceof IStructuredSelection)) {
- return null;
- }
- Object[] elements = ((IStructuredSelection) selection).toArray();
- for (int i = 0; i < elements.length; i++) {
- Object element = elements[i];
- if (element == null) {
- continue;
- }
- addSelected(action, element);
- }
- return _selectedResources;
- }
-
- private void addSelected(ValidateAction action, Object selected) {
- if (selected instanceof IProject) {
- addSelected((IProject) selected);
- } else if (selected instanceof IFile) {
- addSelected((IFile) selected);
- } else if (selected instanceof IFolder) {
- addVisitor((IFolder) selected);
- } else if (isValidType(getExtendedType(selected))) {
- addSelected(action,getExtendedType(selected));
- } else {
- // Not a valid input type. Must be IProject, IJavaProject, or
- // IResource.
- // If this ValidationMenuAction is a delegate of ValidateAction, is
- // the input type recognized by the ValidateAction?
- boolean valid = false;
- if (action != null) {
- IResource[] resources = action.getResource(selected);
- if (resources != null) {
- valid = true;
- for (int i = 0; i < resources.length; i++) {
- addSelected(action, resources[i]);
- }
- }
- }
- if (!valid) {
- // Stop processing. (This allows the "Run Validation" menu item
- // to gray
- // out once at least one non-validatable element is selected.)
- _selectedResources.clear();
- }
- }
- }
-
- private Object getExtendedType(Object selected) {
- Object result = ValidationSelectionHandlerRegistryReader.getInstance().getExtendedType(selected);
- return result == null ? selected : result;
- }
-
- private boolean isValidType(Object object) {
- return object instanceof IProject || object instanceof IFile || object instanceof IFolder;
- }
-
- private void addSelected(IProject selected) {
- _selectedResources.put(selected, null); // whatever the values were
- // before, the entire project
- // needs to be revalidated now
- }
-
-// private void addSelected(IJavaProject selected) {
-// _selectedResources.put(selected.getProject(), null); // whatever the
-// // values were
-// // before, the
-// // entire project
-// // needs to be
-// // revalidated now
-// }
-
- void addSelected(IResource selected) {
- IProject project = selected.getProject();
- boolean added = _selectedResources.containsKey(project);
- List changedRes = null;
- if (added) {
- // If the value is null, the entire project needs to be validated
- // anyway.
- changedRes = (List) _selectedResources.get(project);
- if (changedRes == null) {
- return;
- }
- } else {
- changedRes = new ArrayList();
- }
- if (!changedRes.contains(selected)) {
- changedRes.add(selected);
- _selectedResources.put(project, changedRes);
- }
- }
-
- private void addVisitor(IFolder selected) {
- // add the folder and its children
- try {
- selected.accept(getFolderVisitor());
- } catch (CoreException exc) {
- Logger logger = WTPUIPlugin.getLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationUIPlugin.getLogEntry();
- entry.setSourceIdentifier("ValidationMenuAction.addSelected(IFolder)"); //$NON-NLS-1$
- entry.setMessageTypeIdentifier(ResourceConstants.VBF_EXC_INTERNAL);
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
- return;
- }
- }
-
- private IResourceVisitor getFolderVisitor() {
- if (_folderVisitor == null) {
- _folderVisitor = new IResourceVisitor() {
- public boolean visit(IResource res) {
- if (res instanceof IFile) {
- addSelected(res);
- } else if (res instanceof IFolder) {
- addSelected(res);
- }
- return true; // visit the resource's children
- }
- };
- }
- return _folderVisitor;
- }
-
- /**
- * The delegating action has been performed. Implement this method to do the actual work.
- *
- * @param action
- * action proxy that handles the presentation portion of the plugin action
- * @param window
- * the desktop window passed by the action proxy
- */
- public void run(IAction action) {
- ValidateAction vaction = null;
- if (action instanceof ValidateAction) {
- vaction = (ValidateAction) action;
- }
- final Map projects = loadSelected(vaction, false);
- if ((projects == null) || (projects.size() == 0)) {
- return;
- }
- final ProgressAndTextDialog dialog = new ProgressAndTextDialog(getShell());
- try {
- IRunnableWithProgress runnable = ValidationUIPlugin.getRunnableWithProgress(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) {
- validate(monitor, projects, dialog);
- }
- });
- // validate all EJBs in this project
- dialog.run(true, true, runnable); // fork, cancelable.
- } catch (InvocationTargetException exc) {
- Logger logger = WTPUIPlugin.getLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationUIPlugin.getLogEntry();
- entry.setSourceID("ValidationMenuAction.run(IAction)"); //$NON-NLS-1$
- entry.setMessageTypeIdentifier(ResourceConstants.VBF_EXC_INTERNAL);
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- if (exc.getTargetException() != null) {
- entry.setTargetException(exc.getTargetException());
- logger.write(Level.SEVERE, entry);
- }
- }
- String internalErrorMessage = ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_INTERNAL);
- dialog.addText(internalErrorMessage);
- } catch (InterruptedException exc) {
- // User cancelled validation
- } catch (Throwable exc) {
- Logger logger = WTPUIPlugin.getLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationUIPlugin.getLogEntry();
- entry.setSourceID("ValidationMenuAction.run(IAction)"); //$NON-NLS-1$
- entry.setMessageTypeIdentifier(ResourceConstants.VBF_EXC_INTERNAL);
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
- String internalErrorMessage = ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_INTERNAL);
- dialog.addText(internalErrorMessage);
- } finally {
- _selectedResources.clear();
- }
- }
-
- void validate(final IProgressMonitor monitor, final Map projects, ProgressAndTextDialog dialog) {
- boolean cancelled = false; // Was the operation cancelled?
- Iterator iterator = projects.keySet().iterator();
- while (iterator.hasNext()) {
- IProject project = (IProject) iterator.next();
- if (project == null) {
- continue;
- }
- try {
- if (cancelled) {
- String message = ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_UI_RESCANCELLED, new String[]{project.getName()});
- dialog.addText(message);
- continue;
- }
- if (!project.isOpen()) {
- String message = ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_UI_CLOSED_PROJECT, new String[]{project.getName()});
- dialog.addText(message);
- continue;
- }
- performValidation(monitor, projects, dialog, project);
- } catch (OperationCanceledException exc) {
- // When loading file deltas, if the operation has been
- // cancelled, then
- // resource.accept throws an OperationCanceledException.
- cancelled = true;
- String message = ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_UI_RESCANCELLED, new String[]{project.getName()});
- dialog.addText(message);
- } catch (Throwable exc) {
- logException(dialog, project, exc);
- }
- }
- }
-
- /**
- * @param dialog
- * @param project
- * @param exc
- */
- private void logException(ProgressAndTextDialog dialog, IProject project, Throwable exc) {
- Logger logger = WTPUIPlugin.getLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationUIPlugin.getLogEntry();
- entry.setSourceID("ValidationMenuAction.validate"); //$NON-NLS-1$
- entry.setMessageTypeIdentifier(ResourceConstants.VBF_EXC_INTERNAL);
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
- String internalErrorMessage = ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_INTERNAL_PROJECT, new String[]{project.getName()});
- dialog.addText(internalErrorMessage);
- }
-
- /**
- * @param monitor
- * @param projects
- * @param dialog
- * @param project
- * @throws CoreException
- */
- private void performValidation(final IProgressMonitor monitor, final Map projects, ProgressAndTextDialog dialog, IProject project) throws CoreException {
- // Even if the "maximum number of messages" message is on
- // the task list,
- // run validation, because some messages may have been
- // fixed
- // and there may be space for more messages.
- List changedResources = (List) projects.get(project);
- IResource[] resources = null;
- if (changedResources != null) {
- resources = new IResource[changedResources.size()];
- changedResources.toArray(resources);
- }
- try {
- ProjectConfiguration prjp = ConfigurationManager.getManager().getProjectConfiguration(project);
- if (prjp.numberOfEnabledValidators() > 0) {
- checkProjectConfiguration(monitor, dialog, project, resources, prjp);
- } else {
- String message = ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_UI_NO_VALIDATORS_ENABLED, new String[]{project.getName()});
- dialog.addText(message);
- }
- } catch (InvocationTargetException exc) {
- Logger logger = ValidationPlugin.getPlugin().getLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceIdentifier("ValidationMenuAction::run"); //$NON-NLS-1$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- if (exc.getTargetException() != null) {
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
- }
- }
- }
-
- /**
- * @param monitor
- * @param dialog
- * @param project
- * @param resources
- * @param prjp
- * @throws InvocationTargetException
- * @throws CoreException
- */
- private void checkProjectConfiguration(final IProgressMonitor monitor, ProgressAndTextDialog dialog, IProject project, IResource[] resources, ProjectConfiguration prjp) throws InvocationTargetException, CoreException {
- boolean successful = true; // Did the operation
- // complete
- // successfully?
- EnabledValidatorsOperation validOp = null;
- if (resources == null) {
- validOp = new EnabledValidatorsOperation(project,prjp.runAsync());
- } else {
- validOp = new EnabledIncrementalValidatorsOperation(resources, project, prjp.runAsync());
- }
- if (validOp.isNecessary(monitor)) {
- ResourcesPlugin.getWorkspace().run(validOp, monitor);
- } else {
- if (resources == null) {
- String message = ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_UI_PRJNEEDINPUT, new String[]{project.getName()});
- dialog.addText(message);
- } else {
- for (int i = 0; i < resources.length; i++) {
- String message = ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_UI_RESNEEDINPUT, new String[]{resources[i].getFullPath().toString()});
- dialog.addText(message);
- }
- }
- }
- if (successful) {
- performSucessful(dialog, project, resources);
- } else {
- String internalErrorMessage = ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_INTERNAL_PROJECT, new String[]{project.getName()});
- dialog.addText(internalErrorMessage);
- }
- }
-
- /*public IWorkbenchContext getWorkbenchContext() {
- if(workbenchContext == null)
- workbenchContext = new WorkbenchContext();
- return workbenchContext;
- }*/
-
- /**
- * @param dialog
- * @param project
- * @param resources
- */
- private void performSucessful(ProgressAndTextDialog dialog, IProject project, IResource[] resources) {
- boolean limitExceeded = ValidatorManager.getManager().wasValidationTerminated(project);
- if (limitExceeded) {
- String message = ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_UI_MAX_REPORTED, new String[]{project.getName()});
- dialog.addText(message);
- } else if (resources == null) {
- String message = ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_UI_PRJVALIDATED, new String[]{project.getName()});
- dialog.addText(message);
- } else {
- for (int i = 0; i < resources.length; i++) {
- String message = ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_UI_RESVALIDATED, new String[]{resources[i].getFullPath().toString()});
- dialog.addText(message);
- }
- }
- }
-
- /**
- * Selection in the desktop has changed. Plugin provider can use it to change the availability
- * of the action or to modify other presentation properties.
- *
- * <p>
- * Action delegate cannot be notified about selection changes before it is loaded. For that
- * reason, control of action's enable state should also be performed through simple XML rules
- * defined for the extension point. These rules allow enable state control before the delegate
- * has been loaded.
- * </p>
- *
- * @param action
- * action proxy that handles presentation portion of the plugin action
- * @param selection
- * current selection in the desktop
- */
- public void selectionChanged(IAction action, ISelection selection) {
- _currentSelection = selection;
- int count = 0;
- boolean fwkActivated = (ValidationPlugin.isActivated() && ValidationRegistryReader.isActivated());
- if (fwkActivated) {
- ValidateAction vaction = null;
- if (action instanceof ValidateAction) {
- vaction = (ValidateAction) action;
- }
- final Map projects = loadSelected(vaction, true);
- if ((projects != null) && (projects.size() > 0)) {
- Iterator iterator = projects.keySet().iterator();
- while (iterator.hasNext()) {
- // If at least one project can be validated, make "enabled"
- // true and
- // let the dialog tell the user which projects need to be
- // opened,
- // validators enabled, etc.
- IProject project = (IProject) iterator.next();
- if ((project != null) && (project.isOpen())) {
- // If the validation plugin hasn't been activated yet,
- // don't activate it just to
- // find out if there are validators. Only ask if there
- // are enabled validators if
- // the plugin has already been activated.
- try {
- ProjectConfiguration prjp = ConfigurationManager.getManager().getProjectConfigurationWithoutMigrate(project);
- count += prjp.numberOfEnabledValidators();
- } catch (InvocationTargetException exc) {
- Logger logger = ValidationPlugin.getPlugin().getLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceIdentifier("ValidationMenuAction::selectionChanged"); //$NON-NLS-1$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- if (exc.getTargetException() != null) {
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
- }
- }
- if (count > 0)
- break;
- }
- }
- }
- }
- action.setEnabled((count > 0) || (!fwkActivated)); // Don't disable the
- // action just
- // because the
- // framework hasn't
- // been activated.
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.navigator.internal.views.navigator.INavigatorActionsExtension#init(org.eclipse.wst.common.navigator.internal.views.navigator.INavigatorExtensionSite)
- */
-
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.IActionDelegate2#runWithEvent(org.eclipse.jface.action.IAction,
- * org.eclipse.swt.widgets.Event)
- */
- public void runWithEvent(IAction action, Event event) {
- run(action);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.IActionDelegate2#init(org.eclipse.jface.action.IAction)
- */
- public void init(IAction action) {
- //init
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.IActionDelegate2#dispose()
- */
- public void dispose() {
- //dispose
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IViewActionDelegate#init(org.eclipse.ui.IViewPart)
- */
- public void init(IViewPart view) {
- //init
-
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.validation.ui/validateui/org/eclipse/wst/validation/internal/ui/ValidationPreferencePage.java b/plugins/org.eclipse.wst.validation.ui/validateui/org/eclipse/wst/validation/internal/ui/ValidationPreferencePage.java
deleted file mode 100644
index ff9caf32c..000000000
--- a/plugins/org.eclipse.wst.validation.ui/validateui/org/eclipse/wst/validation/internal/ui/ValidationPreferencePage.java
+++ /dev/null
@@ -1,946 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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
- *******************************************************************************/
-package org.eclipse.wst.validation.internal.ui;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.logging.Level;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.jem.util.logger.LogEntry;
-import org.eclipse.jem.util.logger.proxy.Logger;
-import org.eclipse.jface.preference.PreferencePage;
-import org.eclipse.jface.viewers.CheckboxTableViewer;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerSorter;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.ScrolledComposite;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.KeyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-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.MessageBox;
-import org.eclipse.swt.widgets.TableItem;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPreferencePage;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.wst.common.frameworks.internal.ui.WTPUIPlugin;
-import org.eclipse.wst.validation.internal.ConfigurationManager;
-import org.eclipse.wst.validation.internal.GlobalConfiguration;
-import org.eclipse.wst.validation.internal.ProjectConfiguration;
-import org.eclipse.wst.validation.internal.ValidationConfiguration;
-import org.eclipse.wst.validation.internal.ValidatorMetaData;
-import org.eclipse.wst.validation.internal.operations.ValidatorManager;
-import org.eclipse.wst.validation.internal.ui.plugin.ValidationUIPlugin;
-
-/**
- * This class and its inner classes are not intended to be subclassed outside of the validation
- * framework.
- */
-public class ValidationPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
- private IValidationPage _pageImpl = null;
-
- /**
- * Initially, this interface was created as an abstract class, and getControl() was implemented.
- * (getProject() could also have been implemented in the abstract class.) However, at runtime, a
- * NullPointerException was thrown; the inner class had lost its pointer to its enclosing class.
- * After some experimentation, I discovered that if I changed the parent to an interface, the
- * enclosing class could be found. (Merely moving the AValidationPage into its own file was
- * insufficient.)
- */
- public interface IValidationPage {
- public Composite createPage(Composite parent) throws InvocationTargetException;
-
- public boolean performOk() throws InvocationTargetException;
-
- public boolean performDefaults() throws InvocationTargetException;
-
- public Composite getControl();
-
- public void dispose();
-
- public void loseFocus(); // Page is losing focus (event notification)
-
- public void gainFocus(); // Page is gaining focus (event notification)
- }
-
- public class InvalidPage implements IValidationPage {
- private Composite page = null;
-
- private Composite composite = null;
- private GridLayout layout = null;
- private Label messageLabel = null;
-
- public InvalidPage(Composite parent) {
- page = createPage(parent);
- }
-
- /**
- * This page is added to the Properties guide if some internal problem occurred; for
- * example, the highlighted item in the workbench is not an IProject (according to this
- * page's plugin.xml, this page is only valid when an IProject is selected).
- */
- public Composite createPage(Composite parent) {
- // Don't create the default and apply buttons.
- noDefaultAndApplyButton();
-
- final ScrolledComposite sc1 = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL);
- sc1.setLayoutData(new GridData(GridData.FILL_BOTH));
- composite = new Composite(sc1, SWT.NONE);
- sc1.setContent(composite);
- layout = new GridLayout();
- composite.setLayout(layout);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, ContextIds.VALIDATION_PROPERTIES_PAGE);
-
- messageLabel = new Label(composite, SWT.NONE);
- messageLabel.setText(ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_INVALID_REGISTER));
-
- composite.setSize(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
-
- return composite;
- }
-
- public boolean performDefaults() {
- return true;
- }
-
- /**
- * Since this page occurs under invalid circumstances, there is nothing to save.
- */
- public boolean performOk() {
- return true;
- }
-
- public Composite getControl() {
- return page;
- }
-
- public void dispose() {
- messageLabel.dispose();
- // layout.dispose();
- composite.dispose();
- }
-
- public void loseFocus() {
- // This page does not depend on the contents of any other page in the wizard, so do
- // nothing.
- }
-
- public void gainFocus() {
- // This page does not depend on the contents of any other page in the wizard, so do
- // nothing.
- }
- }
-
- private class NoValidatorsPage implements IValidationPage {
- private Composite page = null;
- private Composite composite = null;
- private GridLayout layout = null;
- private GridData data = null;
- private Label messageLabel = null;
-
- public NoValidatorsPage(Composite parent) {
- page = createPage(parent);
- }
-
- /**
- * This page is created if an IProject is selected, but that project has no validators
- * configured (i.e., the page is valid, but an empty list.)
- */
- public Composite createPage(Composite parent) {
- // Don't create the default and apply buttons.
- noDefaultAndApplyButton();
-
- // top level group
- final ScrolledComposite sc1 = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL);
- sc1.setLayoutData(new GridData(GridData.FILL_BOTH));
- composite = new Composite(sc1, SWT.NONE);
- sc1.setContent(composite);
- layout = new GridLayout();
- composite.setLayout(layout);
- data = new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL);
- composite.setLayoutData(data);
-
- messageLabel = new Label(composite, SWT.NONE);
- messageLabel.setText(ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_UI_NO_VALIDATORS_INSTALLED));
-
- composite.setSize(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
-
- return composite;
- }
-
-
- /**
- * Since there are no validators, there is nothing to save.
- */
- public boolean performOk() {
- return true;
- }
-
- public boolean performDefaults() {
- return true;
- }
-
- public Composite getControl() {
- return page;
- }
-
- public void dispose() {
- messageLabel.dispose();
- // layout.dispose();
- // data.dispose();
- composite.dispose();
- }
-
- public void loseFocus() {
- // This page does not depend on the contents of any other page in the wizard, so do
- // nothing.
- }
-
- public void gainFocus() {
- // This page does not depend on the contents of any other page in the wizard, so do
- // nothing.
- }
- }
-
- private class ValidatorListPage implements IValidationPage {
- private Composite page = null;
-
- private Composite composite = null;
- CheckboxTableViewer validatorList = null;
- private Button selectAllButton = null;
- private Button deselectAllButton = null;
- private Label emptyRowPlaceholder = null;
- Button valWhenBuildButton = null;
- Button valWhenAutoBuildButton = null;
- private Text maxValProblemsField = null;
- private Label maxValProblemsFieldLabel = null;
- Button overrideButton = null;
- private Label listLabel = null;
-
- GlobalConfiguration pagePreferences = null; // the values currently on the page, but not
- // necessarily stored yet. Package visibility
- // for the widget listeners (the compiler would
- // have to create a synthetic accessor method in
- // order to access this field)
- private boolean _isAutoBuildEnabled; // initialized in the constructor
- private ValidatorMetaData[] _oldVmd = null; // Cache the enabled validators so that, if
- // there is no change to this list, the
- // expensive task list update can be avoided
- private boolean _allow = false; // Cache the value of the prefence "allow projects to
-
- // override" so that, when OK is clicked, we can determine
- // if "allow" has changed or not.
-
- /**
- * This class is provided for the CheckboxTableViewer in the
- * ValidationPropertiesPage$ValidatorListPage class.
- */
- public class ValidationContentProvider implements IStructuredContentProvider {
- /**
- * Disposes of this content provider. This is called by the viewer when it is disposed.
- */
- public void dispose() {
- //dispose
- }
-
- /**
- * Returns the elements to display in the viewer when its input is set to the given
- * element. These elements can be presented as rows in a table, items in a list, etc.
- * The result is not modified by the viewer.
- *
- * @param inputElement
- * the input element
- * @return the array of elements to display in the viewer
- */
- public java.lang.Object[] getElements(Object inputElement) {
- if (inputElement instanceof ValidatorMetaData[]) {
- // The Collection is the Collection which is returned by ValidatorManager's
- // getConfiguredValidatorMetaData(IProject) call.
- // This Collection is set to be the input of the CheckboxTableViewer in
- // ValidationPropertiesPage$ValidatorListPage's createPage(Composite)
- // method.
- return (ValidatorMetaData[]) inputElement;
- }
- return new Object[0];
- }
-
- /**
- * Notifies this content provider that the given viewer's input has been switched to a
- * different element.
- * <p>
- * A typical use for this method is registering the content provider as a listener to
- * changes on the new input (using model-specific means), and deregistering the viewer
- * from the old input. In response to these change notifications, the content provider
- * propagates the changes to the viewer.
- * </p>
- *
- * @param viewer
- * the viewer
- * @param oldInput
- * the old input element, or <code>null</code> if the viewer did not
- * previously have an input
- * @param newInput
- * the new input element, or <code>null</code> if the viewer does not have
- * an input
- */
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- //do nothing
- }
-
-
-
- }
-
- /**
- * This class is provided for ValidationPropertiesPage$ValidatorListPage's
- * checkboxTableViewer element.
- */
- public class ValidationLabelProvider extends LabelProvider {
- /**
- * Override the LabelProvider's text, by customizing the text for a ValidatorMetaData
- * element.
- */
- public String getText(Object element) {
- if (element == null) {
- return ""; //$NON-NLS-1$
- } else if (element instanceof ValidatorMetaData) {
- return ((ValidatorMetaData) element).getValidatorDisplayName();
- } else {
- return super.getText(element);
- }
- }
- }
-
- /**
- * This class is used to sort the CheckboxTableViewer elements.
- */
- public class ValidationViewerSorter extends ViewerSorter {
- /**
- * Returns a negative, zero, or positive number depending on whether the first element
- * is less than, equal to, or greater than the second element.
- * <p>
- * The default implementation of this method is based on comparing the elements'
- * categories as computed by the <code>category</code> framework method. Elements
- * within the same category are further subjected to a case insensitive compare of their
- * label strings, either as computed by the content viewer's label provider, or their
- * <code>toString</code> values in other cases. Subclasses may override.
- * </p>
- *
- * @param viewer
- * the viewer
- * @param e1
- * the first element
- * @param e2
- * the second element
- * @return a negative number if the first element is less than the second element; the
- * value <code>0</code> if the first element is equal to the second element;
- * and a positive number if the first element is greater than the second element
- */
- public int compare(Viewer viewer, Object e1, Object e2) {
- // Can't instantiate ViewerSorter because it's abstract, so use this
- // inner class to represent it.
- return super.compare(viewer, e1, e2);
- }
- }
-
- public ValidatorListPage(Composite parent) throws InvocationTargetException {
- _isAutoBuildEnabled = ValidatorManager.getManager().isGlobalAutoBuildEnabled();
- pagePreferences = new GlobalConfiguration(ConfigurationManager.getManager().getGlobalConfiguration()); // This
- // represents
- // the
- // values
- // on
- // the
- // page
- // that
- // haven't
- // been
- // persisted
- // yet.
- // Start
- // with
- // the
- // last
- // values
- // that
- // were
- // persisted
- // into
- // the
- // current
- // page's
- // starting
- // values.
- _oldVmd = pagePreferences.getEnabledValidators(); // Cache the enabled validators so
- // that, if there is no change to this
- // list, the expensive task list
- // update can be avoided
- _allow = pagePreferences.canProjectsOverride();
-
- page = createPage(parent);
- }
-
- public Composite createPage(Composite parent) throws InvocationTargetException {
- // top level group
- final ScrolledComposite sc1 = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL);
- sc1.setLayoutData(new GridData(GridData.FILL_BOTH));
- composite = new Composite(sc1, SWT.NONE);
- sc1.setContent(composite);
- composite.setLayout(new GridLayout()); // use the layout's default preferences
- PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, ContextIds.VALIDATION_PREFERENCE_PAGE);
-
- Composite validatorGroup = new Composite(composite, SWT.NONE);
- GridLayout validatorGroupLayout = new GridLayout();
- validatorGroupLayout.numColumns = 2;
- validatorGroup.setLayout(validatorGroupLayout);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(validatorGroup, ContextIds.VALIDATION_PREFERENCE_PAGE);
-
- GridData overrideData = new GridData(GridData.FILL_HORIZONTAL);
- overrideData.horizontalSpan = 2;
- overrideButton = new Button(validatorGroup, SWT.CHECK);
- overrideButton.setLayoutData(overrideData);
- overrideButton.setText(ResourceHandler.getExternalizedMessage(ResourceConstants.PREF_BUTTON_OVERRIDE));
- overrideButton.setEnabled(true);
- overrideButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- pagePreferences.setCanProjectsOverride(overrideButton.getSelection());
- try {
- updateWidgets();
- } catch (InvocationTargetException exc) {
- displayAndLogError(ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_INTERNAL_TITLE), ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_INTERNAL_PAGE), exc);
- }
- }
- });
- PlatformUI.getWorkbench().getHelpSystem().setHelp(overrideButton, ContextIds.VALIDATION_PREFERENCE_PAGE_OVERRIDE);
-
- emptyRowPlaceholder = new Label(validatorGroup, SWT.NONE);
- emptyRowPlaceholder.setLayoutData(new GridData());
-
- GridData valWhenBuildData = new GridData(GridData.FILL_HORIZONTAL);
- valWhenBuildData.horizontalSpan = 2;
- valWhenBuildButton = new Button(validatorGroup, SWT.CHECK);
- valWhenBuildButton.setLayoutData(valWhenBuildData);
- valWhenBuildButton.setText(ResourceHandler.getExternalizedMessage(ResourceConstants.PREF_BUTTON_FULL));
- valWhenBuildButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- pagePreferences.setBuildValidate(valWhenBuildButton.getSelection());
- valWhenBuildButton.setFocus();
- }
- });
-
- GridData valWhenAutoBuildData = new GridData(GridData.FILL_HORIZONTAL);
- valWhenAutoBuildData.horizontalSpan = 2;
- valWhenAutoBuildButton = new Button(validatorGroup, SWT.CHECK);
- valWhenAutoBuildButton.setLayoutData(valWhenAutoBuildData);
- valWhenAutoBuildButton.setText(ResourceHandler.getExternalizedMessage(ResourceConstants.PREF_BUTTON_AUTO));
- valWhenAutoBuildButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- pagePreferences.setAutoValidate(valWhenAutoBuildButton.getSelection());
- valWhenAutoBuildButton.setFocus();
- }
- });
-
- listLabel = new Label(validatorGroup, SWT.NONE);
- GridData listLabelData = new GridData(GridData.FILL_HORIZONTAL);
- listLabelData.horizontalSpan = 2;
- listLabel.setLayoutData(listLabelData);
- listLabel.setText(ResourceHandler.getExternalizedMessage(ResourceConstants.PREF_VALLIST_TITLE));
-
- GridData validatorListData = new GridData(GridData.FILL_HORIZONTAL);
- validatorListData.horizontalSpan = 2;
- validatorList = CheckboxTableViewer.newCheckList(validatorGroup, SWT.BORDER);
- validatorList.getTable().setLayoutData(validatorListData);
- validatorList.setLabelProvider(new ValidationLabelProvider());
- validatorList.setContentProvider(new ValidationContentProvider());
- validatorList.setSorter(new ValidationViewerSorter());
- validatorList.setInput(pagePreferences.getValidators());
- validatorList.getTable().addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- pagePreferences.setEnabledValidators(ValidationConfiguration.convertToArray(validatorList.getCheckedElements()));
- try {
- updateWidgets();
- } catch (InvocationTargetException exc) {
- displayAndLogError(ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_INTERNAL_TITLE), ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_INTERNAL_PAGE), exc);
- }
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- try {
- performDefaults();
- } catch (InvocationTargetException exc) {
- displayAndLogError(ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_INTERNAL_TITLE), ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_INTERNAL_PAGE), exc);
- }
- }
- });
-
- selectAllButton = new Button(validatorGroup, SWT.PUSH);
- selectAllButton.setLayoutData(new GridData());
- selectAllButton.setText(ResourceHandler.getExternalizedMessage(ResourceConstants.PREF_BUTTON_SELECTALL));
- selectAllButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- try {
- performSelectAll();
- } catch (InvocationTargetException exc) {
- displayAndLogError(ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_INTERNAL_TITLE), ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_INTERNAL_PAGE), exc);
- }
- }
- });
- PlatformUI.getWorkbench().getHelpSystem().setHelp(selectAllButton, ContextIds.VALIDATION_PREFERENCE_PAGE);
-
- deselectAllButton = new Button(validatorGroup, SWT.PUSH);
- deselectAllButton.setLayoutData(new GridData());
- deselectAllButton.setText(ResourceHandler.getExternalizedMessage(ResourceConstants.PREF_BUTTON_DESELECTALL));
- deselectAllButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- try {
- performDeselectAll();
- } catch (InvocationTargetException exc) {
- displayAndLogError(ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_INTERNAL_TITLE), ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_INTERNAL_PAGE), exc);
- }
- }
- });
- PlatformUI.getWorkbench().getHelpSystem().setHelp(deselectAllButton, ContextIds.VALIDATION_PREFERENCE_PAGE);
-
- Composite buttonGroup = new Composite(composite, SWT.NONE);
- GridLayout buttonGroupLayout = new GridLayout();
- buttonGroupLayout.numColumns = 2;
- buttonGroup.setLayout(buttonGroupLayout);
- buttonGroup.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
-
- maxValProblemsFieldLabel = new Label(buttonGroup, SWT.NONE);
- maxValProblemsFieldLabel.setLayoutData(new GridData());
- maxValProblemsFieldLabel.setText(ResourceHandler.getExternalizedMessage(ResourceConstants.PREF_LBL_MAXMSGS));
-
- maxValProblemsField = new Text(buttonGroup, SWT.SINGLE | SWT.BORDER);
- maxValProblemsField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- maxValProblemsField.addKeyListener(new KeyListener() {
- /**
- * Sent when a key is pressed on the system keyboard.
- *
- * @param e
- * an event containing information about the key press
- */
- public void keyPressed(KeyEvent e) {
- //do nothing
- }
-
- /**
- * Sent when a key is released on the system keyboard.
- *
- * @param e
- * an event containing information about the key release
- */
- public void keyReleased(KeyEvent e) {
- try {
- pagePreferences.setMaximumNumberOfMessages(checkInteger());
- } catch (InvocationTargetException exc) {
- displayAndLogError(ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_INTERNAL_TITLE), ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_INTERNAL_PAGE), exc);
- }
- }
- });
- PlatformUI.getWorkbench().getHelpSystem().setHelp(maxValProblemsField, ContextIds.VALIDATION_PREFERENCE_PAGE_MAX_MESSAGES);
-
- // Have to set the tab order or only the first checkbox in a Composite can
- // be tab-ed to. (Seems to apply only to checkboxes. Have to use the arrow
- // key to navigate the checkboxes.)
- validatorGroup.setTabList(new Control[]{overrideButton, valWhenBuildButton, valWhenAutoBuildButton, validatorList.getTable(), selectAllButton, deselectAllButton});
-
- updateWidgets();
-
- composite.setSize(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
-
- return composite;
- }
-
- protected int checkInteger() throws InvocationTargetException {
- GlobalConfiguration gp = ConfigurationManager.getManager().getGlobalConfiguration();
- String text = maxValProblemsField.getText();
- if (text == null) {
- setErrorMessage(ResourceHandler.getExternalizedMessage(ResourceConstants.PREF_ERROR_INT));
- return gp.getMaximumNumberOfMessages();
- }
- try {
- Integer tempInt = new Integer(text.trim());
-
- // no exception? It's an int, then.
- if (tempInt.intValue() <= 0) {
- setErrorMessage(ResourceHandler.getExternalizedMessage(ResourceConstants.PREF_ERROR_INT));
- return gp.getMaximumNumberOfMessages();
- }
- setErrorMessage(null);
- return Integer.valueOf(maxValProblemsField.getText().trim()).intValue();
- } catch (NumberFormatException exc) {
- setErrorMessage(ResourceHandler.getExternalizedMessage(ResourceConstants.PREF_ERROR_INT));
- return gp.getMaximumNumberOfMessages();
- }
- }
-
- protected void updateWidgets() throws InvocationTargetException {
- // Need to update even the widgets that do not change based on another
- // widgets because of performDefaults(). If performDefaults() is selected,
- // then the pagePreferences values are reset, and these widgets
- // might also need to be updated.
- overrideButton.setSelection(pagePreferences.canProjectsOverride());
-
- maxValProblemsField.setText(String.valueOf(pagePreferences.getMaximumNumberOfMessages()));
-
- updateTable();
-
- boolean valEnabled = (pagePreferences.numberOfEnabledValidators() > 0);
- valWhenBuildButton.setEnabled(valEnabled);
- valWhenBuildButton.setSelection(pagePreferences.isBuildValidate() && valEnabled);
-
- boolean incValEnabled = (pagePreferences.numberOfEnabledIncrementalValidators() > 0);
- valWhenAutoBuildButton.setEnabled(_isAutoBuildEnabled && incValEnabled);
- valWhenAutoBuildButton.setSelection(pagePreferences.isAutoValidate() && incValEnabled && _isAutoBuildEnabled);
-
- updateHelp();
- }
-
- protected void updateTable() throws InvocationTargetException {
- TableItem[] items = validatorList.getTable().getItems();
- for (int i = 0; i < items.length; i++) {
- TableItem item = items[i];
- ValidatorMetaData vmd = (ValidatorMetaData) item.getData();
-
- // Should the validator be enabled? Read the user's preferences from last time,
- // if they exist, and set from that. If they don't exist, use the Validator class'
- // default value.
- validatorList.setChecked(vmd, pagePreferences.isEnabled(vmd));
- }
- }
-
- public boolean performOk() throws InvocationTargetException {
- storeValues();
- updateTaskList();
- return true;
- }
-
- public boolean performDefaults() throws InvocationTargetException {
- pagePreferences.resetToDefault();
- updateWidgets();
- checkInteger(); // clear the "max must be a positive integer" message if it exists
- getDefaultsButton().setFocus();
- return true;
- }
-
- public boolean performSelectAll() throws InvocationTargetException {
- validatorList.setAllChecked(true);
- pagePreferences.setEnabledValidators(ValidationConfiguration.convertToArray(validatorList.getCheckedElements()));
- updateWidgets();
- selectAllButton.setFocus();
- return true;
- }
-
- public boolean performDeselectAll() throws InvocationTargetException {
- validatorList.setAllChecked(false);
- pagePreferences.setEnabledValidators(ValidationConfiguration.convertToArray(validatorList.getCheckedElements()));
- updateWidgets();
- deselectAllButton.setFocus();
- return true;
- }
-
- protected void updateHelp() {
- // never disable this widget because users don't expect the preference page to alter
- // based on workbench contents
- PlatformUI.getWorkbench().getHelpSystem().setHelp(valWhenBuildButton, ContextIds.VALIDATION_PREFERENCE_PAGE_REBUILD_ENABLED);
-
- // never disable this widget because users don't expect the preference page to alter
- // based on workbench contents
- PlatformUI.getWorkbench().getHelpSystem().setHelp(valWhenAutoBuildButton, ContextIds.VALIDATION_PREFERENCE_PAGE_AUTO_ENABLED);
- }
-
- /*
- * Store the current values of the controls into the preference store.
- */
- private void storeValues() throws InvocationTargetException {
- pagePreferences.setCanProjectsOverride(overrideButton.getSelection());
-
- // If the manual build button is disabled because no validators are selected in the
- // task list, don't overwrite the user's preference.
- if (valWhenBuildButton.isEnabled()) {
- pagePreferences.setBuildValidate(valWhenBuildButton.getSelection());
- }
-
- // If the auto build button is disabled because no validators are selected in the
- // task list, or because auto-build is disabled, don't overwrite the user's preference.
- if (valWhenAutoBuildButton.isEnabled()) {
- pagePreferences.setAutoValidate(valWhenAutoBuildButton.getSelection());
- }
-
- pagePreferences.setMaximumNumberOfMessages(checkInteger());
- pagePreferences.setEnabledValidators(ValidationConfiguration.convertToArray(validatorList.getCheckedElements()));
-
- pagePreferences.passivate();
- pagePreferences.store();
- // If the projects aren't allowed to override, clear their settings.
- if (!pagePreferences.canProjectsOverride()) {
- IWorkspace workspace = ResourcesPlugin.getWorkspace();
- IProject[] projects = workspace.getRoot().getProjects();
- for (int i = 0; i < projects.length; i++) {
- IProject project = projects[i];
- try {
- if (project.isOpen()) {
- if (ConfigurationManager.getManager().isMigrated(project)) {
- ProjectConfiguration prjp = ConfigurationManager.getManager().getProjectConfiguration(project);
- prjp.setDoesProjectOverride(false);
- prjp.passivate();
- prjp.store();
- }
- }
- } catch (InvocationTargetException exc) {
- displayAndLogError(ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_INTERNAL_TITLE), ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_INTERNAL_PAGE), exc);
- }
- }
- }
-
- }
-
- private void updateTaskList() {
- IWorkspace workspace = ResourcesPlugin.getWorkspace();
- IProject[] projects = workspace.getRoot().getProjects();
- boolean allowChanged = (pagePreferences.canProjectsOverride() != _allow);
- for (int i = 0; i < projects.length; i++) {
- IProject project = projects[i];
- try {
- if (project.isOpen()) {
- ProjectConfiguration prjp = ConfigurationManager.getManager().getProjectConfiguration(project);
- if (!prjp.doesProjectOverride() && (prjp.hasEnabledValidatorsChanged(_oldVmd, allowChanged) || ValidatorManager.getManager().isMessageLimitExceeded(project))) {
- // If the project used to override the preferences, and the preferences
- // make that impossible now, then update the task list.
- //
- // If the preferences allow projects to override, and they don't, and if
- // the validators have changed, then update the task list.
- ValidatorManager.getManager().updateTaskList(project); // Do not remove
- // the exceeded
- // message; only
- // ValidationOperation
- // should do that
- // because it's
- // about to run
- // validation. If
- // the limit is
- // increased,
- // messages may
- // still be
- // missing, so
- // don't remove
- // the "messages
- // may be
- // missing"
- // message.
- }
- }
- } catch (InvocationTargetException exc) {
- displayAndLogError(ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_INTERNAL_TITLE), ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_INTERNAL_PAGE), exc);
- }
- }
- }
-
- public Composite getControl() {
- return page;
- }
-
- public void dispose() {
- listLabel.dispose();
- overrideButton.dispose();
- maxValProblemsField.dispose();
- maxValProblemsFieldLabel.dispose();
- valWhenAutoBuildButton.dispose();
- valWhenBuildButton.dispose();
- emptyRowPlaceholder.dispose();
- deselectAllButton.dispose();
- selectAllButton.dispose();
- validatorList.getTable().dispose();
- // validatorList.dispose();
- // layout.dispose();
- // data.dispose();
- composite.dispose();
- }
-
- public void loseFocus() {
- // This page does not need to cache anything before it loses focus.
- }
-
- public void gainFocus() {
- // This page depends on the Workbench Preference page, so update the value of the
- // isAutoBuild (in case the workbench page's value has changed), and then update
- // this page's widgets.
- try {
- _isAutoBuildEnabled = ValidatorManager.getManager().isGlobalAutoBuildEnabled();
- updateWidgets();
- } catch (InvocationTargetException exc) {
- displayAndLogError(ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_INTERNAL_TITLE), ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_INTERNAL_PAGE), exc);
- }
- }
- }
-
- /*
- * @see PreferencePage#createContents(Composite)
- */
- protected Control createContents(Composite parent) {
- try {
- GlobalConfiguration gp = ConfigurationManager.getManager().getGlobalConfiguration();
- if (gp.numberOfValidators() == 0) {
- _pageImpl = new NoValidatorsPage(parent);
- } else {
- try {
- _pageImpl = new ValidatorListPage(parent);
- } catch (InvocationTargetException exc) {
- _pageImpl = new InvalidPage(parent);
- displayAndLogError(ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_INTERNAL_TITLE), ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_INTERNAL_PAGE), exc);
- } catch (Throwable exc) {
- _pageImpl = new InvalidPage(parent);
- displayAndLogError(ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_INTERNAL_TITLE), ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_INTERNAL_PAGE), exc);
- }
- }
- } catch (InvocationTargetException exc) {
- _pageImpl = new InvalidPage(parent);
- displayAndLogError(ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_INTERNAL_TITLE), ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_INTERNAL_PAGE), exc);
- } catch (Throwable exc) {
- _pageImpl = new InvalidPage(parent);
- displayAndLogError(ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_INTERNAL_TITLE), ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_INTERNAL_PAGE), exc);
- }
-
- return _pageImpl.getControl();
- }
-
- /*
- * @see IWorkbenchPreferencePage#init(IWorkbench)
- */
- public void init(IWorkbench workbench) {
- //init
- }
-
- protected void noDefaultAndApplyButton() {
- super.noDefaultAndApplyButton();
- }
-
- /**
- * Performs special processing when this page's Defaults button has been pressed.
- * <p>
- * This is a framework hook method for sublcasses to do special things when the Defaults button
- * has been pressed. Subclasses may override, but should call <code>super.performDefaults</code>.
- * </p>
- */
- protected void performDefaults() {
- super.performDefaults();
-
- try {
- _pageImpl.performDefaults();
- } catch (InvocationTargetException exc) {
- displayAndLogError(ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_INTERNAL_TITLE), ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_INTERNAL_PAGE), exc);
- } catch (Throwable exc) {
- displayAndLogError(ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_INTERNAL_TITLE), ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_INTERNAL_PAGE), exc);
- }
- }
-
- /**
- * When the user presses the "OK" or "Apply" button on the Properties Guide/Properties Page,
- * respectively, some processing is performed by this PropertyPage. If the page is found, and
- * completes successfully, true is returned. Otherwise, false is returned, and the guide doesn't
- * finish.
- */
- public boolean performOk() {
- try {
- return _pageImpl.performOk();
- } catch (InvocationTargetException exc) {
- displayAndLogError(ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_INTERNAL_TITLE), ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_INTERNAL_PAGE), exc);
- return false;
- } catch (Throwable exc) {
- displayAndLogError(ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_INTERNAL_TITLE), ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_INTERNAL_PAGE), exc);
- return false;
- }
- }
-
- /**
- * Since the pages are inner classes of a child PreferencePage, not a PreferencePage itself,
- * DialogPage's automatic disposal of its children's widgets cannot be used. Instead, dispose of
- * each inner class' widgets explicitly.
- */
- public void dispose() {
- super.dispose();
- try {
- if (_pageImpl != null) {
- _pageImpl.dispose();
- }
- } catch (Throwable exc) {
- displayAndLogError(ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_INTERNAL_TITLE), ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_INTERNAL_PAGE), exc);
- }
- }
-
- private void logError(Throwable exc) {
- Logger logger = WTPUIPlugin.getLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationUIPlugin.getLogEntry();
- entry.setSourceIdentifier("ValidationPreferencePage.displayAndLogError"); //$NON-NLS-1$
- entry.setMessageTypeIdentifier(ResourceConstants.VBF_EXC_INTERNAL_PAGE);
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
-
- if (exc instanceof InvocationTargetException) {
- if (((InvocationTargetException) exc).getTargetException() != null) {
- entry.setTargetException(((InvocationTargetException) exc).getTargetException());
- logger.write(Level.SEVERE, entry);
- }
- }
- }
- }
-
- /**
- * package visibility because if this method is private, then the compiler needs to create a
- * synthetic accessor method for the internal classes, and that can have performance
- * implications.
- */
- void displayAndLogError(String title, String message, Throwable exc) {
- logError(exc);
- displayMessage(title, message, org.eclipse.swt.SWT.ICON_ERROR);
- }
-
- private void displayMessage(String title, String message, int iIconType) {
- MessageBox messageBox = new MessageBox(getShell(), org.eclipse.swt.SWT.OK | iIconType | org.eclipse.swt.SWT.APPLICATION_MODAL);
- messageBox.setMessage(message);
- messageBox.setText(title);
- messageBox.open();
- }
-
- /**
- * @see org.eclipse.jface.dialogs.IDialogPage#setVisible(boolean)
- */
- public void setVisible(boolean visible) {
- super.setVisible(visible);
- if (_pageImpl == null)
- return;
- if (visible) {
- _pageImpl.gainFocus();
- } else {
- _pageImpl.loseFocus();
- }
- }
-
- /**
- * @see org.eclipse.jface.preference.PreferencePage#getDefaultsButton()
- */
- protected Button getDefaultsButton() {
- return super.getDefaultsButton();
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.validation.ui/validateui/org/eclipse/wst/validation/internal/ui/ValidationPropertiesPage.java b/plugins/org.eclipse.wst.validation.ui/validateui/org/eclipse/wst/validation/internal/ui/ValidationPropertiesPage.java
deleted file mode 100644
index 36ff675f1..000000000
--- a/plugins/org.eclipse.wst.validation.ui/validateui/org/eclipse/wst/validation/internal/ui/ValidationPropertiesPage.java
+++ /dev/null
@@ -1,1033 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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
- *******************************************************************************/
-package org.eclipse.wst.validation.internal.ui;
-
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.logging.Level;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.jem.util.logger.LogEntry;
-import org.eclipse.jem.util.logger.proxy.Logger;
-import org.eclipse.jface.viewers.CheckboxTableViewer;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerSorter;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.ScrolledComposite;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.KeyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.MessageBox;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.TableItem;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.PropertyPage;
-import org.eclipse.wst.common.frameworks.internal.ui.WTPUIPlugin;
-import org.eclipse.wst.validation.internal.ConfigurationManager;
-import org.eclipse.wst.validation.internal.GlobalConfiguration;
-import org.eclipse.wst.validation.internal.ProjectConfiguration;
-import org.eclipse.wst.validation.internal.ValidationConfiguration;
-import org.eclipse.wst.validation.internal.ValidatorMetaData;
-import org.eclipse.wst.validation.internal.operations.ValidatorManager;
-import org.eclipse.wst.validation.internal.ui.plugin.ValidationUIPlugin;
-
-/**
- * This class and its inner classes are not intended to be subclassed outside of the validation
- * framework.
- *
- * This page implements the PropertyPage for validators; viewed when the user right-clicks on the
- * IProject, selects "Properties", and then "Validation."
- *
- * There exist three possible page layouts: if there is an eclipse internal error, and the page is
- * brought up on a non-IProject type; if there are no validators configured on that type of
- * IProject, and a page which lists all validators configured on that type of IProject. These three
- * pages are implemented as inner classes, so that it's clear which method is needed for which
- * input. When all of the methods, and behaviour, were implemented in this one class, much more
- * error-checking had to be done, to ensure that the method wasn't being called incorrectly by one
- * of the pages.
- */
-public class ValidationPropertiesPage extends PropertyPage {
- static final String NEWLINE = System.getProperty("line.separator"); //$NON-NLS-1$
- static final String TAB = "\t"; //$NON-NLS-1$
- static final String NEWLINE_AND_TAB = NEWLINE + TAB;
- private IValidationPage _pageImpl = null;
-
- /**
- * Initially, this interface was created as an abstract class, and getControl() was implemented.
- * (getProject() could also have been implemented in the abstract class.) However, at runtime, a
- * NullPointerException was thrown; the inner class had lost its pointer to its enclosing class.
- * After some experimentation, I discovered that if I changed the parent to an interface, the
- * enclosing class could be found. (Merely moving the AValidationPage into its own file was
- * insufficient.)
- */
- public interface IValidationPage {
- public abstract Composite createPage(Composite parent) throws InvocationTargetException;
-
- public abstract boolean performOk() throws InvocationTargetException;
-
- public boolean performDefaults() throws InvocationTargetException;
-
- public Composite getControl();
-
- public abstract void dispose();
- }
-
- public class InvalidPage implements IValidationPage {
- private Composite page = null;
-
- private Composite composite = null;
- private GridLayout layout = null;
- private Label messageLabel = null;
-
- public InvalidPage(Composite parent) {
- page = createPage(parent);
- }
-
- /**
- * This page is added to the Properties guide if some internal problem occurred; for
- * example, the highlighted item in the workbench is not an IProject (according to this
- * page's plugin.xml, this page is only valid when an IProject is selected).
- */
- public Composite createPage(Composite parent) {
- // Don't create the default and apply buttons.
- noDefaultAndApplyButton();
-
- final ScrolledComposite sc1 = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL);
- sc1.setLayoutData(new GridData(GridData.FILL_BOTH));
- composite = new Composite(sc1, SWT.NONE);
- sc1.setContent(composite);
- layout = new GridLayout();
- composite.setLayout(layout);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, ContextIds.VALIDATION_PROPERTIES_PAGE);
-
- messageLabel = new Label(composite, SWT.NONE);
- messageLabel.setText(ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_INVALID_REGISTER));
-
- composite.setSize(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
-
- return composite;
- }
-
- public boolean performDefaults() {
- return true;
- }
-
- /**
- * Since this page occurs under invalid circumstances, there is nothing to save.
- */
- public boolean performOk() {
- return true;
- }
-
- public Composite getControl() {
- return page;
- }
-
- public void dispose() {
- messageLabel.dispose();
- // layout.dispose();
- composite.dispose();
- }
- }
-
- public class NoValidatorsPage implements IValidationPage {
- private Composite page = null;
-
- private Composite composite = null;
- private GridLayout layout = null;
- private GridData data = null;
- private Label messageLabel = null;
-
- public NoValidatorsPage(Composite parent) {
- page = createPage(parent);
- }
-
- /**
- * This page is created if an IProject is selected, but that project has no validators
- * configured (i.e., the page is valid, but an empty list.)
- */
- public Composite createPage(Composite parent) {
- // Don't create the default and apply buttons.
- noDefaultAndApplyButton();
-
- // top level group
- final ScrolledComposite sc1 = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL);
- sc1.setLayoutData(new GridData(GridData.FILL_BOTH));
- composite = new Composite(sc1, SWT.NONE);
- sc1.setContent(composite);
- layout = new GridLayout();
- composite.setLayout(layout);
- data = new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL);
- composite.setLayoutData(data);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, ContextIds.VALIDATION_PROPERTIES_PAGE);
-
- messageLabel = new Label(composite, SWT.NONE);
- String[] msgParm = {getProject().getName()};
- messageLabel.setText(ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_UI_LBL_NOVALIDATORS_DESC, msgParm));
- composite.setSize(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
- return composite;
- }
-
- public boolean performDefaults() {
- return true;
- }
-
- /**
- * Since there are no validators, there is nothing to save.
- */
- public boolean performOk() {
- return true;
- }
-
- public Composite getControl() {
- return page;
- }
-
- public void dispose() {
- messageLabel.dispose();
- // layout.dispose();
- // data.dispose();
- composite.dispose();
- }
- }
-
- public class ValidatorListPage implements IValidationPage {
- Composite page = null;
- GridLayout layout = null;
- GridData data = null;
- Label messageLabel = null;
- CheckboxTableViewer validatorList = null;
- Button overrideGlobalButton = null;
- Button autoButton = null;
- Button valWhenBuildButton = null;
- Button selectAllButton = null;
- Button deselectAllButton = null;
- Label emptyRowPlaceholder = null;
- Text maxValProblemsField = null;
- Label maxValProblemsFieldLabel = null;
-
- ProjectConfiguration pagePreferences = null;
-
- // default values for the widgets, initialized in the constructor
- private boolean isAutoBuildEnabled = false;
- private boolean isBuilderConfigured = false;
- private boolean canOverride = false;
-
- private ValidatorMetaData[] oldVmd = null; // Cache the enabled validators so that, if there
-
- // is no change to this list, the expensive task
- // list update can be avoided
-
- /**
- * This class is provided for the CheckboxTableViewer in the
- * ValidationPropertiesPage$ValidatorListPage class.
- */
- public class ValidationContentProvider implements IStructuredContentProvider {
- /**
- * Disposes of this content provider. This is called by the viewer when it is disposed.
- */
- public void dispose() {
- //dispose
- }
-
- /**
- * Returns the elements to display in the viewer when its input is set to the given
- * element. These elements can be presented as rows in a table, items in a list, etc.
- * The result is not modified by the viewer.
- *
- * @param inputElement
- * the input element
- * @return the array of elements to display in the viewer
- */
- public java.lang.Object[] getElements(Object inputElement) {
- if (inputElement instanceof ValidatorMetaData[]) {
- // The ValidatorMetaData[] is the array which is returned by ValidatorManager's
- // getConfiguredValidatorMetaData(IProject) call.
- // This array is set to be the input of the CheckboxTableViewer in
- // ValidationPropertiesPage$ValidatorListPage's createPage(Composite)
- // method.
- return (ValidatorMetaData[]) inputElement;
- }
- return new Object[0];
- }
-
- /**
- * Notifies this content provider that the given viewer's input has been switched to a
- * different element.
- * <p>
- * A typical use for this method is registering the content provider as a listener to
- * changes on the new input (using model-specific means), and deregistering the viewer
- * from the old input. In response to these change notifications, the content provider
- * propagates the changes to the viewer.
- * </p>
- *
- * @param viewer
- * the viewer
- * @param oldInput
- * the old input element, or <code>null</code> if the viewer did not
- * previously have an input
- * @param newInput
- * the new input element, or <code>null</code> if the viewer does not have
- * an input
- */
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- //do nothing
- }
-
-
-
- }
-
- /**
- * This class is provided for ValidationPropertiesPage$ValidatorListPage's
- * checkboxTableViewer element.
- */
- public class ValidationLabelProvider extends LabelProvider {
- /**
- * Override the LabelProvider's text, by customizing the text for a ValidatorMetaData
- * element.
- */
- public String getText(Object element) {
- if (element == null) {
- return ""; //$NON-NLS-1$
- } else if (element instanceof ValidatorMetaData) {
- return ((ValidatorMetaData) element).getValidatorDisplayName();
- } else {
- return super.getText(element);
- }
- }
- }
-
- /**
- * This class is used to sort the CheckboxTableViewer elements.
- */
- public class ValidationViewerSorter extends ViewerSorter {
- /**
- * Returns a negative, zero, or positive number depending on whether the first element
- * is less than, equal to, or greater than the second element.
- * <p>
- * The default implementation of this method is based on comparing the elements'
- * categories as computed by the <code>category</code> framework method. Elements
- * within the same category are further subjected to a case insensitive compare of their
- * label strings, either as computed by the content viewer's label provider, or their
- * <code>toString</code> values in other cases. Subclasses may override.
- * </p>
- *
- * @param viewer
- * the viewer
- * @param e1
- * the first element
- * @param e2
- * the second element
- * @return a negative number if the first element is less than the second element; the
- * value <code>0</code> if the first element is equal to the second element;
- * and a positive number if the first element is greater than the second element
- */
- public int compare(Viewer viewer, Object e1, Object e2) {
- // Can't instantiate ViewerSorter because it's abstract, so use this
- // inner class to represent it.
- return super.compare(viewer, e1, e2);
- }
- }
-
- public ValidatorListPage(Composite parent) throws InvocationTargetException {
- ConfigurationManager prefMgr = ConfigurationManager.getManager();
- ValidatorManager vMgr = ValidatorManager.getManager();
-
- pagePreferences = new ProjectConfiguration(prefMgr.getProjectConfiguration(getProject())); // This
- // represents
- // the
- // values
- // on
- // the
- // page
- // that
- // haven't
- // been
- // persisted
- // yet.
- // Start
- // with
- // the
- // last
- // values
- // that
- // were
- // persisted
- // into
- // the
- // current
- // page's
- // starting
- // values.
-
- // store the default values for the widgets
- canOverride = prefMgr.getGlobalConfiguration().canProjectsOverride();
- isAutoBuildEnabled = vMgr.isGlobalAutoBuildEnabled();
- isBuilderConfigured = ValidatorManager.doesProjectSupportBuildValidation(getProject());
- oldVmd = pagePreferences.getEnabledValidators(); // Cache the enabled validators so
- // that, if there is no change to this
- // list, the expensive task list update
- // can be avoided
-
- createPage(parent);
- }
-
- /**
- * This page is created if the current project has at least one validator configured on it.
- */
- public Composite createPage(Composite parent) throws InvocationTargetException {
- // top level group
- final ScrolledComposite sc1 = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL);
- sc1.setLayoutData(new GridData(GridData.FILL_BOTH));
- page = new Composite(sc1, SWT.NONE);
- sc1.setContent(page);
- page.setLayout(new GridLayout()); // use the layout's default preferences
-
- Composite validatorGroup = new Composite(page, SWT.NONE);
- GridLayout validatorGroupLayout = new GridLayout();
- validatorGroupLayout.numColumns = 2;
- validatorGroup.setLayout(validatorGroupLayout);
-
- GridData overrideData = new GridData(GridData.FILL_HORIZONTAL);
- overrideData.horizontalSpan = 2;
- overrideGlobalButton = new Button(validatorGroup, SWT.CHECK);
- overrideGlobalButton.setLayoutData(overrideData);
- overrideGlobalButton.setText(ResourceHandler.getExternalizedMessage(ResourceConstants.PROP_BUTTON_OVERRIDE, new String[]{getProject().getName()}));
- overrideGlobalButton.setFocus(); // must focus on something for F1 to have a topic to
- // launch
- overrideGlobalButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- pagePreferences.setDoesProjectOverride(overrideGlobalButton.getSelection());
- try {
- updateWidgets();
- } catch (InvocationTargetException exc) {
- displayAndLogError(ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_INTERNAL_TITLE), ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_INTERNAL_PAGE), exc);
- }
- }
- });
-
-
- emptyRowPlaceholder = new Label(validatorGroup, SWT.NONE);
- emptyRowPlaceholder.setLayoutData(new GridData());
-
- GridData valWhenBuildData = new GridData(GridData.FILL_HORIZONTAL);
- valWhenBuildData.horizontalSpan = 2;
- valWhenBuildButton = new Button(validatorGroup, SWT.CHECK);
- valWhenBuildButton.setLayoutData(valWhenBuildData);
- valWhenBuildButton.setText(ResourceHandler.getExternalizedMessage(ResourceConstants.PROP_BUTTON_FULL, new String[]{getProject().getName()}));
- valWhenBuildButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- pagePreferences.setBuildValidate(valWhenBuildButton.getSelection());
- valWhenBuildButton.setFocus();
- }
- });
-
- GridData valWhenAutoBuildData = new GridData(GridData.FILL_HORIZONTAL);
- valWhenAutoBuildData.horizontalSpan = 2;
- autoButton = new Button(validatorGroup, SWT.CHECK);
- autoButton.setLayoutData(valWhenAutoBuildData);
- autoButton.setText(ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_UI_LBL_AUTO_VALIDATE, new String[]{getProject().getName()}));
- autoButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- pagePreferences.setAutoValidate(autoButton.getSelection());
- autoButton.setFocus();
- }
- });
-
- GridData listLabelData = new GridData(GridData.FILL_HORIZONTAL);
- listLabelData.horizontalSpan = 2;
- messageLabel = new Label(validatorGroup, SWT.NONE);
- messageLabel.setText(ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_UI_LBL_DESC, new String[]{getProject().getName()}));
- messageLabel.setLayoutData(listLabelData);
-
- GridData validatorListData = new GridData(GridData.FILL_HORIZONTAL);
- validatorListData.horizontalSpan = 2;
- validatorList = CheckboxTableViewer.newCheckList(validatorGroup, SWT.BORDER);
- validatorList.getTable().setLayoutData(validatorListData);
- validatorList.setLabelProvider(new ValidationLabelProvider());
- validatorList.setContentProvider(new ValidationContentProvider());
- validatorList.setSorter(new ValidationViewerSorter());
- validatorList.getTable().addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- pagePreferences.setEnabledValidators(ValidationConfiguration.convertToArray(validatorList.getCheckedElements()));
- try {
- updateWidgets();
- } catch (InvocationTargetException exc) {
- displayAndLogError(ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_INTERNAL_TITLE), ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_INTERNAL_PAGE), exc);
- }
- }
- });
- validatorList.setInput(pagePreferences.getValidators());
-
- selectAllButton = new Button(validatorGroup, SWT.PUSH);
- GridData selectData = new GridData();
- selectAllButton.setLayoutData(selectData);
- selectAllButton.setText(ResourceHandler.getExternalizedMessage(ResourceConstants.PROP_BUTTON_SELECTALL));
- selectAllButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- try {
- performSelectAll();
- } catch (InvocationTargetException exc) {
- displayAndLogError(ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_INTERNAL_TITLE), ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_INTERNAL_PAGE), exc);
- }
- }
- });
- PlatformUI.getWorkbench().getHelpSystem().setHelp(selectAllButton, ContextIds.VALIDATION_PROPERTIES_PAGE);
-
-
- GridData deselectData = new GridData();
- deselectAllButton = new Button(validatorGroup, SWT.PUSH);
- deselectAllButton.setLayoutData(deselectData);
- deselectAllButton.setText(ResourceHandler.getExternalizedMessage(ResourceConstants.PROP_BUTTON_DESELECTALL));
- deselectAllButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- try {
- performDeselectAll();
- } catch (InvocationTargetException exc) {
- displayAndLogError(ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_INTERNAL_TITLE), ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_INTERNAL_PAGE), exc);
- }
- }
- });
- PlatformUI.getWorkbench().getHelpSystem().setHelp(deselectAllButton, ContextIds.VALIDATION_PROPERTIES_PAGE);
-
- Composite maxGroup = new Composite(page, SWT.NONE);
- GridLayout maxGroupLayout = new GridLayout();
- maxGroupLayout.numColumns = 2;
- maxGroup.setLayout(maxGroupLayout);
- GridData maxGroupData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- maxGroup.setLayoutData(maxGroupData);
-
- GridData maxLabel = new GridData();
- maxValProblemsFieldLabel = new Label(maxGroup, SWT.NONE);
- maxValProblemsFieldLabel.setLayoutData(maxLabel);
- maxValProblemsFieldLabel.setText(ResourceHandler.getExternalizedMessage(ResourceConstants.PROP_LBL_MAXMSSGS, new String[]{getProject().getName()}));
-
- maxValProblemsField = new Text(maxGroup, SWT.SINGLE | SWT.BORDER);
- GridData maxValProblemsData = new GridData(GridData.FILL_HORIZONTAL);
- maxValProblemsField.setLayoutData(maxValProblemsData);
- maxValProblemsField.addKeyListener(new KeyListener() {
- /**
- * Sent when a key is pressed on the system keyboard.
- *
- * @param e
- * an event containing information about the key press
- */
- public void keyPressed(KeyEvent e) {
- //do nothing
- }
-
- /**
- * Sent when a key is released on the system keyboard.
- *
- * @param e
- * an event containing information about the key release
- */
- public void keyReleased(KeyEvent e) {
- try {
- pagePreferences.setMaximumNumberOfMessages(checkInteger());
- } catch (InvocationTargetException exc) {
- displayAndLogError(ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_INTERNAL_TITLE), ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_INTERNAL_PAGE), exc);
- }
- }
- });
- PlatformUI.getWorkbench().getHelpSystem().setHelp(maxValProblemsField, ContextIds.VALIDATION_PROPERTIES_PAGE_MAX_MESSAGES);
-
- // Have to set the tab order or only the first checkbox in a Composite can
- // be tab-ed to. (Seems to apply only to checkboxes. Have to use the arrow
- // key to navigate the checkboxes.)
- validatorGroup.setTabList(new Control[]{overrideGlobalButton, valWhenBuildButton, autoButton, validatorList.getTable(), selectAllButton, deselectAllButton});
-
- updateWidgets();
-
- page.setSize(page.computeSize(SWT.DEFAULT, SWT.DEFAULT));
-
- return page;
- }
-
- protected void updateTable() throws InvocationTargetException {
- TableItem[] items = validatorList.getTable().getItems();
- for (int i = 0; i < items.length; i++) {
- TableItem item = items[i];
- ValidatorMetaData vmd = (ValidatorMetaData) item.getData();
-
- // Should the validator be enabled? Read the user's preferences from last time,
- // if they exist, and set from that. If they don't exist, use the Validator class'
- // default value.
- validatorList.setChecked(vmd, pagePreferences.isEnabled(vmd));
- }
- }
-
- public boolean performDefaults() throws InvocationTargetException {
- pagePreferences.resetToDefault();
- updateWidgets();
- checkInteger(); // clear the "max must be a positive integer" message if it exists
- getDefaultsButton().setFocus();
- return true;
- }
-
- public boolean performSelectAll() throws InvocationTargetException {
- validatorList.setAllChecked(true);
- pagePreferences.setEnabledValidators(ValidationConfiguration.convertToArray(validatorList.getCheckedElements()));
- updateWidgets();
- selectAllButton.setFocus();
- return true;
- }
-
- public boolean performDeselectAll() throws InvocationTargetException {
- validatorList.setAllChecked(false);
- pagePreferences.setEnabledValidators(ValidationConfiguration.convertToArray(validatorList.getCheckedElements()));
- updateWidgets();
- deselectAllButton.setFocus();
- return true;
- }
-
- protected int checkInteger() throws InvocationTargetException {
- ProjectConfiguration pc = ConfigurationManager.getManager().getProjectConfiguration(getProject());
- String text = maxValProblemsField.getText();
- if (text == null) {
- setErrorMessage(ResourceHandler.getExternalizedMessage(ResourceConstants.PROP_ERROR_INT));
- return pc.getMaximumNumberOfMessages();
- }
- try {
- Integer tempInt = new Integer(text.trim());
-
- // no exception? It's an int, then.
- if (tempInt.intValue() <= 0) {
- setErrorMessage(ResourceHandler.getExternalizedMessage(ResourceConstants.PROP_ERROR_INT));
- return pc.getMaximumNumberOfMessages();
- }
- setErrorMessage(null);
- return Integer.valueOf(maxValProblemsField.getText().trim()).intValue();
- } catch (NumberFormatException exc) {
- setErrorMessage(ResourceHandler.getExternalizedMessage(ResourceConstants.PROP_ERROR_INT));
- return pc.getMaximumNumberOfMessages();
- }
-
- }
-
- void updateWidgets() throws InvocationTargetException {
- // Since the setting of the "override" button enables/disables the other widgets on the
- // page,
- // update the enabled state of the other widgets from the "override" button.
- boolean overridePreferences = canOverride && pagePreferences.doesProjectOverride();
-
- overrideGlobalButton.setEnabled(canOverride);
- overrideGlobalButton.setSelection(overridePreferences);
-
- validatorList.getTable().setEnabled(overridePreferences);
- validatorList.setAllGrayed(!overridePreferences);
-
- selectAllButton.setEnabled(overridePreferences); // since help messsage isn't
- // context-sensitive, it's set in the
- // createPage method
- deselectAllButton.setEnabled(overridePreferences);
-
- maxValProblemsField.setEnabled(overridePreferences);
- maxValProblemsField.setText(String.valueOf(pagePreferences.getMaximumNumberOfMessages()));
-
- updateTable();
-
- // Never check if builder is configured because if it isn't, the user needs to be able
- // to add the builder via the instructions on the F1 infopops.
- // In the case when the builder isn't configured, show the checkbox as enabled but
- // cleared
- // The only time that these two checkboxes are disabled is when no validators are
- // enabled in the list.
- boolean valEnabled = (pagePreferences.numberOfEnabledValidators() > 0);
- valWhenBuildButton.setEnabled(overridePreferences && valEnabled);
- valWhenBuildButton.setSelection(pagePreferences.isBuildValidate() && valEnabled && isBuilderConfigured);
-
- boolean incValEnabled = (pagePreferences.numberOfEnabledIncrementalValidators() > 0);
- autoButton.setEnabled(overridePreferences && isAutoBuildEnabled && incValEnabled);
- autoButton.setSelection(pagePreferences.isAutoValidate() && incValEnabled && isAutoBuildEnabled && isBuilderConfigured);
-
- updateHelp();
- }
-
- protected void updateHelp() throws InvocationTargetException {
- // Whenever a widget is disabled, it cannot get focus.
- // Since it can't have focus, its context-sensitive F1 help can't come up.
- // From experimentation, I know that the composite parent of the widget
- // can't have focus either. So, fudge the focus by making the table the widget
- // surrogate so that the F1 help can be shown, with its instructions on how to
- // enable the disabled widget. The table never has F1 help associated with it other
- // than the page F1, so this fudge doesn't remove any context-sensitive help
- // from the table widget.
-
- if (autoButton.getEnabled()) {
- // set the table's help back to what it was
- PlatformUI.getWorkbench().getHelpSystem().setHelp(validatorList.getTable(), ContextIds.VALIDATION_PROPERTIES_PAGE);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(autoButton, ContextIds.VALIDATION_PROPERTIES_PAGE_AUTO_ENABLED);
- } else {
- // The order of the following if statement is important!
- // If the user cannot enable automatic validation on the project, then the user
- // should not be told, for example, to turn auto-build on. Let the user know that
- // no matter what they do they cannot run auto-validate on the project. IF the
- // project
- // supports auto-validate, THEN check for the items which the user can change.
- validatorList.getTable().setFocus();
- if (pagePreferences.numberOfIncrementalValidators() == 0) {
- PlatformUI.getWorkbench().getHelpSystem().setHelp(validatorList.getTable(), ContextIds.VALIDATION_PROPERTIES_PAGE_DISABLED_AUTO_NOINCVALCONFIG);
- } else if (!ValidatorManager.getManager().isGlobalAutoBuildEnabled()) {
- PlatformUI.getWorkbench().getHelpSystem().setHelp(validatorList.getTable(), ContextIds.VALIDATION_PROPERTIES_PAGE_DISABLED_AUTO_AUTOBUILD);
- } else {
- // Incremental validators configured but not selected
- PlatformUI.getWorkbench().getHelpSystem().setHelp(validatorList.getTable(), ContextIds.VALIDATION_PROPERTIES_PAGE_DISABLED_AUTO_NOINCVALSELECTED);
- }
- }
-
- // if autoButton AND build button are disabled, show the build button's "to enable" text
- if (valWhenBuildButton.getEnabled()) {
- // Do NOT set the table's help back to what it was.
- // Only if auto-validate is enabled should the page go back.
- PlatformUI.getWorkbench().getHelpSystem().setHelp(valWhenBuildButton, ContextIds.VALIDATION_PROPERTIES_PAGE_REBUILD_ENABLED);
- } else {
- // page.getParent().setFocus();
- validatorList.getTable().setFocus();
- PlatformUI.getWorkbench().getHelpSystem().setHelp(validatorList.getTable(), ContextIds.VALIDATION_PROPERTIES_PAGE_DISABLED_BUILD_NOVALSELECTED);
- }
-
- // if the override button is disabled, show its "to enable" text.
- if (overrideGlobalButton.getEnabled()) {
- // Do NOT set the table's help back to what it was.
- // Only if auto-validate is enabled should the page go back.
- boolean doesProjectSupportBuildValidation = ValidatorManager.doesProjectSupportBuildValidation(getProject());
- GlobalConfiguration gp = ConfigurationManager.getManager().getGlobalConfiguration();
- boolean isPrefAuto = gp.isAutoValidate();
- boolean isPrefManual = gp.isBuildValidate();
- if (doesProjectSupportBuildValidation) {
- // Project supports build validation, so it doesn't matter what the preferences
- // are
- PlatformUI.getWorkbench().getHelpSystem().setHelp(overrideGlobalButton, ContextIds.VALIDATION_PROPERTIES_PAGE_OVERRIDE_ENABLED);
- } else if (!doesProjectSupportBuildValidation && (isPrefAuto && isPrefManual)) {
- // Project doesn't support build validation, and the user prefers both auto and
- // manual build validation
- PlatformUI.getWorkbench().getHelpSystem().setHelp(overrideGlobalButton, ContextIds.VALIDATION_PROPERTIES_PAGE_OVERRIDE_ENABLED_CANNOT_HONOUR_BOTH);
- } else if (!doesProjectSupportBuildValidation && isPrefAuto) {
- // Project doesn't support build validation, and the user prefers auto build
- // validation
- PlatformUI.getWorkbench().getHelpSystem().setHelp(overrideGlobalButton, ContextIds.VALIDATION_PROPERTIES_PAGE_OVERRIDE_ENABLED_CANNOT_HONOUR_AUTO);
- } else if (!doesProjectSupportBuildValidation && isPrefManual) {
- // Project doesn't support build validation, and the user prefers manual build
- // validation
- PlatformUI.getWorkbench().getHelpSystem().setHelp(overrideGlobalButton, ContextIds.VALIDATION_PROPERTIES_PAGE_OVERRIDE_ENABLED_CANNOT_HONOUR_MANUAL);
- } else if (!doesProjectSupportBuildValidation && !isPrefAuto && !isPrefManual) {
- // Project doesn't support build validation, but that doesn't matter because the
- // user prefers no build validation.
- PlatformUI.getWorkbench().getHelpSystem().setHelp(overrideGlobalButton, ContextIds.VALIDATION_PROPERTIES_PAGE_OVERRIDE_ENABLED);
- }
- } else {
- validatorList.getTable().setFocus();
- // Preference page doesn't allow projects to override
- PlatformUI.getWorkbench().getHelpSystem().setHelp(validatorList.getTable(), ContextIds.VALIDATION_PROPERTIES_PAGE_DISABLED_OVERRIDE);
- }
- }
-
- /*
- * Store the current values of the controls into the preference store.
- */
- private void storeValues() throws InvocationTargetException {
- pagePreferences.setDoesProjectOverride(overrideGlobalButton.getSelection());
-
- if (pagePreferences.doesProjectOverride()) {
- // project override = user's preference + does the global preference allow the
- // project to override
-
- // If the manual build button is disabled because no validators are selected in the
- // task list, don't overwrite the user's preference.
- if (valWhenBuildButton.isEnabled()) {
- pagePreferences.setBuildValidate(valWhenBuildButton.getSelection());
- }
-
- // If the auto build button is disabled because no validators are selected in the
- // task list, or because auto-build is disabled, don't overwrite the user's
- // preference.
- if (autoButton.isEnabled()) {
- pagePreferences.setAutoValidate(autoButton.getSelection());
- }
-
- pagePreferences.setMaximumNumberOfMessages(checkInteger());
- pagePreferences.setEnabledValidators(ValidationConfiguration.convertToArray(validatorList.getCheckedElements()));
- } else {
- pagePreferences.resetToDefault(); // If the project can't or doesn't override,
- // update its values to match the global
- // preference values.
- }
-
- pagePreferences.passivate();
- }
-
- /**
- * Reads the list of validators, enables the validators which are selected, disables the
- * validators which are not selected, and if the auto-validate checkbox is chosen, performs
- * a full validation.
- */
- public boolean performOk() throws InvocationTargetException {
- // addBuilder MUST be called before storeValues
- // addBuilder adds a builder to the project, and that changes the project description.
- // Changing a project's description triggers the validation framework's "natureChange"
- // migration, and a nature change requires that the list of validators be recalculated.
- // If the builder is added after the values are stored, the stored values are
- // overwritten.
- addBuilder();
-
- // If this method is being called because an APPLY was hit instead of an OK,
- // recalculate the "can build be enabled" status because the builder may have
- // been added in the addBuilder() call above.
- // Also recalculate the values that depend on the isBuilderConfigured value.
- isBuilderConfigured = ValidatorManager.doesProjectSupportBuildValidation(getProject());
-
- // Persist the values.
- storeValues();
-
- if (autoButton.getSelection()) {
- int enabledIncrementalValidators = pagePreferences.numberOfEnabledIncrementalValidators();
- int enabledValidators = pagePreferences.numberOfEnabledValidators();
- if (enabledValidators != enabledIncrementalValidators) {
- // Then some of the enabled validators are not incremental
- int iIconType = org.eclipse.swt.SWT.ICON_INFORMATION;
- Display display = Display.getCurrent();
- Shell shell = (display == null) ? null : display.getActiveShell();
- MessageBox messageBox = new MessageBox(shell, org.eclipse.swt.SWT.OK | iIconType);
- messageBox.setText(ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_UI_MSSGBOX_TITLE_NONINC));
-
- ValidatorMetaData[] vmds = pagePreferences.getEnabledValidators();
- StringBuffer buffer = new StringBuffer(NEWLINE_AND_TAB);
- for (int i = 0; i < vmds.length; i++) {
- ValidatorMetaData vmd = vmds[i];
-
- if (!vmd.isIncremental()) {
- buffer.append(vmd.getValidatorDisplayName());
- buffer.append(NEWLINE_AND_TAB);
- }
- }
- messageBox.setMessage(ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_UI_AUTO_ON_NONINC, new String[]{buffer.toString()}));
- messageBox.open();
- }
- }
-
- if (pagePreferences.hasEnabledValidatorsChanged(oldVmd, false) || ValidatorManager.getManager().isMessageLimitExceeded(getProject())) { // false
- // means
- // that
- // the
- // preference
- // "allow"
- // value
- // hasn't
- // changed
- ValidatorManager.getManager().updateTaskList(getProject()); // Do not remove the
- // exceeded message;
- // only
- // ValidationOperation
- // should do that
- // because it's about to
- // run validation. If
- // the limit is
- // increased, messages
- // may still be missing,
- // so don't remove the
- // "messages may be
- // missing" message.
- }
-
- return true;
- }
-
- /**
- * If the current project doesn't have the validation builder configured on it, add the
- * builder. Otherwise return without doing anything.
- */
- private void addBuilder() {
- if (overrideGlobalButton.getSelection()) { // do not add the builder unless the user
- // overrides the preferences
- if (autoButton.getSelection() || valWhenBuildButton.getSelection()) {
- ValidatorManager.addProjectBuildValidationSupport(getProject());
- }
- }
- }
-
- public Composite getControl() {
- return page;
- }
-
- public void dispose() {
- maxValProblemsField.dispose();
- maxValProblemsFieldLabel.dispose();
- selectAllButton.dispose();
- deselectAllButton.dispose();
- autoButton.dispose();
- valWhenBuildButton.dispose();
- validatorList.getTable().dispose();
- messageLabel.dispose();
- // layout.dispose();
- // data.dispose();
- emptyRowPlaceholder.dispose();
- overrideGlobalButton.dispose();
- page.dispose();
- }
- }
-
- /**
- * ValidationPreferencePage constructor comment.
- */
- public ValidationPropertiesPage() {
- // Some of the initialization is done in the "initialize" method, which is
- // called by the "getPageType" method, because the current project must
- // be known in order to initialize those fields.
- }
-
- /**
- * Given a parent (the Properties guide), create the Validators page to be added to it.
- */
- protected Control createContents(Composite parent) {
- IProject project = getProject();
-
- if ((project == null) || !project.isOpen()) {
- _pageImpl = new InvalidPage(parent);
- } else {
- try {
- if (ConfigurationManager.getManager().getProjectConfiguration(project).numberOfValidators() == 0) {
- _pageImpl = new NoValidatorsPage(parent);
- } else {
- _pageImpl = new ValidatorListPage(parent);
- }
- } catch (InvocationTargetException exc) {
- _pageImpl = new InvalidPage(parent);
- displayAndLogError(ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_INTERNAL_TITLE), ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_INTERNAL_PAGE), exc);
- } catch (Throwable exc) {
- _pageImpl = new InvalidPage(parent);
- displayAndLogError(ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_INTERNAL_TITLE), ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_INTERNAL_PAGE), exc);
- }
- }
-
- return _pageImpl.getControl();
- }
-
- /**
- * Since the pages are inner classes of a child PreferencePage, not a PreferencePage itself,
- * DialogPage's automatic disposal of its children's widgets cannot be used. Instead, dispose of
- * each inner class' widgets explicitly.
- */
- public void dispose() {
- super.dispose();
- try {
- _pageImpl.dispose();
- } catch (Throwable exc) {
- logError(exc);
- }
- }
-
- /**
- * Returns the highlighted item in the workbench.
- */
- public IProject getProject() {
- Object element = getElement();
-
- if (element == null) {
- return null;
- }
-
- if (element instanceof IProject) {
- return (IProject) element;
- }
-
- return null;
- }
-
- protected void noDefaultAndApplyButton() {
- super.noDefaultAndApplyButton();
- }
-
- /**
- * Performs special processing when this page's Defaults button has been pressed.
- * <p>
- * This is a framework hook method for sublcasses to do special things when the Defaults button
- * has been pressed. Subclasses may override, but should call <code>super.performDefaults</code>.
- * </p>
- */
- protected void performDefaults() {
- super.performDefaults();
- try {
- _pageImpl.performDefaults();
- } catch (InvocationTargetException exc) {
- displayAndLogError(ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_INTERNAL_TITLE), ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_INTERNAL_PAGE), exc);
- } catch (Throwable exc) {
- displayAndLogError(ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_INTERNAL_TITLE), ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_INTERNAL_PAGE), exc);
- }
- }
-
- /**
- * When the user presses the "OK" or "Apply" button on the Properties Guide/Properties Page,
- * respectively, some processing is performed by this PropertyPage. If the page is found, and
- * completes successfully, true is returned. Otherwise, false is returned, and the guide doesn't
- * finish.
- */
- public boolean performOk() {
- try {
- return _pageImpl.performOk();
- } catch (InvocationTargetException exc) {
- displayAndLogError(ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_INTERNAL_TITLE), ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_INTERNAL_PAGE), exc);
- return false;
- } catch (Throwable exc) {
- displayAndLogError(ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_INTERNAL_TITLE), ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_INTERNAL_PAGE), exc);
- return false;
- }
- }
-
- void logError(Throwable exc) {
- Logger logger = WTPUIPlugin.getLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationUIPlugin.getLogEntry();
- entry.setSourceIdentifier("ValidationPropertiesPage.displayAndLogError"); //$NON-NLS-1$
- entry.setMessageTypeIdentifier(ResourceConstants.VBF_EXC_INTERNAL_PAGE);
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
-
- if (exc instanceof InvocationTargetException) {
- if (((InvocationTargetException) exc).getTargetException() != null) {
- entry.setTargetException(((InvocationTargetException) exc).getTargetException());
- logger.write(Level.SEVERE, entry);
- }
- }
- }
- }
-
- void displayAndLogError(String title, String message, Throwable exc) {
- logError(exc);
- displayMessage(title, message, org.eclipse.swt.SWT.ICON_ERROR);
- }
-
- private void displayMessage(String title, String message, int iIconType) {
- MessageBox messageBox = new MessageBox(getShell(), org.eclipse.swt.SWT.OK | iIconType | org.eclipse.swt.SWT.APPLICATION_MODAL);
- messageBox.setMessage(message);
- messageBox.setText(title);
- messageBox.open();
- }
-
- /**
- * @see org.eclipse.jface.preference.PreferencePage#getDefaultsButton()
- */
- protected Button getDefaultsButton() {
- return super.getDefaultsButton();
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.validation.ui/validateui/org/eclipse/wst/validation/internal/ui/ValidationUIConstants.java b/plugins/org.eclipse.wst.validation.ui/validateui/org/eclipse/wst/validation/internal/ui/ValidationUIConstants.java
deleted file mode 100644
index b06484b18..000000000
--- a/plugins/org.eclipse.wst.validation.ui/validateui/org/eclipse/wst/validation/internal/ui/ValidationUIConstants.java
+++ /dev/null
@@ -1,19 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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
- *******************************************************************************/
-package org.eclipse.wst.validation.internal.ui;
-
-
-/**
- * @deprecated For use by the validation framework only.
- */
-public interface ValidationUIConstants extends org.eclipse.wst.validation.internal.ui.ResourceConstants {
- //Default
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.validation.ui/validateui/org/eclipse/wst/validation/internal/ui/plugin/RunnableWithProgressWrapper.java b/plugins/org.eclipse.wst.validation.ui/validateui/org/eclipse/wst/validation/internal/ui/plugin/RunnableWithProgressWrapper.java
deleted file mode 100644
index cf3240863..000000000
--- a/plugins/org.eclipse.wst.validation.ui/validateui/org/eclipse/wst/validation/internal/ui/plugin/RunnableWithProgressWrapper.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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
- *******************************************************************************/
-package org.eclipse.wst.validation.internal.ui.plugin;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.resources.IWorkspaceRunnable;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.wst.common.frameworks.internal.operations.IHeadlessRunnableWithProgress;
-import org.eclipse.wst.validation.internal.operations.ValidationOperation;
-
-
-/**
- * This is a wrapper for an IWorkspaceRunnable to the IRunnableWithProgress. This class needs to be
- * used when running the operation from a IRunnableContext.
- *
- * @see IRunnableContext
- * @see ValidationUIPlugin#getRunnableWithProgress Creation date: (5/8/2001 1:28:45 PM)
- * @author: Administrator
- */
-public class RunnableWithProgressWrapper implements IRunnableWithProgress {
- private IHeadlessRunnableWithProgress headlessRunnable = null;
- private IWorkspaceRunnable workspaceRunnable = null;
- private ValidationOperation validationOperation = null;
-
- /**
- * @deprecated Will be removed in Milestone 3. Use
- * RunnableWithProgressWrapper(IWorkspaceRunnable)
- */
- public RunnableWithProgressWrapper(IHeadlessRunnableWithProgress aHeadlessRunnableWithProgress) {
- setHeadlessRunnable(aHeadlessRunnableWithProgress);
- }
-
- public RunnableWithProgressWrapper(IWorkspaceRunnable aHeadlessRunnableWithProgress) {
- setWorkspaceRunnable(aHeadlessRunnableWithProgress);
- }
-
- public RunnableWithProgressWrapper(ValidationOperation op) {
- setValidationOperation(op);
- }
-
- /**
- * @deprecated Will be removed in Milestone 3. Use getWorkspaceRunnable()
- */
- protected IHeadlessRunnableWithProgress getHeadlessRunnable() {
- return headlessRunnable;
- }
-
- protected IWorkspaceRunnable getWorkspaceRunnable() {
- return workspaceRunnable;
- }
-
- /**
- * @see IRunnableWithProgress
- */
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- if (getHeadlessRunnable() != null) {
- getHeadlessRunnable().run(monitor);
- } else {
- IWorkspaceRunnable runnable = (getWorkspaceRunnable() == null) ? validationOperation : getWorkspaceRunnable();
- if (runnable == null) {
- return;
- }
- ResourcesPlugin.getWorkspace().run(runnable, monitor);
- }
- } catch (CoreException exc) {
- throw new InvocationTargetException(exc);
- }
- }
-
- /**
- * @deprecated Will be removed in Milestone 3. Use setWorkspaceRunnable(IWorkspaceRunnable)
- */
- protected void setHeadlessRunnable(IHeadlessRunnableWithProgress newHeadlessRunnable) {
- headlessRunnable = newHeadlessRunnable;
- }
-
- protected void setWorkspaceRunnable(IWorkspaceRunnable newWorkspaceRunnable) {
- workspaceRunnable = newWorkspaceRunnable;
- }
-
- protected void setValidationOperation(ValidationOperation op) {
- validationOperation = op;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.validation.ui/validateui/org/eclipse/wst/validation/internal/ui/plugin/ValidationUIPlugin.java b/plugins/org.eclipse.wst.validation.ui/validateui/org/eclipse/wst/validation/internal/ui/plugin/ValidationUIPlugin.java
deleted file mode 100644
index f4121fee4..000000000
--- a/plugins/org.eclipse.wst.validation.ui/validateui/org/eclipse/wst/validation/internal/ui/plugin/ValidationUIPlugin.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2001, 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
- **************************************************************************************************/
-package org.eclipse.wst.validation.internal.ui.plugin;
-
-import java.util.logging.Level;
-
-import org.eclipse.core.resources.IWorkspaceRunnable;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jem.util.logger.LogEntry;
-import org.eclipse.jem.util.logger.proxy.Logger;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.wst.common.frameworks.internal.ui.WTPUIPlugin;
-import org.eclipse.wst.validation.internal.operations.ValidationOperation;
-import org.eclipse.wst.validation.internal.plugin.ValidationPlugin;
-import org.osgi.framework.BundleContext;
-
-
-
-public class ValidationUIPlugin extends WTPUIPlugin {
- private static ValidationUIPlugin _plugin = null;
-
- public final static String VALIDATION_PROP_FILE_NAME = "validate_ui"; //$NON-NLS-1$
- public static final String VALIDATION_PLUGIN_ID = "org.eclipse.wst.validation.ui"; //$NON-NLS-1$
-
- public ValidationUIPlugin() {
- super();
- if (_plugin == null) {
- _plugin = this;
- }
- }
-
- public static String getBundleName() {
- return VALIDATION_PROP_FILE_NAME;
- }
-
- public static LogEntry getLogEntry() {
- return ValidationPlugin.getLogEntry();
- }
-
-
- public static ValidationUIPlugin getPlugin() {
- return _plugin;
- }
-
- /**
- * Returns the translated String found with the given key.
- *
- * @param key
- * java.lang.String
- * @return java.lang.String
- */
- public static String getResourceString(String key) {
- try {
- return Platform.getResourceString(Platform.getBundle(VALIDATION_PLUGIN_ID), key);
- } catch (Exception e) {
- e.printStackTrace();
- Logger logger = WTPUIPlugin.getLogger();
- if (logger.isLoggingLevel(Level.FINE)) {
- LogEntry entry = getLogEntry();
- entry.setSourceID("ValidationUIPlugin.getResourceString(String)"); //$NON-NLS-1$
- entry.setText("Missing resource for key" + key); //$NON-NLS-1$
- logger.write(Level.FINE, entry);
- }
-
- return key;
- }
- }
-
- /**
- * This method should be called whenever you need to run one of our headless operations in the
- * UI.
- */
- public static IRunnableWithProgress getRunnableWithProgress(IWorkspaceRunnable aWorkspaceRunnable) {
- return new RunnableWithProgressWrapper(aWorkspaceRunnable);
- }
-
-// public static IRunnableWithProgress getRunnableWithProgress(IHeadlessRunnableWithProgress aHeadlessRunnableWithProgress) {
-// return new RunnableWithProgressWrapper(aHeadlessRunnableWithProgress);
-// }
-
- // Need a third, ValidationOperation version of this method, because ValidationOperation
- // is both an IWorkspaceRunnable and an IHeadlessRunnableWithProgress. This method will
- // exist only while IHeadlessRunnableWithProgress exists.
- public static IRunnableWithProgress getRunnableWithProgress(ValidationOperation op) {
- return new RunnableWithProgressWrapper(op);
- }
-
- public void start(BundleContext context) throws Exception {
- super.start(context);
- // org.eclipse.wst.validation.internal.operations.ValidatorManager.setResourceUtilClass(org.eclipse.wst.validation.internal.operations.ui.UIResourceUtil.class);
- }
-} \ No newline at end of file

Back to the top