JBoss Tools SVN: r40852 - trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2012-05-08 10:58:39 -0400 (Tue, 08 May 2012)
New Revision: 40852
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ConfigureGitSharedProject.java
Log:
[JBIDE-11563] corrected error message to correctly replace placeholders by the correct values and corrected the text.
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-05-08 14:52:16 UTC (rev 40851)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ConfigureGitSharedProject.java 2012-05-08 14:58:39 UTC (rev 40852)
@@ -124,7 +124,7 @@
// we shouldn't get here, the UI should validate the remote name and
// inform about an error in this case
throw new OpenShiftUIException(
- "Could not enable OpenShift on project {0}. There's already a a remote called {1} that points to a differnt git repository.",
+ "Could not enable OpenShift on project \"{0}\". There already is a remote called \"{1}\" that points to a differnt git repository.",
project.getName(), remoteName);
}
12 years, 8 months
JBoss Tools SVN: r40851 - trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2012-05-08 10:52:16 -0400 (Tue, 08 May 2012)
New Revision: 40851
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/RegExUtils.java
Log:
added class header and author
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/RegExUtils.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/RegExUtils.java 2012-05-08 14:45:35 UTC (rev 40850)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/RegExUtils.java 2012-05-08 14:52:16 UTC (rev 40851)
@@ -1,5 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
package org.jboss.ide.eclipse.as.core.util;
+/**
+ * @author Andre Dietisheim
+ */
public class RegExUtils {
public static String escapeRegex(String value) {
12 years, 8 months
JBoss Tools SVN: r40850 - 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-05-08 10:45:35 -0400 (Tue, 08 May 2012)
New Revision: 40850
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizard.java
Log:
corrected formatting in the warning message
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-05-08 14:42:07 UTC (rev 40849)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizard.java 2012-05-08 14:45:35 UTC (rev 40850)
@@ -282,11 +282,11 @@
getWizardModel().configureUnsharedProject(delegatingMonitor);
} else {
if (!askForConfirmation(
- NLS.bind("OpenShift application {0} will be enabled on project {1} by "
- + "copying OpenShift configuration and enabling Git for the project.\n "
- + "This cannot be undone. \n"
+ NLS.bind("OpenShift application \"{0}\" will be enabled on project \"{1}\" by "
+ + "copying OpenShift configuration and enabling Git for the project.\n"
+ + "This cannot be undone.\n"
+ "Furthermore publishing to your OpenShift app will eventually override existing content.\n"
- + "Do you wish to continue ?",
+ + "\nDo you wish to continue ?",
wizardModel.getApplicationName(), wizardModel.getProjectName()),
wizardModel.getApplicationName())) {
return Status.CANCEL_STATUS;
12 years, 8 months
JBoss Tools SVN: r40849 - 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-05-08 10:42:07 -0400 (Tue, 08 May 2012)
New Revision: 40849
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizard.java
Log:
corrected formatting in the warning message
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-05-08 14:30:32 UTC (rev 40848)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizard.java 2012-05-08 14:42:07 UTC (rev 40849)
@@ -15,14 +15,10 @@
import java.net.SocketTimeoutException;
import java.net.URISyntaxException;
import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Iterator;
import java.util.List;
import java.util.Set;
-import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.resources.WorkspaceJob;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -274,11 +270,11 @@
wizardModel.importProject(delegatingMonitor);
} else if (!wizardModel.isGitSharedProject()) {
if (!askForConfirmation(
- NLS.bind("OpenShift application {0} will be enabled on project {1} by "
- + "copying OpenShift configuration and enabling Git for the project.\n "
- + "This cannot be undone. \n"
+ NLS.bind("OpenShift application \"{0}\" will be enabled on project \"{1}\" by "
+ + "copying OpenShift configuration and enabling Git for the project.\n"
+ + "This cannot be undone.\n"
+ "Furthermore publishing to your OpenShift app will eventually override existing content.\n"
- + "Do you wish to continue ?",
+ + "\nDo you wish to continue ?",
wizardModel.getApplicationName(), wizardModel.getProjectName()),
wizardModel.getApplicationName())) {
return Status.CANCEL_STATUS;
12 years, 8 months
JBoss Tools SVN: r40848 - 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-05-08 10:30:32 -0400 (Tue, 08 May 2012)
New Revision: 40848
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationConfigurationWizardPage.java
Log:
[JBIDE-11796] passing dbc to WizardUtils#runInWizard(job, dbc) so that button-enablement is restored correctly after job is finished
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationConfigurationWizardPage.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationConfigurationWizardPage.java 2012-05-08 14:28:08 UTC (rev 40847)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationConfigurationWizardPage.java 2012-05-08 14:30:32 UTC (rev 40848)
@@ -174,7 +174,7 @@
this.browseAppsButton = new Button(existingAppSelectionGroup, SWT.NONE);
browseAppsButton.setText("Browse...");
- browseAppsButton.addSelectionListener(onBrowseApps());
+ browseAppsButton.addSelectionListener(onBrowseApps(dbc));
GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).hint(100, SWT.DEFAULT).span(1, 1).grab(false, false)
.applyTo(browseAppsButton);
// observe the list of application, get notified once they have been
@@ -203,7 +203,7 @@
adapter.setProposals(pageModel.getApplicationNames());
}
- private SelectionListener onBrowseApps() {
+ private SelectionListener onBrowseApps(final DataBindingContext dbc) {
return new SelectionAdapter() {
@Override
@@ -232,7 +232,7 @@
}
};
try {
- WizardUtils.runInWizard(j, getContainer());
+ WizardUtils.runInWizard(j, getContainer(), dbc);
} catch(InvocationTargetException ite) {
} catch(InterruptedException ie) {
}
12 years, 8 months
JBoss Tools SVN: r40847 - in trunk/modeshape/plugins/org.jboss.tools.modeshape.rest: src/org/jboss/tools/modeshape/rest and 4 other directories.
by jbosstools-commits@lists.jboss.org
Author: elvisisking
Date: 2012-05-08 10:28:08 -0400 (Tue, 08 May 2012)
New Revision: 40847
Modified:
trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/plugin.xml
trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/RestClientI18n.java
trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/RestClientI18n.properties
trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/actions/ReconnectToServerAction.java
trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/domain/ModeShapeServer.java
trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/jobs/ReconnectJob.java
trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/views/ModeShapeContentProvider.java
trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/views/ServerView.java
Log:
JBIDE-7928 Prompt for Password Dialog. Converted to lazy loading tree in ModeShape Server view. Until user expands tree no call to server is done. Also noticing if empty password and asking user if they want to enter one.
Modified: trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/plugin.xml
===================================================================
--- trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/plugin.xml 2012-05-08 11:17:39 UTC (rev 40846)
+++ trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/plugin.xml 2012-05-08 14:28:08 UTC (rev 40847)
@@ -189,6 +189,9 @@
<enablement>
<or>
<objectClass
+ name="org.jboss.tools.modeshape.rest.domain.ModeShapeServer">
+ </objectClass>
+ <objectClass
name="org.modeshape.web.jcr.rest.client.domain.IModeShapeObject">
</objectClass>
<objectClass
Modified: trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/RestClientI18n.java
===================================================================
--- trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/RestClientI18n.java 2012-05-08 11:17:39 UTC (rev 40846)
+++ trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/RestClientI18n.java 2012-05-08 14:28:08 UTC (rev 40847)
@@ -44,6 +44,9 @@
public static String ignoredResourcesPreferencePageTitle;
public static String missingImage;
+
+ public static String missingServerPasswordDialogMsg;
+ public static String missingServerPasswordDialogTitle;
public static String newIgnoredResourceDialogLabel;
public static String newIgnoredResourceDialogTitle;
@@ -148,6 +151,15 @@
public static String reconnectJobTaskName;
+ public static String requestDialogTitle;
+ public static String runningRepositoriesQueryMsg;
+ public static String runningServerRequestErrorMsg;
+ public static String runningServerRequestErrorDialogMsg;
+ public static String runningServerRequestErrorDialogTitle;
+ public static String runningServerRequestNewPasswordDialogMsg;
+ public static String runningServerRequestNewPasswordDialogTitle;
+ public static String runningWorkspacesQueryMsg;
+
public static String serverEmptyUrlMsg;
public static String serverEmptyUserMsg;
public static String serverExistsMsg;
Modified: trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/RestClientI18n.properties
===================================================================
--- trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/RestClientI18n.properties 2012-05-08 11:17:39 UTC (rev 40846)
+++ trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/RestClientI18n.properties 2012-05-08 14:28:08 UTC (rev 40847)
@@ -37,6 +37,9 @@
missingImage = The following image cannot be found "{0}"
+missingServerPasswordDialogMsg = The server you are trying to connect to does not have a password set. Would you like to set one?
+missingServerPasswordDialogTitle = Empty ModeShape Server Password
+
newIgnoredResourceDialogLabel = Enter a file name or folder name (* = any string, ? = and character):
newIgnoredResourceDialogTitle = New Ignore Pattern
@@ -140,6 +143,15 @@
reconnectJobTaskName = Connecting to server "{0}"
+requestDialogTitle = ModeShape Server Request
+runningRepositoriesQueryMsg = Running repositories query ...
+runningServerRequestErrorMsg = Unable to connect to ModeShape server
+runningServerRequestErrorDialogMsg = ModeShape server cannot be reached. Make sure server properties are correct.
+runningServerRequestErrorDialogTitle = ModeShape Server Connection Error
+runningServerRequestNewPasswordDialogMsg = Enter a new, non-empty server password
+runningServerRequestNewPasswordDialogTitle = Server Password Change
+runningWorkspacesQueryMsg = Running workspaces query ...
+
serverEmptyUserMsg = The user cannot be empty
serverEmptyUrlMsg = A server URL cannot be empty
serverExistsMsg = {0} already exists so it cannot be added
Modified: trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/actions/ReconnectToServerAction.java
===================================================================
--- trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/actions/ReconnectToServerAction.java 2012-05-08 11:17:39 UTC (rev 40846)
+++ trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/actions/ReconnectToServerAction.java 2012-05-08 14:28:08 UTC (rev 40847)
@@ -102,7 +102,7 @@
// run job in own thread not in the UI thread
Thread t = new Thread();
- t.start();
+ t.run();
job.setThread(t);
job.schedule();
}
Modified: trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/domain/ModeShapeServer.java
===================================================================
--- trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/domain/ModeShapeServer.java 2012-05-08 11:17:39 UTC (rev 40846)
+++ trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/domain/ModeShapeServer.java 2012-05-08 14:28:08 UTC (rev 40847)
@@ -58,18 +58,10 @@
*/
@Override
public boolean equals( Object obj ) {
- if (this == obj) {
- return true;
- }
-
- if (obj == null) {
+ if ((obj == null) || !getClass().equals(obj.getClass())) {
return false;
}
- if (!this.getClass().equals(obj.getClass())) {
- return false;
- }
-
ModeShapeServer that = (ModeShapeServer)obj;
if (this.delegate.equals(that.delegate)) {
Modified: trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/jobs/ReconnectJob.java
===================================================================
--- trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/jobs/ReconnectJob.java 2012-05-08 11:17:39 UTC (rev 40846)
+++ trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/jobs/ReconnectJob.java 2012-05-08 14:28:08 UTC (rev 40847)
@@ -22,7 +22,6 @@
import org.jboss.tools.modeshape.rest.Activator;
import org.jboss.tools.modeshape.rest.RestClientI18n;
import org.jboss.tools.modeshape.rest.ServerManager;
-import org.jboss.tools.modeshape.rest.Utils;
import org.jboss.tools.modeshape.rest.domain.ModeShapeServer;
import org.modeshape.web.jcr.rest.client.Status;
@@ -61,7 +60,6 @@
*/
@Override
protected IStatus run( IProgressMonitor monitor ) {
- IStatus result = null;
ServerManager serverManager = Activator.getDefault().getServerManager();
try {
@@ -69,18 +67,21 @@
monitor.beginTask(taskName, 1);
monitor.setTaskName(taskName);
Status status = serverManager.ping(this.server);
- result = Utils.convert(status);
+
+ if (status.isError()) {
+ Activator.getDefault().log(status);
+ }
} catch (Exception e) {
- result = new org.eclipse.core.runtime.Status(IStatus.ERROR,
+ Activator.getDefault().getLog().log(new org.eclipse.core.runtime.Status(IStatus.ERROR,
PLUGIN_ID,
RestClientI18n.publishJobUnexpectedErrorMsg,
- e);
+ e));
} finally {
monitor.done();
- done(result);
}
- return result;
+ // if an error status is returned a dialog is displayed by the UI event loop so we don't want that
+ return org.eclipse.core.runtime.Status.OK_STATUS;
}
}
Modified: trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/views/ModeShapeContentProvider.java
===================================================================
--- trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/views/ModeShapeContentProvider.java 2012-05-08 11:17:39 UTC (rev 40846)
+++ trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/views/ModeShapeContentProvider.java 2012-05-08 14:28:08 UTC (rev 40847)
@@ -13,6 +13,9 @@
import static org.jboss.tools.modeshape.rest.IUiConstants.PUBLISHED_OVERLAY_IMAGE;
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.locks.ReadWriteLock;
@@ -21,37 +24,54 @@
import net.jcip.annotations.GuardedBy;
import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.ColumnLabelProvider;
import org.eclipse.jface.viewers.IDecoration;
+import org.eclipse.jface.viewers.ILazyTreeContentProvider;
import org.eclipse.jface.viewers.ILightweightLabelDecorator;
-import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.LabelProviderChangedEvent;
+import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.osgi.util.NLS;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.IDecoratorManager;
import org.jboss.tools.modeshape.rest.Activator;
import org.jboss.tools.modeshape.rest.IServerRegistryListener;
+import org.jboss.tools.modeshape.rest.IUiConstants;
import org.jboss.tools.modeshape.rest.PublishedResourceHelper;
import org.jboss.tools.modeshape.rest.RestClientI18n;
import org.jboss.tools.modeshape.rest.ServerManager;
import org.jboss.tools.modeshape.rest.ServerRegistryEvent;
-import org.jboss.tools.modeshape.rest.Utils;
import org.jboss.tools.modeshape.rest.domain.ModeShapeDomainObject;
import org.jboss.tools.modeshape.rest.domain.ModeShapeRepository;
import org.jboss.tools.modeshape.rest.domain.ModeShapeServer;
import org.jboss.tools.modeshape.rest.domain.ModeShapeWorkspace;
-import org.modeshape.web.jcr.rest.client.Status;
-import org.modeshape.web.jcr.rest.client.Status.Severity;
/**
* The <code>ModeShapeContentProvider</code> is a content and label provider for the repositories. This class <strong>MUST</strong>
* be registered, and then unregistered, to receive server registry events.
*/
public final class ModeShapeContentProvider extends ColumnLabelProvider implements ILightweightLabelDecorator,
- IServerRegistryListener, ITreeContentProvider {
+ IServerRegistryListener, ILazyTreeContentProvider {
/**
* The decorator ID.
@@ -61,47 +81,60 @@
/**
* If a server connection cannot be established, wait this amount of time before trying again.
*/
- private static final long RETRY_DURATION = 2000;
+ private static final long RETRY_DURATION = 5000;
/**
- * @return the decorator
+ * Indicates if the Eclipse lazy content provider has already called this provider. This occurs when the associated viewer of
+ * this provider has been shown once or if the Eclipse window loses focus.
*/
- public static ModeShapeContentProvider getDecorator() {
- IDecoratorManager decoratorMgr = Activator.getDefault().getWorkbench().getDecoratorManager();
+ private static boolean _alreadyCalledByFramework;
- if (decoratorMgr.getEnabled(ID)) {
- return (ModeShapeContentProvider)decoratorMgr.getBaseLabelProvider(ID);
- }
-
- return null;
- }
-
/**
* Servers that a connection can't be established. Value is the last time a establishing a connection was tried.
*/
@GuardedBy("offlineServersLock")
- private final Map<ModeShapeServer, Long> offlineServerMap = new HashMap<ModeShapeServer, Long>();
+ private final static Map<ModeShapeServer, Long> _offlineServerMap = new HashMap<ModeShapeServer, Long>();
/**
* Lock used for when accessing the offline server map. The map will be accessed in different threads as the decorator runs in
* its own thread (not the UI thread).
*/
- private final ReadWriteLock offlineServersLock = new ReentrantReadWriteLock();
+ private final static ReadWriteLock _offlineServersLock = new ReentrantReadWriteLock();
/**
+ * @return the decorator
+ */
+ public static ModeShapeContentProvider getDecorator() {
+ final IDecoratorManager decoratorMgr = Activator.getDefault().getWorkbench().getDecoratorManager();
+
+ if (decoratorMgr.getEnabled(ID)) {
+ return (ModeShapeContentProvider)decoratorMgr.getBaseLabelProvider(ID);
+ }
+
+ return null;
+ }
+
+ /**
* The server manager where the server registry is managed.
*/
private ServerManager serverManager;
+ private TreeViewer viewer;
+
/**
* @param server the server that is offline
*/
- private void addOfflineServer( ModeShapeServer server ) {
+ void addOfflineServer( final ModeShapeServer server ) {
+ if (this.viewer != null) {
+ this.viewer.setHasChildren(server, false); // get rid of the expansion button
+ }
+
try {
- this.offlineServersLock.writeLock().lock();
- this.offlineServerMap.put(server, System.currentTimeMillis());
+ _offlineServersLock.writeLock().lock();
+ _offlineServerMap.put(server, System.currentTimeMillis());
+ refresh(server);
} finally {
- this.offlineServersLock.writeLock().unlock();
+ _offlineServersLock.writeLock().unlock();
}
}
@@ -112,7 +145,7 @@
*/
@Override
public void decorate( final Object element,
- IDecoration decoration ) {
+ final IDecoration decoration ) {
ImageDescriptor overlay = null;
final Display display = Display.getDefault();
@@ -120,31 +153,30 @@
return;
}
- if (getServerManager() != null) {
- if (element instanceof ModeShapeServer) {
- ModeShapeServer server = (ModeShapeServer)element;
+ if (element instanceof ModeShapeServer) {
+ final ModeShapeServer server = (ModeShapeServer)element;
- if (isOkToConnect(server)) {
- Status status = getServerManager().ping(server);
- overlay = Utils.getOverlayImage(status);
+ // if server is offline then decorate with error overlay
+ try {
+ _offlineServersLock.readLock().lock();
- if (status.isError()) {
- addOfflineServer(server);
- }
+ if (_offlineServerMap.containsKey(server)) {
+ overlay = Activator.getDefault().getImageDescriptor(IUiConstants.ERROR_OVERLAY_IMAGE);
}
- } else if (element instanceof IFile) {
- IFile file = (IFile)element;
-
- if (file.exists() && !file.isHidden()
- && new PublishedResourceHelper(getServerManager()).isPublished((IFile)element)) {
- overlay = Activator.getDefault().getImageDescriptor(PUBLISHED_OVERLAY_IMAGE);
- }
+ } finally {
+ _offlineServersLock.readLock().unlock();
}
+ } else if (element instanceof IFile) {
+ final IFile file = (IFile)element;
- if (overlay != null) {
- decoration.addOverlay(overlay);
+ if (file.exists() && !file.isHidden() && new PublishedResourceHelper(getServerManager()).isPublished((IFile)element)) {
+ overlay = Activator.getDefault().getImageDescriptor(PUBLISHED_OVERLAY_IMAGE);
}
}
+
+ if (overlay != null) {
+ decoration.addOverlay(overlay);
+ }
}
/**
@@ -160,70 +192,20 @@
/**
* {@inheritDoc}
*
- * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)
- */
- @Override
- public Object[] getChildren( Object parentElement ) {
- assert (parentElement instanceof ModeShapeDomainObject);
-
- if (getServerManager() != null) {
- if (parentElement instanceof ModeShapeServer) {
- ModeShapeServer server = (ModeShapeServer)parentElement;
-
- if (isOkToConnect(server)) {
- try {
- return getServerManager().getRepositories(server).toArray();
- } catch (Exception e) {
- addOfflineServer(server);
- String msg = NLS.bind(RestClientI18n.serverManagerGetRepositoriesExceptionMsg, server.getShortDescription());
- Activator.getDefault().log(new Status(Severity.ERROR, msg, e));
- }
- }
- } else if (parentElement instanceof ModeShapeRepository) {
- ModeShapeRepository repository = (ModeShapeRepository)parentElement;
-
- if (isOkToConnect(repository.getServer())) {
- try {
- return getServerManager().getWorkspaces(repository).toArray();
- } catch (Exception e) {
- addOfflineServer(repository.getServer());
- String msg = NLS.bind(RestClientI18n.serverManagerGetWorkspacesExceptionMsg, repository.getShortDescription());
- Activator.getDefault().log(new Status(Severity.ERROR, msg, e));
- }
- }
- }
- }
-
- return new Object[0];
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
- */
- @Override
- public Object[] getElements( Object inputElement ) {
- return ((getServerManager() == null) ? new Object[0] : getServerManager().getServers().toArray());
- }
-
- /**
- * {@inheritDoc}
- *
* @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object)
*/
@Override
- public Image getImage( Object element ) {
+ public Image getImage( final Object element ) {
return Activator.getDefault().getImage(element);
}
/**
* {@inheritDoc}
*
- * @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object)
+ * @see org.eclipse.jface.viewers.ILazyTreeContentProvider#getParent(java.lang.Object)
*/
@Override
- public Object getParent( Object element ) {
+ public Object getParent( final Object element ) {
assert (element instanceof ModeShapeDomainObject);
if (element instanceof ModeShapeWorkspace) {
@@ -234,14 +216,15 @@
return ((ModeShapeRepository)element).getServer();
}
- // server
+ if (element instanceof ModeShapeServer) {
+ return getServerManager();
+ }
+
+ assert false : "unknown ModeShapeDomainObject=" + element.getClass(); //$NON-NLS-1$
return null;
}
- /**
- * @return the server manager (never <code>null</code>)
- */
- private ServerManager getServerManager() {
+ ServerManager getServerManager() {
if (this.serverManager == null) {
this.serverManager = Activator.getDefault().getServerManager();
}
@@ -249,13 +232,17 @@
return this.serverManager;
}
+ Shell getShell() {
+ return this.viewer.getTree().getShell();
+ }
+
/**
* {@inheritDoc}
*
* @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object)
*/
@Override
- public String getText( Object element ) {
+ public String getText( final Object element ) {
assert (element instanceof ModeShapeDomainObject);
return ((ModeShapeDomainObject)element).getName();
}
@@ -266,7 +253,7 @@
* @see org.eclipse.jface.viewers.CellLabelProvider#getToolTipImage(java.lang.Object)
*/
@Override
- public Image getToolTipImage( Object object ) {
+ public Image getToolTipImage( final Object object ) {
return getImage(object);
}
@@ -276,7 +263,7 @@
* @see org.eclipse.jface.viewers.CellLabelProvider#getToolTipText(java.lang.Object)
*/
@Override
- public String getToolTipText( Object element ) {
+ public String getToolTipText( final Object element ) {
if (element instanceof ModeShapeDomainObject) {
return ((ModeShapeDomainObject)element).getShortDescription();
}
@@ -290,18 +277,12 @@
* @see org.eclipse.jface.viewers.CellLabelProvider#getToolTipTimeDisplayed(java.lang.Object)
*/
@Override
- public int getToolTipTimeDisplayed( Object object ) {
+ public int getToolTipTimeDisplayed( final Object object ) {
return 3000;
}
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object)
- */
- @Override
- public boolean hasChildren( Object element ) {
- return getChildren(element).length > 0;
+ TreeViewer getViewer() {
+ return this.viewer;
}
/**
@@ -311,59 +292,39 @@
* java.lang.Object)
*/
@Override
- public void inputChanged( Viewer viewer,
- Object oldInput,
- Object newInput ) {
+ public void inputChanged( final Viewer viewer,
+ final Object oldInput,
+ final Object newInput ) {
// nothing to do
}
- public void refresh( final Object element ) {
- final Display display = Display.getDefault();
-
- if (display.isDisposed()) {
- return;
- }
-
- display.asyncExec(new Runnable() {
- /**
- * {@inheritDoc}
- *
- * @see java.lang.Runnable#run()
- */
- @SuppressWarnings("synthetic-access")
- @Override
- public void run() {
- fireLabelProviderChanged(new LabelProviderChangedEvent(ModeShapeContentProvider.this, element));
- }
- });
- }
-
/**
* Determines if a try to connect to a server should be done based on the last time a try was done and failed.
*
* @param server the server being checked
* @return <code>true</code> if it is OK to try and connect
*/
- private boolean isOkToConnect( ModeShapeServer server ) {
+ private boolean isOkToConnect( final ModeShapeServer server ) {
boolean check = false; // check map for time
try {
- this.offlineServersLock.readLock().lock();
- check = this.offlineServerMap.containsKey(server);
+ _offlineServersLock.readLock().lock();
+ check = _offlineServerMap.containsKey(server);
} finally {
- this.offlineServersLock.readLock().unlock();
+ _offlineServersLock.readLock().unlock();
}
if (check) {
try {
- this.offlineServersLock.writeLock().lock();
+ _offlineServersLock.writeLock().lock();
- if (this.offlineServerMap.containsKey(server)) {
- long checkTime = this.offlineServerMap.get(server);
+ if (_offlineServerMap.containsKey(server)) {
+ final long checkTime = _offlineServerMap.get(server);
// OK to try and connect if last failed attempt was too long ago
if ((System.currentTimeMillis() - checkTime) > RETRY_DURATION) {
- this.offlineServerMap.remove(server);
+ _offlineServerMap.remove(server);
+ refresh(server);
return true;
}
@@ -371,7 +332,7 @@
return false;
}
} finally {
- this.offlineServersLock.writeLock().unlock();
+ _offlineServersLock.writeLock().unlock();
}
}
@@ -379,28 +340,425 @@
return true;
}
+ public void refresh( final Object element ) {
+ final Display display = Display.getDefault();
+
+ if (display.isDisposed()) {
+ return;
+ }
+
+ display.asyncExec(new Runnable() {
+ /**
+ * {@inheritDoc}
+ *
+ * @see java.lang.Runnable#run()
+ */
+ @SuppressWarnings("synthetic-access")
+ @Override
+ public void run() {
+ fireLabelProviderChanged(new LabelProviderChangedEvent(ModeShapeContentProvider.this, element));
+ }
+ });
+ }
+
+ private void run( final ServerOperation op,
+ final boolean enforceNonEmptyPassword ) {
+ try {
+ final ModeShapeServer server = op.getServer();
+
+ if (enforceNonEmptyPassword && ((server.getPassword() == null) || server.getPassword().isEmpty())) {
+ if (MessageDialog.openQuestion(getShell(), RestClientI18n.missingServerPasswordDialogTitle,
+ RestClientI18n.missingServerPasswordDialogMsg)) {
+ final NewPasswordDialog dialog = new NewPasswordDialog(getShell());
+
+ if (dialog.open() == Window.OK) {
+ getServerManager().updateServer(server,
+ new ModeShapeServer(server.getUrl(),
+ server.getUser(),
+ dialog.getNewPassword(),
+ server.isPasswordBeingPersisted()));
+
+ // need to obtain changed server from server manager as servers are not mutable
+ for (final ModeShapeServer registeredServer : getServerManager().getServers()) {
+ if (registeredServer.hasSameKey(server)) {
+ op.setUpdatedServer(registeredServer);
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ final ProgressMonitorDialog dialog = new ProgressMonitorDialog(getShell()) {
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.dialogs.ProgressMonitorDialog#configureShell(org.eclipse.swt.widgets.Shell)
+ */
+ @Override
+ protected void configureShell( final Shell shell ) {
+ super.configureShell(shell);
+ shell.setText(RestClientI18n.requestDialogTitle);
+ }
+ };
+
+ dialog.run(true, false, op);
+ } catch (final InvocationTargetException e) {
+ // should not happen as ServerOperation handles this but just in case
+ if (op.getUpdatedServer() == null) {
+ addOfflineServer(op.getServer());
+ } else {
+ addOfflineServer(op.getUpdatedServer());
+ }
+
+ final org.eclipse.core.runtime.Status error = new org.eclipse.core.runtime.Status(IStatus.ERROR,
+ IUiConstants.PLUGIN_ID,
+ RestClientI18n.runningServerRequestErrorMsg,
+ e.getCause());
+ ErrorDialog.openError(getShell(), RestClientI18n.runningServerRequestErrorDialogTitle,
+ RestClientI18n.runningServerRequestErrorDialogMsg, error);
+ } catch (final InterruptedException e) {
+ // won't happen as runnable is not cancelable
+ }
+ }
+
/**
* {@inheritDoc}
*
* @see org.jboss.tools.modeshape.rest.IServerRegistryListener#serverRegistryChanged(org.jboss.tools.modeshape.rest.ServerRegistryEvent)
*/
@Override
- public Exception[] serverRegistryChanged( ServerRegistryEvent event ) {
+ public Exception[] serverRegistryChanged( final ServerRegistryEvent event ) {
Exception[] errors = null;
// only care about servers being removed or updated
if (event.isRemove() || event.isUpdate()) {
try {
- this.offlineServersLock.writeLock().lock();
- this.offlineServerMap.remove(event.getServer());
- } catch (Exception e) {
+ _offlineServersLock.writeLock().lock();
+ _offlineServerMap.remove(event.getServer());
+ } catch (final Exception e) {
errors = new Exception[] { e };
} finally {
- this.offlineServersLock.writeLock().unlock();
+ _offlineServersLock.writeLock().unlock();
}
}
return errors;
}
+ void setViewer( final TreeViewer viewer ) {
+ this.viewer = viewer;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.viewers.ILazyTreeContentProvider#updateChildCount(java.lang.Object, int)
+ */
+ @Override
+ public void updateChildCount( final Object element,
+ final int currentChildCount ) {
+ getServerManager(); // make sure server manager has been set
+
+ if (element == this.serverManager) {
+ final Collection<ModeShapeServer> servers = this.serverManager.getServers();
+
+ if (servers.size() != currentChildCount) {
+ this.viewer.setChildCount(element, servers.size());
+ }
+
+ if (_alreadyCalledByFramework) {
+ updateElement(element, 0);
+ } else {
+ _alreadyCalledByFramework = true;
+ }
+ } else if (element instanceof ModeShapeServer) {
+ final ModeShapeServer server = (ModeShapeServer)element;
+
+ if (isOkToConnect(server)) {
+ try {
+ final ServerOperation op = new ServerOperation(server) {
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.tools.modeshape.rest.views.ModeShapeContentProvider.ServerOperation#doRun(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ void doRun( final IProgressMonitor monitor ) throws InvocationTargetException, InterruptedException {
+ if (monitor.isCanceled()) {
+ throw new InterruptedException();
+ }
+
+ monitor.beginTask(RestClientI18n.runningRepositoriesQueryMsg, IProgressMonitor.UNKNOWN);
+ final ModeShapeServer serverToQuery = ((getUpdatedServer() == null) ? server : getUpdatedServer());
+
+ try {
+ final Collection<ModeShapeRepository> repositories = getServerManager().getRepositories(serverToQuery);
+
+ if (repositories.size() != currentChildCount) {
+ getViewer().setChildCount(serverToQuery, repositories.size());
+ }
+ } catch (final Exception e) {
+ throw new InvocationTargetException(e);
+ } finally {
+ monitor.done();
+ }
+
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.tools.modeshape.rest.views.ModeShapeContentProvider.ServerOperation#getDisplay()
+ */
+ @Override
+ Display getDisplay() {
+ return getViewer().getTree().getDisplay();
+ }
+ };
+
+ run(op, true);
+ } catch (final Exception e) {
+ addOfflineServer(server);
+ }
+ }
+ } else if (element instanceof ModeShapeRepository) {
+ final ModeShapeRepository repository = (ModeShapeRepository)element;
+
+ if (isOkToConnect(repository.getServer())) {
+ try {
+ final ServerOperation op = new ServerOperation(repository.getServer()) {
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.tools.modeshape.rest.views.ModeShapeContentProvider.ServerOperation#doRun(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ void doRun( final IProgressMonitor monitor ) throws InvocationTargetException, InterruptedException {
+ if (monitor.isCanceled()) {
+ throw new InterruptedException();
+ }
+
+ monitor.beginTask(RestClientI18n.runningWorkspacesQueryMsg, IProgressMonitor.UNKNOWN);
+
+ try {
+ final Collection<ModeShapeWorkspace> workspaces = getServerManager().getWorkspaces(repository);
+
+ if (workspaces.size() != currentChildCount) {
+ getViewer().setChildCount(repository, workspaces.size());
+ }
+ } catch (final Exception e) {
+ throw new InvocationTargetException(e);
+ } finally {
+ monitor.done();
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.tools.modeshape.rest.views.ModeShapeContentProvider.ServerOperation#getDisplay()
+ */
+ @Override
+ Display getDisplay() {
+ return getViewer().getTree().getDisplay();
+ }
+ };
+
+ run(op, true);
+ } catch (final Exception e) {
+ addOfflineServer(repository.getServer());
+ }
+ }
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.viewers.ILazyTreeContentProvider#updateElement(java.lang.Object, int)
+ */
+ @Override
+ public void updateElement( final Object parent,
+ final int index ) {
+ getServerManager(); // make sure server manager has been set
+
+ if (parent == this.serverManager) {
+ final ModeShapeServer server = new ArrayList<ModeShapeServer>(this.serverManager.getServers()).get(index);
+ this.viewer.replace(this.serverManager, index, server);
+ this.viewer.setHasChildren(server, true);
+ } else if (parent instanceof ModeShapeServer) {
+ final ModeShapeServer server = (ModeShapeServer)parent;
+
+ if (isOkToConnect(server)) {
+ try {
+ final ModeShapeRepository repository = new ArrayList<ModeShapeRepository>(this.serverManager.getRepositories(server)).get(index);
+ this.viewer.replace(server, index, repository);
+ this.viewer.setHasChildren(repository, true);
+ } catch (final Exception e) {
+ addOfflineServer(server);
+ }
+ }
+ } else if (parent instanceof ModeShapeRepository) {
+ final ModeShapeRepository repository = (ModeShapeRepository)parent;
+
+ if (isOkToConnect(repository.getServer())) {
+ try {
+ final ModeShapeWorkspace workspace = new ArrayList<ModeShapeWorkspace>(this.serverManager.getWorkspaces(repository)).get(index);
+ this.viewer.replace(repository, index, workspace);
+ } catch (final Exception e) {
+ addOfflineServer(repository.getServer());
+ }
+ }
+ }
+ }
+
+ class NewPasswordDialog extends MessageDialog {
+
+ private Button btnOk;
+ private String newPassword = ""; //$NON-NLS-1$
+
+ public NewPasswordDialog( final Shell parentShell ) {
+ super(parentShell, RestClientI18n.runningServerRequestNewPasswordDialogTitle, null,
+ RestClientI18n.runningServerRequestNewPasswordDialogMsg, MessageDialog.NONE, new String[] {
+ IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }, 0);
+ setShellStyle(getShellStyle() | SWT.RESIZE);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.dialogs.MessageDialog#createButton(org.eclipse.swt.widgets.Composite, int, java.lang.String,
+ * boolean)
+ */
+ @Override
+ protected Button createButton( final Composite parent,
+ final int id,
+ final String label,
+ final boolean defaultButton ) {
+ final Button btn = super.createButton(parent, id, label, defaultButton);
+
+ if (id == IDialogConstants.OK_ID) {
+ // disable OK button initially
+ this.btnOk = btn;
+ btn.setEnabled(false);
+ }
+
+ return btn;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.dialogs.MessageDialog#createCustomArea(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ protected Control createCustomArea( final Composite parent ) {
+ final Composite panel = new Composite(parent, SWT.NONE);
+ panel.setLayout(new GridLayout(2, false));
+ panel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+
+ final Label lbl = new Label(panel, SWT.NONE);
+ lbl.setText(RestClientI18n.serverPagePasswordLabel);
+
+ final Text txt = new Text(panel, SWT.BORDER);
+ txt.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+ txt.setToolTipText(RestClientI18n.serverPagePasswordToolTip);
+ txt.addModifyListener(new ModifyListener() {
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent)
+ */
+ @Override
+ public void modifyText( final ModifyEvent e ) {
+ handlePasswordChanged(((Text)e.widget).getText());
+ }
+ });
+
+ return super.createCustomArea(parent);
+ }
+
+ public String getNewPassword() {
+ return this.newPassword;
+ }
+
+ void handlePasswordChanged( final String newPassword ) {
+ this.newPassword = newPassword;
+
+ // update OK button enablement
+ final boolean enable = ((this.newPassword != null) && !this.newPassword.isEmpty());
+
+ if (this.btnOk.getEnabled() != enable) {
+ this.btnOk.setEnabled(enable);
+ }
+ }
+ }
+
+ abstract class ServerOperation implements IRunnableWithProgress {
+ private ModeShapeServer updatedServer;
+ private final ModeShapeServer server;
+
+ public ServerOperation( final ModeShapeServer server ) {
+ this.server = server;
+ }
+
+ abstract void doRun( IProgressMonitor monitor ) throws InvocationTargetException, InterruptedException;
+
+ abstract Display getDisplay();
+
+ ModeShapeServer getServer() {
+ return this.server;
+ }
+
+ ModeShapeServer getUpdatedServer() {
+ return this.updatedServer;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.operation.IRunnableWithProgress#run(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public final void run( final IProgressMonitor monitor ) {
+ getDisplay().asyncExec(new Runnable() {
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see java.lang.Runnable#run()
+ */
+ @Override
+ public void run() {
+ try {
+ doRun(monitor);
+ } catch (final InvocationTargetException e) {
+ if (getUpdatedServer() == null) {
+ addOfflineServer(getServer());
+ } else {
+ addOfflineServer(getUpdatedServer());
+ }
+
+ final org.eclipse.core.runtime.Status error = new org.eclipse.core.runtime.Status(IStatus.ERROR,
+ IUiConstants.PLUGIN_ID,
+ RestClientI18n.runningServerRequestErrorMsg,
+ e.getCause());
+ ErrorDialog.openError(getShell(), RestClientI18n.runningServerRequestErrorDialogTitle,
+ RestClientI18n.runningServerRequestErrorDialogMsg, error);
+ } catch (final InterruptedException e) {
+ // should not happen has monitor is not cancelable
+ }
+ }
+ });
+ }
+
+ void setUpdatedServer( final ModeShapeServer updatedServer ) {
+ this.updatedServer = updatedServer;
+ }
+ }
}
Modified: trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/views/ServerView.java
===================================================================
--- trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/views/ServerView.java 2012-05-08 11:17:39 UTC (rev 40846)
+++ trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/views/ServerView.java 2012-05-08 14:28:08 UTC (rev 40847)
@@ -147,8 +147,10 @@
* @param parent the viewer's parent
*/
private void constructTreeViewer( Composite parent ) {
+ this.viewer = new TreeViewer(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.VIRTUAL);
+ this.viewer.setUseHashlookup(true);
this.provider = new ModeShapeContentProvider();
- this.viewer = new TreeViewer(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI);
+ this.provider.setViewer(this.viewer);
this.viewer.setContentProvider(this.provider);
ILabelDecorator decorator = Activator.getDefault().getWorkbench().getDecoratorManager().getLabelDecorator();
@@ -178,8 +180,8 @@
}
});
- // need to call this (doesn't matter what the param is) to bootstrap the provider.
- this.viewer.setInput(this);
+ // need to call this to populate tree
+ this.viewer.setInput(getServerManager());
// need to do this so that properties page will work
getSite().setSelectionProvider(this.viewer);
12 years, 8 months
JBoss Tools SVN: r40846 - in trunk/cdi/tests/org.jboss.tools.cdi.seam3.bot.test/src/org/jboss/tools/cdi/seam3/bot/test: base and 3 other directories.
by jbosstools-commits@lists.jboss.org
Author: jjankovi
Date: 2012-05-08 07:17:39 -0400 (Tue, 08 May 2012)
New Revision: 40846
Added:
trunk/cdi/tests/org.jboss.tools.cdi.seam3.bot.test/src/org/jboss/tools/cdi/seam3/bot/test/util/SeamLibrary.java
Removed:
trunk/cdi/tests/org.jboss.tools.cdi.seam3.bot.test/src/org/jboss/tools/cdi/seam3/bot/test/util/SeamLibraries.java
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.seam3.bot.test/src/org/jboss/tools/cdi/seam3/bot/test/CDISeam3AllBotTests.java
trunk/cdi/tests/org.jboss.tools.cdi.seam3.bot.test/src/org/jboss/tools/cdi/seam3/bot/test/base/Seam3TestBase.java
trunk/cdi/tests/org.jboss.tools.cdi.seam3.bot.test/src/org/jboss/tools/cdi/seam3/bot/test/base/SolderAnnotationTestBase.java
trunk/cdi/tests/org.jboss.tools.cdi.seam3.bot.test/src/org/jboss/tools/cdi/seam3/bot/test/base/SolderTestBase.java
trunk/cdi/tests/org.jboss.tools.cdi.seam3.bot.test/src/org/jboss/tools/cdi/seam3/bot/test/tests/DefaultBeansTest.java
trunk/cdi/tests/org.jboss.tools.cdi.seam3.bot.test/src/org/jboss/tools/cdi/seam3/bot/test/tests/ExactAnnotationTest.java
trunk/cdi/tests/org.jboss.tools.cdi.seam3.bot.test/src/org/jboss/tools/cdi/seam3/bot/test/tests/FullyQualifiedTest.java
trunk/cdi/tests/org.jboss.tools.cdi.seam3.bot.test/src/org/jboss/tools/cdi/seam3/bot/test/tests/NamedPackagesTest.java
trunk/cdi/tests/org.jboss.tools.cdi.seam3.bot.test/src/org/jboss/tools/cdi/seam3/bot/test/tests/RequiresAnnotationTest.java
trunk/cdi/tests/org.jboss.tools.cdi.seam3.bot.test/src/org/jboss/tools/cdi/seam3/bot/test/tests/VetoAnnotationTest.java
trunk/cdi/tests/org.jboss.tools.cdi.seam3.bot.test/src/org/jboss/tools/cdi/seam3/bot/test/uiutils/AssignableBeansDialogExt.java
trunk/cdi/tests/org.jboss.tools.cdi.seam3.bot.test/src/org/jboss/tools/cdi/seam3/bot/test/util/LibraryHelper.java
Log:
reformatting seam3 test - better method names, javadoc ...
Modified: trunk/cdi/tests/org.jboss.tools.cdi.seam3.bot.test/src/org/jboss/tools/cdi/seam3/bot/test/CDISeam3AllBotTests.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.seam3.bot.test/src/org/jboss/tools/cdi/seam3/bot/test/CDISeam3AllBotTests.java 2012-05-08 10:41:25 UTC (rev 40845)
+++ trunk/cdi/tests/org.jboss.tools.cdi.seam3.bot.test/src/org/jboss/tools/cdi/seam3/bot/test/CDISeam3AllBotTests.java 2012-05-08 11:17:39 UTC (rev 40846)
@@ -24,25 +24,9 @@
import org.junit.runner.RunWith;
import org.junit.runners.Suite.SuiteClasses;
-
/**
- * This test suite requires JBoss AS 6 or newer
+ * Suite duration: aprox. 18min
*
- * System properties:
- * -Dswtbot.test.properties.file=$PATH
- * -Dusage_reporting_enabled=$BOOLEAN
- *
- * Format of swtbot.properties file:
- * SERVER=EAP|JBOSS_AS,<server version>,<jre version to run with>|default,<server home>
- *
- * Sample swtbot.properties file:
- *
- * SERVER=JBOSS_AS,6.0,default,/home/jjankovi/Dokumenty/Red_Hat_Stuff/Runtimes/jboss-6.0.0.Final
- * JAVA=1.6,/space/java/sdk/jdk1.6.0_22
- *
- *
- * Suite duration: aprox. 3min
- *
* @author Jaroslav Jankovic
*/
@RunWith(RequirementAwareSuite.class)
Modified: trunk/cdi/tests/org.jboss.tools.cdi.seam3.bot.test/src/org/jboss/tools/cdi/seam3/bot/test/base/Seam3TestBase.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.seam3.bot.test/src/org/jboss/tools/cdi/seam3/bot/test/base/Seam3TestBase.java 2012-05-08 10:41:25 UTC (rev 40845)
+++ trunk/cdi/tests/org.jboss.tools.cdi.seam3.bot.test/src/org/jboss/tools/cdi/seam3/bot/test/base/Seam3TestBase.java 2012-05-08 11:17:39 UTC (rev 40846)
@@ -18,7 +18,7 @@
import org.jboss.tools.cdi.seam3.bot.test.Activator;
import org.jboss.tools.cdi.seam3.bot.test.CDISeam3AllBotTests;
import org.jboss.tools.cdi.seam3.bot.test.util.LibraryHelper;
-import org.jboss.tools.cdi.seam3.bot.test.util.SeamLibraries;
+import org.jboss.tools.cdi.seam3.bot.test.util.SeamLibrary;
import org.jboss.tools.ui.bot.ext.RequirementAwareSuite;
import org.jboss.tools.ui.bot.ext.config.Annotations.Require;
import org.jboss.tools.ui.bot.ext.config.Annotations.Server;
@@ -32,6 +32,11 @@
version = "6.0", operator = ">="))
@RunWith(RequirementAwareSuite.class)
@SuiteClasses({ CDISeam3AllBotTests.class })
+/**
+ *
+ * @author jjankovi
+ *
+ */
public class Seam3TestBase extends CDITestBase {
private String projectName = "CDISeam3Project";
@@ -47,15 +52,24 @@
return packageName;
}
+ protected SeamLibrary getSeamLibrary() {
+ return SeamLibrary.UNKNOWN;
+ }
+
@Override
public void prepareWorkspace() {
if (!projectHelper.projectExists(getProjectName())) {
- importSeam3TestProject(getProjectName(), "/resources/projects/" +
- getProjectName(), getProjectName());
+ importSeam3ProjectWithLibrary(getProjectName());
}
}
+ /**
+ *
+ * @param projectName
+ * @param projectLocation
+ * @param dir
+ */
protected void importSeam3TestProject(String projectName,
String projectLocation, String dir) {
ImportHelper.importProject(projectLocation, dir, Activator.PLUGIN_ID);
@@ -66,20 +80,43 @@
configuredState.getServer().name);
}
- protected void addAndCheckLibraryInProject(String projectName,
- SeamLibraries library) {
- addLibraryIntoProject(projectName, library.getName());
- checkLibraryInProject(projectName, library.getName());
+ /**
+ *
+ * @param projectName
+ */
+ protected void importSeam3ProjectWithLibrary(String projectName) {
+ importSeam3ProjectWithLibrary(projectName, getSeamLibrary());
}
+ /**
+ *
+ * @param projectName
+ * @param library
+ */
protected void importSeam3ProjectWithLibrary(String projectName,
- SeamLibraries library) {
+ SeamLibrary library) {
importSeam3TestProject(projectName,
"/resources/projects/" + projectName, projectName);
addAndCheckLibraryInProject(projectName, library);
eclipse.cleanAllProjects();
}
+ /**
+ *
+ * @param projectName
+ * @param library
+ */
+ protected void addAndCheckLibraryInProject(String projectName,
+ SeamLibrary library) {
+ addLibraryIntoProject(projectName, library.getName());
+ checkLibraryInProject(projectName, library.getName());
+ }
+
+ /**
+ *
+ * @param projectName
+ * @param libraryName
+ */
private void addLibraryIntoProject(String projectName, String libraryName) {
try {
libraryHelper.addLibraryIntoProject(projectName, libraryName);
@@ -93,6 +130,11 @@
}
}
+ /**
+ *
+ * @param projectName
+ * @param libraryName
+ */
private void checkLibraryInProject(String projectName, String libraryName) {
assertTrue(libraryHelper.isLibraryInProjectClassPath(projectName, libraryName));
}
Modified: trunk/cdi/tests/org.jboss.tools.cdi.seam3.bot.test/src/org/jboss/tools/cdi/seam3/bot/test/base/SolderAnnotationTestBase.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.seam3.bot.test/src/org/jboss/tools/cdi/seam3/bot/test/base/SolderAnnotationTestBase.java 2012-05-08 10:41:25 UTC (rev 40845)
+++ trunk/cdi/tests/org.jboss.tools.cdi.seam3.bot.test/src/org/jboss/tools/cdi/seam3/bot/test/base/SolderAnnotationTestBase.java 2012-05-08 11:17:39 UTC (rev 40846)
@@ -15,22 +15,89 @@
import org.jboss.tools.cdi.bot.test.CDIConstants;
import org.jboss.tools.cdi.bot.test.annotations.ProblemsType;
+/**
+ *
+ * @author jjankovi
+ *
+ */
public class SolderAnnotationTestBase extends SolderTestBase {
protected String APPLICATION_CLASS = "Application.java";
- protected void testAnnotationImproperValue(String projectName, boolean noBeanEligible) {
+ /**
+ *
+ * @param projectName
+ */
+ protected void testNoBeanValidationProblemExists(String projectName) {
+ testBeanValidationProblemExists(projectName, true);
+
+ }
+
+ /**
+ *
+ * @param projectName
+ */
+ protected void testMultipleBeansValidationProblemExists(String projectName) {
+
+ testBeanValidationProblemExists(projectName, false);
+
+ }
+
+ /**
+ *
+ * @param projectName
+ * @param noBeanEligible
+ */
+ private void testBeanValidationProblemExists(String projectName, boolean noBeanEligible) {
+
SWTBotTreeItem[] validationProblems = quickFixHelper.getProblems(
ProblemsType.WARNINGS, projectName);
assertTrue(validationProblems.length > 0);
assertTrue(validationProblems.length == 1);
assertContains(noBeanEligible?CDIConstants.NO_BEAN_IS_ELIGIBLE:
CDIConstants.MULTIPLE_BEANS, validationProblems[0].getText());
+
+ }
+
+ /**
+ *
+ * @param projectName
+ * @param openOnString
+ * @param openedClass
+ * @param producer
+ * @param producerMethod
+ */
+ protected void testProperInjectBean(String projectName,
+ String openOnString, String openedClass) {
+ testProperInject(projectName, openOnString, openedClass, false, null);
+
}
- protected void testAnnotationProperValue(String projectName, String openOnString, String openedClass,
+ /**
+ *
+ * @param projectName
+ * @param openOnString
+ * @param openedClass
+ */
+ protected void testProperInjectProducer(String projectName,
+ String openOnString, String openedClass,
+ String producerMethod) {
+
+ testProperInject(projectName, openOnString, openedClass, true, producerMethod);
+
+ }
+
+ /**
+ *
+ * @param projectName
+ * @param openOnString
+ * @param openedClass
+ * @param producer
+ * @param producerMethod
+ */
+ private void testProperInject(String projectName, String openOnString, String openedClass,
boolean producer, String producerMethod) {
SWTBotTreeItem[] validationProblems = quickFixHelper.getProblems(
Modified: trunk/cdi/tests/org.jboss.tools.cdi.seam3.bot.test/src/org/jboss/tools/cdi/seam3/bot/test/base/SolderTestBase.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.seam3.bot.test/src/org/jboss/tools/cdi/seam3/bot/test/base/SolderTestBase.java 2012-05-08 10:41:25 UTC (rev 40845)
+++ trunk/cdi/tests/org.jboss.tools.cdi.seam3.bot.test/src/org/jboss/tools/cdi/seam3/bot/test/base/SolderTestBase.java 2012-05-08 11:17:39 UTC (rev 40846)
@@ -1,14 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2012 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
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
package org.jboss.tools.cdi.seam3.bot.test.base;
-import org.jboss.tools.cdi.seam3.bot.test.util.SeamLibraries;
-
+import org.jboss.tools.cdi.seam3.bot.test.util.SeamLibrary;
+/**
+ *
+ * @author jjankovi
+ *
+ */
public class SolderTestBase extends Seam3TestBase {
@Override
- public void prepareWorkspace() {
- if (!projectHelper.projectExists(getProjectName())) {
- importSeam3ProjectWithLibrary(getProjectName(), SeamLibraries.SOLDER);
- }
+ protected SeamLibrary getSeamLibrary() {
+ return SeamLibrary.SOLDER;
}
}
Modified: trunk/cdi/tests/org.jboss.tools.cdi.seam3.bot.test/src/org/jboss/tools/cdi/seam3/bot/test/tests/DefaultBeansTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.seam3.bot.test/src/org/jboss/tools/cdi/seam3/bot/test/tests/DefaultBeansTest.java 2012-05-08 10:41:25 UTC (rev 40845)
+++ trunk/cdi/tests/org.jboss.tools.cdi.seam3.bot.test/src/org/jboss/tools/cdi/seam3/bot/test/tests/DefaultBeansTest.java 2012-05-08 11:17:39 UTC (rev 40846)
@@ -18,6 +18,11 @@
import org.jboss.tools.cdi.seam3.bot.test.uiutils.AssignableBeansDialogExt;
import org.junit.Test;
+/**
+ *
+ * @author jjankovi
+ *
+ */
public class DefaultBeansTest extends SolderAnnotationTestBase {
@Override
@@ -30,16 +35,14 @@
projectExplorer.deleteProject(getProjectName(), true);
}
- private String className = "Application.java";
-
@Test
public void testProperAssign() {
packageExplorer.openFile(getProjectName(), CDIConstants.SRC,
- getPackageName(), className);
+ getPackageName(), APPLICATION_CLASS);
- assertFalse(openOnUtil.openOnByOption("managerImpl", className, CDIConstants.SHOW_ALL_ASSIGNABLE));
- openOnUtil.openOnByOption("managerImpl", className, CDIConstants.OPEN_INJECT_BEAN);
+ assertFalse(openOnUtil.openOnByOption("managerImpl", APPLICATION_CLASS, CDIConstants.SHOW_ALL_ASSIGNABLE));
+ openOnUtil.openOnByOption("managerImpl", APPLICATION_CLASS, CDIConstants.OPEN_INJECT_BEAN);
String destinationFile = getEd().getTitle();
assertTrue("ERROR: redirected to " + destinationFile,
destinationFile.equals("DefaultOne.java"));
@@ -53,9 +56,9 @@
"Manager", null, null).finish();
packageExplorer.openFile(getProjectName(), CDIConstants.SRC,
- getPackageName(), className);
+ getPackageName(), APPLICATION_CLASS);
- assertTrue(openOnUtil.openOnByOption("managerImpl", className, CDIConstants.SHOW_ALL_ASSIGNABLE));
+ assertTrue(openOnUtil.openOnByOption("managerImpl", APPLICATION_CLASS, CDIConstants.SHOW_ALL_ASSIGNABLE));
AssignableBeansDialogExt assignDialog = new AssignableBeansDialogExt(bot.shell("Assignable Beans"));
@@ -69,7 +72,7 @@
assertTrue(allBeans.size() == 1);
assertTrue(allBeans.get(0).contains("DefaultOne"));
- openOnUtil.openOnByOption("managerImpl", className, CDIConstants.OPEN_INJECT_BEAN);
+ openOnUtil.openOnByOption("managerImpl", APPLICATION_CLASS, CDIConstants.OPEN_INJECT_BEAN);
String destinationFile = getEd().getTitle();
assertTrue("ERROR: redirected to " + destinationFile,
destinationFile.equals("DefaultOne.java"));
@@ -83,9 +86,9 @@
"Manager", null, null).finish();
packageExplorer.openFile(getProjectName(), CDIConstants.SRC,
- getPackageName(), className);
+ getPackageName(), APPLICATION_CLASS);
- assertTrue(openOnUtil.openOnByOption("managerImpl", className, CDIConstants.SHOW_ALL_ASSIGNABLE));
+ assertTrue(openOnUtil.openOnByOption("managerImpl", APPLICATION_CLASS, CDIConstants.SHOW_ALL_ASSIGNABLE));
AssignableBeansDialogExt assignDialog = new AssignableBeansDialogExt(bot.shell("Assignable Beans"));
@@ -99,7 +102,7 @@
assertTrue(allBeans.size() == 1);
assertTrue(allBeans.get(0).contains("ManagerImpl"));
- openOnUtil.openOnByOption("managerImpl", className, CDIConstants.OPEN_INJECT_BEAN);
+ openOnUtil.openOnByOption("managerImpl", APPLICATION_CLASS, CDIConstants.OPEN_INJECT_BEAN);
String destinationFile = getEd().getTitle();
assertTrue("ERROR: redirected to " + destinationFile,
destinationFile.equals("ManagerImpl.java"));
@@ -113,9 +116,9 @@
"Manager", null, null).finish();
packageExplorer.openFile(getProjectName(), CDIConstants.SRC,
- getPackageName(), className);
+ getPackageName(), APPLICATION_CLASS);
- assertTrue(openOnUtil.openOnByOption("managerImpl", className, CDIConstants.SHOW_ALL_ASSIGNABLE));
+ assertTrue(openOnUtil.openOnByOption("managerImpl", APPLICATION_CLASS, CDIConstants.SHOW_ALL_ASSIGNABLE));
AssignableBeansDialogExt assignDialog = new AssignableBeansDialogExt(bot.shell("Assignable Beans"));
@@ -132,7 +135,7 @@
assertTrue(allBeans.size() == 1);
assertTrue(allBeans.get(0).contains("ManagerImpl"));
- openOnUtil.openOnByOption("managerImpl", className, CDIConstants.OPEN_INJECT_BEAN);
+ openOnUtil.openOnByOption("managerImpl", APPLICATION_CLASS, CDIConstants.OPEN_INJECT_BEAN);
String destinationFile = getEd().getTitle();
assertTrue("ERROR: redirected to " + destinationFile,
destinationFile.equals("ManagerImpl.java"));
Modified: trunk/cdi/tests/org.jboss.tools.cdi.seam3.bot.test/src/org/jboss/tools/cdi/seam3/bot/test/tests/ExactAnnotationTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.seam3.bot.test/src/org/jboss/tools/cdi/seam3/bot/test/tests/ExactAnnotationTest.java 2012-05-08 10:41:25 UTC (rev 40845)
+++ trunk/cdi/tests/org.jboss.tools.cdi.seam3.bot.test/src/org/jboss/tools/cdi/seam3/bot/test/tests/ExactAnnotationTest.java 2012-05-08 11:17:39 UTC (rev 40846)
@@ -13,22 +13,20 @@
import org.jboss.tools.cdi.bot.test.CDIConstants;
import org.jboss.tools.cdi.seam3.bot.test.base.SolderAnnotationTestBase;
-import org.jboss.tools.cdi.seam3.bot.test.util.SeamLibraries;
+import org.jboss.tools.cdi.seam3.bot.test.util.SeamLibrary;
import org.junit.Test;
+/**
+ *
+ * @author jjankovi
+ *
+ */
public class ExactAnnotationTest extends SolderAnnotationTestBase {
- private String className = "Application.java";
-
private final String EXACT_INTERFACE = "exact-interface";
private final String EXACT_BEANS = "exact-beans";
@Override
- public String getProjectName() {
- return "exact-interface";
- }
-
- @Override
public void prepareWorkspace() {
}
@@ -58,22 +56,22 @@
String peopleManager = "PeopleManager";
String otherManager = "OtherManager";
- importSeam3ProjectWithLibrary(projectName, SeamLibraries.SOLDER);
+ importSeam3ProjectWithLibrary(projectName, SeamLibrary.SOLDER);
setEd(packageExplorer.openFile(projectName, CDIConstants.SRC,
- getPackageName(), className).toTextEditor());
+ getPackageName(), APPLICATION_CLASS).toTextEditor());
- testAnnotationImproperValue(projectName, false);
+ testMultipleBeansValidationProblemExists(projectName);
editResourceUtil.replaceInEditor(managerClass, peopleManager + ".class");
- testAnnotationProperValue(projectName, peopleManager + ".class",
- peopleManager, false, null);
+ testProperInjectBean(projectName, peopleManager + ".class",
+ peopleManager);
- bot.editorByTitle(className).show();
+ bot.editorByTitle(APPLICATION_CLASS).show();
editResourceUtil.replaceInEditor(peopleManager + ".class", otherManager + ".class");
- testAnnotationProperValue(projectName, otherManager + ".class",
- otherManager, false, null);
+ testProperInjectBean(projectName, otherManager + ".class",
+ otherManager);
}
Modified: trunk/cdi/tests/org.jboss.tools.cdi.seam3.bot.test/src/org/jboss/tools/cdi/seam3/bot/test/tests/FullyQualifiedTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.seam3.bot.test/src/org/jboss/tools/cdi/seam3/bot/test/tests/FullyQualifiedTest.java 2012-05-08 10:41:25 UTC (rev 40845)
+++ trunk/cdi/tests/org.jboss.tools.cdi.seam3.bot.test/src/org/jboss/tools/cdi/seam3/bot/test/tests/FullyQualifiedTest.java 2012-05-08 11:17:39 UTC (rev 40846)
@@ -18,20 +18,18 @@
import org.jboss.tools.cdi.bot.test.CDIConstants;
import org.jboss.tools.cdi.bot.test.annotations.ProblemsType;
import org.jboss.tools.cdi.bot.test.uiutils.CollectionsUtil;
-import org.jboss.tools.cdi.seam3.bot.test.base.SolderTestBase;
-import org.jboss.tools.cdi.seam3.bot.test.util.SeamLibraries;
+import org.jboss.tools.cdi.seam3.bot.test.base.SolderAnnotationTestBase;
+import org.jboss.tools.cdi.seam3.bot.test.util.SeamLibrary;
import org.junit.Test;
-public class FullyQualifiedTest extends SolderTestBase {
+/**
+ *
+ * @author jjankovi
+ *
+ */
+public class FullyQualifiedTest extends SolderAnnotationTestBase {
- private String APPLICATION_CLASS = "Application.java";
-
@Override
- public String getProjectName() {
- return "fullyQualified";
- }
-
- @Override
public void waitForJobs() {
projectExplorer.deleteAllProjects();
}
@@ -46,7 +44,7 @@
String projectName = "fullyQualified1";
- importSeam3ProjectWithLibrary(projectName, SeamLibraries.SOLDER);
+ importSeam3ProjectWithLibrary(projectName, SeamLibrary.SOLDER);
setEd(packageExplorer.openFile(projectName, CDIConstants.SRC,
getPackageName(), APPLICATION_CLASS).toTextEditor());
@@ -63,7 +61,7 @@
String projectName = "fullyQualified2";
- importSeam3ProjectWithLibrary(projectName, SeamLibraries.SOLDER);
+ importSeam3ProjectWithLibrary(projectName, SeamLibrary.SOLDER);
setEd(packageExplorer.openFile(projectName, CDIConstants.SRC,
getPackageName(), APPLICATION_CLASS).toTextEditor());
@@ -89,7 +87,7 @@
String projectName = "fullyQualified3";
- importSeam3ProjectWithLibrary(projectName, SeamLibraries.SOLDER);
+ importSeam3ProjectWithLibrary(projectName, SeamLibrary.SOLDER);
setEd(packageExplorer.openFile(projectName, CDIConstants.SRC,
getPackageName(), APPLICATION_CLASS).toTextEditor());
@@ -110,7 +108,7 @@
String projectName = "fullyQualified4";
String myBean1 = "MyBean1.java";
- importSeam3ProjectWithLibrary(projectName, SeamLibraries.SOLDER);
+ importSeam3ProjectWithLibrary(projectName, SeamLibrary.SOLDER);
setEd(packageExplorer.openFile(projectName, CDIConstants.SRC,
getPackageName(), myBean1).toTextEditor());
@@ -135,7 +133,7 @@
String projectName = "fullyQualified5";
- importSeam3ProjectWithLibrary(projectName, SeamLibraries.SOLDER);
+ importSeam3ProjectWithLibrary(projectName, SeamLibrary.SOLDER);
setEd(packageExplorer.openFile(projectName, CDIConstants.SRC,
getPackageName(), APPLICATION_CLASS).toTextEditor());
@@ -172,7 +170,7 @@
String projectName = "fullyQualified6";
- importSeam3ProjectWithLibrary(projectName, SeamLibraries.SOLDER);
+ importSeam3ProjectWithLibrary(projectName, SeamLibrary.SOLDER);
setEd(packageExplorer.openFile(projectName, CDIConstants.SRC,
getPackageName(), APPLICATION_CLASS).toTextEditor());
@@ -228,7 +226,7 @@
String projectName = "fullyQualified7";
- importSeam3ProjectWithLibrary(projectName, SeamLibraries.SOLDER);
+ importSeam3ProjectWithLibrary(projectName, SeamLibrary.SOLDER);
setEd(packageExplorer.openFile(projectName, CDIConstants.SRC,
getPackageName(), APPLICATION_CLASS).toTextEditor());
Modified: trunk/cdi/tests/org.jboss.tools.cdi.seam3.bot.test/src/org/jboss/tools/cdi/seam3/bot/test/tests/NamedPackagesTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.seam3.bot.test/src/org/jboss/tools/cdi/seam3/bot/test/tests/NamedPackagesTest.java 2012-05-08 10:41:25 UTC (rev 40845)
+++ trunk/cdi/tests/org.jboss.tools.cdi.seam3.bot.test/src/org/jboss/tools/cdi/seam3/bot/test/tests/NamedPackagesTest.java 2012-05-08 11:17:39 UTC (rev 40846)
@@ -19,6 +19,11 @@
import org.jboss.tools.cdi.seam3.bot.test.base.SolderTestBase;
import org.junit.Test;
+/**
+ *
+ * @author jjankovi
+ *
+ */
public class NamedPackagesTest extends SolderTestBase {
private final String CDI_SEAM_PACKAGE = "cdi.seam";
Modified: trunk/cdi/tests/org.jboss.tools.cdi.seam3.bot.test/src/org/jboss/tools/cdi/seam3/bot/test/tests/RequiresAnnotationTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.seam3.bot.test/src/org/jboss/tools/cdi/seam3/bot/test/tests/RequiresAnnotationTest.java 2012-05-08 10:41:25 UTC (rev 40845)
+++ trunk/cdi/tests/org.jboss.tools.cdi.seam3.bot.test/src/org/jboss/tools/cdi/seam3/bot/test/tests/RequiresAnnotationTest.java 2012-05-08 11:17:39 UTC (rev 40846)
@@ -13,17 +13,17 @@
import org.jboss.tools.cdi.bot.test.CDIConstants;
import org.jboss.tools.cdi.seam3.bot.test.base.SolderAnnotationTestBase;
-import org.jboss.tools.cdi.seam3.bot.test.util.SeamLibraries;
+import org.jboss.tools.cdi.seam3.bot.test.util.SeamLibrary;
import org.junit.Test;
+/**
+ *
+ * @author jjankovi
+ *
+ */
public class RequiresAnnotationTest extends SolderAnnotationTestBase {
@Override
- public String getProjectName() {
- return "requires1";
- }
-
- @Override
public void waitForJobs() {
projectExplorer.deleteAllProjects();
}
@@ -40,19 +40,19 @@
String manager = "Manager";
String projectName = "requires1";
- importSeam3ProjectWithLibrary(projectName, SeamLibraries.SOLDER);
+ importSeam3ProjectWithLibrary(projectName, SeamLibrary.SOLDER);
setEd(packageExplorer.openFile(projectName, CDIConstants.SRC,
getPackageName(), APPLICATION_CLASS).toTextEditor());
- testAnnotationImproperValue(projectName, true);
+ testNoBeanValidationProblemExists(projectName);
setEd(packageExplorer.openFile(projectName, CDIConstants.SRC,
getPackageName(), managerProducer + ".java").toTextEditor());
editResourceUtil.replaceInEditor("@Requires(\"cdi.test." + manager + "\")",
"@Requires(\"" + getPackageName() + "." + manager + "\")");
- testAnnotationProperValue(projectName, "managerProducer", managerProducer, false, null);
+ testProperInjectBean(projectName, "managerProducer", managerProducer);
}
@@ -63,19 +63,19 @@
String manager = "Manager";
String projectName = "requires2";
- importSeam3ProjectWithLibrary(projectName, SeamLibraries.SOLDER);
+ importSeam3ProjectWithLibrary(projectName, SeamLibrary.SOLDER);
setEd(packageExplorer.openFile(projectName, CDIConstants.SRC,
getPackageName(), APPLICATION_CLASS).toTextEditor());
- testAnnotationImproperValue(projectName, true);
+ testNoBeanValidationProblemExists(projectName);
setEd(packageExplorer.openFile(projectName, CDIConstants.SRC,
getPackageName(), managerProducer + ".java").toTextEditor());
editResourceUtil.replaceInEditor("@Requires(\"cdi.test." + manager + "\")",
"@Requires(\"" + getPackageName() + "." + manager + "\")");
- testAnnotationProperValue(projectName, "managerProducer", managerProducer, false, null);
+ testProperInjectBean(projectName, "managerProducer", managerProducer);
}
@@ -86,20 +86,20 @@
String manager = "Manager";
String projectName = "requires3";
- importSeam3ProjectWithLibrary(projectName, SeamLibraries.SOLDER);
+ importSeam3ProjectWithLibrary(projectName, SeamLibrary.SOLDER);
setEd(packageExplorer.openFile(projectName, CDIConstants.SRC,
getPackageName(), APPLICATION_CLASS).toTextEditor());
- testAnnotationImproperValue(projectName, true);
+ testNoBeanValidationProblemExists(projectName);
setEd(packageExplorer.openFile(projectName, CDIConstants.SRC,
getPackageName(), managerProducer + ".java").toTextEditor());
editResourceUtil.replaceInEditor("@Requires(\"cdi.test." + manager + "\")",
"@Requires(\"" + getPackageName() + "." + manager + "\")");
- testAnnotationProperValue(projectName, "managerProducer",
- managerProducer, true, "getManagerProducer");
+ testProperInjectProducer(projectName, "managerProducer",
+ managerProducer, "getManagerProducer");
}
@@ -110,20 +110,20 @@
String manager = "Manager";
String projectName = "requires4";
- importSeam3ProjectWithLibrary(projectName, SeamLibraries.SOLDER);
+ importSeam3ProjectWithLibrary(projectName, SeamLibrary.SOLDER);
setEd(packageExplorer.openFile(projectName, CDIConstants.SRC,
getPackageName(), APPLICATION_CLASS).toTextEditor());
- testAnnotationImproperValue(projectName, true);
+ testNoBeanValidationProblemExists(projectName);
setEd(packageExplorer.openFile(projectName, CDIConstants.SRC,
getPackageName(), managerProducer + ".java").toTextEditor());
editResourceUtil.replaceInEditor("@Requires(\"cdi.test." + manager + "\")",
"@Requires(\"" + getPackageName() + "." + manager + "\")");
- testAnnotationProperValue(projectName, "managerProducer",
- managerProducer, true, "managerProducer");
+ testProperInjectProducer(projectName, "managerProducer",
+ managerProducer, "managerProducer");
}
@@ -135,7 +135,7 @@
String projectName = "requires5";
String eventAttribute = "eventAttribute";
- importSeam3ProjectWithLibrary(projectName, SeamLibraries.SOLDER);
+ importSeam3ProjectWithLibrary(projectName, SeamLibrary.SOLDER);
setEd(packageExplorer.openFile(projectName, CDIConstants.SRC,
getPackageName(), APPLICATION_CLASS).toTextEditor());
Modified: trunk/cdi/tests/org.jboss.tools.cdi.seam3.bot.test/src/org/jboss/tools/cdi/seam3/bot/test/tests/VetoAnnotationTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.seam3.bot.test/src/org/jboss/tools/cdi/seam3/bot/test/tests/VetoAnnotationTest.java 2012-05-08 10:41:25 UTC (rev 40845)
+++ trunk/cdi/tests/org.jboss.tools.cdi.seam3.bot.test/src/org/jboss/tools/cdi/seam3/bot/test/tests/VetoAnnotationTest.java 2012-05-08 11:17:39 UTC (rev 40846)
@@ -13,17 +13,17 @@
import org.jboss.tools.cdi.bot.test.CDIConstants;
import org.jboss.tools.cdi.seam3.bot.test.base.SolderAnnotationTestBase;
-import org.jboss.tools.cdi.seam3.bot.test.util.SeamLibraries;
+import org.jboss.tools.cdi.seam3.bot.test.util.SeamLibrary;
import org.junit.Test;
+/**
+ *
+ * @author jjankovi
+ *
+ */
public class VetoAnnotationTest extends SolderAnnotationTestBase {
@Override
- public String getProjectName() {
- return "veto1";
- }
-
- @Override
public void waitForJobs() {
projectExplorer.deleteAllProjects();
}
@@ -40,19 +40,19 @@
String otherBean = "OtherBean";
String projectName = "veto1";
- importSeam3ProjectWithLibrary(projectName, SeamLibraries.SOLDER);
+ importSeam3ProjectWithLibrary(projectName, SeamLibrary.SOLDER);
setEd(packageExplorer.openFile(projectName, CDIConstants.SRC,
getPackageName(), APPLICATION_CLASS).toTextEditor());
- testAnnotationImproperValue(projectName, true);
+ testNoBeanValidationProblemExists(projectName);
setEd(packageExplorer.openFile(projectName, CDIConstants.SRC,
getPackageName(), otherBean + ".java").toTextEditor());
editResourceUtil.replaceInEditor("public class " + otherBean,
"public class " + otherBean + " extends " + vetoBean);
- testAnnotationProperValue(projectName, "bean", otherBean, false, null);
+ testProperInjectBean(projectName, "bean", otherBean);
}
@@ -63,19 +63,19 @@
String otherBean = "OtherBean";
String projectName = "veto2";
- importSeam3ProjectWithLibrary(projectName, SeamLibraries.SOLDER);
+ importSeam3ProjectWithLibrary(projectName, SeamLibrary.SOLDER);
setEd(packageExplorer.openFile(projectName, CDIConstants.SRC,
getPackageName(), APPLICATION_CLASS).toTextEditor());
- testAnnotationImproperValue(projectName, true);
+ testNoBeanValidationProblemExists(projectName);
setEd(packageExplorer.openFile(projectName, CDIConstants.SRC,
getPackageName(), otherBean + ".java").toTextEditor());
editResourceUtil.replaceInEditor("public class " + otherBean,
"public class " + otherBean + " extends " + vetoBean);
- testAnnotationProperValue(projectName, "bean", otherBean, false, null);
+ testProperInjectBean(projectName, "bean", otherBean);
}
@@ -85,20 +85,19 @@
String vetoBean = "Bean";
String projectName = "veto3";
- importSeam3ProjectWithLibrary(projectName, SeamLibraries.SOLDER);
+ importSeam3ProjectWithLibrary(projectName, SeamLibrary.SOLDER);
setEd(packageExplorer.openFile(projectName, CDIConstants.SRC,
getPackageName(), APPLICATION_CLASS).toTextEditor());
- testAnnotationImproperValue(projectName, true);
+ testNoBeanValidationProblemExists(projectName);
setEd(packageExplorer.openFile(projectName, CDIConstants.SRC,
getPackageName(), vetoBean + ".java").toTextEditor());
editResourceUtil.replaceInEditor("@Veto", "");
editResourceUtil.replaceInEditor("import org.jboss.seam.solder.core.Veto;", "");
- testAnnotationProperValue(projectName, "manager", vetoBean,
- true, "getManager");
+ testProperInjectProducer(projectName, "manager", vetoBean, "getManager");
}
@@ -108,20 +107,19 @@
String vetoBean = "Bean";
String projectName = "veto4";
- importSeam3ProjectWithLibrary(projectName, SeamLibraries.SOLDER);
+ importSeam3ProjectWithLibrary(projectName, SeamLibrary.SOLDER);
setEd(packageExplorer.openFile(projectName, CDIConstants.SRC,
getPackageName(), APPLICATION_CLASS).toTextEditor());
- testAnnotationImproperValue(projectName, true);
+ testNoBeanValidationProblemExists(projectName);
setEd(packageExplorer.openFile(projectName, CDIConstants.SRC,
getPackageName(), vetoBean + ".java").toTextEditor());
editResourceUtil.replaceInEditor("@Veto", "");
editResourceUtil.replaceInEditor("import org.jboss.seam.solder.core.Veto;", "");
- testAnnotationProperValue(projectName, "manager", vetoBean,
- true, "manager");
+ testProperInjectProducer(projectName, "manager", vetoBean, "manager");
}
@@ -132,7 +130,7 @@
String projectName = "veto5";
String eventAttribute = "eventAttribute";
- importSeam3ProjectWithLibrary(projectName, SeamLibraries.SOLDER);
+ importSeam3ProjectWithLibrary(projectName, SeamLibrary.SOLDER);
setEd(packageExplorer.openFile(projectName, CDIConstants.SRC,
getPackageName(), APPLICATION_CLASS).toTextEditor());
Modified: trunk/cdi/tests/org.jboss.tools.cdi.seam3.bot.test/src/org/jboss/tools/cdi/seam3/bot/test/uiutils/AssignableBeansDialogExt.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.seam3.bot.test/src/org/jboss/tools/cdi/seam3/bot/test/uiutils/AssignableBeansDialogExt.java 2012-05-08 10:41:25 UTC (rev 40845)
+++ trunk/cdi/tests/org.jboss.tools.cdi.seam3.bot.test/src/org/jboss/tools/cdi/seam3/bot/test/uiutils/AssignableBeansDialogExt.java 2012-05-08 11:17:39 UTC (rev 40846)
@@ -13,21 +13,27 @@
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
import org.jboss.tools.cdi.bot.test.uiutils.wizards.AssignableBeansDialog;
-
+/**
+ *
+ * @author jjankovi
+ *
+ */
public class AssignableBeansDialogExt extends AssignableBeansDialog {
+ private final String ELIMINATED_DEFAULT_BEAN = "Eliminated @DefaultBean";
+
public AssignableBeansDialogExt(SWTBotShell shell) {
super(shell);
showDefaultBeans();
}
public AssignableBeansDialog hideDefaultBeans() {
- getTreeItem("Eliminated @DefaultBean").uncheck();
+ getTreeItem(ELIMINATED_DEFAULT_BEAN).uncheck();
return this;
}
public AssignableBeansDialog showDefaultBeans() {
- getTreeItem("Eliminated @DefaultBean").check();
+ getTreeItem(ELIMINATED_DEFAULT_BEAN).check();
return this;
}
Modified: trunk/cdi/tests/org.jboss.tools.cdi.seam3.bot.test/src/org/jboss/tools/cdi/seam3/bot/test/util/LibraryHelper.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.seam3.bot.test/src/org/jboss/tools/cdi/seam3/bot/test/util/LibraryHelper.java 2012-05-08 10:41:25 UTC (rev 40845)
+++ trunk/cdi/tests/org.jboss.tools.cdi.seam3.bot.test/src/org/jboss/tools/cdi/seam3/bot/test/util/LibraryHelper.java 2012-05-08 11:17:39 UTC (rev 40846)
@@ -25,16 +25,22 @@
import org.jboss.tools.cdi.bot.test.CDIConstants;
import org.jboss.tools.cdi.seam3.bot.test.Activator;
import org.jboss.tools.ui.bot.ext.SWTBotExt;
+import org.jboss.tools.ui.bot.ext.SWTBotFactory;
import org.jboss.tools.ui.bot.ext.SWTUtilExt;
import org.jboss.tools.ui.bot.ext.helper.ContextMenuHelper;
import org.jboss.tools.ui.bot.ext.types.IDELabel;
import org.jboss.tools.ui.bot.ext.view.ProjectExplorer;
+/**
+ *
+ * @author jjankovi
+ *
+ */
public class LibraryHelper {
- private ProjectExplorer projectExplorer = new ProjectExplorer();
+ private ProjectExplorer projectExplorer = SWTBotFactory.getProjectexplorer();
- private SWTBotExt bot = new SWTBotExt();
+ private SWTBotExt bot = SWTBotFactory.getBot();
private SWTUtilExt util = new SWTUtilExt(bot);
Deleted: trunk/cdi/tests/org.jboss.tools.cdi.seam3.bot.test/src/org/jboss/tools/cdi/seam3/bot/test/util/SeamLibraries.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.seam3.bot.test/src/org/jboss/tools/cdi/seam3/bot/test/util/SeamLibraries.java 2012-05-08 10:41:25 UTC (rev 40845)
+++ trunk/cdi/tests/org.jboss.tools.cdi.seam3.bot.test/src/org/jboss/tools/cdi/seam3/bot/test/util/SeamLibraries.java 2012-05-08 11:17:39 UTC (rev 40846)
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010-2012 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
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-
-package org.jboss.tools.cdi.seam3.bot.test.util;
-
-public enum SeamLibraries {
-
- SOLDER, INTERNATIONAL;
-
- public String getName() {
- switch (this) {
- case SOLDER:
- return "seam-solder.jar";
- case INTERNATIONAL:
- return "seam-international.jar";
- default:
- throw new AssertionError("Unknown libraries");
- }
- }
-
-}
Added: trunk/cdi/tests/org.jboss.tools.cdi.seam3.bot.test/src/org/jboss/tools/cdi/seam3/bot/test/util/SeamLibrary.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.seam3.bot.test/src/org/jboss/tools/cdi/seam3/bot/test/util/SeamLibrary.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.seam3.bot.test/src/org/jboss/tools/cdi/seam3/bot/test/util/SeamLibrary.java 2012-05-08 11:17:39 UTC (rev 40846)
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2012 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
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.cdi.seam3.bot.test.util;
+
+/**
+ *
+ * @author jjankovi
+ *
+ */
+public enum SeamLibrary {
+
+ SOLDER, INTERNATIONAL, UNKNOWN;
+
+ public String getName() {
+ switch (this) {
+ case SOLDER:
+ return "seam-solder.jar";
+ case INTERNATIONAL:
+ return "seam-international.jar";
+ case UNKNOWN:
+ default:
+ throw new AssertionError("Unknown libraries");
+ }
+ }
+
+}
12 years, 8 months
JBoss Tools SVN: r40845 - in trunk: as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util and 3 other directories.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2012-05-08 06:41:25 -0400 (Tue, 08 May 2012)
New Revision: 40845
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBossServer.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/ServerCreationUtils.java
trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/util/ServerRuntimeUtils.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressServerUtils.java
trunk/runtime/plugins/org.jboss.tools.runtime.as.detector/src/org/jboss/tools/runtime/handlers/JBossASHandler.java
Log:
tools should use public API where possible
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBossServer.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBossServer.java 2012-05-08 08:27:08 UTC (rev 40844)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBossServer.java 2012-05-08 10:41:25 UTC (rev 40845)
@@ -71,6 +71,7 @@
setUsername("admin"); //$NON-NLS-1$
boolean defaultServerDeployment = isAS50() || isEAP(getServer());
setDeployLocationType(defaultServerDeployment ? IDeployableServer.DEPLOY_SERVER : IDeployableServer.DEPLOY_METADATA);
+ setAttribute(IDeployableServer.SERVER_MODE, LocalPublishMethod.LOCAL_PUBLISH_METHOD);
}
public static boolean isEAP(IServer server) {
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/ServerCreationUtils.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/ServerCreationUtils.java 2012-05-08 08:27:08 UTC (rev 40844)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/ServerCreationUtils.java 2012-05-08 10:41:25 UTC (rev 40845)
@@ -1,7 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
package org.jboss.ide.eclipse.as.core.util;
-import java.util.HashMap;
-
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
@@ -22,24 +30,6 @@
public class ServerCreationUtils {
- public static HashMap<String, String> runtimeServerTypeMap =
- new HashMap<String, String>();
- static {
- runtimeServerTypeMap.put(IJBossToolingConstants.AS_32, IJBossToolingConstants.SERVER_AS_32);
- runtimeServerTypeMap.put(IJBossToolingConstants.AS_40, IJBossToolingConstants.SERVER_AS_40);
- runtimeServerTypeMap.put(IJBossToolingConstants.AS_42, IJBossToolingConstants.SERVER_AS_42);
- runtimeServerTypeMap.put(IJBossToolingConstants.AS_50, IJBossToolingConstants.SERVER_AS_50);
- runtimeServerTypeMap.put(IJBossToolingConstants.AS_51, IJBossToolingConstants.SERVER_AS_51);
- runtimeServerTypeMap.put(IJBossToolingConstants.AS_60, IJBossToolingConstants.SERVER_AS_60);
- runtimeServerTypeMap.put(IJBossToolingConstants.AS_70, IJBossToolingConstants.SERVER_AS_70);
- runtimeServerTypeMap.put(IJBossToolingConstants.AS_71, IJBossToolingConstants.SERVER_AS_71);
- runtimeServerTypeMap.put(IJBossToolingConstants.EAP_43, IJBossToolingConstants.SERVER_EAP_43);
- runtimeServerTypeMap.put(IJBossToolingConstants.EAP_50, IJBossToolingConstants.SERVER_EAP_50);
- runtimeServerTypeMap.put(IJBossToolingConstants.EAP_60, IJBossToolingConstants.SERVER_EAP_60);
- // NEW_SERVER_ADAPTER Add the server / runtime mapping here
- }
-
-
public static IServer createDeployOnlyServer(String deployLocation, String tempDeployLocation,
String rtName, String serverName) throws CoreException {
IRuntimeType rt = ServerCore.findRuntimeType(IJBossToolingConstants.DEPLOY_ONLY_RUNTIME);
@@ -56,10 +46,6 @@
return server;
}
- public static IServer createServer2(String name, IRuntime currentRuntime) throws CoreException {
- return createServer2(currentRuntime, runtimeServerTypeMap.get(currentRuntime.getRuntimeType().getId()), name);
- }
-
public static IServer createServer2(IRuntime currentRuntime, String serverTypeId) throws CoreException {
return createServer2(currentRuntime, serverTypeId, serverTypeId);
}
Modified: trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/util/ServerRuntimeUtils.java
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/util/ServerRuntimeUtils.java 2012-05-08 08:27:08 UTC (rev 40844)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/util/ServerRuntimeUtils.java 2012-05-08 10:41:25 UTC (rev 40845)
@@ -130,7 +130,7 @@
public static IServer createMockJBoss7Server(String deployLocation, String tempDeployLocation) throws CoreException {
IRuntime runtime = RuntimeUtils.createRuntime(IJBossToolingConstants.AS_70, "/", "default");
- IServer s = ServerCreationUtils.createServer2(IJBossToolingConstants.SERVER_AS_70, runtime);
+ IServer s = ServerCreationUtils.createServer2(runtime, IJBossToolingConstants.SERVER_AS_70);
IServerWorkingCopy swc = s.createWorkingCopy();
swc.setServerConfiguration(null);
swc.setAttribute(DeployableServer.DEPLOY_DIRECTORY, deployLocation);
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressServerUtils.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressServerUtils.java 2012-05-08 08:27:08 UTC (rev 40844)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressServerUtils.java 2012-05-08 10:41:25 UTC (rev 40845)
@@ -29,6 +29,7 @@
import org.eclipse.wst.server.core.IServerAttributes;
import org.eclipse.wst.server.core.IServerType;
import org.eclipse.wst.server.core.IServerWorkingCopy;
+import org.eclipse.wst.server.core.ServerCore;
import org.eclipse.wst.server.core.internal.Server;
import org.eclipse.wst.server.core.internal.ServerWorkingCopy;
import org.jboss.ide.eclipse.as.core.server.IDeployableServer;
@@ -37,12 +38,12 @@
import org.jboss.ide.eclipse.as.core.util.IJBossToolingConstants;
import org.jboss.ide.eclipse.as.core.util.RuntimeUtils;
import org.jboss.ide.eclipse.as.core.util.ServerConverter;
-import org.jboss.ide.eclipse.as.core.util.ServerCreationUtils;
import org.jboss.tools.openshift.egit.core.EGitUtils;
import org.jboss.tools.openshift.express.internal.core.console.UserDelegate;
import org.jboss.tools.openshift.express.internal.core.console.UserModel;
import org.jboss.tools.openshift.express.internal.ui.OpenShiftUIActivator;
import org.jboss.tools.openshift.express.internal.ui.utils.Logger;
+import org.jboss.tools.openshift.express.internal.ui.utils.OpenShiftPasswordStorageKey;
import org.osgi.service.prefs.BackingStoreException;
import com.openshift.client.IApplication;
@@ -249,13 +250,24 @@
}
public static IServer createServer(IRuntime runtime, String serverID) throws CoreException {
- return ServerCreationUtils.createServer2(runtime, serverID, serverID, "openshift");
+ return createServer2(runtime, ServerCore.findServerType(serverID), serverID);
}
public static IServer createServer(IRuntime runtime, IServerType serverType, String serverName) throws CoreException {
- return ServerCreationUtils.createServer2(runtime, serverType, serverName, "openshift");
+ return createServer2(runtime, serverType, serverName);
}
+ public static IServer createServer2(IRuntime currentRuntime, IServerType serverType, String serverName) throws CoreException {
+ IServerWorkingCopy serverWC = serverType.createServer(null, null,
+ new NullProgressMonitor());
+ serverWC.setRuntime(currentRuntime);
+ serverWC.setName(serverName);
+ serverWC.setServerConfiguration(null);
+ serverWC.setAttribute(IDeployableServer.SERVER_MODE, ExpressBehaviourDelegate.OPENSHIFT_ID);
+ return serverWC.save(true, new NullProgressMonitor());
+ }
+
+
/**
* Returns true if the given server is an OpenShift one, false otherwise.
* @param server the server to check
Modified: trunk/runtime/plugins/org.jboss.tools.runtime.as.detector/src/org/jboss/tools/runtime/handlers/JBossASHandler.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime.as.detector/src/org/jboss/tools/runtime/handlers/JBossASHandler.java 2012-05-08 08:27:08 UTC (rev 40844)
+++ trunk/runtime/plugins/org.jboss.tools.runtime.as.detector/src/org/jboss/tools/runtime/handlers/JBossASHandler.java 2012-05-08 10:41:25 UTC (rev 40845)
@@ -43,13 +43,14 @@
import org.eclipse.wst.server.core.IRuntimeWorkingCopy;
import org.eclipse.wst.server.core.IServer;
import org.eclipse.wst.server.core.IServerType;
+import org.eclipse.wst.server.core.IServerWorkingCopy;
import org.eclipse.wst.server.core.ServerCore;
import org.eclipse.wst.server.core.ServerUtil;
import org.jboss.ide.eclipse.as.core.publishers.LocalPublishMethod;
+import org.jboss.ide.eclipse.as.core.server.IDeployableServer;
import org.jboss.ide.eclipse.as.core.server.bean.JBossServerType;
import org.jboss.ide.eclipse.as.core.server.bean.ServerBean;
import org.jboss.ide.eclipse.as.core.server.bean.ServerBeanLoader;
-import org.jboss.ide.eclipse.as.core.util.ServerCreationUtils;
import org.jboss.tools.runtime.as.detector.IJBossRuntimePluginConstants;
import org.jboss.tools.runtime.as.detector.Messages;
import org.jboss.tools.runtime.as.detector.RuntimeAsActivator;
@@ -255,8 +256,18 @@
}
}
IServerType serverType = ServerCore.findServerType(JBOSS_AS_TYPE_ID[index]);
- ServerCreationUtils.createServer2(runtime, serverType, name, LocalPublishMethod.LOCAL_PUBLISH_METHOD);
+ createServer2(runtime, serverType, name, LocalPublishMethod.LOCAL_PUBLISH_METHOD);
}
+
+ public static IServer createServer2(IRuntime currentRuntime, IServerType serverType, String serverName, String mode) throws CoreException {
+ IServerWorkingCopy serverWC = serverType.createServer(null, null,
+ new NullProgressMonitor());
+ serverWC.setRuntime(currentRuntime);
+ serverWC.setName(serverName);
+ serverWC.setServerConfiguration(null);
+ serverWC.setAttribute(IDeployableServer.SERVER_MODE, mode);
+ return serverWC.save(true, new NullProgressMonitor());
+ }
/**
* Creates HSQL DB Driver
12 years, 8 months
JBoss Tools SVN: r40844 - in trunk/seam/plugins: org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2012-05-08 04:27:08 -0400 (Tue, 08 May 2012)
New Revision: 40844
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/ResourceDeployer.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam23FacetInstallDelegate.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetAbstractInstallDelegate.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/SeamPerspectiveFactory.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamProjectWizard.java
Log:
seam tools should use public API where possible
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/ResourceDeployer.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/ResourceDeployer.java 2012-05-08 06:45:10 UTC (rev 40843)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/ResourceDeployer.java 2012-05-08 08:27:08 UTC (rev 40844)
@@ -20,11 +20,12 @@
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.IRuntimeType;
import org.eclipse.wst.server.core.IServer;
import org.eclipse.wst.server.core.IServerWorkingCopy;
+import org.eclipse.wst.server.core.ServerUtil;
import org.eclipse.wst.server.core.internal.ChainedJob;
import org.jboss.ide.eclipse.as.core.modules.SingleDeployableFactory;
-import org.jboss.ide.eclipse.as.core.server.internal.DeployableServerBehavior;
import org.jboss.tools.seam.core.SeamCoreMessages;
import org.jboss.tools.seam.core.SeamCorePlugin;
@@ -59,12 +60,9 @@
return new Status(Status.WARNING, SeamCorePlugin.PLUGIN_ID,
SeamCoreMessages.DATA_SOURCE_XML_DEPLOYER_NO_SERVER_SELECTED_TO_DEPLOY_DATASOURCE_TO);
}
- // convert it to a DeployableServer instance
- DeployableServerBehavior deployer = (DeployableServerBehavior) s
- .loadAdapter(DeployableServerBehavior.class, null);
-
- // if its not null, the adaptation worked.
- if (deployer == null) {
+ IRuntimeType rt = s.getServerType().getRuntimeType();
+ if (!ServerUtil.isSupportedModule(rt.getModuleTypes(),
+ SingleDeployableFactory.MODULE_TYPE, SingleDeployableFactory.VERSION)) {
return new Status(Status.WARNING, SeamCorePlugin.PLUGIN_ID,
SeamCoreMessages.DATA_SOURCE_XML_DEPLOYER_SERVER_DID_NOT_SUPPORT_DEPLOY_OF_DATASOURCE);
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam23FacetInstallDelegate.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam23FacetInstallDelegate.java 2012-05-08 06:45:10 UTC (rev 40843)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam23FacetInstallDelegate.java 2012-05-08 08:27:08 UTC (rev 40844)
@@ -24,9 +24,11 @@
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+import org.eclipse.wst.server.core.IRuntimeType;
import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.ServerUtil;
import org.eclipse.wst.server.core.internal.ChainedJob;
-import org.jboss.ide.eclipse.as.core.server.internal.JBossServer;
+import org.jboss.ide.eclipse.as.core.modules.SingleDeployableFactory;
import org.jboss.tools.jst.web.server.RegistrationHelper;
import org.jboss.tools.seam.core.SeamCorePlugin;
import org.jboss.tools.seam.core.project.facet.SeamRuntime;
@@ -187,10 +189,11 @@
} catch (CoreException e) {
SeamCorePlugin.getDefault().logError(e);
}
- JBossServer server = getJBossServer(model);
- if (server != null) {
- ChainedJob dsJob = new ResourceDeployer(project, server.getServer(), resource.getFullPath().removeFirstSegments(1));
- dsJob.setNextJob(RegistrationHelper.getRegisterInServerJob(project, new IServer[]{server.getServer()}, null));
+
+ IServer server = getServer(model);
+ if (serverSupportsSingleFileModule(server)) {
+ ChainedJob dsJob = new ResourceDeployer(project, server, resource.getFullPath().removeFirstSegments(1));
+ dsJob.setNextJob(RegistrationHelper.getRegisterInServerJob(project, new IServer[]{server}, null));
dsJob.schedule();
}
}
@@ -198,4 +201,13 @@
}
}
}
+
+ private static boolean serverSupportsSingleFileModule(IServer s) {
+ IRuntimeType rt = s.getServerType().getRuntimeType();
+ if (ServerUtil.isSupportedModule(rt.getModuleTypes(),
+ SingleDeployableFactory.MODULE_TYPE, SingleDeployableFactory.VERSION)) {
+ return true;
+ }
+ return false;
+ }
}
\ No newline at end of file
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetAbstractInstallDelegate.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetAbstractInstallDelegate.java 2012-05-08 06:45:10 UTC (rev 40843)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetAbstractInstallDelegate.java 2012-05-08 08:27:08 UTC (rev 40844)
@@ -89,7 +89,6 @@
import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
import org.eclipse.wst.server.core.IServer;
import org.eclipse.wst.server.core.ServerCore;
-import org.jboss.ide.eclipse.as.core.server.internal.JBossServer;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
import org.jboss.tools.seam.core.ISeamProject;
import org.jboss.tools.seam.core.SeamCoreMessages;
@@ -1353,20 +1352,4 @@
}
return server;
}
-
- /**
- * If the server defined in the model is a JBoss AS then return it.
- * @param model
- * @return
- */
- public static JBossServer getJBossServer(IDataModel model) {
- IServer server = getServer(model);
- if(server!=null) {
- JBossServer jbs = (JBossServer) server.loadAdapter(JBossServer.class, new NullProgressMonitor());
- if (jbs != null) {
- return jbs;
- }
- }
- return null;
- }
}
\ No newline at end of file
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/SeamPerspectiveFactory.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/SeamPerspectiveFactory.java 2012-05-08 06:45:10 UTC (rev 40843)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/SeamPerspectiveFactory.java 2012-05-08 08:27:08 UTC (rev 40844)
@@ -10,7 +10,6 @@
public class SeamPerspectiveFactory implements IPerspectiveFactory {
private static final String SEAM_COMPONENTS_NAVIGATOR = ISeamUiConstants.SEAM_COMPONENTS_VIEW_ID;
- private static String JBOSS_SERVERS_VIEW = "org.jboss.ide.eclipse.as.ui.views.JBossServerView"; //$NON-NLS-1$
private static String WTP_SERVERS_VIEW = "org.eclipse.wst.server.ui.ServersView"; //$NON-NLS-1$
public static final String PERSPECTIVE_ID = "org.jboss.tools.seam.ui.SeamPerspective"; //$NON-NLS-1$
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamProjectWizard.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamProjectWizard.java 2012-05-08 06:45:10 UTC (rev 40843)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamProjectWizard.java 2012-05-08 08:27:08 UTC (rev 40844)
@@ -76,7 +76,7 @@
import org.eclipse.wst.server.core.ServerCore;
import org.eclipse.wst.server.core.internal.ChainedJob;
import org.eclipse.wst.server.ui.ServerUIUtil;
-import org.jboss.ide.eclipse.as.core.server.internal.JBossServer;
+import org.jboss.ide.eclipse.as.core.server.IDeployableServer;
import org.jboss.tools.jst.web.server.RegistrationHelper;
import org.jboss.tools.seam.core.SeamCoreMessages;
import org.jboss.tools.seam.core.SeamCorePlugin;
@@ -85,8 +85,8 @@
import org.jboss.tools.seam.core.project.facet.SeamRuntimeManager;
import org.jboss.tools.seam.core.project.facet.SeamVersion;
import org.jboss.tools.seam.internal.core.project.facet.AntCopyUtils;
+import org.jboss.tools.seam.internal.core.project.facet.ISeamFacetDataModelProperties;
import org.jboss.tools.seam.internal.core.project.facet.ResourceDeployer;
-import org.jboss.tools.seam.internal.core.project.facet.ISeamFacetDataModelProperties;
import org.jboss.tools.seam.internal.core.project.facet.SeamFacetAbstractInstallDelegate;
import org.jboss.tools.seam.internal.core.project.facet.SeamFacetInstallDelegate;
import org.jboss.tools.seam.internal.core.project.facet.SeamFacetProjectCreationDataModelProvider;
@@ -414,7 +414,7 @@
IServer server = SeamFacetAbstractInstallDelegate.getServer(model);
if (server != null) {
- JBossServer jbs = (JBossServer) server.loadAdapter(JBossServer.class, new NullProgressMonitor());
+ IDeployableServer jbs = (IDeployableServer) server.loadAdapter(IDeployableServer.class, new NullProgressMonitor());
if (jbs != null) {
String[] driverJars = (String[]) model.getProperty(ISeamFacetDataModelProperties.JDBC_DRIVER_JAR_PATH);
if(driverJars!=null) {
12 years, 8 months
JBoss Tools SVN: r40843 - in trunk/as/plugins: org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/ejb3 and 4 other directories.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2012-05-08 02:45:10 -0400 (Tue, 08 May 2012)
New Revision: 40843
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/runtime/RuntimeClasspathCache.java
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/runtime/RuntimeKey.java
Removed:
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/ClasspathConstants.java
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/DirectoryLibraryContainerInitializer.java
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/RuntimeKey.java
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.ui/src/org/jboss/ide/eclipse/as/classpath/ui/DirectoryLibraryPage.java
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/ClasspathCorePlugin.java
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/ejb3/EJB3ClasspathContainer.java
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/runtime/ClientAllRuntimeClasspathProvider.java
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.ui/plugin.xml
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.ui/src/org/jboss/ide/eclipse/as/classpath/ui/containers/custom/CustomClasspathPreferencePage.java
Log:
Removal of cruft code and creation of a model class to simplify activator
Deleted: trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/ClasspathConstants.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/ClasspathConstants.java 2012-05-08 06:43:21 UTC (rev 40842)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/ClasspathConstants.java 2012-05-08 06:45:10 UTC (rev 40843)
@@ -1,18 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.ide.eclipse.as.classpath.core;
-
-import org.jboss.ide.eclipse.as.core.server.IJBossServerConstants;
-
-
-public interface ClasspathConstants extends IJBossServerConstants {
-
-}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/ClasspathCorePlugin.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/ClasspathCorePlugin.java 2012-05-08 06:43:21 UTC (rev 40842)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/ClasspathCorePlugin.java 2012-05-08 06:45:10 UTC (rev 40843)
@@ -10,20 +10,17 @@
******************************************************************************/
package org.jboss.ide.eclipse.as.classpath.core;
-import java.util.HashMap;
import java.util.Map;
import org.eclipse.core.runtime.ILog;
-import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Plugin;
import org.eclipse.core.runtime.Status;
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.wst.server.core.IRuntime;
-import org.eclipse.wst.server.core.IRuntimeLifecycleListener;
import org.eclipse.wst.server.core.ServerCore;
-import org.jboss.ide.eclipse.as.core.server.IJBossServerRuntime;
+import org.jboss.ide.eclipse.as.classpath.core.runtime.RuntimeClasspathCache;
+import org.jboss.ide.eclipse.as.classpath.core.runtime.RuntimeKey;
import org.osgi.framework.BundleContext;
/**
@@ -37,32 +34,6 @@
// The shared instance
private static ClasspathCorePlugin plugin;
- private static Map<RuntimeKey, IClasspathEntry[]> runtimeClasspaths;
-
- private IRuntimeLifecycleListener listener = new IRuntimeLifecycleListener() {
-
- public void runtimeRemoved(IRuntime runtime) {
- removeRuntimeClasspath(runtime);
- }
-
- public void runtimeChanged(IRuntime runtime) {
- removeRuntimeClasspath(runtime);
- }
-
- public void runtimeAdded(IRuntime runtime) {
-
- }
-
- private void removeRuntimeClasspath(IRuntime runtime) {
- if (runtime == null) {
- return;
- }
- RuntimeKey key = getRuntimeKey(runtime);
- if (key != null) {
- runtimeClasspaths.remove(key);
- }
- }
- };
/**
* The constructor
*/
@@ -76,8 +47,7 @@
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
- runtimeClasspaths = new HashMap<RuntimeKey, IClasspathEntry[]>();
- ServerCore.addRuntimeLifecycleListener(listener);
+ ServerCore.addRuntimeLifecycleListener(RuntimeClasspathCache.getInstance());
}
/*
@@ -87,8 +57,7 @@
public void stop(BundleContext context) throws Exception {
plugin = null;
super.stop(context);
- runtimeClasspaths = null;
- ServerCore.removeRuntimeLifecycleListener(listener);
+ ServerCore.removeRuntimeLifecycleListener(RuntimeClasspathCache.getInstance());
}
/**
@@ -107,17 +76,11 @@
}
public static Map<RuntimeKey, IClasspathEntry[]> getRuntimeClasspaths() {
- return runtimeClasspaths;
+ return RuntimeClasspathCache.getInstance().getRuntimeClasspaths();
}
public static RuntimeKey getRuntimeKey(IRuntime runtime) {
- if( runtime == null )
- return null;
-
- IJBossServerRuntime jbsrt = (IJBossServerRuntime)runtime.loadAdapter(IJBossServerRuntime.class, new NullProgressMonitor());
- IPath loc = runtime.getLocation();
- String rtID = runtime.getRuntimeType().getId();
- IPath configPath = jbsrt == null ? null : jbsrt.getConfigurationFullPath();
- return new RuntimeKey(loc, configPath, rtID);
+ return RuntimeClasspathCache.getRuntimeKey(runtime);
}
+
}
Deleted: trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/DirectoryLibraryContainerInitializer.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/DirectoryLibraryContainerInitializer.java 2012-05-08 06:43:21 UTC (rev 40842)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/DirectoryLibraryContainerInitializer.java 2012-05-08 06:45:10 UTC (rev 40843)
@@ -1,123 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.ide.eclipse.as.classpath.core;
-
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceProxy;
-import org.eclipse.core.resources.IResourceProxyVisitor;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.jdt.core.ClasspathContainerInitializer;
-import org.eclipse.jdt.core.IClasspathContainer;
-import org.eclipse.jdt.core.IClasspathEntry;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.JavaCore;
-
-// Can't extend abstractclasspathcontainer since it assumes libraries are within our plugins
-// TODO: need to implement resource change listeners like done in FlexibleProjectContainer to be usefull.
-public class DirectoryLibraryContainerInitializer extends ClasspathContainerInitializer {
-
- public static final String CONTAINER_ID = "org.jboss.ide.eclipse.as.classpath.core.DirectoryLibraryContainer"; //$NON-NLS-1$
-
- @Override
- public void initialize(IPath containerPath, IJavaProject project)
- throws CoreException {
- int size = containerPath.segmentCount();
- if (size > 0)
- {
- if (containerPath.segment(0).equals(this.getClasspathContainerID()))
- {
- IClasspathContainer container = this.createClasspathContainer(project, containerPath.removeFirstSegments(1));
- JavaCore.setClasspathContainer(containerPath, new IJavaProject[]
- {project}, new IClasspathContainer[]
- {container}, null);
- }
- }
- }
-
- private IClasspathContainer createClasspathContainer(IJavaProject project, IPath containerPath) {
- return new DirectoryLibraryContainer(project, containerPath);
- }
-
- private String getClasspathContainerID() {
- return CONTAINER_ID;
- }
-
- static class DirectoryLibraryContainer implements IClasspathContainer {
-
- private final IResource file;
-
- final IClasspathEntry[] entries;
-
- private final IPath containerPath;
-
- private final IJavaProject project;
-
- public DirectoryLibraryContainer(IJavaProject project, IPath containerPath) {
- this.project = project;
- this.containerPath = containerPath;
-
- this.file = project.getProject().getWorkspace().getRoot().getFolder(containerPath);
-
-
- final List<IClasspathEntry> libraries = new ArrayList<IClasspathEntry>();
-
- try {
- if(file!=null && file.exists()) {
- file.accept(new IResourceProxyVisitor() {
- public boolean visit(IResourceProxy proxy) /* throws CoreException */{
- switch(proxy.getType()) {
- case IResource.FILE :
- if (proxy.getName().endsWith(".jar") || proxy.getName().endsWith(".zip")) { //$NON-NLS-1$ //$NON-NLS-2$
- libraries.add(JavaCore.newLibraryEntry(proxy.requestFullPath(), null, null));
- }
- return false;
- case IResource.FOLDER :
- //TODO: recursive by default or ?
- return true;
- }
- return true;
- }
- }
- , IResource.NONE);
- }
- } catch (CoreException e) {
- // TODO: log
- e.printStackTrace();
- }
-
- entries = libraries.toArray(new IClasspathEntry[0]);
- }
-
- public IClasspathEntry[] getClasspathEntries() {
- return entries;
- }
-
- public String getDescription() {
- return file == null ?
- Messages.DirectoryLibraryContainerInitializer_libraries_found_no_dir :
- MessageFormat.format(Messages.DirectoryLibraryContainerInitializer_libraries_found_in_dir, file.getProjectRelativePath().toString());
- }
-
- public int getKind() {
- return K_APPLICATION;
- }
-
- public IPath getPath() {
- return file.getProjectRelativePath();
- }
- }
-
-}
Deleted: trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/RuntimeKey.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/RuntimeKey.java 2012-05-08 06:43:21 UTC (rev 40842)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/RuntimeKey.java 2012-05-08 06:45:10 UTC (rev 40843)
@@ -1,88 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.ide.eclipse.as.classpath.core;
-
-import org.eclipse.core.runtime.IPath;
-
-public class RuntimeKey {
- private IPath location;
- private IPath configPath;
- private String id;
-
- public RuntimeKey(IPath location, IPath configPath, String id) {
- this.location = location;
- this.configPath = configPath;
- this.id = id;
- }
-
- public IPath getLocation() {
- return location;
- }
-
- public void setLocation(IPath location) {
- this.location = location;
- }
-
- public IPath getConfigPath() {
- return configPath;
- }
-
- public void setConfigPath(IPath configPath) {
- this.configPath = configPath;
- }
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result
- + ((configPath == null) ? 0 : configPath.hashCode());
- result = prime * result + ((id == null) ? 0 : id.hashCode());
- result = prime * result
- + ((location == null) ? 0 : location.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- RuntimeKey other = (RuntimeKey) obj;
- if (configPath == null) {
- if (other.configPath != null)
- return false;
- } else if (!configPath.equals(other.configPath))
- return false;
- if (id == null) {
- if (other.id != null)
- return false;
- } else if (!id.equals(other.id))
- return false;
- if (location == null) {
- if (other.location != null)
- return false;
- } else if (!location.equals(other.location))
- return false;
- return true;
- }
-}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/ejb3/EJB3ClasspathContainer.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/ejb3/EJB3ClasspathContainer.java 2012-05-08 06:43:21 UTC (rev 40842)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/ejb3/EJB3ClasspathContainer.java 2012-05-08 06:45:10 UTC (rev 40843)
@@ -15,7 +15,6 @@
import java.util.ArrayList;
import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
@@ -29,16 +28,16 @@
import org.eclipse.jdt.launching.JavaRuntime;
import org.eclipse.wst.server.core.IServer;
import org.eclipse.wst.server.core.ServerCore;
-import org.jboss.ide.eclipse.as.classpath.core.ClasspathConstants;
import org.jboss.ide.eclipse.as.classpath.core.ClasspathCorePlugin;
import org.jboss.ide.eclipse.as.classpath.core.Messages;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerConstants;
import org.jboss.ide.eclipse.as.core.server.internal.JBossServer;
/**
* @author Marshall
* @author Rob Stryker
*/
-public class EJB3ClasspathContainer implements IClasspathContainer, ClasspathConstants {
+public class EJB3ClasspathContainer implements IClasspathContainer, IJBossServerConstants {
public static final String CONTAINER_ID = "org.jboss.ide.eclipse.as.classpath.core.ejb3.classpathContainer"; //$NON-NLS-1$
public static final String DESCRIPTION = Messages.EJB3ClasspathContainer_ejb3_description;
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/runtime/ClientAllRuntimeClasspathProvider.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/runtime/ClientAllRuntimeClasspathProvider.java 2012-05-08 06:43:21 UTC (rev 40842)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/runtime/ClientAllRuntimeClasspathProvider.java 2012-05-08 06:45:10 UTC (rev 40843)
@@ -29,11 +29,10 @@
import org.eclipse.jdt.launching.JavaRuntime;
import org.eclipse.jst.server.core.RuntimeClasspathProviderDelegate;
import org.eclipse.wst.server.core.IRuntime;
-import org.jboss.ide.eclipse.as.classpath.core.ClasspathConstants;
import org.jboss.ide.eclipse.as.classpath.core.ClasspathCorePlugin;
import org.jboss.ide.eclipse.as.classpath.core.Messages;
-import org.jboss.ide.eclipse.as.classpath.core.RuntimeKey;
import org.jboss.ide.eclipse.as.classpath.core.runtime.CustomRuntimeClasspathModel.IDefaultPathProvider;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerConstants;
/**
* This class uses the "throw everything you can find" strategy
@@ -45,7 +44,7 @@
*/
public class ClientAllRuntimeClasspathProvider
extends RuntimeClasspathProviderDelegate
- implements ClasspathConstants {
+ implements IJBossServerConstants {
public ClientAllRuntimeClasspathProvider() {
// TODO Auto-generated constructor stub
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/runtime/RuntimeClasspathCache.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/runtime/RuntimeClasspathCache.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/runtime/RuntimeClasspathCache.java 2012-05-08 06:45:10 UTC (rev 40843)
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.classpath.core.runtime;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.wst.server.core.IRuntime;
+import org.eclipse.wst.server.core.IRuntimeLifecycleListener;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerRuntime;
+
+public class RuntimeClasspathCache implements IRuntimeLifecycleListener {
+ private static RuntimeClasspathCache instance = null;
+ public static RuntimeClasspathCache getInstance() {
+ if( instance == null )
+ instance = new RuntimeClasspathCache();
+ return instance;
+ }
+
+
+ private Map<RuntimeKey, IClasspathEntry[]> runtimeClasspaths;
+
+ RuntimeClasspathCache() {
+ runtimeClasspaths = new HashMap<RuntimeKey, IClasspathEntry[]>();
+ }
+ public void runtimeRemoved(IRuntime runtime) {
+ removeRuntimeClasspath(runtime);
+ }
+
+ public void runtimeChanged(IRuntime runtime) {
+ removeRuntimeClasspath(runtime);
+ }
+
+ public void runtimeAdded(IRuntime runtime) {
+
+ }
+
+ private void removeRuntimeClasspath(IRuntime runtime) {
+ if (runtime == null) {
+ return;
+ }
+ RuntimeKey key = getRuntimeKey(runtime);
+ if (key != null) {
+ runtimeClasspaths.remove(key);
+ }
+ }
+
+ public Map<RuntimeKey, IClasspathEntry[]> getRuntimeClasspaths() {
+ return runtimeClasspaths;
+ }
+
+ public static RuntimeKey getRuntimeKey(IRuntime runtime) {
+ if( runtime == null )
+ return null;
+
+ IJBossServerRuntime jbsrt = (IJBossServerRuntime)runtime.loadAdapter(IJBossServerRuntime.class, new NullProgressMonitor());
+ IPath loc = runtime.getLocation();
+ String rtID = runtime.getRuntimeType().getId();
+ IPath configPath = jbsrt == null ? null : jbsrt.getConfigurationFullPath();
+ return new RuntimeKey(loc, configPath, rtID);
+ }
+
+}
Copied: trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/runtime/RuntimeKey.java (from rev 40814, trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/RuntimeKey.java)
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/runtime/RuntimeKey.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/runtime/RuntimeKey.java 2012-05-08 06:45:10 UTC (rev 40843)
@@ -0,0 +1,88 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.classpath.core.runtime;
+
+import org.eclipse.core.runtime.IPath;
+
+public class RuntimeKey {
+ private IPath location;
+ private IPath configPath;
+ private String id;
+
+ public RuntimeKey(IPath location, IPath configPath, String id) {
+ this.location = location;
+ this.configPath = configPath;
+ this.id = id;
+ }
+
+ public IPath getLocation() {
+ return location;
+ }
+
+ public void setLocation(IPath location) {
+ this.location = location;
+ }
+
+ public IPath getConfigPath() {
+ return configPath;
+ }
+
+ public void setConfigPath(IPath configPath) {
+ this.configPath = configPath;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result
+ + ((configPath == null) ? 0 : configPath.hashCode());
+ result = prime * result + ((id == null) ? 0 : id.hashCode());
+ result = prime * result
+ + ((location == null) ? 0 : location.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ RuntimeKey other = (RuntimeKey) obj;
+ if (configPath == null) {
+ if (other.configPath != null)
+ return false;
+ } else if (!configPath.equals(other.configPath))
+ return false;
+ if (id == null) {
+ if (other.id != null)
+ return false;
+ } else if (!id.equals(other.id))
+ return false;
+ if (location == null) {
+ if (other.location != null)
+ return false;
+ } else if (!location.equals(other.location))
+ return false;
+ return true;
+ }
+}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.ui/plugin.xml
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.ui/plugin.xml 2012-05-08 06:43:21 UTC (rev 40842)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.ui/plugin.xml 2012-05-08 06:45:10 UTC (rev 40843)
@@ -7,13 +7,6 @@
class="org.jboss.ide.eclipse.as.classpath.ui.ejb3.JBossEJB3LibrariesPage"
id="org.jboss.ide.eclipse.as.classpath.core.ejb3.classpathContainer"
name="JBoss EJB3 Libraries"/>
- <!-- Cannot be enabled before resource change listening is implementd (max)
- <classpathContainerPage
- class="org.jboss.ide.eclipse.as.classpath.ui.DirectoryLibraryPage"
- id="org.jboss.ide.eclipse.as.classpath.ui.libraryDirectoryPage"
- name="Directory with libraries">
- </classpathContainerPage>
- -->
</extension>
<extension
Deleted: trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.ui/src/org/jboss/ide/eclipse/as/classpath/ui/DirectoryLibraryPage.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.ui/src/org/jboss/ide/eclipse/as/classpath/ui/DirectoryLibraryPage.java 2012-05-08 06:43:21 UTC (rev 40842)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.ui/src/org/jboss/ide/eclipse/as/classpath/ui/DirectoryLibraryPage.java 2012-05-08 06:45:10 UTC (rev 40843)
@@ -1,119 +0,0 @@
-package org.jboss.ide.eclipse.as.classpath.ui;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.core.IClasspathEntry;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.ui.wizards.IClasspathContainerPage;
-import org.eclipse.jdt.ui.wizards.IClasspathContainerPageExtension;
-import org.eclipse.jdt.ui.wizards.NewElementWizardPage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.jboss.ide.eclipse.as.classpath.core.DirectoryLibraryContainerInitializer;
-
-public class DirectoryLibraryPage extends NewElementWizardPage implements
- IClasspathContainerPage, IClasspathContainerPageExtension {
- private IProject ownerProject;
- private String libsProjectName;
- private Combo projectsCombo;
-
- public DirectoryLibraryPage() {
- super("DirectoryLibrariesContainerPage"); //$NON-NLS-1$
-
- setTitle(Messages.DirectoryLibraryPage_Title);
- setDescription(Messages.DirectoryLibraryPage_Description);
- }
-
- public IClasspathEntry getSelection() {
- IPath path = new Path(DirectoryLibraryContainerInitializer.CONTAINER_ID);
-
- final int index = this.projectsCombo.getSelectionIndex();
- final String selectedProjectName = this.projectsCombo.getItem(index);
-
- if (this.ownerProject == null
- || !selectedProjectName.equals(this.ownerProject.getName())) {
- path = path.append(selectedProjectName);
- }
-
- return JavaCore.newContainerEntry(path);
- }
-
- public void setSelection(final IClasspathEntry cpentry) {
- final IPath path = cpentry == null ? null : cpentry.getPath();
-
- if (path == null || path.segmentCount() == 1) {
- if (this.ownerProject != null) {
- this.libsProjectName = this.ownerProject.getName();
- }
- } else {
- this.libsProjectName = path.segment(1);
- }
- }
-
- public void createControl(final Composite parent) {
- final Composite composite = new Composite(parent, SWT.NONE);
- composite.setLayout(new GridLayout(2, false));
-
- final Label label = new Label(composite, SWT.NONE);
- label.setText(Messages.DirectoryLibraryPage_LabelProject);
-
- final String[] webProjects = getWebProjects();
-
- this.projectsCombo = new Combo(composite, SWT.READ_ONLY);
- this.projectsCombo.setItems(webProjects);
-
- final int index;
-
- if (this.ownerProject != null) {
- index = indexOf(webProjects, this.libsProjectName);
- } else {
- if (this.projectsCombo.getItemCount() > 0) {
- index = 0;
- } else {
- index = -1;
- }
- }
-
- if (index != -1) {
- this.projectsCombo.select(index);
- }
-
- final GridData gd = new GridData();
- gd.grabExcessHorizontalSpace = true;
- gd.minimumWidth = 100;
-
- this.projectsCombo.setLayoutData(gd);
-
- setControl(composite);
- }
-
- public boolean finish() {
- return true;
- }
-
- public void initialize(final IJavaProject project,
- final IClasspathEntry[] currentEntries) {
- this.ownerProject = (project == null ? null : project.getProject());
- }
-
- private static String[] getWebProjects() {
- return new String[] { Messages.DirectoryLibraryPage_WebProjects };
- }
-
- private static int indexOf(final String[] array, final String str) {
- for (int i = 0; i < array.length; i++) {
- if (array[i].equals(str)) {
- return i;
- }
- }
-
- return -1;
- }
-
-}
\ No newline at end of file
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.ui/src/org/jboss/ide/eclipse/as/classpath/ui/containers/custom/CustomClasspathPreferencePage.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.ui/src/org/jboss/ide/eclipse/as/classpath/ui/containers/custom/CustomClasspathPreferencePage.java 2012-05-08 06:43:21 UTC (rev 40842)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.ui/src/org/jboss/ide/eclipse/as/classpath/ui/containers/custom/CustomClasspathPreferencePage.java 2012-05-08 06:45:10 UTC (rev 40843)
@@ -51,8 +51,8 @@
import org.jboss.ide.eclipse.archives.webtools.filesets.FilesetDialog;
import org.jboss.ide.eclipse.archives.webtools.filesets.FilesetLabelProvider;
import org.jboss.ide.eclipse.as.classpath.core.ClasspathCorePlugin;
-import org.jboss.ide.eclipse.as.classpath.core.RuntimeKey;
import org.jboss.ide.eclipse.as.classpath.core.runtime.CustomRuntimeClasspathModel;
+import org.jboss.ide.eclipse.as.classpath.core.runtime.RuntimeKey;
import org.jboss.ide.eclipse.as.classpath.core.runtime.CustomRuntimeClasspathModel.IDefaultPathProvider;
import org.jboss.ide.eclipse.as.classpath.ui.ClasspathUIPlugin;
import org.jboss.ide.eclipse.as.classpath.ui.Messages;
12 years, 8 months