JBoss Tools SVN: r38659 - trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/condition.
by jbosstools-commits@lists.jboss.org
Author: ljelinko
Date: 2012-02-13 11:18:17 -0500 (Mon, 13 Feb 2012)
New Revision: 38659
Added:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/condition/TreeContainsNode.java
Log:
Created
Added: trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/condition/TreeContainsNode.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/condition/TreeContainsNode.java (rev 0)
+++ trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/condition/TreeContainsNode.java 2012-02-13 16:18:17 UTC (rev 38659)
@@ -0,0 +1,40 @@
+package org.jboss.tools.ui.bot.ext.condition;
+
+import org.eclipse.swtbot.swt.finder.SWTBot;
+import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
+import org.eclipse.swtbot.swt.finder.waits.ICondition;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
+
+public class TreeContainsNode implements ICondition {
+
+ private SWTBotTree tree;
+
+ private String[] path;
+
+ public TreeContainsNode(SWTBotTree tree, String... path) {
+ this.tree = tree;
+ this.path = path;
+ }
+
+ @Override
+ public void init(SWTBot bot) {
+
+ }
+
+ @Override
+ public boolean test() throws Exception {
+ try {
+ tree.expandNode(path);
+ System.out.println("TRUE");
+ return true;
+ } catch (WidgetNotFoundException e){
+ System.out.println("FALSE");
+ return false;
+ }
+ }
+
+ @Override
+ public String getFailureMessage() {
+ return "Expected tree node " + path[path.length -1] + " to become visible ";
+ }
+}
14 years, 1 month
JBoss Tools SVN: r38658 - trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/selection/bar.
by jbosstools-commits@lists.jboss.org
Author: dmaliarevich
Date: 2012-02-13 10:07:32 -0500 (Mon, 13 Feb 2012)
New Revision: 38658
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/selection/bar/SelectionBar.java
Log:
https://issues.jboss.org/browse/JBIDE-10881 - patch is applied.
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/selection/bar/SelectionBar.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/selection/bar/SelectionBar.java 2012-02-13 14:58:38 UTC (rev 38657)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/selection/bar/SelectionBar.java 2012-02-13 15:07:32 UTC (rev 38658)
@@ -19,6 +19,9 @@
import org.eclipse.core.commands.ICommandListener;
import org.eclipse.core.commands.IStateListener;
import org.eclipse.core.commands.State;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.swt.SWT;
@@ -57,6 +60,7 @@
import org.eclipse.ui.internal.IWorkbenchGraphicConstants;
import org.eclipse.ui.internal.WorkbenchImages;
import org.eclipse.ui.part.EditorPart;
+import org.eclipse.ui.progress.UIJob;
import org.eclipse.wst.sse.core.internal.provisional.INodeAdapter;
import org.eclipse.wst.sse.core.internal.provisional.INodeNotifier;
import org.eclipse.wst.sse.ui.StructuredTextEditor;
@@ -838,7 +842,31 @@
* event' instance.
*/
@Override
- public void notifyChanged(INodeNotifier notifier, int eventType, Object changedFeature, Object oldValue, Object newValue, int pos) {
- selectionBar.updateNodes(false);
+ public void notifyChanged(INodeNotifier notifier, int eventType,
+ Object changedFeature, Object oldValue, Object newValue, int pos) {
+ /*
+ * https://issues.jboss.org/browse/JBIDE-10881
+ * Fixing selection bar listeners calls.
+ */
+ if(updateJob == null) {
+ updateJob = new SelectionBarUpdateJob();
+ updateJob.schedule(100);
+ }
}
-}
+
+ SelectionBarUpdateJob updateJob = null;
+ class SelectionBarUpdateJob extends UIJob {
+ public SelectionBarUpdateJob() {
+ super("Selection Bar update job"); //$NON-NLS-1$
+ }
+ @Override
+ public IStatus runInUIThread(IProgressMonitor monitor) {
+ try {
+ selectionBar.updateNodes(false);
+ } finally {
+ updateJob = null;
+ }
+ return Status.OK_STATUS;
+ }
+ }
+}
\ No newline at end of file
14 years, 1 month
JBoss Tools SVN: r38657 - in trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui: wizard and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2012-02-13 09:58:38 -0500 (Mon, 13 Feb 2012)
New Revision: 38657
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/OpenShiftUIActivator.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/GitCloningSettingsWizardPage.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/GitCloningSettingsWizardPageModel.java
Log:
[JBIDE-10878] make sure custom repo path is not resetted when switch back and forth (was: repo path resetted #onPageActivated, now: setting repo path in model constructor, not touching it any more afterwards)
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/OpenShiftUIActivator.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/OpenShiftUIActivator.java 2012-02-13 14:57:07 UTC (rev 38656)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/OpenShiftUIActivator.java 2012-02-13 14:58:38 UTC (rev 38657)
@@ -81,6 +81,10 @@
log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.ERROR, message, e));
}
+ public static IStatus createCancelStatus(String message) {
+ return new Status(IStatus.CANCEL, OpenShiftUIActivator.PLUGIN_ID, message);
+ }
+
public static IStatus createErrorStatus(String message) {
return new Status(IStatus.ERROR, OpenShiftUIActivator.PLUGIN_ID, message);
}
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/GitCloningSettingsWizardPage.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/GitCloningSettingsWizardPage.java 2012-02-13 14:57:07 UTC (rev 38656)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/GitCloningSettingsWizardPage.java 2012-02-13 14:58:38 UTC (rev 38657)
@@ -218,7 +218,7 @@
// allow to enable a proj only for as7 openshift applications
// setTitle(NLS.bind("Import OpenShift application {0}",
// pageModel.getApplicationName()));
- pageModel.resetRepositoryPath();
+// pageModel.resetRepositoryPath();
pageModel.resetRemoteName();
if (pageModel.isNewProject()) {
useDefaultRepoPathButton.setEnabled(true);
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/GitCloningSettingsWizardPageModel.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/GitCloningSettingsWizardPageModel.java 2012-02-13 14:57:07 UTC (rev 38656)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/GitCloningSettingsWizardPageModel.java 2012-02-13 14:58:38 UTC (rev 38657)
@@ -15,7 +15,6 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
-
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
@@ -30,6 +29,7 @@
import com.openshift.express.client.IApplication;
import com.openshift.express.client.ICartridge;
import com.openshift.express.client.OpenShiftException;
+
/**
* @author Andre Dietisheim
* @author Rob Stryker
@@ -72,6 +72,7 @@
public GitCloningSettingsWizardPageModel(IOpenShiftWizardModel wizardModel) {
this.wizardModel = wizardModel;
+ setRepositoryPath(getDefaultRepositoryPath());
}
public boolean isNewProject() {
@@ -79,7 +80,8 @@
}
// public void setMergeUri(String mergeUri) {
- // firePropertyChange(PROPERTY_MERGE_URI, wizardModel.getMergeUri(), wizardModel.setMergeUri(mergeUri));
+ // firePropertyChange(PROPERTY_MERGE_URI, wizardModel.getMergeUri(),
+ // wizardModel.setMergeUri(mergeUri));
// }
//
// public String getMergeUri() {
@@ -130,10 +132,12 @@
// public List<GitUri> getMergeUris() {
// ArrayList<GitUri> mergeUris = new ArrayList<GitUri>();
// mergeUris.add(new GitUri(
- // "seambooking-example", "git://github.com/openshift/seambooking-example.git",
+ // "seambooking-example",
+ // "git://github.com/openshift/seambooking-example.git",
// ICartridge.JBOSSAS_7));
// mergeUris.add(new GitUri(
- // "tweetstream-example", "git://github.com/openshift/tweetstream-example.git",
+ // "tweetstream-example",
+ // "git://github.com/openshift/tweetstream-example.git",
// ICartridge.JBOSSAS_7));
// mergeUris.add(new GitUri(
// "sinatra-example", "git://github.com/openshift/sinatra-example.git",
@@ -205,14 +209,16 @@
}
- public void resetRepositoryPath() {
- if (wizardModel.isNewProject() || getRepositoryPath() == null) {
- setRepositoryPath(getDefaultRepositoryPath());
- }
- }
+ // public void resetRepositoryPath() {
+ // if (wizardModel.isNewProject()
+ // || getRepositoryPath() == null) {
+ // setRepositoryPath(getDefaultRepositoryPath());
+ // }
+ // }
public void resetRemoteName() {
- // if existing project and remote name is still 'origin' -> switch to 'openshift'
+ // if existing project and remote name is still 'origin' -> switch to
+ // 'openshift'
// (so, if existing project and remote name is not 'origin', leave as-is
if (!wizardModel.isNewProject() && NEW_PROJECT_REMOTE_NAME_DEFAULT.equals(getRemoteName())) {
setRemoteName(EXISTING_PROJECT_REMOTE_NAME_DEFAULT);
@@ -224,7 +230,6 @@
}
}
- @Deprecated
private String getDefaultRepositoryPath() {
return EGitUIUtils.getEGitDefaultRepositoryPath();
}
@@ -291,7 +296,7 @@
if (this.useDefaultRepoPath) {
setRepositoryPath(getDefaultRepositoryPath());
} else {
-
+
}
validateRepoPathProject();
}
@@ -302,21 +307,32 @@
private IStatus validateRepoPathProject() {
IStatus status = Status.OK_STATUS;
- // skip the validation if the user wants to create a new project. The name and state of the existing project do
+ // skip the validation if the user wants to create a new project. The
+ // name and state of the existing project do
// not matter...
- final IPath repoPath = new Path(getRepositoryPath());
- if (!isUseDefaultRepoPath()) {
- if (repoPath.isEmpty() || !repoPath.isAbsolute() || !repoPath.toFile().canWrite()) {
- status = new Status(IStatus.ERROR, OpenShiftUIActivator.PLUGIN_ID,
- "The path does not exist or is not writeable.");
+ String applicationName = getApplicationName();
+ if (applicationName == null
+ || applicationName.length() == 0) {
+ status = OpenShiftUIActivator
+ .createCancelStatus("You have to choose an application name / existing application");
+ } else {
+ if (!isUseDefaultRepoPath()) {
+ final IPath repoPath = new Path(getRepositoryPath());
+ if (repoPath.isEmpty()
+ || !repoPath.isAbsolute()
+ || !repoPath.toFile().canWrite()) {
+ status = OpenShiftUIActivator.createErrorStatus("The path does not exist or is not writeable.");
+ } else {
+ final IPath applicationPath = repoPath.append(new Path(getApplicationName()));
+ if (applicationPath.toFile().exists()) {
+ status = OpenShiftUIActivator.createErrorStatus(
+ "The location '" + repoPath.toOSString() + "' already contains a folder named '"
+ + getApplicationName() + "'.");
+ }
+ }
}
}
- final IPath applicationPath = repoPath.append(new Path(getApplicationName()));
- if (applicationPath.toFile().exists()) {
- status = new Status(IStatus.ERROR, OpenShiftUIActivator.PLUGIN_ID,
- "The location '" + repoPath.toOSString() + "' already contains a folder named '"+ getApplicationName() +"'.");
- }
-
+
setCustomRepoPathValidity(status);
return status;
}
@@ -345,17 +361,21 @@
private IStatus validateRemoteName() {
IStatus status = Status.OK_STATUS;
- // skip the validation if the user wants to create a new project. The name and state of the existing project do
+ // skip the validation if the user wants to create a new project. The
+ // name and state of the existing project do
// not matter...
if (!isUseDefaultRemoteName()) {
final String remoteName = getRemoteName();
- if(remoteName == null || remoteName.isEmpty()) {
- status = new Status(IStatus.ERROR, OpenShiftUIActivator.PLUGIN_ID, "The custom remote name must not be empty.");
- } else if(!remoteName.matches("\\S+")) {
- status = new Status(IStatus.ERROR, OpenShiftUIActivator.PLUGIN_ID, "The custom remote name must not contain spaces.");
+ if (remoteName == null || remoteName.isEmpty()) {
+ status = new Status(IStatus.ERROR, OpenShiftUIActivator.PLUGIN_ID,
+ "The custom remote name must not be empty.");
+ } else if (!remoteName.matches("\\S+")) {
+ status = new Status(IStatus.ERROR, OpenShiftUIActivator.PLUGIN_ID,
+ "The custom remote name must not contain spaces.");
} else if (hasRemoteName(remoteName, getProject())) {
- status = new Status(IStatus.ERROR,
- OpenShiftUIActivator.PLUGIN_ID, NLS.bind("The existing project already has a remote named {0}.", remoteName));
+ status = new Status(IStatus.ERROR,
+ OpenShiftUIActivator.PLUGIN_ID, NLS.bind(
+ "The existing project already has a remote named {0}.", remoteName));
}
}
setCustomRemoteNameValidity(status);
@@ -368,7 +388,7 @@
|| !project.isAccessible()) {
return false;
}
-
+
Repository repository = EGitUtils.getRepository(project);
return EGitUtils.hasRemote(remoteName, repository);
} catch (Exception e) {
@@ -376,16 +396,16 @@
return false;
}
}
-
+
private IProject getProject() {
String projectName = wizardModel.getProjectName();
if (projectName == null) {
return null;
}
-
+
return ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
}
-
+
public void setCustomRemoteNameValidity(IStatus status) {
firePropertyChange(PROPERTY_CUSTOM_REMOTE_NAME_VALIDITY, this.customRemoteNameValidity,
this.customRemoteNameValidity = status);
14 years, 1 month
JBoss Tools SVN: r38656 - trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2012-02-13 09:57:07 -0500 (Mon, 13 Feb 2012)
New Revision: 38656
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationSelectionDialog.java
Log:
[JBIDE-10856] extracted #setApplicationSelected()
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationSelectionDialog.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationSelectionDialog.java 2012-02-13 14:17:08 UTC (rev 38655)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationSelectionDialog.java 2012-02-13 14:57:07 UTC (rev 38656)
@@ -161,18 +161,23 @@
return new IDoubleClickListener() {
@Override
public void doubleClick(DoubleClickEvent event) {
- final ISelection selection = event.getSelection();
- if(selection instanceof StructuredSelection) {
- final Object firstElement = ((StructuredSelection) selection).getFirstElement();
- if(firstElement instanceof IApplication) {
- dialogModel.setSelectedApplication((IApplication) firstElement);
- close();
- }
- }
+// openDetailsDialog();
+ setApplicationSelected(event.getSelection());
}
};
}
+ private void setApplicationSelected(ISelection selection) {
+ if(selection instanceof StructuredSelection) {
+ final Object firstElement = ((StructuredSelection) selection).getFirstElement();
+ if(firstElement instanceof IApplication) {
+ IApplication application = (IApplication) firstElement;
+ dialogModel.setSelectedApplication(application);
+ close();
+ }
+ }
+ }
+
protected TableViewer createTable(Composite tableContainer) {
Table table = new Table(tableContainer, SWT.BORDER | SWT.FULL_SELECTION | SWT.V_SCROLL | SWT.H_SCROLL);
int desiredHeight = table.getItemHeight() * 10 + table.getHeaderHeight();
14 years, 1 month
JBoss Tools SVN: r38655 - in trunk/hibernatetools/plugins: org.jboss.tools.hibernate3_6/src/org/jboss/tools/hibernate3_6 and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: dgeraskov
Date: 2012-02-13 09:17:08 -0500 (Mon, 13 Feb 2012)
New Revision: 38655
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConfigurationFactory.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate3_6/src/org/jboss/tools/hibernate3_6/ConfigurationFactory.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate4_0/src/org/jboss/tools/hibernate4_0/ConfigurationFactory.java
Log:
https://issues.jboss.org/browse/JBIDE-10507
Overwrite datasource properties on configuration build
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConfigurationFactory.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConfigurationFactory.java 2012-02-13 14:07:20 UTC (rev 38654)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConfigurationFactory.java 2012-02-13 14:17:08 UTC (rev 38655)
@@ -82,15 +82,18 @@
public Configuration createConfiguration(Configuration localCfg, boolean includeMappings) {
Properties properties = prefs.getProperties();
- if (properties != null) {
- // in case the transaction manager is empty then we need to inject a faketm since
- // hibernate will still try and instantiate it.
- String str = properties.getProperty(Environment.TRANSACTION_MANAGER_STRATEGY);
- if (str != null && StringHelper.isEmpty(str)) {
- properties.setProperty(Environment.TRANSACTION_MANAGER_STRATEGY, FAKE_TM_LOOKUP);
- // properties.setProperty( "hibernate.transaction.factory_class", "");
- }
+ //https://issues.jboss.org/browse/JBIDE-10507
+ //overwrite datasource properties
+ if (properties == null) {
+ properties = new Properties();
}
+
+ // in case the transaction manager is empty then we need to inject a faketm since
+ // hibernate will still try to instantiate it.
+ properties.setProperty(Environment.TRANSACTION_MANAGER_STRATEGY, FAKE_TM_LOOKUP);
+ properties.put(Environment.DATASOURCE, ""); //$NON-NLS-1$
+ properties.put(Environment.CONNECTION_PROVIDER, "org.hibernate.connection.DriverManagerConnectionProvider"); //$NON-NLS-1$
+
if (localCfg == null) {
localCfg = buildConfiguration(properties, includeMappings);
} else {
@@ -382,10 +385,6 @@
connProfileName);
if (profile != null) {
final Properties cpProperties = profile.getProperties(profile.getProviderId());
- final Properties invokeProperties = localCfg.getProperties();
- // set this property to null!
- invokeProperties.remove(Environment.DATASOURCE);
- localCfg.setProperties(invokeProperties);
// seems we should not setup dialect here
//String dialect = "org.hibernate.dialect.HSQLDialect";
//invoke.setProperty(Environment.DIALECT, dialect);
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate3_6/src/org/jboss/tools/hibernate3_6/ConfigurationFactory.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate3_6/src/org/jboss/tools/hibernate3_6/ConfigurationFactory.java 2012-02-13 14:07:20 UTC (rev 38654)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate3_6/src/org/jboss/tools/hibernate3_6/ConfigurationFactory.java 2012-02-13 14:17:08 UTC (rev 38655)
@@ -74,15 +74,18 @@
public Configuration createConfiguration(Configuration localCfg, boolean includeMappings) {
Properties properties = prefs.getProperties();
- if (properties != null) {
- // in case the transaction manager is empty then we need to inject a faketm since
- // hibernate will still try and instantiate it.
- String str = properties.getProperty(Environment.TRANSACTION_MANAGER_STRATEGY);
- if (str != null && StringHelper.isEmpty(str)) {
- properties.setProperty(Environment.TRANSACTION_MANAGER_STRATEGY, FAKE_TM_LOOKUP);
- // properties.setProperty( "hibernate.transaction.factory_class", "");
- }
+ //https://issues.jboss.org/browse/JBIDE-10507
+ //overwrite datasource properties
+ if (properties == null) {
+ properties = new Properties();
}
+
+ // in case the transaction manager is empty then we need to inject a faketm since
+ // hibernate will still try to instantiate it.
+ properties.setProperty(Environment.TRANSACTION_MANAGER_STRATEGY, FAKE_TM_LOOKUP);
+ properties.put(Environment.DATASOURCE, ""); //$NON-NLS-1$
+ properties.put(Environment.CONNECTION_PROVIDER, "org.hibernate.connection.DriverManagerConnectionProvider"); //$NON-NLS-1$
+
if (localCfg == null) {
localCfg = buildConfiguration(properties, includeMappings);
} else {
@@ -374,10 +377,6 @@
connProfileName);
if (profile != null) {
final Properties cpProperties = profile.getProperties(profile.getProviderId());
- final Properties invokeProperties = localCfg.getProperties();
- // set this property to null!
- invokeProperties.remove(Environment.DATASOURCE);
- localCfg.setProperties(invokeProperties);
// seems we should not setup dialect here
//String dialect = "org.hibernate.dialect.HSQLDialect";
//invoke.setProperty(Environment.DIALECT, dialect);
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate4_0/src/org/jboss/tools/hibernate4_0/ConfigurationFactory.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate4_0/src/org/jboss/tools/hibernate4_0/ConfigurationFactory.java 2012-02-13 14:07:20 UTC (rev 38654)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate4_0/src/org/jboss/tools/hibernate4_0/ConfigurationFactory.java 2012-02-13 14:17:08 UTC (rev 38655)
@@ -86,15 +86,18 @@
public Configuration createConfiguration(Configuration localCfg, boolean includeMappings) {
Properties properties = prefs.getProperties();
- if (properties != null) {
- // in case the transaction manager is empty then we need to inject a faketm since
- // hibernate will still try and instantiate it.
- String str = properties.getProperty(Environment.TRANSACTION_MANAGER_STRATEGY);
- if (str != null && StringHelper.isEmpty(str)) {
- properties.setProperty(Environment.TRANSACTION_MANAGER_STRATEGY, FAKE_TM_LOOKUP);
- // properties.setProperty( "hibernate.transaction.factory_class", "");
- }
+ //https://issues.jboss.org/browse/JBIDE-10507
+ //overwrite datasource properties
+ if (properties == null) {
+ properties = new Properties();
}
+
+ // in case the transaction manager is empty then we need to inject a faketm since
+ // hibernate will still try to instantiate it.
+ properties.setProperty(Environment.TRANSACTION_MANAGER_STRATEGY, FAKE_TM_LOOKUP);
+ properties.put(Environment.DATASOURCE, ""); //$NON-NLS-1$
+ properties.put(Environment.CONNECTION_PROVIDER, "org.hibernate.connection.DriverManagerConnectionProvider"); //$NON-NLS-1$
+
if (localCfg == null) {
localCfg = buildConfiguration(properties, includeMappings);
} else {
@@ -390,10 +393,6 @@
connProfileName);
if (profile != null) {
final Properties cpProperties = profile.getProperties(profile.getProviderId());
- final Properties invokeProperties = localCfg.getProperties();
- // set this property to null!
- invokeProperties.remove(Environment.DATASOURCE);
- localCfg.setProperties(invokeProperties);
// seems we should not setup dialect here
//String dialect = "org.hibernate.dialect.HSQLDialect";
//invoke.setProperty(Environment.DIALECT, dialect);
14 years, 1 month
JBoss Tools SVN: r38654 - trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard.
by jbosstools-commits@lists.jboss.org
Author: xcoulon
Date: 2012-02-13 09:07:20 -0500 (Mon, 13 Feb 2012)
New Revision: 38654
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationSelectionDialog.java
Log:
Fixed - https://issues.jboss.org/browse/JBIDE-10856
Application selection UI issues
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationSelectionDialog.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationSelectionDialog.java 2012-02-13 13:04:51 UTC (rev 38653)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationSelectionDialog.java 2012-02-13 14:07:20 UTC (rev 38654)
@@ -34,6 +34,8 @@
import org.eclipse.jface.viewers.ColumnWeightData;
import org.eclipse.jface.viewers.DoubleClickEvent;
import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.TableViewerColumn;
import org.eclipse.jface.viewers.ViewerCell;
@@ -159,7 +161,14 @@
return new IDoubleClickListener() {
@Override
public void doubleClick(DoubleClickEvent event) {
- openDetailsDialog();
+ final ISelection selection = event.getSelection();
+ if(selection instanceof StructuredSelection) {
+ final Object firstElement = ((StructuredSelection) selection).getFirstElement();
+ if(firstElement instanceof IApplication) {
+ dialogModel.setSelectedApplication((IApplication) firstElement);
+ close();
+ }
+ }
}
};
}
14 years, 1 month
JBoss Tools SVN: r38653 - in trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard: appimport and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2012-02-13 08:04:51 -0500 (Mon, 13 Feb 2012)
New Revision: 38653
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/IOpenShiftWizardModel.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizardModel.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/AbstractImportApplicationOperation.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ConfigureGitSharedProject.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ImportNewProject.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ImportProjectWizardModel.java
Log:
[JBIDE-10887] creating .gitignore with appropriate settings (.project, .classpath, .settings, etc.)
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/IOpenShiftWizardModel.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/IOpenShiftWizardModel.java 2012-02-13 12:05:30 UTC (rev 38652)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/IOpenShiftWizardModel.java 2012-02-13 13:04:51 UTC (rev 38653)
@@ -61,9 +61,10 @@
* @throws InterruptedException
* @throws URISyntaxException
* @throws InvocationTargetException
+ * @throws IOException
*/
public void importProject(IProgressMonitor monitor) throws OpenShiftException, CoreException, InterruptedException,
- URISyntaxException, InvocationTargetException;
+ URISyntaxException, InvocationTargetException, IOException;
/**
* Enables the user chosen, unshared project to be used on the chosen
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizardModel.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizardModel.java 2012-02-13 12:05:30 UTC (rev 38652)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizardModel.java 2012-02-13 13:04:51 UTC (rev 38653)
@@ -64,12 +64,17 @@
* @throws InterruptedException
* @throws URISyntaxException
* @throws InvocationTargetException
+ * @throws IOException
*/
@Override
public void importProject(IProgressMonitor monitor) throws OpenShiftException, CoreException, InterruptedException,
- URISyntaxException, InvocationTargetException {
+ URISyntaxException, InvocationTargetException, IOException {
List<IProject> importedProjects =
- new ImportNewProject(getProjectName(), getApplication(), getRemoteName(), getRepositoryFile())
+ new ImportNewProject(
+ getProjectName()
+ , getApplication()
+ , getRemoteName()
+ , getRepositoryFile())
.execute(monitor);
createServerAdapter(monitor, importedProjects);
}
@@ -358,7 +363,8 @@
return selectedEmbeddableCartridges;
}
- public Set<IEmbeddableCartridge> setSelectedEmbeddableCartridges(Set<IEmbeddableCartridge> selectedEmbeddableCartridges) {
+ public Set<IEmbeddableCartridge> setSelectedEmbeddableCartridges(
+ Set<IEmbeddableCartridge> selectedEmbeddableCartridges) {
dataModel.put(KEY_SELECTED_EMBEDDABLE_CARTRIDGES, selectedEmbeddableCartridges);
return selectedEmbeddableCartridges;
}
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/AbstractImportApplicationOperation.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/AbstractImportApplicationOperation.java 2012-02-13 12:05:30 UTC (rev 38652)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/AbstractImportApplicationOperation.java 2012-02-13 13:04:51 UTC (rev 38653)
@@ -15,15 +15,23 @@
import java.lang.reflect.InvocationTargetException;
import java.net.MalformedURLException;
import java.net.URISyntaxException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.egit.core.op.AddToIndexOperation;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.osgi.util.NLS;
import org.jboss.tools.openshift.egit.core.EGitUtils;
+import org.jboss.tools.openshift.egit.core.GitIgnore;
import org.jboss.tools.openshift.egit.ui.util.EGitUIUtils;
import com.openshift.express.client.IApplication;
@@ -37,11 +45,13 @@
private String projectName;
private IApplication application;
private String remoteName;
+ protected List<IResource> modifiedResources;
public AbstractImportApplicationOperation(String projectName, IApplication application, String remoteName) {
this.projectName = projectName;
this.application = application;
this.remoteName = remoteName;
+ this.modifiedResources = new ArrayList<IResource>();
}
/**
@@ -136,4 +146,81 @@
protected String getRemoteName() {
return remoteName;
}
+
+ /**
+ * Marks the given resources as modified.
+ *
+ * @param resources
+ * the resources that shall be marked as modified
+ *
+ * @see #addAndCommitModifiedResource(IProject, IProgressMonitor)
+ */
+ protected void addToModified(Collection<IResource> resources) {
+ if (resources == null) {
+ return;
+ }
+ modifiedResources.addAll(resources);
+ }
+
+ /**
+ *
+ * Marks the given resource as modified.
+ *
+ * @param resource
+ * the resource that shall be marked as modified
+ *
+ * @see #addAndCommitModifiedResource(IProject, IProgressMonitor)
+ */
+ protected void addToModified(IResource resource) {
+ if (resource == null) {
+ return;
+ }
+ modifiedResources.add(resource);
+ }
+
+ /**
+ * Adds and commits all (modified) resources in the given project to the git
+ * repository that it is attached to.
+ *
+ * @param project
+ * the project to commit
+ * @param monitor
+ * the monitor to report progress to
+ * @throws CoreException
+ * @throws OpenShiftException
+ *
+ * @see #addToModified(Collection<IResource>)
+ * @see #addToModified(IResource)
+ *
+ */
+ protected void addAndCommitModifiedResource(IProject project, IProgressMonitor monitor) throws CoreException,
+ OpenShiftException {
+ Repository repository = EGitUtils.getRepository(project);
+ if (repository == null) {
+ throw new OpenShiftException("project {0} is not connected to a git repository.", project.getName());
+ }
+ new AddToIndexOperation(modifiedResources).execute(monitor);
+ EGitUtils.commit(project, monitor);
+ }
+
+ /**
+ * Adds a predefined set of entries to the gitignore file in (root of) the
+ * given project. If no .gitignore exists yet, a fresh one is created.
+ *
+ * @param project
+ * the project to which the .gitignore shall be configured
+ * @return
+ * @throws IOException
+ * @throws CoreException
+ */
+ protected IFile setupGitIgnore(IProject project, IProgressMonitor monitor) throws IOException, CoreException {
+ GitIgnore gitIgnore = new GitIgnore(project);
+ gitIgnore.add("target")
+ .add(".settings")
+ .add(".project")
+ .add(".classpath")
+ .add(".factorypath");
+ return gitIgnore.write(monitor);
+ }
+
}
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ConfigureGitSharedProject.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ConfigureGitSharedProject.java 2012-02-13 12:05:30 UTC (rev 38652)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ConfigureGitSharedProject.java 2012-02-13 13:04:51 UTC (rev 38653)
@@ -15,26 +15,22 @@
import java.lang.reflect.InvocationTargetException;
import java.net.MalformedURLException;
import java.net.URISyntaxException;
-import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.regex.Pattern;
-import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.egit.core.op.AddToIndexOperation;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.transport.RemoteConfig;
import org.eclipse.osgi.util.NLS;
import org.jboss.ide.eclipse.as.core.util.FileUtil;
import org.jboss.ide.eclipse.as.core.util.RegExUtils;
import org.jboss.tools.openshift.egit.core.EGitUtils;
-import org.jboss.tools.openshift.egit.core.GitIgnore;
import org.jboss.tools.openshift.express.internal.ui.OpenShiftUIActivator;
import org.jboss.tools.openshift.express.internal.ui.OpenShiftUIException;
import org.jboss.tools.openshift.express.internal.ui.UnCommittedChangesException;
@@ -53,12 +49,9 @@
*/
public class ConfigureGitSharedProject extends AbstractImportApplicationOperation {
- private List<IResource> modifiedResources;
-
public ConfigureGitSharedProject(String projectName, IApplication application, String remoteName,
IUser user) {
super(projectName, application, remoteName);
- this.modifiedResources = new ArrayList<IResource>();
}
/**
@@ -139,11 +132,6 @@
EGitUtils.addRemoteTo(getRemoteName(), getApplication().getGitUri(), repository);
}
- private void addAndCommitModifiedResource(IProject project, IProgressMonitor monitor) throws CoreException {
- new AddToIndexOperation(modifiedResources).execute(monitor);
- EGitUtils.commit(project, monitor);
- }
-
private IResource setupOpenShiftMavenProfile(IProject project, IProgressMonitor monitor) throws CoreException {
Assert.isLegal(OpenShiftMavenProfile.isMavenProject(project));
@@ -198,39 +186,4 @@
FileUtil.safeDelete(tmpFolder);
return copiedResources;
}
-
- /**
- * Adds a predefined set of entries to the gitignore file in (root of) the
- * given project. If no .gitignore exists yet, a fresh one is created.
- *
- * @param project
- * the project to which the .gitignore shall be configured
- * @return
- * @throws IOException
- * @throws CoreException
- */
- private IFile setupGitIgnore(IProject project, IProgressMonitor monitor) throws IOException, CoreException {
- GitIgnore gitIgnore = new GitIgnore(project);
- gitIgnore.add("target")
- .add(".settings")
- .add(".project")
- .add(".classpath")
- .add(".factorypath");
- return gitIgnore.write(monitor);
- }
-
- private void addToModified(Collection<IResource> resources) {
- if (resources == null) {
- return;
- }
- modifiedResources.addAll(resources);
- }
-
- private void addToModified(IResource resource) {
- if (resource == null) {
- return;
- }
- modifiedResources.add(resource);
- }
-
}
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ImportNewProject.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ImportNewProject.java 2012-02-13 12:05:30 UTC (rev 38652)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ImportNewProject.java 2012-02-13 13:04:51 UTC (rev 38653)
@@ -56,10 +56,11 @@
* @throws InterruptedException
* @throws URISyntaxException
* @throws InvocationTargetException
+ * @throws IOException
*/
public List<IProject> execute(IProgressMonitor monitor)
throws OpenShiftException, CoreException, InterruptedException, URISyntaxException,
- InvocationTargetException {
+ InvocationTargetException, IOException {
if (cloneDestinationExists()) {
throw new WontOverwriteException(
NLS.bind("There's already a folder at {0}. The new OpenShift project would overwrite it. " +
@@ -80,8 +81,11 @@
}
connectToGitRepo(importedProjects, repositoryFolder, monitor);
+ // TODO: handle multiple projects (is this really possible?)
+ IProject project = importedProjects.get(0);
+ addToModified(setupGitIgnore(project, monitor));
+ addAndCommitModifiedResource(project, monitor);
-
return importedProjects;
}
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ImportProjectWizardModel.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ImportProjectWizardModel.java 2012-02-13 12:05:30 UTC (rev 38652)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ImportProjectWizardModel.java 2012-02-13 13:04:51 UTC (rev 38653)
@@ -68,9 +68,10 @@
* @throws InterruptedException
* @throws URISyntaxException
* @throws InvocationTargetException
+ * @throws IOException
*/
public void importProject(IProgressMonitor monitor) throws OpenShiftException, CoreException, InterruptedException,
- URISyntaxException, InvocationTargetException {
+ URISyntaxException, InvocationTargetException, IOException {
List<IProject> importedProjects = new ImportNewProject(getProjectName()
, getApplication()
, getRemoteName()
14 years, 1 month
JBoss Tools SVN: r38652 - trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2012-02-13 07:05:30 -0500 (Mon, 13 Feb 2012)
New Revision: 38652
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizard.java
Log:
https://issues.jboss.org/browse/JBIDE-10880 - simple logic error
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizard.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizard.java 2012-02-13 11:09:55 UTC (rev 38651)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizard.java 2012-02-13 12:05:30 UTC (rev 38652)
@@ -101,8 +101,8 @@
@Override
public boolean performFinish() {
- boolean success = false;
- if (!getWizardModel().isExistingApplication()) {
+ boolean success = getWizardModel().isExistingApplication();
+ if (!success) {
if (createApplication()) {
success = addRemoveCartridges(
getWizardModel().getApplication(), getWizardModel().getSelectedEmbeddableCartridges());
14 years, 1 month
JBoss Tools SVN: r38651 - in trunk/maven: plugins/org.jboss.tools.maven.jsf/src/org/jboss/tools/maven/jsf/utils and 9 other directories.
by jbosstools-commits@lists.jboss.org
Author: fbricon
Date: 2012-02-13 06:09:55 -0500 (Mon, 13 Feb 2012)
New Revision: 38651
Added:
trunk/maven/plugins/org.jboss.tools.maven.jsf/src/org/jboss/tools/maven/jsf/utils/xpl/
trunk/maven/plugins/org.jboss.tools.maven.jsf/src/org/jboss/tools/maven/jsf/utils/xpl/JSFAppConfigUtils.java
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jsf/JBIDE-10831/
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jsf/JBIDE-10831/jsf-customfacesconfig/
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jsf/JBIDE-10831/jsf-customfacesconfig/pom.xml
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jsf/JBIDE-10831/jsf-customfacesconfig/src/
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jsf/JBIDE-10831/jsf-customfacesconfig/src/main/
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jsf/JBIDE-10831/jsf-customfacesconfig/src/main/webapp/
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jsf/JBIDE-10831/jsf-customfacesconfig/src/main/webapp/WEB-INF/
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jsf/JBIDE-10831/jsf-customfacesconfig/src/main/webapp/WEB-INF/my-faces-config.xml
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jsf/JBIDE-10831/jsf-customfacesconfig/src/main/webapp/WEB-INF/web.xml
Modified:
trunk/maven/plugins/org.jboss.tools.maven.jsf/src/org/jboss/tools/maven/jsf/configurators/JSFProjectConfigurator.java
trunk/maven/plugins/org.jboss.tools.maven.jsf/src/org/jboss/tools/maven/jsf/configurators/JSFUtils.java
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/src/org/jboss/tools/maven/configurators/tests/AbstractMavenConfiguratorTest.java
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/src/org/jboss/tools/maven/configurators/tests/JSFConfiguratorTest.java
Log:
JBIDE-10831 : detect faces-config from javax.faces.CONFIG_FILES context param declared in web.xml
Modified: trunk/maven/plugins/org.jboss.tools.maven.jsf/src/org/jboss/tools/maven/jsf/configurators/JSFProjectConfigurator.java
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.jsf/src/org/jboss/tools/maven/jsf/configurators/JSFProjectConfigurator.java 2012-02-13 10:41:07 UTC (rev 38650)
+++ trunk/maven/plugins/org.jboss.tools.maven.jsf/src/org/jboss/tools/maven/jsf/configurators/JSFProjectConfigurator.java 2012-02-13 11:09:55 UTC (rev 38651)
@@ -172,21 +172,23 @@
markerManager.deleteMarkers(fproj.getProject(), MavenJSFConstants.JSF_CONFIGURATION_ERROR_MARKER_ID);
if (!fproj.hasProjectFacet(JSF_FACET)) {
-
+ IProject project = fproj.getProject();
//JBIDE-10785 : refresh parent to prevent
// org.osgi.service.prefs.BackingStoreException: Resource '/parent/web/.settings' does not exist.
MavenUtil.refreshParent(mavenProject);
- String warSourceDir = getWarSourceDirectory(mavenProject,fproj.getProject());
+ String warSourceDir = getWarSourceDirectory(mavenProject,project);
String facesConfigPath = "WEB-INF/faces-config.xml";
- IFile facesConfig = fproj.getProject().getFolder(warSourceDir).getFile(facesConfigPath);
- IFile generatedFacesConfig = ProjectUtil.getGeneratedWebResourceFile(fproj.getProject(), facesConfigPath);
-
+ IFile defaultFacesConfig = project.getFolder(warSourceDir).getFile(facesConfigPath);
+ IFile generatedFacesConfig = ProjectUtil.getGeneratedWebResourceFile(project, facesConfigPath);
+ IFile actualFacesConfig = JSFUtils.getFacesconfig(project);
+
//faces-config.xml will not be created in the source folder and it doesn't exist yet
// => We'll have to fix it after setting the JSF facet
boolean shouldFixFacesConfig = generatedFacesConfig != null
- && !generatedFacesConfig.getLocation().equals(facesConfig.getLocation())
+ && !generatedFacesConfig.getLocation().equals(defaultFacesConfig.getLocation())
&& !generatedFacesConfig.exists();
+ boolean defaultFacesConfigAlreadyExists = defaultFacesConfig.exists();
IProjectFacetVersion facetVersion = null;
boolean configureServlet = false;//Fix for JBIDE-9454, where existing web.xml is completely overwritten.
@@ -198,7 +200,6 @@
}
else if (jsfVersionString.startsWith(JSF_VERSION_2_0)) {
facetVersion = JSF_FACET_VERSION_2_0;
- //configureServlet = configureWebxml();
}
if (facetVersion != null) {
@@ -216,20 +217,25 @@
}
if (shouldFixFacesConfig && generatedFacesConfig.exists()) {
- if (facesConfig.exists()) {
+ if (defaultFacesConfig.exists()) {
//We have 2 config files. Delete the gen'd one
generatedFacesConfig.delete(true, monitor);
}
else {
//move the gen'd config file to the appropriate source folder
- IContainer destination = facesConfig.getParent();
+ IContainer destination = defaultFacesConfig.getParent();
if (destination != null && !destination.exists()) {
destination.getLocation().toFile().mkdirs();
}
- generatedFacesConfig.move(facesConfig.getFullPath(), true, monitor);
+ generatedFacesConfig.move(defaultFacesConfig.getFullPath(), true, monitor);
}
}
-
+ if (actualFacesConfig != null
+ && !defaultFacesConfigAlreadyExists
+ && !defaultFacesConfig.getLocation().equals(actualFacesConfig.getLocation())
+ && defaultFacesConfig.exists()/*file has just been created*/) {
+ defaultFacesConfig.delete(true, monitor);
+ }
}
}
Modified: trunk/maven/plugins/org.jboss.tools.maven.jsf/src/org/jboss/tools/maven/jsf/configurators/JSFUtils.java
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.jsf/src/org/jboss/tools/maven/jsf/configurators/JSFUtils.java 2012-02-13 10:41:07 UTC (rev 38650)
+++ trunk/maven/plugins/org.jboss.tools.maven.jsf/src/org/jboss/tools/maven/jsf/configurators/JSFUtils.java 2012-02-13 11:09:55 UTC (rev 38651)
@@ -11,6 +11,7 @@
package org.jboss.tools.maven.jsf.configurators;
import java.io.InputStream;
+import java.util.List;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
@@ -30,6 +31,7 @@
import org.jboss.tools.common.util.EclipseJavaUtil;
import org.jboss.tools.maven.core.ProjectUtil;
import org.jboss.tools.maven.jsf.utils.FacesConfigQuickPeek;
+import org.jboss.tools.maven.jsf.utils.xpl.JSFAppConfigUtils;
import org.jboss.tools.maven.ui.Activator;
import org.w3c.dom.Document;
@@ -53,7 +55,17 @@
* Return the faces-config.xml of the given project, or null if faces-config.xml doesn't exist
*/
public static IFile getFacesconfig(IProject project) {
- IFile facesConfig = ProjectUtil.getWebResourceFile(project, "WEB-INF/faces-config.xml");
+ IFile facesConfig = null;
+ @SuppressWarnings("unchecked")
+ List<String> configFiles = JSFAppConfigUtils.getConfigFilesFromContextParam(project);
+ for (String configFile : configFiles) {
+ facesConfig = ProjectUtil.getWebResourceFile(project, configFile);
+ if (facesConfig != null && facesConfig.exists()) {
+ return facesConfig;
+ }
+ }
+ facesConfig = ProjectUtil.getWebResourceFile(project, "WEB-INF/faces-config.xml");
+
return facesConfig;
}
Added: trunk/maven/plugins/org.jboss.tools.maven.jsf/src/org/jboss/tools/maven/jsf/utils/xpl/JSFAppConfigUtils.java
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.jsf/src/org/jboss/tools/maven/jsf/utils/xpl/JSFAppConfigUtils.java (rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.jsf/src/org/jboss/tools/maven/jsf/utils/xpl/JSFAppConfigUtils.java 2012-02-13 11:09:55 UTC (rev 38651)
@@ -0,0 +1,159 @@
+/*******************************************************************************
+ * Copyright (c) 2005 Oracle Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ian Trimble - initial API and implementation
+ *******************************************************************************/
+package org.jboss.tools.maven.jsf.utils.xpl;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.StringTokenizer;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.jst.j2ee.common.ParamValue;
+import org.eclipse.jst.j2ee.internal.J2EEVersionConstants;
+import org.eclipse.jst.j2ee.model.IModelProvider;
+import org.eclipse.jst.j2ee.model.ModelProviderManager;
+import org.eclipse.jst.j2ee.web.componentcore.util.WebArtifactEdit;
+import org.eclipse.jst.j2ee.webapplication.ContextParam;
+import org.eclipse.jst.j2ee.webapplication.WebApp;
+import org.eclipse.wst.common.componentcore.ModuleCoreNature;
+import org.jboss.tools.maven.jsf.MavenJSFActivator;
+
+/**
+ * Class copied from {@link org.eclipse.jst.jsf.core.jsfappconfig.JSFAppConfigUtils}.
+ * <ul>
+ * <li>getConfigFilesFromContextParam() method modified to allow reading of javax.faces.CONFIG_FILES
+ * value in web.xml on projects not having the JSF facet already</li>
+ * <li>Unused methods have been removed</li>
+ * <li>Code changed to use Java 1.5+ features</li>
+ * </ul>
+ *
+ * JSFAppConfigUtils provides utility methods useful in processing of a JSF
+ * application configuration.
+ *
+ *
+ * @author Ian Trimble - Oracle
+ */
+public class JSFAppConfigUtils {
+
+ /**
+ * Name of JSF CONFIG_FILES context parameter ("javax.faces.CONFIG_FILES").
+ */
+ public static final String CONFIG_FILES_CONTEXT_PARAM_NAME = "javax.faces.CONFIG_FILES"; //$NON-NLS-1$
+
+ /**
+ * Location in JAR file of application configuration resource file
+ * ("META-INF/faces-config.xml").
+ */
+ public static final String FACES_CONFIG_IN_JAR_PATH = "META-INF/faces-config.xml"; //$NON-NLS-1$
+
+
+ /**
+ * Gets list of application configuration file names as listed in the JSF
+ * CONFIG_FILES context parameter ("javax.faces.CONFIG_FILES"). Will return
+ * an empty list if WebArtifactEdit is null, if WebApp is null, if context
+ * parameter does not exist, or if trimmed context parameter's value is
+ * an empty String.
+ *
+ * @param project IProject instance for which to get the context
+ * parameter's value.
+ * @return List of application configuration file names as listed in the
+ * JSF CONFIG_FILES context parameter ("javax.faces.CONFIG_FILES"); list
+ * may be empty.
+ */
+ public static List<String> getConfigFilesFromContextParam(IProject project) {
+ List<String> filesList = Collections.emptyList();
+ if (ModuleCoreNature.isFlexibleProject(project)) {
+ IModelProvider provider = ModelProviderManager.getModelProvider(project);
+ Object webAppObj = provider.getModelObject();
+ if (webAppObj != null){
+ if (webAppObj instanceof WebApp)
+ filesList = getConfigFilesForJ2EEApp(project);
+ else if (webAppObj instanceof org.eclipse.jst.javaee.web.WebApp)
+ filesList = getConfigFilesForJEEApp((org.eclipse.jst.javaee.web.WebApp)webAppObj);
+ }
+
+ }
+ return filesList;
+ }
+
+ private static List<String> getConfigFilesForJEEApp(org.eclipse.jst.javaee.web.WebApp webApp) {
+ String filesString = null;
+ for (org.eclipse.jst.javaee.core.ParamValue paramValue : webApp.getContextParams()) {
+ if (paramValue.getParamName().equals(CONFIG_FILES_CONTEXT_PARAM_NAME)) {
+ filesString = paramValue.getParamValue();
+ break;
+ }
+ }
+ return parseFilesString(filesString);
+ }
+
+ private static List<String> getConfigFilesForJ2EEApp(IProject project){
+ List<String> filesList = new ArrayList<String>();
+ WebArtifactEdit webArtifactEdit = WebArtifactEdit.getWebArtifactEditForRead(project);
+ if (webArtifactEdit != null) {
+ try {
+ WebApp webApp = null;
+ try {
+ webApp = webArtifactEdit.getWebApp();
+ } catch(ClassCastException cce) {
+ //occasionally thrown from WTP code in RC3 and possibly later
+ MavenJSFActivator.log(cce);
+ return filesList;
+ }
+ if (webApp != null) {
+ String filesString = null;
+ //need to branch here due to model version differences (BugZilla #119442)
+ if (webApp.getVersionID() == J2EEVersionConstants.WEB_2_3_ID) {
+ EList contexts = webApp.getContexts();
+ Iterator itContexts = contexts.iterator();
+ while (itContexts.hasNext()) {
+ ContextParam contextParam = (ContextParam)itContexts.next();
+ if (contextParam.getParamName().equals(CONFIG_FILES_CONTEXT_PARAM_NAME)) {
+ filesString = contextParam.getParamValue();
+ break;
+ }
+ }
+ } else {
+ EList contextParams = webApp.getContextParams();
+ Iterator itContextParams = contextParams.iterator();
+ while (itContextParams.hasNext()) {
+ ParamValue paramValue = (ParamValue)itContextParams.next();
+ if (paramValue.getName().equals(CONFIG_FILES_CONTEXT_PARAM_NAME)) {
+ filesString = paramValue.getValue();
+ break;
+ }
+ }
+ }
+ filesList = parseFilesString(filesString);
+ }
+ } finally {
+ webArtifactEdit.dispose();
+ }
+ }
+
+ return filesList;
+ }
+
+ private static List<String> parseFilesString(String filesString) {
+ List<String> filesList = new ArrayList<String>();
+ if (filesString != null && filesString.trim().length() > 0) {
+ StringTokenizer stFilesString = new StringTokenizer(filesString, ","); //$NON-NLS-1$
+ while (stFilesString.hasMoreTokens()) {
+ String configFile = stFilesString.nextToken().trim();
+ filesList.add(configFile);
+ }
+ }
+ return filesList;
+ }
+
+}
Added: trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jsf/JBIDE-10831/jsf-customfacesconfig/pom.xml
===================================================================
--- trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jsf/JBIDE-10831/jsf-customfacesconfig/pom.xml (rev 0)
+++ trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jsf/JBIDE-10831/jsf-customfacesconfig/pom.xml 2012-02-13 11:09:55 UTC (rev 38651)
@@ -0,0 +1,19 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>foo.bar</groupId>
+ <artifactId>jsf-customfacesconfig</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ <packaging>war</packaging>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.3.2</version>
+ <configuration>
+ <source>1.6</source>
+ <target>1.6</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
\ No newline at end of file
Added: trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jsf/JBIDE-10831/jsf-customfacesconfig/src/main/webapp/WEB-INF/my-faces-config.xml
===================================================================
--- trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jsf/JBIDE-10831/jsf-customfacesconfig/src/main/webapp/WEB-INF/my-faces-config.xml (rev 0)
+++ trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jsf/JBIDE-10831/jsf-customfacesconfig/src/main/webapp/WEB-INF/my-faces-config.xml 2012-02-13 11:09:55 UTC (rev 38651)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<faces-config
+ xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
+ version="2.0">
+
+</faces-config>
Added: trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jsf/JBIDE-10831/jsf-customfacesconfig/src/main/webapp/WEB-INF/web.xml
===================================================================
--- trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jsf/JBIDE-10831/jsf-customfacesconfig/src/main/webapp/WEB-INF/web.xml (rev 0)
+++ trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jsf/JBIDE-10831/jsf-customfacesconfig/src/main/webapp/WEB-INF/web.xml 2012-02-13 11:09:55 UTC (rev 38651)
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
+ <display-name>aa</display-name>
+ <context-param>
+ <param-name>javax.faces.CONFIG_FILES</param-name>
+ <param-value>/WEB-INF/my-faces-config.xml</param-value>
+</context-param>
+ <welcome-file-list>
+ <welcome-file>index.html</welcome-file>
+ <welcome-file>index.htm</welcome-file>
+ <welcome-file>index.jsp</welcome-file>
+ <welcome-file>default.html</welcome-file>
+ <welcome-file>default.htm</welcome-file>
+ <welcome-file>default.jsp</welcome-file>
+ </welcome-file-list>
+</web-app>
\ No newline at end of file
Modified: trunk/maven/tests/org.jboss.tools.maven.configurators.tests/src/org/jboss/tools/maven/configurators/tests/AbstractMavenConfiguratorTest.java
===================================================================
--- trunk/maven/tests/org.jboss.tools.maven.configurators.tests/src/org/jboss/tools/maven/configurators/tests/AbstractMavenConfiguratorTest.java 2012-02-13 10:41:07 UTC (rev 38650)
+++ trunk/maven/tests/org.jboss.tools.maven.configurators.tests/src/org/jboss/tools/maven/configurators/tests/AbstractMavenConfiguratorTest.java 2012-02-13 11:09:55 UTC (rev 38651)
@@ -27,6 +27,7 @@
import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
import org.jboss.tools.common.util.FileUtil;
import org.jboss.tools.maven.jsf.configurators.JSFProjectConfigurator;
+import org.jboss.tools.maven.jsf.configurators.JSFUtils;
public abstract class AbstractMavenConfiguratorTest extends
AbstractMavenProjectTestCase {
@@ -45,7 +46,7 @@
assertNotNull(project.getName() + " is not a faceted project", facetedProject);
assertEquals("Unexpected JSF Version", expectedJSFVersion, facetedProject.getInstalledVersion(JSFProjectConfigurator.JSF_FACET));
assertTrue("Java Facet is missing", facetedProject.hasProjectFacet(JavaFacet.FACET));
- assertTrue("faces-config.xml is missing", project.getFile("src/main/webapp/WEB-INF/faces-config.xml").exists());
+ assertTrue("faces-config.xml is missing", JSFUtils.getFacesconfig(project).exists());
}
/**
@@ -73,18 +74,17 @@
if (newPomName != null) {
copyContent(project, newPomName, "pom.xml");
}
- IProgressMonitor mon = new NullProgressMonitor();
IProjectConfigurationManager configurationManager = MavenPlugin.getProjectConfigurationManager();
ResolverConfiguration configuration = new ResolverConfiguration();
- configurationManager.enableMavenNature(project, configuration, mon);
- configurationManager.updateProjectConfiguration(project, mon);
- waitForJobsToComplete(mon);
+ configurationManager.enableMavenNature(project, configuration, monitor);
+ configurationManager.updateProjectConfiguration(project, monitor);
+ waitForJobsToComplete(monitor);
- project.build(IncrementalProjectBuilder.FULL_BUILD, mon);
+ project.build(IncrementalProjectBuilder.FULL_BUILD, monitor);
if (waitTime > 0) {
Thread.sleep(waitTime);
}
- waitForJobsToComplete(mon);
+ waitForJobsToComplete(monitor);
}
protected void updateProject(IProject project) throws Exception {
Modified: trunk/maven/tests/org.jboss.tools.maven.configurators.tests/src/org/jboss/tools/maven/configurators/tests/JSFConfiguratorTest.java
===================================================================
--- trunk/maven/tests/org.jboss.tools.maven.configurators.tests/src/org/jboss/tools/maven/configurators/tests/JSFConfiguratorTest.java 2012-02-13 10:41:07 UTC (rev 38650)
+++ trunk/maven/tests/org.jboss.tools.maven.configurators.tests/src/org/jboss/tools/maven/configurators/tests/JSFConfiguratorTest.java 2012-02-13 11:09:55 UTC (rev 38651)
@@ -132,6 +132,18 @@
assertTrue(jsfProject.getName() + " doesn't have the expected Web facet", facetedProject.hasProjectFacet(IJ2EEFacetConstants.DYNAMIC_WEB_25));
}
+ @Test
+ public void testJBIDE10831_detectCustomFacesConfig() throws Exception {
+ String projectLocation = "projects/jsf/JBIDE-10831/jsf-customfacesconfig";
+ IProject jsfProject = importProject(projectLocation+"/pom.xml");
+ waitForJobsToComplete(new NullProgressMonitor());
+ assertIsJSFProject(jsfProject, JSFProjectConfigurator.JSF_FACET_VERSION_2_0);
+
+ IFile facesConfigXml = jsfProject.getFile("src/main/webapp/WEB-INF/faces-config.xml");
+ assertFalse("A new faces-config.xml was added to the project!", facesConfigXml.exists());
+
+ }
+
private void assertHasJSFConfigurationError(IProject project, String message) throws Exception {
WorkspaceHelpers.assertErrorMarker(MavenJSFConstants.JSF_CONFIGURATION_ERROR_MARKER_ID, message, 1, "", project);
}
14 years, 1 month
JBoss Tools SVN: r38650 - trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/viewer.
by jbosstools-commits@lists.jboss.org
Author: xcoulon
Date: 2012-02-13 05:41:07 -0500 (Mon, 13 Feb 2012)
New Revision: 38650
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/viewer/OpenShiftExpressConsoleContentProvider.java
Log:
Open - JBIDE-10845 Application configuration UI issues JBIDE-10855
cannot create/rename domain so new users can't get started
https://issues.jboss.org/browse/JBIDE-10855
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/viewer/OpenShiftExpressConsoleContentProvider.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/viewer/OpenShiftExpressConsoleContentProvider.java 2012-02-13 10:38:14 UTC (rev 38649)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/viewer/OpenShiftExpressConsoleContentProvider.java 2012-02-13 10:41:07 UTC (rev 38650)
@@ -30,12 +30,12 @@
/**
* @author Xavier Coulon
- *
+ *
*/
public class OpenShiftExpressConsoleContentProvider implements ITreeContentProvider {
private StructuredViewer viewer;
-
+
@Override
public void dispose() {
// TODO Auto-generated method stub
@@ -44,9 +44,9 @@
@Override
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- this.viewer = (StructuredViewer)viewer;
+ this.viewer = (StructuredViewer) viewer;
}
-
+
public static class LoadingStub {
public LoadingStub() {
}
@@ -55,25 +55,25 @@
// Keep track of what's loading and what's finished
private ArrayList<IUser> loadedUsers = new ArrayList<IUser>();
private ArrayList<IUser> loadingUsers = new ArrayList<IUser>();
-
+
@Override
public Object[] getElements(final Object parentElement) {
- if(parentElement instanceof IWorkspaceRoot) {
+ if (parentElement instanceof IWorkspaceRoot) {
return UserModel.getDefault().getUsers();
}
- if( parentElement instanceof UserModel ) {
- IUser[] users = ((UserModel)parentElement).getUsers();
+ if (parentElement instanceof UserModel) {
+ IUser[] users = ((UserModel) parentElement).getUsers();
return users;
}
-
- if( parentElement instanceof IUser ) {
- if( !loadedUsers.contains(parentElement)) {
- if( !loadingUsers.contains(parentElement)) {
+
+ if (parentElement instanceof IUser) {
+ if (!loadedUsers.contains(parentElement)) {
+ if (!loadingUsers.contains(parentElement)) {
// Load the data
- launchLoadingUserJob((IUser)parentElement);
+ launchLoadingUserJob((IUser) parentElement);
}
// return a stub object that says loading...
- return new Object[]{new LoadingStub()};
+ return new Object[] { new LoadingStub() };
}
}
return getChildrenFor(parentElement, false);
@@ -81,11 +81,11 @@
// Force the children to load completely
private void getChildrenFor(Object[] parentElements) {
- for( int i = 0; i < parentElements.length; i++ ) {
+ for (int i = 0; i < parentElements.length; i++) {
getChildrenFor(parentElements[i], true);
}
}
-
+
// Get the children without the protection of a "loading..." situation
private Object[] getChildrenFor(Object parentElement, boolean recurse) {
// .... the actual work is done here...
@@ -96,13 +96,16 @@
children = new Object[] { user };
}
if (parentElement instanceof IUser) {
- children = ((IUser) parentElement).getApplications().toArray();
+ final IUser user = (IUser) parentElement;
+ if (user.hasDomain()) {
+ children = user.getApplications().toArray();
+ }
}
if (parentElement instanceof IApplication) {
children = ((IApplication) parentElement).getEmbeddedCartridges().toArray();
}
-
- if( recurse ) {
+
+ if (recurse) {
getChildrenFor(children);
}
} catch (OpenShiftException e) {
@@ -110,10 +113,10 @@
}
return children;
}
-
+
private void launchLoadingUserJob(final IUser user) {
Job job = new Job("Loading OpenShift Express User information...") {
-
+
@Override
protected IStatus run(IProgressMonitor monitor) {
monitor.beginTask("Loading OpenShift Express information...", IProgressMonitor.UNKNOWN);
@@ -131,7 +134,7 @@
job.setPriority(Job.LONG);
job.schedule();
}
-
+
private void refreshViewerObject(final Object object) {
Display.getDefault().asyncExec(new Runnable() {
public void run() {
@@ -139,7 +142,7 @@
}
});
}
-
+
@Override
public Object[] getChildren(Object parentElement) {
return getElements(parentElement);
14 years, 1 month