Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Vosburgh2013-04-10 18:41:39 +0000
committerBrian Vosburgh2013-04-16 20:04:35 +0000
commit65512b3154161a233cee773c6ddda56201ade3ca (patch)
tree4e752d1f9bb36d634bab573af63b1781149f2824
parent3df74a3e1bacc11401e42f975abda6d2d1411d3f (diff)
downloadwebtools.dali-65512b3154161a233cee773c6ddda56201ade3ca.tar.gz
webtools.dali-65512b3154161a233cee773c6ddda56201ade3ca.tar.xz
webtools.dali-65512b3154161a233cee773c6ddda56201ade3ca.zip
clean up some of the common.ui utilities
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/META-INF/MANIFEST.MF1
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/gen/AbstractJptGenerateJob.java14
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/WorkbenchPageTools.java2
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/WorkbenchTools.java277
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/WorkbenchWindowTools.java2
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/AbstractItemStructuredStateProviderManager.java4
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/listeners/SWTCollectionChangeListenerWrapper.java8
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/listeners/SWTListChangeListenerWrapper.java8
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/listeners/SWTPropertyChangeListenerWrapper.java8
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/listeners/SWTStateChangeListenerWrapper.java8
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/swt/bind/BooleanStateController.java4
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/swt/widgets/ComboTools.java109
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/swt/widgets/ControlTools.java173
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/swt/widgets/DisplayTools.java257
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/swt/widgets/TableTools.java41
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/util/ControlSwitcher.java3
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/util/SWTUtil.java527
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/AbstractUiCommandContext.java4
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/AsynchronousUiCommandContext.java6
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/SynchronousUiCommandContext.java4
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/AddRemoveListPane.java4
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/AddRemovePane.java6
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/ClassChooserPane.java39
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/ComboPane.java4
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/Dialog.java13
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/IntegerCombo.java4
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/Pane.java37
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/wizards/JavaProjectWizardPage.java6
-rw-r--r--common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/util/ControlEnablerTest.java4
-rw-r--r--common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/util/ControlSwitcherTest.java4
-rw-r--r--common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/util/ControlVisibilityEnablerTest.java4
-rw-r--r--common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/util/LabeledButtonTest.java4
-rw-r--r--common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/util/LabeledControlUpdaterTest.java4
-rw-r--r--common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/util/LabeledLabelTest.java4
-rw-r--r--common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/util/SectionExpanderTest.java4
-rw-r--r--jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/wizards/gen/JdbcDriverWizardPage.java4
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/wizards/oxm/OxmFileOptionsWizardPage.java7
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/wizards/oxm/OxmFileWizard.java13
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/ClassesGeneratorUi.java5
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/JaxbJavaCompletionProposalComputer.java5
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/JaxbPlatformAdapterFactory.java5
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/actions/OpenJaxbResourceAction.java13
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/navigator/JaxbNavigatorContentProvider.java8
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/properties/JaxbProjectModel.java5
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/properties/JaxbProjectPropertiesPage.java5
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/properties/JaxbSchemasPropertiesPage.java5
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/ClassesGeneratorWizard.java5
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/ClassesGeneratorWizardPage.java11
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/facet/JaxbFacetPage.java4
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/schemagen/SchemaGeneratorWizardPage.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkConvertCombo.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/dialogs/AddVirtualAttributeDialog.java36
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/caching/EntityListComposite.java41
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/connection/JdbcConnectionPropertiesComposite.java5
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/customization/EntityListComposite.java41
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/customization/SessionCustomizersComposite.java40
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/options/EclipseLinkPersistenceUnitOptionsEditorPage.java10
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/options/PersistenceXmlSchemaGenerationComposite.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v2_0/persistence/EclipseLinkPersistenceUnitOptions2_0EditorPage.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/wizards/DynamicEntityClassWizardPage.java13
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/wizards/DynamicEntityFieldsWizardPage.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/wizards/EclipseLinkDynamicEntityWizard.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/wizards/gen/DynamicDefaultTableGenerationWizardPage.java3
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/wizards/gen/GenerateDynamicEntitiesFromSchemaWizard.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/JpaPlatformAdapterFactory.java5
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/JpaXmlCompletionProposalComputer.java5
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/actions/OpenJpaResourceAction.java18
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/BaseJoinColumnDialogPane.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/EntityNameCombo.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/dialogs/AddPersistentClassDialog.java38
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/editors/JpaXmlEditor.java9
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/handlers/PersistentAttributeMapAsHandler.java5
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/handlers/PersistentTypeMapAsHandler.java5
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/persistence/JdbcConnectionPropertiesComposite2_0.java5
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/persistence/PersistenceUnitOptionsEditorPage2_0.java42
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpql/JpaJpqlContentProposalProvider.java14
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpql/JpqlCompletionProposalComputer.java5
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/listeners/SWTConnectionListenerWrapper.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/navigator/JpaNavigatorContentProvider.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/persistence/PersistenceUnitClassesComposite.java43
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/persistence/PersistenceUnitPropertiesEditorPage.java7
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/base/AbstractJpaPlatformUi.java9
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/properties/DataModelPropertyPage.java7
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/properties/JpaProjectPropertiesPage.java15
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/selection/JpaTextEditorManager.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/selection/SetJpaSelectionJob.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/views/JpaStructurePage.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/DatabaseSchemaWizardPage.java9
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/JpaFacetActionPage.java15
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/JpaFacetInstallPage.java13
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/JpaMakePersistentWizardPage.java10
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/conversion/java/JavaMetadataConversionWizardPage.java16
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/entity/EntityClassWizardPage.java9
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/entity/EntityFieldsWizardPage.java9
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/entity/EntityWizard.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/AssociationTablesPage.java3
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/CardinalityPage.java3
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/CascadeDialog.java10
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/DatabaseGroup.java2
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/DefaultTableGenerationWizardPage.java13
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/GenerateEntitiesFromSchemaWizard.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/JoinColumnsPage.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/NewAssociationWizardPage.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/PromptJPAProjectWizardPage.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/SWTUtil.java2
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/TableAssociationsWizardPage.java11
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/TablesAndColumnsCustomizationWizardPage.java11
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/TablesSelectorWizardPage.java22
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/makepersistent/JoinColumnsAnnotationEditor.java5
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/makepersistent/JpaMakePersistentWizard.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/makepersistent/SelectOrderByDialog.java5
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/orm/MappingFileOptionsWizardPage.java11
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/orm/MappingFileWizard.java9
-rw-r--r--jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/dialog/SelectTypeDialog.java5
114 files changed, 1321 insertions, 1165 deletions
diff --git a/common/plugins/org.eclipse.jpt.common.ui/META-INF/MANIFEST.MF b/common/plugins/org.eclipse.jpt.common.ui/META-INF/MANIFEST.MF
index 6576ee52eb..fae37a260e 100644
--- a/common/plugins/org.eclipse.jpt.common.ui/META-INF/MANIFEST.MF
+++ b/common/plugins/org.eclipse.jpt.common.ui/META-INF/MANIFEST.MF
@@ -11,6 +11,7 @@ Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Require-Bundle: org.eclipse.core.resources;bundle-version="[3.4.0,4.0.0)",
org.eclipse.draw2d;bundle-version="[3.4.0,4.0.0)",
+ org.eclipse.help;bundle-version="[3.6.0,4.0.0)",
org.eclipse.jdt.core;bundle-version="[3.4.0,4.0.0)",
org.eclipse.jdt.ui;bundle-version="[3.4.0,4.0.0)",
org.eclipse.jface;bundle-version="[3.7.0,4.0.0)",
diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/gen/AbstractJptGenerateJob.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/gen/AbstractJptGenerateJob.java
index 81c3d97e14..f8f346fe0c 100644
--- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/gen/AbstractJptGenerateJob.java
+++ b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/gen/AbstractJptGenerateJob.java
@@ -25,13 +25,13 @@ import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jpt.common.core.gen.JptGenerator;
import org.eclipse.jpt.common.core.gen.LaunchConfigListener;
import org.eclipse.jpt.common.ui.JptCommonUiMessages;
-import org.eclipse.jpt.common.ui.internal.util.SWTUtil;
+import org.eclipse.jpt.common.ui.internal.WorkbenchTools;
+import org.eclipse.jpt.common.ui.internal.swt.widgets.DisplayTools;
import org.eclipse.jpt.common.utility.internal.reference.SynchronizedBoolean;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.ide.IDE;
/**
@@ -110,11 +110,13 @@ public abstract class AbstractJptGenerateJob extends WorkspaceJob {
protected void openEditor(final IFile file) {
if(file != null) {
- SWTUtil.asyncExec(new Runnable() {
+ DisplayTools.asyncExec(new Runnable() {
public void run() {
try {
- IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
- IDE.openEditor(page, file, true);
+ IWorkbenchPage page = WorkbenchTools.getActivePage();
+ if (page != null) {
+ IDE.openEditor(page, file, true);
+ }
}
catch (PartInitException e) {
AbstractJptGenerateJob.this.logException(e);
@@ -161,7 +163,7 @@ public abstract class AbstractJptGenerateJob extends WorkspaceJob {
}
private void displayError(final String message) {
- SWTUtil.syncExec(new Runnable() {
+ DisplayTools.syncExec(new Runnable() {
public void run() {
MessageDialog.openError(
AbstractJptGenerateJob.this.getShell(),
diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/WorkbenchPageTools.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/WorkbenchPageTools.java
index 45be569f70..6b05a5274a 100644
--- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/WorkbenchPageTools.java
+++ b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/WorkbenchPageTools.java
@@ -16,7 +16,7 @@ import org.eclipse.ui.IWorkbenchPage;
/**
* {@link IWorkbenchPage} utility methods.
*/
-public class WorkbenchPageTools {
+public final class WorkbenchPageTools {
/**
* Close all the views in the specified workbench page with the
diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/WorkbenchTools.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/WorkbenchTools.java
index 55ebb29d97..d0a1d4533c 100644
--- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/WorkbenchTools.java
+++ b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/WorkbenchTools.java
@@ -9,14 +9,254 @@
******************************************************************************/
package org.eclipse.jpt.common.ui.internal;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.content.IContentType;
+import org.eclipse.help.IContext;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jpt.common.core.internal.utility.PlatformTools;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IEditorDescriptor;
import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.ide.IDE;
/**
* {@link IWorkbench} utility methods.
*/
-public class WorkbenchTools {
+public final class WorkbenchTools {
+
+ // ********** workbench UI **********
+
+ /**
+ * Return the Eclipse UI {@link IWorkbench workbench}
+ * {@link Display display}.
+ * Return <code>null</code> if the workbench is not running.
+ * @see #getWorkbench()
+ * @see IWorkbench#getDisplay()
+ */
+ public static Display getDisplay() {
+ IWorkbench wb = getWorkbench();
+ return (wb == null) ? null : wb.getDisplay();
+ }
+
+ /**
+ * Return the currently active workbench window's shell.
+ * Return <code>null</code> if called from a non-UI thread.
+ * @see #getActiveWindow()
+ * @see #getWorkbench()
+ * @see IWorkbench#getActiveWorkbenchWindow()
+ */
+ public static Shell getActiveShell() {
+ IWorkbenchWindow ww = getActiveWindow();
+ return (ww == null) ? null : ww.getShell();
+ }
+
+ /**
+ * Return the currently active workbench window's shell.
+ * Return <code>null</code> if called from a non-UI thread.
+ * @see #getActiveWindow()
+ * @see #getWorkbench()
+ * @see IWorkbenchWindow#getActivePage()
+ * @see IWorkbench#getActiveWorkbenchWindow()
+ */
+ public static IWorkbenchPage getActivePage() {
+ IWorkbenchWindow ww = getActiveWindow();
+ return (ww == null) ? null : ww.getActivePage();
+ }
+
+ /**
+ * Return the currently active workbench window's shell.
+ * Return <code>null</code> if called from a non-UI thread.
+ * @see #getWorkbench()
+ * @see IWorkbench#getActiveWorkbenchWindow()
+ */
+ public static IWorkbenchWindow getActiveWindow() {
+ IWorkbench wb = getWorkbench();
+ return (wb == null) ? null : wb.getActiveWorkbenchWindow();
+ }
+
+ /**
+ * Return the Eclipse UI {@link IWorkbench workbench}.
+ * Return <code>null</code> if the workbench is not running
+ * (i.e. either it has not been started or it has been terminated).
+ * <p>
+ * <strong>NB:</strong> There is no guarantee the workbench will continue
+ * running after it is returned.
+ * @see PlatformUI#isWorkbenchRunning()
+ */
+ public static IWorkbench getWorkbench() {
+ return PlatformUI.isWorkbenchRunning() ? PlatformUI.getWorkbench() : null;
+ }
+
+
+ // ********** editors **********
+
+ /**
+ * Return the workbench's default editor for the specified file, as
+ * determined by the file's name <em>and</em> content.
+ * @see #getDefaultEditor(String, IContentType)
+ */
+ public static IEditorDescriptor getDefaultEditor(IFile file) {
+ return getDefaultEditor(file.getName(), IDE.getContentType(file));
+ }
+
+ /**
+ * Return the workbench's default editor for the specified file name and
+ * content type.
+ * @see #getWorkbench()
+ * @see IWorkbench#getEditorRegistry()
+ * @see org.eclipse.ui.IEditorRegistry#getDefaultEditor(String, IContentType)
+ */
+ public static IEditorDescriptor getDefaultEditor(String fileName, IContentType contentType) {
+ IWorkbench wb = getWorkbench();
+ return (wb == null) ? null : wb.getEditorRegistry().getDefaultEditor(fileName, contentType);
+ }
+
+
+ // ********** shared images **********
+
+ /**
+ * Return the specified image from the Eclipse UI {@link IWorkbench
+ * workbench}'s image registry.
+ * Return <code>null</code> if the workbench is not running.
+ * <p>
+ * <strong>NB:</strong> The returned image is managed by the workbench;
+ * clients must <em>not</em> dispose of the returned image.
+ * @see #getWorkbench()
+ * @see IWorkbench#getSharedImages()
+ * @see org.eclipse.ui.ISharedImages
+ */
+ public static Image getSharedImage(String symbolicName) {
+ IWorkbench wb = getWorkbench();
+ return (wb == null) ? null : wb.getSharedImages().getImage(symbolicName);
+ }
+
+ /**
+ * Return the specified image descriptor from the Eclipse UI
+ * {@link IWorkbench workbench}'s image registry.
+ * Return <code>null</code> if the workbench is not running.
+ * @see #getWorkbench()
+ * @see IWorkbench#getSharedImages()
+ * @see org.eclipse.ui.ISharedImages
+ */
+ public static ImageDescriptor getSharedImageDescriptor(String symbolicName) {
+ IWorkbench wb = getWorkbench();
+ return (wb == null) ? null : wb.getSharedImages().getImageDescriptor(symbolicName);
+ }
+
+
+ // ********** help **********
+
+ /**
+ * Set the specified help context ID on the specified control.
+ * @see #getWorkbench()
+ * @see IWorkbench#getHelpSystem()
+ * @see org.eclipse.ui.help.IWorkbenchHelpSystem#setHelp(Control, String)
+ */
+ public static void setHelp(Control control, String contextID) {
+ IWorkbench wb = getWorkbench();
+ if (wb != null) {
+ wb.getHelpSystem().setHelp(control, contextID);
+ }
+ }
+
+ /**
+ * Set the specified help context ID on the specified action.
+ * @see #getWorkbench()
+ * @see IWorkbench#getHelpSystem()
+ * @see org.eclipse.ui.help.IWorkbenchHelpSystem#setHelp(IAction, String)
+ */
+ public static void setHelp(IAction action, String contextID) {
+ IWorkbench wb = getWorkbench();
+ if (wb != null) {
+ wb.getHelpSystem().setHelp(action, contextID);
+ }
+ }
+
+ /**
+ * Set the specified help context ID on the specified menu.
+ * @see #getWorkbench()
+ * @see IWorkbench#getHelpSystem()
+ * @see org.eclipse.ui.help.IWorkbenchHelpSystem#setHelp(Menu, String)
+ */
+ public static void setHelp(Menu menu, String contextID) {
+ IWorkbench wb = getWorkbench();
+ if (wb != null) {
+ wb.getHelpSystem().setHelp(menu, contextID);
+ }
+ }
+
+ /**
+ * Set the specified help context ID on the specified control.
+ * @see #getWorkbench()
+ * @see IWorkbench#getHelpSystem()
+ * @see org.eclipse.ui.help.IWorkbenchHelpSystem#setHelp(MenuItem, String)
+ */
+ public static void setHelp(MenuItem item, String contextID) {
+ IWorkbench wb = getWorkbench();
+ if (wb != null) {
+ wb.getHelpSystem().setHelp(item, contextID);
+ }
+ }
+
+ /**
+ * Display the entire help bookshelf.
+ * <p>
+ * <strong>NB:</strong> Must be called from the UI thread.
+ * <p>
+ * @see #getWorkbench()
+ * @see IWorkbench#getHelpSystem()
+ * @see org.eclipse.ui.help.IWorkbenchHelpSystem#displayHelp()
+ */
+ public static void displayHelp() {
+ IWorkbench wb = getWorkbench();
+ if (wb != null) {
+ wb.getHelpSystem().displayHelp();
+ }
+ }
+
+ /**
+ * Display help for the specified context.
+ * <p>
+ * <strong>NB:</strong> Must be called from the UI thread.
+ * <p>
+ * @see #getWorkbench()
+ * @see IWorkbench#getHelpSystem()
+ * @see org.eclipse.ui.help.IWorkbenchHelpSystem#displayHelp(IContext)
+ */
+ public static void displayHelp(IContext context) {
+ IWorkbench wb = getWorkbench();
+ if (wb != null) {
+ wb.getHelpSystem().displayHelp(context);
+ }
+ }
+
+ /**
+ * Display help for the specified context ID.
+ * <p>
+ * <strong>NB:</strong> Must be called from the UI thread.
+ * <p>
+ * @see #getWorkbench()
+ * @see IWorkbench#getHelpSystem()
+ * @see org.eclipse.ui.help.IWorkbenchHelpSystem#displayHelp(String)
+ */
+ public static void displayHelp(String contextID) {
+ IWorkbench wb = getWorkbench();
+ if (wb != null) {
+ wb.getHelpSystem().displayHelp(contextID);
+ }
+ }
+
+
+ // ********** close views **********
/**
* Close all the views in the platform workbench with the specified ID.
@@ -24,7 +264,10 @@ public class WorkbenchTools {
* @see org.eclipse.ui.IWorkbenchPartSite#getId()
*/
public static void closeAllViews(String viewID) {
- closeAllViews(PlatformUI.getWorkbench(), viewID);
+ IWorkbench wb = getWorkbench();
+ if (wb != null) {
+ closeAllViews(wb, viewID);
+ }
}
/**
@@ -38,7 +281,35 @@ public class WorkbenchTools {
}
- // ********** constructor **********
+ // ********** adapters **********
+
+ /**
+ * Adapt the Eclipse UI {@link IWorkbench workbench} to the specified class.
+ * Return <code>null</code> if the workbench is not running
+ * (i.e. either it has not been started or it has been terminated).
+ * @see #getWorkbench()
+ * @see PlatformTools#getAdapter(Object, Class)
+ */
+ public static <A> A getAdapter(Class<A> adapterType) {
+ IWorkbench wb = getWorkbench();
+ return (wb == null) ? null : PlatformTools.getAdapter(wb, adapterType);
+ }
+
+ /**
+ * Return the workbench service corresponding to the specified API.
+ * Return <code>null</code> if the workbench is not running
+ * (i.e. either it has not been started or it has been terminated).
+ * @see #getWorkbench()
+ * @see org.eclipse.ui.services.IServiceLocator#getService(Class)
+ */
+ @SuppressWarnings("unchecked")
+ public static <A> A getService(Class<A> api) {
+ IWorkbench wb = getWorkbench();
+ return (wb == null) ? null : (A) wb.getService(api);
+ }
+
+
+ // ********** disabled constructor **********
/**
* Suppress default constructor, ensuring non-instantiability.
diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/WorkbenchWindowTools.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/WorkbenchWindowTools.java
index 35763d2303..eb9917c4e0 100644
--- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/WorkbenchWindowTools.java
+++ b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/WorkbenchWindowTools.java
@@ -15,7 +15,7 @@ import org.eclipse.ui.IWorkbenchWindow;
/**
* {@link IWorkbenchWindow} utility methods.
*/
-public class WorkbenchWindowTools {
+public final class WorkbenchWindowTools {
/**
* Close all the views in the specified workbench window with the
diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/AbstractItemStructuredStateProviderManager.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/AbstractItemStructuredStateProviderManager.java
index 1216a703ac..1b61c007a0 100644
--- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/AbstractItemStructuredStateProviderManager.java
+++ b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/AbstractItemStructuredStateProviderManager.java
@@ -15,7 +15,7 @@ import org.eclipse.jface.viewers.BaseLabelProvider;
import org.eclipse.jface.viewers.LabelProviderChangedEvent;
import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jpt.common.ui.internal.util.SWTUtil;
+import org.eclipse.jpt.common.ui.internal.swt.widgets.DisplayTools;
import org.eclipse.jpt.common.ui.jface.ItemExtendedLabelProvider;
import org.eclipse.jpt.common.ui.jface.ItemLabelProvider;
import org.eclipse.jpt.common.ui.jface.ItemStructuredContentProvider;
@@ -232,7 +232,7 @@ public abstract class AbstractItemStructuredStateProviderManager<V extends Struc
}
protected void execute(Runnable runnable) {
- SWTUtil.execute(this.viewer, runnable);
+ DisplayTools.execute(this.viewer, runnable);
}
protected boolean viewerIsAlive() {
diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/listeners/SWTCollectionChangeListenerWrapper.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/listeners/SWTCollectionChangeListenerWrapper.java
index 8c94238d76..3f5ce0e5e1 100644
--- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/listeners/SWTCollectionChangeListenerWrapper.java
+++ b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/listeners/SWTCollectionChangeListenerWrapper.java
@@ -9,7 +9,7 @@
******************************************************************************/
package org.eclipse.jpt.common.ui.internal.listeners;
-import org.eclipse.jpt.common.ui.internal.util.SWTUtil;
+import org.eclipse.jpt.common.ui.internal.swt.widgets.DisplayTools;
import org.eclipse.jpt.common.utility.internal.RunnableAdapter;
import org.eclipse.jpt.common.utility.model.event.CollectionAddEvent;
import org.eclipse.jpt.common.utility.model.event.CollectionChangeEvent;
@@ -125,12 +125,12 @@ public class SWTCollectionChangeListenerWrapper
}
/**
- * {@link SWTUtil#execute(Runnable)} seems to work OK;
- * but using {@link SWTUtil#syncExec(Runnable)} can somtimes make things
+ * {@link DisplayTools#execute(Runnable)} seems to work OK;
+ * but using {@link DisplayTools#syncExec(Runnable)} can somtimes make things
* more predictable when debugging, at the risk of deadlocks.
*/
private void execute(Runnable r) {
- SWTUtil.execute(r);
+ DisplayTools.execute(r);
// SWTUtil.syncExec(r);
}
diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/listeners/SWTListChangeListenerWrapper.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/listeners/SWTListChangeListenerWrapper.java
index 3037b60e79..5135ee83cb 100644
--- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/listeners/SWTListChangeListenerWrapper.java
+++ b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/listeners/SWTListChangeListenerWrapper.java
@@ -9,7 +9,7 @@
******************************************************************************/
package org.eclipse.jpt.common.ui.internal.listeners;
-import org.eclipse.jpt.common.ui.internal.util.SWTUtil;
+import org.eclipse.jpt.common.ui.internal.swt.widgets.DisplayTools;
import org.eclipse.jpt.common.utility.internal.RunnableAdapter;
import org.eclipse.jpt.common.utility.model.event.ListAddEvent;
import org.eclipse.jpt.common.utility.model.event.ListChangeEvent;
@@ -171,12 +171,12 @@ public class SWTListChangeListenerWrapper
}
/**
- * {@link SWTUtil#execute(Runnable)} seems to work OK;
- * but using {@link SWTUtil#syncExec(Runnable)} can somtimes make things
+ * {@link DisplayTools#execute(Runnable)} seems to work OK;
+ * but using {@link DisplayTools#syncExec(Runnable)} can somtimes make things
* more predictable when debugging, at the risk of deadlocks.
*/
private void execute(Runnable r) {
- SWTUtil.execute(r);
+ DisplayTools.execute(r);
// SWTUtil.syncExec(r);
}
diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/listeners/SWTPropertyChangeListenerWrapper.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/listeners/SWTPropertyChangeListenerWrapper.java
index 049a373c61..9462188cb1 100644
--- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/listeners/SWTPropertyChangeListenerWrapper.java
+++ b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/listeners/SWTPropertyChangeListenerWrapper.java
@@ -9,7 +9,7 @@
******************************************************************************/
package org.eclipse.jpt.common.ui.internal.listeners;
-import org.eclipse.jpt.common.ui.internal.util.SWTUtil;
+import org.eclipse.jpt.common.ui.internal.swt.widgets.DisplayTools;
import org.eclipse.jpt.common.utility.internal.RunnableAdapter;
import org.eclipse.jpt.common.utility.internal.collection.SynchronizedQueue;
import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent;
@@ -64,12 +64,12 @@ public class SWTPropertyChangeListenerWrapper
}
/**
- * {@link SWTUtil#execute(Runnable)} seems to work OK;
- * but using {@link SWTUtil#syncExec(Runnable)} can somtimes make things
+ * {@link DisplayTools#execute(Runnable)} seems to work OK;
+ * but using {@link DisplayTools#syncExec(Runnable)} can somtimes make things
* more predictable when debugging, at the risk of deadlocks.
*/
private void execute(Runnable r) {
- SWTUtil.execute(r);
+ DisplayTools.execute(r);
// SWTUtil.syncExec(r);
}
diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/listeners/SWTStateChangeListenerWrapper.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/listeners/SWTStateChangeListenerWrapper.java
index cd5c6ad980..f7b4ab3a30 100644
--- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/listeners/SWTStateChangeListenerWrapper.java
+++ b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/listeners/SWTStateChangeListenerWrapper.java
@@ -9,7 +9,7 @@
******************************************************************************/
package org.eclipse.jpt.common.ui.internal.listeners;
-import org.eclipse.jpt.common.ui.internal.util.SWTUtil;
+import org.eclipse.jpt.common.ui.internal.swt.widgets.DisplayTools;
import org.eclipse.jpt.common.utility.internal.RunnableAdapter;
import org.eclipse.jpt.common.utility.internal.collection.SynchronizedQueue;
import org.eclipse.jpt.common.utility.model.event.StateChangeEvent;
@@ -59,12 +59,12 @@ public class SWTStateChangeListenerWrapper
}
/**
- * {@link SWTUtil#execute(Runnable)} seems to work OK;
- * but using {@link SWTUtil#syncExec(Runnable)} can somtimes make things
+ * {@link DisplayTools#execute(Runnable)} seems to work OK;
+ * but using {@link DisplayTools#syncExec(Runnable)} can somtimes make things
* more predictable when debugging, at the risk of deadlocks.
*/
private void execute(Runnable r) {
- SWTUtil.execute(r);
+ DisplayTools.execute(r);
// SWTUtil.syncExec(r);
}
diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/swt/bind/BooleanStateController.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/swt/bind/BooleanStateController.java
index f3992db71d..2bcf162ea1 100644
--- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/swt/bind/BooleanStateController.java
+++ b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/swt/bind/BooleanStateController.java
@@ -11,7 +11,7 @@ package org.eclipse.jpt.common.ui.internal.swt.bind;
import org.eclipse.jpt.common.ui.internal.listeners.SWTPropertyChangeListenerWrapper;
import org.eclipse.jpt.common.ui.internal.swt.events.DisposeAdapter;
-import org.eclipse.jpt.common.ui.internal.util.SWTUtil;
+import org.eclipse.jpt.common.ui.internal.swt.widgets.DisplayTools;
import org.eclipse.jpt.common.utility.internal.RunnableAdapter;
import org.eclipse.jpt.common.utility.internal.ObjectTools;
import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent;
@@ -167,7 +167,7 @@ abstract class BooleanStateController {
abstract void setControlState(boolean controlState);
void setControlState(Control control, boolean controlState) {
- SWTUtil.execute(new SetControlStateRunnable(control, controlState));
+ DisplayTools.execute(new SetControlStateRunnable(control, controlState));
}
/* CU private */ class SetControlStateRunnable
diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/swt/widgets/ComboTools.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/swt/widgets/ComboTools.java
new file mode 100644
index 0000000000..35ae0fa5e5
--- /dev/null
+++ b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/swt/widgets/ComboTools.java
@@ -0,0 +1,109 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2013 Oracle. 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:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.common.ui.internal.swt.widgets;
+
+import org.eclipse.swt.events.FocusEvent;
+import org.eclipse.swt.events.FocusListener;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.widgets.Combo;
+
+/**
+ * A suite of utility methods related to the user interface.
+ *
+ * @version 2.0
+ * @since 1.0
+ */
+public final class ComboTools {
+
+ /**
+ * Tweak the specified combo-box to remove the default value when the
+ * widget receives the focus and to show the default when the widget loses
+ * the focus. The default value must be the first value in the combo-box's
+ * selection list.
+ */
+ public static void handleDefaultValue(Combo combo) {
+ ComboListener listener = new ComboListener();
+ combo.addFocusListener(listener);
+ combo.addModifyListener(listener);
+ }
+
+ /**
+ * This handler is responsible for removing the default value when the combo
+ * has the focus or when the selected item is the default value and to select
+ * it when the combo loses the focus.
+ */
+ /* CU private */ static class ComboListener
+ implements FocusListener, ModifyListener
+ {
+ public void focusGained(FocusEvent e) {
+ Combo combo = (Combo) e.widget;
+ if (combo.getSelectionIndex() == 0) {
+ // cannot modify the combo while it is notifying its listeners
+ DisplayTools.asyncExec(new SelectText(combo));
+ }
+ }
+
+ public void focusLost(FocusEvent e) {
+ // NOP
+ }
+
+ private class SelectText
+ implements Runnable
+ {
+ private final Combo combo;
+
+ SelectText(Combo combo) {
+ super();
+ this.combo = combo;
+ }
+
+ public void run() {
+ if (this.combo.isDisposed()) {
+ return;
+ }
+ String text = this.combo.getText();
+ this.combo.setSelection(new Point(0, text.length()));
+ }
+ }
+
+ public void modifyText(ModifyEvent e) {
+ Combo combo = (Combo) e.widget;
+ if (combo.isFocusControl() && (combo.getSelectionIndex() == 0)) {
+ // cannot modify the combo while it is notifying its listeners
+ DisplayTools.asyncExec(new ModifyText(combo));
+ }
+ }
+
+ private class ModifyText
+ implements Runnable
+ {
+ private final Combo combo;
+
+ ModifyText(Combo combo) {
+ super();
+ this.combo = combo;
+ }
+
+ public void run() {
+ if (this.combo.isDisposed()) {
+ return;
+ }
+ String text = this.combo.getText();
+ if (text.length() == 0) {
+ text = this.combo.getItem(0);
+ this.combo.setText(text);
+ }
+ this.combo.setSelection(new Point(0, text.length()));
+ }
+ }
+ }
+}
diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/swt/widgets/ControlTools.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/swt/widgets/ControlTools.java
new file mode 100644
index 0000000000..d75e5a95a7
--- /dev/null
+++ b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/swt/widgets/ControlTools.java
@@ -0,0 +1,173 @@
+/*******************************************************************************
+ * Copyright (c) 2012, 2013 Oracle. 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:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.common.ui.internal.swt.widgets;
+
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.forms.widgets.ScrolledForm;
+import org.eclipse.ui.forms.widgets.SharedScrolledComposite;
+
+/**
+ * {@link Control} utility methods.
+ */
+public final class ControlTools {
+
+ // ********** center **********
+
+ /**
+ * Center the specified control within its display.
+ * (This is helpful for centering {@link org.eclipse.swt.widgets.Shell}s in
+ * a display.)
+ * <p>
+ * <strong>NB:</strong> This will not look too good on a dual monitor system.
+ */
+ public static void center(Control control) {
+ control.setBounds(calculateCenteredBounds(control.getBounds(), control.getDisplay().getBounds()));
+ }
+
+ /**
+ * Center the specified control within the specified parent control.
+ */
+ public static void center(Control control, Control parentControl) {
+ control.setBounds(calculateCenteredBounds(control.getBounds(), parentControl.getBounds()));
+ }
+
+ /**
+ * Calculate the bounds (within the second specified rectangle's coordinate
+ * system) that would center the first specified rectangle
+ * with respect to the second specified rectangle.
+ */
+ public static Rectangle calculateCenteredBounds(Rectangle rectangle1, Rectangle rectangle2) {
+ return calculateCenteredBounds(rectangle1.width, rectangle1.height, rectangle2.x, rectangle2.y, rectangle2.width, rectangle2.height);
+ }
+
+ /**
+ * Calculate the bounds (within the second specified rectangle's coordinate
+ * system) that would center the first specified rectangle
+ * with respect to the second specified rectangle.
+ */
+ public static Rectangle calculateCenteredBounds(Point size1, Point size2) {
+ return calculateCenteredBounds(size1.x, size1.y, size2.x, size2.y);
+ }
+
+ /**
+ * Calculate the point (within the second specified rectangle's coordinate
+ * system) that would center the first specified rectangle
+ * with respect to the second specified rectangle.
+ */
+ public static Rectangle calculateCenteredBounds(int width1, int height1, int width2, int height2) {
+ return calculateCenteredBounds(width1, height1, 0, 0, width2, height2);
+ }
+
+
+ /**
+ * Calculate the point (within the second specified rectangle's coordinate
+ * system) that would center the first specified rectangle
+ * with respect to the second specified rectangle.
+ */
+ public static Rectangle calculateCenteredBounds(int width1, int height1, int x2, int y2, int width2, int height2) {
+ return new Rectangle(x2 + ((width2 - width1) >> 1), y2 + ((height2 - height1) >> 1), width1, height1);
+ }
+
+ /**
+ * Calculate the point (within the second specified rectangle's coordinate
+ * system) that would center the first specified rectangle
+ * with respect to the second specified rectangle.
+ */
+ public static Point calculateCenteredPosition(Rectangle rectangle1, Rectangle rectangle2) {
+ return calculateCenteredPosition(rectangle1.width, rectangle1.height, rectangle2.x, rectangle2.y, rectangle2.width, rectangle2.height);
+ }
+
+ /**
+ * Calculate the point (within the second specified rectangle's coordinate
+ * system) that would center the first specified rectangle
+ * with respect to the second specified rectangle.
+ */
+ public static Point calculateCenteredPosition(Point size1, Point size2) {
+ return calculateCenteredPosition(size1.x, size1.y, size2.x, size2.y);
+ }
+
+ /**
+ * Calculate the point (within the second specified rectangle's coordinate
+ * system) that would center the first specified rectangle
+ * with respect to the second specified rectangle.
+ */
+ public static Point calculateCenteredPosition(int width1, int height1, int width2, int height2) {
+ return calculateCenteredPosition(width1, height1, 0, 0, width2, height2);
+ }
+
+ /**
+ * Calculate the point (within the second specified rectangle's coordinate
+ * system) that would center the first specified rectangle
+ * with respect to the second specified rectangle.
+ */
+ public static Point calculateCenteredPosition(int width1, int height1, int x2, int y2, int width2, int height2) {
+ return new Point(x2 + ((width2 - width1) >> 1), y2 + ((height2 - height1) >> 1));
+ }
+
+
+ // ********** reflow **********
+
+ /**
+ * Reflow the specified control and all its ancestors up its containment
+ * hierarchy.
+ * @see #reflow(Composite)
+ */
+ public static void reflow(Control control) {
+ reflow((control instanceof Composite) ? (Composite) control : control.getParent());
+ }
+
+ /**
+ * Reflow the specified composite and all its ancestors up its containment
+ * hierarchy until we reach a {@link SharedScrolledComposite} or the window
+ * (i.e. the top of the containment hierarchy).
+ * Copied from {@link org.eclipse.ui.forms.widgets.Section#reflow()}.
+ */
+ public static void reflow(Composite composite) {
+ for (Composite c = composite; c != null; ) {
+ c.setRedraw(false);
+ c = c.getParent();
+ if ((c instanceof SharedScrolledComposite) || (c instanceof Shell)) {
+ break;
+ }
+ }
+
+ for (Composite c = composite; c != null; ) {
+ c.layout(true);
+ c = c.getParent();
+ if (c instanceof SharedScrolledComposite) {
+ ((ScrolledForm) c).reflow(true);
+ break;
+ }
+ }
+
+ for (Composite c = composite; c != null; ) {
+ c.setRedraw(true);
+ c = c.getParent();
+ if ((c instanceof SharedScrolledComposite) || (c instanceof Shell)) {
+ break;
+ }
+ }
+ }
+
+
+ // ********** disabled constructor **********
+
+ /**
+ * Suppress default constructor, ensuring non-instantiability.
+ */
+ private ControlTools() {
+ super();
+ throw new UnsupportedOperationException();
+ }
+}
diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/swt/widgets/DisplayTools.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/swt/widgets/DisplayTools.java
new file mode 100644
index 0000000000..15b4a49994
--- /dev/null
+++ b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/swt/widgets/DisplayTools.java
@@ -0,0 +1,257 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2013 Oracle. 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:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.common.ui.internal.swt.widgets;
+
+import org.eclipse.jface.util.OpenStrategy;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jpt.common.ui.internal.WorkbenchTools;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Widget;
+import org.eclipse.ui.IWorkbench;
+
+/**
+ * {@link Display} convenience methods.
+ */
+public final class DisplayTools {
+
+ // ********** UI thread execution **********
+
+ /**
+ * <strong>NB:</strong> The runnable will not be executed if the workbench
+ * is not running (i.e. the runnable is treated as ephemeral, and not
+ * executing it, probably during workbench shutdown, is not a problem because
+ * it is UI-related and the UI is gone).
+ * @see Display#asyncExec(Runnable)
+ * @see #syncExec(Runnable)
+ * @see #timerExec(int, Runnable)
+ * @see #execute(Runnable)
+ */
+ public static void asyncExec(Runnable runnable) {
+ Display display = getDisplay();
+ if (display != null) {
+ display.asyncExec(runnable);
+ }
+ }
+
+ /**
+ * <strong>NB:</strong> The runnable will not be executed if the workbench
+ * is not running (i.e. the runnable is treated as ephemeral, and not
+ * executing it, probably during workbench shutdown, is not a problem because
+ * it is UI-related and the UI is gone).
+ * @see Display#syncExec(Runnable)
+ * @see #asyncExec(Runnable)
+ * @see #timerExec(int, Runnable)
+ * @see #execute(Runnable)
+ */
+ public static void syncExec(Runnable runnable) {
+ Display display = getDisplay();
+ if (display != null) {
+ display.syncExec(runnable);
+ }
+ }
+
+ /**
+ * Use the standard delay.
+ * <p>
+ * <strong>NB:</strong> The runnable will not be executed if the workbench
+ * is not running (i.e. the runnable is treated as ephemeral, and not
+ * executing it, probably during workbench shutdown, is not a problem because
+ * it is UI-related and the UI is gone).
+ * @see OpenStrategy#getPostSelectionDelay()
+ * @see #timerExec(int, Runnable)
+ */
+ public static void delayedExec(Runnable runnable) {
+ timerExec(OpenStrategy.getPostSelectionDelay(), runnable);
+ }
+
+ /**
+ * <strong>NB:</strong> The runnable will not be executed if the workbench
+ * is not running (i.e. the runnable is treated as ephemeral, and not
+ * executing it, probably during workbench shutdown, is not a problem because
+ * it is UI-related and the UI is gone).
+ * @see Display#timerExec(int, Runnable)
+ * @see #asyncExec(Runnable)
+ * @see #syncExec(Runnable)
+ * @see #execute(Runnable)
+ */
+ public static void timerExec(int milliseconds, Runnable runnable) {
+ Display display = getDisplay();
+ if (display != null) {
+ display.timerExec(milliseconds, runnable);
+ }
+ }
+
+ /**
+ * Execute the specified runnable if the current thread is the UI thread;
+ * otherwise asynchrounously dispatch the runnable to the UI thread,
+ * returning immediately. This is useful for event handlers when it is not
+ * obvious whether the events are fired on the UI thread.
+ * <p>
+ * <strong>NB:</strong> The runnable will not be executed if the workbench
+ * is not running (i.e. the runnable is treated as ephemeral, and not
+ * executing it, probably during workbench shutdown, is not a problem because
+ * it is UI-related and the UI is gone).
+ * @see Display#asyncExec(Runnable)
+ * @see #asyncExec(Runnable)
+ * @see #syncExec(Runnable)
+ * @see #timerExec(int, Runnable)
+ * @see IWorkbench#getDisplay()
+ */
+ public static void execute(Runnable runnable) {
+ Display display = Display.getCurrent();
+ if (display != null) {
+ // the current thread is the UI thread
+ runnable.run();
+ } else {
+ display = WorkbenchTools.getDisplay();
+ if (display != null) {
+ display.asyncExec(runnable);
+ }
+ }
+ }
+
+ /**
+ * Execute the specified runnable if the current thread is the specified
+ * viewer's thread;
+ * otherwise asynchrounously dispatch the runnable to the viewer's thread,
+ * returning immediately. This is useful for event handlers when it is not
+ * obviously whether the events are fired on the viewer's thread.
+ * @see #execute(Runnable)
+ * @see Display#asyncExec(Runnable)
+ * @see #asyncExec(Runnable)
+ * @see #syncExec(Runnable)
+ * @see #timerExec(int, Runnable)
+ */
+ public static void execute(Viewer viewer, Runnable runnable) {
+ execute(viewer.getControl(), runnable);
+ }
+
+ /**
+ * Execute the specified runnable if the current thread is the specified
+ * control's thread;
+ * otherwise asynchrounously dispatch the runnable to the control's thread,
+ * returning immediately. This is useful for event handlers when it is not
+ * obviously whether the events are fired on the control's thread.
+ * @see #execute(Runnable)
+ * @see Display#asyncExec(Runnable)
+ * @see #asyncExec(Runnable)
+ * @see #syncExec(Runnable)
+ * @see #timerExec(int, Runnable)
+ */
+ public static void execute(Control control, Runnable runnable) {
+ execute(control.getDisplay(), runnable);
+ }
+
+ /**
+ * Execute the specified runnable if the current thread is the specified
+ * display's thread;
+ * otherwise asynchrounously dispatch the runnable to the display's thread,
+ * returning immediately. This is useful for event handlers when it is not
+ * obviously whether the events are fired on the display's thread.
+ * @see #execute(Runnable)
+ * @see Display#asyncExec(Runnable)
+ * @see #asyncExec(Runnable)
+ * @see #syncExec(Runnable)
+ * @see #timerExec(int, Runnable)
+ */
+ public static void execute(Display display, Runnable runnable) {
+ if (display.getThread() == Thread.currentThread()) {
+ // the current thread is the the UI thread
+ runnable.run();
+ } else {
+ display.asyncExec(runnable);
+ }
+ }
+
+ /**
+ * Return the current shell. Return <code>null</code> if there is none.
+ * @exception org.eclipse.swt.SWTException if not called from the UI thread
+ */
+ public static Shell getShell() {
+ Shell shell = getActiveShell();
+ return (shell != null) ? shell : WorkbenchTools.getActiveShell();
+ }
+
+ /**
+ * Return the current "active" shell, which can be the shell from any
+ * window. Return <code>null</code> if there is no display.
+ * @see Display#getActiveShell()
+ * @exception org.eclipse.swt.SWTException if not called from the UI thread
+ */
+ public static Shell getActiveShell() {
+ // Retrieve the active shell, which can be the shell from any window
+ Display display = getDisplay();
+ return (display == null) ? null : display.getActiveShell();
+ }
+
+ /**
+ * Return the most appropriate {@link Display display}; i.e. return the
+ * {@link Display#getCurrent() display associated with the current thread}
+ * if it is present; otherwise return the
+ * {@link IWorkbench#getDisplay() Eclipse workbench
+ * display} (but, <em>explicitly</em>, not the
+ * {@link Display#getDefault() "default display"} -
+ * see the comment at {@link IWorkbench#getDisplay()}).
+ * Return <code>null</code> if the workbench is not running.
+ */
+ public static Display getDisplay() {
+ Display display = Display.getCurrent();
+ return (display != null) ? display : WorkbenchTools.getDisplay();
+ }
+
+
+ // ********** UI thread **********
+
+ /**
+ * Determines if the current thread is the UI event thread.
+ *
+ * @return <code>true</code> if it's the UI event thread, <code>false</code>
+ * otherwise
+ */
+ public static boolean uiThread() {
+ return Display.getCurrent() != null;
+ }
+
+ /**
+ * Determines if the current thread is the UI event thread by using the
+ * thread from which the given viewer's display was instantiated.
+ *
+ * @param viewer The viewer used to determine if the current thread
+ * is the UI event thread
+ * @return <code>true</code> if the current thread is the UI event thread;
+ * <code>false</code> otherwise
+ */
+ public static boolean uiThread(Viewer viewer) {
+ return uiThread(viewer.getControl());
+ }
+
+ /**
+ * Determines if the current thread is the UI event thread by using the
+ * thread from which the given widget's display was instantiated.
+ *
+ * @param widget The widget used to determine if the current thread
+ * is the UI event thread
+ * @return <code>true</code> if the current thread is the UI event thread;
+ * <code>false</code> otherwise
+ */
+ public static boolean uiThread(Widget widget) {
+ return widget.getDisplay().getThread() == Thread.currentThread();
+ }
+
+
+ // ********** disabled constructor **********
+
+ private DisplayTools() {
+ super();
+ throw new UnsupportedOperationException();
+ }
+}
diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/swt/widgets/TableTools.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/swt/widgets/TableTools.java
new file mode 100644
index 0000000000..47487ecf36
--- /dev/null
+++ b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/swt/widgets/TableTools.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2012, 2013 Oracle. 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:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.common.ui.internal.swt.widgets;
+
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.swt.widgets.Table;
+
+/**
+ * {@link Table} utility methods.
+ */
+public final class TableTools {
+
+ public static int calculateHeightHint(Table table, int rowCount) {
+ if (table.getFont().equals(JFaceResources.getDefaultFont())) {
+ table.setFont(JFaceResources.getDialogFont());
+ }
+ int hint = table.getHeaderHeight() + (table.getItemHeight() * rowCount);
+ if (table.getLinesVisible()) {
+ hint += table.getGridLineWidth() * (rowCount - 1);
+ }
+ return hint;
+ }
+
+
+ // ********** disabled constructor **********
+
+ /**
+ * Suppress default constructor, ensuring non-instantiability.
+ */
+ private TableTools() {
+ super();
+ throw new UnsupportedOperationException();
+ }
+}
diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/util/ControlSwitcher.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/util/ControlSwitcher.java
index d442601e7d..932f992a54 100644
--- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/util/ControlSwitcher.java
+++ b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/util/ControlSwitcher.java
@@ -10,6 +10,7 @@
package org.eclipse.jpt.common.ui.internal.util;
import org.eclipse.jpt.common.ui.internal.listeners.SWTPropertyChangeListenerWrapper;
+import org.eclipse.jpt.common.ui.internal.swt.widgets.ControlTools;
import org.eclipse.jpt.common.utility.internal.transformer.AbstractTransformer;
import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent;
import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener;
@@ -146,7 +147,7 @@ public final class ControlSwitcher
this.pageBook.showPage(page);
// Revalidate the parents in order to update the layout
- SWTUtil.reflow(this.pageBook);
+ ControlTools.reflow(this.pageBook);
}
@SuppressWarnings("unchecked")
diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/util/SWTUtil.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/util/SWTUtil.java
deleted file mode 100644
index f792eeb705..0000000000
--- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/util/SWTUtil.java
+++ /dev/null
@@ -1,527 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2012 Oracle. 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:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.common.ui.internal.util;
-
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.util.OpenStrategy;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.events.FocusEvent;
-import org.eclipse.swt.events.FocusListener;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.Widget;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.forms.widgets.ScrolledForm;
-
-/**
- * A suite of utility methods related to the user interface.
- *
- * @version 2.0
- * @since 1.0
- */
-public class SWTUtil {
-
- /**
- * <strong>NB:</strong> The runnable will not be executed if the workbench
- * is not running (i.e. the runnable is treated as ephemeral, and not
- * executing it, probably during workbench shutdown, is not a problem because
- * it is UI-related and the UI is gone).
- * @see Display#asyncExec(Runnable)
- * @see #syncExec(Runnable)
- * @see #timerExec(int, Runnable)
- * @see #execute(Runnable)
- */
- public static void asyncExec(Runnable runnable) {
- Display display = getDisplay();
- if (display != null) {
- display.asyncExec(runnable);
- }
- }
-
- /**
- * <strong>NB:</strong> The runnable will not be executed if the workbench
- * is not running (i.e. the runnable is treated as ephemeral, and not
- * executing it, probably during workbench shutdown, is not a problem because
- * it is UI-related and the UI is gone).
- * @see Display#syncExec(Runnable)
- * @see #asyncExec(Runnable)
- * @see #timerExec(int, Runnable)
- * @see #execute(Runnable)
- */
- public static void syncExec(Runnable runnable) {
- Display display = getDisplay();
- if (display != null) {
- display.syncExec(runnable);
- }
- }
-
- /**
- * Use the standard delay.
- * <p>
- * <strong>NB:</strong> The runnable will not be executed if the workbench
- * is not running (i.e. the runnable is treated as ephemeral, and not
- * executing it, probably during workbench shutdown, is not a problem because
- * it is UI-related and the UI is gone).
- * @see OpenStrategy#getPostSelectionDelay()
- * @see #timerExec(int, Runnable)
- */
- public static void delayedExec(Runnable runnable) {
- timerExec(OpenStrategy.getPostSelectionDelay(), runnable);
- }
-
- /**
- * <strong>NB:</strong> The runnable will not be executed if the workbench
- * is not running (i.e. the runnable is treated as ephemeral, and not
- * executing it, probably during workbench shutdown, is not a problem because
- * it is UI-related and the UI is gone).
- * @see Display#timerExec(int, Runnable)
- * @see #asyncExec(Runnable)
- * @see #syncExec(Runnable)
- * @see #execute(Runnable)
- */
- public static void timerExec(int milliseconds, Runnable runnable) {
- Display display = getDisplay();
- if (display != null) {
- display.timerExec(milliseconds, runnable);
- }
- }
-
- /**
- * Execute the specified runnable if the current thread is the UI thread;
- * otherwise asynchrounously dispatch the runnable to the UI thread,
- * returning immediately. This is useful for event handlers when it is not
- * obvious whether the events are fired on the UI thread.
- * <p>
- * <strong>NB:</strong> The runnable will not be executed if the workbench
- * is not running (i.e. the runnable is treated as ephemeral, and not
- * executing it, probably during workbench shutdown, is not a problem because
- * it is UI-related and the UI is gone).
- * @see Display#asyncExec(Runnable)
- * @see #asyncExec(Runnable)
- * @see #syncExec(Runnable)
- * @see #timerExec(int, Runnable)
- * @see IWorkbench#getDisplay()
- */
- public static void execute(Runnable runnable) {
- Display display = Display.getCurrent();
- if (display != null) {
- // the current thread is the UI thread
- runnable.run();
- } else {
- display = getWorkbenchDisplay();
- if (display != null) {
- display.asyncExec(runnable);
- }
- }
- }
-
- /**
- * Execute the specified runnable if the current thread is the specified
- * viewer's thread;
- * otherwise asynchrounously dispatch the runnable to the viewer's thread,
- * returning immediately. This is useful for event handlers when it is not
- * obviously whether the events are fired on the viewer's thread.
- * @see #execute(Runnable)
- * @see Display#asyncExec(Runnable)
- * @see #asyncExec(Runnable)
- * @see #syncExec(Runnable)
- * @see #timerExec(int, Runnable)
- */
- public static void execute(Viewer viewer, Runnable runnable) {
- execute(viewer.getControl(), runnable);
- }
-
- /**
- * Execute the specified runnable if the current thread is the specified
- * control's thread;
- * otherwise asynchrounously dispatch the runnable to the control's thread,
- * returning immediately. This is useful for event handlers when it is not
- * obviously whether the events are fired on the control's thread.
- * @see #execute(Runnable)
- * @see Display#asyncExec(Runnable)
- * @see #asyncExec(Runnable)
- * @see #syncExec(Runnable)
- * @see #timerExec(int, Runnable)
- */
- public static void execute(Control control, Runnable runnable) {
- execute(control.getDisplay(), runnable);
- }
-
- /**
- * Execute the specified runnable if the current thread is the specified
- * display's thread;
- * otherwise asynchrounously dispatch the runnable to the display's thread,
- * returning immediately. This is useful for event handlers when it is not
- * obviously whether the events are fired on the display's thread.
- * @see #execute(Runnable)
- * @see Display#asyncExec(Runnable)
- * @see #asyncExec(Runnable)
- * @see #syncExec(Runnable)
- * @see #timerExec(int, Runnable)
- */
- public static void execute(Display display, Runnable runnable) {
- if (display.getThread() == Thread.currentThread()) {
- // the current thread is the the UI thread
- runnable.run();
- } else {
- display.asyncExec(runnable);
- }
- }
-
- /**
- * Return the current shell. Return <code>null</code> if there is none.
- * @exception org.eclipse.swt.SWTException if not called from the UI thread
- */
- public static Shell getShell() {
- Shell shell = getActiveShell();
- return (shell != null) ? shell : getActiveWorkbenchShell();
- }
-
- /**
- * Return the current "active" shell, which can be the shell from any
- * window. Return <code>null</code> if there is no display.
- * @see Display#getActiveShell()
- * @exception org.eclipse.swt.SWTException if not called from the UI thread
- */
- public static Shell getActiveShell() {
- // Retrieve the active shell, which can be the shell from any window
- Display display = getDisplay();
- return (display == null) ? null : display.getActiveShell();
- }
-
- /**
- * Return the currently active workbench window's shell.
- * Return <code>null</code> if not called from the UI thread.
- * @see IWorkbench#getActiveWorkbenchWindow()
- */
- public static Shell getActiveWorkbenchShell() {
- IWorkbench wb = getWorkbench();
- if (wb == null) {
- return null;
- }
- IWorkbenchWindow ww = wb.getActiveWorkbenchWindow();
- return (ww == null) ? null : ww.getShell();
- }
-
- /**
- * Return the most appropriate {@link Display display}; i.e. return the
- * {@link Display#getCurrent() display associated with the current thread}
- * if it is present; otherwise return the
- * {@link IWorkbench#getDisplay() Eclipse workbench
- * display} (but, <em>explicitly</em>, not the
- * {@link Display#getDefault() "default display"} -
- * see the comment at {@link IWorkbench#getDisplay()}).
- * Return <code>null</code> if the workbench is not running.
- */
- public static Display getDisplay() {
- Display display = Display.getCurrent();
- return (display != null) ? display : getWorkbenchDisplay();
- }
-
- /**
- * Return the Eclipse UI {@link IWorkbench workbench}
- * {@link Display display}.
- * Return <code>null</code> if the workbench is not running.
- * @see #getWorkbench()
- */
- public static Display getWorkbenchDisplay() {
- IWorkbench wb = getWorkbench();
- return (wb == null) ? null : wb.getDisplay();
- }
-
- /**
- * Return the Eclipse UI {@link IWorkbench workbench}.
- * Return <code>null</code> if the workbench is not running
- * (i.e. either it has not been started or it has been terminated).
- * <p>
- * <strong>NB:</strong> There is no guarantee the workbench will continue
- * running after it is returned.
- * @see PlatformUI#isWorkbenchRunning()
- */
- public static IWorkbench getWorkbench() {
- return PlatformUI.isWorkbenchRunning() ? PlatformUI.getWorkbench() : null;
- }
-
- /**
- * Center the specified shell within its display.
- * <p>
- * <strong>NB:</strong> This will not look too good on a dual monitor system.
- */
- public static void center(Shell shell) {
- shell.setBounds(calculateCenteredBounds(shell.getBounds(), shell.getDisplay().getBounds()));
- }
-
- /**
- * Center the specified shell within the specified parent shell.
- */
- public static void center(Shell shell, Shell parentShell) {
- shell.setBounds(calculateCenteredBounds(shell.getBounds(), parentShell.getBounds()));
- }
-
- /**
- * Calculate the bounds (within the second specified rectangle's coordinate
- * system) that would center the first specified rectangle
- * with respect to the second specified rectangle.
- */
- public static Rectangle calculateCenteredBounds(Rectangle rectangle1, Rectangle rectangle2) {
- return calculateCenteredBounds(rectangle1.width, rectangle1.height, rectangle2.x, rectangle2.y, rectangle2.width, rectangle2.height);
- }
-
- /**
- * Calculate the bounds (within the second specified rectangle's coordinate
- * system) that would center the first specified rectangle
- * with respect to the second specified rectangle.
- */
- public static Rectangle calculateCenteredBounds(Point size1, Point size2) {
- return calculateCenteredBounds(size1.x, size1.y, size2.x, size2.y);
- }
-
- /**
- * Calculate the point (within the second specified rectangle's coordinate
- * system) that would center the first specified rectangle
- * with respect to the second specified rectangle.
- */
- public static Rectangle calculateCenteredBounds(int width1, int height1, int width2, int height2) {
- return calculateCenteredBounds(width1, height1, 0, 0, width2, height2);
- }
-
-
- /**
- * Calculate the point (within the second specified rectangle's coordinate
- * system) that would center the first specified rectangle
- * with respect to the second specified rectangle.
- */
- public static Rectangle calculateCenteredBounds(int width1, int height1, int x2, int y2, int width2, int height2) {
- return new Rectangle(x2 + ((width2 - width1) >> 1), y2 + ((height2 - height1) >> 1), width1, height1);
- }
-
- /**
- * Calculate the point (within the second specified rectangle's coordinate
- * system) that would center the first specified rectangle
- * with respect to the second specified rectangle.
- */
- public static Point calculateCenteredPosition(Rectangle rectangle1, Rectangle rectangle2) {
- return calculateCenteredPosition(rectangle1.width, rectangle1.height, rectangle2.x, rectangle2.y, rectangle2.width, rectangle2.height);
- }
-
- /**
- * Calculate the point (within the second specified rectangle's coordinate
- * system) that would center the first specified rectangle
- * with respect to the second specified rectangle.
- */
- public static Point calculateCenteredPosition(Point size1, Point size2) {
- return calculateCenteredPosition(size1.x, size1.y, size2.x, size2.y);
- }
-
- /**
- * Calculate the point (within the second specified rectangle's coordinate
- * system) that would center the first specified rectangle
- * with respect to the second specified rectangle.
- */
- public static Point calculateCenteredPosition(int width1, int height1, int width2, int height2) {
- return calculateCenteredPosition(width1, height1, 0, 0, width2, height2);
- }
-
- /**
- * Calculate the point (within the second specified rectangle's coordinate
- * system) that would center the first specified rectangle
- * with respect to the second specified rectangle.
- */
- public static Point calculateCenteredPosition(int width1, int height1, int x2, int y2, int width2, int height2) {
- return new Point(x2 + ((width2 - width1) >> 1), y2 + ((height2 - height1) >> 1));
- }
-
- /**
- * Tweaks the given <code>Combo</code> to remove the default value when the
- * widget receives the focus and to show the default when the widget loses
- * the focus.
- *
- * @param combo The widget having a default value that is always at the
- * beginning of the list
- */
- public static void attachDefaultValueHandler(Combo combo) {
- ComboHandler handler = new ComboHandler();
- combo.addFocusListener(handler);
- combo.addModifyListener(handler);
- }
-
-
- public static int getTableHeightHint(Table table, int rows) {
- if (table.getFont().equals(JFaceResources.getDefaultFont()))
- table.setFont(JFaceResources.getDialogFont());
- int result= table.getItemHeight() * rows + table.getHeaderHeight();
- if (table.getLinesVisible())
- result+= table.getGridLineWidth() * (rows - 1);
- return result;
- }
-
- /**
- * Relays out the parents of the <code>Control</code>. This was taken from
- * the widget <code>Section</code>.
- *
- * @param pane The pane to revalidate as well as its parents
- */
- public static void reflow(Composite pane) {
-
- for (Composite composite = pane; composite != null; ) {
- composite.setRedraw(false);
- composite = composite.getParent();
-
- if (composite instanceof ScrolledForm || composite instanceof Shell) {
- break;
- }
- }
-
- for (Composite composite = pane; composite != null; ) {
- composite.layout(true);
- composite = composite.getParent();
-
- if (composite instanceof ScrolledForm) {
- ((ScrolledForm) composite).reflow(true);
- break;
- }
- }
-
- for (Composite composite = pane; composite != null; ) {
- composite.setRedraw(true);
- composite = composite.getParent();
-
- if (composite instanceof ScrolledForm || composite instanceof Shell) {
- break;
- }
- }
- }
-
-
- /**
- * Determines if the current thread is the UI event thread.
- *
- * @return <code>true</code> if it's the UI event thread, <code>false</code>
- * otherwise
- */
- public static boolean uiThread() {
- return Display.getCurrent() != null;
- }
-
- /**
- * Determines if the current thread is the UI event thread by using the
- * thread from which the given viewer's display was instantiated.
- *
- * @param viewer The viewer used to determine if the current thread
- * is the UI event thread
- * @return <code>true</code> if the current thread is the UI event thread;
- * <code>false</code> otherwise
- */
- public static boolean uiThread(Viewer viewer) {
- return uiThread(viewer.getControl());
- }
-
- /**
- * Determines if the current thread is the UI event thread by using the
- * thread from which the given widget's display was instantiated.
- *
- * @param widget The widget used to determine if the current thread
- * is the UI event thread
- * @return <code>true</code> if the current thread is the UI event thread;
- * <code>false</code> otherwise
- */
- public static boolean uiThread(Widget widget) {
- return widget.getDisplay().getThread() == Thread.currentThread();
- }
-
-
- /**
- * This handler is responsible for removing the default value when the combo
- * has the focus or when the selected item is the default value and to select
- * it when the combo loses the focus.
- */
- private static class ComboHandler implements ModifyListener,
- FocusListener {
-
- public void focusGained(FocusEvent e) {
- Combo combo = (Combo) e.widget;
-
- if (combo.getSelectionIndex() == 0) {
- // The text selection has to be changed outside of the context of this
- // listener otherwise the combo won't update because it's currently
- // notifying its listeners
- asyncExec(new SelectText(combo));
- }
- }
-
- public void focusLost(FocusEvent e) {
- //do nothing
- }
-
- public void modifyText(ModifyEvent e) {
-
- Combo combo = (Combo) e.widget;
-
- if (combo.isFocusControl() &&
- combo.getSelectionIndex() == 0) {
-
- // The text has to be changed outside of the context of this
- // listener otherwise the combo won't update because it's currently
- // notifying its listeners
- asyncExec(new ModifyText(combo));
- }
- }
-
- private class ModifyText implements Runnable {
- private final Combo combo;
-
- public ModifyText(Combo combo) {
- super();
- this.combo = combo;
- }
-
- public void run() {
- if (this.combo.isDisposed()) {
- return;
- }
- String text = this.combo.getText();
-
- if (text.length() == 0) {
- text = this.combo.getItem(0);
- this.combo.setText(text);
- }
-
- this.combo.setSelection(new Point(0, text.length()));
- }
- }
-
- private class SelectText implements Runnable {
- private final Combo combo;
-
- public SelectText(Combo combo) {
- super();
- this.combo = combo;
- }
-
- public void run() {
- if (this.combo.isDisposed()) {
- return;
- }
- String text = this.combo.getText();
- this.combo.setSelection(new Point(0, text.length()));
- }
- }
- }
-}
diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/AbstractUiCommandContext.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/AbstractUiCommandContext.java
index c17a1660d4..1ad032683d 100644
--- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/AbstractUiCommandContext.java
+++ b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/AbstractUiCommandContext.java
@@ -9,7 +9,7 @@
******************************************************************************/
package org.eclipse.jpt.common.ui.internal.utility;
-import org.eclipse.jpt.common.ui.internal.util.SWTUtil;
+import org.eclipse.jpt.common.ui.internal.swt.widgets.DisplayTools;
import org.eclipse.jpt.common.utility.command.Command;
import org.eclipse.jpt.common.utility.command.ExtendedCommandContext;
import org.eclipse.jpt.common.utility.internal.command.CommandRunnable;
@@ -48,7 +48,7 @@ abstract class AbstractUiCommandContext
SynchronizingCommand syncCommand = new SynchronizingCommand(command);
// dispatch the sync command to the UI thread...
- SWTUtil.asyncExec(this.buildRunnable(syncCommand));
+ DisplayTools.asyncExec(this.buildRunnable(syncCommand));
// ...and wait for it to execute
try {
diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/AsynchronousUiCommandContext.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/AsynchronousUiCommandContext.java
index 8b57470fb6..41a1a9ac8f 100644
--- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/AsynchronousUiCommandContext.java
+++ b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/AsynchronousUiCommandContext.java
@@ -9,7 +9,7 @@
******************************************************************************/
package org.eclipse.jpt.common.ui.internal.utility;
-import org.eclipse.jpt.common.ui.internal.util.SWTUtil;
+import org.eclipse.jpt.common.ui.internal.swt.widgets.DisplayTools;
import org.eclipse.jpt.common.utility.command.Command;
import org.eclipse.jpt.common.utility.command.ExtendedCommandContext;
@@ -35,10 +35,10 @@ public final class AsynchronousUiCommandContext
}
public void execute(Command command) {
- SWTUtil.asyncExec(this.buildRunnable(command));
+ DisplayTools.asyncExec(this.buildRunnable(command));
}
public void waitToExecute(Command command) {
- SWTUtil.syncExec(this.buildRunnable(command));
+ DisplayTools.syncExec(this.buildRunnable(command));
}
}
diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/SynchronousUiCommandContext.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/SynchronousUiCommandContext.java
index d16d2c00ea..5623c937be 100644
--- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/SynchronousUiCommandContext.java
+++ b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/SynchronousUiCommandContext.java
@@ -9,7 +9,7 @@
******************************************************************************/
package org.eclipse.jpt.common.ui.internal.utility;
-import org.eclipse.jpt.common.ui.internal.util.SWTUtil;
+import org.eclipse.jpt.common.ui.internal.swt.widgets.DisplayTools;
import org.eclipse.jpt.common.utility.command.Command;
import org.eclipse.jpt.common.utility.command.ExtendedCommandContext;
@@ -35,7 +35,7 @@ public final class SynchronousUiCommandContext
}
public void execute(Command command) {
- SWTUtil.syncExec(this.buildRunnable(command));
+ DisplayTools.syncExec(this.buildRunnable(command));
}
public void waitToExecute(Command command) {
diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/AddRemoveListPane.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/AddRemoveListPane.java
index 2182f293e8..cc958bc86a 100644
--- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/AddRemoveListPane.java
+++ b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/AddRemoveListPane.java
@@ -15,7 +15,7 @@ import org.eclipse.jface.viewers.ITableLabelProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jpt.common.ui.internal.swt.ColumnAdapter;
import org.eclipse.jpt.common.ui.internal.swt.TableModelAdapter;
-import org.eclipse.jpt.common.ui.internal.util.SWTUtil;
+import org.eclipse.jpt.common.ui.internal.swt.widgets.DisplayTools;
import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel;
import org.eclipse.jpt.common.utility.model.Model;
import org.eclipse.jpt.common.utility.model.event.ListAddEvent;
@@ -261,7 +261,7 @@ public class AddRemoveListPane<T extends Model, E extends Object> extends AddRem
* notified before the table has been updated (table column added or removed).
*/
private void revalidateLayout() {
- SWTUtil.asyncExec(new Runnable() { public void run() {
+ DisplayTools.asyncExec(new Runnable() { public void run() {
if (!table.isDisposed()) {
table.getParent().computeSize(SWT.DEFAULT, SWT.DEFAULT);
table.getParent().layout();
diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/AddRemovePane.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/AddRemovePane.java
index 1434df5c1c..f1398740fc 100644
--- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/AddRemovePane.java
+++ b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/AddRemovePane.java
@@ -488,11 +488,11 @@ public abstract class AddRemovePane<T extends Model, E extends Object> extends P
// Update the help topic ID
if (helpId != null) {
- getHelpSystem().setHelp(this.addButton, helpId);
- getHelpSystem().setHelp(this.removeButton, helpId);
+ this.setHelp(this.addButton, helpId);
+ this.setHelp(this.removeButton, helpId);
if (this.optionalButton != null) {
- getHelpSystem().setHelp(this.optionalButton, helpId);
+ this.setHelp(this.optionalButton, helpId);
}
}
}
diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/ClassChooserPane.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/ClassChooserPane.java
index 24b6d63827..4426cd672d 100644
--- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/ClassChooserPane.java
+++ b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/ClassChooserPane.java
@@ -18,7 +18,6 @@ import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.IPackageFragmentRoot;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.search.IJavaSearchScope;
import org.eclipse.jdt.core.search.SearchEngine;
import org.eclipse.jdt.internal.ui.refactoring.contentassist.ControlContentAssistHelper;
import org.eclipse.jdt.internal.ui.refactoring.contentassist.JavaTypeCompletionProcessor;
@@ -38,8 +37,8 @@ import org.eclipse.jpt.common.utility.internal.StringTools;
import org.eclipse.jpt.common.utility.model.Model;
import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent;
import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener;
-import org.eclipse.jpt.common.utility.model.value.PropertyValueModel;
import org.eclipse.jpt.common.utility.model.value.ModifiablePropertyValueModel;
+import org.eclipse.jpt.common.utility.model.value.PropertyValueModel;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.widgets.Composite;
@@ -356,33 +355,25 @@ public abstract class ClassChooserPane<T extends Model> extends ChooserPane<T>
* cancelled the dialog
*/
protected IType chooseType() {
- IJavaElement[] elements = new IJavaElement[] { getJavaProject() };
- IJavaSearchScope scope = SearchEngine.createJavaSearchScope(elements);
- SelectionDialog typeSelectionDialog;
-
+ SelectionDialog dialog;
try {
- typeSelectionDialog = JavaUI.createTypeDialog(
- getShell(),
- PlatformUI.getWorkbench().getProgressService(),
- scope,
- getTypeDialogStyle(),
- false,
- StringTools.isBlank(getClassName()) ? "" : ClassNameTools.simpleName(getClassName())
- );
- }
- catch (JavaModelException e) {
- JptCommonUiPlugin.instance().logError(e);
+ dialog = JavaUI.createTypeDialog(
+ getShell(),
+ PlatformUI.getWorkbench().getProgressService(),
+ SearchEngine.createJavaSearchScope(new IJavaElement[] { getJavaProject() }),
+ getTypeDialogStyle(),
+ false,
+ StringTools.isBlank(getClassName()) ? StringTools.EMPTY_STRING : ClassNameTools.simpleName(getClassName())
+ );
+ } catch (JavaModelException ex) {
+ JptCommonUiPlugin.instance().logError(ex);
return null;
}
- typeSelectionDialog.setTitle(JptCommonUiMessages.CLASS_CHOOSER_PANE__DIALOG_TITLE);
- typeSelectionDialog.setMessage(JptCommonUiMessages.CLASS_CHOOSER_PANE__DIALOG_MESSAGE);
+ dialog.setTitle(JptCommonUiMessages.CLASS_CHOOSER_PANE__DIALOG_TITLE);
+ dialog.setMessage(JptCommonUiMessages.CLASS_CHOOSER_PANE__DIALOG_MESSAGE);
- if (typeSelectionDialog.open() == Window.OK) {
- return (IType) typeSelectionDialog.getResult()[0];
- }
-
- return null;
+ return (dialog.open() == Window.OK) ? (IType) dialog.getResult()[0] : null;
}
protected int getTypeDialogStyle() {
diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/ComboPane.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/ComboPane.java
index 0371c4bc5d..e23c23a1c7 100644
--- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/ComboPane.java
+++ b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/ComboPane.java
@@ -10,7 +10,7 @@
package org.eclipse.jpt.common.ui.internal.widgets;
import org.eclipse.jpt.common.ui.JptCommonUiMessages;
-import org.eclipse.jpt.common.ui.internal.util.SWTUtil;
+import org.eclipse.jpt.common.ui.internal.swt.widgets.ComboTools;
import org.eclipse.jpt.common.utility.internal.StringTools;
import org.eclipse.jpt.common.utility.internal.ObjectTools;
import org.eclipse.jpt.common.utility.model.Model;
@@ -80,7 +80,7 @@ public abstract class ComboPane<T extends Model>
protected void initializeLayout(Composite container) {
this.comboBox = this.addEditableCombo(container, getHelpId());
this.comboBox.addModifyListener(this.buildModifyListener());
- SWTUtil.attachDefaultValueHandler(this.comboBox);
+ ComboTools.handleDefaultValue(this.comboBox);
}
protected ModifyListener buildModifyListener() {
diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/Dialog.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/Dialog.java
index 9ac6812157..f5abb5a0fc 100644
--- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/Dialog.java
+++ b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/Dialog.java
@@ -23,8 +23,6 @@ import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.help.IWorkbenchHelpSystem;
/**
* The abstract implementation of a dialog using a "state object" (model object)
@@ -202,17 +200,6 @@ public abstract class Dialog<T extends Node>
}
/**
- * Returns the helps system.
- *
- * @return The platform's help system
- *
- * @category Helper
- */
- protected final IWorkbenchHelpSystem getHelpSystem() {
- return PlatformUI.getWorkbench().getHelpSystem();
- }
-
- /**
* Initializes this dialog.
*/
protected void initialize() {
diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/IntegerCombo.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/IntegerCombo.java
index a7128d8046..24f3626bdc 100644
--- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/IntegerCombo.java
+++ b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/IntegerCombo.java
@@ -11,7 +11,7 @@ package org.eclipse.jpt.common.ui.internal.widgets;
import org.eclipse.jface.fieldassist.FieldDecorationRegistry;
import org.eclipse.jpt.common.ui.JptCommonUiMessages;
-import org.eclipse.jpt.common.ui.internal.util.SWTUtil;
+import org.eclipse.jpt.common.ui.internal.swt.widgets.ComboTools;
import org.eclipse.jpt.common.utility.internal.model.value.PropertyListValueModelAdapter;
import org.eclipse.jpt.common.utility.internal.model.value.TransformationModifiablePropertyValueModel;
import org.eclipse.jpt.common.utility.internal.model.value.TransformationPropertyValueModel;
@@ -102,7 +102,7 @@ public abstract class IntegerCombo<T extends Model>
this.comboBox.setLayoutData(gridData);
this.comboBox.addVerifyListener(this.buildVerifyListener());
- SWTUtil.attachDefaultValueHandler(this.comboBox);
+ ComboTools.handleDefaultValue(this.comboBox);
}
protected Combo addIntegerCombo(Composite container) {
diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/Pane.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/Pane.java
index bb0ef6d17f..bd4706bc67 100644
--- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/Pane.java
+++ b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/Pane.java
@@ -18,6 +18,7 @@ import org.eclipse.jface.resource.ResourceManager;
import org.eclipse.jface.viewers.ComboViewer;
import org.eclipse.jface.viewers.IBaseLabelProvider;
import org.eclipse.jpt.common.ui.WidgetFactory;
+import org.eclipse.jpt.common.ui.internal.WorkbenchTools;
import org.eclipse.jpt.common.ui.internal.listeners.SWTPropertyChangeListenerWrapper;
import org.eclipse.jpt.common.ui.internal.plugin.JptCommonUiPlugin;
import org.eclipse.jpt.common.ui.internal.swt.ComboModelAdapter;
@@ -65,11 +66,9 @@ import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Spinner;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.forms.widgets.ExpandableComposite;
import org.eclipse.ui.forms.widgets.Hyperlink;
import org.eclipse.ui.forms.widgets.Section;
-import org.eclipse.ui.help.IWorkbenchHelpSystem;
import org.eclipse.ui.part.PageBook;
/**
@@ -553,7 +552,7 @@ public abstract class Pane<T extends Model> {
});
if (helpId != null) {
- getHelpSystem().setHelp(button, helpId);
+ this.setHelp(button, helpId);
}
GridData gridData = new GridData();
@@ -643,7 +642,7 @@ public abstract class Pane<T extends Model> {
Combo combo = this.addUnmanagedCombo(container);
if (helpId != null) {
- getHelpSystem().setHelp(combo, helpId);
+ this.setHelp(combo, helpId);
}
this.controlEnabledState(combo);
@@ -818,7 +817,7 @@ public abstract class Pane<T extends Model> {
Combo combo = this.getWidgetFactory().createEditableCombo(container);
if (helpId != null) {
- getHelpSystem().setHelp(combo, helpId);
+ this.setHelp(combo, helpId);
}
combo.setLayoutData(getFieldGridData());
@@ -1030,7 +1029,7 @@ public abstract class Pane<T extends Model> {
SpinnerModelAdapter.adapt(numberHolder, spinner, defaultValue);
if (helpId != null) {
- getHelpSystem().setHelp(spinner, helpId);
+ this.setHelp(spinner, helpId);
}
return spinner;
@@ -1099,7 +1098,7 @@ public abstract class Pane<T extends Model> {
DateTimeModelAdapter.adapt(hoursHolder, minutesHolder, secondsHolder, dateTime);
if (helpId != null) {
- getHelpSystem().setHelp(dateTime, helpId);
+ this.setHelp(dateTime, helpId);
}
return dateTime;
@@ -1151,7 +1150,7 @@ public abstract class Pane<T extends Model> {
if (helpId != null) {
- getHelpSystem().setHelp(container, helpId);
+ this.setHelp(container, helpId);
}
return combo;
@@ -1226,7 +1225,7 @@ public abstract class Pane<T extends Model> {
list.setLayoutData(new GridData(GridData.FILL_BOTH));
if (helpId != null) {
- getHelpSystem().setHelp(list, helpId);
+ this.setHelp(list, helpId);
}
return list;
@@ -1266,7 +1265,7 @@ public abstract class Pane<T extends Model> {
adjustMultiLineTextLayout(lineCount, text, text.getLineHeight());
if (helpId != null) {
- getHelpSystem().setHelp(text, helpId);
+ this.setHelp(text, helpId);
}
return text;
@@ -1450,7 +1449,7 @@ public abstract class Pane<T extends Model> {
button.setLayoutData(new GridData());
if (helpId != null) {
- getHelpSystem().setHelp(button, helpId);
+ this.setHelp(button, helpId);
}
return button;
@@ -1704,7 +1703,7 @@ public abstract class Pane<T extends Model> {
table.setLayoutData(gridData);
if (helpId != null) {
- getHelpSystem().setHelp(table, helpId);
+ this.setHelp(table, helpId);
}
return table;
@@ -1794,7 +1793,7 @@ public abstract class Pane<T extends Model> {
Text text = this.addText(container);
if (helpId != null) {
- getHelpSystem().setHelp(text, helpId);
+ this.setHelp(text, helpId);
}
return text;
@@ -1816,7 +1815,7 @@ public abstract class Pane<T extends Model> {
Text text = this.addUnmanagedText(container);
if (helpId != null) {
- getHelpSystem().setHelp(text, helpId);
+ this.setHelp(text, helpId);
}
return text;
@@ -1950,7 +1949,7 @@ public abstract class Pane<T extends Model> {
group.setLayout(layout);
if (helpId != null) {
- getHelpSystem().setHelp(group, helpId);
+ this.setHelp(group, helpId);
}
return group;
@@ -1996,7 +1995,7 @@ public abstract class Pane<T extends Model> {
SWTBindTools.bind(booleanHolder, button);
if (helpId != null) {
- getHelpSystem().setHelp(button, helpId);
+ this.setHelp(button, helpId);
}
return button;
@@ -2073,7 +2072,7 @@ public abstract class Pane<T extends Model> {
);
if (helpId != null) {
- getHelpSystem().setHelp(checkBox.getCheckBox(), helpId);
+ this.setHelp(checkBox.getCheckBox(), helpId);
}
return checkBox;
@@ -2267,8 +2266,8 @@ public abstract class Pane<T extends Model> {
return (this.parent == null) ? this.resourceManager : this.parent.getResourceManager();
}
- protected final IWorkbenchHelpSystem getHelpSystem() {
- return PlatformUI.getWorkbench().getHelpSystem();
+ protected final void setHelp(Control control, String contextID) {
+ WorkbenchTools.setHelp(control, contextID);
}
protected final boolean isPopulating() {
diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/wizards/JavaProjectWizardPage.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/wizards/JavaProjectWizardPage.java
index c45e0caae1..4dd6d50e63 100644
--- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/wizards/JavaProjectWizardPage.java
+++ b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/wizards/JavaProjectWizardPage.java
@@ -19,6 +19,7 @@ import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.jpt.common.core.internal.utility.ProjectTools;
+import org.eclipse.jpt.common.ui.internal.WorkbenchTools;
import org.eclipse.jpt.common.utility.internal.ArrayTools;
import org.eclipse.jpt.common.utility.internal.StringTools;
import org.eclipse.jpt.common.utility.internal.iterable.IterableTools;
@@ -33,7 +34,6 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableItem;
-import org.eclipse.ui.PlatformUI;
/**
* JavaProjectWizardPage
@@ -174,9 +174,7 @@ public class JavaProjectWizardPage extends WizardPage {
private final class ProjectTableLabelProvider extends LabelProvider implements ITableLabelProvider {
public Image getColumnImage(Object element, int columnIndex) {
- if(columnIndex == PROJECT_NAME_COLUMN_INDEX)
- return PlatformUI.getWorkbench().getSharedImages().getImage(org.eclipse.ui.ide.IDE.SharedImages.IMG_OBJ_PROJECT);
- return null;
+ return (columnIndex == PROJECT_NAME_COLUMN_INDEX) ? WorkbenchTools.getSharedImage(org.eclipse.ui.ide.IDE.SharedImages.IMG_OBJ_PROJECT) : null;
}
public String getColumnText(Object element, int columnIndex) {
diff --git a/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/util/ControlEnablerTest.java b/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/util/ControlEnablerTest.java
index e3cc697fae..5986ac327a 100644
--- a/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/util/ControlEnablerTest.java
+++ b/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/util/ControlEnablerTest.java
@@ -12,7 +12,7 @@ package org.eclipse.jpt.common.ui.tests.internal.util;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import org.eclipse.jpt.common.ui.internal.swt.bind.SWTBindTools;
-import org.eclipse.jpt.common.ui.internal.util.SWTUtil;
+import org.eclipse.jpt.common.ui.internal.swt.widgets.DisplayTools;
import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridLayout;
@@ -28,7 +28,7 @@ public final class ControlEnablerTest {
@Before
public void setUp() {
- parent = new Composite(SWTUtil.getShell(), SWT.NONE);
+ parent = new Composite(DisplayTools.getShell(), SWT.NONE);
parent.setLayout(new GridLayout());
}
diff --git a/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/util/ControlSwitcherTest.java b/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/util/ControlSwitcherTest.java
index d0238a925e..c139d073c3 100644
--- a/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/util/ControlSwitcherTest.java
+++ b/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/util/ControlSwitcherTest.java
@@ -12,8 +12,8 @@ package org.eclipse.jpt.common.ui.tests.internal.util;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertSame;
+import org.eclipse.jpt.common.ui.internal.swt.widgets.DisplayTools;
import org.eclipse.jpt.common.ui.internal.util.ControlSwitcher;
-import org.eclipse.jpt.common.ui.internal.util.SWTUtil;
import org.eclipse.jpt.common.utility.internal.ObjectTools;
import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel;
import org.eclipse.jpt.common.utility.internal.transformer.AbstractTransformer;
@@ -97,7 +97,7 @@ public final class ControlSwitcherTest {
@Before
public void setUp() {
- parent = new Composite(SWTUtil.getShell(), SWT.NONE);
+ parent = new Composite(DisplayTools.getShell(), SWT.NONE);
parent.setLayout(new GridLayout());
pageBook = new PageBook(parent, SWT.NULL);
diff --git a/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/util/ControlVisibilityEnablerTest.java b/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/util/ControlVisibilityEnablerTest.java
index f1c3693bb0..b90b9afae2 100644
--- a/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/util/ControlVisibilityEnablerTest.java
+++ b/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/util/ControlVisibilityEnablerTest.java
@@ -12,7 +12,7 @@ package org.eclipse.jpt.common.ui.tests.internal.util;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import org.eclipse.jpt.common.ui.internal.swt.bind.SWTBindTools;
-import org.eclipse.jpt.common.ui.internal.util.SWTUtil;
+import org.eclipse.jpt.common.ui.internal.swt.widgets.DisplayTools;
import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridLayout;
@@ -28,7 +28,7 @@ public final class ControlVisibilityEnablerTest {
@Before
public void setUp() {
- parent = new Composite(SWTUtil.getShell(), SWT.NONE);
+ parent = new Composite(DisplayTools.getShell(), SWT.NONE);
parent.setLayout(new GridLayout());
}
diff --git a/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/util/LabeledButtonTest.java b/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/util/LabeledButtonTest.java
index 52515acb41..3a718343e3 100644
--- a/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/util/LabeledButtonTest.java
+++ b/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/util/LabeledButtonTest.java
@@ -11,8 +11,8 @@ package org.eclipse.jpt.common.ui.tests.internal.util;
import static org.junit.Assert.assertEquals;
import org.eclipse.core.runtime.AssertionFailedException;
+import org.eclipse.jpt.common.ui.internal.swt.widgets.DisplayTools;
import org.eclipse.jpt.common.ui.internal.util.LabeledButton;
-import org.eclipse.jpt.common.ui.internal.util.SWTUtil;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridLayout;
@@ -29,7 +29,7 @@ public final class LabeledButtonTest {
@Before
public void setUp() {
- parent = new Composite(SWTUtil.getShell(), SWT.NONE);
+ parent = new Composite(DisplayTools.getShell(), SWT.NONE);
parent.setLayout(new GridLayout());
}
diff --git a/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/util/LabeledControlUpdaterTest.java b/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/util/LabeledControlUpdaterTest.java
index cc8d6ee13f..389d82486c 100644
--- a/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/util/LabeledControlUpdaterTest.java
+++ b/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/util/LabeledControlUpdaterTest.java
@@ -10,9 +10,9 @@
package org.eclipse.jpt.common.ui.tests.internal.util;
import static org.junit.Assert.assertEquals;
+import org.eclipse.jpt.common.ui.internal.swt.widgets.DisplayTools;
import org.eclipse.jpt.common.ui.internal.util.LabeledControlUpdater;
import org.eclipse.jpt.common.ui.internal.util.LabeledLabel;
-import org.eclipse.jpt.common.ui.internal.util.SWTUtil;
import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel;
import org.eclipse.jpt.common.utility.model.value.ModifiablePropertyValueModel;
import org.eclipse.swt.SWT;
@@ -31,7 +31,7 @@ public final class LabeledControlUpdaterTest {
@Before
public void setUp() {
- parent = new Composite(SWTUtil.getShell(), SWT.NONE);
+ parent = new Composite(DisplayTools.getShell(), SWT.NONE);
parent.setLayout(new GridLayout());
}
diff --git a/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/util/LabeledLabelTest.java b/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/util/LabeledLabelTest.java
index d43bcee4fb..eaa8b4d5ca 100644
--- a/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/util/LabeledLabelTest.java
+++ b/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/util/LabeledLabelTest.java
@@ -11,8 +11,8 @@ package org.eclipse.jpt.common.ui.tests.internal.util;
import static org.junit.Assert.assertEquals;
import org.eclipse.core.runtime.AssertionFailedException;
+import org.eclipse.jpt.common.ui.internal.swt.widgets.DisplayTools;
import org.eclipse.jpt.common.ui.internal.util.LabeledLabel;
-import org.eclipse.jpt.common.ui.internal.util.SWTUtil;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridLayout;
@@ -29,7 +29,7 @@ public final class LabeledLabelTest {
@Before
public void setUp() {
- parent = new Composite(SWTUtil.getShell(), SWT.NONE);
+ parent = new Composite(DisplayTools.getShell(), SWT.NONE);
parent.setLayout(new GridLayout());
}
diff --git a/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/util/SectionExpanderTest.java b/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/util/SectionExpanderTest.java
index e0c4bd8d8c..104e9021c9 100644
--- a/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/util/SectionExpanderTest.java
+++ b/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/util/SectionExpanderTest.java
@@ -12,7 +12,7 @@ package org.eclipse.jpt.common.ui.tests.internal.util;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import org.eclipse.jpt.common.ui.internal.swt.bind.SWTBindTools;
-import org.eclipse.jpt.common.ui.internal.util.SWTUtil;
+import org.eclipse.jpt.common.ui.internal.swt.widgets.DisplayTools;
import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridLayout;
@@ -30,7 +30,7 @@ public final class SectionExpanderTest {
@Before
public void setUp() {
- this.parent = new Composite(SWTUtil.getShell(), SWT.NONE);
+ this.parent = new Composite(DisplayTools.getShell(), SWT.NONE);
this.parent.setLayout(new GridLayout());
}
diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/wizards/gen/JdbcDriverWizardPage.java b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/wizards/gen/JdbcDriverWizardPage.java
index 938ff2eb11..bdbb30705c 100644
--- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/wizards/gen/JdbcDriverWizardPage.java
+++ b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/wizards/gen/JdbcDriverWizardPage.java
@@ -25,7 +25,7 @@ import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.wizard.IWizard;
import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.jpt.common.ui.internal.util.SWTUtil;
+import org.eclipse.jpt.common.ui.internal.swt.widgets.TableTools;
import org.eclipse.jpt.common.ui.internal.util.TableLayoutComposite;
import org.eclipse.jpt.common.utility.internal.StringTools;
import org.eclipse.jpt.common.utility.internal.collection.CollectionTools;
@@ -214,7 +214,7 @@ public class JdbcDriverWizardPage extends WizardPage
GridData gridData= new GridData(GridData.FILL_BOTH);
gridData.horizontalSpan = 1;
- gridData.heightHint= SWTUtil.getTableHeightHint(table, 7);
+ gridData.heightHint= TableTools.calculateHeightHint(table, 7);
tableLayout.setLayoutData(gridData);
TableViewer tableViewer = new TableViewer(table);
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/wizards/oxm/OxmFileOptionsWizardPage.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/wizards/oxm/OxmFileOptionsWizardPage.java
index 0801fcf1ee..55a20c3fe1 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/wizards/oxm/OxmFileOptionsWizardPage.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/wizards/oxm/OxmFileOptionsWizardPage.java
@@ -9,9 +9,11 @@
*******************************************************************************/
package org.eclipse.jpt.jaxb.eclipselink.ui.internal.wizards.oxm;
-import static org.eclipse.jpt.common.core.internal.operations.JptFileCreationDataModelProperties.*;
+import static org.eclipse.jpt.common.core.internal.operations.JptFileCreationDataModelProperties.CONTAINER_PATH;
+import static org.eclipse.jpt.common.core.internal.operations.JptFileCreationDataModelProperties.FILE_NAME;
import static org.eclipse.jpt.jaxb.eclipselink.core.internal.operations.OxmFileCreationDataModelProperties.PACKAGE_NAME;
import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jpt.common.ui.internal.WorkbenchTools;
import org.eclipse.jpt.jaxb.eclipselink.ui.JptJaxbEclipseLinkUiMessages;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
@@ -19,7 +21,6 @@ import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.PlatformUI;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
import org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelWizardPage;
@@ -76,7 +77,7 @@ public class OxmFileOptionsWizardPage
// new Label(composite, SWT.NONE);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, getInfopopID());
+ WorkbenchTools.setHelp(composite, getInfopopID());
Dialog.applyDialogFont(parent);
return composite;
}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/wizards/oxm/OxmFileWizard.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/wizards/oxm/OxmFileWizard.java
index 2dec9a7c1e..58da9a41e3 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/wizards/oxm/OxmFileWizard.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/wizards/oxm/OxmFileWizard.java
@@ -9,7 +9,8 @@
*******************************************************************************/
package org.eclipse.jpt.jaxb.eclipselink.ui.internal.wizards.oxm;
-import static org.eclipse.jpt.common.core.internal.operations.JptFileCreationDataModelProperties.*;
+import static org.eclipse.jpt.common.core.internal.operations.JptFileCreationDataModelProperties.CONTAINER_PATH;
+import static org.eclipse.jpt.common.core.internal.operations.JptFileCreationDataModelProperties.FILE_NAME;
import java.lang.reflect.InvocationTargetException;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
@@ -30,6 +31,7 @@ import org.eclipse.jpt.common.core.internal.utility.PathTools;
import org.eclipse.jpt.common.core.internal.utility.PlatformTools;
import org.eclipse.jpt.common.core.internal.utility.ProjectTools;
import org.eclipse.jpt.common.core.resource.ProjectResourceLocator;
+import org.eclipse.jpt.common.ui.internal.WorkbenchTools;
import org.eclipse.jpt.common.ui.internal.wizards.NewJptFileWizardPage;
import org.eclipse.jpt.jaxb.core.JaxbProject;
import org.eclipse.jpt.jaxb.eclipselink.core.internal.operations.OxmFileCreationDataModelProperties;
@@ -41,7 +43,6 @@ import org.eclipse.ui.INewWizard;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.ide.IDE;
import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
@@ -280,8 +281,10 @@ public class OxmFileWizard
getShell().getDisplay().asyncExec(new Runnable() {
public void run() {
try {
- IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
- IDE.openEditor(page, file, true);
+ IWorkbenchPage page = WorkbenchTools.getActivePage();
+ if (page != null) {
+ IDE.openEditor(page, file, true);
+ }
}
catch (PartInitException e) {
JptJaxbEclipseLinkUiPlugin.instance().logError(e);
@@ -296,4 +299,4 @@ public class OxmFileWizard
super.dispose();
this.config.dispose();
}
-} \ No newline at end of file
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/ClassesGeneratorUi.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/ClassesGeneratorUi.java
index cfff2a3c9e..20363ac0df 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/ClassesGeneratorUi.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/ClassesGeneratorUi.java
@@ -20,7 +20,7 @@ import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.window.Window;
import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.jpt.common.core.internal.utility.PlatformTools;
+import org.eclipse.jpt.common.ui.internal.WorkbenchTools;
import org.eclipse.jpt.common.ui.internal.dialogs.OptionalMessageDialog;
import org.eclipse.jpt.jaxb.core.JaxbProject;
import org.eclipse.jpt.jaxb.core.JaxbProjectManager;
@@ -37,7 +37,6 @@ import org.eclipse.jpt.jaxb.ui.internal.wizards.classesgen.ClassesGeneratorWizar
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.PlatformUI;
import org.eclipse.wst.xsd.contentmodel.internal.XSDImpl;
import org.eclipse.xsd.XSDSchema;
@@ -191,7 +190,7 @@ public class ClassesGeneratorUi {
}
private JaxbWorkbench getJaxbWorkbench() {
- return PlatformTools.getAdapter(PlatformUI.getWorkbench(), JaxbWorkbench.class);
+ return WorkbenchTools.getAdapter(JaxbWorkbench.class);
}
private boolean isOverwritingClasses(ClassesGeneratorOptions generatorOptions) {
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/JaxbJavaCompletionProposalComputer.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/JaxbJavaCompletionProposalComputer.java
index 50930a6172..e14b1f3b03 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/JaxbJavaCompletionProposalComputer.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/JaxbJavaCompletionProposalComputer.java
@@ -25,8 +25,8 @@ import org.eclipse.jdt.ui.text.java.JavaContentAssistInvocationContext;
import org.eclipse.jface.text.contentassist.CompletionProposal;
import org.eclipse.jface.text.contentassist.ICompletionProposal;
import org.eclipse.jpt.common.core.internal.utility.ContentTypeTools;
-import org.eclipse.jpt.common.core.internal.utility.PlatformTools;
import org.eclipse.jpt.common.core.resource.java.JavaResourceCompilationUnit;
+import org.eclipse.jpt.common.ui.internal.WorkbenchTools;
import org.eclipse.jpt.common.utility.internal.StringTools;
import org.eclipse.jpt.common.utility.internal.iterable.IterableTools;
import org.eclipse.jpt.common.utility.internal.predicate.PredicateTools;
@@ -37,7 +37,6 @@ import org.eclipse.jpt.jaxb.core.JaxbWorkspace;
import org.eclipse.jpt.jaxb.core.context.JaxbContextNode;
import org.eclipse.jpt.jaxb.ui.JaxbWorkbench;
import org.eclipse.jpt.jaxb.ui.internal.plugin.JptJaxbUiPlugin;
-import org.eclipse.ui.PlatformUI;
public class JaxbJavaCompletionProposalComputer
@@ -200,7 +199,7 @@ public class JaxbJavaCompletionProposalComputer
}
private JaxbWorkbench getJaxbWorkbench() {
- return PlatformTools.getAdapter(PlatformUI.getWorkbench(), JaxbWorkbench.class);
+ return WorkbenchTools.getAdapter(JaxbWorkbench.class);
}
private Predicate<String> buildPrefixFilter(char[] prefix) {
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/JaxbPlatformAdapterFactory.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/JaxbPlatformAdapterFactory.java
index 4e01ff7f2c..f852af398a 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/JaxbPlatformAdapterFactory.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/JaxbPlatformAdapterFactory.java
@@ -10,13 +10,12 @@
package org.eclipse.jpt.jaxb.ui.internal;
import org.eclipse.core.runtime.IAdapterFactory;
-import org.eclipse.jpt.common.core.internal.utility.PlatformTools;
+import org.eclipse.jpt.common.ui.internal.WorkbenchTools;
import org.eclipse.jpt.jaxb.core.platform.JaxbPlatform;
import org.eclipse.jpt.jaxb.ui.JaxbWorkbench;
import org.eclipse.jpt.jaxb.ui.internal.platform.InternalJaxbPlatformUiManager;
import org.eclipse.jpt.jaxb.ui.platform.JaxbPlatformUi;
import org.eclipse.jpt.jaxb.ui.platform.JaxbPlatformUiManager;
-import org.eclipse.ui.PlatformUI;
/**
* Factory to build adapters for a {@link JaxbPlatform}:<ul>
@@ -60,6 +59,6 @@ public class JaxbPlatformAdapterFactory
}
private JaxbWorkbench getJaxbWorkbench() {
- return PlatformTools.getAdapter(PlatformUI.getWorkbench(), JaxbWorkbench.class);
+ return WorkbenchTools.getAdapter(JaxbWorkbench.class);
}
}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/actions/OpenJaxbResourceAction.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/actions/OpenJaxbResourceAction.java
index 9cfc3a7469..084adaecb3 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/actions/OpenJaxbResourceAction.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/actions/OpenJaxbResourceAction.java
@@ -14,13 +14,12 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.content.IContentType;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jpt.common.ui.internal.WorkbenchTools;
import org.eclipse.jpt.jaxb.core.context.JaxbContextNode;
import org.eclipse.jpt.jaxb.core.context.JaxbContextRoot;
import org.eclipse.jpt.jaxb.ui.JptJaxbUiMessages;
import org.eclipse.ui.IEditorDescriptor;
-import org.eclipse.ui.IEditorRegistry;
import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.actions.BaseSelectionListenerAction;
import org.eclipse.ui.ide.IDE;
import org.eclipse.ui.part.FileEditorInput;
@@ -72,17 +71,17 @@ public class OpenJaxbResourceAction
}
protected void openEditor(IFile file) {
- IEditorRegistry registry = PlatformUI.getWorkbench().getEditorRegistry();
- IContentType contentType = IDE.getContentType(file);
- IEditorDescriptor editorDescriptor = registry.getDefaultEditor(file.getName(), contentType);
+ IEditorDescriptor editorDescriptor = WorkbenchTools.getDefaultEditor(file);
if (editorDescriptor == null) {
return; // no editor associated...
}
- IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ IWorkbenchPage page = WorkbenchTools.getActivePage();
try {
- page.openEditor(new FileEditorInput(file), editorDescriptor.getId());
+ if (page != null) {
+ page.openEditor(new FileEditorInput(file), editorDescriptor.getId());
+ }
}
catch (Exception e) {
MessageDialog.openError(page.getWorkbenchWindow().getShell(), JptJaxbUiMessages.ERROR_OPENING_EDITOR, e.getMessage());
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/navigator/JaxbNavigatorContentProvider.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/navigator/JaxbNavigatorContentProvider.java
index 77d7208377..5632f4054d 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/navigator/JaxbNavigatorContentProvider.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/navigator/JaxbNavigatorContentProvider.java
@@ -21,6 +21,7 @@ import org.eclipse.jface.resource.ResourceManager;
import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jpt.common.core.internal.utility.PlatformTools;
+import org.eclipse.jpt.common.ui.internal.WorkbenchTools;
import org.eclipse.jpt.common.ui.internal.jface.NavigatorContentProvider;
import org.eclipse.jpt.common.ui.jface.ItemExtendedLabelProvider;
import org.eclipse.jpt.common.ui.jface.ItemTreeContentProvider;
@@ -35,7 +36,6 @@ import org.eclipse.jpt.jaxb.core.JaxbWorkspace;
import org.eclipse.jpt.jaxb.ui.JaxbWorkbench;
import org.eclipse.jpt.jaxb.ui.platform.JaxbPlatformUi;
import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.PlatformUI;
/**
* This extension of navigator content provider delegates to the platform UI
@@ -151,11 +151,7 @@ public class JaxbNavigatorContentProvider
}
private JaxbWorkbench getJaxbWorkbench() {
- return PlatformTools.getAdapter(this.getWorkbench(), JaxbWorkbench.class);
- }
-
- private IWorkbench getWorkbench() {
- return PlatformUI.getWorkbench();
+ return PlatformTools.getAdapter(WorkbenchTools.getWorkbench(), JaxbWorkbench.class);
}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/properties/JaxbProjectModel.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/properties/JaxbProjectModel.java
index 204c7a0258..a2bfe187fa 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/properties/JaxbProjectModel.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/properties/JaxbProjectModel.java
@@ -10,7 +10,7 @@
package org.eclipse.jpt.jaxb.ui.internal.properties;
import org.eclipse.core.resources.IProject;
-import org.eclipse.jpt.common.core.internal.utility.PlatformTools;
+import org.eclipse.jpt.common.ui.internal.WorkbenchTools;
import org.eclipse.jpt.common.utility.internal.model.value.AspectPropertyValueModelAdapter;
import org.eclipse.jpt.common.utility.model.event.CollectionAddEvent;
import org.eclipse.jpt.common.utility.model.listener.CollectionChangeAdapter;
@@ -20,7 +20,6 @@ import org.eclipse.jpt.jaxb.core.JaxbProject;
import org.eclipse.jpt.jaxb.core.JaxbProjectManager;
import org.eclipse.jpt.jaxb.core.JaxbWorkspace;
import org.eclipse.jpt.jaxb.ui.JaxbWorkbench;
-import org.eclipse.ui.PlatformUI;
/**
* Treat the JAXB project as an "aspect" of the Eclipse project (IProject);
@@ -94,6 +93,6 @@ class JaxbProjectModel
}
private JaxbWorkbench getJaxbWorkbench() {
- return PlatformTools.getAdapter(PlatformUI.getWorkbench(), JaxbWorkbench.class);
+ return WorkbenchTools.getAdapter(JaxbWorkbench.class);
}
}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/properties/JaxbProjectPropertiesPage.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/properties/JaxbProjectPropertiesPage.java
index ae1dd5aade..3877d544f2 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/properties/JaxbProjectPropertiesPage.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/properties/JaxbProjectPropertiesPage.java
@@ -16,7 +16,7 @@ import java.util.List;
import java.util.Map;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jpt.common.core.internal.utility.ICUStringCollator;
-import org.eclipse.jpt.common.core.internal.utility.PlatformTools;
+import org.eclipse.jpt.common.ui.internal.WorkbenchTools;
import org.eclipse.jpt.common.ui.internal.properties.JptProjectPropertiesPage;
import org.eclipse.jpt.common.ui.internal.swt.bind.SWTBindTools;
import org.eclipse.jpt.common.utility.internal.iterable.IterableTools;
@@ -52,7 +52,6 @@ import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Group;
-import org.eclipse.ui.PlatformUI;
import org.eclipse.wst.common.project.facet.core.IFacetedProject;
import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
@@ -279,7 +278,7 @@ public class JaxbProjectPropertiesPage
}
private JaxbWorkbench getJaxbWorkbench() {
- return PlatformTools.getAdapter(PlatformUI.getWorkbench(), JaxbWorkbench.class);
+ return WorkbenchTools.getAdapter(JaxbWorkbench.class);
}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/properties/JaxbSchemasPropertiesPage.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/properties/JaxbSchemasPropertiesPage.java
index e16843e005..1040c25501 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/properties/JaxbSchemasPropertiesPage.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/properties/JaxbSchemasPropertiesPage.java
@@ -46,7 +46,7 @@ import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.window.ToolTip;
import org.eclipse.jface.window.Window;
-import org.eclipse.jpt.common.core.internal.utility.PlatformTools;
+import org.eclipse.jpt.common.ui.internal.WorkbenchTools;
import org.eclipse.jpt.common.ui.internal.swt.ColumnAdapter;
import org.eclipse.jpt.common.ui.internal.swt.TableModelAdapter;
import org.eclipse.jpt.common.ui.internal.swt.bind.SWTBindTools;
@@ -90,7 +90,6 @@ import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.dialogs.PropertyPage;
import org.eclipse.wst.xsd.contentmodel.internal.XSDImpl;
import org.eclipse.xsd.XSDSchema;
@@ -430,7 +429,7 @@ public class JaxbSchemasPropertiesPage
}
private JaxbWorkbench getJaxbWorkbench() {
- return PlatformTools.getAdapter(PlatformUI.getWorkbench(), JaxbWorkbench.class);
+ return WorkbenchTools.getAdapter(JaxbWorkbench.class);
}
@Override
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/ClassesGeneratorWizard.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/ClassesGeneratorWizard.java
index d4549b5af0..e664242896 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/ClassesGeneratorWizard.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/ClassesGeneratorWizard.java
@@ -31,7 +31,7 @@ import org.eclipse.jface.resource.ResourceManager;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.jpt.common.core.internal.utility.PlatformTools;
+import org.eclipse.jpt.common.ui.internal.WorkbenchTools;
import org.eclipse.jpt.common.ui.internal.dialogs.OptionalMessageDialog;
import org.eclipse.jpt.common.ui.internal.wizards.JavaProjectWizardPage;
import org.eclipse.jpt.jaxb.core.JaxbProject;
@@ -51,7 +51,6 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.INewWizard;
import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.PlatformUI;
import org.eclipse.wst.xsd.contentmodel.internal.XSDImpl;
import org.eclipse.xsd.XSDSchema;
@@ -205,7 +204,7 @@ public class ClassesGeneratorWizard
}
private JaxbWorkbench getJaxbWorkbench() {
- return PlatformTools.getAdapter(PlatformUI.getWorkbench(), JaxbWorkbench.class);
+ return WorkbenchTools.getAdapter(JaxbWorkbench.class);
}
/* return the physical location of the schema */
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/ClassesGeneratorWizardPage.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/ClassesGeneratorWizardPage.java
index fb7370325c..b9d89de4b3 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/ClassesGeneratorWizardPage.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/ClassesGeneratorWizardPage.java
@@ -48,8 +48,8 @@ import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.jface.window.Window;
-import org.eclipse.jpt.common.core.internal.utility.PlatformTools;
-import org.eclipse.jpt.common.ui.internal.util.SWTUtil;
+import org.eclipse.jpt.common.ui.internal.WorkbenchTools;
+import org.eclipse.jpt.common.ui.internal.swt.widgets.TableTools;
import org.eclipse.jpt.common.ui.internal.util.TableLayoutComposite;
import org.eclipse.jpt.common.utility.internal.ArrayTools;
import org.eclipse.jpt.common.utility.internal.StringTools;
@@ -80,7 +80,6 @@ import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.dialogs.ElementTreeSelectionDialog;
import org.osgi.framework.Bundle;
@@ -308,7 +307,7 @@ public class ClassesGeneratorWizardPage extends NewTypeWizardPage {
Composite composite = new Composite(parent, SWT.NULL);
composite.setLayout(new GridLayout());
- PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, HELP_CONTEXT_ID);
+ WorkbenchTools.setHelp(composite, HELP_CONTEXT_ID);
this.settingsGroup = new SettingsGroup(composite);
@@ -488,7 +487,7 @@ public class ClassesGeneratorWizardPage extends NewTypeWizardPage {
}
private JaxbWorkbench getJaxbWorkbench() {
- return PlatformTools.getAdapter(PlatformUI.getWorkbench(), JaxbWorkbench.class);
+ return WorkbenchTools.getAdapter(JaxbWorkbench.class);
}
// huh? why is this here???
@@ -643,7 +642,7 @@ public class ClassesGeneratorWizardPage extends NewTypeWizardPage {
GridData gridData= new GridData(GridData.FILL_BOTH);
gridData.horizontalSpan = 2;
- gridData.heightHint= SWTUtil.getTableHeightHint(table, 3);
+ gridData.heightHint= TableTools.calculateHeightHint(table, 3);
tableLayout.setLayoutData(gridData);
TableViewer tableViewer = new TableViewer(table);
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/facet/JaxbFacetPage.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/facet/JaxbFacetPage.java
index c0fa2491d5..4779b77e35 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/facet/JaxbFacetPage.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/facet/JaxbFacetPage.java
@@ -156,10 +156,6 @@ public abstract class JaxbFacetPage
super.validatePage(showMessage);
}
- protected final IWorkbenchHelpSystem getHelpSystem() {
- return PlatformUI.getWorkbench().getHelpSystem();
- }
-
protected final class PlatformGroup
{
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/schemagen/SchemaGeneratorWizardPage.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/schemagen/SchemaGeneratorWizardPage.java
index 58f70dc3bd..4a1cb2b3e4 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/schemagen/SchemaGeneratorWizardPage.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/schemagen/SchemaGeneratorWizardPage.java
@@ -28,6 +28,7 @@ import org.eclipse.jface.viewers.ICheckStateListener;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.jpt.common.ui.internal.WorkbenchTools;
import org.eclipse.jpt.common.utility.internal.ArrayTools;
import org.eclipse.jpt.jaxb.core.internal.gen.SchemaGenerator;
import org.eclipse.jpt.jaxb.ui.JptJaxbUiMessages;
@@ -44,7 +45,6 @@ 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.ui.PlatformUI;
import org.osgi.framework.Bundle;
/**
@@ -205,7 +205,7 @@ public class SchemaGeneratorWizardPage extends AbstractJarDestinationWizardPage
Composite composite = new Composite(parent, SWT.NULL);
composite.setLayout(new GridLayout());
- PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, HELP_CONTEXT_ID);
+ WorkbenchTools.setHelp(composite, HELP_CONTEXT_ID);
this.settingsGroup = new SettingsGroup(composite);
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkConvertCombo.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkConvertCombo.java
index 6ef2cc2c38..88e7763aec 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkConvertCombo.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkConvertCombo.java
@@ -11,7 +11,7 @@ package org.eclipse.jpt.jpa.eclipselink.ui.internal.details;
import java.util.ArrayList;
import org.eclipse.jpt.common.ui.JptCommonUiMessages;
-import org.eclipse.jpt.common.ui.internal.util.SWTUtil;
+import org.eclipse.jpt.common.ui.internal.swt.widgets.ComboTools;
import org.eclipse.jpt.common.ui.internal.widgets.Pane;
import org.eclipse.jpt.common.utility.internal.StringTools;
import org.eclipse.jpt.common.utility.internal.model.value.CollectionAspectAdapter;
@@ -82,7 +82,7 @@ public class EclipseLinkConvertCombo
buildConverterNameTransformer(),
(String) null
);
- SWTUtil.attachDefaultValueHandler(this.combo);
+ ComboTools.handleDefaultValue(this.combo);
}
protected final ModifiablePropertyValueModel<String> buildConvertNameHolder() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/dialogs/AddVirtualAttributeDialog.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/dialogs/AddVirtualAttributeDialog.java
index c560835d3d..2389622c56 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/dialogs/AddVirtualAttributeDialog.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/dialogs/AddVirtualAttributeDialog.java
@@ -325,29 +325,25 @@ public class AddVirtualAttributeDialog extends StatusDialog {
}
protected IType chooseType(String type) {
- IJavaElement[] elements= new IJavaElement[] { getJpaProject().getJavaProject() };
- IJavaSearchScope scope= SearchEngine.createJavaSearchScope(elements);
- IProgressService service = PlatformUI.getWorkbench().getProgressService();
-
- SelectionDialog typeSelectionDialog;
+ SelectionDialog dialog;
try {
- typeSelectionDialog =
- JavaUI.createTypeDialog(
- getShell(), service, scope,
- IJavaElementSearchConstants.CONSIDER_ALL_TYPES,
- false, type);
- }
- catch (JavaModelException e) {
- JptJpaEclipseLinkUiPlugin.instance().logError(e);
- throw new RuntimeException(e);
+ dialog = JavaUI.createTypeDialog(
+ getShell(),
+ PlatformUI.getWorkbench().getProgressService(),
+ SearchEngine.createJavaSearchScope(new IJavaElement[] { getJpaProject().getJavaProject() }),
+ IJavaElementSearchConstants.CONSIDER_ALL_TYPES,
+ false,
+ type
+ );
+ } catch (JavaModelException ex) {
+ JptJpaEclipseLinkUiPlugin.instance().logError(ex);
+ return null;
}
- typeSelectionDialog.setTitle(JptJpaUiMessages.AddPersistentClassDialog_classDialog_title);
- typeSelectionDialog.setMessage(JptJpaUiMessages.AddPersistentClassDialog_classDialog_message);
- if (typeSelectionDialog.open() == Window.OK) {
- return (IType) typeSelectionDialog.getResult()[0];
- }
- return null;
+ dialog.setTitle(JptJpaUiMessages.AddPersistentClassDialog_classDialog_title);
+ dialog.setMessage(JptJpaUiMessages.AddPersistentClassDialog_classDialog_message);
+
+ return (dialog.open() == Window.OK) ? (IType) dialog.getResult()[0] : null;
}
private void validate() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/caching/EntityListComposite.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/caching/EntityListComposite.java
index dbf00b30ac..341af01d56 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/caching/EntityListComposite.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/caching/EntityListComposite.java
@@ -13,7 +13,6 @@ import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.search.IJavaSearchScope;
import org.eclipse.jdt.core.search.SearchEngine;
import org.eclipse.jdt.ui.IJavaElementSearchConstants;
import org.eclipse.jdt.ui.JavaUI;
@@ -22,6 +21,7 @@ import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.window.Window;
import org.eclipse.jpt.common.ui.internal.widgets.AddRemoveListPane;
import org.eclipse.jpt.common.ui.internal.widgets.Pane;
+import org.eclipse.jpt.common.utility.internal.StringTools;
import org.eclipse.jpt.common.utility.internal.model.value.CollectionPropertyValueModelAdapter;
import org.eclipse.jpt.common.utility.internal.model.value.ListAspectAdapter;
import org.eclipse.jpt.common.utility.internal.model.value.SimpleCollectionValueModel;
@@ -39,7 +39,6 @@ import org.eclipse.jpt.jpa.eclipselink.ui.internal.plugin.JptJpaEclipseLinkUiPlu
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.dialogs.SelectionDialog;
-import org.eclipse.ui.progress.IProgressService;
/**
* EntityListComposite
@@ -153,33 +152,25 @@ public class EntityListComposite<T extends EclipseLinkCaching> extends Pane<T>
}
private IType chooseEntity() {
- IJavaProject javaProject = getJavaProject();
- IJavaElement[] elements = new IJavaElement[] { javaProject };
- IJavaSearchScope scope = SearchEngine.createJavaSearchScope(elements);
- IProgressService service = PlatformUI.getWorkbench().getProgressService();
- SelectionDialog typeSelectionDialog;
-
+ SelectionDialog dialog;
try {
- typeSelectionDialog = JavaUI.createTypeDialog(
- getShell(),
- service,
- scope,
- IJavaElementSearchConstants.CONSIDER_CLASSES,
- false,
- ""
- );
- }
- catch (JavaModelException e) {
- JptJpaEclipseLinkUiPlugin.instance().logError(e);
+ dialog = JavaUI.createTypeDialog(
+ getShell(),
+ PlatformUI.getWorkbench().getProgressService(),
+ SearchEngine.createJavaSearchScope(new IJavaElement[] { getJavaProject() }),
+ IJavaElementSearchConstants.CONSIDER_CLASSES,
+ false,
+ StringTools.EMPTY_STRING
+ );
+ } catch (JavaModelException ex) {
+ JptJpaEclipseLinkUiPlugin.instance().logError(ex);
return null;
}
- typeSelectionDialog.setTitle(JptJpaEclipseLinkUiMessages.CACHING_ENTITY_LIST_COMPOSITE_DIALOG_TITLE);
- typeSelectionDialog.setMessage(JptJpaEclipseLinkUiMessages.CACHING_ENTITY_LIST_COMPOSITE_DIALOG_MESSAGE);
- if (typeSelectionDialog.open() == Window.OK) {
- return (IType) typeSelectionDialog.getResult()[0];
- }
- return null;
+ dialog.setTitle(JptJpaEclipseLinkUiMessages.CACHING_ENTITY_LIST_COMPOSITE_DIALOG_TITLE);
+ dialog.setMessage(JptJpaEclipseLinkUiMessages.CACHING_ENTITY_LIST_COMPOSITE_DIALOG_MESSAGE);
+
+ return (dialog.open() == Window.OK) ? (IType) dialog.getResult()[0] : null;
}
private IJavaProject getJavaProject() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/connection/JdbcConnectionPropertiesComposite.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/connection/JdbcConnectionPropertiesComposite.java
index f8f37072a0..3b9ad90564 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/connection/JdbcConnectionPropertiesComposite.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/connection/JdbcConnectionPropertiesComposite.java
@@ -20,8 +20,8 @@ import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jpt.common.core.internal.utility.PlatformTools;
import org.eclipse.jpt.common.ui.JptCommonUiMessages;
+import org.eclipse.jpt.common.ui.internal.WorkbenchTools;
import org.eclipse.jpt.common.ui.internal.widgets.ClassChooserPane;
import org.eclipse.jpt.common.ui.internal.widgets.Pane;
import org.eclipse.jpt.common.ui.internal.widgets.TriStateCheckBox;
@@ -46,7 +46,6 @@ import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.dialogs.FilteredItemsSelectionDialog;
import org.eclipse.ui.forms.widgets.Hyperlink;
@@ -293,7 +292,7 @@ public class JdbcConnectionPropertiesComposite<T extends EclipseLinkConnection>
}
private JpaWorkbench getJpaWorkbench() {
- return PlatformTools.getAdapter(PlatformUI.getWorkbench(), JpaWorkbench.class);
+ return WorkbenchTools.getAdapter(JpaWorkbench.class);
}
// broaden access a bit
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/customization/EntityListComposite.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/customization/EntityListComposite.java
index e4e25e6c66..e7a0d6f4ac 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/customization/EntityListComposite.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/customization/EntityListComposite.java
@@ -13,7 +13,6 @@ import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.search.IJavaSearchScope;
import org.eclipse.jdt.core.search.SearchEngine;
import org.eclipse.jdt.ui.IJavaElementSearchConstants;
import org.eclipse.jdt.ui.JavaUI;
@@ -23,6 +22,7 @@ import org.eclipse.jface.window.Window;
import org.eclipse.jpt.common.ui.internal.widgets.AddRemoveListPane;
import org.eclipse.jpt.common.ui.internal.widgets.ClassChooserPane;
import org.eclipse.jpt.common.ui.internal.widgets.Pane;
+import org.eclipse.jpt.common.utility.internal.StringTools;
import org.eclipse.jpt.common.utility.internal.model.value.CollectionPropertyValueModelAdapter;
import org.eclipse.jpt.common.utility.internal.model.value.ListAspectAdapter;
import org.eclipse.jpt.common.utility.internal.model.value.PropertyAspectAdapter;
@@ -45,7 +45,6 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.dialogs.SelectionDialog;
import org.eclipse.ui.forms.widgets.Hyperlink;
-import org.eclipse.ui.progress.IProgressService;
/**
* EntityListComposite
@@ -153,33 +152,25 @@ public class EntityListComposite extends Pane<EclipseLinkCustomization>
}
private IType chooseEntity() {
- IJavaProject javaProject = getJavaProject();
- IJavaElement[] elements = new IJavaElement[] { javaProject };
- IJavaSearchScope scope = SearchEngine.createJavaSearchScope(elements);
- IProgressService service = PlatformUI.getWorkbench().getProgressService();
- SelectionDialog typeSelectionDialog;
-
+ SelectionDialog dialog;
try {
- typeSelectionDialog = JavaUI.createTypeDialog(
- getShell(),
- service,
- scope,
- IJavaElementSearchConstants.CONSIDER_CLASSES,
- false,
- ""
- );
- }
- catch (JavaModelException e) {
- JptJpaEclipseLinkUiPlugin.instance().logError(e);
+ dialog = JavaUI.createTypeDialog(
+ getShell(),
+ PlatformUI.getWorkbench().getProgressService(),
+ SearchEngine.createJavaSearchScope(new IJavaElement[] { getJavaProject() }),
+ IJavaElementSearchConstants.CONSIDER_CLASSES,
+ false,
+ StringTools.EMPTY_STRING
+ );
+ } catch (JavaModelException ex) {
+ JptJpaEclipseLinkUiPlugin.instance().logError(ex);
return null;
}
- typeSelectionDialog.setTitle(JptJpaEclipseLinkUiMessages.CUSTOMIZATION_ENTITY_LIST_COMPOSITE_DIALOG_TITLE);
- typeSelectionDialog.setMessage(JptJpaEclipseLinkUiMessages.CUSTOMIZATION_ENTITY_LIST_COMPOSITE_DIALOG_MESSAGE);
- if (typeSelectionDialog.open() == Window.OK) {
- return (IType) typeSelectionDialog.getResult()[0];
- }
- return null;
+ dialog.setTitle(JptJpaEclipseLinkUiMessages.CUSTOMIZATION_ENTITY_LIST_COMPOSITE_DIALOG_TITLE);
+ dialog.setMessage(JptJpaEclipseLinkUiMessages.CUSTOMIZATION_ENTITY_LIST_COMPOSITE_DIALOG_MESSAGE);
+
+ return (dialog.open() == Window.OK) ? (IType) dialog.getResult()[0] : null;
}
private IJavaProject getJavaProject() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/customization/SessionCustomizersComposite.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/customization/SessionCustomizersComposite.java
index 7f4eb00582..77cd180f29 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/customization/SessionCustomizersComposite.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/customization/SessionCustomizersComposite.java
@@ -24,6 +24,7 @@ import org.eclipse.jpt.common.ui.JptCommonUiMessages;
import org.eclipse.jpt.common.ui.internal.widgets.AddRemoveListPane;
import org.eclipse.jpt.common.ui.internal.widgets.AddRemovePane.Adapter;
import org.eclipse.jpt.common.ui.internal.widgets.Pane;
+import org.eclipse.jpt.common.utility.internal.StringTools;
import org.eclipse.jpt.common.utility.internal.model.value.ListAspectAdapter;
import org.eclipse.jpt.common.utility.internal.model.value.SimpleCollectionValueModel;
import org.eclipse.jpt.common.utility.iterable.ListIterable;
@@ -37,7 +38,6 @@ import org.eclipse.jpt.jpa.eclipselink.ui.internal.plugin.JptJpaEclipseLinkUiPlu
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.dialogs.SelectionDialog;
-import org.eclipse.ui.progress.IProgressService;
/**
* SessionCustomizersComposite
@@ -130,35 +130,25 @@ public class SessionCustomizersComposite extends Pane<EclipseLinkCustomization>
* canceled the dialog
*/
private IType chooseType() {
- IJavaProject javaProject = getJavaProject();
- IJavaElement[] elements = new IJavaElement[] { javaProject };
- IJavaSearchScope scope = SearchEngine.createJavaSearchScope(elements);
- IProgressService service = PlatformUI.getWorkbench().getProgressService();
- SelectionDialog typeSelectionDialog;
-
+ SelectionDialog dialog;
try {
- typeSelectionDialog = JavaUI.createTypeDialog(
- getShell(),
- service,
- scope,
- IJavaElementSearchConstants.CONSIDER_CLASSES,
- false,
- ""
- );
- }
- catch (JavaModelException e) {
- JptJpaEclipseLinkUiPlugin.instance().logError(e);
+ dialog = JavaUI.createTypeDialog(
+ getShell(),
+ PlatformUI.getWorkbench().getProgressService(),
+ SearchEngine.createJavaSearchScope(new IJavaElement[] { getJavaProject() }),
+ IJavaElementSearchConstants.CONSIDER_CLASSES,
+ false,
+ StringTools.EMPTY_STRING
+ );
+ } catch (JavaModelException ex) {
+ JptJpaEclipseLinkUiPlugin.instance().logError(ex);
return null;
}
- typeSelectionDialog.setTitle(JptCommonUiMessages.CLASS_CHOOSER_PANE__DIALOG_TITLE);
- typeSelectionDialog.setMessage(JptCommonUiMessages.CLASS_CHOOSER_PANE__DIALOG_MESSAGE);
+ dialog.setTitle(JptCommonUiMessages.CLASS_CHOOSER_PANE__DIALOG_TITLE);
+ dialog.setMessage(JptCommonUiMessages.CLASS_CHOOSER_PANE__DIALOG_MESSAGE);
- if (typeSelectionDialog.open() == Window.OK) {
- return (IType) typeSelectionDialog.getResult()[0];
- }
-
- return null;
+ return (dialog.open() == Window.OK) ? (IType) dialog.getResult()[0] : null;
}
@Override
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/options/EclipseLinkPersistenceUnitOptionsEditorPage.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/options/EclipseLinkPersistenceUnitOptionsEditorPage.java
index 802b20aa81..b65f4bd9aa 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/options/EclipseLinkPersistenceUnitOptionsEditorPage.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/options/EclipseLinkPersistenceUnitOptionsEditorPage.java
@@ -16,7 +16,7 @@ import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jface.resource.ResourceManager;
import org.eclipse.jpt.common.ui.JptCommonUiMessages;
import org.eclipse.jpt.common.ui.WidgetFactory;
-import org.eclipse.jpt.common.ui.internal.util.SWTUtil;
+import org.eclipse.jpt.common.ui.internal.swt.widgets.ComboTools;
import org.eclipse.jpt.common.ui.internal.widgets.ClassChooserPane;
import org.eclipse.jpt.common.ui.internal.widgets.Pane;
import org.eclipse.jpt.common.ui.internal.widgets.TriStateCheckBox;
@@ -199,7 +199,7 @@ public class EclipseLinkPersistenceUnitOptionsEditorPage
TransformerTools.<String>objectToStringTransformer(),
EclipseLinkHelpContextIds.PERSISTENCE_OPTIONS_SESSION_NAME
);
- SWTUtil.attachDefaultValueHandler(sessionNameCombo);
+ ComboTools.handleDefaultValue(sessionNameCombo);
this.addLabel(container, JptJpaEclipseLinkUiMessages.PERSISTENCE_XML_OPTIONS_TAB_SESSIONS_XML);
@@ -209,7 +209,7 @@ public class EclipseLinkPersistenceUnitOptionsEditorPage
this.buildSessionsXmlFileNameHolder(),
TransformerTools.<String>objectToStringTransformer(),
EclipseLinkHelpContextIds.PERSISTENCE_OPTIONS_SESSIONS_XML);
- SWTUtil.attachDefaultValueHandler(sessionsXmlCombo);
+ ComboTools.handleDefaultValue(sessionsXmlCombo);
this.addLabel(container, JptJpaEclipseLinkUiMessages.PERSISTENCE_XML_OPTIONS_TAB_TARGET_DATABASE_LABEL);
@@ -220,7 +220,7 @@ public class EclipseLinkPersistenceUnitOptionsEditorPage
this.buildTargetDatabaseLabelTransformer(),
EclipseLinkHelpContextIds.PERSISTENCE_OPTIONS_TARGET_DATABASE
);
- SWTUtil.attachDefaultValueHandler(targetDatabaseCombo);
+ ComboTools.handleDefaultValue(targetDatabaseCombo);
this.addLabel(container, JptJpaEclipseLinkUiMessages.PERSISTENCE_XML_OPTIONS_TAB_TARGET_SERVER_LABEL);
@@ -231,7 +231,7 @@ public class EclipseLinkPersistenceUnitOptionsEditorPage
this.buildTargetServerConverter(),
EclipseLinkHelpContextIds.PERSISTENCE_OPTIONS_TARGET_SERVER
);
- SWTUtil.attachDefaultValueHandler(targetServerCombo);
+ ComboTools.handleDefaultValue(targetServerCombo);
Hyperlink eventListenerLink = addHyperlink(container, JptJpaEclipseLinkUiMessages.PERSISTENCE_XML_OPTIONS_TAB_EVENT_LISTENER_LABEL);
this.initializeEventListenerClassChooser(container, eventListenerLink);
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/options/PersistenceXmlSchemaGenerationComposite.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/options/PersistenceXmlSchemaGenerationComposite.java
index d7579a534d..a4e1fdae59 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/options/PersistenceXmlSchemaGenerationComposite.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/options/PersistenceXmlSchemaGenerationComposite.java
@@ -11,7 +11,7 @@ package org.eclipse.jpt.jpa.eclipselink.ui.internal.persistence.options;
import java.util.Collection;
import org.eclipse.jpt.common.ui.JptCommonUiMessages;
-import org.eclipse.jpt.common.ui.internal.util.SWTUtil;
+import org.eclipse.jpt.common.ui.internal.swt.widgets.ComboTools;
import org.eclipse.jpt.common.ui.internal.widgets.EnumFormComboViewer;
import org.eclipse.jpt.common.ui.internal.widgets.FolderChooserComboPane;
import org.eclipse.jpt.common.ui.internal.widgets.Pane;
@@ -69,7 +69,7 @@ public class PersistenceXmlSchemaGenerationComposite
TransformerTools.<String>objectToStringTransformer(),
getHelpID()
);
- SWTUtil.attachDefaultValueHandler(ddlFileNameCombo);
+ ComboTools.handleDefaultValue(ddlFileNameCombo);
// Drop DDL File Name:
this.addLabel(container, JptJpaEclipseLinkUiMessages.PERSISTENCE_XML_SCHEMA_GENERATION_TAB_DROP_DDL_FILE_NAME_LABEL);
@@ -80,7 +80,7 @@ public class PersistenceXmlSchemaGenerationComposite
TransformerTools.<String>objectToStringTransformer(),
getHelpID()
);
- SWTUtil.attachDefaultValueHandler(dropDDLCombo);
+ ComboTools.handleDefaultValue(dropDDLCombo);
}
//************ DDL generation type ************
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v2_0/persistence/EclipseLinkPersistenceUnitOptions2_0EditorPage.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v2_0/persistence/EclipseLinkPersistenceUnitOptions2_0EditorPage.java
index 346a2d6aa9..02b900037d 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v2_0/persistence/EclipseLinkPersistenceUnitOptions2_0EditorPage.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v2_0/persistence/EclipseLinkPersistenceUnitOptions2_0EditorPage.java
@@ -29,6 +29,7 @@ import org.eclipse.jpt.common.ui.internal.widgets.AddRemovePane.Adapter;
import org.eclipse.jpt.common.ui.internal.widgets.EnumFormComboViewer;
import org.eclipse.jpt.common.ui.internal.widgets.IntegerCombo;
import org.eclipse.jpt.common.ui.internal.widgets.TriStateCheckBox;
+import org.eclipse.jpt.common.utility.internal.StringTools;
import org.eclipse.jpt.common.utility.internal.model.value.ListAspectAdapter;
import org.eclipse.jpt.common.utility.internal.model.value.PropertyAspectAdapter;
import org.eclipse.jpt.common.utility.internal.model.value.SimpleCollectionValueModel;
@@ -43,9 +44,9 @@ import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
import org.eclipse.jpt.jpa.core.jpa2.context.persistence.PersistenceUnit2_0;
import org.eclipse.jpt.jpa.core.jpa2.context.persistence.options.Options2_0;
import org.eclipse.jpt.jpa.core.jpa2.context.persistence.options.ValidationMode2_0;
-import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkPersistenceUnit;
import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkLogging2_0;
import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkOptions2_0;
+import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkPersistenceUnit;
import org.eclipse.jpt.jpa.eclipselink.ui.JptJpaEclipseLinkUiMessages;
import org.eclipse.jpt.jpa.eclipselink.ui.internal.EclipseLinkHelpContextIds;
import org.eclipse.jpt.jpa.eclipselink.ui.internal.persistence.options.EclipseLinkPersistenceUnitOptionsEditorPage;
@@ -57,7 +58,6 @@ import org.eclipse.swt.widgets.Control;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.dialogs.SelectionDialog;
import org.eclipse.ui.forms.widgets.Section;
-import org.eclipse.ui.progress.IProgressService;
class EclipseLinkPersistenceUnitOptions2_0EditorPage
extends EclipseLinkPersistenceUnitOptionsEditorPage {
@@ -447,35 +447,25 @@ class EclipseLinkPersistenceUnitOptions2_0EditorPage
* canceled the dialog
*/
private IType chooseType() {
- IJavaProject javaProject = this.getSubject().getJpaProject().getJavaProject();
- IJavaElement[] elements = new IJavaElement[] { javaProject };
- IJavaSearchScope scope = SearchEngine.createJavaSearchScope(elements);
- IProgressService service = PlatformUI.getWorkbench().getProgressService();
- SelectionDialog typeSelectionDialog;
-
+ SelectionDialog dialog;
try {
- typeSelectionDialog = JavaUI.createTypeDialog(
+ dialog = JavaUI.createTypeDialog(
getShell(),
- service,
- scope,
+ PlatformUI.getWorkbench().getProgressService(),
+ SearchEngine.createJavaSearchScope(new IJavaElement[] { this.getSubject().getJpaProject().getJavaProject() }),
IJavaElementSearchConstants.CONSIDER_CLASSES,
false,
- ""
+ StringTools.EMPTY_STRING
);
- }
- catch (JavaModelException e) {
- JptJpaEclipseLinkUiPlugin.instance().logError(e);
+ } catch (JavaModelException ex) {
+ JptJpaEclipseLinkUiPlugin.instance().logError(ex);
return null;
}
- typeSelectionDialog.setTitle(JptCommonUiMessages.CLASS_CHOOSER_PANE__DIALOG_TITLE);
- typeSelectionDialog.setMessage(JptCommonUiMessages.CLASS_CHOOSER_PANE__DIALOG_MESSAGE);
+ dialog.setTitle(JptCommonUiMessages.CLASS_CHOOSER_PANE__DIALOG_TITLE);
+ dialog.setMessage(JptCommonUiMessages.CLASS_CHOOSER_PANE__DIALOG_MESSAGE);
- if (typeSelectionDialog.open() == Window.OK) {
- return (IType) typeSelectionDialog.getResult()[0];
- }
-
- return null;
+ return (dialog.open() == Window.OK) ? (IType) dialog.getResult()[0] : null;
}
private ModifiableCollectionValueModel<String> buildSelectedItemsModel() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/wizards/DynamicEntityClassWizardPage.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/wizards/DynamicEntityClassWizardPage.java
index f16adc2e47..3ee159bb18 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/wizards/DynamicEntityClassWizardPage.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/wizards/DynamicEntityClassWizardPage.java
@@ -16,7 +16,6 @@ import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
@@ -43,14 +42,15 @@ import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.jface.window.Window;
import org.eclipse.jpt.common.core.internal.utility.ProjectTools;
import org.eclipse.jpt.common.core.resource.xml.JptXmlResource;
+import org.eclipse.jpt.common.ui.internal.WorkbenchTools;
import org.eclipse.jpt.common.utility.internal.ObjectTools;
import org.eclipse.jpt.common.utility.internal.iterable.IterableTools;
import org.eclipse.jpt.common.utility.internal.transformer.TransformerAdapter;
import org.eclipse.jpt.common.utility.transformer.Transformer;
import org.eclipse.jpt.jpa.core.JpaPlatform;
import org.eclipse.jpt.jpa.core.JpaProject;
-import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaPlatformFactory2_1;
import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaPlatformFactory.EclipseLinkJpaPlatformVersion;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaPlatformFactory2_1;
import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlEntityMappings;
import org.eclipse.jpt.jpa.eclipselink.ui.JptJpaEclipseLinkUiMessages;
import org.eclipse.jpt.jpa.eclipselink.ui.internal.EclipseLinkHelpContextIds;
@@ -73,7 +73,6 @@ import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.dialogs.ElementListSelectionDialog;
import org.eclipse.ui.model.WorkbenchContentProvider;
import org.eclipse.ui.model.WorkbenchLabelProvider;
@@ -156,7 +155,7 @@ public class DynamicEntityClassWizardPage extends DataModelWizardPage{
classText.setFocus();
}
- PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, EclipseLinkHelpContextIds.DYNAMIC_ENTITY_CLASS);
+ WorkbenchTools.setHelp(composite, EclipseLinkHelpContextIds.DYNAMIC_ENTITY_CLASS);
Dialog.applyDialogFont(parent);
return composite;
}
@@ -574,7 +573,7 @@ public class DynamicEntityClassWizardPage extends DataModelWizardPage{
}
private IProject getSelectedProject() {
- IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ IWorkbenchWindow window = WorkbenchTools.getActiveWindow();
if (window == null)
return null;
ISelection selection = window.getSelectionService().getSelection();
@@ -606,7 +605,7 @@ public class DynamicEntityClassWizardPage extends DataModelWizardPage{
}
private IPackageFragment getSelectedPackageFragment() {
- IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ IWorkbenchWindow window = WorkbenchTools.getActiveWindow();
if (window == null)
return null;
ISelection selection = window.getSelectionService().getSelection();
@@ -655,7 +654,7 @@ public class DynamicEntityClassWizardPage extends DataModelWizardPage{
}
}
if (jelem == null) {
- IWorkbenchWindow window= PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ IWorkbenchWindow window = WorkbenchTools.getActiveWindow();
if (window == null)
return null;
IWorkbenchPart part = window.getActivePage().getActivePart();
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/wizards/DynamicEntityFieldsWizardPage.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/wizards/DynamicEntityFieldsWizardPage.java
index 5b3f62287d..85f62eaea4 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/wizards/DynamicEntityFieldsWizardPage.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/wizards/DynamicEntityFieldsWizardPage.java
@@ -12,6 +12,7 @@ package org.eclipse.jpt.jpa.eclipselink.ui.internal.wizards;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jpt.common.ui.internal.WorkbenchTools;
import org.eclipse.jpt.jpa.eclipselink.ui.JptJpaEclipseLinkUiMessages;
import org.eclipse.jpt.jpa.eclipselink.ui.internal.EclipseLinkHelpContextIds;
import org.eclipse.jpt.jpa.eclipselink.ui.internal.plugin.JptJpaEclipseLinkUiPlugin;
@@ -21,7 +22,6 @@ import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Group;
-import org.eclipse.ui.PlatformUI;
import org.eclipse.wst.common.componentcore.internal.operation.IArtifactEditOperationDataModelProperties;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
import org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelWizardPage;
@@ -64,7 +64,7 @@ public class DynamicEntityFieldsWizardPage extends DataModelWizardPage {
setErrorMessage(projectStatus.getMessage());
composite.setEnabled(false);
}
- PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, EclipseLinkHelpContextIds.DYNAMIC_ENTITY_FIELD);
+ WorkbenchTools.setHelp(composite, EclipseLinkHelpContextIds.DYNAMIC_ENTITY_FIELD);
Dialog.applyDialogFont(parent);
return composite;
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/wizards/EclipseLinkDynamicEntityWizard.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/wizards/EclipseLinkDynamicEntityWizard.java
index b7086581e2..24ebf363c6 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/wizards/EclipseLinkDynamicEntityWizard.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/wizards/EclipseLinkDynamicEntityWizard.java
@@ -18,7 +18,8 @@ import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jpt.common.core.internal.utility.PlatformTools;
import org.eclipse.jpt.common.core.resource.xml.JptXmlResource;
-import org.eclipse.jpt.common.ui.internal.util.SWTUtil;
+import org.eclipse.jpt.common.ui.internal.WorkbenchTools;
+import org.eclipse.jpt.common.ui.internal.swt.widgets.DisplayTools;
import org.eclipse.jpt.jpa.core.JpaProject;
import org.eclipse.jpt.jpa.core.context.JpaContextModel;
import org.eclipse.jpt.jpa.eclipselink.ui.JptJpaEclipseLinkUiMessages;
@@ -31,7 +32,6 @@ import org.eclipse.ui.INewWizard;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.ide.IDE;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
import org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider;
@@ -111,12 +111,14 @@ public class EclipseLinkDynamicEntityWizard extends DataModelWizard implements I
* Open the EclipseLink mapping file where the dynamic entity is created
*/
protected void openEditor(final JptXmlResource xmlResource) {
- SWTUtil.asyncExec(new Runnable() {
+ DisplayTools.asyncExec(new Runnable() {
public void run() {
IFile file = xmlResource.getFile();
- IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ IWorkbenchPage page = WorkbenchTools.getActivePage();
try {
- IDE.openEditor(page, file, true);
+ if (page != null) {
+ IDE.openEditor(page, file, true);
+ }
} catch (PartInitException e) {
e.printStackTrace();
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/wizards/gen/DynamicDefaultTableGenerationWizardPage.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/wizards/gen/DynamicDefaultTableGenerationWizardPage.java
index ed9de3da16..4cdfe9893a 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/wizards/gen/DynamicDefaultTableGenerationWizardPage.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/wizards/gen/DynamicDefaultTableGenerationWizardPage.java
@@ -16,6 +16,7 @@ import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.jface.window.Window;
import org.eclipse.jpt.common.core.resource.xml.JptXmlResource;
+import org.eclipse.jpt.common.ui.internal.WorkbenchTools;
import org.eclipse.jpt.jpa.core.JpaProject;
import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlEntityMappings;
import org.eclipse.jpt.jpa.eclipselink.ui.internal.wizards.SelectEclipseLinkMappingFileDialog;
@@ -60,7 +61,7 @@ public class DynamicDefaultTableGenerationWizardPage extends
GridLayout layout = new GridLayout();
layout.numColumns = nColumns;
composite.setLayout(layout);
- this.getHelpSystem().setHelp(composite, JpaHelpContextIds.GENERATE_ENTITIES_WIZARD_CUSTOMIZE_DEFAULT_ENTITY_GENERATION);
+ WorkbenchTools.setHelp(composite, JpaHelpContextIds.GENERATE_ENTITIES_WIZARD_CUSTOMIZE_DEFAULT_ENTITY_GENERATION);
createXmlMappingFileGroup(composite);
createDomainJavaClassesPropertiesGroup(composite, 4);
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/wizards/gen/GenerateDynamicEntitiesFromSchemaWizard.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/wizards/gen/GenerateDynamicEntitiesFromSchemaWizard.java
index 070c111641..9a2494dcaa 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/wizards/gen/GenerateDynamicEntitiesFromSchemaWizard.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/wizards/gen/GenerateDynamicEntitiesFromSchemaWizard.java
@@ -24,7 +24,8 @@ import org.eclipse.core.runtime.Status;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jpt.common.core.resource.ProjectResourceLocator;
import org.eclipse.jpt.common.core.resource.xml.JptXmlResource;
-import org.eclipse.jpt.common.ui.internal.util.SWTUtil;
+import org.eclipse.jpt.common.ui.internal.WorkbenchTools;
+import org.eclipse.jpt.common.ui.internal.swt.widgets.DisplayTools;
import org.eclipse.jpt.jpa.core.JpaProject;
import org.eclipse.jpt.jpa.db.ConnectionProfile;
import org.eclipse.jpt.jpa.db.Schema;
@@ -39,7 +40,6 @@ import org.eclipse.jpt.jpa.ui.internal.wizards.gen.TablesSelectorWizardPage;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.ide.IDE;
public class GenerateDynamicEntitiesFromSchemaWizard
@@ -171,11 +171,13 @@ public class GenerateDynamicEntitiesFromSchemaWizard
private void openEditor(final IFile file) {
if (file != null) {
- SWTUtil.asyncExec(new Runnable() {
+ DisplayTools.asyncExec(new Runnable() {
public void run() {
try {
- IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
- IDE.openEditor(page, file, true);
+ IWorkbenchPage page = WorkbenchTools.getActivePage();
+ if (page != null) {
+ IDE.openEditor(page, file, true);
+ }
}
catch (PartInitException e) {
JptJpaEclipseLinkUiPlugin.instance().logError(e);
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/JpaPlatformAdapterFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/JpaPlatformAdapterFactory.java
index 502f4ba053..9dda02efe7 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/JpaPlatformAdapterFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/JpaPlatformAdapterFactory.java
@@ -10,13 +10,12 @@
package org.eclipse.jpt.jpa.ui.internal;
import org.eclipse.core.runtime.IAdapterFactory;
-import org.eclipse.jpt.common.core.internal.utility.PlatformTools;
+import org.eclipse.jpt.common.ui.internal.WorkbenchTools;
import org.eclipse.jpt.jpa.core.JpaPlatform;
import org.eclipse.jpt.jpa.ui.JpaPlatformUi;
import org.eclipse.jpt.jpa.ui.JpaPlatformUiManager;
import org.eclipse.jpt.jpa.ui.JpaWorkbench;
import org.eclipse.jpt.jpa.ui.internal.platform.InternalJpaPlatformUiManager;
-import org.eclipse.ui.PlatformUI;
/**
* Factory to build adapters for a {@link JpaPlatform}:<ul>
@@ -60,6 +59,6 @@ public class JpaPlatformAdapterFactory
}
private JpaWorkbench getJpaWorkbench() {
- return PlatformTools.getAdapter(PlatformUI.getWorkbench(), JpaWorkbench.class);
+ return WorkbenchTools.getAdapter(JpaWorkbench.class);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/JpaXmlCompletionProposalComputer.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/JpaXmlCompletionProposalComputer.java
index dbbf10a29f..78522f1775 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/JpaXmlCompletionProposalComputer.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/JpaXmlCompletionProposalComputer.java
@@ -24,7 +24,7 @@ import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.ResourceManager;
import org.eclipse.jface.text.contentassist.CompletionProposal;
import org.eclipse.jface.text.contentassist.ICompletionProposal;
-import org.eclipse.jpt.common.core.internal.utility.PlatformTools;
+import org.eclipse.jpt.common.ui.internal.WorkbenchTools;
import org.eclipse.jpt.common.utility.internal.StringTools;
import org.eclipse.jpt.common.utility.internal.collection.CollectionTools;
import org.eclipse.jpt.jpa.core.JpaFile;
@@ -36,7 +36,6 @@ import org.eclipse.jpt.jpa.ui.JptJpaUiMessages;
import org.eclipse.jpt.jpa.ui.internal.plugin.JptJpaUiPlugin;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.PlatformUI;
import org.eclipse.wst.sse.ui.contentassist.CompletionProposalInvocationContext;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement;
@@ -311,6 +310,6 @@ public class JpaXmlCompletionProposalComputer extends DefaultJpaXmlCompletionPro
}
private JpaWorkbench getJpaWorkbench() {
- return PlatformTools.getAdapter(PlatformUI.getWorkbench(), JpaWorkbench.class);
+ return WorkbenchTools.getAdapter(JpaWorkbench.class);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/actions/OpenJpaResourceAction.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/actions/OpenJpaResourceAction.java
index 3f7e56f54c..c1f66bc641 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/actions/OpenJpaResourceAction.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/actions/OpenJpaResourceAction.java
@@ -11,13 +11,12 @@ package org.eclipse.jpt.jpa.ui.internal.actions;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.content.IContentType;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.ui.JavaUI;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jpt.common.core.internal.utility.PlatformTools;
+import org.eclipse.jpt.common.ui.internal.WorkbenchTools;
import org.eclipse.jpt.jpa.core.JpaStructureNode;
import org.eclipse.jpt.jpa.core.context.JpaContextModel;
import org.eclipse.jpt.jpa.core.context.java.JavaElementReference;
@@ -25,12 +24,9 @@ import org.eclipse.jpt.jpa.ui.JptJpaUiMessages;
import org.eclipse.jpt.jpa.ui.internal.plugin.JptJpaUiPlugin;
import org.eclipse.jpt.jpa.ui.selection.JpaSelectionManager;
import org.eclipse.ui.IEditorDescriptor;
-import org.eclipse.ui.IEditorRegistry;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.actions.BaseSelectionListenerAction;
-import org.eclipse.ui.ide.IDE;
import org.eclipse.ui.part.FileEditorInput;
/**
@@ -73,7 +69,7 @@ public class OpenJpaResourceAction
if ((resource != null) && resource.exists() && (resource.getType() == IResource.FILE)) {
this.openEditor((IFile) resource);
if (this.selectedNode instanceof JpaStructureNode) {
- JpaSelectionManager selectionManager = PlatformTools.getAdapter(PlatformUI.getWorkbench(), JpaSelectionManager.class);
+ JpaSelectionManager selectionManager = WorkbenchTools.getAdapter(JpaSelectionManager.class);
selectionManager.setSelection((JpaStructureNode) this.selectedNode);
}
}
@@ -84,17 +80,17 @@ public class OpenJpaResourceAction
}
protected void openEditor(IFile file) {
- IEditorRegistry registry = PlatformUI.getWorkbench().getEditorRegistry();
- IContentType contentType = IDE.getContentType(file);
- IEditorDescriptor editorDescriptor = registry.getDefaultEditor(file.getName(), contentType);
+ IEditorDescriptor editorDescriptor = WorkbenchTools.getDefaultEditor(file);
if (editorDescriptor == null) {
return; // no editor associated...
}
- IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ IWorkbenchPage page = WorkbenchTools.getActivePage();
try {
- page.openEditor(new FileEditorInput(file), editorDescriptor.getId());
+ if (page != null) {
+ page.openEditor(new FileEditorInput(file), editorDescriptor.getId());
+ }
}
catch (Exception e) {
MessageDialog.openError(page.getWorkbenchWindow().getShell(), JptJpaUiMessages.OpenJpaResourceAction_error, e.getMessage());
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/BaseJoinColumnDialogPane.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/BaseJoinColumnDialogPane.java
index 0fe62a26f3..d1e78b774d 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/BaseJoinColumnDialogPane.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/BaseJoinColumnDialogPane.java
@@ -13,7 +13,7 @@ import java.util.ArrayList;
import java.util.ListIterator;
import org.eclipse.jface.resource.ResourceManager;
import org.eclipse.jpt.common.ui.JptCommonUiMessages;
-import org.eclipse.jpt.common.ui.internal.util.SWTUtil;
+import org.eclipse.jpt.common.ui.internal.swt.widgets.ComboTools;
import org.eclipse.jpt.common.ui.internal.widgets.DialogPane;
import org.eclipse.jpt.common.utility.internal.model.value.CompositeListValueModel;
import org.eclipse.jpt.common.utility.internal.model.value.ListAspectAdapter;
@@ -351,7 +351,7 @@ public class BaseJoinColumnDialogPane<T extends BaseJoinColumnStateObject>
JpaHelpContextIds.MAPPING_JOIN_COLUMN_NAME
);
- SWTUtil.attachDefaultValueHandler(nameCombo);
+ ComboTools.handleDefaultValue(nameCombo);
// Referenced Column Name widgets
this.addLabel(container, JptJpaUiDetailsMessages.JoinColumnDialog_referencedColumnName);
@@ -363,7 +363,7 @@ public class BaseJoinColumnDialogPane<T extends BaseJoinColumnStateObject>
JpaHelpContextIds.MAPPING_JOIN_REFERENCED_COLUMN
);
- SWTUtil.attachDefaultValueHandler(referencedColumnNameCombo);
+ ComboTools.handleDefaultValue(referencedColumnNameCombo);
// Table widgets
if (isTableEditable()) {
@@ -377,7 +377,7 @@ public class BaseJoinColumnDialogPane<T extends BaseJoinColumnStateObject>
JpaHelpContextIds.MAPPING_JOIN_REFERENCED_COLUMN
);
- SWTUtil.attachDefaultValueHandler(tableCombo);
+ ComboTools.handleDefaultValue(tableCombo);
}
else {
this.addLabel(container, JptJpaUiDetailsMessages.JoinColumnDialogPane_table);
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/EntityNameCombo.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/EntityNameCombo.java
index 58f2351ca6..7ebd583b3d 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/EntityNameCombo.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/EntityNameCombo.java
@@ -10,7 +10,7 @@
package org.eclipse.jpt.jpa.ui.internal.details;
import org.eclipse.jpt.common.ui.JptCommonUiMessages;
-import org.eclipse.jpt.common.ui.internal.util.SWTUtil;
+import org.eclipse.jpt.common.ui.internal.swt.widgets.ComboTools;
import org.eclipse.jpt.common.ui.internal.widgets.Pane;
import org.eclipse.jpt.common.utility.internal.model.value.PropertyAspectAdapter;
import org.eclipse.jpt.common.utility.internal.model.value.PropertyListValueModelAdapter;
@@ -77,7 +77,7 @@ public class EntityNameCombo
TransformerTools.<String>objectToStringTransformer(),
JpaHelpContextIds.ENTITY_NAME);
- SWTUtil.attachDefaultValueHandler(this.combo);
+ ComboTools.handleDefaultValue(this.combo);
}
private ListValueModel<String> buildDefaultEntityNameListHolder() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/dialogs/AddPersistentClassDialog.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/dialogs/AddPersistentClassDialog.java
index 54b9c86188..39b28030c9 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/dialogs/AddPersistentClassDialog.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/dialogs/AddPersistentClassDialog.java
@@ -14,7 +14,6 @@ import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IPackageFragmentRoot;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.search.IJavaSearchScope;
import org.eclipse.jdt.core.search.SearchEngine;
import org.eclipse.jdt.internal.ui.refactoring.contentassist.ControlContentAssistHelper;
import org.eclipse.jdt.internal.ui.refactoring.contentassist.JavaTypeCompletionProcessor;
@@ -57,7 +56,6 @@ import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.dialogs.SelectionDialog;
-import org.eclipse.ui.progress.IProgressService;
public class AddPersistentClassDialog extends StatusDialog
{
@@ -237,29 +235,25 @@ public class AddPersistentClassDialog extends StatusDialog
}
protected IType chooseType() {
- IJavaElement[] elements= new IJavaElement[] { getJpaProject().getJavaProject() };
- IJavaSearchScope scope= SearchEngine.createJavaSearchScope(elements);
- IProgressService service = PlatformUI.getWorkbench().getProgressService();
-
- SelectionDialog typeSelectionDialog;
+ SelectionDialog dialog;
try {
- typeSelectionDialog =
- JavaUI.createTypeDialog(
- getShell(), service, scope,
- IJavaElementSearchConstants.CONSIDER_CLASSES,
- false, getClassName());
- }
- catch (JavaModelException e) {
- JptJpaUiPlugin.instance().logError(e);
- throw new RuntimeException(e);
+ dialog = JavaUI.createTypeDialog(
+ getShell(),
+ PlatformUI.getWorkbench().getProgressService(),
+ SearchEngine.createJavaSearchScope(new IJavaElement[] { getJpaProject().getJavaProject() }),
+ IJavaElementSearchConstants.CONSIDER_CLASSES,
+ false,
+ getClassName()
+ );
+ } catch (JavaModelException ex) {
+ JptJpaUiPlugin.instance().logError(ex);
+ return null;
}
- typeSelectionDialog.setTitle(JptJpaUiMessages.AddPersistentClassDialog_classDialog_title);
- typeSelectionDialog.setMessage(JptJpaUiMessages.AddPersistentClassDialog_classDialog_message);
- if (typeSelectionDialog.open() == Window.OK) {
- return (IType) typeSelectionDialog.getResult()[0];
- }
- return null;
+ dialog.setTitle(JptJpaUiMessages.AddPersistentClassDialog_classDialog_title);
+ dialog.setMessage(JptJpaUiMessages.AddPersistentClassDialog_classDialog_message);
+
+ return (dialog.open() == Window.OK) ? (IType) dialog.getResult()[0] : null;
}
private void validate() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/editors/JpaXmlEditor.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/editors/JpaXmlEditor.java
index a062f819e6..b2fd4243a2 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/editors/JpaXmlEditor.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/editors/JpaXmlEditor.java
@@ -19,7 +19,8 @@ import org.eclipse.jface.resource.ResourceManager;
import org.eclipse.jpt.common.core.JptResourceType;
import org.eclipse.jpt.common.core.internal.utility.PlatformTools;
import org.eclipse.jpt.common.ui.WidgetFactory;
-import org.eclipse.jpt.common.ui.internal.util.SWTUtil;
+import org.eclipse.jpt.common.ui.internal.WorkbenchTools;
+import org.eclipse.jpt.common.ui.internal.swt.widgets.DisplayTools;
import org.eclipse.jpt.common.ui.internal.widgets.FormWidgetFactory;
import org.eclipse.jpt.common.utility.internal.ObjectTools;
import org.eclipse.jpt.common.utility.internal.StringBuilderTools;
@@ -428,7 +429,7 @@ public class JpaXmlEditor
}
private void execute(Runnable runnable) {
- SWTUtil.execute(this.getSite().getShell().getDisplay(), runnable);
+ DisplayTools.execute(this.getSite().getShell().getDisplay(), runnable);
}
@Override
@@ -556,14 +557,14 @@ public class JpaXmlEditor
@Override
public ImageDescriptor getImageDescriptor() {
- return PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_LCL_LINKTO_HELP);
+ return WorkbenchTools.getSharedImageDescriptor(ISharedImages.IMG_LCL_LINKTO_HELP);
}
@Override
public void run() {
BusyIndicator.showWhile(Page.this.getManagedForm().getForm().getDisplay(), new Runnable() {
public void run() {
- PlatformUI.getWorkbench().getHelpSystem().displayHelp(HelpAction.this.helpID);
+ WorkbenchTools.displayHelp(HelpAction.this.helpID);
}
});
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/handlers/PersistentAttributeMapAsHandler.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/handlers/PersistentAttributeMapAsHandler.java
index d3cc095a70..f1cee63c57 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/handlers/PersistentAttributeMapAsHandler.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/handlers/PersistentAttributeMapAsHandler.java
@@ -14,12 +14,11 @@ import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jpt.common.core.internal.utility.PlatformTools;
+import org.eclipse.jpt.common.ui.internal.WorkbenchTools;
import org.eclipse.jpt.jpa.core.context.SpecifiedPersistentAttribute;
import org.eclipse.jpt.jpa.ui.selection.JpaSelectionManager;
import org.eclipse.ui.ISources;
import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.commands.IElementUpdater;
import org.eclipse.ui.handlers.HandlerUtil;
import org.eclipse.ui.menus.UIElement;
@@ -116,7 +115,7 @@ public class PersistentAttributeMapAsHandler
}
private JpaSelectionManager getJpaSelectionManager() {
- return PlatformTools.getAdapter(PlatformUI.getWorkbench(), JpaSelectionManager.class);
+ return WorkbenchTools.getAdapter(JpaSelectionManager.class);
}
public void updateElement(UIElement element, @SuppressWarnings("rawtypes") Map parameters) {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/handlers/PersistentTypeMapAsHandler.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/handlers/PersistentTypeMapAsHandler.java
index 79b91fa355..0d17d89dd3 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/handlers/PersistentTypeMapAsHandler.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/handlers/PersistentTypeMapAsHandler.java
@@ -14,12 +14,11 @@ import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jpt.common.core.internal.utility.PlatformTools;
+import org.eclipse.jpt.common.ui.internal.WorkbenchTools;
import org.eclipse.jpt.jpa.core.context.PersistentType;
import org.eclipse.jpt.jpa.ui.selection.JpaSelectionManager;
import org.eclipse.ui.ISources;
import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.commands.IElementUpdater;
import org.eclipse.ui.handlers.HandlerUtil;
import org.eclipse.ui.menus.UIElement;
@@ -90,7 +89,7 @@ public class PersistentTypeMapAsHandler
}
private JpaSelectionManager getJpaSelectionManager() {
- return PlatformTools.getAdapter(PlatformUI.getWorkbench(), JpaSelectionManager.class);
+ return WorkbenchTools.getAdapter(JpaSelectionManager.class);
}
public void updateElement(UIElement element, @SuppressWarnings("rawtypes") Map parameters) {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/persistence/JdbcConnectionPropertiesComposite2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/persistence/JdbcConnectionPropertiesComposite2_0.java
index 130dc80f7e..73ac8bc124 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/persistence/JdbcConnectionPropertiesComposite2_0.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/persistence/JdbcConnectionPropertiesComposite2_0.java
@@ -18,7 +18,7 @@ import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jpt.common.core.internal.utility.PlatformTools;
+import org.eclipse.jpt.common.ui.internal.WorkbenchTools;
import org.eclipse.jpt.common.ui.internal.widgets.ClassChooserPane;
import org.eclipse.jpt.common.ui.internal.widgets.Pane;
import org.eclipse.jpt.common.utility.internal.StringTools;
@@ -38,7 +38,6 @@ import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.dialogs.FilteredItemsSelectionDialog;
import org.eclipse.ui.forms.widgets.Hyperlink;
@@ -186,7 +185,7 @@ public class JdbcConnectionPropertiesComposite2_0 extends Pane<Connection2_0>
}
private JpaWorkbench getJpaWorkbench() {
- return PlatformTools.getAdapter(PlatformUI.getWorkbench(), JpaWorkbench.class);
+ return WorkbenchTools.getAdapter(JpaWorkbench.class);
}
// broaden access a bit
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/persistence/PersistenceUnitOptionsEditorPage2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/persistence/PersistenceUnitOptionsEditorPage2_0.java
index 15534efaf0..d7b7f449dc 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/persistence/PersistenceUnitOptionsEditorPage2_0.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/persistence/PersistenceUnitOptionsEditorPage2_0.java
@@ -11,10 +11,8 @@ package org.eclipse.jpt.jpa.ui.internal.jpa2.persistence;
import java.util.Collection;
import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.search.IJavaSearchScope;
import org.eclipse.jdt.core.search.SearchEngine;
import org.eclipse.jdt.ui.IJavaElementSearchConstants;
import org.eclipse.jdt.ui.JavaUI;
@@ -29,6 +27,7 @@ import org.eclipse.jpt.common.ui.internal.widgets.AddRemovePane.Adapter;
import org.eclipse.jpt.common.ui.internal.widgets.EnumFormComboViewer;
import org.eclipse.jpt.common.ui.internal.widgets.IntegerCombo;
import org.eclipse.jpt.common.ui.internal.widgets.Pane;
+import org.eclipse.jpt.common.utility.internal.StringTools;
import org.eclipse.jpt.common.utility.internal.model.value.ListAspectAdapter;
import org.eclipse.jpt.common.utility.internal.model.value.PropertyAspectAdapter;
import org.eclipse.jpt.common.utility.internal.model.value.SimpleCollectionValueModel;
@@ -51,7 +50,6 @@ import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.dialogs.SelectionDialog;
import org.eclipse.ui.forms.widgets.ExpandableComposite;
import org.eclipse.ui.forms.widgets.Section;
-import org.eclipse.ui.progress.IProgressService;
public class PersistenceUnitOptionsEditorPage2_0
extends Pane<Options2_0>
@@ -396,35 +394,25 @@ public class PersistenceUnitOptionsEditorPage2_0
* canceled the dialog
*/
private IType chooseType() {
- IJavaProject javaProject = this.getSubject().getJpaProject().getJavaProject();
- IJavaElement[] elements = new IJavaElement[] { javaProject };
- IJavaSearchScope scope = SearchEngine.createJavaSearchScope(elements);
- IProgressService service = PlatformUI.getWorkbench().getProgressService();
- SelectionDialog typeSelectionDialog;
-
+ SelectionDialog dialog;
try {
- typeSelectionDialog = JavaUI.createTypeDialog(
- getShell(),
- service,
- scope,
- IJavaElementSearchConstants.CONSIDER_CLASSES,
- false,
- ""
- );
- }
- catch (JavaModelException e) {
- JptJpaUiPlugin.instance().logError(e);
+ dialog = JavaUI.createTypeDialog(
+ getShell(),
+ PlatformUI.getWorkbench().getProgressService(),
+ SearchEngine.createJavaSearchScope(new IJavaElement[] { this.getSubject().getJpaProject().getJavaProject() }),
+ IJavaElementSearchConstants.CONSIDER_CLASSES,
+ false,
+ StringTools.EMPTY_STRING
+ );
+ } catch (JavaModelException ex) {
+ JptJpaUiPlugin.instance().logError(ex);
return null;
}
- typeSelectionDialog.setTitle(JptCommonUiMessages.CLASS_CHOOSER_PANE__DIALOG_TITLE);
- typeSelectionDialog.setMessage(JptCommonUiMessages.CLASS_CHOOSER_PANE__DIALOG_MESSAGE);
+ dialog.setTitle(JptCommonUiMessages.CLASS_CHOOSER_PANE__DIALOG_TITLE);
+ dialog.setMessage(JptCommonUiMessages.CLASS_CHOOSER_PANE__DIALOG_MESSAGE);
- if (typeSelectionDialog.open() == Window.OK) {
- return (IType) typeSelectionDialog.getResult()[0];
- }
-
- return null;
+ return (dialog.open() == Window.OK) ? (IType) dialog.getResult()[0] : null;
}
private ModifiableCollectionValueModel<String> buildSelectedItemsModel() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpql/JpaJpqlContentProposalProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpql/JpaJpqlContentProposalProvider.java
index f77776e564..572e48a2be 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpql/JpaJpqlContentProposalProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpql/JpaJpqlContentProposalProvider.java
@@ -58,6 +58,7 @@ import org.eclipse.jface.text.source.Annotation;
import org.eclipse.jface.text.source.AnnotationModel;
import org.eclipse.jface.text.source.ISourceViewer;
import org.eclipse.jface.text.source.SourceViewer;
+import org.eclipse.jpt.common.ui.internal.WorkbenchTools;
import org.eclipse.jpt.common.ui.internal.listeners.SWTPropertyChangeListenerWrapper;
import org.eclipse.jpt.common.utility.internal.StringTools;
import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent;
@@ -76,12 +77,11 @@ import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.ISources;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.actions.ActionFactory;
import org.eclipse.ui.editors.text.EditorsUI;
import org.eclipse.ui.editors.text.TextSourceViewerConfiguration;
@@ -207,9 +207,8 @@ public final class JpaJpqlContentProposalProvider extends JpqlCompletionProposal
private void activateHandler() {
- IWorkbench workbench = PlatformUI.getWorkbench();
- IFocusService focusService = (IFocusService) workbench.getService(IFocusService.class);
- IHandlerService handlerService = (IHandlerService) workbench.getService(IHandlerService.class);
+ IFocusService focusService = WorkbenchTools.getService(IFocusService.class);
+ IHandlerService handlerService = WorkbenchTools.getService(IHandlerService.class);
if ((focusService != null) && (handlerService != null)) {
@@ -402,8 +401,7 @@ public final class JpaJpqlContentProposalProvider extends JpqlCompletionProposal
textHolder.removePropertyChangeListener(PropertyValueModel.VALUE, textListener);
queryHolder.removePropertyChangeListener(PropertyValueModel.VALUE, subjectChangeListener);
- IWorkbench workbench = PlatformUI.getWorkbench();
- IHandlerService handlerService = (IHandlerService) workbench.getService(IHandlerService.class);
+ IHandlerService handlerService = WorkbenchTools.getService(IHandlerService.class);
if (handlerService != null) { //this can be null if closing the workbench
handlerService.deactivateHandler(handlerActivation);
}
@@ -411,7 +409,7 @@ public final class JpaJpqlContentProposalProvider extends JpqlCompletionProposal
private KeyStroke findContentAssistTrigger() {
- IBindingService bindingService = (IBindingService) PlatformUI.getWorkbench().getService(IBindingService.class);
+ IBindingService bindingService = WorkbenchTools.getService(IBindingService.class);
// Dig through the list of available bindings to find the one for content assist
for (Binding binding : bindingService.getBindings()) {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpql/JpqlCompletionProposalComputer.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpql/JpqlCompletionProposalComputer.java
index 4759e43de0..154ece2b81 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpql/JpqlCompletionProposalComputer.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpql/JpqlCompletionProposalComputer.java
@@ -29,7 +29,7 @@ import java.util.List;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.ResourceManager;
-import org.eclipse.jpt.common.core.internal.utility.PlatformTools;
+import org.eclipse.jpt.common.ui.internal.WorkbenchTools;
import org.eclipse.jpt.common.utility.internal.CharacterTools;
import org.eclipse.jpt.common.utility.internal.StringTools;
import org.eclipse.jpt.common.utility.internal.iterable.IterableTools;
@@ -49,7 +49,6 @@ import org.eclipse.persistence.jpa.jpql.tools.spi.IMapping;
import org.eclipse.persistence.jpa.jpql.tools.spi.IType;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.PlatformUI;
/**
* The abstract definition of JPQL content assist support.
@@ -427,7 +426,7 @@ abstract class JpqlCompletionProposalComputer<T> {
}
JpaWorkbench getJpaWorkbench() {
- return PlatformTools.getAdapter(PlatformUI.getWorkbench(), JpaWorkbench.class);
+ return WorkbenchTools.getAdapter(JpaWorkbench.class);
}
ResourceManager getResourceManager(Control control) {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/listeners/SWTConnectionListenerWrapper.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/listeners/SWTConnectionListenerWrapper.java
index 4c5a5e2ade..00a0e58084 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/listeners/SWTConnectionListenerWrapper.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/listeners/SWTConnectionListenerWrapper.java
@@ -9,7 +9,7 @@
******************************************************************************/
package org.eclipse.jpt.jpa.ui.internal.listeners;
-import org.eclipse.jpt.common.ui.internal.util.SWTUtil;
+import org.eclipse.jpt.common.ui.internal.swt.widgets.DisplayTools;
import org.eclipse.jpt.common.utility.internal.RunnableAdapter;
import org.eclipse.jpt.jpa.db.Catalog;
import org.eclipse.jpt.jpa.db.Column;
@@ -321,12 +321,12 @@ public class SWTConnectionListenerWrapper
}
/**
- * {@link SWTUtil#execute(Runnable)} seems to work OK;
- * but using {@link SWTUtil#syncExec(Runnable)} can somtimes make things
+ * {@link DisplayTools#execute(Runnable)} seems to work OK;
+ * but using {@link DisplayTools#syncExec(Runnable)} can somtimes make things
* more predictable when debugging, at the risk of deadlocks.
*/
private void execute(Runnable r) {
- SWTUtil.execute(r);
+ DisplayTools.execute(r);
// SWTUtil.syncExec(r);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/navigator/JpaNavigatorContentProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/navigator/JpaNavigatorContentProvider.java
index 99edd33c63..caf06ebd6f 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/navigator/JpaNavigatorContentProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/navigator/JpaNavigatorContentProvider.java
@@ -21,9 +21,9 @@ import org.eclipse.core.resources.IWorkspace;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.resource.LocalResourceManager;
import org.eclipse.jface.resource.ResourceManager;
-import org.eclipse.jpt.common.core.internal.utility.PlatformTools;
import org.eclipse.jpt.common.core.internal.utility.ProjectTools;
import org.eclipse.jpt.common.core.internal.utility.ResourceChangeAdapter;
+import org.eclipse.jpt.common.ui.internal.WorkbenchTools;
import org.eclipse.jpt.common.ui.internal.jface.NavigatorContentProvider;
import org.eclipse.jpt.common.ui.jface.ItemExtendedLabelProvider;
import org.eclipse.jpt.common.ui.jface.ItemTreeContentProvider;
@@ -31,8 +31,6 @@ import org.eclipse.jpt.jpa.core.JpaProject;
import org.eclipse.jpt.jpa.core.JpaProjectManager;
import org.eclipse.jpt.jpa.ui.JpaContextModelRootModel;
import org.eclipse.jpt.jpa.ui.JpaWorkbench;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.navigator.ICommonContentExtensionSite;
/**
@@ -93,7 +91,7 @@ public class JpaNavigatorContentProvider
}
private ResourceManager buildResourceManager_() {
- return new LocalResourceManager(JFaceResources.getResources(this.getWorkbench().getDisplay()));
+ return new LocalResourceManager(JFaceResources.getResources(WorkbenchTools.getDisplay()));
}
@@ -227,11 +225,7 @@ public class JpaNavigatorContentProvider
}
private JpaWorkbench getJpaWorkbench() {
- return PlatformTools.getAdapter(this.getWorkbench(), JpaWorkbench.class);
- }
-
- private IWorkbench getWorkbench() {
- return PlatformUI.getWorkbench();
+ return WorkbenchTools.getAdapter(JpaWorkbench.class);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/persistence/PersistenceUnitClassesComposite.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/persistence/PersistenceUnitClassesComposite.java
index e9fde84a8d..249df907ad 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/persistence/PersistenceUnitClassesComposite.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/persistence/PersistenceUnitClassesComposite.java
@@ -13,7 +13,6 @@ import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.search.IJavaSearchScope;
import org.eclipse.jdt.core.search.SearchEngine;
import org.eclipse.jdt.ui.IJavaElementSearchConstants;
import org.eclipse.jdt.ui.JavaUI;
@@ -26,6 +25,7 @@ import org.eclipse.jpt.common.ui.internal.jface.ResourceManagerLabelProvider;
import org.eclipse.jpt.common.ui.internal.widgets.AddRemoveListPane;
import org.eclipse.jpt.common.ui.internal.widgets.AddRemovePane;
import org.eclipse.jpt.common.ui.internal.widgets.Pane;
+import org.eclipse.jpt.common.utility.internal.StringTools;
import org.eclipse.jpt.common.utility.internal.model.value.CollectionPropertyValueModelAdapter;
import org.eclipse.jpt.common.utility.internal.model.value.ItemPropertyListValueModelAdapter;
import org.eclipse.jpt.common.utility.internal.model.value.ListAspectAdapter;
@@ -42,8 +42,8 @@ import org.eclipse.jpt.common.utility.model.value.PropertyValueModel;
import org.eclipse.jpt.common.utility.transformer.Transformer;
import org.eclipse.jpt.jpa.core.context.persistence.ClassRef;
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.jpa.ui.JpaPlatformUi;
import org.eclipse.jpt.jpa.ui.JavaManagedTypeUiDefinition;
+import org.eclipse.jpt.jpa.ui.JpaPlatformUi;
import org.eclipse.jpt.jpa.ui.PersistenceResourceUiDefinition;
import org.eclipse.jpt.jpa.ui.internal.JpaHelpContextIds;
import org.eclipse.jpt.jpa.ui.internal.plugin.JptJpaUiPlugin;
@@ -53,7 +53,6 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.dialogs.SelectionDialog;
-import org.eclipse.ui.progress.IProgressService;
@SuppressWarnings("nls")
public class PersistenceUnitClassesComposite
@@ -286,35 +285,25 @@ public class PersistenceUnitClassesComposite
* canceled the dialog
*/
private IType chooseType() {
- IJavaProject javaProject = getJavaProject();
- IJavaElement[] elements = new IJavaElement[] { javaProject };
- IJavaSearchScope scope = SearchEngine.createJavaSearchScope(elements);
- IProgressService service = PlatformUI.getWorkbench().getProgressService();
- SelectionDialog typeSelectionDialog;
-
+ SelectionDialog dialog;
try {
- typeSelectionDialog = JavaUI.createTypeDialog(
- getShell(),
- service,
- scope,
- IJavaElementSearchConstants.CONSIDER_CLASSES,
- false,
- ""
- );
- }
- catch (JavaModelException e) {
- JptJpaUiPlugin.instance().logError(e);
+ dialog = JavaUI.createTypeDialog(
+ getShell(),
+ PlatformUI.getWorkbench().getProgressService(),
+ SearchEngine.createJavaSearchScope(new IJavaElement[] { getJavaProject() }),
+ IJavaElementSearchConstants.CONSIDER_CLASSES,
+ false,
+ StringTools.EMPTY_STRING
+ );
+ } catch (JavaModelException ex) {
+ JptJpaUiPlugin.instance().logError(ex);
return null;
}
- typeSelectionDialog.setTitle(JptCommonUiMessages.CLASS_CHOOSER_PANE__DIALOG_TITLE);
- typeSelectionDialog.setMessage(JptCommonUiMessages.CLASS_CHOOSER_PANE__DIALOG_MESSAGE);
-
- if (typeSelectionDialog.open() == Window.OK) {
- return (IType) typeSelectionDialog.getResult()[0];
- }
+ dialog.setTitle(JptCommonUiMessages.CLASS_CHOOSER_PANE__DIALOG_TITLE);
+ dialog.setMessage(JptCommonUiMessages.CLASS_CHOOSER_PANE__DIALOG_MESSAGE);
- return null;
+ return (dialog.open() == Window.OK) ? (IType) dialog.getResult()[0] : null;
}
protected IType findType(ClassRef classRef) {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/persistence/PersistenceUnitPropertiesEditorPage.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/persistence/PersistenceUnitPropertiesEditorPage.java
index d47e768d7f..4d7103ff2d 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/persistence/PersistenceUnitPropertiesEditorPage.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/persistence/PersistenceUnitPropertiesEditorPage.java
@@ -19,7 +19,8 @@ import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.TextCellEditor;
import org.eclipse.jpt.common.ui.WidgetFactory;
import org.eclipse.jpt.common.ui.internal.swt.ColumnAdapter;
-import org.eclipse.jpt.common.ui.internal.util.SWTUtil;
+import org.eclipse.jpt.common.ui.internal.swt.widgets.ControlTools;
+import org.eclipse.jpt.common.ui.internal.swt.widgets.DisplayTools;
import org.eclipse.jpt.common.ui.internal.widgets.AddRemoveTablePane;
import org.eclipse.jpt.common.ui.internal.widgets.Pane;
import org.eclipse.jpt.common.utility.internal.model.value.ListAspectAdapter;
@@ -360,12 +361,12 @@ public class PersistenceUnitPropertiesEditorPage
* notified before the table has been updated (table column added or removed).
*/
private void revalidateLayout() {
- SWTUtil.asyncExec(new Runnable() { public void run() {
+ DisplayTools.asyncExec(new Runnable() { public void run() {
Table table = getMainControl();
if (!table.isDisposed()) {
// We have to do a total relayout of the tab otherwise the
// table might become cut off at the bottom
- SWTUtil.reflow(table);
+ ControlTools.reflow(table);
}
}});
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/base/AbstractJpaPlatformUi.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/base/AbstractJpaPlatformUi.java
index f54d981900..5972499536 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/base/AbstractJpaPlatformUi.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/base/AbstractJpaPlatformUi.java
@@ -16,7 +16,8 @@ import org.eclipse.jface.wizard.IWizard;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.jpt.common.core.JptResourceType;
import org.eclipse.jpt.common.ui.WidgetFactory;
-import org.eclipse.jpt.common.ui.internal.util.SWTUtil;
+import org.eclipse.jpt.common.ui.internal.swt.widgets.DisplayTools;
+import org.eclipse.jpt.common.ui.internal.swt.widgets.ControlTools;
import org.eclipse.jpt.common.ui.jface.ItemTreeStateProviderFactoryProvider;
import org.eclipse.jpt.common.utility.internal.ObjectTools;
import org.eclipse.jpt.common.utility.internal.iterable.IterableTools;
@@ -186,7 +187,7 @@ public abstract class AbstractJpaPlatformUi
// ********** convenience methods **********
protected void displayMessage(String title, String message) {
- MessageDialog.openInformation(SWTUtil.getShell(), title, message);
+ MessageDialog.openInformation(DisplayTools.getShell(), title, message);
}
protected void openInDialog(JavaMetadataConversionWizardPage wizardPage) {
@@ -211,7 +212,7 @@ public abstract class AbstractJpaPlatformUi
}
public SizedWizardDialog(IWizard wizard, int width, int height) {
- this(SWTUtil.getShell(), wizard, width, height);
+ this(DisplayTools.getShell(), wizard, width, height);
}
public SizedWizardDialog(Shell shell, IWizard wizard, int width, int height) {
@@ -224,7 +225,7 @@ public abstract class AbstractJpaPlatformUi
protected void configureShell(Shell shell) {
super.configureShell(shell);
shell.setSize(this.width, this.height);
- SWTUtil.center(shell, this.getParentShell());
+ ControlTools.center(shell, this.getParentShell());
}
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/properties/DataModelPropertyPage.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/properties/DataModelPropertyPage.java
index 0786ddb62a..ecab67a6a6 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/properties/DataModelPropertyPage.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/properties/DataModelPropertyPage.java
@@ -15,10 +15,10 @@ import java.util.HashMap;
import java.util.Map;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.dialogs.IMessageProvider;
+import org.eclipse.jpt.common.ui.internal.WorkbenchTools;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Listener;
-import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.dialogs.PropertyPage;
import org.eclipse.wst.common.frameworks.datamodel.DataModelEvent;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
@@ -96,8 +96,9 @@ public abstract class DataModelPropertyPage
* Set up info pop hooks if set.
*/
protected void setupInfopop(Control parent) {
- if (getInfopopID() != null)
- PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, getInfopopID());
+ if (getInfopopID() != null) {
+ WorkbenchTools.setHelp(parent, getInfopopID());
+ }
}
/**
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/properties/JpaProjectPropertiesPage.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/properties/JpaProjectPropertiesPage.java
index 69077af963..69e772d12b 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/properties/JpaProjectPropertiesPage.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/properties/JpaProjectPropertiesPage.java
@@ -25,11 +25,11 @@ import org.eclipse.jdt.core.IJavaElementDelta;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jpt.common.core.internal.utility.ICUStringCollator;
-import org.eclipse.jpt.common.core.internal.utility.PlatformTools;
+import org.eclipse.jpt.common.ui.internal.WorkbenchTools;
import org.eclipse.jpt.common.ui.internal.listeners.SWTPropertyChangeListenerWrapper;
import org.eclipse.jpt.common.ui.internal.properties.JptProjectPropertiesPage;
import org.eclipse.jpt.common.ui.internal.swt.bind.SWTBindTools;
-import org.eclipse.jpt.common.ui.internal.util.SWTUtil;
+import org.eclipse.jpt.common.ui.internal.swt.widgets.ControlTools;
import org.eclipse.jpt.common.utility.internal.BitTools;
import org.eclipse.jpt.common.utility.internal.ObjectTools;
import org.eclipse.jpt.common.utility.internal.StringTools;
@@ -105,7 +105,6 @@ import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Link;
-import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer;
import org.eclipse.wst.common.project.facet.core.IFacetedProject;
import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
@@ -536,7 +535,7 @@ public class JpaProjectPropertiesPage
this.buildPersistentClassManagementGroup(parent);
this.buildMetamodelGroup(parent);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, JpaHelpContextIds.PROPERTIES_JAVA_PERSISTENCE);
+ WorkbenchTools.setHelp(parent, JpaHelpContextIds.PROPERTIES_JAVA_PERSISTENCE);
}
@Override
@@ -671,7 +670,7 @@ public class JpaProjectPropertiesPage
}
/* CU private */ static JpaWorkbench getJpaWorkbench() {
- return PlatformTools.getAdapter(PlatformUI.getWorkbench(), JpaWorkbench.class);
+ return WorkbenchTools.getAdapter(JpaWorkbench.class);
}
@@ -683,7 +682,7 @@ public class JpaProjectPropertiesPage
group.setLayout(new GridLayout(3, false));
group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- PlatformUI.getWorkbench().getHelpSystem().setHelp(group, JpaHelpContextIds.PROPERTIES_JAVA_PERSISTENCE_CONNECTION);
+ WorkbenchTools.setHelp(group, JpaHelpContextIds.PROPERTIES_JAVA_PERSISTENCE_CONNECTION);
Combo connectionDropDown = this.buildDropDown(group, 3);
SWTBindTools.bind(
@@ -754,7 +753,7 @@ public class JpaProjectPropertiesPage
return;
}
this.connectLink.setText(text);
- SWTUtil.reflow(this.connectLink.getParent());
+ ControlTools.reflow(this.connectLink);
}
/* CU private */ class AddConnectionLinkListener
@@ -834,7 +833,7 @@ public class JpaProjectPropertiesPage
SIMPLE_STRING_TRANSFORMER
);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(group, JpaHelpContextIds.PROPERTIES_JAVA_PERSISTENCE_METAMODEL);
+ WorkbenchTools.setHelp(group, JpaHelpContextIds.PROPERTIES_JAVA_PERSISTENCE_METAMODEL);
SWTBindTools.controlVisibleState(this.jpa2_0ProjectFlagModel, group, metamodelSourceFolderLink, metamodelSourceFolderDropDown);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/selection/JpaTextEditorManager.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/selection/JpaTextEditorManager.java
index 1b64eab836..b69d1447f0 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/selection/JpaTextEditorManager.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/selection/JpaTextEditorManager.java
@@ -19,7 +19,7 @@ import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.common.ui.internal.PropertyAdapter;
import org.eclipse.jpt.common.ui.internal.jface.SelectionChangedAdapter;
-import org.eclipse.jpt.common.ui.internal.util.SWTUtil;
+import org.eclipse.jpt.common.ui.internal.swt.widgets.DisplayTools;
import org.eclipse.jpt.common.utility.internal.ObjectTools;
import org.eclipse.jpt.common.utility.internal.model.value.DoublePropertyValueModel;
import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel;
@@ -336,7 +336,7 @@ class JpaTextEditorManager
}
private void execute(Runnable runnable) {
- SWTUtil.execute(this.textEditor.getSite().getShell().getDisplay(), runnable);
+ DisplayTools.execute(this.textEditor.getSite().getShell().getDisplay(), runnable);
}
public void dispose() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/selection/SetJpaSelectionJob.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/selection/SetJpaSelectionJob.java
index 0a346623be..93e981e853 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/selection/SetJpaSelectionJob.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/selection/SetJpaSelectionJob.java
@@ -13,7 +13,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jpt.common.ui.internal.util.SWTUtil;
+import org.eclipse.jpt.common.ui.internal.swt.widgets.DisplayTools;
import org.eclipse.jpt.common.utility.internal.RunnableAdapter;
import org.eclipse.jpt.jpa.core.JpaStructureNode;
import org.eclipse.jpt.jpa.ui.JptJpaUiMessages;
@@ -67,7 +67,7 @@ class SetJpaSelectionJob
@Override
protected IStatus run(IProgressMonitor monitor) {
- SWTUtil.asyncExec(this.setJpaSelectionRunnable);
+ DisplayTools.asyncExec(this.setJpaSelectionRunnable);
return Status.OK_STATUS;
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/views/JpaStructurePage.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/views/JpaStructurePage.java
index 1ac53a77a5..9daec74913 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/views/JpaStructurePage.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/views/JpaStructurePage.java
@@ -30,7 +30,7 @@ import org.eclipse.jpt.common.ui.internal.jface.ItemTreeStateProviderManager;
import org.eclipse.jpt.common.ui.internal.jface.NullItemTreeStateProviderFactoryProvider;
import org.eclipse.jpt.common.ui.internal.jface.SelectionChangedAdapter;
import org.eclipse.jpt.common.ui.internal.jface.SimpleMessageTreeContent;
-import org.eclipse.jpt.common.ui.internal.util.SWTUtil;
+import org.eclipse.jpt.common.ui.internal.swt.widgets.DisplayTools;
import org.eclipse.jpt.common.ui.jface.ItemTreeStateProviderFactoryProvider;
import org.eclipse.jpt.common.ui.jface.TreeStateProvider;
import org.eclipse.jpt.common.utility.internal.ObjectTools;
@@ -523,7 +523,7 @@ public class JpaStructurePage
}
private void execute(Runnable runnable) {
- SWTUtil.execute(this.getSite().getShell().getDisplay(), runnable);
+ DisplayTools.execute(this.getSite().getShell().getDisplay(), runnable);
}
@Override
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/DatabaseSchemaWizardPage.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/DatabaseSchemaWizardPage.java
index e6a13a792c..327431ff5a 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/DatabaseSchemaWizardPage.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/DatabaseSchemaWizardPage.java
@@ -10,11 +10,11 @@
package org.eclipse.jpt.jpa.ui.internal.wizards;
import java.util.EventListener;
-
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.preference.PreferenceDialog;
import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.jpt.common.ui.internal.util.SWTUtil;
+import org.eclipse.jpt.common.ui.internal.WorkbenchTools;
+import org.eclipse.jpt.common.ui.internal.swt.widgets.DisplayTools;
import org.eclipse.jpt.common.utility.internal.ListenerList;
import org.eclipse.jpt.common.utility.internal.iterable.EmptyIterable;
import org.eclipse.jpt.jpa.core.JpaProject;
@@ -38,7 +38,6 @@ import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Link;
-import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.dialogs.PreferencesUtil;
/**
@@ -78,7 +77,7 @@ public class DatabaseSchemaWizardPage extends WizardPage {
composite.setLayout(new GridLayout());
this.databaseGroup = new DatabaseGroup(composite);
Dialog.applyDialogFont(parent);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, JpaHelpContextIds.PROPERTIES_JAVA_PERSISTENCE_CONNECTION);
+ WorkbenchTools.setHelp(composite, JpaHelpContextIds.PROPERTIES_JAVA_PERSISTENCE_CONNECTION);
return composite;
}
@@ -366,7 +365,7 @@ public class DatabaseSchemaWizardPage extends WizardPage {
this.connectionChanged();
}
private void connectionChanged() {
- SWTUtil.asyncExec(
+ DisplayTools.asyncExec(
new Runnable() {
public void run() {
DatabaseGroup.this.connectionChanged();
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/JpaFacetActionPage.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/JpaFacetActionPage.java
index 7571456ea6..d1437cfa98 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/JpaFacetActionPage.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/JpaFacetActionPage.java
@@ -11,6 +11,7 @@ package org.eclipse.jpt.jpa.ui.internal.wizards;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jpt.common.ui.internal.WorkbenchTools;
import org.eclipse.jpt.jpa.core.internal.facet.JpaFacetDataModelProperties;
import org.eclipse.jpt.jpa.ui.JptJpaUiImages;
import org.eclipse.jpt.jpa.ui.JptJpaUiMessages;
@@ -24,8 +25,6 @@ import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Group;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.help.IWorkbenchHelpSystem;
import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetDataModelProperties;
import org.eclipse.wst.common.project.facet.core.IFacetedProjectWorkingCopy;
import org.eclipse.wst.common.project.facet.core.events.IFacetedProjectEvent;
@@ -57,7 +56,7 @@ public abstract class JpaFacetActionPage
setUpRuntimeListener();
Dialog.applyDialogFont(parent);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, JpaHelpContextIds.DIALOG_JPA_FACET);
+ WorkbenchTools.setHelp(parent, JpaHelpContextIds.DIALOG_JPA_FACET);
return composite;
}
@@ -141,10 +140,6 @@ public abstract class JpaFacetActionPage
setErrorMessage();
}
}
-
- protected final IWorkbenchHelpSystem getHelpSystem() {
- return PlatformUI.getWorkbench().getHelpSystem();
- }
@Override
public void dispose() {
@@ -163,7 +158,7 @@ public abstract class JpaFacetActionPage
group.setText(JptJpaUiMessages.JpaFacetWizardPage_platformLabel);
group.setLayout(new GridLayout());
group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- PlatformUI.getWorkbench().getHelpSystem().setHelp(group, JpaHelpContextIds.DIALOG_JPA_PLATFORM);
+ WorkbenchTools.setHelp(group, JpaHelpContextIds.DIALOG_JPA_PLATFORM);
platformCombo = createCombo(group, 1, true);
synchHelper.synchCombo(platformCombo, PLATFORM, null);
@@ -183,7 +178,7 @@ public abstract class JpaFacetActionPage
composite, librariesInstallDelegate,
JptJpaUiMessages.JpaFacetWizardPage_jpaImplementationLabel );
librariesComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- PlatformUI.getWorkbench().getHelpSystem().setHelp(librariesComposite, JpaHelpContextIds.NEW_JPA_PROJECT_CONTENT_PAGE_CLASSPATH);
+ WorkbenchTools.setHelp(librariesComposite, JpaHelpContextIds.NEW_JPA_PROJECT_CONTENT_PAGE_CLASSPATH);
}
}
@@ -200,7 +195,7 @@ public abstract class JpaFacetActionPage
group.setText(JptJpaUiMessages.JpaFacetWizardPage_persistentClassManagementLabel);
group.setLayout(new GridLayout());
group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- PlatformUI.getWorkbench().getHelpSystem().setHelp(group, JpaHelpContextIds.NEW_JPA_PROJECT_CONTENT_PAGE_CLASSPATH);
+ WorkbenchTools.setHelp(group, JpaHelpContextIds.NEW_JPA_PROJECT_CONTENT_PAGE_CLASSPATH);
discoverClassesButton = createButton(group, 1, JptJpaUiMessages.JpaFacetWizardPage_discoverClassesButton, SWT.RADIO);
synchHelper.synchRadio(discoverClassesButton, DISCOVER_ANNOTATED_CLASSES, null);
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/JpaFacetInstallPage.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/JpaFacetInstallPage.java
index d3a32899e5..faf66ba21e 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/JpaFacetInstallPage.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/JpaFacetInstallPage.java
@@ -9,8 +9,8 @@
******************************************************************************/
package org.eclipse.jpt.jpa.ui.internal.wizards;
-import org.eclipse.jpt.common.core.internal.utility.PlatformTools;
-import org.eclipse.jpt.common.ui.internal.util.SWTUtil;
+import org.eclipse.jpt.common.ui.internal.WorkbenchTools;
+import org.eclipse.jpt.common.ui.internal.swt.widgets.ControlTools;
import org.eclipse.jpt.common.utility.internal.ArrayTools;
import org.eclipse.jpt.jpa.core.JpaWorkspace;
import org.eclipse.jpt.jpa.core.internal.facet.JpaFacetInstallDataModelProperties;
@@ -32,7 +32,6 @@ import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Link;
-import org.eclipse.ui.PlatformUI;
public class JpaFacetInstallPage
extends JpaFacetActionPage
@@ -46,7 +45,7 @@ public class JpaFacetInstallPage
@Override
protected Composite createTopLevelComposite(Composite parent) {
Composite composite = super.createTopLevelComposite(parent);
- this.getHelpSystem().setHelp(composite, JpaHelpContextIds.NEW_JPA_PROJECT_JPA_FACET);
+ WorkbenchTools.setHelp(composite, JpaHelpContextIds.NEW_JPA_PROJECT_JPA_FACET);
return composite;
}
@@ -100,7 +99,7 @@ public class JpaFacetInstallPage
group.setText(JptJpaUiMessages.JpaFacetWizardPage_connectionLabel);
group.setLayout(new GridLayout(3, false));
group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- PlatformUI.getWorkbench().getHelpSystem().setHelp(group, JpaHelpContextIds.NEW_JPA_PROJECT_CONTENT_PAGE_DATABASE);
+ WorkbenchTools.setHelp(group, JpaHelpContextIds.NEW_JPA_PROJECT_CONTENT_PAGE_DATABASE);
connectionCombo = createCombo(group, 3, true);
synchHelper.synchCombo(connectionCombo, CONNECTION, null);
@@ -226,7 +225,7 @@ public class JpaFacetInstallPage
}
private JpaWorkbench getJpaWorkbench() {
- return PlatformTools.getAdapter(PlatformUI.getWorkbench(), JpaWorkbench.class);
+ return WorkbenchTools.getAdapter(JpaWorkbench.class);
}
private void updateConnectLink(ConnectionProfile cp) {
@@ -241,7 +240,7 @@ public class JpaFacetInstallPage
private void updateConnectLinkText(String text) {
connectLink.setText(text);
- SWTUtil.reflow(connectLink.getParent());
+ ControlTools.reflow(connectLink);
}
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/JpaMakePersistentWizardPage.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/JpaMakePersistentWizardPage.java
index 28b203f649..f78916cc47 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/JpaMakePersistentWizardPage.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/JpaMakePersistentWizardPage.java
@@ -47,6 +47,7 @@ import org.eclipse.jface.window.Window;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.jpt.common.core.JptResourceType;
import org.eclipse.jpt.common.core.resource.xml.JptXmlResource;
+import org.eclipse.jpt.common.ui.internal.WorkbenchTools;
import org.eclipse.jpt.common.ui.internal.swt.bind.SWTBindTools;
import org.eclipse.jpt.common.ui.internal.utility.SynchronousUiCommandContext;
import org.eclipse.jpt.common.utility.command.Command;
@@ -96,7 +97,6 @@ import org.eclipse.swt.widgets.Link;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.ide.IDE;
import org.eclipse.ui.model.WorkbenchContentProvider;
import org.eclipse.ui.model.WorkbenchLabelProvider;
@@ -496,7 +496,7 @@ public class JpaMakePersistentWizardPage
@Override
public final void performHelp() {
- PlatformUI.getWorkbench().getHelpSystem().displayHelp( this.helpContextId );
+ WorkbenchTools.displayHelp( this.helpContextId );
}
protected void performFinish() throws InvocationTargetException {
@@ -542,8 +542,10 @@ public class JpaMakePersistentWizardPage
getShell().getDisplay().asyncExec(new Runnable() {
public void run() {
try {
- IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
- IDE.openEditor(page, file, true);
+ IWorkbenchPage page = WorkbenchTools.getActivePage();
+ if (page != null) {
+ IDE.openEditor(page, file, true);
+ }
}
catch (PartInitException e) {
JptJpaUiPlugin.instance().logError(e);
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/conversion/java/JavaMetadataConversionWizardPage.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/conversion/java/JavaMetadataConversionWizardPage.java
index 36b663633a..b66f57026c 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/conversion/java/JavaMetadataConversionWizardPage.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/conversion/java/JavaMetadataConversionWizardPage.java
@@ -34,8 +34,9 @@ import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.jpt.common.core.internal.utility.WorkspaceRunnableAdapter;
import org.eclipse.jpt.common.core.resource.ProjectResourceLocator;
import org.eclipse.jpt.common.core.resource.xml.JptXmlResource;
+import org.eclipse.jpt.common.ui.internal.WorkbenchTools;
import org.eclipse.jpt.common.ui.internal.swt.bind.SWTBindTools;
-import org.eclipse.jpt.common.ui.internal.util.SWTUtil;
+import org.eclipse.jpt.common.ui.internal.swt.widgets.DisplayTools;
import org.eclipse.jpt.common.ui.internal.utility.SynchronousUiCommandContext;
import org.eclipse.jpt.common.utility.command.Command;
import org.eclipse.jpt.common.utility.internal.ObjectTools;
@@ -76,7 +77,6 @@ import org.eclipse.swt.widgets.Link;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.ide.IDE;
public abstract class JavaMetadataConversionWizardPage
@@ -536,7 +536,7 @@ public abstract class JavaMetadataConversionWizardPage
}
protected void saveAllFiles() {
- SWTUtil.asyncExec(this.buildSaveAllFilesRunnable());
+ DisplayTools.asyncExec(this.buildSaveAllFilesRunnable());
}
protected Runnable buildSaveAllFilesRunnable() {
@@ -548,7 +548,7 @@ public abstract class JavaMetadataConversionWizardPage
}
protected void openEditorOnMappingFile() {
- SWTUtil.asyncExec(this.buildOpenEditorOnMappingFileRunnable());
+ DisplayTools.asyncExec(this.buildOpenEditorOnMappingFileRunnable());
}
protected Runnable buildOpenEditorOnMappingFileRunnable() {
@@ -608,9 +608,11 @@ public abstract class JavaMetadataConversionWizardPage
}
public void run() {
- IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ IWorkbenchPage page = WorkbenchTools.getActivePage();
try {
- IDE.openEditor(page, this.file);
+ if (page != null) {
+ IDE.openEditor(page, this.file);
+ }
} catch (PartInitException ex) {
JptJpaUiPlugin.instance().logError(ex);
}
@@ -637,6 +639,6 @@ public abstract class JavaMetadataConversionWizardPage
@Override
public final void performHelp() {
- PlatformUI.getWorkbench().getHelpSystem().displayHelp(HELP_CONTEXT_ID);
+ WorkbenchTools.displayHelp(HELP_CONTEXT_ID);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/entity/EntityClassWizardPage.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/entity/EntityClassWizardPage.java
index ba3334b07d..adab49e2bf 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/entity/EntityClassWizardPage.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/entity/EntityClassWizardPage.java
@@ -29,6 +29,7 @@ import org.eclipse.jface.window.Window;
import org.eclipse.jpt.common.core.internal.utility.JavaProjectTools;
import org.eclipse.jpt.common.core.internal.utility.ProjectTools;
import org.eclipse.jpt.common.core.resource.xml.JptXmlResource;
+import org.eclipse.jpt.common.ui.internal.WorkbenchTools;
import org.eclipse.jpt.common.utility.internal.ArrayTools;
import org.eclipse.jpt.common.utility.internal.ObjectTools;
import org.eclipse.jpt.jpa.core.JpaProject;
@@ -54,9 +55,7 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.dialogs.ISelectionStatusValidator;
-import org.eclipse.ui.help.IWorkbenchHelpSystem;
import org.eclipse.ui.model.WorkbenchContentProvider;
import org.eclipse.ui.model.WorkbenchLabelProvider;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
@@ -107,7 +106,7 @@ public class EntityClassWizardPage
@Override
protected Composite createTopLevelComposite(Composite parent) {
Composite composite = super.createTopLevelComposite(parent);
- this.getHelpSystem().setHelp(composite, JpaHelpContextIds.NEW_JPA_ENTITY_ENTITY_CLASS);
+ WorkbenchTools.setHelp(composite, JpaHelpContextIds.NEW_JPA_ENTITY_ENTITY_CLASS);
createInheritanceControl(composite);
this.inheritanceButton.addSelectionListener(new SelectionAdapter() {
@@ -398,8 +397,4 @@ public class EntityClassWizardPage
protected boolean isProjectValid(IProject project) {
return (project.isAccessible() && ProjectTools.hasFacet(project, JpaProject.FACET));
}
-
- protected final IWorkbenchHelpSystem getHelpSystem() {
- return PlatformUI.getWorkbench().getHelpSystem();
- }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/entity/EntityFieldsWizardPage.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/entity/EntityFieldsWizardPage.java
index 153aacd667..c9321e1191 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/entity/EntityFieldsWizardPage.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/entity/EntityFieldsWizardPage.java
@@ -13,6 +13,7 @@ package org.eclipse.jpt.jpa.ui.internal.wizards.entity;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jpt.common.ui.internal.WorkbenchTools;
import org.eclipse.jpt.jpa.ui.internal.JpaHelpContextIds;
import org.eclipse.jpt.jpa.ui.internal.wizards.entity.data.model.IEntityDataModelProperties;
import org.eclipse.jpt.jpa.ui.wizards.entity.JptJpaUiWizardsEntityMessages;
@@ -26,8 +27,6 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.help.IWorkbenchHelpSystem;
import org.eclipse.wst.common.componentcore.internal.operation.IArtifactEditOperationDataModelProperties;
import org.eclipse.wst.common.frameworks.datamodel.DataModelEvent;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
@@ -68,7 +67,7 @@ public class EntityFieldsWizardPage extends DataModelWizardPage {
protected Composite createTopLevelComposite(Composite parent) {
Composite composite = new Composite(parent, SWT.NULL);
composite.setLayout(new GridLayout());
- this.getHelpSystem().setHelp(composite, JpaHelpContextIds.NEW_JPA_ENTITY_ENTITY_PROPERTIES);
+ WorkbenchTools.setHelp(composite, JpaHelpContextIds.NEW_JPA_ENTITY_ENTITY_PROPERTIES);
GridData data = new GridData(GridData.FILL_BOTH);
data.widthHint = 300;
@@ -226,10 +225,6 @@ public class EntityFieldsWizardPage extends DataModelWizardPage {
tableNameText.setEnabled(!tableNameCheckButton.getSelection());
}
}
-
- protected final IWorkbenchHelpSystem getHelpSystem() {
- return PlatformUI.getWorkbench().getHelpSystem();
- }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/entity/EntityWizard.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/entity/EntityWizard.java
index f343f75975..ed71a1e4a1 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/entity/EntityWizard.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/entity/EntityWizard.java
@@ -21,6 +21,7 @@ import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jpt.common.core.internal.utility.PlatformTools;
+import org.eclipse.jpt.common.ui.internal.WorkbenchTools;
import org.eclipse.jpt.jpa.core.context.JpaContextModel;
import org.eclipse.jpt.jpa.ui.JptJpaUiImages;
import org.eclipse.jpt.jpa.ui.internal.plugin.JptJpaUiPlugin;
@@ -31,7 +32,6 @@ import org.eclipse.ui.INewWizard;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.ide.IDE;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
import org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider;
@@ -111,8 +111,10 @@ public class EntityWizard
getShell().getDisplay().asyncExec(new Runnable() {
public void run() {
try {
- IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
- IDE.openEditor(page, file, true);
+ IWorkbenchPage page = WorkbenchTools.getActivePage();
+ if (page != null) {
+ IDE.openEditor(page, file, true);
+ }
}
catch (PartInitException e) {
JptJpaUiPlugin.instance().logError(e);
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/AssociationTablesPage.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/AssociationTablesPage.java
index 1414ee4b75..2d0baa53f9 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/AssociationTablesPage.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/AssociationTablesPage.java
@@ -17,6 +17,7 @@ import java.util.ArrayList;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.resource.ResourceManager;
import org.eclipse.jpt.common.ui.JptCommonUiImages;
+import org.eclipse.jpt.common.ui.internal.WorkbenchTools;
import org.eclipse.jpt.common.utility.internal.iterable.IterableTools;
import org.eclipse.jpt.jpa.db.Schema;
import org.eclipse.jpt.jpa.db.Table;
@@ -68,7 +69,7 @@ public class AssociationTablesPage extends NewAssociationWizardPage {
layout.numColumns = nColumns;
assocKindGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
assocKindGroup.setLayout(layout);
- this.getHelpSystem().setHelp(composite, JpaHelpContextIds.GENERATE_ENTITIES_WIZARD_ASSOCIATION_TABLES);
+ WorkbenchTools.setHelp(composite, JpaHelpContextIds.GENERATE_ENTITIES_WIZARD_ASSOCIATION_TABLES);
assocKindGroup.setText( JptJpaUiWizardsEntityGenMessages.GenerateEntitiesWizard_newAssoc_tablesPage_assocKind);
simpleAssoBtn = createButton(assocKindGroup, 3, JptJpaUiWizardsEntityGenMessages.GenerateEntitiesWizard_newAssoc_tablesPage_simpleAssoc, SWT.RADIO);
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/CardinalityPage.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/CardinalityPage.java
index 3842ff2b64..04205cf73a 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/CardinalityPage.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/CardinalityPage.java
@@ -10,6 +10,7 @@
package org.eclipse.jpt.jpa.ui.internal.wizards.gen;
+import org.eclipse.jpt.common.ui.internal.WorkbenchTools;
import org.eclipse.jpt.jpa.gen.internal.Association;
import org.eclipse.jpt.jpa.gen.internal.ORMGenCustomizer;
import org.eclipse.jpt.jpa.ui.internal.JpaHelpContextIds;
@@ -47,7 +48,7 @@ public class CardinalityPage extends NewAssociationWizardPage {
GridLayout layout = new GridLayout();
layout.numColumns = nColumns;
composite.setLayout(layout);
- this.getHelpSystem().setHelp(composite, JpaHelpContextIds.GENERATE_ENTITIES_WIZARD_ASSOCIATION_CARDINALITY);
+ WorkbenchTools.setHelp(composite, JpaHelpContextIds.GENERATE_ENTITIES_WIZARD_ASSOCIATION_CARDINALITY);
CardinalitySelectionListener selectionListener = new CardinalitySelectionListener();
cardinalityButtons[0] = createRadioButton( composite, 1, JptJpaUiWizardsEntityGenMessages.manyToOne);
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/CascadeDialog.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/CascadeDialog.java
index 5ae82f57ff..cdd7f81ced 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/CascadeDialog.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/CascadeDialog.java
@@ -15,6 +15,7 @@ import java.util.List;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.TrayDialog;
+import org.eclipse.jpt.common.ui.internal.WorkbenchTools;
import org.eclipse.jpt.jpa.gen.internal.AssociationRole;
import org.eclipse.jpt.jpa.gen.internal.util.StringUtil;
import org.eclipse.jpt.jpa.ui.internal.JpaHelpContextIds;
@@ -29,8 +30,6 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.help.IWorkbenchHelpSystem;
/**
* Simple dialog allows user to set the cascade property of an associationRole.
@@ -71,7 +70,7 @@ public class CascadeDialog extends TrayDialog {
protected void configureShell(Shell newShell) {
super.configureShell(newShell);
newShell.setText(JptJpaUiWizardsEntityGenMessages.selectCascadeDlgTitle);
- this.getHelpSystem().setHelp(newShell, JpaHelpContextIds.GENERATE_ENTITIES_WIZARD_SELECT_CASCADE);
+ WorkbenchTools.setHelp(newShell, JpaHelpContextIds.GENERATE_ENTITIES_WIZARD_SELECT_CASCADE);
}
private void setAssociationRole(AssociationRole role) {
@@ -151,11 +150,6 @@ public class CascadeDialog extends TrayDialog {
}
return false;
}
-
- protected final IWorkbenchHelpSystem getHelpSystem() {
- return PlatformUI.getWorkbench().getHelpSystem();
- }
-
}
class TagNames
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/DatabaseGroup.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/DatabaseGroup.java
index bddd41530b..405fc7e627 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/DatabaseGroup.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/DatabaseGroup.java
@@ -464,7 +464,7 @@ public class DatabaseGroup
this.connectionChanged();
}
private void connectionChanged() {
- org.eclipse.jpt.common.ui.internal.util.SWTUtil.asyncExec(
+ org.eclipse.jpt.common.ui.internal.swt.widgets.DisplayTools.asyncExec(
new Runnable() {
public void run() {
DatabaseGroup.this.connectionChanged();
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/DefaultTableGenerationWizardPage.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/DefaultTableGenerationWizardPage.java
index fb9666b205..d5adbfab46 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/DefaultTableGenerationWizardPage.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/DefaultTableGenerationWizardPage.java
@@ -12,7 +12,6 @@ package org.eclipse.jpt.jpa.ui.internal.wizards.gen;
import java.util.ArrayList;
import java.util.List;
-
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
@@ -34,9 +33,9 @@ import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.jface.window.Window;
-import org.eclipse.jface.wizard.IWizard;
import org.eclipse.jpt.common.core.internal.utility.JavaProjectTools;
import org.eclipse.jpt.common.core.internal.utility.PackageFragmentRootTools;
+import org.eclipse.jpt.common.ui.internal.WorkbenchTools;
import org.eclipse.jpt.jpa.core.JpaProject;
import org.eclipse.jpt.jpa.gen.internal.ORMGenCustomizer;
import org.eclipse.jpt.jpa.gen.internal.ORMGenTable;
@@ -48,9 +47,7 @@ import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Group;
-import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.dialogs.ElementTreeSelectionDialog;
-import org.eclipse.ui.help.IWorkbenchHelpSystem;
/**
* A wizard page allowing the entry of the default table generation
@@ -111,7 +108,7 @@ public class DefaultTableGenerationWizardPage extends NewTypeWizardPage {
GridLayout layout = new GridLayout();
layout.numColumns = nColumns;
composite.setLayout(layout);
- this.getHelpSystem().setHelp(composite, JpaHelpContextIds.GENERATE_ENTITIES_WIZARD_CUSTOMIZE_DEFAULT_ENTITY_GENERATION);
+ WorkbenchTools.setHelp(composite, JpaHelpContextIds.GENERATE_ENTITIES_WIZARD_CUSTOMIZE_DEFAULT_ENTITY_GENERATION);
//Create entity access, collection type, etc
this.defaultTableGenPanel = new TableGenPanel(composite, 4, true, this);
@@ -368,10 +365,6 @@ public class DefaultTableGenerationWizardPage extends NewTypeWizardPage {
@Override
public final void performHelp() {
- this.getHelpSystem().displayHelp(this.getWizard().getHelpContextID());
+ WorkbenchTools.displayHelp(this.getWizard().getHelpContextID());
}
-
- protected final IWorkbenchHelpSystem getHelpSystem() {
- return PlatformUI.getWorkbench().getHelpSystem();
- }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/GenerateEntitiesFromSchemaWizard.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/GenerateEntitiesFromSchemaWizard.java
index f4f2af72f4..b94f6e895e 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/GenerateEntitiesFromSchemaWizard.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/GenerateEntitiesFromSchemaWizard.java
@@ -34,6 +34,7 @@ import org.eclipse.jface.wizard.IWizardPage;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.jpt.common.core.internal.utility.JavaProjectTools;
import org.eclipse.jpt.common.core.internal.utility.PlatformTools;
+import org.eclipse.jpt.common.ui.internal.WorkbenchTools;
import org.eclipse.jpt.common.ui.internal.dialogs.OptionalMessageDialog;
import org.eclipse.jpt.common.utility.internal.StringTools;
import org.eclipse.jpt.jpa.core.JpaEntityGeneratorDatabaseAnnotationNameBuilder;
@@ -61,7 +62,6 @@ import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.INewWizard;
import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.PlatformUI;
public class GenerateEntitiesFromSchemaWizard
extends Wizard
@@ -103,15 +103,11 @@ public class GenerateEntitiesFromSchemaWizard
protected ResourceManager buildResourceManager() {
JpaWorkbench jpaWorkbench = this.getJpaWorkbench();
- return (jpaWorkbench != null) ? jpaWorkbench.buildLocalResourceManager() : new LocalResourceManager(JFaceResources.getResources(this.getWorkbench().getDisplay()));
+ return (jpaWorkbench != null) ? jpaWorkbench.buildLocalResourceManager() : new LocalResourceManager(JFaceResources.getResources(WorkbenchTools.getDisplay()));
}
protected JpaWorkbench getJpaWorkbench() {
- return PlatformTools.getAdapter(this.getWorkbench(), JpaWorkbench.class);
- }
-
- protected IWorkbench getWorkbench() {
- return PlatformUI.getWorkbench();
+ return WorkbenchTools.getAdapter(JpaWorkbench.class);
}
@Override
@@ -311,7 +307,7 @@ public class GenerateEntitiesFromSchemaWizard
private boolean promptUser(final String className) {
// get on the UI thread synchronously, need feedback before continuing
final boolean ret[]=new boolean[1];
- org.eclipse.jpt.common.ui.internal.util.SWTUtil.syncExec(new Runnable() {
+ org.eclipse.jpt.common.ui.internal.swt.widgets.DisplayTools.syncExec(new Runnable() {
public void run() {
final OverwriteConfirmerDialog dialog = new OverwriteConfirmerDialog(Display.getCurrent().getActiveShell(), className);
dialog.open();
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/JoinColumnsPage.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/JoinColumnsPage.java
index 29885968e0..7507467998 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/JoinColumnsPage.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/JoinColumnsPage.java
@@ -14,7 +14,6 @@ import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.TreeMap;
-
import org.eclipse.core.runtime.Assert;
import org.eclipse.jface.dialogs.IPageChangedListener;
import org.eclipse.jface.dialogs.PageChangedEvent;
@@ -33,7 +32,8 @@ import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerSorter;
import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.jpt.common.ui.internal.util.SWTUtil;
+import org.eclipse.jpt.common.ui.internal.WorkbenchTools;
+import org.eclipse.jpt.common.ui.internal.swt.widgets.TableTools;
import org.eclipse.jpt.common.ui.internal.util.TableLayoutComposite;
import org.eclipse.jpt.jpa.db.Column;
import org.eclipse.jpt.jpa.db.Schema;
@@ -90,7 +90,7 @@ public class JoinColumnsPage extends NewAssociationWizardPage {
GridLayout layout = new GridLayout();
layout.numColumns = 1;
composite.setLayout(layout);
- this.getHelpSystem().setHelp(composite, JpaHelpContextIds.GENERATE_ENTITIES_WIZARD_JOIN_COLUMNS);
+ WorkbenchTools.setHelp(composite, JpaHelpContextIds.GENERATE_ENTITIES_WIZARD_JOIN_COLUMNS);
tablesGroup1 = new Composite(composite, SWT.SHADOW_ETCHED_IN);
tablesGroup1.setLayoutData(new GridData());
@@ -385,7 +385,7 @@ public class JoinColumnsPage extends NewAssociationWizardPage {
referencedColumn.setResizable(true);
GridData gd= new GridData(GridData.FILL_BOTH);
- gd.heightHint= SWTUtil.getTableHeightHint(table, 3);
+ gd.heightHint= TableTools.calculateHeightHint(table, 3);
gd.widthHint = 300;
layout.setLayoutData(gd);
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/NewAssociationWizardPage.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/NewAssociationWizardPage.java
index 8263181770..7b0db70425 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/NewAssociationWizardPage.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/NewAssociationWizardPage.java
@@ -49,12 +49,4 @@ public abstract class NewAssociationWizardPage extends WizardPage {
public void updateWithNewTables() {
}
-
- /**
- * Returns the helps system.
- * @return The platform's help system
- */
- protected final IWorkbenchHelpSystem getHelpSystem() {
- return PlatformUI.getWorkbench().getHelpSystem();
- }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/PromptJPAProjectWizardPage.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/PromptJPAProjectWizardPage.java
index 8ab959b392..f5a60218af 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/PromptJPAProjectWizardPage.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/PromptJPAProjectWizardPage.java
@@ -18,6 +18,7 @@ import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.jpt.common.core.internal.utility.ProjectTools;
+import org.eclipse.jpt.common.ui.internal.WorkbenchTools;
import org.eclipse.jpt.common.utility.internal.ArrayTools;
import org.eclipse.jpt.common.utility.internal.StringTools;
import org.eclipse.jpt.common.utility.internal.iterable.IterableTools;
@@ -34,7 +35,6 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableItem;
-import org.eclipse.ui.PlatformUI;
public class PromptJPAProjectWizardPage extends WizardPage {
@@ -153,16 +153,14 @@ public class PromptJPAProjectWizardPage extends WizardPage {
@Override
public final void performHelp()
{
- PlatformUI.getWorkbench().getHelpSystem().displayHelp( this.helpContextId );
+ WorkbenchTools.displayHelp( this.helpContextId );
}
// inner classes
private final class ProjectTableLabelProvider extends LabelProvider implements ITableLabelProvider {
public Image getColumnImage(Object element, int columnIndex)
{
- if (columnIndex == PROJECT_NAME_COLUMN_INDEX)
- return PlatformUI.getWorkbench().getSharedImages().getImage(org.eclipse.ui.ide.IDE.SharedImages.IMG_OBJ_PROJECT);
- return null;
+ return (columnIndex == PROJECT_NAME_COLUMN_INDEX) ? WorkbenchTools.getSharedImage(org.eclipse.ui.ide.IDE.SharedImages.IMG_OBJ_PROJECT) : null;
}
public String getColumnText(Object element, int columnIndex)
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/SWTUtil.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/SWTUtil.java
index 3687043fcd..453e7d0f8c 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/SWTUtil.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/SWTUtil.java
@@ -132,6 +132,6 @@ public class SWTUtil {
}
public static Shell getShell() {
- return org.eclipse.jpt.common.ui.internal.util.SWTUtil.getShell();
+ return org.eclipse.jpt.common.ui.internal.swt.widgets.DisplayTools.getShell();
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/TableAssociationsWizardPage.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/TableAssociationsWizardPage.java
index bdc3c8b73e..444ffef0d8 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/TableAssociationsWizardPage.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/TableAssociationsWizardPage.java
@@ -27,6 +27,7 @@ import org.eclipse.jface.window.Window;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.jpt.common.ui.JptCommonUiImages;
+import org.eclipse.jpt.common.ui.internal.WorkbenchTools;
import org.eclipse.jpt.jpa.core.JpaProject;
import org.eclipse.jpt.jpa.gen.internal.Association;
import org.eclipse.jpt.jpa.gen.internal.AssociationRole;
@@ -49,8 +50,6 @@ import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.help.IWorkbenchHelpSystem;
public class TableAssociationsWizardPage extends WizardPage {
@@ -109,7 +108,7 @@ public class TableAssociationsWizardPage extends WizardPage {
GridLayout layout = new GridLayout();
layout.numColumns = nColumns;
composite.setLayout(layout);
- this.getHelpSystem().setHelp(composite, JpaHelpContextIds.GENERATE_ENTITIES_WIZARD_TABLE_ASSOCIATIONS);
+ WorkbenchTools.setHelp(composite, JpaHelpContextIds.GENERATE_ENTITIES_WIZARD_TABLE_ASSOCIATIONS);
Label label = new Label(composite, SWT.NONE);
label.setText( JptJpaUiWizardsEntityGenMessages.GenerateEntitiesWizard_assocPage_label );
@@ -757,10 +756,6 @@ public class TableAssociationsWizardPage extends WizardPage {
@Override
public final void performHelp() {
- this.getHelpSystem().displayHelp(this.getWizard().getHelpContextID());
+ WorkbenchTools.displayHelp(this.getWizard().getHelpContextID());
}
-
- protected final IWorkbenchHelpSystem getHelpSystem() {
- return PlatformUI.getWorkbench().getHelpSystem();
- }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/TablesAndColumnsCustomizationWizardPage.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/TablesAndColumnsCustomizationWizardPage.java
index 8c11a824f7..11055f7ee2 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/TablesAndColumnsCustomizationWizardPage.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/TablesAndColumnsCustomizationWizardPage.java
@@ -27,6 +27,7 @@ import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.TreeSelection;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jpt.common.ui.internal.WorkbenchTools;
import org.eclipse.jpt.common.utility.internal.StringTools;
import org.eclipse.jpt.jpa.core.JpaProject;
import org.eclipse.jpt.jpa.gen.internal.ORMGenColumn;
@@ -45,8 +46,6 @@ import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.help.IWorkbenchHelpSystem;
public class TablesAndColumnsCustomizationWizardPage extends NewTypeWizardPage {
@@ -97,7 +96,7 @@ public class TablesAndColumnsCustomizationWizardPage extends NewTypeWizardPage {
GridLayout layout = new GridLayout();
layout.numColumns = nColumns;
composite.setLayout(layout);
- this.getHelpSystem().setHelp(composite, JpaHelpContextIds.GENERATE_ENTITIES_WIZARD_CUSTOMIZE_INDIVIDUAL_ENTITIES);
+ WorkbenchTools.setHelp(composite, JpaHelpContextIds.GENERATE_ENTITIES_WIZARD_CUSTOMIZE_INDIVIDUAL_ENTITIES);
createTableAndColumnsListPanel(composite, 1);
@@ -392,10 +391,6 @@ public class TablesAndColumnsCustomizationWizardPage extends NewTypeWizardPage {
@Override
public final void performHelp() {
- this.getHelpSystem().displayHelp(this.getWizard().getHelpContextID());
+ WorkbenchTools.displayHelp(this.getWizard().getHelpContextID());
}
-
- protected final IWorkbenchHelpSystem getHelpSystem() {
- return PlatformUI.getWorkbench().getHelpSystem();
- }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/TablesSelectorWizardPage.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/TablesSelectorWizardPage.java
index 8b17ff5f5e..a965aea869 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/TablesSelectorWizardPage.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/TablesSelectorWizardPage.java
@@ -43,7 +43,9 @@ import org.eclipse.jface.viewers.ViewerSorter;
import org.eclipse.jface.wizard.IWizardPage;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.jpt.common.ui.JptCommonUiImages;
-import org.eclipse.jpt.common.ui.internal.util.SWTUtil;
+import org.eclipse.jpt.common.ui.internal.WorkbenchTools;
+import org.eclipse.jpt.common.ui.internal.swt.widgets.DisplayTools;
+import org.eclipse.jpt.common.ui.internal.swt.widgets.TableTools;
import org.eclipse.jpt.common.ui.internal.util.TableLayoutComposite;
import org.eclipse.jpt.common.utility.internal.StringMatcher;
import org.eclipse.jpt.common.utility.internal.collection.CollectionTools;
@@ -75,8 +77,6 @@ import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.TableItem;
import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.help.IWorkbenchHelpSystem;
public class TablesSelectorWizardPage extends WizardPage {
@@ -140,7 +140,7 @@ public class TablesSelectorWizardPage extends WizardPage {
@Override
public final void performHelp() {
- this.getHelpSystem().displayHelp(this.getWizard().getHelpContextID());
+ WorkbenchTools.displayHelp(this.getWizard().getHelpContextID());
}
@Override
@@ -148,10 +148,6 @@ public class TablesSelectorWizardPage extends WizardPage {
return (GenerateEntitiesFromSchemaWizard) super.getWizard();
}
- protected final IWorkbenchHelpSystem getHelpSystem() {
- return PlatformUI.getWorkbench().getHelpSystem();
- }
-
// ********** IWizardPage implementation **********
@Override
@@ -173,7 +169,7 @@ public class TablesSelectorWizardPage extends WizardPage {
GridLayout layout = new GridLayout();
layout.numColumns = nColumns;
composite.setLayout(layout);
- this.getHelpSystem().setHelp(composite, JpaHelpContextIds.GENERATE_ENTITIES_WIZARD_SELECT_TABLES);
+ WorkbenchTools.setHelp(composite, JpaHelpContextIds.GENERATE_ENTITIES_WIZARD_SELECT_TABLES);
this.databaseGroup = this.createDatabaseGroup(composite, 400);
@@ -190,7 +186,7 @@ public class TablesSelectorWizardPage extends WizardPage {
this.buildRestoreDefaultsButton(composite);
this.updateSelectionState(this.databaseGroup.getSelectedSchema());
- this.getHelpSystem().setHelp(this.tableTable.getControl(), JpaHelpContextIds.DIALOG_GENERATE_ENTITIES_TABLES);
+ WorkbenchTools.setHelp(this.tableTable.getControl(), JpaHelpContextIds.DIALOG_GENERATE_ENTITIES_TABLES);
return composite;
}
@@ -353,7 +349,7 @@ public class TablesSelectorWizardPage extends WizardPage {
table.addKeyListener(this.buildTableKeyListener());
GridData gridData= new GridData(GridData.FILL_BOTH);
- gridData.heightHint= SWTUtil.getTableHeightHint(table, 20);
+ gridData.heightHint= TableTools.calculateHeightHint(table, 20);
gridData.widthHint = 250;
gridData.grabExcessHorizontalSpace = true;
gridData.grabExcessVerticalSpace = true ;
@@ -661,7 +657,7 @@ public class TablesSelectorWizardPage extends WizardPage {
@Override
public void done(final IJobChangeEvent event) {
- SWTUtil.asyncExec(new Runnable() {
+ DisplayTools.asyncExec(new Runnable() {
public void run() {
updateTablesListViewer(tables);
}
@@ -857,4 +853,4 @@ public class TablesSelectorWizardPage extends WizardPage {
}
}
}
-} \ No newline at end of file
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/makepersistent/JoinColumnsAnnotationEditor.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/makepersistent/JoinColumnsAnnotationEditor.java
index 1e523c2d1d..2c06434ae2 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/makepersistent/JoinColumnsAnnotationEditor.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/makepersistent/JoinColumnsAnnotationEditor.java
@@ -12,7 +12,6 @@ package org.eclipse.jpt.jpa.ui.internal.wizards.makepersistent;
import java.util.ArrayList;
import java.util.List;
-
import org.eclipse.draw2d.ColorConstants;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.resource.ResourceManager;
@@ -24,7 +23,7 @@ import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jpt.common.ui.internal.util.SWTUtil;
+import org.eclipse.jpt.common.ui.internal.swt.widgets.TableTools;
import org.eclipse.jpt.jpa.annotate.mapping.ColumnAttributes;
import org.eclipse.jpt.jpa.annotate.mapping.EntityRefPropertyElem;
import org.eclipse.jpt.jpa.annotate.mapping.JoinTableAttributes;
@@ -369,7 +368,7 @@ public class JoinColumnsAnnotationEditor
joinColumnTable = createJoinColumnTable(composite, joinColumns, 200);
GridData gd2 = new GridData(GridData.FILL_HORIZONTAL);
- gd2.heightHint = SWTUtil.getTableHeightHint(joinColumnTable.getTable(), 5);
+ gd2.heightHint = TableTools.calculateHeightHint(joinColumnTable.getTable(), 5);
joinColumnTable.getTable().setLayoutData(gd2);
joinColumnTable.addSelectionChangedListener(new ISelectionChangedListener()
{
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/makepersistent/JpaMakePersistentWizard.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/makepersistent/JpaMakePersistentWizard.java
index 34e6d1a812..8c84e9cb57 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/makepersistent/JpaMakePersistentWizard.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/makepersistent/JpaMakePersistentWizard.java
@@ -24,7 +24,7 @@ import org.eclipse.jface.resource.ResourceManager;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerComparator;
import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.jpt.common.core.internal.utility.PlatformTools;
+import org.eclipse.jpt.common.ui.internal.WorkbenchTools;
import org.eclipse.jpt.jpa.core.JpaEntityGeneratorDatabaseAnnotationNameBuilder;
import org.eclipse.jpt.jpa.core.JpaFile;
import org.eclipse.jpt.jpa.core.JpaProject;
@@ -41,8 +41,6 @@ import org.eclipse.jpt.jpa.ui.JpaWorkbench;
import org.eclipse.jpt.jpa.ui.JptJpaUiImages;
import org.eclipse.jpt.jpa.ui.JptJpaUiMessages;
import org.eclipse.jpt.jpa.ui.internal.plugin.JptJpaUiPlugin;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.PlatformUI;
public class JpaMakePersistentWizard
extends Wizard
@@ -78,7 +76,7 @@ public class JpaMakePersistentWizard
protected ResourceManager buildResourceManager() {
JpaWorkbench jpaWorkbench = this.getJpaWorkbench();
- return (jpaWorkbench != null) ? jpaWorkbench.buildLocalResourceManager() : new LocalResourceManager(JFaceResources.getResources(this.getWorkbench().getDisplay()));
+ return (jpaWorkbench != null) ? jpaWorkbench.buildLocalResourceManager() : new LocalResourceManager(JFaceResources.getResources(WorkbenchTools.getDisplay()));
}
protected JavaClassMapping[] buildJavaClassMappings(Set<IType> selectedJdtTypes)
@@ -94,11 +92,7 @@ public class JpaMakePersistentWizard
}
private JpaWorkbench getJpaWorkbench() {
- return PlatformTools.getAdapter(this.getWorkbench(), JpaWorkbench.class);
- }
-
- private IWorkbench getWorkbench() {
- return PlatformUI.getWorkbench();
+ return WorkbenchTools.getAdapter(JpaWorkbench.class);
}
@Override
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/makepersistent/SelectOrderByDialog.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/makepersistent/SelectOrderByDialog.java
index 70c568d81e..391ecfeee7 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/makepersistent/SelectOrderByDialog.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/makepersistent/SelectOrderByDialog.java
@@ -14,7 +14,6 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.StringTokenizer;
-
import org.eclipse.core.resources.IProject;
import org.eclipse.jdt.core.Flags;
import org.eclipse.jdt.core.IField;
@@ -34,7 +33,7 @@ import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jpt.common.ui.JptCommonUiImages;
-import org.eclipse.jpt.common.ui.internal.util.SWTUtil;
+import org.eclipse.jpt.common.ui.internal.swt.widgets.TableTools;
import org.eclipse.jpt.common.ui.internal.util.TableLayoutComposite;
import org.eclipse.jpt.jpa.annotate.mapping.EntityRefPropertyElem;
import org.eclipse.jpt.jpa.annotate.util.AnnotateMappingUtil;
@@ -154,7 +153,7 @@ public class SelectOrderByDialog extends Dialog
entityNameColumn.setResizable(true);
GridData gd= new GridData(GridData.FILL_BOTH);
- gd.heightHint= SWTUtil.getTableHeightHint(table, 10);
+ gd.heightHint= TableTools.calculateHeightHint(table, 10);
gd.widthHint = 400;
layout.setLayoutData(gd);
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/orm/MappingFileOptionsWizardPage.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/orm/MappingFileOptionsWizardPage.java
index 6b1c034f2b..8c34a4147b 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/orm/MappingFileOptionsWizardPage.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/orm/MappingFileOptionsWizardPage.java
@@ -10,9 +10,13 @@
*******************************************************************************/
package org.eclipse.jpt.jpa.ui.internal.wizards.orm;
-import static org.eclipse.jpt.common.core.internal.operations.JptFileCreationDataModelProperties.*;
-import static org.eclipse.jpt.jpa.core.internal.operations.OrmFileCreationDataModelProperties.*;
+import static org.eclipse.jpt.common.core.internal.operations.JptFileCreationDataModelProperties.CONTAINER_PATH;
+import static org.eclipse.jpt.common.core.internal.operations.JptFileCreationDataModelProperties.FILE_NAME;
+import static org.eclipse.jpt.jpa.core.internal.operations.OrmFileCreationDataModelProperties.ADD_TO_PERSISTENCE_UNIT;
+import static org.eclipse.jpt.jpa.core.internal.operations.OrmFileCreationDataModelProperties.DEFAULT_ACCESS;
+import static org.eclipse.jpt.jpa.core.internal.operations.OrmFileCreationDataModelProperties.PERSISTENCE_UNIT;
import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jpt.common.ui.internal.WorkbenchTools;
import org.eclipse.jpt.jpa.ui.JptJpaUiMessages;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionEvent;
@@ -23,7 +27,6 @@ import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
-import org.eclipse.ui.PlatformUI;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
import org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelWizardPage;
@@ -118,7 +121,7 @@ public class MappingFileOptionsWizardPage
new Label(composite, SWT.NONE);
// classText.setFocus();
- PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, getInfopopID());
+ WorkbenchTools.setHelp(composite, getInfopopID());
Dialog.applyDialogFont(parent);
return composite;
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/orm/MappingFileWizard.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/orm/MappingFileWizard.java
index 5fb242f354..c58cbbeff4 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/orm/MappingFileWizard.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/orm/MappingFileWizard.java
@@ -31,10 +31,11 @@ import org.eclipse.jface.window.Window;
import org.eclipse.jface.wizard.IWizardPage;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.jpt.common.core.internal.utility.PathTools;
import org.eclipse.jpt.common.core.internal.utility.PlatformTools;
import org.eclipse.jpt.common.core.internal.utility.ProjectTools;
-import org.eclipse.jpt.common.core.internal.utility.PathTools;
import org.eclipse.jpt.common.core.resource.ProjectResourceLocator;
+import org.eclipse.jpt.common.ui.internal.WorkbenchTools;
import org.eclipse.jpt.common.ui.internal.wizards.NewJptFileWizardPage;
import org.eclipse.jpt.jpa.core.JpaProject;
import org.eclipse.jpt.jpa.core.context.JpaContextModel;
@@ -335,8 +336,10 @@ public class MappingFileWizard extends Wizard
getShell().getDisplay().asyncExec(new Runnable() {
public void run() {
try {
- IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
- IDE.openEditor(page, file, true);
+ IWorkbenchPage page = WorkbenchTools.getActivePage();
+ if (page != null) {
+ IDE.openEditor(page, file, true);
+ }
}
catch (PartInitException e) {
JptJpaUiPlugin.instance().logError(e);
diff --git a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/dialog/SelectTypeDialog.java b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/dialog/SelectTypeDialog.java
index 28cc37e17c..d7e17aac8d 100644
--- a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/dialog/SelectTypeDialog.java
+++ b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/dialog/SelectTypeDialog.java
@@ -33,6 +33,7 @@ import org.eclipse.jface.fieldassist.ContentProposalAdapter;
import org.eclipse.jface.fieldassist.IContentProposalProvider;
import org.eclipse.jface.fieldassist.SimpleContentProposalProvider;
import org.eclipse.jface.fieldassist.TextContentAdapter;
+import org.eclipse.jpt.common.ui.internal.WorkbenchTools;
import org.eclipse.jpt.common.utility.internal.StringTools;
import org.eclipse.jpt.jpadiagrameditor.ui.internal.JPADiagramEditorPlugin;
import org.eclipse.jpt.jpadiagrameditor.ui.internal.i18n.JPAEditorMessages;
@@ -80,7 +81,7 @@ public class SelectTypeDialog extends TitleAreaDialog {
public SelectTypeDialog(String message,
String initialType) {
- super(PlatformUI.getWorkbench().getDisplay().getActiveShell());
+ super(WorkbenchTools.getActiveShell());
this.title = JPAEditorMessages.SelectTypeDialog_chooseAttributeTypeDialogTitle;
this.message = message;
this.type = initialType;
@@ -142,7 +143,7 @@ public class SelectTypeDialog extends TitleAreaDialog {
IProgressService service = PlatformUI.getWorkbench().getProgressService();
SelectionDialog d = null;
try {
- d = JavaUI.createTypeDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell(),
+ d = JavaUI.createTypeDialog(WorkbenchTools.getActiveShell(),
service,
scope,
IJavaElementSearchConstants.CONSIDER_ALL_TYPES,

Back to the top