JBoss Tools SVN: r9920 - in trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui: src/org/jboss/tools/hibernate/jpt/ui/internal/platform and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: dgeraskov
Date: 2008-08-27 08:54:44 -0400 (Wed, 27 Aug 2008)
New Revision: 9920
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/META-INF/MANIFEST.MF
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/platform/HibernatePlatformUI.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateEntitiesWizard.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateInitWizardPage.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-2658
redundant dependencies removed
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/META-INF/MANIFEST.MF 2008-08-27 12:54:37 UTC (rev 9919)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/META-INF/MANIFEST.MF 2008-08-27 12:54:44 UTC (rev 9920)
@@ -4,30 +4,18 @@
Bundle-SymbolicName: org.jboss.tools.hibernate.jpt.ui;singleton:=true
Bundle-Version: 1.0.0
Bundle-Activator: org.jboss.tools.hibernate.jpt.ui.HibernateJptUIPlugin
-Require-Bundle: org.eclipse.ui,
- org.eclipse.core.runtime,
+Require-Bundle:
org.eclipse.jpt.ui,
org.eclipse.jpt.core;bundle-version="2.0.0",
- org.eclipse.jpt.eclipselink.core;bundle-version="1.0.0",
- org.eclipse.jpt.eclipselink.ui;bundle-version="1.0.0",
- org.eclipse.jpt.gen;bundle-version="1.1.0",
- org.eclipse.jpt.utility;bundle-version="1.2.0",
org.hibernate.eclipse.console;bundle-version="3.2.0",
org.hibernate.eclipse;bundle-version="3.2.0",
- org.eclipse.core.resources;bundle-version="3.4.0",
org.eclipse.debug.core;bundle-version="3.4.0",
org.eclipse.jdt.core;bundle-version="3.4.0",
- org.eclipse.jpt.db;bundle-version="1.1.1",
org.eclipse.jdt.ui;bundle-version="3.4.0",
- org.eclipse.jpt.db.ui;bundle-version="1.0.1",
org.eclipse.datatools.connectivity;bundle-version="1.1.0",
org.eclipse.jdt.launching;bundle-version="3.4.0",
org.eclipse.wst.common.project.facet.ui;bundle-version="1.3.0",
- org.eclipse.wst.web.ui;bundle-version="1.1.200",
- org.eclipse.wst.common.frameworks;bundle-version="1.1.200",
- org.eclipse.wst.common.emf;bundle-version="1.1.200",
- org.eclipse.wst.common.modulecore;bundle-version="1.1.200",
- org.eclipse.wst.common.frameworks.ui;bundle-version="1.1.200"
+ org.eclipse.wst.common.frameworks;bundle-version="1.1.200"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-Vendor: Hibernate Team
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/platform/HibernatePlatformUI.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/platform/HibernatePlatformUI.java 2008-08-27 12:54:37 UTC (rev 9919)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/platform/HibernatePlatformUI.java 2008-08-27 12:54:44 UTC (rev 9920)
@@ -11,28 +11,16 @@
package org.jboss.tools.hibernate.jpt.ui.internal.platform;
import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
-import org.eclipse.core.resources.WorkspaceJob;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationType;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.window.Window;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.jpt.core.JpaProject;
-import org.eclipse.jpt.db.Table;
-import org.eclipse.jpt.gen.internal.EntityGenerator;
-import org.eclipse.jpt.gen.internal.PackageGenerator;
import org.eclipse.jpt.ui.internal.platform.generic.GenericPlatformUi;
import org.hibernate.eclipse.launch.HibernateLaunchConstants;
import org.jboss.tools.hibernate.jpt.ui.HibernateJptUIPlugin;
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateEntitiesWizard.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateEntitiesWizard.java 2008-08-27 12:54:37 UTC (rev 9919)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateEntitiesWizard.java 2008-08-27 12:54:44 UTC (rev 9920)
@@ -10,26 +10,13 @@
******************************************************************************/
package org.jboss.tools.hibernate.jpt.ui.wizard;
-import java.util.Collection;
-import java.util.Collections;
-
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.core.ILaunchManager;
-import org.eclipse.jdt.core.IPackageFragment;
-import org.eclipse.jdt.core.IPackageFragmentRoot;
-import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.jpt.core.JpaProject;
-import org.eclipse.jpt.db.ConnectionProfile;
-import org.eclipse.jpt.db.Schema;
-import org.eclipse.jpt.db.Table;
-import org.eclipse.jpt.gen.internal.EntityGenerator;
-import org.eclipse.jpt.gen.internal.PackageGenerator;
import org.eclipse.jpt.ui.internal.JptUiMessages;
-import org.eclipse.jpt.ui.internal.wizards.DatabaseReconnectWizardPage;
-import org.eclipse.jpt.utility.internal.CollectionTools;
import org.hibernate.console.KnownConfigurations;
import org.hibernate.eclipse.launch.HibernateLaunchConstants;
import org.jboss.tools.hibernate.jpt.ui.HibernateJptUIPlugin;
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateInitWizardPage.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateInitWizardPage.java 2008-08-27 12:54:37 UTC (rev 9919)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateInitWizardPage.java 2008-08-27 12:54:44 UTC (rev 9920)
@@ -10,11 +10,9 @@
******************************************************************************/
package org.jboss.tools.hibernate.jpt.ui.wizard;
-import java.io.File;
-import java.net.URL;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;
@@ -23,7 +21,6 @@
import org.eclipse.datatools.connectivity.IConnectionProfile;
import org.eclipse.datatools.connectivity.ProfileManager;
import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationType;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.core.ILaunchManager;
@@ -35,10 +32,7 @@
import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.jpt.core.JpaProject;
-import org.eclipse.jpt.db.JptDbPlugin;
import org.eclipse.jpt.ui.internal.JptUiMessages;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.StringTools;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
@@ -52,14 +46,13 @@
import org.hibernate.cfg.Environment;
import org.hibernate.console.ConsoleConfiguration;
import org.hibernate.console.KnownConfigurations;
-import org.hibernate.console.preferences.ConsoleConfigurationPreferences;
import org.hibernate.console.preferences.ConsoleConfigurationPreferences.ConfigurationMode;
import org.hibernate.eclipse.console.HibernateConsoleMessages;
import org.hibernate.eclipse.launch.ICodeGenerationLaunchConstants;
import org.hibernate.eclipse.launch.IConsoleConfigurationLaunchConstants;
+import org.hibernate.tool.hbm2x.StringUtils;
import org.hibernate.util.StringHelper;
import org.jboss.tools.hibernate.jpt.ui.HibernateJptUIPlugin;
-import org.w3c.dom.Element;
/**
* @author Dmitry Geraskov
@@ -162,11 +155,10 @@
connectionProfileName = new ComboDialogField(SWT.READ_ONLY);
connectionProfileName.setLabelText(JptUiMessages.DatabaseReconnectWizardPage_connection);
- List<String> list = dtpConnectionProfileNames();
- connectionProfileName.setItems((String[]) list.toArray(new String[list.size()]));
+ connectionProfileName.setItems(dtpConnectionProfileNames());
String connectionName = getProjectConnectionProfileName();
- if (!StringTools.stringIsEmpty(connectionName)) {
+ if (!StringUtils.isEmpty(connectionName)) {
connectionProfileName.selectItem(connectionName);
}
connectionProfileName.doFillIntoGrid(dbGroup, numColumns);
@@ -206,21 +198,17 @@
setErrorMessage(null);
}
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.WizardPage#isPageComplete()
- */
- /*@Override
- public boolean isPageComplete() {
- return (selectMethod.getSelection() && (StringHelper.isNotEmpty(getConfigurationName())))
- ||(!selectMethod.getSelection() && (StringHelper.isNotEmpty(getConnectionProfileName())));
- }*/
-
- private List<String> dtpConnectionProfileNames() {
+ private String[] dtpConnectionProfileNames() {
List<String> list = new ArrayList<String>();
- for (Iterator<String> i = CollectionTools.sort(JptDbPlugin.instance().getConnectionProfileRepository().connectionProfileNames()); i.hasNext();) {
+ /*for (Iterator<String> i = CollectionTools.sort(JptDbPlugin.instance().getConnectionProfileRepository().connectionProfileNames()); i.hasNext();) {
list.add(i.next());
+ }*/
+ IConnectionProfile[] cps = ProfileManager.getInstance().getProfiles();
+ for (int i = 0; i < cps.length; i++) {
+ list.add(cps[i].getName());
}
- return list;
+ Collections.sort(list);
+ return (String[]) list.toArray(new String[list.size()]);
}
private String getProjectConnectionProfileName() {
16 years, 4 months
JBoss Tools SVN: r9919 - in trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core: src/org/jboss/tools/hibernate/jpt/core/internal/context and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: dgeraskov
Date: 2008-08-27 08:54:37 -0400 (Wed, 27 Aug 2008)
New Revision: 9919
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/META-INF/MANIFEST.MF
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/HibernatePersistenceUnit.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-2658
redundant dependencies removed
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/META-INF/MANIFEST.MF 2008-08-27 12:21:22 UTC (rev 9918)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/META-INF/MANIFEST.MF 2008-08-27 12:54:37 UTC (rev 9919)
@@ -7,12 +7,8 @@
org.eclipse.core.runtime,
org.eclipse.jpt.core,
org.eclipse.wst.validation,
- org.eclipse.core.resources,
- org.eclipse.emf.ecore,
org.eclipse.jpt.eclipselink.core;bundle-version="1.0.0",
- org.eclipse.jpt.eclipselink.ui;bundle-version="1.0.0",
- org.eclipse.jpt.utility;bundle-version="1.2.0",
- org.eclipse.wst.common.project.facet.core;bundle-version="1.3.0"
+ org.eclipse.jpt.utility;bundle-version="1.2.0"
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-Vendor: Hibernate Team
Export-Package: org.jboss.tools.hibernate.jpt.core.internal,
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/HibernatePersistenceUnit.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/HibernatePersistenceUnit.java 2008-08-27 12:21:22 UTC (rev 9918)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/HibernatePersistenceUnit.java 2008-08-27 12:54:37 UTC (rev 9919)
@@ -13,13 +13,6 @@
import org.eclipse.jpt.core.context.persistence.Persistence;
import org.eclipse.jpt.core.internal.context.persistence.GenericPersistenceUnit;
import org.eclipse.jpt.core.resource.persistence.XmlPersistenceUnit;
-import org.eclipse.jpt.eclipselink.core.internal.context.EclipseLinkJpaProperties;
-import org.eclipse.jpt.eclipselink.core.internal.context.caching.Caching;
-import org.eclipse.jpt.eclipselink.core.internal.context.connection.Connection;
-import org.eclipse.jpt.eclipselink.core.internal.context.customization.Customization;
-import org.eclipse.jpt.eclipselink.core.internal.context.logging.Logging;
-import org.eclipse.jpt.eclipselink.core.internal.context.options.Options;
-import org.eclipse.jpt.eclipselink.core.internal.context.schema.generation.SchemaGeneration;
/**
* @author Dmitry Geraskov
16 years, 4 months
JBoss Tools SVN: r9918 - trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/META-INF.
by jbosstools-commits@lists.jboss.org
Author: dgeraskov
Date: 2008-08-27 08:21:22 -0400 (Wed, 27 Aug 2008)
New Revision: 9918
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/META-INF/MANIFEST.MF
Log:
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/META-INF/MANIFEST.MF 2008-08-27 12:20:12 UTC (rev 9917)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/META-INF/MANIFEST.MF 2008-08-27 12:21:22 UTC (rev 9918)
@@ -21,7 +21,13 @@
org.eclipse.jdt.ui;bundle-version="3.4.0",
org.eclipse.jpt.db.ui;bundle-version="1.0.1",
org.eclipse.datatools.connectivity;bundle-version="1.1.0",
- org.eclipse.jdt.launching;bundle-version="3.4.0"
+ org.eclipse.jdt.launching;bundle-version="3.4.0",
+ org.eclipse.wst.common.project.facet.ui;bundle-version="1.3.0",
+ org.eclipse.wst.web.ui;bundle-version="1.1.200",
+ org.eclipse.wst.common.frameworks;bundle-version="1.1.200",
+ org.eclipse.wst.common.emf;bundle-version="1.1.200",
+ org.eclipse.wst.common.modulecore;bundle-version="1.1.200",
+ org.eclipse.wst.common.frameworks.ui;bundle-version="1.1.200"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-Vendor: Hibernate Team
16 years, 4 months
JBoss Tools SVN: r9917 - in trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui: src/org/jboss/tools/hibernate/jpt/ui and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: dgeraskov
Date: 2008-08-27 08:20:12 -0400 (Wed, 27 Aug 2008)
New Revision: 9917
Added:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/ConsoleConfigurationFacetInstallDelegate.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/ConsoleConfigurationFacetModel.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/Messages.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/ProjectCreateFacetWizardPage.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/messages.properties
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/plugin.xml
Log:
https://jira.jboss.org/jira/browse/JBIDE-2679
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/plugin.xml
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/plugin.xml 2008-08-27 08:42:27 UTC (rev 9916)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/plugin.xml 2008-08-27 12:20:12 UTC (rev 9917)
@@ -10,5 +10,53 @@
</jpaPlatform>
</extension>
+ <extension
+ point="org.eclipse.wst.common.project.facet.ui.wizardPages">
+ <wizard-pages
+ action="hibernate.consoleConfiguration.core.install">
+ <page
+ class="org.jboss.tools.hibernate.jpt.ui.wizard.ProjectCreateFacetWizardPage">
+ </page>
+ </wizard-pages>
+ </extension>
+ <extension
+ point="org.eclipse.wst.common.project.facet.core.facets">
+ <project-facet
+ id="hibernate.consoleConfiguration.core">
+ <label>
+ Console Configuration
+ </label>
+ <description>
+ Enables generation of Console Configuration based on selected Connection Profile.
+ </description>
+ </project-facet>
+ <project-facet-version
+ facet="hibernate.consoleConfiguration.core"
+ version="1.0">
+ <constraint>
+ <requires
+ facet="jpt.jpa"
+ soft="false">
+ </requires>
+ </constraint>
+
+ </project-facet-version>
+
+ <action
+ facet="hibernate.consoleConfiguration.core"
+ id="hibernate.consoleConfiguration.core.install"
+ type="install">
+ <delegate
+ class="org.jboss.tools.hibernate.jpt.ui.ConsoleConfigurationFacetInstallDelegate"/>
+ <config-factory
+ class="org.jboss.tools.hibernate.jpt.ui.ConsoleConfigurationFacetModel$Factory"/>
+ </action>
+
+ </extension>
+
+
+
+
+
</plugin>
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/ConsoleConfigurationFacetInstallDelegate.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/ConsoleConfigurationFacetInstallDelegate.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/ConsoleConfigurationFacetInstallDelegate.java 2008-08-27 12:20:12 UTC (rev 9917)
@@ -0,0 +1,89 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.hibernate.jpt.ui;
+
+import java.util.List;
+import java.util.Properties;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.datatools.connectivity.IConnectionProfile;
+import org.eclipse.datatools.connectivity.ProfileManager;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunchConfigurationType;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
+import org.eclipse.wst.common.project.facet.core.IDelegate;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+import org.hibernate.cfg.Environment;
+import org.hibernate.console.preferences.ConsoleConfigurationPreferences.ConfigurationMode;
+import org.hibernate.eclipse.launch.ICodeGenerationLaunchConstants;
+import org.hibernate.eclipse.launch.IConsoleConfigurationLaunchConstants;
+
+public class ConsoleConfigurationFacetInstallDelegate implements IDelegate {
+
+ public void execute(IProject project, IProjectFacetVersion fv, Object config, IProgressMonitor monitor)
+ throws CoreException {
+ ConsoleConfigurationFacetModel model = (ConsoleConfigurationFacetModel) config;
+ if (model.getConsoleConfigurationName() == null || "".equals(model.getConsoleConfigurationName())) return;
+ //create cc
+
+ ILaunchManager lm = DebugPlugin.getDefault().getLaunchManager();
+ ILaunchConfigurationType lct = lm.getLaunchConfigurationType(ICodeGenerationLaunchConstants.CONSOLE_CONFIGURATION_LAUNCH_TYPE_ID);
+ ILaunchConfigurationWorkingCopy wc = lct.newInstance(null, model.getConsoleConfigurationName());
+
+ //TODO: change to work with connection profile when JBIDE-719 is finished.
+
+ wc.setAttribute(IConsoleConfigurationLaunchConstants.CONFIGURATION_FACTORY, ConfigurationMode.JPA.toString());
+ wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, model.getProjectName());
+ wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_DEFAULT_CLASSPATH, true );
+ wc.setAttribute(IConsoleConfigurationLaunchConstants.FILE_MAPPINGS, (List<String>)null);
+
+ IConnectionProfile profile = ProfileManager.getInstance().getProfileByName(model.getConnectionProfileName());
+ if (null != profile) {
+ Properties cpProperties = profile.getProperties(profile.getProviderId());
+ String driver = cpProperties.getProperty("org.eclipse.datatools.connectivity.db.driverClass");
+ wc.setAttribute(Environment.DRIVER, driver);
+ String url = cpProperties.getProperty("org.eclipse.datatools.connectivity.db.URL");
+ wc.setAttribute(Environment.URL, url);
+ String user = cpProperties.getProperty("org.eclipse.datatools.connectivity.db.username");
+ if (null != user && user.length() > 0) {
+ wc.setAttribute(Environment.USER, user);
+ }
+ String pass = cpProperties.getProperty("org.eclipse.datatools.connectivity.db.password");
+ if (null != pass && pass.length() > 0) {
+ wc.setAttribute(Environment.PASS, pass);
+ }
+
+ /* Hibernate dialect must explicitly be set(error)
+ need to register driver before
+ Properties props = new Properties();
+ props.putAll(wc.getAttributes());
+ try {
+ DatabaseMetaData meta = DriverManager.getConnection(url, user, pass).getMetaData();
+ String databaseName = meta.getDatabaseProductName();
+ int databaseMajorVersion = meta.getDatabaseMajorVersion();
+ //SQL Dialect:
+ Dialect dialect = DialectFactory.buildDialect(props, databaseName, databaseMajorVersion );
+ wc.setAttribute(Environment.DIALECT, dialect.toString());
+ } catch (Exception e) {
+ //can't determine dialect
+ }
+ */
+ }
+
+ wc.doSave();
+ }
+
+}
Property changes on: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/ConsoleConfigurationFacetInstallDelegate.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/ConsoleConfigurationFacetModel.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/ConsoleConfigurationFacetModel.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/ConsoleConfigurationFacetModel.java 2008-08-27 12:20:12 UTC (rev 9917)
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.hibernate.jpt.ui;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.wst.common.project.facet.core.IActionConfigFactory;
+
+/**
+ * @author Dmitry Geraskov
+ *
+ */
+public class ConsoleConfigurationFacetModel {
+
+ private String projectName;
+
+ private String consoleConfigurationName;
+
+ private String connectionProfileName;
+
+ public static class Factory implements IActionConfigFactory {
+ public Object create() throws CoreException {
+ return new ConsoleConfigurationFacetModel();
+ }
+ }
+
+ /**
+ * @return the projectName
+ */
+ public String getProjectName() {
+ return projectName;
+ }
+
+ /**
+ * @param projectName the projectName to set
+ */
+ public void setProjectName(String projectName) {
+ if (projectName != null) projectName = projectName.trim();
+ this.projectName = projectName;
+ }
+
+ /**
+ * @return the consoleConfigurationName
+ */
+ public String getConsoleConfigurationName() {
+ return consoleConfigurationName;
+ }
+
+ /**
+ * @param consoleConfigurationName the consoleConfigurationName to set
+ */
+ public void setConsoleConfigurationName(String ccName) {
+ this.consoleConfigurationName = ccName;
+ }
+
+ /**
+ * @return the connectionProfileName
+ */
+ public String getConnectionProfileName() {
+ return connectionProfileName;
+ }
+
+ /**
+ * @param connectionProfileName the connectionProfileName to set
+ */
+ public void setConnectionProfileName(String cpName) {
+ this.connectionProfileName = cpName;
+ }
+
+
+}
Property changes on: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/ConsoleConfigurationFacetModel.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/Messages.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/Messages.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/Messages.java 2008-08-27 12:20:12 UTC (rev 9917)
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.hibernate.jpt.ui.wizard;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * @author Dmitry Geraskov
+ *
+ */
+public class Messages extends NLS {
+ private static final String BUNDLE_NAME = "org.jboss.tools.hibernate.jpt.ui.wizard.messages"; //$NON-NLS-1$
+
+ public static String ccName;
+ public static String connectionProfileError;
+ public static String selectName;
+ public static String wizardMessage;
+
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
Property changes on: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/Messages.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/ProjectCreateFacetWizardPage.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/ProjectCreateFacetWizardPage.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/ProjectCreateFacetWizardPage.java 2008-08-27 12:20:12 UTC (rev 9917)
@@ -0,0 +1,228 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.hibernate.jpt.ui.wizard;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.jdt.internal.ui.wizards.dialogfields.DialogField;
+import org.eclipse.jdt.internal.ui.wizards.dialogfields.IDialogFieldListener;
+import org.eclipse.jdt.internal.ui.wizards.dialogfields.SelectionButtonDialogField;
+import org.eclipse.jdt.internal.ui.wizards.dialogfields.StringDialogField;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jpt.core.internal.facet.JpaFacetDataModelProperties;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.project.facet.core.IProjectFacet;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+import org.eclipse.wst.common.project.facet.core.VersionFormatException;
+import org.eclipse.wst.common.project.facet.core.IFacetedProject.Action;
+import org.eclipse.wst.common.project.facet.ui.AbstractFacetWizardPage;
+import org.hibernate.eclipse.console.HibernateConsoleMessages;
+import org.jboss.tools.hibernate.jpt.ui.ConsoleConfigurationFacetModel;
+import org.jboss.tools.hibernate.jpt.ui.HibernateJptUIPlugin;
+
+public class ProjectCreateFacetWizardPage extends AbstractFacetWizardPage {
+
+ private String connectioProfileName;
+
+ private String projectName;
+
+ private boolean firstTime = true;
+
+ private ConsoleConfigurationFacetModel config;
+
+ private StringDialogField ccName;
+
+ private SelectionButtonDialogField select;
+
+ private IDialogFieldListener completeListener = new IDialogFieldListener() {
+ public void dialogFieldChanged(DialogField field) {
+ updateFields();
+ updateButtons();
+ }
+
+ };
+
+ public ProjectCreateFacetWizardPage() {
+ super(new String());
+ setMessage(Messages.wizardMessage); //$NON-NLS-1$
+ }
+
+ /**
+ * @param pageName
+ */
+ public ProjectCreateFacetWizardPage(String pageName) {
+ super(pageName);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelWizardPage
+ * #createTopLevelComposite(org.eclipse.swt.widgets.Composite)
+ */
+ public void createControl(Composite parent) {
+ int nColumns = 2;
+ Composite composite = new Composite(parent, SWT.NULL);
+ GridLayout layout = new GridLayout(nColumns, false);
+ composite.setLayout(layout);
+
+ select = new SelectionButtonDialogField(SWT.CHECK);
+ select.setLabelText(Messages.selectName);
+ select.setSelection(true);
+
+ ccName = new StringDialogField();
+ ccName.setLabelText(Messages.ccName);
+
+ select.attachDialogField(ccName);
+ select.setDialogFieldListener(completeListener);
+ ccName.setDialogFieldListener(completeListener);
+
+ Control[] controls = select.doFillIntoGrid(composite, nColumns);
+ ((GridData) controls[0].getLayoutData()).grabExcessHorizontalSpace = true;
+ ccName.doFillIntoGrid(composite, nColumns);
+
+ Dialog.applyDialogFont(parent);
+ setControl(composite);
+ }
+
+ public void setConfig(Object config) {
+ this.config = (ConsoleConfigurationFacetModel) config;
+ }
+
+ @Override
+ public void transferStateToConfig() {
+ if (select.isSelected()) {
+ config.setProjectName(projectName);
+ config.setConsoleConfigurationName(ccName.getText());
+ config.setConnectionProfileName(connectioProfileName);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.dialogs.DialogPage#setVisible(boolean)
+ */
+ @Override
+ public void setVisible(boolean visible) {
+ super.setVisible(visible);
+
+ if (visible) {
+ updateFields();
+ updateButtons();
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.wizard.WizardPage#isPageComplete()
+ */
+ @Override
+ public boolean isPageComplete() {
+ updateFields();
+ if (!select.isSelected()) {
+ return true;
+ } else {
+ return connectioProfileName != null && ccName.getText().length() > 0;
+ }
+ }
+
+ private void updateButtons() {
+ if (!select.isSelected()) {
+ setErrorMessage(null);
+ } else {
+ if (connectioProfileName == null) {
+ setErrorMessage(Messages.connectionProfileError);
+ } else {
+ setErrorMessage(verifyName());
+ }
+ }
+ setPageComplete(getErrorMessage() == null);
+ }
+
+ private void updateFields() {
+ connectioProfileName = null;
+ projectName = context.getProjectName();
+
+ if (firstTime && projectName != null) {
+ firstTime = false;
+ ILaunchManager lm = DebugPlugin.getDefault().getLaunchManager();
+ ccName.setText(lm.generateUniqueLaunchConfigurationNameFrom(projectName));
+ }
+
+ IProjectFacet pf = ProjectFacetsManager.getProjectFacet("jpt.jpa"); //$NON-NLS-1$
+ IProjectFacetVersion fv;
+ try {
+ fv = pf.getLatestVersion();
+ Action a = context.getAction(Action.Type.INSTALL, fv);
+ if (a != null) {
+ IDataModel model = (IDataModel) a.getConfig();
+ connectioProfileName = (String) model.getProperty(JpaFacetDataModelProperties.CONNECTION);
+ }
+ } catch (VersionFormatException e) {
+ HibernateJptUIPlugin.logException(e);
+ } catch (CoreException e) {
+ HibernateJptUIPlugin.logException(e);
+ }
+ }
+
+ private String verifyName() {
+ String currentName = ccName.getText().trim();
+
+ if (currentName.length() < 1) {
+ return HibernateConsoleMessages.ConsoleConfigurationWizardPage_name_must_specified;
+ }
+
+ ILaunchManager lm = DebugPlugin.getDefault().getLaunchManager();
+ try {
+ if (lm.isExistingLaunchConfigurationName(currentName)) {
+ return HibernateConsoleMessages.ConsoleConfigurationWizardPage_config_name_already_exist;
+ }
+ } catch (CoreException e) {
+ HibernateJptUIPlugin.logException(e);
+ }
+
+ if (Platform.OS_WIN32.equals(Platform.getOS())) {
+ String[] badnames = new String[] { "aux", "clock$", "com1", "com2", "com3", "com4", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
+ "com5", "com6", "com7", "com8", "com9", "con", "lpt1", "lpt2", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$
+ "lpt3", "lpt4", "lpt5", "lpt6", "lpt7", "lpt8", "lpt9", "nul", "prn" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$
+ for (int i = 0; i < badnames.length; i++) {
+ if (currentName.equals(badnames[i])) {
+ return NLS.bind(HibernateConsoleMessages.ConsoleConfigurationWizardPage_bad_name, currentName);
+ }
+ }
+ }
+ // See if name contains any characters that we deem illegal.
+ // '@' and '&' are disallowed because they corrupt menu items.
+ char[] disallowedChars = new char[] { '@', '&', '\\', '/', ':', '*', '?', '"', '<', '>', '|', '\0' };
+ for (int i = 0; i < disallowedChars.length; i++) {
+ char c = disallowedChars[i];
+ if (currentName.indexOf(c) > -1) {
+ return NLS.bind(HibernateConsoleMessages.ConsoleConfigurationWizardPage_bad_char, c);
+ }
+ }
+
+ return null;
+ }
+
+}
Property changes on: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/ProjectCreateFacetWizardPage.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/messages.properties
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/messages.properties (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/messages.properties 2008-08-27 12:20:12 UTC (rev 9917)
@@ -0,0 +1,4 @@
+ccName=Console Configuration name
+connectionProfileError=Connection profile should be selected.
+selectName=Create default Console Configuration
+wizardMessage=Enter console configuration name if you want to create new one for selected project.
Property changes on: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/messages.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
16 years, 4 months
JBoss Tools SVN: r9916 - in trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui: internal/platform and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: dgeraskov
Date: 2008-08-27 04:42:27 -0400 (Wed, 27 Aug 2008)
New Revision: 9916
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/HibernateJptUIPlugin.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/platform/HibernatePlatformUI.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateDdlWizard.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateEntitiesWizard.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateInitWizardPage.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-2658
logging
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/HibernateJptUIPlugin.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/HibernateJptUIPlugin.java 2008-08-27 07:56:48 UTC (rev 9915)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/HibernateJptUIPlugin.java 2008-08-27 08:42:27 UTC (rev 9916)
@@ -11,6 +11,8 @@
package org.jboss.tools.hibernate.jpt.ui;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
@@ -62,8 +64,42 @@
* Log message
*
*/
- public static void log(int severity, String message) {
- //not realized
+ private static void log(int severity, String message, Throwable e) {
+ getDefault().getLog().log(new Status(severity, PLUGIN_ID, message, e));
}
+
+ /**
+ * Short exception log
+ *
+ */
+ public static void logException(Throwable e) {
+ log(IStatus.ERROR, e.getMessage(), e);
+ }
+
+ /**
+ * Short error log call
+ *
+ */
+ public static void logError(String message) {
+ log(IStatus.ERROR, message, null);
+ }
+
+ /**
+ * Short warning log call
+ *
+ */
+ public static void logWarning(String message) {
+ log(IStatus.WARNING, message, null);
+ }
+
+ /**
+ * Short information log call
+ *
+ */
+ public static void logInfo(String message) {
+ log(IStatus.INFO, message, null);
+ }
+
+
}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/platform/HibernatePlatformUI.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/platform/HibernatePlatformUI.java 2008-08-27 07:56:48 UTC (rev 9915)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/platform/HibernatePlatformUI.java 2008-08-27 08:42:27 UTC (rev 9916)
@@ -35,6 +35,7 @@
import org.eclipse.jpt.gen.internal.PackageGenerator;
import org.eclipse.jpt.ui.internal.platform.generic.GenericPlatformUi;
import org.hibernate.eclipse.launch.HibernateLaunchConstants;
+import org.jboss.tools.hibernate.jpt.ui.HibernateJptUIPlugin;
import org.jboss.tools.hibernate.jpt.ui.wizard.GenerateDdlWizard;
import org.jboss.tools.hibernate.jpt.ui.wizard.GenerateEntitiesWizard;
@@ -79,7 +80,7 @@
wc.setAttribute(HibernateLaunchConstants.ATTR_EXPORTERS, exporters);
wc.setAttribute(full_exporter_id, true);
} catch (CoreException e) {
- e.printStackTrace();
+ HibernateJptUIPlugin.logException(e);
}
return wc;
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateDdlWizard.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateDdlWizard.java 2008-08-27 07:56:48 UTC (rev 9915)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateDdlWizard.java 2008-08-27 08:42:27 UTC (rev 9916)
@@ -26,6 +26,7 @@
import org.eclipse.jpt.ui.internal.JptUiMessages;
import org.hibernate.console.KnownConfigurations;
import org.hibernate.eclipse.launch.HibernateLaunchConstants;
+import org.jboss.tools.hibernate.jpt.ui.HibernateJptUIPlugin;
import org.jboss.tools.hibernate.jpt.ui.internal.platform.HibernatePlatformUI;
/**
@@ -79,7 +80,7 @@
try {
wc.launch(ILaunchManager.RUN_MODE, null);
} catch (CoreException e) {
- e.printStackTrace();
+ HibernateJptUIPlugin.logException(e);
} finally{
if (initPage.isTemporaryConfiguration()){
KnownConfigurations.getInstance().removeConfiguration(KnownConfigurations.getInstance().find(concoleConfigurationName), false);
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateEntitiesWizard.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateEntitiesWizard.java 2008-08-27 07:56:48 UTC (rev 9915)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateEntitiesWizard.java 2008-08-27 08:42:27 UTC (rev 9916)
@@ -32,6 +32,7 @@
import org.eclipse.jpt.utility.internal.CollectionTools;
import org.hibernate.console.KnownConfigurations;
import org.hibernate.eclipse.launch.HibernateLaunchConstants;
+import org.jboss.tools.hibernate.jpt.ui.HibernateJptUIPlugin;
import org.jboss.tools.hibernate.jpt.ui.internal.platform.HibernatePlatformUI;
/**
@@ -91,7 +92,7 @@
try {
wc.launch(ILaunchManager.RUN_MODE, null);
} catch (CoreException e) {
- e.printStackTrace();
+ HibernateJptUIPlugin.logException(e);
} finally{
if (initPage.isTemporaryConfiguration()){
KnownConfigurations.getInstance().removeConfiguration(KnownConfigurations.getInstance().find(concoleConfigurationName), false);
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateInitWizardPage.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateInitWizardPage.java 2008-08-27 07:56:48 UTC (rev 9915)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateInitWizardPage.java 2008-08-27 08:42:27 UTC (rev 9916)
@@ -58,6 +58,7 @@
import org.hibernate.eclipse.launch.ICodeGenerationLaunchConstants;
import org.hibernate.eclipse.launch.IConsoleConfigurationLaunchConstants;
import org.hibernate.util.StringHelper;
+import org.jboss.tools.hibernate.jpt.ui.HibernateJptUIPlugin;
import org.w3c.dom.Element;
/**
@@ -258,8 +259,7 @@
wc.doSave();
return wc.getName();
} catch (CoreException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ HibernateJptUIPlugin.logException(e);
return null;
}
16 years, 4 months
JBoss Tools SVN: r9915 - in workspace/Denny/org.jboss.tools.esb: META-INF and 5 other directories.
by jbosstools-commits@lists.jboss.org
Author: dennyxu
Date: 2008-08-27 03:56:48 -0400 (Wed, 27 Aug 2008)
New Revision: 9915
Added:
workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/projects/wizards/AbstractESBProjectCreationWizard.java
workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/projects/wizards/ESBProjectCreationWizard.java
workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/projects/wizards/JBossESBFacetProjectCreationDataModelProvider.java
workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/utils/ESBProjectUtil.java
Removed:
workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/project/facet/
workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/projects/nature/
workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/projects/wizards/AbstractESBProjectCreationWizard.java
workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/projects/wizards/ESBProjectCreationWizard.java
workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/projects/wizards/JBossESBFacetProjectCreationDataModelProvider.java
workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/utils/ResourceUtils.java
Modified:
workspace/Denny/org.jboss.tools.esb/META-INF/MANIFEST.MF
workspace/Denny/org.jboss.tools.esb/plugin.xml
workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/projects/wizards/pages/AbstractESBWizardPage.java
workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/projects/wizards/pages/ESBFacetInstallationPage.java
Log:
Modified: workspace/Denny/org.jboss.tools.esb/META-INF/MANIFEST.MF
===================================================================
--- workspace/Denny/org.jboss.tools.esb/META-INF/MANIFEST.MF 2008-08-27 00:41:46 UTC (rev 9914)
+++ workspace/Denny/org.jboss.tools.esb/META-INF/MANIFEST.MF 2008-08-27 07:56:48 UTC (rev 9915)
@@ -28,6 +28,9 @@
org.eclipse.jst.j2ee;bundle-version="1.1.200",
org.eclipse.jst.j2ee.web;bundle-version="1.1.200",
org.eclipse.jst.j2ee.core;bundle-version="1.1.200",
- org.eclipse.jst.j2ee.ui;bundle-version="1.1.200"
+ org.eclipse.jst.j2ee.ui;bundle-version="1.1.200",
+ org.jboss.tools.esb.project;bundle-version="1.0.0",
+ org.jboss.tools.esb.project.preference;bundle-version="1.0.0",
+ org.eclipse.jdt.core;bundle-version="3.4.0"
Eclipse-LazyStart: true
Export-Package: org.jboss.tools.esb.projects.wizards.pages
Modified: workspace/Denny/org.jboss.tools.esb/plugin.xml
===================================================================
--- workspace/Denny/org.jboss.tools.esb/plugin.xml 2008-08-27 00:41:46 UTC (rev 9914)
+++ workspace/Denny/org.jboss.tools.esb/plugin.xml 2008-08-27 07:56:48 UTC (rev 9915)
@@ -6,7 +6,7 @@
point="org.eclipse.ui.newWizards">
<wizard
category="org.jboss.tools.esb.category1"
- class="org.jboss.tools.esb.projects.wizards.ESBProjectCreationWizard"
+ class="org.jboss.tools.esb.projects.wizards.ESBProjectWizard"
id="JBoss.ESB.Project.Wizard"
name="ESB Project Wizard"
project="true">
@@ -16,90 +16,11 @@
name="ESB Wizard">
</category>
</extension>
+
<extension
- point="org.eclipse.wst.common.project.facet.core.facets">
- <project-facet
- id="jboss.esb">
- <label>
- JBoss ESB
- </label>
- </project-facet>
- <project-facet-version
- facet="jboss.esb"
- version="4.2">
- <action
- facet="jboss.esb"
- type="install"
- version="4.2">
- <delegate
- class="org.jboss.tools.esb.project.facet.JBossESBFacetInstallationDelegate">
- </delegate>
- <config-factory
- class="org.jboss.tools.esb.project.facet.JBossESBFacetInstallationConfig">
- </config-factory>
- </action>
- </project-facet-version>
- <project-facet-version
- facet="jboss.esb"
- version="4.3">
- <action
- facet="jboss.esb"
- id="jboss.esb.install"
- type="install"
- version="4.3">
- <delegate
- class="org.jboss.tools.esb.project.facet.JBossESBFacetInstallationDelegate">
- </delegate>
- <config-factory
- class="org.jboss.tools.esb.project.facet.JBossESBFacetInstallationConfig">
- </config-factory>
- </action>
- </project-facet-version>
- <template
- id="template.jboss.esb">
- <label>
- label body text
- </label>
- <fixed
- facet="jboss.esb">
- </fixed>
- <fixed
- facet="jst.java">
- </fixed>
- </template>
- </extension>
- <extension
- id="esbnature"
- name="JBoss ESB Nature"
- point="org.eclipse.core.resources.natures">
- <runtime>
- <run
- class="org.jboss.tools.esb.projects.nature.JBossESBProjectNature">
- </run>
- </runtime>
- <requires-nature
- id="org.eclipse.wst.common.project.facet.core.nature">
- </requires-nature>
- </extension>
- <extension
- point="org.eclipse.ui.ide.projectNatureImages">
- <image
- icon="esbproject.image3"
- id="org.jboss.esb.project.esbnature.image"
- natureId="org.jboss.esb.project.esbnature">
- </image>
- </extension>
- <extension
- point="org.eclipse.wst.server.core.moduleTypes">
- <moduleType
- id="jboss.esb"
- name="JBoss ESB Module">
- </moduleType>
- </extension>
- <extension
point="org.eclipse.wst.common.project.facet.ui.wizardPages">
<wizard-pages
- action="jboss.esb.install">
+ action="jst.jboss.esb.install">
<page
class="org.jboss.tools.esb.projects.wizards.pages.ESBFacetInstallationPage">
</page>
@@ -116,18 +37,6 @@
wizardPage="org.jboss.tools.esb.project.ui.templates.HelloWorldTemplateWizardPage">
</templates>
</extension>
- <extension
- point="org.eclipse.wst.common.project.facet.core.runtimes">
- <supported>
- <facet
- id="jboss.esb"
- version="4.2,4.3">
- </facet>
- <runtime-component
- id="org.jboss.ide.eclipse.as.runtime.component"
- version="4.2">
- </runtime-component>
- </supported>
- </extension>
+
</plugin>
Deleted: workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/projects/wizards/AbstractESBProjectCreationWizard.java
===================================================================
--- workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/projects/wizards/AbstractESBProjectCreationWizard.java 2008-08-27 00:41:46 UTC (rev 9914)
+++ workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/projects/wizards/AbstractESBProjectCreationWizard.java 2008-08-27 07:56:48 UTC (rev 9915)
@@ -1,432 +0,0 @@
-package org.jboss.tools.esb.projects.wizards;
-
-
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.INewWizard;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetDataModelProperties;
-import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetProjectCreationDataModelProperties;
-import org.eclipse.wst.common.frameworks.datamodel.DataModelEvent;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModelListener;
-import org.eclipse.wst.common.project.facet.core.FacetedProjectFramework;
-import org.eclipse.wst.common.project.facet.core.IFacetedProject;
-import org.eclipse.wst.common.project.facet.core.IFacetedProjectTemplate;
-import org.eclipse.wst.common.project.facet.core.IFacetedProjectWorkingCopy;
-import org.eclipse.wst.common.project.facet.core.IPreset;
-import org.eclipse.wst.common.project.facet.core.IProjectFacet;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-import org.eclipse.wst.common.project.facet.core.events.IFacetedProjectEvent;
-import org.eclipse.wst.common.project.facet.core.events.IFacetedProjectListener;
-import org.eclipse.wst.common.project.facet.core.runtime.IRuntime;
-import org.eclipse.wst.common.project.facet.ui.ModifyFacetedProjectWizard;
-
-public abstract class AbstractESBProjectCreationWizard extends ModifyFacetedProjectWizard implements INewWizard, IFacetProjectCreationDataModelProperties {
-
- protected IDataModel model = null;
- private final IFacetedProjectTemplate template;
- private IWizardPage[] beginingPages;
- private IConfigurationElement configurationElement;
-
- public AbstractESBProjectCreationWizard(IDataModel model)
- {
- this.model = ( model == null ? createDataModel() : model );
- this.template = getTemplate();
-
- setWindowTitle("New JBoss ESB Project");
- setFacetedProjectWorkingCopy((IFacetedProjectWorkingCopy)this.model.getProperty(FACETED_PROJECT_WORKING_COPY));
- getFacetedProjectWorkingCopy().setFixedProjectFacets( this.template.getFixedProjectFacets() );
- setDefaultPageImageDescriptor(getDefaultPageImageDescriptor());
- setShowFacetsSelectionPage( false );
- }
-
- public AbstractESBProjectCreationWizard()
- {
- this( null );
- }
-
- public IDataModel getDataModel() {
- return model;
- }
-
- protected abstract IDataModel createDataModel();
-
- protected abstract ImageDescriptor getDefaultPageImageDescriptor();
-
- protected abstract IFacetedProjectTemplate getTemplate();
-
- /**
- * Returns the first page that shows up before the facets page. If multiple pages are required,
- * also override {@link #createBeginingPages()}.
- *
- * @return
- */
- protected abstract IWizardPage createFirstPage();
-
- /**
- * Subclasses should override to add more than one page before the facets page. If only one page
- * is required, then use {@link #createFirstPage()}. The default implementation will return the
- * result of {@link #createFirstPage()}.
- *
- * @return
- */
- protected IWizardPage[] createBeginingPages() {
- return new IWizardPage[]{createFirstPage()};
- }
-
- public void addPages() {
- beginingPages = createBeginingPages();
- for (int i = 0; i < beginingPages.length; i++) {
- addPage(beginingPages[i]);
- }
-
- super.addPages();
-
- getFacetedProjectWorkingCopy().addListener
- (
- new IFacetedProjectListener()
- {
- public void handleEvent( final IFacetedProjectEvent event )
- {
- facetSelectionChangedEvent();
- }
- },
- IFacetedProjectEvent.Type.PROJECT_FACETS_CHANGED
- );
- }
-
- public void createPageControls(Composite container) {
- super.createPageControls(container);
-
- final IPreset preset = this.template.getInitialPreset();
- final IRuntime runtime = (IRuntime) model.getProperty( FACET_RUNTIME );
-
- if( preset == null )
- {
- // If no preset is specified, select the runtime and it's default
- // facets.
-
- setRuntimeAndDefaultFacets( runtime );
- }
- else
- {
- // If preset is specified, select the runtime only if supports all
- // of the facets included in the preset.
-
- getFacetedProjectWorkingCopy().setSelectedPreset( preset.getId() );
-
- boolean supports = false;
-
- if( runtime != null )
- {
- supports = true;
-
- for( Iterator itr = preset.getProjectFacets().iterator(); itr.hasNext(); )
- {
- final IProjectFacetVersion fv = (IProjectFacetVersion) itr.next();
-
- if( ! runtime.supports( fv ) )
- {
- supports = false;
- break;
- }
- }
- }
-
- if( supports )
- {
- getFacetedProjectWorkingCopy().setTargetedRuntimes( Collections.singleton( runtime ) );
- }
- else
- {
- model.setProperty( FACET_RUNTIME, null );
- }
- }
-
- synchRuntimes();
- }
-
- public IWizardPage[] getPages() {
- final IWizardPage[] base = super.getPages();
- final IWizardPage[] pages = new IWizardPage[base.length + beginingPages.length];
-
- for (int i = 0; i < beginingPages.length; i++) {
- pages[i] = beginingPages[i];
- }
-
- System.arraycopy(base, 0, pages, beginingPages.length, base.length);
-
- return pages;
- }
-
- public void init(IWorkbench workbench, IStructuredSelection selection) {
- }
-
- protected void synchRuntimes()
- {
- final Boolean[] suppressBackEvents = { Boolean.FALSE };
-
- model.addListener(new IDataModelListener() {
- public void propertyChanged(DataModelEvent event) {
- if (IDataModel.VALUE_CHG == event.getFlag() || IDataModel.DEFAULT_CHG == event.getFlag()) {
- if (FACET_RUNTIME.equals(event.getPropertyName())) {
- if( ! suppressBackEvents[ 0 ].booleanValue() ) {
- IRuntime runtime = (IRuntime) event.getProperty();
- setRuntimeAndDefaultFacets( runtime );
- }
- }
- }
- }
- });
-
- getFacetedProjectWorkingCopy().addListener
- (
- new IFacetedProjectListener()
- {
- public void handleEvent( final IFacetedProjectEvent event )
- {
- suppressBackEvents[ 0 ] = Boolean.TRUE;
- model.setProperty(FACET_RUNTIME, getFacetedProjectWorkingCopy().getPrimaryRuntime());
- suppressBackEvents[ 0 ] = Boolean.FALSE;
- }
- },
- IFacetedProjectEvent.Type.PRIMARY_RUNTIME_CHANGED
- );
- }
-
- protected void setRuntimeAndDefaultFacets( final IRuntime runtime )
- {
- final IFacetedProjectWorkingCopy dm = getFacetedProjectWorkingCopy();
-
- dm.setTargetedRuntimes( Collections.<IRuntime>emptySet() );
-
- if( runtime != null )
- {
- final Set<IProjectFacetVersion> minFacets = new HashSet<IProjectFacetVersion>();
-
- try
- {
- for( IProjectFacet f : dm.getFixedProjectFacets() )
- {
- minFacets.add( f.getLatestSupportedVersion( runtime ) );
- }
- }
- catch( CoreException e )
- {
- throw new RuntimeException( e );
- }
-
- dm.setProjectFacets( minFacets );
-
- dm.setTargetedRuntimes( Collections.singleton( runtime ) );
- }
-
- dm.setSelectedPreset( FacetedProjectFramework.DEFAULT_CONFIGURATION_PRESET_ID );
- }
-
- public String getProjectName() {
- return model.getStringProperty(IFacetProjectCreationDataModelProperties.FACET_PROJECT_NAME);
- }
-
- protected void performFinish(final IProgressMonitor monitor)
-
- throws CoreException
-
- {
- monitor.beginTask("", 10); //$NON-NLS-1$
-
- try {
- super.performFinish(new SubProgressMonitor(monitor, 8));
-
- /* try {
- getFacetProjectNotificationOperation().execute(new NullProgressMonitor(), null);
- } catch (ExecutionException e) {
- String msg = e.getMessage();
- if( msg == null ) msg = ""; //$NON-NLS-1$
- final IStatus st = new Status( IStatus.ERROR, WSTWebUIPlugin.PLUGIN_ID, 0, msg, e );
- throw new CoreException( st );
- }*/
- } finally {
- monitor.done();
- }
- }
-
- public boolean performFinish() {
- if (super.performFinish() == false) {
- return false;
- }
-
- /* try {
- postPerformFinish();
- } catch (InvocationTargetException e) {
- Logger.logException(e);
- }*/
-
- return true;
- }
-
- /**
- * <p>
- * Override to return the final perspective ID (if any). The final perspective ID can be
- * hardcoded by the subclass or determined programmatically (possibly using the value of a field
- * on the Wizard's WTP Operation Data Model).
- * </p>
- * <p>
- * The default implementation returns no perspective id unless overriden by product definition
- * via the "wtp.project.final.perspective" property.
- * </p>
- *
- * @return Returns the ID of the Perspective which is preferred by this wizard upon completion.
- */
-
- protected String getFinalPerspectiveID() {
- return null;
- }
-
- /**
- * {@inheritDoc}
- *
- * <p>
- * The configuration element is saved to use when the wizard completes in order to change the
- * current perspective using either (1) the value specified by {@link #getFinalPerspectiveID()}
- * or (2) the value specified by the finalPerspective attribute in the Wizard's configuration
- * element.
- * </p>
- *
- * @see org.eclipse.core.runtime.IExecutableExtension#setInitializationData(org.eclipse.core.runtime.IConfigurationElement,
- * java.lang.String, java.lang.Object)
- */
- public final void setInitializationData(IConfigurationElement aConfigurationElement, String aPropertyName, Object theData) throws CoreException {
- configurationElement = aConfigurationElement;
- doSetInitializeData(aConfigurationElement, aPropertyName, theData);
-
- }
-
- /**
- * <p>
- * Override method for clients that wish to take advantage of the information provided by
- * {@see #setInitializationData(IConfigurationElement, String, Object)}.
- * </p>
- *
- * @param aConfigurationElement
- * The configuration element provided from the templated method.
- * @param aPropertyName
- * The property name provided from the templated method.
- * @param theData
- * The data provided from the templated method.
- */
- protected void doSetInitializeData(IConfigurationElement aConfigurationElement, String aPropertyName, Object theData) {
- // Default do nothing
- }
-
- /**
- * <p>
- * Returns the an id component used for Activity filtering.
- * </p>
- *
- * <p>
- * The Plugin ID is determined from the configuration element specified in
- * {@see #setInitializationData(IConfigurationElement, String, Object)}.
- * </p>
- *
- * @return Returns the plugin id associated with this wizard
- */
- public final String getPluginId() {
- return (configurationElement != null) ? configurationElement.getDeclaringExtension().getNamespace() : ""; //$NON-NLS-1$
- }
-
- /**
- *
- * <p>
- * Invoked after the user has clicked the "Finish" button of the wizard. The default
- * implementation will attempt to update the final perspective to the value specified by
- * {@link #getFinalPerspectiveID() }
- * </p>
- *
- * @throws InvocationTargetException
- *
- * @see org.eclipse.wst.common.frameworks.internal.ui.wizard.WTPWizard#postPerformFinish()
- */
-/* protected void postPerformFinish() throws InvocationTargetException {
- if (getFinalPerspectiveID() != null && getFinalPerspectiveID().length() > 0) {
- final IConfigurationElement element = new DelegateConfigurationElement(configurationElement) {
- public String getAttribute(String aName) {
- if (aName.equals("finalPerspective")) { //$NON-NLS-1$
- return getFinalPerspectiveID();
- }
- return super.getAttribute(aName);
- }
- };
- BasicNewProjectResourceWizard.updatePerspective(element);
- } else
- BasicNewProjectResourceWizard.updatePerspective(configurationElement);
-
- String projName = getProjectName();
- BasicNewResourceWizard.selectAndReveal(ResourcesPlugin.getWorkspace().getRoot().getProject(projName), WSTWebUIPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow());
- }*/
-
- /*protected IDataModelOperation getFacetProjectNotificationOperation() {
- return new DataModelPausibleOperationImpl(new AbstractDataModelOperation(this.model) {
- public String getID() {
- return AbstractESBProjectCreationWizard.class.getName();
- }
-
- public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- return AbstractDataModelProvider.OK_STATUS;
- }
- });
- }*/
-
- /**
- * Need to keep the model in sync with the UI. This method will pickup changes coming from the
- * UI and push them into the model
- */
- protected void facetSelectionChangedEvent() {
- Set actions = getFacetedProjectWorkingCopy().getProjectFacetActions();
- Iterator iterator = actions.iterator();
- Set activeIds = new HashSet();
- while (iterator.hasNext()) {
- IFacetedProject.Action action = (IFacetedProject.Action) iterator.next();
- String id = action.getProjectFacetVersion().getProjectFacet().getId();
- activeIds.add(id);
- }
- // First handle all the actions tracked by IDataModels
- FacetDataModelMap dataModelMap = (FacetDataModelMap) model.getProperty(FACET_DM_MAP);
- iterator = dataModelMap.keySet().iterator();
- while (iterator.hasNext()) {
- String id = (String) iterator.next();
- IDataModel configDM = (IDataModel) dataModelMap.get(id);
- boolean active = activeIds.contains(id);
- configDM.setBooleanProperty(IFacetDataModelProperties.SHOULD_EXECUTE, active);
- activeIds.remove(id);
- }
- // Now handle the actions not tracked by IDataModels
- FacetActionMap actionMap = (FacetActionMap) model.getProperty(FACET_ACTION_MAP);
- actionMap.clear();
- iterator = actions.iterator();
- while (iterator.hasNext()) {
- IFacetedProject.Action action = (IFacetedProject.Action) iterator.next();
- String id = action.getProjectFacetVersion().getProjectFacet().getId();
- if (activeIds.contains(id)) {
- actionMap.add(action);
- }
- }
- model.notifyPropertyChange(FACET_RUNTIME, IDataModel.VALID_VALUES_CHG);
- }
-
-
-
-
-}
Added: workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/projects/wizards/AbstractESBProjectCreationWizard.java
===================================================================
--- workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/projects/wizards/AbstractESBProjectCreationWizard.java (rev 0)
+++ workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/projects/wizards/AbstractESBProjectCreationWizard.java 2008-08-27 07:56:48 UTC (rev 9915)
@@ -0,0 +1,432 @@
+package org.jboss.tools.esb.projects.wizards;
+
+
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.SubProgressMonitor;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.INewWizard;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetDataModelProperties;
+import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetProjectCreationDataModelProperties;
+import org.eclipse.wst.common.frameworks.datamodel.DataModelEvent;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModelListener;
+import org.eclipse.wst.common.project.facet.core.FacetedProjectFramework;
+import org.eclipse.wst.common.project.facet.core.IFacetedProject;
+import org.eclipse.wst.common.project.facet.core.IFacetedProjectTemplate;
+import org.eclipse.wst.common.project.facet.core.IFacetedProjectWorkingCopy;
+import org.eclipse.wst.common.project.facet.core.IPreset;
+import org.eclipse.wst.common.project.facet.core.IProjectFacet;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+import org.eclipse.wst.common.project.facet.core.events.IFacetedProjectEvent;
+import org.eclipse.wst.common.project.facet.core.events.IFacetedProjectListener;
+import org.eclipse.wst.common.project.facet.core.runtime.IRuntime;
+import org.eclipse.wst.common.project.facet.ui.ModifyFacetedProjectWizard;
+
+public abstract class AbstractESBProjectCreationWizard extends ModifyFacetedProjectWizard implements INewWizard, IFacetProjectCreationDataModelProperties {
+
+ protected IDataModel model = null;
+ private final IFacetedProjectTemplate template;
+ private IWizardPage[] beginingPages;
+ private IConfigurationElement configurationElement;
+
+ public AbstractESBProjectCreationWizard(IDataModel model)
+ {
+ this.model = ( model == null ? createDataModel() : model );
+ this.template = getTemplate();
+
+ setWindowTitle("New JBoss ESB Project");
+ setFacetedProjectWorkingCopy((IFacetedProjectWorkingCopy)this.model.getProperty(FACETED_PROJECT_WORKING_COPY));
+ getFacetedProjectWorkingCopy().setFixedProjectFacets( this.template.getFixedProjectFacets() );
+ setDefaultPageImageDescriptor(getDefaultPageImageDescriptor());
+ setShowFacetsSelectionPage( false );
+ }
+
+ public AbstractESBProjectCreationWizard()
+ {
+ this( null );
+ }
+
+ public IDataModel getDataModel() {
+ return model;
+ }
+
+ protected abstract IDataModel createDataModel();
+
+ protected abstract ImageDescriptor getDefaultPageImageDescriptor();
+
+ protected abstract IFacetedProjectTemplate getTemplate();
+
+ /**
+ * Returns the first page that shows up before the facets page. If multiple pages are required,
+ * also override {@link #createBeginingPages()}.
+ *
+ * @return
+ */
+ protected abstract IWizardPage createFirstPage();
+
+ /**
+ * Subclasses should override to add more than one page before the facets page. If only one page
+ * is required, then use {@link #createFirstPage()}. The default implementation will return the
+ * result of {@link #createFirstPage()}.
+ *
+ * @return
+ */
+ protected IWizardPage[] createBeginingPages() {
+ return new IWizardPage[]{createFirstPage()};
+ }
+
+ public void addPages() {
+ beginingPages = createBeginingPages();
+ for (int i = 0; i < beginingPages.length; i++) {
+ addPage(beginingPages[i]);
+ }
+
+ super.addPages();
+
+ getFacetedProjectWorkingCopy().addListener
+ (
+ new IFacetedProjectListener()
+ {
+ public void handleEvent( final IFacetedProjectEvent event )
+ {
+ facetSelectionChangedEvent();
+ }
+ },
+ IFacetedProjectEvent.Type.PROJECT_FACETS_CHANGED
+ );
+ }
+
+ public void createPageControls(Composite container) {
+ super.createPageControls(container);
+
+ final IPreset preset = this.template.getInitialPreset();
+ final IRuntime runtime = (IRuntime) model.getProperty( FACET_RUNTIME );
+
+ if( preset == null )
+ {
+ // If no preset is specified, select the runtime and it's default
+ // facets.
+
+ setRuntimeAndDefaultFacets( runtime );
+ }
+ else
+ {
+ // If preset is specified, select the runtime only if supports all
+ // of the facets included in the preset.
+
+ getFacetedProjectWorkingCopy().setSelectedPreset( preset.getId() );
+
+ boolean supports = false;
+
+ if( runtime != null )
+ {
+ supports = true;
+
+ for( Iterator itr = preset.getProjectFacets().iterator(); itr.hasNext(); )
+ {
+ final IProjectFacetVersion fv = (IProjectFacetVersion) itr.next();
+
+ if( ! runtime.supports( fv ) )
+ {
+ supports = false;
+ break;
+ }
+ }
+ }
+
+ if( supports )
+ {
+ getFacetedProjectWorkingCopy().setTargetedRuntimes( Collections.singleton( runtime ) );
+ }
+ else
+ {
+ model.setProperty( FACET_RUNTIME, null );
+ }
+ }
+
+ synchRuntimes();
+ }
+
+ public IWizardPage[] getPages() {
+ final IWizardPage[] base = super.getPages();
+ final IWizardPage[] pages = new IWizardPage[base.length + beginingPages.length];
+
+ for (int i = 0; i < beginingPages.length; i++) {
+ pages[i] = beginingPages[i];
+ }
+
+ System.arraycopy(base, 0, pages, beginingPages.length, base.length);
+
+ return pages;
+ }
+
+ public void init(IWorkbench workbench, IStructuredSelection selection) {
+ }
+
+ protected void synchRuntimes()
+ {
+ final Boolean[] suppressBackEvents = { Boolean.FALSE };
+
+ model.addListener(new IDataModelListener() {
+ public void propertyChanged(DataModelEvent event) {
+ if (IDataModel.VALUE_CHG == event.getFlag() || IDataModel.DEFAULT_CHG == event.getFlag()) {
+ if (FACET_RUNTIME.equals(event.getPropertyName())) {
+ if( ! suppressBackEvents[ 0 ].booleanValue() ) {
+ IRuntime runtime = (IRuntime) event.getProperty();
+ setRuntimeAndDefaultFacets( runtime );
+ }
+ }
+ }
+ }
+ });
+
+ getFacetedProjectWorkingCopy().addListener
+ (
+ new IFacetedProjectListener()
+ {
+ public void handleEvent( final IFacetedProjectEvent event )
+ {
+ suppressBackEvents[ 0 ] = Boolean.TRUE;
+ model.setProperty(FACET_RUNTIME, getFacetedProjectWorkingCopy().getPrimaryRuntime());
+ suppressBackEvents[ 0 ] = Boolean.FALSE;
+ }
+ },
+ IFacetedProjectEvent.Type.PRIMARY_RUNTIME_CHANGED
+ );
+ }
+
+ protected void setRuntimeAndDefaultFacets( final IRuntime runtime )
+ {
+ final IFacetedProjectWorkingCopy dm = getFacetedProjectWorkingCopy();
+
+ dm.setTargetedRuntimes( Collections.<IRuntime>emptySet() );
+
+ if( runtime != null )
+ {
+ final Set<IProjectFacetVersion> minFacets = new HashSet<IProjectFacetVersion>();
+
+ try
+ {
+ for( IProjectFacet f : dm.getFixedProjectFacets() )
+ {
+ minFacets.add( f.getLatestSupportedVersion( runtime ) );
+ }
+ }
+ catch( CoreException e )
+ {
+ throw new RuntimeException( e );
+ }
+
+ dm.setProjectFacets( minFacets );
+
+ dm.setTargetedRuntimes( Collections.singleton( runtime ) );
+ }
+
+ dm.setSelectedPreset( FacetedProjectFramework.DEFAULT_CONFIGURATION_PRESET_ID );
+ }
+
+ public String getProjectName() {
+ return model.getStringProperty(IFacetProjectCreationDataModelProperties.FACET_PROJECT_NAME);
+ }
+
+ protected void performFinish(final IProgressMonitor monitor)
+
+ throws CoreException
+
+ {
+ monitor.beginTask("", 10); //$NON-NLS-1$
+
+ try {
+ super.performFinish(new SubProgressMonitor(monitor, 8));
+
+ /* try {
+ getFacetProjectNotificationOperation().execute(new NullProgressMonitor(), null);
+ } catch (ExecutionException e) {
+ String msg = e.getMessage();
+ if( msg == null ) msg = ""; //$NON-NLS-1$
+ final IStatus st = new Status( IStatus.ERROR, WSTWebUIPlugin.PLUGIN_ID, 0, msg, e );
+ throw new CoreException( st );
+ }*/
+ } finally {
+ monitor.done();
+ }
+ }
+
+ public boolean performFinish() {
+ if (super.performFinish() == false) {
+ return false;
+ }
+
+ /* try {
+ postPerformFinish();
+ } catch (InvocationTargetException e) {
+ Logger.logException(e);
+ }*/
+
+ return true;
+ }
+
+ /**
+ * <p>
+ * Override to return the final perspective ID (if any). The final perspective ID can be
+ * hardcoded by the subclass or determined programmatically (possibly using the value of a field
+ * on the Wizard's WTP Operation Data Model).
+ * </p>
+ * <p>
+ * The default implementation returns no perspective id unless overriden by product definition
+ * via the "wtp.project.final.perspective" property.
+ * </p>
+ *
+ * @return Returns the ID of the Perspective which is preferred by this wizard upon completion.
+ */
+
+ protected String getFinalPerspectiveID() {
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * <p>
+ * The configuration element is saved to use when the wizard completes in order to change the
+ * current perspective using either (1) the value specified by {@link #getFinalPerspectiveID()}
+ * or (2) the value specified by the finalPerspective attribute in the Wizard's configuration
+ * element.
+ * </p>
+ *
+ * @see org.eclipse.core.runtime.IExecutableExtension#setInitializationData(org.eclipse.core.runtime.IConfigurationElement,
+ * java.lang.String, java.lang.Object)
+ */
+ public final void setInitializationData(IConfigurationElement aConfigurationElement, String aPropertyName, Object theData) throws CoreException {
+ configurationElement = aConfigurationElement;
+ doSetInitializeData(aConfigurationElement, aPropertyName, theData);
+
+ }
+
+ /**
+ * <p>
+ * Override method for clients that wish to take advantage of the information provided by
+ * {@see #setInitializationData(IConfigurationElement, String, Object)}.
+ * </p>
+ *
+ * @param aConfigurationElement
+ * The configuration element provided from the templated method.
+ * @param aPropertyName
+ * The property name provided from the templated method.
+ * @param theData
+ * The data provided from the templated method.
+ */
+ protected void doSetInitializeData(IConfigurationElement aConfigurationElement, String aPropertyName, Object theData) {
+ // Default do nothing
+ }
+
+ /**
+ * <p>
+ * Returns the an id component used for Activity filtering.
+ * </p>
+ *
+ * <p>
+ * The Plugin ID is determined from the configuration element specified in
+ * {@see #setInitializationData(IConfigurationElement, String, Object)}.
+ * </p>
+ *
+ * @return Returns the plugin id associated with this wizard
+ */
+ public final String getPluginId() {
+ return (configurationElement != null) ? configurationElement.getDeclaringExtension().getNamespace() : ""; //$NON-NLS-1$
+ }
+
+ /**
+ *
+ * <p>
+ * Invoked after the user has clicked the "Finish" button of the wizard. The default
+ * implementation will attempt to update the final perspective to the value specified by
+ * {@link #getFinalPerspectiveID() }
+ * </p>
+ *
+ * @throws InvocationTargetException
+ *
+ * @see org.eclipse.wst.common.frameworks.internal.ui.wizard.WTPWizard#postPerformFinish()
+ */
+/* protected void postPerformFinish() throws InvocationTargetException {
+ if (getFinalPerspectiveID() != null && getFinalPerspectiveID().length() > 0) {
+ final IConfigurationElement element = new DelegateConfigurationElement(configurationElement) {
+ public String getAttribute(String aName) {
+ if (aName.equals("finalPerspective")) { //$NON-NLS-1$
+ return getFinalPerspectiveID();
+ }
+ return super.getAttribute(aName);
+ }
+ };
+ BasicNewProjectResourceWizard.updatePerspective(element);
+ } else
+ BasicNewProjectResourceWizard.updatePerspective(configurationElement);
+
+ String projName = getProjectName();
+ BasicNewResourceWizard.selectAndReveal(ResourcesPlugin.getWorkspace().getRoot().getProject(projName), WSTWebUIPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow());
+ }*/
+
+ /*protected IDataModelOperation getFacetProjectNotificationOperation() {
+ return new DataModelPausibleOperationImpl(new AbstractDataModelOperation(this.model) {
+ public String getID() {
+ return AbstractESBProjectCreationWizard.class.getName();
+ }
+
+ public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ return AbstractDataModelProvider.OK_STATUS;
+ }
+ });
+ }*/
+
+ /**
+ * Need to keep the model in sync with the UI. This method will pickup changes coming from the
+ * UI and push them into the model
+ */
+ protected void facetSelectionChangedEvent() {
+ Set actions = getFacetedProjectWorkingCopy().getProjectFacetActions();
+ Iterator iterator = actions.iterator();
+ Set activeIds = new HashSet();
+ while (iterator.hasNext()) {
+ IFacetedProject.Action action = (IFacetedProject.Action) iterator.next();
+ String id = action.getProjectFacetVersion().getProjectFacet().getId();
+ activeIds.add(id);
+ }
+ // First handle all the actions tracked by IDataModels
+ FacetDataModelMap dataModelMap = (FacetDataModelMap) model.getProperty(FACET_DM_MAP);
+ iterator = dataModelMap.keySet().iterator();
+ while (iterator.hasNext()) {
+ String id = (String) iterator.next();
+ IDataModel configDM = (IDataModel) dataModelMap.get(id);
+ boolean active = activeIds.contains(id);
+ configDM.setBooleanProperty(IFacetDataModelProperties.SHOULD_EXECUTE, active);
+ activeIds.remove(id);
+ }
+ // Now handle the actions not tracked by IDataModels
+ FacetActionMap actionMap = (FacetActionMap) model.getProperty(FACET_ACTION_MAP);
+ actionMap.clear();
+ iterator = actions.iterator();
+ while (iterator.hasNext()) {
+ IFacetedProject.Action action = (IFacetedProject.Action) iterator.next();
+ String id = action.getProjectFacetVersion().getProjectFacet().getId();
+ if (activeIds.contains(id)) {
+ actionMap.add(action);
+ }
+ }
+ model.notifyPropertyChange(FACET_RUNTIME, IDataModel.VALID_VALUES_CHG);
+ }
+
+
+
+
+}
Deleted: workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/projects/wizards/ESBProjectCreationWizard.java
===================================================================
--- workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/projects/wizards/ESBProjectCreationWizard.java 2008-08-27 00:41:46 UTC (rev 9914)
+++ workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/projects/wizards/ESBProjectCreationWizard.java 2008-08-27 07:56:48 UTC (rev 9915)
@@ -1,83 +0,0 @@
-package org.jboss.tools.esb.projects.wizards;
-
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.wizard.IWizardPage;
-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;
-import org.eclipse.wst.common.project.facet.core.IFacetedProjectTemplate;
-import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
-import org.eclipse.wst.project.facet.IProductConstants;
-import org.eclipse.wst.project.facet.ProductManager;
-import org.eclipse.wst.web.ui.internal.WSTWebUIPlugin;
-import org.jboss.tools.esb.projects.wizards.pages.AbstractESBWizardPage;
-import org.jboss.tools.esb.projects.wizards.pages.NewESBProjectWizardPage;
-
-public class ESBProjectCreationWizard extends AbstractESBProjectCreationWizard{
-
- protected IDataModel createDataModel() {
- return DataModelFactory.createDataModel(new JBossESBFacetProjectCreationDataModelProvider());
- }
-
- protected ImageDescriptor getDefaultPageImageDescriptor() {
- return WSTWebUIPlugin.getDefault().getImageDescriptor("newwprj_wiz"); //$NON-NLS-1$
- }
-
- protected IFacetedProjectTemplate getTemplate() {
- return ProjectFacetsManager.getTemplate("template.jboss.esb"); //$NON-NLS-1$
- }
-
- protected IWizardPage createFirstPage() {
- return new AbstractESBWizardPage(model, "first.page"); //$NON-NLS-1$
- }
-
- protected String getFinalPerspectiveID() {
- return ProductManager.getProperty(IProductConstants.FINAL_PERSPECTIVE_STATICWEB);
- }
-
- protected IWizardPage[] createBeginingPages() {
- return new IWizardPage[]{createFirstPage()/*, new ESBProjectTemplateWizardPage(this.model, "Templates"),
- new TemplatePackageNameWizardPage(this.model, "Set Package Name")*/};
- }
-
-
- @Override
- public void addPages() {
- new NewESBProjectWizardPage(model, "first.page"); //$NON-NLS-1$
-
- super.addPages();
- }
-
- @Override
- public boolean performFinish() {
-
- boolean rtn = super.performFinish();
- IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(this.getProjectName());
- IFile esbFile = project.getFile("/ESBContent/META-INF/jboss-esb.xml");
-
- IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
- if(esbFile != null){
- try {
- IDE.openEditor(page, esbFile, "org.jboss.tools.esb.editor.editors.ESBComposedEditor", true);
- } catch (PartInitException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- return rtn;
- }
-
-
-
-}
-
-
-
Added: workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/projects/wizards/ESBProjectCreationWizard.java
===================================================================
--- workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/projects/wizards/ESBProjectCreationWizard.java (rev 0)
+++ workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/projects/wizards/ESBProjectCreationWizard.java 2008-08-27 07:56:48 UTC (rev 9915)
@@ -0,0 +1,83 @@
+package org.jboss.tools.esb.projects.wizards;
+
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.wizard.IWizardPage;
+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;
+import org.eclipse.wst.common.project.facet.core.IFacetedProjectTemplate;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+import org.eclipse.wst.project.facet.IProductConstants;
+import org.eclipse.wst.project.facet.ProductManager;
+import org.eclipse.wst.web.ui.internal.WSTWebUIPlugin;
+import org.jboss.tools.esb.projects.wizards.pages.AbstractESBWizardPage;
+import org.jboss.tools.esb.projects.wizards.pages.NewESBProjectWizardPage;
+
+public class ESBProjectCreationWizard extends AbstractESBProjectCreationWizard{
+
+ protected IDataModel createDataModel() {
+ return DataModelFactory.createDataModel(new JBossESBFacetProjectCreationDataModelProvider());
+ }
+
+ protected ImageDescriptor getDefaultPageImageDescriptor() {
+ return WSTWebUIPlugin.getDefault().getImageDescriptor("newwprj_wiz"); //$NON-NLS-1$
+ }
+
+ protected IFacetedProjectTemplate getTemplate() {
+ return ProjectFacetsManager.getTemplate("template.jboss.esb"); //$NON-NLS-1$
+ }
+
+ protected IWizardPage createFirstPage() {
+ return new AbstractESBWizardPage(model, "first.page"); //$NON-NLS-1$
+ }
+
+ protected String getFinalPerspectiveID() {
+ return ProductManager.getProperty(IProductConstants.FINAL_PERSPECTIVE_STATICWEB);
+ }
+
+ protected IWizardPage[] createBeginingPages() {
+ return new IWizardPage[]{createFirstPage()/*, new ESBProjectTemplateWizardPage(this.model, "Templates"),
+ new TemplatePackageNameWizardPage(this.model, "Set Package Name")*/};
+ }
+
+/*
+ @Override
+ public void addPages() {
+ new NewESBProjectWizardPage(model, "first.page"); //$NON-NLS-1$
+
+ super.addPages();
+ }*/
+
+ @Override
+ public boolean performFinish() {
+
+ boolean rtn = super.performFinish();
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(this.getProjectName());
+ IFile esbFile = project.getFile("/ESBContent/META-INF/jboss-esb.xml");
+
+ IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ if(esbFile != null){
+ try {
+ IDE.openEditor(page, esbFile, "org.jboss.tools.esb.editor.editors.ESBComposedEditor", true);
+ } catch (PartInitException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ return rtn;
+ }
+
+
+
+}
+
+
+
Deleted: workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/projects/wizards/JBossESBFacetProjectCreationDataModelProvider.java
===================================================================
--- workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/projects/wizards/JBossESBFacetProjectCreationDataModelProvider.java 2008-08-27 00:41:46 UTC (rev 9914)
+++ workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/projects/wizards/JBossESBFacetProjectCreationDataModelProvider.java 2008-08-27 07:56:48 UTC (rev 9915)
@@ -1,64 +0,0 @@
-package org.jboss.tools.esb.projects.wizards;
-
-import java.util.ArrayList;
-import java.util.Collection;
-
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jst.common.project.facet.IJavaFacetInstallDataModelProperties;
-import org.eclipse.jst.common.project.facet.JavaFacetUtils;
-import org.eclipse.wst.common.componentcore.datamodel.FacetProjectCreationDataModelProvider;
-import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetDataModelProperties;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.project.facet.core.IProjectFacet;
-import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
-import org.eclipse.wst.project.facet.ProductManager;
-import org.jboss.tools.esb.project.facet.IJBossESBFacetDataModelProperties;
-import org.jboss.tools.esb.utils.ResourceUtils;
-
-public class JBossESBFacetProjectCreationDataModelProvider extends
- FacetProjectCreationDataModelProvider {
-
-
- public void init() {
- super.init();
-
- Collection<IProjectFacet> requiredFacets = new ArrayList<IProjectFacet>();
- requiredFacets.add(JavaFacetUtils.JAVA_FACET);
- requiredFacets.add(ProjectFacetsManager.getProjectFacet("jboss.esb"));
- setProperty(REQUIRED_FACETS_COLLECTION, requiredFacets);
-
- FacetDataModelMap map = (FacetDataModelMap) getProperty(FACET_DM_MAP);
- IDataModel javaFacet = map.getFacetDataModel( JavaFacetUtils.JAVA_FACET.getId() );
- javaFacet.setProperty(IJavaFacetInstallDataModelProperties.SOURCE_FOLDER_NAME, "src");
- // If using optimized single root structure, set the output folder to "<content folder>/WEB-INF/classes"
- /*if (ProductManager.shouldUseSingleRootStructure())
- javaFacet.setProperty(IJavaFacetInstallDataModelProperties.DEFAULT_OUTPUT_FOLDER_NAME, webRoot+"/"+J2EEConstants.WEB_INF_CLASSES); //$NON-NLS-1$
-*/
- }
-
- public Object getDefaultProperty(String propertyName) {
- if (IFacetDataModelProperties.FACET_ID.equals(propertyName)) {
- return "jboss.esb";
- }
- else if (IJBossESBFacetDataModelProperties.DEFAULT_LOCATION.equals(propertyName)){
- return ResourcesPlugin.getWorkspace().getRoot().getFullPath();
- }
- else if(IJBossESBFacetDataModelProperties.USER_DEFINED_LOCATION.equals(propertyName)){
- return true;
- }
- else if(IJBossESBFacetDataModelProperties.FACET_PROJECT_NAME.equals(propertyName)){
- return "";
- }
- return super.getDefaultProperty(propertyName);
- }
-
- @Override
- public IStatus validate(String propertyName) {
- if(FACET_PROJECT_NAME.equals(propertyName)){
- String projectName = model.getStringProperty(FACET_PROJECT_NAME);
- return ResourceUtils.validateName(projectName);
- }
- return super.validate(propertyName);
- }
-}
Added: workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/projects/wizards/JBossESBFacetProjectCreationDataModelProvider.java
===================================================================
--- workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/projects/wizards/JBossESBFacetProjectCreationDataModelProvider.java (rev 0)
+++ workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/projects/wizards/JBossESBFacetProjectCreationDataModelProvider.java 2008-08-27 07:56:48 UTC (rev 9915)
@@ -0,0 +1,64 @@
+package org.jboss.tools.esb.projects.wizards;
+
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jst.common.project.facet.IJavaFacetInstallDataModelProperties;
+import org.eclipse.jst.common.project.facet.JavaFacetInstallDataModelProvider;
+import org.eclipse.wst.common.componentcore.datamodel.FacetProjectCreationDataModelProvider;
+import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetDataModelProperties;
+import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.jboss.tools.esb.project.facet.IJBossESBFacetDataModelProperties;
+import org.jboss.tools.esb.project.facet.JBossESBFacetInstallationConfig;
+import org.jboss.tools.esb.utils.ESBProjectUtil;
+
+public class JBossESBFacetProjectCreationDataModelProvider extends
+ FacetProjectCreationDataModelProvider {
+
+
+ public void init() {
+ super.init();
+
+ FacetDataModelMap map = (FacetDataModelMap) getProperty(FACET_DM_MAP);
+ IDataModel javaFacet = DataModelFactory.createDataModel(new JavaFacetInstallDataModelProvider());
+ map.add(javaFacet);
+
+ IDataModel esbFacet = DataModelFactory.createDataModel(new JBossESBFacetInstallationConfig());
+ map.add(esbFacet);
+
+ javaFacet.setProperty(
+ IJavaFacetInstallDataModelProperties.SOURCE_FOLDER_NAME,
+ esbFacet
+ .getStringProperty(IJBossESBFacetDataModelProperties.ESB_SOURCE_FOLDER));
+
+
+ }
+
+ public Object getDefaultProperty(String propertyName) {
+ if (IFacetDataModelProperties.FACET_ID.equals(propertyName)) {
+ return "jst.jboss.esb";
+ }
+ else if (IJBossESBFacetDataModelProperties.DEFAULT_LOCATION.equals(propertyName)){
+ return ResourcesPlugin.getWorkspace().getRoot().getFullPath();
+ }
+ else if(IJBossESBFacetDataModelProperties.USER_DEFINED_LOCATION.equals(propertyName)){
+ return true;
+ }
+ else if(IJBossESBFacetDataModelProperties.FACET_PROJECT_NAME.equals(propertyName)){
+ return "";
+ }
+
+ return super.getDefaultProperty(propertyName);
+ }
+
+ @Override
+ public IStatus validate(String propertyName) {
+ if(FACET_PROJECT_NAME.equals(propertyName)){
+ String projectName = model.getStringProperty(FACET_PROJECT_NAME);
+ return ESBProjectUtil.validateName(projectName);
+ }
+ return super.validate(propertyName);
+ }
+
+
+}
Modified: workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/projects/wizards/pages/AbstractESBWizardPage.java
===================================================================
--- workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/projects/wizards/pages/AbstractESBWizardPage.java 2008-08-27 00:41:46 UTC (rev 9914)
+++ workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/projects/wizards/pages/AbstractESBWizardPage.java 2008-08-27 07:56:48 UTC (rev 9915)
@@ -83,7 +83,6 @@
private Text projectNameField;
private Text locationPathField;
private Button browseButton;
- private boolean isValidating = false;
private boolean hasValidPrjLocation = true;
private boolean hasValidPrjName = false;
@@ -108,6 +107,7 @@
}
protected void validatePage() {
+
}
@@ -117,7 +117,11 @@
}
public void propertyChanged(DataModelEvent event) {
- setPageErrorMesage();
+ if(FACET_PROJECT_NAME.equals(event.getPropertyName())
+ || PROJECT_LOCATION.equals(event.getPropertyName())
+ || USE_DEFAULT_LOCATION.equals(event.getPropertyName())){
+ setPageErrorMesage();
+ }
}
private void setPageErrorMesage(){
@@ -156,6 +160,8 @@
createServerTargetComposite(top);
createPrimaryFacetComposite(top);
+ refreshRuntimeCombo(serverTargetCombo, null);
+
setControl(top);
}
@@ -180,27 +186,39 @@
newServerTargetButton.setText("N&ew...");
newServerTargetButton.addSelectionListener(new SelectionAdapter(){
public void widgetSelected(SelectionEvent e) {
- NewRuntimeWizard wizard = new NewRuntimeWizard();
- WizardDialog dialog = new WizardDialog(Display.getCurrent().getActiveShell(),wizard);
-
- boolean isOK = dialog.open() == WizardDialog.OK;//ServerUIUtil.showNewRuntimeWizard(Display.getCurrent().getActiveShell(), null, null);
+
+ Set<IProjectFacetVersion> facetVersions = new HashSet<IProjectFacetVersion>();
+ facetVersions.add(getPrimaryFacetVersion());
+ Set<IRuntime> preAddition = RuntimeManager.getRuntimes(facetVersions);
+ boolean isOK = ServerUIUtil.showNewRuntimeWizard(Display.getCurrent().getActiveShell(), getModuleTypeID(), null);
if(isOK){
- Object obj = wizard.getTaskModel().getObject("runtime");
- if(obj instanceof IRuntime){
- IRuntime newRuntime = (IRuntime)obj;
- refreshRuntimeCombo(FACET_RUNTIME, DataModelEvent.VALUE_CHG, serverTargetCombo, newRuntime);
- }
+ Set<IRuntime> postAddition = RuntimeManager.getRuntimes(facetVersions);
+ IRuntime newAddition = getNewAddition(preAddition, postAddition);
+ model.setProperty(FACET_RUNTIME, newAddition);
+ refreshRuntimeCombo(serverTargetCombo, newAddition);
}
}
});
//Control[] deps = new Control[]{newServerTargetButton};
//synchHelper.synchCombo(serverTargetCombo, FACET_RUNTIME, deps);
- refreshRuntimeCombo(FACET_RUNTIME, DataModelEvent.VALUE_CHG, serverTargetCombo, null);
if (serverTargetCombo.getSelectionIndex() == -1 && serverTargetCombo.getVisibleItemCount() != 0)
serverTargetCombo.select(0);
}
+ private IRuntime getNewAddition(Set<IRuntime> preAddition, Set<IRuntime> postAddition){
+ IRuntime runtime = null;
+ Iterator<IRuntime> runtimes = postAddition.iterator();
+ while(runtimes.hasNext()){
+ runtime = runtimes.next();
+ if(!preAddition.contains(runtime)){
+ return runtime;
+ }
+ }
+
+ return runtime;
+ }
+
protected void createPrimaryFacetComposite(Composite top) {
primaryProjectFacet = ProjectFacetsManager.getProjectFacet( getModuleTypeID() );
if (primaryProjectFacet.getVersions().size() <= 1){
@@ -301,9 +319,9 @@
model.setStringProperty(FACET_PROJECT_NAME, projectNameField.getText());
}
});
+ projectNameField.setFocus();
-
// project specification group
Group projectGroup = new Group(parent, SWT.NONE);
layout = new GridLayout();
@@ -421,7 +439,7 @@
}
public String getModuleTypeID(){
- return "jboss.esb";
+ return "jst.jboss.esb";
}
protected void updatePrimaryVersions(){
@@ -451,34 +469,26 @@
}
- protected void refreshRuntimeCombo(String propertyName, int flag, Combo combo, IRuntime newRuntime) {
- int index = -1;
-
- for(IRuntime runtime:RuntimeManager.getRuntimes()){
- index++;
+ protected void refreshRuntimeCombo(Combo combo, IRuntime newRuntime) {
+ for(IRuntime runtime: RuntimeManager.getRuntimes(primaryProjectFacet.getVersions())){
combo.add(runtime.getName());
- combo.setData(Integer.toString(index), runtime);
- if(newRuntime != null && runtime.getName().equals(newRuntime.getName())){
- combo.select(index);
- }
-
+ //combo.setData(Integer.toString(index), descriptor.getPropertyDescription());
}
combo.add("<None>");
- if(combo.getSelectionIndex() < 0){
- combo.select(combo.getItemCount() - 1);
-
+ if(newRuntime != null){
+ combo.setText(newRuntime.getName());
}
+ else{
+ combo.setText("<None>");
+ }
}
private void saveRuntimeToProject(){
- String selectedRuntime = Integer.toString(serverTargetCombo.getSelectionIndex());
- Object obj = serverTargetCombo.getData(selectedRuntime);
-
- model.setProperty(FACET_RUNTIME, obj);
+ IRuntime selectedRunime = RuntimeManager.getRuntime(serverTargetCombo.getText());
+ model.setProperty(FACET_RUNTIME, selectedRunime);
}
-
protected void handlePrimaryFacetVersionSelectedEvent()
Modified: workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/projects/wizards/pages/ESBFacetInstallationPage.java
===================================================================
--- workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/projects/wizards/pages/ESBFacetInstallationPage.java 2008-08-27 00:41:46 UTC (rev 9914)
+++ workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/projects/wizards/pages/ESBFacetInstallationPage.java 2008-08-27 07:56:48 UTC (rev 9915)
@@ -1,34 +1,53 @@
package org.jboss.tools.esb.projects.wizards.pages;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.jst.common.project.facet.IJavaFacetInstallDataModelProperties;
+import org.eclipse.jst.common.project.facet.JavaFacetUtils;
+import org.eclipse.jst.common.project.facet.core.JavaFacet;
+import org.eclipse.jst.common.project.facet.core.internal.JavaFacetUtil;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
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.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
-import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetInstallDataModelProperties;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelWizardPage;
import org.eclipse.wst.common.project.facet.ui.AbstractFacetWizardPage;
import org.eclipse.wst.common.project.facet.ui.IFacetWizardPage;
-import org.eclipse.wst.common.project.facet.ui.IWizardContext;
-import org.eclipse.wst.web.internal.ResourceHandler;
-import org.eclipse.wst.web.ui.internal.wizards.DataModelFacetInstallPage;
-import org.eclipse.wst.web.ui.internal.wizards.IWstWebUIContextIds;
+import org.jboss.tools.esb.JBossESBPlugin;
+import org.jboss.tools.esb.project.classpath.JBossRuntime;
+import org.jboss.tools.esb.project.classpath.JBossRuntimeManager;
import org.jboss.tools.esb.project.facet.IJBossESBFacetDataModelProperties;
+import org.jboss.tools.esb.project.preference.controls.JBossRuntimeListFieldEditor;
+import org.jboss.tools.esb.project.utils.StatusUtils;
+import org.jboss.tools.esb.utils.ESBProjectUtil;
public class ESBFacetInstallationPage extends AbstractFacetWizardPage implements IFacetWizardPage, IJBossESBFacetDataModelProperties {
private Label configFolderLabel;
private Text configFolder;
private Label contextRootLabel;
- private Text contextRoot;
+ private Text contentFolder;
private IDataModel model;
+ private boolean hasValidContentFolder = true;
+ private boolean hasValidSrc = true;
+ private boolean hasRuntime = true;
+ private Combo cmbRuntimes;
public ESBFacetInstallationPage() {
super( "simpleweb.facet.install.page"); //$NON-NLS-1$
@@ -64,10 +83,19 @@
this.contextRootLabel.setText("Content Directory");
this.contextRootLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- this.contextRoot = new Text(prjGroup, SWT.BORDER);
- this.contextRoot.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- this.contextRoot.setData("label", this.contextRootLabel); //$NON-NLS-1$
- this.contextRoot.setText("ESBContent");
+ this.contentFolder = new Text(prjGroup, SWT.BORDER);
+ this.contentFolder.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ this.contentFolder.setData("label", this.contextRootLabel); //$NON-NLS-1$
+ this.contentFolder.setText("esbcontent");
+ contentFolder.addModifyListener(new ModifyListener(){
+ public void modifyText(ModifyEvent e){
+ String content = contentFolder.getText();
+ if(content != null && !content.equals("")){
+ model.setProperty(ESB_CONTENT_FOLDER, content);
+ }
+ changePageStatus();
+ }
+ });
//synchHelper.synchText(contextRoot, CONTEXT_ROOT, new Control[]{contextRootLabel});
configFolderLabel = new Label(prjGroup, SWT.NONE);
@@ -78,45 +106,194 @@
configFolder.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
configFolder.setData("label", configFolderLabel); //$NON-NLS-1$
configFolder.setText("src");
+ configFolder.addModifyListener(new ModifyListener(){
+ public void modifyText(ModifyEvent e){
+ String srcFolder = configFolder.getText();
+ if(srcFolder != null && !srcFolder.equals("")){
+ model.setProperty(ESB_SOURCE_FOLDER, srcFolder);
+ }
+ changePageStatus();
+ }
+
+ });
}
+
private void createRuntimeGroup(Composite parent){
Group runtimeGroup = new Group(parent, SWT.BORDER);
- runtimeGroup.setText("ESB Runtime");
+ runtimeGroup.setText("JBoss ESB Runtime");
runtimeGroup.setLayout(new GridLayout(4, false));
runtimeGroup.setLayoutData(new GridData(GridData.FILL_BOTH));
- Button btnServerSupplied = new Button(runtimeGroup, SWT.RADIO);
+ /* Button btnServerSupplied = new Button(runtimeGroup, SWT.RADIO);
GridData gd = new GridData();
gd.horizontalSpan = 1;
- btnServerSupplied.setLayoutData(gd);
+ btnServerSupplied.setLayoutData(gd);*/
- Label lblServerSupplied = new Label(runtimeGroup, SWT.NONE);
+ /*Label lblServerSupplied = new Label(runtimeGroup, SWT.NONE);
lblServerSupplied.setText("Server supplied ESB Runtime");
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan = 3;
lblServerSupplied.setLayoutData(gd);
- Button btnUserSupplied = new Button(runtimeGroup, SWT.RADIO);
+ Button btnUserSupplied = new Button(runtimeGroup, SWT.RADIO);*/
- Combo cmbRuntimes = new Combo(runtimeGroup, SWT.READ_ONLY);
+ cmbRuntimes = new Combo(runtimeGroup, SWT.READ_ONLY);
cmbRuntimes.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ cmbRuntimes.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ String runtimeName = cmbRuntimes.getText();
+ JBossRuntime jr = (JBossRuntime) cmbRuntimes
+ .getData(runtimeName);
+ saveJBosswsRuntimeToModel(jr);
+ }
+ });
+ initializeRuntimesCombo(cmbRuntimes, null);
-
-
Button btnNew = new Button(runtimeGroup, SWT.NONE);
btnNew.setText("New");
-
+ btnNew.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ newJBossWSRuntime();
+ changePageStatus();
+ }
+ });
}
+
+
+ /*
+ * create a new jbossws runtime and set user supplied runtime to the new one
+ */
+ protected void newJBossWSRuntime() {
+ List<JBossRuntime> exists = new ArrayList<JBossRuntime>(Arrays.asList(JBossRuntimeManager.getInstance().getRuntimes()));
+ List<JBossRuntime> added = new ArrayList<JBossRuntime>();
+
+ JBossRuntimeListFieldEditor.JBossRuntimeNewWizard newRtwizard = new JBossRuntimeListFieldEditor.JBossRuntimeNewWizard(
+ exists, added) {
+ public boolean performFinish() {
+ JBossRuntime rt = getRuntime();
+ rt.setDefault(true);
+ JBossRuntimeManager.getInstance().addRuntime(rt);
+ JBossRuntimeManager.getInstance().save();
+
+ return true;
+ }
+ };
+ WizardDialog dialog = new WizardDialog(Display.getCurrent()
+ .getActiveShell(), newRtwizard);
+ if (dialog.open() == WizardDialog.OK) {
+ initializeRuntimesCombo(cmbRuntimes, null);
+ //cmbRuntimes.select(0);
+ }
+ }
+ protected void initializeRuntimesCombo(Combo cmRuntime, String runtimeName) {
+ JBossRuntime selectedJbws = null;
+ JBossRuntime defaultJbws = null;
+ int selectIndex = 0;
+ int defaultIndex = 0;
+ cmRuntime.removeAll();
+ JBossRuntime[] runtimes = JBossRuntimeManager.getInstance()
+ .getRuntimes();
+ for (int i = 0; i < runtimes.length; i++) {
+ JBossRuntime jr = runtimes[i];
+ cmRuntime.add(jr.getName());
+ cmRuntime.setData(jr.getName(), jr);
+
+ if(jr.getName().equals(runtimeName)){
+ selectedJbws = jr;
+ selectIndex = i;
+ }
+ // get default jbossws runtime
+ if (jr.isDefault()) {
+ defaultJbws = jr;
+ defaultIndex = i;
+ }
+ }
+
+ if(selectedJbws != null){
+ cmRuntime.select(selectIndex);
+ saveJBosswsRuntimeToModel(selectedJbws);
+ }else if(defaultJbws != null){
+ cmRuntime.select(defaultIndex);
+ saveJBosswsRuntimeToModel(defaultJbws);
+ }
+ }
+
+ protected void saveJBosswsRuntimeToModel(JBossRuntime jbws) {
+ /* String duplicateMsg = "";
+ try {
+ duplicateMsg = ESBProjectUtil.getDuplicateJars(model, jbws.getName());
+ } catch (JavaModelException e1) {
+ JBossESBPlugin.getDefault().getLog().log(
+ StatusUtils.errorStatus(e1));
+ }*/
+ if (jbws != null) {
+ model.setStringProperty(
+ IJBossESBFacetDataModelProperties.RUNTIME_HOME,
+ jbws.getHomeDir());
+ model.setStringProperty(
+ IJBossESBFacetDataModelProperties.RUNTIME_ID, jbws
+ .getName());
+ hasRuntime = true;
+ }else{
+ model.setStringProperty(
+ IJBossESBFacetDataModelProperties.RUNTIME_ID, null);
+ model.setStringProperty(
+ IJBossESBFacetDataModelProperties.RUNTIME_HOME, null);
+ hasRuntime = false;
+ }
+ }
+
+
+
+ private void changePageStatus(){
+ //String duplicateMsg = "";
+ /*try {
+ duplicateMsg = ESBProjectUtil.getDuplicateJars(model, cmbRuntimes.getText());
+ } catch (JavaModelException e1) {
+ JBossESBPlugin.getDefault().getLog().log(
+ StatusUtils.errorStatus(e1));
+ }*/
+
+ if(contentFolder.getText().trim().equals("")){
+ setErrorMessage("Please specify a valid content folder.");
+ hasValidContentFolder = false;
+ setPageComplete(isPageComplete());
+ }
+ else if(configFolder.getText().trim().equals("")){
+ setErrorMessage("Please specify a valid source folder.");
+ hasValidSrc = false;
+ setPageComplete(isPageComplete());
+ }
+ /* else if (!duplicateMsg.equals("")) {
+ setErrorMessage("Duplicated jar on classpath:" + duplicateMsg);
+ }*/
+ else{
+ setErrorMessage(null);
+ hasValidSrc = true;
+ hasValidContentFolder = true;
+ setPageComplete(isPageComplete());
+
+ }
+ }
+
+ @Override
+ public boolean isPageComplete() {
+ return hasValidContentFolder
+ && hasValidSrc
+ && hasRuntime;
+ }
+
+
private void fillMessageGroup(Composite parent){
Group messageGroup = new Group(parent, SWT.BORDER);
messageGroup.setText("Target Message Product");
Copied: workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/utils/ESBProjectUtil.java (from rev 9764, workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/utils/ResourceUtils.java)
===================================================================
--- workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/utils/ESBProjectUtil.java (rev 0)
+++ workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/utils/ESBProjectUtil.java 2008-08-27 07:56:48 UTC (rev 9915)
@@ -0,0 +1,104 @@
+package org.jboss.tools.esb.utils;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.internal.resources.Resource;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IProjectDescription;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jdt.core.IClasspathContainer;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetDataModelProperties;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.jboss.tools.esb.project.classpath.JBossRuntime;
+import org.jboss.tools.esb.project.classpath.JBossRuntimeManager;
+
+public class ESBProjectUtil {
+
+
+ public static IStatus validateName(String name) {
+ IStatus status = validateProjectName(name);
+ if (!status.isOK())
+ return status;
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(name);
+ if (project.exists()) {
+ return createErrorStatus("A project already exists with this name.");
+ }
+ if (!isPlatformCaseSensitive()) {
+ // now look for a matching case variant in the tree
+ IResource variant = ((Resource) project).findExistingResourceVariant(project.getFullPath());
+ if (variant != null) {
+ return createErrorStatus("A project already exists with this name.");
+ }
+ }
+ return Status.OK_STATUS;
+ }
+
+ public static IStatus validateProjectName(String projectName) {
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ IStatus status = workspace.validateName(projectName, IResource.PROJECT);
+ if (!status.isOK())
+ return status;
+ if (projectName.endsWith(" ")) //$NON-NLS-1$
+ return createErrorStatus("Project names cannot end with white space.");
+ return Status.OK_STATUS;
+ }
+
+ public static boolean isPlatformCaseSensitive() {
+ return Platform.OS_MACOSX.equals(Platform.getOS()) ? false : new
+ java.io.File("a").compareTo(new java.io.File("A")) != 0; //$NON-NLS-1$//$NON-NLS-2$
+ }
+
+ public static IStatus createErrorStatus(String msg){
+ IStatus status = new Status(IStatus.ERROR, "org.jboss.tools.esb.project.ui", msg);
+ return status;
+ }
+
+ public static String getDuplicateJars(IDataModel model, String jbwsName) throws JavaModelException{
+ List<String> allExistingJars = new ArrayList<String>();
+ List<String> runtimeJars = new ArrayList<String>();
+
+ JBossRuntime jbws = JBossRuntimeManager.getInstance().findRuntimeByName(jbwsName);
+ if(jbws.isUserConfigClasspath()){
+ runtimeJars.addAll(jbws.getLibraries());
+ }else{
+ runtimeJars.addAll(JBossRuntimeManager.getInstance().getAllRuntimeJars(jbws));
+ }
+
+ String prjName = model.getStringProperty(IFacetDataModelProperties.FACET_PROJECT_NAME);
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(prjName);
+ IJavaProject javaProject = JavaCore.create(project);
+ IClasspathEntry[] entries = javaProject.getRawClasspath();
+ for(IClasspathEntry entry: entries){
+ if(entry.getEntryKind() == IClasspathEntry.CPE_CONTAINER){
+ IClasspathContainer container = JavaCore.getClasspathContainer(entry.getPath(), javaProject);
+ for(IClasspathEntry containedEntry: container.getClasspathEntries()){
+ allExistingJars.add(containedEntry.getPath().toOSString());
+ }
+ }else if(entry.getEntryKind() == IClasspathEntry.CPE_LIBRARY){
+ allExistingJars.add(entry.getPath().toOSString());
+ }
+ }
+
+ for(String jarName: runtimeJars){
+ if(allExistingJars.contains(jarName)){
+ return jarName;
+ }
+ }
+
+ return "";
+
+ }
+
+
+}
Deleted: workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/utils/ResourceUtils.java
===================================================================
--- workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/utils/ResourceUtils.java 2008-08-27 00:41:46 UTC (rev 9914)
+++ workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/utils/ResourceUtils.java 2008-08-27 07:56:48 UTC (rev 9915)
@@ -1,54 +0,0 @@
-package org.jboss.tools.esb.utils;
-
-import org.eclipse.core.internal.resources.Resource;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.wst.common.frameworks.internal.WTPResourceHandler;
-import org.eclipse.wst.common.frameworks.internal.plugin.WTPCommonMessages;
-import org.eclipse.wst.common.frameworks.internal.plugin.WTPCommonPlugin;
-
-public class ResourceUtils {
-
- public static IStatus validateName(String name) {
- IStatus status = validateProjectName(name);
- if (!status.isOK())
- return status;
- IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(name);
- if (project.exists()) {
- return createErrorStatus("A project already exists with this name.");
- }
- if (!isPlatformCaseSensitive()) {
- // now look for a matching case variant in the tree
- IResource variant = ((Resource) project).findExistingResourceVariant(project.getFullPath());
- if (variant != null) {
- return createErrorStatus("A project already exists with this name.");
- }
- }
- return Status.OK_STATUS;
- }
-
- public static IStatus validateProjectName(String projectName) {
- IWorkspace workspace = ResourcesPlugin.getWorkspace();
- IStatus status = workspace.validateName(projectName, IResource.PROJECT);
- if (!status.isOK())
- return status;
- if (projectName.endsWith(" ")) //$NON-NLS-1$
- return createErrorStatus("Project names cannot end with white space.");
- return Status.OK_STATUS;
- }
-
- public static boolean isPlatformCaseSensitive() {
- return Platform.OS_MACOSX.equals(Platform.getOS()) ? false : new
- java.io.File("a").compareTo(new java.io.File("A")) != 0; //$NON-NLS-1$//$NON-NLS-2$
- }
-
- public static IStatus createErrorStatus(String msg){
- IStatus status = new Status(IStatus.ERROR, "org.jboss.tools.esb.project.ui", msg);
- return status;
- }
-}
16 years, 4 months
JBoss Tools SVN: r9914 - in trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src: main/org/jboss/ide/eclipse/archives/core/build and 3 other directories.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2008-08-26 20:41:46 -0400 (Tue, 26 Aug 2008)
New Revision: 9914
Modified:
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/project/ArchivesBuilder.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/build/ArchiveBuildDelegate.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/DirectoryScannerFactory.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveFileSet.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveFileSetImpl.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/util/ModelUtil.java
Log:
JBIDE-2693
Modified: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/project/ArchivesBuilder.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/project/ArchivesBuilder.java 2008-08-26 21:39:17 UTC (rev 9913)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/project/ArchivesBuilder.java 2008-08-27 00:41:46 UTC (rev 9914)
@@ -77,7 +77,7 @@
ArchiveBuildDelegate delegate = new ArchiveBuildDelegate();
if (kind == IncrementalProjectBuilder.INCREMENTAL_BUILD || kind == IncrementalProjectBuilder.AUTO_BUILD) {
fillDeltas(interestingProjects, addedChanged, removed);
- delegate.projectIncrementalBuild(addedChanged, removed);
+ delegate.incrementalBuild(null,addedChanged, removed,true);
} else if (kind == IncrementalProjectBuilder.FULL_BUILD){
// build each package fully
@@ -126,9 +126,9 @@
// ignore the packages project. that will it's own build call,
// or will handle the change in some other way
if( !delta.getResource().equals(proj.findMember(IArchiveModel.DEFAULT_PACKAGES_FILE)))
- addedChanged.add(delta.getResource().getLocation());
+ addedChanged.add(delta.getResource().getFullPath());
} else if( (delta.getKind() & IResourceDelta.REMOVED ) > 0 ) {
- removed.add(delta.getResource().getLocation());
+ removed.add(delta.getResource().getFullPath());
}
}
return true;
Modified: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/build/ArchiveBuildDelegate.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/build/ArchiveBuildDelegate.java 2008-08-26 21:39:17 UTC (rev 9913)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/build/ArchiveBuildDelegate.java 2008-08-27 00:41:46 UTC (rev 9914)
@@ -151,22 +151,7 @@
EventManager.finishedCollectingFileSet(fileset);
}
-
-
-
/**
- * Incremental Build!!
- * Parameters are instances of changed IPath objects.
- * Will search the entire model for matching filesets.
- *
- * @param addedChanged Set of changed / added resources
- * @param setRemoved Set of removed resources
- */
- public void projectIncrementalBuild(Set<IPath> addedChanged, Set<IPath> removed) {
- incrementalBuild(null, addedChanged, removed);
- }
-
- /**
* Incremental build.
* Parameters are instance sof changed IPath objects
* Will search only the given node for matching descendent filesets
@@ -174,34 +159,58 @@
* @param addedChanged A list of added or changed resource paths
* @param removed A list of removed resource paths
*/
- public void incrementalBuild(IArchive archive, Set<IPath> addedChanged, Set<IPath> removed) {
+ public void incrementalBuild(IArchive archive, Set<IPath> addedChanged,
+ Set<IPath> removed, boolean workspaceRelative) {
// find any and all filesets that match each file
- Iterator<IPath> i = addedChanged.iterator();
- IPath path;
+ Iterator<IPath> i;
+ IPath path, globalPath;
IArchiveFileSet[] matchingFilesets;
ArrayList<IArchive> topPackagesChanged = new ArrayList<IArchive>();
+ ArrayList<IArchiveFileSet> seen = new ArrayList<IArchiveFileSet>();
+
+ // Handle the removed files first. Hopefully the fileset hasn't been reset yet
+ // or it could make this block of code fail.
+ i = removed.iterator();
while(i.hasNext()) {
- path = i.next();
- matchingFilesets = ModelUtil.getMatchingFilesets(archive, path);
+ path = ((IPath)i.next());
+ globalPath = !workspaceRelative ? path :
+ ArchivesCore.getInstance().getVFS().workspacePathToAbsolutePath(path);
+
+ matchingFilesets = ModelUtil.getMatchingFilesets(archive, path, workspaceRelative);
localFireAffectedTopLevelPackages(topPackagesChanged, matchingFilesets);
for( int j = 0; j < matchingFilesets.length; j++ ) {
- ModelTruezipBridge.copyFiles(matchingFilesets[j], matchingFilesets[j].getMatches(path));
+ ModelTruezipBridge.deleteFiles(matchingFilesets[j], matchingFilesets[j].getMatches(globalPath));
+ if( !seen.contains(matchingFilesets[j])) {
+ seen.add(matchingFilesets[j]);
+ }
}
- EventManager.fileUpdated(path, matchingFilesets);
+ EventManager.fileRemoved(path, matchingFilesets);
}
+
+ // reset all of the filesets that have already matched
+ Iterator<IArchiveFileSet> fit = seen.iterator();
+ while(fit.hasNext())
+ fit.next().resetScanner();
- i = removed.iterator();
+ i = addedChanged.iterator();
while(i.hasNext()) {
- path = ((IPath)i.next());
- matchingFilesets = ModelUtil.getMatchingFilesets(archive, path);
+ path = i.next();
+ globalPath = !workspaceRelative ? path :
+ ArchivesCore.getInstance().getVFS().workspacePathToAbsolutePath(path);
+ matchingFilesets = ModelUtil.getMatchingFilesets(archive, path, workspaceRelative);
localFireAffectedTopLevelPackages(topPackagesChanged, matchingFilesets);
for( int j = 0; j < matchingFilesets.length; j++ ) {
- ModelTruezipBridge.deleteFiles(matchingFilesets[j], matchingFilesets[j].getMatches(path));
+ if( !seen.contains(matchingFilesets[j])) {
+ seen.add(matchingFilesets[j]);
+ matchingFilesets[j].resetScanner();
+ }
+ ModelTruezipBridge.copyFiles(matchingFilesets[j], matchingFilesets[j].getMatches(globalPath));
}
- EventManager.fileRemoved(path, matchingFilesets);
+ EventManager.fileUpdated(path, matchingFilesets);
}
+
TrueZipUtil.sync();
Iterator<IArchive> i2 = topPackagesChanged.iterator();
Modified: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/DirectoryScannerFactory.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/DirectoryScannerFactory.java 2008-08-26 21:39:17 UTC (rev 9913)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/DirectoryScannerFactory.java 2008-08-27 00:41:46 UTC (rev 9914)
@@ -222,5 +222,9 @@
return false;
}
}
+
+ public boolean couldBeIncluded(String name, boolean inWorkspace) {
+ return super.isIncluded(name) && !super.isExcluded(name);
+ }
}
}
Modified: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveFileSet.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveFileSet.java 2008-08-26 21:39:17 UTC (rev 9913)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveFileSet.java 2008-08-27 00:41:46 UTC (rev 9914)
@@ -41,8 +41,6 @@
public static final String FLATTENED_ATTRIBUTE = ATTRIBUTE_PREFIX + "flattened";
public static final String SOURCE_PATH_ATTRIBUTE = ATTRIBUTE_PREFIX + "sourcePath";
-
-
/**
* @return Whether or not this fileset's basedir is inside the workspace
*/
@@ -74,35 +72,6 @@
public String getExcludesPattern();
/**
- * @return An array of matching IPath's in the filesystem (for external filesystem filesets)
- */
- public FileWrapper[] findMatchingPaths();
-
- /**
- * Get the FileWrapper objects that match this path
- * @param path
- * @return
- */
- public FileWrapper[] getMatches(IPath path);
-
- /**
- * @param path The absolute path on the filesystem to check
- * @return Whether or not this fileset matches the passed-in path
- */
- public boolean matchesPath(IPath path);
-
- /**
- * Does this global path file match this fileset
- * at the specific fileset-relative location?
- *
- * If fsRelative is null, just match the path
- * @param globalPath
- * @param fsRelative
- * @return
- */
- public boolean matchesPath(IPath globalPath, String fsRelative);
-
- /**
* Sets the "root" or "source" of this fileset (file-system or workspace relative)
* @param path The absolute path that is the source of this fileset
*/
@@ -132,4 +101,35 @@
*/
public void setFlattened(boolean flattened);
+
+ /**
+ * @return An array of matching IPath's in the filesystem (for external filesystem filesets)
+ */
+ public FileWrapper[] findMatchingPaths();
+
+ /**
+ * Get the FileWrapper objects that match this path
+ * @param path
+ * @return
+ */
+ public FileWrapper[] getMatches(IPath path);
+
+ /**
+ * This method returns whether the global path passed in matches this fileset.
+ * It must give an accurate answer regardless of whether the path is cached or not.
+ *
+ * @param path The absolute path on the filesystem to check.
+ * @return Whether or not this fileset matches the passed-in path
+ */
+ public boolean matchesPath(IPath path);
+
+ /**
+ * This method returns whether the path passed in matches this fileset.
+ * It must give an accurate answer regardless of whether the path is cached or not.
+ *
+ * @param path The absolute path on the filesystem to check.
+ * @param inWorkspace Whether this is a workspace path or a global path
+ * @return Whether or not this fileset matches the passed-in path
+ */
+ public boolean matchesPath(IPath path, boolean inWorkspace);
}
Modified: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveFileSetImpl.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveFileSetImpl.java 2008-08-26 21:39:17 UTC (rev 9913)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveFileSetImpl.java 2008-08-27 00:41:46 UTC (rev 9914)
@@ -96,27 +96,24 @@
/*
* @see IArchiveFileSet#matchesPath(IPath)
*/
- public boolean matchesPath(IPath path) {
- return matchesPath(path, null);
+ public boolean matchesPath(IPath globalPath) {
+ return matchesPath(globalPath, false);
}
- public boolean matchesPath(IPath globalPath, String fsRelative) {
+ public boolean matchesPath(IPath path, boolean inWorkspace) {
getScanner();
+ IPath globalPath = path;
+ if( inWorkspace )
+ globalPath = ArchivesCore.getInstance().getVFS().workspacePathToAbsolutePath(path);
+
ArrayList<FileWrapper> result = matchingMap.get(globalPath.toFile().getAbsolutePath());
- if( result != null ) {
- if( result.size() > 0 && fsRelative == null )
+ if( result != null )
+ if( result.size() > 0 )
return true;
-
- FileWrapper tmp;
- for( int i = 0; i < result.size(); i++ ) {
- tmp = result.get(i);
- if( tmp.getFilesetRelative().equals(fsRelative))
- return true;
- }
- }
- return false;
+
+ return getScanner().couldBeIncluded(path.toString(), inWorkspace);
}
-
+
public FileWrapper[] getMatches(IPath path) {
getScanner();
ArrayList<FileWrapper> l = matchingMap.get(path.toFile().getAbsolutePath());
Modified: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/util/ModelUtil.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/util/ModelUtil.java 2008-08-26 21:39:17 UTC (rev 9913)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/util/ModelUtil.java 2008-08-27 00:41:46 UTC (rev 9914)
@@ -27,7 +27,6 @@
import java.util.Iterator;
import java.util.List;
-import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.jboss.ide.eclipse.archives.core.ArchivesCore;
@@ -61,17 +60,8 @@
*
*/
public class ModelUtil {
-
+
/**
- * Get any declared fileset that matches this path and are registered with the model
- * @param path
- * @return
- */
- public static IArchiveFileSet[] getMatchingFilesets(final IPath path) {
- return getMatchingFilesets(null, path);
- }
-
- /**
* Get any declared filesets that match this path and are
* a child of the given node
* @param node
@@ -79,11 +69,15 @@
* @return
*/
public static IArchiveFileSet[] getMatchingFilesets(IArchiveNode node, final IPath path) {
+ return getMatchingFilesets(node, path, false);
+ }
+
+ public static IArchiveFileSet[] getMatchingFilesets(IArchiveNode node, final IPath path, final boolean inWorkspace) {
final ArrayList<IArchiveFileSet> rets = new ArrayList<IArchiveFileSet>();
IArchiveNodeVisitor visitor = new IArchiveNodeVisitor() {
public boolean visit(IArchiveNode node) {
if( node.getNodeType() == IArchiveNode.TYPE_ARCHIVE_FILESET &&
- ((IArchiveFileSet)node).matchesPath(path)) {
+ ((IArchiveFileSet)node).matchesPath(path, inWorkspace)) {
rets.add((IArchiveFileSet)node);
}
return true;
@@ -178,14 +172,7 @@
* @return
*/
public static IPath getBaseDestinationFile(IArchiveNode node) {
- ArrayList<IArchiveNode> list = new ArrayList<IArchiveNode>();
- while( node != null && !(node instanceof ArchiveModelNode)) {
- list.add(node);
- node = node.getParent();
- }
- Collections.reverse(list);
- IArchiveNode[] nodes = list.toArray(new IArchiveNode[list.size()]);
-
+ IArchiveNode[] nodes = getReverseNodeTree(node);
IPath lastConcrete = null;
for( int i = 0; i < nodes.length; i++ ) {
if( nodes[i] instanceof IArchive) {
@@ -205,10 +192,29 @@
public static IPath getBaseDestinationFile(IArchiveFileSet node, IPath fsRelative) {
IPath last = getBaseDestinationFile(node);
- if( fsRelative != null )
- last = last.append(fsRelative);
+ if( fsRelative != null ) {
+ IArchiveNode[] nodes = getReverseNodeTree(node);
+ boolean anyZipped = false;
+ for( int i = 0; !anyZipped && i < nodes.length; i++ )
+ if( nodes[i] instanceof IArchive && !((IArchive)nodes[i]).isExploded())
+ anyZipped = true;
+
+ if(!anyZipped) // none are zipped, we can append this path
+ last = last.append(fsRelative);
+ }
return last;
}
+
+ private static IArchiveNode[] getReverseNodeTree(IArchiveNode node) {
+ ArrayList<IArchiveNode> list = new ArrayList<IArchiveNode>();
+ while( node != null && !(node instanceof ArchiveModelNode)) {
+ list.add(node);
+ node = node.getParent();
+ }
+ Collections.reverse(list);
+ IArchiveNode[] nodes = list.toArray(new IArchiveNode[list.size()]);
+ return nodes;
+ }
public static void fillArchiveModel( XbPackages node, IArchiveModelRootNode modelNode) throws ArchivesModelException {
for (Iterator iter = node.getAllChildren().iterator(); iter.hasNext(); ) {
16 years, 4 months
JBoss Tools SVN: r9913 - trunk/core/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/ui.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2008-08-26 17:39:17 -0400 (Tue, 26 Aug 2008)
New Revision: 9913
Modified:
trunk/core/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/ui/PreviewPage.java
Log:
JBIDE-2692 - refreshing archives view after preference change (missed a commit)
Modified: trunk/core/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/ui/PreviewPage.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/ui/PreviewPage.java 2008-08-26 21:39:00 UTC (rev 9912)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/ui/PreviewPage.java 2008-08-26 21:39:17 UTC (rev 9913)
@@ -94,7 +94,7 @@
previewGroup.setLayout(new FormLayout());
previewViewer = new TreeViewer(previewGroup);
previewViewer.setLabelProvider(new ArchivesLabelProvider());
- previewViewer.setContentProvider(new ArchivesContentProviderDelegate());
+ previewViewer.setContentProvider(new ArchivesContentProviderDelegate(false));
FormData warPreviewData = new FormData();
warPreviewData.left = new FormAttachment(0,5);
warPreviewData.right = new FormAttachment(100,-5);
16 years, 4 months
JBoss Tools SVN: r9912 - trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2008-08-26 17:39:00 -0400 (Tue, 26 Aug 2008)
New Revision: 9912
Modified:
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/ArchivesRootBridgeContentProvider.java
Log:
JBIDE-2692 - refreshing archives view after preference change
Modified: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/ArchivesRootBridgeContentProvider.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/ArchivesRootBridgeContentProvider.java 2008-08-26 21:31:20 UTC (rev 9911)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/ArchivesRootBridgeContentProvider.java 2008-08-26 21:39:00 UTC (rev 9912)
@@ -3,6 +3,8 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.Viewer;
+import org.jboss.ide.eclipse.archives.ui.PrefsInitializer;
+import org.jboss.ide.eclipse.archives.ui.PrefsInitializer.IArchivesPreferenceListener;
import org.jboss.ide.eclipse.archives.ui.providers.ArchivesContentProviderDelegate.WrappedProject;
/**
@@ -13,10 +15,12 @@
* @author rob.stryker(a)redhat.com
*
*/
-public class ArchivesRootBridgeContentProvider implements ITreeContentProvider {
+public class ArchivesRootBridgeContentProvider
+ implements ITreeContentProvider, IArchivesPreferenceListener {
private ArchivesContentProviderDelegate delegate;
public ArchivesRootBridgeContentProvider() {
delegate = new ArchivesContentProviderDelegate(WrappedProject.CATEGORY);
+ PrefsInitializer.addListener(this);
}
public Object[] getChildren(Object parentElement) {
@@ -38,10 +42,17 @@
}
public void dispose() {
+ PrefsInitializer.removeListener(this);
}
+ private Viewer viewer;
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ this.viewer = viewer;
delegate.inputChanged(viewer, oldInput, newInput);
}
+ public void preferenceChanged(String key, boolean val) {
+ viewer.refresh();
+ }
+
}
16 years, 4 months
JBoss Tools SVN: r9911 - in trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui: preferences and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2008-08-26 17:31:20 -0400 (Tue, 26 Aug 2008)
New Revision: 9911
Modified:
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/PrefsInitializer.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/preferences/MainPreferencePage.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/views/ProjectArchivesCommonView.java
Log:
JBIDE-2692 - refreshing archives view after preference change
Modified: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/PrefsInitializer.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/PrefsInitializer.java 2008-08-26 19:18:26 UTC (rev 9910)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/PrefsInitializer.java 2008-08-26 21:31:20 UTC (rev 9911)
@@ -1,5 +1,8 @@
package org.jboss.ide.eclipse.archives.ui;
+import java.util.ArrayList;
+import java.util.Iterator;
+
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
@@ -18,7 +21,12 @@
public static final String PREF_SHOW_FULL_FILESET_ROOT_DIR = "showFullFilesetRootDir";
public static final String PREF_SHOW_PROJECT_ROOT = "showProjectRoot";
public static final String PREF_SHOW_ALL_PROJECTS = "showAllProjects";
+ public static final ArrayList<IArchivesPreferenceListener> listeners = new ArrayList<IArchivesPreferenceListener>();
+ public static interface IArchivesPreferenceListener {
+ public void preferenceChanged(String key, boolean val);
+ }
+
public void initializeDefaultPreferences() {
IEclipsePreferences prefs = new DefaultScope().getNode(PackagesUIPlugin.PLUGIN_ID);
prefs.putBoolean(PREF_SHOW_FULL_FILESET_ROOT_DIR, true);
@@ -52,9 +60,25 @@
try {
prefs.flush();
} catch (org.osgi.service.prefs.BackingStoreException e) { } // swallow
-
+ fireChanged(key, val);
}
+ protected static void fireChanged(String key, boolean val) {
+ Iterator<IArchivesPreferenceListener> i = listeners.iterator();
+ while(i.hasNext()) {
+ i.next().preferenceChanged(key, val);
+ }
+ }
+
+ public static void addListener(IArchivesPreferenceListener listener) {
+ if( !listeners.contains(listener))
+ listeners.add(listener);
+ }
+
+ public static void removeListener(IArchivesPreferenceListener listener) {
+ listeners.remove(listener);
+ }
+
/**
* Get the global pref value for this key
* @param key
@@ -65,20 +89,7 @@
}
/**
- * Get the *effective* value of this preference upon this adaptable / resource
- * Effective values are the stored value if project-specific prefs are turned on.
- * Effective values are the global value if project-specific prefs are *NOT* turned on.
*
- * @param key
- * @param adaptable
- * @return
- */
-// public static boolean getBoolean(String key, IAdaptable adaptable) {
-// return getBoolean(key, adaptable, true);
-// }
-
- /**
- *
* @param key the preference to be gotten
* @param adaptable the project / resource where the pref might be stored
* @param effective whether or not to get the raw pref value or the effective value
Modified: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/preferences/MainPreferencePage.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/preferences/MainPreferencePage.java 2008-08-26 19:18:26 UTC (rev 9910)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/preferences/MainPreferencePage.java 2008-08-26 21:31:20 UTC (rev 9911)
@@ -182,10 +182,6 @@
PrefsInitializer.setBoolean(PrefsInitializer.PREF_SHOW_FULL_FILESET_ROOT_DIR, showFullFilesetRootDir.getSelection(), getElement());
PrefsInitializer.setBoolean(PrefsInitializer.PREF_SHOW_PROJECT_ROOT, showProjectRoot.getSelection(), getElement());
PrefsInitializer.setBoolean(PrefsInitializer.PREF_SHOW_ALL_PROJECTS, showAllProjects.getSelection(), getElement());
- // TODO FIX THIS
-// if( ProjectArchivesCommonView.getInstance() != null )
-// ProjectArchivesCommonView.getInstance().refreshViewer(null);
-
return true;
}
}
Modified: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/views/ProjectArchivesCommonView.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/views/ProjectArchivesCommonView.java 2008-08-26 19:18:26 UTC (rev 9910)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/views/ProjectArchivesCommonView.java 2008-08-26 21:31:20 UTC (rev 9911)
@@ -27,9 +27,10 @@
import org.jboss.ide.eclipse.archives.core.model.IArchiveNode;
import org.jboss.ide.eclipse.archives.ui.ArchivesSharedImages;
import org.jboss.ide.eclipse.archives.ui.PrefsInitializer;
+import org.jboss.ide.eclipse.archives.ui.PrefsInitializer.IArchivesPreferenceListener;
import org.jboss.ide.eclipse.archives.ui.providers.ArchivesContentProviderDelegate.WrappedProject;
-public class ProjectArchivesCommonView extends CommonNavigator {
+public class ProjectArchivesCommonView extends CommonNavigator implements IArchivesPreferenceListener {
protected static ProjectArchivesCommonView instance;
protected ISelectionListener selectionListener;
protected IProject currentProject;
@@ -47,6 +48,7 @@
public void createPartControl(Composite aParent) {
super.createPartControl(aParent);
addBuildActionToSite();
+ PrefsInitializer.addListener(this);
}
public void init(IViewSite site) throws PartInitException {
@@ -57,6 +59,7 @@
public void dispose() {
super.dispose();
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().removePostSelectionListener(selectionListener);
+ PrefsInitializer.removeListener(this);
}
protected ISelectionListener createSelectionListener() {
@@ -71,13 +74,7 @@
IProject project = getProject(element);
if( project != null && project != currentProject ) {
currentProject = project;
- if( showProjectRoot()) {
- // if we're showing all projects, then the view is already set.
- if( !showAllProjects() || !getCommonViewer().getInput().equals(ResourcesPlugin.getWorkspace().getRoot()))
- getCommonViewer().setInput(ResourcesPlugin.getWorkspace().getRoot());
- } else {
- getCommonViewer().setInput(currentProject);
- }
+ jiggleViewerInput();
}
}
@@ -106,6 +103,16 @@
public IProject getCurrentProject() {
return currentProject;
}
+
+ protected void jiggleViewerInput() {
+ if( showProjectRoot()) {
+ // if we're showing all projects, then the view is already set.
+ if( !showAllProjects() || !getCommonViewer().getInput().equals(ResourcesPlugin.getWorkspace().getRoot()))
+ getCommonViewer().setInput(ResourcesPlugin.getWorkspace().getRoot());
+ } else {
+ getCommonViewer().setInput(currentProject);
+ }
+ }
private boolean showProjectRoot() {
return PrefsInitializer.getBoolean(PrefsInitializer.PREF_SHOW_PROJECT_ROOT);
@@ -156,4 +163,8 @@
return new PropertySheetPage();
return super.getAdapter(adapter);
}
+
+ public void preferenceChanged(String key, boolean val) {
+ jiggleViewerInput();
+ }
}
16 years, 4 months