diff options
Diffstat (limited to 'jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui')
32 files changed, 0 insertions, 2352 deletions
diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/.classpath b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/.classpath deleted file mode 100644 index 76f5da81fa..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/.classpath +++ /dev/null @@ -1,15 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry kind="src" path="src"/> - <classpathentry kind="src" path="property_files"/> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/> - <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"> - <accessrules> - <accessrule kind="accessible" pattern="org/eclipse/jpt/common/ui/**"/> - <accessrule kind="accessible" pattern="org/eclipse/jpt/common/utility/**"/> - <accessrule kind="accessible" pattern="org/eclipse/jst/**"/> - <accessrule kind="accessible" pattern="org/eclipse/wst/**"/> - </accessrules> - </classpathentry> - <classpathentry kind="output" path="bin"/> -</classpath> diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/.cvsignore b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/.cvsignore deleted file mode 100644 index ba077a4031..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -bin diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/.project b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/.project deleted file mode 100644 index 7d3b57f9f6..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/.project +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>org.eclipse.jpt.dbws.eclipselink.ui</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.jdt.core.javabuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.ManifestBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.SchemaBuilder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.pde.PluginNature</nature> - <nature>org.eclipse.jdt.core.javanature</nature> - </natures> -</projectDescription> diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/.settings/org.eclipse.jdt.core.prefs b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 3fa75e2387..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,12 +0,0 @@ -#Tue Mar 08 12:07:08 EST 2011 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.5 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.5 diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/META-INF/MANIFEST.MF b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/META-INF/MANIFEST.MF deleted file mode 100644 index 8e3e367e5d..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/META-INF/MANIFEST.MF +++ /dev/null @@ -1,31 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: %pluginName -Bundle-Vendor: %providerName -Bundle-SymbolicName: org.eclipse.jpt.dbws.eclipselink.ui;singleton:=true -Bundle-Version: 1.0.0.qualifier -Bundle-Activator: org.eclipse.jpt.dbws.eclipselink.ui.JptDbwsUiPlugin -Bundle-ActivationPolicy: lazy -Bundle-ClassPath: . -Bundle-Localization: plugin -Bundle-RequiredExecutionEnvironment: J2SE-1.5 -Require-Bundle: org.eclipse.debug.core;bundle-version="[3.4.0,4.0.0)", - org.eclipse.jdt.core;bundle-version="[3.4.0,4.0.0)", - org.eclipse.jdt.launching;bundle-version="[3.4.0,4.0.0)", - org.eclipse.jpt.common.core;bundle-version="[1.0.0,2.0.0)", - org.eclipse.jpt.common.ui;bundle-version="[1.0.0,2.0.0)", - org.eclipse.jpt.common.utility;bundle-version="[2.0.0,3.0.0)", - org.eclipse.jpt.dbws.eclipselink.core.gen;bundle-version="[1.0.0,2.0.0)", - org.eclipse.persistence.core;bundle-version="[2.3.0,3.0.0)", - org.eclipse.persistence.dbws.builder;bundle-version="[2.3.0,3.0.0)", - org.eclipse.wst.common.modulecore;bundle-version="[1.1.200,2.0.0)", - org.eclipse.wst.common.project.facet.ui;bundle-version="[1.3.0,2.0.0)", - org.eclipse.wst.common.ui;bundle-version="[1.1.500,2.0.0)", - org.eclipse.wst.common.uriresolver;bundle-version="[1.1.401,2.0.0)", - org.eclipse.wst.xml.core;bundle-version="[1.1.500,2.0.0)" -Export-Package: org.eclipse.jpt.dbws.eclipselink.core.internal.gen;x-internal:=true, - org.eclipse.jpt.dbws.eclipselink.ui, - org.eclipse.jpt.dbws.eclipselink.ui.internal;x-internal:=true, - org.eclipse.jpt.dbws.eclipselink.ui.internal.actions;x-internal:=true, - org.eclipse.jpt.dbws.eclipselink.ui.internal.wizards.gen;x-internal:=true -Import-Package: com.ibm.icu.text;version="4.0.1" diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/about.html b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/about.html deleted file mode 100644 index be534ba44f..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/about.html +++ /dev/null @@ -1,34 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"> -<HTML> - -<head> -<title>About</title> -<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1"> -</head> - -<BODY lang="EN-US"> - -<H3>About This Content</H3> - -<P>May 02, 2008</P> - -<H3>License</H3> - -<P>The Eclipse Foundation makes available all content in this plug-in -("Content"). Unless otherwise indicated below, the Content is provided to you -under the terms and conditions of the Eclipse Public License Version 1.0 -("EPL"). A copy of the EPL is available at -<A href="http://www.eclipse.org/org/documents/epl-v10.php">http://www.eclipse.org/org/documents/epl-v10.php</A>. -For purposes of the EPL, "Program" will mean the Content.</P> - -<P>If you did not receive this Content directly from the Eclipse Foundation, the -Content is being redistributed by another party ("Redistributor") and different -terms and conditions may apply to your use of any object code in the Content. -Check the Redistributor's license that was provided with the Content. If no such -license exists, contact the Redistributor. Unless otherwise indicated below, the -terms and conditions of the EPL still apply to any source code in the Content -and such source code may be obtained at -<A href="http://www.eclipse.org/">http://www.eclipse.org/</A>.</P> - -</BODY> -</HTML> diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/build.properties b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/build.properties deleted file mode 100644 index 377eb5ce7a..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/build.properties +++ /dev/null @@ -1,18 +0,0 @@ -################################################################################ -# Copyright (c) 2010, 2011 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 -################################################################################ -source.. = src/,\ - property_files/ -output.. = bin/ -bin.includes = .,\ - META-INF/,\ - about.html,\ - plugin.xml,\ - plugin.properties -jars.compile.order = . diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/component.xml b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/component.xml deleted file mode 100644 index 4bf2db832f..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/component.xml +++ /dev/null @@ -1 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?><component xmlns="http://eclipse.org/wtp/releng/tools/component-model" name="org.eclipse.jpt.dbws.eclipselink.ui"><description url=""></description><component-depends unrestricted="true"></component-depends><plugin id="org.eclipse.jpt.dbws.eclipselink.ui" fragment="false"/></component>
\ No newline at end of file diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/icons/full/etool16/newclient_webserv_wiz.gif b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/icons/full/etool16/newclient_webserv_wiz.gif Binary files differdeleted file mode 100644 index 1ee05fa2e5..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/icons/full/etool16/newclient_webserv_wiz.gif +++ /dev/null diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/icons/full/obj16/XSDFile.gif b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/icons/full/obj16/XSDFile.gif Binary files differdeleted file mode 100644 index cc0eeb7196..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/icons/full/obj16/XSDFile.gif +++ /dev/null diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/icons/full/obj16/dtdfile.gif b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/icons/full/obj16/dtdfile.gif Binary files differdeleted file mode 100644 index 3c0acadd2d..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/icons/full/obj16/dtdfile.gif +++ /dev/null diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/icons/full/obj16/text.gif b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/icons/full/obj16/text.gif Binary files differdeleted file mode 100644 index efa7a38014..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/icons/full/obj16/text.gif +++ /dev/null diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/icons/full/ovr16/error_ovr.gif b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/icons/full/ovr16/error_ovr.gif Binary files differdeleted file mode 100644 index 119dcccd5a..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/icons/full/ovr16/error_ovr.gif +++ /dev/null diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/icons/full/wizban/webservicesclient_wiz.gif b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/icons/full/wizban/webservicesclient_wiz.gif Binary files differdeleted file mode 100644 index 77c16a0f87..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/icons/full/wizban/webservicesclient_wiz.gif +++ /dev/null diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/plugin.properties b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/plugin.properties deleted file mode 100644 index efab1b2e17..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/plugin.properties +++ /dev/null @@ -1,31 +0,0 @@ -############################################################################### -# Copyright (c) 2011 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 -############################################################################### - -# ==================================================================== -# To code developer: -# Do NOT change the properties between this line and the -# "%%% END OF TRANSLATED PROPERTIES %%%" line. -# Make a new property name, append to the end of the file and change -# the code to use the new property. -# ==================================================================== - -# ==================================================================== -# %%% END OF TRANSLATED PROPERTIES %%% -# ==================================================================== -pluginName= Dali Java Persistence Tools - DBWS UI -providerName=Eclipse Web Tools Platform - -generateDBWS = Generate Database Web Services - -dbwsWizardCategoryName = Database Web Services - -generateDbwsFromXmlName = Web Services from Builder XML -generateDbwsFromXmlDesc = Generate Web Services from Builder XML - diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/plugin.xml b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/plugin.xml deleted file mode 100644 index 5c52d864fe..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/plugin.xml +++ /dev/null @@ -1,77 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<?eclipse version="3.2"?> -<!-- - Copyright (c) 2010, 2011 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 - --> - -<plugin> - - <extension - point="org.eclipse.ui.menus"> - - <!-- contributions for any popup --> - <menuContribution - locationURI="popup:org.eclipse.ui.popup.any"> - - <menu - id="org.eclipse.jpt.dbws.ui.menu.WebServices" - label="%dbwsWizardCategoryName"> - </menu> - </menuContribution> - - </extension> - - - <extension - point="org.eclipse.ui.newWizards"> - - <category - id="org.eclipse.jpt.dbws" - name="%dbwsWizardCategoryName"/> - - <wizard - id="org.eclipse.jpt.dbws.ui.wizard.generateDbws" - name="%generateDbwsFromXmlName" - category="org.eclipse.jpt.dbws" - class="org.eclipse.jpt.dbws.eclipselink.ui.internal.wizards.gen.DbwsGeneratorWizard" - icon="icons/full/etool16/newclient_webserv_wiz.gif"> - <description>%generateDbwsFromXmlDesc</description> - </wizard> - - </extension> - - - <extension - point="org.eclipse.ui.popupMenus"> - - <!-- contributions to the "Generate" submenu --> - <objectContribution - id="org.eclipse.jpt.ui.xsdFileActions" - objectClass="org.eclipse.core.resources.IFile" - nameFilter="*builder.xml"> - - <filter - name="projectNature" - value="org.eclipse.jdt.core.javanature"> - </filter> - <enablement> - <test property="org.eclipse.wst.common.project.facet.core.projectFacet" value="jst.web"/> - </enablement> - <action - id="org.eclipse.jpt.dbws.ui.generateDbws" - label="%generateDBWS" - menubarPath="org.eclipse.jpt.dbws.ui.menu.WebServices/content" - class="org.eclipse.jpt.dbws.eclipselink.ui.internal.actions.GenerateDbwsAction"> - </action> - </objectContribution> - - </extension> - - -</plugin> diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/property_files/jpt_dbws_ui.properties b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/property_files/jpt_dbws_ui.properties deleted file mode 100644 index 0d62c677d0..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/property_files/jpt_dbws_ui.properties +++ /dev/null @@ -1,49 +0,0 @@ -################################################################################ -# Copyright (c) 2011 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 -################################################################################ - - -# DbwsGenerator -DbwsGeneratorWizard_title = New Database Web Services from Builder XML -DbwsGeneratorWizard_generatingDbws = Generating Database Web Services - -WebDynamicProjectWizardPage_title = Web Dynamic Project -WebDynamicProjectWizardPage_desc = Specify project for Database Web Services -WebDynamicProjectWizardPage_destinationProject = Select destination project: - -BuilderXmlWizardPage_title = Select Builder XML File -BuilderXmlWizardPage_desc = Specify XML file to generate Database Web Services from - -BuilderXmlWizardPage_errorUriCannotBeLocated = The selected catalog entry specifies a URI that can not be located. - -JdbcDriverWizardPage_title = Driver files -JdbcDriverWizardPage_desc = Specify driver JAR files - -JdbcDriverWizardPage_driverFiles = Driver files: - -JdbcDriverWizardPage_addButton = Add... -JdbcDriverWizardPage_removeButton = Remove - -JdbcDriverWizardPage_chooseADriverFile = Driver File Selection - -DbwsGeneratorUi_runningDbwsWarningTitle = Generating Database Web Services -DbwsGeneratorUi_runningDbwsWarningMessage = \ - Warning: Running DBWS Builder will overwrite existing files in your project.\ - \n\nAre you sure you want to continue? - -DbwsGeneratorUi_dbwsNotOnClasspathMessage = \ - Warning: DBWS Builder is not on your project classpath.\ - \n\nAre you sure you want to continue? - -DbwsGeneratorUi_notJavaProject = Not a java project -DbwsGeneratorUi_notWebDynamicProject = Not a WebDynamic project - -BuilderXmlWizardPage_xmlCatalogTableTitle = XML Catalog -BuilderXmlWizardPage_xmlCatalogKeyColumn = Key -BuilderXmlWizardPage_xmlCatalogUriColumn = URI
\ No newline at end of file diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/core/internal/gen/DbwsGenerator.java b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/core/internal/gen/DbwsGenerator.java deleted file mode 100644 index 16c1e6c586..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/core/internal/gen/DbwsGenerator.java +++ /dev/null @@ -1,156 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2010, 2011 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.dbws.eclipselink.core.internal.gen; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.Path; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants; -import org.eclipse.jdt.launching.IRuntimeClasspathEntry; -import org.eclipse.jpt.common.core.internal.gen.AbstractJptGenerator; -import org.eclipse.jpt.common.utility.internal.StringTools; - -/** - * DbwsGenerator - */ -public class DbwsGenerator extends AbstractJptGenerator -{ - static public String LAUNCH_CONFIG_NAME = "DBWS Gen Run Config"; //$NON-NLS-1$ - static public String DBWS_GEN_PACKAGE_NAME = "org.eclipse.jpt.dbws.eclipselink.core.gen"; //$NON-NLS-1$ - static public String DBWS_GEN_CLASS = DBWS_GEN_PACKAGE_NAME + ".Main"; //$NON-NLS-1$ - - static public String DBWS_GEN_JAR_PREFIX = DBWS_GEN_PACKAGE_NAME + "_"; //$NON-NLS-1$ - - private final String builderFileName; - private final String stageDirName; - private final String driverJarList; - - // ********** static methods ********** - - public static void generate( - IJavaProject javaProject, - String builderFileName, - String stageDirName, - String driverJarList, - IProgressMonitor monitor) { - if (javaProject == null) { - throw new NullPointerException(); - } - new DbwsGenerator(javaProject, - builderFileName, - stageDirName, - driverJarList).generate(monitor); - } - - // ********** constructors ********** - - private DbwsGenerator( - IJavaProject javaProject, - String builderFileName, - String stageDirName, - String driverJarList) { - super(javaProject); - this.builderFileName = builderFileName; - this.stageDirName = stageDirName; - this.driverJarList = driverJarList; - } - - // ********** overrides ********** - - @Override - protected String getMainType() { - return DBWS_GEN_CLASS; - } - - @Override - protected String getLaunchConfigName() { - return LAUNCH_CONFIG_NAME; - } - - @Override - protected String getBootstrapJarPrefix() { - return DBWS_GEN_JAR_PREFIX; - } - - @Override - protected void preGenerate(IProgressMonitor monitor) { - // do nothing - - } - - @Override - protected void postGenerate() { - super.postGenerate(); - try { - this.getProject().refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor()); - } - catch (CoreException e) { - throw new RuntimeException(e); - } - } - - // ********** Launch Configuration Setup ********** - - @Override - protected List<String> buildClasspath() throws CoreException { - List<String> classpath = new ArrayList<String>(); - // DBWS_Gen jar - classpath.add(this.getBootstrapJarClasspathEntry().getMemento()); - // Default Project classpath - classpath.add(this.getDefaultProjectClasspathEntry().getMemento()); - // JDBC jar - if( ! StringTools.stringIsEmpty(this.driverJarList)) { - classpath.add(this.getJdbcJarClasspathEntry().getMemento()); - } - // System Library - classpath.add(this.getSystemLibraryClasspathEntry().getMemento()); - return classpath; - } - - @Override - protected void specifyProgramArguments() { - - StringBuffer programArguments = new StringBuffer(); - - // builderFile - programArguments.append(" -builderFile \""); //$NON-NLS-1$ - programArguments.append(this.builderFileName); - programArguments.append('"'); - - // stageDir - programArguments.append(" -stageDir \""); //$NON-NLS-1$ - programArguments.append(this.stageDirName); - programArguments.append('"'); - - // packageAs - programArguments.append(" -packageAs eclipse"); //$NON-NLS-1$ - - this.launchConfig.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, programArguments.toString()); - } - - // ********** private methods ********** - - private IRuntimeClasspathEntry getJdbcJarClasspathEntry() { - return getArchiveClasspathEntry(this.buildJdbcJarPath()); - } - - private IPath buildJdbcJarPath() { - return new Path(this.driverJarList); - } - - -} diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/JptDbwsUiPlugin.java b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/JptDbwsUiPlugin.java deleted file mode 100644 index 25b0f74546..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/JptDbwsUiPlugin.java +++ /dev/null @@ -1,111 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2011 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.dbws.eclipselink.ui; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.resource.ImageRegistry; -import org.eclipse.swt.graphics.Image; -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.eclipse.wst.xml.core.internal.XMLCorePlugin; -import org.eclipse.wst.xml.core.internal.catalog.provisional.ICatalog; - -/** - * The activator class controls the plug-in life cycle - * - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -@SuppressWarnings("nls") -public class JptDbwsUiPlugin extends AbstractUIPlugin { - - // The plug-in ID - public static final String PLUGIN_ID = "org.eclipse.jpt.dbws.eclipselink.ui"; //$NON-NLS-1$ - - public static final String USER_CATALOG_ID = XMLCorePlugin.USER_CATALOG_ID; //$NON-NLS-1$ - public static final String DEFAULT_CATALOG_ID = XMLCorePlugin.DEFAULT_CATALOG_ID; //$NON-NLS-1$ - public static final String SYSTEM_CATALOG_ID = XMLCorePlugin.SYSTEM_CATALOG_ID; //$NON-NLS-1$ - - // ********** singleton ********** - private static JptDbwsUiPlugin INSTANCE; - - /** - * Returns the singleton Plugin - */ - public static JptDbwsUiPlugin instance() { - return INSTANCE; - } - - public static void log(IStatus status) { - INSTANCE.getLog().log(status); - } - - public static void log(String msg) { - log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, msg, null)); - } - - public static void log(Throwable throwable) { - log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, throwable.getLocalizedMessage(), throwable)); - } - - // ********** Image API ********** - /** - * This gets a .gif from the icons folder. - */ - public static ImageDescriptor getImageDescriptor(String key) { - if (! key.startsWith("icons/")) { - key = "icons/" + key; - } - if (! key.endsWith(".gif")) { - key = key + ".gif"; - } - return imageDescriptorFromPlugin(PLUGIN_ID, key); - } - - /** - * This returns an image for a .gif from the icons folder - */ - //TODO we are using the ImageRegistry here and storing all our icons for the life of the plugin, - //which means until the workspace is closed. This is better than before where we constantly - //created new images. Bug 306437 is about cleaning this up and using Local Resource Managers - //on our views so that closing the JPA perspective would mean our icons are disposed. - public static Image getImage(String key) { - ImageRegistry imageRegistry = instance().getImageRegistry(); - Image image = imageRegistry.get(key); - if (image == null) { - imageRegistry.put(key, getImageDescriptor(key)); - image = imageRegistry.get(key); - } - return image; - } - - - // ********** XMLCorePlugin API ********** - - public ICatalog getDefaultXMLCatalog() { - return XMLCorePlugin.getDefault().getDefaultXMLCatalog(); - } - - - // ********** constructors ********** - - public JptDbwsUiPlugin() { - super(); - if(INSTANCE != null) { - throw new IllegalStateException(); - } - INSTANCE = this; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/DbwsGeneratorUi.java b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/DbwsGeneratorUi.java deleted file mode 100644 index 8000bf3b6c..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/DbwsGeneratorUi.java +++ /dev/null @@ -1,275 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2010, 2011 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.dbws.eclipselink.ui.internal; - -import java.io.File; -import java.util.Map; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.WorkspaceJob; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -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.jface.dialogs.MessageDialog; -import org.eclipse.jface.window.Window; -import org.eclipse.jface.wizard.WizardDialog; -import org.eclipse.jpt.dbws.eclipselink.core.internal.gen.DbwsGenerator; -import org.eclipse.jpt.dbws.eclipselink.ui.internal.wizards.gen.DbwsGeneratorWizard; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.persistence.oxm.XMLContext; -import org.eclipse.persistence.oxm.XMLUnmarshaller; -import org.eclipse.persistence.tools.dbws.DBWSBuilderModel; -import org.eclipse.persistence.tools.dbws.DBWSBuilderModelProject; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.wst.common.componentcore.ComponentCore; -import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; -import org.eclipse.wst.common.project.facet.core.IFacetedProject; -import org.eclipse.wst.common.project.facet.core.IProjectFacet; -import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager; - -/** - * DbwsGeneratorUi - */ -public class DbwsGeneratorUi -{ - private final IJavaProject javaProject; - private final String builderXmlFile; - - private static final String WEB_FACET_ID = "jst.web"; //$NON-NLS-1$ - private static final String DRIVER_PROPERTY = "driver"; //$NON-NLS-1$ - private static final String DBWS_BUILDER_CLASS_NAME = "org.eclipse.persistence.tools.dbws.DBWSBuilder"; //$NON-NLS-1$ - - // ********** static methods ********** - - public static void generate(IFile xmlFile) { - IProject project = xmlFile.getProject(); - - if( ! projectIsWebDynamic(project)) { - throw new RuntimeException(JptDbwsUiMessages.DbwsGeneratorUi_notWebDynamicProject); - } - IPath xmlPath = xmlFile.getProjectRelativePath(); - - new DbwsGeneratorUi(project, xmlPath.toOSString()).generate(); - } - - public static boolean projectIsWebDynamic(IProject project) { - - IProjectFacet projectFacet = ProjectFacetsManager.getProjectFacet(WEB_FACET_ID); - IFacetedProject facetedProject = null; - try { - facetedProject = ProjectFacetsManager.create(project); - } - catch (CoreException e) { - return false; - } - return (facetedProject == null) ? false : facetedProject.hasProjectFacet(projectFacet); - } - - public static IPath getWebContentPath(IProject project){ - IVirtualComponent component = ComponentCore.createComponent(project); - IPath modulePath = component.getRootFolder().getProjectRelativePath(); - return modulePath; - } - - public static boolean displayDBWSNotOnClasspathWarning(Shell shell) { - - String msg = JptDbwsUiMessages.DbwsGeneratorUi_dbwsNotOnClasspathMessage; - - return MessageDialog.openQuestion( - shell, - JptDbwsUiMessages.DbwsGeneratorUi_runningDbwsWarningTitle, - msg); - } - - public static boolean displayOverridingWebContentWarning(Shell shell) { - - String msg = JptDbwsUiMessages.DbwsGeneratorUi_runningDbwsWarningMessage; - - return MessageDialog.openQuestion( - shell, - JptDbwsUiMessages.DbwsGeneratorUi_runningDbwsWarningTitle, - msg); - } - - // ********** constructors ********** - - private DbwsGeneratorUi(IProject webProject, String builderXmlFile) { - super(); - if(webProject == null || StringTools.stringIsEmpty(builderXmlFile)) { - throw new NullPointerException(); - } - this.javaProject = this.getJavaProjectFrom(webProject); - if(this.javaProject == null) { - throw new RuntimeException(JptDbwsUiMessages.DbwsGeneratorUi_notJavaProject); - } - this.builderXmlFile = builderXmlFile; - } - - // ********** generate ********** - /** - * prompt the user with a wizard - */ - protected void generate() { - - if( ! this.dbwsIsOnClasspath()) { - if( ! displayDBWSNotOnClasspathWarning(this.getCurrentShell())) { - return; - } - } - if(this.classIsOnProjectsClasspath( - this.getDriverNameFrom(this.builderXmlFile))) { - - if(displayOverridingWebContentWarning(this.getCurrentShell())) { - this.scheduleGenerateDbwsJob(); - } - return; - } - this.openWizardDialog(); - return; - } - - // ********** internal methods ********** - - private void openWizardDialog() { - - DbwsGeneratorWizard wizard = new DbwsGeneratorWizard(this.javaProject, this.builderXmlFile); - wizard.setWindowTitle(JptDbwsUiMessages.DbwsGeneratorWizard_title); - WizardDialog dialog = new WizardDialog(this.getCurrentShell(), wizard); - dialog.create(); - int returnCode = dialog.open(); - if(returnCode != Window.OK) { - return; - } - } - - private String getDriverNameFrom(String builderXmlFile) { - try { - DBWSBuilderModel model = this.buildBuilderModel(builderXmlFile); - Map<String, String> properties = model.getProperties(); - return properties.get(DRIVER_PROPERTY); - } - catch(Exception e) { - return null; - } - } - - private DBWSBuilderModel buildBuilderModel(String builderFileName) { - String projectDirName = this.javaProject.getProject().getLocation().toOSString(); - File builderFile = this.getBuilderFile(projectDirName + File.separator + builderFileName); - return this.unmarshal(builderFile); - } - - private DBWSBuilderModel unmarshal(File builderFile) { - if((builderFile == null) || ( ! builderFile.exists())) { - return null; - } - XMLContext context = new XMLContext(new DBWSBuilderModelProject()); - XMLUnmarshaller unmarshaller = context.createUnmarshaller(); - - DBWSBuilderModel model = (DBWSBuilderModel)unmarshaller.unmarshal(builderFile); - if(model == null || model.properties.size() == 0) { - return null; - } - return model; - } - - private File getBuilderFile(String builderFileName) { - - File builderFile = new File(builderFileName); - if( ! (builderFile.exists() && builderFile.isFile())) { - return null; - } - return builderFile; - } - - /** - * Test if the given class is on the project's classpath. - */ - private boolean classIsOnProjectsClasspath(String driverName) { - try { - if(StringTools.stringIsEmpty(driverName)) { - return false; - } - IType genClass = this.javaProject.findType(driverName); - return (genClass != null); - } - catch (JavaModelException e) { - throw new RuntimeException(e); - } - } - - /** - * Test if the DBWS builder is on the project's classpath. - */ - private boolean dbwsIsOnClasspath() { - try { - IType genClass = this.javaProject.findType(DBWS_BUILDER_CLASS_NAME); - return (genClass != null); - } - catch (JavaModelException e) { - throw new RuntimeException(e); - } - } - - private IJavaProject getJavaProjectFrom(IProject project) { - return (IJavaProject)((IJavaElement)((IAdaptable)project).getAdapter(IJavaElement.class)); - } - - private Shell getCurrentShell() { - return Display.getCurrent().getActiveShell(); - } - - private void scheduleGenerateDbwsJob() { - - String stageDirName = this.javaProject.getProject().getLocation().toOSString(); - - WorkspaceJob generateJob = new GenerateDbwsJob( - this.javaProject, - this.builderXmlFile, - stageDirName, - null // driverJarList - ); - generateJob.schedule(); - } - - // ********** generate DBWS job ********** - - public static class GenerateDbwsJob extends WorkspaceJob { - private final IJavaProject project; - final String builderFileName; - final String stageDirName; - final String driverJarList; - - public GenerateDbwsJob(IJavaProject project, String builderFileName, String stageDirName, String driverJarList) { - super(JptDbwsUiMessages.DbwsGeneratorWizard_generatingDbws); - - this.project = project ; - this.builderFileName = builderFileName; - this.stageDirName = stageDirName; - this.driverJarList = driverJarList; - } - - @Override - public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException { - DbwsGenerator.generate(this.project, this.builderFileName, this.stageDirName, this.driverJarList, monitor); - return Status.OK_STATUS; - } - - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/JptDbwsUiIcons.java b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/JptDbwsUiIcons.java deleted file mode 100644 index 38beda8da7..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/JptDbwsUiIcons.java +++ /dev/null @@ -1,18 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2011 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.dbws.eclipselink.ui.internal; - -@SuppressWarnings("nls") -public class JptDbwsUiIcons -{ - // **************** Wizard icons ******************************************* - - public static final String DBWS_GEN_WIZ_BANNER = "full/wizban/webservicesclient_wiz"; -} diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/JptDbwsUiMessages.java b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/JptDbwsUiMessages.java deleted file mode 100644 index 1610eac2a3..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/JptDbwsUiMessages.java +++ /dev/null @@ -1,68 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2010, 2011 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.dbws.eclipselink.ui.internal; - -import org.eclipse.osgi.util.NLS; - -/** - * Localized messages used by Dali DBWS UI. - * - * @version 2.3 - */ -public class JptDbwsUiMessages { - - // DbwsGenerator - public static String DbwsGeneratorWizard_title; - public static String DbwsGeneratorWizard_generatingDbws; - - public static String WebDynamicProjectWizardPage_title; - public static String WebDynamicProjectWizardPage_desc; - public static String WebDynamicProjectWizardPage_destinationProject; - - public static String BuilderXmlWizardPage_title; - public static String BuilderXmlWizardPage_desc; - - public static String BuilderXmlWizardPage_errorUriCannotBeLocated; - - public static String JdbcDriverWizardPage_title; - public static String JdbcDriverWizardPage_desc; - - public static String JdbcDriverWizardPage_driverFiles; - - public static String JdbcDriverWizardPage_addButton; - public static String JdbcDriverWizardPage_removeButton; - - public static String JdbcDriverWizardPage_chooseADriverFile; - - public static String DbwsGeneratorUi_runningDbwsWarningTitle; - public static String DbwsGeneratorUi_runningDbwsWarningMessage; - public static String DbwsGeneratorUi_dbwsNotOnClasspathMessage; - - public static String DbwsGeneratorUi_notJavaProject; - public static String DbwsGeneratorUi_notWebDynamicProject; - - public static String BuilderXmlWizardPage_xmlCatalogTableTitle; - public static String BuilderXmlWizardPage_xmlCatalogKeyColumn; - public static String BuilderXmlWizardPage_xmlCatalogUriColumn; - - - - - private static final String BUNDLE_NAME = "jpt_dbws_ui"; //$NON-NLS-1$ - private static final Class<?> BUNDLE_CLASS = JptDbwsUiMessages.class; - static { - NLS.initializeMessages(BUNDLE_NAME, BUNDLE_CLASS); - } - - private JptDbwsUiMessages() { - throw new UnsupportedOperationException(); - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/actions/GenerateDbwsAction.java b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/actions/GenerateDbwsAction.java deleted file mode 100644 index 1dfee6b4b4..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/actions/GenerateDbwsAction.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2010 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.dbws.eclipselink.ui.internal.actions; - -import org.eclipse.core.resources.IFile; -import org.eclipse.jpt.dbws.eclipselink.ui.internal.DbwsGeneratorUi; - -/** - * GenerateDbwsAction - */ -public class GenerateDbwsAction extends ObjectAction -{ - - @Override - protected void execute(IFile xmlFile) { - - DbwsGeneratorUi.generate(xmlFile); - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/actions/ObjectAction.java b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/actions/ObjectAction.java deleted file mode 100644 index 5c90f1e584..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/actions/ObjectAction.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2010 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.dbws.eclipselink.ui.internal.actions; - -import java.util.Iterator; - -import org.eclipse.core.resources.IFile; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.ITreeSelection; -import org.eclipse.ui.IObjectActionDelegate; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.actions.ActionDelegate; - -/** - * GenerateEntitiesAction - */ -public abstract class ObjectAction extends ActionDelegate implements IObjectActionDelegate -{ - private ISelection currentSelection; - - public ObjectAction() { - super(); - } - - public void setActivePart(IAction action, IWorkbenchPart targetPart) { - // do nothing - } - - @Override - public void selectionChanged(IAction action, ISelection selection) { - this.currentSelection = selection; - } - - @Override - public void run(IAction action) { - if (this.currentSelection instanceof ITreeSelection) { - for (Iterator<?> stream = ((ITreeSelection) this.currentSelection).iterator(); stream.hasNext(); ) { - this.execute(stream.next()); - } - } - } - - protected void execute(Object selection) { - - if(selection instanceof IFile) { - this.execute((IFile)selection); - } - } - - @SuppressWarnings("unused") - protected void execute(IFile file) { - throw new UnsupportedOperationException(); - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/wizards/gen/BuilderXmlWizardPage.java b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/wizards/gen/BuilderXmlWizardPage.java deleted file mode 100644 index 5eb23fc72e..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/wizards/gen/BuilderXmlWizardPage.java +++ /dev/null @@ -1,186 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2011 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.dbws.eclipselink.ui.internal.wizards.gen; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.jdt.core.IJavaElement; -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.wizard.IWizardPage; -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.jpt.common.ui.internal.wizards.JavaProjectWizardPage; -import org.eclipse.jpt.dbws.eclipselink.ui.internal.JptDbwsUiMessages; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.wst.common.uriresolver.internal.util.URIHelper; - -/** - * BuilderXmlWizardPage - */ -public class BuilderXmlWizardPage extends WizardPage { - - private final IStructuredSelection initialSelection; - private IProject targetProject; - - protected SelectFileOrXMLCatalogIdPanel selectSourcePanel; - - protected static final String[] browseXMLFilterExtensions = {".xml"}; //$NON-NLS-1$ - - // ********** static method ********** - - public static IFile getBuilderXmlFromSelection(IStructuredSelection selection) { - Object firstElement = selection.getFirstElement(); - if(firstElement instanceof IFile) { - String elementExtension = ((IFile)firstElement).getFileExtension(); - if(elementExtension != null) { - if(browseXMLFilterExtensions[0].endsWith(elementExtension)) { - return ((IFile)firstElement); - } - } - } - return null; - } - - // ********** constructor ********** - - BuilderXmlWizardPage(IStructuredSelection selection) { - super("BuilderXmlWizardPage"); //$NON-NLS-1$ - - this.initialSelection = selection; - } - - // ********** IDialogPage implementation ********** - - public void createControl(Composite parent) { - Composite composite = new Composite(parent, SWT.NONE); -// PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, HELP_CONTEXT_ID); - composite.setLayout(new GridLayout()); - composite.setLayoutData(new GridData(GridData.FILL_BOTH)); - this.setControl(composite); - - this.selectSourcePanel = new SelectFileOrXMLCatalogIdPanel(composite, this.initialSelection); - this.selectSourcePanel.setLayoutData(new GridData(GridData.FILL_BOTH)); - - SelectFileOrXMLCatalogIdPanel.PanelListener listener = new SelectFileOrXMLCatalogIdPanel.PanelListener() { - public void completionStateChanged() { - selectFileOrXMLCatalogIdPanelChanged(); - } - }; - this.selectSourcePanel.setListener(listener); - Dialog.applyDialogFont(parent); - } - - @Override - public void setVisible(boolean visible) { - super.setVisible(visible); - if(visible) { - - if(this.getBuilderXml() != null) { - this.selectSourcePanel.setSingleFileViewDefaultSelection(new StructuredSelection(this.getBuilderXml())); - } - else { - this.updateTargetProject(); - IFile schema = getBuilderXmlFromSelection(this.initialSelection); - if(schema != null) { - this.selectSourcePanel.setSingleFileViewDefaultSelection(new StructuredSelection(schema)); - } - else { - this.selectSourcePanel.setSingleFileViewDefaultSelection(new StructuredSelection(this.targetProject)); - } - } - this.selectSourcePanel.update(); - - this.setTitle(JptDbwsUiMessages.BuilderXmlWizardPage_title); - this.setDescription(JptDbwsUiMessages.BuilderXmlWizardPage_desc); - this.selectSourcePanel.setFilterExtensions(browseXMLFilterExtensions); - } - this.selectSourcePanel.setVisibleHelper(visible); - } - - // ********** IWizardPage implementation ********** - - @Override - public boolean isPageComplete() { - - return this.schemaOrUriSelected() && (this.getErrorMessage() == null); - } - - // ********** intra-wizard methods ********** - - public IFile getBuilderXml() { - return this.selectSourcePanel.getFile(); - } - - public String getSourceURI() { - String uri = this.selectSourcePanel.getXMLCatalogURI(); - if(uri == null) { - IFile file = this.selectSourcePanel.getFile(); - if(file != null) { - uri = URIHelper.getPlatformURI(file); - } - } - return uri; - } - - // ********** internal methods ********** - - private void updateTargetProject() { - IWizardPage previousPage = this.getPreviousPage(); - - if(previousPage instanceof JavaProjectWizardPage) { - // get project from previousPage - this.targetProject = (((JavaProjectWizardPage)previousPage).getJavaProject()).getProject(); - } - else if(initialSelection != null && ! this.initialSelection.isEmpty()) { - // no previousPage - get project from initialSelection - this.targetProject = this.getProjectFromInitialSelection(); - } - } - - private IProject getProjectFromInitialSelection() { - Object firstElement = initialSelection.getFirstElement(); - if(firstElement instanceof IProject) { - return (IProject)firstElement; - } - else if(firstElement instanceof IResource) { - return ((IResource) firstElement).getProject(); - } - else if(firstElement instanceof IJavaElement) { - return ((IJavaElement)firstElement).getJavaProject().getProject(); - } - return null; - } - - private boolean schemaOrUriSelected() { - return ((this.getBuilderXml() != null) || (this.getSourceURI() != null)); - } - - private String computeErrorMessage() { - String errorMessage = null; - String uri = this.getSourceURI(); - if(uri != null) { - if( ! URIHelper.isReadableURI(uri, false)) { - errorMessage = JptDbwsUiMessages.BuilderXmlWizardPage_errorUriCannotBeLocated; - } - } - return errorMessage; - } - - private void selectFileOrXMLCatalogIdPanelChanged() { - String errorMessage = this.computeErrorMessage(); - this.setErrorMessage(errorMessage); - this.setPageComplete(this.isPageComplete()); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/wizards/gen/DbwsGeneratorWizard.java b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/wizards/gen/DbwsGeneratorWizard.java deleted file mode 100644 index a0c798a854..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/wizards/gen/DbwsGeneratorWizard.java +++ /dev/null @@ -1,216 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2010, 2011 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.dbws.eclipselink.ui.internal.wizards.gen; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.WorkspaceJob; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IPath; -import org.eclipse.jdt.core.IJavaElement; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jface.dialogs.IDialogSettings; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.wizard.Wizard; -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.jpt.dbws.eclipselink.ui.JptDbwsUiPlugin; -import org.eclipse.jpt.dbws.eclipselink.ui.internal.DbwsGeneratorUi; -import org.eclipse.jpt.dbws.eclipselink.ui.internal.JptDbwsUiIcons; -import org.eclipse.jpt.dbws.eclipselink.ui.internal.JptDbwsUiMessages; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchWizard; - -/** - * DbwsGeneratorWizard - */ -public class DbwsGeneratorWizard extends Wizard implements IWorkbenchWizard { - - private IJavaProject javaProject; - private String builderXmlFile; - private IStructuredSelection selection; - - private WebDynamicProjectWizardPage projectWizardPage; - private BuilderXmlWizardPage builderXmlWizardPage; - - // Dialog store id constant - private static final String WIZARD_NAME = DbwsGeneratorWizard.class.getName(); - private static final String DBWS_SECTION_NAME = "DbwsSettings"; //$NON-NLS-1$ - - private JdbcDriverWizardPage jdbcDriversPage; - - // ********** constructor ********** - - public DbwsGeneratorWizard() { - super(); - - this.initialize(); - } - - public DbwsGeneratorWizard(IJavaProject javaProject, String builderXmlFile) { - super(); - - this.javaProject = javaProject; - this.builderXmlFile = builderXmlFile; - - this.initialize(); - } - - private void initialize() { - if(this.getDialogSettings() == null) { - IDialogSettings dbwsSettings = JptDbwsUiPlugin.instance().getDialogSettings(); - IDialogSettings wizardSettings = dbwsSettings.getSection(DBWS_SECTION_NAME); - if(wizardSettings == null) { - wizardSettings = dbwsSettings.addNewSection(DBWS_SECTION_NAME); - } - this.setDialogSettings(wizardSettings); - } - } - - // ********** IWorkbenchWizard implementation ********** - - public void init(IWorkbench workbench, IStructuredSelection selection) { - this.selection = selection; - - this.setWindowTitle(JptDbwsUiMessages.DbwsGeneratorWizard_title); - - this.setDefaultPageImageDescriptor(JptDbwsUiPlugin.getImageDescriptor(JptDbwsUiIcons.DBWS_GEN_WIZ_BANNER)); - this.setNeedsProgressMonitor(true); - } - - // ********** IWizard implementation ********** - - @Override - public void addPages() { - super.addPages(); - - if(this.selection != null) { - // WebDynamicProjectWizardPage - this.javaProject = this.getJavaProjectFromSelection(this.selection); - - this.projectWizardPage = this.buildWebDynamicProjectPage(this.javaProject); - this.addPage(this.projectWizardPage); - - // BuilderXmlWizardPage - IFile builderXmlSelected = BuilderXmlWizardPage.getBuilderXmlFromSelection(this.selection); - if(builderXmlSelected == null) { - this.builderXmlWizardPage = this.buildBuilderXmlPage(this.selection); - this.addPage(this.builderXmlWizardPage); - } - else { - this.builderXmlFile = this.makeRelativeToProjectPath(builderXmlSelected.getFullPath()); - } - } - // JdbcDriverWizardPage - this.jdbcDriversPage = this.buildJdbcDriversPage(); - this.addPage(this.jdbcDriversPage); - } - - @Override - public boolean performFinish() { - - WizardPage currentPage = (WizardPage)getContainer().getCurrentPage(); - if(currentPage != null) { - if( ! currentPage.isPageComplete()) { - return false; - } - } - - String driverJarList = this.jdbcDriversPage.getDriverJarList(); - this.jdbcDriversPage.finish(); // persist settings - - if(DbwsGeneratorUi.displayOverridingWebContentWarning(this.getShell())) { - this.generateDbws(driverJarList); - } - return true; - } - - // ********** intra-wizard methods ********** - - public IJavaProject getJavaProject() { - if(this.projectWizardPage != null) { - this.javaProject = this.projectWizardPage.getJavaProject(); - } - return this.javaProject; - } - - public String getBuilderXmlPathOrUri() { - if(this.builderXmlWizardPage != null) { - IFile xmlFile = this.builderXmlWizardPage.getBuilderXml(); - if(xmlFile != null) { - return this.makeRelativeToProjectPath(xmlFile.getFullPath()); - } - else { - return this.builderXmlWizardPage.getSourceURI(); - } - } - return this.builderXmlFile; - } - - // ********** internal methods ********** - - private WebDynamicProjectWizardPage buildWebDynamicProjectPage(IJavaProject javaProject) { - - WebDynamicProjectWizardPage projectWizardPage = new WebDynamicProjectWizardPage(javaProject); - projectWizardPage.setTitle(JptDbwsUiMessages.WebDynamicProjectWizardPage_title); - projectWizardPage.setDescription(JptDbwsUiMessages.WebDynamicProjectWizardPage_desc); - projectWizardPage.setDestinationLabel(JptDbwsUiMessages.WebDynamicProjectWizardPage_destinationProject); - - return projectWizardPage; - } - - private BuilderXmlWizardPage buildBuilderXmlPage(IStructuredSelection selection) { - return new BuilderXmlWizardPage(selection); - } - - private JdbcDriverWizardPage buildJdbcDriversPage() { - return new JdbcDriverWizardPage(WIZARD_NAME); - } - - private String makeRelativeToProjectPath(IPath path) { - IPath relativePath = path.makeRelativeTo(this.getJavaProject().getProject().getFullPath()); - return relativePath.toOSString(); - } - - private void generateDbws(String driverJarList) { - - String stageDirName = this.getJavaProject().getProject().getLocation().toOSString(); - - WorkspaceJob generateJob = new DbwsGeneratorUi.GenerateDbwsJob( - this.getJavaProject(), - this.getBuilderXmlPathOrUri(), - stageDirName, - driverJarList - ); - generateJob.schedule(); - } - - private IJavaProject getJavaProjectFromSelection(IStructuredSelection selection) { - if(selection == null) { - return null; - } - Object firstElement = selection.getFirstElement(); - if(firstElement instanceof IJavaProject) { - return (IJavaProject)firstElement; - } - else if(firstElement instanceof IResource) { - IProject project = ((IResource) firstElement).getProject(); - return getJavaProjectFrom(project); - } - else if(firstElement instanceof IJavaElement) { - return ((IJavaElement)firstElement).getJavaProject(); - } - return null; - } - - private IJavaProject getJavaProjectFrom(IProject project) { - return (IJavaProject)((IJavaElement)((IAdaptable)project).getAdapter(IJavaElement.class)); - } -} 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 deleted file mode 100644 index 8f5c9d1f07..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/wizards/gen/JdbcDriverWizardPage.java +++ /dev/null @@ -1,355 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2010, 2011 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.dbws.eclipselink.ui.internal.wizards.gen; - -import java.io.File; -import java.util.ArrayList; -import java.util.Collection; - -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jface.dialogs.IDialogSettings; -import org.eclipse.jface.viewers.ColumnWeightData; -import org.eclipse.jface.viewers.IBaseLabelProvider; -import org.eclipse.jface.viewers.IContentProvider; -import org.eclipse.jface.viewers.IStructuredContentProvider; -import org.eclipse.jface.viewers.ITableLabelProvider; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.StructuredSelection; -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.util.TableLayoutComposite; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.dbws.eclipselink.ui.JptDbwsUiPlugin; -import org.eclipse.jpt.dbws.eclipselink.ui.internal.JptDbwsUiIcons; -import org.eclipse.jpt.dbws.eclipselink.ui.internal.JptDbwsUiMessages; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.FileDialog; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.TableColumn; - -/** - * JdbcDriversWizardPage - */ -public class JdbcDriverWizardPage extends WizardPage -{ - private final String storedDriverClasspathId; - private ArrayList<String> jarPaths; - - public static String BINDINGS_FILE_FILTER = "*.jar;*.zip"; //$NON-NLS-1$ - // dialog store id constants - private static final String PAGE_ID = "DRIVER_CLASSPATH_ID"; //$NON-NLS-1$ - private static final String PATH_SEPARATOR = System.getProperty("path.separator"); //$NON-NLS-1$ - - // ********** constructor ********** - - protected JdbcDriverWizardPage(String wizardName) { - super("Jdbc Driver"); //$NON-NLS-1$ - - this.initialize(); - - this.jarPaths = new ArrayList<String>(); - this.storedDriverClasspathId = wizardName + "." + PAGE_ID; //$NON-NLS-1$ - } - - protected void initialize() { - this.setTitle(JptDbwsUiMessages.JdbcDriverWizardPage_title); - this.setDescription(JptDbwsUiMessages.JdbcDriverWizardPage_desc); - this.setImageDescriptor(JptDbwsUiPlugin.getImageDescriptor(JptDbwsUiIcons.DBWS_GEN_WIZ_BANNER)); - } - - // ********** intra-wizard methods ********** - - public void finish() { - this.saveWidgetValues(); - } - - public String getDriverJarList() { - return this.buildDriverJarListString(); - } - - // ********** internal methods ********** - - /** - * Initializes the JAR package from last used wizard page values. - */ - private void initializeJarPaths() { - IDialogSettings settings= this.getDialogSettings(); - if(settings != null) { - // destination - String[] driverPaths = settings.getArray(this.storedDriverClasspathId); - if(driverPaths == null) { - return; // ie.- no settings stored - } - this.jarPaths = new ArrayList<String>(); - - CollectionTools.addAll(this.jarPaths, driverPaths); - } - } - - private void saveWidgetValues() { - IDialogSettings settings= this.getDialogSettings(); - - if(settings != null) { - String[] driverPaths = this.jarPaths.toArray(new String[0]); - settings.put(this.storedDriverClasspathId, driverPaths); - } - } - - private String buildDriverJarListString() { - if(this.jarPaths.isEmpty()) { - return StringTools.EMPTY_STRING; - } - StringBuffer result = new StringBuffer(); - for(String jar : this.jarPaths) { - result.append(jar).append(PATH_SEPARATOR); - } - result.deleteCharAt(result.length() - 1); // remove last separator - return result.toString(); - } - - // ********** UI components ********** - - public void createControl(Composite parent) { - this.initializeJarPaths(); - this.setPageComplete(true); - this.setControl(this.buildTopLevelControl(parent)); - } - - private Control buildTopLevelControl(Composite parent) { - Composite composite = new Composite(parent, SWT.NULL); - composite.setLayout(new GridLayout()); - - new JarsGroup(composite); - - return composite; - } - - // ********** private methods ********** - - private void removeJarFile(String filePath) { - this.jarPaths.remove(filePath); - } - - private void addJarFile(String filePath) { - if( ! this.jarPaths.contains(filePath)) { - this.jarPaths.add(filePath); - } - } - - // ********** JarsGroup class ********** - - private class JarsGroup { - - - // ********** constructor ********** - - private JarsGroup(Composite parent) { - super(); - Composite composite = new Composite(parent, SWT.NONE); - GridLayout layout = new GridLayout(2, false); //must be 4 for the package controls - layout.marginHeight = 0; - layout.marginWidth = 0; - composite.setLayout(layout); - composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - // TODO PlatformUI.getWorkbench().getHelpSystem().setHelp(this.group, HELP_CONTEXT_ID); - - this.buildLabel(composite, 2, JptDbwsUiMessages.JdbcDriverWizardPage_driverFiles); - - this.buildDriverFilesTable(composite); - } - - // ********** intra-wizard methods ********** - - public IJavaProject getJavaProject() { - IWizard wizard = getWizard(); - - if( ! (wizard instanceof DbwsGeneratorWizard)) { - throw new NullPointerException(); - } - return ((DbwsGeneratorWizard)wizard).getJavaProject(); - } - - private ArrayList<String> getJarPaths() { - return jarPaths; - } - - // ********** private methods ********** - - private TableViewer buildDriverFilesTable(Composite parent) { - - TableViewer tableViewer = this.buildTableViewer(parent, this.getJarPaths()); - - this.buildAddRemoveButtons(parent, tableViewer); - return tableViewer; - } - - private TableViewer buildTableViewer(Composite parent, ArrayList<String> tableDataModel) { - - TableLayoutComposite tableLayout = new TableLayoutComposite(parent, SWT.NONE); - this.addColumnsData(tableLayout); - - final Table table = new Table(tableLayout, SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE | SWT.FULL_SELECTION | SWT.BORDER); - table.setLinesVisible(false); - - TableColumn column = new TableColumn(table, SWT.NONE, 0); - column.setResizable(true); - - GridData gridData= new GridData(GridData.FILL_BOTH); - gridData.horizontalSpan = 1; - gridData.heightHint= SWTUtil.getTableHeightHint(table, 7); - tableLayout.setLayoutData(gridData); - - TableViewer tableViewer = new TableViewer(table); - tableViewer.setUseHashlookup(true); - tableViewer.setLabelProvider(this.buildLabelProvider()); - tableViewer.setContentProvider(this.buildContentProvider()); - - tableViewer.setInput(tableDataModel); - tableViewer.refresh(); - return tableViewer; - } - - private void buildAddRemoveButtons(Composite parent, final TableViewer tableViewer) { - - Composite buttonComposite = new Composite(parent, SWT.NULL); - GridLayout buttonLayout = new GridLayout(1, false); - buttonComposite.setLayout(buttonLayout); - GridData gridData = new GridData(); - gridData.horizontalAlignment = GridData.FILL; - gridData.verticalAlignment = GridData.BEGINNING; - buttonComposite.setLayoutData(gridData); - // Add buttons - Button addButton = new Button(buttonComposite, SWT.PUSH); - addButton.setText(JptDbwsUiMessages.JdbcDriverWizardPage_addButton); - gridData = new GridData(); - gridData.horizontalAlignment = GridData.FILL; - gridData.grabExcessHorizontalSpace= true; - addButton.setLayoutData(gridData); - addButton.addSelectionListener(new SelectionListener() { - public void widgetDefaultSelected(SelectionEvent e) {} - - public void widgetSelected(SelectionEvent e) { - - ArrayList<String> jarFiles = promptJarFiles(); - for(String jarFile : jarFiles) { - addJarFile(jarFile); - } - tableViewer.refresh(); - } - }); - // Remove buttons - Button removeButton = new Button(buttonComposite, SWT.PUSH); - removeButton.setText(JptDbwsUiMessages.JdbcDriverWizardPage_removeButton); - gridData = new GridData(); - gridData.horizontalAlignment = GridData.FILL; - gridData.grabExcessHorizontalSpace= true; - removeButton.setLayoutData(gridData); - removeButton.addSelectionListener(new SelectionListener() { - public void widgetDefaultSelected(SelectionEvent e) {} - - public void widgetSelected(SelectionEvent e) { - StructuredSelection selection = (StructuredSelection)tableViewer.getSelection(); - if(selection.isEmpty()) { - return; - } - String jarFile = (String)selection.getFirstElement(); - removeJarFile(jarFile); - - tableViewer.refresh(); - } - }); - addButton.setFocus(); - } - - private IBaseLabelProvider buildLabelProvider() { - return new TableLabelProvider(); - } - - private IContentProvider buildContentProvider() { - return new TableContentProvider(); - } - - private ArrayList<String> promptJarFiles() { - String projectPath= this.getJavaProject().getProject().getLocation().toString(); - - FileDialog dialog = new FileDialog(getShell(), SWT.MULTI); - dialog.setText(JptDbwsUiMessages.JdbcDriverWizardPage_chooseADriverFile); - dialog.setFilterPath(projectPath); - dialog.setFilterExtensions(new String[] {BINDINGS_FILE_FILTER}); - - dialog.open(); - String path = dialog.getFilterPath(); - String[] fileNames = dialog.getFileNames(); - ArrayList<String> results = new ArrayList<String>(fileNames.length); - for(String fileName : fileNames) { - results.add(path + File.separator + fileName); - } - return results; - } - - private void addColumnsData(TableLayoutComposite layout) { - layout.addColumnData(new ColumnWeightData(50, true)); - } - - /** - * Build and return a label - */ - private Label buildLabel(Composite parent, int span, String text) { - Label label = new Label(parent, SWT.NONE); - label.setText(text); - GridData gd = new GridData(); - gd.horizontalSpan = span; - label.setLayoutData(gd); - return label; - } - - // ********** inner class ********** - - private class TableLabelProvider extends LabelProvider implements ITableLabelProvider { - - public Image getColumnImage(Object element, int columnIndex) { - return null; - } - - public String getColumnText(Object element, int columnIndex) { - return (String)element; - } - } - - private class TableContentProvider implements IStructuredContentProvider { - - TableContentProvider() { - super(); - } - - public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {} - - public void dispose() {} - - public Object[] getElements(Object inputElement) { - return ((Collection<?>) inputElement).toArray(); - } - } - } - -}
\ No newline at end of file diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/wizards/gen/SelectFileOrXMLCatalogIdPanel.java b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/wizards/gen/SelectFileOrXMLCatalogIdPanel.java deleted file mode 100644 index 7f36cc306f..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/wizards/gen/SelectFileOrXMLCatalogIdPanel.java +++ /dev/null @@ -1,142 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * Code originate from org.eclipse.wst.xml.ui.internal.dialogs - *******************************************************************************/ -package org.eclipse.jpt.dbws.eclipselink.ui.internal.wizards.gen; - -import org.eclipse.core.resources.IFile; -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jpt.dbws.eclipselink.ui.JptDbwsUiPlugin; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.ui.part.PageBook; -import org.eclipse.wst.xml.core.internal.catalog.provisional.ICatalog; - - -public class SelectFileOrXMLCatalogIdPanel extends Composite implements SelectionListener { - - public interface PanelListener { - void completionStateChanged(); - } - - protected PanelListener listener; - protected PageBook pageBook; - - protected SelectFilePanel selectFilePanel; - protected SelectXMLCatalogIdPanel selectXMLCatalogIdPanel; - - // ********** constructor ********** - - public SelectFileOrXMLCatalogIdPanel(Composite parent, IStructuredSelection selection) { - super(parent, SWT.NONE); - - // container group - setLayout(new GridLayout()); - GridData gd = new GridData(GridData.FILL_BOTH); - gd.heightHint = 400; - gd.widthHint = 400; - setLayoutData(gd); - - pageBook = new PageBook(this, SWT.NONE); - pageBook.setLayoutData(new GridData(GridData.FILL_BOTH)); - - selectFilePanel = new SelectFilePanel(pageBook, selection); - this.setSingleFileViewDefaultSelection(selection); - - // Catalog - ICatalog xmlCatalog = JptDbwsUiPlugin.instance().getDefaultXMLCatalog(); - selectXMLCatalogIdPanel = new SelectXMLCatalogIdPanel(pageBook, xmlCatalog); - selectXMLCatalogIdPanel.getTableViewer().addSelectionChangedListener(new ISelectionChangedListener() { - public void selectionChanged(SelectionChangedEvent event) { - updateCompletionStateChange(); - } - }); - Dialog.applyDialogFont(parent); - pageBook.showPage(selectFilePanel.getControl()); - } - - public void setSingleFileViewDefaultSelection(ISelection selection) { - this.selectFilePanel.setDefaultSelection(selection); - } - - public IFile getFile() { - return selectFilePanel.getFile(); - } - - public String getXMLCatalogURI() { - return null; // XMLCatalog not supported - } - - public void setCatalogEntryType(int catalogEntryType) { - selectXMLCatalogIdPanel.setCatalogEntryType(catalogEntryType); - } - - public void setFilterExtensions(String[] filterExtensions) { - selectFilePanel.resetFilters(); - selectFilePanel.addFilterExtensions(filterExtensions); - - selectXMLCatalogIdPanel.getTableViewer().setFilterExtensions(filterExtensions); - } - - public void setListener(PanelListener listener) { - this.listener = listener; - } - - public void setVisibleHelper(boolean isVisible) { - selectFilePanel.setVisibleHelper(isVisible); - } - - public void updateCompletionStateChange() { - if (listener != null) { - listener.completionStateChanged(); - } - } - - public void widgetDefaultSelected(SelectionEvent e) { - } - - public void widgetSelected(SelectionEvent e) { - pageBook.showPage(selectFilePanel.getControl()); - - updateCompletionStateChange(); - } - - // ********** inner class ********** - - protected class SelectFilePanel extends SelectSingleFileViewFacade implements SelectSingleFileViewFacade.Listener { - protected Control control; - - public SelectFilePanel(Composite parent, IStructuredSelection selection) { - super(selection, true); - // String[] ext = {".dtd"}; - // addFilterExtensions(ext); - control = createControl(parent); - control.setLayoutData(new GridData(GridData.FILL_BOTH)); - SelectFilePanel.this.setListener(this); - } - - public Control getControl() { - return control; - } - - public void setControlComplete(boolean isComplete) { - updateCompletionStateChange(); - } - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/wizards/gen/SelectSingleFileViewFacade.java b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/wizards/gen/SelectSingleFileViewFacade.java deleted file mode 100644 index c5363d54e6..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/wizards/gen/SelectSingleFileViewFacade.java +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2010 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.dbws.eclipselink.ui.internal.wizards.gen; - -import org.eclipse.core.resources.IFile; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.swt.widgets.Composite; - -/** - * SelectSingleFileView - * - * Façade class to change accessibility of SelectSingleFileView. - */ -@SuppressWarnings("restriction") -public class SelectSingleFileViewFacade extends org.eclipse.wst.common.ui.internal.viewers.SelectSingleFileView { - - public static interface Listener extends org.eclipse.wst.common.ui.internal.viewers.SelectSingleFileView.Listener - {} - - public SelectSingleFileViewFacade(IStructuredSelection selection, boolean isFileMandatory) { - super(selection, isFileMandatory); - } - - public void addFilterExtensions(String[] filterExtensions) { - super.addFilterExtensions(filterExtensions); - } - - public Composite createControl(Composite parent) { - return super.createControl(parent); - } - - public IFile getFile() { - return super.getFile(); - } - - public void resetFilters() { - super.resetFilters(); - } - - public void setVisibleHelper(boolean isVisible) { - super.setVisibleHelper(isVisible); - } - - public void setDefaultSelection(ISelection selection) { - super.setDefaultSelection(selection); - } - - public void setListener(Listener listener) { - super.setListener(listener); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/wizards/gen/SelectXMLCatalogIdPanel.java b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/wizards/gen/SelectXMLCatalogIdPanel.java deleted file mode 100644 index 3e1ec46a64..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/wizards/gen/SelectXMLCatalogIdPanel.java +++ /dev/null @@ -1,146 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * Code originate from org.eclipse.wst.xml.ui.internal.dialogs - *******************************************************************************/ -package org.eclipse.jpt.dbws.eclipselink.ui.internal.wizards.gen; - -import java.util.Collection; -import java.util.List; -import java.util.Vector; - -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jpt.dbws.eclipselink.ui.JptDbwsUiPlugin; -import org.eclipse.jpt.dbws.eclipselink.ui.internal.JptDbwsUiMessages; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; -import org.eclipse.wst.xml.core.internal.catalog.provisional.ICatalog; -import org.eclipse.wst.xml.core.internal.catalog.provisional.ICatalogEntry; -import org.eclipse.wst.xml.core.internal.catalog.provisional.INextCatalog; - - -public class SelectXMLCatalogIdPanel extends Composite { - protected int catalogEntryType; - protected boolean doTableSizeHack = false; - - protected XMLCatalogTableViewer tableViewer; - protected ICatalog fXmlCatalog; - - public SelectXMLCatalogIdPanel(Composite parent, ICatalog xmlCatalog) { - super(parent, SWT.NONE); - this.fXmlCatalog = xmlCatalog; - - GridLayout gridLayout = new GridLayout(); - this.setLayout(gridLayout); - GridData gd = new GridData(GridData.FILL_BOTH); - gd.heightHint = 200; - gd.widthHint = 700; - this.setLayoutData(gd); - - Label label = new Label(this, SWT.NONE); - label.setText(JptDbwsUiMessages.BuilderXmlWizardPage_xmlCatalogTableTitle); - - tableViewer = createTableViewer(this); - tableViewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); - tableViewer.setInput("dummy"); //$NON-NLS-1$ - } - - protected XMLCatalogTableViewer createTableViewer(Composite parent) { - String headings[] = new String[2]; - headings[0] = JptDbwsUiMessages.BuilderXmlWizardPage_xmlCatalogKeyColumn; - headings[1] = JptDbwsUiMessages.BuilderXmlWizardPage_xmlCatalogUriColumn; - - XMLCatalogTableViewer theTableViewer = new XMLCatalogTableViewer(parent, headings) { - - protected void addXMLCatalogEntries(List list, ICatalogEntry[] entries) { - for (int i = 0; i < entries.length; i++) { - ICatalogEntry entry = entries[i]; - if (catalogEntryType == 0) { - list.add(entry); - } - else if (catalogEntryType == entry.getEntryType()) { - list.add(entry); - } - } - } - - public Collection getXMLCatalogEntries() { - List result = null; - - if ((fXmlCatalog == null) || doTableSizeHack) { - // this lets us create a table with an initial height of - // 10 rows - // otherwise we get stuck with 0 row heigh table... that's - // too small - doTableSizeHack = false; - result = new Vector(); - for (int i = 0; i < 6; i++) { - result.add(""); //$NON-NLS-1$ - } - } - else { - result = new Vector(); - INextCatalog[] nextCatalogs = fXmlCatalog.getNextCatalogs(); - for (int i = 0; i < nextCatalogs.length; i++) { - INextCatalog catalog = nextCatalogs[i]; - ICatalog referencedCatalog = catalog.getReferencedCatalog(); - if (referencedCatalog != null) { - if (JptDbwsUiPlugin.SYSTEM_CATALOG_ID.equals(referencedCatalog.getId())) { - ICatalog systemCatalog = referencedCatalog; - addXMLCatalogEntries(result, systemCatalog.getCatalogEntries()); - - } - else if (JptDbwsUiPlugin.USER_CATALOG_ID.equals(referencedCatalog.getId())) { - ICatalog userCatalog = referencedCatalog; - addXMLCatalogEntries(result, userCatalog.getCatalogEntries()); - - } - } - } - } - return result; - } - }; - return theTableViewer; - } - - - public String getId() { - ICatalogEntry entry = getXMLCatalogEntry(); - return entry != null ? entry.getKey() : null; - } - - public XMLCatalogTableViewer getTableViewer() { - return tableViewer; - } - - public String getURI() { - ICatalogEntry entry = getXMLCatalogEntry(); - return entry != null ? entry.getURI() : null; - } - - public ICatalogEntry getXMLCatalogEntry() { - ICatalogEntry result = null; - ISelection selection = tableViewer.getSelection(); - Object selectedObject = (selection instanceof IStructuredSelection) ? ((IStructuredSelection) selection).getFirstElement() : null; - if (selectedObject instanceof ICatalogEntry) { - result = (ICatalogEntry) selectedObject; - } - return result; - } - - public void setCatalogEntryType(int catalogEntryType) { - this.catalogEntryType = catalogEntryType; - tableViewer.refresh(); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/wizards/gen/WebDynamicProjectWizardPage.java b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/wizards/gen/WebDynamicProjectWizardPage.java deleted file mode 100644 index 0e32bfda55..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/wizards/gen/WebDynamicProjectWizardPage.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2011 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.dbws.eclipselink.ui.internal.wizards.gen; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jpt.common.ui.internal.wizards.JavaProjectWizardPage; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable; -import org.eclipse.jpt.dbws.eclipselink.ui.internal.DbwsGeneratorUi; - -/** - * WebDynamicProjectWizardPage - */ -public class WebDynamicProjectWizardPage extends JavaProjectWizardPage { - - public WebDynamicProjectWizardPage(IJavaProject javaProject) { - super(javaProject); - } - - @Override - protected Iterable<IProject> getJavaProjects() { - return new FilteringIterable<IProject>(CollectionTools.collection(this.getProjects())) { - @Override - protected boolean accept(IProject next) { - return DbwsGeneratorUi.projectIsWebDynamic(next); - } - }; - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/wizards/gen/XMLCatalogTableViewer.java b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/wizards/gen/XMLCatalogTableViewer.java deleted file mode 100644 index c556561adf..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/wizards/gen/XMLCatalogTableViewer.java +++ /dev/null @@ -1,195 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * Code originate from org.eclipse.wst.xml.ui.internal.dialogs - *******************************************************************************/ -package org.eclipse.jpt.dbws.eclipselink.ui.internal.wizards.gen; - -import java.util.Arrays; -import java.util.Collection; -import java.util.Comparator; - -import org.eclipse.jface.action.Action; -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.viewers.ColumnWeightData; -import org.eclipse.jface.viewers.IStructuredContentProvider; -import org.eclipse.jface.viewers.ITableLabelProvider; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.TableLayout; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerFilter; -import org.eclipse.jpt.dbws.eclipselink.ui.JptDbwsUiPlugin; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.TableColumn; -import org.eclipse.wst.common.uriresolver.internal.util.URIHelper; -import org.eclipse.wst.xml.core.internal.catalog.provisional.ICatalogEntry; - -import com.ibm.icu.text.Collator; - -public class XMLCatalogTableViewer extends TableViewer { - - protected static String ERROR_STATE_KEY = "errorstatekey"; //$NON-NLS-1$ - - protected static Image dtdFileImage = JptDbwsUiPlugin.getImage("icons/full/obj16/dtdfile.gif"); //$NON-NLS-1$ - protected static Image unknownFileImage = JptDbwsUiPlugin.getImage("icons/full/obj16/text.gif"); //$NON-NLS-1$ - protected static Image xsdFileImage = JptDbwsUiPlugin.getImage("icons/full/obj16/XSDFile.gif"); //$NON-NLS-1$ - protected static Image errorImage = JptDbwsUiPlugin.getImage("icons/full/ovr16/error_ovr.gif"); //$NON-NLS-1$ - - // ********** constructor ********** - - public XMLCatalogTableViewer(Composite parent, String[] columnProperties) { - super(parent, SWT.FULL_SELECTION); - - Table table = getTable(); - table.setLinesVisible(true); - table.setHeaderVisible(true); - table.setLinesVisible(true); - - TableLayout layout = new TableLayout(); - for (int i = 0; i < columnProperties.length; i++) { - TableColumn column = new TableColumn(table, i); - column.setText(columnProperties[i]); - column.setAlignment(SWT.LEFT); - layout.addColumnData(new ColumnWeightData(50, true)); - } - table.setLayout(layout); - table.setLinesVisible(false); - - setColumnProperties(columnProperties); - - setContentProvider(new CatalogEntryContentProvider()); - setLabelProvider(new CatalogEntryLabelProvider()); - } - - public Collection getXMLCatalogEntries() { - return null; - } - - public void menuAboutToShow(IMenuManager menuManager) { - Action action = new Action("hello") { //$NON-NLS-1$ - public void run() { - System.out.println("run!"); //$NON-NLS-1$ - } - }; - menuManager.add(action); - } - - public void setFilterExtensions(String[] extensions) { - resetFilters(); - addFilter(new XMLCatalogTableViewerFilter(extensions)); - } - - // ********** inner class ********** - - public class CatalogEntryContentProvider implements IStructuredContentProvider { - - public void dispose() { - } - - public Object[] getElements(Object element) { - Object[] array = getXMLCatalogEntries().toArray(); - Comparator comparator = new Comparator() { - public int compare(Object o1, Object o2) { - int result = 0; - if ((o1 instanceof ICatalogEntry) && (o2 instanceof ICatalogEntry)) { - ICatalogEntry mappingInfo1 = (ICatalogEntry) o1; - ICatalogEntry mappingInfo2 = (ICatalogEntry) o2; - result = Collator.getInstance().compare(mappingInfo1.getKey(), mappingInfo2.getKey()); - } - return result; - } - }; - Arrays.sort(array, comparator); - return array; - } - - public void inputChanged(Viewer viewer, Object old, Object newobj) { - } - - public boolean isDeleted(Object object) { - return false; - } - } - - public class CatalogEntryLabelProvider extends LabelProvider implements ITableLabelProvider { - - public Image getColumnImage(Object object, int columnIndex) { - Image result = null; - if (columnIndex == 0) { - Image base = null; - if (object instanceof ICatalogEntry) { - ICatalogEntry catalogEntry = (ICatalogEntry) object; - String uri = catalogEntry.getURI(); - if (uri.endsWith("dtd")) { //$NON-NLS-1$ - base = dtdFileImage; - } - else if (uri.endsWith("xsd")) { //$NON-NLS-1$ - base = xsdFileImage; - } - else { - base = unknownFileImage; - } - - if (base != null) { - if (URIHelper.isReadableURI(uri, false)) { - result = base; - } - else { - // TODO... SSE port - result = base;// imageFactory.createCompositeImage(base, - // errorImage, - // ImageFactory.BOTTOM_LEFT); - } - } - } - } - return result; - } - - public String getColumnText(Object object, int columnIndex) { - String result = null; - if (object instanceof ICatalogEntry) { - ICatalogEntry catalogEntry = (ICatalogEntry) object; - result = columnIndex == 0 ? catalogEntry.getKey() : catalogEntry.getURI(); - result = URIHelper.removePlatformResourceProtocol(result); - } - return result != null ? result : ""; //$NON-NLS-1$ - } - } - - class XMLCatalogTableViewerFilter extends ViewerFilter { - protected String[] extensions; - - public XMLCatalogTableViewerFilter(String[] extensions) { - this.extensions = extensions; - } - - public boolean isFilterProperty(Object element, Object property) { - return false; - } - - public boolean select(Viewer viewer, Object parent, Object element) { - boolean result = false; - if (element instanceof ICatalogEntry) { - ICatalogEntry catalogEntry = (ICatalogEntry) element; - for (int i = 0; i < extensions.length; i++) { - if (catalogEntry.getURI().endsWith(extensions[i])) { - result = true; - break; - } - } - } - return result; - } - } -} |